@opencrvs/toolkit
Advanced tools
Comparing version
@@ -6,2 +6,3 @@ import { EventDocument } from '../events/EventDocument'; | ||
import { PartialSchema as AjvJSONSchemaType } from 'ajv/dist/types/json-schema'; | ||
import { userSerializer } from '../events/serializers/user/serializer'; | ||
/** @knipignore */ | ||
@@ -12,2 +13,3 @@ export type JSONSchema = { | ||
export declare function defineConditional(schema: any): JSONSchema; | ||
export declare function defineFormConditional(schema: Record<string, unknown>): JSONSchema; | ||
export type UserConditionalParameters = { | ||
@@ -53,6 +55,12 @@ $now: string; | ||
/** | ||
* Returns an JSON Schema object, which is treated as always invalid. | ||
* | ||
* @returns {JSONSchema} An schema object that always evaluates to false. | ||
*/ | ||
export declare function never(): JSONSchema; | ||
/** | ||
* | ||
* Generate conditional rules for user. | ||
*/ | ||
export declare const user: { | ||
export declare const user: typeof userSerializer & { | ||
hasScope: (scope: Scope) => JSONSchema; | ||
@@ -64,5 +72,13 @@ }; | ||
*/ | ||
export declare const event: { | ||
export declare function createEventConditionals(): { | ||
/** | ||
* Checks if the event contains a specific action type. | ||
* @param action - The action type to check for. | ||
*/ | ||
hasAction: (action: ActionType) => JSONSchema; | ||
}; | ||
type FieldReference = { | ||
_fieldId: string; | ||
[key: string]: unknown; | ||
}; | ||
/** | ||
@@ -76,3 +92,3 @@ * Generate conditional rules for a form field. | ||
*/ | ||
export declare function field(fieldId: string): { | ||
export declare function createFieldConditionals(fieldId: string): { | ||
isAfter: () => { | ||
@@ -83,3 +99,3 @@ days: (days: number) => { | ||
}; | ||
date: (date: string) => JSONSchema; | ||
date: (date: string | FieldReference) => JSONSchema; | ||
now: () => JSONSchema; | ||
@@ -92,6 +108,6 @@ }; | ||
}; | ||
date: (date: string) => JSONSchema; | ||
date: (date: string | FieldReference) => JSONSchema; | ||
now: () => JSONSchema; | ||
}; | ||
isEqualTo: (value: string | boolean) => JSONSchema; | ||
isEqualTo: (value: string | boolean | FieldReference) => JSONSchema; | ||
/** | ||
@@ -109,5 +125,14 @@ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected. | ||
isValidEnglishName: () => JSONSchema; | ||
/** | ||
* Checks if the field value matches a given regular expression pattern. | ||
* @param pattern - The regular expression pattern to match the field value against. | ||
* @returns A JSONSchema conditional that validates the field value against the pattern. | ||
*/ | ||
matches: (pattern: string) => JSONSchema; | ||
isBetween: (min: number, max: number) => JSONSchema; | ||
getId: () => { | ||
fieldId: string; | ||
}; | ||
}; | ||
export {}; | ||
//# sourceMappingURL=conditionals.d.ts.map |
@@ -6,5 +6,9 @@ import { ConditionalParameters, JSONSchema } from './conditionals'; | ||
import { TranslationConfig } from '../events/TranslationConfig'; | ||
import { FieldConditional } from '../events/Conditional'; | ||
export declare function validate(schema: JSONSchema, data: ConditionalParameters): boolean; | ||
export declare function isConditionMet(conditional: JSONSchema, values: Record<string, unknown>): boolean; | ||
export declare function areConditionsMet(conditions: FieldConditional[], values: Record<string, unknown>): boolean; | ||
export declare function isFieldVisible(field: FieldConfig, form: ActionUpdate | EventState): boolean; | ||
export declare function isFieldEnabled(field: FieldConfig, form: ActionUpdate | EventState): boolean; | ||
export declare function isFieldDisplayedOnReview(field: FieldConfig, form: ActionUpdate | EventState): boolean; | ||
export declare const errorMessages: { | ||
@@ -48,19 +52,2 @@ hiddenField: { | ||
/** | ||
* Checks if a field has validation errors based on its type and custom conditionals. | ||
* | ||
* @returns an array of error messages for the field | ||
*/ | ||
export declare function getFieldValidationErrors({ field, values }: { | ||
field: FieldConfig; | ||
values: ActionUpdate; | ||
}): { | ||
errors: { | ||
message: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
}[]; | ||
}; | ||
/** | ||
* Validates primitive fields defined by the FieldConfig type. | ||
@@ -76,2 +63,10 @@ * e.g. email is proper format, date is a valid date, etc. | ||
}[]; | ||
export declare function runFieldValidations({ field, values }: { | ||
field: FieldConfig; | ||
values: ActionUpdate; | ||
}): { | ||
errors: { | ||
message: TranslationConfig; | ||
}[]; | ||
}; | ||
//# sourceMappingURL=validate.d.ts.map |
@@ -0,1 +1,2 @@ | ||
import { z } from 'zod'; | ||
/** | ||
@@ -5,27 +6,35 @@ * Actions recognized by the system | ||
export declare const ActionType: { | ||
readonly DELETE: "DELETE"; | ||
readonly CREATE: "CREATE"; | ||
readonly ASSIGN: "ASSIGN"; | ||
readonly UNASSIGN: "UNASSIGN"; | ||
readonly NOTIFY: "NOTIFY"; | ||
readonly DECLARE: "DECLARE"; | ||
readonly VALIDATE: "VALIDATE"; | ||
readonly REGISTER: "REGISTER"; | ||
readonly VALIDATE: "VALIDATE"; | ||
readonly REQUEST_CORRECTION: "REQUEST_CORRECTION"; | ||
readonly REJECT_CORRECTION: "REJECT_CORRECTION"; | ||
readonly APPROVE_CORRECTION: "APPROVE_CORRECTION"; | ||
readonly DETECT_DUPLICATE: "DETECT_DUPLICATE"; | ||
readonly NOTIFY: "NOTIFY"; | ||
readonly DECLARE: "DECLARE"; | ||
readonly DELETE: "DELETE"; | ||
readonly PRINT_CERTIFICATE: "PRINT_CERTIFICATE"; | ||
readonly CUSTOM: "CUSTOM"; | ||
readonly REJECT: "REJECT"; | ||
readonly MARKED_AS_DUPLICATE: "MARKED_AS_DUPLICATE"; | ||
readonly ARCHIVE: "ARCHIVE"; | ||
readonly PRINT_CERTIFICATE: "PRINT_CERTIFICATE"; | ||
readonly REQUEST_CORRECTION: "REQUEST_CORRECTION"; | ||
readonly REJECT_CORRECTION: "REJECT_CORRECTION"; | ||
readonly APPROVE_CORRECTION: "APPROVE_CORRECTION"; | ||
readonly READ: "READ"; | ||
readonly ASSIGN: "ASSIGN"; | ||
readonly UNASSIGN: "UNASSIGN"; | ||
}; | ||
/** | ||
* Actions that can be attached to an event document | ||
* even if they are not in event configuration | ||
*/ | ||
export declare const LatentActions: ("REJECT" | "ARCHIVE")[]; | ||
export type ActionType = (typeof ActionType)[keyof typeof ActionType]; | ||
export declare const ConfirmableActions: readonly ["NOTIFY", "DECLARE", "VALIDATE", "REGISTER", "REJECT", "ARCHIVE", "PRINT_CERTIFICATE"]; | ||
/** Testing building types from enums as an alternative */ | ||
export declare const ActionTypes: z.ZodEnum<["DELETE", "CREATE", "NOTIFY", "DECLARE", "VALIDATE", "REGISTER", "DETECT_DUPLICATE", "REJECT", "MARKED_AS_DUPLICATE", "ARCHIVE", "PRINT_CERTIFICATE", "REQUEST_CORRECTION", "REJECT_CORRECTION", "APPROVE_CORRECTION", "READ", "ASSIGN", "UNASSIGN"]>; | ||
/** Actions which change event data (declaration) before registration / during declaration. */ | ||
export declare const DeclarationActions: z.ZodEnum<["DECLARE", "VALIDATE", "REGISTER"]>; | ||
export type DeclarationActionType = z.infer<typeof DeclarationActions>; | ||
/** Actions that can modify declaration data. Request can be corrected after declaring it. */ | ||
export declare const DeclarationUpdateActions: z.ZodEnum<["DECLARE", "VALIDATE", "REGISTER", "REQUEST_CORRECTION"]>; | ||
export type DeclarationUpdateActionType = z.infer<typeof DeclarationUpdateActions>; | ||
/** Actions which update annotation or status of an event. */ | ||
export declare const annotationActions: z.ZodEnum<["DELETE", "CREATE", "NOTIFY", "DETECT_DUPLICATE", "REJECT", "MARKED_AS_DUPLICATE", "ARCHIVE", "PRINT_CERTIFICATE", "REQUEST_CORRECTION", "REJECT_CORRECTION", "APPROVE_CORRECTION", "READ", "ASSIGN", "UNASSIGN"]>; | ||
export type AnnotationActionType = z.infer<typeof annotationActions>; | ||
/** Actions which requires the user to be assigned */ | ||
export declare const writeActions: z.ZodEnum<["DELETE", "NOTIFY", "DECLARE", "VALIDATE", "REGISTER", "DETECT_DUPLICATE", "REJECT", "MARKED_AS_DUPLICATE", "ARCHIVE", "PRINT_CERTIFICATE", "REQUEST_CORRECTION", "REJECT_CORRECTION", "APPROVE_CORRECTION"]>; | ||
//# sourceMappingURL=ActionType.d.ts.map |
import { z } from 'zod'; | ||
import { TranslationConfig } from './TranslationConfig'; | ||
export declare const SearchQueryParams: z.ZodObject<{ | ||
eventType: z.ZodOptional<z.ZodString>; | ||
}, "strip", z.ZodUnion<[z.ZodString, z.ZodString, z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodString], null>]>, z.ZodBoolean, z.ZodNumber, z.ZodObject<{ | ||
filename: z.ZodString; | ||
originalFilename: z.ZodString; | ||
type: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: string; | ||
filename: string; | ||
originalFilename: string; | ||
}, { | ||
type: string; | ||
filename: string; | ||
originalFilename: string; | ||
}>, z.ZodArray<z.ZodObject<{ | ||
filename: z.ZodString; | ||
originalFilename: z.ZodString; | ||
type: z.ZodString; | ||
option: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: string; | ||
option: string; | ||
filename: string; | ||
originalFilename: string; | ||
}, { | ||
type: string; | ||
option: string; | ||
filename: string; | ||
originalFilename: string; | ||
}>, "many">, z.ZodObject<z.objectUtil.extendShape<{ | ||
country: z.ZodString; | ||
addressType: z.ZodLiteral<"DOMESTIC">; | ||
province: z.ZodString; | ||
district: z.ZodString; | ||
}, { | ||
urbanOrRural: z.ZodLiteral<"URBAN">; | ||
town: z.ZodOptional<z.ZodString>; | ||
residentialArea: z.ZodOptional<z.ZodString>; | ||
street: z.ZodOptional<z.ZodString>; | ||
number: z.ZodOptional<z.ZodString>; | ||
zipCode: z.ZodOptional<z.ZodString>; | ||
}>, "strip", z.ZodTypeAny, { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "URBAN"; | ||
number?: string | undefined; | ||
town?: string | undefined; | ||
residentialArea?: string | undefined; | ||
street?: string | undefined; | ||
zipCode?: string | undefined; | ||
}, { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "URBAN"; | ||
number?: string | undefined; | ||
town?: string | undefined; | ||
residentialArea?: string | undefined; | ||
street?: string | undefined; | ||
zipCode?: string | undefined; | ||
}>, z.ZodObject<z.objectUtil.extendShape<{ | ||
country: z.ZodString; | ||
addressType: z.ZodLiteral<"DOMESTIC">; | ||
province: z.ZodString; | ||
district: z.ZodString; | ||
}, { | ||
urbanOrRural: z.ZodLiteral<"RURAL">; | ||
village: z.ZodOptional<z.ZodString>; | ||
}>, "strip", z.ZodTypeAny, { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "RURAL"; | ||
village?: string | undefined; | ||
}, { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "RURAL"; | ||
village?: string | undefined; | ||
}>, z.ZodUndefined, z.ZodObject<{ | ||
country: z.ZodString; | ||
addressType: z.ZodLiteral<"INTERNATIONAL">; | ||
state: z.ZodString; | ||
district2: z.ZodString; | ||
cityOrTown: z.ZodOptional<z.ZodString>; | ||
addressLine1: z.ZodOptional<z.ZodString>; | ||
addressLine2: z.ZodOptional<z.ZodString>; | ||
addressLine3: z.ZodOptional<z.ZodString>; | ||
postcodeOrZip: z.ZodOptional<z.ZodString>; | ||
}, "strip", z.ZodTypeAny, { | ||
country: string; | ||
state: string; | ||
addressType: "INTERNATIONAL"; | ||
district2: string; | ||
cityOrTown?: string | undefined; | ||
addressLine1?: string | undefined; | ||
addressLine2?: string | undefined; | ||
addressLine3?: string | undefined; | ||
postcodeOrZip?: string | undefined; | ||
}, { | ||
country: string; | ||
state: string; | ||
addressType: "INTERNATIONAL"; | ||
district2: string; | ||
cityOrTown?: string | undefined; | ||
addressLine1?: string | undefined; | ||
addressLine2?: string | undefined; | ||
addressLine3?: string | undefined; | ||
postcodeOrZip?: string | undefined; | ||
}>]>, z.objectOutputType<{ | ||
eventType: z.ZodOptional<z.ZodString>; | ||
}, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodString], null>]>, z.ZodBoolean, z.ZodNumber, z.ZodObject<{ | ||
filename: z.ZodString; | ||
originalFilename: z.ZodString; | ||
type: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: string; | ||
filename: string; | ||
originalFilename: string; | ||
}, { | ||
type: string; | ||
filename: string; | ||
originalFilename: string; | ||
}>, z.ZodArray<z.ZodObject<{ | ||
filename: z.ZodString; | ||
originalFilename: z.ZodString; | ||
type: z.ZodString; | ||
option: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: string; | ||
option: string; | ||
filename: string; | ||
originalFilename: string; | ||
}, { | ||
type: string; | ||
option: string; | ||
filename: string; | ||
originalFilename: string; | ||
}>, "many">, z.ZodObject<z.objectUtil.extendShape<{ | ||
country: z.ZodString; | ||
addressType: z.ZodLiteral<"DOMESTIC">; | ||
province: z.ZodString; | ||
district: z.ZodString; | ||
}, { | ||
urbanOrRural: z.ZodLiteral<"URBAN">; | ||
town: z.ZodOptional<z.ZodString>; | ||
residentialArea: z.ZodOptional<z.ZodString>; | ||
street: z.ZodOptional<z.ZodString>; | ||
number: z.ZodOptional<z.ZodString>; | ||
zipCode: z.ZodOptional<z.ZodString>; | ||
}>, "strip", z.ZodTypeAny, { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "URBAN"; | ||
number?: string | undefined; | ||
town?: string | undefined; | ||
residentialArea?: string | undefined; | ||
street?: string | undefined; | ||
zipCode?: string | undefined; | ||
}, { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "URBAN"; | ||
number?: string | undefined; | ||
town?: string | undefined; | ||
residentialArea?: string | undefined; | ||
street?: string | undefined; | ||
zipCode?: string | undefined; | ||
}>, z.ZodObject<z.objectUtil.extendShape<{ | ||
country: z.ZodString; | ||
addressType: z.ZodLiteral<"DOMESTIC">; | ||
province: z.ZodString; | ||
district: z.ZodString; | ||
}, { | ||
urbanOrRural: z.ZodLiteral<"RURAL">; | ||
village: z.ZodOptional<z.ZodString>; | ||
}>, "strip", z.ZodTypeAny, { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "RURAL"; | ||
village?: string | undefined; | ||
}, { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "RURAL"; | ||
village?: string | undefined; | ||
}>, z.ZodUndefined, z.ZodObject<{ | ||
country: z.ZodString; | ||
addressType: z.ZodLiteral<"INTERNATIONAL">; | ||
state: z.ZodString; | ||
district2: z.ZodString; | ||
cityOrTown: z.ZodOptional<z.ZodString>; | ||
addressLine1: z.ZodOptional<z.ZodString>; | ||
addressLine2: z.ZodOptional<z.ZodString>; | ||
addressLine3: z.ZodOptional<z.ZodString>; | ||
postcodeOrZip: z.ZodOptional<z.ZodString>; | ||
}, "strip", z.ZodTypeAny, { | ||
country: string; | ||
state: string; | ||
addressType: "INTERNATIONAL"; | ||
district2: string; | ||
cityOrTown?: string | undefined; | ||
addressLine1?: string | undefined; | ||
addressLine2?: string | undefined; | ||
addressLine3?: string | undefined; | ||
postcodeOrZip?: string | undefined; | ||
}, { | ||
country: string; | ||
state: string; | ||
addressType: "INTERNATIONAL"; | ||
district2: string; | ||
cityOrTown?: string | undefined; | ||
addressLine1?: string | undefined; | ||
addressLine2?: string | undefined; | ||
addressLine3?: string | undefined; | ||
postcodeOrZip?: string | undefined; | ||
}>]>, "strip">, z.objectInputType<{ | ||
eventType: z.ZodOptional<z.ZodString>; | ||
}, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodString], null>]>, z.ZodBoolean, z.ZodNumber, z.ZodObject<{ | ||
filename: z.ZodString; | ||
originalFilename: z.ZodString; | ||
type: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: string; | ||
filename: string; | ||
originalFilename: string; | ||
}, { | ||
type: string; | ||
filename: string; | ||
originalFilename: string; | ||
}>, z.ZodArray<z.ZodObject<{ | ||
filename: z.ZodString; | ||
originalFilename: z.ZodString; | ||
type: z.ZodString; | ||
option: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: string; | ||
option: string; | ||
filename: string; | ||
originalFilename: string; | ||
}, { | ||
type: string; | ||
option: string; | ||
filename: string; | ||
originalFilename: string; | ||
}>, "many">, z.ZodObject<z.objectUtil.extendShape<{ | ||
country: z.ZodString; | ||
addressType: z.ZodLiteral<"DOMESTIC">; | ||
province: z.ZodString; | ||
district: z.ZodString; | ||
}, { | ||
urbanOrRural: z.ZodLiteral<"URBAN">; | ||
town: z.ZodOptional<z.ZodString>; | ||
residentialArea: z.ZodOptional<z.ZodString>; | ||
street: z.ZodOptional<z.ZodString>; | ||
number: z.ZodOptional<z.ZodString>; | ||
zipCode: z.ZodOptional<z.ZodString>; | ||
}>, "strip", z.ZodTypeAny, { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "URBAN"; | ||
number?: string | undefined; | ||
town?: string | undefined; | ||
residentialArea?: string | undefined; | ||
street?: string | undefined; | ||
zipCode?: string | undefined; | ||
}, { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "URBAN"; | ||
number?: string | undefined; | ||
town?: string | undefined; | ||
residentialArea?: string | undefined; | ||
street?: string | undefined; | ||
zipCode?: string | undefined; | ||
}>, z.ZodObject<z.objectUtil.extendShape<{ | ||
country: z.ZodString; | ||
addressType: z.ZodLiteral<"DOMESTIC">; | ||
province: z.ZodString; | ||
district: z.ZodString; | ||
}, { | ||
urbanOrRural: z.ZodLiteral<"RURAL">; | ||
village: z.ZodOptional<z.ZodString>; | ||
}>, "strip", z.ZodTypeAny, { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "RURAL"; | ||
village?: string | undefined; | ||
}, { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "RURAL"; | ||
village?: string | undefined; | ||
}>, z.ZodUndefined, z.ZodObject<{ | ||
country: z.ZodString; | ||
addressType: z.ZodLiteral<"INTERNATIONAL">; | ||
state: z.ZodString; | ||
district2: z.ZodString; | ||
cityOrTown: z.ZodOptional<z.ZodString>; | ||
addressLine1: z.ZodOptional<z.ZodString>; | ||
addressLine2: z.ZodOptional<z.ZodString>; | ||
addressLine3: z.ZodOptional<z.ZodString>; | ||
postcodeOrZip: z.ZodOptional<z.ZodString>; | ||
}, "strip", z.ZodTypeAny, { | ||
country: string; | ||
state: string; | ||
addressType: "INTERNATIONAL"; | ||
district2: string; | ||
cityOrTown?: string | undefined; | ||
addressLine1?: string | undefined; | ||
addressLine2?: string | undefined; | ||
addressLine3?: string | undefined; | ||
postcodeOrZip?: string | undefined; | ||
}, { | ||
country: string; | ||
state: string; | ||
addressType: "INTERNATIONAL"; | ||
district2: string; | ||
cityOrTown?: string | undefined; | ||
addressLine1?: string | undefined; | ||
addressLine2?: string | undefined; | ||
addressLine3?: string | undefined; | ||
postcodeOrZip?: string | undefined; | ||
}>]>, "strip">>; | ||
export type SearchQueryParams = z.infer<typeof SearchQueryParams>; | ||
export declare const FieldConfigSchema: z.ZodObject<z.objectUtil.extendShape<{ | ||
config: z.ZodObject<{ | ||
type: z.ZodEnum<["fuzzy", "exact", "range"]>; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact" | "fuzzy" | "range"; | ||
}, { | ||
type: "exact" | "fuzzy" | "range"; | ||
}>; | ||
options: z.ZodOptional<z.ZodArray<z.ZodObject<{ | ||
value: z.ZodString; | ||
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>; | ||
}, "strip", z.ZodTypeAny, { | ||
value: string; | ||
label: TranslationConfig; | ||
}, { | ||
value: string; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
}>, "many">>; | ||
searchCriteriaLabelPrefix: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>>; | ||
conditionals: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<"type", import("./Conditional").FieldConditionalType[]>, "many">>>; | ||
}, { | ||
fieldId: z.ZodString; | ||
fieldType: z.ZodLiteral<"field">; | ||
}>, "strip", z.ZodTypeAny, { | ||
config: { | ||
type: "exact" | "fuzzy" | "range"; | ||
}; | ||
fieldId: string; | ||
fieldType: "field"; | ||
options?: { | ||
value: string; | ||
label: TranslationConfig; | ||
}[] | undefined; | ||
conditionals?: ({ | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "ENABLE"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "DISPLAY_ON_REVIEW"; | ||
conditional: import(".").JSONSchema; | ||
})[] | undefined; | ||
searchCriteriaLabelPrefix?: TranslationConfig | undefined; | ||
}, { | ||
config: { | ||
type: "exact" | "fuzzy" | "range"; | ||
}; | ||
fieldId: string; | ||
fieldType: "field"; | ||
options?: { | ||
value: string; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
}[] | undefined; | ||
conditionals?: ({ | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "ENABLE"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "DISPLAY_ON_REVIEW"; | ||
conditional: import(".").JSONSchema; | ||
})[] | undefined; | ||
searchCriteriaLabelPrefix?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
}>; | ||
export declare const EventFieldId: z.ZodEnum<["trackingId", "status", "legalStatus.REGISTERED.createdAt", "legalStatus.REGISTERED.createdAtLocation", "updatedAt"]>; | ||
export type EventFieldId = z.infer<typeof EventFieldId>; | ||
export declare const EventFieldConfigSchema: z.ZodObject<z.objectUtil.extendShape<{ | ||
config: z.ZodObject<{ | ||
type: z.ZodEnum<["fuzzy", "exact", "range"]>; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact" | "fuzzy" | "range"; | ||
}, { | ||
type: "exact" | "fuzzy" | "range"; | ||
}>; | ||
options: z.ZodOptional<z.ZodArray<z.ZodObject<{ | ||
value: z.ZodString; | ||
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>; | ||
}, "strip", z.ZodTypeAny, { | ||
value: string; | ||
label: TranslationConfig; | ||
}, { | ||
value: string; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
}>, "many">>; | ||
searchCriteriaLabelPrefix: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>>; | ||
conditionals: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<"type", import("./Conditional").FieldConditionalType[]>, "many">>>; | ||
}, { | ||
fieldId: z.ZodEnum<["trackingId", "status", "legalStatus.REGISTERED.createdAt", "legalStatus.REGISTERED.createdAtLocation", "updatedAt"]>; | ||
fieldType: z.ZodLiteral<"event">; | ||
}>, "strip", z.ZodTypeAny, { | ||
config: { | ||
type: "exact" | "fuzzy" | "range"; | ||
}; | ||
fieldId: "status" | "updatedAt" | "trackingId" | "legalStatus.REGISTERED.createdAt" | "legalStatus.REGISTERED.createdAtLocation"; | ||
fieldType: "event"; | ||
options?: { | ||
value: string; | ||
label: TranslationConfig; | ||
}[] | undefined; | ||
conditionals?: ({ | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "ENABLE"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "DISPLAY_ON_REVIEW"; | ||
conditional: import(".").JSONSchema; | ||
})[] | undefined; | ||
searchCriteriaLabelPrefix?: TranslationConfig | undefined; | ||
}, { | ||
config: { | ||
type: "exact" | "fuzzy" | "range"; | ||
}; | ||
fieldId: "status" | "updatedAt" | "trackingId" | "legalStatus.REGISTERED.createdAt" | "legalStatus.REGISTERED.createdAtLocation"; | ||
fieldType: "event"; | ||
options?: { | ||
value: string; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
}[] | undefined; | ||
conditionals?: ({ | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "ENABLE"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "DISPLAY_ON_REVIEW"; | ||
conditional: import(".").JSONSchema; | ||
})[] | undefined; | ||
searchCriteriaLabelPrefix?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
}>; | ||
export declare const SearchField: z.ZodDiscriminatedUnion<"fieldType", [z.ZodObject<z.objectUtil.extendShape<{ | ||
config: z.ZodObject<{ | ||
type: z.ZodEnum<["fuzzy", "exact", "range"]>; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact" | "fuzzy" | "range"; | ||
}, { | ||
type: "exact" | "fuzzy" | "range"; | ||
}>; | ||
options: z.ZodOptional<z.ZodArray<z.ZodObject<{ | ||
value: z.ZodString; | ||
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>; | ||
}, "strip", z.ZodTypeAny, { | ||
value: string; | ||
label: TranslationConfig; | ||
}, { | ||
value: string; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
}>, "many">>; | ||
searchCriteriaLabelPrefix: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>>; | ||
conditionals: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<"type", import("./Conditional").FieldConditionalType[]>, "many">>>; | ||
}, { | ||
fieldId: z.ZodString; | ||
fieldType: z.ZodLiteral<"field">; | ||
}>, "strip", z.ZodTypeAny, { | ||
config: { | ||
type: "exact" | "fuzzy" | "range"; | ||
}; | ||
fieldId: string; | ||
fieldType: "field"; | ||
options?: { | ||
value: string; | ||
label: TranslationConfig; | ||
}[] | undefined; | ||
conditionals?: ({ | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "ENABLE"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "DISPLAY_ON_REVIEW"; | ||
conditional: import(".").JSONSchema; | ||
})[] | undefined; | ||
searchCriteriaLabelPrefix?: TranslationConfig | undefined; | ||
}, { | ||
config: { | ||
type: "exact" | "fuzzy" | "range"; | ||
}; | ||
fieldId: string; | ||
fieldType: "field"; | ||
options?: { | ||
value: string; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
}[] | undefined; | ||
conditionals?: ({ | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "ENABLE"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "DISPLAY_ON_REVIEW"; | ||
conditional: import(".").JSONSchema; | ||
})[] | undefined; | ||
searchCriteriaLabelPrefix?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
}>, z.ZodObject<z.objectUtil.extendShape<{ | ||
config: z.ZodObject<{ | ||
type: z.ZodEnum<["fuzzy", "exact", "range"]>; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact" | "fuzzy" | "range"; | ||
}, { | ||
type: "exact" | "fuzzy" | "range"; | ||
}>; | ||
options: z.ZodOptional<z.ZodArray<z.ZodObject<{ | ||
value: z.ZodString; | ||
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>; | ||
}, "strip", z.ZodTypeAny, { | ||
value: string; | ||
label: TranslationConfig; | ||
}, { | ||
value: string; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
}>, "many">>; | ||
searchCriteriaLabelPrefix: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>>; | ||
conditionals: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<"type", import("./Conditional").FieldConditionalType[]>, "many">>>; | ||
}, { | ||
fieldId: z.ZodEnum<["trackingId", "status", "legalStatus.REGISTERED.createdAt", "legalStatus.REGISTERED.createdAtLocation", "updatedAt"]>; | ||
fieldType: z.ZodLiteral<"event">; | ||
}>, "strip", z.ZodTypeAny, { | ||
config: { | ||
type: "exact" | "fuzzy" | "range"; | ||
}; | ||
fieldId: "status" | "updatedAt" | "trackingId" | "legalStatus.REGISTERED.createdAt" | "legalStatus.REGISTERED.createdAtLocation"; | ||
fieldType: "event"; | ||
options?: { | ||
value: string; | ||
label: TranslationConfig; | ||
}[] | undefined; | ||
conditionals?: ({ | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "ENABLE"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "DISPLAY_ON_REVIEW"; | ||
conditional: import(".").JSONSchema; | ||
})[] | undefined; | ||
searchCriteriaLabelPrefix?: TranslationConfig | undefined; | ||
}, { | ||
config: { | ||
type: "exact" | "fuzzy" | "range"; | ||
}; | ||
fieldId: "status" | "updatedAt" | "trackingId" | "legalStatus.REGISTERED.createdAt" | "legalStatus.REGISTERED.createdAtLocation"; | ||
fieldType: "event"; | ||
options?: { | ||
value: string; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
}[] | undefined; | ||
conditionals?: ({ | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "ENABLE"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "DISPLAY_ON_REVIEW"; | ||
conditional: import(".").JSONSchema; | ||
})[] | undefined; | ||
searchCriteriaLabelPrefix?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
}>]>; | ||
export type SearchField = z.infer<typeof SearchField>; | ||
export declare const AdvancedSearchConfig: z.ZodObject<{ | ||
@@ -9,30 +702,218 @@ title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, { | ||
}>; | ||
fields: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{ | ||
fieldId: z.ZodString; | ||
config: z.ZodOptional<z.ZodObject<{ | ||
type: z.ZodEnum<["FUZZY", "EXACT", "RANGE"]>; | ||
fields: z.ZodArray<z.ZodDiscriminatedUnion<"fieldType", [z.ZodObject<z.objectUtil.extendShape<{ | ||
config: z.ZodObject<{ | ||
type: z.ZodEnum<["fuzzy", "exact", "range"]>; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "FUZZY" | "EXACT" | "RANGE"; | ||
type: "exact" | "fuzzy" | "range"; | ||
}, { | ||
type: "FUZZY" | "EXACT" | "RANGE"; | ||
type: "exact" | "fuzzy" | "range"; | ||
}>; | ||
options: z.ZodOptional<z.ZodArray<z.ZodObject<{ | ||
value: z.ZodString; | ||
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>; | ||
}, "strip", z.ZodTypeAny, { | ||
value: string; | ||
label: TranslationConfig; | ||
}, { | ||
value: string; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
}>, "many">>; | ||
searchCriteriaLabelPrefix: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>>; | ||
}, "strip", z.ZodTypeAny, { | ||
conditionals: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<"type", import("./Conditional").FieldConditionalType[]>, "many">>>; | ||
}, { | ||
fieldId: z.ZodString; | ||
fieldType: z.ZodLiteral<"field">; | ||
}>, "strip", z.ZodTypeAny, { | ||
config: { | ||
type: "exact" | "fuzzy" | "range"; | ||
}; | ||
fieldId: string; | ||
config?: { | ||
type: "FUZZY" | "EXACT" | "RANGE"; | ||
} | undefined; | ||
fieldType: "field"; | ||
options?: { | ||
value: string; | ||
label: TranslationConfig; | ||
}[] | undefined; | ||
conditionals?: ({ | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "ENABLE"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "DISPLAY_ON_REVIEW"; | ||
conditional: import(".").JSONSchema; | ||
})[] | undefined; | ||
searchCriteriaLabelPrefix?: TranslationConfig | undefined; | ||
}, { | ||
config: { | ||
type: "exact" | "fuzzy" | "range"; | ||
}; | ||
fieldId: string; | ||
config?: { | ||
type: "FUZZY" | "EXACT" | "RANGE"; | ||
fieldType: "field"; | ||
options?: { | ||
value: string; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
}[] | undefined; | ||
conditionals?: ({ | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "ENABLE"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "DISPLAY_ON_REVIEW"; | ||
conditional: import(".").JSONSchema; | ||
})[] | undefined; | ||
searchCriteriaLabelPrefix?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
}>, "many">>>; | ||
}>, z.ZodObject<z.objectUtil.extendShape<{ | ||
config: z.ZodObject<{ | ||
type: z.ZodEnum<["fuzzy", "exact", "range"]>; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact" | "fuzzy" | "range"; | ||
}, { | ||
type: "exact" | "fuzzy" | "range"; | ||
}>; | ||
options: z.ZodOptional<z.ZodArray<z.ZodObject<{ | ||
value: z.ZodString; | ||
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>; | ||
}, "strip", z.ZodTypeAny, { | ||
value: string; | ||
label: TranslationConfig; | ||
}, { | ||
value: string; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
}>, "many">>; | ||
searchCriteriaLabelPrefix: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>>; | ||
conditionals: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<"type", import("./Conditional").FieldConditionalType[]>, "many">>>; | ||
}, { | ||
fieldId: z.ZodEnum<["trackingId", "status", "legalStatus.REGISTERED.createdAt", "legalStatus.REGISTERED.createdAtLocation", "updatedAt"]>; | ||
fieldType: z.ZodLiteral<"event">; | ||
}>, "strip", z.ZodTypeAny, { | ||
config: { | ||
type: "exact" | "fuzzy" | "range"; | ||
}; | ||
fieldId: "status" | "updatedAt" | "trackingId" | "legalStatus.REGISTERED.createdAt" | "legalStatus.REGISTERED.createdAtLocation"; | ||
fieldType: "event"; | ||
options?: { | ||
value: string; | ||
label: TranslationConfig; | ||
}[] | undefined; | ||
conditionals?: ({ | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "ENABLE"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "DISPLAY_ON_REVIEW"; | ||
conditional: import(".").JSONSchema; | ||
})[] | undefined; | ||
searchCriteriaLabelPrefix?: TranslationConfig | undefined; | ||
}, { | ||
config: { | ||
type: "exact" | "fuzzy" | "range"; | ||
}; | ||
fieldId: "status" | "updatedAt" | "trackingId" | "legalStatus.REGISTERED.createdAt" | "legalStatus.REGISTERED.createdAtLocation"; | ||
fieldType: "event"; | ||
options?: { | ||
value: string; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
}[] | undefined; | ||
conditionals?: ({ | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "ENABLE"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "DISPLAY_ON_REVIEW"; | ||
conditional: import(".").JSONSchema; | ||
})[] | undefined; | ||
searchCriteriaLabelPrefix?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
}>]>, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
title: TranslationConfig; | ||
fields: { | ||
fields: ({ | ||
config: { | ||
type: "exact" | "fuzzy" | "range"; | ||
}; | ||
fieldId: string; | ||
config?: { | ||
type: "FUZZY" | "EXACT" | "RANGE"; | ||
} | undefined; | ||
}[]; | ||
fieldType: "field"; | ||
options?: { | ||
value: string; | ||
label: TranslationConfig; | ||
}[] | undefined; | ||
conditionals?: ({ | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "ENABLE"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "DISPLAY_ON_REVIEW"; | ||
conditional: import(".").JSONSchema; | ||
})[] | undefined; | ||
searchCriteriaLabelPrefix?: TranslationConfig | undefined; | ||
} | { | ||
config: { | ||
type: "exact" | "fuzzy" | "range"; | ||
}; | ||
fieldId: "status" | "updatedAt" | "trackingId" | "legalStatus.REGISTERED.createdAt" | "legalStatus.REGISTERED.createdAtLocation"; | ||
fieldType: "event"; | ||
options?: { | ||
value: string; | ||
label: TranslationConfig; | ||
}[] | undefined; | ||
conditionals?: ({ | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "ENABLE"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "DISPLAY_ON_REVIEW"; | ||
conditional: import(".").JSONSchema; | ||
})[] | undefined; | ||
searchCriteriaLabelPrefix?: TranslationConfig | undefined; | ||
})[]; | ||
}, { | ||
@@ -44,10 +925,64 @@ title: { | ||
}; | ||
fields?: { | ||
fields: ({ | ||
config: { | ||
type: "exact" | "fuzzy" | "range"; | ||
}; | ||
fieldId: string; | ||
config?: { | ||
type: "FUZZY" | "EXACT" | "RANGE"; | ||
fieldType: "field"; | ||
options?: { | ||
value: string; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
}[] | undefined; | ||
conditionals?: ({ | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "ENABLE"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "DISPLAY_ON_REVIEW"; | ||
conditional: import(".").JSONSchema; | ||
})[] | undefined; | ||
searchCriteriaLabelPrefix?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
}[] | undefined; | ||
} | { | ||
config: { | ||
type: "exact" | "fuzzy" | "range"; | ||
}; | ||
fieldId: "status" | "updatedAt" | "trackingId" | "legalStatus.REGISTERED.createdAt" | "legalStatus.REGISTERED.createdAtLocation"; | ||
fieldType: "event"; | ||
options?: { | ||
value: string; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
}[] | undefined; | ||
conditionals?: ({ | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "ENABLE"; | ||
conditional: import(".").JSONSchema; | ||
} | { | ||
type: "DISPLAY_ON_REVIEW"; | ||
conditional: import(".").JSONSchema; | ||
})[] | undefined; | ||
searchCriteriaLabelPrefix?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
})[]; | ||
}>; | ||
export type AdvancedSearchConfigInput = z.infer<typeof AdvancedSearchConfig>; | ||
export type AdvancedSearchConfig = z.infer<typeof AdvancedSearchConfig>; | ||
//# sourceMappingURL=AdvancedSearchConfig.d.ts.map |
@@ -120,2 +120,3 @@ import { z } from 'zod'; | ||
}>; | ||
export type UrbanAddressUpdateValue = z.infer<typeof UrbanAddressUpdateValue>; | ||
export declare const RuralAddressUpdateValue: z.ZodObject<z.objectUtil.extendShape<{ | ||
@@ -144,2 +145,3 @@ country: z.ZodString; | ||
}>; | ||
export type RuralAddressUpdateValue = z.infer<typeof RuralAddressUpdateValue>; | ||
export declare const GenericAddressValue: z.ZodObject<{ | ||
@@ -294,2 +296,3 @@ country: z.ZodString; | ||
}>; | ||
export type GenericAddressUpdateValue = z.infer<typeof GenericAddressUpdateValue>; | ||
export declare const AddressFieldUpdateValue: z.ZodUnion<[z.ZodDiscriminatedUnion<"urbanOrRural", [z.ZodObject<z.objectUtil.extendShape<{ | ||
@@ -296,0 +299,0 @@ country: z.ZodString; |
import { JSONSchema } from '../conditionals/conditionals'; | ||
import { z } from 'zod'; | ||
export declare function Conditional(): z.ZodType<JSONSchema, z.ZodTypeDef, JSONSchema>; | ||
export declare const Conditional: z.ZodType<JSONSchema, z.ZodTypeDef, JSONSchema>; | ||
/** | ||
@@ -8,7 +8,7 @@ * By default, when conditionals are undefined, action is visible and enabled to everyone. | ||
export declare const ConditionalType: { | ||
/** When 'SHOW' conditional is defined, the action is shown to the user only if the condition is met */ | ||
readonly SHOW: "SHOW"; | ||
/** If 'ENABLE' conditional is defined, the action is enabled only if the condition is met */ | ||
readonly ENABLE: "ENABLE"; | ||
readonly DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"; | ||
}; | ||
export type ConditionalType = (typeof ConditionalType)[keyof typeof ConditionalType]; | ||
export declare const ShowConditional: z.ZodObject<{ | ||
@@ -35,7 +35,23 @@ type: z.ZodLiteral<"SHOW">; | ||
/** @knipignore */ | ||
export type AllActionConditionalFields = typeof ShowConditional | typeof EnableConditional; | ||
export type ActionConditionalType = typeof ShowConditional | typeof EnableConditional; | ||
/** @knipignore */ | ||
export type InferredActionConditional = z.infer<typeof ShowConditional> | z.infer<typeof EnableConditional>; | ||
export declare const ActionConditional: z.ZodDiscriminatedUnion<"type", AllActionConditionalFields[]>; | ||
export declare const ActionConditional: z.ZodDiscriminatedUnion<"type", ActionConditionalType[]>; | ||
export type ActionConditional = InferredActionConditional; | ||
export declare const DisplayOnReviewConditional: z.ZodObject<{ | ||
type: z.ZodLiteral<"DISPLAY_ON_REVIEW">; | ||
conditional: z.ZodType<JSONSchema, z.ZodTypeDef, JSONSchema>; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "DISPLAY_ON_REVIEW"; | ||
conditional: JSONSchema; | ||
}, { | ||
type: "DISPLAY_ON_REVIEW"; | ||
conditional: JSONSchema; | ||
}>; | ||
/** @knipignore */ | ||
export type FieldConditionalType = typeof ShowConditional | typeof EnableConditional | typeof DisplayOnReviewConditional; | ||
/** @knipignore */ | ||
export type InferredFieldConditional = z.infer<typeof ShowConditional> | z.infer<typeof EnableConditional> | z.infer<typeof DisplayOnReviewConditional>; | ||
export declare const FieldConditional: z.ZodDiscriminatedUnion<"type", FieldConditionalType[]>; | ||
export type FieldConditional = z.infer<typeof FieldConditional>; | ||
//# sourceMappingURL=Conditional.d.ts.map |
import { z } from 'zod'; | ||
import { ActionType } from './ActionType'; | ||
export declare const Draft: z.ZodObject<{ | ||
@@ -10,5 +9,8 @@ id: z.ZodString; | ||
id: z.ZodString; | ||
transactionId: z.ZodString; | ||
createdAt: z.ZodString; | ||
createdBy: z.ZodString; | ||
data: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{ | ||
createdByRole: z.ZodString; | ||
createdAtLocation: z.ZodOptional<z.ZodNullable<z.ZodString>>; | ||
declaration: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodString], null>]>, z.ZodBoolean, z.ZodNumber, z.ZodObject<{ | ||
filename: z.ZodString; | ||
@@ -127,3 +129,3 @@ originalFilename: z.ZodString; | ||
}>]>>; | ||
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{ | ||
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodString], null>]>, z.ZodBoolean, z.ZodNumber, z.ZodObject<{ | ||
filename: z.ZodString; | ||
@@ -242,8 +244,14 @@ originalFilename: z.ZodString; | ||
}>]>>>; | ||
createdAtLocation: z.ZodString; | ||
status: z.ZodEnum<["Requested", "Accepted", "Rejected"]>; | ||
originalActionId: z.ZodOptional<z.ZodString>; | ||
}, { | ||
type: z.ZodEnum<[ActionType, ...ActionType[]]>; | ||
type: z.ZodEnum<["DELETE", "CREATE", "NOTIFY", "DECLARE", "VALIDATE", "REGISTER", "DETECT_DUPLICATE", "REJECT", "MARKED_AS_DUPLICATE", "ARCHIVE", "PRINT_CERTIFICATE", "REQUEST_CORRECTION", "REJECT_CORRECTION", "APPROVE_CORRECTION", "READ", "ASSIGN", "UNASSIGN"]>; | ||
}>, "id">, "strip", z.ZodTypeAny, { | ||
type: ActionType; | ||
data: Record<string, string | number | boolean | { | ||
type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "CREATE" | "NOTIFY" | "DETECT_DUPLICATE" | "REJECT" | "MARKED_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "READ" | "ASSIGN" | "UNASSIGN"; | ||
status: "Rejected" | "Requested" | "Accepted"; | ||
transactionId: string; | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
declaration: Record<string, string | number | boolean | { | ||
type: string; | ||
@@ -285,7 +293,5 @@ filename: string; | ||
originalFilename: string; | ||
}[] | undefined>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
metadata?: Record<string, string | number | boolean | { | ||
}[] | [string, string] | undefined>; | ||
createdAtLocation?: string | null | undefined; | ||
annotation?: Record<string, string | number | boolean | { | ||
type: string; | ||
@@ -327,6 +333,12 @@ filename: string; | ||
originalFilename: string; | ||
}[] | undefined> | undefined; | ||
}[] | [string, string] | undefined> | undefined; | ||
originalActionId?: string | undefined; | ||
}, { | ||
type: ActionType; | ||
data: Record<string, string | number | boolean | { | ||
type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "CREATE" | "NOTIFY" | "DETECT_DUPLICATE" | "REJECT" | "MARKED_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "READ" | "ASSIGN" | "UNASSIGN"; | ||
status: "Rejected" | "Requested" | "Accepted"; | ||
transactionId: string; | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
declaration: Record<string, string | number | boolean | { | ||
type: string; | ||
@@ -368,7 +380,5 @@ filename: string; | ||
originalFilename: string; | ||
}[] | undefined>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
metadata?: Record<string, string | number | boolean | { | ||
}[] | [string, string] | undefined>; | ||
createdAtLocation?: string | null | undefined; | ||
annotation?: Record<string, string | number | boolean | { | ||
type: string; | ||
@@ -410,12 +420,18 @@ filename: string; | ||
originalFilename: string; | ||
}[] | undefined> | undefined; | ||
}[] | [string, string] | undefined> | undefined; | ||
originalActionId?: string | undefined; | ||
}>; | ||
}, "strip", z.ZodTypeAny, { | ||
id: string; | ||
transactionId: string; | ||
createdAt: string; | ||
eventId: string; | ||
transactionId: string; | ||
action: { | ||
type: ActionType; | ||
data: Record<string, string | number | boolean | { | ||
type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "CREATE" | "NOTIFY" | "DETECT_DUPLICATE" | "REJECT" | "MARKED_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "READ" | "ASSIGN" | "UNASSIGN"; | ||
status: "Rejected" | "Requested" | "Accepted"; | ||
transactionId: string; | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
declaration: Record<string, string | number | boolean | { | ||
type: string; | ||
@@ -457,7 +473,5 @@ filename: string; | ||
originalFilename: string; | ||
}[] | undefined>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
metadata?: Record<string, string | number | boolean | { | ||
}[] | [string, string] | undefined>; | ||
createdAtLocation?: string | null | undefined; | ||
annotation?: Record<string, string | number | boolean | { | ||
type: string; | ||
@@ -499,12 +513,18 @@ filename: string; | ||
originalFilename: string; | ||
}[] | undefined> | undefined; | ||
}[] | [string, string] | undefined> | undefined; | ||
originalActionId?: string | undefined; | ||
}; | ||
}, { | ||
id: string; | ||
transactionId: string; | ||
createdAt: string; | ||
eventId: string; | ||
transactionId: string; | ||
action: { | ||
type: ActionType; | ||
data: Record<string, string | number | boolean | { | ||
type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "CREATE" | "NOTIFY" | "DETECT_DUPLICATE" | "REJECT" | "MARKED_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "READ" | "ASSIGN" | "UNASSIGN"; | ||
status: "Rejected" | "Requested" | "Accepted"; | ||
transactionId: string; | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
declaration: Record<string, string | number | boolean | { | ||
type: string; | ||
@@ -546,7 +566,5 @@ filename: string; | ||
originalFilename: string; | ||
}[] | undefined>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
metadata?: Record<string, string | number | boolean | { | ||
}[] | [string, string] | undefined>; | ||
createdAtLocation?: string | null | undefined; | ||
annotation?: Record<string, string | number | boolean | { | ||
type: string; | ||
@@ -588,3 +606,4 @@ filename: string; | ||
originalFilename: string; | ||
}[] | undefined> | undefined; | ||
}[] | [string, string] | undefined> | undefined; | ||
originalActionId?: string | undefined; | ||
}; | ||
@@ -595,3 +614,3 @@ }>; | ||
transactionId: z.ZodString; | ||
data: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{ | ||
declaration: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodString], null>]>, z.ZodBoolean, z.ZodNumber, z.ZodObject<{ | ||
filename: z.ZodString; | ||
@@ -709,4 +728,4 @@ originalFilename: z.ZodString; | ||
postcodeOrZip?: string | null | undefined; | ||
}>]>>; | ||
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{ | ||
}>]>>>; | ||
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodString], null>]>, z.ZodBoolean, z.ZodNumber, z.ZodObject<{ | ||
filename: z.ZodString; | ||
@@ -825,7 +844,12 @@ originalFilename: z.ZodString; | ||
}>]>>>; | ||
originalActionId: z.ZodOptional<z.ZodString>; | ||
keepAssignment: z.ZodOptional<z.ZodBoolean>; | ||
}, { | ||
type: z.ZodEnum<[ActionType, ...ActionType[]]>; | ||
type: z.ZodEnum<["DELETE", "CREATE", "NOTIFY", "DECLARE", "VALIDATE", "REGISTER", "DETECT_DUPLICATE", "REJECT", "MARKED_AS_DUPLICATE", "ARCHIVE", "PRINT_CERTIFICATE", "REQUEST_CORRECTION", "REJECT_CORRECTION", "APPROVE_CORRECTION", "READ", "ASSIGN", "UNASSIGN"]>; | ||
status: z.ZodEnum<["Requested", "Accepted", "Rejected"]>; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: ActionType; | ||
data: Record<string, string | number | boolean | { | ||
type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "CREATE" | "NOTIFY" | "DETECT_DUPLICATE" | "REJECT" | "MARKED_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "READ" | "ASSIGN" | "UNASSIGN"; | ||
status: "Rejected" | "Requested" | "Accepted"; | ||
transactionId: string; | ||
declaration: Record<string, string | number | boolean | { | ||
type: string; | ||
@@ -867,6 +891,5 @@ filename: string; | ||
originalFilename: string; | ||
}[] | undefined>; | ||
}[] | [string, string] | undefined>; | ||
eventId: string; | ||
transactionId: string; | ||
metadata?: Record<string, string | number | boolean | { | ||
annotation?: Record<string, string | number | boolean | { | ||
type: string; | ||
@@ -908,6 +931,11 @@ filename: string; | ||
originalFilename: string; | ||
}[] | undefined> | undefined; | ||
}[] | [string, string] | undefined> | undefined; | ||
originalActionId?: string | undefined; | ||
keepAssignment?: boolean | undefined; | ||
}, { | ||
type: ActionType; | ||
data: Record<string, string | number | boolean | { | ||
type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "CREATE" | "NOTIFY" | "DETECT_DUPLICATE" | "REJECT" | "MARKED_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "READ" | "ASSIGN" | "UNASSIGN"; | ||
status: "Rejected" | "Requested" | "Accepted"; | ||
transactionId: string; | ||
eventId: string; | ||
declaration?: Record<string, string | number | boolean | { | ||
type: string; | ||
@@ -949,6 +977,4 @@ filename: string; | ||
originalFilename: string; | ||
}[] | undefined>; | ||
eventId: string; | ||
transactionId: string; | ||
metadata?: Record<string, string | number | boolean | { | ||
}[] | [string, string] | undefined> | undefined; | ||
annotation?: Record<string, string | number | boolean | { | ||
type: string; | ||
@@ -990,3 +1016,5 @@ filename: string; | ||
originalFilename: string; | ||
}[] | undefined> | undefined; | ||
}[] | [string, string] | undefined> | undefined; | ||
originalActionId?: string | undefined; | ||
keepAssignment?: boolean | undefined; | ||
}>; | ||
@@ -993,0 +1021,0 @@ export type Draft = z.infer<typeof Draft>; |
import { z } from 'zod'; | ||
import { EventConfig } from './EventConfig'; | ||
import { FormConfig, FormConfigInput, FormPageConfig, FormPageConfigInput } from './FormConfig'; | ||
import { FormPageConfig, FormPageConfigInput, PageConfig, PageConfigInput } from './PageConfig'; | ||
import { ActionFormConfig, ActionFormConfigInput, DeclarationFormConfig, DeclarationFormConfigInput } from './FormConfig'; | ||
export type EventConfigInput = z.input<typeof EventConfig>; | ||
export declare const defineForm: (form: FormConfigInput) => FormConfig; | ||
export declare const defineDeclarationForm: (form: DeclarationFormConfigInput) => DeclarationFormConfig; | ||
export declare const defineActionForm: (actionForm: ActionFormConfigInput) => ActionFormConfig; | ||
export declare const definePage: (page: PageConfigInput) => PageConfig; | ||
export declare const defineFormPage: (formPage: FormPageConfigInput) => FormPageConfig; | ||
//# sourceMappingURL=EventConfigInput.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import { z } from 'zod'; | ||
import { z, ZodType } from 'zod'; | ||
export declare const EventIndex: z.ZodObject<z.objectUtil.extendShape<{ | ||
@@ -15,11 +15,206 @@ id: z.ZodString; | ||
}>; | ||
legalStatuses: z.ZodObject<{ | ||
DECLARED: z.ZodOptional<z.ZodNullable<z.ZodObject<{ | ||
createdAt: z.ZodString; | ||
createdBy: z.ZodString; | ||
createdAtLocation: z.ZodOptional<z.ZodNullable<z.ZodString>>; | ||
acceptedAt: z.ZodString; | ||
createdByRole: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
}, { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
}>>>; | ||
REGISTERED: z.ZodOptional<z.ZodNullable<z.ZodObject<z.objectUtil.extendShape<{ | ||
createdAt: z.ZodString; | ||
createdBy: z.ZodString; | ||
createdAtLocation: z.ZodOptional<z.ZodNullable<z.ZodString>>; | ||
acceptedAt: z.ZodString; | ||
createdByRole: z.ZodString; | ||
}, { | ||
registrationNumber: z.ZodString; | ||
}>, "strip", z.ZodTypeAny, { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
registrationNumber: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
}, { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
registrationNumber: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
}>>>; | ||
}, "strip", z.ZodTypeAny, { | ||
DECLARED?: { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
} | null | undefined; | ||
REGISTERED?: { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
registrationNumber: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
} | null | undefined; | ||
}, { | ||
DECLARED?: { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
} | null | undefined; | ||
REGISTERED?: { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
registrationNumber: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
} | null | undefined; | ||
}>; | ||
createdAt: z.ZodString; | ||
dateOfEvent: z.ZodOptional<z.ZodNullable<z.ZodString>>; | ||
createdBy: z.ZodString; | ||
createdAtLocation: z.ZodString; | ||
modifiedAt: z.ZodString; | ||
updatedByUserRole: z.ZodString; | ||
createdAtLocation: z.ZodOptional<z.ZodNullable<z.ZodString>>; | ||
updatedAtLocation: z.ZodOptional<z.ZodNullable<z.ZodString>>; | ||
updatedAt: z.ZodString; | ||
assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>; | ||
updatedBy: z.ZodString; | ||
updatedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>; | ||
trackingId: z.ZodString; | ||
flags: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNativeEnum<{ | ||
readonly CERTIFICATE_PRINTED: "certificate-printed"; | ||
}>]>, "many">; | ||
}, { | ||
data: z.ZodRecord<z.ZodString, z.ZodAny>; | ||
declaration: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodString], null>]>, z.ZodBoolean, z.ZodNumber, z.ZodObject<{ | ||
filename: z.ZodString; | ||
originalFilename: z.ZodString; | ||
type: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: string; | ||
filename: string; | ||
originalFilename: string; | ||
}, { | ||
type: string; | ||
filename: string; | ||
originalFilename: string; | ||
}>, z.ZodArray<z.ZodObject<{ | ||
filename: z.ZodString; | ||
originalFilename: z.ZodString; | ||
type: z.ZodString; | ||
option: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: string; | ||
option: string; | ||
filename: string; | ||
originalFilename: string; | ||
}, { | ||
type: string; | ||
option: string; | ||
filename: string; | ||
originalFilename: string; | ||
}>, "many">, z.ZodObject<z.objectUtil.extendShape<{ | ||
country: z.ZodString; | ||
addressType: z.ZodLiteral<"DOMESTIC">; | ||
province: z.ZodString; | ||
district: z.ZodString; | ||
}, { | ||
urbanOrRural: z.ZodLiteral<"URBAN">; | ||
town: z.ZodOptional<z.ZodString>; | ||
residentialArea: z.ZodOptional<z.ZodString>; | ||
street: z.ZodOptional<z.ZodString>; | ||
number: z.ZodOptional<z.ZodString>; | ||
zipCode: z.ZodOptional<z.ZodString>; | ||
}>, "strip", z.ZodTypeAny, { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "URBAN"; | ||
number?: string | undefined; | ||
town?: string | undefined; | ||
residentialArea?: string | undefined; | ||
street?: string | undefined; | ||
zipCode?: string | undefined; | ||
}, { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "URBAN"; | ||
number?: string | undefined; | ||
town?: string | undefined; | ||
residentialArea?: string | undefined; | ||
street?: string | undefined; | ||
zipCode?: string | undefined; | ||
}>, z.ZodObject<z.objectUtil.extendShape<{ | ||
country: z.ZodString; | ||
addressType: z.ZodLiteral<"DOMESTIC">; | ||
province: z.ZodString; | ||
district: z.ZodString; | ||
}, { | ||
urbanOrRural: z.ZodLiteral<"RURAL">; | ||
village: z.ZodOptional<z.ZodString>; | ||
}>, "strip", z.ZodTypeAny, { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "RURAL"; | ||
village?: string | undefined; | ||
}, { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "RURAL"; | ||
village?: string | undefined; | ||
}>, z.ZodUndefined, z.ZodObject<{ | ||
country: z.ZodString; | ||
addressType: z.ZodLiteral<"INTERNATIONAL">; | ||
state: z.ZodString; | ||
district2: z.ZodString; | ||
cityOrTown: z.ZodOptional<z.ZodString>; | ||
addressLine1: z.ZodOptional<z.ZodString>; | ||
addressLine2: z.ZodOptional<z.ZodString>; | ||
addressLine3: z.ZodOptional<z.ZodString>; | ||
postcodeOrZip: z.ZodOptional<z.ZodString>; | ||
}, "strip", z.ZodTypeAny, { | ||
country: string; | ||
state: string; | ||
addressType: "INTERNATIONAL"; | ||
district2: string; | ||
cityOrTown?: string | undefined; | ||
addressLine1?: string | undefined; | ||
addressLine2?: string | undefined; | ||
addressLine3?: string | undefined; | ||
postcodeOrZip?: string | undefined; | ||
}, { | ||
country: string; | ||
state: string; | ||
addressType: "INTERNATIONAL"; | ||
district2: string; | ||
cityOrTown?: string | undefined; | ||
addressLine1?: string | undefined; | ||
addressLine2?: string | undefined; | ||
addressLine3?: string | undefined; | ||
postcodeOrZip?: string | undefined; | ||
}>]>>; | ||
}>, "strip", z.ZodTypeAny, { | ||
@@ -29,10 +224,68 @@ type: string; | ||
status: "ARCHIVED" | "CERTIFIED" | "DECLARED" | "REGISTERED" | "REJECTED" | "VALIDATED" | "CREATED" | "NOTIFIED"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
declaration: Record<string, string | number | boolean | { | ||
type: string; | ||
filename: string; | ||
originalFilename: string; | ||
} | { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "URBAN"; | ||
number?: string | undefined; | ||
town?: string | undefined; | ||
residentialArea?: string | undefined; | ||
street?: string | undefined; | ||
zipCode?: string | undefined; | ||
} | { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "RURAL"; | ||
village?: string | undefined; | ||
} | { | ||
country: string; | ||
state: string; | ||
addressType: "INTERNATIONAL"; | ||
district2: string; | ||
cityOrTown?: string | undefined; | ||
addressLine1?: string | undefined; | ||
addressLine2?: string | undefined; | ||
addressLine3?: string | undefined; | ||
postcodeOrZip?: string | undefined; | ||
} | { | ||
type: string; | ||
option: string; | ||
filename: string; | ||
originalFilename: string; | ||
}[] | [string, string] | undefined>; | ||
updatedAt: string; | ||
trackingId: string; | ||
modifiedAt: string; | ||
updatedBy: string; | ||
legalStatuses: { | ||
DECLARED?: { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
} | null | undefined; | ||
REGISTERED?: { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
registrationNumber: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
} | null | undefined; | ||
}; | ||
updatedByUserRole: string; | ||
flags: string[]; | ||
createdAtLocation?: string | null | undefined; | ||
assignedTo?: string | null | undefined; | ||
dateOfEvent?: string | null | undefined; | ||
updatedAtLocation?: string | null | undefined; | ||
updatedBy?: string | null | undefined; | ||
}, { | ||
@@ -42,10 +295,68 @@ type: string; | ||
status: "ARCHIVED" | "CERTIFIED" | "DECLARED" | "REGISTERED" | "REJECTED" | "VALIDATED" | "CREATED" | "NOTIFIED"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
declaration: Record<string, string | number | boolean | { | ||
type: string; | ||
filename: string; | ||
originalFilename: string; | ||
} | { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "URBAN"; | ||
number?: string | undefined; | ||
town?: string | undefined; | ||
residentialArea?: string | undefined; | ||
street?: string | undefined; | ||
zipCode?: string | undefined; | ||
} | { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "RURAL"; | ||
village?: string | undefined; | ||
} | { | ||
country: string; | ||
state: string; | ||
addressType: "INTERNATIONAL"; | ||
district2: string; | ||
cityOrTown?: string | undefined; | ||
addressLine1?: string | undefined; | ||
addressLine2?: string | undefined; | ||
addressLine3?: string | undefined; | ||
postcodeOrZip?: string | undefined; | ||
} | { | ||
type: string; | ||
option: string; | ||
filename: string; | ||
originalFilename: string; | ||
}[] | [string, string] | undefined>; | ||
updatedAt: string; | ||
trackingId: string; | ||
modifiedAt: string; | ||
updatedBy: string; | ||
legalStatuses: { | ||
DECLARED?: { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
} | null | undefined; | ||
REGISTERED?: { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
registrationNumber: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
} | null | undefined; | ||
}; | ||
updatedByUserRole: string; | ||
flags: string[]; | ||
createdAtLocation?: string | null | undefined; | ||
assignedTo?: string | null | undefined; | ||
dateOfEvent?: string | null | undefined; | ||
updatedAtLocation?: string | null | undefined; | ||
updatedBy?: string | null | undefined; | ||
}>; | ||
@@ -61,2 +372,1003 @@ export declare const EventSearchIndex: z.ZodIntersection<z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodObject<{ | ||
export type EventIndex = z.infer<typeof EventIndex>; | ||
export declare const Fuzzy: z.ZodObject<{ | ||
type: z.ZodLiteral<"fuzzy">; | ||
term: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "fuzzy"; | ||
term: string; | ||
}, { | ||
type: "fuzzy"; | ||
term: string; | ||
}>; | ||
export declare const Exact: z.ZodObject<{ | ||
type: z.ZodLiteral<"exact">; | ||
term: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact"; | ||
term: string; | ||
}, { | ||
type: "exact"; | ||
term: string; | ||
}>; | ||
export declare const AnyOf: z.ZodObject<{ | ||
type: z.ZodLiteral<"anyOf">; | ||
terms: z.ZodArray<z.ZodString, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "anyOf"; | ||
terms: string[]; | ||
}, { | ||
type: "anyOf"; | ||
terms: string[]; | ||
}>; | ||
export declare const ExactStatus: z.ZodObject<{ | ||
type: z.ZodLiteral<"exact">; | ||
term: z.ZodEnum<["CREATED", "NOTIFIED", "DECLARED", "VALIDATED", "REGISTERED", "CERTIFIED", "REJECTED", "ARCHIVED"]>; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact"; | ||
term: "ARCHIVED" | "CERTIFIED" | "DECLARED" | "REGISTERED" | "REJECTED" | "VALIDATED" | "CREATED" | "NOTIFIED"; | ||
}, { | ||
type: "exact"; | ||
term: "ARCHIVED" | "CERTIFIED" | "DECLARED" | "REGISTERED" | "REJECTED" | "VALIDATED" | "CREATED" | "NOTIFIED"; | ||
}>; | ||
export declare const AnyOfStatus: z.ZodObject<{ | ||
type: z.ZodLiteral<"anyOf">; | ||
terms: z.ZodArray<z.ZodEnum<["CREATED", "NOTIFIED", "DECLARED", "VALIDATED", "REGISTERED", "CERTIFIED", "REJECTED", "ARCHIVED"]>, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "anyOf"; | ||
terms: ("ARCHIVED" | "CERTIFIED" | "DECLARED" | "REGISTERED" | "REJECTED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
}, { | ||
type: "anyOf"; | ||
terms: ("ARCHIVED" | "CERTIFIED" | "DECLARED" | "REGISTERED" | "REJECTED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
}>; | ||
export declare const Range: z.ZodObject<{ | ||
type: z.ZodLiteral<"range">; | ||
gte: z.ZodString; | ||
lte: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
}, { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
}>; | ||
export declare const Not: z.ZodObject<{ | ||
type: z.ZodLiteral<"not">; | ||
term: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "not"; | ||
term: string; | ||
}, { | ||
type: "not"; | ||
term: string; | ||
}>; | ||
export declare const Within: z.ZodObject<{ | ||
type: z.ZodLiteral<"within">; | ||
location: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "within"; | ||
location: string; | ||
}, { | ||
type: "within"; | ||
location: string; | ||
}>; | ||
export declare const DateCondition: z.ZodUnion<[z.ZodObject<{ | ||
type: z.ZodLiteral<"exact">; | ||
term: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact"; | ||
term: string; | ||
}, { | ||
type: "exact"; | ||
term: string; | ||
}>, z.ZodObject<{ | ||
type: z.ZodLiteral<"range">; | ||
gte: z.ZodString; | ||
lte: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
}, { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
}>]>; | ||
export declare const QueryInput: ZodType; | ||
export type BaseInput = z.infer<typeof Fuzzy> | z.infer<typeof Exact> | z.infer<typeof Range> | z.infer<typeof Within> | z.infer<typeof AnyOf> | z.infer<typeof Not>; | ||
type QueryMap = { | ||
[key: string]: BaseInput | QueryMap; | ||
}; | ||
export type QueryInputType = BaseInput | QueryMap; | ||
export declare const QueryExpression: z.ZodObject<{ | ||
eventType: z.ZodOptional<z.ZodString>; | ||
status: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodObject<{ | ||
type: z.ZodLiteral<"anyOf">; | ||
terms: z.ZodArray<z.ZodEnum<["CREATED", "NOTIFIED", "DECLARED", "VALIDATED", "REGISTERED", "CERTIFIED", "REJECTED", "ARCHIVED"]>, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "anyOf"; | ||
terms: ("ARCHIVED" | "CERTIFIED" | "DECLARED" | "REGISTERED" | "REJECTED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
}, { | ||
type: "anyOf"; | ||
terms: ("ARCHIVED" | "CERTIFIED" | "DECLARED" | "REGISTERED" | "REJECTED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
}>, z.ZodObject<{ | ||
type: z.ZodLiteral<"exact">; | ||
term: z.ZodEnum<["CREATED", "NOTIFIED", "DECLARED", "VALIDATED", "REGISTERED", "CERTIFIED", "REJECTED", "ARCHIVED"]>; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact"; | ||
term: "ARCHIVED" | "CERTIFIED" | "DECLARED" | "REGISTERED" | "REJECTED" | "VALIDATED" | "CREATED" | "NOTIFIED"; | ||
}, { | ||
type: "exact"; | ||
term: "ARCHIVED" | "CERTIFIED" | "DECLARED" | "REGISTERED" | "REJECTED" | "VALIDATED" | "CREATED" | "NOTIFIED"; | ||
}>]>>>; | ||
createdAt: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodObject<{ | ||
type: z.ZodLiteral<"exact">; | ||
term: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact"; | ||
term: string; | ||
}, { | ||
type: "exact"; | ||
term: string; | ||
}>, z.ZodObject<{ | ||
type: z.ZodLiteral<"range">; | ||
gte: z.ZodString; | ||
lte: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
}, { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
}>]>>>; | ||
updatedAt: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodObject<{ | ||
type: z.ZodLiteral<"exact">; | ||
term: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact"; | ||
term: string; | ||
}, { | ||
type: "exact"; | ||
term: string; | ||
}>, z.ZodObject<{ | ||
type: z.ZodLiteral<"range">; | ||
gte: z.ZodString; | ||
lte: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
}, { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
}>]>>>; | ||
'legalStatus.REGISTERED.createdAt': z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodObject<{ | ||
type: z.ZodLiteral<"exact">; | ||
term: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact"; | ||
term: string; | ||
}, { | ||
type: "exact"; | ||
term: string; | ||
}>, z.ZodObject<{ | ||
type: z.ZodLiteral<"range">; | ||
gte: z.ZodString; | ||
lte: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
}, { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
}>]>>>; | ||
'legalStatus.REGISTERED.createdAtLocation': z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodObject<{ | ||
type: z.ZodLiteral<"within">; | ||
location: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "within"; | ||
location: string; | ||
}, { | ||
type: "within"; | ||
location: string; | ||
}>, z.ZodObject<{ | ||
type: z.ZodLiteral<"exact">; | ||
term: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact"; | ||
term: string; | ||
}, { | ||
type: "exact"; | ||
term: string; | ||
}>]>>>; | ||
createdAtLocation: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodObject<{ | ||
type: z.ZodLiteral<"within">; | ||
location: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "within"; | ||
location: string; | ||
}, { | ||
type: "within"; | ||
location: string; | ||
}>, z.ZodObject<{ | ||
type: z.ZodLiteral<"exact">; | ||
term: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact"; | ||
term: string; | ||
}, { | ||
type: "exact"; | ||
term: string; | ||
}>]>>>; | ||
updatedAtLocation: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodObject<{ | ||
type: z.ZodLiteral<"within">; | ||
location: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "within"; | ||
location: string; | ||
}, { | ||
type: "within"; | ||
location: string; | ||
}>, z.ZodObject<{ | ||
type: z.ZodLiteral<"exact">; | ||
term: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact"; | ||
term: string; | ||
}, { | ||
type: "exact"; | ||
term: string; | ||
}>]>>>; | ||
assignedTo: z.ZodOptional<z.ZodOptional<z.ZodObject<{ | ||
type: z.ZodLiteral<"exact">; | ||
term: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact"; | ||
term: string; | ||
}, { | ||
type: "exact"; | ||
term: string; | ||
}>>>; | ||
createdBy: z.ZodOptional<z.ZodOptional<z.ZodObject<{ | ||
type: z.ZodLiteral<"exact">; | ||
term: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact"; | ||
term: string; | ||
}, { | ||
type: "exact"; | ||
term: string; | ||
}>>>; | ||
updatedBy: z.ZodOptional<z.ZodOptional<z.ZodObject<{ | ||
type: z.ZodLiteral<"exact">; | ||
term: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact"; | ||
term: string; | ||
}, { | ||
type: "exact"; | ||
term: string; | ||
}>>>; | ||
trackingId: z.ZodOptional<z.ZodOptional<z.ZodObject<{ | ||
type: z.ZodLiteral<"exact">; | ||
term: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact"; | ||
term: string; | ||
}, { | ||
type: "exact"; | ||
term: string; | ||
}>>>; | ||
flags: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<{ | ||
type: z.ZodLiteral<"anyOf">; | ||
terms: z.ZodArray<z.ZodString, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "anyOf"; | ||
terms: string[]; | ||
}, { | ||
type: "anyOf"; | ||
terms: string[]; | ||
}>, z.ZodObject<{ | ||
type: z.ZodLiteral<"not">; | ||
term: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "not"; | ||
term: string; | ||
}, { | ||
type: "not"; | ||
term: string; | ||
}>]>, "many">>>; | ||
data: z.ZodOptional<z.ZodType<any, z.ZodTypeDef, any>>; | ||
}, "strip", z.ZodTypeAny, { | ||
status?: { | ||
type: "exact"; | ||
term: "ARCHIVED" | "CERTIFIED" | "DECLARED" | "REGISTERED" | "REJECTED" | "VALIDATED" | "CREATED" | "NOTIFIED"; | ||
} | { | ||
type: "anyOf"; | ||
terms: ("ARCHIVED" | "CERTIFIED" | "DECLARED" | "REGISTERED" | "REJECTED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
} | undefined; | ||
data?: any; | ||
createdAt?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
} | undefined; | ||
createdBy?: { | ||
type: "exact"; | ||
term: string; | ||
} | undefined; | ||
createdAtLocation?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "within"; | ||
location: string; | ||
} | undefined; | ||
assignedTo?: { | ||
type: "exact"; | ||
term: string; | ||
} | undefined; | ||
updatedAt?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
} | undefined; | ||
trackingId?: { | ||
type: "exact"; | ||
term: string; | ||
} | undefined; | ||
updatedAtLocation?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "within"; | ||
location: string; | ||
} | undefined; | ||
updatedBy?: { | ||
type: "exact"; | ||
term: string; | ||
} | undefined; | ||
flags?: ({ | ||
type: "anyOf"; | ||
terms: string[]; | ||
} | { | ||
type: "not"; | ||
term: string; | ||
})[] | undefined; | ||
eventType?: string | undefined; | ||
'legalStatus.REGISTERED.createdAt'?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
} | undefined; | ||
'legalStatus.REGISTERED.createdAtLocation'?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "within"; | ||
location: string; | ||
} | undefined; | ||
}, { | ||
status?: { | ||
type: "exact"; | ||
term: "ARCHIVED" | "CERTIFIED" | "DECLARED" | "REGISTERED" | "REJECTED" | "VALIDATED" | "CREATED" | "NOTIFIED"; | ||
} | { | ||
type: "anyOf"; | ||
terms: ("ARCHIVED" | "CERTIFIED" | "DECLARED" | "REGISTERED" | "REJECTED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
} | undefined; | ||
data?: any; | ||
createdAt?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
} | undefined; | ||
createdBy?: { | ||
type: "exact"; | ||
term: string; | ||
} | undefined; | ||
createdAtLocation?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "within"; | ||
location: string; | ||
} | undefined; | ||
assignedTo?: { | ||
type: "exact"; | ||
term: string; | ||
} | undefined; | ||
updatedAt?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
} | undefined; | ||
trackingId?: { | ||
type: "exact"; | ||
term: string; | ||
} | undefined; | ||
updatedAtLocation?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "within"; | ||
location: string; | ||
} | undefined; | ||
updatedBy?: { | ||
type: "exact"; | ||
term: string; | ||
} | undefined; | ||
flags?: ({ | ||
type: "anyOf"; | ||
terms: string[]; | ||
} | { | ||
type: "not"; | ||
term: string; | ||
})[] | undefined; | ||
eventType?: string | undefined; | ||
'legalStatus.REGISTERED.createdAt'?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
} | undefined; | ||
'legalStatus.REGISTERED.createdAtLocation'?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "within"; | ||
location: string; | ||
} | undefined; | ||
}>; | ||
export declare const QueryType: z.ZodObject<{ | ||
type: z.ZodUnion<[z.ZodLiteral<"and">, z.ZodLiteral<"or">]>; | ||
clauses: z.ZodEffects<z.ZodArray<z.ZodObject<{ | ||
eventType: z.ZodOptional<z.ZodString>; | ||
status: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodObject<{ | ||
type: z.ZodLiteral<"anyOf">; | ||
terms: z.ZodArray<z.ZodEnum<["CREATED", "NOTIFIED", "DECLARED", "VALIDATED", "REGISTERED", "CERTIFIED", "REJECTED", "ARCHIVED"]>, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "anyOf"; | ||
terms: ("ARCHIVED" | "CERTIFIED" | "DECLARED" | "REGISTERED" | "REJECTED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
}, { | ||
type: "anyOf"; | ||
terms: ("ARCHIVED" | "CERTIFIED" | "DECLARED" | "REGISTERED" | "REJECTED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
}>, z.ZodObject<{ | ||
type: z.ZodLiteral<"exact">; | ||
term: z.ZodEnum<["CREATED", "NOTIFIED", "DECLARED", "VALIDATED", "REGISTERED", "CERTIFIED", "REJECTED", "ARCHIVED"]>; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact"; | ||
term: "ARCHIVED" | "CERTIFIED" | "DECLARED" | "REGISTERED" | "REJECTED" | "VALIDATED" | "CREATED" | "NOTIFIED"; | ||
}, { | ||
type: "exact"; | ||
term: "ARCHIVED" | "CERTIFIED" | "DECLARED" | "REGISTERED" | "REJECTED" | "VALIDATED" | "CREATED" | "NOTIFIED"; | ||
}>]>>>; | ||
createdAt: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodObject<{ | ||
type: z.ZodLiteral<"exact">; | ||
term: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact"; | ||
term: string; | ||
}, { | ||
type: "exact"; | ||
term: string; | ||
}>, z.ZodObject<{ | ||
type: z.ZodLiteral<"range">; | ||
gte: z.ZodString; | ||
lte: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
}, { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
}>]>>>; | ||
updatedAt: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodObject<{ | ||
type: z.ZodLiteral<"exact">; | ||
term: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact"; | ||
term: string; | ||
}, { | ||
type: "exact"; | ||
term: string; | ||
}>, z.ZodObject<{ | ||
type: z.ZodLiteral<"range">; | ||
gte: z.ZodString; | ||
lte: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
}, { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
}>]>>>; | ||
'legalStatus.REGISTERED.createdAt': z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodObject<{ | ||
type: z.ZodLiteral<"exact">; | ||
term: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact"; | ||
term: string; | ||
}, { | ||
type: "exact"; | ||
term: string; | ||
}>, z.ZodObject<{ | ||
type: z.ZodLiteral<"range">; | ||
gte: z.ZodString; | ||
lte: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
}, { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
}>]>>>; | ||
'legalStatus.REGISTERED.createdAtLocation': z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodObject<{ | ||
type: z.ZodLiteral<"within">; | ||
location: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "within"; | ||
location: string; | ||
}, { | ||
type: "within"; | ||
location: string; | ||
}>, z.ZodObject<{ | ||
type: z.ZodLiteral<"exact">; | ||
term: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact"; | ||
term: string; | ||
}, { | ||
type: "exact"; | ||
term: string; | ||
}>]>>>; | ||
createdAtLocation: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodObject<{ | ||
type: z.ZodLiteral<"within">; | ||
location: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "within"; | ||
location: string; | ||
}, { | ||
type: "within"; | ||
location: string; | ||
}>, z.ZodObject<{ | ||
type: z.ZodLiteral<"exact">; | ||
term: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact"; | ||
term: string; | ||
}, { | ||
type: "exact"; | ||
term: string; | ||
}>]>>>; | ||
updatedAtLocation: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodObject<{ | ||
type: z.ZodLiteral<"within">; | ||
location: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "within"; | ||
location: string; | ||
}, { | ||
type: "within"; | ||
location: string; | ||
}>, z.ZodObject<{ | ||
type: z.ZodLiteral<"exact">; | ||
term: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact"; | ||
term: string; | ||
}, { | ||
type: "exact"; | ||
term: string; | ||
}>]>>>; | ||
assignedTo: z.ZodOptional<z.ZodOptional<z.ZodObject<{ | ||
type: z.ZodLiteral<"exact">; | ||
term: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact"; | ||
term: string; | ||
}, { | ||
type: "exact"; | ||
term: string; | ||
}>>>; | ||
createdBy: z.ZodOptional<z.ZodOptional<z.ZodObject<{ | ||
type: z.ZodLiteral<"exact">; | ||
term: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact"; | ||
term: string; | ||
}, { | ||
type: "exact"; | ||
term: string; | ||
}>>>; | ||
updatedBy: z.ZodOptional<z.ZodOptional<z.ZodObject<{ | ||
type: z.ZodLiteral<"exact">; | ||
term: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact"; | ||
term: string; | ||
}, { | ||
type: "exact"; | ||
term: string; | ||
}>>>; | ||
trackingId: z.ZodOptional<z.ZodOptional<z.ZodObject<{ | ||
type: z.ZodLiteral<"exact">; | ||
term: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "exact"; | ||
term: string; | ||
}, { | ||
type: "exact"; | ||
term: string; | ||
}>>>; | ||
flags: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<{ | ||
type: z.ZodLiteral<"anyOf">; | ||
terms: z.ZodArray<z.ZodString, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "anyOf"; | ||
terms: string[]; | ||
}, { | ||
type: "anyOf"; | ||
terms: string[]; | ||
}>, z.ZodObject<{ | ||
type: z.ZodLiteral<"not">; | ||
term: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "not"; | ||
term: string; | ||
}, { | ||
type: "not"; | ||
term: string; | ||
}>]>, "many">>>; | ||
data: z.ZodOptional<z.ZodType<any, z.ZodTypeDef, any>>; | ||
}, "strip", z.ZodTypeAny, { | ||
status?: { | ||
type: "exact"; | ||
term: "ARCHIVED" | "CERTIFIED" | "DECLARED" | "REGISTERED" | "REJECTED" | "VALIDATED" | "CREATED" | "NOTIFIED"; | ||
} | { | ||
type: "anyOf"; | ||
terms: ("ARCHIVED" | "CERTIFIED" | "DECLARED" | "REGISTERED" | "REJECTED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
} | undefined; | ||
data?: any; | ||
createdAt?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
} | undefined; | ||
createdBy?: { | ||
type: "exact"; | ||
term: string; | ||
} | undefined; | ||
createdAtLocation?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "within"; | ||
location: string; | ||
} | undefined; | ||
assignedTo?: { | ||
type: "exact"; | ||
term: string; | ||
} | undefined; | ||
updatedAt?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
} | undefined; | ||
trackingId?: { | ||
type: "exact"; | ||
term: string; | ||
} | undefined; | ||
updatedAtLocation?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "within"; | ||
location: string; | ||
} | undefined; | ||
updatedBy?: { | ||
type: "exact"; | ||
term: string; | ||
} | undefined; | ||
flags?: ({ | ||
type: "anyOf"; | ||
terms: string[]; | ||
} | { | ||
type: "not"; | ||
term: string; | ||
})[] | undefined; | ||
eventType?: string | undefined; | ||
'legalStatus.REGISTERED.createdAt'?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
} | undefined; | ||
'legalStatus.REGISTERED.createdAtLocation'?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "within"; | ||
location: string; | ||
} | undefined; | ||
}, { | ||
status?: { | ||
type: "exact"; | ||
term: "ARCHIVED" | "CERTIFIED" | "DECLARED" | "REGISTERED" | "REJECTED" | "VALIDATED" | "CREATED" | "NOTIFIED"; | ||
} | { | ||
type: "anyOf"; | ||
terms: ("ARCHIVED" | "CERTIFIED" | "DECLARED" | "REGISTERED" | "REJECTED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
} | undefined; | ||
data?: any; | ||
createdAt?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
} | undefined; | ||
createdBy?: { | ||
type: "exact"; | ||
term: string; | ||
} | undefined; | ||
createdAtLocation?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "within"; | ||
location: string; | ||
} | undefined; | ||
assignedTo?: { | ||
type: "exact"; | ||
term: string; | ||
} | undefined; | ||
updatedAt?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
} | undefined; | ||
trackingId?: { | ||
type: "exact"; | ||
term: string; | ||
} | undefined; | ||
updatedAtLocation?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "within"; | ||
location: string; | ||
} | undefined; | ||
updatedBy?: { | ||
type: "exact"; | ||
term: string; | ||
} | undefined; | ||
flags?: ({ | ||
type: "anyOf"; | ||
terms: string[]; | ||
} | { | ||
type: "not"; | ||
term: string; | ||
})[] | undefined; | ||
eventType?: string | undefined; | ||
'legalStatus.REGISTERED.createdAt'?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
} | undefined; | ||
'legalStatus.REGISTERED.createdAtLocation'?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "within"; | ||
location: string; | ||
} | undefined; | ||
}>, "many">, { | ||
status?: { | ||
type: "exact"; | ||
term: "ARCHIVED" | "CERTIFIED" | "DECLARED" | "REGISTERED" | "REJECTED" | "VALIDATED" | "CREATED" | "NOTIFIED"; | ||
} | { | ||
type: "anyOf"; | ||
terms: ("ARCHIVED" | "CERTIFIED" | "DECLARED" | "REGISTERED" | "REJECTED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
} | undefined; | ||
data?: any; | ||
createdAt?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
} | undefined; | ||
createdBy?: { | ||
type: "exact"; | ||
term: string; | ||
} | undefined; | ||
createdAtLocation?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "within"; | ||
location: string; | ||
} | undefined; | ||
assignedTo?: { | ||
type: "exact"; | ||
term: string; | ||
} | undefined; | ||
updatedAt?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
} | undefined; | ||
trackingId?: { | ||
type: "exact"; | ||
term: string; | ||
} | undefined; | ||
updatedAtLocation?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "within"; | ||
location: string; | ||
} | undefined; | ||
updatedBy?: { | ||
type: "exact"; | ||
term: string; | ||
} | undefined; | ||
flags?: ({ | ||
type: "anyOf"; | ||
terms: string[]; | ||
} | { | ||
type: "not"; | ||
term: string; | ||
})[] | undefined; | ||
eventType?: string | undefined; | ||
'legalStatus.REGISTERED.createdAt'?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
} | undefined; | ||
'legalStatus.REGISTERED.createdAtLocation'?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "within"; | ||
location: string; | ||
} | undefined; | ||
}[], unknown>; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "and" | "or"; | ||
clauses: { | ||
status?: { | ||
type: "exact"; | ||
term: "ARCHIVED" | "CERTIFIED" | "DECLARED" | "REGISTERED" | "REJECTED" | "VALIDATED" | "CREATED" | "NOTIFIED"; | ||
} | { | ||
type: "anyOf"; | ||
terms: ("ARCHIVED" | "CERTIFIED" | "DECLARED" | "REGISTERED" | "REJECTED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
} | undefined; | ||
data?: any; | ||
createdAt?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
} | undefined; | ||
createdBy?: { | ||
type: "exact"; | ||
term: string; | ||
} | undefined; | ||
createdAtLocation?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "within"; | ||
location: string; | ||
} | undefined; | ||
assignedTo?: { | ||
type: "exact"; | ||
term: string; | ||
} | undefined; | ||
updatedAt?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
} | undefined; | ||
trackingId?: { | ||
type: "exact"; | ||
term: string; | ||
} | undefined; | ||
updatedAtLocation?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "within"; | ||
location: string; | ||
} | undefined; | ||
updatedBy?: { | ||
type: "exact"; | ||
term: string; | ||
} | undefined; | ||
flags?: ({ | ||
type: "anyOf"; | ||
terms: string[]; | ||
} | { | ||
type: "not"; | ||
term: string; | ||
})[] | undefined; | ||
eventType?: string | undefined; | ||
'legalStatus.REGISTERED.createdAt'?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "range"; | ||
gte: string; | ||
lte: string; | ||
} | undefined; | ||
'legalStatus.REGISTERED.createdAtLocation'?: { | ||
type: "exact"; | ||
term: string; | ||
} | { | ||
type: "within"; | ||
location: string; | ||
} | undefined; | ||
}[]; | ||
}, { | ||
type: "and" | "or"; | ||
clauses?: unknown; | ||
}>; | ||
export type QueryType = z.infer<typeof QueryType>; | ||
export type QueryExpression = z.infer<typeof QueryExpression>; | ||
export {}; | ||
//# sourceMappingURL=EventIndex.d.ts.map |
@@ -17,2 +17,11 @@ import { z } from 'zod'; | ||
export type EventStatus = (typeof EventStatus)[keyof typeof EventStatus]; | ||
export declare const EventStatusEnum: z.ZodEnum<["CREATED", "NOTIFIED", "DECLARED", "VALIDATED", "REGISTERED", "CERTIFIED", "REJECTED", "ARCHIVED"]>; | ||
export declare const CustomFlags: { | ||
readonly CERTIFICATE_PRINTED: "certificate-printed"; | ||
}; | ||
export type CustomFlags = (typeof CustomFlags)[keyof typeof CustomFlags]; | ||
export declare const Flag: z.ZodUnion<[z.ZodString, z.ZodNativeEnum<{ | ||
readonly CERTIFICATE_PRINTED: "certificate-printed"; | ||
}>]>; | ||
export type Flag = z.infer<typeof Flag>; | ||
export declare const eventStatuses: ("ARCHIVED" | "CERTIFIED" | "DECLARED" | "REGISTERED" | "REJECTED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
@@ -29,2 +38,123 @@ export declare const EventStatuses: z.ZodNativeEnum<{ | ||
}>; | ||
export declare const ZodDate: z.ZodString; | ||
export declare const ActionCreationMetadata: z.ZodObject<{ | ||
createdAt: z.ZodString; | ||
createdBy: z.ZodString; | ||
createdAtLocation: z.ZodOptional<z.ZodNullable<z.ZodString>>; | ||
acceptedAt: z.ZodString; | ||
createdByRole: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
}, { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
}>; | ||
export type ActionCreationMetadata = z.infer<typeof ActionCreationMetadata>; | ||
export declare const RegistrationCreationMetadata: z.ZodObject<z.objectUtil.extendShape<{ | ||
createdAt: z.ZodString; | ||
createdBy: z.ZodString; | ||
createdAtLocation: z.ZodOptional<z.ZodNullable<z.ZodString>>; | ||
acceptedAt: z.ZodString; | ||
createdByRole: z.ZodString; | ||
}, { | ||
registrationNumber: z.ZodString; | ||
}>, "strip", z.ZodTypeAny, { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
registrationNumber: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
}, { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
registrationNumber: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
}>; | ||
export type RegistrationCreationMetadata = z.infer<typeof RegistrationCreationMetadata>; | ||
export declare const LegalStatuses: z.ZodObject<{ | ||
DECLARED: z.ZodOptional<z.ZodNullable<z.ZodObject<{ | ||
createdAt: z.ZodString; | ||
createdBy: z.ZodString; | ||
createdAtLocation: z.ZodOptional<z.ZodNullable<z.ZodString>>; | ||
acceptedAt: z.ZodString; | ||
createdByRole: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
}, { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
}>>>; | ||
REGISTERED: z.ZodOptional<z.ZodNullable<z.ZodObject<z.objectUtil.extendShape<{ | ||
createdAt: z.ZodString; | ||
createdBy: z.ZodString; | ||
createdAtLocation: z.ZodOptional<z.ZodNullable<z.ZodString>>; | ||
acceptedAt: z.ZodString; | ||
createdByRole: z.ZodString; | ||
}, { | ||
registrationNumber: z.ZodString; | ||
}>, "strip", z.ZodTypeAny, { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
registrationNumber: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
}, { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
registrationNumber: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
}>>>; | ||
}, "strip", z.ZodTypeAny, { | ||
DECLARED?: { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
} | null | undefined; | ||
REGISTERED?: { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
registrationNumber: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
} | null | undefined; | ||
}, { | ||
DECLARED?: { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
} | null | undefined; | ||
REGISTERED?: { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
registrationNumber: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
} | null | undefined; | ||
}>; | ||
/** | ||
@@ -48,9 +178,91 @@ * Event metadata exposed to client. | ||
}>; | ||
legalStatuses: z.ZodObject<{ | ||
DECLARED: z.ZodOptional<z.ZodNullable<z.ZodObject<{ | ||
createdAt: z.ZodString; | ||
createdBy: z.ZodString; | ||
createdAtLocation: z.ZodOptional<z.ZodNullable<z.ZodString>>; | ||
acceptedAt: z.ZodString; | ||
createdByRole: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
}, { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
}>>>; | ||
REGISTERED: z.ZodOptional<z.ZodNullable<z.ZodObject<z.objectUtil.extendShape<{ | ||
createdAt: z.ZodString; | ||
createdBy: z.ZodString; | ||
createdAtLocation: z.ZodOptional<z.ZodNullable<z.ZodString>>; | ||
acceptedAt: z.ZodString; | ||
createdByRole: z.ZodString; | ||
}, { | ||
registrationNumber: z.ZodString; | ||
}>, "strip", z.ZodTypeAny, { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
registrationNumber: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
}, { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
registrationNumber: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
}>>>; | ||
}, "strip", z.ZodTypeAny, { | ||
DECLARED?: { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
} | null | undefined; | ||
REGISTERED?: { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
registrationNumber: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
} | null | undefined; | ||
}, { | ||
DECLARED?: { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
} | null | undefined; | ||
REGISTERED?: { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
registrationNumber: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
} | null | undefined; | ||
}>; | ||
createdAt: z.ZodString; | ||
dateOfEvent: z.ZodOptional<z.ZodNullable<z.ZodString>>; | ||
createdBy: z.ZodString; | ||
createdAtLocation: z.ZodString; | ||
modifiedAt: z.ZodString; | ||
updatedByUserRole: z.ZodString; | ||
createdAtLocation: z.ZodOptional<z.ZodNullable<z.ZodString>>; | ||
updatedAtLocation: z.ZodOptional<z.ZodNullable<z.ZodString>>; | ||
updatedAt: z.ZodString; | ||
assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>; | ||
updatedBy: z.ZodString; | ||
updatedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>; | ||
trackingId: z.ZodString; | ||
flags: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNativeEnum<{ | ||
readonly CERTIFICATE_PRINTED: "certificate-printed"; | ||
}>]>, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
@@ -62,7 +274,28 @@ type: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
updatedAt: string; | ||
trackingId: string; | ||
modifiedAt: string; | ||
updatedBy: string; | ||
legalStatuses: { | ||
DECLARED?: { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
} | null | undefined; | ||
REGISTERED?: { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
registrationNumber: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
} | null | undefined; | ||
}; | ||
updatedByUserRole: string; | ||
flags: string[]; | ||
createdAtLocation?: string | null | undefined; | ||
assignedTo?: string | null | undefined; | ||
dateOfEvent?: string | null | undefined; | ||
updatedAtLocation?: string | null | undefined; | ||
updatedBy?: string | null | undefined; | ||
}, { | ||
@@ -74,10 +307,33 @@ type: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
updatedAt: string; | ||
trackingId: string; | ||
modifiedAt: string; | ||
updatedBy: string; | ||
legalStatuses: { | ||
DECLARED?: { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
} | null | undefined; | ||
REGISTERED?: { | ||
createdAt: string; | ||
createdBy: string; | ||
createdByRole: string; | ||
registrationNumber: string; | ||
acceptedAt: string; | ||
createdAtLocation?: string | null | undefined; | ||
} | null | undefined; | ||
}; | ||
updatedByUserRole: string; | ||
flags: string[]; | ||
createdAtLocation?: string | null | undefined; | ||
assignedTo?: string | null | undefined; | ||
dateOfEvent?: string | null | undefined; | ||
updatedAtLocation?: string | null | undefined; | ||
updatedBy?: string | null | undefined; | ||
}>; | ||
export type EventMetadata = z.infer<typeof EventMetadata>; | ||
export type EventMetadataKeys = `event.${keyof EventMetadata}`; | ||
export declare const EventMetadataKeysArray: readonly ["id", "type", "status", "createdAt", "dateOfEvent", "createdBy", "updatedByUserRole", "createdAtLocation", "updatedAtLocation", "updatedAt", "assignedTo", "updatedBy", "trackingId", "legalStatuses", "flags"]; | ||
export declare const EventMetadataKeys: z.ZodEnum<["id", "type", "status", "createdAt", "dateOfEvent", "createdBy", "updatedByUserRole", "createdAtLocation", "updatedAtLocation", "updatedAt", "assignedTo", "updatedBy", "trackingId", "legalStatuses", "flags"]>; | ||
export type EventMetadataKeys = z.infer<typeof EventMetadataKeys>; | ||
/** | ||
@@ -88,3 +344,3 @@ * Mapping of event metadata keys to translation configuration. | ||
*/ | ||
export declare const eventMetadataLabelMap: Record<EventMetadataKeys, TranslationConfig>; | ||
export declare const eventMetadataLabelMap: Record<Exclude<`event.${EventMetadataKeys}`, 'event.legalStatuses'>, TranslationConfig>; | ||
//# sourceMappingURL=EventMetadata.d.ts.map |
@@ -8,2 +8,3 @@ export declare const FieldType: { | ||
readonly DATE: "DATE"; | ||
readonly DATE_RANGE: "DATE_RANGE"; | ||
readonly PARAGRAPH: "PARAGRAPH"; | ||
@@ -14,3 +15,2 @@ readonly PAGE_HEADER: "PAGE_HEADER"; | ||
readonly FILE_WITH_OPTIONS: "FILE_WITH_OPTIONS"; | ||
readonly HIDDEN: "HIDDEN"; | ||
readonly BULLET_LIST: "BULLET_LIST"; | ||
@@ -28,3 +28,3 @@ readonly CHECKBOX: "CHECKBOX"; | ||
}; | ||
export declare const fieldTypes: ("ADDRESS" | "TEXT" | "NUMBER" | "TEXTAREA" | "EMAIL" | "DATE" | "PARAGRAPH" | "PAGE_HEADER" | "RADIO_GROUP" | "FILE" | "FILE_WITH_OPTIONS" | "HIDDEN" | "BULLET_LIST" | "CHECKBOX" | "SELECT" | "COUNTRY" | "LOCATION" | "DIVIDER" | "ADMINISTRATIVE_AREA" | "FACILITY" | "OFFICE" | "SIGNATURE" | "DATA")[]; | ||
export declare const fieldTypes: ("ADDRESS" | "TEXT" | "NUMBER" | "TEXTAREA" | "EMAIL" | "DATE" | "DATE_RANGE" | "PARAGRAPH" | "PAGE_HEADER" | "RADIO_GROUP" | "FILE" | "FILE_WITH_OPTIONS" | "BULLET_LIST" | "CHECKBOX" | "SELECT" | "COUNTRY" | "LOCATION" | "DIVIDER" | "ADMINISTRATIVE_AREA" | "FACILITY" | "OFFICE" | "SIGNATURE" | "DATA")[]; | ||
export type FieldType = (typeof fieldTypes)[number]; | ||
@@ -34,3 +34,3 @@ /** | ||
*/ | ||
export declare const compositeFieldTypes: ("ADDRESS" | "FILE" | "FILE_WITH_OPTIONS")[]; | ||
export declare const compositeFieldTypes: ("ADDRESS" | "DATE_RANGE" | "FILE" | "FILE_WITH_OPTIONS")[]; | ||
//# sourceMappingURL=FieldType.d.ts.map |
@@ -161,3 +161,3 @@ import { z } from 'zod'; | ||
originalFilename: string; | ||
}>, "many">>> | z.ZodBoolean | z.ZodOptional<z.ZodNullable<z.ZodBoolean>> | z.ZodNumber | z.ZodOptional<z.ZodNullable<z.ZodNumber>> | z.ZodUndefined | z.ZodOptional<z.ZodNullable<z.ZodUndefined>> | z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodDiscriminatedUnion<"urbanOrRural", [z.ZodObject<z.objectUtil.extendShape<{ | ||
}>, "many">>> | z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodString], null>]> | z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodString], null>]>>> | z.ZodBoolean | z.ZodOptional<z.ZodNullable<z.ZodBoolean>> | z.ZodNumber | z.ZodOptional<z.ZodNullable<z.ZodNumber>> | z.ZodUndefined | z.ZodOptional<z.ZodNullable<z.ZodUndefined>> | z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodDiscriminatedUnion<"urbanOrRural", [z.ZodObject<z.objectUtil.extendShape<{ | ||
country: z.ZodString; | ||
@@ -287,3 +287,3 @@ addressType: z.ZodLiteral<"DOMESTIC">; | ||
originalFilename: string; | ||
}[] | null | undefined; | ||
}[] | [string, string] | null | undefined; | ||
}, { | ||
@@ -327,3 +327,3 @@ [x: string]: string | number | boolean | { | ||
originalFilename: string; | ||
}[] | null | undefined; | ||
}[] | [string, string] | null | undefined; | ||
}>; | ||
@@ -333,3 +333,3 @@ /** | ||
*/ | ||
export declare function mapFieldTypeToMockValue(field: FieldConfig, i: number): string | true | 19 | { | ||
export declare function mapFieldTypeToMockValue(field: FieldConfig, i: number): string | true | string[] | 19 | { | ||
country: string; | ||
@@ -423,2 +423,9 @@ addressType: "DOMESTIC"; | ||
}; | ||
export declare const isDateRangeFieldType: (field: { | ||
config: FieldConfig; | ||
value: FieldValue; | ||
}) => field is { | ||
value: string; | ||
config: DateField; | ||
}; | ||
export declare const isPageHeaderFieldType: (field: { | ||
@@ -425,0 +432,0 @@ config: FieldConfig; |
@@ -16,4 +16,7 @@ import { z } from 'zod'; | ||
export declare const TextValue: z.ZodString; | ||
export declare const RequiredTextValue: z.ZodString; | ||
export declare const NonEmptyTextValue: z.ZodString; | ||
export declare const DateValue: z.ZodString; | ||
export declare const DatetimeValue: z.ZodString; | ||
export declare const DateRangeFieldValue: z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodString], null>]>; | ||
export type DateRangeFieldValue = z.infer<typeof DateRangeFieldValue>; | ||
export declare const EmailValue: z.ZodString; | ||
@@ -26,3 +29,3 @@ export declare const CheckboxFieldValue: z.ZodBoolean; | ||
export type DataFieldValue = z.infer<typeof DataFieldValue>; | ||
export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{ | ||
export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodString], null>]>, z.ZodBoolean, z.ZodNumber, z.ZodObject<{ | ||
filename: z.ZodString; | ||
@@ -142,3 +145,3 @@ originalFilename: z.ZodString; | ||
export type FieldValue = z.infer<typeof FieldValue>; | ||
export declare const FieldUpdateValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{ | ||
export declare const FieldUpdateValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodString], null>]>, z.ZodBoolean, z.ZodNumber, z.ZodObject<{ | ||
filename: z.ZodString; | ||
@@ -267,3 +270,3 @@ originalFilename: z.ZodString; | ||
* */ | ||
export type FieldUpdateValueSchema = typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldUpdateValue | typeof NumberFieldValue | typeof DataFieldValue | z.ZodString | z.ZodBoolean; | ||
export type FieldUpdateValueSchema = typeof DateRangeFieldValue | typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldUpdateValue | typeof NumberFieldValue | typeof DataFieldValue | z.ZodString | z.ZodBoolean; | ||
//# sourceMappingURL=FieldValue.d.ts.map |
@@ -0,1 +1,2 @@ | ||
export * from './Constants'; | ||
export * from './ActionConfig'; | ||
@@ -6,5 +7,7 @@ export * from './offline'; | ||
export * from './FieldConfig'; | ||
export * from './FormConfig'; | ||
export * from './PageConfig'; | ||
export * from './SummaryConfig'; | ||
export * from './WorkqueueConfig'; | ||
export * from './WorkqueueColumnConfig'; | ||
export * from './workqueueDefaultColumns'; | ||
export * from './Draft'; | ||
@@ -19,2 +22,3 @@ export * from './EventMetadata'; | ||
export * from './FieldValue'; | ||
export * from './FormConfig'; | ||
export * from './CompositeFieldValue'; | ||
@@ -34,4 +38,8 @@ export * from './state'; | ||
export * from './TemplateConfig'; | ||
export * from './scopes'; | ||
export * from './serializer'; | ||
export * from '../conditionals/conditionals'; | ||
export * from '../conditionals/validate'; | ||
export * from './field'; | ||
export * from './event'; | ||
//# sourceMappingURL=index.d.ts.map |
import { z } from 'zod'; | ||
import { TranslationConfig } from './TranslationConfig'; | ||
export declare const SummaryConfig: z.ZodObject<{ | ||
title: z.ZodObject<{ | ||
id: z.ZodString; | ||
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>; | ||
fields: z.ZodArray<z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{ | ||
emptyValueMessage: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, { | ||
@@ -16,20 +10,13 @@ id: string; | ||
}>>; | ||
}, "strip", z.ZodTypeAny, { | ||
id: string; | ||
label: TranslationConfig; | ||
emptyValueMessage?: TranslationConfig | undefined; | ||
conditionals: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{ | ||
type: z.ZodLiteral<"SHOW">; | ||
conditional: z.ZodType<import(".").JSONSchema, z.ZodTypeDef, import(".").JSONSchema>; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}, { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}>, "many">>>; | ||
}, { | ||
id: string; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
emptyValueMessage?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
}>; | ||
fields: z.ZodArray<z.ZodObject<{ | ||
id: z.ZodString; | ||
@@ -51,6 +38,10 @@ value: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, { | ||
}>>; | ||
}, "strip", z.ZodTypeAny, { | ||
}>, "strip", z.ZodTypeAny, { | ||
id: string; | ||
value: TranslationConfig; | ||
label: TranslationConfig; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: TranslationConfig | undefined; | ||
@@ -69,2 +60,6 @@ }, { | ||
}; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: { | ||
@@ -75,23 +70,81 @@ id: string; | ||
} | undefined; | ||
}>, "many">; | ||
}>, z.ZodObject<z.objectUtil.extendShape<{ | ||
emptyValueMessage: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>>; | ||
conditionals: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{ | ||
type: z.ZodLiteral<"SHOW">; | ||
conditional: z.ZodType<import(".").JSONSchema, z.ZodTypeDef, import(".").JSONSchema>; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}, { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}>, "many">>>; | ||
}, { | ||
fieldId: z.ZodString; | ||
label: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>>; | ||
}>, "strip", z.ZodTypeAny, { | ||
fieldId: string; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
label?: TranslationConfig | undefined; | ||
emptyValueMessage?: TranslationConfig | undefined; | ||
}, { | ||
fieldId: string; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
label?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
emptyValueMessage?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
}>]>, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
title: { | ||
id: string; | ||
label: TranslationConfig; | ||
fields: ({ | ||
fieldId: string; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
label?: TranslationConfig | undefined; | ||
emptyValueMessage?: TranslationConfig | undefined; | ||
}; | ||
fields: { | ||
} | { | ||
id: string; | ||
value: TranslationConfig; | ||
label: TranslationConfig; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: TranslationConfig | undefined; | ||
}[]; | ||
})[]; | ||
}, { | ||
title: { | ||
id: string; | ||
label: { | ||
fields: ({ | ||
fieldId: string; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
label?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
} | undefined; | ||
emptyValueMessage?: { | ||
@@ -102,4 +155,3 @@ id: string; | ||
} | undefined; | ||
}; | ||
fields: { | ||
} | { | ||
id: string; | ||
@@ -116,2 +168,6 @@ value: { | ||
}; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: { | ||
@@ -122,5 +178,5 @@ id: string; | ||
} | undefined; | ||
}[]; | ||
})[]; | ||
}>; | ||
export type SummaryConfig = z.infer<typeof SummaryConfig>; | ||
//# sourceMappingURL=SummaryConfig.d.ts.map |
@@ -9,3 +9,3 @@ /** | ||
*/ | ||
export interface MetaFields { | ||
export type SystemVariables = { | ||
$user: { | ||
@@ -15,3 +15,3 @@ province: string; | ||
}; | ||
} | ||
}; | ||
/** | ||
@@ -26,8 +26,8 @@ * Recursively flatten the keys of an object. Used to limit types when configuring default values in country config. | ||
}[keyof T]; | ||
export type FlattenedMetaFields = FlattenedKeyStrings<MetaFields>; | ||
export type FlattenenedSystemVariables = FlattenedKeyStrings<SystemVariables>; | ||
/** | ||
* Default value for a field when configuring a form. | ||
*/ | ||
export type FieldConfigDefaultValue = FieldValue | FlattenedMetaFields | Record<string, FlattenedMetaFields | FieldValue>; | ||
export declare function isTemplateVariable(value: FieldConfigDefaultValue): value is FlattenedMetaFields; | ||
export type FieldConfigDefaultValue = FieldValue | FlattenenedSystemVariables | Record<string, FlattenenedSystemVariables | FieldValue>; | ||
export declare function isTemplateVariable(value: FieldConfigDefaultValue): value is FlattenenedSystemVariables; | ||
export declare function isFieldValue(value: FieldConfigDefaultValue): value is FieldValue; | ||
@@ -34,0 +34,0 @@ /** |
@@ -1,3 +0,3 @@ | ||
import { ActionDocument } from './ActionDocument'; | ||
import { ArchiveActionInput, DeclareActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, ValidateActionInput } from './ActionInput'; | ||
import { ActionDocument, ActionUpdate, EventState } from './ActionDocument'; | ||
import { ArchiveActionInput, AssignActionInput, DeclareActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnassignActionInput, ValidateActionInput } from './ActionInput'; | ||
import { ActionType } from './ActionType'; | ||
@@ -9,43 +9,6 @@ import { Draft } from './Draft'; | ||
import { EventInput } from './EventInput'; | ||
import { FieldValue } from './FieldValue'; | ||
import { TranslationConfig } from './TranslationConfig'; | ||
export declare function generateActionInput(configuration: EventConfig, action: ActionType): import("lodash").Dictionary<string | number | boolean | { | ||
type: string; | ||
filename: string; | ||
originalFilename: string; | ||
} | { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "URBAN"; | ||
number?: string | undefined; | ||
town?: string | undefined; | ||
residentialArea?: string | undefined; | ||
street?: string | undefined; | ||
zipCode?: string | undefined; | ||
} | { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "RURAL"; | ||
village?: string | undefined; | ||
} | { | ||
country: string; | ||
state: string; | ||
addressType: "INTERNATIONAL"; | ||
district2: string; | ||
cityOrTown?: string | undefined; | ||
addressLine1?: string | undefined; | ||
addressLine2?: string | undefined; | ||
addressLine3?: string | undefined; | ||
postcodeOrZip?: string | undefined; | ||
} | { | ||
type: string; | ||
option: string; | ||
filename: string; | ||
originalFilename: string; | ||
}[] | undefined>; | ||
export declare function generateActionMetadataInput(configuration: EventConfig, action: ActionType): {}; | ||
import { WorkqueueConfig } from './WorkqueueConfig'; | ||
export declare function generateActionDeclarationInput(configuration: EventConfig, action: ActionType): EventState; | ||
export declare function generateActionAnnotationInput(configuration: EventConfig, action: ActionType): {}; | ||
export declare const eventPayloadGenerator: { | ||
@@ -61,31 +24,11 @@ create: (input?: Partial<EventInput>) => { | ||
}; | ||
draft: (eventId: string, input?: Partial<Draft>) => { | ||
id: import("../uuid").UUID; | ||
draft: ({ eventId, actionType }: { | ||
eventId: string; | ||
createdAt: string; | ||
transactionId: import("../uuid").UUID; | ||
action: { | ||
type: "REQUEST_CORRECTION"; | ||
data: { | ||
'applicant.firstname': string; | ||
'applicant.surname': string; | ||
'applicant.dob': string; | ||
'recommender.none': boolean; | ||
}; | ||
metadata: { | ||
'correction.requester.relationship': string; | ||
'correction.request.reason': string; | ||
}; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
}; | ||
} & Partial<{ | ||
id: string; | ||
createdAt: string; | ||
eventId: string; | ||
transactionId: string; | ||
action: { | ||
type: ActionType; | ||
data: Record<string, string | number | boolean | { | ||
actionType: ActionType; | ||
}, input?: Partial<Draft>) => Draft; | ||
actions: { | ||
declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "declaration" | "annotation">>) => { | ||
type: "DECLARE"; | ||
transactionId: string; | ||
declaration: Record<string, string | number | boolean | { | ||
type: string; | ||
@@ -127,51 +70,16 @@ filename: string; | ||
originalFilename: string; | ||
}[] | undefined>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
metadata?: Record<string, string | number | boolean | { | ||
type: string; | ||
filename: string; | ||
originalFilename: string; | ||
} | { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "URBAN"; | ||
number?: string | null | undefined; | ||
town?: string | null | undefined; | ||
residentialArea?: string | null | undefined; | ||
street?: string | null | undefined; | ||
zipCode?: string | null | undefined; | ||
} | { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "RURAL"; | ||
village?: string | null | undefined; | ||
} | { | ||
country: string; | ||
state: string; | ||
addressType: "INTERNATIONAL"; | ||
district2: string; | ||
cityOrTown?: string | null | undefined; | ||
addressLine1?: string | null | undefined; | ||
addressLine2?: string | null | undefined; | ||
addressLine3?: string | null | undefined; | ||
postcodeOrZip?: string | null | undefined; | ||
} | { | ||
type: string; | ||
option: string; | ||
filename: string; | ||
originalFilename: string; | ||
}[] | undefined> | undefined; | ||
}[] | [string, string] | undefined>; | ||
annotation: {}; | ||
eventId: string; | ||
}; | ||
}>; | ||
actions: { | ||
declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "data">>) => { | ||
type: "DECLARE"; | ||
/** | ||
* Notify allows sending incomplete data. Think it as 'partial declare' for now. | ||
*/ | ||
notify: (eventId: string, input?: { | ||
transactionId?: string; | ||
declaration?: Partial<ActionUpdate>; | ||
}) => { | ||
type: "NOTIFY"; | ||
transactionId: string; | ||
data: Record<string, string | number | boolean | { | ||
declaration: Partial<Record<string, string | number | boolean | { | ||
type: string; | ||
@@ -213,9 +121,9 @@ filename: string; | ||
originalFilename: string; | ||
}[] | undefined>; | ||
}[] | [string, string] | undefined>>; | ||
eventId: string; | ||
}; | ||
validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "data">>) => { | ||
validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "declaration" | "annotation">>) => { | ||
type: "VALIDATE"; | ||
transactionId: string; | ||
data: Record<string, string | number | boolean | { | ||
declaration: Record<string, string | number | boolean | { | ||
type: string; | ||
@@ -257,101 +165,48 @@ filename: string; | ||
originalFilename: string; | ||
}[] | undefined>; | ||
}[] | [string, string] | undefined>; | ||
annotation: {}; | ||
duplicates: never[]; | ||
eventId: string; | ||
}; | ||
archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "data">>, isDuplicate?: boolean) => { | ||
assign: (eventId: string, input?: Partial<Pick<AssignActionInput, "transactionId" | "assignedTo">>) => { | ||
type: "ASSIGN"; | ||
transactionId: string; | ||
declaration: {}; | ||
assignedTo: string; | ||
eventId: string; | ||
}; | ||
unassign: (eventId: string, input?: Partial<Pick<UnassignActionInput, "transactionId">>) => { | ||
type: "UNASSIGN"; | ||
transactionId: string; | ||
declaration: {}; | ||
assignedTo: null; | ||
eventId: string; | ||
}; | ||
archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "declaration">>, isDuplicate?: boolean) => { | ||
type: "ARCHIVE"; | ||
transactionId: string; | ||
data: Record<string, string | number | boolean | { | ||
type: string; | ||
filename: string; | ||
originalFilename: string; | ||
} | { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "URBAN"; | ||
number?: string | null | undefined; | ||
town?: string | null | undefined; | ||
residentialArea?: string | null | undefined; | ||
street?: string | null | undefined; | ||
zipCode?: string | null | undefined; | ||
} | { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "RURAL"; | ||
village?: string | null | undefined; | ||
} | { | ||
country: string; | ||
state: string; | ||
addressType: "INTERNATIONAL"; | ||
district2: string; | ||
cityOrTown?: string | null | undefined; | ||
addressLine1?: string | null | undefined; | ||
addressLine2?: string | null | undefined; | ||
addressLine3?: string | null | undefined; | ||
postcodeOrZip?: string | null | undefined; | ||
} | { | ||
type: string; | ||
option: string; | ||
filename: string; | ||
originalFilename: string; | ||
}[] | undefined>; | ||
metadata: { | ||
declaration: {}; | ||
annotation: {}; | ||
duplicates: never[]; | ||
eventId: string; | ||
reason: { | ||
message: string; | ||
isDuplicate: boolean; | ||
}; | ||
duplicates: never[]; | ||
eventId: string; | ||
}; | ||
reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "data">>) => { | ||
reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation">>) => { | ||
type: "REJECT"; | ||
transactionId: string; | ||
data: Record<string, string | number | boolean | { | ||
type: string; | ||
filename: string; | ||
originalFilename: string; | ||
} | { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "URBAN"; | ||
number?: string | null | undefined; | ||
town?: string | null | undefined; | ||
residentialArea?: string | null | undefined; | ||
street?: string | null | undefined; | ||
zipCode?: string | null | undefined; | ||
} | { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "RURAL"; | ||
village?: string | null | undefined; | ||
} | { | ||
country: string; | ||
state: string; | ||
addressType: "INTERNATIONAL"; | ||
district2: string; | ||
cityOrTown?: string | null | undefined; | ||
addressLine1?: string | null | undefined; | ||
addressLine2?: string | null | undefined; | ||
addressLine3?: string | null | undefined; | ||
postcodeOrZip?: string | null | undefined; | ||
} | { | ||
type: string; | ||
option: string; | ||
filename: string; | ||
originalFilename: string; | ||
}[] | undefined>; | ||
declaration: {}; | ||
annotation: {}; | ||
duplicates: never[]; | ||
eventId: string; | ||
reason: { | ||
message: string; | ||
}; | ||
}; | ||
register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "data">>) => { | ||
register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation">>) => { | ||
type: "REGISTER"; | ||
transactionId: string; | ||
data: Record<string, string | number | boolean | { | ||
declaration: Record<string, string | number | boolean | { | ||
type: string; | ||
@@ -393,54 +248,18 @@ filename: string; | ||
originalFilename: string; | ||
}[] | undefined>; | ||
}[] | [string, string] | undefined>; | ||
annotation: {}; | ||
eventId: string; | ||
}; | ||
printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "data" | "metadata">>) => { | ||
printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "annotation">>) => { | ||
type: "PRINT_CERTIFICATE"; | ||
transactionId: string; | ||
data: Record<string, string | number | boolean | { | ||
type: string; | ||
filename: string; | ||
originalFilename: string; | ||
} | { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "URBAN"; | ||
number?: string | null | undefined; | ||
town?: string | null | undefined; | ||
residentialArea?: string | null | undefined; | ||
street?: string | null | undefined; | ||
zipCode?: string | null | undefined; | ||
} | { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "RURAL"; | ||
village?: string | null | undefined; | ||
} | { | ||
country: string; | ||
state: string; | ||
addressType: "INTERNATIONAL"; | ||
district2: string; | ||
cityOrTown?: string | null | undefined; | ||
addressLine1?: string | null | undefined; | ||
addressLine2?: string | null | undefined; | ||
addressLine3?: string | null | undefined; | ||
postcodeOrZip?: string | null | undefined; | ||
} | { | ||
type: string; | ||
option: string; | ||
filename: string; | ||
originalFilename: string; | ||
}[] | undefined>; | ||
metadata: {}; | ||
declaration: {}; | ||
annotation: {}; | ||
eventId: string; | ||
}; | ||
correction: { | ||
request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "data">>) => { | ||
request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "declaration" | "annotation">>) => { | ||
type: "REQUEST_CORRECTION"; | ||
transactionId: string; | ||
data: Record<string, string | number | boolean | { | ||
declaration: Record<string, string | number | boolean | { | ||
type: string; | ||
@@ -482,91 +301,19 @@ filename: string; | ||
originalFilename: string; | ||
}[] | undefined>; | ||
metadata: {}; | ||
}[] | [string, string] | undefined>; | ||
annotation: {}; | ||
eventId: string; | ||
}; | ||
approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "data">>) => { | ||
approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => { | ||
type: "APPROVE_CORRECTION"; | ||
transactionId: string; | ||
data: Record<string, string | number | boolean | { | ||
type: string; | ||
filename: string; | ||
originalFilename: string; | ||
} | { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "URBAN"; | ||
number?: string | null | undefined; | ||
town?: string | null | undefined; | ||
residentialArea?: string | null | undefined; | ||
street?: string | null | undefined; | ||
zipCode?: string | null | undefined; | ||
} | { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "RURAL"; | ||
village?: string | null | undefined; | ||
} | { | ||
country: string; | ||
state: string; | ||
addressType: "INTERNATIONAL"; | ||
district2: string; | ||
cityOrTown?: string | null | undefined; | ||
addressLine1?: string | null | undefined; | ||
addressLine2?: string | null | undefined; | ||
addressLine3?: string | null | undefined; | ||
postcodeOrZip?: string | null | undefined; | ||
} | { | ||
type: string; | ||
option: string; | ||
filename: string; | ||
originalFilename: string; | ||
}[] | undefined>; | ||
declaration: {}; | ||
annotation: {}; | ||
eventId: string; | ||
requestId: string; | ||
}; | ||
reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "data">>) => { | ||
reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => { | ||
type: "REJECT_CORRECTION"; | ||
transactionId: string; | ||
data: Record<string, string | number | boolean | { | ||
type: string; | ||
filename: string; | ||
originalFilename: string; | ||
} | { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "URBAN"; | ||
number?: string | null | undefined; | ||
town?: string | null | undefined; | ||
residentialArea?: string | null | undefined; | ||
street?: string | null | undefined; | ||
zipCode?: string | null | undefined; | ||
} | { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "RURAL"; | ||
village?: string | null | undefined; | ||
} | { | ||
country: string; | ||
state: string; | ||
addressType: "INTERNATIONAL"; | ||
district2: string; | ||
cityOrTown?: string | null | undefined; | ||
addressLine1?: string | null | undefined; | ||
addressLine2?: string | null | undefined; | ||
addressLine3?: string | null | undefined; | ||
postcodeOrZip?: string | null | undefined; | ||
} | { | ||
type: string; | ||
option: string; | ||
filename: string; | ||
originalFilename: string; | ||
}[] | undefined>; | ||
declaration: {}; | ||
annotation: {}; | ||
eventId: string; | ||
@@ -587,5 +334,7 @@ requestId: string; | ||
}): EventDocument; | ||
export declare function generateEventDraftDocument(eventId: string, actionType?: ActionType, data?: Record<string, FieldValue>): Draft; | ||
export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>) => EventIndex; | ||
export declare function generateEventDraftDocument(eventId: string, actionType?: ActionType, declaration?: EventState): Draft; | ||
export declare function getRandomDatetime(rng: () => number, start: Date, end: Date): string; | ||
export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>, seed?: number) => EventIndex; | ||
export declare const generateTranslationConfig: (message: string) => TranslationConfig; | ||
export declare const generateWorkqueues: (slug?: string) => WorkqueueConfig[]; | ||
//# sourceMappingURL=test.utils.d.ts.map |
@@ -1,2 +0,20 @@ | ||
export type User = { | ||
import { z } from 'zod'; | ||
export declare const User: z.ZodObject<{ | ||
id: z.ZodString; | ||
name: z.ZodArray<z.ZodObject<{ | ||
use: z.ZodString; | ||
given: z.ZodArray<z.ZodString, "many">; | ||
family: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
use: string; | ||
given: string[]; | ||
family: string; | ||
}, { | ||
use: string; | ||
given: string[]; | ||
family: string; | ||
}>, "many">; | ||
role: z.ZodString; | ||
signatureFilename: z.ZodOptional<z.ZodString>; | ||
}, "strip", z.ZodTypeAny, { | ||
id: string; | ||
@@ -9,3 +27,14 @@ name: { | ||
role: string; | ||
}; | ||
signatureFilename?: string | undefined; | ||
}, { | ||
id: string; | ||
name: { | ||
use: string; | ||
given: string[]; | ||
family: string; | ||
}[]; | ||
role: string; | ||
signatureFilename?: string | undefined; | ||
}>; | ||
export type User = z.infer<typeof User>; | ||
//# sourceMappingURL=User.d.ts.map |
@@ -25,5 +25,7 @@ "use strict"; | ||
and: () => and, | ||
createEventConditionals: () => createEventConditionals, | ||
createFieldConditionals: () => createFieldConditionals, | ||
defineConditional: () => defineConditional, | ||
event: () => event, | ||
field: () => field, | ||
defineFormConditional: () => defineFormConditional, | ||
never: () => never, | ||
not: () => not, | ||
@@ -35,2 +37,19 @@ or: () => or, | ||
// ../commons/src/events/serializers/user/serializer.ts | ||
var import_zod = require("zod"); | ||
var SerializedUserField = import_zod.z.object({ | ||
$userField: import_zod.z.enum([ | ||
"id", | ||
"name", | ||
"role", | ||
"signatureFilename", | ||
"primaryOfficeId" | ||
]) | ||
}); | ||
function userSerializer(userField) { | ||
return { | ||
$userField: userField | ||
}; | ||
} | ||
// ../commons/src/conditionals/conditionals.ts | ||
@@ -40,2 +59,12 @@ function defineConditional(schema) { | ||
} | ||
function defineFormConditional(schema) { | ||
const schemaWithForm = { | ||
type: "object", | ||
properties: { | ||
$form: schema | ||
}, | ||
required: ["$form"] | ||
}; | ||
return defineConditional(schemaWithForm); | ||
} | ||
function alwaysTrue() { | ||
@@ -65,3 +94,6 @@ return {}; | ||
} | ||
var user = { | ||
function never() { | ||
return not(alwaysTrue()); | ||
} | ||
var user = Object.assign(userSerializer, { | ||
hasScope: (scope) => defineConditional({ | ||
@@ -86,47 +118,66 @@ type: "object", | ||
}) | ||
}; | ||
var event = { | ||
hasAction: (action) => defineConditional({ | ||
}); | ||
function createEventConditionals() { | ||
return { | ||
/** | ||
* Checks if the event contains a specific action type. | ||
* @param action - The action type to check for. | ||
*/ | ||
hasAction: (action) => defineConditional({ | ||
type: "object", | ||
properties: { | ||
$event: { | ||
type: "object", | ||
properties: { | ||
actions: { | ||
type: "array", | ||
contains: { | ||
type: "object", | ||
properties: { | ||
type: { | ||
const: action | ||
} | ||
}, | ||
required: ["type"] | ||
} | ||
} | ||
}, | ||
required: ["actions"] | ||
} | ||
}, | ||
required: ["$event"] | ||
}) | ||
}; | ||
} | ||
function getDateFromNow(days) { | ||
return new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0]; | ||
} | ||
function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) { | ||
return { | ||
type: "object", | ||
properties: { | ||
$event: { | ||
type: "object", | ||
properties: { | ||
actions: { | ||
type: "array", | ||
contains: { | ||
type: "object", | ||
properties: { | ||
type: { | ||
const: action | ||
} | ||
}, | ||
required: ["type"] | ||
} | ||
} | ||
}, | ||
required: ["actions"] | ||
} | ||
[fieldId]: { | ||
type: "string", | ||
format: "date", | ||
[clause]: { $data: `1/${comparedFieldId}` } | ||
}, | ||
[comparedFieldId]: { type: "string", format: "date" } | ||
}, | ||
required: ["$event"] | ||
}) | ||
}; | ||
function field(fieldId) { | ||
const getDateFromNow = (days) => new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0]; | ||
required: [fieldId] | ||
}; | ||
} | ||
function isFieldReference(value) { | ||
return typeof value === "object" && value !== null && "_fieldId" in value; | ||
} | ||
function createFieldConditionals(fieldId) { | ||
const getDateRange = (date, clause) => ({ | ||
type: "object", | ||
properties: { | ||
$form: { | ||
type: "object", | ||
properties: { | ||
[fieldId]: { | ||
type: "string", | ||
format: "date", | ||
[clause]: date | ||
} | ||
}, | ||
required: [fieldId] | ||
[fieldId]: { | ||
type: "string", | ||
format: "date", | ||
[clause]: date | ||
} | ||
}, | ||
required: ["$form"] | ||
required: [fieldId] | ||
}); | ||
@@ -136,43 +187,77 @@ return { | ||
days: (days) => ({ | ||
inPast: () => defineConditional( | ||
inPast: () => defineFormConditional( | ||
getDateRange(getDateFromNow(days), "formatMinimum") | ||
), | ||
inFuture: () => defineConditional( | ||
inFuture: () => defineFormConditional( | ||
getDateRange(getDateFromNow(-days), "formatMinimum") | ||
) | ||
}), | ||
date: (date) => defineConditional(getDateRange(date, "formatMinimum")), | ||
now: () => defineConditional(getDateRange(getDateFromNow(0), "formatMinimum")) | ||
date: (date) => { | ||
if (isFieldReference(date)) { | ||
const comparedFieldId = date._fieldId; | ||
return defineFormConditional( | ||
getDateRangeToFieldReference( | ||
fieldId, | ||
comparedFieldId, | ||
"formatMinimum" | ||
) | ||
); | ||
} | ||
return defineFormConditional(getDateRange(date, "formatMinimum")); | ||
}, | ||
now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMinimum")) | ||
}), | ||
isBefore: () => ({ | ||
days: (days) => ({ | ||
inPast: () => defineConditional( | ||
inPast: () => defineFormConditional( | ||
getDateRange(getDateFromNow(days), "formatMaximum") | ||
), | ||
inFuture: () => defineConditional( | ||
inFuture: () => defineFormConditional( | ||
getDateRange(getDateFromNow(-days), "formatMaximum") | ||
) | ||
}), | ||
date: (date) => defineConditional(getDateRange(date, "formatMaximum")), | ||
now: () => defineConditional(getDateRange(getDateFromNow(0), "formatMaximum")) | ||
date: (date) => { | ||
if (isFieldReference(date)) { | ||
const comparedFieldId = date._fieldId; | ||
return defineFormConditional( | ||
getDateRangeToFieldReference( | ||
fieldId, | ||
comparedFieldId, | ||
"formatMaximum" | ||
) | ||
); | ||
} | ||
return defineFormConditional(getDateRange(date, "formatMaximum")); | ||
}, | ||
now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMaximum")) | ||
}), | ||
isEqualTo: (value) => defineConditional({ | ||
type: "object", | ||
properties: { | ||
$form: { | ||
isEqualTo: (value) => { | ||
if (isFieldReference(value)) { | ||
const comparedFieldId = value._fieldId; | ||
return defineFormConditional({ | ||
type: "object", | ||
properties: { | ||
[fieldId]: { | ||
oneOf: [ | ||
{ type: "string", const: value }, | ||
{ type: "boolean", const: value } | ||
], | ||
const: value | ||
} | ||
type: ["string", "boolean"], | ||
const: { $data: `1/${comparedFieldId}` } | ||
}, | ||
[comparedFieldId]: { type: ["string", "boolean"] } | ||
}, | ||
required: [fieldId] | ||
} | ||
}, | ||
required: ["$form"] | ||
}), | ||
required: [fieldId, comparedFieldId] | ||
}); | ||
} | ||
return defineFormConditional({ | ||
type: "object", | ||
properties: { | ||
[fieldId]: { | ||
oneOf: [ | ||
{ type: "string", const: value }, | ||
{ type: "boolean", const: value } | ||
], | ||
const: value | ||
} | ||
}, | ||
required: [fieldId] | ||
}); | ||
}, | ||
/** | ||
@@ -186,42 +271,19 @@ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected. | ||
*/ | ||
isFalsy: () => defineConditional({ | ||
isFalsy: () => defineFormConditional({ | ||
type: "object", | ||
properties: { | ||
$form: { | ||
type: "object", | ||
properties: { | ||
[fieldId]: { | ||
anyOf: [ | ||
{ const: "undefined" }, | ||
{ const: false }, | ||
{ const: null }, | ||
{ const: "" } | ||
] | ||
} | ||
}, | ||
[fieldId]: { | ||
anyOf: [ | ||
{ | ||
required: [fieldId] | ||
}, | ||
{ | ||
not: { | ||
required: [fieldId] | ||
} | ||
} | ||
{ const: "undefined" }, | ||
{ const: false }, | ||
{ const: null }, | ||
{ const: "" } | ||
] | ||
} | ||
}, | ||
required: ["$form"] | ||
}), | ||
isUndefined: () => defineConditional({ | ||
type: "object", | ||
properties: { | ||
$form: { | ||
type: "object", | ||
properties: { | ||
[fieldId]: { | ||
type: "string", | ||
enum: ["undefined"] | ||
} | ||
}, | ||
anyOf: [ | ||
{ | ||
required: [fieldId] | ||
}, | ||
{ | ||
not: { | ||
@@ -231,56 +293,65 @@ required: [fieldId] | ||
} | ||
] | ||
}), | ||
isUndefined: () => defineFormConditional({ | ||
type: "object", | ||
properties: { | ||
[fieldId]: { | ||
type: "string", | ||
enum: ["undefined"] | ||
} | ||
}, | ||
required: ["$form"] | ||
not: { | ||
required: [fieldId] | ||
} | ||
}), | ||
inArray: (values) => defineConditional({ | ||
inArray: (values) => defineFormConditional({ | ||
type: "object", | ||
properties: { | ||
$form: { | ||
type: "object", | ||
properties: { | ||
[fieldId]: { | ||
type: "string", | ||
enum: values | ||
} | ||
}, | ||
required: [fieldId] | ||
[fieldId]: { | ||
type: "string", | ||
enum: values | ||
} | ||
}, | ||
required: ["$form"] | ||
required: [fieldId] | ||
}), | ||
isValidEnglishName: () => defineConditional({ | ||
isValidEnglishName: () => defineFormConditional({ | ||
type: "object", | ||
properties: { | ||
$form: { | ||
type: "object", | ||
properties: { | ||
[fieldId]: { | ||
type: "string", | ||
pattern: "^[\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*( [\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*)*$", | ||
description: "Name must contain only letters, numbers, and allowed special characters ('._-). No double spaces." | ||
} | ||
}, | ||
required: [fieldId] | ||
[fieldId]: { | ||
type: "string", | ||
pattern: "^[\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*( [\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*)*$", | ||
description: "Name must contain only letters, numbers, and allowed special characters ('._-). No double spaces." | ||
} | ||
}, | ||
required: ["$form"] | ||
required: [fieldId] | ||
}), | ||
isBetween: (min, max) => defineConditional({ | ||
/** | ||
* Checks if the field value matches a given regular expression pattern. | ||
* @param pattern - The regular expression pattern to match the field value against. | ||
* @returns A JSONSchema conditional that validates the field value against the pattern. | ||
*/ | ||
matches: (pattern) => defineFormConditional({ | ||
type: "object", | ||
properties: { | ||
$form: { | ||
type: "object", | ||
properties: { | ||
[fieldId]: { | ||
type: "number", | ||
minimum: min, | ||
maximum: max | ||
} | ||
}, | ||
required: [fieldId] | ||
[fieldId]: { | ||
type: "string", | ||
pattern | ||
} | ||
}, | ||
required: ["$form"] | ||
}) | ||
required: [fieldId] | ||
}), | ||
isBetween: (min, max) => defineFormConditional({ | ||
type: "object", | ||
properties: { | ||
[fieldId]: { | ||
type: "number", | ||
minimum: min, | ||
maximum: max | ||
} | ||
}, | ||
required: [fieldId] | ||
}), | ||
getId: () => ({ fieldId }) | ||
}; | ||
} |
@@ -0,1 +1,2 @@ | ||
import { z } from 'zod'; | ||
export declare const SCOPES: { | ||
@@ -21,2 +22,3 @@ readonly NATLSYSADMIN: "natlsysadmin"; | ||
readonly RECORD_DECLARE: "record.declare-birth"; | ||
readonly RECORD_IMPORT: "record.import"; | ||
readonly RECORD_DECLARE_BIRTH: "record.declare-birth"; | ||
@@ -87,4 +89,159 @@ readonly RECORD_DECLARE_BIRTH_MY_JURISDICTION: "record.declare-birth:my-jurisdiction"; | ||
}; | ||
export type Scope = (typeof SCOPES)[keyof typeof SCOPES]; | ||
declare const LiteralScopes: z.ZodUnion<[z.ZodLiteral<"natlsysadmin">, z.ZodLiteral<"bypassratelimit">, z.ZodLiteral<"declare">, z.ZodLiteral<"register">, z.ZodLiteral<"validate">, z.ZodLiteral<"demo">, z.ZodLiteral<"certify">, z.ZodLiteral<"performance">, z.ZodLiteral<"sysadmin">, z.ZodLiteral<"teams">, z.ZodLiteral<"config">, z.ZodLiteral<"webhook">, z.ZodLiteral<"nationalId">, z.ZodLiteral<"notification-api">, z.ZodLiteral<"recordsearch">, z.ZodLiteral<"record.import">, z.ZodLiteral<"record.declare-birth">, z.ZodLiteral<"record.declare-birth:my-jurisdiction">, z.ZodLiteral<"record.declare-death">, z.ZodLiteral<"record.declare-death:my-jurisdiction">, z.ZodLiteral<"record.declare-marriage">, z.ZodLiteral<"record.declare-marriage:my-jurisdiction">, z.ZodLiteral<"record.declaration-submit-incomplete">, z.ZodLiteral<"record.declaration-submit-for-review">, z.ZodLiteral<"record.unassign-others">, z.ZodLiteral<"record.declaration-submit-for-approval">, z.ZodLiteral<"record.declaration-submit-for-updates">, z.ZodLiteral<"record.declaration-edit">, z.ZodLiteral<"record.review-duplicates">, z.ZodLiteral<"record.declaration-archive">, z.ZodLiteral<"record.declaration-reinstate">, z.ZodLiteral<"record.register">, z.ZodLiteral<"record.export-records">, z.ZodLiteral<"record.declaration-print">, z.ZodLiteral<"record.declaration-print-supporting-documents">, z.ZodLiteral<"record.registration-print">, z.ZodLiteral<"record.registration-print&issue-certified-copies">, z.ZodLiteral<"record.registration-print-certified-copies">, z.ZodLiteral<"record.registration-bulk-print-certified-copies">, z.ZodLiteral<"record.registration-verify-certified-copies">, z.ZodLiteral<"record.registration-request-correction">, z.ZodLiteral<"record.registration-correct">, z.ZodLiteral<"record.registration-request-revocation">, z.ZodLiteral<"record.registration-revoke">, z.ZodLiteral<"record.registration-request-reinstatement">, z.ZodLiteral<"record.registration-reinstate">, z.ZodLiteral<"record.confirm-registration">, z.ZodLiteral<"record.reject-registration">, z.ZodLiteral<"search.birth:my-jurisdiction">, z.ZodLiteral<"search.birth">, z.ZodLiteral<"search.death:my-jurisdiction">, z.ZodLiteral<"search.death">, z.ZodLiteral<"search.marriage:my-jurisdiction">, z.ZodLiteral<"search.marriage">, z.ZodLiteral<"record.read">, z.ZodLiteral<"record.read-audit">, z.ZodLiteral<"record.read-comments">, z.ZodLiteral<"record.create-comments">, z.ZodLiteral<"profile.update">, z.ZodLiteral<"profile.electronic-signature">, z.ZodLiteral<"performance.read">, z.ZodLiteral<"performance.read-dashboards">, z.ZodLiteral<"performance.vital-statistics-export">, z.ZodLiteral<"organisation.read-locations:all">, z.ZodLiteral<"organisation.read-locations:my-office">, z.ZodLiteral<"organisation.read-locations:my-jurisdiction">, z.ZodLiteral<"user.read:all">, z.ZodLiteral<"user.read:my-office">, z.ZodLiteral<"user.read:my-jurisdiction">, z.ZodLiteral<"user.read:only-my-audit">, z.ZodLiteral<"user.create:all">, z.ZodLiteral<"user.create:my-jurisdiction">, z.ZodLiteral<"user.update:all">, z.ZodLiteral<"user.update:my-jurisdiction">, z.ZodLiteral<"config.update:all">, z.ZodLiteral<"user.data-seeding">]>; | ||
declare const ConfigurableScopes: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{ | ||
type: z.ZodLiteral<"user.create">; | ||
options: z.ZodObject<{ | ||
role: z.ZodArray<z.ZodString, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
role: string[]; | ||
}, { | ||
role: string[]; | ||
}>; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "user.create"; | ||
options: { | ||
role: string[]; | ||
}; | ||
}, { | ||
type: "user.create"; | ||
options: { | ||
role: string[]; | ||
}; | ||
}>, z.ZodObject<{ | ||
type: z.ZodLiteral<"user.edit">; | ||
options: z.ZodObject<{ | ||
role: z.ZodArray<z.ZodString, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
role: string[]; | ||
}, { | ||
role: string[]; | ||
}>; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "user.edit"; | ||
options: { | ||
role: string[]; | ||
}; | ||
}, { | ||
type: "user.edit"; | ||
options: { | ||
role: string[]; | ||
}; | ||
}>, z.ZodObject<{ | ||
type: z.ZodLiteral<"workqueue">; | ||
options: z.ZodObject<{ | ||
id: z.ZodArray<z.ZodString, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
id: string[]; | ||
}, { | ||
id: string[]; | ||
}>; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "workqueue"; | ||
options: { | ||
id: string[]; | ||
}; | ||
}, { | ||
type: "workqueue"; | ||
options: { | ||
id: string[]; | ||
}; | ||
}>, z.ZodObject<{ | ||
type: z.ZodLiteral<"record.notify">; | ||
options: z.ZodObject<{ | ||
event: z.ZodArray<z.ZodString, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
event: string[]; | ||
}, { | ||
event: string[]; | ||
}>; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "record.notify"; | ||
options: { | ||
event: string[]; | ||
}; | ||
}, { | ||
type: "record.notify"; | ||
options: { | ||
event: string[]; | ||
}; | ||
}>]>; | ||
export type ConfigurableScopeType = ConfigurableScopes['type']; | ||
export type ConfigurableScopes = z.infer<typeof ConfigurableScopes>; | ||
export declare function findScope<T extends ConfigurableScopeType>(scopes: string[], scopeType: T): Extract<{ | ||
type: "user.create"; | ||
options: { | ||
role: string[]; | ||
}; | ||
}, { | ||
type: T; | ||
}> | Extract<{ | ||
type: "user.edit"; | ||
options: { | ||
role: string[]; | ||
}; | ||
}, { | ||
type: T; | ||
}> | Extract<{ | ||
type: "workqueue"; | ||
options: { | ||
id: string[]; | ||
}; | ||
}, { | ||
type: T; | ||
}> | Extract<{ | ||
type: "record.notify"; | ||
options: { | ||
event: string[]; | ||
}; | ||
}, { | ||
type: T; | ||
}> | undefined; | ||
/** | ||
* Parses a configurable scope string into a ConfigurableScopes object. | ||
* @param {string} scope - The scope string to parse | ||
* @returns {ConfigurableScopes | undefined} The parsed scope object if valid, undefined otherwise | ||
* @example | ||
* parseScope("user.create[role=field-agent|registration-agent]") | ||
* // Returns: { type: "user.create", options: { role: ["field-agent", "registration-agent"] } } | ||
*/ | ||
export declare function parseScope(scope: string): { | ||
type: "user.create"; | ||
options: { | ||
role: string[]; | ||
}; | ||
} | { | ||
type: "user.edit"; | ||
options: { | ||
role: string[]; | ||
}; | ||
} | { | ||
type: "workqueue"; | ||
options: { | ||
id: string[]; | ||
}; | ||
} | { | ||
type: "record.notify"; | ||
options: { | ||
event: string[]; | ||
}; | ||
} | { | ||
type: "natlsysadmin" | "bypassratelimit" | "declare" | "register" | "validate" | "demo" | "certify" | "performance" | "sysadmin" | "teams" | "config" | "webhook" | "nationalId" | "notification-api" | "recordsearch" | "record.declare-birth" | "record.import" | "record.declare-birth:my-jurisdiction" | "record.declare-death" | "record.declare-death:my-jurisdiction" | "record.declare-marriage" | "record.declare-marriage:my-jurisdiction" | "record.declaration-submit-incomplete" | "record.declaration-submit-for-review" | "record.unassign-others" | "record.declaration-submit-for-approval" | "record.declaration-submit-for-updates" | "record.declaration-edit" | "record.review-duplicates" | "record.declaration-archive" | "record.declaration-reinstate" | "record.register" | "record.export-records" | "record.declaration-print" | "record.declaration-print-supporting-documents" | "record.registration-print" | "record.registration-print&issue-certified-copies" | "record.registration-print-certified-copies" | "record.registration-bulk-print-certified-copies" | "record.registration-verify-certified-copies" | "record.registration-request-correction" | "record.registration-correct" | "record.registration-request-revocation" | "record.registration-revoke" | "record.registration-request-reinstatement" | "record.registration-reinstate" | "record.confirm-registration" | "record.reject-registration" | "search.birth:my-jurisdiction" | "search.birth" | "search.death:my-jurisdiction" | "search.death" | "search.marriage:my-jurisdiction" | "search.marriage" | "record.read" | "record.read-audit" | "record.read-comments" | "record.create-comments" | "profile.update" | "profile.electronic-signature" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "organisation.read-locations:all" | "organisation.read-locations:my-office" | "organisation.read-locations:my-jurisdiction" | "user.read:all" | "user.read:my-office" | "user.read:my-jurisdiction" | "user.read:only-my-audit" | "user.create:all" | "user.create:my-jurisdiction" | "user.update:all" | "user.update:my-jurisdiction" | "config.update:all" | "user.data-seeding"; | ||
} | undefined; | ||
/** | ||
* Stringifies a ConfigurableScopes object into a scope string. | ||
* @param {ConfigurableScopes} scope - The scope object to stringify | ||
* @returns {string} The stringified scope in format "type[key1=value1|value2,key2=value3|value4]" | ||
* @example | ||
* stringifyScope({ | ||
* type: "record.notify", | ||
* options: { event: ["v2.birth", "tennis-club-membership"] } | ||
* }) | ||
* // Returns: "record.notify[event=v2.birth|tennis-club-membership]" | ||
*/ | ||
export declare function stringifyScope(scope: ConfigurableScopes): string; | ||
export declare const scopes: Scope[]; | ||
export type ParsedScopes = NonNullable<ReturnType<typeof parseScope>>; | ||
export type RawScopes = z.infer<typeof LiteralScopes> | (string & {}); | ||
export type Scope = RawScopes; | ||
export {}; | ||
//# sourceMappingURL=scopes.d.ts.map |
@@ -24,3 +24,6 @@ "use strict"; | ||
SCOPES: () => SCOPES, | ||
scopes: () => scopes | ||
findScope: () => findScope, | ||
parseScope: () => parseScope, | ||
scopes: () => scopes, | ||
stringifyScope: () => stringifyScope | ||
}); | ||
@@ -30,2 +33,3 @@ module.exports = __toCommonJS(scopes_exports); | ||
// ../commons/src/scopes.ts | ||
var import_zod = require("zod"); | ||
var SCOPES = { | ||
@@ -54,2 +58,4 @@ // TODO v1.8 legacy scopes | ||
// declare | ||
RECORD_IMPORT: "record.import", | ||
// declare | ||
RECORD_DECLARE_BIRTH: "record.declare-birth", | ||
@@ -142,2 +148,147 @@ RECORD_DECLARE_BIRTH_MY_JURISDICTION: "record.declare-birth:my-jurisdiction", | ||
}; | ||
var LiteralScopes = import_zod.z.union([ | ||
import_zod.z.literal(SCOPES.NATLSYSADMIN), | ||
import_zod.z.literal(SCOPES.BYPASSRATELIMIT), | ||
import_zod.z.literal(SCOPES.DECLARE), | ||
import_zod.z.literal(SCOPES.REGISTER), | ||
import_zod.z.literal(SCOPES.VALIDATE), | ||
import_zod.z.literal(SCOPES.DEMO), | ||
import_zod.z.literal(SCOPES.CERTIFY), | ||
import_zod.z.literal(SCOPES.PERFORMANCE), | ||
import_zod.z.literal(SCOPES.SYSADMIN), | ||
import_zod.z.literal(SCOPES.TEAMS), | ||
import_zod.z.literal(SCOPES.CONFIG), | ||
import_zod.z.literal(SCOPES.WEBHOOK), | ||
import_zod.z.literal(SCOPES.NATIONALID), | ||
import_zod.z.literal(SCOPES.NOTIFICATION_API), | ||
import_zod.z.literal(SCOPES.RECORDSEARCH), | ||
import_zod.z.literal(SCOPES.RECORD_IMPORT), | ||
import_zod.z.literal(SCOPES.RECORD_DECLARE_BIRTH), | ||
import_zod.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION), | ||
import_zod.z.literal(SCOPES.RECORD_DECLARE_DEATH), | ||
import_zod.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION), | ||
import_zod.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE), | ||
import_zod.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION), | ||
import_zod.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE), | ||
import_zod.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW), | ||
import_zod.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS), | ||
import_zod.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL), | ||
import_zod.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES), | ||
import_zod.z.literal(SCOPES.RECORD_DECLARATION_EDIT), | ||
import_zod.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES), | ||
import_zod.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE), | ||
import_zod.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE), | ||
import_zod.z.literal(SCOPES.RECORD_REGISTER), | ||
import_zod.z.literal(SCOPES.RECORD_EXPORT_RECORDS), | ||
import_zod.z.literal(SCOPES.RECORD_DECLARATION_PRINT), | ||
import_zod.z.literal(SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS), | ||
import_zod.z.literal(SCOPES.RECORD_REGISTRATION_PRINT), | ||
import_zod.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES), | ||
import_zod.z.literal(SCOPES.RECORD_PRINT_CERTIFIED_COPIES), | ||
import_zod.z.literal(SCOPES.RECORD_BULK_PRINT_CERTIFIED_COPIES), | ||
import_zod.z.literal(SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES), | ||
import_zod.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION), | ||
import_zod.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT), | ||
import_zod.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REVOCATION), | ||
import_zod.z.literal(SCOPES.RECORD_REGISTRATION_REVOKE), | ||
import_zod.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REINSTATEMENT), | ||
import_zod.z.literal(SCOPES.RECORD_REGISTRATION_REINSTATE), | ||
import_zod.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION), | ||
import_zod.z.literal(SCOPES.RECORD_REJECT_REGISTRATION), | ||
import_zod.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION), | ||
import_zod.z.literal(SCOPES.SEARCH_BIRTH), | ||
import_zod.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION), | ||
import_zod.z.literal(SCOPES.SEARCH_DEATH), | ||
import_zod.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION), | ||
import_zod.z.literal(SCOPES.SEARCH_MARRIAGE), | ||
import_zod.z.literal(SCOPES.RECORD_READ), | ||
import_zod.z.literal(SCOPES.RECORD_READ_AUDIT), | ||
import_zod.z.literal(SCOPES.RECORD_READ_COMMENTS), | ||
import_zod.z.literal(SCOPES.RECORD_CREATE_COMMENTS), | ||
import_zod.z.literal(SCOPES.PROFILE_UPDATE), | ||
import_zod.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE), | ||
import_zod.z.literal(SCOPES.PERFORMANCE_READ), | ||
import_zod.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS), | ||
import_zod.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS), | ||
import_zod.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS), | ||
import_zod.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE), | ||
import_zod.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION), | ||
import_zod.z.literal(SCOPES.USER_READ), | ||
import_zod.z.literal(SCOPES.USER_READ_MY_OFFICE), | ||
import_zod.z.literal(SCOPES.USER_READ_MY_JURISDICTION), | ||
import_zod.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT), | ||
import_zod.z.literal(SCOPES.USER_CREATE), | ||
import_zod.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION), | ||
import_zod.z.literal(SCOPES.USER_UPDATE), | ||
import_zod.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION), | ||
import_zod.z.literal(SCOPES.CONFIG_UPDATE_ALL), | ||
import_zod.z.literal(SCOPES.USER_DATA_SEEDING) | ||
]); | ||
var rawConfigurableScopeRegex = /^([a-zA-Z\.]+)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/; | ||
var rawConfigurableScope = import_zod.z.string().regex(rawConfigurableScopeRegex); | ||
var CreateUserScope = import_zod.z.object({ | ||
type: import_zod.z.literal("user.create"), | ||
options: import_zod.z.object({ | ||
role: import_zod.z.array(import_zod.z.string()) | ||
}) | ||
}); | ||
var EditUserScope = import_zod.z.object({ | ||
type: import_zod.z.literal("user.edit"), | ||
options: import_zod.z.object({ | ||
role: import_zod.z.array(import_zod.z.string()) | ||
}) | ||
}); | ||
var WorkqueueScope = import_zod.z.object({ | ||
type: import_zod.z.literal("workqueue"), | ||
options: import_zod.z.object({ | ||
id: import_zod.z.array(import_zod.z.string()) | ||
}) | ||
}); | ||
var NotifyRecordScope = import_zod.z.object({ | ||
type: import_zod.z.literal("record.notify"), | ||
options: import_zod.z.object({ | ||
event: import_zod.z.array(import_zod.z.string()) | ||
}) | ||
}); | ||
var ConfigurableScopes = import_zod.z.discriminatedUnion("type", [ | ||
CreateUserScope, | ||
EditUserScope, | ||
WorkqueueScope, | ||
NotifyRecordScope | ||
]); | ||
function findScope(scopes2, scopeType) { | ||
const parsedScopes = scopes2.map((rawScope) => parseScope(rawScope)); | ||
return parsedScopes.find( | ||
(parsedScope) => parsedScope?.type === scopeType | ||
); | ||
} | ||
function parseScope(scope) { | ||
const maybeLiteralScope = LiteralScopes.safeParse(scope); | ||
if (maybeLiteralScope.success) { | ||
return { | ||
type: maybeLiteralScope.data | ||
}; | ||
} | ||
const maybeConfigurableScope = rawConfigurableScope.safeParse(scope); | ||
if (!maybeConfigurableScope.success) { | ||
return; | ||
} | ||
const rawScope = maybeConfigurableScope.data; | ||
const [, type, rawOptions] = rawScope.match(rawConfigurableScopeRegex) ?? []; | ||
const options = rawOptions.split(",").reduce((acc, option) => { | ||
const [key, value] = option.split("="); | ||
acc[key] = value.split("|"); | ||
return acc; | ||
}, {}); | ||
const parsedScope = { | ||
type, | ||
options | ||
}; | ||
const result = ConfigurableScopes.safeParse(parsedScope); | ||
return result.success ? result.data : void 0; | ||
} | ||
function stringifyScope(scope) { | ||
const options = Object.entries(scope.options).map(([key, value]) => `${key}=${value.join("|")}`).join(","); | ||
return `${scope.type}[${options}]`; | ||
} | ||
var scopes = Object.values(SCOPES); |
{ | ||
"name": "@opencrvs/toolkit", | ||
"version": "1.8.0-rc.483dc44", | ||
"version": "1.8.0-rc.4858a6a", | ||
"description": "OpenCRVS toolkit for building country configurations", | ||
@@ -23,3 +23,4 @@ "license": "MPL-2.0", | ||
"@trpc/client": "^11.0.0-rc.648", | ||
"@trpc/server": "^11.0.0-rc.532" | ||
"@trpc/server": "^11.0.0-rc.532", | ||
"zod-openapi": "^4.2.4" | ||
}, | ||
@@ -26,0 +27,0 @@ "devDependencies": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
11962543
321.32%68
19.3%303627
323.47%7
16.67%1
Infinity%+ Added
+ Added
+ Added