@opencrvs/toolkit 1.8.0-rc.f8296f8 → 1.8.0-rc.f84146e
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 +2944 -1117
- package/dist/commons/conditionals/conditionals.d.ts +6 -2
- package/dist/commons/conditionals/validate.d.ts +6 -0
- package/dist/commons/events/ActionConfig.d.ts +24179 -11127
- package/dist/commons/events/ActionDocument.d.ts +1818 -414
- package/dist/commons/events/ActionInput.d.ts +1504 -304
- package/dist/commons/events/ActionType.d.ts +4 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +75 -3
- package/dist/commons/events/CompositeFieldValue.d.ts +28 -0
- package/dist/commons/events/Constants.d.ts +1 -0
- package/dist/commons/events/CreatedAtLocation.d.ts +2 -1
- package/dist/commons/events/Draft.d.ts +129 -33
- package/dist/commons/events/EventConfig.d.ts +12161 -5927
- package/dist/commons/events/EventDocument.d.ts +1162 -298
- package/dist/commons/events/EventIndex.d.ts +284 -31
- package/dist/commons/events/EventMetadata.d.ts +57 -57
- package/dist/commons/events/FieldConfig.d.ts +2074 -1202
- package/dist/commons/events/FieldType.d.ts +4 -1
- package/dist/commons/events/FieldTypeMapping.d.ts +94 -52
- package/dist/commons/events/FieldValue.d.ts +43 -5
- package/dist/commons/events/FormConfig.d.ts +10259 -4769
- package/dist/commons/events/PageConfig.d.ts +3480 -2134
- package/dist/commons/events/SummaryConfig.d.ts +0 -5
- package/dist/commons/events/WorkqueueConfig.d.ts +297 -19
- package/dist/commons/events/defineConfig.d.ts +1724 -701
- package/dist/commons/events/field.d.ts +5 -10
- package/dist/commons/events/test.utils.d.ts +125 -40
- package/dist/commons/events/transactions.d.ts +1 -1
- package/dist/commons/events/utils.d.ts +10015 -331
- package/dist/conditionals/index.js +26 -6
- package/dist/events/index.js +760 -491
- package/package.json +1 -1
package/dist/events/index.js
CHANGED
@@ -56,6 +56,7 @@ __export(events_exports, {
|
|
56
56
|
ArchiveActionInput: () => ArchiveActionInput,
|
57
57
|
AssignActionInput: () => AssignActionInput,
|
58
58
|
AsyncRejectActionDocument: () => AsyncRejectActionDocument,
|
59
|
+
BIRTH_EVENT: () => BIRTH_EVENT,
|
59
60
|
BaseActionInput: () => BaseActionInput,
|
60
61
|
BearerTokenByUserType: () => BearerTokenByUserType,
|
61
62
|
CONFIG_GET_ALLOWED_SCOPES: () => CONFIG_GET_ALLOWED_SCOPES,
|
@@ -101,13 +102,12 @@ __export(events_exports, {
|
|
101
102
|
EventSearchIndex: () => EventSearchIndex,
|
102
103
|
EventState: () => EventState,
|
103
104
|
EventStatus: () => EventStatus,
|
104
|
-
EventStatusEnum: () => EventStatusEnum,
|
105
|
-
EventStatuses: () => EventStatuses,
|
106
105
|
Exact: () => Exact,
|
107
106
|
ExactStatus: () => ExactStatus,
|
108
107
|
FieldConditional: () => FieldConditional,
|
109
108
|
FieldConfig: () => FieldConfig,
|
110
109
|
FieldConfigSchema: () => FieldConfigSchema,
|
110
|
+
FieldReference: () => FieldReference,
|
111
111
|
FieldType: () => FieldType,
|
112
112
|
FieldUpdateValue: () => FieldUpdateValue,
|
113
113
|
FieldValue: () => FieldValue,
|
@@ -126,6 +126,8 @@ __export(events_exports, {
|
|
126
126
|
LegalStatuses: () => LegalStatuses,
|
127
127
|
MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
|
128
128
|
MimeType: () => MimeType,
|
129
|
+
NameFieldUpdateValue: () => NameFieldUpdateValue,
|
130
|
+
NameFieldValue: () => NameFieldValue,
|
129
131
|
NonEmptyTextValue: () => NonEmptyTextValue,
|
130
132
|
Not: () => Not,
|
131
133
|
NotifyActionInput: () => NotifyActionInput,
|
@@ -152,6 +154,7 @@ __export(events_exports, {
|
|
152
154
|
SearchQueryParams: () => SearchQueryParams,
|
153
155
|
SelectOption: () => SelectOption,
|
154
156
|
ShowConditional: () => ShowConditional,
|
157
|
+
SignatureFieldValue: () => SignatureFieldValue,
|
155
158
|
SummaryConfig: () => SummaryConfig,
|
156
159
|
TENNIS_CLUB_MEMBERSHIP: () => TENNIS_CLUB_MEMBERSHIP,
|
157
160
|
TextValue: () => TextValue,
|
@@ -164,6 +167,7 @@ __export(events_exports, {
|
|
164
167
|
VerificationActionConfig: () => VerificationActionConfig,
|
165
168
|
VerificationPageConfig: () => VerificationPageConfig,
|
166
169
|
Within: () => Within,
|
170
|
+
WorkqueueActionsWithDefault: () => WorkqueueActionsWithDefault,
|
167
171
|
WorkqueueColumn: () => WorkqueueColumn,
|
168
172
|
WorkqueueColumnKeys: () => WorkqueueColumnKeys,
|
169
173
|
WorkqueueColumnKeysArray: () => WorkqueueColumnKeysArray,
|
@@ -182,9 +186,8 @@ __export(events_exports, {
|
|
182
186
|
createEmptyDraft: () => createEmptyDraft,
|
183
187
|
createEventConditionals: () => createEventConditionals,
|
184
188
|
createFieldConditionals: () => createFieldConditionals,
|
185
|
-
|
189
|
+
createPrng: () => createPrng,
|
186
190
|
createValidationSchema: () => createValidationSchema,
|
187
|
-
dateOfEventColumn: () => dateOfEventColumn,
|
188
191
|
deepDropNulls: () => deepDropNulls,
|
189
192
|
deepMerge: () => deepMerge,
|
190
193
|
defaultWorkqueueColumns: () => defaultWorkqueueColumns,
|
@@ -204,7 +207,6 @@ __export(events_exports, {
|
|
204
207
|
eventMetadataLabelMap: () => eventMetadataLabelMap,
|
205
208
|
eventPayloadGenerator: () => eventPayloadGenerator,
|
206
209
|
eventQueryDataGenerator: () => eventQueryDataGenerator,
|
207
|
-
eventStatuses: () => eventStatuses,
|
208
210
|
field: () => field,
|
209
211
|
fieldTypes: () => fieldTypes,
|
210
212
|
filterUnallowedActions: () => filterUnallowedActions,
|
@@ -217,6 +219,7 @@ __export(events_exports, {
|
|
217
219
|
generateActionDocument: () => generateActionDocument,
|
218
220
|
generateEventDocument: () => generateEventDocument,
|
219
221
|
generateEventDraftDocument: () => generateEventDraftDocument,
|
222
|
+
generateRandomName: () => generateRandomName,
|
220
223
|
generateRandomSignature: () => generateRandomSignature,
|
221
224
|
generateTransactionId: () => generateTransactionId,
|
222
225
|
generateTranslationConfig: () => generateTranslationConfig,
|
@@ -227,17 +230,22 @@ __export(events_exports, {
|
|
227
230
|
getActionReview: () => getActionReview,
|
228
231
|
getActionReviewFields: () => getActionReviewFields,
|
229
232
|
getActionVerificationPageIds: () => getActionVerificationPageIds,
|
233
|
+
getAllUniqueFields: () => getAllUniqueFields,
|
230
234
|
getAnnotationFromDrafts: () => getAnnotationFromDrafts,
|
231
235
|
getAssignedUserFromActions: () => getAssignedUserFromActions,
|
232
236
|
getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
|
233
237
|
getCurrentEventState: () => getCurrentEventState,
|
234
238
|
getCurrentEventStateWithDrafts: () => getCurrentEventStateWithDrafts,
|
235
239
|
getDeclaration: () => getDeclaration,
|
240
|
+
getDeclarationFieldById: () => getDeclarationFieldById,
|
236
241
|
getDeclarationFields: () => getDeclarationFields,
|
237
242
|
getDeclarationPages: () => getDeclarationPages,
|
243
|
+
getEventConfigById: () => getEventConfigById,
|
238
244
|
getMixedPath: () => getMixedPath,
|
245
|
+
getRandomDate: () => getRandomDate,
|
239
246
|
getRandomDatetime: () => getRandomDatetime,
|
240
247
|
getStatusFromActions: () => getStatusFromActions,
|
248
|
+
getValidatorsForField: () => getValidatorsForField,
|
241
249
|
getVisibleVerificationPageIds: () => getVisibleVerificationPageIds,
|
242
250
|
hasAnyOfScopes: () => hasAnyOfScopes,
|
243
251
|
isAddressFieldType: () => isAddressFieldType,
|
@@ -260,12 +268,17 @@ __export(events_exports, {
|
|
260
268
|
isFieldVisible: () => isFieldVisible,
|
261
269
|
isFileFieldType: () => isFileFieldType,
|
262
270
|
isFileFieldWithOptionType: () => isFileFieldWithOptionType,
|
271
|
+
isIdFieldType: () => isIdFieldType,
|
263
272
|
isLocationFieldType: () => isLocationFieldType,
|
273
|
+
isMetaAction: () => isMetaAction,
|
274
|
+
isNameFieldType: () => isNameFieldType,
|
275
|
+
isNonInteractiveFieldType: () => isNonInteractiveFieldType,
|
264
276
|
isNumberFieldType: () => isNumberFieldType,
|
265
277
|
isOfficeFieldType: () => isOfficeFieldType,
|
266
278
|
isPageHeaderFieldType: () => isPageHeaderFieldType,
|
267
279
|
isPageVisible: () => isPageVisible,
|
268
280
|
isParagraphFieldType: () => isParagraphFieldType,
|
281
|
+
isPhoneFieldType: () => isPhoneFieldType,
|
269
282
|
isRadioGroupFieldType: () => isRadioGroupFieldType,
|
270
283
|
isSelectFieldType: () => isSelectFieldType,
|
271
284
|
isSignatureFieldType: () => isSignatureFieldType,
|
@@ -275,6 +288,7 @@ __export(events_exports, {
|
|
275
288
|
isUndeclaredDraft: () => isUndeclaredDraft,
|
276
289
|
isVerificationPage: () => isVerificationPage,
|
277
290
|
isWriteAction: () => isWriteAction,
|
291
|
+
mandatoryColumns: () => mandatoryColumns,
|
278
292
|
mapFieldTypeToEmptyValue: () => mapFieldTypeToEmptyValue,
|
279
293
|
mapFieldTypeToMockValue: () => mapFieldTypeToMockValue,
|
280
294
|
mapFieldTypeToZod: () => mapFieldTypeToZod,
|
@@ -288,12 +302,14 @@ __export(events_exports, {
|
|
288
302
|
user: () => user,
|
289
303
|
validate: () => validate,
|
290
304
|
validateFieldInput: () => validateFieldInput,
|
305
|
+
workqueueActions: () => workqueueActions,
|
291
306
|
writeActions: () => writeActions
|
292
307
|
});
|
293
308
|
module.exports = __toCommonJS(events_exports);
|
294
309
|
|
295
310
|
// ../commons/src/events/Constants.ts
|
296
311
|
var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
|
312
|
+
var BIRTH_EVENT = "v2-birth";
|
297
313
|
|
298
314
|
// ../commons/src/events/ActionConfig.ts
|
299
315
|
var import_zod9 = require("zod");
|
@@ -372,6 +388,9 @@ var TranslationConfig = import_zod2.z.object({
|
|
372
388
|
|
373
389
|
// ../commons/src/events/FieldType.ts
|
374
390
|
var FieldType = {
|
391
|
+
NAME: "NAME",
|
392
|
+
PHONE: "PHONE",
|
393
|
+
ID: "ID",
|
375
394
|
ADDRESS: "ADDRESS",
|
376
395
|
TEXT: "TEXT",
|
377
396
|
NUMBER: "NUMBER",
|
@@ -448,6 +467,16 @@ var UrbanAddressUpdateValue = AdminStructure.extend({
|
|
448
467
|
number: import_zod3.z.string().nullish(),
|
449
468
|
zipCode: import_zod3.z.string().nullish()
|
450
469
|
});
|
470
|
+
var NameFieldValue = import_zod3.z.object({
|
471
|
+
firstname: import_zod3.z.string(),
|
472
|
+
surname: import_zod3.z.string(),
|
473
|
+
middlename: import_zod3.z.string().optional()
|
474
|
+
});
|
475
|
+
var NameFieldUpdateValue = import_zod3.z.object({
|
476
|
+
firstname: import_zod3.z.string(),
|
477
|
+
surname: import_zod3.z.string(),
|
478
|
+
middlename: import_zod3.z.string().nullish()
|
479
|
+
}).or(import_zod3.z.null()).or(import_zod3.z.undefined());
|
451
480
|
var RuralAddressUpdateValue = AdminStructure.extend({
|
452
481
|
urbanOrRural: import_zod3.z.literal(GeographicalArea.RURAL),
|
453
482
|
village: import_zod3.z.string().nullish()
|
@@ -497,6 +526,7 @@ var EmailValue = import_zod4.z.string().email();
|
|
497
526
|
var CheckboxFieldValue = import_zod4.z.boolean();
|
498
527
|
var NumberFieldValue = import_zod4.z.number();
|
499
528
|
var DataFieldValue = import_zod4.z.undefined();
|
529
|
+
var SignatureFieldValue = import_zod4.z.string();
|
500
530
|
var FieldValue = import_zod4.z.union([
|
501
531
|
TextValue,
|
502
532
|
DateValue,
|
@@ -508,7 +538,9 @@ var FieldValue = import_zod4.z.union([
|
|
508
538
|
UrbanAddressValue,
|
509
539
|
RuralAddressValue,
|
510
540
|
DataFieldValue,
|
511
|
-
GenericAddressValue
|
541
|
+
GenericAddressValue,
|
542
|
+
NameFieldValue,
|
543
|
+
NameFieldUpdateValue
|
512
544
|
]);
|
513
545
|
var FieldUpdateValue = import_zod4.z.union([
|
514
546
|
TextValue,
|
@@ -521,25 +553,20 @@ var FieldUpdateValue = import_zod4.z.union([
|
|
521
553
|
UrbanAddressUpdateValue,
|
522
554
|
RuralAddressUpdateValue,
|
523
555
|
DataFieldValue,
|
524
|
-
GenericAddressUpdateValue
|
556
|
+
GenericAddressUpdateValue,
|
557
|
+
NameFieldUpdateValue
|
525
558
|
]);
|
526
559
|
|
527
560
|
// ../commons/src/events/FieldConfig.ts
|
528
561
|
var import_zod_openapi3 = require("zod-openapi");
|
529
562
|
(0, import_zod_openapi3.extendZodWithOpenApi)(import_zod5.z);
|
530
|
-
var FieldId = import_zod5.z.string();
|
531
|
-
var
|
532
|
-
|
533
|
-
}).
|
563
|
+
var FieldId = import_zod5.z.string().describe("Unique identifier for the field");
|
564
|
+
var FieldReference = import_zod5.z.object({
|
565
|
+
$$field: FieldId
|
566
|
+
}).describe("Reference to a field by its ID");
|
567
|
+
var ParentReference = FieldReference.optional();
|
534
568
|
var BaseField = import_zod5.z.object({
|
535
569
|
id: FieldId,
|
536
|
-
defaultValue: import_zod5.z.union([
|
537
|
-
TextValue,
|
538
|
-
NonEmptyTextValue,
|
539
|
-
DateValue,
|
540
|
-
NumberFieldValue,
|
541
|
-
CheckboxFieldValue
|
542
|
-
]).optional(),
|
543
570
|
parent: ParentReference,
|
544
571
|
conditionals: import_zod5.z.array(FieldConditional).default([]).optional(),
|
545
572
|
required: import_zod5.z.boolean().default(false).optional(),
|
@@ -601,6 +628,7 @@ var SignatureField = BaseField.extend({
|
|
601
628
|
signaturePromptLabel: TranslationConfig.describe(
|
602
629
|
"Title of the signature modal"
|
603
630
|
),
|
631
|
+
defaultValue: SignatureFieldValue.optional(),
|
604
632
|
configuration: import_zod5.z.object({
|
605
633
|
maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
606
634
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
@@ -660,6 +688,7 @@ var PageHeader = BaseField.extend({
|
|
660
688
|
}).describe("A read-only header component for form pages");
|
661
689
|
var File = BaseField.extend({
|
662
690
|
type: import_zod5.z.literal(FieldType.FILE),
|
691
|
+
defaultValue: FileFieldValue.optional(),
|
663
692
|
configuration: import_zod5.z.object({
|
664
693
|
maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
665
694
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
|
@@ -702,6 +731,26 @@ var Select = BaseField.extend({
|
|
702
731
|
defaultValue: TextValue.optional(),
|
703
732
|
options: import_zod5.z.array(SelectOption).describe("A list of options")
|
704
733
|
}).describe("Select input");
|
734
|
+
var NameField = BaseField.extend({
|
735
|
+
type: import_zod5.z.literal(FieldType.NAME),
|
736
|
+
defaultValue: import_zod5.z.object({
|
737
|
+
firstname: NonEmptyTextValue,
|
738
|
+
surname: NonEmptyTextValue
|
739
|
+
}).optional(),
|
740
|
+
configuration: import_zod5.z.object({
|
741
|
+
maxLength: import_zod5.z.number().optional().describe("Maximum length of the text"),
|
742
|
+
prefix: TranslationConfig.optional(),
|
743
|
+
postfix: TranslationConfig.optional()
|
744
|
+
}).optional()
|
745
|
+
}).describe("Name input field");
|
746
|
+
var PhoneField = BaseField.extend({
|
747
|
+
defaultValue: NonEmptyTextValue.optional(),
|
748
|
+
type: import_zod5.z.literal(FieldType.PHONE)
|
749
|
+
}).describe("Phone input field");
|
750
|
+
var IdField = BaseField.extend({
|
751
|
+
defaultValue: NonEmptyTextValue.optional(),
|
752
|
+
type: import_zod5.z.literal(FieldType.ID)
|
753
|
+
}).describe("ID input field");
|
705
754
|
var Checkbox = BaseField.extend({
|
706
755
|
type: import_zod5.z.literal(FieldType.CHECKBOX),
|
707
756
|
defaultValue: CheckboxFieldValue.optional()
|
@@ -733,6 +782,7 @@ var Location = BaseField.extend({
|
|
733
782
|
var FileUploadWithOptions = BaseField.extend({
|
734
783
|
type: import_zod5.z.literal(FieldType.FILE_WITH_OPTIONS),
|
735
784
|
options: import_zod5.z.array(SelectOption).describe("A list of options"),
|
785
|
+
defaultValue: FileFieldWithOptionValue.optional(),
|
736
786
|
configuration: import_zod5.z.object({
|
737
787
|
maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
738
788
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
@@ -780,6 +830,9 @@ var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
|
780
830
|
BulletList,
|
781
831
|
PageHeader,
|
782
832
|
Select,
|
833
|
+
NameField,
|
834
|
+
PhoneField,
|
835
|
+
IdField,
|
783
836
|
Checkbox,
|
784
837
|
File,
|
785
838
|
Country,
|
@@ -913,6 +966,25 @@ var writeActions = ActionTypes.exclude([
|
|
913
966
|
ActionType.ASSIGN,
|
914
967
|
ActionType.UNASSIGN
|
915
968
|
]);
|
969
|
+
var workqueueActions = ActionTypes.exclude([
|
970
|
+
ActionType.CREATE,
|
971
|
+
ActionType.NOTIFY,
|
972
|
+
ActionType.DETECT_DUPLICATE,
|
973
|
+
ActionType.REJECT,
|
974
|
+
ActionType.MARKED_AS_DUPLICATE,
|
975
|
+
ActionType.ARCHIVE,
|
976
|
+
ActionType.REQUEST_CORRECTION,
|
977
|
+
ActionType.REJECT_CORRECTION,
|
978
|
+
ActionType.APPROVE_CORRECTION
|
979
|
+
]);
|
980
|
+
var META_ACTIONS = [
|
981
|
+
ActionType.ASSIGN,
|
982
|
+
ActionType.UNASSIGN,
|
983
|
+
ActionType.READ
|
984
|
+
];
|
985
|
+
function isMetaAction(actionType) {
|
986
|
+
return META_ACTIONS.includes(actionType);
|
987
|
+
}
|
916
988
|
|
917
989
|
// ../commons/src/events/FormConfig.ts
|
918
990
|
var import_zod8 = require("zod");
|
@@ -1080,7 +1152,7 @@ var import_zod18 = require("zod");
|
|
1080
1152
|
var import_zod12 = require("zod");
|
1081
1153
|
var import_zod_openapi6 = require("zod-openapi");
|
1082
1154
|
(0, import_zod_openapi6.extendZodWithOpenApi)(import_zod12.z);
|
1083
|
-
var
|
1155
|
+
var FieldReference2 = import_zod12.z.string();
|
1084
1156
|
var Matcher = import_zod12.z.object({
|
1085
1157
|
fieldId: import_zod12.z.string(),
|
1086
1158
|
options: import_zod12.z.object({
|
@@ -1109,7 +1181,7 @@ var DateRangeMatcher = Matcher.extend({
|
|
1109
1181
|
type: import_zod12.z.literal("dateRange"),
|
1110
1182
|
options: import_zod12.z.object({
|
1111
1183
|
days: import_zod12.z.number(),
|
1112
|
-
origin:
|
1184
|
+
origin: FieldReference2,
|
1113
1185
|
boost: import_zod12.z.number().optional().default(1)
|
1114
1186
|
})
|
1115
1187
|
});
|
@@ -1117,7 +1189,7 @@ var DateDistanceMatcher = Matcher.extend({
|
|
1117
1189
|
type: import_zod12.z.literal("dateDistance"),
|
1118
1190
|
options: import_zod12.z.object({
|
1119
1191
|
days: import_zod12.z.number(),
|
1120
|
-
origin:
|
1192
|
+
origin: FieldReference2,
|
1121
1193
|
boost: import_zod12.z.number().optional().default(1)
|
1122
1194
|
})
|
1123
1195
|
});
|
@@ -1166,8 +1238,7 @@ var Field = BaseField2.extend({
|
|
1166
1238
|
value: TranslationConfig.describe(
|
1167
1239
|
"Summary field value. Can utilise values defined in configuration and EventMetadata"
|
1168
1240
|
),
|
1169
|
-
label: TranslationConfig
|
1170
|
-
emptyValueMessage: TranslationConfig.optional()
|
1241
|
+
label: TranslationConfig
|
1171
1242
|
}).describe("Custom configured field");
|
1172
1243
|
var SummaryConfig = import_zod13.z.object({
|
1173
1244
|
fields: import_zod13.z.array(import_zod13.z.union([Field, ReferenceField])).describe("Fields rendered in summary view.")
|
@@ -1183,35 +1254,35 @@ var BaseField3 = import_zod14.z.object({
|
|
1183
1254
|
options: import_zod14.z.array(SelectOption).optional(),
|
1184
1255
|
searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
|
1185
1256
|
`
|
1186
|
-
This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
|
1257
|
+
This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
|
1187
1258
|
when rendering search parameter labels \u2014 for example, in the search results page to indicate which fields were used in the search.
|
1188
1259
|
|
1189
|
-
For example, a field config like { id: "child.firstname", label: { defaultMessage: "First Name(s)" } } would render as "First Name(s)" by default.
|
1260
|
+
For example, a field config like { id: "child.name.firstname", label: { defaultMessage: "First Name(s)" } } would render as "First Name(s)" by default.
|
1190
1261
|
|
1191
1262
|
A field config like { id: "mother.firstname", label: { defaultMessage: "First Name(s)" } } would also render as "First Name(s)" by default.
|
1192
1263
|
|
1193
|
-
So, if both child.firstname and mother.firstname are used in a search, the resulting search criteria labels would be "First Name(s)", "First Name(s)",
|
1264
|
+
So, if both child.name.firstname and mother.firstname are used in a search, the resulting search criteria labels would be "First Name(s)", "First Name(s)",
|
1194
1265
|
which is ambiguous.
|
1195
1266
|
|
1196
|
-
Now, if we treat the field ID prefix as a label (e.g., "applicant.firstname" \u2192 "Applicant"), and the field label is already
|
1197
|
-
descriptive \u2014 like { id: "applicant.firstname", label: { defaultMessage: "Applicant's First Name" } } \u2014 then the resulting
|
1267
|
+
Now, if we treat the field ID prefix as a label (e.g., "applicant.firstname" \u2192 "Applicant"), and the field label is already
|
1268
|
+
descriptive \u2014 like { id: "applicant.firstname", label: { defaultMessage: "Applicant's First Name" } } \u2014 then the resulting
|
1198
1269
|
label would be "Applicant Applicant's First Name", which is redundant and awkward.
|
1199
1270
|
|
1200
|
-
By setting searchCriteriaLabelPrefix to a translation config object, we can explicitly define the desired prefix
|
1271
|
+
By setting searchCriteriaLabelPrefix to a translation config object, we can explicitly define the desired prefix
|
1201
1272
|
in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
|
1202
1273
|
`
|
1203
1274
|
),
|
1204
1275
|
conditionals: import_zod14.z.array(FieldConditional).default([]).optional().describe(
|
1205
1276
|
`
|
1206
1277
|
In advanced search, we sometimes need to override the default field visibility conditionals.
|
1207
|
-
|
1208
|
-
For example, Informant fields in the declaration form may have conditional logic
|
1209
|
-
that hides them based on other field values. Since the advanced search form reuses
|
1278
|
+
|
1279
|
+
For example, Informant fields in the declaration form may have conditional logic
|
1280
|
+
that hides them based on other field values. Since the advanced search form reuses
|
1210
1281
|
the declaration form config, those same conditionals would apply by default.
|
1211
|
-
|
1282
|
+
|
1212
1283
|
However, in advanced search we often want to make all Informant fields searchable,
|
1213
|
-
regardless of their original visibility logic. To do this, we explicitly set their
|
1214
|
-
'conditionals' to an empty array ('[]') in the search config. This ensures they
|
1284
|
+
regardless of their original visibility logic. To do this, we explicitly set their
|
1285
|
+
'conditionals' to an empty array ('[]') in the search config. This ensures they
|
1215
1286
|
are always rendered in the advanced search form.
|
1216
1287
|
`
|
1217
1288
|
)
|
@@ -1252,16 +1323,9 @@ var import_lodash = require("lodash");
|
|
1252
1323
|
var import_zod16 = require("zod");
|
1253
1324
|
var import_zod_openapi7 = require("zod-openapi");
|
1254
1325
|
|
1255
|
-
// ../commons/src/uuid.ts
|
1256
|
-
var import_uuid = require("uuid");
|
1257
|
-
var import_zod15 = require("zod");
|
1258
|
-
var UUID = import_zod15.z.string().uuid().brand("UUID");
|
1259
|
-
function getUUID() {
|
1260
|
-
return (0, import_uuid.v4)();
|
1261
|
-
}
|
1262
|
-
|
1263
1326
|
// ../commons/src/events/CreatedAtLocation.ts
|
1264
|
-
var
|
1327
|
+
var import_zod15 = require("zod");
|
1328
|
+
var CreatedAtLocation = import_zod15.z.string().nullish();
|
1265
1329
|
|
1266
1330
|
// ../commons/src/events/ActionDocument.ts
|
1267
1331
|
(0, import_zod_openapi7.extendZodWithOpenApi)(import_zod16.z);
|
@@ -1278,17 +1342,17 @@ var ActionBase = import_zod16.z.object({
|
|
1278
1342
|
createdAt: import_zod16.z.string().datetime(),
|
1279
1343
|
createdBy: import_zod16.z.string(),
|
1280
1344
|
createdByRole: import_zod16.z.string(),
|
1281
|
-
createdBySignature: import_zod16.z.string().nullish().describe("
|
1345
|
+
createdBySignature: import_zod16.z.string().nullish().describe("Reference to signature of the user who created the action"),
|
1282
1346
|
createdAtLocation: CreatedAtLocation,
|
1283
1347
|
declaration: ActionUpdate,
|
1284
|
-
annotation: ActionUpdate.optional()
|
1348
|
+
annotation: ActionUpdate.optional(),
|
1285
1349
|
status: import_zod16.z.enum([
|
1286
1350
|
ActionStatus.Requested,
|
1287
1351
|
ActionStatus.Accepted,
|
1288
1352
|
ActionStatus.Rejected
|
1289
1353
|
]),
|
1290
1354
|
// If the action is an asynchronous confirmation for another action, we will save the original action id here.
|
1291
|
-
originalActionId:
|
1355
|
+
originalActionId: import_zod16.z.string().optional()
|
1292
1356
|
});
|
1293
1357
|
var AssignedAction = ActionBase.merge(
|
1294
1358
|
import_zod16.z.object({
|
@@ -1449,7 +1513,8 @@ function mapFieldTypeToZod(type, required) {
|
|
1449
1513
|
case FieldType.ADMINISTRATIVE_AREA:
|
1450
1514
|
case FieldType.FACILITY:
|
1451
1515
|
case FieldType.OFFICE:
|
1452
|
-
case FieldType.
|
1516
|
+
case FieldType.PHONE:
|
1517
|
+
case FieldType.ID:
|
1453
1518
|
schema = required ? NonEmptyTextValue : TextValue;
|
1454
1519
|
break;
|
1455
1520
|
case FieldType.NUMBER:
|
@@ -1458,6 +1523,7 @@ function mapFieldTypeToZod(type, required) {
|
|
1458
1523
|
case FieldType.CHECKBOX:
|
1459
1524
|
schema = CheckboxFieldValue;
|
1460
1525
|
break;
|
1526
|
+
case FieldType.SIGNATURE:
|
1461
1527
|
case FieldType.FILE:
|
1462
1528
|
schema = FileFieldValue;
|
1463
1529
|
break;
|
@@ -1470,6 +1536,9 @@ function mapFieldTypeToZod(type, required) {
|
|
1470
1536
|
case FieldType.DATA:
|
1471
1537
|
schema = DataFieldValue;
|
1472
1538
|
break;
|
1539
|
+
case FieldType.NAME:
|
1540
|
+
schema = required ? NameFieldValue : NameFieldUpdateValue;
|
1541
|
+
break;
|
1473
1542
|
}
|
1474
1543
|
return required ? schema : schema.nullish();
|
1475
1544
|
}
|
@@ -1480,58 +1549,6 @@ function createValidationSchema(config) {
|
|
1480
1549
|
}
|
1481
1550
|
return import_zod17.z.object(shape);
|
1482
1551
|
}
|
1483
|
-
function mapFieldTypeToMockValue(field2, i) {
|
1484
|
-
switch (field2.type) {
|
1485
|
-
case FieldType.DIVIDER:
|
1486
|
-
case FieldType.TEXT:
|
1487
|
-
case FieldType.TEXTAREA:
|
1488
|
-
case FieldType.BULLET_LIST:
|
1489
|
-
case FieldType.PAGE_HEADER:
|
1490
|
-
case FieldType.LOCATION:
|
1491
|
-
case FieldType.SELECT:
|
1492
|
-
case FieldType.COUNTRY:
|
1493
|
-
case FieldType.RADIO_GROUP:
|
1494
|
-
case FieldType.SIGNATURE:
|
1495
|
-
case FieldType.PARAGRAPH:
|
1496
|
-
case FieldType.ADMINISTRATIVE_AREA:
|
1497
|
-
case FieldType.FACILITY:
|
1498
|
-
case FieldType.OFFICE:
|
1499
|
-
return `${field2.id}-${field2.type}-${i}`;
|
1500
|
-
case FieldType.NUMBER:
|
1501
|
-
return 19;
|
1502
|
-
case FieldType.EMAIL:
|
1503
|
-
return "test@opencrvs.org";
|
1504
|
-
case FieldType.ADDRESS:
|
1505
|
-
return {
|
1506
|
-
country: "FAR",
|
1507
|
-
addressType: AddressType.DOMESTIC,
|
1508
|
-
province: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
1509
|
-
district: "5ef450bc-712d-48ad-93f3-8da0fa453baa",
|
1510
|
-
urbanOrRural: "URBAN",
|
1511
|
-
town: "Example Town",
|
1512
|
-
residentialArea: "Example Residential Area",
|
1513
|
-
street: "Example Street",
|
1514
|
-
number: "55",
|
1515
|
-
zipCode: "123456"
|
1516
|
-
};
|
1517
|
-
case FieldType.DATE:
|
1518
|
-
return "2021-01-01";
|
1519
|
-
case FieldType.DATE_RANGE:
|
1520
|
-
return ["2021-01-01", "2021-01-02"];
|
1521
|
-
case FieldType.CHECKBOX:
|
1522
|
-
return true;
|
1523
|
-
case FieldType.FILE:
|
1524
|
-
return {
|
1525
|
-
filename: "4f095fc4-4312-4de2-aa38-86dcc0f71044.png",
|
1526
|
-
originalFilename: "abcd.png",
|
1527
|
-
type: "image/png"
|
1528
|
-
};
|
1529
|
-
case FieldType.FILE_WITH_OPTIONS:
|
1530
|
-
return null;
|
1531
|
-
case FieldType.DATA:
|
1532
|
-
return {};
|
1533
|
-
}
|
1534
|
-
}
|
1535
1552
|
function mapFieldTypeToEmptyValue(field2) {
|
1536
1553
|
switch (field2.type) {
|
1537
1554
|
case FieldType.DIVIDER:
|
@@ -1543,7 +1560,6 @@ function mapFieldTypeToEmptyValue(field2) {
|
|
1543
1560
|
case FieldType.SELECT:
|
1544
1561
|
case FieldType.COUNTRY:
|
1545
1562
|
case FieldType.RADIO_GROUP:
|
1546
|
-
case FieldType.SIGNATURE:
|
1547
1563
|
case FieldType.PARAGRAPH:
|
1548
1564
|
case FieldType.ADMINISTRATIVE_AREA:
|
1549
1565
|
case FieldType.FACILITY:
|
@@ -1554,6 +1570,9 @@ function mapFieldTypeToEmptyValue(field2) {
|
|
1554
1570
|
case FieldType.CHECKBOX:
|
1555
1571
|
case FieldType.DATE_RANGE:
|
1556
1572
|
case FieldType.DATA:
|
1573
|
+
case FieldType.NAME:
|
1574
|
+
case FieldType.PHONE:
|
1575
|
+
case FieldType.ID:
|
1557
1576
|
return null;
|
1558
1577
|
case FieldType.ADDRESS:
|
1559
1578
|
return {
|
@@ -1569,6 +1588,7 @@ function mapFieldTypeToEmptyValue(field2) {
|
|
1569
1588
|
number: null,
|
1570
1589
|
zipCode: null
|
1571
1590
|
};
|
1591
|
+
case FieldType.SIGNATURE:
|
1572
1592
|
case FieldType.FILE:
|
1573
1593
|
return {
|
1574
1594
|
filename: "",
|
@@ -1597,6 +1617,15 @@ var isTextFieldType = (field2) => {
|
|
1597
1617
|
var isNumberFieldType = (field2) => {
|
1598
1618
|
return field2.config.type === FieldType.NUMBER;
|
1599
1619
|
};
|
1620
|
+
var isNameFieldType = (field2) => {
|
1621
|
+
return field2.config.type === FieldType.NAME;
|
1622
|
+
};
|
1623
|
+
var isPhoneFieldType = (field2) => {
|
1624
|
+
return field2.config.type === FieldType.PHONE;
|
1625
|
+
};
|
1626
|
+
var isIdFieldType = (field2) => {
|
1627
|
+
return field2.config.type === FieldType.ID;
|
1628
|
+
};
|
1600
1629
|
var isTextAreaFieldType = (field2) => {
|
1601
1630
|
return field2.config.type === FieldType.TEXTAREA;
|
1602
1631
|
};
|
@@ -1648,6 +1677,9 @@ var isOfficeFieldType = (field2) => {
|
|
1648
1677
|
var isDataFieldType = (field2) => {
|
1649
1678
|
return field2.config.type === FieldType.DATA;
|
1650
1679
|
};
|
1680
|
+
var isNonInteractiveFieldType = (field2) => {
|
1681
|
+
return field2.type === FieldType.DIVIDER || field2.type === FieldType.PAGE_HEADER || field2.type === FieldType.PARAGRAPH || field2.type === FieldType.BULLET_LIST || field2.type === FieldType.DATA;
|
1682
|
+
};
|
1651
1683
|
|
1652
1684
|
// ../commons/src/conditionals/validate.ts
|
1653
1685
|
var ajv = new import_ajv.default({
|
@@ -1728,6 +1760,11 @@ var errorMessages = {
|
|
1728
1760
|
defaultMessage: "Invalid input",
|
1729
1761
|
description: "Error message when generic field is invalid",
|
1730
1762
|
id: "v2.error.invalid"
|
1763
|
+
},
|
1764
|
+
unexpectedField: {
|
1765
|
+
defaultMessage: "Unexpected field",
|
1766
|
+
description: "Error message when field is not expected",
|
1767
|
+
id: "v2.error.unexpectedField"
|
1731
1768
|
}
|
1732
1769
|
};
|
1733
1770
|
function createIntlError(message) {
|
@@ -1823,6 +1860,51 @@ function runFieldValidations({
|
|
1823
1860
|
errors: [...fieldValidationResult, ...customValidationResults]
|
1824
1861
|
};
|
1825
1862
|
}
|
1863
|
+
function getValidatorsForField(fieldId, validations) {
|
1864
|
+
return validations.map(({ validator, message }) => {
|
1865
|
+
const jsonSchema = validator;
|
1866
|
+
const $form = jsonSchema.properties.$form;
|
1867
|
+
if ($form.properties?.[fieldId]?.type === "object") {
|
1868
|
+
return {
|
1869
|
+
message,
|
1870
|
+
validator: {
|
1871
|
+
...jsonSchema,
|
1872
|
+
properties: {
|
1873
|
+
$form: {
|
1874
|
+
type: "object",
|
1875
|
+
properties: $form.properties?.[fieldId]?.properties || {},
|
1876
|
+
required: $form.properties?.[fieldId]?.required || []
|
1877
|
+
}
|
1878
|
+
}
|
1879
|
+
}
|
1880
|
+
};
|
1881
|
+
}
|
1882
|
+
if (!$form.properties?.[fieldId]) {
|
1883
|
+
return null;
|
1884
|
+
}
|
1885
|
+
return {
|
1886
|
+
message,
|
1887
|
+
validator: {
|
1888
|
+
...jsonSchema,
|
1889
|
+
properties: {
|
1890
|
+
$form: {
|
1891
|
+
type: "object",
|
1892
|
+
properties: {
|
1893
|
+
[fieldId]: $form.properties?.[fieldId]
|
1894
|
+
},
|
1895
|
+
required: $form.required?.includes(fieldId) ? [fieldId] : []
|
1896
|
+
}
|
1897
|
+
}
|
1898
|
+
}
|
1899
|
+
};
|
1900
|
+
}).filter((x) => x !== null);
|
1901
|
+
}
|
1902
|
+
|
1903
|
+
// ../commons/src/uuid.ts
|
1904
|
+
var import_uuid = require("uuid");
|
1905
|
+
function getUUID() {
|
1906
|
+
return (0, import_uuid.v4)();
|
1907
|
+
}
|
1826
1908
|
|
1827
1909
|
// ../commons/src/utils.ts
|
1828
1910
|
function getOrThrow(x, message) {
|
@@ -1863,6 +1945,13 @@ var getActionAnnotationFields = (actionConfig) => {
|
|
1863
1945
|
function getAllAnnotationFields(config) {
|
1864
1946
|
return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
|
1865
1947
|
}
|
1948
|
+
function getAllUniqueFields(eventConfig) {
|
1949
|
+
return (0, import_lodash.uniqBy)(getDeclarationFields(eventConfig), (field2) => field2.id);
|
1950
|
+
}
|
1951
|
+
function getDeclarationFieldById(config, fieldId) {
|
1952
|
+
const field2 = getAllUniqueFields(config).find((f) => f.id === fieldId);
|
1953
|
+
return getOrThrow(field2, `Field with id ${fieldId} not found in event config`);
|
1954
|
+
}
|
1866
1955
|
var findRecordActionPages = (config, actionType) => {
|
1867
1956
|
const action = config.actions.find((a) => a.type === actionType);
|
1868
1957
|
if (action?.type === ActionType.REQUEST_CORRECTION) {
|
@@ -1924,7 +2013,7 @@ function createEmptyDraft(eventId, draftId, actionType) {
|
|
1924
2013
|
annotation: {},
|
1925
2014
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
1926
2015
|
createdBy: "@todo",
|
1927
|
-
createdAtLocation: "
|
2016
|
+
createdAtLocation: "@todo",
|
1928
2017
|
status: ActionStatus.Accepted,
|
1929
2018
|
transactionId: "@todo",
|
1930
2019
|
createdByRole: "@todo"
|
@@ -1968,8 +2057,9 @@ function omitHiddenAnnotationFields(actionConfig, declaration, annotation) {
|
|
1968
2057
|
);
|
1969
2058
|
}
|
1970
2059
|
function deepMerge(currentDocument, actionDocument) {
|
2060
|
+
const currentDocumentClone = (0, import_lodash.cloneDeep)(currentDocument);
|
1971
2061
|
return (0, import_lodash.mergeWith)(
|
1972
|
-
|
2062
|
+
(0, import_lodash.cloneDeep)(currentDocumentClone),
|
1973
2063
|
actionDocument,
|
1974
2064
|
(previousValue, incomingValue) => {
|
1975
2065
|
if (incomingValue === void 0) {
|
@@ -2017,6 +2107,12 @@ function getMixedPath(obj, path, defaultValue) {
|
|
2017
2107
|
const result = resolve(obj, parts);
|
2018
2108
|
return (0, import_lodash.isNil)(result) ? defaultValue : result;
|
2019
2109
|
}
|
2110
|
+
function getEventConfigById(eventConfigs, id) {
|
2111
|
+
const eventConfig = eventConfigs.find(
|
2112
|
+
(eventConfiguration) => eventConfiguration.id === id
|
2113
|
+
);
|
2114
|
+
return getOrThrow(eventConfig, `Event config for ${id} not found`);
|
2115
|
+
}
|
2020
2116
|
|
2021
2117
|
// ../commons/src/events/EventConfig.ts
|
2022
2118
|
var import_zod_openapi8 = require("zod-openapi");
|
@@ -2025,7 +2121,7 @@ var EventConfig = import_zod18.z.object({
|
|
2025
2121
|
id: import_zod18.z.string().describe(
|
2026
2122
|
'A machine-readable identifier for the event, e.g. "birth" or "death"'
|
2027
2123
|
),
|
2028
|
-
dateOfEvent:
|
2124
|
+
dateOfEvent: FieldReference.optional(),
|
2029
2125
|
title: TranslationConfig,
|
2030
2126
|
fallbackTitle: TranslationConfig.optional().describe(
|
2031
2127
|
"This is a fallback title if actual title resolves to empty string"
|
@@ -2069,13 +2165,13 @@ var EventConfig = import_zod18.z.object({
|
|
2069
2165
|
}
|
2070
2166
|
if (event2.dateOfEvent) {
|
2071
2167
|
const eventDateFieldId = getDeclarationFields(event2).find(
|
2072
|
-
({ id }) => id === event2.dateOfEvent
|
2168
|
+
({ id }) => id === event2.dateOfEvent?.$$field
|
2073
2169
|
);
|
2074
2170
|
if (!eventDateFieldId) {
|
2075
2171
|
ctx.addIssue({
|
2076
2172
|
code: "custom",
|
2077
2173
|
message: `Date of event field id must match a field id in fields array.
|
2078
|
-
Invalid date of event field ID for event ${event2.id}: ${event2.dateOfEvent
|
2174
|
+
Invalid date of event field ID for event ${event2.id}: ${event2.dateOfEvent.$$field}`,
|
2079
2175
|
path: ["dateOfEvent"]
|
2080
2176
|
});
|
2081
2177
|
} else if (eventDateFieldId.type !== FieldType.DATE) {
|
@@ -2228,7 +2324,7 @@ function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
|
|
2228
2324
|
};
|
2229
2325
|
}
|
2230
2326
|
function isFieldReference(value) {
|
2231
|
-
return typeof value === "object" && value !== null && "
|
2327
|
+
return typeof value === "object" && value !== null && "$$field" in value;
|
2232
2328
|
}
|
2233
2329
|
function createFieldConditionals(fieldId) {
|
2234
2330
|
const getDateRange = (date, clause) => ({
|
@@ -2243,6 +2339,10 @@ function createFieldConditionals(fieldId) {
|
|
2243
2339
|
required: [fieldId]
|
2244
2340
|
});
|
2245
2341
|
return {
|
2342
|
+
/**
|
2343
|
+
* @private Internal property used for field reference tracking.
|
2344
|
+
*/
|
2345
|
+
$$field: fieldId,
|
2246
2346
|
isAfter: () => ({
|
2247
2347
|
days: (days) => ({
|
2248
2348
|
inPast: () => defineFormConditional(
|
@@ -2254,7 +2354,7 @@ function createFieldConditionals(fieldId) {
|
|
2254
2354
|
}),
|
2255
2355
|
date: (date) => {
|
2256
2356
|
if (isFieldReference(date)) {
|
2257
|
-
const comparedFieldId = date
|
2357
|
+
const comparedFieldId = date.$$field;
|
2258
2358
|
return defineFormConditional(
|
2259
2359
|
getDateRangeToFieldReference(
|
2260
2360
|
fieldId,
|
@@ -2278,7 +2378,7 @@ function createFieldConditionals(fieldId) {
|
|
2278
2378
|
}),
|
2279
2379
|
date: (date) => {
|
2280
2380
|
if (isFieldReference(date)) {
|
2281
|
-
const comparedFieldId = date
|
2381
|
+
const comparedFieldId = date.$$field;
|
2282
2382
|
return defineFormConditional(
|
2283
2383
|
getDateRangeToFieldReference(
|
2284
2384
|
fieldId,
|
@@ -2293,13 +2393,13 @@ function createFieldConditionals(fieldId) {
|
|
2293
2393
|
}),
|
2294
2394
|
isEqualTo: (value) => {
|
2295
2395
|
if (isFieldReference(value)) {
|
2296
|
-
const comparedFieldId = value
|
2396
|
+
const comparedFieldId = value.$$field;
|
2297
2397
|
return defineFormConditional({
|
2298
2398
|
type: "object",
|
2299
2399
|
properties: {
|
2300
2400
|
[fieldId]: {
|
2301
2401
|
type: ["string", "boolean"],
|
2302
|
-
const: { $data:
|
2402
|
+
const: { $data: `/$form/${comparedFieldId}` }
|
2303
2403
|
},
|
2304
2404
|
[comparedFieldId]: { type: ["string", "boolean"] }
|
2305
2405
|
},
|
@@ -2410,7 +2510,23 @@ function createFieldConditionals(fieldId) {
|
|
2410
2510
|
},
|
2411
2511
|
required: [fieldId]
|
2412
2512
|
}),
|
2413
|
-
getId: () => ({ fieldId })
|
2513
|
+
getId: () => ({ fieldId }),
|
2514
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2515
|
+
object: (options) => defineFormConditional({
|
2516
|
+
type: "object",
|
2517
|
+
properties: {
|
2518
|
+
[fieldId]: {
|
2519
|
+
type: "object",
|
2520
|
+
properties: Object.fromEntries(
|
2521
|
+
Object.entries(options).map(([key, value]) => {
|
2522
|
+
return [key, value.properties.$form.properties[key]];
|
2523
|
+
})
|
2524
|
+
),
|
2525
|
+
required: Object.keys(options)
|
2526
|
+
}
|
2527
|
+
},
|
2528
|
+
required: [fieldId]
|
2529
|
+
})
|
2414
2530
|
};
|
2415
2531
|
}
|
2416
2532
|
|
@@ -2489,27 +2605,16 @@ var import_zod21 = require("zod");
|
|
2489
2605
|
|
2490
2606
|
// ../commons/src/events/EventMetadata.ts
|
2491
2607
|
var import_zod20 = require("zod");
|
2492
|
-
var EventStatus =
|
2493
|
-
|
2494
|
-
|
2495
|
-
|
2496
|
-
|
2497
|
-
|
2498
|
-
|
2499
|
-
|
2500
|
-
|
2501
|
-
|
2502
|
-
var eventStatusValues = [
|
2503
|
-
EventStatus.CREATED,
|
2504
|
-
EventStatus.NOTIFIED,
|
2505
|
-
EventStatus.DECLARED,
|
2506
|
-
EventStatus.VALIDATED,
|
2507
|
-
EventStatus.REGISTERED,
|
2508
|
-
EventStatus.CERTIFIED,
|
2509
|
-
EventStatus.REJECTED,
|
2510
|
-
EventStatus.ARCHIVED
|
2511
|
-
];
|
2512
|
-
var EventStatusEnum = import_zod20.z.enum(eventStatusValues);
|
2608
|
+
var EventStatus = import_zod20.z.enum([
|
2609
|
+
"CREATED",
|
2610
|
+
"NOTIFIED",
|
2611
|
+
"DECLARED",
|
2612
|
+
"VALIDATED",
|
2613
|
+
"REGISTERED",
|
2614
|
+
"CERTIFIED",
|
2615
|
+
"REJECTED",
|
2616
|
+
"ARCHIVED"
|
2617
|
+
]);
|
2513
2618
|
var CustomFlags = {
|
2514
2619
|
CERTIFICATE_PRINTED: "certificate-printed"
|
2515
2620
|
};
|
@@ -2521,8 +2626,6 @@ var Flag = import_zod20.z.string().regex(
|
|
2521
2626
|
),
|
2522
2627
|
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
2523
2628
|
).or(import_zod20.z.nativeEnum(CustomFlags));
|
2524
|
-
var eventStatuses = Object.values(EventStatus);
|
2525
|
-
var EventStatuses = import_zod20.z.nativeEnum(EventStatus);
|
2526
2629
|
var ZodDate = import_zod20.z.string().date();
|
2527
2630
|
var ActionCreationMetadata = import_zod20.z.object({
|
2528
2631
|
createdAt: import_zod20.z.string().datetime().describe("The timestamp when the action request was created."),
|
@@ -2531,7 +2634,8 @@ var ActionCreationMetadata = import_zod20.z.object({
|
|
2531
2634
|
"Location of the user who created the action request."
|
2532
2635
|
),
|
2533
2636
|
acceptedAt: import_zod20.z.string().datetime().describe("Timestamp when the action request was accepted."),
|
2534
|
-
createdByRole: import_zod20.z.string().describe("Role of the user at the time of action request creation.")
|
2637
|
+
createdByRole: import_zod20.z.string().describe("Role of the user at the time of action request creation."),
|
2638
|
+
createdBySignature: import_zod20.z.string().nullish().describe("Signature of the user who created the action request.")
|
2535
2639
|
});
|
2536
2640
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
2537
2641
|
registrationNumber: import_zod20.z.string().describe(
|
@@ -2539,13 +2643,13 @@ var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
2539
2643
|
)
|
2540
2644
|
});
|
2541
2645
|
var LegalStatuses = import_zod20.z.object({
|
2542
|
-
[EventStatus.DECLARED]: ActionCreationMetadata.nullish(),
|
2543
|
-
[EventStatus.REGISTERED]: RegistrationCreationMetadata.nullish()
|
2646
|
+
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
2647
|
+
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
2544
2648
|
});
|
2545
2649
|
var EventMetadata = import_zod20.z.object({
|
2546
|
-
id:
|
2650
|
+
id: import_zod20.z.string(),
|
2547
2651
|
type: import_zod20.z.string().describe("The type of event, such as birth, death, or marriage."),
|
2548
|
-
status:
|
2652
|
+
status: EventStatus,
|
2549
2653
|
legalStatuses: LegalStatuses.describe(
|
2550
2654
|
"Metadata related to the legal registration of the event, such as who registered it and when."
|
2551
2655
|
),
|
@@ -2557,9 +2661,7 @@ var EventMetadata = import_zod20.z.object({
|
|
2557
2661
|
"Location of the user who created the event."
|
2558
2662
|
),
|
2559
2663
|
createdBySignature: import_zod20.z.string().nullish().describe("Signature of the user who created the event."),
|
2560
|
-
updatedAtLocation:
|
2561
|
-
"Location of the user who last updated the declaration."
|
2562
|
-
),
|
2664
|
+
updatedAtLocation: import_zod20.z.string().nullish().describe("Location of the user who last updated the declaration."),
|
2563
2665
|
updatedAt: import_zod20.z.string().datetime().describe("Timestamp of the most recent declaration update."),
|
2564
2666
|
assignedTo: import_zod20.z.string().nullish().describe("ID of the user currently assigned to the event."),
|
2565
2667
|
updatedBy: import_zod20.z.string().nullish().describe("ID of the user who last updated the declaration."),
|
@@ -2712,13 +2814,13 @@ var AnyOf = import_zod22.z.object({
|
|
2712
2814
|
});
|
2713
2815
|
var ExactStatus = import_zod22.z.object({
|
2714
2816
|
type: import_zod22.z.literal("exact"),
|
2715
|
-
term:
|
2817
|
+
term: EventStatus
|
2716
2818
|
}).openapi({
|
2717
2819
|
ref: "ExactStatus"
|
2718
2820
|
});
|
2719
2821
|
var AnyOfStatus = import_zod22.z.object({
|
2720
2822
|
type: import_zod22.z.literal("anyOf"),
|
2721
|
-
terms: import_zod22.z.array(
|
2823
|
+
terms: import_zod22.z.array(EventStatus)
|
2722
2824
|
}).openapi({
|
2723
2825
|
ref: "AnyOfStatus"
|
2724
2826
|
});
|
@@ -2755,6 +2857,7 @@ var QueryExpression = import_zod22.z.object({
|
|
2755
2857
|
"legalStatus.REGISTERED.createdAtLocation": import_zod22.z.optional(
|
2756
2858
|
import_zod22.z.union([Within, Exact])
|
2757
2859
|
),
|
2860
|
+
"legalStatus.REGISTERED.registrationNumber": import_zod22.z.optional(Exact),
|
2758
2861
|
createdAtLocation: import_zod22.z.optional(import_zod22.z.union([Within, Exact])),
|
2759
2862
|
updatedAtLocation: import_zod22.z.optional(import_zod22.z.union([Within, Exact])),
|
2760
2863
|
assignedTo: import_zod22.z.optional(Exact),
|
@@ -2778,22 +2881,13 @@ var QueryType = import_zod22.z.object({
|
|
2778
2881
|
}
|
2779
2882
|
return val;
|
2780
2883
|
},
|
2781
|
-
import_zod22.z.array(QueryExpression).openapi({
|
2884
|
+
import_zod22.z.array(QueryExpression).nonempty("At least one clause is required.").openapi({
|
2782
2885
|
default: [
|
2783
2886
|
{
|
2784
2887
|
eventType: TENNIS_CLUB_MEMBERSHIP,
|
2785
2888
|
status: {
|
2786
2889
|
type: "anyOf",
|
2787
|
-
terms:
|
2788
|
-
"CREATED",
|
2789
|
-
"NOTIFIED",
|
2790
|
-
"DECLARED",
|
2791
|
-
"VALIDATED",
|
2792
|
-
"REGISTERED",
|
2793
|
-
"CERTIFIED",
|
2794
|
-
"REJECTED",
|
2795
|
-
"ARCHIVED"
|
2796
|
-
]
|
2890
|
+
terms: EventStatus.options
|
2797
2891
|
},
|
2798
2892
|
updatedAt: {
|
2799
2893
|
type: "range",
|
@@ -2957,7 +3051,7 @@ var AvailableIcons = import_zod24.z.enum([
|
|
2957
3051
|
]);
|
2958
3052
|
|
2959
3053
|
// ../commons/src/events/WorkqueueConfig.ts
|
2960
|
-
var
|
3054
|
+
var mandatoryColumns = defineWorkqueuesColumns([
|
2961
3055
|
{
|
2962
3056
|
label: {
|
2963
3057
|
id: "workqueues.dateOfEvent",
|
@@ -2975,6 +3069,10 @@ var dateOfEventColumn = defineWorkqueuesColumns([
|
|
2975
3069
|
value: event.field("updatedAt")
|
2976
3070
|
}
|
2977
3071
|
]);
|
3072
|
+
var WorkqueueActionsWithDefault = import_zod25.z.enum([
|
3073
|
+
...workqueueActions.options,
|
3074
|
+
"DEFAULT"
|
3075
|
+
]);
|
2978
3076
|
var WorkqueueConfig = import_zod25.z.object({
|
2979
3077
|
slug: import_zod25.z.string().describe("Determines the url of the workqueue."),
|
2980
3078
|
name: TranslationConfig.describe(
|
@@ -2983,11 +3081,11 @@ var WorkqueueConfig = import_zod25.z.object({
|
|
2983
3081
|
query: CountryConfigQueryType,
|
2984
3082
|
actions: import_zod25.z.array(
|
2985
3083
|
import_zod25.z.object({
|
2986
|
-
type:
|
3084
|
+
type: WorkqueueActionsWithDefault,
|
2987
3085
|
conditionals: import_zod25.z.array(Conditional).optional()
|
2988
3086
|
})
|
2989
3087
|
),
|
2990
|
-
columns: import_zod25.z.array(WorkqueueColumn).default(
|
3088
|
+
columns: import_zod25.z.array(WorkqueueColumn).default(mandatoryColumns),
|
2991
3089
|
icon: AvailableIcons
|
2992
3090
|
}).describe("Configuration for workqueue.");
|
2993
3091
|
var WorkqueueConfigInput = import_zod25.z.object({
|
@@ -2998,11 +3096,11 @@ var WorkqueueConfigInput = import_zod25.z.object({
|
|
2998
3096
|
query: CountryConfigQueryInputType,
|
2999
3097
|
actions: import_zod25.z.array(
|
3000
3098
|
import_zod25.z.object({
|
3001
|
-
type:
|
3099
|
+
type: WorkqueueActionsWithDefault,
|
3002
3100
|
conditionals: import_zod25.z.array(Conditional).optional()
|
3003
3101
|
})
|
3004
3102
|
),
|
3005
|
-
columns: import_zod25.z.array(WorkqueueColumn).default(
|
3103
|
+
columns: import_zod25.z.array(WorkqueueColumn).default(mandatoryColumns),
|
3006
3104
|
icon: AvailableIcons
|
3007
3105
|
});
|
3008
3106
|
function defineWorkqueue(workqueueInput) {
|
@@ -3044,13 +3142,14 @@ var import_zod27 = require("zod");
|
|
3044
3142
|
// ../commons/src/events/ActionInput.ts
|
3045
3143
|
var import_zod26 = require("zod");
|
3046
3144
|
var import_zod_openapi10 = require("zod-openapi");
|
3145
|
+
var import_uuid3 = require("uuid");
|
3047
3146
|
(0, import_zod_openapi10.extendZodWithOpenApi)(import_zod26.z);
|
3048
3147
|
var BaseActionInput = import_zod26.z.object({
|
3049
|
-
eventId:
|
3148
|
+
eventId: import_zod26.z.string(),
|
3050
3149
|
transactionId: import_zod26.z.string(),
|
3051
3150
|
declaration: ActionUpdate.default({}),
|
3052
3151
|
annotation: ActionUpdate.optional(),
|
3053
|
-
originalActionId:
|
3152
|
+
originalActionId: import_zod26.z.string().optional(),
|
3054
3153
|
keepAssignment: import_zod26.z.boolean().optional()
|
3055
3154
|
});
|
3056
3155
|
var CreateActionInput = BaseActionInput.merge(
|
@@ -3078,7 +3177,7 @@ var NotifyActionInput = BaseActionInput.merge(
|
|
3078
3177
|
).openapi({
|
3079
3178
|
default: {
|
3080
3179
|
eventId: "<event-id-here>",
|
3081
|
-
transactionId:
|
3180
|
+
transactionId: (0, import_uuid3.v4)(),
|
3082
3181
|
declaration: {},
|
3083
3182
|
annotation: {},
|
3084
3183
|
type: ActionType.NOTIFY
|
@@ -3145,7 +3244,7 @@ var ReadActionInput = BaseActionInput.merge(
|
|
3145
3244
|
type: import_zod26.z.literal(ActionType.READ).default(ActionType.READ)
|
3146
3245
|
})
|
3147
3246
|
);
|
3148
|
-
var DeleteActionInput = import_zod26.z.object({ eventId:
|
3247
|
+
var DeleteActionInput = import_zod26.z.object({ eventId: import_zod26.z.string() });
|
3149
3248
|
var ActionInput = import_zod26.z.discriminatedUnion("type", [
|
3150
3249
|
CreateActionInput.openapi({ ref: "CreateActionInput" }),
|
3151
3250
|
ValidateActionInput.openapi({ ref: "ValidateActionInput" }),
|
@@ -3176,8 +3275,8 @@ var ActionInput = import_zod26.z.discriminatedUnion("type", [
|
|
3176
3275
|
|
3177
3276
|
// ../commons/src/events/Draft.ts
|
3178
3277
|
var Draft = import_zod27.z.object({
|
3179
|
-
id:
|
3180
|
-
eventId:
|
3278
|
+
id: import_zod27.z.string(),
|
3279
|
+
eventId: import_zod27.z.string(),
|
3181
3280
|
transactionId: import_zod27.z.string(),
|
3182
3281
|
createdAt: import_zod27.z.string().datetime(),
|
3183
3282
|
action: ActionBase.extend({
|
@@ -3195,18 +3294,18 @@ var DraftInput = BaseActionInput.extend({
|
|
3195
3294
|
|
3196
3295
|
// ../commons/src/events/EventInput.ts
|
3197
3296
|
var import_zod28 = require("zod");
|
3198
|
-
var
|
3297
|
+
var import_uuid4 = require("uuid");
|
3199
3298
|
var EventInput = import_zod28.z.object({
|
3200
3299
|
transactionId: import_zod28.z.string(),
|
3201
3300
|
type: import_zod28.z.string()
|
3202
|
-
}).openapi({ default: { transactionId: (0,
|
3301
|
+
}).openapi({ default: { transactionId: (0, import_uuid4.v4)(), type: "v2.birth" } });
|
3203
3302
|
|
3204
3303
|
// ../commons/src/events/EventDocument.ts
|
3205
3304
|
var import_zod29 = require("zod");
|
3206
3305
|
var import_zod_openapi11 = require("zod-openapi");
|
3207
3306
|
(0, import_zod_openapi11.extendZodWithOpenApi)(import_zod29.z);
|
3208
3307
|
var EventDocument = import_zod29.z.object({
|
3209
|
-
id:
|
3308
|
+
id: import_zod29.z.string(),
|
3210
3309
|
type: import_zod29.z.string(),
|
3211
3310
|
createdAt: import_zod29.z.string().datetime(),
|
3212
3311
|
updatedAt: import_zod29.z.string().datetime(),
|
@@ -3248,6 +3347,7 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
|
|
3248
3347
|
createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
|
3249
3348
|
acceptedAt: acceptAction.createdAt,
|
3250
3349
|
createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
|
3350
|
+
createdBySignature: requestAction?.createdBySignature ?? acceptAction.createdBySignature,
|
3251
3351
|
registrationNumber
|
3252
3352
|
};
|
3253
3353
|
}
|
@@ -3276,11 +3376,11 @@ function getDeclarationActionUpdateMetadata(actions) {
|
|
3276
3376
|
}
|
3277
3377
|
function getLegalStatuses(actions) {
|
3278
3378
|
return {
|
3279
|
-
[EventStatus.DECLARED]: getDeclarationActionCreationMetadata(
|
3379
|
+
[EventStatus.enum.DECLARED]: getDeclarationActionCreationMetadata(
|
3280
3380
|
ActionType.DECLARE,
|
3281
3381
|
actions
|
3282
3382
|
),
|
3283
|
-
[EventStatus.REGISTERED]: getDeclarationActionCreationMetadata(
|
3383
|
+
[EventStatus.enum.REGISTERED]: getDeclarationActionCreationMetadata(
|
3284
3384
|
ActionType.REGISTER,
|
3285
3385
|
actions
|
3286
3386
|
)
|
@@ -3293,26 +3393,26 @@ function getStatusFromActions(actions) {
|
|
3293
3393
|
(a) => a.status === ActionStatus.Rejected
|
3294
3394
|
);
|
3295
3395
|
if (hasRejectedAction) {
|
3296
|
-
return EventStatus.REJECTED;
|
3396
|
+
return EventStatus.enum.REJECTED;
|
3297
3397
|
}
|
3298
3398
|
return actions.reduce((status, action) => {
|
3299
3399
|
switch (action.type) {
|
3300
3400
|
case ActionType.CREATE:
|
3301
|
-
return EventStatus.CREATED;
|
3401
|
+
return EventStatus.enum.CREATED;
|
3302
3402
|
case ActionType.DECLARE:
|
3303
|
-
return EventStatus.DECLARED;
|
3403
|
+
return EventStatus.enum.DECLARED;
|
3304
3404
|
case ActionType.VALIDATE:
|
3305
|
-
return EventStatus.VALIDATED;
|
3405
|
+
return EventStatus.enum.VALIDATED;
|
3306
3406
|
case ActionType.REGISTER:
|
3307
|
-
return EventStatus.REGISTERED;
|
3407
|
+
return EventStatus.enum.REGISTERED;
|
3308
3408
|
case ActionType.REJECT:
|
3309
|
-
return EventStatus.REJECTED;
|
3409
|
+
return EventStatus.enum.REJECTED;
|
3310
3410
|
case ActionType.ARCHIVE:
|
3311
|
-
return EventStatus.ARCHIVED;
|
3411
|
+
return EventStatus.enum.ARCHIVED;
|
3312
3412
|
case ActionType.NOTIFY:
|
3313
|
-
return EventStatus.NOTIFIED;
|
3413
|
+
return EventStatus.enum.NOTIFIED;
|
3314
3414
|
case ActionType.PRINT_CERTIFICATE:
|
3315
|
-
return EventStatus.CERTIFIED;
|
3415
|
+
return EventStatus.enum.CERTIFIED;
|
3316
3416
|
case ActionType.ASSIGN:
|
3317
3417
|
case ActionType.UNASSIGN:
|
3318
3418
|
case ActionType.REQUEST_CORRECTION:
|
@@ -3323,7 +3423,7 @@ function getStatusFromActions(actions) {
|
|
3323
3423
|
default:
|
3324
3424
|
return status;
|
3325
3425
|
}
|
3326
|
-
}, EventStatus.CREATED);
|
3426
|
+
}, EventStatus.enum.CREATED);
|
3327
3427
|
}
|
3328
3428
|
function getFlagsFromActions(actions) {
|
3329
3429
|
const sortedactions = actions.sort(
|
@@ -3415,7 +3515,7 @@ function deepDropNulls(obj) {
|
|
3415
3515
|
return obj;
|
3416
3516
|
}
|
3417
3517
|
function isUndeclaredDraft(status) {
|
3418
|
-
return status === EventStatus.CREATED;
|
3518
|
+
return status === EventStatus.enum.CREATED;
|
3419
3519
|
}
|
3420
3520
|
function getAcceptedActions(event2) {
|
3421
3521
|
return event2.actions.filter(
|
@@ -3438,7 +3538,7 @@ function getCurrentEventState(event2, config) {
|
|
3438
3538
|
let dateOfEvent;
|
3439
3539
|
if (config.dateOfEvent) {
|
3440
3540
|
const parsedDate = ZodDate.safeParse(
|
3441
|
-
declaration[config.dateOfEvent
|
3541
|
+
declaration[config.dateOfEvent.$$field]
|
3442
3542
|
);
|
3443
3543
|
if (parsedDate.success) {
|
3444
3544
|
dateOfEvent = parsedDate.data;
|
@@ -3576,10 +3676,6 @@ function createFieldConfig(fieldId, options) {
|
|
3576
3676
|
// ../commons/src/events/field.ts
|
3577
3677
|
function field(fieldId, options = {}) {
|
3578
3678
|
return {
|
3579
|
-
/**
|
3580
|
-
* @private Internal property used for field reference tracking.
|
3581
|
-
*/
|
3582
|
-
_fieldId: fieldId,
|
3583
3679
|
...createFieldConditionals(fieldId),
|
3584
3680
|
...createFieldConfig(fieldId, options)
|
3585
3681
|
};
|
@@ -4245,7 +4341,7 @@ var PRINT_CERTIFICATE_FORM = defineActionForm({
|
|
4245
4341
|
var TENNIS_CLUB_DECLARATION_REVIEW = {
|
4246
4342
|
title: {
|
4247
4343
|
id: "v2.event.tennis-club-membership.action.declare.form.review.title",
|
4248
|
-
defaultMessage: "{applicant.firstname, select, __EMPTY__ {Member declaration} other {{applicant.surname, select, __EMPTY__ {Member declaration} other {Member declaration for {applicant.firstname} {applicant.surname}}}}}",
|
4344
|
+
defaultMessage: "{applicant.name.firstname, select, __EMPTY__ {Member declaration} other {{applicant.name.surname, select, __EMPTY__ {Member declaration} other {Member declaration for {applicant.name.firstname} {applicant.name.surname}}}}}",
|
4249
4345
|
description: "Title of the review page"
|
4250
4346
|
},
|
4251
4347
|
fields: [
|
@@ -4290,27 +4386,17 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
|
4290
4386
|
},
|
4291
4387
|
fields: [
|
4292
4388
|
{
|
4293
|
-
id: "applicant.
|
4294
|
-
type: FieldType.
|
4389
|
+
id: "applicant.name",
|
4390
|
+
type: FieldType.NAME,
|
4295
4391
|
required: true,
|
4392
|
+
hideLabel: true,
|
4296
4393
|
conditionals: [],
|
4297
4394
|
label: {
|
4298
|
-
defaultMessage: "Applicant's
|
4395
|
+
defaultMessage: "Applicant's name",
|
4299
4396
|
description: "This is the label for the field",
|
4300
4397
|
id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.firstname.label"
|
4301
4398
|
}
|
4302
4399
|
},
|
4303
|
-
{
|
4304
|
-
id: "applicant.surname",
|
4305
|
-
type: FieldType.TEXT,
|
4306
|
-
required: true,
|
4307
|
-
conditionals: [],
|
4308
|
-
label: {
|
4309
|
-
defaultMessage: "Applicant's surname",
|
4310
|
-
description: "This is the label for the field",
|
4311
|
-
id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.surname.label"
|
4312
|
-
}
|
4313
|
-
},
|
4314
4400
|
{
|
4315
4401
|
id: "applicant.email",
|
4316
4402
|
type: "EMAIL",
|
@@ -4444,8 +4530,9 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
|
4444
4530
|
}
|
4445
4531
|
},
|
4446
4532
|
{
|
4447
|
-
id: "recommender.
|
4448
|
-
type: FieldType.
|
4533
|
+
id: "recommender.name",
|
4534
|
+
type: FieldType.NAME,
|
4535
|
+
hideLabel: true,
|
4449
4536
|
required: true,
|
4450
4537
|
conditionals: [
|
4451
4538
|
{
|
@@ -4454,27 +4541,11 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
|
4454
4541
|
}
|
4455
4542
|
],
|
4456
4543
|
label: {
|
4457
|
-
defaultMessage: "Recommender's
|
4544
|
+
defaultMessage: "Recommender's name",
|
4458
4545
|
description: "This is the label for the field",
|
4459
4546
|
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.firstname.label"
|
4460
4547
|
}
|
4461
4548
|
},
|
4462
|
-
{
|
4463
|
-
id: "recommender.surname",
|
4464
|
-
type: FieldType.TEXT,
|
4465
|
-
required: true,
|
4466
|
-
conditionals: [
|
4467
|
-
{
|
4468
|
-
type: ConditionalType.SHOW,
|
4469
|
-
conditional: field("recommender.none").isFalsy()
|
4470
|
-
}
|
4471
|
-
],
|
4472
|
-
label: {
|
4473
|
-
defaultMessage: "Recommender's surname",
|
4474
|
-
description: "This is the label for the field",
|
4475
|
-
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.surname.label"
|
4476
|
-
}
|
4477
|
-
},
|
4478
4549
|
{
|
4479
4550
|
id: "recommender.id",
|
4480
4551
|
type: FieldType.TEXT,
|
@@ -4505,7 +4576,7 @@ var statusOptions = [
|
|
4505
4576
|
}
|
4506
4577
|
},
|
4507
4578
|
{
|
4508
|
-
value: EventStatus.CREATED,
|
4579
|
+
value: EventStatus.enum.CREATED,
|
4509
4580
|
label: {
|
4510
4581
|
defaultMessage: "Draft",
|
4511
4582
|
description: "Option for form field: status of record",
|
@@ -4513,7 +4584,7 @@ var statusOptions = [
|
|
4513
4584
|
}
|
4514
4585
|
},
|
4515
4586
|
{
|
4516
|
-
value: EventStatus.NOTIFIED,
|
4587
|
+
value: EventStatus.enum.NOTIFIED,
|
4517
4588
|
label: {
|
4518
4589
|
defaultMessage: "Notified",
|
4519
4590
|
description: "Option for form field: status of record",
|
@@ -4521,7 +4592,7 @@ var statusOptions = [
|
|
4521
4592
|
}
|
4522
4593
|
},
|
4523
4594
|
{
|
4524
|
-
value: EventStatus.DECLARED,
|
4595
|
+
value: EventStatus.enum.DECLARED,
|
4525
4596
|
label: {
|
4526
4597
|
defaultMessage: "Declared",
|
4527
4598
|
description: "Option for form field: status of record",
|
@@ -4529,7 +4600,7 @@ var statusOptions = [
|
|
4529
4600
|
}
|
4530
4601
|
},
|
4531
4602
|
{
|
4532
|
-
value: EventStatus.VALIDATED,
|
4603
|
+
value: EventStatus.enum.VALIDATED,
|
4533
4604
|
label: {
|
4534
4605
|
defaultMessage: "Validated",
|
4535
4606
|
description: "Option for form field: status of record",
|
@@ -4537,7 +4608,7 @@ var statusOptions = [
|
|
4537
4608
|
}
|
4538
4609
|
},
|
4539
4610
|
{
|
4540
|
-
value: EventStatus.REGISTERED,
|
4611
|
+
value: EventStatus.enum.REGISTERED,
|
4541
4612
|
label: {
|
4542
4613
|
defaultMessage: "Registered",
|
4543
4614
|
description: "Option for form field: status of record",
|
@@ -4545,7 +4616,7 @@ var statusOptions = [
|
|
4545
4616
|
}
|
4546
4617
|
},
|
4547
4618
|
{
|
4548
|
-
value: EventStatus.CERTIFIED,
|
4619
|
+
value: EventStatus.enum.CERTIFIED,
|
4549
4620
|
label: {
|
4550
4621
|
defaultMessage: "Certified",
|
4551
4622
|
description: "Option for form field: status of record",
|
@@ -4553,7 +4624,7 @@ var statusOptions = [
|
|
4553
4624
|
}
|
4554
4625
|
},
|
4555
4626
|
{
|
4556
|
-
value: EventStatus.REJECTED,
|
4627
|
+
value: EventStatus.enum.REJECTED,
|
4557
4628
|
label: {
|
4558
4629
|
defaultMessage: "Rejected",
|
4559
4630
|
description: "Option for form field: status of record",
|
@@ -4561,7 +4632,7 @@ var statusOptions = [
|
|
4561
4632
|
}
|
4562
4633
|
},
|
4563
4634
|
{
|
4564
|
-
value: EventStatus.ARCHIVED,
|
4635
|
+
value: EventStatus.enum.ARCHIVED,
|
4565
4636
|
label: {
|
4566
4637
|
defaultMessage: "Archived",
|
4567
4638
|
description: "Option for form field: status of record",
|
@@ -4625,38 +4696,25 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4625
4696
|
id: "v2.event.tennis-club-membership.label"
|
4626
4697
|
},
|
4627
4698
|
title: {
|
4628
|
-
defaultMessage: "{applicant.firstname} {applicant.surname}",
|
4699
|
+
defaultMessage: "{applicant.name.firstname} {applicant.name.surname}",
|
4629
4700
|
description: "This is the title of the summary",
|
4630
4701
|
id: "v2.event.tennis-club-membership.title"
|
4631
4702
|
},
|
4632
4703
|
summary: {
|
4633
4704
|
fields: [
|
4634
4705
|
{
|
4635
|
-
|
4706
|
+
fieldId: "applicant.name",
|
4636
4707
|
label: {
|
4637
|
-
defaultMessage: "Applicant's
|
4708
|
+
defaultMessage: "Applicant's name",
|
4638
4709
|
description: "This is the label for the field",
|
4639
4710
|
id: "event.tennis-club-membership.summary.field.firstname.label"
|
4640
4711
|
},
|
4641
|
-
value: {
|
4642
|
-
defaultMessage: "{applicant.firstname}",
|
4643
|
-
description: "This is the value to show in the summary",
|
4644
|
-
id: "event.tennis-club-membership.summary.field.firstname"
|
4645
|
-
},
|
4646
4712
|
emptyValueMessage: {
|
4647
4713
|
defaultMessage: "First name is not provided",
|
4648
4714
|
description: "This is the message to show when the field is empty",
|
4649
4715
|
id: "event.tennis-club-membership.summary.field.firstname.empty"
|
4650
4716
|
}
|
4651
4717
|
},
|
4652
|
-
{
|
4653
|
-
fieldId: "applicant.surname",
|
4654
|
-
label: {
|
4655
|
-
defaultMessage: "Applicant's last name",
|
4656
|
-
description: "Label for surname",
|
4657
|
-
id: "v2.event.tennis-club-membership.summary.field.surname.label"
|
4658
|
-
}
|
4659
|
-
},
|
4660
4718
|
{
|
4661
4719
|
fieldId: "applicant.email"
|
4662
4720
|
}
|
@@ -4992,8 +5050,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4992
5050
|
id: "v2.event.tennis-club-membership.search.applicants"
|
4993
5051
|
},
|
4994
5052
|
fields: [
|
4995
|
-
field("applicant.
|
4996
|
-
field("applicant.surname").fuzzy(),
|
5053
|
+
field("applicant.name").fuzzy(),
|
4997
5054
|
field("applicant.dob").range(),
|
4998
5055
|
field("applicant.email").exact()
|
4999
5056
|
]
|
@@ -5004,31 +5061,11 @@ var tennisClubMembershipEvent = defineConfig({
|
|
5004
5061
|
description: "Recommender details search field section title",
|
5005
5062
|
id: "v2.event.tennis-club-membership.search.recommender"
|
5006
5063
|
},
|
5007
|
-
fields: [
|
5008
|
-
field("recommender.firstname").fuzzy(),
|
5009
|
-
field("recommender.surname").fuzzy()
|
5010
|
-
]
|
5064
|
+
fields: [field("recommender.name").fuzzy()]
|
5011
5065
|
}
|
5012
5066
|
],
|
5013
5067
|
declaration: TENNIS_CLUB_DECLARATION_FORM
|
5014
5068
|
});
|
5015
|
-
var WorkqueueFixture = defineWorkqueues([
|
5016
|
-
{
|
5017
|
-
columns: [],
|
5018
|
-
slug: "in-progress",
|
5019
|
-
name: {
|
5020
|
-
id: "workqueues.inProgress.title",
|
5021
|
-
defaultMessage: "In progress",
|
5022
|
-
description: "Title of in progress workqueue"
|
5023
|
-
},
|
5024
|
-
query: {
|
5025
|
-
type: "and",
|
5026
|
-
clauses: [{ eventType: tennisClubMembershipEvent.id }]
|
5027
|
-
},
|
5028
|
-
actions: [],
|
5029
|
-
icon: "Draft"
|
5030
|
-
}
|
5031
|
-
]);
|
5032
5069
|
|
5033
5070
|
// ../commons/src/fixtures/football-club-membership-event.ts
|
5034
5071
|
var footballClubMembershipEvent = defineConfig({
|
@@ -5039,21 +5076,21 @@ var footballClubMembershipEvent = defineConfig({
|
|
5039
5076
|
id: "event.football-club-membership.label"
|
5040
5077
|
},
|
5041
5078
|
title: {
|
5042
|
-
defaultMessage: "{applicant.firstname} {applicant.surname}",
|
5079
|
+
defaultMessage: "{applicant.name.firstname} {applicant.name.surname}",
|
5043
5080
|
description: "This is the title of the summary",
|
5044
5081
|
id: "v2.event.football-club-membership.title"
|
5045
5082
|
},
|
5046
5083
|
summary: {
|
5047
5084
|
fields: [
|
5048
5085
|
{
|
5049
|
-
id: "applicant.firstname",
|
5086
|
+
id: "applicant.name.firstname",
|
5050
5087
|
label: {
|
5051
5088
|
defaultMessage: "Applicant's first name",
|
5052
5089
|
description: "This is the label for the field",
|
5053
5090
|
id: "event.football-club-membership.summary.field.firstname.label"
|
5054
5091
|
},
|
5055
5092
|
value: {
|
5056
|
-
defaultMessage: "{applicant.firstname}",
|
5093
|
+
defaultMessage: "{applicant.name.firstname}",
|
5057
5094
|
description: "This is the value to show in the summary",
|
5058
5095
|
id: "event.football-club-membership.summary.field.firstname"
|
5059
5096
|
},
|
@@ -5064,7 +5101,7 @@ var footballClubMembershipEvent = defineConfig({
|
|
5064
5101
|
}
|
5065
5102
|
},
|
5066
5103
|
{
|
5067
|
-
fieldId: "applicant.surname",
|
5104
|
+
fieldId: "applicant.name.surname",
|
5068
5105
|
label: {
|
5069
5106
|
defaultMessage: "Applicant's last name",
|
5070
5107
|
description: "Label for surname",
|
@@ -5406,8 +5443,7 @@ var footballClubMembershipEvent = defineConfig({
|
|
5406
5443
|
id: "v2.event.football-club-membership.search.applicants"
|
5407
5444
|
},
|
5408
5445
|
fields: [
|
5409
|
-
field("applicant.
|
5410
|
-
field("applicant.surname").fuzzy(),
|
5446
|
+
field("applicant.name").fuzzy(),
|
5411
5447
|
field("applicant.dob").range(),
|
5412
5448
|
field("applicant.email").exact()
|
5413
5449
|
]
|
@@ -5418,10 +5454,7 @@ var footballClubMembershipEvent = defineConfig({
|
|
5418
5454
|
description: "Recommender details search field section title",
|
5419
5455
|
id: "v2.event.football-club-membership.search.recommender"
|
5420
5456
|
},
|
5421
|
-
fields: [
|
5422
|
-
field("recommender.firstname").fuzzy(),
|
5423
|
-
field("recommender.surname").fuzzy()
|
5424
|
-
]
|
5457
|
+
fields: [field("recommender.name").fuzzy()]
|
5425
5458
|
}
|
5426
5459
|
],
|
5427
5460
|
declaration: TENNIS_CLUB_DECLARATION_FORM
|
@@ -5486,33 +5519,253 @@ var libraryMembershipEvent = defineConfig({
|
|
5486
5519
|
declaration: libraryMembershipForm
|
5487
5520
|
});
|
5488
5521
|
|
5522
|
+
// ../commons/src/fixtures/v2-birth-event.ts
|
5523
|
+
var child = defineFormPage({
|
5524
|
+
id: "child",
|
5525
|
+
type: PageTypes.enum.FORM,
|
5526
|
+
title: {
|
5527
|
+
defaultMessage: "Child's details",
|
5528
|
+
description: "Form section title for Child",
|
5529
|
+
id: "v2.form.birth.child.title"
|
5530
|
+
},
|
5531
|
+
fields: [
|
5532
|
+
{
|
5533
|
+
id: "child.firstNames",
|
5534
|
+
type: FieldType.TEXT,
|
5535
|
+
required: true,
|
5536
|
+
configuration: { maxLength: 32 },
|
5537
|
+
hideLabel: true,
|
5538
|
+
label: {
|
5539
|
+
defaultMessage: "Child's first name",
|
5540
|
+
description: "This is the label for the field",
|
5541
|
+
id: "v2.event.birth.action.declare.form.section.child.field.name.label"
|
5542
|
+
}
|
5543
|
+
},
|
5544
|
+
{
|
5545
|
+
id: "child.familyName",
|
5546
|
+
type: FieldType.TEXT,
|
5547
|
+
required: true,
|
5548
|
+
configuration: { maxLength: 32 },
|
5549
|
+
hideLabel: true,
|
5550
|
+
label: {
|
5551
|
+
defaultMessage: "Child's last name",
|
5552
|
+
description: "This is the label for the field",
|
5553
|
+
id: "v2.event.birth.action.declare.form.section.child.field.name.label"
|
5554
|
+
}
|
5555
|
+
},
|
5556
|
+
{
|
5557
|
+
id: "child.DoB",
|
5558
|
+
type: "DATE",
|
5559
|
+
required: true,
|
5560
|
+
label: {
|
5561
|
+
defaultMessage: "Date of birth",
|
5562
|
+
description: "This is the label for the field",
|
5563
|
+
id: "v2.event.birth.action.declare.form.section.child.field.dob.label"
|
5564
|
+
}
|
5565
|
+
}
|
5566
|
+
]
|
5567
|
+
});
|
5568
|
+
var mother = defineFormPage({
|
5569
|
+
id: "mother",
|
5570
|
+
type: PageTypes.enum.FORM,
|
5571
|
+
title: {
|
5572
|
+
defaultMessage: "Mother's details",
|
5573
|
+
description: "Form section title for mothers details",
|
5574
|
+
id: "v2.form.section.mother.title"
|
5575
|
+
},
|
5576
|
+
fields: [
|
5577
|
+
{
|
5578
|
+
id: "mother.firstNames",
|
5579
|
+
configuration: { maxLength: 32 },
|
5580
|
+
type: FieldType.TEXT,
|
5581
|
+
required: true,
|
5582
|
+
label: {
|
5583
|
+
defaultMessage: "First name(s)",
|
5584
|
+
description: "This is the label for the field",
|
5585
|
+
id: `v2.event.birth.action.declare.form.section.person.field.firstname.label`
|
5586
|
+
}
|
5587
|
+
},
|
5588
|
+
{
|
5589
|
+
id: `mother.familyName`,
|
5590
|
+
configuration: { maxLength: 32 },
|
5591
|
+
type: FieldType.TEXT,
|
5592
|
+
required: true,
|
5593
|
+
label: {
|
5594
|
+
defaultMessage: "Last name",
|
5595
|
+
description: "This is the label for the field",
|
5596
|
+
id: `v2.event.birth.action.declare.form.section.person.field.surname.label`
|
5597
|
+
}
|
5598
|
+
},
|
5599
|
+
{
|
5600
|
+
id: `mother.DoB`,
|
5601
|
+
type: "DATE",
|
5602
|
+
required: true,
|
5603
|
+
label: {
|
5604
|
+
defaultMessage: "Date of birth",
|
5605
|
+
description: "This is the label for the field",
|
5606
|
+
id: `v2.event.birth.action.declare.form.section.person.field.dob.label`
|
5607
|
+
}
|
5608
|
+
},
|
5609
|
+
{
|
5610
|
+
id: "mother.identifier",
|
5611
|
+
type: FieldType.ID,
|
5612
|
+
required: true,
|
5613
|
+
label: {
|
5614
|
+
defaultMessage: "ID Number",
|
5615
|
+
description: "This is the label for the field",
|
5616
|
+
id: `v2.event.birth.action.declare.form.section.person.field.nid.label`
|
5617
|
+
}
|
5618
|
+
}
|
5619
|
+
]
|
5620
|
+
});
|
5621
|
+
var BIRTH_DECLARATION_FORM = defineDeclarationForm({
|
5622
|
+
label: {
|
5623
|
+
defaultMessage: "Birth decalration form",
|
5624
|
+
id: "v2.event.birth.action.declare.form.label",
|
5625
|
+
description: "This is what this form is referred as in the system"
|
5626
|
+
},
|
5627
|
+
pages: [child, mother]
|
5628
|
+
});
|
5629
|
+
var v2BirthEvent = defineConfig({
|
5630
|
+
id: BIRTH_EVENT,
|
5631
|
+
title: {
|
5632
|
+
defaultMessage: "{child.name.firstname} {child.name.surname}",
|
5633
|
+
description: "This is the title of the summary",
|
5634
|
+
id: "v2.event.birth.title"
|
5635
|
+
},
|
5636
|
+
label: {
|
5637
|
+
defaultMessage: "Birth",
|
5638
|
+
description: "This is what this event is referred as in the system",
|
5639
|
+
id: "v2.event.birth.label"
|
5640
|
+
},
|
5641
|
+
summary: {
|
5642
|
+
fields: []
|
5643
|
+
},
|
5644
|
+
actions: [],
|
5645
|
+
declaration: BIRTH_DECLARATION_FORM
|
5646
|
+
});
|
5647
|
+
|
5489
5648
|
// ../commons/src/events/test.utils.ts
|
5490
|
-
function
|
5649
|
+
function pickRandom(rng, items) {
|
5650
|
+
return items[Math.floor(rng() * items.length)];
|
5651
|
+
}
|
5652
|
+
function generateRandomName(rng) {
|
5653
|
+
const firstnames = [
|
5654
|
+
"Danny",
|
5655
|
+
"John",
|
5656
|
+
"Jane",
|
5657
|
+
"Emily",
|
5658
|
+
"Michael",
|
5659
|
+
"Sarah",
|
5660
|
+
"Chris",
|
5661
|
+
"Jessica",
|
5662
|
+
"Sara",
|
5663
|
+
"Sarachella",
|
5664
|
+
"Sarandera",
|
5665
|
+
"Zara"
|
5666
|
+
];
|
5667
|
+
const surnames = [
|
5668
|
+
"Doe",
|
5669
|
+
"Smith",
|
5670
|
+
"Johnson",
|
5671
|
+
"Brown",
|
5672
|
+
"Williams",
|
5673
|
+
"Jones",
|
5674
|
+
"Garcia",
|
5675
|
+
"Miller",
|
5676
|
+
"Saranen",
|
5677
|
+
"Sarajanen",
|
5678
|
+
"Sarthua",
|
5679
|
+
"Tsarakovski",
|
5680
|
+
"Salamander",
|
5681
|
+
"Zarathustra"
|
5682
|
+
];
|
5683
|
+
return {
|
5684
|
+
firstname: pickRandom(rng, firstnames),
|
5685
|
+
surname: pickRandom(rng, surnames)
|
5686
|
+
};
|
5687
|
+
}
|
5688
|
+
function mapFieldTypeToMockValue(field2, i, rng) {
|
5689
|
+
switch (field2.type) {
|
5690
|
+
case FieldType.DIVIDER:
|
5691
|
+
case FieldType.TEXT:
|
5692
|
+
case FieldType.TEXTAREA:
|
5693
|
+
case FieldType.BULLET_LIST:
|
5694
|
+
case FieldType.PAGE_HEADER:
|
5695
|
+
case FieldType.LOCATION:
|
5696
|
+
case FieldType.SELECT:
|
5697
|
+
case FieldType.COUNTRY:
|
5698
|
+
case FieldType.RADIO_GROUP:
|
5699
|
+
case FieldType.PARAGRAPH:
|
5700
|
+
case FieldType.ADMINISTRATIVE_AREA:
|
5701
|
+
case FieldType.FACILITY:
|
5702
|
+
case FieldType.PHONE:
|
5703
|
+
case FieldType.ID:
|
5704
|
+
case FieldType.OFFICE:
|
5705
|
+
return `${field2.id}-${field2.type}-${i}`;
|
5706
|
+
case FieldType.NAME:
|
5707
|
+
return generateRandomName(rng);
|
5708
|
+
case FieldType.NUMBER:
|
5709
|
+
return 19;
|
5710
|
+
case FieldType.EMAIL:
|
5711
|
+
return "test@opencrvs.org";
|
5712
|
+
case FieldType.ADDRESS:
|
5713
|
+
return {
|
5714
|
+
country: "FAR",
|
5715
|
+
addressType: AddressType.DOMESTIC,
|
5716
|
+
province: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
5717
|
+
district: "5ef450bc-712d-48ad-93f3-8da0fa453baa",
|
5718
|
+
urbanOrRural: "URBAN",
|
5719
|
+
town: "Example Town",
|
5720
|
+
residentialArea: "Example Residential Area",
|
5721
|
+
street: "Example Street",
|
5722
|
+
number: "55",
|
5723
|
+
zipCode: "123456"
|
5724
|
+
};
|
5725
|
+
case FieldType.DATE:
|
5726
|
+
return "2021-01-01";
|
5727
|
+
case FieldType.DATE_RANGE:
|
5728
|
+
return ["2021-01-01", "2021-01-02"];
|
5729
|
+
case FieldType.CHECKBOX:
|
5730
|
+
return true;
|
5731
|
+
case FieldType.SIGNATURE:
|
5732
|
+
case FieldType.FILE:
|
5733
|
+
return {
|
5734
|
+
filename: "4f095fc4-4312-4de2-aa38-86dcc0f71044.png",
|
5735
|
+
originalFilename: "abcd.png",
|
5736
|
+
type: "image/png"
|
5737
|
+
};
|
5738
|
+
case FieldType.FILE_WITH_OPTIONS:
|
5739
|
+
case FieldType.DATA:
|
5740
|
+
return void 0;
|
5741
|
+
}
|
5742
|
+
}
|
5743
|
+
function fieldConfigsToActionPayload(fields, rng) {
|
5491
5744
|
return fields.reduce(
|
5492
5745
|
(acc, field2, i) => ({
|
5493
5746
|
...acc,
|
5494
|
-
[field2.id]: mapFieldTypeToMockValue(field2, i)
|
5747
|
+
[field2.id]: mapFieldTypeToMockValue(field2, i, rng)
|
5495
5748
|
}),
|
5496
5749
|
{}
|
5497
5750
|
);
|
5498
5751
|
}
|
5499
|
-
function generateActionDeclarationInput(configuration, action) {
|
5752
|
+
function generateActionDeclarationInput(configuration, action, rng) {
|
5500
5753
|
const parsed = DeclarationUpdateActions.safeParse(action);
|
5501
5754
|
if (parsed.success) {
|
5502
5755
|
const fields = getDeclarationFields(configuration);
|
5503
5756
|
const declarationConfig = getDeclaration(configuration);
|
5504
|
-
const declaration = fieldConfigsToActionPayload(fields);
|
5757
|
+
const declaration = fieldConfigsToActionPayload(fields, rng);
|
5505
5758
|
return omitHiddenPaginatedFields(declarationConfig, declaration);
|
5506
5759
|
}
|
5507
5760
|
console.warn(`${action} is not a declaration action. Setting data as {}.`);
|
5508
5761
|
return {};
|
5509
5762
|
}
|
5510
|
-
function generateActionAnnotationInput(configuration, action) {
|
5763
|
+
function generateActionAnnotationInput(configuration, action, rng) {
|
5511
5764
|
const actionConfig = configuration.actions.find(
|
5512
5765
|
(ac) => ac.type === action
|
5513
5766
|
);
|
5514
5767
|
const annotationFields = actionConfig ? getActionAnnotationFields(actionConfig) : [];
|
5515
|
-
const annotation = fieldConfigsToActionPayload(annotationFields);
|
5768
|
+
const annotation = fieldConfigsToActionPayload(annotationFields, rng);
|
5516
5769
|
const visibleVerificationPageIds = getVisibleVerificationPageIds(
|
5517
5770
|
findRecordActionPages(configuration, action),
|
5518
5771
|
annotation
|
@@ -5530,198 +5783,226 @@ function generateActionAnnotationInput(configuration, action) {
|
|
5530
5783
|
...visiblePageVerificationMap
|
5531
5784
|
};
|
5532
5785
|
}
|
5533
|
-
|
5534
|
-
|
5535
|
-
|
5536
|
-
type: input.type ?? TENNIS_CLUB_MEMBERSHIP
|
5537
|
-
}),
|
5538
|
-
patch: (id, input = {}) => ({
|
5539
|
-
transactionId: input.transactionId ?? getUUID(),
|
5540
|
-
type: input.type ?? TENNIS_CLUB_MEMBERSHIP,
|
5541
|
-
id
|
5542
|
-
}),
|
5543
|
-
draft: ({ eventId, actionType }, input = {}) => (0, import_lodash2.merge)(
|
5544
|
-
{
|
5545
|
-
id: getUUID(),
|
5546
|
-
eventId,
|
5547
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
5548
|
-
transactionId: getUUID(),
|
5549
|
-
action: {
|
5550
|
-
transactionId: getUUID(),
|
5551
|
-
type: actionType,
|
5552
|
-
status: ActionStatus.Accepted,
|
5553
|
-
declaration: {
|
5554
|
-
"applicant.firstname": "Max",
|
5555
|
-
"applicant.surname": "McLaren",
|
5556
|
-
"applicant.dob": "2020-01-02",
|
5557
|
-
"recommender.none": true
|
5558
|
-
},
|
5559
|
-
annotation: {
|
5560
|
-
"correction.requester.relationship": "ANOTHER_AGENT",
|
5561
|
-
"correction.request.reason": "Child's name was incorrect"
|
5562
|
-
},
|
5563
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
5564
|
-
createdBy: "@todo",
|
5565
|
-
createdByRole: "@todo",
|
5566
|
-
createdAtLocation: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c"
|
5567
|
-
}
|
5568
|
-
},
|
5569
|
-
input
|
5570
|
-
),
|
5571
|
-
actions: {
|
5572
|
-
declare: (eventId, input = {}) => ({
|
5573
|
-
type: ActionType.DECLARE,
|
5574
|
-
transactionId: input.transactionId ?? getUUID(),
|
5575
|
-
declaration: input.declaration ?? generateActionDeclarationInput(
|
5576
|
-
tennisClubMembershipEvent,
|
5577
|
-
ActionType.DECLARE
|
5578
|
-
),
|
5579
|
-
annotation: input.annotation ?? generateActionAnnotationInput(
|
5580
|
-
tennisClubMembershipEvent,
|
5581
|
-
ActionType.DECLARE
|
5582
|
-
),
|
5583
|
-
eventId
|
5584
|
-
}),
|
5585
|
-
/**
|
5586
|
-
* Notify allows sending incomplete data. Think it as 'partial declare' for now.
|
5587
|
-
*/
|
5588
|
-
notify: (eventId, input = {}) => {
|
5589
|
-
let declaration = input.declaration;
|
5590
|
-
if (!declaration) {
|
5591
|
-
const partialDeclaration = (0, import_lodash2.omitBy)(
|
5592
|
-
generateActionDeclarationInput(
|
5593
|
-
tennisClubMembershipEvent,
|
5594
|
-
ActionType.DECLARE
|
5595
|
-
),
|
5596
|
-
import_lodash2.isString
|
5597
|
-
);
|
5598
|
-
declaration = partialDeclaration;
|
5599
|
-
}
|
5600
|
-
return {
|
5601
|
-
type: ActionType.NOTIFY,
|
5602
|
-
transactionId: input.transactionId ?? getUUID(),
|
5603
|
-
declaration,
|
5604
|
-
eventId
|
5605
|
-
};
|
5606
|
-
},
|
5607
|
-
validate: (eventId, input = {}) => ({
|
5608
|
-
type: ActionType.VALIDATE,
|
5609
|
-
transactionId: input.transactionId ?? getUUID(),
|
5610
|
-
declaration: input.declaration ?? generateActionDeclarationInput(
|
5611
|
-
tennisClubMembershipEvent,
|
5612
|
-
ActionType.VALIDATE
|
5613
|
-
),
|
5614
|
-
annotation: input.annotation ?? generateActionAnnotationInput(
|
5615
|
-
tennisClubMembershipEvent,
|
5616
|
-
ActionType.VALIDATE
|
5617
|
-
),
|
5618
|
-
duplicates: [],
|
5619
|
-
eventId
|
5620
|
-
}),
|
5621
|
-
assign: (eventId, input = {}) => ({
|
5622
|
-
type: ActionType.ASSIGN,
|
5623
|
-
transactionId: input.transactionId ?? getUUID(),
|
5624
|
-
declaration: {},
|
5625
|
-
assignedTo: input.assignedTo ?? getUUID(),
|
5626
|
-
eventId
|
5627
|
-
}),
|
5628
|
-
unassign: (eventId, input = {}) => ({
|
5629
|
-
type: ActionType.UNASSIGN,
|
5630
|
-
transactionId: input.transactionId ?? getUUID(),
|
5631
|
-
declaration: {},
|
5632
|
-
assignedTo: null,
|
5633
|
-
eventId
|
5634
|
-
}),
|
5635
|
-
archive: (eventId, input = {}, isDuplicate) => ({
|
5636
|
-
type: ActionType.ARCHIVE,
|
5637
|
-
transactionId: input.transactionId ?? getUUID(),
|
5638
|
-
declaration: {},
|
5639
|
-
// @TODO: Check whether generator is needed?
|
5640
|
-
annotation: {},
|
5641
|
-
duplicates: [],
|
5642
|
-
eventId,
|
5643
|
-
reason: {
|
5644
|
-
message: `${ActionType.ARCHIVE}`,
|
5645
|
-
isDuplicate: isDuplicate ?? false
|
5646
|
-
}
|
5647
|
-
}),
|
5648
|
-
reject: (eventId, input = {}) => ({
|
5649
|
-
type: ActionType.REJECT,
|
5650
|
-
transactionId: input.transactionId ?? getUUID(),
|
5651
|
-
declaration: {},
|
5652
|
-
annotation: input.annotation ?? generateActionAnnotationInput(
|
5653
|
-
tennisClubMembershipEvent,
|
5654
|
-
ActionType.REJECT
|
5655
|
-
),
|
5656
|
-
duplicates: [],
|
5657
|
-
eventId,
|
5658
|
-
reason: { message: `${ActionType.REJECT}` }
|
5659
|
-
}),
|
5660
|
-
register: (eventId, input = {}) => ({
|
5661
|
-
type: ActionType.REGISTER,
|
5786
|
+
function eventPayloadGenerator(rng) {
|
5787
|
+
return {
|
5788
|
+
create: (input = {}) => ({
|
5662
5789
|
transactionId: input.transactionId ?? getUUID(),
|
5663
|
-
|
5664
|
-
tennisClubMembershipEvent,
|
5665
|
-
ActionType.REGISTER
|
5666
|
-
),
|
5667
|
-
annotation: input.annotation ?? generateActionAnnotationInput(
|
5668
|
-
tennisClubMembershipEvent,
|
5669
|
-
ActionType.REGISTER
|
5670
|
-
),
|
5671
|
-
eventId
|
5790
|
+
type: input.type ?? TENNIS_CLUB_MEMBERSHIP
|
5672
5791
|
}),
|
5673
|
-
|
5674
|
-
type: ActionType.PRINT_CERTIFICATE,
|
5792
|
+
patch: (id, input = {}) => ({
|
5675
5793
|
transactionId: input.transactionId ?? getUUID(),
|
5676
|
-
|
5677
|
-
|
5678
|
-
tennisClubMembershipEvent,
|
5679
|
-
ActionType.PRINT_CERTIFICATE
|
5680
|
-
),
|
5681
|
-
eventId
|
5794
|
+
type: input.type ?? TENNIS_CLUB_MEMBERSHIP,
|
5795
|
+
id
|
5682
5796
|
}),
|
5683
|
-
|
5684
|
-
|
5685
|
-
|
5797
|
+
draft: ({ eventId, actionType }, input = {}) => (0, import_lodash2.merge)(
|
5798
|
+
{
|
5799
|
+
id: getUUID(),
|
5800
|
+
eventId,
|
5801
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
5802
|
+
transactionId: getUUID(),
|
5803
|
+
action: {
|
5804
|
+
transactionId: getUUID(),
|
5805
|
+
type: actionType,
|
5806
|
+
status: ActionStatus.Accepted,
|
5807
|
+
declaration: {
|
5808
|
+
"applicant.name": {
|
5809
|
+
firstname: "Max",
|
5810
|
+
surname: "McLaren"
|
5811
|
+
},
|
5812
|
+
"applicant.dob": "2020-01-02",
|
5813
|
+
"recommender.none": true
|
5814
|
+
},
|
5815
|
+
annotation: {
|
5816
|
+
"correction.requester.relationship": "ANOTHER_AGENT",
|
5817
|
+
"correction.request.reason": "Child's name was incorrect"
|
5818
|
+
},
|
5819
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
5820
|
+
createdBy: "@todo",
|
5821
|
+
createdByRole: "@todo",
|
5822
|
+
createdAtLocation: "@todo"
|
5823
|
+
}
|
5824
|
+
},
|
5825
|
+
input
|
5826
|
+
),
|
5827
|
+
actions: {
|
5828
|
+
declare: (eventId, input = {}) => ({
|
5829
|
+
type: ActionType.DECLARE,
|
5830
|
+
transactionId: input.transactionId ?? getUUID(),
|
5831
|
+
declaration: input.declaration ?? generateActionDeclarationInput(
|
5832
|
+
tennisClubMembershipEvent,
|
5833
|
+
ActionType.DECLARE,
|
5834
|
+
rng
|
5835
|
+
),
|
5836
|
+
annotation: input.annotation ?? generateActionAnnotationInput(
|
5837
|
+
tennisClubMembershipEvent,
|
5838
|
+
ActionType.DECLARE,
|
5839
|
+
rng
|
5840
|
+
),
|
5841
|
+
eventId,
|
5842
|
+
...input
|
5843
|
+
}),
|
5844
|
+
/**
|
5845
|
+
* Notify allows sending incomplete data. Think it as 'partial declare' for now.
|
5846
|
+
*/
|
5847
|
+
notify: (eventId, input = {}) => {
|
5848
|
+
let declaration = input.declaration;
|
5849
|
+
if (!declaration) {
|
5850
|
+
const partialDeclaration = (0, import_lodash2.omitBy)(
|
5851
|
+
generateActionDeclarationInput(
|
5852
|
+
tennisClubMembershipEvent,
|
5853
|
+
ActionType.DECLARE,
|
5854
|
+
rng
|
5855
|
+
),
|
5856
|
+
import_lodash2.isString
|
5857
|
+
);
|
5858
|
+
declaration = partialDeclaration;
|
5859
|
+
}
|
5860
|
+
return {
|
5861
|
+
type: ActionType.NOTIFY,
|
5862
|
+
transactionId: input.transactionId ?? getUUID(),
|
5863
|
+
declaration,
|
5864
|
+
eventId,
|
5865
|
+
keepAssignment: input.keepAssignment
|
5866
|
+
};
|
5867
|
+
},
|
5868
|
+
validate: (eventId, input = {}) => ({
|
5869
|
+
type: ActionType.VALIDATE,
|
5686
5870
|
transactionId: input.transactionId ?? getUUID(),
|
5687
5871
|
declaration: input.declaration ?? generateActionDeclarationInput(
|
5688
5872
|
tennisClubMembershipEvent,
|
5689
|
-
ActionType.
|
5873
|
+
ActionType.VALIDATE,
|
5874
|
+
rng
|
5690
5875
|
),
|
5691
5876
|
annotation: input.annotation ?? generateActionAnnotationInput(
|
5692
5877
|
tennisClubMembershipEvent,
|
5693
|
-
ActionType.
|
5878
|
+
ActionType.VALIDATE,
|
5879
|
+
rng
|
5694
5880
|
),
|
5881
|
+
duplicates: [],
|
5882
|
+
eventId,
|
5883
|
+
...input
|
5884
|
+
}),
|
5885
|
+
assign: (eventId, input = {}) => ({
|
5886
|
+
type: ActionType.ASSIGN,
|
5887
|
+
transactionId: input.transactionId ?? getUUID(),
|
5888
|
+
declaration: {},
|
5889
|
+
assignedTo: input.assignedTo ?? getUUID(),
|
5695
5890
|
eventId
|
5696
5891
|
}),
|
5697
|
-
|
5698
|
-
type: ActionType.
|
5892
|
+
unassign: (eventId, input = {}) => ({
|
5893
|
+
type: ActionType.UNASSIGN,
|
5699
5894
|
transactionId: input.transactionId ?? getUUID(),
|
5700
5895
|
declaration: {},
|
5896
|
+
assignedTo: null,
|
5897
|
+
eventId
|
5898
|
+
}),
|
5899
|
+
archive: (eventId, input = {}, isDuplicate) => ({
|
5900
|
+
type: ActionType.ARCHIVE,
|
5901
|
+
transactionId: input.transactionId ?? getUUID(),
|
5902
|
+
declaration: {},
|
5903
|
+
// @TODO: Check whether generator is needed?
|
5904
|
+
annotation: {},
|
5905
|
+
duplicates: [],
|
5906
|
+
eventId,
|
5907
|
+
reason: {
|
5908
|
+
message: `${ActionType.ARCHIVE}`,
|
5909
|
+
isDuplicate: isDuplicate ?? false
|
5910
|
+
},
|
5911
|
+
...input
|
5912
|
+
}),
|
5913
|
+
reject: (eventId, input = {}) => ({
|
5914
|
+
type: ActionType.REJECT,
|
5915
|
+
transactionId: input.transactionId ?? getUUID(),
|
5916
|
+
declaration: {},
|
5917
|
+
annotation: input.annotation ?? generateActionAnnotationInput(
|
5918
|
+
tennisClubMembershipEvent,
|
5919
|
+
ActionType.REJECT,
|
5920
|
+
rng
|
5921
|
+
),
|
5922
|
+
duplicates: [],
|
5923
|
+
eventId,
|
5924
|
+
reason: { message: `${ActionType.REJECT}` },
|
5925
|
+
...input
|
5926
|
+
}),
|
5927
|
+
register: (eventId, input = {}) => ({
|
5928
|
+
type: ActionType.REGISTER,
|
5929
|
+
transactionId: input.transactionId ?? getUUID(),
|
5930
|
+
declaration: input.declaration ?? generateActionDeclarationInput(
|
5931
|
+
tennisClubMembershipEvent,
|
5932
|
+
ActionType.REGISTER,
|
5933
|
+
rng
|
5934
|
+
),
|
5701
5935
|
annotation: input.annotation ?? generateActionAnnotationInput(
|
5702
5936
|
tennisClubMembershipEvent,
|
5703
|
-
ActionType.
|
5937
|
+
ActionType.REGISTER,
|
5938
|
+
rng
|
5704
5939
|
),
|
5705
5940
|
eventId,
|
5706
|
-
|
5941
|
+
...input
|
5707
5942
|
}),
|
5708
|
-
|
5709
|
-
type: ActionType.
|
5943
|
+
printCertificate: (eventId, input = {}) => ({
|
5944
|
+
type: ActionType.PRINT_CERTIFICATE,
|
5710
5945
|
transactionId: input.transactionId ?? getUUID(),
|
5711
5946
|
declaration: {},
|
5712
5947
|
annotation: input.annotation ?? generateActionAnnotationInput(
|
5713
5948
|
tennisClubMembershipEvent,
|
5714
|
-
ActionType.
|
5949
|
+
ActionType.PRINT_CERTIFICATE,
|
5950
|
+
rng
|
5715
5951
|
),
|
5716
5952
|
eventId,
|
5717
|
-
|
5718
|
-
})
|
5953
|
+
...input
|
5954
|
+
}),
|
5955
|
+
correction: {
|
5956
|
+
request: (eventId, input = {}) => ({
|
5957
|
+
type: ActionType.REQUEST_CORRECTION,
|
5958
|
+
transactionId: input.transactionId ?? getUUID(),
|
5959
|
+
declaration: input.declaration ?? generateActionDeclarationInput(
|
5960
|
+
tennisClubMembershipEvent,
|
5961
|
+
ActionType.REQUEST_CORRECTION,
|
5962
|
+
rng
|
5963
|
+
),
|
5964
|
+
annotation: input.annotation ?? generateActionAnnotationInput(
|
5965
|
+
tennisClubMembershipEvent,
|
5966
|
+
ActionType.REQUEST_CORRECTION,
|
5967
|
+
rng
|
5968
|
+
),
|
5969
|
+
eventId,
|
5970
|
+
keepAssignment: input.keepAssignment
|
5971
|
+
}),
|
5972
|
+
approve: (eventId, requestId, input = {}) => ({
|
5973
|
+
type: ActionType.APPROVE_CORRECTION,
|
5974
|
+
transactionId: input.transactionId ?? getUUID(),
|
5975
|
+
declaration: {},
|
5976
|
+
annotation: input.annotation ?? generateActionAnnotationInput(
|
5977
|
+
tennisClubMembershipEvent,
|
5978
|
+
ActionType.APPROVE_CORRECTION,
|
5979
|
+
rng
|
5980
|
+
),
|
5981
|
+
eventId,
|
5982
|
+
requestId,
|
5983
|
+
keepAssignment: input.keepAssignment
|
5984
|
+
}),
|
5985
|
+
reject: (eventId, requestId, input = {}) => ({
|
5986
|
+
type: ActionType.REJECT_CORRECTION,
|
5987
|
+
transactionId: input.transactionId ?? getUUID(),
|
5988
|
+
declaration: {},
|
5989
|
+
annotation: input.annotation ?? generateActionAnnotationInput(
|
5990
|
+
tennisClubMembershipEvent,
|
5991
|
+
ActionType.REJECT_CORRECTION,
|
5992
|
+
rng
|
5993
|
+
),
|
5994
|
+
eventId,
|
5995
|
+
requestId,
|
5996
|
+
keepAssignment: input.keepAssignment
|
5997
|
+
})
|
5998
|
+
}
|
5719
5999
|
}
|
5720
|
-
}
|
5721
|
-
}
|
6000
|
+
};
|
6001
|
+
}
|
5722
6002
|
function generateActionDocument({
|
5723
6003
|
configuration,
|
5724
6004
|
action,
|
6005
|
+
rng = () => 0.1,
|
5725
6006
|
defaults = {}
|
5726
6007
|
}) {
|
5727
6008
|
const actionBase = {
|
@@ -5732,7 +6013,7 @@ function generateActionDocument({
|
|
5732
6013
|
createdByRole: "FIELD_AGENT",
|
5733
6014
|
id: getUUID(),
|
5734
6015
|
createdAtLocation: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
5735
|
-
declaration: generateActionDeclarationInput(configuration, action),
|
6016
|
+
declaration: generateActionDeclarationInput(configuration, action, rng),
|
5736
6017
|
annotation: {},
|
5737
6018
|
status: ActionStatus.Accepted,
|
5738
6019
|
transactionId: getUUID(),
|
@@ -5784,13 +6065,14 @@ function generateActionDocument({
|
|
5784
6065
|
}
|
5785
6066
|
function generateEventDocument({
|
5786
6067
|
configuration,
|
5787
|
-
actions
|
6068
|
+
actions,
|
6069
|
+
rng = () => 0.1
|
5788
6070
|
}) {
|
5789
6071
|
return {
|
5790
6072
|
trackingId: getUUID(),
|
5791
6073
|
type: configuration.id,
|
5792
6074
|
actions: actions.map(
|
5793
|
-
(action) => generateActionDocument({ configuration, action })
|
6075
|
+
(action) => generateActionDocument({ configuration, action, rng })
|
5794
6076
|
),
|
5795
6077
|
// Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
|
5796
6078
|
// @TODO: This should be fixed in the future.
|
@@ -5801,10 +6083,16 @@ function generateEventDocument({
|
|
5801
6083
|
updatedAt: new Date(Date.now() - 1e3).toISOString()
|
5802
6084
|
};
|
5803
6085
|
}
|
5804
|
-
function generateEventDraftDocument(
|
6086
|
+
function generateEventDraftDocument({
|
6087
|
+
eventId,
|
6088
|
+
actionType,
|
6089
|
+
rng = () => 0.1,
|
6090
|
+
declaration = {}
|
6091
|
+
}) {
|
5805
6092
|
const action = generateActionDocument({
|
5806
6093
|
configuration: tennisClubMembershipEvent,
|
5807
|
-
action: actionType
|
6094
|
+
action: actionType,
|
6095
|
+
rng
|
5808
6096
|
});
|
5809
6097
|
return {
|
5810
6098
|
id: getUUID(),
|
@@ -5820,51 +6108,29 @@ function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE, de
|
|
5820
6108
|
eventId
|
5821
6109
|
};
|
5822
6110
|
}
|
5823
|
-
function pickRandom(rng, items) {
|
5824
|
-
return items[Math.floor(rng() * items.length)];
|
5825
|
-
}
|
5826
6111
|
function getRandomDatetime(rng, start, end) {
|
5827
6112
|
const range = end.getTime() - start.getTime();
|
5828
6113
|
const offset = Math.floor(rng() * range);
|
5829
6114
|
const randomDate = new Date(start.getTime() + offset);
|
5830
6115
|
return randomDate.toISOString();
|
5831
6116
|
}
|
6117
|
+
function getRandomDate(rng, start, end) {
|
6118
|
+
const datetime = getRandomDatetime(rng, new Date(start), new Date(end));
|
6119
|
+
return datetime.split("T")[0];
|
6120
|
+
}
|
5832
6121
|
function generateRandomApplicant(rng) {
|
5833
|
-
const
|
5834
|
-
|
5835
|
-
"John",
|
5836
|
-
"Jane",
|
5837
|
-
"Emily",
|
5838
|
-
"Michael",
|
5839
|
-
"Sarah",
|
5840
|
-
"Chris",
|
5841
|
-
"Jessica"
|
5842
|
-
];
|
5843
|
-
const surnames = [
|
5844
|
-
"Doe",
|
5845
|
-
"Smith",
|
5846
|
-
"Johnson",
|
5847
|
-
"Brown",
|
5848
|
-
"Williams",
|
5849
|
-
"Jones",
|
5850
|
-
"Garcia",
|
5851
|
-
"Miller"
|
5852
|
-
];
|
5853
|
-
const randomFirstName = pickRandom(rng, firstNames);
|
5854
|
-
const randomSurname = pickRandom(rng, surnames);
|
5855
|
-
const randomDob = getRandomDatetime(
|
5856
|
-
rng,
|
5857
|
-
/* @__PURE__ */ new Date("1990-01-01"),
|
5858
|
-
/* @__PURE__ */ new Date("2010-12-31")
|
5859
|
-
).split("T")[0];
|
6122
|
+
const { firstname, surname } = generateRandomName(rng);
|
6123
|
+
const randomDob = getRandomDate(rng, "1990-01-01", "2010-12-31");
|
5860
6124
|
return {
|
5861
6125
|
"recommender.none": true,
|
5862
|
-
"applicant.
|
5863
|
-
|
6126
|
+
"applicant.name": {
|
6127
|
+
firstname,
|
6128
|
+
surname
|
6129
|
+
},
|
5864
6130
|
"applicant.dob": randomDob
|
5865
6131
|
};
|
5866
6132
|
}
|
5867
|
-
function
|
6133
|
+
function createPrng(seed) {
|
5868
6134
|
const MODULUS = 2 ** 32;
|
5869
6135
|
const MULTIPLIER = 1664525;
|
5870
6136
|
const INCREMENT = 1013904223;
|
@@ -5890,7 +6156,7 @@ function generateRandomSignature(rng) {
|
|
5890
6156
|
return `/random-bucket/${generateUuid(rng)}.png`;
|
5891
6157
|
}
|
5892
6158
|
var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
|
5893
|
-
const rng =
|
6159
|
+
const rng = createPrng(seed);
|
5894
6160
|
const createdAt = getRandomDatetime(
|
5895
6161
|
rng,
|
5896
6162
|
/* @__PURE__ */ new Date("2024-01-01"),
|
@@ -5899,7 +6165,7 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
|
|
5899
6165
|
return {
|
5900
6166
|
id: overrides.id ?? generateUuid(rng),
|
5901
6167
|
type: overrides.type ?? TENNIS_CLUB_MEMBERSHIP,
|
5902
|
-
status: overrides.status ?? pickRandom(rng,
|
6168
|
+
status: overrides.status ?? pickRandom(rng, EventStatus.options),
|
5903
6169
|
createdAt: overrides.createdAt ?? createdAt,
|
5904
6170
|
createdBy: overrides.createdBy ?? generateUuid(rng),
|
5905
6171
|
createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
|
@@ -5938,8 +6204,7 @@ var generateWorkqueues = (slug = "all-events") => defineWorkqueues([
|
|
5938
6204
|
clauses: [{ eventType: tennisClubMembershipEvent.id }]
|
5939
6205
|
},
|
5940
6206
|
actions: [],
|
5941
|
-
icon: "Draft"
|
5942
|
-
columns: []
|
6207
|
+
icon: "Draft"
|
5943
6208
|
}
|
5944
6209
|
]);
|
5945
6210
|
|
@@ -5954,7 +6219,9 @@ function isFieldValueWithoutTemplates(value) {
|
|
5954
6219
|
if (isTemplateVariable(value)) {
|
5955
6220
|
return false;
|
5956
6221
|
}
|
5957
|
-
if (typeof value === "object" &&
|
6222
|
+
if (typeof value === "object" && // @todo remove ts-ignore
|
6223
|
+
//@ts-ignore
|
6224
|
+
Object.values(value).some((val) => isTemplateVariable(val))) {
|
5958
6225
|
return false;
|
5959
6226
|
}
|
5960
6227
|
return true;
|
@@ -6293,7 +6560,7 @@ function filterUnallowedActions(actions, userScopes) {
|
|
6293
6560
|
return hasAnyOfScopes(userScopes, requiredScopes);
|
6294
6561
|
});
|
6295
6562
|
const hasOtherAllowedActions = allowedActions.some(
|
6296
|
-
(action) => action
|
6563
|
+
(action) => !isMetaAction(action)
|
6297
6564
|
);
|
6298
6565
|
if (hasOtherAllowedActions) {
|
6299
6566
|
return allowedActions;
|
@@ -6359,6 +6626,8 @@ function deserializeQuery(query, user2) {
|
|
6359
6626
|
...query,
|
6360
6627
|
clauses: query.clauses.map(
|
6361
6628
|
(clause) => deserializeQueryExpression(clause, user2)
|
6629
|
+
// SAFETY: This cast should be safe because `query.clauses` has already been validated as non-empty by the Zod schema.
|
6630
|
+
// Without the cast, TypeScript cannot infer the tuple type required by the target interface.
|
6362
6631
|
)
|
6363
6632
|
};
|
6364
6633
|
}
|