@opencrvs/toolkit 1.8.0-rc.ffe24c3 → 1.8.1-rc.008155b

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.
Files changed (35) hide show
  1. package/dist/commons/api/router.d.ts +1791 -14926
  2. package/dist/commons/conditionals/conditionals.d.ts +0 -12
  3. package/dist/commons/conditionals/validate.d.ts +5 -0
  4. package/dist/commons/events/ActionConfig.d.ts +37041 -35133
  5. package/dist/commons/events/ActionDocument.d.ts +3742 -1637
  6. package/dist/commons/events/ActionInput.d.ts +2342 -1380
  7. package/dist/commons/events/ActionType.d.ts +7 -4
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +153 -86
  9. package/dist/commons/events/CompositeFieldValue.d.ts +15 -15
  10. package/dist/commons/events/CountryConfigQueryInput.d.ts +1174 -772
  11. package/dist/commons/events/Draft.d.ts +190 -118
  12. package/dist/commons/events/EventConfig.d.ts +20268 -22409
  13. package/dist/commons/events/EventDocument.d.ts +1714 -1021
  14. package/dist/commons/events/EventIndex.d.ts +523 -182
  15. package/dist/commons/events/EventMetadata.d.ts +9 -7
  16. package/dist/commons/events/FieldConfig.d.ts +1527 -455
  17. package/dist/commons/events/FieldType.d.ts +3 -1
  18. package/dist/commons/events/FieldTypeMapping.d.ts +80 -41
  19. package/dist/commons/events/FieldValue.d.ts +58 -28
  20. package/dist/commons/events/FormConfig.d.ts +9263 -2657
  21. package/dist/commons/events/PageConfig.d.ts +3642 -2028
  22. package/dist/commons/events/SummaryConfig.d.ts +10 -10
  23. package/dist/commons/events/User.d.ts +6 -3
  24. package/dist/commons/events/WorkqueueConfig.d.ts +2290 -1350
  25. package/dist/commons/events/defineConfig.d.ts +2761 -3252
  26. package/dist/commons/events/event.d.ts +19 -19
  27. package/dist/commons/events/field.d.ts +27 -1
  28. package/dist/commons/events/scopes.d.ts +2 -1
  29. package/dist/commons/events/test.utils.d.ts +62 -34
  30. package/dist/commons/events/utils.d.ts +8851 -6797
  31. package/dist/conditionals/index.js +25 -55
  32. package/dist/events/index.js +1657 -1377
  33. package/dist/scopes/index.d.ts +92 -6
  34. package/dist/scopes/index.js +38 -9
  35. package/package.json +3 -3
@@ -40,6 +40,7 @@ __export(events_exports, {
40
40
  ActionConfigBase: () => ActionConfigBase,
41
41
  ActionCreationMetadata: () => ActionCreationMetadata,
42
42
  ActionDocument: () => ActionDocument,
43
+ ActionFlag: () => ActionFlag,
43
44
  ActionFormConfig: () => ActionFormConfig,
44
45
  ActionInput: () => ActionInput,
45
46
  ActionStatus: () => ActionStatus,
@@ -95,6 +96,7 @@ __export(events_exports, {
95
96
  EventDocument: () => EventDocument,
96
97
  EventFieldConfigSchema: () => EventFieldConfigSchema,
97
98
  EventFieldId: () => EventFieldId,
99
+ EventFieldIdInput: () => EventFieldIdInput,
98
100
  EventIndex: () => EventIndex,
99
101
  EventInput: () => EventInput,
100
102
  EventMetadata: () => EventMetadata,
@@ -106,6 +108,8 @@ __export(events_exports, {
106
108
  Exact: () => Exact,
107
109
  ExactDate: () => ExactDate,
108
110
  ExactStatus: () => ExactStatus,
111
+ ExactUserType: () => ExactUserType,
112
+ ExclusiveActions: () => ExclusiveActions,
109
113
  FieldConditional: () => FieldConditional,
110
114
  FieldConfig: () => FieldConfig,
111
115
  FieldConfigSchema: () => FieldConfigSchema,
@@ -127,6 +131,7 @@ __export(events_exports, {
127
131
  InherentFlags: () => InherentFlags,
128
132
  LanguageConfig: () => LanguageConfig,
129
133
  LegalStatuses: () => LegalStatuses,
134
+ METADATA_FIELD_PREFIX: () => METADATA_FIELD_PREFIX,
130
135
  MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
131
136
  MimeType: () => MimeType,
132
137
  NameFieldUpdateValue: () => NameFieldUpdateValue,
@@ -137,11 +142,11 @@ __export(events_exports, {
137
142
  PageConfig: () => PageConfig,
138
143
  PageTypes: () => PageTypes,
139
144
  PrintCertificateActionInput: () => PrintCertificateActionInput,
145
+ PrintContent: () => PrintContent,
140
146
  QueryExpression: () => QueryExpression,
141
147
  QueryInput: () => QueryInput,
142
148
  QueryType: () => QueryType,
143
149
  Range: () => Range,
144
- RangeDate: () => RangeDate,
145
150
  ReadActionInput: () => ReadActionInput,
146
151
  RegisterAction: () => RegisterAction,
147
152
  RegisterActionInput: () => RegisterActionInput,
@@ -155,14 +160,19 @@ __export(events_exports, {
155
160
  RuralAddressValue: () => RuralAddressValue,
156
161
  SearchField: () => SearchField,
157
162
  SearchQueryParams: () => SearchQueryParams,
163
+ SearchScopeAccessLevels: () => SearchScopeAccessLevels,
164
+ SelectDateRangeField: () => SelectDateRangeField,
165
+ SelectDateRangeOption: () => SelectDateRangeOption,
166
+ SelectDateRangeValue: () => SelectDateRangeValue,
158
167
  SelectOption: () => SelectOption,
159
168
  ShowConditional: () => ShowConditional,
160
169
  SignatureFieldValue: () => SignatureFieldValue,
161
- StatusChangingActions: () => StatusChangingActions,
162
170
  SummaryConfig: () => SummaryConfig,
163
171
  TENNIS_CLUB_MEMBERSHIP: () => TENNIS_CLUB_MEMBERSHIP,
172
+ TEST_SYSTEM_IANA_TIMEZONE: () => TEST_SYSTEM_IANA_TIMEZONE,
164
173
  TestUserRole: () => TestUserRole,
165
174
  TextValue: () => TextValue,
175
+ TimeValue: () => TimeValue,
166
176
  TranslationConfig: () => TranslationConfig,
167
177
  UnassignActionInput: () => UnassignActionInput,
168
178
  UrbanAddressUpdateValue: () => UrbanAddressUpdateValue,
@@ -188,11 +198,11 @@ __export(events_exports, {
188
198
  alwaysTrue: () => alwaysTrue,
189
199
  and: () => and,
190
200
  annotationActions: () => annotationActions,
201
+ applyDeclarationToEventIndex: () => applyDeclarationToEventIndex,
191
202
  applyDraftsToEventIndex: () => applyDraftsToEventIndex,
192
203
  areConditionsMet: () => areConditionsMet,
193
204
  compositeFieldTypes: () => compositeFieldTypes,
194
205
  createEmptyDraft: () => createEmptyDraft,
195
- createEventConditionals: () => createEventConditionals,
196
206
  createFieldConditionals: () => createFieldConditionals,
197
207
  createPrng: () => createPrng,
198
208
  createValidationSchema: () => createValidationSchema,
@@ -243,6 +253,7 @@ __export(events_exports, {
243
253
  getAnnotationFromDrafts: () => getAnnotationFromDrafts,
244
254
  getAssignedUserFromActions: () => getAssignedUserFromActions,
245
255
  getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
256
+ getAvailableActionsForEvent: () => getAvailableActionsForEvent,
246
257
  getCurrentEventState: () => getCurrentEventState,
247
258
  getCurrentEventStateWithDrafts: () => getCurrentEventStateWithDrafts,
248
259
  getDeclaration: () => getDeclaration,
@@ -251,6 +262,7 @@ __export(events_exports, {
251
262
  getDeclarationPages: () => getDeclarationPages,
252
263
  getEventConfigById: () => getEventConfigById,
253
264
  getMixedPath: () => getMixedPath,
265
+ getPrintCertificatePages: () => getPrintCertificatePages,
254
266
  getRandomDate: () => getRandomDate,
255
267
  getRandomDatetime: () => getRandomDatetime,
256
268
  getStatusFromActions: () => getStatusFromActions,
@@ -289,11 +301,13 @@ __export(events_exports, {
289
301
  isParagraphFieldType: () => isParagraphFieldType,
290
302
  isPhoneFieldType: () => isPhoneFieldType,
291
303
  isRadioGroupFieldType: () => isRadioGroupFieldType,
304
+ isSelectDateRangeFieldType: () => isSelectDateRangeFieldType,
292
305
  isSelectFieldType: () => isSelectFieldType,
293
306
  isSignatureFieldType: () => isSignatureFieldType,
294
307
  isTemplateVariable: () => isTemplateVariable,
295
308
  isTextAreaFieldType: () => isTextAreaFieldType,
296
309
  isTextFieldType: () => isTextFieldType,
310
+ isTimeFieldType: () => isTimeFieldType,
297
311
  isUndeclaredDraft: () => isUndeclaredDraft,
298
312
  isVerificationPage: () => isVerificationPage,
299
313
  isWriteAction: () => isWriteAction,
@@ -307,7 +321,9 @@ __export(events_exports, {
307
321
  omitHiddenFields: () => omitHiddenFields,
308
322
  omitHiddenPaginatedFields: () => omitHiddenPaginatedFields,
309
323
  or: () => or,
324
+ resolveDateOfEvent: () => resolveDateOfEvent,
310
325
  runFieldValidations: () => runFieldValidations,
326
+ timePeriodToDateRange: () => timePeriodToDateRange,
311
327
  user: () => user,
312
328
  validate: () => validate,
313
329
  validateFieldInput: () => validateFieldInput,
@@ -321,7 +337,7 @@ var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
321
337
  var BIRTH_EVENT = "v2-birth";
322
338
 
323
339
  // ../commons/src/events/ActionConfig.ts
324
- var import_zod9 = require("zod");
340
+ var import_zod10 = require("zod");
325
341
 
326
342
  // ../commons/src/events/Conditional.ts
327
343
  var import_zod = require("zod");
@@ -372,12 +388,6 @@ var FieldConditional = import_zod.z.discriminatedUnion("type", [
372
388
  ref: "FieldConditional"
373
389
  });
374
390
 
375
- // ../commons/src/events/PageConfig.ts
376
- var import_zod6 = require("zod");
377
-
378
- // ../commons/src/events/FieldConfig.ts
379
- var import_zod5 = require("zod");
380
-
381
391
  // ../commons/src/events/TranslationConfig.ts
382
392
  var import_zod2 = require("zod");
383
393
  var import_zod_openapi2 = require("zod-openapi");
@@ -395,6 +405,110 @@ var TranslationConfig = import_zod2.z.object({
395
405
  ref: "TranslationConfig"
396
406
  });
397
407
 
408
+ // ../commons/src/events/ActionType.ts
409
+ var import_zod3 = require("zod");
410
+ var ActionType = {
411
+ // Pre-declaration actions
412
+ DELETE: "DELETE",
413
+ CREATE: "CREATE",
414
+ NOTIFY: "NOTIFY",
415
+ // Declaration actions
416
+ DECLARE: "DECLARE",
417
+ VALIDATE: "VALIDATE",
418
+ REGISTER: "REGISTER",
419
+ // Declaration system actions. Non-configurable.
420
+ DETECT_DUPLICATE: "DETECT_DUPLICATE",
421
+ REJECT: "REJECT",
422
+ // REJECT_DECLARATION
423
+ MARKED_AS_DUPLICATE: "MARKED_AS_DUPLICATE",
424
+ // MARK_AS_DUPLICATE
425
+ ARCHIVE: "ARCHIVE",
426
+ // Record actions
427
+ PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
428
+ REQUEST_CORRECTION: "REQUEST_CORRECTION",
429
+ REJECT_CORRECTION: "REJECT_CORRECTION",
430
+ APPROVE_CORRECTION: "APPROVE_CORRECTION",
431
+ // General actions
432
+ READ: "READ",
433
+ ASSIGN: "ASSIGN",
434
+ UNASSIGN: "UNASSIGN"
435
+ };
436
+ var ConfirmableActions = [
437
+ ActionType.NOTIFY,
438
+ ActionType.DECLARE,
439
+ ActionType.VALIDATE,
440
+ ActionType.REGISTER,
441
+ ActionType.REJECT,
442
+ ActionType.ARCHIVE,
443
+ ActionType.PRINT_CERTIFICATE,
444
+ ActionType.REQUEST_CORRECTION,
445
+ ActionType.APPROVE_CORRECTION,
446
+ ActionType.REJECT_CORRECTION
447
+ ];
448
+ var ActionTypes = import_zod3.z.enum([
449
+ "DELETE",
450
+ "CREATE",
451
+ "NOTIFY",
452
+ "DECLARE",
453
+ "VALIDATE",
454
+ "REGISTER",
455
+ "DETECT_DUPLICATE",
456
+ "REJECT",
457
+ "MARKED_AS_DUPLICATE",
458
+ "ARCHIVE",
459
+ "PRINT_CERTIFICATE",
460
+ "REQUEST_CORRECTION",
461
+ "REJECT_CORRECTION",
462
+ "APPROVE_CORRECTION",
463
+ "READ",
464
+ "ASSIGN",
465
+ "UNASSIGN"
466
+ ]);
467
+ var ExclusiveActions = {
468
+ REVIEW_CORRECTION_REQUEST: "REVIEW_CORRECTION_REQUEST"
469
+ };
470
+ var declarationActionValues = [
471
+ ActionTypes.enum.DECLARE,
472
+ ActionTypes.enum.VALIDATE,
473
+ ActionTypes.enum.REGISTER
474
+ ];
475
+ var DeclarationActions = ActionTypes.extract(declarationActionValues);
476
+ var declarationUpdateActionValues = [
477
+ ...declarationActionValues,
478
+ ActionTypes.enum.REQUEST_CORRECTION
479
+ ];
480
+ var DeclarationUpdateActions = ActionTypes.extract(
481
+ declarationUpdateActionValues
482
+ );
483
+ var annotationActions = ActionTypes.exclude(declarationActionValues);
484
+ var writeActions = ActionTypes.exclude([
485
+ ActionType.CREATE,
486
+ ActionType.READ,
487
+ ActionType.ASSIGN,
488
+ ActionType.UNASSIGN
489
+ ]);
490
+ var workqueueActions = ActionTypes.exclude([
491
+ ActionType.CREATE,
492
+ ActionType.NOTIFY,
493
+ ActionType.DETECT_DUPLICATE,
494
+ ActionType.REJECT,
495
+ ActionType.MARKED_AS_DUPLICATE,
496
+ ActionType.ARCHIVE,
497
+ ActionType.REJECT_CORRECTION,
498
+ ActionType.APPROVE_CORRECTION
499
+ ]);
500
+ var META_ACTIONS = [
501
+ ActionType.ASSIGN,
502
+ ActionType.UNASSIGN,
503
+ ActionType.READ
504
+ ];
505
+ function isMetaAction(actionType) {
506
+ return META_ACTIONS.includes(actionType);
507
+ }
508
+
509
+ // ../commons/src/events/FieldConfig.ts
510
+ var import_zod7 = require("zod");
511
+
398
512
  // ../commons/src/events/FieldType.ts
399
513
  var FieldType = {
400
514
  NAME: "NAME",
@@ -407,6 +521,10 @@ var FieldType = {
407
521
  EMAIL: "EMAIL",
408
522
  DATE: "DATE",
409
523
  DATE_RANGE: "DATE_RANGE",
524
+ // // Internal use, only for search functionality
525
+ SELECT_DATE_RANGE: "SELECT_DATE_RANGE",
526
+ // Internal use, only for search functionality
527
+ TIME: "TIME",
410
528
  PARAGRAPH: "PARAGRAPH",
411
529
  PAGE_HEADER: "PAGE_HEADER",
412
530
  RADIO_GROUP: "RADIO_GROUP",
@@ -433,10 +551,24 @@ var compositeFieldTypes = [
433
551
  ];
434
552
 
435
553
  // ../commons/src/events/FieldValue.ts
554
+ var import_zod6 = require("zod");
555
+
556
+ // ../commons/src/documents.ts
436
557
  var import_zod4 = require("zod");
558
+ var import_zod_openapi3 = require("zod-openapi");
559
+ (0, import_zod_openapi3.extendZodWithOpenApi)(import_zod4.z);
560
+ var FullDocumentUrl = import_zod4.z.string().brand("FullDocumentUrl").describe(
561
+ "A full url with protocol, host, bucket name, starting from the root of the S3 server, https://minio/bucket-name/document-id.jpg"
562
+ );
563
+ var FullDocumentPath = import_zod4.z.string().transform((val) => val.startsWith("/") ? val : `/${val}`).openapi({ effectType: "input", type: "string" }).describe(
564
+ "A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
565
+ );
566
+ var DocumentPath = import_zod4.z.string().brand("DocumentPath").describe(
567
+ "A full identifier starting from the root of the S3 bucket, e.g. /document-id.jpg or /directory/document-id.jpg but never /bucket-name/document-id.jpg"
568
+ );
437
569
 
438
570
  // ../commons/src/events/CompositeFieldValue.ts
439
- var import_zod3 = require("zod");
571
+ var import_zod5 = require("zod");
440
572
  var GeographicalArea = {
441
573
  URBAN: "URBAN",
442
574
  RURAL: "RURAL"
@@ -445,101 +577,115 @@ var AddressType = {
445
577
  DOMESTIC: "DOMESTIC",
446
578
  INTERNATIONAL: "INTERNATIONAL"
447
579
  };
448
- var FileFieldValue = import_zod3.z.object({
449
- filename: import_zod3.z.string(),
450
- originalFilename: import_zod3.z.string(),
451
- type: import_zod3.z.string()
580
+ var FileFieldValue = import_zod5.z.object({
581
+ path: FullDocumentPath,
582
+ originalFilename: import_zod5.z.string(),
583
+ type: import_zod5.z.string()
452
584
  });
453
- var AdminStructure = import_zod3.z.object({
454
- country: import_zod3.z.string(),
455
- addressType: import_zod3.z.literal(AddressType.DOMESTIC),
456
- province: import_zod3.z.string(),
457
- district: import_zod3.z.string()
585
+ var AdminStructure = import_zod5.z.object({
586
+ country: import_zod5.z.string(),
587
+ addressType: import_zod5.z.literal(AddressType.DOMESTIC),
588
+ province: import_zod5.z.string(),
589
+ district: import_zod5.z.string()
458
590
  });
459
591
  var UrbanAddressValue = AdminStructure.extend({
460
- urbanOrRural: import_zod3.z.literal(GeographicalArea.URBAN),
461
- town: import_zod3.z.string().optional(),
462
- residentialArea: import_zod3.z.string().optional(),
463
- street: import_zod3.z.string().optional(),
464
- number: import_zod3.z.string().optional(),
465
- zipCode: import_zod3.z.string().optional()
592
+ urbanOrRural: import_zod5.z.literal(GeographicalArea.URBAN),
593
+ town: import_zod5.z.string().optional(),
594
+ residentialArea: import_zod5.z.string().optional(),
595
+ street: import_zod5.z.string().optional(),
596
+ number: import_zod5.z.string().optional(),
597
+ zipCode: import_zod5.z.string().optional()
466
598
  });
467
599
  var RuralAddressValue = AdminStructure.extend({
468
- urbanOrRural: import_zod3.z.literal(GeographicalArea.RURAL),
469
- village: import_zod3.z.string().optional()
600
+ urbanOrRural: import_zod5.z.literal(GeographicalArea.RURAL),
601
+ village: import_zod5.z.string().optional()
470
602
  });
471
603
  var UrbanAddressUpdateValue = AdminStructure.extend({
472
- urbanOrRural: import_zod3.z.literal(GeographicalArea.URBAN),
473
- town: import_zod3.z.string().nullish(),
474
- residentialArea: import_zod3.z.string().nullish(),
475
- street: import_zod3.z.string().nullish(),
476
- number: import_zod3.z.string().nullish(),
477
- zipCode: import_zod3.z.string().nullish()
604
+ urbanOrRural: import_zod5.z.literal(GeographicalArea.URBAN),
605
+ town: import_zod5.z.string().nullish(),
606
+ residentialArea: import_zod5.z.string().nullish(),
607
+ street: import_zod5.z.string().nullish(),
608
+ number: import_zod5.z.string().nullish(),
609
+ zipCode: import_zod5.z.string().nullish()
478
610
  });
479
- var NameFieldValue = import_zod3.z.object({
480
- firstname: import_zod3.z.string(),
481
- surname: import_zod3.z.string(),
482
- middlename: import_zod3.z.string().optional()
611
+ var NameFieldValue = import_zod5.z.object({
612
+ firstname: import_zod5.z.string().min(1),
613
+ surname: import_zod5.z.string().min(1),
614
+ middlename: import_zod5.z.string().optional()
483
615
  });
484
- var NameFieldUpdateValue = import_zod3.z.object({
485
- firstname: import_zod3.z.string(),
486
- surname: import_zod3.z.string(),
487
- middlename: import_zod3.z.string().nullish()
488
- }).or(import_zod3.z.null()).or(import_zod3.z.undefined());
616
+ var NameFieldUpdateValue = import_zod5.z.object({
617
+ firstname: import_zod5.z.string().nullish(),
618
+ surname: import_zod5.z.string().nullish(),
619
+ middlename: import_zod5.z.string().nullish()
620
+ }).or(import_zod5.z.null()).or(import_zod5.z.undefined());
489
621
  var RuralAddressUpdateValue = AdminStructure.extend({
490
- urbanOrRural: import_zod3.z.literal(GeographicalArea.RURAL),
491
- village: import_zod3.z.string().nullish()
622
+ urbanOrRural: import_zod5.z.literal(GeographicalArea.RURAL),
623
+ village: import_zod5.z.string().nullish()
492
624
  });
493
- var GenericAddressValue = import_zod3.z.object({
494
- country: import_zod3.z.string(),
495
- addressType: import_zod3.z.literal(AddressType.INTERNATIONAL),
496
- state: import_zod3.z.string(),
497
- district2: import_zod3.z.string(),
498
- cityOrTown: import_zod3.z.string().optional(),
499
- addressLine1: import_zod3.z.string().optional(),
500
- addressLine2: import_zod3.z.string().optional(),
501
- addressLine3: import_zod3.z.string().optional(),
502
- postcodeOrZip: import_zod3.z.string().optional()
625
+ var GenericAddressValue = import_zod5.z.object({
626
+ country: import_zod5.z.string(),
627
+ addressType: import_zod5.z.literal(AddressType.INTERNATIONAL),
628
+ state: import_zod5.z.string(),
629
+ district2: import_zod5.z.string(),
630
+ cityOrTown: import_zod5.z.string().optional(),
631
+ addressLine1: import_zod5.z.string().optional(),
632
+ addressLine2: import_zod5.z.string().optional(),
633
+ addressLine3: import_zod5.z.string().optional(),
634
+ postcodeOrZip: import_zod5.z.string().optional()
503
635
  });
504
- var AddressFieldValue = import_zod3.z.discriminatedUnion("urbanOrRural", [UrbanAddressValue, RuralAddressValue]).or(GenericAddressValue);
505
- var GenericAddressUpdateValue = import_zod3.z.object({
506
- country: import_zod3.z.string(),
507
- addressType: import_zod3.z.literal(AddressType.INTERNATIONAL),
508
- state: import_zod3.z.string(),
509
- district2: import_zod3.z.string(),
510
- cityOrTown: import_zod3.z.string().nullish(),
511
- addressLine1: import_zod3.z.string().nullish(),
512
- addressLine2: import_zod3.z.string().nullish(),
513
- addressLine3: import_zod3.z.string().nullish(),
514
- postcodeOrZip: import_zod3.z.string().nullish()
636
+ var AddressFieldValue = import_zod5.z.discriminatedUnion("urbanOrRural", [UrbanAddressValue, RuralAddressValue]).or(GenericAddressValue);
637
+ var GenericAddressUpdateValue = import_zod5.z.object({
638
+ country: import_zod5.z.string(),
639
+ addressType: import_zod5.z.literal(AddressType.INTERNATIONAL),
640
+ state: import_zod5.z.string(),
641
+ district2: import_zod5.z.string(),
642
+ cityOrTown: import_zod5.z.string().nullish(),
643
+ addressLine1: import_zod5.z.string().nullish(),
644
+ addressLine2: import_zod5.z.string().nullish(),
645
+ addressLine3: import_zod5.z.string().nullish(),
646
+ postcodeOrZip: import_zod5.z.string().nullish()
515
647
  });
516
- var AddressFieldUpdateValue = import_zod3.z.discriminatedUnion("urbanOrRural", [
648
+ var AddressFieldUpdateValue = import_zod5.z.discriminatedUnion("urbanOrRural", [
517
649
  UrbanAddressUpdateValue,
518
650
  RuralAddressUpdateValue
519
651
  ]).or(GenericAddressUpdateValue);
520
- var FileFieldValueWithOption = import_zod3.z.object({
521
- filename: import_zod3.z.string(),
522
- originalFilename: import_zod3.z.string(),
523
- type: import_zod3.z.string(),
524
- option: import_zod3.z.string()
652
+ var FileFieldValueWithOption = import_zod5.z.object({
653
+ path: FullDocumentPath,
654
+ originalFilename: import_zod5.z.string(),
655
+ type: import_zod5.z.string(),
656
+ option: import_zod5.z.string()
525
657
  });
526
- var FileFieldWithOptionValue = import_zod3.z.array(FileFieldValueWithOption);
658
+ var FileFieldWithOptionValue = import_zod5.z.array(FileFieldValueWithOption);
527
659
 
528
660
  // ../commons/src/events/FieldValue.ts
529
- var TextValue = import_zod4.z.string();
661
+ var TextValue = import_zod6.z.string();
530
662
  var NonEmptyTextValue = TextValue.min(1);
531
- var DateValue = import_zod4.z.string().date().describe("Date in the format YYYY-MM-DD");
532
- var DatetimeValue = import_zod4.z.string().datetime();
533
- var DateRangeFieldValue = DateValue.or(import_zod4.z.tuple([DateValue, DateValue]));
534
- var EmailValue = import_zod4.z.string().email();
535
- var CheckboxFieldValue = import_zod4.z.boolean();
536
- var NumberFieldValue = import_zod4.z.number();
537
- var DataFieldValue = import_zod4.z.undefined();
538
- var SignatureFieldValue = import_zod4.z.string();
539
- var FieldValue = import_zod4.z.union([
663
+ var DateValue = import_zod6.z.string().date().describe("Date in the format YYYY-MM-DD");
664
+ var TimeValue = import_zod6.z.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/);
665
+ var DatetimeValue = import_zod6.z.string().datetime();
666
+ var SelectDateRangeValue = import_zod6.z.enum([
667
+ "last7Days",
668
+ "last30Days",
669
+ "last90Days",
670
+ "last365Days"
671
+ ]);
672
+ var DateRangeFieldValue = import_zod6.z.object({
673
+ start: DateValue,
674
+ end: DateValue
675
+ }).or(DateValue).describe(
676
+ "Date range with start and end dates in the format YYYY-MM-DD. Inclusive start, exclusive end."
677
+ );
678
+ var EmailValue = import_zod6.z.string().email();
679
+ var CheckboxFieldValue = import_zod6.z.boolean();
680
+ var NumberFieldValue = import_zod6.z.number();
681
+ var DataFieldValue = import_zod6.z.undefined();
682
+ var SignatureFieldValue = import_zod6.z.string();
683
+ var FieldValue = import_zod6.z.union([
540
684
  TextValue,
541
685
  DateValue,
686
+ TimeValue,
542
687
  DateRangeFieldValue,
688
+ SelectDateRangeValue,
543
689
  CheckboxFieldValue,
544
690
  NumberFieldValue,
545
691
  FileFieldValue,
@@ -551,10 +697,12 @@ var FieldValue = import_zod4.z.union([
551
697
  NameFieldValue,
552
698
  NameFieldUpdateValue
553
699
  ]);
554
- var FieldUpdateValue = import_zod4.z.union([
700
+ var FieldUpdateValue = import_zod6.z.union([
555
701
  TextValue,
556
702
  DateValue,
703
+ TimeValue,
557
704
  DateRangeFieldValue,
705
+ SelectDateRangeValue,
558
706
  CheckboxFieldValue,
559
707
  NumberFieldValue,
560
708
  FileFieldValue,
@@ -567,63 +715,68 @@ var FieldUpdateValue = import_zod4.z.union([
567
715
  ]);
568
716
 
569
717
  // ../commons/src/events/FieldConfig.ts
570
- var import_zod_openapi3 = require("zod-openapi");
571
- (0, import_zod_openapi3.extendZodWithOpenApi)(import_zod5.z);
572
- var FieldId = import_zod5.z.string().describe("Unique identifier for the field");
573
- var FieldReference = import_zod5.z.object({
718
+ var import_zod_openapi4 = require("zod-openapi");
719
+ (0, import_zod_openapi4.extendZodWithOpenApi)(import_zod7.z);
720
+ var FieldId = import_zod7.z.string().describe("Unique identifier for the field");
721
+ var FieldReference = import_zod7.z.object({
574
722
  $$field: FieldId
575
723
  }).describe("Reference to a field by its ID");
576
- var ParentReference = FieldReference.optional();
577
- var ValidationConfig = import_zod5.z.object({
724
+ var ValidationConfig = import_zod7.z.object({
578
725
  validator: Conditional,
579
726
  message: TranslationConfig
580
727
  });
581
- var BaseField = import_zod5.z.object({
728
+ var BaseField = import_zod7.z.object({
582
729
  id: FieldId,
583
- parent: ParentReference,
584
- conditionals: import_zod5.z.array(FieldConditional).default([]).optional(),
585
- required: import_zod5.z.boolean().default(false).optional(),
586
- placeholder: TranslationConfig.optional(),
587
- validation: import_zod5.z.array(ValidationConfig).default([]).optional(),
588
730
  label: TranslationConfig,
731
+ parent: FieldReference.optional().describe(
732
+ "Reference to a parent field. If a field has a parent, it will be reset when the parent field is changed."
733
+ ),
734
+ required: import_zod7.z.boolean().default(false).optional(),
735
+ conditionals: import_zod7.z.array(FieldConditional).default([]).optional(),
736
+ secured: import_zod7.z.boolean().default(false).optional(),
737
+ placeholder: TranslationConfig.optional(),
738
+ validation: import_zod7.z.array(ValidationConfig).default([]).optional(),
589
739
  helperText: TranslationConfig.optional(),
590
- hideLabel: import_zod5.z.boolean().default(false).optional()
740
+ hideLabel: import_zod7.z.boolean().default(false).optional(),
741
+ uncorrectable: import_zod7.z.boolean().default(false).optional().describe(
742
+ "Indicates if the field can be changed during a record correction."
743
+ )
591
744
  });
592
745
  var Divider = BaseField.extend({
593
- type: import_zod5.z.literal(FieldType.DIVIDER)
746
+ type: import_zod7.z.literal(FieldType.DIVIDER)
594
747
  });
595
748
  var TextField = BaseField.extend({
596
- type: import_zod5.z.literal(FieldType.TEXT),
749
+ type: import_zod7.z.literal(FieldType.TEXT),
597
750
  defaultValue: NonEmptyTextValue.optional(),
598
- configuration: import_zod5.z.object({
599
- maxLength: import_zod5.z.number().optional().describe("Maximum length of the text"),
600
- type: import_zod5.z.enum(["text", "password"]).optional(),
751
+ configuration: import_zod7.z.object({
752
+ maxLength: import_zod7.z.number().optional().describe("Maximum length of the text"),
753
+ type: import_zod7.z.enum(["text", "password"]).optional(),
601
754
  prefix: TranslationConfig.optional(),
602
755
  postfix: TranslationConfig.optional()
603
756
  }).default({ type: "text" }).optional()
604
757
  }).describe("Text input");
605
758
  var NumberField = BaseField.extend({
606
- type: import_zod5.z.literal(FieldType.NUMBER),
759
+ type: import_zod7.z.literal(FieldType.NUMBER),
607
760
  defaultValue: NumberFieldValue.optional(),
608
- configuration: import_zod5.z.object({
609
- min: import_zod5.z.number().optional().describe("Minimum value"),
610
- max: import_zod5.z.number().optional().describe("Maximum value"),
761
+ configuration: import_zod7.z.object({
762
+ min: import_zod7.z.number().optional().describe("Minimum value"),
763
+ max: import_zod7.z.number().optional().describe("Maximum value"),
611
764
  prefix: TranslationConfig.optional(),
612
765
  postfix: TranslationConfig.optional()
613
766
  }).optional()
614
767
  }).describe("Number input");
615
768
  var TextAreaField = BaseField.extend({
616
- type: import_zod5.z.literal(FieldType.TEXTAREA),
769
+ type: import_zod7.z.literal(FieldType.TEXTAREA),
617
770
  defaultValue: NonEmptyTextValue.optional(),
618
- configuration: import_zod5.z.object({
619
- maxLength: import_zod5.z.number().optional().describe("Maximum length of the text"),
620
- rows: import_zod5.z.number().optional().describe("Number of visible text lines"),
621
- cols: import_zod5.z.number().optional().describe("Number of visible columns"),
771
+ configuration: import_zod7.z.object({
772
+ maxLength: import_zod7.z.number().optional().describe("Maximum length of the text"),
773
+ rows: import_zod7.z.number().optional().describe("Number of visible text lines"),
774
+ cols: import_zod7.z.number().optional().describe("Number of visible columns"),
622
775
  prefix: TranslationConfig.optional(),
623
776
  postfix: TranslationConfig.optional()
624
777
  }).default({ rows: 4 }).optional()
625
778
  }).describe("Multiline text input");
626
- var ImageMimeType = import_zod5.z.enum([
779
+ var ImageMimeType = import_zod7.z.enum([
627
780
  "image/png",
628
781
  "image/jpg",
629
782
  "image/jpeg",
@@ -632,46 +785,53 @@ var ImageMimeType = import_zod5.z.enum([
632
785
  var MimeType = ImageMimeType;
633
786
  var DEFAULT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;
634
787
  var SignatureField = BaseField.extend({
635
- type: import_zod5.z.literal(FieldType.SIGNATURE),
788
+ type: import_zod7.z.literal(FieldType.SIGNATURE),
636
789
  signaturePromptLabel: TranslationConfig.describe(
637
790
  "Title of the signature modal"
638
791
  ),
639
792
  defaultValue: SignatureFieldValue.optional(),
640
- configuration: import_zod5.z.object({
641
- maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
793
+ configuration: import_zod7.z.object({
794
+ maxFileSize: import_zod7.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
642
795
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
643
796
  }).default({
644
797
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
645
798
  })
646
799
  }).describe("Signature input field");
647
800
  var EmailField = BaseField.extend({
648
- type: import_zod5.z.literal(FieldType.EMAIL),
649
- configuration: import_zod5.z.object({
650
- maxLength: import_zod5.z.number().optional().describe("Maximum length of the text")
801
+ type: import_zod7.z.literal(FieldType.EMAIL),
802
+ configuration: import_zod7.z.object({
803
+ maxLength: import_zod7.z.number().optional().describe("Maximum length of the text")
651
804
  }).default({ maxLength: 10 }).optional(),
652
805
  defaultValue: NonEmptyTextValue.optional()
653
806
  });
654
807
  var DateField = BaseField.extend({
655
- type: import_zod5.z.literal(FieldType.DATE),
808
+ type: import_zod7.z.literal(FieldType.DATE),
656
809
  defaultValue: DateValue.optional(),
657
- configuration: import_zod5.z.object({
810
+ configuration: import_zod7.z.object({
658
811
  notice: TranslationConfig.describe(
659
812
  "Text to display above the date input"
660
813
  ).optional()
661
814
  }).optional()
662
- }).describe("A single date input (dd-mm-YYYY)");
815
+ }).describe("A single date input (yyyy-MM-dd)");
816
+ var TimeField = BaseField.extend({
817
+ type: import_zod7.z.literal(FieldType.TIME),
818
+ defaultValue: TimeValue.optional(),
819
+ configuration: import_zod7.z.object({
820
+ notice: TranslationConfig.describe(
821
+ "Text to display above the time input"
822
+ ).optional()
823
+ }).optional()
824
+ }).describe("A single date input (HH-mm)");
663
825
  var DateRangeField = BaseField.extend({
664
- type: import_zod5.z.literal(FieldType.DATE_RANGE),
826
+ type: import_zod7.z.literal(FieldType.DATE_RANGE),
665
827
  defaultValue: DateRangeFieldValue.optional(),
666
- configuration: import_zod5.z.object({
828
+ configuration: import_zod7.z.object({
667
829
  notice: TranslationConfig.describe(
668
830
  "Text to display above the date input"
669
831
  ).optional()
670
832
  }).optional()
671
- }).describe(
672
- "A date range input ({ rangeStart: dd-mm-YYYY, rangeEnd: dd-mm-YYYY })"
673
- );
674
- var HtmlFontVariant = import_zod5.z.enum([
833
+ }).describe("A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })");
834
+ var HtmlFontVariant = import_zod7.z.enum([
675
835
  "reg12",
676
836
  "reg14",
677
837
  "reg16",
@@ -681,27 +841,31 @@ var HtmlFontVariant = import_zod5.z.enum([
681
841
  "h2",
682
842
  "h1"
683
843
  ]);
844
+ var ParagraphConfiguration = import_zod7.z.object({
845
+ styles: import_zod7.z.object({
846
+ fontVariant: HtmlFontVariant.optional().describe(
847
+ "Font variant to use for the paragraph text"
848
+ ),
849
+ hint: import_zod7.z.boolean().optional().describe("When true, paragraph is styled as a hint with grey color")
850
+ }).optional()
851
+ }).default({});
684
852
  var Paragraph = BaseField.extend({
685
- type: import_zod5.z.literal(FieldType.PARAGRAPH),
853
+ type: import_zod7.z.literal(FieldType.PARAGRAPH),
686
854
  defaultValue: NonEmptyTextValue.optional(),
687
- configuration: import_zod5.z.object({
688
- styles: import_zod5.z.object({
689
- fontVariant: HtmlFontVariant.optional()
690
- }).optional()
691
- }).default({})
855
+ configuration: ParagraphConfiguration
692
856
  }).describe("A read-only HTML <p> paragraph");
693
857
  var PageHeader = BaseField.extend({
694
- type: import_zod5.z.literal(FieldType.PAGE_HEADER),
858
+ type: import_zod7.z.literal(FieldType.PAGE_HEADER),
695
859
  defaultValue: NonEmptyTextValue.optional()
696
860
  }).describe("A read-only header component for form pages");
697
861
  var File = BaseField.extend({
698
- type: import_zod5.z.literal(FieldType.FILE),
862
+ type: import_zod7.z.literal(FieldType.FILE),
699
863
  defaultValue: FileFieldValue.optional(),
700
- configuration: import_zod5.z.object({
701
- maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
864
+ configuration: import_zod7.z.object({
865
+ maxFileSize: import_zod7.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
702
866
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
703
- style: import_zod5.z.object({
704
- width: import_zod5.z.enum(["full", "auto"]).optional().describe(
867
+ style: import_zod7.z.object({
868
+ width: import_zod7.z.enum(["full", "auto"]).optional().describe(
705
869
  "Whether the file upload button should take the full width of the container or not"
706
870
  )
707
871
  }).optional(),
@@ -710,129 +874,148 @@ var File = BaseField.extend({
710
874
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
711
875
  })
712
876
  }).describe("File upload");
713
- var SelectOption = import_zod5.z.object({
714
- value: import_zod5.z.string().describe("The value of the option"),
877
+ var SelectOption = import_zod7.z.object({
878
+ value: import_zod7.z.string().describe("The value of the option"),
715
879
  label: TranslationConfig.describe("The label of the option")
716
880
  });
717
881
  var RadioGroup = BaseField.extend({
718
- type: import_zod5.z.literal(FieldType.RADIO_GROUP),
882
+ type: import_zod7.z.literal(FieldType.RADIO_GROUP),
719
883
  defaultValue: TextValue.optional(),
720
- options: import_zod5.z.array(SelectOption).describe("A list of options"),
721
- configuration: import_zod5.z.object({
722
- styles: import_zod5.z.object({
723
- size: import_zod5.z.enum(["NORMAL", "LARGE"]).optional()
884
+ options: import_zod7.z.array(SelectOption).describe("A list of options"),
885
+ configuration: import_zod7.z.object({
886
+ styles: import_zod7.z.object({
887
+ size: import_zod7.z.enum(["NORMAL", "LARGE"]).optional()
724
888
  }).optional()
725
889
  }).optional()
726
890
  }).describe("Grouped radio options");
727
891
  var BulletList = BaseField.extend({
728
- type: import_zod5.z.literal(FieldType.BULLET_LIST),
892
+ type: import_zod7.z.literal(FieldType.BULLET_LIST),
729
893
  defaultValue: TextValue.optional(),
730
- items: import_zod5.z.array(TranslationConfig).describe("A list of items"),
731
- configuration: import_zod5.z.object({
732
- styles: import_zod5.z.object({
894
+ items: import_zod7.z.array(TranslationConfig).describe("A list of items"),
895
+ configuration: import_zod7.z.object({
896
+ styles: import_zod7.z.object({
733
897
  fontVariant: HtmlFontVariant.optional()
734
898
  }).optional()
735
899
  }).default({})
736
900
  }).describe("A list of bullet points");
737
901
  var Select = BaseField.extend({
738
- type: import_zod5.z.literal(FieldType.SELECT),
902
+ type: import_zod7.z.literal(FieldType.SELECT),
739
903
  defaultValue: TextValue.optional(),
740
- options: import_zod5.z.array(SelectOption).describe("A list of options")
904
+ options: import_zod7.z.array(SelectOption).describe("A list of options")
741
905
  }).describe("Select input");
906
+ var SelectDateRangeOption = import_zod7.z.object({
907
+ value: SelectDateRangeValue.describe("The value of the option"),
908
+ label: TranslationConfig.describe("The label of the option")
909
+ });
910
+ var SelectDateRangeField = BaseField.extend({
911
+ type: import_zod7.z.literal(FieldType.SELECT_DATE_RANGE),
912
+ defaultValue: SelectDateRangeValue.optional(),
913
+ options: import_zod7.z.array(SelectDateRangeOption).describe("A list of options")
914
+ }).describe("Select input with date range options");
742
915
  var NameField = BaseField.extend({
743
- type: import_zod5.z.literal(FieldType.NAME),
744
- defaultValue: import_zod5.z.object({
916
+ type: import_zod7.z.literal(FieldType.NAME),
917
+ defaultValue: import_zod7.z.object({
745
918
  firstname: NonEmptyTextValue,
746
919
  surname: NonEmptyTextValue
747
920
  }).optional(),
748
- configuration: import_zod5.z.object({
749
- maxLength: import_zod5.z.number().optional().describe("Maximum length of the text"),
921
+ configuration: import_zod7.z.object({
922
+ maxLength: import_zod7.z.number().optional().describe("Maximum length of the text"),
750
923
  prefix: TranslationConfig.optional(),
751
- postfix: TranslationConfig.optional()
924
+ postfix: TranslationConfig.optional(),
925
+ includeMiddlename: import_zod7.z.boolean().default(false).optional().describe("To make middle name visible in Name form field"),
926
+ searchMode: import_zod7.z.boolean().optional()
752
927
  }).optional()
753
928
  }).describe("Name input field");
754
929
  var PhoneField = BaseField.extend({
755
930
  defaultValue: NonEmptyTextValue.optional(),
756
- type: import_zod5.z.literal(FieldType.PHONE)
931
+ type: import_zod7.z.literal(FieldType.PHONE)
757
932
  }).describe("Phone input field");
758
933
  var IdField = BaseField.extend({
759
934
  defaultValue: NonEmptyTextValue.optional(),
760
- type: import_zod5.z.literal(FieldType.ID)
935
+ type: import_zod7.z.literal(FieldType.ID)
761
936
  }).describe("ID input field");
762
937
  var Checkbox = BaseField.extend({
763
- type: import_zod5.z.literal(FieldType.CHECKBOX),
938
+ type: import_zod7.z.literal(FieldType.CHECKBOX),
764
939
  defaultValue: CheckboxFieldValue.optional()
765
940
  }).describe("Boolean checkbox field");
766
941
  var Country = BaseField.extend({
767
- type: import_zod5.z.literal(FieldType.COUNTRY),
942
+ type: import_zod7.z.literal(FieldType.COUNTRY),
768
943
  defaultValue: NonEmptyTextValue.optional()
769
944
  }).describe("Country select field");
770
- var AdministrativeAreas = import_zod5.z.enum([
945
+ var AdministrativeAreas = import_zod7.z.enum([
771
946
  "ADMIN_STRUCTURE",
772
947
  "HEALTH_FACILITY",
773
948
  "CRVS_OFFICE"
774
949
  ]);
775
- var AdministrativeAreaConfiguration = import_zod5.z.object({
776
- partOf: import_zod5.z.object({
777
- $declaration: import_zod5.z.string()
950
+ var AdministrativeAreaConfiguration = import_zod7.z.object({
951
+ partOf: import_zod7.z.object({
952
+ $declaration: import_zod7.z.string()
778
953
  }).optional().describe("Parent location"),
779
954
  type: AdministrativeAreas
780
955
  }).describe("Administrative area options");
781
956
  var AdministrativeArea = BaseField.extend({
782
- type: import_zod5.z.literal(FieldType.ADMINISTRATIVE_AREA),
957
+ type: import_zod7.z.literal(FieldType.ADMINISTRATIVE_AREA),
783
958
  defaultValue: NonEmptyTextValue.optional(),
784
959
  configuration: AdministrativeAreaConfiguration
785
960
  }).describe("Administrative area input field e.g. facility, office");
786
961
  var Location = BaseField.extend({
787
- type: import_zod5.z.literal(FieldType.LOCATION),
788
- defaultValue: NonEmptyTextValue.optional()
962
+ type: import_zod7.z.literal(FieldType.LOCATION),
963
+ defaultValue: NonEmptyTextValue.optional(),
964
+ configuration: import_zod7.z.object({
965
+ searchableResource: import_zod7.z.array(import_zod7.z.enum(["locations", "facilities", "offices"])).optional()
966
+ }).optional()
789
967
  }).describe("Input field for a location");
790
968
  var FileUploadWithOptions = BaseField.extend({
791
- type: import_zod5.z.literal(FieldType.FILE_WITH_OPTIONS),
792
- options: import_zod5.z.array(SelectOption).describe("A list of options"),
969
+ type: import_zod7.z.literal(FieldType.FILE_WITH_OPTIONS),
970
+ options: import_zod7.z.array(SelectOption).describe("A list of options"),
793
971
  defaultValue: FileFieldWithOptionValue.optional(),
794
- configuration: import_zod5.z.object({
795
- maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
972
+ configuration: import_zod7.z.object({
973
+ maxFileSize: import_zod7.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
796
974
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
797
975
  }).default({
798
976
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
799
977
  })
800
978
  });
801
979
  var Facility = BaseField.extend({
802
- type: import_zod5.z.literal(FieldType.FACILITY),
980
+ type: import_zod7.z.literal(FieldType.FACILITY),
803
981
  defaultValue: NonEmptyTextValue.optional()
804
982
  }).describe("Input field for a facility");
805
983
  var Office = BaseField.extend({
806
- type: import_zod5.z.literal(FieldType.OFFICE),
984
+ type: import_zod7.z.literal(FieldType.OFFICE),
807
985
  defaultValue: NonEmptyTextValue.optional()
808
986
  }).describe("Input field for an office");
809
987
  var Address = BaseField.extend({
810
- type: import_zod5.z.literal(FieldType.ADDRESS),
811
- defaultValue: AddressFieldValue.optional()
988
+ type: import_zod7.z.literal(FieldType.ADDRESS),
989
+ defaultValue: AddressFieldValue.optional(),
990
+ configuration: import_zod7.z.object({
991
+ searchMode: import_zod7.z.boolean().optional()
992
+ }).optional()
812
993
  }).describe("Address input field \u2013 a combination of location and text fields");
813
- var DataEntry = import_zod5.z.union([
814
- import_zod5.z.object({
994
+ var DataEntry = import_zod7.z.union([
995
+ import_zod7.z.object({
815
996
  label: TranslationConfig,
816
- value: TranslationConfig.or(import_zod5.z.string())
997
+ value: TranslationConfig.or(import_zod7.z.string())
817
998
  }),
818
- import_zod5.z.object({
819
- fieldId: import_zod5.z.string()
999
+ import_zod7.z.object({
1000
+ fieldId: import_zod7.z.string()
820
1001
  })
821
1002
  ]);
822
1003
  var DataField = BaseField.extend({
823
- type: import_zod5.z.literal(FieldType.DATA),
824
- configuration: import_zod5.z.object({
1004
+ type: import_zod7.z.literal(FieldType.DATA),
1005
+ configuration: import_zod7.z.object({
825
1006
  subtitle: TranslationConfig.optional(),
826
- data: import_zod5.z.array(DataEntry)
1007
+ data: import_zod7.z.array(DataEntry)
827
1008
  })
828
1009
  }).describe("Data field for displaying read-only data");
829
- var FieldConfig = import_zod5.z.discriminatedUnion("type", [
1010
+ var FieldConfig = import_zod7.z.discriminatedUnion("type", [
830
1011
  Address,
831
1012
  TextField,
832
1013
  NumberField,
833
1014
  TextAreaField,
834
1015
  DateField,
1016
+ TimeField,
835
1017
  DateRangeField,
1018
+ SelectDateRangeField,
836
1019
  Paragraph,
837
1020
  RadioGroup,
838
1021
  BulletList,
@@ -858,14 +1041,18 @@ var FieldConfig = import_zod5.z.discriminatedUnion("type", [
858
1041
  ref: "FieldConfig"
859
1042
  });
860
1043
 
1044
+ // ../commons/src/events/FormConfig.ts
1045
+ var import_zod9 = require("zod");
1046
+
861
1047
  // ../commons/src/events/PageConfig.ts
862
- var import_zod_openapi4 = require("zod-openapi");
863
- (0, import_zod_openapi4.extendZodWithOpenApi)(import_zod6.z);
864
- var PageTypes = import_zod6.z.enum(["FORM", "VERIFICATION"]);
865
- var PageConfigBase = import_zod6.z.object({
866
- id: import_zod6.z.string().describe("Unique identifier for the page"),
1048
+ var import_zod8 = require("zod");
1049
+ var import_zod_openapi5 = require("zod-openapi");
1050
+ (0, import_zod_openapi5.extendZodWithOpenApi)(import_zod8.z);
1051
+ var PageTypes = import_zod8.z.enum(["FORM", "VERIFICATION"]);
1052
+ var PageConfigBase = import_zod8.z.object({
1053
+ id: import_zod8.z.string().describe("Unique identifier for the page"),
867
1054
  title: TranslationConfig.describe("Header title of the page"),
868
- fields: import_zod6.z.array(FieldConfig).describe("Fields to be rendered on the page"),
1055
+ fields: import_zod8.z.array(FieldConfig).describe("Fields to be rendered on the page"),
869
1056
  conditional: Conditional.optional().describe(
870
1057
  "Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
871
1058
  )
@@ -874,13 +1061,13 @@ var PageConfigBase = import_zod6.z.object({
874
1061
  ref: "FormPageConfig"
875
1062
  });
876
1063
  var FormPageConfig = PageConfigBase.extend({
877
- type: import_zod6.z.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
1064
+ type: import_zod8.z.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
878
1065
  });
879
- var VerificationActionConfig = import_zod6.z.object({
880
- verify: import_zod6.z.object({ label: TranslationConfig }),
881
- cancel: import_zod6.z.object({
1066
+ var VerificationActionConfig = import_zod8.z.object({
1067
+ verify: import_zod8.z.object({ label: TranslationConfig }),
1068
+ cancel: import_zod8.z.object({
882
1069
  label: TranslationConfig,
883
- confirmation: import_zod6.z.object({
1070
+ confirmation: import_zod8.z.object({
884
1071
  title: TranslationConfig,
885
1072
  body: TranslationConfig
886
1073
  })
@@ -890,218 +1077,110 @@ var VerificationActionConfig = import_zod6.z.object({
890
1077
  ref: "VerificationActionConfig"
891
1078
  });
892
1079
  var VerificationPageConfig = FormPageConfig.extend({
893
- type: import_zod6.z.literal(PageTypes.enum.VERIFICATION),
1080
+ type: import_zod8.z.literal(PageTypes.enum.VERIFICATION),
894
1081
  actions: VerificationActionConfig
895
1082
  });
896
- var PageConfig = import_zod6.z.discriminatedUnion("type", [
1083
+ var PageConfig = import_zod8.z.discriminatedUnion("type", [
897
1084
  FormPageConfig,
898
1085
  VerificationPageConfig
899
1086
  ]);
900
1087
 
901
- // ../commons/src/events/ActionType.ts
902
- var import_zod7 = require("zod");
903
- var ActionType = {
904
- // Pre-declaration actions
905
- DELETE: "DELETE",
906
- CREATE: "CREATE",
907
- NOTIFY: "NOTIFY",
908
- // Declaration actions
909
- DECLARE: "DECLARE",
910
- VALIDATE: "VALIDATE",
911
- REGISTER: "REGISTER",
912
- // Declaration system actions. Non-configurable.
913
- DETECT_DUPLICATE: "DETECT_DUPLICATE",
914
- REJECT: "REJECT",
915
- // REJECT_DECLARATION
916
- MARKED_AS_DUPLICATE: "MARKED_AS_DUPLICATE",
917
- // MARK_AS_DUPLICATE
918
- ARCHIVE: "ARCHIVE",
919
- // Record actions
920
- PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
921
- REQUEST_CORRECTION: "REQUEST_CORRECTION",
922
- REJECT_CORRECTION: "REJECT_CORRECTION",
923
- APPROVE_CORRECTION: "APPROVE_CORRECTION",
924
- // General actions
925
- READ: "READ",
926
- ASSIGN: "ASSIGN",
927
- UNASSIGN: "UNASSIGN"
928
- };
929
- var ConfirmableActions = [
930
- ActionType.NOTIFY,
931
- ActionType.DECLARE,
932
- ActionType.VALIDATE,
933
- ActionType.REGISTER,
934
- ActionType.REJECT,
935
- ActionType.ARCHIVE,
936
- ActionType.PRINT_CERTIFICATE
937
- ];
938
- var ActionTypes = import_zod7.z.enum([
939
- "DELETE",
940
- "CREATE",
941
- "NOTIFY",
942
- "DECLARE",
943
- "VALIDATE",
944
- "REGISTER",
945
- "DETECT_DUPLICATE",
946
- "REJECT",
947
- "MARKED_AS_DUPLICATE",
948
- "ARCHIVE",
949
- "PRINT_CERTIFICATE",
950
- "REQUEST_CORRECTION",
951
- "REJECT_CORRECTION",
952
- "APPROVE_CORRECTION",
953
- "READ",
954
- "ASSIGN",
955
- "UNASSIGN"
956
- ]);
957
- var declarationActionValues = [
958
- ActionTypes.enum.DECLARE,
959
- ActionTypes.enum.VALIDATE,
960
- ActionTypes.enum.REGISTER
961
- ];
962
- var DeclarationActions = ActionTypes.extract(declarationActionValues);
963
- var declarationUpdateActionValues = [
964
- ...declarationActionValues,
965
- ActionTypes.enum.REQUEST_CORRECTION
966
- ];
967
- var DeclarationUpdateActions = ActionTypes.extract(
968
- declarationUpdateActionValues
969
- );
970
- var annotationActions = ActionTypes.exclude(declarationActionValues);
971
- var writeActions = ActionTypes.exclude([
972
- ActionType.CREATE,
973
- ActionType.READ,
974
- ActionType.ASSIGN,
975
- ActionType.UNASSIGN
976
- ]);
977
- var StatusChangingActions = ActionTypes.extract([
978
- ActionType.CREATE,
979
- ActionType.NOTIFY,
980
- ActionType.DECLARE,
981
- ActionType.VALIDATE,
982
- ActionType.REGISTER,
983
- ActionType.REJECT,
984
- ActionType.ARCHIVE,
985
- ActionType.PRINT_CERTIFICATE
986
- ]);
987
- var workqueueActions = ActionTypes.exclude([
988
- ActionType.CREATE,
989
- ActionType.NOTIFY,
990
- ActionType.DETECT_DUPLICATE,
991
- ActionType.REJECT,
992
- ActionType.MARKED_AS_DUPLICATE,
993
- ActionType.ARCHIVE,
994
- ActionType.REQUEST_CORRECTION,
995
- ActionType.REJECT_CORRECTION,
996
- ActionType.APPROVE_CORRECTION
997
- ]);
998
- var META_ACTIONS = [
999
- ActionType.ASSIGN,
1000
- ActionType.UNASSIGN,
1001
- ActionType.READ
1002
- ];
1003
- function isMetaAction(actionType) {
1004
- return META_ACTIONS.includes(actionType);
1005
- }
1006
-
1007
1088
  // ../commons/src/events/FormConfig.ts
1008
- var import_zod8 = require("zod");
1009
- var DeclarationFormConfig = import_zod8.z.object({
1089
+ var DeclarationFormConfig = import_zod9.z.object({
1010
1090
  label: TranslationConfig.describe("Human readable description of the form"),
1011
- pages: import_zod8.z.array(FormPageConfig)
1091
+ pages: import_zod9.z.array(FormPageConfig)
1012
1092
  }).describe("Configuration for a declaration form");
1013
- var ActionFormConfig = import_zod8.z.object({
1093
+ var ActionFormConfig = import_zod9.z.object({
1014
1094
  label: TranslationConfig.describe("Human readable description of the form"),
1015
- pages: import_zod8.z.array(PageConfig)
1095
+ pages: import_zod9.z.array(PageConfig)
1016
1096
  });
1017
- var FormConfig = import_zod8.z.union([DeclarationFormConfig, ActionFormConfig]);
1097
+ var FormConfig = import_zod9.z.union([DeclarationFormConfig, ActionFormConfig]);
1018
1098
 
1019
1099
  // ../commons/src/events/ActionConfig.ts
1020
- var import_zod_openapi5 = require("zod-openapi");
1021
- (0, import_zod_openapi5.extendZodWithOpenApi)(import_zod9.z);
1022
- var ActionConditional2 = import_zod9.z.discriminatedUnion("type", [
1100
+ var import_zod_openapi6 = require("zod-openapi");
1101
+ (0, import_zod_openapi6.extendZodWithOpenApi)(import_zod10.z);
1102
+ var ActionConditional2 = import_zod10.z.discriminatedUnion("type", [
1023
1103
  /** If conditional is defined, the action is shown to the user only if the condition is met */
1024
1104
  ShowConditional,
1025
1105
  /** If conditional is defined, the action is enabled only if the condition is met */
1026
1106
  EnableConditional
1027
1107
  ]);
1028
- var DeclarationReviewConfig = import_zod9.z.object({
1108
+ var DeclarationReviewConfig = import_zod10.z.object({
1029
1109
  title: TranslationConfig.describe("Title of the review page"),
1030
- fields: import_zod9.z.array(FieldConfig).describe("Fields to be rendered on the review page for annotations.")
1110
+ fields: import_zod10.z.array(FieldConfig).describe("Fields to be rendered on the review page for annotations.")
1031
1111
  }).describe("Configuration for **declaration** review page.");
1032
- var ActionConfigBase = import_zod9.z.object({
1112
+ var ActionConfigBase = import_zod10.z.object({
1033
1113
  label: TranslationConfig,
1034
- conditionals: import_zod9.z.array(ActionConditional2).optional().default([]),
1035
- draft: import_zod9.z.boolean().optional()
1114
+ conditionals: import_zod10.z.array(ActionConditional2).optional().default([]),
1115
+ draft: import_zod10.z.boolean().optional()
1036
1116
  });
1037
1117
  var ReadActionConfig = ActionConfigBase.merge(
1038
- import_zod9.z.object({
1039
- type: import_zod9.z.literal(ActionType.READ),
1118
+ import_zod10.z.object({
1119
+ type: import_zod10.z.literal(ActionType.READ),
1040
1120
  review: DeclarationReviewConfig
1041
1121
  })
1042
1122
  );
1043
1123
  var DeclareConfig = ActionConfigBase.merge(
1044
- import_zod9.z.object({
1045
- type: import_zod9.z.literal(ActionType.DECLARE),
1124
+ import_zod10.z.object({
1125
+ type: import_zod10.z.literal(ActionType.DECLARE),
1046
1126
  review: DeclarationReviewConfig
1047
1127
  })
1048
1128
  );
1049
1129
  var ValidateConfig = ActionConfigBase.merge(
1050
- import_zod9.z.object({
1051
- type: import_zod9.z.literal(ActionType.VALIDATE),
1130
+ import_zod10.z.object({
1131
+ type: import_zod10.z.literal(ActionType.VALIDATE),
1052
1132
  review: DeclarationReviewConfig
1053
1133
  })
1054
1134
  );
1055
1135
  var RegisterConfig = ActionConfigBase.merge(
1056
- import_zod9.z.object({
1057
- type: import_zod9.z.literal(ActionType.REGISTER),
1136
+ import_zod10.z.object({
1137
+ type: import_zod10.z.literal(ActionType.REGISTER),
1058
1138
  review: DeclarationReviewConfig
1059
1139
  })
1060
1140
  );
1061
1141
  var RejectDeclarationConfig = ActionConfigBase.merge(
1062
- import_zod9.z.object({
1063
- type: import_zod9.z.literal(ActionType.REJECT)
1142
+ import_zod10.z.object({
1143
+ type: import_zod10.z.literal(ActionType.REJECT)
1064
1144
  })
1065
1145
  );
1066
1146
  var MarkedAsDuplicateConfig = ActionConfigBase.merge(
1067
- import_zod9.z.object({
1068
- type: import_zod9.z.literal(ActionType.MARKED_AS_DUPLICATE)
1147
+ import_zod10.z.object({
1148
+ type: import_zod10.z.literal(ActionType.MARKED_AS_DUPLICATE)
1069
1149
  })
1070
1150
  );
1071
1151
  var ArchiveConfig = ActionConfigBase.merge(
1072
- import_zod9.z.object({
1073
- type: import_zod9.z.literal(ActionType.ARCHIVE)
1152
+ import_zod10.z.object({
1153
+ type: import_zod10.z.literal(ActionType.ARCHIVE)
1074
1154
  })
1075
1155
  );
1076
1156
  var DeleteConfig = ActionConfigBase.merge(
1077
- import_zod9.z.object({
1078
- type: import_zod9.z.literal(ActionType.DELETE)
1157
+ import_zod10.z.object({
1158
+ type: import_zod10.z.literal(ActionType.DELETE)
1079
1159
  })
1080
1160
  );
1081
1161
  var PrintCertificateActionConfig = ActionConfigBase.merge(
1082
- import_zod9.z.object({
1083
- type: import_zod9.z.literal(ActionType.PRINT_CERTIFICATE),
1162
+ import_zod10.z.object({
1163
+ type: import_zod10.z.literal(ActionType.PRINT_CERTIFICATE),
1084
1164
  printForm: ActionFormConfig
1085
1165
  })
1086
1166
  );
1087
1167
  var RequestCorrectionConfig = ActionConfigBase.merge(
1088
- import_zod9.z.object({
1089
- type: import_zod9.z.literal(ActionType.REQUEST_CORRECTION),
1090
- onboardingForm: import_zod9.z.array(PageConfig),
1091
- additionalDetailsForm: import_zod9.z.array(PageConfig)
1168
+ import_zod10.z.object({
1169
+ type: import_zod10.z.literal(ActionType.REQUEST_CORRECTION),
1170
+ correctionForm: ActionFormConfig
1092
1171
  })
1093
1172
  );
1094
1173
  var RejectCorrectionConfig = ActionConfigBase.merge(
1095
- import_zod9.z.object({
1096
- type: import_zod9.z.literal(ActionType.REJECT_CORRECTION)
1174
+ import_zod10.z.object({
1175
+ type: import_zod10.z.literal(ActionType.REJECT_CORRECTION)
1097
1176
  })
1098
1177
  );
1099
1178
  var ApproveCorrectionConfig = ActionConfigBase.merge(
1100
- import_zod9.z.object({
1101
- type: import_zod9.z.literal(ActionType.APPROVE_CORRECTION)
1179
+ import_zod10.z.object({
1180
+ type: import_zod10.z.literal(ActionType.APPROVE_CORRECTION)
1102
1181
  })
1103
1182
  );
1104
- var ActionConfig = import_zod9.z.discriminatedUnion("type", [
1183
+ var ActionConfig = import_zod10.z.discriminatedUnion("type", [
1105
1184
  /*
1106
1185
  * OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
1107
1186
  * and treat them as "models" instead of duplicating the data structure in each endpoint.
@@ -1121,108 +1200,108 @@ var ActionConfig = import_zod9.z.discriminatedUnion("type", [
1121
1200
  RejectCorrectionConfig.openapi({ ref: "RejectCorrectionActionConfig" }),
1122
1201
  ApproveCorrectionConfig.openapi({ ref: "ApproveCorrectionActionConfig" })
1123
1202
  ]).openapi({ ref: "ActionConfig" });
1124
- var DeclarationActionConfig = import_zod9.z.discriminatedUnion("type", [
1203
+ var DeclarationActionConfig = import_zod10.z.discriminatedUnion("type", [
1125
1204
  DeclareConfig,
1126
1205
  ValidateConfig,
1127
1206
  RegisterConfig
1128
1207
  ]);
1129
1208
 
1130
1209
  // ../commons/src/events/offline/CertificateConfig.ts
1131
- var import_zod10 = require("zod");
1132
- var FontFamily = import_zod10.z.object({
1133
- normal: import_zod10.z.string(),
1134
- bold: import_zod10.z.string(),
1135
- italics: import_zod10.z.string(),
1136
- bolditalics: import_zod10.z.string()
1210
+ var import_zod11 = require("zod");
1211
+ var FontFamily = import_zod11.z.object({
1212
+ normal: import_zod11.z.string(),
1213
+ bold: import_zod11.z.string(),
1214
+ italics: import_zod11.z.string(),
1215
+ bolditalics: import_zod11.z.string()
1137
1216
  });
1138
- var CertificateConfig = import_zod10.z.object({
1139
- id: import_zod10.z.string(),
1140
- event: import_zod10.z.string(),
1217
+ var CertificateConfig = import_zod11.z.object({
1218
+ id: import_zod11.z.string(),
1219
+ event: import_zod11.z.string(),
1141
1220
  label: TranslationConfig,
1142
- isDefault: import_zod10.z.boolean(),
1143
- fee: import_zod10.z.object({
1144
- onTime: import_zod10.z.number(),
1145
- late: import_zod10.z.number(),
1146
- delayed: import_zod10.z.number()
1221
+ isDefault: import_zod11.z.boolean(),
1222
+ fee: import_zod11.z.object({
1223
+ onTime: import_zod11.z.number(),
1224
+ late: import_zod11.z.number(),
1225
+ delayed: import_zod11.z.number()
1147
1226
  }),
1148
- svgUrl: import_zod10.z.string(),
1149
- fonts: import_zod10.z.record(FontFamily).optional()
1227
+ svgUrl: import_zod11.z.string(),
1228
+ fonts: import_zod11.z.record(FontFamily).optional()
1150
1229
  });
1151
1230
  var CertificateTemplateConfig = CertificateConfig.extend({
1152
- hash: import_zod10.z.string().optional(),
1153
- svg: import_zod10.z.string()
1231
+ hash: import_zod11.z.string().optional(),
1232
+ svg: import_zod11.z.string()
1154
1233
  });
1155
1234
 
1156
1235
  // ../commons/src/events/offline/LanguageConfig.ts
1157
- var import_zod11 = require("zod");
1158
- var LanguageConfig = import_zod11.z.object({
1159
- lang: import_zod11.z.string(),
1236
+ var import_zod12 = require("zod");
1237
+ var LanguageConfig = import_zod12.z.object({
1238
+ lang: import_zod12.z.string(),
1160
1239
  /**
1161
1240
  * client.csv contents
1162
1241
  */
1163
- messages: import_zod11.z.record(import_zod11.z.string())
1242
+ messages: import_zod12.z.record(import_zod12.z.string())
1164
1243
  });
1165
1244
 
1166
1245
  // ../commons/src/events/EventConfig.ts
1167
- var import_zod20 = require("zod");
1246
+ var import_zod21 = require("zod");
1168
1247
 
1169
1248
  // ../commons/src/events/DeduplicationConfig.ts
1170
- var import_zod12 = require("zod");
1171
- var import_zod_openapi6 = require("zod-openapi");
1172
- (0, import_zod_openapi6.extendZodWithOpenApi)(import_zod12.z);
1173
- var FieldReference2 = import_zod12.z.string();
1174
- var Matcher = import_zod12.z.object({
1175
- fieldId: import_zod12.z.string(),
1176
- options: import_zod12.z.object({
1177
- boost: import_zod12.z.number().optional()
1249
+ var import_zod13 = require("zod");
1250
+ var import_zod_openapi7 = require("zod-openapi");
1251
+ (0, import_zod_openapi7.extendZodWithOpenApi)(import_zod13.z);
1252
+ var FieldReference2 = import_zod13.z.string();
1253
+ var Matcher = import_zod13.z.object({
1254
+ fieldId: import_zod13.z.string(),
1255
+ options: import_zod13.z.object({
1256
+ boost: import_zod13.z.number().optional()
1178
1257
  }).optional().default({})
1179
1258
  });
1180
1259
  var FuzzyMatcher = Matcher.extend({
1181
- type: import_zod12.z.literal("fuzzy"),
1182
- options: import_zod12.z.object({
1260
+ type: import_zod13.z.literal("fuzzy"),
1261
+ options: import_zod13.z.object({
1183
1262
  /**
1184
1263
  * Names of length 3 or less characters = 0 edits allowed
1185
1264
  * Names of length 4 - 6 characters = 1 edit allowed
1186
1265
  * Names of length >7 characters = 2 edits allowed
1187
1266
  */
1188
- fuzziness: import_zod12.z.union([import_zod12.z.string(), import_zod12.z.number()]).optional().default("AUTO:4,7"),
1189
- boost: import_zod12.z.number().optional().default(1)
1267
+ fuzziness: import_zod13.z.union([import_zod13.z.string(), import_zod13.z.number()]).optional().default("AUTO:4,7"),
1268
+ boost: import_zod13.z.number().optional().default(1)
1190
1269
  }).optional().default({})
1191
1270
  });
1192
1271
  var StrictMatcher = Matcher.extend({
1193
- type: import_zod12.z.literal("strict"),
1194
- options: import_zod12.z.object({
1195
- boost: import_zod12.z.number().optional().default(1)
1272
+ type: import_zod13.z.literal("strict"),
1273
+ options: import_zod13.z.object({
1274
+ boost: import_zod13.z.number().optional().default(1)
1196
1275
  }).optional().default({})
1197
1276
  });
1198
1277
  var DateRangeMatcher = Matcher.extend({
1199
- type: import_zod12.z.literal("dateRange"),
1200
- options: import_zod12.z.object({
1201
- days: import_zod12.z.number(),
1278
+ type: import_zod13.z.literal("dateRange"),
1279
+ options: import_zod13.z.object({
1280
+ days: import_zod13.z.number(),
1202
1281
  origin: FieldReference2,
1203
- boost: import_zod12.z.number().optional().default(1)
1282
+ boost: import_zod13.z.number().optional().default(1)
1204
1283
  })
1205
1284
  });
1206
1285
  var DateDistanceMatcher = Matcher.extend({
1207
- type: import_zod12.z.literal("dateDistance"),
1208
- options: import_zod12.z.object({
1209
- days: import_zod12.z.number(),
1286
+ type: import_zod13.z.literal("dateDistance"),
1287
+ options: import_zod13.z.object({
1288
+ days: import_zod13.z.number(),
1210
1289
  origin: FieldReference2,
1211
- boost: import_zod12.z.number().optional().default(1)
1290
+ boost: import_zod13.z.number().optional().default(1)
1212
1291
  })
1213
1292
  });
1214
- var And = import_zod12.z.object({
1215
- type: import_zod12.z.literal("and"),
1293
+ var And = import_zod13.z.object({
1294
+ type: import_zod13.z.literal("and"),
1216
1295
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
1217
- clauses: import_zod12.z.lazy(() => Clause.array())
1296
+ clauses: import_zod13.z.lazy(() => Clause.array())
1218
1297
  });
1219
- var Or = import_zod12.z.object({
1220
- type: import_zod12.z.literal("or"),
1298
+ var Or = import_zod13.z.object({
1299
+ type: import_zod13.z.literal("or"),
1221
1300
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
1222
- clauses: import_zod12.z.lazy(() => Clause.array())
1301
+ clauses: import_zod13.z.lazy(() => Clause.array())
1223
1302
  });
1224
- var Clause = import_zod12.z.lazy(
1225
- () => import_zod12.z.discriminatedUnion("type", [
1303
+ var Clause = import_zod13.z.lazy(
1304
+ () => import_zod13.z.discriminatedUnion("type", [
1226
1305
  And,
1227
1306
  Or,
1228
1307
  FuzzyMatcher,
@@ -1233,43 +1312,43 @@ var Clause = import_zod12.z.lazy(
1233
1312
  ).openapi({
1234
1313
  ref: "Clause"
1235
1314
  });
1236
- var DeduplicationConfig = import_zod12.z.object({
1237
- id: import_zod12.z.string(),
1315
+ var DeduplicationConfig = import_zod13.z.object({
1316
+ id: import_zod13.z.string(),
1238
1317
  label: TranslationConfig,
1239
1318
  query: Clause
1240
1319
  });
1241
1320
 
1242
1321
  // ../commons/src/events/SummaryConfig.ts
1243
- var import_zod13 = require("zod");
1244
- var BaseField2 = import_zod13.z.object({
1322
+ var import_zod14 = require("zod");
1323
+ var BaseField2 = import_zod14.z.object({
1245
1324
  emptyValueMessage: TranslationConfig.optional(),
1246
- conditionals: import_zod13.z.array(ShowConditional).default([]).optional()
1325
+ conditionals: import_zod14.z.array(ShowConditional).default([]).optional()
1247
1326
  });
1248
1327
  var ReferenceField = BaseField2.extend({
1249
- fieldId: import_zod13.z.string(),
1328
+ fieldId: import_zod14.z.string(),
1250
1329
  label: TranslationConfig.optional().describe(
1251
1330
  "By default, the configured field's label is used. This can be overridden by providing a custom label."
1252
1331
  )
1253
1332
  }).describe("Field directly referencing event data with field id");
1254
1333
  var Field = BaseField2.extend({
1255
- id: import_zod13.z.string().describe("Id of summary field"),
1334
+ id: import_zod14.z.string().describe("Id of summary field"),
1256
1335
  value: TranslationConfig.describe(
1257
1336
  "Summary field value. Can utilise values defined in configuration and EventMetadata"
1258
1337
  ),
1259
1338
  label: TranslationConfig
1260
1339
  }).describe("Custom configured field");
1261
- var SummaryConfig = import_zod13.z.object({
1262
- fields: import_zod13.z.array(import_zod13.z.union([Field, ReferenceField])).describe("Fields rendered in summary view.")
1340
+ var SummaryConfig = import_zod14.z.object({
1341
+ fields: import_zod14.z.array(import_zod14.z.union([Field, ReferenceField])).describe("Fields rendered in summary view.")
1263
1342
  }).describe("Configuration for summary in event.");
1264
1343
 
1265
1344
  // ../commons/src/events/AdvancedSearchConfig.ts
1266
- var import_zod14 = require("zod");
1267
- var MatchType = import_zod14.z.enum(["fuzzy", "exact", "range"]);
1268
- var BaseField3 = import_zod14.z.object({
1269
- config: import_zod14.z.object({
1345
+ var import_zod15 = require("zod");
1346
+ var MatchType = import_zod15.z.enum(["fuzzy", "exact", "range", "within"]);
1347
+ var BaseField3 = import_zod15.z.object({
1348
+ config: import_zod15.z.object({
1270
1349
  type: MatchType.describe("Determines the type of field")
1271
1350
  }),
1272
- options: import_zod14.z.array(SelectOption).optional(),
1351
+ options: import_zod15.z.array(SelectOption).optional(),
1273
1352
  searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
1274
1353
  `
1275
1354
  This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
@@ -1290,7 +1369,7 @@ var BaseField3 = import_zod14.z.object({
1290
1369
  in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
1291
1370
  `
1292
1371
  ),
1293
- conditionals: import_zod14.z.array(FieldConditional).default([]).optional().describe(
1372
+ conditionals: import_zod15.z.array(FieldConditional).default([]).optional().describe(
1294
1373
  `
1295
1374
  In advanced search, we sometimes need to override the default field visibility conditionals.
1296
1375
 
@@ -1304,50 +1383,68 @@ var BaseField3 = import_zod14.z.object({
1304
1383
  are always rendered in the advanced search form.
1305
1384
  `
1306
1385
  ),
1307
- validations: import_zod14.z.array(ValidationConfig).default([]).optional().describe(
1386
+ validations: import_zod15.z.array(ValidationConfig).default([]).optional().describe(
1308
1387
  `In advanced search, we sometimes need to override the default field validations.`
1309
1388
  )
1310
1389
  });
1311
- var SearchQueryParams = import_zod14.z.object({
1312
- eventType: import_zod14.z.string().optional().describe(
1390
+ var SearchQueryParams = import_zod15.z.object({
1391
+ eventType: import_zod15.z.string().optional().describe(
1313
1392
  "Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
1314
1393
  )
1315
1394
  }).catchall(FieldValue);
1316
1395
  var FieldConfigSchema = BaseField3.extend({
1317
- fieldId: import_zod14.z.string(),
1318
- fieldType: import_zod14.z.literal("field")
1396
+ fieldId: import_zod15.z.string(),
1397
+ fieldType: import_zod15.z.literal("field"),
1398
+ alternateFieldIds: import_zod15.z.array(import_zod15.z.string()).optional().describe(
1399
+ `Sometimes there might be need to search a value against multiple field of same FormField type. For example
1400
+ search Country, Province, District against child.address.private and child.address.other. In such case, we
1401
+ add a one field as fieldId, and accomodate others in alternateFieldIds`
1402
+ ),
1403
+ excludeInSearchQuery: import_zod15.z.boolean().default(false).optional().describe(`Sometimes there will be search fields which are used to
1404
+ conditionally display another search field, but its not needed in search query. For example, child.placeOfBirth
1405
+ is select field, which has 3 options, FACILITY, PRIVATE_HOME, OTHER. Upon selecting any of the option, pops up another field
1406
+ related to the selected option, whose value is required in the search query. But child.placeOfBirth itself is not needed in the query.
1407
+ In such case, populate this field (excludeInSearchQuery) with boolean true`)
1319
1408
  });
1320
- var EventFieldId = import_zod14.z.enum([
1409
+ var EventFieldIdInput = import_zod15.z.enum([
1321
1410
  "trackingId",
1322
1411
  "status",
1323
- "legalStatus.REGISTERED.createdAt",
1324
- "legalStatus.REGISTERED.createdAtLocation",
1412
+ "legalStatuses.REGISTERED.acceptedAt",
1413
+ "legalStatuses.REGISTERED.createdAtLocation",
1325
1414
  "updatedAt"
1326
1415
  ]);
1416
+ var METADATA_FIELD_PREFIX = "event.";
1417
+ var EventFieldId = import_zod15.z.enum([
1418
+ `${METADATA_FIELD_PREFIX}trackingId`,
1419
+ `${METADATA_FIELD_PREFIX}status`,
1420
+ `${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
1421
+ `${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.createdAtLocation`,
1422
+ `${METADATA_FIELD_PREFIX}updatedAt`
1423
+ ]);
1327
1424
  var EventFieldConfigSchema = BaseField3.extend({
1328
1425
  fieldId: EventFieldId,
1329
- fieldType: import_zod14.z.literal("event")
1426
+ fieldType: import_zod15.z.literal("event")
1330
1427
  });
1331
- var SearchField = import_zod14.z.discriminatedUnion("fieldType", [
1428
+ var SearchField = import_zod15.z.discriminatedUnion("fieldType", [
1332
1429
  FieldConfigSchema,
1333
1430
  EventFieldConfigSchema
1334
1431
  ]);
1335
- var AdvancedSearchConfig = import_zod14.z.object({
1432
+ var AdvancedSearchConfig = import_zod15.z.object({
1336
1433
  title: TranslationConfig.describe("Advanced search tab title"),
1337
- fields: import_zod14.z.array(SearchField).describe("Advanced search fields.")
1434
+ fields: import_zod15.z.array(SearchField).describe("Advanced search fields.")
1338
1435
  });
1339
1436
 
1340
1437
  // ../commons/src/events/utils.ts
1341
1438
  var import_lodash = require("lodash");
1342
1439
 
1343
1440
  // ../commons/src/events/ActionDocument.ts
1344
- var import_zod18 = require("zod");
1345
- var import_zod_openapi7 = require("zod-openapi");
1441
+ var import_zod19 = require("zod");
1442
+ var import_zod_openapi8 = require("zod-openapi");
1346
1443
 
1347
1444
  // ../commons/src/uuid.ts
1348
1445
  var import_uuid = require("uuid");
1349
- var import_zod15 = require("zod");
1350
- var UUID = import_zod15.z.string().uuid().brand("UUID");
1446
+ var import_zod16 = require("zod");
1447
+ var UUID = import_zod16.z.string().uuid().brand("UUID");
1351
1448
  function getUUID() {
1352
1449
  return (0, import_uuid.v4)();
1353
1450
  }
@@ -1357,10 +1454,10 @@ var CreatedAtLocation = UUID.nullish();
1357
1454
 
1358
1455
  // ../commons/src/authentication.ts
1359
1456
  var import_jwt_decode = __toESM(require("jwt-decode"));
1360
- var import_zod17 = require("zod");
1457
+ var import_zod18 = require("zod");
1361
1458
 
1362
1459
  // ../commons/src/scopes.ts
1363
- var import_zod16 = require("zod");
1460
+ var import_zod17 = require("zod");
1364
1461
  var SCOPES = {
1365
1462
  // TODO v1.8 legacy scopes
1366
1463
  NATLSYSADMIN: "natlsysadmin",
@@ -1473,108 +1570,108 @@ var SCOPES = {
1473
1570
  // data seeding
1474
1571
  USER_DATA_SEEDING: "user.data-seeding"
1475
1572
  };
1476
- var LegacyScopes = import_zod16.z.union([
1477
- import_zod16.z.literal(SCOPES.NATLSYSADMIN),
1478
- import_zod16.z.literal(SCOPES.BYPASSRATELIMIT),
1479
- import_zod16.z.literal(SCOPES.DECLARE),
1480
- import_zod16.z.literal(SCOPES.REGISTER),
1481
- import_zod16.z.literal(SCOPES.VALIDATE),
1482
- import_zod16.z.literal(SCOPES.DEMO),
1483
- import_zod16.z.literal(SCOPES.CERTIFY),
1484
- import_zod16.z.literal(SCOPES.PERFORMANCE),
1485
- import_zod16.z.literal(SCOPES.SYSADMIN),
1486
- import_zod16.z.literal(SCOPES.TEAMS),
1487
- import_zod16.z.literal(SCOPES.CONFIG)
1573
+ var LegacyScopes = import_zod17.z.union([
1574
+ import_zod17.z.literal(SCOPES.NATLSYSADMIN),
1575
+ import_zod17.z.literal(SCOPES.BYPASSRATELIMIT),
1576
+ import_zod17.z.literal(SCOPES.DECLARE),
1577
+ import_zod17.z.literal(SCOPES.REGISTER),
1578
+ import_zod17.z.literal(SCOPES.VALIDATE),
1579
+ import_zod17.z.literal(SCOPES.DEMO),
1580
+ import_zod17.z.literal(SCOPES.CERTIFY),
1581
+ import_zod17.z.literal(SCOPES.PERFORMANCE),
1582
+ import_zod17.z.literal(SCOPES.SYSADMIN),
1583
+ import_zod17.z.literal(SCOPES.TEAMS),
1584
+ import_zod17.z.literal(SCOPES.CONFIG)
1488
1585
  ]);
1489
- var IntegrationScopes = import_zod16.z.union([
1490
- import_zod16.z.literal(SCOPES.WEBHOOK),
1491
- import_zod16.z.literal(SCOPES.NATIONALID),
1492
- import_zod16.z.literal(SCOPES.NOTIFICATION_API),
1493
- import_zod16.z.literal(SCOPES.RECORDSEARCH)
1586
+ var IntegrationScopes = import_zod17.z.union([
1587
+ import_zod17.z.literal(SCOPES.WEBHOOK),
1588
+ import_zod17.z.literal(SCOPES.NATIONALID),
1589
+ import_zod17.z.literal(SCOPES.NOTIFICATION_API),
1590
+ import_zod17.z.literal(SCOPES.RECORDSEARCH)
1494
1591
  ]);
1495
- var DeclareScopes = import_zod16.z.union([
1496
- import_zod16.z.literal(SCOPES.RECORD_DECLARE),
1497
- import_zod16.z.literal(SCOPES.RECORD_IMPORT),
1498
- import_zod16.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
1499
- import_zod16.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
1500
- import_zod16.z.literal(SCOPES.RECORD_DECLARE_DEATH),
1501
- import_zod16.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
1502
- import_zod16.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
1503
- import_zod16.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
1504
- import_zod16.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
1505
- import_zod16.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW)
1592
+ var DeclareScopes = import_zod17.z.union([
1593
+ import_zod17.z.literal(SCOPES.RECORD_DECLARE),
1594
+ import_zod17.z.literal(SCOPES.RECORD_IMPORT),
1595
+ import_zod17.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
1596
+ import_zod17.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
1597
+ import_zod17.z.literal(SCOPES.RECORD_DECLARE_DEATH),
1598
+ import_zod17.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
1599
+ import_zod17.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
1600
+ import_zod17.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
1601
+ import_zod17.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
1602
+ import_zod17.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW)
1506
1603
  ]);
1507
- var UnassignScope = import_zod16.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS);
1508
- var ValidateScopes = import_zod16.z.union([
1509
- import_zod16.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
1510
- import_zod16.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
1511
- import_zod16.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
1512
- import_zod16.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
1513
- import_zod16.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
1514
- import_zod16.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE)
1604
+ var UnassignScope = import_zod17.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS);
1605
+ var ValidateScopes = import_zod17.z.union([
1606
+ import_zod17.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
1607
+ import_zod17.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
1608
+ import_zod17.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
1609
+ import_zod17.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
1610
+ import_zod17.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
1611
+ import_zod17.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE)
1515
1612
  ]);
1516
- var RegisterScope = import_zod16.z.literal(SCOPES.RECORD_REGISTER);
1517
- var CertifyScopes = import_zod16.z.union([
1518
- import_zod16.z.literal(SCOPES.RECORD_EXPORT_RECORDS),
1519
- import_zod16.z.literal(SCOPES.RECORD_DECLARATION_PRINT),
1520
- import_zod16.z.literal(SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS),
1521
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_PRINT),
1522
- import_zod16.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
1523
- import_zod16.z.literal(SCOPES.RECORD_PRINT_CERTIFIED_COPIES),
1524
- import_zod16.z.literal(SCOPES.RECORD_BULK_PRINT_CERTIFIED_COPIES),
1525
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES)
1613
+ var RegisterScope = import_zod17.z.literal(SCOPES.RECORD_REGISTER);
1614
+ var CertifyScopes = import_zod17.z.union([
1615
+ import_zod17.z.literal(SCOPES.RECORD_EXPORT_RECORDS),
1616
+ import_zod17.z.literal(SCOPES.RECORD_DECLARATION_PRINT),
1617
+ import_zod17.z.literal(SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS),
1618
+ import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_PRINT),
1619
+ import_zod17.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
1620
+ import_zod17.z.literal(SCOPES.RECORD_PRINT_CERTIFIED_COPIES),
1621
+ import_zod17.z.literal(SCOPES.RECORD_BULK_PRINT_CERTIFIED_COPIES),
1622
+ import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES)
1526
1623
  ]);
1527
- var CorrectionScopes = import_zod16.z.union([
1528
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
1529
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
1530
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REVOCATION),
1531
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REVOKE),
1532
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REINSTATEMENT),
1533
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REINSTATE),
1534
- import_zod16.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
1535
- import_zod16.z.literal(SCOPES.RECORD_REJECT_REGISTRATION)
1624
+ var CorrectionScopes = import_zod17.z.union([
1625
+ import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
1626
+ import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
1627
+ import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REVOCATION),
1628
+ import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_REVOKE),
1629
+ import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REINSTATEMENT),
1630
+ import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_REINSTATE),
1631
+ import_zod17.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
1632
+ import_zod17.z.literal(SCOPES.RECORD_REJECT_REGISTRATION)
1536
1633
  ]);
1537
- var SearchScopes = import_zod16.z.union([
1538
- import_zod16.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
1539
- import_zod16.z.literal(SCOPES.SEARCH_BIRTH),
1540
- import_zod16.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
1541
- import_zod16.z.literal(SCOPES.SEARCH_DEATH),
1542
- import_zod16.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
1543
- import_zod16.z.literal(SCOPES.SEARCH_MARRIAGE)
1634
+ var SearchScopes = import_zod17.z.union([
1635
+ import_zod17.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
1636
+ import_zod17.z.literal(SCOPES.SEARCH_BIRTH),
1637
+ import_zod17.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
1638
+ import_zod17.z.literal(SCOPES.SEARCH_DEATH),
1639
+ import_zod17.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
1640
+ import_zod17.z.literal(SCOPES.SEARCH_MARRIAGE)
1544
1641
  ]);
1545
- var AuditScopes = import_zod16.z.union([
1546
- import_zod16.z.literal(SCOPES.RECORD_READ),
1547
- import_zod16.z.literal(SCOPES.RECORD_READ_AUDIT),
1548
- import_zod16.z.literal(SCOPES.RECORD_READ_COMMENTS),
1549
- import_zod16.z.literal(SCOPES.RECORD_CREATE_COMMENTS)
1642
+ var AuditScopes = import_zod17.z.union([
1643
+ import_zod17.z.literal(SCOPES.RECORD_READ),
1644
+ import_zod17.z.literal(SCOPES.RECORD_READ_AUDIT),
1645
+ import_zod17.z.literal(SCOPES.RECORD_READ_COMMENTS),
1646
+ import_zod17.z.literal(SCOPES.RECORD_CREATE_COMMENTS)
1550
1647
  ]);
1551
- var ProfileScopes = import_zod16.z.union([
1552
- import_zod16.z.literal(SCOPES.PROFILE_UPDATE),
1553
- import_zod16.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE)
1648
+ var ProfileScopes = import_zod17.z.union([
1649
+ import_zod17.z.literal(SCOPES.PROFILE_UPDATE),
1650
+ import_zod17.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE)
1554
1651
  ]);
1555
- var PerformanceScopes = import_zod16.z.union([
1556
- import_zod16.z.literal(SCOPES.PERFORMANCE_READ),
1557
- import_zod16.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
1558
- import_zod16.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS)
1652
+ var PerformanceScopes = import_zod17.z.union([
1653
+ import_zod17.z.literal(SCOPES.PERFORMANCE_READ),
1654
+ import_zod17.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
1655
+ import_zod17.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS)
1559
1656
  ]);
1560
- var OrganisationScopes = import_zod16.z.union([
1561
- import_zod16.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
1562
- import_zod16.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
1563
- import_zod16.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION)
1657
+ var OrganisationScopes = import_zod17.z.union([
1658
+ import_zod17.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
1659
+ import_zod17.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
1660
+ import_zod17.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION)
1564
1661
  ]);
1565
- var UserScopes = import_zod16.z.union([
1566
- import_zod16.z.literal(SCOPES.USER_READ),
1567
- import_zod16.z.literal(SCOPES.USER_READ_MY_OFFICE),
1568
- import_zod16.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
1569
- import_zod16.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
1570
- import_zod16.z.literal(SCOPES.USER_CREATE),
1571
- import_zod16.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
1572
- import_zod16.z.literal(SCOPES.USER_UPDATE),
1573
- import_zod16.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION)
1662
+ var UserScopes = import_zod17.z.union([
1663
+ import_zod17.z.literal(SCOPES.USER_READ),
1664
+ import_zod17.z.literal(SCOPES.USER_READ_MY_OFFICE),
1665
+ import_zod17.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
1666
+ import_zod17.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
1667
+ import_zod17.z.literal(SCOPES.USER_CREATE),
1668
+ import_zod17.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
1669
+ import_zod17.z.literal(SCOPES.USER_UPDATE),
1670
+ import_zod17.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION)
1574
1671
  ]);
1575
- var ConfigScope = import_zod16.z.literal(SCOPES.CONFIG_UPDATE_ALL);
1576
- var DataSeedingScope = import_zod16.z.literal(SCOPES.USER_DATA_SEEDING);
1577
- var LiteralScopes = import_zod16.z.union([
1672
+ var ConfigScope = import_zod17.z.literal(SCOPES.CONFIG_UPDATE_ALL);
1673
+ var DataSeedingScope = import_zod17.z.literal(SCOPES.USER_DATA_SEEDING);
1674
+ var LiteralScopes = import_zod17.z.union([
1578
1675
  LegacyScopes,
1579
1676
  IntegrationScopes,
1580
1677
  UnassignScope,
@@ -1593,39 +1690,47 @@ var LiteralScopes = import_zod16.z.union([
1593
1690
  DataSeedingScope
1594
1691
  ]);
1595
1692
  var rawConfigurableScopeRegex = /^([a-zA-Z\.]+)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
1596
- var rawConfigurableScope = import_zod16.z.string().regex(rawConfigurableScopeRegex);
1597
- var CreateUserScope = import_zod16.z.object({
1598
- type: import_zod16.z.literal("user.create"),
1599
- options: import_zod16.z.object({
1600
- role: import_zod16.z.array(import_zod16.z.string())
1693
+ var rawConfigurableScope = import_zod17.z.string().regex(rawConfigurableScopeRegex);
1694
+ var CreateUserScope = import_zod17.z.object({
1695
+ type: import_zod17.z.literal("user.create"),
1696
+ options: import_zod17.z.object({
1697
+ role: import_zod17.z.array(import_zod17.z.string())
1698
+ })
1699
+ });
1700
+ var EditUserScope = import_zod17.z.object({
1701
+ type: import_zod17.z.literal("user.edit"),
1702
+ options: import_zod17.z.object({
1703
+ role: import_zod17.z.array(import_zod17.z.string())
1601
1704
  })
1602
1705
  });
1603
- var EditUserScope = import_zod16.z.object({
1604
- type: import_zod16.z.literal("user.edit"),
1605
- options: import_zod16.z.object({
1606
- role: import_zod16.z.array(import_zod16.z.string())
1706
+ var WorkqueueScope = import_zod17.z.object({
1707
+ type: import_zod17.z.literal("workqueue"),
1708
+ options: import_zod17.z.object({
1709
+ id: import_zod17.z.array(import_zod17.z.string())
1607
1710
  })
1608
1711
  });
1609
- var WorkqueueScope = import_zod16.z.object({
1610
- type: import_zod16.z.literal("workqueue"),
1611
- options: import_zod16.z.object({
1612
- id: import_zod16.z.array(import_zod16.z.string())
1712
+ var NotifyRecordScope = import_zod17.z.object({
1713
+ type: import_zod17.z.literal("record.notify"),
1714
+ options: import_zod17.z.object({
1715
+ event: import_zod17.z.array(import_zod17.z.string())
1613
1716
  })
1614
1717
  });
1615
- var NotifyRecordScope = import_zod16.z.object({
1616
- type: import_zod16.z.literal("record.notify"),
1617
- options: import_zod16.z.object({
1618
- event: import_zod16.z.array(import_zod16.z.string())
1718
+ var SearchScope = import_zod17.z.object({
1719
+ type: import_zod17.z.literal("search"),
1720
+ options: import_zod17.z.object({
1721
+ event: import_zod17.z.array(import_zod17.z.string()).length(1),
1722
+ access: import_zod17.z.array(import_zod17.z.enum(["my-jurisdiction", "all"])).length(1)
1619
1723
  })
1620
1724
  });
1621
- var ConfigurableScopes = import_zod16.z.discriminatedUnion("type", [
1725
+ var ConfigurableRawScopes = import_zod17.z.discriminatedUnion("type", [
1726
+ SearchScope,
1622
1727
  CreateUserScope,
1623
1728
  EditUserScope,
1624
1729
  WorkqueueScope,
1625
1730
  NotifyRecordScope
1626
1731
  ]);
1627
1732
  var scopes = Object.values(SCOPES);
1628
- var ActionScopes = import_zod16.z.union([
1733
+ var ActionScopes = import_zod17.z.union([
1629
1734
  DeclareScopes,
1630
1735
  ValidateScopes,
1631
1736
  RegisterScope,
@@ -1776,30 +1881,30 @@ var DEFAULT_ROLES_DEFINITION = [
1776
1881
  ]
1777
1882
  }
1778
1883
  ];
1779
- var TokenUserType = import_zod17.z.enum(["user", "system"]);
1780
- var TokenWithBearer = import_zod17.z.string().regex(/^Bearer\s/);
1884
+ var TokenUserType = import_zod18.z.enum(["user", "system"]);
1885
+ var TokenWithBearer = import_zod18.z.string().regex(/^Bearer\s/);
1781
1886
 
1782
1887
  // ../commons/src/events/ActionDocument.ts
1783
- (0, import_zod_openapi7.extendZodWithOpenApi)(import_zod18.z);
1784
- var ActionUpdate = import_zod18.z.record(import_zod18.z.string(), FieldUpdateValue);
1785
- var EventState = import_zod18.z.record(import_zod18.z.string(), FieldValue);
1888
+ (0, import_zod_openapi8.extendZodWithOpenApi)(import_zod19.z);
1889
+ var ActionUpdate = import_zod19.z.record(import_zod19.z.string(), FieldUpdateValue);
1890
+ var EventState = import_zod19.z.record(import_zod19.z.string(), FieldValue);
1786
1891
  var ActionStatus = {
1787
1892
  Requested: "Requested",
1788
1893
  Accepted: "Accepted",
1789
1894
  Rejected: "Rejected"
1790
1895
  };
1791
- var ActionBase = import_zod18.z.object({
1896
+ var ActionBase = import_zod19.z.object({
1792
1897
  id: UUID,
1793
- transactionId: import_zod18.z.string(),
1898
+ transactionId: import_zod19.z.string(),
1794
1899
  createdByUserType: TokenUserType,
1795
- createdAt: import_zod18.z.string().datetime(),
1796
- createdBy: import_zod18.z.string(),
1797
- createdByRole: import_zod18.z.string(),
1798
- createdBySignature: import_zod18.z.string().nullish().describe("Reference to signature of the user who created the action"),
1900
+ createdAt: import_zod19.z.string().datetime(),
1901
+ createdBy: import_zod19.z.string(),
1902
+ createdByRole: import_zod19.z.string(),
1903
+ createdBySignature: import_zod19.z.string().nullish().describe("Reference to signature of the user who created the action"),
1799
1904
  createdAtLocation: CreatedAtLocation,
1800
1905
  declaration: ActionUpdate,
1801
1906
  annotation: ActionUpdate.optional().nullable(),
1802
- status: import_zod18.z.enum([
1907
+ status: import_zod19.z.enum([
1803
1908
  ActionStatus.Requested,
1804
1909
  ActionStatus.Accepted,
1805
1910
  ActionStatus.Rejected
@@ -1808,93 +1913,107 @@ var ActionBase = import_zod18.z.object({
1808
1913
  originalActionId: UUID.optional().nullable().describe(
1809
1914
  "Reference to the original action that was asynchronously rejected or accepted by 3rd party integration."
1810
1915
  )
1916
+ // 'content' field reserved for additional data
1917
+ // Each action can define its own content specifc to the action
1918
+ // See PrintCertificateAction
1811
1919
  });
1812
1920
  var AssignedAction = ActionBase.merge(
1813
- import_zod18.z.object({
1814
- type: import_zod18.z.literal(ActionType.ASSIGN),
1815
- assignedTo: import_zod18.z.string()
1921
+ import_zod19.z.object({
1922
+ type: import_zod19.z.literal(ActionType.ASSIGN),
1923
+ assignedTo: import_zod19.z.string()
1924
+ // TODO move into 'content' property
1816
1925
  })
1817
1926
  );
1818
1927
  var UnassignedAction = ActionBase.merge(
1819
- import_zod18.z.object({
1820
- type: import_zod18.z.literal(ActionType.UNASSIGN)
1928
+ import_zod19.z.object({
1929
+ type: import_zod19.z.literal(ActionType.UNASSIGN)
1821
1930
  })
1822
1931
  );
1823
1932
  var RegisterAction = ActionBase.merge(
1824
- import_zod18.z.object({
1825
- type: import_zod18.z.literal(ActionType.REGISTER),
1826
- registrationNumber: import_zod18.z.string().optional()
1933
+ import_zod19.z.object({
1934
+ type: import_zod19.z.literal(ActionType.REGISTER),
1935
+ registrationNumber: import_zod19.z.string().optional()
1936
+ // TODO move into 'content' property
1827
1937
  })
1828
1938
  );
1829
1939
  var DeclareAction = ActionBase.merge(
1830
- import_zod18.z.object({
1831
- type: import_zod18.z.literal(ActionType.DECLARE)
1940
+ import_zod19.z.object({
1941
+ type: import_zod19.z.literal(ActionType.DECLARE)
1832
1942
  })
1833
1943
  );
1834
1944
  var ValidateAction = ActionBase.merge(
1835
- import_zod18.z.object({
1836
- type: import_zod18.z.literal(ActionType.VALIDATE)
1945
+ import_zod19.z.object({
1946
+ type: import_zod19.z.literal(ActionType.VALIDATE)
1837
1947
  })
1838
1948
  );
1839
- var RejectionReason = import_zod18.z.object({
1840
- message: import_zod18.z.string().min(1, { message: "Message cannot be empty" }).describe("Message describing reason for rejection or archiving"),
1841
- isDuplicate: import_zod18.z.boolean().optional().describe("If a declaration is duplicated")
1949
+ var RejectionReason = import_zod19.z.object({
1950
+ message: import_zod19.z.string().min(1, { message: "Message cannot be empty" }).describe("Message describing reason for rejection or archiving"),
1951
+ isDuplicate: import_zod19.z.boolean().optional().describe("If a declaration is duplicated")
1842
1952
  });
1843
1953
  var RejectAction = ActionBase.merge(
1844
- import_zod18.z.object({
1845
- type: import_zod18.z.literal(ActionType.REJECT),
1954
+ import_zod19.z.object({
1955
+ type: import_zod19.z.literal(ActionType.REJECT),
1846
1956
  reason: RejectionReason
1957
+ // TODO move into 'content' property
1847
1958
  })
1848
1959
  );
1849
1960
  var MarkAsDuplicateAction = ActionBase.merge(
1850
- import_zod18.z.object({
1851
- type: import_zod18.z.literal(ActionType.MARKED_AS_DUPLICATE)
1961
+ import_zod19.z.object({
1962
+ type: import_zod19.z.literal(ActionType.MARKED_AS_DUPLICATE)
1852
1963
  })
1853
1964
  );
1854
1965
  var ArchiveAction = ActionBase.merge(
1855
- import_zod18.z.object({
1856
- type: import_zod18.z.literal(ActionType.ARCHIVE),
1966
+ import_zod19.z.object({
1967
+ type: import_zod19.z.literal(ActionType.ARCHIVE),
1857
1968
  reason: RejectionReason
1969
+ // TODO move into 'content' property
1858
1970
  })
1859
1971
  );
1860
1972
  var CreatedAction = ActionBase.merge(
1861
- import_zod18.z.object({
1862
- type: import_zod18.z.literal(ActionType.CREATE)
1973
+ import_zod19.z.object({
1974
+ type: import_zod19.z.literal(ActionType.CREATE)
1863
1975
  })
1864
1976
  );
1865
1977
  var NotifiedAction = ActionBase.merge(
1866
- import_zod18.z.object({
1867
- type: import_zod18.z.literal(ActionType.NOTIFY)
1978
+ import_zod19.z.object({
1979
+ type: import_zod19.z.literal(ActionType.NOTIFY)
1868
1980
  })
1869
1981
  );
1982
+ var PrintContent = import_zod19.z.object({
1983
+ templateId: import_zod19.z.string().optional()
1984
+ });
1870
1985
  var PrintCertificateAction = ActionBase.merge(
1871
- import_zod18.z.object({
1872
- type: import_zod18.z.literal(ActionType.PRINT_CERTIFICATE)
1986
+ import_zod19.z.object({
1987
+ type: import_zod19.z.literal(ActionType.PRINT_CERTIFICATE),
1988
+ content: PrintContent.optional().nullable()
1873
1989
  })
1874
1990
  );
1875
1991
  var RequestedCorrectionAction = ActionBase.merge(
1876
- import_zod18.z.object({
1877
- type: import_zod18.z.literal(ActionType.REQUEST_CORRECTION)
1992
+ import_zod19.z.object({
1993
+ type: import_zod19.z.literal(ActionType.REQUEST_CORRECTION)
1878
1994
  })
1879
1995
  );
1880
1996
  var ApprovedCorrectionAction = ActionBase.merge(
1881
- import_zod18.z.object({
1882
- type: import_zod18.z.literal(ActionType.APPROVE_CORRECTION),
1883
- requestId: import_zod18.z.string()
1997
+ import_zod19.z.object({
1998
+ type: import_zod19.z.literal(ActionType.APPROVE_CORRECTION),
1999
+ requestId: import_zod19.z.string()
2000
+ // TODO move into 'content' property
1884
2001
  })
1885
2002
  );
1886
2003
  var RejectedCorrectionAction = ActionBase.merge(
1887
- import_zod18.z.object({
1888
- type: import_zod18.z.literal(ActionType.REJECT_CORRECTION),
1889
- requestId: import_zod18.z.string()
2004
+ import_zod19.z.object({
2005
+ type: import_zod19.z.literal(ActionType.REJECT_CORRECTION),
2006
+ requestId: import_zod19.z.string(),
2007
+ // TODO move into 'content' property
2008
+ reason: RejectionReason
1890
2009
  })
1891
2010
  );
1892
2011
  var ReadAction = ActionBase.merge(
1893
- import_zod18.z.object({
1894
- type: import_zod18.z.literal(ActionType.READ)
2012
+ import_zod19.z.object({
2013
+ type: import_zod19.z.literal(ActionType.READ)
1895
2014
  })
1896
2015
  );
1897
- var ActionDocument = import_zod18.z.discriminatedUnion("type", [
2016
+ var ActionDocument = import_zod19.z.discriminatedUnion("type", [
1898
2017
  CreatedAction.openapi({ ref: "CreatedAction" }),
1899
2018
  ValidateAction.openapi({ ref: "ValidateAction" }),
1900
2019
  RejectAction.openapi({ ref: "RejectAction" }),
@@ -1917,20 +2036,20 @@ var AsyncRejectActionDocument = ActionBase.omit({
1917
2036
  declaration: true,
1918
2037
  annotation: true
1919
2038
  }).merge(
1920
- import_zod18.z.object({
1921
- type: import_zod18.z.enum(ConfirmableActions),
1922
- status: import_zod18.z.literal(ActionStatus.Rejected)
2039
+ import_zod19.z.object({
2040
+ type: import_zod19.z.enum(ConfirmableActions),
2041
+ status: import_zod19.z.literal(ActionStatus.Rejected)
1923
2042
  })
1924
2043
  );
1925
- var Action = import_zod18.z.union([ActionDocument, AsyncRejectActionDocument]);
1926
- var ResolvedUser = import_zod18.z.object({
1927
- id: import_zod18.z.string(),
1928
- role: import_zod18.z.string(),
1929
- name: import_zod18.z.array(
1930
- import_zod18.z.object({
1931
- use: import_zod18.z.string(),
1932
- given: import_zod18.z.array(import_zod18.z.string()),
1933
- family: import_zod18.z.string()
2044
+ var Action = import_zod19.z.union([ActionDocument, AsyncRejectActionDocument]);
2045
+ var ResolvedUser = import_zod19.z.object({
2046
+ id: import_zod19.z.string(),
2047
+ role: import_zod19.z.string(),
2048
+ name: import_zod19.z.array(
2049
+ import_zod19.z.object({
2050
+ use: import_zod19.z.string(),
2051
+ given: import_zod19.z.array(import_zod19.z.string()),
2052
+ family: import_zod19.z.string()
1934
2053
  })
1935
2054
  )
1936
2055
  });
@@ -1941,19 +2060,25 @@ var import_ajv_formats = __toESM(require("ajv-formats"));
1941
2060
  var import_date_fns = require("date-fns");
1942
2061
 
1943
2062
  // ../commons/src/events/FieldTypeMapping.ts
1944
- var import_zod19 = require("zod");
2063
+ var import_zod20 = require("zod");
1945
2064
  function mapFieldTypeToZod(type, required) {
1946
2065
  let schema;
1947
2066
  switch (type) {
1948
2067
  case FieldType.DATE:
1949
2068
  schema = DateValue;
1950
2069
  break;
2070
+ case FieldType.TIME:
2071
+ schema = TimeValue;
2072
+ break;
1951
2073
  case FieldType.EMAIL:
1952
2074
  schema = EmailValue;
1953
2075
  break;
1954
2076
  case FieldType.DATE_RANGE:
1955
2077
  schema = DateRangeFieldValue;
1956
2078
  break;
2079
+ case FieldType.SELECT_DATE_RANGE:
2080
+ schema = SelectDateRangeValue;
2081
+ break;
1957
2082
  case FieldType.TEXT:
1958
2083
  case FieldType.TEXTAREA:
1959
2084
  case FieldType.DIVIDER:
@@ -2001,7 +2126,7 @@ function createValidationSchema(config) {
2001
2126
  for (const field2 of config) {
2002
2127
  shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
2003
2128
  }
2004
- return import_zod19.z.object(shape);
2129
+ return import_zod20.z.object(shape);
2005
2130
  }
2006
2131
  function mapFieldTypeToEmptyValue(field2) {
2007
2132
  switch (field2.type) {
@@ -2021,8 +2146,10 @@ function mapFieldTypeToEmptyValue(field2) {
2021
2146
  case FieldType.NUMBER:
2022
2147
  case FieldType.EMAIL:
2023
2148
  case FieldType.DATE:
2149
+ case FieldType.TIME:
2024
2150
  case FieldType.CHECKBOX:
2025
2151
  case FieldType.DATE_RANGE:
2152
+ case FieldType.SELECT_DATE_RANGE:
2026
2153
  case FieldType.DATA:
2027
2154
  case FieldType.NAME:
2028
2155
  case FieldType.PHONE:
@@ -2045,7 +2172,7 @@ function mapFieldTypeToEmptyValue(field2) {
2045
2172
  case FieldType.SIGNATURE:
2046
2173
  case FieldType.FILE:
2047
2174
  return {
2048
- filename: "",
2175
+ path: "",
2049
2176
  originalFilename: "",
2050
2177
  type: ""
2051
2178
  };
@@ -2059,9 +2186,15 @@ var isParagraphFieldType = (field2) => {
2059
2186
  var isDateFieldType = (field2) => {
2060
2187
  return field2.config.type === FieldType.DATE;
2061
2188
  };
2189
+ var isTimeFieldType = (field2) => {
2190
+ return field2.config.type === FieldType.TIME;
2191
+ };
2062
2192
  var isDateRangeFieldType = (field2) => {
2063
2193
  return field2.config.type === FieldType.DATE_RANGE;
2064
2194
  };
2195
+ var isSelectDateRangeFieldType = (field2) => {
2196
+ return field2.config.type === FieldType.SELECT_DATE_RANGE;
2197
+ };
2065
2198
  var isPageHeaderFieldType = (field2) => {
2066
2199
  return field2.config.type === FieldType.PAGE_HEADER;
2067
2200
  };
@@ -2141,6 +2274,29 @@ var ajv = new import_ajv.default({
2141
2274
  allowUnionTypes: true
2142
2275
  });
2143
2276
  (0, import_ajv_formats.default)(ajv);
2277
+ ajv.addKeyword({
2278
+ keyword: "daysFromNow",
2279
+ type: "string",
2280
+ schemaType: "object",
2281
+ $data: true,
2282
+ errors: true,
2283
+ validate(schema, data, _, dataContext) {
2284
+ if (!(dataContext && dataContext.rootData && typeof dataContext.rootData === "object" && "$now" in dataContext.rootData && typeof dataContext.rootData.$now === "string")) {
2285
+ throw new Error("Validation context must contain $now");
2286
+ }
2287
+ const { days, clause } = schema;
2288
+ if (typeof data !== "string") {
2289
+ return false;
2290
+ }
2291
+ const date = new Date(data);
2292
+ if (isNaN(date.getTime())) {
2293
+ return false;
2294
+ }
2295
+ const now = new Date(dataContext.rootData.$now);
2296
+ const offsetDate = new Date(now.getTime() + days * 24 * 60 * 60 * 1e3);
2297
+ return clause === "after" ? (0, import_date_fns.isAfter)(date, offsetDate) : (0, import_date_fns.isBefore)(date, offsetDate);
2298
+ }
2299
+ });
2144
2300
  function validate(schema, data) {
2145
2301
  return ajv.validate(schema, data);
2146
2302
  }
@@ -2206,7 +2362,7 @@ var errorMessages = {
2206
2362
  id: "v2.error.invalidEmail"
2207
2363
  },
2208
2364
  requiredField: {
2209
- defaultMessage: "Required for registration",
2365
+ defaultMessage: "Required",
2210
2366
  description: "Error message when required field is missing",
2211
2367
  id: "v2.error.required"
2212
2368
  },
@@ -2219,6 +2375,11 @@ var errorMessages = {
2219
2375
  defaultMessage: "Unexpected field",
2220
2376
  description: "Error message when field is not expected",
2221
2377
  id: "v2.error.unexpectedField"
2378
+ },
2379
+ correctionNotAllowed: {
2380
+ defaultMessage: "Correction not allowed for field",
2381
+ description: "Error message when correction is not allowed for field",
2382
+ id: "v2.error.correctionNotAllowed"
2222
2383
  }
2223
2384
  };
2224
2385
  function createIntlError(message) {
@@ -2279,13 +2440,8 @@ function validateFieldInput({
2279
2440
  field: field2,
2280
2441
  value
2281
2442
  }) {
2282
- const rawError = mapFieldTypeToZod(field2.type, field2.required).safeParse(
2283
- value,
2284
- {
2285
- // @ts-expect-error
2286
- errorMap: zodToIntlErrorMap
2287
- }
2288
- );
2443
+ const zodType = mapFieldTypeToZod(field2.type, field2.required);
2444
+ const rawError = zodType.safeParse(value, { errorMap: zodToIntlErrorMap });
2289
2445
  return rawError.error?.issues.map((issue) => issue.message) ?? [];
2290
2446
  }
2291
2447
  function runFieldValidations({
@@ -2366,6 +2522,7 @@ function joinValues(values, separator = " ") {
2366
2522
  }
2367
2523
 
2368
2524
  // ../commons/src/events/utils.ts
2525
+ var import_date_fns2 = require("date-fns");
2369
2526
  function isDeclarationActionConfig(action) {
2370
2527
  return DeclarationActions.safeParse(action.type).success;
2371
2528
  }
@@ -2378,12 +2535,18 @@ function getDeclarationPages(configuration) {
2378
2535
  function getDeclaration(configuration) {
2379
2536
  return configuration.declaration;
2380
2537
  }
2538
+ function getPrintCertificatePages(configuration) {
2539
+ const action = configuration.actions.find(
2540
+ (a) => a.type === ActionType.PRINT_CERTIFICATE
2541
+ );
2542
+ return getOrThrow(
2543
+ action?.printForm.pages,
2544
+ `${ActionType.PRINT_CERTIFICATE} action does not have print form set.`
2545
+ );
2546
+ }
2381
2547
  var getActionAnnotationFields = (actionConfig) => {
2382
2548
  if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
2383
- return [
2384
- ...actionConfig.onboardingForm.flatMap(({ fields }) => fields),
2385
- ...actionConfig.additionalDetailsForm.flatMap(({ fields }) => fields)
2386
- ];
2549
+ return actionConfig.correctionForm.pages.flatMap(({ fields }) => fields);
2387
2550
  }
2388
2551
  if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
2389
2552
  return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
@@ -2406,7 +2569,7 @@ function getDeclarationFieldById(config, fieldId) {
2406
2569
  var findRecordActionPages = (config, actionType) => {
2407
2570
  const action = config.actions.find((a) => a.type === actionType);
2408
2571
  if (action?.type === ActionType.REQUEST_CORRECTION) {
2409
- return [...action.onboardingForm, ...action.additionalDetailsForm];
2572
+ return action.correctionForm.pages;
2410
2573
  }
2411
2574
  if (action?.type === ActionType.PRINT_CERTIFICATE) {
2412
2575
  return action.printForm.pages;
@@ -2480,13 +2643,10 @@ function getVisibleVerificationPageIds(pages, annotation) {
2480
2643
  }
2481
2644
  function getActionVerificationPageIds(actionConfig, annotation) {
2482
2645
  if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
2483
- return [
2484
- ...getVisibleVerificationPageIds(actionConfig.onboardingForm, annotation),
2485
- ...getVisibleVerificationPageIds(
2486
- actionConfig.additionalDetailsForm,
2487
- annotation
2488
- )
2489
- ];
2646
+ return getVisibleVerificationPageIds(
2647
+ actionConfig.correctionForm.pages,
2648
+ annotation
2649
+ );
2490
2650
  }
2491
2651
  if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
2492
2652
  return getVisibleVerificationPageIds(
@@ -2565,12 +2725,33 @@ function getEventConfigById(eventConfigs, id) {
2565
2725
  );
2566
2726
  return getOrThrow(eventConfig, `Event config for ${id} not found`);
2567
2727
  }
2728
+ function timePeriodToDateRange(value) {
2729
+ let startDate;
2730
+ switch (value) {
2731
+ case "last7Days":
2732
+ startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 7);
2733
+ break;
2734
+ case "last30Days":
2735
+ startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 30);
2736
+ break;
2737
+ case "last90Days":
2738
+ startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 90);
2739
+ break;
2740
+ case "last365Days":
2741
+ startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 365);
2742
+ break;
2743
+ }
2744
+ return {
2745
+ startDate: startDate.toISOString(),
2746
+ endDate: (/* @__PURE__ */ new Date()).toISOString()
2747
+ };
2748
+ }
2568
2749
 
2569
2750
  // ../commons/src/events/EventConfig.ts
2570
- var import_zod_openapi8 = require("zod-openapi");
2571
- (0, import_zod_openapi8.extendZodWithOpenApi)(import_zod20.z);
2572
- var EventConfig = import_zod20.z.object({
2573
- id: import_zod20.z.string().describe(
2751
+ var import_zod_openapi9 = require("zod-openapi");
2752
+ (0, import_zod_openapi9.extendZodWithOpenApi)(import_zod21.z);
2753
+ var EventConfig = import_zod21.z.object({
2754
+ id: import_zod21.z.string().describe(
2574
2755
  'A machine-readable identifier for the event, e.g. "birth" or "death"'
2575
2756
  ),
2576
2757
  dateOfEvent: FieldReference.optional(),
@@ -2580,10 +2761,10 @@ var EventConfig = import_zod20.z.object({
2580
2761
  ),
2581
2762
  summary: SummaryConfig,
2582
2763
  label: TranslationConfig,
2583
- actions: import_zod20.z.array(ActionConfig),
2764
+ actions: import_zod21.z.array(ActionConfig),
2584
2765
  declaration: DeclarationFormConfig,
2585
- deduplication: import_zod20.z.array(DeduplicationConfig).optional().default([]),
2586
- advancedSearch: import_zod20.z.array(AdvancedSearchConfig).optional().default([])
2766
+ deduplication: import_zod21.z.array(DeduplicationConfig).optional().default([]),
2767
+ advancedSearch: import_zod21.z.array(AdvancedSearchConfig).optional().default([])
2587
2768
  }).superRefine((event2, ctx) => {
2588
2769
  const allFields = findAllFields(event2);
2589
2770
  const fieldIds = allFields.map((field2) => field2.id);
@@ -2615,6 +2796,28 @@ var EventConfig = import_zod20.z.object({
2615
2796
  path: ["advancedSearch"]
2616
2797
  });
2617
2798
  }
2799
+ event2.advancedSearch.forEach((section, sectionIndex) => {
2800
+ section.fields.forEach((field2, fieldIndex) => {
2801
+ if ("alternateFieldIds" in field2 && Array.isArray(field2.alternateFieldIds)) {
2802
+ const invalidAltIds = field2.alternateFieldIds.filter(
2803
+ (id) => !fieldIds.includes(id)
2804
+ );
2805
+ if (invalidAltIds.length > 0) {
2806
+ ctx.addIssue({
2807
+ code: "custom",
2808
+ message: `Invalid alternateFieldIds: ${invalidAltIds.join(", ")}`,
2809
+ path: [
2810
+ "advancedSearch",
2811
+ sectionIndex,
2812
+ "fields",
2813
+ fieldIndex,
2814
+ "alternateFieldIds"
2815
+ ]
2816
+ });
2817
+ }
2818
+ }
2819
+ });
2820
+ });
2618
2821
  if (event2.dateOfEvent) {
2619
2822
  const eventDateFieldId = getDeclarationFields(event2).find(
2620
2823
  ({ id }) => id === event2.dateOfEvent?.$$field
@@ -2645,16 +2848,17 @@ var definePage = (page) => PageConfig.parse(page);
2645
2848
  var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
2646
2849
 
2647
2850
  // ../commons/src/events/WorkqueueConfig.ts
2648
- var import_zod27 = require("zod");
2851
+ var import_zod28 = require("zod");
2649
2852
 
2650
2853
  // ../commons/src/events/serializers/user/serializer.ts
2651
- var import_zod21 = require("zod");
2652
- var SerializedUserField = import_zod21.z.object({
2653
- $userField: import_zod21.z.enum([
2854
+ var import_zod22 = require("zod");
2855
+ var SerializedUserField = import_zod22.z.object({
2856
+ $userField: import_zod22.z.enum([
2654
2857
  "id",
2655
2858
  "name",
2656
2859
  "role",
2657
- "signatureFilename",
2860
+ "signature",
2861
+ "avatar",
2658
2862
  "primaryOfficeId"
2659
2863
  ])
2660
2864
  });
@@ -2726,41 +2930,6 @@ var user = Object.assign(userSerializer, {
2726
2930
  required: ["$user"]
2727
2931
  })
2728
2932
  });
2729
- function createEventConditionals() {
2730
- return {
2731
- /**
2732
- * Checks if the event contains a specific action type.
2733
- * @param action - The action type to check for.
2734
- */
2735
- hasAction: (action) => defineConditional({
2736
- type: "object",
2737
- properties: {
2738
- $event: {
2739
- type: "object",
2740
- properties: {
2741
- actions: {
2742
- type: "array",
2743
- contains: {
2744
- type: "object",
2745
- properties: {
2746
- type: {
2747
- const: action
2748
- }
2749
- },
2750
- required: ["type"]
2751
- }
2752
- }
2753
- },
2754
- required: ["actions"]
2755
- }
2756
- },
2757
- required: ["$event"]
2758
- })
2759
- };
2760
- }
2761
- function getDateFromNow(days) {
2762
- return new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
2763
- }
2764
2933
  function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
2765
2934
  return {
2766
2935
  type: "object",
@@ -2779,6 +2948,20 @@ function isFieldReference(value) {
2779
2948
  return typeof value === "object" && value !== null && "$$field" in value;
2780
2949
  }
2781
2950
  function createFieldConditionals(fieldId) {
2951
+ const getDayRange = (days, clause) => ({
2952
+ type: "object",
2953
+ properties: {
2954
+ [fieldId]: {
2955
+ type: "string",
2956
+ format: "date",
2957
+ daysFromNow: {
2958
+ days,
2959
+ clause
2960
+ }
2961
+ }
2962
+ },
2963
+ required: [fieldId]
2964
+ });
2782
2965
  const getDateRange = (date, clause) => ({
2783
2966
  type: "object",
2784
2967
  properties: {
@@ -2797,12 +2980,8 @@ function createFieldConditionals(fieldId) {
2797
2980
  $$field: fieldId,
2798
2981
  isAfter: () => ({
2799
2982
  days: (days) => ({
2800
- inPast: () => defineFormConditional(
2801
- getDateRange(getDateFromNow(days), "formatMinimum")
2802
- ),
2803
- inFuture: () => defineFormConditional(
2804
- getDateRange(getDateFromNow(-days), "formatMinimum")
2805
- )
2983
+ inPast: () => defineFormConditional(getDayRange(-days, "after")),
2984
+ inFuture: () => defineFormConditional(getDayRange(days, "after"))
2806
2985
  }),
2807
2986
  date: (date) => {
2808
2987
  if (isFieldReference(date)) {
@@ -2817,16 +2996,12 @@ function createFieldConditionals(fieldId) {
2817
2996
  }
2818
2997
  return defineFormConditional(getDateRange(date, "formatMinimum"));
2819
2998
  },
2820
- now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMinimum"))
2999
+ now: () => defineFormConditional(getDateRange({ $data: "/$now" }, "formatMinimum"))
2821
3000
  }),
2822
3001
  isBefore: () => ({
2823
3002
  days: (days) => ({
2824
- inPast: () => defineFormConditional(
2825
- getDateRange(getDateFromNow(days), "formatMaximum")
2826
- ),
2827
- inFuture: () => defineFormConditional(
2828
- getDateRange(getDateFromNow(-days), "formatMaximum")
2829
- )
3003
+ inPast: () => defineFormConditional(getDayRange(days, "before")),
3004
+ inFuture: () => defineFormConditional(getDayRange(-days, "before"))
2830
3005
  }),
2831
3006
  date: (date) => {
2832
3007
  if (isFieldReference(date)) {
@@ -2841,7 +3016,7 @@ function createFieldConditionals(fieldId) {
2841
3016
  }
2842
3017
  return defineFormConditional(getDateRange(date, "formatMaximum"));
2843
3018
  },
2844
- now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMaximum"))
3019
+ now: () => defineFormConditional(getDateRange({ $data: "/$now" }, "formatMaximum"))
2845
3020
  }),
2846
3021
  isEqualTo: (value) => {
2847
3022
  if (isFieldReference(value)) {
@@ -2930,11 +3105,10 @@ function createFieldConditionals(fieldId) {
2930
3105
  properties: {
2931
3106
  [fieldId]: {
2932
3107
  type: "string",
2933
- pattern: "^[\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*( [\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*)*$",
2934
- description: "Name must contain only letters, numbers, and allowed special characters ('._-). No double spaces."
3108
+ pattern: "^[\\p{Script=Latin}0-9'.-]*(\\([\\p{Script=Latin}0-9'.-]+\\))?[\\p{Script=Latin}0-9'.-]*( [\\p{Script=Latin}0-9'.-]*(\\([\\p{Script=Latin}0-9'.-]+\\))?[\\p{Script=Latin}0-9'.-]*)*$",
3109
+ description: "Name must contain only letters, numbers, and allowed special characters ('.-). No double spaces."
2935
3110
  }
2936
- },
2937
- required: [fieldId]
3111
+ }
2938
3112
  }),
2939
3113
  /**
2940
3114
  * Checks if the field value matches a given regular expression pattern.
@@ -2990,7 +3164,7 @@ function createSearchConfig(baseField) {
2990
3164
  *
2991
3165
  * @returns An object containing the field ID and a configuration object with a type of 'range'.
2992
3166
  *
2993
- * @example event('legalStatus.REGISTERED.createdAt').range()
3167
+ * @example event('legalStatuses.REGISTERED.acceptedAt').range()
2994
3168
  * // {
2995
3169
  * // ...
2996
3170
  * // config: { type: 'range' }
@@ -3025,26 +3199,65 @@ function createSearchConfig(baseField) {
3025
3199
  fuzzy: () => ({
3026
3200
  ...baseField,
3027
3201
  config: { type: "fuzzy" }
3202
+ }),
3203
+ /**
3204
+ * Creates a configuration for matching locations and the child locations
3205
+ * @returns An object containing the field ID and a configuration object with a type of 'within'.
3206
+ * @example field('createdAtLocation').within()
3207
+ * // {
3208
+ * // ...
3209
+ * // config: { type: 'within' }
3210
+ * // }
3211
+ */
3212
+ within: () => ({
3213
+ ...baseField,
3214
+ config: { type: "within" }
3028
3215
  })
3029
3216
  };
3030
3217
  }
3031
3218
 
3032
3219
  // ../commons/src/event-config/event-configuration.ts
3033
- function createEventFieldConfig(fieldId, options) {
3220
+ function createEventFieldConfig(fieldId) {
3034
3221
  const baseField = {
3035
- fieldId,
3036
- options,
3222
+ fieldId: `${METADATA_FIELD_PREFIX}${fieldId}`,
3037
3223
  fieldType: "event"
3038
3224
  };
3039
3225
  return createSearchConfig(baseField);
3040
3226
  }
3041
3227
 
3042
3228
  // ../commons/src/events/event.ts
3043
- function eventFn(fieldId, options) {
3044
- return createEventFieldConfig(fieldId, options);
3229
+ function eventFn(fieldId) {
3230
+ return createEventFieldConfig(fieldId);
3045
3231
  }
3046
3232
  var event = Object.assign(eventFn, {
3047
- ...createEventConditionals(),
3233
+ /**
3234
+ * Checks if the event contains a specific action type.
3235
+ * @param action - The action type to check for.
3236
+ */
3237
+ hasAction: (action) => defineConditional({
3238
+ type: "object",
3239
+ properties: {
3240
+ $event: {
3241
+ type: "object",
3242
+ properties: {
3243
+ actions: {
3244
+ type: "array",
3245
+ contains: {
3246
+ type: "object",
3247
+ properties: {
3248
+ type: {
3249
+ const: action
3250
+ }
3251
+ },
3252
+ required: ["type"]
3253
+ }
3254
+ }
3255
+ },
3256
+ required: ["actions"]
3257
+ }
3258
+ },
3259
+ required: ["$event"]
3260
+ }),
3048
3261
  field(field2) {
3049
3262
  return {
3050
3263
  $event: field2
@@ -3053,83 +3266,82 @@ var event = Object.assign(eventFn, {
3053
3266
  });
3054
3267
 
3055
3268
  // ../commons/src/events/WorkqueueColumnConfig.ts
3056
- var import_zod23 = require("zod");
3269
+ var import_zod24 = require("zod");
3057
3270
 
3058
3271
  // ../commons/src/events/EventMetadata.ts
3059
- var import_zod22 = require("zod");
3060
- var EventStatus = import_zod22.z.enum([
3272
+ var import_zod23 = require("zod");
3273
+ var EventStatus = import_zod23.z.enum([
3061
3274
  "CREATED",
3062
3275
  "NOTIFIED",
3063
3276
  "DECLARED",
3064
3277
  "VALIDATED",
3065
3278
  "REGISTERED",
3066
- "CERTIFIED",
3067
- "REJECTED",
3068
3279
  "ARCHIVED"
3069
3280
  ]);
3070
3281
  var InherentFlags = {
3071
- PRINTED: "printed",
3282
+ PENDING_CERTIFICATION: "pending-certification",
3072
3283
  INCOMPLETE: "incomplete",
3073
3284
  REJECTED: "rejected",
3074
3285
  CORRECTION_REQUESTED: "correction-requested"
3075
3286
  };
3076
- var Flag = import_zod22.z.string().regex(
3287
+ var ActionFlag = import_zod23.z.string().regex(
3077
3288
  new RegExp(
3078
3289
  `^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
3079
3290
  ActionStatus
3080
3291
  ).join("|").toLowerCase()})$`
3081
3292
  ),
3082
3293
  "Flag must be in the format ActionType:ActionStatus (lowerCase)"
3083
- ).or(import_zod22.z.nativeEnum(InherentFlags));
3084
- var ZodDate = import_zod22.z.string().date();
3085
- var ActionCreationMetadata = import_zod22.z.object({
3086
- createdAt: import_zod22.z.string().datetime().describe("The timestamp when the action request was created."),
3087
- createdBy: import_zod22.z.string().describe("ID of the user who created the action request."),
3294
+ );
3295
+ var Flag = ActionFlag.or(import_zod23.z.nativeEnum(InherentFlags));
3296
+ var ZodDate = import_zod23.z.string().date();
3297
+ var ActionCreationMetadata = import_zod23.z.object({
3298
+ createdAt: import_zod23.z.string().datetime().describe("The timestamp when the action request was created."),
3299
+ createdBy: import_zod23.z.string().describe("ID of the user who created the action request."),
3088
3300
  createdAtLocation: CreatedAtLocation.describe(
3089
3301
  "Location of the user who created the action request."
3090
3302
  ),
3091
- createdByUserType: import_zod22.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
3092
- acceptedAt: import_zod22.z.string().datetime().describe("Timestamp when the action request was accepted."),
3093
- createdByRole: import_zod22.z.string().describe("Role of the user at the time of action request creation."),
3094
- createdBySignature: import_zod22.z.string().nullish().describe("Signature of the user who created the action request.")
3303
+ createdByUserType: import_zod23.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
3304
+ acceptedAt: import_zod23.z.string().datetime().describe("Timestamp when the action request was accepted."),
3305
+ createdByRole: import_zod23.z.string().describe("Role of the user at the time of action request creation."),
3306
+ createdBySignature: import_zod23.z.string().nullish().describe("Signature of the user who created the action request.")
3095
3307
  });
3096
3308
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
3097
- registrationNumber: import_zod22.z.string().describe(
3309
+ registrationNumber: import_zod23.z.string().describe(
3098
3310
  "Registration number of the event. Always present for accepted registrations."
3099
3311
  )
3100
3312
  });
3101
- var LegalStatuses = import_zod22.z.object({
3313
+ var LegalStatuses = import_zod23.z.object({
3102
3314
  [EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
3103
3315
  [EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
3104
3316
  });
3105
- var EventMetadata = import_zod22.z.object({
3317
+ var EventMetadata = import_zod23.z.object({
3106
3318
  id: UUID,
3107
- type: import_zod22.z.string().describe("The type of event, such as birth, death, or marriage."),
3319
+ type: import_zod23.z.string().describe("The type of event, such as birth, death, or marriage."),
3108
3320
  status: EventStatus,
3109
3321
  legalStatuses: LegalStatuses.describe(
3110
3322
  "Metadata related to the legal registration of the event, such as who registered it and when."
3111
3323
  ),
3112
- createdAt: import_zod22.z.string().datetime().describe("The timestamp when the event was first created and saved."),
3324
+ createdAt: import_zod23.z.string().datetime().describe("The timestamp when the event was first created and saved."),
3113
3325
  dateOfEvent: ZodDate.nullish(),
3114
- createdBy: import_zod22.z.string().describe("ID of the user who created the event."),
3115
- createdByUserType: import_zod22.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
3116
- updatedByUserRole: import_zod22.z.string().describe("Role of the user who last changed the status."),
3326
+ createdBy: import_zod23.z.string().describe("ID of the user who created the event."),
3327
+ createdByUserType: import_zod23.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
3328
+ updatedByUserRole: import_zod23.z.string().describe("Role of the user who last changed the status."),
3117
3329
  createdAtLocation: CreatedAtLocation.describe(
3118
3330
  "Location of the user who created the event."
3119
3331
  ),
3120
- createdBySignature: import_zod22.z.string().nullish().describe("Signature of the user who created the event."),
3332
+ createdBySignature: import_zod23.z.string().nullish().describe("Signature of the user who created the event."),
3121
3333
  updatedAtLocation: UUID.nullish().describe(
3122
3334
  "Location of the user who last changed the status."
3123
3335
  ),
3124
- updatedAt: import_zod22.z.string().datetime().describe(
3336
+ updatedAt: import_zod23.z.string().datetime().describe(
3125
3337
  "Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
3126
3338
  ),
3127
- assignedTo: import_zod22.z.string().nullish().describe("ID of the user currently assigned to the event."),
3128
- updatedBy: import_zod22.z.string().nullish().describe("ID of the user who last changed the status."),
3129
- trackingId: import_zod22.z.string().describe(
3339
+ assignedTo: import_zod23.z.string().nullish().describe("ID of the user currently assigned to the event."),
3340
+ updatedBy: import_zod23.z.string().nullish().describe("ID of the user who last changed the status."),
3341
+ trackingId: import_zod23.z.string().describe(
3130
3342
  "System-generated tracking ID used by informants or registrars to look up the event."
3131
3343
  ),
3132
- flags: import_zod22.z.array(Flag)
3344
+ flags: import_zod23.z.array(Flag)
3133
3345
  });
3134
3346
  var EventMetadataKeysArray = [
3135
3347
  "id",
@@ -3149,7 +3361,7 @@ var EventMetadataKeysArray = [
3149
3361
  "legalStatuses",
3150
3362
  "flags"
3151
3363
  ];
3152
- var EventMetadataKeys = import_zod22.z.enum(EventMetadataKeysArray);
3364
+ var EventMetadataKeys = import_zod23.z.enum(EventMetadataKeysArray);
3153
3365
  var eventMetadataLabelMap = {
3154
3366
  "event.assignedTo": {
3155
3367
  id: "event.assignedTo.label",
@@ -3234,11 +3446,11 @@ var WorkqueueColumnKeysArray = [
3234
3446
  "title",
3235
3447
  "outbox"
3236
3448
  ];
3237
- var WorkqueueColumnKeys = import_zod23.z.enum(WorkqueueColumnKeysArray);
3238
- var WorkqueueColumnValue = import_zod23.z.object({
3449
+ var WorkqueueColumnKeys = import_zod24.z.enum(WorkqueueColumnKeysArray);
3450
+ var WorkqueueColumnValue = import_zod24.z.object({
3239
3451
  $event: WorkqueueColumnKeys
3240
3452
  });
3241
- var WorkqueueColumn = import_zod23.z.object({
3453
+ var WorkqueueColumn = import_zod24.z.object({
3242
3454
  label: TranslationConfig,
3243
3455
  value: WorkqueueColumnValue
3244
3456
  });
@@ -3249,115 +3461,130 @@ function defineWorkqueuesColumns(workqueueColumns) {
3249
3461
  }
3250
3462
 
3251
3463
  // ../commons/src/events/CountryConfigQueryInput.ts
3252
- var import_zod25 = require("zod");
3464
+ var import_zod26 = require("zod");
3253
3465
 
3254
3466
  // ../commons/src/events/EventIndex.ts
3255
- var import_zod24 = require("zod");
3256
- var import_zod_openapi9 = require("zod-openapi");
3257
- (0, import_zod_openapi9.extendZodWithOpenApi)(import_zod24.z);
3467
+ var import_zod25 = require("zod");
3468
+ var import_zod_openapi10 = require("zod-openapi");
3469
+ (0, import_zod_openapi10.extendZodWithOpenApi)(import_zod25.z);
3258
3470
  var EventIndex = EventMetadata.extend({
3259
3471
  declaration: EventState
3260
3472
  }).openapi({
3261
3473
  ref: "EventIndex"
3262
3474
  });
3263
- var EventSearchIndex = import_zod24.z.record(import_zod24.z.string(), import_zod24.z.any()).and(
3264
- import_zod24.z.object({
3265
- type: import_zod24.z.string()
3475
+ var EventSearchIndex = import_zod25.z.record(import_zod25.z.string(), import_zod25.z.any()).and(
3476
+ import_zod25.z.object({
3477
+ type: import_zod25.z.string()
3266
3478
  // Ensures "type" (event-id) exists and is a string
3267
3479
  })
3268
3480
  ).openapi({
3269
3481
  ref: "EventSearchIndex"
3270
3482
  });
3271
- var Fuzzy = import_zod24.z.object({ type: import_zod24.z.literal("fuzzy"), term: import_zod24.z.string() }).openapi({
3483
+ var Fuzzy = import_zod25.z.object({ type: import_zod25.z.literal("fuzzy"), term: import_zod25.z.string() }).openapi({
3272
3484
  ref: "Fuzzy"
3273
3485
  });
3274
- var Exact = import_zod24.z.object({ type: import_zod24.z.literal("exact"), term: import_zod24.z.string() }).openapi({
3486
+ var Exact = import_zod25.z.object({ type: import_zod25.z.literal("exact"), term: import_zod25.z.string() }).openapi({
3275
3487
  ref: "Exact"
3276
3488
  });
3277
- var ExactStatus = import_zod24.z.object({
3278
- type: import_zod24.z.literal("exact"),
3489
+ var ExactStatus = import_zod25.z.object({
3490
+ type: import_zod25.z.literal("exact"),
3279
3491
  term: EventStatus
3280
3492
  }).openapi({
3281
3493
  ref: "ExactStatus"
3282
3494
  });
3283
- var AnyOf = import_zod24.z.object({
3284
- type: import_zod24.z.literal("anyOf"),
3285
- terms: import_zod24.z.array(import_zod24.z.string())
3495
+ var ExactUserType = import_zod25.z.object({
3496
+ type: import_zod25.z.literal("exact"),
3497
+ term: TokenUserType
3498
+ }).openapi({
3499
+ ref: "ExactUserType"
3500
+ });
3501
+ var AnyOf = import_zod25.z.object({
3502
+ type: import_zod25.z.literal("anyOf"),
3503
+ terms: import_zod25.z.array(import_zod25.z.string())
3286
3504
  }).openapi({
3287
3505
  ref: "AnyOf"
3288
3506
  });
3289
- var AnyOfStatus = import_zod24.z.object({
3290
- type: import_zod24.z.literal("anyOf"),
3291
- terms: import_zod24.z.array(EventStatus)
3507
+ var AnyOfStatus = import_zod25.z.object({
3508
+ type: import_zod25.z.literal("anyOf"),
3509
+ terms: import_zod25.z.array(EventStatus)
3292
3510
  }).openapi({
3293
3511
  ref: "AnyOfStatus"
3294
3512
  });
3295
- var Range = import_zod24.z.object({
3296
- type: import_zod24.z.literal("range"),
3297
- gte: import_zod24.z.string(),
3298
- lte: import_zod24.z.string()
3513
+ var Range = import_zod25.z.object({
3514
+ type: import_zod25.z.literal("range"),
3515
+ gte: import_zod25.z.string(),
3516
+ lte: import_zod25.z.string()
3299
3517
  }).openapi({
3300
3518
  ref: "Range"
3301
3519
  });
3302
- var ContainsFlags = import_zod24.z.object({
3303
- anyOf: import_zod24.z.array(Flag).optional(),
3304
- noneOf: import_zod24.z.array(Flag).optional()
3520
+ var ContainsFlags = import_zod25.z.object({
3521
+ anyOf: import_zod25.z.array(Flag).optional(),
3522
+ noneOf: import_zod25.z.array(Flag).optional()
3305
3523
  }).openapi({
3306
3524
  ref: "ContainsFlags"
3307
3525
  });
3308
- var Within = import_zod24.z.object({ type: import_zod24.z.literal("within"), location: import_zod24.z.string() }).openapi({
3526
+ var Within = import_zod25.z.object({ type: import_zod25.z.literal("within"), location: import_zod25.z.string() }).openapi({
3309
3527
  ref: "Within"
3310
3528
  });
3311
- var RangeDate = Range.extend({
3312
- gte: import_zod24.z.string().date().or(import_zod24.z.string().datetime()),
3313
- lte: import_zod24.z.string().date().or(import_zod24.z.string().datetime())
3314
- }).openapi({
3315
- ref: "RangeDate"
3316
- });
3529
+ var RangeDate = import_zod25.z.object({
3530
+ type: import_zod25.z.literal("range"),
3531
+ gte: import_zod25.z.string().date().or(import_zod25.z.string().datetime()),
3532
+ lte: import_zod25.z.string().date().or(import_zod25.z.string().datetime())
3533
+ }).openapi({ ref: "RangeDate" });
3317
3534
  var ExactDate = Exact.extend({
3318
- term: import_zod24.z.string().date().or(import_zod24.z.string().datetime())
3535
+ term: import_zod25.z.string().date().or(import_zod25.z.string().datetime())
3319
3536
  }).openapi({
3320
3537
  ref: "ExactDate"
3321
3538
  });
3322
- var DateCondition = import_zod24.z.union([ExactDate, RangeDate]).openapi({
3539
+ var TimePeriod = import_zod25.z.object({
3540
+ type: import_zod25.z.literal("timePeriod"),
3541
+ term: SelectDateRangeValue
3542
+ }).openapi({
3543
+ ref: "TimePeriod"
3544
+ });
3545
+ var DateCondition = import_zod25.z.union([ExactDate, RangeDate, TimePeriod]).openapi({
3323
3546
  ref: "DateCondition"
3324
3547
  });
3325
- var QueryInput = import_zod24.z.lazy(
3326
- () => import_zod24.z.union([
3327
- import_zod24.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf]),
3328
- import_zod24.z.record(import_zod24.z.string(), QueryInput)
3548
+ var QueryInput = import_zod25.z.lazy(
3549
+ () => import_zod25.z.union([
3550
+ import_zod25.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf]),
3551
+ import_zod25.z.record(import_zod25.z.string(), QueryInput)
3329
3552
  ])
3330
3553
  ).openapi({
3331
3554
  ref: "QueryInput"
3332
3555
  });
3333
- var QueryExpression = import_zod24.z.object({
3334
- id: import_zod24.z.optional(import_zod24.z.string()),
3335
- eventType: import_zod24.z.string(),
3336
- status: import_zod24.z.optional(import_zod24.z.union([AnyOfStatus, ExactStatus])),
3337
- createdAt: import_zod24.z.optional(DateCondition),
3338
- updatedAt: import_zod24.z.optional(DateCondition),
3339
- "legalStatus.REGISTERED.createdAt": import_zod24.z.optional(DateCondition),
3340
- "legalStatus.REGISTERED.createdAtLocation": import_zod24.z.optional(
3341
- import_zod24.z.union([Within, Exact])
3556
+ var QueryExpression = import_zod25.z.object({
3557
+ id: import_zod25.z.optional(import_zod25.z.string()),
3558
+ eventType: import_zod25.z.string(),
3559
+ status: import_zod25.z.optional(import_zod25.z.union([AnyOfStatus, ExactStatus])),
3560
+ createdAt: import_zod25.z.optional(DateCondition),
3561
+ updatedAt: import_zod25.z.optional(DateCondition),
3562
+ "legalStatuses.REGISTERED.acceptedAt": import_zod25.z.optional(DateCondition),
3563
+ "legalStatuses.DECLARED.createdAtLocation": import_zod25.z.optional(
3564
+ import_zod25.z.union([Within, Exact])
3342
3565
  ),
3343
- "legalStatus.REGISTERED.registrationNumber": import_zod24.z.optional(Exact),
3344
- createdAtLocation: import_zod24.z.optional(import_zod24.z.union([Within, Exact])),
3345
- updatedAtLocation: import_zod24.z.optional(import_zod24.z.union([Within, Exact])),
3346
- assignedTo: import_zod24.z.optional(Exact),
3347
- createdByUserType: TokenUserType,
3348
- createdBy: import_zod24.z.optional(Exact),
3349
- updatedBy: import_zod24.z.optional(Exact),
3350
- trackingId: import_zod24.z.optional(Exact),
3351
- flags: import_zod24.z.optional(ContainsFlags),
3566
+ "legalStatuses.REGISTERED.createdAtLocation": import_zod25.z.optional(
3567
+ import_zod25.z.union([Within, Exact])
3568
+ ),
3569
+ "legalStatuses.REGISTERED.registrationNumber": import_zod25.z.optional(Exact),
3570
+ createdAtLocation: import_zod25.z.optional(import_zod25.z.union([Within, Exact])),
3571
+ updatedAtLocation: import_zod25.z.optional(import_zod25.z.union([Within, Exact])),
3572
+ assignedTo: import_zod25.z.optional(Exact),
3573
+ createdByUserType: import_zod25.z.optional(ExactUserType),
3574
+ createdBy: import_zod25.z.optional(Exact),
3575
+ updatedBy: import_zod25.z.optional(Exact),
3576
+ trackingId: import_zod25.z.optional(Exact),
3577
+ flags: import_zod25.z.optional(ContainsFlags),
3578
+ // @todo: The type for this comes out as "any"
3352
3579
  data: QueryInput
3353
3580
  }).partial().refine((obj) => Object.values(obj).some((val) => val !== void 0), {
3354
3581
  message: "At least one query field must be specified."
3355
3582
  }).openapi({
3356
3583
  ref: "QueryExpression"
3357
3584
  });
3358
- var QueryType = import_zod24.z.object({
3359
- type: import_zod24.z.literal("and").or(import_zod24.z.literal("or")).openapi({ default: "and" }),
3360
- clauses: import_zod24.z.preprocess(
3585
+ var QueryType = import_zod25.z.object({
3586
+ type: import_zod25.z.literal("and").or(import_zod25.z.literal("or")).openapi({ default: "and" }),
3587
+ clauses: import_zod25.z.preprocess(
3361
3588
  (val) => {
3362
3589
  if (typeof val === "string") {
3363
3590
  return [JSON.parse(val)];
@@ -3367,7 +3594,7 @@ var QueryType = import_zod24.z.object({
3367
3594
  }
3368
3595
  return val;
3369
3596
  },
3370
- import_zod24.z.array(QueryExpression).nonempty("At least one clause is required.").openapi({
3597
+ import_zod25.z.array(QueryExpression).nonempty("At least one clause is required.").openapi({
3371
3598
  default: [
3372
3599
  {
3373
3600
  eventType: TENNIS_CLUB_MEMBERSHIP,
@@ -3388,58 +3615,62 @@ var QueryType = import_zod24.z.object({
3388
3615
  }).openapi({
3389
3616
  ref: "QueryType"
3390
3617
  });
3618
+ var SearchScopeAccessLevels = {
3619
+ MY_JURISDICTION: "my-jurisdiction",
3620
+ ALL: "all"
3621
+ };
3391
3622
 
3392
3623
  // ../commons/src/events/CountryConfigQueryInput.ts
3393
- var SerializableExact = import_zod25.z.object({
3394
- type: import_zod25.z.literal("exact"),
3395
- term: import_zod25.z.union([import_zod25.z.string(), SerializedUserField])
3624
+ var SerializableExact = import_zod26.z.object({
3625
+ type: import_zod26.z.literal("exact"),
3626
+ term: import_zod26.z.union([import_zod26.z.string(), SerializedUserField])
3396
3627
  });
3397
- var SerializableWithin = import_zod25.z.object({
3398
- type: import_zod25.z.literal("within"),
3399
- location: import_zod25.z.union([import_zod25.z.string(), SerializedUserField])
3628
+ var SerializableWithin = import_zod26.z.object({
3629
+ type: import_zod26.z.literal("within"),
3630
+ location: import_zod26.z.union([import_zod26.z.string(), SerializedUserField])
3400
3631
  });
3401
- var SerializedQueryExpression = import_zod25.z.object({
3402
- eventType: import_zod25.z.string(),
3403
- status: import_zod25.z.optional(import_zod25.z.union([AnyOfStatus, ExactStatus])),
3404
- createdAt: import_zod25.z.optional(DateCondition),
3405
- updatedAt: import_zod25.z.optional(DateCondition),
3406
- "legalStatus.REGISTERED.createdAt": import_zod25.z.optional(DateCondition),
3407
- "legalStatus.REGISTERED.createdAtLocation": import_zod25.z.optional(
3408
- import_zod25.z.union([Within, Exact])
3632
+ var SerializedQueryExpression = import_zod26.z.object({
3633
+ eventType: import_zod26.z.string(),
3634
+ status: import_zod26.z.optional(import_zod26.z.union([AnyOfStatus, ExactStatus])),
3635
+ createdAt: import_zod26.z.optional(DateCondition),
3636
+ updatedAt: import_zod26.z.optional(DateCondition),
3637
+ "legalStatuses.REGISTERED.createdAt": import_zod26.z.optional(DateCondition),
3638
+ "legalStatuses.REGISTERED.createdAtLocation": import_zod26.z.optional(
3639
+ import_zod26.z.union([Within, Exact])
3409
3640
  ),
3410
- "legalStatus.REGISTERED.registrationNumber": import_zod25.z.optional(Exact),
3411
- createdAtLocation: import_zod25.z.optional(
3412
- import_zod25.z.union([SerializableWithin, SerializableExact])
3641
+ "legalStatuses.REGISTERED.registrationNumber": import_zod26.z.optional(Exact),
3642
+ createdAtLocation: import_zod26.z.optional(
3643
+ import_zod26.z.union([SerializableWithin, SerializableExact])
3413
3644
  ),
3414
- updatedAtLocation: import_zod25.z.optional(
3415
- import_zod25.z.union([SerializableWithin, SerializableExact])
3645
+ updatedAtLocation: import_zod26.z.optional(
3646
+ import_zod26.z.union([SerializableWithin, SerializableExact])
3416
3647
  ),
3417
- assignedTo: import_zod25.z.optional(SerializableExact),
3418
- createdBy: import_zod25.z.optional(SerializableExact),
3419
- createdByUserType: TokenUserType,
3420
- updatedBy: import_zod25.z.optional(SerializableExact),
3421
- trackingId: import_zod25.z.optional(Exact),
3422
- flags: import_zod25.z.optional(ContainsFlags),
3648
+ assignedTo: import_zod26.z.optional(SerializableExact),
3649
+ createdBy: import_zod26.z.optional(SerializableExact),
3650
+ createdByUserType: ExactUserType,
3651
+ updatedBy: import_zod26.z.optional(SerializableExact),
3652
+ trackingId: import_zod26.z.optional(Exact),
3653
+ flags: import_zod26.z.optional(ContainsFlags),
3423
3654
  data: QueryInput
3424
3655
  }).partial();
3425
- var Or2 = import_zod25.z.object({
3426
- type: import_zod25.z.literal("or"),
3427
- clauses: import_zod25.z.array(SerializedQueryExpression)
3656
+ var Or2 = import_zod26.z.object({
3657
+ type: import_zod26.z.literal("or"),
3658
+ clauses: import_zod26.z.array(SerializedQueryExpression)
3428
3659
  });
3429
- var And2 = import_zod25.z.object({
3430
- type: import_zod25.z.literal("and"),
3431
- clauses: import_zod25.z.array(SerializedQueryExpression)
3660
+ var And2 = import_zod26.z.object({
3661
+ type: import_zod26.z.literal("and"),
3662
+ clauses: import_zod26.z.array(SerializedQueryExpression)
3432
3663
  });
3433
- var CountryConfigQueryType = import_zod25.z.discriminatedUnion("type", [And2, Or2]);
3434
- var CountryConfigQueryInputType = import_zod25.z.union([
3664
+ var CountryConfigQueryType = import_zod26.z.discriminatedUnion("type", [And2, Or2]);
3665
+ var CountryConfigQueryInputType = import_zod26.z.union([
3435
3666
  SerializedQueryExpression,
3436
3667
  And2,
3437
3668
  Or2
3438
3669
  ]);
3439
3670
 
3440
3671
  // ../commons/src/icons.ts
3441
- var import_zod26 = require("zod");
3442
- var AvailableIcons = import_zod26.z.enum([
3672
+ var import_zod27 = require("zod");
3673
+ var AvailableIcons = import_zod27.z.enum([
3443
3674
  "Archived",
3444
3675
  "Assigned",
3445
3676
  "Certified",
@@ -3477,7 +3708,6 @@ var AvailableIcons = import_zod26.z.enum([
3477
3708
  "Copy",
3478
3709
  "Database",
3479
3710
  "DotsThreeVertical",
3480
- "DownloadSimple",
3481
3711
  "ArrowCounterClockwise",
3482
3712
  "MagnifyingGlassMinus",
3483
3713
  "MagnifyingGlassPlus",
@@ -3561,43 +3791,45 @@ var mandatoryColumns = defineWorkqueuesColumns([
3561
3791
  value: event.field("updatedAt")
3562
3792
  }
3563
3793
  ]);
3564
- var WorkqueueActionsWithDefault = import_zod27.z.enum([
3794
+ var WorkqueueActionsWithDefault = import_zod28.z.enum([
3565
3795
  ...workqueueActions.options,
3566
3796
  "DEFAULT"
3567
3797
  ]);
3568
- var WorkqueueConfig = import_zod27.z.object({
3569
- slug: import_zod27.z.string().describe("Determines the url of the workqueue."),
3798
+ var WorkqueueConfig = import_zod28.z.object({
3799
+ slug: import_zod28.z.string().describe("Determines the url of the workqueue."),
3570
3800
  name: TranslationConfig.describe(
3571
3801
  "Title of the workflow (both in navigation and on the page)"
3572
3802
  ),
3573
3803
  query: CountryConfigQueryType,
3574
- actions: import_zod27.z.array(
3575
- import_zod27.z.object({
3804
+ actions: import_zod28.z.array(
3805
+ import_zod28.z.object({
3576
3806
  type: WorkqueueActionsWithDefault,
3577
- conditionals: import_zod27.z.array(Conditional).optional()
3807
+ conditionals: import_zod28.z.array(Conditional).optional()
3578
3808
  })
3579
3809
  ),
3580
- columns: import_zod27.z.array(WorkqueueColumn).default(mandatoryColumns),
3581
- icon: AvailableIcons
3810
+ columns: import_zod28.z.array(WorkqueueColumn).default(mandatoryColumns),
3811
+ icon: AvailableIcons,
3812
+ emptyMessage: TranslationConfig.optional()
3582
3813
  }).describe("Configuration for workqueue.");
3583
3814
  var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
3584
3815
  query: true,
3585
3816
  columns: true
3586
3817
  });
3587
- var WorkqueueConfigInput = import_zod27.z.object({
3588
- slug: import_zod27.z.string().describe("Determines the url of the workqueue."),
3818
+ var WorkqueueConfigInput = import_zod28.z.object({
3819
+ slug: import_zod28.z.string().describe("Determines the url of the workqueue."),
3589
3820
  name: TranslationConfig.describe(
3590
3821
  "Title of the workflow (both in navigation and on the page)"
3591
3822
  ),
3592
3823
  query: CountryConfigQueryInputType,
3593
- actions: import_zod27.z.array(
3594
- import_zod27.z.object({
3824
+ actions: import_zod28.z.array(
3825
+ import_zod28.z.object({
3595
3826
  type: WorkqueueActionsWithDefault,
3596
- conditionals: import_zod27.z.array(Conditional).optional()
3827
+ conditionals: import_zod28.z.array(Conditional).optional()
3597
3828
  })
3598
3829
  ),
3599
- columns: import_zod27.z.array(WorkqueueColumn).default(mandatoryColumns),
3600
- icon: AvailableIcons
3830
+ columns: import_zod28.z.array(WorkqueueColumn).default(mandatoryColumns),
3831
+ icon: AvailableIcons,
3832
+ emptyMessage: TranslationConfig.optional()
3601
3833
  });
3602
3834
  function defineWorkqueue(workqueueInput) {
3603
3835
  const queryInput = workqueueInput.query;
@@ -3607,10 +3839,10 @@ function defineWorkqueue(workqueueInput) {
3607
3839
  function defineWorkqueues(workqueues) {
3608
3840
  return workqueues.map((workqueue) => defineWorkqueue(workqueue));
3609
3841
  }
3610
- var WorkqueueCountInput = import_zod27.z.array(
3611
- import_zod27.z.object({ slug: import_zod27.z.string(), query: QueryType })
3842
+ var WorkqueueCountInput = import_zod28.z.array(
3843
+ import_zod28.z.object({ slug: import_zod28.z.string(), query: QueryType })
3612
3844
  );
3613
- var WorkqueueCountOutput = import_zod27.z.record(import_zod27.z.string(), import_zod27.z.number());
3845
+ var WorkqueueCountOutput = import_zod28.z.record(import_zod28.z.string(), import_zod28.z.number());
3614
3846
 
3615
3847
  // ../commons/src/events/workqueueDefaultColumns.ts
3616
3848
  var defaultWorkqueueColumns = [
@@ -3633,42 +3865,42 @@ var defaultWorkqueueColumns = [
3633
3865
  ];
3634
3866
 
3635
3867
  // ../commons/src/events/Draft.ts
3636
- var import_zod29 = require("zod");
3868
+ var import_zod30 = require("zod");
3637
3869
 
3638
3870
  // ../commons/src/events/ActionInput.ts
3639
- var import_zod28 = require("zod");
3640
- var import_zod_openapi10 = require("zod-openapi");
3641
- (0, import_zod_openapi10.extendZodWithOpenApi)(import_zod28.z);
3642
- var BaseActionInput = import_zod28.z.object({
3871
+ var import_zod29 = require("zod");
3872
+ var import_zod_openapi11 = require("zod-openapi");
3873
+ (0, import_zod_openapi11.extendZodWithOpenApi)(import_zod29.z);
3874
+ var BaseActionInput = import_zod29.z.object({
3643
3875
  eventId: UUID,
3644
- transactionId: import_zod28.z.string(),
3876
+ transactionId: import_zod29.z.string(),
3645
3877
  declaration: ActionUpdate.default({}),
3646
3878
  annotation: ActionUpdate.optional(),
3647
3879
  originalActionId: UUID.optional(),
3648
3880
  // should not be part of base action.
3649
- keepAssignment: import_zod28.z.boolean().optional()
3881
+ keepAssignment: import_zod29.z.boolean().optional()
3650
3882
  });
3651
3883
  var CreateActionInput = BaseActionInput.merge(
3652
- import_zod28.z.object({
3653
- type: import_zod28.z.literal(ActionType.CREATE).default(ActionType.CREATE),
3884
+ import_zod29.z.object({
3885
+ type: import_zod29.z.literal(ActionType.CREATE).default(ActionType.CREATE),
3654
3886
  createdAtLocation: CreatedAtLocation
3655
3887
  })
3656
3888
  );
3657
3889
  var RegisterActionInput = BaseActionInput.merge(
3658
- import_zod28.z.object({
3659
- type: import_zod28.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
3660
- registrationNumber: import_zod28.z.string().optional()
3890
+ import_zod29.z.object({
3891
+ type: import_zod29.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
3892
+ registrationNumber: import_zod29.z.string().optional()
3661
3893
  })
3662
3894
  ).strict();
3663
3895
  var ValidateActionInput = BaseActionInput.merge(
3664
- import_zod28.z.object({
3665
- type: import_zod28.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
3666
- duplicates: import_zod28.z.array(import_zod28.z.string())
3896
+ import_zod29.z.object({
3897
+ type: import_zod29.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
3898
+ duplicates: import_zod29.z.array(import_zod29.z.string())
3667
3899
  })
3668
3900
  );
3669
3901
  var NotifyActionInput = BaseActionInput.merge(
3670
- import_zod28.z.object({
3671
- type: import_zod28.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
3902
+ import_zod29.z.object({
3903
+ type: import_zod29.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
3672
3904
  })
3673
3905
  ).openapi({
3674
3906
  default: {
@@ -3680,68 +3912,70 @@ var NotifyActionInput = BaseActionInput.merge(
3680
3912
  }
3681
3913
  });
3682
3914
  var DeclareActionInput = BaseActionInput.merge(
3683
- import_zod28.z.object({
3684
- type: import_zod28.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
3915
+ import_zod29.z.object({
3916
+ type: import_zod29.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
3685
3917
  })
3686
3918
  );
3687
3919
  var PrintCertificateActionInput = BaseActionInput.merge(
3688
- import_zod28.z.object({
3689
- type: import_zod28.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
3920
+ import_zod29.z.object({
3921
+ type: import_zod29.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
3922
+ content: PrintContent.optional()
3690
3923
  })
3691
3924
  );
3692
3925
  var RejectDeclarationActionInput = BaseActionInput.merge(
3693
- import_zod28.z.object({
3694
- type: import_zod28.z.literal(ActionType.REJECT).default(ActionType.REJECT),
3926
+ import_zod29.z.object({
3927
+ type: import_zod29.z.literal(ActionType.REJECT).default(ActionType.REJECT),
3695
3928
  reason: RejectionReason
3696
3929
  })
3697
3930
  );
3698
3931
  var MarkedAsDuplicateActionInput = BaseActionInput.merge(
3699
- import_zod28.z.object({
3700
- type: import_zod28.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
3932
+ import_zod29.z.object({
3933
+ type: import_zod29.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
3701
3934
  })
3702
3935
  );
3703
3936
  var ArchiveActionInput = BaseActionInput.merge(
3704
- import_zod28.z.object({
3705
- type: import_zod28.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
3937
+ import_zod29.z.object({
3938
+ type: import_zod29.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
3706
3939
  reason: RejectionReason
3707
3940
  })
3708
3941
  );
3709
3942
  var AssignActionInput = BaseActionInput.merge(
3710
- import_zod28.z.object({
3711
- type: import_zod28.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
3712
- assignedTo: import_zod28.z.string()
3943
+ import_zod29.z.object({
3944
+ type: import_zod29.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
3945
+ assignedTo: import_zod29.z.string()
3713
3946
  })
3714
3947
  );
3715
3948
  var UnassignActionInput = BaseActionInput.merge(
3716
- import_zod28.z.object({
3717
- type: import_zod28.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
3718
- assignedTo: import_zod28.z.literal(null).default(null)
3949
+ import_zod29.z.object({
3950
+ type: import_zod29.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
3951
+ assignedTo: import_zod29.z.literal(null).default(null)
3719
3952
  })
3720
3953
  );
3721
3954
  var RequestCorrectionActionInput = BaseActionInput.merge(
3722
- import_zod28.z.object({
3723
- type: import_zod28.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
3955
+ import_zod29.z.object({
3956
+ type: import_zod29.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
3724
3957
  })
3725
3958
  );
3726
3959
  var RejectCorrectionActionInput = BaseActionInput.merge(
3727
- import_zod28.z.object({
3728
- requestId: import_zod28.z.string(),
3729
- type: import_zod28.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
3960
+ import_zod29.z.object({
3961
+ requestId: import_zod29.z.string(),
3962
+ type: import_zod29.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION),
3963
+ reason: RejectionReason
3730
3964
  })
3731
3965
  );
3732
3966
  var ApproveCorrectionActionInput = BaseActionInput.merge(
3733
- import_zod28.z.object({
3734
- requestId: import_zod28.z.string(),
3735
- type: import_zod28.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
3967
+ import_zod29.z.object({
3968
+ requestId: import_zod29.z.string(),
3969
+ type: import_zod29.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
3736
3970
  })
3737
3971
  );
3738
3972
  var ReadActionInput = BaseActionInput.merge(
3739
- import_zod28.z.object({
3740
- type: import_zod28.z.literal(ActionType.READ).default(ActionType.READ)
3973
+ import_zod29.z.object({
3974
+ type: import_zod29.z.literal(ActionType.READ).default(ActionType.READ)
3741
3975
  })
3742
3976
  );
3743
- var DeleteActionInput = import_zod28.z.object({ eventId: UUID });
3744
- var ActionInput = import_zod28.z.discriminatedUnion("type", [
3977
+ var DeleteActionInput = import_zod29.z.object({ eventId: UUID });
3978
+ var ActionInput = import_zod29.z.discriminatedUnion("type", [
3745
3979
  CreateActionInput.openapi({ ref: "CreateActionInput" }),
3746
3980
  ValidateActionInput.openapi({ ref: "ValidateActionInput" }),
3747
3981
  RegisterActionInput.openapi({ ref: "RegisterActionInput" }),
@@ -3770,18 +4004,18 @@ var ActionInput = import_zod28.z.discriminatedUnion("type", [
3770
4004
  });
3771
4005
 
3772
4006
  // ../commons/src/events/Draft.ts
3773
- var Draft = import_zod29.z.object({
4007
+ var Draft = import_zod30.z.object({
3774
4008
  id: UUID,
3775
4009
  eventId: UUID,
3776
- transactionId: import_zod29.z.string(),
3777
- createdAt: import_zod29.z.string().datetime(),
4010
+ transactionId: import_zod30.z.string(),
4011
+ createdAt: import_zod30.z.string().datetime(),
3778
4012
  action: ActionBase.extend({
3779
4013
  type: ActionTypes
3780
4014
  }).omit({ id: true })
3781
4015
  });
3782
4016
  var DraftInput = BaseActionInput.extend({
3783
4017
  type: ActionTypes,
3784
- status: import_zod29.z.enum([
4018
+ status: import_zod30.z.enum([
3785
4019
  ActionStatus.Requested,
3786
4020
  ActionStatus.Accepted,
3787
4021
  ActionStatus.Rejected
@@ -3789,27 +4023,28 @@ var DraftInput = BaseActionInput.extend({
3789
4023
  });
3790
4024
 
3791
4025
  // ../commons/src/events/EventInput.ts
3792
- var import_zod30 = require("zod");
4026
+ var import_zod31 = require("zod");
3793
4027
  var import_uuid8 = require("uuid");
3794
- var EventInput = import_zod30.z.object({
3795
- transactionId: import_zod30.z.string(),
3796
- type: import_zod30.z.string()
4028
+ var EventInput = import_zod31.z.object({
4029
+ transactionId: import_zod31.z.string(),
4030
+ type: import_zod31.z.string()
3797
4031
  }).openapi({ default: { transactionId: (0, import_uuid8.v4)(), type: "v2.birth" } });
3798
4032
 
3799
4033
  // ../commons/src/events/EventDocument.ts
3800
- var import_zod31 = require("zod");
3801
- var import_zod_openapi11 = require("zod-openapi");
3802
- (0, import_zod_openapi11.extendZodWithOpenApi)(import_zod31.z);
3803
- var EventDocument = import_zod31.z.object({
4034
+ var import_zod32 = require("zod");
4035
+ var import_zod_openapi12 = require("zod-openapi");
4036
+ (0, import_zod_openapi12.extendZodWithOpenApi)(import_zod32.z);
4037
+ var EventDocument = import_zod32.z.object({
3804
4038
  id: UUID,
3805
- type: import_zod31.z.string(),
3806
- createdAt: import_zod31.z.string().datetime(),
3807
- updatedAt: import_zod31.z.string().datetime(),
3808
- actions: import_zod31.z.array(Action),
3809
- trackingId: import_zod31.z.string()
4039
+ type: import_zod32.z.string(),
4040
+ createdAt: import_zod32.z.string().datetime(),
4041
+ updatedAt: import_zod32.z.string().datetime(),
4042
+ actions: import_zod32.z.array(Action),
4043
+ trackingId: import_zod32.z.string()
3810
4044
  }).openapi({ ref: "EventDocument" });
3811
4045
 
3812
4046
  // ../commons/src/events/state/utils.ts
4047
+ var import_lodash2 = require("lodash");
3813
4048
  function getActionRequests(actionType, actions) {
3814
4049
  const filtered = actions.filter((action) => action.type === actionType);
3815
4050
  const accept = filtered.find(
@@ -3848,29 +4083,38 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
3848
4083
  registrationNumber
3849
4084
  };
3850
4085
  }
4086
+ var updateActions = ActionTypes.extract([
4087
+ ActionType.CREATE,
4088
+ ActionType.NOTIFY,
4089
+ ActionType.DECLARE,
4090
+ ActionType.VALIDATE,
4091
+ ActionType.REGISTER,
4092
+ ActionType.REJECT,
4093
+ ActionType.ARCHIVE,
4094
+ ActionType.PRINT_CERTIFICATE,
4095
+ ActionType.REQUEST_CORRECTION
4096
+ ]);
3851
4097
  function getActionUpdateMetadata(actions) {
3852
4098
  const createAction = getOrThrow(
3853
4099
  actions.find((action) => action.type === ActionType.CREATE),
3854
4100
  `Event has no ${ActionType.CREATE} action`
3855
4101
  );
3856
- return StatusChangingActions.options.reduce(
3857
- (metadata, actionType) => {
3858
- const { accept, request } = getActionRequests(actionType, actions);
3859
- return {
3860
- createdAt: request?.createdAt ?? accept?.createdAt ?? metadata.createdAt,
3861
- createdBy: request?.createdBy ?? accept?.createdBy ?? metadata.createdBy,
3862
- createdByUserType: request?.createdByUserType ?? accept?.createdByUserType ?? metadata.createdByUserType,
3863
- createdAtLocation: request?.createdAtLocation ?? accept?.createdAtLocation ?? metadata.createdAtLocation,
3864
- createdByRole: request?.createdByRole ?? accept?.createdByRole ?? metadata.createdByRole
3865
- };
4102
+ const metadataFields = [
4103
+ "createdAt",
4104
+ "createdBy",
4105
+ "createdByUserType",
4106
+ "createdAtLocation",
4107
+ "createdByRole"
4108
+ ];
4109
+ return actions.filter(({ type }) => updateActions.safeParse(type).success).filter(({ status }) => status === ActionStatus.Accepted).reduce(
4110
+ (_, action) => {
4111
+ if (action.originalActionId) {
4112
+ const originalAction = actions.find(({ id }) => id === action.originalActionId) ?? action;
4113
+ return (0, import_lodash2.pick)(originalAction, metadataFields);
4114
+ }
4115
+ return (0, import_lodash2.pick)(action, metadataFields);
3866
4116
  },
3867
- {
3868
- createdAt: createAction.createdAt,
3869
- createdBy: createAction.createdBy,
3870
- createdByUserType: createAction.createdByUserType,
3871
- createdAtLocation: createAction.createdAtLocation,
3872
- createdByRole: createAction.createdByRole
3873
- }
4117
+ (0, import_lodash2.pick)(createAction, metadataFields)
3874
4118
  );
3875
4119
  }
3876
4120
  function getLegalStatuses(actions) {
@@ -3887,16 +4131,19 @@ function getLegalStatuses(actions) {
3887
4131
  }
3888
4132
 
3889
4133
  // ../commons/src/events/state/flags.ts
3890
- function isCertificatePrinted(actions) {
4134
+ function isPendingCertification(actions) {
4135
+ if (getStatusFromActions(actions) !== EventStatus.enum.REGISTERED) {
4136
+ return false;
4137
+ }
3891
4138
  return actions.reduce((prev, { type }) => {
3892
4139
  if (type === ActionType.PRINT_CERTIFICATE) {
3893
- return true;
4140
+ return false;
3894
4141
  }
3895
4142
  if (type === ActionType.APPROVE_CORRECTION) {
3896
- return false;
4143
+ return true;
3897
4144
  }
3898
4145
  return prev;
3899
- }, false);
4146
+ }, true);
3900
4147
  }
3901
4148
  function isCorrectionRequested(actions) {
3902
4149
  return actions.reduce((prev, { type }) => {
@@ -3916,7 +4163,7 @@ function isDeclarationIncomplete(actions) {
3916
4163
  return getStatusFromActions(actions) === EventStatus.enum.NOTIFIED;
3917
4164
  }
3918
4165
  function isRejected(actions) {
3919
- return getStatusFromActions(actions) === EventStatus.enum.REJECTED;
4166
+ return actions.at(-1)?.type === ActionType.REJECT;
3920
4167
  }
3921
4168
  function getFlagsFromActions(actions) {
3922
4169
  const sortedActions = actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
@@ -3931,8 +4178,8 @@ function getFlagsFromActions(actions) {
3931
4178
  const flag = joinValues([type, status], ":").toLowerCase();
3932
4179
  return flag;
3933
4180
  });
3934
- if (isCertificatePrinted(sortedActions)) {
3935
- flags.push(InherentFlags.PRINTED);
4181
+ if (isPendingCertification(sortedActions)) {
4182
+ flags.push(InherentFlags.PENDING_CERTIFICATION);
3936
4183
  }
3937
4184
  if (isCorrectionRequested(sortedActions)) {
3938
4185
  flags.push(InherentFlags.CORRECTION_REQUESTED);
@@ -3958,16 +4205,14 @@ function getStatusFromActions(actions) {
3958
4205
  return EventStatus.enum.VALIDATED;
3959
4206
  case ActionType.REGISTER:
3960
4207
  return EventStatus.enum.REGISTERED;
3961
- case ActionType.REJECT:
3962
- return EventStatus.enum.REJECTED;
3963
4208
  case ActionType.ARCHIVE:
3964
4209
  return EventStatus.enum.ARCHIVED;
3965
4210
  case ActionType.NOTIFY:
3966
4211
  return EventStatus.enum.NOTIFIED;
3967
4212
  case ActionType.PRINT_CERTIFICATE:
3968
- return EventStatus.enum.CERTIFIED;
3969
4213
  case ActionType.ASSIGN:
3970
4214
  case ActionType.UNASSIGN:
4215
+ case ActionType.REJECT:
3971
4216
  case ActionType.REQUEST_CORRECTION:
3972
4217
  case ActionType.APPROVE_CORRECTION:
3973
4218
  case ActionType.MARKED_AS_DUPLICATE:
@@ -4003,7 +4248,8 @@ function getAssignedUserSignatureFromActions(actions) {
4003
4248
  function aggregateActionDeclarations(actions) {
4004
4249
  const excludedActions = [
4005
4250
  ActionType.REQUEST_CORRECTION,
4006
- ActionType.PRINT_CERTIFICATE
4251
+ ActionType.PRINT_CERTIFICATE,
4252
+ ActionType.REJECT_CORRECTION
4007
4253
  ];
4008
4254
  return actions.reduce((declaration, action) => {
4009
4255
  if (excludedActions.some((excludedAction) => excludedAction === action.type)) {
@@ -4044,6 +4290,13 @@ function getAcceptedActions(event2) {
4044
4290
  );
4045
4291
  }
4046
4292
  var DEFAULT_DATE_OF_EVENT_PROPERTY = "createdAt";
4293
+ function resolveDateOfEvent(eventMetadata, declaration, config) {
4294
+ if (!config.dateOfEvent) {
4295
+ return eventMetadata[DEFAULT_DATE_OF_EVENT_PROPERTY].split("T")[0];
4296
+ }
4297
+ const parsedDate = ZodDate.safeParse(declaration[config.dateOfEvent.$$field]);
4298
+ return parsedDate.success ? parsedDate.data : void 0;
4299
+ }
4047
4300
  function getCurrentEventState(event2, config) {
4048
4301
  const creationAction = event2.actions.find(
4049
4302
  (action) => action.type === ActionType.CREATE
@@ -4057,17 +4310,6 @@ function getCurrentEventState(event2, config) {
4057
4310
  const requestActionMetadata = getActionUpdateMetadata(event2.actions);
4058
4311
  const acceptedActionMetadata = getActionUpdateMetadata(acceptedActions);
4059
4312
  const declaration = aggregateActionDeclarations(acceptedActions);
4060
- let dateOfEvent;
4061
- if (config.dateOfEvent) {
4062
- const parsedDate = ZodDate.safeParse(
4063
- declaration[config.dateOfEvent.$$field]
4064
- );
4065
- if (parsedDate.success) {
4066
- dateOfEvent = parsedDate.data;
4067
- }
4068
- } else {
4069
- dateOfEvent = event2[DEFAULT_DATE_OF_EVENT_PROPERTY].split("T")[0];
4070
- }
4071
4313
  return deepDropNulls({
4072
4314
  id: event2.id,
4073
4315
  type: event2.type,
@@ -4086,7 +4328,7 @@ function getCurrentEventState(event2, config) {
4086
4328
  declaration,
4087
4329
  trackingId: event2.trackingId,
4088
4330
  updatedByUserRole: requestActionMetadata.createdByRole,
4089
- dateOfEvent,
4331
+ dateOfEvent: resolveDateOfEvent(event2, declaration, config),
4090
4332
  flags: getFlagsFromActions(event2.actions)
4091
4333
  });
4092
4334
  }
@@ -4115,19 +4357,32 @@ function getCurrentEventStateWithDrafts({
4115
4357
  };
4116
4358
  return getCurrentEventState(withDrafts, configuration);
4117
4359
  }
4118
- function applyDraftsToEventIndex(eventIndex, drafts) {
4360
+ function applyDeclarationToEventIndex(eventIndex, declaration, eventConfiguration) {
4361
+ const updatedDeclaration = deepMerge(eventIndex.declaration, declaration);
4362
+ return {
4363
+ ...eventIndex,
4364
+ dateOfEvent: resolveDateOfEvent(
4365
+ eventIndex,
4366
+ updatedDeclaration,
4367
+ eventConfiguration
4368
+ ),
4369
+ declaration: updatedDeclaration
4370
+ };
4371
+ }
4372
+ function applyDraftsToEventIndex(eventIndex, drafts, eventConfiguration) {
4119
4373
  const indexedAt = eventIndex.updatedAt;
4120
4374
  const activeDrafts = drafts.filter(({ createdAt }) => new Date(createdAt) > new Date(indexedAt)).map((draft) => draft.action).sort();
4121
4375
  if (activeDrafts.length === 0) {
4122
4376
  return eventIndex;
4123
4377
  }
4124
- return {
4125
- ...eventIndex,
4126
- declaration: {
4127
- ...eventIndex.declaration,
4128
- ...activeDrafts[activeDrafts.length - 1].declaration
4129
- }
4130
- };
4378
+ return applyDeclarationToEventIndex(
4379
+ {
4380
+ ...eventIndex,
4381
+ updatedAt: activeDrafts[activeDrafts.length - 1].createdAt
4382
+ },
4383
+ activeDrafts[activeDrafts.length - 1].declaration,
4384
+ eventConfiguration
4385
+ );
4131
4386
  }
4132
4387
  function getAnnotationFromDrafts(drafts) {
4133
4388
  const actions = drafts.map((draft) => draft.action);
@@ -4168,23 +4423,24 @@ function generateTransactionId() {
4168
4423
  }
4169
4424
 
4170
4425
  // ../commons/src/events/User.ts
4171
- var import_zod32 = require("zod");
4172
- var User = import_zod32.z.object({
4173
- id: import_zod32.z.string(),
4174
- name: import_zod32.z.array(
4175
- import_zod32.z.object({
4176
- use: import_zod32.z.string(),
4177
- given: import_zod32.z.array(import_zod32.z.string()),
4178
- family: import_zod32.z.string()
4426
+ var import_zod33 = require("zod");
4427
+ var User = import_zod33.z.object({
4428
+ id: import_zod33.z.string(),
4429
+ name: import_zod33.z.array(
4430
+ import_zod33.z.object({
4431
+ use: import_zod33.z.string(),
4432
+ given: import_zod33.z.array(import_zod33.z.string()),
4433
+ family: import_zod33.z.string()
4179
4434
  })
4180
4435
  ),
4181
- role: import_zod32.z.string(),
4182
- signatureFilename: import_zod32.z.string().optional()
4436
+ role: import_zod33.z.string(),
4437
+ avatar: FullDocumentPath.optional(),
4438
+ signature: FullDocumentPath.optional()
4183
4439
  });
4184
4440
 
4185
4441
  // ../commons/src/events/test.utils.ts
4186
- var import_lodash2 = require("lodash");
4187
- var import_addDays = __toESM(require("date-fns/addDays"));
4442
+ var import_lodash3 = require("lodash");
4443
+ var import_date_fns4 = require("date-fns");
4188
4444
 
4189
4445
  // ../commons/src/field-config/field-configuration.ts
4190
4446
  function createFieldConfig(fieldId, options) {
@@ -4205,7 +4461,7 @@ function field(fieldId, options = {}) {
4205
4461
  }
4206
4462
 
4207
4463
  // ../commons/src/fixtures/forms.ts
4208
- var import_date_fns2 = require("date-fns");
4464
+ var import_date_fns3 = require("date-fns");
4209
4465
  var PRINT_CERTIFICATE_FORM = defineActionForm({
4210
4466
  label: {
4211
4467
  id: "v2.event.tennis-club-membership.action.certificate.form.label",
@@ -4924,6 +5180,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
4924
5180
  id: "applicant.email",
4925
5181
  type: "EMAIL",
4926
5182
  required: false,
5183
+ uncorrectable: true,
4927
5184
  conditionals: [],
4928
5185
  label: {
4929
5186
  defaultMessage: "Applicant's email",
@@ -5003,6 +5260,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
5003
5260
  id: "applicant.address",
5004
5261
  type: "ADDRESS",
5005
5262
  required: true,
5263
+ secured: true,
5006
5264
  conditionals: [],
5007
5265
  label: {
5008
5266
  defaultMessage: "Applicant's address",
@@ -5138,22 +5396,6 @@ var statusOptions = [
5138
5396
  id: "v2.advancedSearch.form.recordStatusRegistered"
5139
5397
  }
5140
5398
  },
5141
- {
5142
- value: EventStatus.enum.CERTIFIED,
5143
- label: {
5144
- defaultMessage: "Certified",
5145
- description: "Option for form field: status of record",
5146
- id: "v2.advancedSearch.form.recordStatusCertified"
5147
- }
5148
- },
5149
- {
5150
- value: EventStatus.enum.REJECTED,
5151
- label: {
5152
- defaultMessage: "Rejected",
5153
- description: "Option for form field: status of record",
5154
- id: "v2.advancedSearch.form.recordStatusRejected"
5155
- }
5156
- },
5157
5399
  {
5158
5400
  value: EventStatus.enum.ARCHIVED,
5159
5401
  label: {
@@ -5170,7 +5412,7 @@ var timePeriodOptions = [
5170
5412
  description: "Label for option of time period select: last 7 days",
5171
5413
  id: "form.section.label.timePeriodLast7Days"
5172
5414
  },
5173
- value: `${(0, import_date_fns2.format)((0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 7), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
5415
+ value: `${(0, import_date_fns3.format)((0, import_date_fns3.subDays)(/* @__PURE__ */ new Date(), 7), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
5174
5416
  /* @__PURE__ */ new Date(),
5175
5417
  "yyyy-MM-dd"
5176
5418
  )}`
@@ -5181,7 +5423,7 @@ var timePeriodOptions = [
5181
5423
  description: "Label for option of time period select: last 30 days",
5182
5424
  id: "form.section.label.timePeriodLast30Days"
5183
5425
  },
5184
- value: `${(0, import_date_fns2.format)((0, import_date_fns2.subMonths)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
5426
+ value: `${(0, import_date_fns3.format)((0, import_date_fns3.subMonths)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
5185
5427
  /* @__PURE__ */ new Date(),
5186
5428
  "yyyy-MM-dd"
5187
5429
  )}`
@@ -5192,7 +5434,7 @@ var timePeriodOptions = [
5192
5434
  description: "Label for option of time period select: last 90 days",
5193
5435
  id: "form.section.label.timePeriodLast90Days"
5194
5436
  },
5195
- value: `${(0, import_date_fns2.format)((0, import_date_fns2.subQuarters)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
5437
+ value: `${(0, import_date_fns3.format)((0, import_date_fns3.subQuarters)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
5196
5438
  /* @__PURE__ */ new Date(),
5197
5439
  "yyyy-MM-dd"
5198
5440
  )}`
@@ -5203,7 +5445,7 @@ var timePeriodOptions = [
5203
5445
  description: "Label for option of time period select: last year",
5204
5446
  id: "form.section.label.timePeriodLastYear"
5205
5447
  },
5206
- value: `${(0, import_date_fns2.format)((0, import_date_fns2.subYears)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
5448
+ value: `${(0, import_date_fns3.format)((0, import_date_fns3.subYears)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
5207
5449
  /* @__PURE__ */ new Date(),
5208
5450
  "yyyy-MM-dd"
5209
5451
  )}`
@@ -5287,197 +5529,202 @@ var tennisClubMembershipEvent = defineConfig({
5287
5529
  description: "This is shown as the action name anywhere the user can trigger the action from",
5288
5530
  id: "event.tennis-club-membership.action.correction.request.label"
5289
5531
  },
5290
- onboardingForm: [
5291
- {
5292
- id: "correction-requester",
5293
- type: PageTypes.enum.FORM,
5294
- title: {
5295
- id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
5296
- defaultMessage: "Correction requester",
5297
- description: "This is the title of the section"
5298
- },
5299
- fields: [
5300
- {
5301
- id: "correction.requester.relationshop.intro",
5302
- type: "PAGE_HEADER",
5303
- label: {
5304
- id: "correction.requester.relationshop.intro.label",
5305
- defaultMessage: "Note: In the case that the child is now of legal age (18) then only they should be able to request a change to their birth record.",
5306
- description: "The title for the corrector form"
5307
- }
5532
+ correctionForm: {
5533
+ label: {
5534
+ id: "v2.event.tennis-club-membership.action.request-correction.label",
5535
+ defaultMessage: "Request correction",
5536
+ description: "This is shown as the action name anywhere the user can trigger the action from"
5537
+ },
5538
+ pages: [
5539
+ {
5540
+ id: "correction-requester",
5541
+ type: PageTypes.enum.FORM,
5542
+ title: {
5543
+ id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
5544
+ defaultMessage: "Correction requester",
5545
+ description: "This is the title of the section"
5308
5546
  },
5309
- {
5310
- id: "correction.requester.relationship",
5311
- type: "RADIO_GROUP",
5312
- label: {
5313
- id: "v2.correction.corrector.title",
5314
- defaultMessage: "Who is requesting a change to this record?",
5315
- description: "The title for the corrector form"
5547
+ fields: [
5548
+ {
5549
+ id: "correction.requester.relationshop.intro",
5550
+ type: "PAGE_HEADER",
5551
+ label: {
5552
+ id: "correction.requester.relationshop.intro.label",
5553
+ defaultMessage: "Note: In the case that the child is now of legal age (18) then only they should be able to request a change to their birth record.",
5554
+ description: "The title for the corrector form"
5555
+ }
5316
5556
  },
5317
- defaultValue: "",
5318
- options: [
5319
- {
5320
- value: "INFORMANT",
5321
- label: {
5322
- id: "v2.correction.corrector.informant",
5323
- defaultMessage: "Informant",
5324
- description: "Label for informant option in certificate correction form"
5325
- }
5326
- },
5327
- {
5328
- value: "ANOTHER_AGENT",
5329
- label: {
5330
- id: "v2.correction.corrector.anotherAgent",
5331
- defaultMessage: "Another registration agent or field agent",
5332
- description: "Label for another registration or field agent option in certificate correction form"
5333
- }
5334
- },
5335
- {
5336
- value: "REGISTRAR",
5337
- label: {
5338
- id: "v2.correction.corrector.me",
5339
- defaultMessage: "Me (Registrar)",
5340
- description: "Label for registrar option in certificate correction form"
5341
- }
5557
+ {
5558
+ id: "correction.requester.relationship",
5559
+ type: "RADIO_GROUP",
5560
+ label: {
5561
+ id: "v2.correction.corrector.title",
5562
+ defaultMessage: "Who is requesting a change to this record?",
5563
+ description: "The title for the corrector form"
5342
5564
  },
5343
- {
5344
- value: "OTHER",
5345
- label: {
5346
- id: "v2.correction.corrector.others",
5347
- defaultMessage: "Someone else",
5348
- description: "Label for someone else option in certificate correction form"
5565
+ defaultValue: "",
5566
+ options: [
5567
+ {
5568
+ value: "INFORMANT",
5569
+ label: {
5570
+ id: "v2.correction.corrector.informant",
5571
+ defaultMessage: "Informant",
5572
+ description: "Label for informant option in certificate correction form"
5573
+ }
5574
+ },
5575
+ {
5576
+ value: "ANOTHER_AGENT",
5577
+ label: {
5578
+ id: "v2.correction.corrector.anotherAgent",
5579
+ defaultMessage: "Another registration agent or field agent",
5580
+ description: "Label for another registration or field agent option in certificate correction form"
5581
+ }
5582
+ },
5583
+ {
5584
+ value: "REGISTRAR",
5585
+ label: {
5586
+ id: "v2.correction.corrector.me",
5587
+ defaultMessage: "Me (Registrar)",
5588
+ description: "Label for registrar option in certificate correction form"
5589
+ }
5590
+ },
5591
+ {
5592
+ value: "OTHER",
5593
+ label: {
5594
+ id: "v2.correction.corrector.others",
5595
+ defaultMessage: "Someone else",
5596
+ description: "Label for someone else option in certificate correction form"
5597
+ }
5349
5598
  }
5350
- }
5351
- ]
5352
- }
5353
- ]
5354
- },
5355
- {
5356
- id: "identity-check",
5357
- type: PageTypes.enum.FORM,
5358
- title: {
5359
- id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
5360
- defaultMessage: "Verify their identity",
5361
- description: "This is the title of the section"
5362
- },
5363
- fields: [
5364
- {
5365
- id: "correction.identity-check.instructions",
5366
- type: "PAGE_HEADER",
5367
- label: {
5368
- id: "correction.corrector.identity.instruction",
5369
- defaultMessage: "Please verify the identity of the person making this request",
5370
- description: "The title for the corrector form"
5599
+ ]
5371
5600
  }
5601
+ ]
5602
+ },
5603
+ {
5604
+ id: "identity-check",
5605
+ type: PageTypes.enum.FORM,
5606
+ title: {
5607
+ id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
5608
+ defaultMessage: "Verify their identity",
5609
+ description: "This is the title of the section"
5372
5610
  },
5373
- {
5374
- id: "correction.identity-check.verified",
5375
- type: "RADIO_GROUP",
5376
- label: {
5377
- id: "correction.corrector.identity.verified.label",
5378
- defaultMessage: "Identity verified",
5379
- description: "The title for the corrector form"
5611
+ fields: [
5612
+ {
5613
+ id: "correction.identity-check.instructions",
5614
+ type: "PAGE_HEADER",
5615
+ label: {
5616
+ id: "correction.corrector.identity.instruction",
5617
+ defaultMessage: "Please verify the identity of the person making this request",
5618
+ description: "The title for the corrector form"
5619
+ }
5380
5620
  },
5381
- defaultValue: "",
5382
- required: true,
5383
- options: [
5384
- {
5385
- value: "VERIFIED",
5386
- label: {
5387
- id: "correction.corrector.identity.verified",
5388
- defaultMessage: "I have verified their identity",
5389
- description: "Label for verified option in corrector identity check page"
5621
+ {
5622
+ id: "correction.identity-check.verified",
5623
+ type: "RADIO_GROUP",
5624
+ label: {
5625
+ id: "correction.corrector.identity.verified.label",
5626
+ defaultMessage: "Identity verified",
5627
+ description: "The title for the corrector form"
5628
+ },
5629
+ defaultValue: "",
5630
+ required: true,
5631
+ options: [
5632
+ {
5633
+ value: "VERIFIED",
5634
+ label: {
5635
+ id: "correction.corrector.identity.verified",
5636
+ defaultMessage: "I have verified their identity",
5637
+ description: "Label for verified option in corrector identity check page"
5638
+ }
5390
5639
  }
5391
- }
5392
- ]
5393
- }
5394
- ]
5395
- }
5396
- ],
5397
- additionalDetailsForm: [
5398
- {
5399
- id: "correction-request.supporting-documents",
5400
- type: PageTypes.enum.FORM,
5401
- title: {
5402
- id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
5403
- defaultMessage: "Upload supporting documents",
5404
- description: "This is the title of the section"
5405
- },
5406
- fields: [
5407
- {
5408
- id: "correction.supportingDocs.introduction",
5409
- type: "PAGE_HEADER",
5410
- label: {
5411
- id: "correction.corrector.paragraph.title",
5412
- defaultMessage: "For all record corrections at a minimum an affidavit must be provided. For material errors and omissions eg. in paternity cases, a court order must also be provided.",
5413
- description: "The title for the corrector form"
5414
- }
5415
- },
5416
- {
5417
- id: "correction.supportingDocs",
5418
- type: FieldType.FILE,
5419
- label: {
5420
- id: "correction.corrector.title",
5421
- defaultMessage: "Upload supporting documents",
5422
- description: "The title for the corrector form"
5640
+ ]
5423
5641
  }
5642
+ ]
5643
+ },
5644
+ {
5645
+ id: "correction-request.supporting-documents",
5646
+ type: PageTypes.enum.FORM,
5647
+ title: {
5648
+ id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
5649
+ defaultMessage: "Upload supporting documents",
5650
+ description: "This is the title of the section"
5424
5651
  },
5425
- {
5426
- id: "correction.request.supportingDocuments",
5427
- type: "RADIO_GROUP",
5428
- label: {
5429
- id: "correction.corrector.title",
5430
- defaultMessage: "Who is requesting a change to this record?",
5431
- description: "The title for the corrector form"
5652
+ fields: [
5653
+ {
5654
+ id: "correction.supportingDocs.introduction",
5655
+ type: "PAGE_HEADER",
5656
+ label: {
5657
+ id: "correction.corrector.paragraph.title",
5658
+ defaultMessage: "For all record corrections at a minimum an affidavit must be provided. For material errors and omissions eg. in paternity cases, a court order must also be provided.",
5659
+ description: "The title for the corrector form"
5660
+ }
5432
5661
  },
5433
- defaultValue: "",
5434
- configuration: {
5435
- styles: {
5436
- size: "NORMAL"
5662
+ {
5663
+ id: "correction.supportingDocs",
5664
+ type: FieldType.FILE,
5665
+ label: {
5666
+ id: "correction.corrector.title",
5667
+ defaultMessage: "Upload supporting documents",
5668
+ description: "The title for the corrector form"
5437
5669
  }
5438
5670
  },
5439
- options: [
5440
- {
5441
- value: "ATTEST",
5442
- label: {
5443
- id: "correction.supportingDocuments.attest.label",
5444
- defaultMessage: "I attest to seeing supporting documentation and have a copy filed at my office",
5445
- description: ""
5671
+ {
5672
+ id: "correction.request.supportingDocuments",
5673
+ type: "RADIO_GROUP",
5674
+ label: {
5675
+ id: "correction.corrector.title",
5676
+ defaultMessage: "Who is requesting a change to this record?",
5677
+ description: "The title for the corrector form"
5678
+ },
5679
+ defaultValue: "",
5680
+ configuration: {
5681
+ styles: {
5682
+ size: "NORMAL"
5446
5683
  }
5447
5684
  },
5448
- {
5449
- value: "NOT_NEEDED",
5450
- label: {
5451
- id: "correction.supportingDocuments.notNeeded.label",
5452
- defaultMessage: "No supporting documents required",
5453
- description: ""
5685
+ options: [
5686
+ {
5687
+ value: "ATTEST",
5688
+ label: {
5689
+ id: "correction.supportingDocuments.attest.label",
5690
+ defaultMessage: "I attest to seeing supporting documentation and have a copy filed at my office",
5691
+ description: ""
5692
+ }
5693
+ },
5694
+ {
5695
+ value: "NOT_NEEDED",
5696
+ label: {
5697
+ id: "correction.supportingDocuments.notNeeded.label",
5698
+ defaultMessage: "No supporting documents required",
5699
+ description: ""
5700
+ }
5454
5701
  }
5455
- }
5456
- ]
5457
- }
5458
- ]
5459
- },
5460
- {
5461
- id: "correction-request.additional-details",
5462
- type: PageTypes.enum.FORM,
5463
- title: {
5464
- id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
5465
- defaultMessage: "Reason for correction",
5466
- description: "This is the title of the section"
5702
+ ]
5703
+ }
5704
+ ]
5467
5705
  },
5468
- fields: [
5469
- {
5470
- id: "correction.request.reason",
5471
- type: FieldType.TEXT,
5472
- label: {
5473
- id: "correction.reason.title",
5474
- defaultMessage: "Reason for correction?",
5475
- description: "The title for the corrector form"
5706
+ {
5707
+ id: "correction-request.additional-details",
5708
+ type: PageTypes.enum.FORM,
5709
+ title: {
5710
+ id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
5711
+ defaultMessage: "Reason for correction",
5712
+ description: "This is the title of the section"
5713
+ },
5714
+ fields: [
5715
+ {
5716
+ id: "correction.request.reason",
5717
+ type: FieldType.TEXT,
5718
+ label: {
5719
+ id: "correction.reason.title",
5720
+ defaultMessage: "Reason for correction?",
5721
+ description: "The title for the corrector form"
5722
+ }
5476
5723
  }
5477
- }
5478
- ]
5479
- }
5480
- ]
5724
+ ]
5725
+ }
5726
+ ]
5727
+ }
5481
5728
  },
5482
5729
  {
5483
5730
  type: ActionType.APPROVE_CORRECTION,
@@ -5560,10 +5807,10 @@ var tennisClubMembershipEvent = defineConfig({
5560
5807
  id: "v2.advancedSearch.form.registrationDetails"
5561
5808
  },
5562
5809
  fields: [
5563
- event("legalStatus.REGISTERED.createdAtLocation").exact(),
5564
- event("legalStatus.REGISTERED.createdAt").range(),
5565
- event("status", statusOptions).exact(),
5566
- event("updatedAt", timePeriodOptions).range()
5810
+ event("legalStatuses.REGISTERED.createdAtLocation").exact(),
5811
+ event("legalStatuses.REGISTERED.acceptedAt").range(),
5812
+ event("status").exact(),
5813
+ event("updatedAt").range()
5567
5814
  ]
5568
5815
  },
5569
5816
  {
@@ -5680,197 +5927,202 @@ var footballClubMembershipEvent = defineConfig({
5680
5927
  description: "This is shown as the action name anywhere the user can trigger the action from",
5681
5928
  id: "event.football-club-membership.action.correction.request.label"
5682
5929
  },
5683
- onboardingForm: [
5684
- {
5685
- id: "correction-requester",
5686
- type: PageTypes.enum.FORM,
5687
- title: {
5688
- id: "event.football-club-membership.action.requestCorrection.form.section.corrector",
5689
- defaultMessage: "Correction requester",
5690
- description: "This is the title of the section"
5691
- },
5692
- fields: [
5693
- {
5694
- id: "correction.requester.relationshop.intro",
5695
- type: "PAGE_HEADER",
5696
- label: {
5697
- id: "correction.requester.relationshop.intro.label",
5698
- defaultMessage: "Note: In the case that the child is now of legal age (18) then only they should be able to request a change to their birth record.",
5699
- description: "The title for the corrector form"
5700
- }
5930
+ correctionForm: {
5931
+ label: {
5932
+ id: "event.football-club-membership.action.correction.request.label",
5933
+ defaultMessage: "Request correction",
5934
+ description: "This is shown as the action name anywhere the user can trigger the action from"
5935
+ },
5936
+ pages: [
5937
+ {
5938
+ id: "correction-requester",
5939
+ type: PageTypes.enum.FORM,
5940
+ title: {
5941
+ id: "event.football-club-membership.action.requestCorrection.form.section.corrector",
5942
+ defaultMessage: "Correction requester",
5943
+ description: "This is the title of the section"
5701
5944
  },
5702
- {
5703
- id: "correction.requester.relationship",
5704
- type: "RADIO_GROUP",
5705
- label: {
5706
- id: "v2.correction.corrector.title",
5707
- defaultMessage: "Who is requesting a change to this record?",
5708
- description: "The title for the corrector form"
5945
+ fields: [
5946
+ {
5947
+ id: "correction.requester.relationshop.intro",
5948
+ type: "PAGE_HEADER",
5949
+ label: {
5950
+ id: "correction.requester.relationshop.intro.label",
5951
+ defaultMessage: "Note: In the case that the child is now of legal age (18) then only they should be able to request a change to their birth record.",
5952
+ description: "The title for the corrector form"
5953
+ }
5709
5954
  },
5710
- defaultValue: "",
5711
- options: [
5712
- {
5713
- value: "INFORMANT",
5714
- label: {
5715
- id: "v2.correction.corrector.informant",
5716
- defaultMessage: "Informant",
5717
- description: "Label for informant option in certificate correction form"
5718
- }
5719
- },
5720
- {
5721
- value: "ANOTHER_AGENT",
5722
- label: {
5723
- id: "v2.correction.corrector.anotherAgent",
5724
- defaultMessage: "Another registration agent or field agent",
5725
- description: "Label for another registration or field agent option in certificate correction form"
5726
- }
5727
- },
5728
- {
5729
- value: "REGISTRAR",
5730
- label: {
5731
- id: "v2.correction.corrector.me",
5732
- defaultMessage: "Me (Registrar)",
5733
- description: "Label for registrar option in certificate correction form"
5734
- }
5955
+ {
5956
+ id: "correction.requester.relationship",
5957
+ type: "RADIO_GROUP",
5958
+ label: {
5959
+ id: "v2.correction.corrector.title",
5960
+ defaultMessage: "Who is requesting a change to this record?",
5961
+ description: "The title for the corrector form"
5735
5962
  },
5736
- {
5737
- value: "OTHER",
5738
- label: {
5739
- id: "v2.correction.corrector.others",
5740
- defaultMessage: "Someone else",
5741
- description: "Label for someone else option in certificate correction form"
5963
+ defaultValue: "",
5964
+ options: [
5965
+ {
5966
+ value: "INFORMANT",
5967
+ label: {
5968
+ id: "v2.correction.corrector.informant",
5969
+ defaultMessage: "Informant",
5970
+ description: "Label for informant option in certificate correction form"
5971
+ }
5972
+ },
5973
+ {
5974
+ value: "ANOTHER_AGENT",
5975
+ label: {
5976
+ id: "v2.correction.corrector.anotherAgent",
5977
+ defaultMessage: "Another registration agent or field agent",
5978
+ description: "Label for another registration or field agent option in certificate correction form"
5979
+ }
5980
+ },
5981
+ {
5982
+ value: "REGISTRAR",
5983
+ label: {
5984
+ id: "v2.correction.corrector.me",
5985
+ defaultMessage: "Me (Registrar)",
5986
+ description: "Label for registrar option in certificate correction form"
5987
+ }
5988
+ },
5989
+ {
5990
+ value: "OTHER",
5991
+ label: {
5992
+ id: "v2.correction.corrector.others",
5993
+ defaultMessage: "Someone else",
5994
+ description: "Label for someone else option in certificate correction form"
5995
+ }
5742
5996
  }
5743
- }
5744
- ]
5745
- }
5746
- ]
5747
- },
5748
- {
5749
- id: "identity-check",
5750
- type: PageTypes.enum.FORM,
5751
- title: {
5752
- id: "event.football-club-membership.action.requestCorrection.form.section.verify",
5753
- defaultMessage: "Verify their identity",
5754
- description: "This is the title of the section"
5755
- },
5756
- fields: [
5757
- {
5758
- id: "correction.identity-check.instructions",
5759
- type: "PAGE_HEADER",
5760
- label: {
5761
- id: "correction.corrector.identity.instruction",
5762
- defaultMessage: "Please verify the identity of the person making this request",
5763
- description: "The title for the corrector form"
5997
+ ]
5764
5998
  }
5999
+ ]
6000
+ },
6001
+ {
6002
+ id: "identity-check",
6003
+ type: PageTypes.enum.FORM,
6004
+ title: {
6005
+ id: "event.football-club-membership.action.requestCorrection.form.section.verify",
6006
+ defaultMessage: "Verify their identity",
6007
+ description: "This is the title of the section"
5765
6008
  },
5766
- {
5767
- id: "correction.identity-check.verified",
5768
- type: "RADIO_GROUP",
5769
- label: {
5770
- id: "correction.corrector.identity.verified.label",
5771
- defaultMessage: "Identity verified",
5772
- description: "The title for the corrector form"
6009
+ fields: [
6010
+ {
6011
+ id: "correction.identity-check.instructions",
6012
+ type: "PAGE_HEADER",
6013
+ label: {
6014
+ id: "correction.corrector.identity.instruction",
6015
+ defaultMessage: "Please verify the identity of the person making this request",
6016
+ description: "The title for the corrector form"
6017
+ }
5773
6018
  },
5774
- defaultValue: "",
5775
- required: true,
5776
- options: [
5777
- {
5778
- value: "VERIFIED",
5779
- label: {
5780
- id: "correction.corrector.identity.verified",
5781
- defaultMessage: "I have verified their identity",
5782
- description: "Label for verified option in corrector identity check page"
6019
+ {
6020
+ id: "correction.identity-check.verified",
6021
+ type: "RADIO_GROUP",
6022
+ label: {
6023
+ id: "correction.corrector.identity.verified.label",
6024
+ defaultMessage: "Identity verified",
6025
+ description: "The title for the corrector form"
6026
+ },
6027
+ defaultValue: "",
6028
+ required: true,
6029
+ options: [
6030
+ {
6031
+ value: "VERIFIED",
6032
+ label: {
6033
+ id: "correction.corrector.identity.verified",
6034
+ defaultMessage: "I have verified their identity",
6035
+ description: "Label for verified option in corrector identity check page"
6036
+ }
5783
6037
  }
5784
- }
5785
- ]
5786
- }
5787
- ]
5788
- }
5789
- ],
5790
- additionalDetailsForm: [
5791
- {
5792
- id: "correction-request.supporting-documents",
5793
- type: PageTypes.enum.FORM,
5794
- title: {
5795
- id: "event.football-club-membership.action.requestCorrection.form.section.verify",
5796
- defaultMessage: "Upload supporting documents",
5797
- description: "This is the title of the section"
5798
- },
5799
- fields: [
5800
- {
5801
- id: "correction.supportingDocs.introduction",
5802
- type: "PAGE_HEADER",
5803
- label: {
5804
- id: "correction.corrector.paragraph.title",
5805
- defaultMessage: "For all record corrections at a minimum an affidavit must be provided. For material errors and omissions eg. in paternity cases, a court order must also be provided.",
5806
- description: "The title for the corrector form"
5807
- }
5808
- },
5809
- {
5810
- id: "correction.supportingDocs",
5811
- type: FieldType.FILE,
5812
- label: {
5813
- id: "correction.corrector.title",
5814
- defaultMessage: "Upload supporting documents",
5815
- description: "The title for the corrector form"
6038
+ ]
5816
6039
  }
6040
+ ]
6041
+ },
6042
+ {
6043
+ id: "correction-request.supporting-documents",
6044
+ type: PageTypes.enum.FORM,
6045
+ title: {
6046
+ id: "event.football-club-membership.action.requestCorrection.form.section.verify",
6047
+ defaultMessage: "Upload supporting documents",
6048
+ description: "This is the title of the section"
5817
6049
  },
5818
- {
5819
- id: "correction.request.supportingDocuments",
5820
- type: "RADIO_GROUP",
5821
- label: {
5822
- id: "correction.corrector.title",
5823
- defaultMessage: "Who is requesting a change to this record?",
5824
- description: "The title for the corrector form"
6050
+ fields: [
6051
+ {
6052
+ id: "correction.supportingDocs.introduction",
6053
+ type: "PAGE_HEADER",
6054
+ label: {
6055
+ id: "correction.corrector.paragraph.title",
6056
+ defaultMessage: "For all record corrections at a minimum an affidavit must be provided. For material errors and omissions eg. in paternity cases, a court order must also be provided.",
6057
+ description: "The title for the corrector form"
6058
+ }
5825
6059
  },
5826
- defaultValue: "",
5827
- configuration: {
5828
- styles: {
5829
- size: "NORMAL"
6060
+ {
6061
+ id: "correction.supportingDocs",
6062
+ type: FieldType.FILE,
6063
+ label: {
6064
+ id: "correction.corrector.title",
6065
+ defaultMessage: "Upload supporting documents",
6066
+ description: "The title for the corrector form"
5830
6067
  }
5831
6068
  },
5832
- options: [
5833
- {
5834
- value: "ATTEST",
5835
- label: {
5836
- id: "correction.supportingDocuments.attest.label",
5837
- defaultMessage: "I attest to seeing supporting documentation and have a copy filed at my office",
5838
- description: ""
6069
+ {
6070
+ id: "correction.request.supportingDocuments",
6071
+ type: "RADIO_GROUP",
6072
+ label: {
6073
+ id: "correction.corrector.title",
6074
+ defaultMessage: "Who is requesting a change to this record?",
6075
+ description: "The title for the corrector form"
6076
+ },
6077
+ defaultValue: "",
6078
+ configuration: {
6079
+ styles: {
6080
+ size: "NORMAL"
5839
6081
  }
5840
6082
  },
5841
- {
5842
- value: "NOT_NEEDED",
5843
- label: {
5844
- id: "correction.supportingDocuments.notNeeded.label",
5845
- defaultMessage: "No supporting documents required",
5846
- description: ""
6083
+ options: [
6084
+ {
6085
+ value: "ATTEST",
6086
+ label: {
6087
+ id: "correction.supportingDocuments.attest.label",
6088
+ defaultMessage: "I attest to seeing supporting documentation and have a copy filed at my office",
6089
+ description: ""
6090
+ }
6091
+ },
6092
+ {
6093
+ value: "NOT_NEEDED",
6094
+ label: {
6095
+ id: "correction.supportingDocuments.notNeeded.label",
6096
+ defaultMessage: "No supporting documents required",
6097
+ description: ""
6098
+ }
5847
6099
  }
5848
- }
5849
- ]
5850
- }
5851
- ]
5852
- },
5853
- {
5854
- id: "correction-request.additional-details",
5855
- type: PageTypes.enum.FORM,
5856
- title: {
5857
- id: "event.football-club-membership.action.requestCorrection.form.section.corrector",
5858
- defaultMessage: "Reason for correction",
5859
- description: "This is the title of the section"
6100
+ ]
6101
+ }
6102
+ ]
5860
6103
  },
5861
- fields: [
5862
- {
5863
- id: "correction.request.reason",
5864
- type: FieldType.TEXT,
5865
- label: {
5866
- id: "correction.reason.title",
5867
- defaultMessage: "Reason for correction?",
5868
- description: "The title for the corrector form"
6104
+ {
6105
+ id: "correction-request.additional-details",
6106
+ type: PageTypes.enum.FORM,
6107
+ title: {
6108
+ id: "event.football-club-membership.action.requestCorrection.form.section.corrector",
6109
+ defaultMessage: "Reason for correction",
6110
+ description: "This is the title of the section"
6111
+ },
6112
+ fields: [
6113
+ {
6114
+ id: "correction.request.reason",
6115
+ type: FieldType.TEXT,
6116
+ label: {
6117
+ id: "correction.reason.title",
6118
+ defaultMessage: "Reason for correction?",
6119
+ description: "The title for the corrector form"
6120
+ }
5869
6121
  }
5870
- }
5871
- ]
5872
- }
5873
- ]
6122
+ ]
6123
+ }
6124
+ ]
6125
+ }
5874
6126
  },
5875
6127
  {
5876
6128
  type: ActionType.APPROVE_CORRECTION,
@@ -5953,10 +6205,10 @@ var footballClubMembershipEvent = defineConfig({
5953
6205
  id: "v2.advancedSearch.form.registrationDetails"
5954
6206
  },
5955
6207
  fields: [
5956
- event("legalStatus.REGISTERED.createdAtLocation").exact(),
5957
- event("legalStatus.REGISTERED.createdAt").range(),
5958
- event("status", statusOptions).exact(),
5959
- event("updatedAt", timePeriodOptions).range()
6208
+ event("legalStatuses.REGISTERED.createdAtLocation").exact(),
6209
+ event("legalStatuses.REGISTERED.acceptedAt").range(),
6210
+ event("status").exact(),
6211
+ event("updatedAt").range()
5960
6212
  ]
5961
6213
  },
5962
6214
  {
@@ -6169,8 +6421,9 @@ var v2BirthEvent = defineConfig({
6169
6421
  });
6170
6422
 
6171
6423
  // ../commons/src/events/test.utils.ts
6172
- var import_zod33 = require("zod");
6173
- var TestUserRole = import_zod33.z.enum([
6424
+ var import_zod34 = require("zod");
6425
+ var TEST_SYSTEM_IANA_TIMEZONE = "Asia/Dhaka";
6426
+ var TestUserRole = import_zod34.z.enum([
6174
6427
  "FIELD_AGENT",
6175
6428
  "LOCAL_REGISTRAR",
6176
6429
  "LOCAL_SYSTEM_ADMIN",
@@ -6225,6 +6478,7 @@ function mapFieldTypeToMockValue(field2, i, rng) {
6225
6478
  case FieldType.PAGE_HEADER:
6226
6479
  case FieldType.LOCATION:
6227
6480
  case FieldType.SELECT:
6481
+ case FieldType.SELECT_DATE_RANGE:
6228
6482
  case FieldType.COUNTRY:
6229
6483
  case FieldType.RADIO_GROUP:
6230
6484
  case FieldType.PARAGRAPH:
@@ -6255,14 +6509,19 @@ function mapFieldTypeToMockValue(field2, i, rng) {
6255
6509
  };
6256
6510
  case FieldType.DATE:
6257
6511
  return "2021-01-01";
6512
+ case FieldType.TIME:
6513
+ return "09:33";
6258
6514
  case FieldType.DATE_RANGE:
6259
- return ["2021-01-01", "2021-01-02"];
6515
+ return {
6516
+ start: "2021-01-01",
6517
+ end: "2021-01-31"
6518
+ };
6260
6519
  case FieldType.CHECKBOX:
6261
6520
  return true;
6262
6521
  case FieldType.SIGNATURE:
6263
6522
  case FieldType.FILE:
6264
6523
  return {
6265
- filename: "4f095fc4-4312-4de2-aa38-86dcc0f71044.png",
6524
+ path: "/ocrvs/4f095fc4-4312-4de2-aa38-86dcc0f71044.png",
6266
6525
  originalFilename: "abcd.png",
6267
6526
  type: "image/png"
6268
6527
  };
@@ -6325,7 +6584,11 @@ function eventPayloadGenerator(rng) {
6325
6584
  type: input.type ?? TENNIS_CLUB_MEMBERSHIP,
6326
6585
  id
6327
6586
  }),
6328
- draft: ({ eventId, actionType }, input = {}) => (0, import_lodash2.merge)(
6587
+ draft: ({
6588
+ eventId,
6589
+ actionType,
6590
+ annotation
6591
+ }, input = {}) => (0, import_lodash3.merge)(
6329
6592
  {
6330
6593
  id: getUUID(),
6331
6594
  eventId,
@@ -6341,11 +6604,16 @@ function eventPayloadGenerator(rng) {
6341
6604
  surname: "McLaren"
6342
6605
  },
6343
6606
  "applicant.dob": "2020-01-02",
6344
- "recommender.none": true
6607
+ "applicant.image": {
6608
+ path: "/ocrvs/e56d1dd3-2cd4-452a-b54e-bf3e2d830605.png",
6609
+ originalFilename: "Screenshot.png",
6610
+ type: "image/png"
6611
+ }
6345
6612
  },
6346
6613
  annotation: {
6347
6614
  "correction.requester.relationship": "ANOTHER_AGENT",
6348
- "correction.request.reason": "Child's name was incorrect"
6615
+ "correction.request.reason": "Child's name was incorrect",
6616
+ ...annotation
6349
6617
  },
6350
6618
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
6351
6619
  createdBy: "@todo",
@@ -6379,13 +6647,13 @@ function eventPayloadGenerator(rng) {
6379
6647
  notify: (eventId, input = {}) => {
6380
6648
  let declaration = input.declaration;
6381
6649
  if (!declaration) {
6382
- const partialDeclaration = (0, import_lodash2.omitBy)(
6650
+ const partialDeclaration = (0, import_lodash3.omitBy)(
6383
6651
  generateActionDeclarationInput(
6384
6652
  tennisClubMembershipEvent,
6385
6653
  ActionType.DECLARE,
6386
6654
  rng
6387
6655
  ),
6388
- import_lodash2.isString
6656
+ import_lodash3.isString
6389
6657
  );
6390
6658
  declaration = partialDeclaration;
6391
6659
  }
@@ -6488,10 +6756,13 @@ function eventPayloadGenerator(rng) {
6488
6756
  request: (eventId, input = {}) => ({
6489
6757
  type: ActionType.REQUEST_CORRECTION,
6490
6758
  transactionId: input.transactionId ?? getUUID(),
6491
- declaration: input.declaration ?? generateActionDeclarationInput(
6492
- tennisClubMembershipEvent,
6493
- ActionType.REQUEST_CORRECTION,
6494
- rng
6759
+ declaration: input.declaration ?? (0, import_lodash3.omit)(
6760
+ generateActionDeclarationInput(
6761
+ tennisClubMembershipEvent,
6762
+ ActionType.REQUEST_CORRECTION,
6763
+ rng
6764
+ ),
6765
+ ["applicant.email"]
6495
6766
  ),
6496
6767
  annotation: input.annotation ?? generateActionAnnotationInput(
6497
6768
  tennisClubMembershipEvent,
@@ -6514,7 +6785,7 @@ function eventPayloadGenerator(rng) {
6514
6785
  requestId,
6515
6786
  keepAssignment: input.keepAssignment
6516
6787
  }),
6517
- reject: (eventId, requestId, input = {}) => ({
6788
+ reject: (eventId, requestId, input) => ({
6518
6789
  type: ActionType.REJECT_CORRECTION,
6519
6790
  transactionId: input.transactionId ?? getUUID(),
6520
6791
  declaration: {},
@@ -6525,7 +6796,8 @@ function eventPayloadGenerator(rng) {
6525
6796
  ),
6526
6797
  eventId,
6527
6798
  requestId,
6528
- keepAssignment: input.keepAssignment
6799
+ keepAssignment: input.keepAssignment,
6800
+ reason: input.reason ?? { message: "" }
6529
6801
  })
6530
6802
  }
6531
6803
  }
@@ -6584,7 +6856,8 @@ function generateActionDocument({
6584
6856
  return {
6585
6857
  ...actionBase,
6586
6858
  requestId: getUUID(),
6587
- type: action
6859
+ type: action,
6860
+ reason: { message: "Correction rejection" }
6588
6861
  };
6589
6862
  case ActionType.REGISTER:
6590
6863
  return {
@@ -6712,7 +6985,7 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
6712
6985
  createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
6713
6986
  updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
6714
6987
  createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
6715
- updatedAt: overrides.updatedAt ?? (0, import_addDays.default)(new Date(createdAt), 1).toISOString(),
6988
+ updatedAt: overrides.updatedAt ?? (0, import_date_fns4.addDays)(new Date(createdAt), 1).toISOString(),
6716
6989
  assignedTo: overrides.assignedTo ?? null,
6717
6990
  updatedBy: overrides.updatedBy ?? generateUuid(rng),
6718
6991
  updatedByUserRole: overrides.updatedByUserRole ?? "FIELD_AGENT",
@@ -6784,7 +7057,7 @@ function isFieldConfigDefaultValue(value) {
6784
7057
  }
6785
7058
 
6786
7059
  // ../commons/src/events/scopes.ts
6787
- var import_lodash3 = require("lodash");
7060
+ var import_lodash4 = require("lodash");
6788
7061
  var CONFIG_GET_ALLOWED_SCOPES = [
6789
7062
  SCOPES.RECORD_DECLARE,
6790
7063
  SCOPES.RECORD_READ,
@@ -6831,7 +7104,11 @@ var ACTION_ALLOWED_SCOPES = {
6831
7104
  [ActionType.REGISTER]: [SCOPES.RECORD_REGISTER],
6832
7105
  [ActionType.PRINT_CERTIFICATE]: [SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES],
6833
7106
  [ActionType.REQUEST_CORRECTION]: [
6834
- SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION
7107
+ SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION,
7108
+ SCOPES.RECORD_REGISTRATION_CORRECT
7109
+ ],
7110
+ [ExclusiveActions.REVIEW_CORRECTION_REQUEST]: [
7111
+ SCOPES.RECORD_REGISTRATION_CORRECT
6835
7112
  ],
6836
7113
  [ActionType.REJECT_CORRECTION]: [SCOPES.RECORD_REGISTRATION_CORRECT],
6837
7114
  [ActionType.APPROVE_CORRECTION]: [SCOPES.RECORD_REGISTRATION_CORRECT],
@@ -6868,19 +7145,19 @@ var WRITE_ACTION_SCOPES = [
6868
7145
  ...ACTION_ALLOWED_SCOPES[ActionType.PRINT_CERTIFICATE]
6869
7146
  ];
6870
7147
  function hasAnyOfScopes(a, b) {
6871
- return (0, import_lodash3.intersection)(a, b).length > 0;
7148
+ return (0, import_lodash4.intersection)(a, b).length > 0;
6872
7149
  }
6873
7150
 
6874
7151
  // ../commons/src/events/serializers/user/deserializer.ts
6875
- var import_zod34 = require("zod");
7152
+ var import_zod35 = require("zod");
6876
7153
  var UserWithPrimaryOffice = User.extend({
6877
- primaryOfficeId: import_zod34.z.string()
7154
+ primaryOfficeId: import_zod35.z.string()
6878
7155
  });
6879
7156
  function userDeserializer(serializedUserField, user2) {
6880
7157
  if (typeof serializedUserField === "string") {
6881
7158
  return serializedUserField;
6882
7159
  }
6883
- if (serializedUserField.$userField === "name" || serializedUserField.$userField === "signatureFilename") {
7160
+ if (serializedUserField.$userField === "name" || serializedUserField.$userField === "signature" || serializedUserField.$userField === "avatar") {
6884
7161
  throw new Error(
6885
7162
  `Deserializer for ${serializedUserField.$userField} is not implemented yet`
6886
7163
  );
@@ -6962,20 +7239,13 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
6962
7239
  ActionType.ARCHIVE,
6963
7240
  ActionType.REJECT
6964
7241
  ],
6965
- [EventStatus.enum.REJECTED]: [
6966
- ActionType.READ,
6967
- ActionType.DECLARE,
6968
- ActionType.VALIDATE
6969
- ],
6970
7242
  [EventStatus.enum.REGISTERED]: [
6971
7243
  ActionType.READ,
6972
7244
  ActionType.PRINT_CERTIFICATE,
6973
- ActionType.REQUEST_CORRECTION
6974
- ],
6975
- [EventStatus.enum.CERTIFIED]: [
6976
- ActionType.READ,
6977
- ActionType.PRINT_CERTIFICATE,
6978
- ActionType.REQUEST_CORRECTION
7245
+ ActionType.REQUEST_CORRECTION,
7246
+ ActionType.APPROVE_CORRECTION,
7247
+ ActionType.REJECT_CORRECTION,
7248
+ ExclusiveActions.REVIEW_CORRECTION_REQUEST
6979
7249
  ],
6980
7250
  [EventStatus.enum.ARCHIVED]: [
6981
7251
  ActionType.READ,
@@ -6983,3 +7253,13 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
6983
7253
  ActionType.UNASSIGN
6984
7254
  ]
6985
7255
  };
7256
+ var getAvailableActionsForEvent = (event2) => {
7257
+ if (event2.flags.includes(InherentFlags.REJECTED)) {
7258
+ return [
7259
+ ActionType.READ,
7260
+ event2.status === EventStatus.Enum.VALIDATED ? ActionType.VALIDATE : ActionType.DECLARE,
7261
+ ActionType.ARCHIVE
7262
+ ];
7263
+ }
7264
+ return AVAILABLE_ACTIONS_BY_EVENT_STATUS[event2.status];
7265
+ };