@opencrvs/toolkit 1.8.1-rc.4f4b65a → 1.8.1-rc.5130256
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 +392 -409
- package/dist/commons/conditionals/conditionals.test.d.ts +2 -0
- package/dist/commons/conditionals/validate-address.test.d.ts +2 -0
- package/dist/commons/conditionals/validate.d.ts +2 -11
- package/dist/commons/conditionals/validate.test.d.ts +2 -0
- package/dist/commons/events/ActionConfig.d.ts +5805 -3441
- package/dist/commons/events/ActionDocument.d.ts +716 -1252
- package/dist/commons/events/ActionInput.d.ts +600 -626
- package/dist/commons/events/AdvancedSearchConfig.d.ts +65 -83
- package/dist/commons/events/CompositeFieldValue.d.ts +6 -6
- package/dist/commons/events/CountryConfigQueryInput.d.ts +88 -88
- package/dist/commons/events/Draft.d.ts +48 -48
- package/dist/commons/events/EventConfig.d.ts +2663 -1401
- package/dist/commons/events/EventDocument.d.ts +432 -451
- package/dist/commons/events/EventIndex.d.ts +62 -184
- package/dist/commons/events/EventMetadata.d.ts +9 -9
- package/dist/commons/events/FieldConfig.d.ts +343 -254
- package/dist/commons/events/FieldType.d.ts +2 -1
- package/dist/commons/events/FieldTypeMapping.d.ts +25 -18
- package/dist/commons/events/FieldValue.d.ts +12 -12
- package/dist/commons/events/FormConfig.d.ts +2388 -1296
- package/dist/commons/events/PageConfig.d.ts +508 -264
- package/dist/commons/events/WorkqueueConfig.d.ts +164 -288
- package/dist/commons/events/defineConfig.d.ts +309 -129
- package/dist/commons/events/event.d.ts +6 -68
- package/dist/commons/events/field.d.ts +0 -14
- package/dist/commons/events/test.utils.d.ts +12 -12
- package/dist/commons/events/utils.d.ts +564 -244
- package/dist/commons/events/utils.test.d.ts +2 -0
- package/dist/conditionals/index.js +2 -3
- package/dist/events/index.js +115 -259
- package/package.json +1 -1
- package/tsconfig.json +1 -1
package/dist/events/index.js
CHANGED
@@ -40,7 +40,6 @@ __export(events_exports, {
|
|
40
40
|
ActionConfigBase: () => ActionConfigBase,
|
41
41
|
ActionCreationMetadata: () => ActionCreationMetadata,
|
42
42
|
ActionDocument: () => ActionDocument,
|
43
|
-
ActionFlag: () => ActionFlag,
|
44
43
|
ActionFormConfig: () => ActionFormConfig,
|
45
44
|
ActionInput: () => ActionInput,
|
46
45
|
ActionStatus: () => ActionStatus,
|
@@ -96,7 +95,6 @@ __export(events_exports, {
|
|
96
95
|
EventDocument: () => EventDocument,
|
97
96
|
EventFieldConfigSchema: () => EventFieldConfigSchema,
|
98
97
|
EventFieldId: () => EventFieldId,
|
99
|
-
EventFieldIdInput: () => EventFieldIdInput,
|
100
98
|
EventIndex: () => EventIndex,
|
101
99
|
EventInput: () => EventInput,
|
102
100
|
EventMetadata: () => EventMetadata,
|
@@ -131,10 +129,8 @@ __export(events_exports, {
|
|
131
129
|
InherentFlags: () => InherentFlags,
|
132
130
|
LanguageConfig: () => LanguageConfig,
|
133
131
|
LegalStatuses: () => LegalStatuses,
|
134
|
-
METADATA_FIELD_PREFIX: () => METADATA_FIELD_PREFIX,
|
135
132
|
MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
|
136
133
|
MimeType: () => MimeType,
|
137
|
-
NameConfig: () => NameConfig,
|
138
134
|
NameFieldUpdateValue: () => NameFieldUpdateValue,
|
139
135
|
NameFieldValue: () => NameFieldValue,
|
140
136
|
NonEmptyTextValue: () => NonEmptyTextValue,
|
@@ -143,7 +139,6 @@ __export(events_exports, {
|
|
143
139
|
PageConfig: () => PageConfig,
|
144
140
|
PageTypes: () => PageTypes,
|
145
141
|
PrintCertificateActionInput: () => PrintCertificateActionInput,
|
146
|
-
PrintContent: () => PrintContent,
|
147
142
|
QueryExpression: () => QueryExpression,
|
148
143
|
QueryInput: () => QueryInput,
|
149
144
|
QueryType: () => QueryType,
|
@@ -172,7 +167,6 @@ __export(events_exports, {
|
|
172
167
|
TENNIS_CLUB_MEMBERSHIP: () => TENNIS_CLUB_MEMBERSHIP,
|
173
168
|
TEST_SYSTEM_IANA_TIMEZONE: () => TEST_SYSTEM_IANA_TIMEZONE,
|
174
169
|
TestUserRole: () => TestUserRole,
|
175
|
-
TextField: () => TextField,
|
176
170
|
TextValue: () => TextValue,
|
177
171
|
TimeValue: () => TimeValue,
|
178
172
|
TranslationConfig: () => TranslationConfig,
|
@@ -184,6 +178,7 @@ __export(events_exports, {
|
|
184
178
|
ValidationConfig: () => ValidationConfig,
|
185
179
|
VerificationActionConfig: () => VerificationActionConfig,
|
186
180
|
VerificationPageConfig: () => VerificationPageConfig,
|
181
|
+
VisibleStatus: () => VisibleStatus,
|
187
182
|
WRITE_ACTION_SCOPES: () => WRITE_ACTION_SCOPES,
|
188
183
|
Within: () => Within,
|
189
184
|
WorkqueueActionsWithDefault: () => WorkqueueActionsWithDefault,
|
@@ -202,7 +197,6 @@ __export(events_exports, {
|
|
202
197
|
annotationActions: () => annotationActions,
|
203
198
|
applyDeclarationToEventIndex: () => applyDeclarationToEventIndex,
|
204
199
|
applyDraftsToEventIndex: () => applyDraftsToEventIndex,
|
205
|
-
areCertificateConditionsMet: () => areCertificateConditionsMet,
|
206
200
|
areConditionsMet: () => areConditionsMet,
|
207
201
|
compositeFieldTypes: () => compositeFieldTypes,
|
208
202
|
createEmptyDraft: () => createEmptyDraft,
|
@@ -303,6 +297,7 @@ __export(events_exports, {
|
|
303
297
|
isPageVisible: () => isPageVisible,
|
304
298
|
isParagraphFieldType: () => isParagraphFieldType,
|
305
299
|
isPhoneFieldType: () => isPhoneFieldType,
|
300
|
+
isPrintButtonFieldType: () => isPrintButtonFieldType,
|
306
301
|
isRadioGroupFieldType: () => isRadioGroupFieldType,
|
307
302
|
isSelectDateRangeFieldType: () => isSelectDateRangeFieldType,
|
308
303
|
isSelectFieldType: () => isSelectFieldType,
|
@@ -326,7 +321,6 @@ __export(events_exports, {
|
|
326
321
|
or: () => or,
|
327
322
|
resolveDateOfEvent: () => resolveDateOfEvent,
|
328
323
|
runFieldValidations: () => runFieldValidations,
|
329
|
-
runStructuralValidations: () => runStructuralValidations,
|
330
324
|
timePeriodToDateRange: () => timePeriodToDateRange,
|
331
325
|
user: () => user,
|
332
326
|
validate: () => validate,
|
@@ -544,7 +538,8 @@ var FieldType = {
|
|
544
538
|
FACILITY: "FACILITY",
|
545
539
|
OFFICE: "OFFICE",
|
546
540
|
SIGNATURE: "SIGNATURE",
|
547
|
-
DATA: "DATA"
|
541
|
+
DATA: "DATA",
|
542
|
+
PRINT_BUTTON: "PRINT_BUTTON"
|
548
543
|
};
|
549
544
|
var fieldTypes = Object.values(FieldType);
|
550
545
|
var compositeFieldTypes = [
|
@@ -561,7 +556,7 @@ var import_zod6 = require("zod");
|
|
561
556
|
var import_zod4 = require("zod");
|
562
557
|
var import_zod_openapi3 = require("zod-openapi");
|
563
558
|
(0, import_zod_openapi3.extendZodWithOpenApi)(import_zod4.z);
|
564
|
-
var
|
559
|
+
var FullDocumentURL = import_zod4.z.string().brand("FullDocumentURL").describe(
|
565
560
|
"A full url with protocol, host, bucket name, starting from the root of the S3 server, https://minio/bucket-name/document-id.jpg"
|
566
561
|
);
|
567
562
|
var FullDocumentPath = import_zod4.z.string().transform((val) => val.startsWith("/") ? val : `/${val}`).openapi({ effectType: "input", type: "string" }).describe(
|
@@ -618,8 +613,8 @@ var NameFieldValue = import_zod5.z.object({
|
|
618
613
|
middlename: import_zod5.z.string().optional()
|
619
614
|
});
|
620
615
|
var NameFieldUpdateValue = import_zod5.z.object({
|
621
|
-
firstname: import_zod5.z.string(),
|
622
|
-
surname: import_zod5.z.string(),
|
616
|
+
firstname: import_zod5.z.string().nullish(),
|
617
|
+
surname: import_zod5.z.string().nullish(),
|
623
618
|
middlename: import_zod5.z.string().nullish()
|
624
619
|
}).or(import_zod5.z.null()).or(import_zod5.z.undefined());
|
625
620
|
var RuralAddressUpdateValue = AdminStructure.extend({
|
@@ -916,32 +911,18 @@ var SelectDateRangeField = BaseField.extend({
|
|
916
911
|
defaultValue: SelectDateRangeValue.optional(),
|
917
912
|
options: import_zod7.z.array(SelectDateRangeOption).describe("A list of options")
|
918
913
|
}).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
|
-
});
|
924
914
|
var NameField = BaseField.extend({
|
925
915
|
type: import_zod7.z.literal(FieldType.NAME),
|
926
916
|
defaultValue: import_zod7.z.object({
|
927
|
-
firstname: NonEmptyTextValue
|
928
|
-
|
929
|
-
surname: NonEmptyTextValue.optional()
|
917
|
+
firstname: NonEmptyTextValue,
|
918
|
+
surname: NonEmptyTextValue
|
930
919
|
}).optional(),
|
931
920
|
configuration: import_zod7.z.object({
|
932
|
-
name: NameConfig.default({
|
933
|
-
firstname: { required: true },
|
934
|
-
surname: { required: true }
|
935
|
-
}).optional(),
|
936
921
|
maxLength: import_zod7.z.number().optional().describe("Maximum length of the text"),
|
937
922
|
prefix: TranslationConfig.optional(),
|
938
923
|
postfix: TranslationConfig.optional(),
|
924
|
+
includeMiddlename: import_zod7.z.boolean().default(false).optional().describe("To make middle name visible in Name form field"),
|
939
925
|
searchMode: import_zod7.z.boolean().optional()
|
940
|
-
}).default({
|
941
|
-
name: {
|
942
|
-
firstname: { required: true },
|
943
|
-
surname: { required: true }
|
944
|
-
}
|
945
926
|
}).optional()
|
946
927
|
}).describe("Name input field");
|
947
928
|
var PhoneField = BaseField.extend({
|
@@ -1025,6 +1006,15 @@ var DataField = BaseField.extend({
|
|
1025
1006
|
data: import_zod7.z.array(DataEntry)
|
1026
1007
|
})
|
1027
1008
|
}).describe("Data field for displaying read-only data");
|
1009
|
+
var PrintButton = BaseField.extend({
|
1010
|
+
type: import_zod7.z.literal(FieldType.PRINT_BUTTON),
|
1011
|
+
configuration: import_zod7.z.object({
|
1012
|
+
template: import_zod7.z.string().describe("Template ID from countryconfig templates to use for printing"),
|
1013
|
+
buttonLabel: TranslationConfig.optional().describe(
|
1014
|
+
"Label for the print button"
|
1015
|
+
)
|
1016
|
+
})
|
1017
|
+
}).describe("Print button field for printing certificates");
|
1028
1018
|
var FieldConfig = import_zod7.z.discriminatedUnion("type", [
|
1029
1019
|
Address,
|
1030
1020
|
TextField,
|
@@ -1053,7 +1043,8 @@ var FieldConfig = import_zod7.z.discriminatedUnion("type", [
|
|
1053
1043
|
SignatureField,
|
1054
1044
|
EmailField,
|
1055
1045
|
FileUploadWithOptions,
|
1056
|
-
DataField
|
1046
|
+
DataField,
|
1047
|
+
PrintButton
|
1057
1048
|
]).openapi({
|
1058
1049
|
description: "Form field configuration",
|
1059
1050
|
ref: "FieldConfig"
|
@@ -1243,8 +1234,7 @@ var CertificateConfig = import_zod11.z.object({
|
|
1243
1234
|
delayed: import_zod11.z.number()
|
1244
1235
|
}),
|
1245
1236
|
svgUrl: import_zod11.z.string(),
|
1246
|
-
fonts: import_zod11.z.record(FontFamily).optional()
|
1247
|
-
conditionals: import_zod11.z.array(ShowConditional).optional()
|
1237
|
+
fonts: import_zod11.z.record(FontFamily).optional()
|
1248
1238
|
});
|
1249
1239
|
var CertificateTemplateConfig = CertificateConfig.extend({
|
1250
1240
|
hash: import_zod11.z.string().optional(),
|
@@ -1362,7 +1352,7 @@ var SummaryConfig = import_zod14.z.object({
|
|
1362
1352
|
|
1363
1353
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
1364
1354
|
var import_zod15 = require("zod");
|
1365
|
-
var MatchType = import_zod15.z.enum(["fuzzy", "exact", "range"
|
1355
|
+
var MatchType = import_zod15.z.enum(["fuzzy", "exact", "range"]);
|
1366
1356
|
var BaseField3 = import_zod15.z.object({
|
1367
1357
|
config: import_zod15.z.object({
|
1368
1358
|
type: MatchType.describe("Determines the type of field")
|
@@ -1416,30 +1406,22 @@ var FieldConfigSchema = BaseField3.extend({
|
|
1416
1406
|
fieldType: import_zod15.z.literal("field"),
|
1417
1407
|
alternateFieldIds: import_zod15.z.array(import_zod15.z.string()).optional().describe(
|
1418
1408
|
`Sometimes there might be need to search a value against multiple field of same FormField type. For example
|
1419
|
-
search Country, Province, District against child.address.private and child.address.other. In such case, we
|
1409
|
+
search Country, Province, District against child.address.private and child.address.other. In such case, we
|
1420
1410
|
add a one field as fieldId, and accomodate others in alternateFieldIds`
|
1421
1411
|
),
|
1422
|
-
excludeInSearchQuery: import_zod15.z.boolean().default(false).optional().describe(`Sometimes there will be search fields which are used to
|
1423
|
-
conditionally display another search field, but its not needed in search query. For example, child.placeOfBirth
|
1412
|
+
excludeInSearchQuery: import_zod15.z.boolean().default(false).optional().describe(`Sometimes there will be search fields which are used to
|
1413
|
+
conditionally display another search field, but its not needed in search query. For example, child.placeOfBirth
|
1424
1414
|
is select field, which has 3 options, FACILITY, PRIVATE_HOME, OTHER. Upon selecting any of the option, pops up another field
|
1425
1415
|
related to the selected option, whose value is required in the search query. But child.placeOfBirth itself is not needed in the query.
|
1426
1416
|
In such case, populate this field (excludeInSearchQuery) with boolean true`)
|
1427
1417
|
});
|
1428
|
-
var
|
1418
|
+
var EventFieldId = import_zod15.z.enum([
|
1429
1419
|
"trackingId",
|
1430
1420
|
"status",
|
1431
1421
|
"legalStatuses.REGISTERED.acceptedAt",
|
1432
1422
|
"legalStatuses.REGISTERED.createdAtLocation",
|
1433
1423
|
"updatedAt"
|
1434
1424
|
]);
|
1435
|
-
var METADATA_FIELD_PREFIX = "event.";
|
1436
|
-
var EventFieldId = import_zod15.z.enum([
|
1437
|
-
`${METADATA_FIELD_PREFIX}trackingId`,
|
1438
|
-
`${METADATA_FIELD_PREFIX}status`,
|
1439
|
-
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
|
1440
|
-
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.createdAtLocation`,
|
1441
|
-
`${METADATA_FIELD_PREFIX}updatedAt`
|
1442
|
-
]);
|
1443
1425
|
var EventFieldConfigSchema = BaseField3.extend({
|
1444
1426
|
fieldId: EventFieldId,
|
1445
1427
|
fieldType: import_zod15.z.literal("event")
|
@@ -1932,15 +1914,11 @@ var ActionBase = import_zod19.z.object({
|
|
1932
1914
|
originalActionId: UUID.optional().nullable().describe(
|
1933
1915
|
"Reference to the original action that was asynchronously rejected or accepted by 3rd party integration."
|
1934
1916
|
)
|
1935
|
-
// 'content' field reserved for additional data
|
1936
|
-
// Each action can define its own content specifc to the action
|
1937
|
-
// See PrintCertificateAction
|
1938
1917
|
});
|
1939
1918
|
var AssignedAction = ActionBase.merge(
|
1940
1919
|
import_zod19.z.object({
|
1941
1920
|
type: import_zod19.z.literal(ActionType.ASSIGN),
|
1942
1921
|
assignedTo: import_zod19.z.string()
|
1943
|
-
// TODO move into 'content' property
|
1944
1922
|
})
|
1945
1923
|
);
|
1946
1924
|
var UnassignedAction = ActionBase.merge(
|
@@ -1952,7 +1930,6 @@ var RegisterAction = ActionBase.merge(
|
|
1952
1930
|
import_zod19.z.object({
|
1953
1931
|
type: import_zod19.z.literal(ActionType.REGISTER),
|
1954
1932
|
registrationNumber: import_zod19.z.string().optional()
|
1955
|
-
// TODO move into 'content' property
|
1956
1933
|
})
|
1957
1934
|
);
|
1958
1935
|
var DeclareAction = ActionBase.merge(
|
@@ -1973,7 +1950,6 @@ var RejectAction = ActionBase.merge(
|
|
1973
1950
|
import_zod19.z.object({
|
1974
1951
|
type: import_zod19.z.literal(ActionType.REJECT),
|
1975
1952
|
reason: RejectionReason
|
1976
|
-
// TODO move into 'content' property
|
1977
1953
|
})
|
1978
1954
|
);
|
1979
1955
|
var MarkAsDuplicateAction = ActionBase.merge(
|
@@ -1985,7 +1961,6 @@ var ArchiveAction = ActionBase.merge(
|
|
1985
1961
|
import_zod19.z.object({
|
1986
1962
|
type: import_zod19.z.literal(ActionType.ARCHIVE),
|
1987
1963
|
reason: RejectionReason
|
1988
|
-
// TODO move into 'content' property
|
1989
1964
|
})
|
1990
1965
|
);
|
1991
1966
|
var CreatedAction = ActionBase.merge(
|
@@ -1998,13 +1973,9 @@ var NotifiedAction = ActionBase.merge(
|
|
1998
1973
|
type: import_zod19.z.literal(ActionType.NOTIFY)
|
1999
1974
|
})
|
2000
1975
|
);
|
2001
|
-
var PrintContent = import_zod19.z.object({
|
2002
|
-
templateId: import_zod19.z.string().optional()
|
2003
|
-
});
|
2004
1976
|
var PrintCertificateAction = ActionBase.merge(
|
2005
1977
|
import_zod19.z.object({
|
2006
|
-
type: import_zod19.z.literal(ActionType.PRINT_CERTIFICATE)
|
2007
|
-
content: PrintContent.optional().nullable()
|
1978
|
+
type: import_zod19.z.literal(ActionType.PRINT_CERTIFICATE)
|
2008
1979
|
})
|
2009
1980
|
);
|
2010
1981
|
var RequestedCorrectionAction = ActionBase.merge(
|
@@ -2016,14 +1987,12 @@ var ApprovedCorrectionAction = ActionBase.merge(
|
|
2016
1987
|
import_zod19.z.object({
|
2017
1988
|
type: import_zod19.z.literal(ActionType.APPROVE_CORRECTION),
|
2018
1989
|
requestId: import_zod19.z.string()
|
2019
|
-
// TODO move into 'content' property
|
2020
1990
|
})
|
2021
1991
|
);
|
2022
1992
|
var RejectedCorrectionAction = ActionBase.merge(
|
2023
1993
|
import_zod19.z.object({
|
2024
1994
|
type: import_zod19.z.literal(ActionType.REJECT_CORRECTION),
|
2025
1995
|
requestId: import_zod19.z.string(),
|
2026
|
-
// TODO move into 'content' property
|
2027
1996
|
reason: RejectionReason
|
2028
1997
|
})
|
2029
1998
|
);
|
@@ -2074,7 +2043,7 @@ var ResolvedUser = import_zod19.z.object({
|
|
2074
2043
|
});
|
2075
2044
|
|
2076
2045
|
// ../commons/src/conditionals/validate.ts
|
2077
|
-
var
|
2046
|
+
var import_ajv = __toESM(require("ajv"));
|
2078
2047
|
var import_ajv_formats = __toESM(require("ajv-formats"));
|
2079
2048
|
var import_date_fns = require("date-fns");
|
2080
2049
|
|
@@ -2137,6 +2106,9 @@ function mapFieldTypeToZod(type, required) {
|
|
2137
2106
|
case FieldType.NAME:
|
2138
2107
|
schema = required ? NameFieldValue : NameFieldUpdateValue;
|
2139
2108
|
break;
|
2109
|
+
case FieldType.PRINT_BUTTON:
|
2110
|
+
schema = TextValue;
|
2111
|
+
break;
|
2140
2112
|
}
|
2141
2113
|
return required ? schema : schema.nullish();
|
2142
2114
|
}
|
@@ -2197,6 +2169,8 @@ function mapFieldTypeToEmptyValue(field2) {
|
|
2197
2169
|
};
|
2198
2170
|
case FieldType.FILE_WITH_OPTIONS:
|
2199
2171
|
return [];
|
2172
|
+
case FieldType.PRINT_BUTTON:
|
2173
|
+
return null;
|
2200
2174
|
}
|
2201
2175
|
}
|
2202
2176
|
var isParagraphFieldType = (field2) => {
|
@@ -2283,16 +2257,17 @@ var isOfficeFieldType = (field2) => {
|
|
2283
2257
|
var isDataFieldType = (field2) => {
|
2284
2258
|
return field2.config.type === FieldType.DATA;
|
2285
2259
|
};
|
2260
|
+
var isPrintButtonFieldType = (field2) => {
|
2261
|
+
return field2.config.type === FieldType.PRINT_BUTTON;
|
2262
|
+
};
|
2286
2263
|
var isNonInteractiveFieldType = (field2) => {
|
2287
|
-
return field2.type === FieldType.DIVIDER || field2.type === FieldType.PAGE_HEADER || field2.type === FieldType.PARAGRAPH || field2.type === FieldType.BULLET_LIST || field2.type === FieldType.DATA;
|
2264
|
+
return field2.type === FieldType.DIVIDER || field2.type === FieldType.PAGE_HEADER || field2.type === FieldType.PARAGRAPH || field2.type === FieldType.BULLET_LIST || field2.type === FieldType.DATA || field2.type === FieldType.PRINT_BUTTON;
|
2288
2265
|
};
|
2289
2266
|
|
2290
2267
|
// ../commons/src/conditionals/validate.ts
|
2291
|
-
var ajv = new
|
2268
|
+
var ajv = new import_ajv.default({
|
2292
2269
|
$data: true,
|
2293
|
-
allowUnionTypes: true
|
2294
|
-
strict: false
|
2295
|
-
// Allow minContains and other newer features
|
2270
|
+
allowUnionTypes: true
|
2296
2271
|
});
|
2297
2272
|
(0, import_ajv_formats.default)(ajv);
|
2298
2273
|
ajv.addKeyword({
|
@@ -2465,23 +2440,6 @@ function validateFieldInput({
|
|
2465
2440
|
const rawError = zodType.safeParse(value, { errorMap: zodToIntlErrorMap });
|
2466
2441
|
return rawError.error?.issues.map((issue) => issue.message) ?? [];
|
2467
2442
|
}
|
2468
|
-
function runStructuralValidations({
|
2469
|
-
field: field2,
|
2470
|
-
values
|
2471
|
-
}) {
|
2472
|
-
if (!isFieldVisible(field2, values) || isFieldEmptyAndNotRequired(field2, values)) {
|
2473
|
-
return {
|
2474
|
-
errors: []
|
2475
|
-
};
|
2476
|
-
}
|
2477
|
-
const fieldValidationResult = validateFieldInput({
|
2478
|
-
field: field2,
|
2479
|
-
value: values[field2.id]
|
2480
|
-
});
|
2481
|
-
return {
|
2482
|
-
errors: fieldValidationResult
|
2483
|
-
};
|
2484
|
-
}
|
2485
2443
|
function runFieldValidations({
|
2486
2444
|
field: field2,
|
2487
2445
|
values
|
@@ -2547,11 +2505,6 @@ function getValidatorsForField(fieldId, validations) {
|
|
2547
2505
|
};
|
2548
2506
|
}).filter((x) => x !== null);
|
2549
2507
|
}
|
2550
|
-
function areCertificateConditionsMet(conditions, values) {
|
2551
|
-
return conditions.every((condition) => {
|
2552
|
-
return ajv.validate(condition.conditional, values);
|
2553
|
-
});
|
2554
|
-
}
|
2555
2508
|
|
2556
2509
|
// ../commons/src/utils.ts
|
2557
2510
|
function getOrThrow(x, message) {
|
@@ -2772,16 +2725,16 @@ function timePeriodToDateRange(value) {
|
|
2772
2725
|
let startDate;
|
2773
2726
|
switch (value) {
|
2774
2727
|
case "last7Days":
|
2775
|
-
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(),
|
2728
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 6);
|
2776
2729
|
break;
|
2777
2730
|
case "last30Days":
|
2778
|
-
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(),
|
2731
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 29);
|
2779
2732
|
break;
|
2780
2733
|
case "last90Days":
|
2781
|
-
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(),
|
2734
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 89);
|
2782
2735
|
break;
|
2783
2736
|
case "last365Days":
|
2784
|
-
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(),
|
2737
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 364);
|
2785
2738
|
break;
|
2786
2739
|
}
|
2787
2740
|
return {
|
@@ -3148,9 +3101,8 @@ function createFieldConditionals(fieldId) {
|
|
3148
3101
|
properties: {
|
3149
3102
|
[fieldId]: {
|
3150
3103
|
type: "string",
|
3151
|
-
|
3152
|
-
|
3153
|
-
description: "Name must contain only letters, numbers, and allowed special characters ('.-). No double spaces."
|
3104
|
+
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'._-]*)*$",
|
3105
|
+
description: "Name must contain only letters, numbers, and allowed special characters ('._-). No double spaces."
|
3154
3106
|
}
|
3155
3107
|
}
|
3156
3108
|
}),
|
@@ -3243,19 +3195,6 @@ function createSearchConfig(baseField) {
|
|
3243
3195
|
fuzzy: () => ({
|
3244
3196
|
...baseField,
|
3245
3197
|
config: { type: "fuzzy" }
|
3246
|
-
}),
|
3247
|
-
/**
|
3248
|
-
* Creates a configuration for matching locations and the child locations
|
3249
|
-
* @returns An object containing the field ID and a configuration object with a type of 'within'.
|
3250
|
-
* @example field('createdAtLocation').within()
|
3251
|
-
* // {
|
3252
|
-
* // ...
|
3253
|
-
* // config: { type: 'within' }
|
3254
|
-
* // }
|
3255
|
-
*/
|
3256
|
-
within: () => ({
|
3257
|
-
...baseField,
|
3258
|
-
config: { type: "within" }
|
3259
3198
|
})
|
3260
3199
|
};
|
3261
3200
|
}
|
@@ -3263,7 +3202,7 @@ function createSearchConfig(baseField) {
|
|
3263
3202
|
// ../commons/src/event-config/event-configuration.ts
|
3264
3203
|
function createEventFieldConfig(fieldId) {
|
3265
3204
|
const baseField = {
|
3266
|
-
fieldId
|
3205
|
+
fieldId,
|
3267
3206
|
fieldType: "event"
|
3268
3207
|
};
|
3269
3208
|
return createSearchConfig(baseField);
|
@@ -3276,107 +3215,32 @@ function eventFn(fieldId) {
|
|
3276
3215
|
var event = Object.assign(eventFn, {
|
3277
3216
|
/**
|
3278
3217
|
* Checks if the event contains a specific action type.
|
3279
|
-
* Can be used directly as a conditional or chained with additional methods.
|
3280
3218
|
* @param action - The action type to check for.
|
3281
3219
|
*/
|
3282
|
-
hasAction: (action) => {
|
3283
|
-
|
3284
|
-
|
3285
|
-
|
3286
|
-
$event: {
|
3287
|
-
type: "object",
|
3288
|
-
properties: {
|
3289
|
-
actions: {
|
3290
|
-
type: "array",
|
3291
|
-
contains: {
|
3292
|
-
type: "object",
|
3293
|
-
properties: {
|
3294
|
-
type: {
|
3295
|
-
const: action
|
3296
|
-
}
|
3297
|
-
},
|
3298
|
-
required: ["type"]
|
3299
|
-
}
|
3300
|
-
}
|
3301
|
-
},
|
3302
|
-
required: ["actions"]
|
3303
|
-
}
|
3304
|
-
},
|
3305
|
-
required: ["$event"]
|
3306
|
-
});
|
3307
|
-
const buildActionConstraints = (additionalFields) => {
|
3308
|
-
const actionProperties = {
|
3309
|
-
type: { const: action }
|
3310
|
-
};
|
3311
|
-
const requiredFields = ["type"];
|
3312
|
-
if (additionalFields) {
|
3313
|
-
Object.entries(additionalFields).forEach(([key, value]) => {
|
3314
|
-
actionProperties[key] = { const: value };
|
3315
|
-
requiredFields.push(key);
|
3316
|
-
});
|
3317
|
-
}
|
3318
|
-
return { actionProperties, requiredFields };
|
3319
|
-
};
|
3320
|
-
const createCountConditional = (countType, count, additionalFields) => {
|
3321
|
-
const { actionProperties, requiredFields } = buildActionConstraints(additionalFields);
|
3322
|
-
return defineConditional({
|
3220
|
+
hasAction: (action) => defineConditional({
|
3221
|
+
type: "object",
|
3222
|
+
properties: {
|
3223
|
+
$event: {
|
3323
3224
|
type: "object",
|
3324
3225
|
properties: {
|
3325
|
-
|
3326
|
-
type: "
|
3327
|
-
|
3328
|
-
|
3329
|
-
|
3330
|
-
|
3331
|
-
|
3332
|
-
|
3333
|
-
|
3334
|
-
|
3335
|
-
|
3336
|
-
}
|
3337
|
-
},
|
3338
|
-
required: ["actions"]
|
3226
|
+
actions: {
|
3227
|
+
type: "array",
|
3228
|
+
contains: {
|
3229
|
+
type: "object",
|
3230
|
+
properties: {
|
3231
|
+
type: {
|
3232
|
+
const: action
|
3233
|
+
}
|
3234
|
+
},
|
3235
|
+
required: ["type"]
|
3236
|
+
}
|
3339
3237
|
}
|
3340
3238
|
},
|
3341
|
-
required: ["
|
3342
|
-
}
|
3343
|
-
}
|
3344
|
-
|
3345
|
-
|
3346
|
-
/**
|
3347
|
-
* Creates a conditional that checks if the event contains a specific action type
|
3348
|
-
* with a minimum count of occurrences.
|
3349
|
-
*
|
3350
|
-
* @param minCount - The minimum number of actions required.
|
3351
|
-
*/
|
3352
|
-
minCount: (minCount) => createCountConditional("minContains", minCount, additionalFields),
|
3353
|
-
/**
|
3354
|
-
* Builds a conditional that sets a maximum count for the number of actions.
|
3355
|
-
* This is useful for limiting the number of actions of a specific type in a single event.
|
3356
|
-
*/
|
3357
|
-
maxCount: (maxCount) => createCountConditional("maxContains", maxCount, additionalFields)
|
3358
|
-
};
|
3359
|
-
};
|
3360
|
-
const chainableMethods = {
|
3361
|
-
/**
|
3362
|
-
* Adds additional field constraints to the action matching.
|
3363
|
-
*
|
3364
|
-
* @param fields - Object containing additional fields to match on the action.
|
3365
|
-
*/
|
3366
|
-
withFields: (fields) => withMinMax(fields),
|
3367
|
-
/**
|
3368
|
-
* Adds template ID constraint to the action matching.
|
3369
|
-
* This is a convenience method that adds content.templateId to the fields.
|
3370
|
-
*
|
3371
|
-
* @param id - The template ID to match against.
|
3372
|
-
*/
|
3373
|
-
withTemplate: (id) => withMinMax({
|
3374
|
-
content: { templateId: id }
|
3375
|
-
}),
|
3376
|
-
...withMinMax()
|
3377
|
-
};
|
3378
|
-
return { ...basicConditional, ...chainableMethods };
|
3379
|
-
},
|
3239
|
+
required: ["actions"]
|
3240
|
+
}
|
3241
|
+
},
|
3242
|
+
required: ["$event"]
|
3243
|
+
}),
|
3380
3244
|
field(field2) {
|
3381
3245
|
return {
|
3382
3246
|
$event: field2
|
@@ -3395,23 +3259,24 @@ var EventStatus = import_zod23.z.enum([
|
|
3395
3259
|
"DECLARED",
|
3396
3260
|
"VALIDATED",
|
3397
3261
|
"REGISTERED",
|
3262
|
+
"CERTIFIED",
|
3398
3263
|
"ARCHIVED"
|
3399
3264
|
]);
|
3265
|
+
var VisibleStatus = import_zod23.z.enum([...EventStatus.options, "REJECTED"]);
|
3400
3266
|
var InherentFlags = {
|
3401
|
-
|
3267
|
+
PRINTED: "printed",
|
3402
3268
|
INCOMPLETE: "incomplete",
|
3403
3269
|
REJECTED: "rejected",
|
3404
3270
|
CORRECTION_REQUESTED: "correction-requested"
|
3405
3271
|
};
|
3406
|
-
var
|
3272
|
+
var Flag = import_zod23.z.string().regex(
|
3407
3273
|
new RegExp(
|
3408
3274
|
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
3409
3275
|
ActionStatus
|
3410
3276
|
).join("|").toLowerCase()})$`
|
3411
3277
|
),
|
3412
3278
|
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
3413
|
-
);
|
3414
|
-
var Flag = ActionFlag.or(import_zod23.z.nativeEnum(InherentFlags));
|
3279
|
+
).or(import_zod23.z.nativeEnum(InherentFlags));
|
3415
3280
|
var ZodDate = import_zod23.z.string().date();
|
3416
3281
|
var ActionCreationMetadata = import_zod23.z.object({
|
3417
3282
|
createdAt: import_zod23.z.string().datetime().describe("The timestamp when the action request was created."),
|
@@ -3679,9 +3544,6 @@ var QueryExpression = import_zod25.z.object({
|
|
3679
3544
|
createdAt: import_zod25.z.optional(DateCondition),
|
3680
3545
|
updatedAt: import_zod25.z.optional(DateCondition),
|
3681
3546
|
"legalStatuses.REGISTERED.acceptedAt": import_zod25.z.optional(DateCondition),
|
3682
|
-
"legalStatuses.DECLARED.createdAtLocation": import_zod25.z.optional(
|
3683
|
-
import_zod25.z.union([Within, Exact])
|
3684
|
-
),
|
3685
3547
|
"legalStatuses.REGISTERED.createdAtLocation": import_zod25.z.optional(
|
3686
3548
|
import_zod25.z.union([Within, Exact])
|
3687
3549
|
),
|
@@ -3927,8 +3789,7 @@ var WorkqueueConfig = import_zod28.z.object({
|
|
3927
3789
|
})
|
3928
3790
|
),
|
3929
3791
|
columns: import_zod28.z.array(WorkqueueColumn).default(mandatoryColumns),
|
3930
|
-
icon: AvailableIcons
|
3931
|
-
emptyMessage: TranslationConfig.optional()
|
3792
|
+
icon: AvailableIcons
|
3932
3793
|
}).describe("Configuration for workqueue.");
|
3933
3794
|
var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
|
3934
3795
|
query: true,
|
@@ -3947,8 +3808,7 @@ var WorkqueueConfigInput = import_zod28.z.object({
|
|
3947
3808
|
})
|
3948
3809
|
),
|
3949
3810
|
columns: import_zod28.z.array(WorkqueueColumn).default(mandatoryColumns),
|
3950
|
-
icon: AvailableIcons
|
3951
|
-
emptyMessage: TranslationConfig.optional()
|
3811
|
+
icon: AvailableIcons
|
3952
3812
|
});
|
3953
3813
|
function defineWorkqueue(workqueueInput) {
|
3954
3814
|
const queryInput = workqueueInput.query;
|
@@ -4037,8 +3897,7 @@ var DeclareActionInput = BaseActionInput.merge(
|
|
4037
3897
|
);
|
4038
3898
|
var PrintCertificateActionInput = BaseActionInput.merge(
|
4039
3899
|
import_zod29.z.object({
|
4040
|
-
type: import_zod29.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
|
4041
|
-
content: PrintContent.optional()
|
3900
|
+
type: import_zod29.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
|
4042
3901
|
})
|
4043
3902
|
);
|
4044
3903
|
var RejectDeclarationActionInput = BaseActionInput.merge(
|
@@ -4250,19 +4109,16 @@ function getLegalStatuses(actions) {
|
|
4250
4109
|
}
|
4251
4110
|
|
4252
4111
|
// ../commons/src/events/state/flags.ts
|
4253
|
-
function
|
4254
|
-
if (getStatusFromActions(actions) !== EventStatus.enum.REGISTERED) {
|
4255
|
-
return false;
|
4256
|
-
}
|
4112
|
+
function isCertificatePrinted(actions) {
|
4257
4113
|
return actions.reduce((prev, { type }) => {
|
4258
4114
|
if (type === ActionType.PRINT_CERTIFICATE) {
|
4259
|
-
return
|
4115
|
+
return true;
|
4260
4116
|
}
|
4261
4117
|
if (type === ActionType.APPROVE_CORRECTION) {
|
4262
|
-
return
|
4118
|
+
return false;
|
4263
4119
|
}
|
4264
4120
|
return prev;
|
4265
|
-
},
|
4121
|
+
}, false);
|
4266
4122
|
}
|
4267
4123
|
function isCorrectionRequested(actions) {
|
4268
4124
|
return actions.reduce((prev, { type }) => {
|
@@ -4297,8 +4153,8 @@ function getFlagsFromActions(actions) {
|
|
4297
4153
|
const flag = joinValues([type, status], ":").toLowerCase();
|
4298
4154
|
return flag;
|
4299
4155
|
});
|
4300
|
-
if (
|
4301
|
-
flags.push(InherentFlags.
|
4156
|
+
if (isCertificatePrinted(sortedActions)) {
|
4157
|
+
flags.push(InherentFlags.PRINTED);
|
4302
4158
|
}
|
4303
4159
|
if (isCorrectionRequested(sortedActions)) {
|
4304
4160
|
flags.push(InherentFlags.CORRECTION_REQUESTED);
|
@@ -4329,6 +4185,7 @@ function getStatusFromActions(actions) {
|
|
4329
4185
|
case ActionType.NOTIFY:
|
4330
4186
|
return EventStatus.enum.NOTIFIED;
|
4331
4187
|
case ActionType.PRINT_CERTIFICATE:
|
4188
|
+
return EventStatus.enum.CERTIFIED;
|
4332
4189
|
case ActionType.ASSIGN:
|
4333
4190
|
case ActionType.UNASSIGN:
|
4334
4191
|
case ActionType.REJECT:
|
@@ -5293,27 +5150,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
|
5293
5150
|
defaultMessage: "Applicant's name",
|
5294
5151
|
description: "This is the label for the field",
|
5295
5152
|
id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.firstname.label"
|
5296
|
-
}
|
5297
|
-
configuration: {
|
5298
|
-
name: {
|
5299
|
-
firstname: { required: true },
|
5300
|
-
middlename: { required: false },
|
5301
|
-
surname: { required: true }
|
5302
|
-
}
|
5303
|
-
},
|
5304
|
-
validation: [
|
5305
|
-
{
|
5306
|
-
validator: field("applicant.name").object({
|
5307
|
-
firstname: field("firstname").isValidEnglishName(),
|
5308
|
-
surname: field("surname").isValidEnglishName()
|
5309
|
-
}),
|
5310
|
-
message: {
|
5311
|
-
defaultMessage: "Input contains invalid characters. Please use only letters (a-z, A-Z), numbers (0-9), hyphens (-), apostrophes(') and underscores (_)",
|
5312
|
-
description: "This is the error message for invalid name",
|
5313
|
-
id: "v2.error.invalidName"
|
5314
|
-
}
|
5315
|
-
}
|
5316
|
-
]
|
5153
|
+
}
|
5317
5154
|
},
|
5318
5155
|
{
|
5319
5156
|
id: "applicant.email",
|
@@ -5535,6 +5372,22 @@ var statusOptions = [
|
|
5535
5372
|
id: "v2.advancedSearch.form.recordStatusRegistered"
|
5536
5373
|
}
|
5537
5374
|
},
|
5375
|
+
{
|
5376
|
+
value: EventStatus.enum.CERTIFIED,
|
5377
|
+
label: {
|
5378
|
+
defaultMessage: "Certified",
|
5379
|
+
description: "Option for form field: status of record",
|
5380
|
+
id: "v2.advancedSearch.form.recordStatusCertified"
|
5381
|
+
}
|
5382
|
+
},
|
5383
|
+
{
|
5384
|
+
value: VisibleStatus.enum.REJECTED,
|
5385
|
+
label: {
|
5386
|
+
defaultMessage: "Rejected",
|
5387
|
+
description: "Option for form field: status of record",
|
5388
|
+
id: "v2.advancedSearch.form.recordStatusRejected"
|
5389
|
+
}
|
5390
|
+
},
|
5538
5391
|
{
|
5539
5392
|
value: EventStatus.enum.ARCHIVED,
|
5540
5393
|
label: {
|
@@ -6650,6 +6503,8 @@ function mapFieldTypeToMockValue(field2, i, rng) {
|
|
6650
6503
|
return "2021-01-01";
|
6651
6504
|
case FieldType.TIME:
|
6652
6505
|
return "09:33";
|
6506
|
+
case FieldType.PRINT_BUTTON:
|
6507
|
+
return void 0;
|
6653
6508
|
case FieldType.DATE_RANGE:
|
6654
6509
|
return {
|
6655
6510
|
start: "2021-01-01",
|
@@ -6986,11 +6841,7 @@ function generateActionDocument({
|
|
6986
6841
|
case ActionType.NOTIFY:
|
6987
6842
|
return { ...actionBase, type: action };
|
6988
6843
|
case ActionType.PRINT_CERTIFICATE:
|
6989
|
-
return {
|
6990
|
-
...actionBase,
|
6991
|
-
type: action,
|
6992
|
-
content: defaults.content
|
6993
|
-
};
|
6844
|
+
return { ...actionBase, type: action };
|
6994
6845
|
case ActionType.REQUEST_CORRECTION:
|
6995
6846
|
return { ...actionBase, type: action };
|
6996
6847
|
case ActionType.APPROVE_CORRECTION:
|
@@ -7390,6 +7241,14 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
7390
7241
|
ActionType.REJECT_CORRECTION,
|
7391
7242
|
ExclusiveActions.REVIEW_CORRECTION_REQUEST
|
7392
7243
|
],
|
7244
|
+
[EventStatus.enum.CERTIFIED]: [
|
7245
|
+
ActionType.READ,
|
7246
|
+
ActionType.PRINT_CERTIFICATE,
|
7247
|
+
ActionType.REQUEST_CORRECTION,
|
7248
|
+
ActionType.APPROVE_CORRECTION,
|
7249
|
+
ActionType.REJECT_CORRECTION,
|
7250
|
+
ExclusiveActions.REVIEW_CORRECTION_REQUEST
|
7251
|
+
],
|
7393
7252
|
[EventStatus.enum.ARCHIVED]: [
|
7394
7253
|
ActionType.READ,
|
7395
7254
|
ActionType.ASSIGN,
|
@@ -7397,12 +7256,9 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
7397
7256
|
]
|
7398
7257
|
};
|
7399
7258
|
var getAvailableActionsForEvent = (event2) => {
|
7400
|
-
|
7401
|
-
|
7402
|
-
|
7403
|
-
|
7404
|
-
|
7405
|
-
];
|
7406
|
-
}
|
7407
|
-
return AVAILABLE_ACTIONS_BY_EVENT_STATUS[event2.status];
|
7259
|
+
return event2.flags.includes(InherentFlags.REJECTED) ? [
|
7260
|
+
ActionType.READ,
|
7261
|
+
event2.status === EventStatus.Enum.VALIDATED ? ActionType.VALIDATE : ActionType.DECLARE,
|
7262
|
+
ActionType.ARCHIVE
|
7263
|
+
] : AVAILABLE_ACTIONS_BY_EVENT_STATUS[event2.status];
|
7408
7264
|
};
|