@opencrvs/toolkit 1.8.1-rc.985e0f0 → 1.8.1-rc.9d3f7cc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commons/api/router.d.ts +409 -392
- package/dist/commons/conditionals/validate.d.ts +11 -2
- package/dist/commons/events/ActionConfig.d.ts +2730 -532
- package/dist/commons/events/ActionDocument.d.ts +1252 -716
- package/dist/commons/events/ActionInput.d.ts +626 -600
- package/dist/commons/events/AdvancedSearchConfig.d.ts +83 -65
- package/dist/commons/events/CompositeFieldValue.d.ts +6 -6
- package/dist/commons/events/CountryConfigQueryInput.d.ts +88 -88
- package/dist/commons/events/DeduplicationConfig.d.ts +21 -48
- package/dist/commons/events/Draft.d.ts +48 -48
- package/dist/commons/events/EventConfig.d.ts +1031 -217
- package/dist/commons/events/EventDocument.d.ts +451 -432
- package/dist/commons/events/EventIndex.d.ts +184 -62
- package/dist/commons/events/EventMetadata.d.ts +9 -9
- package/dist/commons/events/FieldConfig.d.ts +254 -43
- package/dist/commons/events/FieldTypeMapping.d.ts +16 -16
- package/dist/commons/events/FieldValue.d.ts +12 -12
- package/dist/commons/events/FormConfig.d.ts +1032 -246
- package/dist/commons/events/PageConfig.d.ts +264 -46
- package/dist/commons/events/WorkqueueConfig.d.ts +288 -164
- package/dist/commons/events/defineConfig.d.ts +189 -35
- package/dist/commons/events/event.d.ts +68 -6
- package/dist/commons/events/field.d.ts +14 -0
- package/dist/commons/events/test.utils.d.ts +12 -12
- package/dist/commons/events/utils.d.ts +296 -65
- package/dist/conditionals/index.js +3 -2
- package/dist/events/index.js +415 -258
- package/package.json +1 -1
- package/tsconfig.json +1 -1
- package/dist/commons/conditionals/conditionals.test.d.ts +0 -2
- package/dist/commons/conditionals/validate-address.test.d.ts +0 -2
- package/dist/commons/conditionals/validate.test.d.ts +0 -2
- package/dist/commons/events/utils.test.d.ts +0 -2
package/dist/events/index.js
CHANGED
@@ -40,6 +40,7 @@ __export(events_exports, {
|
|
40
40
|
ActionConfigBase: () => ActionConfigBase,
|
41
41
|
ActionCreationMetadata: () => ActionCreationMetadata,
|
42
42
|
ActionDocument: () => ActionDocument,
|
43
|
+
ActionFlag: () => ActionFlag,
|
43
44
|
ActionFormConfig: () => ActionFormConfig,
|
44
45
|
ActionInput: () => ActionInput,
|
45
46
|
ActionStatus: () => ActionStatus,
|
@@ -95,6 +96,7 @@ __export(events_exports, {
|
|
95
96
|
EventDocument: () => EventDocument,
|
96
97
|
EventFieldConfigSchema: () => EventFieldConfigSchema,
|
97
98
|
EventFieldId: () => EventFieldId,
|
99
|
+
EventFieldIdInput: () => EventFieldIdInput,
|
98
100
|
EventIndex: () => EventIndex,
|
99
101
|
EventInput: () => EventInput,
|
100
102
|
EventMetadata: () => EventMetadata,
|
@@ -129,8 +131,10 @@ __export(events_exports, {
|
|
129
131
|
InherentFlags: () => InherentFlags,
|
130
132
|
LanguageConfig: () => LanguageConfig,
|
131
133
|
LegalStatuses: () => LegalStatuses,
|
134
|
+
METADATA_FIELD_PREFIX: () => METADATA_FIELD_PREFIX,
|
132
135
|
MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
|
133
136
|
MimeType: () => MimeType,
|
137
|
+
NameConfig: () => NameConfig,
|
134
138
|
NameFieldUpdateValue: () => NameFieldUpdateValue,
|
135
139
|
NameFieldValue: () => NameFieldValue,
|
136
140
|
NonEmptyTextValue: () => NonEmptyTextValue,
|
@@ -139,6 +143,7 @@ __export(events_exports, {
|
|
139
143
|
PageConfig: () => PageConfig,
|
140
144
|
PageTypes: () => PageTypes,
|
141
145
|
PrintCertificateActionInput: () => PrintCertificateActionInput,
|
146
|
+
PrintContent: () => PrintContent,
|
142
147
|
QueryExpression: () => QueryExpression,
|
143
148
|
QueryInput: () => QueryInput,
|
144
149
|
QueryType: () => QueryType,
|
@@ -167,6 +172,7 @@ __export(events_exports, {
|
|
167
172
|
TENNIS_CLUB_MEMBERSHIP: () => TENNIS_CLUB_MEMBERSHIP,
|
168
173
|
TEST_SYSTEM_IANA_TIMEZONE: () => TEST_SYSTEM_IANA_TIMEZONE,
|
169
174
|
TestUserRole: () => TestUserRole,
|
175
|
+
TextField: () => TextField,
|
170
176
|
TextValue: () => TextValue,
|
171
177
|
TimeValue: () => TimeValue,
|
172
178
|
TranslationConfig: () => TranslationConfig,
|
@@ -178,7 +184,6 @@ __export(events_exports, {
|
|
178
184
|
ValidationConfig: () => ValidationConfig,
|
179
185
|
VerificationActionConfig: () => VerificationActionConfig,
|
180
186
|
VerificationPageConfig: () => VerificationPageConfig,
|
181
|
-
VisibleStatus: () => VisibleStatus,
|
182
187
|
WRITE_ACTION_SCOPES: () => WRITE_ACTION_SCOPES,
|
183
188
|
Within: () => Within,
|
184
189
|
WorkqueueActionsWithDefault: () => WorkqueueActionsWithDefault,
|
@@ -197,6 +202,7 @@ __export(events_exports, {
|
|
197
202
|
annotationActions: () => annotationActions,
|
198
203
|
applyDeclarationToEventIndex: () => applyDeclarationToEventIndex,
|
199
204
|
applyDraftsToEventIndex: () => applyDraftsToEventIndex,
|
205
|
+
areCertificateConditionsMet: () => areCertificateConditionsMet,
|
200
206
|
areConditionsMet: () => areConditionsMet,
|
201
207
|
compositeFieldTypes: () => compositeFieldTypes,
|
202
208
|
createEmptyDraft: () => createEmptyDraft,
|
@@ -320,6 +326,7 @@ __export(events_exports, {
|
|
320
326
|
or: () => or,
|
321
327
|
resolveDateOfEvent: () => resolveDateOfEvent,
|
322
328
|
runFieldValidations: () => runFieldValidations,
|
329
|
+
runStructuralValidations: () => runStructuralValidations,
|
323
330
|
timePeriodToDateRange: () => timePeriodToDateRange,
|
324
331
|
user: () => user,
|
325
332
|
validate: () => validate,
|
@@ -334,7 +341,7 @@ var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
|
|
334
341
|
var BIRTH_EVENT = "v2-birth";
|
335
342
|
|
336
343
|
// ../commons/src/events/ActionConfig.ts
|
337
|
-
var
|
344
|
+
var import_zod11 = require("zod");
|
338
345
|
|
339
346
|
// ../commons/src/events/Conditional.ts
|
340
347
|
var import_zod = require("zod");
|
@@ -554,7 +561,7 @@ var import_zod6 = require("zod");
|
|
554
561
|
var import_zod4 = require("zod");
|
555
562
|
var import_zod_openapi3 = require("zod-openapi");
|
556
563
|
(0, import_zod_openapi3.extendZodWithOpenApi)(import_zod4.z);
|
557
|
-
var
|
564
|
+
var FullDocumentUrl = import_zod4.z.string().brand("FullDocumentUrl").describe(
|
558
565
|
"A full url with protocol, host, bucket name, starting from the root of the S3 server, https://minio/bucket-name/document-id.jpg"
|
559
566
|
);
|
560
567
|
var FullDocumentPath = import_zod4.z.string().transform((val) => val.startsWith("/") ? val : `/${val}`).openapi({ effectType: "input", type: "string" }).describe(
|
@@ -611,8 +618,8 @@ var NameFieldValue = import_zod5.z.object({
|
|
611
618
|
middlename: import_zod5.z.string().optional()
|
612
619
|
});
|
613
620
|
var NameFieldUpdateValue = import_zod5.z.object({
|
614
|
-
firstname: import_zod5.z.string()
|
615
|
-
surname: import_zod5.z.string()
|
621
|
+
firstname: import_zod5.z.string(),
|
622
|
+
surname: import_zod5.z.string(),
|
616
623
|
middlename: import_zod5.z.string().nullish()
|
617
624
|
}).or(import_zod5.z.null()).or(import_zod5.z.undefined());
|
618
625
|
var RuralAddressUpdateValue = AdminStructure.extend({
|
@@ -909,18 +916,32 @@ var SelectDateRangeField = BaseField.extend({
|
|
909
916
|
defaultValue: SelectDateRangeValue.optional(),
|
910
917
|
options: import_zod7.z.array(SelectDateRangeOption).describe("A list of options")
|
911
918
|
}).describe("Select input with date range options");
|
919
|
+
var NameConfig = import_zod7.z.object({
|
920
|
+
firstname: import_zod7.z.object({ required: import_zod7.z.boolean() }).optional(),
|
921
|
+
middlename: import_zod7.z.object({ required: import_zod7.z.boolean() }).optional(),
|
922
|
+
surname: import_zod7.z.object({ required: import_zod7.z.boolean() }).optional()
|
923
|
+
});
|
912
924
|
var NameField = BaseField.extend({
|
913
925
|
type: import_zod7.z.literal(FieldType.NAME),
|
914
926
|
defaultValue: import_zod7.z.object({
|
915
|
-
firstname: NonEmptyTextValue,
|
916
|
-
|
927
|
+
firstname: NonEmptyTextValue.optional(),
|
928
|
+
middlename: NonEmptyTextValue.optional(),
|
929
|
+
surname: NonEmptyTextValue.optional()
|
917
930
|
}).optional(),
|
918
931
|
configuration: import_zod7.z.object({
|
932
|
+
name: NameConfig.default({
|
933
|
+
firstname: { required: true },
|
934
|
+
surname: { required: true }
|
935
|
+
}).optional(),
|
919
936
|
maxLength: import_zod7.z.number().optional().describe("Maximum length of the text"),
|
920
937
|
prefix: TranslationConfig.optional(),
|
921
938
|
postfix: TranslationConfig.optional(),
|
922
|
-
includeMiddlename: import_zod7.z.boolean().default(false).optional().describe("To make middle name visible in Name form field"),
|
923
939
|
searchMode: import_zod7.z.boolean().optional()
|
940
|
+
}).default({
|
941
|
+
name: {
|
942
|
+
firstname: { required: true },
|
943
|
+
surname: { required: true }
|
944
|
+
}
|
924
945
|
}).optional()
|
925
946
|
}).describe("Name input field");
|
926
947
|
var PhoneField = BaseField.extend({
|
@@ -1093,91 +1114,168 @@ var ActionFormConfig = import_zod9.z.object({
|
|
1093
1114
|
});
|
1094
1115
|
var FormConfig = import_zod9.z.union([DeclarationFormConfig, ActionFormConfig]);
|
1095
1116
|
|
1096
|
-
// ../commons/src/events/
|
1117
|
+
// ../commons/src/events/DeduplicationConfig.ts
|
1118
|
+
var import_zod10 = require("zod");
|
1097
1119
|
var import_zod_openapi6 = require("zod-openapi");
|
1098
1120
|
(0, import_zod_openapi6.extendZodWithOpenApi)(import_zod10.z);
|
1099
|
-
var
|
1121
|
+
var FieldReference2 = import_zod10.z.string();
|
1122
|
+
var Matcher = import_zod10.z.object({
|
1123
|
+
/**
|
1124
|
+
* The reference to the field to match against.
|
1125
|
+
*
|
1126
|
+
* For `dateDistance` type matcher the value of this field will
|
1127
|
+
* be used as the origin date to calculate the distance from.
|
1128
|
+
*/
|
1129
|
+
fieldId: FieldReference2,
|
1130
|
+
options: import_zod10.z.object({
|
1131
|
+
boost: import_zod10.z.number().optional()
|
1132
|
+
}).optional().default({
|
1133
|
+
boost: 1
|
1134
|
+
})
|
1135
|
+
});
|
1136
|
+
var FuzzyMatcher = Matcher.extend({
|
1137
|
+
type: import_zod10.z.literal("fuzzy"),
|
1138
|
+
options: import_zod10.z.object({
|
1139
|
+
/**
|
1140
|
+
* Names of length 3 or less characters = 0 edits allowed
|
1141
|
+
* Names of length 4 - 6 characters = 1 edit allowed
|
1142
|
+
* Names of length >7 characters = 2 edits allowed
|
1143
|
+
*/
|
1144
|
+
fuzziness: import_zod10.z.union([import_zod10.z.string(), import_zod10.z.number()]).optional().default("AUTO:4,7"),
|
1145
|
+
boost: import_zod10.z.number().optional().default(1)
|
1146
|
+
}).optional().default({
|
1147
|
+
fuzziness: "AUTO:4,7",
|
1148
|
+
boost: 1
|
1149
|
+
})
|
1150
|
+
});
|
1151
|
+
var StrictMatcher = Matcher.extend({
|
1152
|
+
type: import_zod10.z.literal("strict"),
|
1153
|
+
options: import_zod10.z.object({
|
1154
|
+
boost: import_zod10.z.number().optional().default(1)
|
1155
|
+
}).optional().default({
|
1156
|
+
boost: 1
|
1157
|
+
})
|
1158
|
+
});
|
1159
|
+
var DateDistanceMatcher = Matcher.extend({
|
1160
|
+
type: import_zod10.z.literal("dateDistance"),
|
1161
|
+
options: import_zod10.z.object({
|
1162
|
+
days: import_zod10.z.number(),
|
1163
|
+
boost: import_zod10.z.number().optional().default(1)
|
1164
|
+
})
|
1165
|
+
});
|
1166
|
+
var And = import_zod10.z.object({
|
1167
|
+
type: import_zod10.z.literal("and"),
|
1168
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
1169
|
+
clauses: import_zod10.z.lazy(() => Clause.array())
|
1170
|
+
});
|
1171
|
+
var Or = import_zod10.z.object({
|
1172
|
+
type: import_zod10.z.literal("or"),
|
1173
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
1174
|
+
clauses: import_zod10.z.lazy(() => Clause.array())
|
1175
|
+
});
|
1176
|
+
var Clause = import_zod10.z.lazy(
|
1177
|
+
() => import_zod10.z.discriminatedUnion("type", [
|
1178
|
+
And,
|
1179
|
+
Or,
|
1180
|
+
FuzzyMatcher,
|
1181
|
+
StrictMatcher,
|
1182
|
+
DateDistanceMatcher
|
1183
|
+
])
|
1184
|
+
).openapi({
|
1185
|
+
ref: "Clause"
|
1186
|
+
});
|
1187
|
+
var DeduplicationConfig = import_zod10.z.object({
|
1188
|
+
id: import_zod10.z.string(),
|
1189
|
+
label: TranslationConfig,
|
1190
|
+
query: Clause
|
1191
|
+
});
|
1192
|
+
|
1193
|
+
// ../commons/src/events/ActionConfig.ts
|
1194
|
+
var import_zod_openapi7 = require("zod-openapi");
|
1195
|
+
(0, import_zod_openapi7.extendZodWithOpenApi)(import_zod11.z);
|
1196
|
+
var ActionConditional2 = import_zod11.z.discriminatedUnion("type", [
|
1100
1197
|
/** If conditional is defined, the action is shown to the user only if the condition is met */
|
1101
1198
|
ShowConditional,
|
1102
1199
|
/** If conditional is defined, the action is enabled only if the condition is met */
|
1103
1200
|
EnableConditional
|
1104
1201
|
]);
|
1105
|
-
var DeclarationReviewConfig =
|
1202
|
+
var DeclarationReviewConfig = import_zod11.z.object({
|
1106
1203
|
title: TranslationConfig.describe("Title of the review page"),
|
1107
|
-
fields:
|
1204
|
+
fields: import_zod11.z.array(FieldConfig).describe("Fields to be rendered on the review page for annotations.")
|
1108
1205
|
}).describe("Configuration for **declaration** review page.");
|
1109
|
-
var ActionConfigBase =
|
1206
|
+
var ActionConfigBase = import_zod11.z.object({
|
1110
1207
|
label: TranslationConfig,
|
1111
|
-
conditionals:
|
1112
|
-
|
1208
|
+
conditionals: import_zod11.z.array(ActionConditional2).optional().default([]),
|
1209
|
+
deduplication: DeduplicationConfig.optional(),
|
1210
|
+
draft: import_zod11.z.boolean().optional()
|
1113
1211
|
});
|
1114
1212
|
var ReadActionConfig = ActionConfigBase.merge(
|
1115
|
-
|
1116
|
-
type:
|
1213
|
+
import_zod11.z.object({
|
1214
|
+
type: import_zod11.z.literal(ActionType.READ),
|
1117
1215
|
review: DeclarationReviewConfig
|
1118
1216
|
})
|
1119
1217
|
);
|
1120
1218
|
var DeclareConfig = ActionConfigBase.merge(
|
1121
|
-
|
1122
|
-
type:
|
1219
|
+
import_zod11.z.object({
|
1220
|
+
type: import_zod11.z.literal(ActionType.DECLARE),
|
1123
1221
|
review: DeclarationReviewConfig
|
1124
1222
|
})
|
1125
1223
|
);
|
1126
1224
|
var ValidateConfig = ActionConfigBase.merge(
|
1127
|
-
|
1128
|
-
type:
|
1225
|
+
import_zod11.z.object({
|
1226
|
+
type: import_zod11.z.literal(ActionType.VALIDATE),
|
1129
1227
|
review: DeclarationReviewConfig
|
1130
1228
|
})
|
1131
1229
|
);
|
1132
1230
|
var RegisterConfig = ActionConfigBase.merge(
|
1133
|
-
|
1134
|
-
type:
|
1231
|
+
import_zod11.z.object({
|
1232
|
+
type: import_zod11.z.literal(ActionType.REGISTER),
|
1135
1233
|
review: DeclarationReviewConfig
|
1136
1234
|
})
|
1137
1235
|
);
|
1138
1236
|
var RejectDeclarationConfig = ActionConfigBase.merge(
|
1139
|
-
|
1140
|
-
type:
|
1237
|
+
import_zod11.z.object({
|
1238
|
+
type: import_zod11.z.literal(ActionType.REJECT)
|
1141
1239
|
})
|
1142
1240
|
);
|
1143
1241
|
var MarkedAsDuplicateConfig = ActionConfigBase.merge(
|
1144
|
-
|
1145
|
-
type:
|
1242
|
+
import_zod11.z.object({
|
1243
|
+
type: import_zod11.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1146
1244
|
})
|
1147
1245
|
);
|
1148
1246
|
var ArchiveConfig = ActionConfigBase.merge(
|
1149
|
-
|
1150
|
-
type:
|
1247
|
+
import_zod11.z.object({
|
1248
|
+
type: import_zod11.z.literal(ActionType.ARCHIVE)
|
1151
1249
|
})
|
1152
1250
|
);
|
1153
1251
|
var DeleteConfig = ActionConfigBase.merge(
|
1154
|
-
|
1155
|
-
type:
|
1252
|
+
import_zod11.z.object({
|
1253
|
+
type: import_zod11.z.literal(ActionType.DELETE)
|
1156
1254
|
})
|
1157
1255
|
);
|
1158
1256
|
var PrintCertificateActionConfig = ActionConfigBase.merge(
|
1159
|
-
|
1160
|
-
type:
|
1257
|
+
import_zod11.z.object({
|
1258
|
+
type: import_zod11.z.literal(ActionType.PRINT_CERTIFICATE),
|
1161
1259
|
printForm: ActionFormConfig
|
1162
1260
|
})
|
1163
1261
|
);
|
1164
1262
|
var RequestCorrectionConfig = ActionConfigBase.merge(
|
1165
|
-
|
1166
|
-
type:
|
1263
|
+
import_zod11.z.object({
|
1264
|
+
type: import_zod11.z.literal(ActionType.REQUEST_CORRECTION),
|
1167
1265
|
correctionForm: ActionFormConfig
|
1168
1266
|
})
|
1169
1267
|
);
|
1170
1268
|
var RejectCorrectionConfig = ActionConfigBase.merge(
|
1171
|
-
|
1172
|
-
type:
|
1269
|
+
import_zod11.z.object({
|
1270
|
+
type: import_zod11.z.literal(ActionType.REJECT_CORRECTION)
|
1173
1271
|
})
|
1174
1272
|
);
|
1175
1273
|
var ApproveCorrectionConfig = ActionConfigBase.merge(
|
1176
|
-
|
1177
|
-
type:
|
1274
|
+
import_zod11.z.object({
|
1275
|
+
type: import_zod11.z.literal(ActionType.APPROVE_CORRECTION)
|
1178
1276
|
})
|
1179
1277
|
);
|
1180
|
-
var ActionConfig =
|
1278
|
+
var ActionConfig = import_zod11.z.discriminatedUnion("type", [
|
1181
1279
|
/*
|
1182
1280
|
* OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
|
1183
1281
|
* and treat them as "models" instead of duplicating the data structure in each endpoint.
|
@@ -1197,124 +1295,52 @@ var ActionConfig = import_zod10.z.discriminatedUnion("type", [
|
|
1197
1295
|
RejectCorrectionConfig.openapi({ ref: "RejectCorrectionActionConfig" }),
|
1198
1296
|
ApproveCorrectionConfig.openapi({ ref: "ApproveCorrectionActionConfig" })
|
1199
1297
|
]).openapi({ ref: "ActionConfig" });
|
1200
|
-
var DeclarationActionConfig =
|
1298
|
+
var DeclarationActionConfig = import_zod11.z.discriminatedUnion("type", [
|
1201
1299
|
DeclareConfig,
|
1202
1300
|
ValidateConfig,
|
1203
1301
|
RegisterConfig
|
1204
1302
|
]);
|
1205
1303
|
|
1206
1304
|
// ../commons/src/events/offline/CertificateConfig.ts
|
1207
|
-
var
|
1208
|
-
var FontFamily =
|
1209
|
-
normal:
|
1210
|
-
bold:
|
1211
|
-
italics:
|
1212
|
-
bolditalics:
|
1305
|
+
var import_zod12 = require("zod");
|
1306
|
+
var FontFamily = import_zod12.z.object({
|
1307
|
+
normal: import_zod12.z.string(),
|
1308
|
+
bold: import_zod12.z.string(),
|
1309
|
+
italics: import_zod12.z.string(),
|
1310
|
+
bolditalics: import_zod12.z.string()
|
1213
1311
|
});
|
1214
|
-
var CertificateConfig =
|
1215
|
-
id:
|
1216
|
-
event:
|
1312
|
+
var CertificateConfig = import_zod12.z.object({
|
1313
|
+
id: import_zod12.z.string(),
|
1314
|
+
event: import_zod12.z.string(),
|
1217
1315
|
label: TranslationConfig,
|
1218
|
-
isDefault:
|
1219
|
-
fee:
|
1220
|
-
onTime:
|
1221
|
-
late:
|
1222
|
-
delayed:
|
1316
|
+
isDefault: import_zod12.z.boolean(),
|
1317
|
+
fee: import_zod12.z.object({
|
1318
|
+
onTime: import_zod12.z.number(),
|
1319
|
+
late: import_zod12.z.number(),
|
1320
|
+
delayed: import_zod12.z.number()
|
1223
1321
|
}),
|
1224
|
-
svgUrl:
|
1225
|
-
fonts:
|
1322
|
+
svgUrl: import_zod12.z.string(),
|
1323
|
+
fonts: import_zod12.z.record(FontFamily).optional(),
|
1324
|
+
conditionals: import_zod12.z.array(ShowConditional).optional()
|
1226
1325
|
});
|
1227
1326
|
var CertificateTemplateConfig = CertificateConfig.extend({
|
1228
|
-
hash:
|
1229
|
-
svg:
|
1327
|
+
hash: import_zod12.z.string().optional(),
|
1328
|
+
svg: import_zod12.z.string()
|
1230
1329
|
});
|
1231
1330
|
|
1232
1331
|
// ../commons/src/events/offline/LanguageConfig.ts
|
1233
|
-
var
|
1234
|
-
var LanguageConfig =
|
1235
|
-
lang:
|
1332
|
+
var import_zod13 = require("zod");
|
1333
|
+
var LanguageConfig = import_zod13.z.object({
|
1334
|
+
lang: import_zod13.z.string(),
|
1236
1335
|
/**
|
1237
1336
|
* client.csv contents
|
1238
1337
|
*/
|
1239
|
-
messages:
|
1338
|
+
messages: import_zod13.z.record(import_zod13.z.string())
|
1240
1339
|
});
|
1241
1340
|
|
1242
1341
|
// ../commons/src/events/EventConfig.ts
|
1243
1342
|
var import_zod21 = require("zod");
|
1244
1343
|
|
1245
|
-
// ../commons/src/events/DeduplicationConfig.ts
|
1246
|
-
var import_zod13 = require("zod");
|
1247
|
-
var import_zod_openapi7 = require("zod-openapi");
|
1248
|
-
(0, import_zod_openapi7.extendZodWithOpenApi)(import_zod13.z);
|
1249
|
-
var FieldReference2 = import_zod13.z.string();
|
1250
|
-
var Matcher = import_zod13.z.object({
|
1251
|
-
fieldId: import_zod13.z.string(),
|
1252
|
-
options: import_zod13.z.object({
|
1253
|
-
boost: import_zod13.z.number().optional()
|
1254
|
-
}).optional().default({})
|
1255
|
-
});
|
1256
|
-
var FuzzyMatcher = Matcher.extend({
|
1257
|
-
type: import_zod13.z.literal("fuzzy"),
|
1258
|
-
options: import_zod13.z.object({
|
1259
|
-
/**
|
1260
|
-
* Names of length 3 or less characters = 0 edits allowed
|
1261
|
-
* Names of length 4 - 6 characters = 1 edit allowed
|
1262
|
-
* Names of length >7 characters = 2 edits allowed
|
1263
|
-
*/
|
1264
|
-
fuzziness: import_zod13.z.union([import_zod13.z.string(), import_zod13.z.number()]).optional().default("AUTO:4,7"),
|
1265
|
-
boost: import_zod13.z.number().optional().default(1)
|
1266
|
-
}).optional().default({})
|
1267
|
-
});
|
1268
|
-
var StrictMatcher = Matcher.extend({
|
1269
|
-
type: import_zod13.z.literal("strict"),
|
1270
|
-
options: import_zod13.z.object({
|
1271
|
-
boost: import_zod13.z.number().optional().default(1)
|
1272
|
-
}).optional().default({})
|
1273
|
-
});
|
1274
|
-
var DateRangeMatcher = Matcher.extend({
|
1275
|
-
type: import_zod13.z.literal("dateRange"),
|
1276
|
-
options: import_zod13.z.object({
|
1277
|
-
days: import_zod13.z.number(),
|
1278
|
-
origin: FieldReference2,
|
1279
|
-
boost: import_zod13.z.number().optional().default(1)
|
1280
|
-
})
|
1281
|
-
});
|
1282
|
-
var DateDistanceMatcher = Matcher.extend({
|
1283
|
-
type: import_zod13.z.literal("dateDistance"),
|
1284
|
-
options: import_zod13.z.object({
|
1285
|
-
days: import_zod13.z.number(),
|
1286
|
-
origin: FieldReference2,
|
1287
|
-
boost: import_zod13.z.number().optional().default(1)
|
1288
|
-
})
|
1289
|
-
});
|
1290
|
-
var And = import_zod13.z.object({
|
1291
|
-
type: import_zod13.z.literal("and"),
|
1292
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
1293
|
-
clauses: import_zod13.z.lazy(() => Clause.array())
|
1294
|
-
});
|
1295
|
-
var Or = import_zod13.z.object({
|
1296
|
-
type: import_zod13.z.literal("or"),
|
1297
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
1298
|
-
clauses: import_zod13.z.lazy(() => Clause.array())
|
1299
|
-
});
|
1300
|
-
var Clause = import_zod13.z.lazy(
|
1301
|
-
() => import_zod13.z.discriminatedUnion("type", [
|
1302
|
-
And,
|
1303
|
-
Or,
|
1304
|
-
FuzzyMatcher,
|
1305
|
-
StrictMatcher,
|
1306
|
-
DateRangeMatcher,
|
1307
|
-
DateDistanceMatcher
|
1308
|
-
])
|
1309
|
-
).openapi({
|
1310
|
-
ref: "Clause"
|
1311
|
-
});
|
1312
|
-
var DeduplicationConfig = import_zod13.z.object({
|
1313
|
-
id: import_zod13.z.string(),
|
1314
|
-
label: TranslationConfig,
|
1315
|
-
query: Clause
|
1316
|
-
});
|
1317
|
-
|
1318
1344
|
// ../commons/src/events/SummaryConfig.ts
|
1319
1345
|
var import_zod14 = require("zod");
|
1320
1346
|
var BaseField2 = import_zod14.z.object({
|
@@ -1340,7 +1366,7 @@ var SummaryConfig = import_zod14.z.object({
|
|
1340
1366
|
|
1341
1367
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
1342
1368
|
var import_zod15 = require("zod");
|
1343
|
-
var MatchType = import_zod15.z.enum(["fuzzy", "exact", "range"]);
|
1369
|
+
var MatchType = import_zod15.z.enum(["fuzzy", "exact", "range", "within"]);
|
1344
1370
|
var BaseField3 = import_zod15.z.object({
|
1345
1371
|
config: import_zod15.z.object({
|
1346
1372
|
type: MatchType.describe("Determines the type of field")
|
@@ -1394,22 +1420,30 @@ var FieldConfigSchema = BaseField3.extend({
|
|
1394
1420
|
fieldType: import_zod15.z.literal("field"),
|
1395
1421
|
alternateFieldIds: import_zod15.z.array(import_zod15.z.string()).optional().describe(
|
1396
1422
|
`Sometimes there might be need to search a value against multiple field of same FormField type. For example
|
1397
|
-
search Country, Province, District against child.address.private and child.address.other. In such case, we
|
1423
|
+
search Country, Province, District against child.address.private and child.address.other. In such case, we
|
1398
1424
|
add a one field as fieldId, and accomodate others in alternateFieldIds`
|
1399
1425
|
),
|
1400
|
-
excludeInSearchQuery: import_zod15.z.boolean().default(false).optional().describe(`Sometimes there will be search fields which are used to
|
1401
|
-
conditionally display another search field, but its not needed in search query. For example, child.placeOfBirth
|
1426
|
+
excludeInSearchQuery: import_zod15.z.boolean().default(false).optional().describe(`Sometimes there will be search fields which are used to
|
1427
|
+
conditionally display another search field, but its not needed in search query. For example, child.placeOfBirth
|
1402
1428
|
is select field, which has 3 options, FACILITY, PRIVATE_HOME, OTHER. Upon selecting any of the option, pops up another field
|
1403
1429
|
related to the selected option, whose value is required in the search query. But child.placeOfBirth itself is not needed in the query.
|
1404
1430
|
In such case, populate this field (excludeInSearchQuery) with boolean true`)
|
1405
1431
|
});
|
1406
|
-
var
|
1432
|
+
var EventFieldIdInput = import_zod15.z.enum([
|
1407
1433
|
"trackingId",
|
1408
1434
|
"status",
|
1409
1435
|
"legalStatuses.REGISTERED.acceptedAt",
|
1410
1436
|
"legalStatuses.REGISTERED.createdAtLocation",
|
1411
1437
|
"updatedAt"
|
1412
1438
|
]);
|
1439
|
+
var METADATA_FIELD_PREFIX = "event.";
|
1440
|
+
var EventFieldId = import_zod15.z.enum([
|
1441
|
+
`${METADATA_FIELD_PREFIX}trackingId`,
|
1442
|
+
`${METADATA_FIELD_PREFIX}status`,
|
1443
|
+
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
|
1444
|
+
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.createdAtLocation`,
|
1445
|
+
`${METADATA_FIELD_PREFIX}updatedAt`
|
1446
|
+
]);
|
1413
1447
|
var EventFieldConfigSchema = BaseField3.extend({
|
1414
1448
|
fieldId: EventFieldId,
|
1415
1449
|
fieldType: import_zod15.z.literal("event")
|
@@ -1902,11 +1936,15 @@ var ActionBase = import_zod19.z.object({
|
|
1902
1936
|
originalActionId: UUID.optional().nullable().describe(
|
1903
1937
|
"Reference to the original action that was asynchronously rejected or accepted by 3rd party integration."
|
1904
1938
|
)
|
1939
|
+
// 'content' field reserved for additional data
|
1940
|
+
// Each action can define its own content specifc to the action
|
1941
|
+
// See PrintCertificateAction
|
1905
1942
|
});
|
1906
1943
|
var AssignedAction = ActionBase.merge(
|
1907
1944
|
import_zod19.z.object({
|
1908
1945
|
type: import_zod19.z.literal(ActionType.ASSIGN),
|
1909
1946
|
assignedTo: import_zod19.z.string()
|
1947
|
+
// TODO move into 'content' property
|
1910
1948
|
})
|
1911
1949
|
);
|
1912
1950
|
var UnassignedAction = ActionBase.merge(
|
@@ -1918,6 +1956,7 @@ var RegisterAction = ActionBase.merge(
|
|
1918
1956
|
import_zod19.z.object({
|
1919
1957
|
type: import_zod19.z.literal(ActionType.REGISTER),
|
1920
1958
|
registrationNumber: import_zod19.z.string().optional()
|
1959
|
+
// TODO move into 'content' property
|
1921
1960
|
})
|
1922
1961
|
);
|
1923
1962
|
var DeclareAction = ActionBase.merge(
|
@@ -1938,6 +1977,7 @@ var RejectAction = ActionBase.merge(
|
|
1938
1977
|
import_zod19.z.object({
|
1939
1978
|
type: import_zod19.z.literal(ActionType.REJECT),
|
1940
1979
|
reason: RejectionReason
|
1980
|
+
// TODO move into 'content' property
|
1941
1981
|
})
|
1942
1982
|
);
|
1943
1983
|
var MarkAsDuplicateAction = ActionBase.merge(
|
@@ -1949,6 +1989,7 @@ var ArchiveAction = ActionBase.merge(
|
|
1949
1989
|
import_zod19.z.object({
|
1950
1990
|
type: import_zod19.z.literal(ActionType.ARCHIVE),
|
1951
1991
|
reason: RejectionReason
|
1992
|
+
// TODO move into 'content' property
|
1952
1993
|
})
|
1953
1994
|
);
|
1954
1995
|
var CreatedAction = ActionBase.merge(
|
@@ -1961,9 +2002,13 @@ var NotifiedAction = ActionBase.merge(
|
|
1961
2002
|
type: import_zod19.z.literal(ActionType.NOTIFY)
|
1962
2003
|
})
|
1963
2004
|
);
|
2005
|
+
var PrintContent = import_zod19.z.object({
|
2006
|
+
templateId: import_zod19.z.string().optional()
|
2007
|
+
});
|
1964
2008
|
var PrintCertificateAction = ActionBase.merge(
|
1965
2009
|
import_zod19.z.object({
|
1966
|
-
type: import_zod19.z.literal(ActionType.PRINT_CERTIFICATE)
|
2010
|
+
type: import_zod19.z.literal(ActionType.PRINT_CERTIFICATE),
|
2011
|
+
content: PrintContent.optional().nullable()
|
1967
2012
|
})
|
1968
2013
|
);
|
1969
2014
|
var RequestedCorrectionAction = ActionBase.merge(
|
@@ -1975,12 +2020,14 @@ var ApprovedCorrectionAction = ActionBase.merge(
|
|
1975
2020
|
import_zod19.z.object({
|
1976
2021
|
type: import_zod19.z.literal(ActionType.APPROVE_CORRECTION),
|
1977
2022
|
requestId: import_zod19.z.string()
|
2023
|
+
// TODO move into 'content' property
|
1978
2024
|
})
|
1979
2025
|
);
|
1980
2026
|
var RejectedCorrectionAction = ActionBase.merge(
|
1981
2027
|
import_zod19.z.object({
|
1982
2028
|
type: import_zod19.z.literal(ActionType.REJECT_CORRECTION),
|
1983
2029
|
requestId: import_zod19.z.string(),
|
2030
|
+
// TODO move into 'content' property
|
1984
2031
|
reason: RejectionReason
|
1985
2032
|
})
|
1986
2033
|
);
|
@@ -2031,7 +2078,7 @@ var ResolvedUser = import_zod19.z.object({
|
|
2031
2078
|
});
|
2032
2079
|
|
2033
2080
|
// ../commons/src/conditionals/validate.ts
|
2034
|
-
var
|
2081
|
+
var import__ = __toESM(require("ajv/dist/2019"));
|
2035
2082
|
var import_ajv_formats = __toESM(require("ajv-formats"));
|
2036
2083
|
var import_date_fns = require("date-fns");
|
2037
2084
|
|
@@ -2245,9 +2292,11 @@ var isNonInteractiveFieldType = (field2) => {
|
|
2245
2292
|
};
|
2246
2293
|
|
2247
2294
|
// ../commons/src/conditionals/validate.ts
|
2248
|
-
var ajv = new
|
2295
|
+
var ajv = new import__.default({
|
2249
2296
|
$data: true,
|
2250
|
-
allowUnionTypes: true
|
2297
|
+
allowUnionTypes: true,
|
2298
|
+
strict: false
|
2299
|
+
// Allow minContains and other newer features
|
2251
2300
|
});
|
2252
2301
|
(0, import_ajv_formats.default)(ajv);
|
2253
2302
|
ajv.addKeyword({
|
@@ -2420,6 +2469,23 @@ function validateFieldInput({
|
|
2420
2469
|
const rawError = zodType.safeParse(value, { errorMap: zodToIntlErrorMap });
|
2421
2470
|
return rawError.error?.issues.map((issue) => issue.message) ?? [];
|
2422
2471
|
}
|
2472
|
+
function runStructuralValidations({
|
2473
|
+
field: field2,
|
2474
|
+
values
|
2475
|
+
}) {
|
2476
|
+
if (!isFieldVisible(field2, values) || isFieldEmptyAndNotRequired(field2, values)) {
|
2477
|
+
return {
|
2478
|
+
errors: []
|
2479
|
+
};
|
2480
|
+
}
|
2481
|
+
const fieldValidationResult = validateFieldInput({
|
2482
|
+
field: field2,
|
2483
|
+
value: values[field2.id]
|
2484
|
+
});
|
2485
|
+
return {
|
2486
|
+
errors: fieldValidationResult
|
2487
|
+
};
|
2488
|
+
}
|
2423
2489
|
function runFieldValidations({
|
2424
2490
|
field: field2,
|
2425
2491
|
values
|
@@ -2485,6 +2551,11 @@ function getValidatorsForField(fieldId, validations) {
|
|
2485
2551
|
};
|
2486
2552
|
}).filter((x) => x !== null);
|
2487
2553
|
}
|
2554
|
+
function areCertificateConditionsMet(conditions, values) {
|
2555
|
+
return conditions.every((condition) => {
|
2556
|
+
return ajv.validate(condition.conditional, values);
|
2557
|
+
});
|
2558
|
+
}
|
2488
2559
|
|
2489
2560
|
// ../commons/src/utils.ts
|
2490
2561
|
function getOrThrow(x, message) {
|
@@ -2705,16 +2776,16 @@ function timePeriodToDateRange(value) {
|
|
2705
2776
|
let startDate;
|
2706
2777
|
switch (value) {
|
2707
2778
|
case "last7Days":
|
2708
|
-
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(),
|
2779
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 7);
|
2709
2780
|
break;
|
2710
2781
|
case "last30Days":
|
2711
|
-
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(),
|
2782
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 30);
|
2712
2783
|
break;
|
2713
2784
|
case "last90Days":
|
2714
|
-
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(),
|
2785
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 90);
|
2715
2786
|
break;
|
2716
2787
|
case "last365Days":
|
2717
|
-
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(),
|
2788
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 365);
|
2718
2789
|
break;
|
2719
2790
|
}
|
2720
2791
|
return {
|
@@ -2739,7 +2810,6 @@ var EventConfig = import_zod21.z.object({
|
|
2739
2810
|
label: TranslationConfig,
|
2740
2811
|
actions: import_zod21.z.array(ActionConfig),
|
2741
2812
|
declaration: DeclarationFormConfig,
|
2742
|
-
deduplication: import_zod21.z.array(DeduplicationConfig).optional().default([]),
|
2743
2813
|
advancedSearch: import_zod21.z.array(AdvancedSearchConfig).optional().default([])
|
2744
2814
|
}).superRefine((event2, ctx) => {
|
2745
2815
|
const allFields = findAllFields(event2);
|
@@ -3081,8 +3151,9 @@ function createFieldConditionals(fieldId) {
|
|
3081
3151
|
properties: {
|
3082
3152
|
[fieldId]: {
|
3083
3153
|
type: "string",
|
3084
|
-
|
3085
|
-
|
3154
|
+
minLength: 1,
|
3155
|
+
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'.-]*)*$",
|
3156
|
+
description: "Name must contain only letters, numbers, and allowed special characters ('.-). No double spaces."
|
3086
3157
|
}
|
3087
3158
|
}
|
3088
3159
|
}),
|
@@ -3175,6 +3246,19 @@ function createSearchConfig(baseField) {
|
|
3175
3246
|
fuzzy: () => ({
|
3176
3247
|
...baseField,
|
3177
3248
|
config: { type: "fuzzy" }
|
3249
|
+
}),
|
3250
|
+
/**
|
3251
|
+
* Creates a configuration for matching locations and the child locations
|
3252
|
+
* @returns An object containing the field ID and a configuration object with a type of 'within'.
|
3253
|
+
* @example field('createdAtLocation').within()
|
3254
|
+
* // {
|
3255
|
+
* // ...
|
3256
|
+
* // config: { type: 'within' }
|
3257
|
+
* // }
|
3258
|
+
*/
|
3259
|
+
within: () => ({
|
3260
|
+
...baseField,
|
3261
|
+
config: { type: "within" }
|
3178
3262
|
})
|
3179
3263
|
};
|
3180
3264
|
}
|
@@ -3182,7 +3266,7 @@ function createSearchConfig(baseField) {
|
|
3182
3266
|
// ../commons/src/event-config/event-configuration.ts
|
3183
3267
|
function createEventFieldConfig(fieldId) {
|
3184
3268
|
const baseField = {
|
3185
|
-
fieldId
|
3269
|
+
fieldId: `${METADATA_FIELD_PREFIX}${fieldId}`,
|
3186
3270
|
fieldType: "event"
|
3187
3271
|
};
|
3188
3272
|
return createSearchConfig(baseField);
|
@@ -3195,32 +3279,107 @@ function eventFn(fieldId) {
|
|
3195
3279
|
var event = Object.assign(eventFn, {
|
3196
3280
|
/**
|
3197
3281
|
* Checks if the event contains a specific action type.
|
3282
|
+
* Can be used directly as a conditional or chained with additional methods.
|
3198
3283
|
* @param action - The action type to check for.
|
3199
3284
|
*/
|
3200
|
-
hasAction: (action) =>
|
3201
|
-
|
3202
|
-
|
3203
|
-
|
3285
|
+
hasAction: (action) => {
|
3286
|
+
const basicConditional = defineConditional({
|
3287
|
+
type: "object",
|
3288
|
+
properties: {
|
3289
|
+
$event: {
|
3290
|
+
type: "object",
|
3291
|
+
properties: {
|
3292
|
+
actions: {
|
3293
|
+
type: "array",
|
3294
|
+
contains: {
|
3295
|
+
type: "object",
|
3296
|
+
properties: {
|
3297
|
+
type: {
|
3298
|
+
const: action
|
3299
|
+
}
|
3300
|
+
},
|
3301
|
+
required: ["type"]
|
3302
|
+
}
|
3303
|
+
}
|
3304
|
+
},
|
3305
|
+
required: ["actions"]
|
3306
|
+
}
|
3307
|
+
},
|
3308
|
+
required: ["$event"]
|
3309
|
+
});
|
3310
|
+
const buildActionConstraints = (additionalFields) => {
|
3311
|
+
const actionProperties = {
|
3312
|
+
type: { const: action }
|
3313
|
+
};
|
3314
|
+
const requiredFields = ["type"];
|
3315
|
+
if (additionalFields) {
|
3316
|
+
Object.entries(additionalFields).forEach(([key, value]) => {
|
3317
|
+
actionProperties[key] = { const: value };
|
3318
|
+
requiredFields.push(key);
|
3319
|
+
});
|
3320
|
+
}
|
3321
|
+
return { actionProperties, requiredFields };
|
3322
|
+
};
|
3323
|
+
const createCountConditional = (countType, count, additionalFields) => {
|
3324
|
+
const { actionProperties, requiredFields } = buildActionConstraints(additionalFields);
|
3325
|
+
return defineConditional({
|
3204
3326
|
type: "object",
|
3205
3327
|
properties: {
|
3206
|
-
|
3207
|
-
type: "
|
3208
|
-
|
3209
|
-
|
3210
|
-
|
3211
|
-
|
3212
|
-
|
3213
|
-
|
3214
|
-
|
3215
|
-
|
3216
|
-
|
3328
|
+
$event: {
|
3329
|
+
type: "object",
|
3330
|
+
properties: {
|
3331
|
+
actions: {
|
3332
|
+
type: "array",
|
3333
|
+
contains: {
|
3334
|
+
type: "object",
|
3335
|
+
properties: actionProperties,
|
3336
|
+
required: requiredFields
|
3337
|
+
},
|
3338
|
+
[countType]: count
|
3339
|
+
}
|
3340
|
+
},
|
3341
|
+
required: ["actions"]
|
3217
3342
|
}
|
3218
3343
|
},
|
3219
|
-
required: ["
|
3220
|
-
}
|
3221
|
-
}
|
3222
|
-
|
3223
|
-
|
3344
|
+
required: ["$event"]
|
3345
|
+
});
|
3346
|
+
};
|
3347
|
+
const withMinMax = (additionalFields) => {
|
3348
|
+
return {
|
3349
|
+
/**
|
3350
|
+
* Creates a conditional that checks if the event contains a specific action type
|
3351
|
+
* with a minimum count of occurrences.
|
3352
|
+
*
|
3353
|
+
* @param minCount - The minimum number of actions required.
|
3354
|
+
*/
|
3355
|
+
minCount: (minCount) => createCountConditional("minContains", minCount, additionalFields),
|
3356
|
+
/**
|
3357
|
+
* Builds a conditional that sets a maximum count for the number of actions.
|
3358
|
+
* This is useful for limiting the number of actions of a specific type in a single event.
|
3359
|
+
*/
|
3360
|
+
maxCount: (maxCount) => createCountConditional("maxContains", maxCount, additionalFields)
|
3361
|
+
};
|
3362
|
+
};
|
3363
|
+
const chainableMethods = {
|
3364
|
+
/**
|
3365
|
+
* Adds additional field constraints to the action matching.
|
3366
|
+
*
|
3367
|
+
* @param fields - Object containing additional fields to match on the action.
|
3368
|
+
*/
|
3369
|
+
withFields: (fields) => withMinMax(fields),
|
3370
|
+
/**
|
3371
|
+
* Adds template ID constraint to the action matching.
|
3372
|
+
* This is a convenience method that adds content.templateId to the fields.
|
3373
|
+
*
|
3374
|
+
* @param id - The template ID to match against.
|
3375
|
+
*/
|
3376
|
+
withTemplate: (id) => withMinMax({
|
3377
|
+
content: { templateId: id }
|
3378
|
+
}),
|
3379
|
+
...withMinMax()
|
3380
|
+
};
|
3381
|
+
return { ...basicConditional, ...chainableMethods };
|
3382
|
+
},
|
3224
3383
|
field(field2) {
|
3225
3384
|
return {
|
3226
3385
|
$event: field2
|
@@ -3239,24 +3398,23 @@ var EventStatus = import_zod23.z.enum([
|
|
3239
3398
|
"DECLARED",
|
3240
3399
|
"VALIDATED",
|
3241
3400
|
"REGISTERED",
|
3242
|
-
"CERTIFIED",
|
3243
3401
|
"ARCHIVED"
|
3244
3402
|
]);
|
3245
|
-
var VisibleStatus = import_zod23.z.enum([...EventStatus.options, "REJECTED"]);
|
3246
3403
|
var InherentFlags = {
|
3247
|
-
|
3404
|
+
PENDING_CERTIFICATION: "pending-certification",
|
3248
3405
|
INCOMPLETE: "incomplete",
|
3249
3406
|
REJECTED: "rejected",
|
3250
3407
|
CORRECTION_REQUESTED: "correction-requested"
|
3251
3408
|
};
|
3252
|
-
var
|
3409
|
+
var ActionFlag = import_zod23.z.string().regex(
|
3253
3410
|
new RegExp(
|
3254
3411
|
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
3255
3412
|
ActionStatus
|
3256
3413
|
).join("|").toLowerCase()})$`
|
3257
3414
|
),
|
3258
3415
|
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
3259
|
-
)
|
3416
|
+
);
|
3417
|
+
var Flag = ActionFlag.or(import_zod23.z.nativeEnum(InherentFlags));
|
3260
3418
|
var ZodDate = import_zod23.z.string().date();
|
3261
3419
|
var ActionCreationMetadata = import_zod23.z.object({
|
3262
3420
|
createdAt: import_zod23.z.string().datetime().describe("The timestamp when the action request was created."),
|
@@ -3524,6 +3682,9 @@ var QueryExpression = import_zod25.z.object({
|
|
3524
3682
|
createdAt: import_zod25.z.optional(DateCondition),
|
3525
3683
|
updatedAt: import_zod25.z.optional(DateCondition),
|
3526
3684
|
"legalStatuses.REGISTERED.acceptedAt": import_zod25.z.optional(DateCondition),
|
3685
|
+
"legalStatuses.DECLARED.createdAtLocation": import_zod25.z.optional(
|
3686
|
+
import_zod25.z.union([Within, Exact])
|
3687
|
+
),
|
3527
3688
|
"legalStatuses.REGISTERED.createdAtLocation": import_zod25.z.optional(
|
3528
3689
|
import_zod25.z.union([Within, Exact])
|
3529
3690
|
),
|
@@ -3769,7 +3930,8 @@ var WorkqueueConfig = import_zod28.z.object({
|
|
3769
3930
|
})
|
3770
3931
|
),
|
3771
3932
|
columns: import_zod28.z.array(WorkqueueColumn).default(mandatoryColumns),
|
3772
|
-
icon: AvailableIcons
|
3933
|
+
icon: AvailableIcons,
|
3934
|
+
emptyMessage: TranslationConfig.optional()
|
3773
3935
|
}).describe("Configuration for workqueue.");
|
3774
3936
|
var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
|
3775
3937
|
query: true,
|
@@ -3788,7 +3950,8 @@ var WorkqueueConfigInput = import_zod28.z.object({
|
|
3788
3950
|
})
|
3789
3951
|
),
|
3790
3952
|
columns: import_zod28.z.array(WorkqueueColumn).default(mandatoryColumns),
|
3791
|
-
icon: AvailableIcons
|
3953
|
+
icon: AvailableIcons,
|
3954
|
+
emptyMessage: TranslationConfig.optional()
|
3792
3955
|
});
|
3793
3956
|
function defineWorkqueue(workqueueInput) {
|
3794
3957
|
const queryInput = workqueueInput.query;
|
@@ -3877,7 +4040,8 @@ var DeclareActionInput = BaseActionInput.merge(
|
|
3877
4040
|
);
|
3878
4041
|
var PrintCertificateActionInput = BaseActionInput.merge(
|
3879
4042
|
import_zod29.z.object({
|
3880
|
-
type: import_zod29.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
|
4043
|
+
type: import_zod29.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
|
4044
|
+
content: PrintContent.optional()
|
3881
4045
|
})
|
3882
4046
|
);
|
3883
4047
|
var RejectDeclarationActionInput = BaseActionInput.merge(
|
@@ -4089,16 +4253,19 @@ function getLegalStatuses(actions) {
|
|
4089
4253
|
}
|
4090
4254
|
|
4091
4255
|
// ../commons/src/events/state/flags.ts
|
4092
|
-
function
|
4256
|
+
function isPendingCertification(actions) {
|
4257
|
+
if (getStatusFromActions(actions) !== EventStatus.enum.REGISTERED) {
|
4258
|
+
return false;
|
4259
|
+
}
|
4093
4260
|
return actions.reduce((prev, { type }) => {
|
4094
4261
|
if (type === ActionType.PRINT_CERTIFICATE) {
|
4095
|
-
return
|
4262
|
+
return false;
|
4096
4263
|
}
|
4097
4264
|
if (type === ActionType.APPROVE_CORRECTION) {
|
4098
|
-
return
|
4265
|
+
return true;
|
4099
4266
|
}
|
4100
4267
|
return prev;
|
4101
|
-
},
|
4268
|
+
}, true);
|
4102
4269
|
}
|
4103
4270
|
function isCorrectionRequested(actions) {
|
4104
4271
|
return actions.reduce((prev, { type }) => {
|
@@ -4133,8 +4300,8 @@ function getFlagsFromActions(actions) {
|
|
4133
4300
|
const flag = joinValues([type, status], ":").toLowerCase();
|
4134
4301
|
return flag;
|
4135
4302
|
});
|
4136
|
-
if (
|
4137
|
-
flags.push(InherentFlags.
|
4303
|
+
if (isPendingCertification(sortedActions)) {
|
4304
|
+
flags.push(InherentFlags.PENDING_CERTIFICATION);
|
4138
4305
|
}
|
4139
4306
|
if (isCorrectionRequested(sortedActions)) {
|
4140
4307
|
flags.push(InherentFlags.CORRECTION_REQUESTED);
|
@@ -4165,7 +4332,6 @@ function getStatusFromActions(actions) {
|
|
4165
4332
|
case ActionType.NOTIFY:
|
4166
4333
|
return EventStatus.enum.NOTIFIED;
|
4167
4334
|
case ActionType.PRINT_CERTIFICATE:
|
4168
|
-
return EventStatus.enum.CERTIFIED;
|
4169
4335
|
case ActionType.ASSIGN:
|
4170
4336
|
case ActionType.UNASSIGN:
|
4171
4337
|
case ActionType.REJECT:
|
@@ -5130,7 +5296,27 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
|
5130
5296
|
defaultMessage: "Applicant's name",
|
5131
5297
|
description: "This is the label for the field",
|
5132
5298
|
id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.firstname.label"
|
5133
|
-
}
|
5299
|
+
},
|
5300
|
+
configuration: {
|
5301
|
+
name: {
|
5302
|
+
firstname: { required: true },
|
5303
|
+
middlename: { required: false },
|
5304
|
+
surname: { required: true }
|
5305
|
+
}
|
5306
|
+
},
|
5307
|
+
validation: [
|
5308
|
+
{
|
5309
|
+
validator: field("applicant.name").object({
|
5310
|
+
firstname: field("firstname").isValidEnglishName(),
|
5311
|
+
surname: field("surname").isValidEnglishName()
|
5312
|
+
}),
|
5313
|
+
message: {
|
5314
|
+
defaultMessage: "Input contains invalid characters. Please use only letters (a-z, A-Z), numbers (0-9), hyphens (-), apostrophes(') and underscores (_)",
|
5315
|
+
description: "This is the error message for invalid name",
|
5316
|
+
id: "v2.error.invalidName"
|
5317
|
+
}
|
5318
|
+
}
|
5319
|
+
]
|
5134
5320
|
},
|
5135
5321
|
{
|
5136
5322
|
id: "applicant.email",
|
@@ -5352,22 +5538,6 @@ var statusOptions = [
|
|
5352
5538
|
id: "v2.advancedSearch.form.recordStatusRegistered"
|
5353
5539
|
}
|
5354
5540
|
},
|
5355
|
-
{
|
5356
|
-
value: EventStatus.enum.CERTIFIED,
|
5357
|
-
label: {
|
5358
|
-
defaultMessage: "Certified",
|
5359
|
-
description: "Option for form field: status of record",
|
5360
|
-
id: "v2.advancedSearch.form.recordStatusCertified"
|
5361
|
-
}
|
5362
|
-
},
|
5363
|
-
{
|
5364
|
-
value: VisibleStatus.enum.REJECTED,
|
5365
|
-
label: {
|
5366
|
-
defaultMessage: "Rejected",
|
5367
|
-
description: "Option for form field: status of record",
|
5368
|
-
id: "v2.advancedSearch.form.recordStatusRejected"
|
5369
|
-
}
|
5370
|
-
},
|
5371
5541
|
{
|
5372
5542
|
value: EventStatus.enum.ARCHIVED,
|
5373
5543
|
label: {
|
@@ -6277,33 +6447,24 @@ var child = defineFormPage({
|
|
6277
6447
|
},
|
6278
6448
|
fields: [
|
6279
6449
|
{
|
6280
|
-
id: "child.
|
6281
|
-
type: FieldType.
|
6282
|
-
required: true,
|
6283
|
-
configuration: { maxLength: 32 },
|
6284
|
-
hideLabel: true,
|
6285
|
-
label: {
|
6286
|
-
defaultMessage: "Child's first name",
|
6287
|
-
description: "This is the label for the field",
|
6288
|
-
id: "v2.event.birth.action.declare.form.section.child.field.name.label"
|
6289
|
-
}
|
6290
|
-
},
|
6291
|
-
{
|
6292
|
-
id: "child.familyName",
|
6293
|
-
type: FieldType.TEXT,
|
6450
|
+
id: "child.name",
|
6451
|
+
type: FieldType.NAME,
|
6294
6452
|
required: true,
|
6295
6453
|
configuration: { maxLength: 32 },
|
6296
6454
|
hideLabel: true,
|
6297
6455
|
label: {
|
6298
|
-
defaultMessage: "Child's
|
6456
|
+
defaultMessage: "Child's name",
|
6299
6457
|
description: "This is the label for the field",
|
6300
6458
|
id: "v2.event.birth.action.declare.form.section.child.field.name.label"
|
6301
|
-
}
|
6459
|
+
},
|
6460
|
+
validation: []
|
6302
6461
|
},
|
6303
6462
|
{
|
6304
|
-
id: "child.
|
6463
|
+
id: "child.dob",
|
6305
6464
|
type: "DATE",
|
6306
6465
|
required: true,
|
6466
|
+
secured: true,
|
6467
|
+
validation: [],
|
6307
6468
|
label: {
|
6308
6469
|
defaultMessage: "Date of birth",
|
6309
6470
|
description: "This is the label for the field",
|
@@ -6322,46 +6483,43 @@ var mother = defineFormPage({
|
|
6322
6483
|
},
|
6323
6484
|
fields: [
|
6324
6485
|
{
|
6325
|
-
id: "mother.
|
6326
|
-
|
6327
|
-
type: FieldType.TEXT,
|
6486
|
+
id: "mother.name",
|
6487
|
+
type: FieldType.NAME,
|
6328
6488
|
required: true,
|
6329
|
-
label: {
|
6330
|
-
defaultMessage: "First name(s)",
|
6331
|
-
description: "This is the label for the field",
|
6332
|
-
id: `v2.event.birth.action.declare.form.section.person.field.firstname.label`
|
6333
|
-
}
|
6334
|
-
},
|
6335
|
-
{
|
6336
|
-
id: `mother.familyName`,
|
6337
6489
|
configuration: { maxLength: 32 },
|
6338
|
-
|
6339
|
-
required: true,
|
6490
|
+
hideLabel: true,
|
6340
6491
|
label: {
|
6341
|
-
defaultMessage: "
|
6492
|
+
defaultMessage: "Mother's name",
|
6342
6493
|
description: "This is the label for the field",
|
6343
|
-
id:
|
6344
|
-
}
|
6494
|
+
id: "v2.event.birth.action.declare.form.section.mother.field.name.label"
|
6495
|
+
},
|
6496
|
+
conditionals: [],
|
6497
|
+
validation: []
|
6345
6498
|
},
|
6346
6499
|
{
|
6347
|
-
id:
|
6500
|
+
id: "mother.dob",
|
6348
6501
|
type: "DATE",
|
6349
6502
|
required: true,
|
6503
|
+
secured: true,
|
6504
|
+
validation: [],
|
6350
6505
|
label: {
|
6351
6506
|
defaultMessage: "Date of birth",
|
6352
6507
|
description: "This is the label for the field",
|
6353
|
-
id:
|
6354
|
-
}
|
6508
|
+
id: "v2.event.birth.action.declare.form.section.person.field.dob.label"
|
6509
|
+
},
|
6510
|
+
conditionals: []
|
6355
6511
|
},
|
6356
6512
|
{
|
6357
|
-
id: "mother.
|
6513
|
+
id: "mother.nid",
|
6358
6514
|
type: FieldType.ID,
|
6359
6515
|
required: true,
|
6360
6516
|
label: {
|
6361
6517
|
defaultMessage: "ID Number",
|
6362
6518
|
description: "This is the label for the field",
|
6363
|
-
id:
|
6364
|
-
}
|
6519
|
+
id: "v2.event.birth.action.declare.form.section.person.field.nid.label"
|
6520
|
+
},
|
6521
|
+
conditionals: [],
|
6522
|
+
validation: []
|
6365
6523
|
}
|
6366
6524
|
]
|
6367
6525
|
});
|
@@ -6819,7 +6977,11 @@ function generateActionDocument({
|
|
6819
6977
|
case ActionType.NOTIFY:
|
6820
6978
|
return { ...actionBase, type: action };
|
6821
6979
|
case ActionType.PRINT_CERTIFICATE:
|
6822
|
-
return {
|
6980
|
+
return {
|
6981
|
+
...actionBase,
|
6982
|
+
type: action,
|
6983
|
+
content: defaults.content
|
6984
|
+
};
|
6823
6985
|
case ActionType.REQUEST_CORRECTION:
|
6824
6986
|
return { ...actionBase, type: action };
|
6825
6987
|
case ActionType.APPROVE_CORRECTION:
|
@@ -7219,14 +7381,6 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
7219
7381
|
ActionType.REJECT_CORRECTION,
|
7220
7382
|
ExclusiveActions.REVIEW_CORRECTION_REQUEST
|
7221
7383
|
],
|
7222
|
-
[EventStatus.enum.CERTIFIED]: [
|
7223
|
-
ActionType.READ,
|
7224
|
-
ActionType.PRINT_CERTIFICATE,
|
7225
|
-
ActionType.REQUEST_CORRECTION,
|
7226
|
-
ActionType.APPROVE_CORRECTION,
|
7227
|
-
ActionType.REJECT_CORRECTION,
|
7228
|
-
ExclusiveActions.REVIEW_CORRECTION_REQUEST
|
7229
|
-
],
|
7230
7384
|
[EventStatus.enum.ARCHIVED]: [
|
7231
7385
|
ActionType.READ,
|
7232
7386
|
ActionType.ASSIGN,
|
@@ -7234,9 +7388,12 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
7234
7388
|
]
|
7235
7389
|
};
|
7236
7390
|
var getAvailableActionsForEvent = (event2) => {
|
7237
|
-
|
7238
|
-
|
7239
|
-
|
7240
|
-
|
7241
|
-
|
7391
|
+
if (event2.flags.includes(InherentFlags.REJECTED)) {
|
7392
|
+
return [
|
7393
|
+
ActionType.READ,
|
7394
|
+
event2.status === EventStatus.Enum.VALIDATED ? ActionType.VALIDATE : ActionType.DECLARE,
|
7395
|
+
ActionType.ARCHIVE
|
7396
|
+
];
|
7397
|
+
}
|
7398
|
+
return AVAILABLE_ACTIONS_BY_EVENT_STATUS[event2.status];
|
7242
7399
|
};
|