@opencrvs/toolkit 1.8.0-rc.f7aaf07 → 1.8.0-rc.f7e1622

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 (37) hide show
  1. package/dist/commons/api/router.d.ts +2228 -15340
  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 +33832 -35902
  5. package/dist/commons/events/ActionDocument.d.ts +3439 -1912
  6. package/dist/commons/events/ActionInput.d.ts +2406 -1506
  7. package/dist/commons/events/ActionType.d.ts +7 -4
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +100 -51
  9. package/dist/commons/events/CompositeFieldValue.d.ts +15 -15
  10. package/dist/commons/events/CountryConfigQueryInput.d.ts +1798 -734
  11. package/dist/commons/events/CreatedAtLocation.d.ts +1 -2
  12. package/dist/commons/events/Draft.d.ts +208 -136
  13. package/dist/commons/events/EventConfig.d.ts +19880 -23808
  14. package/dist/commons/events/EventDocument.d.ts +1863 -1220
  15. package/dist/commons/events/EventIndex.d.ts +514 -316
  16. package/dist/commons/events/EventMetadata.d.ts +44 -33
  17. package/dist/commons/events/FieldConfig.d.ts +1171 -385
  18. package/dist/commons/events/FieldType.d.ts +2 -1
  19. package/dist/commons/events/FieldTypeMapping.d.ts +73 -41
  20. package/dist/commons/events/FieldValue.d.ts +57 -28
  21. package/dist/commons/events/FormConfig.d.ts +7380 -2640
  22. package/dist/commons/events/PageConfig.d.ts +1499 -343
  23. package/dist/commons/events/SummaryConfig.d.ts +10 -10
  24. package/dist/commons/events/User.d.ts +6 -3
  25. package/dist/commons/events/WorkqueueConfig.d.ts +3153 -1327
  26. package/dist/commons/events/defineConfig.d.ts +2475 -3245
  27. package/dist/commons/events/event.d.ts +10 -18
  28. package/dist/commons/events/field.d.ts +13 -1
  29. package/dist/commons/events/scopes.d.ts +2 -1
  30. package/dist/commons/events/test.utils.d.ts +74 -40
  31. package/dist/commons/events/transactions.d.ts +1 -1
  32. package/dist/commons/events/utils.d.ts +8553 -6994
  33. package/dist/conditionals/index.js +23 -53
  34. package/dist/events/index.js +1685 -1402
  35. package/dist/scopes/index.d.ts +92 -6
  36. package/dist/scopes/index.js +38 -9
  37. package/package.json +3 -3
@@ -69,11 +69,12 @@ __export(events_exports, {
69
69
  Conditional: () => Conditional,
70
70
  ConditionalType: () => ConditionalType,
71
71
  ConfirmableActions: () => ConfirmableActions,
72
- CustomFlags: () => CustomFlags,
72
+ ContainsFlags: () => ContainsFlags,
73
73
  DEFAULT_DATE_OF_EVENT_PROPERTY: () => DEFAULT_DATE_OF_EVENT_PROPERTY,
74
74
  DataEntry: () => DataEntry,
75
75
  DataFieldValue: () => DataFieldValue,
76
76
  DateCondition: () => DateCondition,
77
+ DateRangeField: () => DateRangeField,
77
78
  DateRangeFieldValue: () => DateRangeFieldValue,
78
79
  DateValue: () => DateValue,
79
80
  DatetimeValue: () => DatetimeValue,
@@ -106,6 +107,8 @@ __export(events_exports, {
106
107
  Exact: () => Exact,
107
108
  ExactDate: () => ExactDate,
108
109
  ExactStatus: () => ExactStatus,
110
+ ExactUserType: () => ExactUserType,
111
+ ExclusiveActions: () => ExclusiveActions,
109
112
  FieldConditional: () => FieldConditional,
110
113
  FieldConfig: () => FieldConfig,
111
114
  FieldConfigSchema: () => FieldConfigSchema,
@@ -124,6 +127,7 @@ __export(events_exports, {
124
127
  GenericAddressValue: () => GenericAddressValue,
125
128
  GeographicalArea: () => GeographicalArea,
126
129
  ImageMimeType: () => ImageMimeType,
130
+ InherentFlags: () => InherentFlags,
127
131
  LanguageConfig: () => LanguageConfig,
128
132
  LegalStatuses: () => LegalStatuses,
129
133
  MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
@@ -131,7 +135,6 @@ __export(events_exports, {
131
135
  NameFieldUpdateValue: () => NameFieldUpdateValue,
132
136
  NameFieldValue: () => NameFieldValue,
133
137
  NonEmptyTextValue: () => NonEmptyTextValue,
134
- Not: () => Not,
135
138
  NotifyActionInput: () => NotifyActionInput,
136
139
  NumberFieldValue: () => NumberFieldValue,
137
140
  PageConfig: () => PageConfig,
@@ -141,7 +144,6 @@ __export(events_exports, {
141
144
  QueryInput: () => QueryInput,
142
145
  QueryType: () => QueryType,
143
146
  Range: () => Range,
144
- RangeDate: () => RangeDate,
145
147
  ReadActionInput: () => ReadActionInput,
146
148
  RegisterAction: () => RegisterAction,
147
149
  RegisterActionInput: () => RegisterActionInput,
@@ -155,12 +157,16 @@ __export(events_exports, {
155
157
  RuralAddressValue: () => RuralAddressValue,
156
158
  SearchField: () => SearchField,
157
159
  SearchQueryParams: () => SearchQueryParams,
160
+ SearchScopeAccessLevels: () => SearchScopeAccessLevels,
161
+ SelectDateRangeField: () => SelectDateRangeField,
162
+ SelectDateRangeOption: () => SelectDateRangeOption,
163
+ SelectDateRangeValue: () => SelectDateRangeValue,
158
164
  SelectOption: () => SelectOption,
159
165
  ShowConditional: () => ShowConditional,
160
166
  SignatureFieldValue: () => SignatureFieldValue,
161
- StatusChangingActions: () => StatusChangingActions,
162
167
  SummaryConfig: () => SummaryConfig,
163
168
  TENNIS_CLUB_MEMBERSHIP: () => TENNIS_CLUB_MEMBERSHIP,
169
+ TEST_SYSTEM_IANA_TIMEZONE: () => TEST_SYSTEM_IANA_TIMEZONE,
164
170
  TestUserRole: () => TestUserRole,
165
171
  TextValue: () => TextValue,
166
172
  TranslationConfig: () => TranslationConfig,
@@ -172,6 +178,7 @@ __export(events_exports, {
172
178
  ValidationConfig: () => ValidationConfig,
173
179
  VerificationActionConfig: () => VerificationActionConfig,
174
180
  VerificationPageConfig: () => VerificationPageConfig,
181
+ VisibleStatus: () => VisibleStatus,
175
182
  WRITE_ACTION_SCOPES: () => WRITE_ACTION_SCOPES,
176
183
  Within: () => Within,
177
184
  WorkqueueActionsWithDefault: () => WorkqueueActionsWithDefault,
@@ -188,11 +195,11 @@ __export(events_exports, {
188
195
  alwaysTrue: () => alwaysTrue,
189
196
  and: () => and,
190
197
  annotationActions: () => annotationActions,
198
+ applyDeclarationToEventIndex: () => applyDeclarationToEventIndex,
191
199
  applyDraftsToEventIndex: () => applyDraftsToEventIndex,
192
200
  areConditionsMet: () => areConditionsMet,
193
201
  compositeFieldTypes: () => compositeFieldTypes,
194
202
  createEmptyDraft: () => createEmptyDraft,
195
- createEventConditionals: () => createEventConditionals,
196
203
  createFieldConditionals: () => createFieldConditionals,
197
204
  createPrng: () => createPrng,
198
205
  createValidationSchema: () => createValidationSchema,
@@ -228,8 +235,10 @@ __export(events_exports, {
228
235
  generateEventDraftDocument: () => generateEventDraftDocument,
229
236
  generateRandomName: () => generateRandomName,
230
237
  generateRandomSignature: () => generateRandomSignature,
238
+ generateRegistrationNumber: () => generateRegistrationNumber,
231
239
  generateTransactionId: () => generateTransactionId,
232
240
  generateTranslationConfig: () => generateTranslationConfig,
241
+ generateUuid: () => generateUuid,
233
242
  generateWorkqueues: () => generateWorkqueues,
234
243
  getAcceptedActions: () => getAcceptedActions,
235
244
  getActionAnnotation: () => getActionAnnotation,
@@ -241,6 +250,7 @@ __export(events_exports, {
241
250
  getAnnotationFromDrafts: () => getAnnotationFromDrafts,
242
251
  getAssignedUserFromActions: () => getAssignedUserFromActions,
243
252
  getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
253
+ getAvailableActionsForEvent: () => getAvailableActionsForEvent,
244
254
  getCurrentEventState: () => getCurrentEventState,
245
255
  getCurrentEventStateWithDrafts: () => getCurrentEventStateWithDrafts,
246
256
  getDeclaration: () => getDeclaration,
@@ -249,6 +259,7 @@ __export(events_exports, {
249
259
  getDeclarationPages: () => getDeclarationPages,
250
260
  getEventConfigById: () => getEventConfigById,
251
261
  getMixedPath: () => getMixedPath,
262
+ getPrintCertificatePages: () => getPrintCertificatePages,
252
263
  getRandomDate: () => getRandomDate,
253
264
  getRandomDatetime: () => getRandomDatetime,
254
265
  getStatusFromActions: () => getStatusFromActions,
@@ -287,6 +298,7 @@ __export(events_exports, {
287
298
  isParagraphFieldType: () => isParagraphFieldType,
288
299
  isPhoneFieldType: () => isPhoneFieldType,
289
300
  isRadioGroupFieldType: () => isRadioGroupFieldType,
301
+ isSelectDateRangeFieldType: () => isSelectDateRangeFieldType,
290
302
  isSelectFieldType: () => isSelectFieldType,
291
303
  isSignatureFieldType: () => isSignatureFieldType,
292
304
  isTemplateVariable: () => isTemplateVariable,
@@ -305,7 +317,9 @@ __export(events_exports, {
305
317
  omitHiddenFields: () => omitHiddenFields,
306
318
  omitHiddenPaginatedFields: () => omitHiddenPaginatedFields,
307
319
  or: () => or,
320
+ resolveDateOfEvent: () => resolveDateOfEvent,
308
321
  runFieldValidations: () => runFieldValidations,
322
+ timePeriodToDateRange: () => timePeriodToDateRange,
309
323
  user: () => user,
310
324
  validate: () => validate,
311
325
  validateFieldInput: () => validateFieldInput,
@@ -319,7 +333,7 @@ var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
319
333
  var BIRTH_EVENT = "v2-birth";
320
334
 
321
335
  // ../commons/src/events/ActionConfig.ts
322
- var import_zod9 = require("zod");
336
+ var import_zod10 = require("zod");
323
337
 
324
338
  // ../commons/src/events/Conditional.ts
325
339
  var import_zod = require("zod");
@@ -370,12 +384,6 @@ var FieldConditional = import_zod.z.discriminatedUnion("type", [
370
384
  ref: "FieldConditional"
371
385
  });
372
386
 
373
- // ../commons/src/events/PageConfig.ts
374
- var import_zod6 = require("zod");
375
-
376
- // ../commons/src/events/FieldConfig.ts
377
- var import_zod5 = require("zod");
378
-
379
387
  // ../commons/src/events/TranslationConfig.ts
380
388
  var import_zod2 = require("zod");
381
389
  var import_zod_openapi2 = require("zod-openapi");
@@ -393,6 +401,110 @@ var TranslationConfig = import_zod2.z.object({
393
401
  ref: "TranslationConfig"
394
402
  });
395
403
 
404
+ // ../commons/src/events/ActionType.ts
405
+ var import_zod3 = require("zod");
406
+ var ActionType = {
407
+ // Pre-declaration actions
408
+ DELETE: "DELETE",
409
+ CREATE: "CREATE",
410
+ NOTIFY: "NOTIFY",
411
+ // Declaration actions
412
+ DECLARE: "DECLARE",
413
+ VALIDATE: "VALIDATE",
414
+ REGISTER: "REGISTER",
415
+ // Declaration system actions. Non-configurable.
416
+ DETECT_DUPLICATE: "DETECT_DUPLICATE",
417
+ REJECT: "REJECT",
418
+ // REJECT_DECLARATION
419
+ MARKED_AS_DUPLICATE: "MARKED_AS_DUPLICATE",
420
+ // MARK_AS_DUPLICATE
421
+ ARCHIVE: "ARCHIVE",
422
+ // Record actions
423
+ PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
424
+ REQUEST_CORRECTION: "REQUEST_CORRECTION",
425
+ REJECT_CORRECTION: "REJECT_CORRECTION",
426
+ APPROVE_CORRECTION: "APPROVE_CORRECTION",
427
+ // General actions
428
+ READ: "READ",
429
+ ASSIGN: "ASSIGN",
430
+ UNASSIGN: "UNASSIGN"
431
+ };
432
+ var ConfirmableActions = [
433
+ ActionType.NOTIFY,
434
+ ActionType.DECLARE,
435
+ ActionType.VALIDATE,
436
+ ActionType.REGISTER,
437
+ ActionType.REJECT,
438
+ ActionType.ARCHIVE,
439
+ ActionType.PRINT_CERTIFICATE,
440
+ ActionType.REQUEST_CORRECTION,
441
+ ActionType.APPROVE_CORRECTION,
442
+ ActionType.REJECT_CORRECTION
443
+ ];
444
+ var ActionTypes = import_zod3.z.enum([
445
+ "DELETE",
446
+ "CREATE",
447
+ "NOTIFY",
448
+ "DECLARE",
449
+ "VALIDATE",
450
+ "REGISTER",
451
+ "DETECT_DUPLICATE",
452
+ "REJECT",
453
+ "MARKED_AS_DUPLICATE",
454
+ "ARCHIVE",
455
+ "PRINT_CERTIFICATE",
456
+ "REQUEST_CORRECTION",
457
+ "REJECT_CORRECTION",
458
+ "APPROVE_CORRECTION",
459
+ "READ",
460
+ "ASSIGN",
461
+ "UNASSIGN"
462
+ ]);
463
+ var ExclusiveActions = {
464
+ REVIEW_CORRECTION_REQUEST: "REVIEW_CORRECTION_REQUEST"
465
+ };
466
+ var declarationActionValues = [
467
+ ActionTypes.enum.DECLARE,
468
+ ActionTypes.enum.VALIDATE,
469
+ ActionTypes.enum.REGISTER
470
+ ];
471
+ var DeclarationActions = ActionTypes.extract(declarationActionValues);
472
+ var declarationUpdateActionValues = [
473
+ ...declarationActionValues,
474
+ ActionTypes.enum.REQUEST_CORRECTION
475
+ ];
476
+ var DeclarationUpdateActions = ActionTypes.extract(
477
+ declarationUpdateActionValues
478
+ );
479
+ var annotationActions = ActionTypes.exclude(declarationActionValues);
480
+ var writeActions = ActionTypes.exclude([
481
+ ActionType.CREATE,
482
+ ActionType.READ,
483
+ ActionType.ASSIGN,
484
+ ActionType.UNASSIGN
485
+ ]);
486
+ var workqueueActions = ActionTypes.exclude([
487
+ ActionType.CREATE,
488
+ ActionType.NOTIFY,
489
+ ActionType.DETECT_DUPLICATE,
490
+ ActionType.REJECT,
491
+ ActionType.MARKED_AS_DUPLICATE,
492
+ ActionType.ARCHIVE,
493
+ ActionType.REJECT_CORRECTION,
494
+ ActionType.APPROVE_CORRECTION
495
+ ]);
496
+ var META_ACTIONS = [
497
+ ActionType.ASSIGN,
498
+ ActionType.UNASSIGN,
499
+ ActionType.READ
500
+ ];
501
+ function isMetaAction(actionType) {
502
+ return META_ACTIONS.includes(actionType);
503
+ }
504
+
505
+ // ../commons/src/events/FieldConfig.ts
506
+ var import_zod7 = require("zod");
507
+
396
508
  // ../commons/src/events/FieldType.ts
397
509
  var FieldType = {
398
510
  NAME: "NAME",
@@ -405,6 +517,9 @@ var FieldType = {
405
517
  EMAIL: "EMAIL",
406
518
  DATE: "DATE",
407
519
  DATE_RANGE: "DATE_RANGE",
520
+ // // Internal use, only for search functionality
521
+ SELECT_DATE_RANGE: "SELECT_DATE_RANGE",
522
+ // Internal use, only for search functionality
408
523
  PARAGRAPH: "PARAGRAPH",
409
524
  PAGE_HEADER: "PAGE_HEADER",
410
525
  RADIO_GROUP: "RADIO_GROUP",
@@ -431,10 +546,24 @@ var compositeFieldTypes = [
431
546
  ];
432
547
 
433
548
  // ../commons/src/events/FieldValue.ts
549
+ var import_zod6 = require("zod");
550
+
551
+ // ../commons/src/documents.ts
434
552
  var import_zod4 = require("zod");
553
+ var import_zod_openapi3 = require("zod-openapi");
554
+ (0, import_zod_openapi3.extendZodWithOpenApi)(import_zod4.z);
555
+ var FullDocumentURL = import_zod4.z.string().brand("FullDocumentURL").describe(
556
+ "A full url with protocol, host, bucket name, starting from the root of the S3 server, https://minio/bucket-name/document-id.jpg"
557
+ );
558
+ var FullDocumentPath = import_zod4.z.string().transform((val) => val.startsWith("/") ? val : `/${val}`).openapi({ effectType: "input", type: "string" }).describe(
559
+ "A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
560
+ );
561
+ var DocumentPath = import_zod4.z.string().brand("DocumentPath").describe(
562
+ "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"
563
+ );
435
564
 
436
565
  // ../commons/src/events/CompositeFieldValue.ts
437
- var import_zod3 = require("zod");
566
+ var import_zod5 = require("zod");
438
567
  var GeographicalArea = {
439
568
  URBAN: "URBAN",
440
569
  RURAL: "RURAL"
@@ -443,101 +572,113 @@ var AddressType = {
443
572
  DOMESTIC: "DOMESTIC",
444
573
  INTERNATIONAL: "INTERNATIONAL"
445
574
  };
446
- var FileFieldValue = import_zod3.z.object({
447
- filename: import_zod3.z.string(),
448
- originalFilename: import_zod3.z.string(),
449
- type: import_zod3.z.string()
575
+ var FileFieldValue = import_zod5.z.object({
576
+ path: FullDocumentPath,
577
+ originalFilename: import_zod5.z.string(),
578
+ type: import_zod5.z.string()
450
579
  });
451
- var AdminStructure = import_zod3.z.object({
452
- country: import_zod3.z.string(),
453
- addressType: import_zod3.z.literal(AddressType.DOMESTIC),
454
- province: import_zod3.z.string(),
455
- district: import_zod3.z.string()
580
+ var AdminStructure = import_zod5.z.object({
581
+ country: import_zod5.z.string(),
582
+ addressType: import_zod5.z.literal(AddressType.DOMESTIC),
583
+ province: import_zod5.z.string(),
584
+ district: import_zod5.z.string()
456
585
  });
457
586
  var UrbanAddressValue = AdminStructure.extend({
458
- urbanOrRural: import_zod3.z.literal(GeographicalArea.URBAN),
459
- town: import_zod3.z.string().optional(),
460
- residentialArea: import_zod3.z.string().optional(),
461
- street: import_zod3.z.string().optional(),
462
- number: import_zod3.z.string().optional(),
463
- zipCode: import_zod3.z.string().optional()
587
+ urbanOrRural: import_zod5.z.literal(GeographicalArea.URBAN),
588
+ town: import_zod5.z.string().optional(),
589
+ residentialArea: import_zod5.z.string().optional(),
590
+ street: import_zod5.z.string().optional(),
591
+ number: import_zod5.z.string().optional(),
592
+ zipCode: import_zod5.z.string().optional()
464
593
  });
465
594
  var RuralAddressValue = AdminStructure.extend({
466
- urbanOrRural: import_zod3.z.literal(GeographicalArea.RURAL),
467
- village: import_zod3.z.string().optional()
595
+ urbanOrRural: import_zod5.z.literal(GeographicalArea.RURAL),
596
+ village: import_zod5.z.string().optional()
468
597
  });
469
598
  var UrbanAddressUpdateValue = AdminStructure.extend({
470
- urbanOrRural: import_zod3.z.literal(GeographicalArea.URBAN),
471
- town: import_zod3.z.string().nullish(),
472
- residentialArea: import_zod3.z.string().nullish(),
473
- street: import_zod3.z.string().nullish(),
474
- number: import_zod3.z.string().nullish(),
475
- zipCode: import_zod3.z.string().nullish()
599
+ urbanOrRural: import_zod5.z.literal(GeographicalArea.URBAN),
600
+ town: import_zod5.z.string().nullish(),
601
+ residentialArea: import_zod5.z.string().nullish(),
602
+ street: import_zod5.z.string().nullish(),
603
+ number: import_zod5.z.string().nullish(),
604
+ zipCode: import_zod5.z.string().nullish()
476
605
  });
477
- var NameFieldValue = import_zod3.z.object({
478
- firstname: import_zod3.z.string(),
479
- surname: import_zod3.z.string(),
480
- middlename: import_zod3.z.string().optional()
606
+ var NameFieldValue = import_zod5.z.object({
607
+ firstname: import_zod5.z.string(),
608
+ surname: import_zod5.z.string(),
609
+ middlename: import_zod5.z.string().optional()
481
610
  });
482
- var NameFieldUpdateValue = import_zod3.z.object({
483
- firstname: import_zod3.z.string(),
484
- surname: import_zod3.z.string(),
485
- middlename: import_zod3.z.string().nullish()
486
- }).or(import_zod3.z.null()).or(import_zod3.z.undefined());
611
+ var NameFieldUpdateValue = import_zod5.z.object({
612
+ firstname: import_zod5.z.string().nullish(),
613
+ surname: import_zod5.z.string().nullish(),
614
+ middlename: import_zod5.z.string().nullish()
615
+ }).or(import_zod5.z.null()).or(import_zod5.z.undefined());
487
616
  var RuralAddressUpdateValue = AdminStructure.extend({
488
- urbanOrRural: import_zod3.z.literal(GeographicalArea.RURAL),
489
- village: import_zod3.z.string().nullish()
617
+ urbanOrRural: import_zod5.z.literal(GeographicalArea.RURAL),
618
+ village: import_zod5.z.string().nullish()
490
619
  });
491
- var GenericAddressValue = import_zod3.z.object({
492
- country: import_zod3.z.string(),
493
- addressType: import_zod3.z.literal(AddressType.INTERNATIONAL),
494
- state: import_zod3.z.string(),
495
- district2: import_zod3.z.string(),
496
- cityOrTown: import_zod3.z.string().optional(),
497
- addressLine1: import_zod3.z.string().optional(),
498
- addressLine2: import_zod3.z.string().optional(),
499
- addressLine3: import_zod3.z.string().optional(),
500
- postcodeOrZip: import_zod3.z.string().optional()
620
+ var GenericAddressValue = import_zod5.z.object({
621
+ country: import_zod5.z.string(),
622
+ addressType: import_zod5.z.literal(AddressType.INTERNATIONAL),
623
+ state: import_zod5.z.string(),
624
+ district2: import_zod5.z.string(),
625
+ cityOrTown: import_zod5.z.string().optional(),
626
+ addressLine1: import_zod5.z.string().optional(),
627
+ addressLine2: import_zod5.z.string().optional(),
628
+ addressLine3: import_zod5.z.string().optional(),
629
+ postcodeOrZip: import_zod5.z.string().optional()
501
630
  });
502
- var AddressFieldValue = import_zod3.z.discriminatedUnion("urbanOrRural", [UrbanAddressValue, RuralAddressValue]).or(GenericAddressValue);
503
- var GenericAddressUpdateValue = import_zod3.z.object({
504
- country: import_zod3.z.string(),
505
- addressType: import_zod3.z.literal(AddressType.INTERNATIONAL),
506
- state: import_zod3.z.string(),
507
- district2: import_zod3.z.string(),
508
- cityOrTown: import_zod3.z.string().nullish(),
509
- addressLine1: import_zod3.z.string().nullish(),
510
- addressLine2: import_zod3.z.string().nullish(),
511
- addressLine3: import_zod3.z.string().nullish(),
512
- postcodeOrZip: import_zod3.z.string().nullish()
631
+ var AddressFieldValue = import_zod5.z.discriminatedUnion("urbanOrRural", [UrbanAddressValue, RuralAddressValue]).or(GenericAddressValue);
632
+ var GenericAddressUpdateValue = import_zod5.z.object({
633
+ country: import_zod5.z.string(),
634
+ addressType: import_zod5.z.literal(AddressType.INTERNATIONAL),
635
+ state: import_zod5.z.string(),
636
+ district2: import_zod5.z.string(),
637
+ cityOrTown: import_zod5.z.string().nullish(),
638
+ addressLine1: import_zod5.z.string().nullish(),
639
+ addressLine2: import_zod5.z.string().nullish(),
640
+ addressLine3: import_zod5.z.string().nullish(),
641
+ postcodeOrZip: import_zod5.z.string().nullish()
513
642
  });
514
- var AddressFieldUpdateValue = import_zod3.z.discriminatedUnion("urbanOrRural", [
643
+ var AddressFieldUpdateValue = import_zod5.z.discriminatedUnion("urbanOrRural", [
515
644
  UrbanAddressUpdateValue,
516
645
  RuralAddressUpdateValue
517
646
  ]).or(GenericAddressUpdateValue);
518
- var FileFieldValueWithOption = import_zod3.z.object({
519
- filename: import_zod3.z.string(),
520
- originalFilename: import_zod3.z.string(),
521
- type: import_zod3.z.string(),
522
- option: import_zod3.z.string()
647
+ var FileFieldValueWithOption = import_zod5.z.object({
648
+ path: FullDocumentPath,
649
+ originalFilename: import_zod5.z.string(),
650
+ type: import_zod5.z.string(),
651
+ option: import_zod5.z.string()
523
652
  });
524
- var FileFieldWithOptionValue = import_zod3.z.array(FileFieldValueWithOption);
653
+ var FileFieldWithOptionValue = import_zod5.z.array(FileFieldValueWithOption);
525
654
 
526
655
  // ../commons/src/events/FieldValue.ts
527
- var TextValue = import_zod4.z.string();
656
+ var TextValue = import_zod6.z.string();
528
657
  var NonEmptyTextValue = TextValue.min(1);
529
- var DateValue = import_zod4.z.string().date().describe("Date in the format YYYY-MM-DD");
530
- var DatetimeValue = import_zod4.z.string().datetime();
531
- var DateRangeFieldValue = DateValue.or(import_zod4.z.tuple([DateValue, DateValue]));
532
- var EmailValue = import_zod4.z.string().email();
533
- var CheckboxFieldValue = import_zod4.z.boolean();
534
- var NumberFieldValue = import_zod4.z.number();
535
- var DataFieldValue = import_zod4.z.undefined();
536
- var SignatureFieldValue = import_zod4.z.string();
537
- var FieldValue = import_zod4.z.union([
658
+ var DateValue = import_zod6.z.string().date().describe("Date in the format YYYY-MM-DD");
659
+ var DatetimeValue = import_zod6.z.string().datetime();
660
+ var SelectDateRangeValue = import_zod6.z.enum([
661
+ "last7Days",
662
+ "last30Days",
663
+ "last90Days",
664
+ "last365Days"
665
+ ]);
666
+ var DateRangeFieldValue = import_zod6.z.object({
667
+ start: DateValue,
668
+ end: DateValue
669
+ }).or(DateValue).describe(
670
+ "Date range with start and end dates in the format YYYY-MM-DD. Inclusive start, exclusive end."
671
+ );
672
+ var EmailValue = import_zod6.z.string().email();
673
+ var CheckboxFieldValue = import_zod6.z.boolean();
674
+ var NumberFieldValue = import_zod6.z.number();
675
+ var DataFieldValue = import_zod6.z.undefined();
676
+ var SignatureFieldValue = import_zod6.z.string();
677
+ var FieldValue = import_zod6.z.union([
538
678
  TextValue,
539
679
  DateValue,
540
680
  DateRangeFieldValue,
681
+ SelectDateRangeValue,
541
682
  CheckboxFieldValue,
542
683
  NumberFieldValue,
543
684
  FileFieldValue,
@@ -549,10 +690,11 @@ var FieldValue = import_zod4.z.union([
549
690
  NameFieldValue,
550
691
  NameFieldUpdateValue
551
692
  ]);
552
- var FieldUpdateValue = import_zod4.z.union([
693
+ var FieldUpdateValue = import_zod6.z.union([
553
694
  TextValue,
554
695
  DateValue,
555
696
  DateRangeFieldValue,
697
+ SelectDateRangeValue,
556
698
  CheckboxFieldValue,
557
699
  NumberFieldValue,
558
700
  FileFieldValue,
@@ -565,63 +707,68 @@ var FieldUpdateValue = import_zod4.z.union([
565
707
  ]);
566
708
 
567
709
  // ../commons/src/events/FieldConfig.ts
568
- var import_zod_openapi3 = require("zod-openapi");
569
- (0, import_zod_openapi3.extendZodWithOpenApi)(import_zod5.z);
570
- var FieldId = import_zod5.z.string().describe("Unique identifier for the field");
571
- var FieldReference = import_zod5.z.object({
710
+ var import_zod_openapi4 = require("zod-openapi");
711
+ (0, import_zod_openapi4.extendZodWithOpenApi)(import_zod7.z);
712
+ var FieldId = import_zod7.z.string().describe("Unique identifier for the field");
713
+ var FieldReference = import_zod7.z.object({
572
714
  $$field: FieldId
573
715
  }).describe("Reference to a field by its ID");
574
- var ParentReference = FieldReference.optional();
575
- var ValidationConfig = import_zod5.z.object({
716
+ var ValidationConfig = import_zod7.z.object({
576
717
  validator: Conditional,
577
718
  message: TranslationConfig
578
719
  });
579
- var BaseField = import_zod5.z.object({
720
+ var BaseField = import_zod7.z.object({
580
721
  id: FieldId,
581
- parent: ParentReference,
582
- conditionals: import_zod5.z.array(FieldConditional).default([]).optional(),
583
- required: import_zod5.z.boolean().default(false).optional(),
584
- placeholder: TranslationConfig.optional(),
585
- validation: import_zod5.z.array(ValidationConfig).default([]).optional(),
586
722
  label: TranslationConfig,
723
+ parent: FieldReference.optional().describe(
724
+ "Reference to a parent field. If a field has a parent, it will be reset when the parent field is changed."
725
+ ),
726
+ required: import_zod7.z.boolean().default(false).optional(),
727
+ conditionals: import_zod7.z.array(FieldConditional).default([]).optional(),
728
+ secured: import_zod7.z.boolean().default(false).optional(),
729
+ placeholder: TranslationConfig.optional(),
730
+ validation: import_zod7.z.array(ValidationConfig).default([]).optional(),
587
731
  helperText: TranslationConfig.optional(),
588
- hideLabel: import_zod5.z.boolean().default(false).optional()
732
+ hideLabel: import_zod7.z.boolean().default(false).optional(),
733
+ uncorrectable: import_zod7.z.boolean().default(false).optional().describe(
734
+ "Indicates if the field can be changed during a record correction."
735
+ )
589
736
  });
590
737
  var Divider = BaseField.extend({
591
- type: import_zod5.z.literal(FieldType.DIVIDER)
738
+ type: import_zod7.z.literal(FieldType.DIVIDER)
592
739
  });
593
740
  var TextField = BaseField.extend({
594
- type: import_zod5.z.literal(FieldType.TEXT),
741
+ type: import_zod7.z.literal(FieldType.TEXT),
595
742
  defaultValue: NonEmptyTextValue.optional(),
596
- configuration: import_zod5.z.object({
597
- maxLength: import_zod5.z.number().optional().describe("Maximum length of the text"),
598
- type: import_zod5.z.enum(["text", "password"]).optional(),
743
+ configuration: import_zod7.z.object({
744
+ maxLength: import_zod7.z.number().optional().describe("Maximum length of the text"),
745
+ type: import_zod7.z.enum(["text", "password"]).optional(),
599
746
  prefix: TranslationConfig.optional(),
600
747
  postfix: TranslationConfig.optional()
601
748
  }).default({ type: "text" }).optional()
602
749
  }).describe("Text input");
603
750
  var NumberField = BaseField.extend({
604
- type: import_zod5.z.literal(FieldType.NUMBER),
751
+ type: import_zod7.z.literal(FieldType.NUMBER),
605
752
  defaultValue: NumberFieldValue.optional(),
606
- configuration: import_zod5.z.object({
607
- min: import_zod5.z.number().optional().describe("Minimum value"),
608
- max: import_zod5.z.number().optional().describe("Maximum value"),
753
+ configuration: import_zod7.z.object({
754
+ min: import_zod7.z.number().optional().describe("Minimum value"),
755
+ max: import_zod7.z.number().optional().describe("Maximum value"),
609
756
  prefix: TranslationConfig.optional(),
610
757
  postfix: TranslationConfig.optional()
611
758
  }).optional()
612
759
  }).describe("Number input");
613
760
  var TextAreaField = BaseField.extend({
614
- type: import_zod5.z.literal(FieldType.TEXTAREA),
761
+ type: import_zod7.z.literal(FieldType.TEXTAREA),
615
762
  defaultValue: NonEmptyTextValue.optional(),
616
- configuration: import_zod5.z.object({
617
- maxLength: import_zod5.z.number().optional().describe("Maximum length of the text"),
618
- rows: import_zod5.z.number().optional().describe("Number of visible text lines"),
619
- cols: import_zod5.z.number().optional().describe("Number of visible columns"),
763
+ configuration: import_zod7.z.object({
764
+ maxLength: import_zod7.z.number().optional().describe("Maximum length of the text"),
765
+ rows: import_zod7.z.number().optional().describe("Number of visible text lines"),
766
+ cols: import_zod7.z.number().optional().describe("Number of visible columns"),
620
767
  prefix: TranslationConfig.optional(),
621
768
  postfix: TranslationConfig.optional()
622
769
  }).default({ rows: 4 }).optional()
623
770
  }).describe("Multiline text input");
624
- var ImageMimeType = import_zod5.z.enum([
771
+ var ImageMimeType = import_zod7.z.enum([
625
772
  "image/png",
626
773
  "image/jpg",
627
774
  "image/jpeg",
@@ -630,46 +777,44 @@ var ImageMimeType = import_zod5.z.enum([
630
777
  var MimeType = ImageMimeType;
631
778
  var DEFAULT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;
632
779
  var SignatureField = BaseField.extend({
633
- type: import_zod5.z.literal(FieldType.SIGNATURE),
780
+ type: import_zod7.z.literal(FieldType.SIGNATURE),
634
781
  signaturePromptLabel: TranslationConfig.describe(
635
782
  "Title of the signature modal"
636
783
  ),
637
784
  defaultValue: SignatureFieldValue.optional(),
638
- configuration: import_zod5.z.object({
639
- maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
785
+ configuration: import_zod7.z.object({
786
+ maxFileSize: import_zod7.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
640
787
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
641
788
  }).default({
642
789
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
643
790
  })
644
791
  }).describe("Signature input field");
645
792
  var EmailField = BaseField.extend({
646
- type: import_zod5.z.literal(FieldType.EMAIL),
647
- configuration: import_zod5.z.object({
648
- maxLength: import_zod5.z.number().optional().describe("Maximum length of the text")
793
+ type: import_zod7.z.literal(FieldType.EMAIL),
794
+ configuration: import_zod7.z.object({
795
+ maxLength: import_zod7.z.number().optional().describe("Maximum length of the text")
649
796
  }).default({ maxLength: 10 }).optional(),
650
797
  defaultValue: NonEmptyTextValue.optional()
651
798
  });
652
799
  var DateField = BaseField.extend({
653
- type: import_zod5.z.literal(FieldType.DATE),
800
+ type: import_zod7.z.literal(FieldType.DATE),
654
801
  defaultValue: DateValue.optional(),
655
- configuration: import_zod5.z.object({
802
+ configuration: import_zod7.z.object({
656
803
  notice: TranslationConfig.describe(
657
804
  "Text to display above the date input"
658
805
  ).optional()
659
806
  }).optional()
660
- }).describe("A single date input (dd-mm-YYYY)");
807
+ }).describe("A single date input (yyyy-MM-dd)");
661
808
  var DateRangeField = BaseField.extend({
662
- type: import_zod5.z.literal(FieldType.DATE_RANGE),
809
+ type: import_zod7.z.literal(FieldType.DATE_RANGE),
663
810
  defaultValue: DateRangeFieldValue.optional(),
664
- configuration: import_zod5.z.object({
811
+ configuration: import_zod7.z.object({
665
812
  notice: TranslationConfig.describe(
666
813
  "Text to display above the date input"
667
814
  ).optional()
668
815
  }).optional()
669
- }).describe(
670
- "A date range input ({ rangeStart: dd-mm-YYYY, rangeEnd: dd-mm-YYYY })"
671
- );
672
- var HtmlFontVariant = import_zod5.z.enum([
816
+ }).describe("A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })");
817
+ var HtmlFontVariant = import_zod7.z.enum([
673
818
  "reg12",
674
819
  "reg14",
675
820
  "reg16",
@@ -679,27 +824,31 @@ var HtmlFontVariant = import_zod5.z.enum([
679
824
  "h2",
680
825
  "h1"
681
826
  ]);
827
+ var ParagraphConfiguration = import_zod7.z.object({
828
+ styles: import_zod7.z.object({
829
+ fontVariant: HtmlFontVariant.optional().describe(
830
+ "Font variant to use for the paragraph text"
831
+ ),
832
+ hint: import_zod7.z.boolean().optional().describe("When true, paragraph is styled as a hint with grey color")
833
+ }).optional()
834
+ }).default({});
682
835
  var Paragraph = BaseField.extend({
683
- type: import_zod5.z.literal(FieldType.PARAGRAPH),
836
+ type: import_zod7.z.literal(FieldType.PARAGRAPH),
684
837
  defaultValue: NonEmptyTextValue.optional(),
685
- configuration: import_zod5.z.object({
686
- styles: import_zod5.z.object({
687
- fontVariant: HtmlFontVariant.optional()
688
- }).optional()
689
- }).default({})
838
+ configuration: ParagraphConfiguration
690
839
  }).describe("A read-only HTML <p> paragraph");
691
840
  var PageHeader = BaseField.extend({
692
- type: import_zod5.z.literal(FieldType.PAGE_HEADER),
841
+ type: import_zod7.z.literal(FieldType.PAGE_HEADER),
693
842
  defaultValue: NonEmptyTextValue.optional()
694
843
  }).describe("A read-only header component for form pages");
695
844
  var File = BaseField.extend({
696
- type: import_zod5.z.literal(FieldType.FILE),
845
+ type: import_zod7.z.literal(FieldType.FILE),
697
846
  defaultValue: FileFieldValue.optional(),
698
- configuration: import_zod5.z.object({
699
- maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
847
+ configuration: import_zod7.z.object({
848
+ maxFileSize: import_zod7.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
700
849
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
701
- style: import_zod5.z.object({
702
- width: import_zod5.z.enum(["full", "auto"]).optional().describe(
850
+ style: import_zod7.z.object({
851
+ width: import_zod7.z.enum(["full", "auto"]).optional().describe(
703
852
  "Whether the file upload button should take the full width of the container or not"
704
853
  )
705
854
  }).optional(),
@@ -708,129 +857,147 @@ var File = BaseField.extend({
708
857
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
709
858
  })
710
859
  }).describe("File upload");
711
- var SelectOption = import_zod5.z.object({
712
- value: import_zod5.z.string().describe("The value of the option"),
860
+ var SelectOption = import_zod7.z.object({
861
+ value: import_zod7.z.string().describe("The value of the option"),
713
862
  label: TranslationConfig.describe("The label of the option")
714
863
  });
715
864
  var RadioGroup = BaseField.extend({
716
- type: import_zod5.z.literal(FieldType.RADIO_GROUP),
865
+ type: import_zod7.z.literal(FieldType.RADIO_GROUP),
717
866
  defaultValue: TextValue.optional(),
718
- options: import_zod5.z.array(SelectOption).describe("A list of options"),
719
- configuration: import_zod5.z.object({
720
- styles: import_zod5.z.object({
721
- size: import_zod5.z.enum(["NORMAL", "LARGE"]).optional()
867
+ options: import_zod7.z.array(SelectOption).describe("A list of options"),
868
+ configuration: import_zod7.z.object({
869
+ styles: import_zod7.z.object({
870
+ size: import_zod7.z.enum(["NORMAL", "LARGE"]).optional()
722
871
  }).optional()
723
872
  }).optional()
724
873
  }).describe("Grouped radio options");
725
874
  var BulletList = BaseField.extend({
726
- type: import_zod5.z.literal(FieldType.BULLET_LIST),
875
+ type: import_zod7.z.literal(FieldType.BULLET_LIST),
727
876
  defaultValue: TextValue.optional(),
728
- items: import_zod5.z.array(TranslationConfig).describe("A list of items"),
729
- configuration: import_zod5.z.object({
730
- styles: import_zod5.z.object({
877
+ items: import_zod7.z.array(TranslationConfig).describe("A list of items"),
878
+ configuration: import_zod7.z.object({
879
+ styles: import_zod7.z.object({
731
880
  fontVariant: HtmlFontVariant.optional()
732
881
  }).optional()
733
882
  }).default({})
734
883
  }).describe("A list of bullet points");
735
884
  var Select = BaseField.extend({
736
- type: import_zod5.z.literal(FieldType.SELECT),
885
+ type: import_zod7.z.literal(FieldType.SELECT),
737
886
  defaultValue: TextValue.optional(),
738
- options: import_zod5.z.array(SelectOption).describe("A list of options")
887
+ options: import_zod7.z.array(SelectOption).describe("A list of options")
739
888
  }).describe("Select input");
889
+ var SelectDateRangeOption = import_zod7.z.object({
890
+ value: SelectDateRangeValue.describe("The value of the option"),
891
+ label: TranslationConfig.describe("The label of the option")
892
+ });
893
+ var SelectDateRangeField = BaseField.extend({
894
+ type: import_zod7.z.literal(FieldType.SELECT_DATE_RANGE),
895
+ defaultValue: SelectDateRangeValue.optional(),
896
+ options: import_zod7.z.array(SelectDateRangeOption).describe("A list of options")
897
+ }).describe("Select input with date range options");
740
898
  var NameField = BaseField.extend({
741
- type: import_zod5.z.literal(FieldType.NAME),
742
- defaultValue: import_zod5.z.object({
899
+ type: import_zod7.z.literal(FieldType.NAME),
900
+ defaultValue: import_zod7.z.object({
743
901
  firstname: NonEmptyTextValue,
744
902
  surname: NonEmptyTextValue
745
903
  }).optional(),
746
- configuration: import_zod5.z.object({
747
- maxLength: import_zod5.z.number().optional().describe("Maximum length of the text"),
904
+ configuration: import_zod7.z.object({
905
+ maxLength: import_zod7.z.number().optional().describe("Maximum length of the text"),
748
906
  prefix: TranslationConfig.optional(),
749
- postfix: TranslationConfig.optional()
907
+ postfix: TranslationConfig.optional(),
908
+ includeMiddlename: import_zod7.z.boolean().default(false).optional().describe("To make middle name visible in Name form field"),
909
+ searchMode: import_zod7.z.boolean().optional()
750
910
  }).optional()
751
911
  }).describe("Name input field");
752
912
  var PhoneField = BaseField.extend({
753
913
  defaultValue: NonEmptyTextValue.optional(),
754
- type: import_zod5.z.literal(FieldType.PHONE)
914
+ type: import_zod7.z.literal(FieldType.PHONE)
755
915
  }).describe("Phone input field");
756
916
  var IdField = BaseField.extend({
757
917
  defaultValue: NonEmptyTextValue.optional(),
758
- type: import_zod5.z.literal(FieldType.ID)
918
+ type: import_zod7.z.literal(FieldType.ID)
759
919
  }).describe("ID input field");
760
920
  var Checkbox = BaseField.extend({
761
- type: import_zod5.z.literal(FieldType.CHECKBOX),
921
+ type: import_zod7.z.literal(FieldType.CHECKBOX),
762
922
  defaultValue: CheckboxFieldValue.optional()
763
923
  }).describe("Boolean checkbox field");
764
924
  var Country = BaseField.extend({
765
- type: import_zod5.z.literal(FieldType.COUNTRY),
925
+ type: import_zod7.z.literal(FieldType.COUNTRY),
766
926
  defaultValue: NonEmptyTextValue.optional()
767
927
  }).describe("Country select field");
768
- var AdministrativeAreas = import_zod5.z.enum([
928
+ var AdministrativeAreas = import_zod7.z.enum([
769
929
  "ADMIN_STRUCTURE",
770
930
  "HEALTH_FACILITY",
771
931
  "CRVS_OFFICE"
772
932
  ]);
773
- var AdministrativeAreaConfiguration = import_zod5.z.object({
774
- partOf: import_zod5.z.object({
775
- $declaration: import_zod5.z.string()
933
+ var AdministrativeAreaConfiguration = import_zod7.z.object({
934
+ partOf: import_zod7.z.object({
935
+ $declaration: import_zod7.z.string()
776
936
  }).optional().describe("Parent location"),
777
937
  type: AdministrativeAreas
778
938
  }).describe("Administrative area options");
779
939
  var AdministrativeArea = BaseField.extend({
780
- type: import_zod5.z.literal(FieldType.ADMINISTRATIVE_AREA),
940
+ type: import_zod7.z.literal(FieldType.ADMINISTRATIVE_AREA),
781
941
  defaultValue: NonEmptyTextValue.optional(),
782
942
  configuration: AdministrativeAreaConfiguration
783
943
  }).describe("Administrative area input field e.g. facility, office");
784
944
  var Location = BaseField.extend({
785
- type: import_zod5.z.literal(FieldType.LOCATION),
786
- defaultValue: NonEmptyTextValue.optional()
945
+ type: import_zod7.z.literal(FieldType.LOCATION),
946
+ defaultValue: NonEmptyTextValue.optional(),
947
+ configuration: import_zod7.z.object({
948
+ searchableResource: import_zod7.z.array(import_zod7.z.enum(["locations", "facilities", "offices"])).optional()
949
+ }).optional()
787
950
  }).describe("Input field for a location");
788
951
  var FileUploadWithOptions = BaseField.extend({
789
- type: import_zod5.z.literal(FieldType.FILE_WITH_OPTIONS),
790
- options: import_zod5.z.array(SelectOption).describe("A list of options"),
952
+ type: import_zod7.z.literal(FieldType.FILE_WITH_OPTIONS),
953
+ options: import_zod7.z.array(SelectOption).describe("A list of options"),
791
954
  defaultValue: FileFieldWithOptionValue.optional(),
792
- configuration: import_zod5.z.object({
793
- maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
955
+ configuration: import_zod7.z.object({
956
+ maxFileSize: import_zod7.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
794
957
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
795
958
  }).default({
796
959
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
797
960
  })
798
961
  });
799
962
  var Facility = BaseField.extend({
800
- type: import_zod5.z.literal(FieldType.FACILITY),
963
+ type: import_zod7.z.literal(FieldType.FACILITY),
801
964
  defaultValue: NonEmptyTextValue.optional()
802
965
  }).describe("Input field for a facility");
803
966
  var Office = BaseField.extend({
804
- type: import_zod5.z.literal(FieldType.OFFICE),
967
+ type: import_zod7.z.literal(FieldType.OFFICE),
805
968
  defaultValue: NonEmptyTextValue.optional()
806
969
  }).describe("Input field for an office");
807
970
  var Address = BaseField.extend({
808
- type: import_zod5.z.literal(FieldType.ADDRESS),
809
- defaultValue: AddressFieldValue.optional()
971
+ type: import_zod7.z.literal(FieldType.ADDRESS),
972
+ defaultValue: AddressFieldValue.optional(),
973
+ configuration: import_zod7.z.object({
974
+ searchMode: import_zod7.z.boolean().optional()
975
+ }).optional()
810
976
  }).describe("Address input field \u2013 a combination of location and text fields");
811
- var DataEntry = import_zod5.z.union([
812
- import_zod5.z.object({
977
+ var DataEntry = import_zod7.z.union([
978
+ import_zod7.z.object({
813
979
  label: TranslationConfig,
814
- value: TranslationConfig.or(import_zod5.z.string())
980
+ value: TranslationConfig.or(import_zod7.z.string())
815
981
  }),
816
- import_zod5.z.object({
817
- fieldId: import_zod5.z.string()
982
+ import_zod7.z.object({
983
+ fieldId: import_zod7.z.string()
818
984
  })
819
985
  ]);
820
986
  var DataField = BaseField.extend({
821
- type: import_zod5.z.literal(FieldType.DATA),
822
- configuration: import_zod5.z.object({
987
+ type: import_zod7.z.literal(FieldType.DATA),
988
+ configuration: import_zod7.z.object({
823
989
  subtitle: TranslationConfig.optional(),
824
- data: import_zod5.z.array(DataEntry)
990
+ data: import_zod7.z.array(DataEntry)
825
991
  })
826
992
  }).describe("Data field for displaying read-only data");
827
- var FieldConfig = import_zod5.z.discriminatedUnion("type", [
993
+ var FieldConfig = import_zod7.z.discriminatedUnion("type", [
828
994
  Address,
829
995
  TextField,
830
996
  NumberField,
831
997
  TextAreaField,
832
998
  DateField,
833
999
  DateRangeField,
1000
+ SelectDateRangeField,
834
1001
  Paragraph,
835
1002
  RadioGroup,
836
1003
  BulletList,
@@ -856,14 +1023,18 @@ var FieldConfig = import_zod5.z.discriminatedUnion("type", [
856
1023
  ref: "FieldConfig"
857
1024
  });
858
1025
 
1026
+ // ../commons/src/events/FormConfig.ts
1027
+ var import_zod9 = require("zod");
1028
+
859
1029
  // ../commons/src/events/PageConfig.ts
860
- var import_zod_openapi4 = require("zod-openapi");
861
- (0, import_zod_openapi4.extendZodWithOpenApi)(import_zod6.z);
862
- var PageTypes = import_zod6.z.enum(["FORM", "VERIFICATION"]);
863
- var PageConfigBase = import_zod6.z.object({
864
- id: import_zod6.z.string().describe("Unique identifier for the page"),
1030
+ var import_zod8 = require("zod");
1031
+ var import_zod_openapi5 = require("zod-openapi");
1032
+ (0, import_zod_openapi5.extendZodWithOpenApi)(import_zod8.z);
1033
+ var PageTypes = import_zod8.z.enum(["FORM", "VERIFICATION"]);
1034
+ var PageConfigBase = import_zod8.z.object({
1035
+ id: import_zod8.z.string().describe("Unique identifier for the page"),
865
1036
  title: TranslationConfig.describe("Header title of the page"),
866
- fields: import_zod6.z.array(FieldConfig).describe("Fields to be rendered on the page"),
1037
+ fields: import_zod8.z.array(FieldConfig).describe("Fields to be rendered on the page"),
867
1038
  conditional: Conditional.optional().describe(
868
1039
  "Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
869
1040
  )
@@ -872,13 +1043,13 @@ var PageConfigBase = import_zod6.z.object({
872
1043
  ref: "FormPageConfig"
873
1044
  });
874
1045
  var FormPageConfig = PageConfigBase.extend({
875
- type: import_zod6.z.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
1046
+ type: import_zod8.z.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
876
1047
  });
877
- var VerificationActionConfig = import_zod6.z.object({
878
- verify: import_zod6.z.object({ label: TranslationConfig }),
879
- cancel: import_zod6.z.object({
1048
+ var VerificationActionConfig = import_zod8.z.object({
1049
+ verify: import_zod8.z.object({ label: TranslationConfig }),
1050
+ cancel: import_zod8.z.object({
880
1051
  label: TranslationConfig,
881
- confirmation: import_zod6.z.object({
1052
+ confirmation: import_zod8.z.object({
882
1053
  title: TranslationConfig,
883
1054
  body: TranslationConfig
884
1055
  })
@@ -888,218 +1059,110 @@ var VerificationActionConfig = import_zod6.z.object({
888
1059
  ref: "VerificationActionConfig"
889
1060
  });
890
1061
  var VerificationPageConfig = FormPageConfig.extend({
891
- type: import_zod6.z.literal(PageTypes.enum.VERIFICATION),
1062
+ type: import_zod8.z.literal(PageTypes.enum.VERIFICATION),
892
1063
  actions: VerificationActionConfig
893
1064
  });
894
- var PageConfig = import_zod6.z.discriminatedUnion("type", [
1065
+ var PageConfig = import_zod8.z.discriminatedUnion("type", [
895
1066
  FormPageConfig,
896
1067
  VerificationPageConfig
897
1068
  ]);
898
1069
 
899
- // ../commons/src/events/ActionType.ts
900
- var import_zod7 = require("zod");
901
- var ActionType = {
902
- // Pre-declaration actions
903
- DELETE: "DELETE",
904
- CREATE: "CREATE",
905
- NOTIFY: "NOTIFY",
906
- // Declaration actions
907
- DECLARE: "DECLARE",
908
- VALIDATE: "VALIDATE",
909
- REGISTER: "REGISTER",
910
- // Declaration system actions. Non-configurable.
911
- DETECT_DUPLICATE: "DETECT_DUPLICATE",
912
- REJECT: "REJECT",
913
- // REJECT_DECLARATION
914
- MARKED_AS_DUPLICATE: "MARKED_AS_DUPLICATE",
915
- // MARK_AS_DUPLICATE
916
- ARCHIVE: "ARCHIVE",
917
- // Record actions
918
- PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
919
- REQUEST_CORRECTION: "REQUEST_CORRECTION",
920
- REJECT_CORRECTION: "REJECT_CORRECTION",
921
- APPROVE_CORRECTION: "APPROVE_CORRECTION",
922
- // General actions
923
- READ: "READ",
924
- ASSIGN: "ASSIGN",
925
- UNASSIGN: "UNASSIGN"
926
- };
927
- var ConfirmableActions = [
928
- ActionType.NOTIFY,
929
- ActionType.DECLARE,
930
- ActionType.VALIDATE,
931
- ActionType.REGISTER,
932
- ActionType.REJECT,
933
- ActionType.ARCHIVE,
934
- ActionType.PRINT_CERTIFICATE
935
- ];
936
- var ActionTypes = import_zod7.z.enum([
937
- "DELETE",
938
- "CREATE",
939
- "NOTIFY",
940
- "DECLARE",
941
- "VALIDATE",
942
- "REGISTER",
943
- "DETECT_DUPLICATE",
944
- "REJECT",
945
- "MARKED_AS_DUPLICATE",
946
- "ARCHIVE",
947
- "PRINT_CERTIFICATE",
948
- "REQUEST_CORRECTION",
949
- "REJECT_CORRECTION",
950
- "APPROVE_CORRECTION",
951
- "READ",
952
- "ASSIGN",
953
- "UNASSIGN"
954
- ]);
955
- var declarationActionValues = [
956
- ActionTypes.enum.DECLARE,
957
- ActionTypes.enum.VALIDATE,
958
- ActionTypes.enum.REGISTER
959
- ];
960
- var DeclarationActions = ActionTypes.extract(declarationActionValues);
961
- var declarationUpdateActionValues = [
962
- ...declarationActionValues,
963
- ActionTypes.enum.REQUEST_CORRECTION
964
- ];
965
- var DeclarationUpdateActions = ActionTypes.extract(
966
- declarationUpdateActionValues
967
- );
968
- var annotationActions = ActionTypes.exclude(declarationActionValues);
969
- var writeActions = ActionTypes.exclude([
970
- ActionType.CREATE,
971
- ActionType.READ,
972
- ActionType.ASSIGN,
973
- ActionType.UNASSIGN
974
- ]);
975
- var StatusChangingActions = ActionTypes.extract([
976
- ActionType.CREATE,
977
- ActionType.NOTIFY,
978
- ActionType.DECLARE,
979
- ActionType.VALIDATE,
980
- ActionType.REGISTER,
981
- ActionType.REJECT,
982
- ActionType.ARCHIVE,
983
- ActionType.PRINT_CERTIFICATE
984
- ]);
985
- var workqueueActions = ActionTypes.exclude([
986
- ActionType.CREATE,
987
- ActionType.NOTIFY,
988
- ActionType.DETECT_DUPLICATE,
989
- ActionType.REJECT,
990
- ActionType.MARKED_AS_DUPLICATE,
991
- ActionType.ARCHIVE,
992
- ActionType.REQUEST_CORRECTION,
993
- ActionType.REJECT_CORRECTION,
994
- ActionType.APPROVE_CORRECTION
995
- ]);
996
- var META_ACTIONS = [
997
- ActionType.ASSIGN,
998
- ActionType.UNASSIGN,
999
- ActionType.READ
1000
- ];
1001
- function isMetaAction(actionType) {
1002
- return META_ACTIONS.includes(actionType);
1003
- }
1004
-
1005
1070
  // ../commons/src/events/FormConfig.ts
1006
- var import_zod8 = require("zod");
1007
- var DeclarationFormConfig = import_zod8.z.object({
1071
+ var DeclarationFormConfig = import_zod9.z.object({
1008
1072
  label: TranslationConfig.describe("Human readable description of the form"),
1009
- pages: import_zod8.z.array(FormPageConfig)
1073
+ pages: import_zod9.z.array(FormPageConfig)
1010
1074
  }).describe("Configuration for a declaration form");
1011
- var ActionFormConfig = import_zod8.z.object({
1075
+ var ActionFormConfig = import_zod9.z.object({
1012
1076
  label: TranslationConfig.describe("Human readable description of the form"),
1013
- pages: import_zod8.z.array(PageConfig)
1077
+ pages: import_zod9.z.array(PageConfig)
1014
1078
  });
1015
- var FormConfig = import_zod8.z.union([DeclarationFormConfig, ActionFormConfig]);
1079
+ var FormConfig = import_zod9.z.union([DeclarationFormConfig, ActionFormConfig]);
1016
1080
 
1017
1081
  // ../commons/src/events/ActionConfig.ts
1018
- var import_zod_openapi5 = require("zod-openapi");
1019
- (0, import_zod_openapi5.extendZodWithOpenApi)(import_zod9.z);
1020
- var ActionConditional2 = import_zod9.z.discriminatedUnion("type", [
1082
+ var import_zod_openapi6 = require("zod-openapi");
1083
+ (0, import_zod_openapi6.extendZodWithOpenApi)(import_zod10.z);
1084
+ var ActionConditional2 = import_zod10.z.discriminatedUnion("type", [
1021
1085
  /** If conditional is defined, the action is shown to the user only if the condition is met */
1022
1086
  ShowConditional,
1023
1087
  /** If conditional is defined, the action is enabled only if the condition is met */
1024
1088
  EnableConditional
1025
1089
  ]);
1026
- var DeclarationReviewConfig = import_zod9.z.object({
1090
+ var DeclarationReviewConfig = import_zod10.z.object({
1027
1091
  title: TranslationConfig.describe("Title of the review page"),
1028
- fields: import_zod9.z.array(FieldConfig).describe("Fields to be rendered on the review page for annotations.")
1092
+ fields: import_zod10.z.array(FieldConfig).describe("Fields to be rendered on the review page for annotations.")
1029
1093
  }).describe("Configuration for **declaration** review page.");
1030
- var ActionConfigBase = import_zod9.z.object({
1094
+ var ActionConfigBase = import_zod10.z.object({
1031
1095
  label: TranslationConfig,
1032
- conditionals: import_zod9.z.array(ActionConditional2).optional().default([]),
1033
- draft: import_zod9.z.boolean().optional()
1096
+ conditionals: import_zod10.z.array(ActionConditional2).optional().default([]),
1097
+ draft: import_zod10.z.boolean().optional()
1034
1098
  });
1035
1099
  var ReadActionConfig = ActionConfigBase.merge(
1036
- import_zod9.z.object({
1037
- type: import_zod9.z.literal(ActionType.READ),
1100
+ import_zod10.z.object({
1101
+ type: import_zod10.z.literal(ActionType.READ),
1038
1102
  review: DeclarationReviewConfig
1039
1103
  })
1040
1104
  );
1041
1105
  var DeclareConfig = ActionConfigBase.merge(
1042
- import_zod9.z.object({
1043
- type: import_zod9.z.literal(ActionType.DECLARE),
1106
+ import_zod10.z.object({
1107
+ type: import_zod10.z.literal(ActionType.DECLARE),
1044
1108
  review: DeclarationReviewConfig
1045
1109
  })
1046
1110
  );
1047
1111
  var ValidateConfig = ActionConfigBase.merge(
1048
- import_zod9.z.object({
1049
- type: import_zod9.z.literal(ActionType.VALIDATE),
1112
+ import_zod10.z.object({
1113
+ type: import_zod10.z.literal(ActionType.VALIDATE),
1050
1114
  review: DeclarationReviewConfig
1051
1115
  })
1052
1116
  );
1053
1117
  var RegisterConfig = ActionConfigBase.merge(
1054
- import_zod9.z.object({
1055
- type: import_zod9.z.literal(ActionType.REGISTER),
1118
+ import_zod10.z.object({
1119
+ type: import_zod10.z.literal(ActionType.REGISTER),
1056
1120
  review: DeclarationReviewConfig
1057
1121
  })
1058
1122
  );
1059
1123
  var RejectDeclarationConfig = ActionConfigBase.merge(
1060
- import_zod9.z.object({
1061
- type: import_zod9.z.literal(ActionType.REJECT)
1124
+ import_zod10.z.object({
1125
+ type: import_zod10.z.literal(ActionType.REJECT)
1062
1126
  })
1063
1127
  );
1064
1128
  var MarkedAsDuplicateConfig = ActionConfigBase.merge(
1065
- import_zod9.z.object({
1066
- type: import_zod9.z.literal(ActionType.MARKED_AS_DUPLICATE)
1129
+ import_zod10.z.object({
1130
+ type: import_zod10.z.literal(ActionType.MARKED_AS_DUPLICATE)
1067
1131
  })
1068
1132
  );
1069
1133
  var ArchiveConfig = ActionConfigBase.merge(
1070
- import_zod9.z.object({
1071
- type: import_zod9.z.literal(ActionType.ARCHIVE)
1134
+ import_zod10.z.object({
1135
+ type: import_zod10.z.literal(ActionType.ARCHIVE)
1072
1136
  })
1073
1137
  );
1074
1138
  var DeleteConfig = ActionConfigBase.merge(
1075
- import_zod9.z.object({
1076
- type: import_zod9.z.literal(ActionType.DELETE)
1139
+ import_zod10.z.object({
1140
+ type: import_zod10.z.literal(ActionType.DELETE)
1077
1141
  })
1078
1142
  );
1079
1143
  var PrintCertificateActionConfig = ActionConfigBase.merge(
1080
- import_zod9.z.object({
1081
- type: import_zod9.z.literal(ActionType.PRINT_CERTIFICATE),
1144
+ import_zod10.z.object({
1145
+ type: import_zod10.z.literal(ActionType.PRINT_CERTIFICATE),
1082
1146
  printForm: ActionFormConfig
1083
1147
  })
1084
1148
  );
1085
1149
  var RequestCorrectionConfig = ActionConfigBase.merge(
1086
- import_zod9.z.object({
1087
- type: import_zod9.z.literal(ActionType.REQUEST_CORRECTION),
1088
- onboardingForm: import_zod9.z.array(PageConfig),
1089
- additionalDetailsForm: import_zod9.z.array(PageConfig)
1150
+ import_zod10.z.object({
1151
+ type: import_zod10.z.literal(ActionType.REQUEST_CORRECTION),
1152
+ correctionForm: ActionFormConfig
1090
1153
  })
1091
1154
  );
1092
1155
  var RejectCorrectionConfig = ActionConfigBase.merge(
1093
- import_zod9.z.object({
1094
- type: import_zod9.z.literal(ActionType.REJECT_CORRECTION)
1156
+ import_zod10.z.object({
1157
+ type: import_zod10.z.literal(ActionType.REJECT_CORRECTION)
1095
1158
  })
1096
1159
  );
1097
1160
  var ApproveCorrectionConfig = ActionConfigBase.merge(
1098
- import_zod9.z.object({
1099
- type: import_zod9.z.literal(ActionType.APPROVE_CORRECTION)
1161
+ import_zod10.z.object({
1162
+ type: import_zod10.z.literal(ActionType.APPROVE_CORRECTION)
1100
1163
  })
1101
1164
  );
1102
- var ActionConfig = import_zod9.z.discriminatedUnion("type", [
1165
+ var ActionConfig = import_zod10.z.discriminatedUnion("type", [
1103
1166
  /*
1104
1167
  * OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
1105
1168
  * and treat them as "models" instead of duplicating the data structure in each endpoint.
@@ -1119,108 +1182,108 @@ var ActionConfig = import_zod9.z.discriminatedUnion("type", [
1119
1182
  RejectCorrectionConfig.openapi({ ref: "RejectCorrectionActionConfig" }),
1120
1183
  ApproveCorrectionConfig.openapi({ ref: "ApproveCorrectionActionConfig" })
1121
1184
  ]).openapi({ ref: "ActionConfig" });
1122
- var DeclarationActionConfig = import_zod9.z.discriminatedUnion("type", [
1185
+ var DeclarationActionConfig = import_zod10.z.discriminatedUnion("type", [
1123
1186
  DeclareConfig,
1124
1187
  ValidateConfig,
1125
1188
  RegisterConfig
1126
1189
  ]);
1127
1190
 
1128
1191
  // ../commons/src/events/offline/CertificateConfig.ts
1129
- var import_zod10 = require("zod");
1130
- var FontFamily = import_zod10.z.object({
1131
- normal: import_zod10.z.string(),
1132
- bold: import_zod10.z.string(),
1133
- italics: import_zod10.z.string(),
1134
- bolditalics: import_zod10.z.string()
1192
+ var import_zod11 = require("zod");
1193
+ var FontFamily = import_zod11.z.object({
1194
+ normal: import_zod11.z.string(),
1195
+ bold: import_zod11.z.string(),
1196
+ italics: import_zod11.z.string(),
1197
+ bolditalics: import_zod11.z.string()
1135
1198
  });
1136
- var CertificateConfig = import_zod10.z.object({
1137
- id: import_zod10.z.string(),
1138
- event: import_zod10.z.string(),
1199
+ var CertificateConfig = import_zod11.z.object({
1200
+ id: import_zod11.z.string(),
1201
+ event: import_zod11.z.string(),
1139
1202
  label: TranslationConfig,
1140
- isDefault: import_zod10.z.boolean(),
1141
- fee: import_zod10.z.object({
1142
- onTime: import_zod10.z.number(),
1143
- late: import_zod10.z.number(),
1144
- delayed: import_zod10.z.number()
1203
+ isDefault: import_zod11.z.boolean(),
1204
+ fee: import_zod11.z.object({
1205
+ onTime: import_zod11.z.number(),
1206
+ late: import_zod11.z.number(),
1207
+ delayed: import_zod11.z.number()
1145
1208
  }),
1146
- svgUrl: import_zod10.z.string(),
1147
- fonts: import_zod10.z.record(FontFamily).optional()
1209
+ svgUrl: import_zod11.z.string(),
1210
+ fonts: import_zod11.z.record(FontFamily).optional()
1148
1211
  });
1149
1212
  var CertificateTemplateConfig = CertificateConfig.extend({
1150
- hash: import_zod10.z.string().optional(),
1151
- svg: import_zod10.z.string()
1213
+ hash: import_zod11.z.string().optional(),
1214
+ svg: import_zod11.z.string()
1152
1215
  });
1153
1216
 
1154
1217
  // ../commons/src/events/offline/LanguageConfig.ts
1155
- var import_zod11 = require("zod");
1156
- var LanguageConfig = import_zod11.z.object({
1157
- lang: import_zod11.z.string(),
1218
+ var import_zod12 = require("zod");
1219
+ var LanguageConfig = import_zod12.z.object({
1220
+ lang: import_zod12.z.string(),
1158
1221
  /**
1159
1222
  * client.csv contents
1160
1223
  */
1161
- messages: import_zod11.z.record(import_zod11.z.string())
1224
+ messages: import_zod12.z.record(import_zod12.z.string())
1162
1225
  });
1163
1226
 
1164
1227
  // ../commons/src/events/EventConfig.ts
1165
- var import_zod20 = require("zod");
1228
+ var import_zod21 = require("zod");
1166
1229
 
1167
1230
  // ../commons/src/events/DeduplicationConfig.ts
1168
- var import_zod12 = require("zod");
1169
- var import_zod_openapi6 = require("zod-openapi");
1170
- (0, import_zod_openapi6.extendZodWithOpenApi)(import_zod12.z);
1171
- var FieldReference2 = import_zod12.z.string();
1172
- var Matcher = import_zod12.z.object({
1173
- fieldId: import_zod12.z.string(),
1174
- options: import_zod12.z.object({
1175
- boost: import_zod12.z.number().optional()
1231
+ var import_zod13 = require("zod");
1232
+ var import_zod_openapi7 = require("zod-openapi");
1233
+ (0, import_zod_openapi7.extendZodWithOpenApi)(import_zod13.z);
1234
+ var FieldReference2 = import_zod13.z.string();
1235
+ var Matcher = import_zod13.z.object({
1236
+ fieldId: import_zod13.z.string(),
1237
+ options: import_zod13.z.object({
1238
+ boost: import_zod13.z.number().optional()
1176
1239
  }).optional().default({})
1177
1240
  });
1178
1241
  var FuzzyMatcher = Matcher.extend({
1179
- type: import_zod12.z.literal("fuzzy"),
1180
- options: import_zod12.z.object({
1242
+ type: import_zod13.z.literal("fuzzy"),
1243
+ options: import_zod13.z.object({
1181
1244
  /**
1182
1245
  * Names of length 3 or less characters = 0 edits allowed
1183
1246
  * Names of length 4 - 6 characters = 1 edit allowed
1184
1247
  * Names of length >7 characters = 2 edits allowed
1185
1248
  */
1186
- fuzziness: import_zod12.z.union([import_zod12.z.string(), import_zod12.z.number()]).optional().default("AUTO:4,7"),
1187
- boost: import_zod12.z.number().optional().default(1)
1249
+ fuzziness: import_zod13.z.union([import_zod13.z.string(), import_zod13.z.number()]).optional().default("AUTO:4,7"),
1250
+ boost: import_zod13.z.number().optional().default(1)
1188
1251
  }).optional().default({})
1189
1252
  });
1190
1253
  var StrictMatcher = Matcher.extend({
1191
- type: import_zod12.z.literal("strict"),
1192
- options: import_zod12.z.object({
1193
- boost: import_zod12.z.number().optional().default(1)
1254
+ type: import_zod13.z.literal("strict"),
1255
+ options: import_zod13.z.object({
1256
+ boost: import_zod13.z.number().optional().default(1)
1194
1257
  }).optional().default({})
1195
1258
  });
1196
1259
  var DateRangeMatcher = Matcher.extend({
1197
- type: import_zod12.z.literal("dateRange"),
1198
- options: import_zod12.z.object({
1199
- days: import_zod12.z.number(),
1260
+ type: import_zod13.z.literal("dateRange"),
1261
+ options: import_zod13.z.object({
1262
+ days: import_zod13.z.number(),
1200
1263
  origin: FieldReference2,
1201
- boost: import_zod12.z.number().optional().default(1)
1264
+ boost: import_zod13.z.number().optional().default(1)
1202
1265
  })
1203
1266
  });
1204
1267
  var DateDistanceMatcher = Matcher.extend({
1205
- type: import_zod12.z.literal("dateDistance"),
1206
- options: import_zod12.z.object({
1207
- days: import_zod12.z.number(),
1268
+ type: import_zod13.z.literal("dateDistance"),
1269
+ options: import_zod13.z.object({
1270
+ days: import_zod13.z.number(),
1208
1271
  origin: FieldReference2,
1209
- boost: import_zod12.z.number().optional().default(1)
1272
+ boost: import_zod13.z.number().optional().default(1)
1210
1273
  })
1211
1274
  });
1212
- var And = import_zod12.z.object({
1213
- type: import_zod12.z.literal("and"),
1275
+ var And = import_zod13.z.object({
1276
+ type: import_zod13.z.literal("and"),
1214
1277
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
1215
- clauses: import_zod12.z.lazy(() => Clause.array())
1278
+ clauses: import_zod13.z.lazy(() => Clause.array())
1216
1279
  });
1217
- var Or = import_zod12.z.object({
1218
- type: import_zod12.z.literal("or"),
1280
+ var Or = import_zod13.z.object({
1281
+ type: import_zod13.z.literal("or"),
1219
1282
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
1220
- clauses: import_zod12.z.lazy(() => Clause.array())
1283
+ clauses: import_zod13.z.lazy(() => Clause.array())
1221
1284
  });
1222
- var Clause = import_zod12.z.lazy(
1223
- () => import_zod12.z.discriminatedUnion("type", [
1285
+ var Clause = import_zod13.z.lazy(
1286
+ () => import_zod13.z.discriminatedUnion("type", [
1224
1287
  And,
1225
1288
  Or,
1226
1289
  FuzzyMatcher,
@@ -1231,43 +1294,43 @@ var Clause = import_zod12.z.lazy(
1231
1294
  ).openapi({
1232
1295
  ref: "Clause"
1233
1296
  });
1234
- var DeduplicationConfig = import_zod12.z.object({
1235
- id: import_zod12.z.string(),
1297
+ var DeduplicationConfig = import_zod13.z.object({
1298
+ id: import_zod13.z.string(),
1236
1299
  label: TranslationConfig,
1237
1300
  query: Clause
1238
1301
  });
1239
1302
 
1240
1303
  // ../commons/src/events/SummaryConfig.ts
1241
- var import_zod13 = require("zod");
1242
- var BaseField2 = import_zod13.z.object({
1304
+ var import_zod14 = require("zod");
1305
+ var BaseField2 = import_zod14.z.object({
1243
1306
  emptyValueMessage: TranslationConfig.optional(),
1244
- conditionals: import_zod13.z.array(ShowConditional).default([]).optional()
1307
+ conditionals: import_zod14.z.array(ShowConditional).default([]).optional()
1245
1308
  });
1246
1309
  var ReferenceField = BaseField2.extend({
1247
- fieldId: import_zod13.z.string(),
1310
+ fieldId: import_zod14.z.string(),
1248
1311
  label: TranslationConfig.optional().describe(
1249
1312
  "By default, the configured field's label is used. This can be overridden by providing a custom label."
1250
1313
  )
1251
1314
  }).describe("Field directly referencing event data with field id");
1252
1315
  var Field = BaseField2.extend({
1253
- id: import_zod13.z.string().describe("Id of summary field"),
1316
+ id: import_zod14.z.string().describe("Id of summary field"),
1254
1317
  value: TranslationConfig.describe(
1255
1318
  "Summary field value. Can utilise values defined in configuration and EventMetadata"
1256
1319
  ),
1257
1320
  label: TranslationConfig
1258
1321
  }).describe("Custom configured field");
1259
- var SummaryConfig = import_zod13.z.object({
1260
- fields: import_zod13.z.array(import_zod13.z.union([Field, ReferenceField])).describe("Fields rendered in summary view.")
1322
+ var SummaryConfig = import_zod14.z.object({
1323
+ fields: import_zod14.z.array(import_zod14.z.union([Field, ReferenceField])).describe("Fields rendered in summary view.")
1261
1324
  }).describe("Configuration for summary in event.");
1262
1325
 
1263
1326
  // ../commons/src/events/AdvancedSearchConfig.ts
1264
- var import_zod14 = require("zod");
1265
- var MatchType = import_zod14.z.enum(["fuzzy", "exact", "range"]);
1266
- var BaseField3 = import_zod14.z.object({
1267
- config: import_zod14.z.object({
1327
+ var import_zod15 = require("zod");
1328
+ var MatchType = import_zod15.z.enum(["fuzzy", "exact", "range"]);
1329
+ var BaseField3 = import_zod15.z.object({
1330
+ config: import_zod15.z.object({
1268
1331
  type: MatchType.describe("Determines the type of field")
1269
1332
  }),
1270
- options: import_zod14.z.array(SelectOption).optional(),
1333
+ options: import_zod15.z.array(SelectOption).optional(),
1271
1334
  searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
1272
1335
  `
1273
1336
  This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
@@ -1288,7 +1351,7 @@ var BaseField3 = import_zod14.z.object({
1288
1351
  in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
1289
1352
  `
1290
1353
  ),
1291
- conditionals: import_zod14.z.array(FieldConditional).default([]).optional().describe(
1354
+ conditionals: import_zod15.z.array(FieldConditional).default([]).optional().describe(
1292
1355
  `
1293
1356
  In advanced search, we sometimes need to override the default field visibility conditionals.
1294
1357
 
@@ -1302,56 +1365,73 @@ var BaseField3 = import_zod14.z.object({
1302
1365
  are always rendered in the advanced search form.
1303
1366
  `
1304
1367
  ),
1305
- validations: import_zod14.z.array(ValidationConfig).default([]).optional().describe(
1368
+ validations: import_zod15.z.array(ValidationConfig).default([]).optional().describe(
1306
1369
  `In advanced search, we sometimes need to override the default field validations.`
1307
1370
  )
1308
1371
  });
1309
- var SearchQueryParams = import_zod14.z.object({
1310
- eventType: import_zod14.z.string().optional().describe(
1372
+ var SearchQueryParams = import_zod15.z.object({
1373
+ eventType: import_zod15.z.string().optional().describe(
1311
1374
  "Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
1312
1375
  )
1313
1376
  }).catchall(FieldValue);
1314
1377
  var FieldConfigSchema = BaseField3.extend({
1315
- fieldId: import_zod14.z.string(),
1316
- fieldType: import_zod14.z.literal("field")
1378
+ fieldId: import_zod15.z.string(),
1379
+ fieldType: import_zod15.z.literal("field"),
1380
+ alternateFieldIds: import_zod15.z.array(import_zod15.z.string()).optional().describe(
1381
+ `Sometimes there might be need to search a value against multiple field of same FormField type. For example
1382
+ search Country, Province, District against child.address.private and child.address.other. In such case, we
1383
+ add a one field as fieldId, and accomodate others in alternateFieldIds`
1384
+ ),
1385
+ excludeInSearchQuery: import_zod15.z.boolean().default(false).optional().describe(`Sometimes there will be search fields which are used to
1386
+ conditionally display another search field, but its not needed in search query. For example, child.placeOfBirth
1387
+ is select field, which has 3 options, FACILITY, PRIVATE_HOME, OTHER. Upon selecting any of the option, pops up another field
1388
+ related to the selected option, whose value is required in the search query. But child.placeOfBirth itself is not needed in the query.
1389
+ In such case, populate this field (excludeInSearchQuery) with boolean true`)
1317
1390
  });
1318
- var EventFieldId = import_zod14.z.enum([
1391
+ var EventFieldId = import_zod15.z.enum([
1319
1392
  "trackingId",
1320
1393
  "status",
1321
- "legalStatus.REGISTERED.createdAt",
1322
- "legalStatus.REGISTERED.createdAtLocation",
1394
+ "legalStatuses.REGISTERED.acceptedAt",
1395
+ "legalStatuses.REGISTERED.createdAtLocation",
1323
1396
  "updatedAt"
1324
1397
  ]);
1325
1398
  var EventFieldConfigSchema = BaseField3.extend({
1326
1399
  fieldId: EventFieldId,
1327
- fieldType: import_zod14.z.literal("event")
1400
+ fieldType: import_zod15.z.literal("event")
1328
1401
  });
1329
- var SearchField = import_zod14.z.discriminatedUnion("fieldType", [
1402
+ var SearchField = import_zod15.z.discriminatedUnion("fieldType", [
1330
1403
  FieldConfigSchema,
1331
1404
  EventFieldConfigSchema
1332
1405
  ]);
1333
- var AdvancedSearchConfig = import_zod14.z.object({
1406
+ var AdvancedSearchConfig = import_zod15.z.object({
1334
1407
  title: TranslationConfig.describe("Advanced search tab title"),
1335
- fields: import_zod14.z.array(SearchField).describe("Advanced search fields.")
1408
+ fields: import_zod15.z.array(SearchField).describe("Advanced search fields.")
1336
1409
  });
1337
1410
 
1338
1411
  // ../commons/src/events/utils.ts
1339
1412
  var import_lodash = require("lodash");
1340
1413
 
1341
1414
  // ../commons/src/events/ActionDocument.ts
1342
- var import_zod18 = require("zod");
1343
- var import_zod_openapi7 = require("zod-openapi");
1415
+ var import_zod19 = require("zod");
1416
+ var import_zod_openapi8 = require("zod-openapi");
1417
+
1418
+ // ../commons/src/uuid.ts
1419
+ var import_uuid = require("uuid");
1420
+ var import_zod16 = require("zod");
1421
+ var UUID = import_zod16.z.string().uuid().brand("UUID");
1422
+ function getUUID() {
1423
+ return (0, import_uuid.v4)();
1424
+ }
1344
1425
 
1345
1426
  // ../commons/src/events/CreatedAtLocation.ts
1346
- var import_zod15 = require("zod");
1347
- var CreatedAtLocation = import_zod15.z.string().nullish();
1427
+ var CreatedAtLocation = UUID.nullish();
1348
1428
 
1349
1429
  // ../commons/src/authentication.ts
1350
1430
  var import_jwt_decode = __toESM(require("jwt-decode"));
1351
- var import_zod17 = require("zod");
1431
+ var import_zod18 = require("zod");
1352
1432
 
1353
1433
  // ../commons/src/scopes.ts
1354
- var import_zod16 = require("zod");
1434
+ var import_zod17 = require("zod");
1355
1435
  var SCOPES = {
1356
1436
  // TODO v1.8 legacy scopes
1357
1437
  NATLSYSADMIN: "natlsysadmin",
@@ -1464,108 +1544,108 @@ var SCOPES = {
1464
1544
  // data seeding
1465
1545
  USER_DATA_SEEDING: "user.data-seeding"
1466
1546
  };
1467
- var LegacyScopes = import_zod16.z.union([
1468
- import_zod16.z.literal(SCOPES.NATLSYSADMIN),
1469
- import_zod16.z.literal(SCOPES.BYPASSRATELIMIT),
1470
- import_zod16.z.literal(SCOPES.DECLARE),
1471
- import_zod16.z.literal(SCOPES.REGISTER),
1472
- import_zod16.z.literal(SCOPES.VALIDATE),
1473
- import_zod16.z.literal(SCOPES.DEMO),
1474
- import_zod16.z.literal(SCOPES.CERTIFY),
1475
- import_zod16.z.literal(SCOPES.PERFORMANCE),
1476
- import_zod16.z.literal(SCOPES.SYSADMIN),
1477
- import_zod16.z.literal(SCOPES.TEAMS),
1478
- import_zod16.z.literal(SCOPES.CONFIG)
1547
+ var LegacyScopes = import_zod17.z.union([
1548
+ import_zod17.z.literal(SCOPES.NATLSYSADMIN),
1549
+ import_zod17.z.literal(SCOPES.BYPASSRATELIMIT),
1550
+ import_zod17.z.literal(SCOPES.DECLARE),
1551
+ import_zod17.z.literal(SCOPES.REGISTER),
1552
+ import_zod17.z.literal(SCOPES.VALIDATE),
1553
+ import_zod17.z.literal(SCOPES.DEMO),
1554
+ import_zod17.z.literal(SCOPES.CERTIFY),
1555
+ import_zod17.z.literal(SCOPES.PERFORMANCE),
1556
+ import_zod17.z.literal(SCOPES.SYSADMIN),
1557
+ import_zod17.z.literal(SCOPES.TEAMS),
1558
+ import_zod17.z.literal(SCOPES.CONFIG)
1479
1559
  ]);
1480
- var IntegrationScopes = import_zod16.z.union([
1481
- import_zod16.z.literal(SCOPES.WEBHOOK),
1482
- import_zod16.z.literal(SCOPES.NATIONALID),
1483
- import_zod16.z.literal(SCOPES.NOTIFICATION_API),
1484
- import_zod16.z.literal(SCOPES.RECORDSEARCH)
1560
+ var IntegrationScopes = import_zod17.z.union([
1561
+ import_zod17.z.literal(SCOPES.WEBHOOK),
1562
+ import_zod17.z.literal(SCOPES.NATIONALID),
1563
+ import_zod17.z.literal(SCOPES.NOTIFICATION_API),
1564
+ import_zod17.z.literal(SCOPES.RECORDSEARCH)
1485
1565
  ]);
1486
- var DeclareScopes = import_zod16.z.union([
1487
- import_zod16.z.literal(SCOPES.RECORD_DECLARE),
1488
- import_zod16.z.literal(SCOPES.RECORD_IMPORT),
1489
- import_zod16.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
1490
- import_zod16.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
1491
- import_zod16.z.literal(SCOPES.RECORD_DECLARE_DEATH),
1492
- import_zod16.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
1493
- import_zod16.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
1494
- import_zod16.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
1495
- import_zod16.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
1496
- import_zod16.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW)
1566
+ var DeclareScopes = import_zod17.z.union([
1567
+ import_zod17.z.literal(SCOPES.RECORD_DECLARE),
1568
+ import_zod17.z.literal(SCOPES.RECORD_IMPORT),
1569
+ import_zod17.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
1570
+ import_zod17.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
1571
+ import_zod17.z.literal(SCOPES.RECORD_DECLARE_DEATH),
1572
+ import_zod17.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
1573
+ import_zod17.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
1574
+ import_zod17.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
1575
+ import_zod17.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
1576
+ import_zod17.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW)
1497
1577
  ]);
1498
- var UnassignScope = import_zod16.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS);
1499
- var ValidateScopes = import_zod16.z.union([
1500
- import_zod16.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
1501
- import_zod16.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
1502
- import_zod16.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
1503
- import_zod16.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
1504
- import_zod16.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
1505
- import_zod16.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE)
1578
+ var UnassignScope = import_zod17.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS);
1579
+ var ValidateScopes = import_zod17.z.union([
1580
+ import_zod17.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
1581
+ import_zod17.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
1582
+ import_zod17.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
1583
+ import_zod17.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
1584
+ import_zod17.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
1585
+ import_zod17.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE)
1506
1586
  ]);
1507
- var RegisterScope = import_zod16.z.literal(SCOPES.RECORD_REGISTER);
1508
- var CertifyScopes = import_zod16.z.union([
1509
- import_zod16.z.literal(SCOPES.RECORD_EXPORT_RECORDS),
1510
- import_zod16.z.literal(SCOPES.RECORD_DECLARATION_PRINT),
1511
- import_zod16.z.literal(SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS),
1512
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_PRINT),
1513
- import_zod16.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
1514
- import_zod16.z.literal(SCOPES.RECORD_PRINT_CERTIFIED_COPIES),
1515
- import_zod16.z.literal(SCOPES.RECORD_BULK_PRINT_CERTIFIED_COPIES),
1516
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES)
1587
+ var RegisterScope = import_zod17.z.literal(SCOPES.RECORD_REGISTER);
1588
+ var CertifyScopes = import_zod17.z.union([
1589
+ import_zod17.z.literal(SCOPES.RECORD_EXPORT_RECORDS),
1590
+ import_zod17.z.literal(SCOPES.RECORD_DECLARATION_PRINT),
1591
+ import_zod17.z.literal(SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS),
1592
+ import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_PRINT),
1593
+ import_zod17.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
1594
+ import_zod17.z.literal(SCOPES.RECORD_PRINT_CERTIFIED_COPIES),
1595
+ import_zod17.z.literal(SCOPES.RECORD_BULK_PRINT_CERTIFIED_COPIES),
1596
+ import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES)
1517
1597
  ]);
1518
- var CorrectionScopes = import_zod16.z.union([
1519
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
1520
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
1521
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REVOCATION),
1522
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REVOKE),
1523
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REINSTATEMENT),
1524
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REINSTATE),
1525
- import_zod16.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
1526
- import_zod16.z.literal(SCOPES.RECORD_REJECT_REGISTRATION)
1598
+ var CorrectionScopes = import_zod17.z.union([
1599
+ import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
1600
+ import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
1601
+ import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REVOCATION),
1602
+ import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_REVOKE),
1603
+ import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REINSTATEMENT),
1604
+ import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_REINSTATE),
1605
+ import_zod17.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
1606
+ import_zod17.z.literal(SCOPES.RECORD_REJECT_REGISTRATION)
1527
1607
  ]);
1528
- var SearchScopes = import_zod16.z.union([
1529
- import_zod16.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
1530
- import_zod16.z.literal(SCOPES.SEARCH_BIRTH),
1531
- import_zod16.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
1532
- import_zod16.z.literal(SCOPES.SEARCH_DEATH),
1533
- import_zod16.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
1534
- import_zod16.z.literal(SCOPES.SEARCH_MARRIAGE)
1608
+ var SearchScopes = import_zod17.z.union([
1609
+ import_zod17.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
1610
+ import_zod17.z.literal(SCOPES.SEARCH_BIRTH),
1611
+ import_zod17.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
1612
+ import_zod17.z.literal(SCOPES.SEARCH_DEATH),
1613
+ import_zod17.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
1614
+ import_zod17.z.literal(SCOPES.SEARCH_MARRIAGE)
1535
1615
  ]);
1536
- var AuditScopes = import_zod16.z.union([
1537
- import_zod16.z.literal(SCOPES.RECORD_READ),
1538
- import_zod16.z.literal(SCOPES.RECORD_READ_AUDIT),
1539
- import_zod16.z.literal(SCOPES.RECORD_READ_COMMENTS),
1540
- import_zod16.z.literal(SCOPES.RECORD_CREATE_COMMENTS)
1616
+ var AuditScopes = import_zod17.z.union([
1617
+ import_zod17.z.literal(SCOPES.RECORD_READ),
1618
+ import_zod17.z.literal(SCOPES.RECORD_READ_AUDIT),
1619
+ import_zod17.z.literal(SCOPES.RECORD_READ_COMMENTS),
1620
+ import_zod17.z.literal(SCOPES.RECORD_CREATE_COMMENTS)
1541
1621
  ]);
1542
- var ProfileScopes = import_zod16.z.union([
1543
- import_zod16.z.literal(SCOPES.PROFILE_UPDATE),
1544
- import_zod16.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE)
1622
+ var ProfileScopes = import_zod17.z.union([
1623
+ import_zod17.z.literal(SCOPES.PROFILE_UPDATE),
1624
+ import_zod17.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE)
1545
1625
  ]);
1546
- var PerformanceScopes = import_zod16.z.union([
1547
- import_zod16.z.literal(SCOPES.PERFORMANCE_READ),
1548
- import_zod16.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
1549
- import_zod16.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS)
1626
+ var PerformanceScopes = import_zod17.z.union([
1627
+ import_zod17.z.literal(SCOPES.PERFORMANCE_READ),
1628
+ import_zod17.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
1629
+ import_zod17.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS)
1550
1630
  ]);
1551
- var OrganisationScopes = import_zod16.z.union([
1552
- import_zod16.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
1553
- import_zod16.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
1554
- import_zod16.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION)
1631
+ var OrganisationScopes = import_zod17.z.union([
1632
+ import_zod17.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
1633
+ import_zod17.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
1634
+ import_zod17.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION)
1555
1635
  ]);
1556
- var UserScopes = import_zod16.z.union([
1557
- import_zod16.z.literal(SCOPES.USER_READ),
1558
- import_zod16.z.literal(SCOPES.USER_READ_MY_OFFICE),
1559
- import_zod16.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
1560
- import_zod16.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
1561
- import_zod16.z.literal(SCOPES.USER_CREATE),
1562
- import_zod16.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
1563
- import_zod16.z.literal(SCOPES.USER_UPDATE),
1564
- import_zod16.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION)
1636
+ var UserScopes = import_zod17.z.union([
1637
+ import_zod17.z.literal(SCOPES.USER_READ),
1638
+ import_zod17.z.literal(SCOPES.USER_READ_MY_OFFICE),
1639
+ import_zod17.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
1640
+ import_zod17.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
1641
+ import_zod17.z.literal(SCOPES.USER_CREATE),
1642
+ import_zod17.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
1643
+ import_zod17.z.literal(SCOPES.USER_UPDATE),
1644
+ import_zod17.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION)
1565
1645
  ]);
1566
- var ConfigScope = import_zod16.z.literal(SCOPES.CONFIG_UPDATE_ALL);
1567
- var DataSeedingScope = import_zod16.z.literal(SCOPES.USER_DATA_SEEDING);
1568
- var LiteralScopes = import_zod16.z.union([
1646
+ var ConfigScope = import_zod17.z.literal(SCOPES.CONFIG_UPDATE_ALL);
1647
+ var DataSeedingScope = import_zod17.z.literal(SCOPES.USER_DATA_SEEDING);
1648
+ var LiteralScopes = import_zod17.z.union([
1569
1649
  LegacyScopes,
1570
1650
  IntegrationScopes,
1571
1651
  UnassignScope,
@@ -1584,39 +1664,47 @@ var LiteralScopes = import_zod16.z.union([
1584
1664
  DataSeedingScope
1585
1665
  ]);
1586
1666
  var rawConfigurableScopeRegex = /^([a-zA-Z\.]+)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
1587
- var rawConfigurableScope = import_zod16.z.string().regex(rawConfigurableScopeRegex);
1588
- var CreateUserScope = import_zod16.z.object({
1589
- type: import_zod16.z.literal("user.create"),
1590
- options: import_zod16.z.object({
1591
- role: import_zod16.z.array(import_zod16.z.string())
1667
+ var rawConfigurableScope = import_zod17.z.string().regex(rawConfigurableScopeRegex);
1668
+ var CreateUserScope = import_zod17.z.object({
1669
+ type: import_zod17.z.literal("user.create"),
1670
+ options: import_zod17.z.object({
1671
+ role: import_zod17.z.array(import_zod17.z.string())
1592
1672
  })
1593
1673
  });
1594
- var EditUserScope = import_zod16.z.object({
1595
- type: import_zod16.z.literal("user.edit"),
1596
- options: import_zod16.z.object({
1597
- role: import_zod16.z.array(import_zod16.z.string())
1674
+ var EditUserScope = import_zod17.z.object({
1675
+ type: import_zod17.z.literal("user.edit"),
1676
+ options: import_zod17.z.object({
1677
+ role: import_zod17.z.array(import_zod17.z.string())
1598
1678
  })
1599
1679
  });
1600
- var WorkqueueScope = import_zod16.z.object({
1601
- type: import_zod16.z.literal("workqueue"),
1602
- options: import_zod16.z.object({
1603
- id: import_zod16.z.array(import_zod16.z.string())
1680
+ var WorkqueueScope = import_zod17.z.object({
1681
+ type: import_zod17.z.literal("workqueue"),
1682
+ options: import_zod17.z.object({
1683
+ id: import_zod17.z.array(import_zod17.z.string())
1604
1684
  })
1605
1685
  });
1606
- var NotifyRecordScope = import_zod16.z.object({
1607
- type: import_zod16.z.literal("record.notify"),
1608
- options: import_zod16.z.object({
1609
- event: import_zod16.z.array(import_zod16.z.string())
1686
+ var NotifyRecordScope = import_zod17.z.object({
1687
+ type: import_zod17.z.literal("record.notify"),
1688
+ options: import_zod17.z.object({
1689
+ event: import_zod17.z.array(import_zod17.z.string())
1610
1690
  })
1611
1691
  });
1612
- var ConfigurableScopes = import_zod16.z.discriminatedUnion("type", [
1692
+ var SearchScope = import_zod17.z.object({
1693
+ type: import_zod17.z.literal("search"),
1694
+ options: import_zod17.z.object({
1695
+ event: import_zod17.z.array(import_zod17.z.string()).length(1),
1696
+ access: import_zod17.z.array(import_zod17.z.enum(["my-jurisdiction", "all"])).length(1)
1697
+ })
1698
+ });
1699
+ var ConfigurableRawScopes = import_zod17.z.discriminatedUnion("type", [
1700
+ SearchScope,
1613
1701
  CreateUserScope,
1614
1702
  EditUserScope,
1615
1703
  WorkqueueScope,
1616
1704
  NotifyRecordScope
1617
1705
  ]);
1618
1706
  var scopes = Object.values(SCOPES);
1619
- var ActionScopes = import_zod16.z.union([
1707
+ var ActionScopes = import_zod17.z.union([
1620
1708
  DeclareScopes,
1621
1709
  ValidateScopes,
1622
1710
  RegisterScope,
@@ -1767,124 +1855,125 @@ var DEFAULT_ROLES_DEFINITION = [
1767
1855
  ]
1768
1856
  }
1769
1857
  ];
1770
- var TokenUserType = import_zod17.z.enum(["user", "system"]);
1771
- var TokenWithBearer = import_zod17.z.string().regex(/^Bearer\s/);
1858
+ var TokenUserType = import_zod18.z.enum(["user", "system"]);
1859
+ var TokenWithBearer = import_zod18.z.string().regex(/^Bearer\s/);
1772
1860
 
1773
1861
  // ../commons/src/events/ActionDocument.ts
1774
- (0, import_zod_openapi7.extendZodWithOpenApi)(import_zod18.z);
1775
- var ActionUpdate = import_zod18.z.record(import_zod18.z.string(), FieldUpdateValue);
1776
- var EventState = import_zod18.z.record(import_zod18.z.string(), FieldValue);
1862
+ (0, import_zod_openapi8.extendZodWithOpenApi)(import_zod19.z);
1863
+ var ActionUpdate = import_zod19.z.record(import_zod19.z.string(), FieldUpdateValue);
1864
+ var EventState = import_zod19.z.record(import_zod19.z.string(), FieldValue);
1777
1865
  var ActionStatus = {
1778
1866
  Requested: "Requested",
1779
1867
  Accepted: "Accepted",
1780
1868
  Rejected: "Rejected"
1781
1869
  };
1782
- var ActionBase = import_zod18.z.object({
1783
- id: import_zod18.z.string(),
1784
- transactionId: import_zod18.z.string(),
1870
+ var ActionBase = import_zod19.z.object({
1871
+ id: UUID,
1872
+ transactionId: import_zod19.z.string(),
1785
1873
  createdByUserType: TokenUserType,
1786
- createdAt: import_zod18.z.string().datetime(),
1787
- createdBy: import_zod18.z.string(),
1788
- createdByRole: import_zod18.z.string(),
1789
- createdBySignature: import_zod18.z.string().nullish().describe("Reference to signature of the user who created the action"),
1874
+ createdAt: import_zod19.z.string().datetime(),
1875
+ createdBy: import_zod19.z.string(),
1876
+ createdByRole: import_zod19.z.string(),
1877
+ createdBySignature: import_zod19.z.string().nullish().describe("Reference to signature of the user who created the action"),
1790
1878
  createdAtLocation: CreatedAtLocation,
1791
1879
  declaration: ActionUpdate,
1792
- annotation: ActionUpdate.optional(),
1793
- status: import_zod18.z.enum([
1880
+ annotation: ActionUpdate.optional().nullable(),
1881
+ status: import_zod19.z.enum([
1794
1882
  ActionStatus.Requested,
1795
1883
  ActionStatus.Accepted,
1796
1884
  ActionStatus.Rejected
1797
1885
  ]),
1798
1886
  // If the action is an asynchronous confirmation for another action, we will save the original action id here.
1799
- originalActionId: import_zod18.z.string().optional()
1887
+ originalActionId: UUID.optional().nullable().describe(
1888
+ "Reference to the original action that was asynchronously rejected or accepted by 3rd party integration."
1889
+ )
1800
1890
  });
1801
1891
  var AssignedAction = ActionBase.merge(
1802
- import_zod18.z.object({
1803
- type: import_zod18.z.literal(ActionType.ASSIGN),
1804
- assignedTo: import_zod18.z.string()
1892
+ import_zod19.z.object({
1893
+ type: import_zod19.z.literal(ActionType.ASSIGN),
1894
+ assignedTo: import_zod19.z.string()
1805
1895
  })
1806
1896
  );
1807
1897
  var UnassignedAction = ActionBase.merge(
1808
- import_zod18.z.object({
1809
- type: import_zod18.z.literal(ActionType.UNASSIGN),
1810
- assignedTo: import_zod18.z.literal(null)
1898
+ import_zod19.z.object({
1899
+ type: import_zod19.z.literal(ActionType.UNASSIGN)
1811
1900
  })
1812
1901
  );
1813
1902
  var RegisterAction = ActionBase.merge(
1814
- import_zod18.z.object({
1815
- type: import_zod18.z.literal(ActionType.REGISTER),
1816
- registrationNumber: import_zod18.z.string().optional()
1903
+ import_zod19.z.object({
1904
+ type: import_zod19.z.literal(ActionType.REGISTER),
1905
+ registrationNumber: import_zod19.z.string().optional()
1817
1906
  })
1818
1907
  );
1819
1908
  var DeclareAction = ActionBase.merge(
1820
- import_zod18.z.object({
1821
- type: import_zod18.z.literal(ActionType.DECLARE)
1909
+ import_zod19.z.object({
1910
+ type: import_zod19.z.literal(ActionType.DECLARE)
1822
1911
  })
1823
1912
  );
1824
1913
  var ValidateAction = ActionBase.merge(
1825
- import_zod18.z.object({
1826
- type: import_zod18.z.literal(ActionType.VALIDATE)
1914
+ import_zod19.z.object({
1915
+ type: import_zod19.z.literal(ActionType.VALIDATE)
1827
1916
  })
1828
1917
  );
1829
- var RejectionReason = import_zod18.z.object({
1830
- message: import_zod18.z.string().min(1, { message: "Message cannot be empty" }).describe("Message describing reason for rejection or archiving"),
1831
- isDuplicate: import_zod18.z.boolean().optional().describe("If a declaration is duplicated")
1918
+ var RejectionReason = import_zod19.z.object({
1919
+ message: import_zod19.z.string().min(1, { message: "Message cannot be empty" }).describe("Message describing reason for rejection or archiving"),
1920
+ isDuplicate: import_zod19.z.boolean().optional().describe("If a declaration is duplicated")
1832
1921
  });
1833
1922
  var RejectAction = ActionBase.merge(
1834
- import_zod18.z.object({
1835
- type: import_zod18.z.literal(ActionType.REJECT),
1923
+ import_zod19.z.object({
1924
+ type: import_zod19.z.literal(ActionType.REJECT),
1836
1925
  reason: RejectionReason
1837
1926
  })
1838
1927
  );
1839
1928
  var MarkAsDuplicateAction = ActionBase.merge(
1840
- import_zod18.z.object({
1841
- type: import_zod18.z.literal(ActionType.MARKED_AS_DUPLICATE)
1929
+ import_zod19.z.object({
1930
+ type: import_zod19.z.literal(ActionType.MARKED_AS_DUPLICATE)
1842
1931
  })
1843
1932
  );
1844
1933
  var ArchiveAction = ActionBase.merge(
1845
- import_zod18.z.object({
1846
- type: import_zod18.z.literal(ActionType.ARCHIVE),
1934
+ import_zod19.z.object({
1935
+ type: import_zod19.z.literal(ActionType.ARCHIVE),
1847
1936
  reason: RejectionReason
1848
1937
  })
1849
1938
  );
1850
1939
  var CreatedAction = ActionBase.merge(
1851
- import_zod18.z.object({
1852
- type: import_zod18.z.literal(ActionType.CREATE)
1940
+ import_zod19.z.object({
1941
+ type: import_zod19.z.literal(ActionType.CREATE)
1853
1942
  })
1854
1943
  );
1855
1944
  var NotifiedAction = ActionBase.merge(
1856
- import_zod18.z.object({
1857
- type: import_zod18.z.literal(ActionType.NOTIFY)
1945
+ import_zod19.z.object({
1946
+ type: import_zod19.z.literal(ActionType.NOTIFY)
1858
1947
  })
1859
1948
  );
1860
1949
  var PrintCertificateAction = ActionBase.merge(
1861
- import_zod18.z.object({
1862
- type: import_zod18.z.literal(ActionType.PRINT_CERTIFICATE)
1950
+ import_zod19.z.object({
1951
+ type: import_zod19.z.literal(ActionType.PRINT_CERTIFICATE)
1863
1952
  })
1864
1953
  );
1865
1954
  var RequestedCorrectionAction = ActionBase.merge(
1866
- import_zod18.z.object({
1867
- type: import_zod18.z.literal(ActionType.REQUEST_CORRECTION)
1955
+ import_zod19.z.object({
1956
+ type: import_zod19.z.literal(ActionType.REQUEST_CORRECTION)
1868
1957
  })
1869
1958
  );
1870
1959
  var ApprovedCorrectionAction = ActionBase.merge(
1871
- import_zod18.z.object({
1872
- type: import_zod18.z.literal(ActionType.APPROVE_CORRECTION),
1873
- requestId: import_zod18.z.string()
1960
+ import_zod19.z.object({
1961
+ type: import_zod19.z.literal(ActionType.APPROVE_CORRECTION),
1962
+ requestId: import_zod19.z.string()
1874
1963
  })
1875
1964
  );
1876
1965
  var RejectedCorrectionAction = ActionBase.merge(
1877
- import_zod18.z.object({
1878
- type: import_zod18.z.literal(ActionType.REJECT_CORRECTION),
1879
- requestId: import_zod18.z.string()
1966
+ import_zod19.z.object({
1967
+ type: import_zod19.z.literal(ActionType.REJECT_CORRECTION),
1968
+ requestId: import_zod19.z.string()
1880
1969
  })
1881
1970
  );
1882
1971
  var ReadAction = ActionBase.merge(
1883
- import_zod18.z.object({
1884
- type: import_zod18.z.literal(ActionType.READ)
1972
+ import_zod19.z.object({
1973
+ type: import_zod19.z.literal(ActionType.READ)
1885
1974
  })
1886
1975
  );
1887
- var ActionDocument = import_zod18.z.discriminatedUnion("type", [
1976
+ var ActionDocument = import_zod19.z.discriminatedUnion("type", [
1888
1977
  CreatedAction.openapi({ ref: "CreatedAction" }),
1889
1978
  ValidateAction.openapi({ ref: "ValidateAction" }),
1890
1979
  RejectAction.openapi({ ref: "RejectAction" }),
@@ -1907,20 +1996,20 @@ var AsyncRejectActionDocument = ActionBase.omit({
1907
1996
  declaration: true,
1908
1997
  annotation: true
1909
1998
  }).merge(
1910
- import_zod18.z.object({
1911
- type: import_zod18.z.enum(ConfirmableActions),
1912
- status: import_zod18.z.literal(ActionStatus.Rejected)
1999
+ import_zod19.z.object({
2000
+ type: import_zod19.z.enum(ConfirmableActions),
2001
+ status: import_zod19.z.literal(ActionStatus.Rejected)
1913
2002
  })
1914
2003
  );
1915
- var Action = import_zod18.z.union([ActionDocument, AsyncRejectActionDocument]);
1916
- var ResolvedUser = import_zod18.z.object({
1917
- id: import_zod18.z.string(),
1918
- role: import_zod18.z.string(),
1919
- name: import_zod18.z.array(
1920
- import_zod18.z.object({
1921
- use: import_zod18.z.string(),
1922
- given: import_zod18.z.array(import_zod18.z.string()),
1923
- family: import_zod18.z.string()
2004
+ var Action = import_zod19.z.union([ActionDocument, AsyncRejectActionDocument]);
2005
+ var ResolvedUser = import_zod19.z.object({
2006
+ id: import_zod19.z.string(),
2007
+ role: import_zod19.z.string(),
2008
+ name: import_zod19.z.array(
2009
+ import_zod19.z.object({
2010
+ use: import_zod19.z.string(),
2011
+ given: import_zod19.z.array(import_zod19.z.string()),
2012
+ family: import_zod19.z.string()
1924
2013
  })
1925
2014
  )
1926
2015
  });
@@ -1931,7 +2020,7 @@ var import_ajv_formats = __toESM(require("ajv-formats"));
1931
2020
  var import_date_fns = require("date-fns");
1932
2021
 
1933
2022
  // ../commons/src/events/FieldTypeMapping.ts
1934
- var import_zod19 = require("zod");
2023
+ var import_zod20 = require("zod");
1935
2024
  function mapFieldTypeToZod(type, required) {
1936
2025
  let schema;
1937
2026
  switch (type) {
@@ -1944,6 +2033,9 @@ function mapFieldTypeToZod(type, required) {
1944
2033
  case FieldType.DATE_RANGE:
1945
2034
  schema = DateRangeFieldValue;
1946
2035
  break;
2036
+ case FieldType.SELECT_DATE_RANGE:
2037
+ schema = SelectDateRangeValue;
2038
+ break;
1947
2039
  case FieldType.TEXT:
1948
2040
  case FieldType.TEXTAREA:
1949
2041
  case FieldType.DIVIDER:
@@ -1991,7 +2083,7 @@ function createValidationSchema(config) {
1991
2083
  for (const field2 of config) {
1992
2084
  shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
1993
2085
  }
1994
- return import_zod19.z.object(shape);
2086
+ return import_zod20.z.object(shape);
1995
2087
  }
1996
2088
  function mapFieldTypeToEmptyValue(field2) {
1997
2089
  switch (field2.type) {
@@ -2013,6 +2105,7 @@ function mapFieldTypeToEmptyValue(field2) {
2013
2105
  case FieldType.DATE:
2014
2106
  case FieldType.CHECKBOX:
2015
2107
  case FieldType.DATE_RANGE:
2108
+ case FieldType.SELECT_DATE_RANGE:
2016
2109
  case FieldType.DATA:
2017
2110
  case FieldType.NAME:
2018
2111
  case FieldType.PHONE:
@@ -2035,7 +2128,7 @@ function mapFieldTypeToEmptyValue(field2) {
2035
2128
  case FieldType.SIGNATURE:
2036
2129
  case FieldType.FILE:
2037
2130
  return {
2038
- filename: "",
2131
+ path: "",
2039
2132
  originalFilename: "",
2040
2133
  type: ""
2041
2134
  };
@@ -2052,6 +2145,9 @@ var isDateFieldType = (field2) => {
2052
2145
  var isDateRangeFieldType = (field2) => {
2053
2146
  return field2.config.type === FieldType.DATE_RANGE;
2054
2147
  };
2148
+ var isSelectDateRangeFieldType = (field2) => {
2149
+ return field2.config.type === FieldType.SELECT_DATE_RANGE;
2150
+ };
2055
2151
  var isPageHeaderFieldType = (field2) => {
2056
2152
  return field2.config.type === FieldType.PAGE_HEADER;
2057
2153
  };
@@ -2131,6 +2227,29 @@ var ajv = new import_ajv.default({
2131
2227
  allowUnionTypes: true
2132
2228
  });
2133
2229
  (0, import_ajv_formats.default)(ajv);
2230
+ ajv.addKeyword({
2231
+ keyword: "daysFromNow",
2232
+ type: "string",
2233
+ schemaType: "object",
2234
+ $data: true,
2235
+ errors: true,
2236
+ validate(schema, data, _, dataContext) {
2237
+ if (!(dataContext && dataContext.rootData && typeof dataContext.rootData === "object" && "$now" in dataContext.rootData && typeof dataContext.rootData.$now === "string")) {
2238
+ throw new Error("Validation context must contain $now");
2239
+ }
2240
+ const { days, clause } = schema;
2241
+ if (typeof data !== "string") {
2242
+ return false;
2243
+ }
2244
+ const date = new Date(data);
2245
+ if (isNaN(date.getTime())) {
2246
+ return false;
2247
+ }
2248
+ const now = new Date(dataContext.rootData.$now);
2249
+ const offsetDate = new Date(now.getTime() + days * 24 * 60 * 60 * 1e3);
2250
+ return clause === "after" ? (0, import_date_fns.isAfter)(date, offsetDate) : (0, import_date_fns.isBefore)(date, offsetDate);
2251
+ }
2252
+ });
2134
2253
  function validate(schema, data) {
2135
2254
  return ajv.validate(schema, data);
2136
2255
  }
@@ -2196,7 +2315,7 @@ var errorMessages = {
2196
2315
  id: "v2.error.invalidEmail"
2197
2316
  },
2198
2317
  requiredField: {
2199
- defaultMessage: "Required for registration",
2318
+ defaultMessage: "Required",
2200
2319
  description: "Error message when required field is missing",
2201
2320
  id: "v2.error.required"
2202
2321
  },
@@ -2209,6 +2328,11 @@ var errorMessages = {
2209
2328
  defaultMessage: "Unexpected field",
2210
2329
  description: "Error message when field is not expected",
2211
2330
  id: "v2.error.unexpectedField"
2331
+ },
2332
+ correctionNotAllowed: {
2333
+ defaultMessage: "Correction not allowed for field",
2334
+ description: "Error message when correction is not allowed for field",
2335
+ id: "v2.error.correctionNotAllowed"
2212
2336
  }
2213
2337
  };
2214
2338
  function createIntlError(message) {
@@ -2344,12 +2468,6 @@ function getValidatorsForField(fieldId, validations) {
2344
2468
  }).filter((x) => x !== null);
2345
2469
  }
2346
2470
 
2347
- // ../commons/src/uuid.ts
2348
- var import_uuid = require("uuid");
2349
- function getUUID() {
2350
- return (0, import_uuid.v4)();
2351
- }
2352
-
2353
2471
  // ../commons/src/utils.ts
2354
2472
  function getOrThrow(x, message) {
2355
2473
  if (x === void 0 || x === null) {
@@ -2357,8 +2475,12 @@ function getOrThrow(x, message) {
2357
2475
  }
2358
2476
  return x;
2359
2477
  }
2478
+ function joinValues(values, separator = " ") {
2479
+ return values.filter((value) => !!value).join(separator).trim();
2480
+ }
2360
2481
 
2361
2482
  // ../commons/src/events/utils.ts
2483
+ var import_date_fns2 = require("date-fns");
2362
2484
  function isDeclarationActionConfig(action) {
2363
2485
  return DeclarationActions.safeParse(action.type).success;
2364
2486
  }
@@ -2371,12 +2493,18 @@ function getDeclarationPages(configuration) {
2371
2493
  function getDeclaration(configuration) {
2372
2494
  return configuration.declaration;
2373
2495
  }
2496
+ function getPrintCertificatePages(configuration) {
2497
+ const action = configuration.actions.find(
2498
+ (a) => a.type === ActionType.PRINT_CERTIFICATE
2499
+ );
2500
+ return getOrThrow(
2501
+ action?.printForm.pages,
2502
+ `${ActionType.PRINT_CERTIFICATE} action does not have print form set.`
2503
+ );
2504
+ }
2374
2505
  var getActionAnnotationFields = (actionConfig) => {
2375
2506
  if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
2376
- return [
2377
- ...actionConfig.onboardingForm.flatMap(({ fields }) => fields),
2378
- ...actionConfig.additionalDetailsForm.flatMap(({ fields }) => fields)
2379
- ];
2507
+ return actionConfig.correctionForm.pages.flatMap(({ fields }) => fields);
2380
2508
  }
2381
2509
  if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
2382
2510
  return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
@@ -2399,7 +2527,7 @@ function getDeclarationFieldById(config, fieldId) {
2399
2527
  var findRecordActionPages = (config, actionType) => {
2400
2528
  const action = config.actions.find((a) => a.type === actionType);
2401
2529
  if (action?.type === ActionType.REQUEST_CORRECTION) {
2402
- return [...action.onboardingForm, ...action.additionalDetailsForm];
2530
+ return action.correctionForm.pages;
2403
2531
  }
2404
2532
  if (action?.type === ActionType.PRINT_CERTIFICATE) {
2405
2533
  return action.printForm.pages;
@@ -2458,7 +2586,7 @@ function createEmptyDraft(eventId, draftId, actionType) {
2458
2586
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
2459
2587
  createdByUserType: TokenUserType.Enum.user,
2460
2588
  createdBy: "@todo",
2461
- createdAtLocation: "@todo",
2589
+ createdAtLocation: "00000000-0000-0000-0000-000000000000",
2462
2590
  status: ActionStatus.Accepted,
2463
2591
  transactionId: "@todo",
2464
2592
  createdByRole: "@todo"
@@ -2473,13 +2601,10 @@ function getVisibleVerificationPageIds(pages, annotation) {
2473
2601
  }
2474
2602
  function getActionVerificationPageIds(actionConfig, annotation) {
2475
2603
  if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
2476
- return [
2477
- ...getVisibleVerificationPageIds(actionConfig.onboardingForm, annotation),
2478
- ...getVisibleVerificationPageIds(
2479
- actionConfig.additionalDetailsForm,
2480
- annotation
2481
- )
2482
- ];
2604
+ return getVisibleVerificationPageIds(
2605
+ actionConfig.correctionForm.pages,
2606
+ annotation
2607
+ );
2483
2608
  }
2484
2609
  if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
2485
2610
  return getVisibleVerificationPageIds(
@@ -2558,12 +2683,33 @@ function getEventConfigById(eventConfigs, id) {
2558
2683
  );
2559
2684
  return getOrThrow(eventConfig, `Event config for ${id} not found`);
2560
2685
  }
2686
+ function timePeriodToDateRange(value) {
2687
+ let startDate;
2688
+ switch (value) {
2689
+ case "last7Days":
2690
+ startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 6);
2691
+ break;
2692
+ case "last30Days":
2693
+ startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 29);
2694
+ break;
2695
+ case "last90Days":
2696
+ startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 89);
2697
+ break;
2698
+ case "last365Days":
2699
+ startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 364);
2700
+ break;
2701
+ }
2702
+ return {
2703
+ startDate: startDate.toISOString(),
2704
+ endDate: (/* @__PURE__ */ new Date()).toISOString()
2705
+ };
2706
+ }
2561
2707
 
2562
2708
  // ../commons/src/events/EventConfig.ts
2563
- var import_zod_openapi8 = require("zod-openapi");
2564
- (0, import_zod_openapi8.extendZodWithOpenApi)(import_zod20.z);
2565
- var EventConfig = import_zod20.z.object({
2566
- id: import_zod20.z.string().describe(
2709
+ var import_zod_openapi9 = require("zod-openapi");
2710
+ (0, import_zod_openapi9.extendZodWithOpenApi)(import_zod21.z);
2711
+ var EventConfig = import_zod21.z.object({
2712
+ id: import_zod21.z.string().describe(
2567
2713
  'A machine-readable identifier for the event, e.g. "birth" or "death"'
2568
2714
  ),
2569
2715
  dateOfEvent: FieldReference.optional(),
@@ -2573,10 +2719,10 @@ var EventConfig = import_zod20.z.object({
2573
2719
  ),
2574
2720
  summary: SummaryConfig,
2575
2721
  label: TranslationConfig,
2576
- actions: import_zod20.z.array(ActionConfig),
2722
+ actions: import_zod21.z.array(ActionConfig),
2577
2723
  declaration: DeclarationFormConfig,
2578
- deduplication: import_zod20.z.array(DeduplicationConfig).optional().default([]),
2579
- advancedSearch: import_zod20.z.array(AdvancedSearchConfig).optional().default([])
2724
+ deduplication: import_zod21.z.array(DeduplicationConfig).optional().default([]),
2725
+ advancedSearch: import_zod21.z.array(AdvancedSearchConfig).optional().default([])
2580
2726
  }).superRefine((event2, ctx) => {
2581
2727
  const allFields = findAllFields(event2);
2582
2728
  const fieldIds = allFields.map((field2) => field2.id);
@@ -2608,6 +2754,28 @@ var EventConfig = import_zod20.z.object({
2608
2754
  path: ["advancedSearch"]
2609
2755
  });
2610
2756
  }
2757
+ event2.advancedSearch.forEach((section, sectionIndex) => {
2758
+ section.fields.forEach((field2, fieldIndex) => {
2759
+ if ("alternateFieldIds" in field2 && Array.isArray(field2.alternateFieldIds)) {
2760
+ const invalidAltIds = field2.alternateFieldIds.filter(
2761
+ (id) => !fieldIds.includes(id)
2762
+ );
2763
+ if (invalidAltIds.length > 0) {
2764
+ ctx.addIssue({
2765
+ code: "custom",
2766
+ message: `Invalid alternateFieldIds: ${invalidAltIds.join(", ")}`,
2767
+ path: [
2768
+ "advancedSearch",
2769
+ sectionIndex,
2770
+ "fields",
2771
+ fieldIndex,
2772
+ "alternateFieldIds"
2773
+ ]
2774
+ });
2775
+ }
2776
+ }
2777
+ });
2778
+ });
2611
2779
  if (event2.dateOfEvent) {
2612
2780
  const eventDateFieldId = getDeclarationFields(event2).find(
2613
2781
  ({ id }) => id === event2.dateOfEvent?.$$field
@@ -2638,16 +2806,17 @@ var definePage = (page) => PageConfig.parse(page);
2638
2806
  var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
2639
2807
 
2640
2808
  // ../commons/src/events/WorkqueueConfig.ts
2641
- var import_zod27 = require("zod");
2809
+ var import_zod28 = require("zod");
2642
2810
 
2643
2811
  // ../commons/src/events/serializers/user/serializer.ts
2644
- var import_zod21 = require("zod");
2645
- var SerializedUserField = import_zod21.z.object({
2646
- $userField: import_zod21.z.enum([
2812
+ var import_zod22 = require("zod");
2813
+ var SerializedUserField = import_zod22.z.object({
2814
+ $userField: import_zod22.z.enum([
2647
2815
  "id",
2648
2816
  "name",
2649
2817
  "role",
2650
- "signatureFilename",
2818
+ "signature",
2819
+ "avatar",
2651
2820
  "primaryOfficeId"
2652
2821
  ])
2653
2822
  });
@@ -2719,41 +2888,6 @@ var user = Object.assign(userSerializer, {
2719
2888
  required: ["$user"]
2720
2889
  })
2721
2890
  });
2722
- function createEventConditionals() {
2723
- return {
2724
- /**
2725
- * Checks if the event contains a specific action type.
2726
- * @param action - The action type to check for.
2727
- */
2728
- hasAction: (action) => defineConditional({
2729
- type: "object",
2730
- properties: {
2731
- $event: {
2732
- type: "object",
2733
- properties: {
2734
- actions: {
2735
- type: "array",
2736
- contains: {
2737
- type: "object",
2738
- properties: {
2739
- type: {
2740
- const: action
2741
- }
2742
- },
2743
- required: ["type"]
2744
- }
2745
- }
2746
- },
2747
- required: ["actions"]
2748
- }
2749
- },
2750
- required: ["$event"]
2751
- })
2752
- };
2753
- }
2754
- function getDateFromNow(days) {
2755
- return new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
2756
- }
2757
2891
  function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
2758
2892
  return {
2759
2893
  type: "object",
@@ -2772,6 +2906,20 @@ function isFieldReference(value) {
2772
2906
  return typeof value === "object" && value !== null && "$$field" in value;
2773
2907
  }
2774
2908
  function createFieldConditionals(fieldId) {
2909
+ const getDayRange = (days, clause) => ({
2910
+ type: "object",
2911
+ properties: {
2912
+ [fieldId]: {
2913
+ type: "string",
2914
+ format: "date",
2915
+ daysFromNow: {
2916
+ days,
2917
+ clause
2918
+ }
2919
+ }
2920
+ },
2921
+ required: [fieldId]
2922
+ });
2775
2923
  const getDateRange = (date, clause) => ({
2776
2924
  type: "object",
2777
2925
  properties: {
@@ -2790,12 +2938,8 @@ function createFieldConditionals(fieldId) {
2790
2938
  $$field: fieldId,
2791
2939
  isAfter: () => ({
2792
2940
  days: (days) => ({
2793
- inPast: () => defineFormConditional(
2794
- getDateRange(getDateFromNow(days), "formatMinimum")
2795
- ),
2796
- inFuture: () => defineFormConditional(
2797
- getDateRange(getDateFromNow(-days), "formatMinimum")
2798
- )
2941
+ inPast: () => defineFormConditional(getDayRange(-days, "after")),
2942
+ inFuture: () => defineFormConditional(getDayRange(days, "after"))
2799
2943
  }),
2800
2944
  date: (date) => {
2801
2945
  if (isFieldReference(date)) {
@@ -2810,16 +2954,12 @@ function createFieldConditionals(fieldId) {
2810
2954
  }
2811
2955
  return defineFormConditional(getDateRange(date, "formatMinimum"));
2812
2956
  },
2813
- now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMinimum"))
2957
+ now: () => defineFormConditional(getDateRange({ $data: "/$now" }, "formatMinimum"))
2814
2958
  }),
2815
2959
  isBefore: () => ({
2816
2960
  days: (days) => ({
2817
- inPast: () => defineFormConditional(
2818
- getDateRange(getDateFromNow(days), "formatMaximum")
2819
- ),
2820
- inFuture: () => defineFormConditional(
2821
- getDateRange(getDateFromNow(-days), "formatMaximum")
2822
- )
2961
+ inPast: () => defineFormConditional(getDayRange(days, "before")),
2962
+ inFuture: () => defineFormConditional(getDayRange(-days, "before"))
2823
2963
  }),
2824
2964
  date: (date) => {
2825
2965
  if (isFieldReference(date)) {
@@ -2834,7 +2974,7 @@ function createFieldConditionals(fieldId) {
2834
2974
  }
2835
2975
  return defineFormConditional(getDateRange(date, "formatMaximum"));
2836
2976
  },
2837
- now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMaximum"))
2977
+ now: () => defineFormConditional(getDateRange({ $data: "/$now" }, "formatMaximum"))
2838
2978
  }),
2839
2979
  isEqualTo: (value) => {
2840
2980
  if (isFieldReference(value)) {
@@ -2926,8 +3066,7 @@ function createFieldConditionals(fieldId) {
2926
3066
  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'._-]*)*$",
2927
3067
  description: "Name must contain only letters, numbers, and allowed special characters ('._-). No double spaces."
2928
3068
  }
2929
- },
2930
- required: [fieldId]
3069
+ }
2931
3070
  }),
2932
3071
  /**
2933
3072
  * Checks if the field value matches a given regular expression pattern.
@@ -2983,7 +3122,7 @@ function createSearchConfig(baseField) {
2983
3122
  *
2984
3123
  * @returns An object containing the field ID and a configuration object with a type of 'range'.
2985
3124
  *
2986
- * @example event('legalStatus.REGISTERED.createdAt').range()
3125
+ * @example event('legalStatuses.REGISTERED.acceptedAt').range()
2987
3126
  * // {
2988
3127
  * // ...
2989
3128
  * // config: { type: 'range' }
@@ -3023,21 +3162,47 @@ function createSearchConfig(baseField) {
3023
3162
  }
3024
3163
 
3025
3164
  // ../commons/src/event-config/event-configuration.ts
3026
- function createEventFieldConfig(fieldId, options) {
3165
+ function createEventFieldConfig(fieldId) {
3027
3166
  const baseField = {
3028
3167
  fieldId,
3029
- options,
3030
3168
  fieldType: "event"
3031
3169
  };
3032
3170
  return createSearchConfig(baseField);
3033
3171
  }
3034
3172
 
3035
3173
  // ../commons/src/events/event.ts
3036
- function eventFn(fieldId, options) {
3037
- return createEventFieldConfig(fieldId, options);
3174
+ function eventFn(fieldId) {
3175
+ return createEventFieldConfig(fieldId);
3038
3176
  }
3039
3177
  var event = Object.assign(eventFn, {
3040
- ...createEventConditionals(),
3178
+ /**
3179
+ * Checks if the event contains a specific action type.
3180
+ * @param action - The action type to check for.
3181
+ */
3182
+ hasAction: (action) => defineConditional({
3183
+ type: "object",
3184
+ properties: {
3185
+ $event: {
3186
+ type: "object",
3187
+ properties: {
3188
+ actions: {
3189
+ type: "array",
3190
+ contains: {
3191
+ type: "object",
3192
+ properties: {
3193
+ type: {
3194
+ const: action
3195
+ }
3196
+ },
3197
+ required: ["type"]
3198
+ }
3199
+ }
3200
+ },
3201
+ required: ["actions"]
3202
+ }
3203
+ },
3204
+ required: ["$event"]
3205
+ }),
3041
3206
  field(field2) {
3042
3207
  return {
3043
3208
  $event: field2
@@ -3046,78 +3211,83 @@ var event = Object.assign(eventFn, {
3046
3211
  });
3047
3212
 
3048
3213
  // ../commons/src/events/WorkqueueColumnConfig.ts
3049
- var import_zod23 = require("zod");
3214
+ var import_zod24 = require("zod");
3050
3215
 
3051
3216
  // ../commons/src/events/EventMetadata.ts
3052
- var import_zod22 = require("zod");
3053
- var EventStatus = import_zod22.z.enum([
3217
+ var import_zod23 = require("zod");
3218
+ var EventStatus = import_zod23.z.enum([
3054
3219
  "CREATED",
3055
3220
  "NOTIFIED",
3056
3221
  "DECLARED",
3057
3222
  "VALIDATED",
3058
3223
  "REGISTERED",
3059
3224
  "CERTIFIED",
3060
- "REJECTED",
3061
3225
  "ARCHIVED"
3062
3226
  ]);
3063
- var CustomFlags = {
3064
- CERTIFICATE_PRINTED: "certificate-printed"
3227
+ var VisibleStatus = import_zod23.z.enum([...EventStatus.options, "REJECTED"]);
3228
+ var InherentFlags = {
3229
+ PRINTED: "printed",
3230
+ INCOMPLETE: "incomplete",
3231
+ REJECTED: "rejected",
3232
+ CORRECTION_REQUESTED: "correction-requested"
3065
3233
  };
3066
- var Flag = import_zod22.z.string().regex(
3234
+ var Flag = import_zod23.z.string().regex(
3067
3235
  new RegExp(
3068
3236
  `^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
3069
3237
  ActionStatus
3070
3238
  ).join("|").toLowerCase()})$`
3071
3239
  ),
3072
3240
  "Flag must be in the format ActionType:ActionStatus (lowerCase)"
3073
- ).or(import_zod22.z.nativeEnum(CustomFlags));
3074
- var ZodDate = import_zod22.z.string().date();
3075
- var ActionCreationMetadata = import_zod22.z.object({
3076
- createdAt: import_zod22.z.string().datetime().describe("The timestamp when the action request was created."),
3077
- createdBy: import_zod22.z.string().describe("ID of the user who created the action request."),
3241
+ ).or(import_zod23.z.nativeEnum(InherentFlags));
3242
+ var ZodDate = import_zod23.z.string().date();
3243
+ var ActionCreationMetadata = import_zod23.z.object({
3244
+ createdAt: import_zod23.z.string().datetime().describe("The timestamp when the action request was created."),
3245
+ createdBy: import_zod23.z.string().describe("ID of the user who created the action request."),
3078
3246
  createdAtLocation: CreatedAtLocation.describe(
3079
3247
  "Location of the user who created the action request."
3080
3248
  ),
3081
- createdByUserType: import_zod22.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
3082
- acceptedAt: import_zod22.z.string().datetime().describe("Timestamp when the action request was accepted."),
3083
- createdByRole: import_zod22.z.string().describe("Role of the user at the time of action request creation."),
3084
- createdBySignature: import_zod22.z.string().nullish().describe("Signature of the user who created the action request.")
3249
+ createdByUserType: import_zod23.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
3250
+ acceptedAt: import_zod23.z.string().datetime().describe("Timestamp when the action request was accepted."),
3251
+ createdByRole: import_zod23.z.string().describe("Role of the user at the time of action request creation."),
3252
+ createdBySignature: import_zod23.z.string().nullish().describe("Signature of the user who created the action request.")
3085
3253
  });
3086
3254
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
3087
- registrationNumber: import_zod22.z.string().describe(
3255
+ registrationNumber: import_zod23.z.string().describe(
3088
3256
  "Registration number of the event. Always present for accepted registrations."
3089
3257
  )
3090
3258
  });
3091
- var LegalStatuses = import_zod22.z.object({
3259
+ var LegalStatuses = import_zod23.z.object({
3092
3260
  [EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
3093
3261
  [EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
3094
3262
  });
3095
- var EventMetadata = import_zod22.z.object({
3096
- id: import_zod22.z.string(),
3097
- type: import_zod22.z.string().describe("The type of event, such as birth, death, or marriage."),
3263
+ var EventMetadata = import_zod23.z.object({
3264
+ id: UUID,
3265
+ type: import_zod23.z.string().describe("The type of event, such as birth, death, or marriage."),
3098
3266
  status: EventStatus,
3099
3267
  legalStatuses: LegalStatuses.describe(
3100
3268
  "Metadata related to the legal registration of the event, such as who registered it and when."
3101
3269
  ),
3102
- createdAt: import_zod22.z.string().datetime().describe("The timestamp when the event was first created and saved."),
3270
+ createdAt: import_zod23.z.string().datetime().describe("The timestamp when the event was first created and saved."),
3103
3271
  dateOfEvent: ZodDate.nullish(),
3104
- createdBy: import_zod22.z.string().describe("ID of the user who created the event."),
3105
- createdByUserType: import_zod22.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
3106
- updatedByUserRole: import_zod22.z.string().describe("Role of the user who last changed the status."),
3272
+ createdBy: import_zod23.z.string().describe("ID of the user who created the event."),
3273
+ createdByUserType: import_zod23.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
3274
+ updatedByUserRole: import_zod23.z.string().describe("Role of the user who last changed the status."),
3107
3275
  createdAtLocation: CreatedAtLocation.describe(
3108
3276
  "Location of the user who created the event."
3109
3277
  ),
3110
- createdBySignature: import_zod22.z.string().nullish().describe("Signature of the user who created the event."),
3111
- updatedAtLocation: import_zod22.z.string().nullish().describe("Location of the user who last changed the status."),
3112
- updatedAt: import_zod22.z.string().datetime().describe(
3278
+ createdBySignature: import_zod23.z.string().nullish().describe("Signature of the user who created the event."),
3279
+ updatedAtLocation: UUID.nullish().describe(
3280
+ "Location of the user who last changed the status."
3281
+ ),
3282
+ updatedAt: import_zod23.z.string().datetime().describe(
3113
3283
  "Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
3114
3284
  ),
3115
- assignedTo: import_zod22.z.string().nullish().describe("ID of the user currently assigned to the event."),
3116
- updatedBy: import_zod22.z.string().nullish().describe("ID of the user who last changed the status."),
3117
- trackingId: import_zod22.z.string().describe(
3285
+ assignedTo: import_zod23.z.string().nullish().describe("ID of the user currently assigned to the event."),
3286
+ updatedBy: import_zod23.z.string().nullish().describe("ID of the user who last changed the status."),
3287
+ trackingId: import_zod23.z.string().describe(
3118
3288
  "System-generated tracking ID used by informants or registrars to look up the event."
3119
3289
  ),
3120
- flags: import_zod22.z.array(Flag)
3290
+ flags: import_zod23.z.array(Flag)
3121
3291
  });
3122
3292
  var EventMetadataKeysArray = [
3123
3293
  "id",
@@ -3137,7 +3307,7 @@ var EventMetadataKeysArray = [
3137
3307
  "legalStatuses",
3138
3308
  "flags"
3139
3309
  ];
3140
- var EventMetadataKeys = import_zod22.z.enum(EventMetadataKeysArray);
3310
+ var EventMetadataKeys = import_zod23.z.enum(EventMetadataKeysArray);
3141
3311
  var eventMetadataLabelMap = {
3142
3312
  "event.assignedTo": {
3143
3313
  id: "event.assignedTo.label",
@@ -3222,11 +3392,11 @@ var WorkqueueColumnKeysArray = [
3222
3392
  "title",
3223
3393
  "outbox"
3224
3394
  ];
3225
- var WorkqueueColumnKeys = import_zod23.z.enum(WorkqueueColumnKeysArray);
3226
- var WorkqueueColumnValue = import_zod23.z.object({
3395
+ var WorkqueueColumnKeys = import_zod24.z.enum(WorkqueueColumnKeysArray);
3396
+ var WorkqueueColumnValue = import_zod24.z.object({
3227
3397
  $event: WorkqueueColumnKeys
3228
3398
  });
3229
- var WorkqueueColumn = import_zod23.z.object({
3399
+ var WorkqueueColumn = import_zod24.z.object({
3230
3400
  label: TranslationConfig,
3231
3401
  value: WorkqueueColumnValue
3232
3402
  });
@@ -3237,112 +3407,127 @@ function defineWorkqueuesColumns(workqueueColumns) {
3237
3407
  }
3238
3408
 
3239
3409
  // ../commons/src/events/CountryConfigQueryInput.ts
3240
- var import_zod25 = require("zod");
3410
+ var import_zod26 = require("zod");
3241
3411
 
3242
3412
  // ../commons/src/events/EventIndex.ts
3243
- var import_zod24 = require("zod");
3244
- var import_zod_openapi9 = require("zod-openapi");
3245
- (0, import_zod_openapi9.extendZodWithOpenApi)(import_zod24.z);
3413
+ var import_zod25 = require("zod");
3414
+ var import_zod_openapi10 = require("zod-openapi");
3415
+ (0, import_zod_openapi10.extendZodWithOpenApi)(import_zod25.z);
3246
3416
  var EventIndex = EventMetadata.extend({
3247
3417
  declaration: EventState
3248
3418
  }).openapi({
3249
3419
  ref: "EventIndex"
3250
3420
  });
3251
- var EventSearchIndex = import_zod24.z.record(import_zod24.z.string(), import_zod24.z.any()).and(
3252
- import_zod24.z.object({
3253
- type: import_zod24.z.string()
3421
+ var EventSearchIndex = import_zod25.z.record(import_zod25.z.string(), import_zod25.z.any()).and(
3422
+ import_zod25.z.object({
3423
+ type: import_zod25.z.string()
3254
3424
  // Ensures "type" (event-id) exists and is a string
3255
3425
  })
3256
3426
  ).openapi({
3257
3427
  ref: "EventSearchIndex"
3258
3428
  });
3259
- var Fuzzy = import_zod24.z.object({ type: import_zod24.z.literal("fuzzy"), term: import_zod24.z.string() }).openapi({
3429
+ var Fuzzy = import_zod25.z.object({ type: import_zod25.z.literal("fuzzy"), term: import_zod25.z.string() }).openapi({
3260
3430
  ref: "Fuzzy"
3261
3431
  });
3262
- var Exact = import_zod24.z.object({ type: import_zod24.z.literal("exact"), term: import_zod24.z.string() }).openapi({
3432
+ var Exact = import_zod25.z.object({ type: import_zod25.z.literal("exact"), term: import_zod25.z.string() }).openapi({
3263
3433
  ref: "Exact"
3264
3434
  });
3265
- var ExactStatus = import_zod24.z.object({
3266
- type: import_zod24.z.literal("exact"),
3435
+ var ExactStatus = import_zod25.z.object({
3436
+ type: import_zod25.z.literal("exact"),
3267
3437
  term: EventStatus
3268
3438
  }).openapi({
3269
3439
  ref: "ExactStatus"
3270
3440
  });
3271
- var AnyOf = import_zod24.z.object({
3272
- type: import_zod24.z.literal("anyOf"),
3273
- terms: import_zod24.z.array(import_zod24.z.string())
3441
+ var ExactUserType = import_zod25.z.object({
3442
+ type: import_zod25.z.literal("exact"),
3443
+ term: TokenUserType
3444
+ }).openapi({
3445
+ ref: "ExactUserType"
3446
+ });
3447
+ var AnyOf = import_zod25.z.object({
3448
+ type: import_zod25.z.literal("anyOf"),
3449
+ terms: import_zod25.z.array(import_zod25.z.string())
3274
3450
  }).openapi({
3275
3451
  ref: "AnyOf"
3276
3452
  });
3277
- var AnyOfStatus = import_zod24.z.object({
3278
- type: import_zod24.z.literal("anyOf"),
3279
- terms: import_zod24.z.array(EventStatus)
3453
+ var AnyOfStatus = import_zod25.z.object({
3454
+ type: import_zod25.z.literal("anyOf"),
3455
+ terms: import_zod25.z.array(EventStatus)
3280
3456
  }).openapi({
3281
3457
  ref: "AnyOfStatus"
3282
3458
  });
3283
- var Range = import_zod24.z.object({
3284
- type: import_zod24.z.literal("range"),
3285
- gte: import_zod24.z.string(),
3286
- lte: import_zod24.z.string()
3459
+ var Range = import_zod25.z.object({
3460
+ type: import_zod25.z.literal("range"),
3461
+ gte: import_zod25.z.string(),
3462
+ lte: import_zod25.z.string()
3287
3463
  }).openapi({
3288
3464
  ref: "Range"
3289
3465
  });
3290
- var Not = import_zod24.z.object({ type: import_zod24.z.literal("not"), term: import_zod24.z.string() }).openapi({
3291
- ref: "Not"
3466
+ var ContainsFlags = import_zod25.z.object({
3467
+ anyOf: import_zod25.z.array(Flag).optional(),
3468
+ noneOf: import_zod25.z.array(Flag).optional()
3469
+ }).openapi({
3470
+ ref: "ContainsFlags"
3292
3471
  });
3293
- var Within = import_zod24.z.object({ type: import_zod24.z.literal("within"), location: import_zod24.z.string() }).openapi({
3472
+ var Within = import_zod25.z.object({ type: import_zod25.z.literal("within"), location: import_zod25.z.string() }).openapi({
3294
3473
  ref: "Within"
3295
3474
  });
3296
- var RangeDate = Range.extend({
3297
- gte: import_zod24.z.string().date().or(import_zod24.z.string().datetime()),
3298
- lte: import_zod24.z.string().date().or(import_zod24.z.string().datetime())
3299
- }).openapi({
3300
- ref: "RangeDate"
3301
- });
3475
+ var RangeDate = import_zod25.z.object({
3476
+ type: import_zod25.z.literal("range"),
3477
+ gte: import_zod25.z.string().date().or(import_zod25.z.string().datetime()),
3478
+ lte: import_zod25.z.string().date().or(import_zod25.z.string().datetime())
3479
+ }).openapi({ ref: "RangeDate" });
3302
3480
  var ExactDate = Exact.extend({
3303
- term: import_zod24.z.string().date().or(import_zod24.z.string().datetime())
3481
+ term: import_zod25.z.string().date().or(import_zod25.z.string().datetime())
3304
3482
  }).openapi({
3305
3483
  ref: "ExactDate"
3306
3484
  });
3307
- var DateCondition = import_zod24.z.union([ExactDate, RangeDate]).openapi({
3485
+ var TimePeriod = import_zod25.z.object({
3486
+ type: import_zod25.z.literal("timePeriod"),
3487
+ term: SelectDateRangeValue
3488
+ }).openapi({
3489
+ ref: "TimePeriod"
3490
+ });
3491
+ var DateCondition = import_zod25.z.union([ExactDate, RangeDate, TimePeriod]).openapi({
3308
3492
  ref: "DateCondition"
3309
3493
  });
3310
- var QueryInput = import_zod24.z.lazy(
3311
- () => import_zod24.z.union([
3312
- import_zod24.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf, Not]),
3313
- import_zod24.z.record(import_zod24.z.string(), QueryInput)
3494
+ var QueryInput = import_zod25.z.lazy(
3495
+ () => import_zod25.z.union([
3496
+ import_zod25.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf]),
3497
+ import_zod25.z.record(import_zod25.z.string(), QueryInput)
3314
3498
  ])
3315
3499
  ).openapi({
3316
3500
  ref: "QueryInput"
3317
3501
  });
3318
- var QueryExpression = import_zod24.z.object({
3319
- id: import_zod24.z.optional(import_zod24.z.string()),
3320
- eventType: import_zod24.z.string(),
3321
- status: import_zod24.z.optional(import_zod24.z.union([AnyOfStatus, ExactStatus])),
3322
- createdAt: import_zod24.z.optional(DateCondition),
3323
- updatedAt: import_zod24.z.optional(DateCondition),
3324
- "legalStatus.REGISTERED.createdAt": import_zod24.z.optional(DateCondition),
3325
- "legalStatus.REGISTERED.createdAtLocation": import_zod24.z.optional(
3326
- import_zod24.z.union([Within, Exact])
3502
+ var QueryExpression = import_zod25.z.object({
3503
+ id: import_zod25.z.optional(import_zod25.z.string()),
3504
+ eventType: import_zod25.z.string(),
3505
+ status: import_zod25.z.optional(import_zod25.z.union([AnyOfStatus, ExactStatus])),
3506
+ createdAt: import_zod25.z.optional(DateCondition),
3507
+ updatedAt: import_zod25.z.optional(DateCondition),
3508
+ "legalStatuses.REGISTERED.acceptedAt": import_zod25.z.optional(DateCondition),
3509
+ "legalStatuses.REGISTERED.createdAtLocation": import_zod25.z.optional(
3510
+ import_zod25.z.union([Within, Exact])
3327
3511
  ),
3328
- "legalStatus.REGISTERED.registrationNumber": import_zod24.z.optional(Exact),
3329
- createdAtLocation: import_zod24.z.optional(import_zod24.z.union([Within, Exact])),
3330
- updatedAtLocation: import_zod24.z.optional(import_zod24.z.union([Within, Exact])),
3331
- assignedTo: import_zod24.z.optional(Exact),
3332
- createdByUserType: TokenUserType,
3333
- createdBy: import_zod24.z.optional(Exact),
3334
- updatedBy: import_zod24.z.optional(Exact),
3335
- trackingId: import_zod24.z.optional(Exact),
3336
- flags: import_zod24.z.optional(import_zod24.z.array(import_zod24.z.union([AnyOf, Not]))),
3512
+ "legalStatuses.REGISTERED.registrationNumber": import_zod25.z.optional(Exact),
3513
+ createdAtLocation: import_zod25.z.optional(import_zod25.z.union([Within, Exact])),
3514
+ updatedAtLocation: import_zod25.z.optional(import_zod25.z.union([Within, Exact])),
3515
+ assignedTo: import_zod25.z.optional(Exact),
3516
+ createdByUserType: import_zod25.z.optional(ExactUserType),
3517
+ createdBy: import_zod25.z.optional(Exact),
3518
+ updatedBy: import_zod25.z.optional(Exact),
3519
+ trackingId: import_zod25.z.optional(Exact),
3520
+ flags: import_zod25.z.optional(ContainsFlags),
3521
+ // @todo: The type for this comes out as "any"
3337
3522
  data: QueryInput
3338
3523
  }).partial().refine((obj) => Object.values(obj).some((val) => val !== void 0), {
3339
3524
  message: "At least one query field must be specified."
3340
3525
  }).openapi({
3341
3526
  ref: "QueryExpression"
3342
3527
  });
3343
- var QueryType = import_zod24.z.object({
3344
- type: import_zod24.z.literal("and").or(import_zod24.z.literal("or")).openapi({ default: "and" }),
3345
- clauses: import_zod24.z.preprocess(
3528
+ var QueryType = import_zod25.z.object({
3529
+ type: import_zod25.z.literal("and").or(import_zod25.z.literal("or")).openapi({ default: "and" }),
3530
+ clauses: import_zod25.z.preprocess(
3346
3531
  (val) => {
3347
3532
  if (typeof val === "string") {
3348
3533
  return [JSON.parse(val)];
@@ -3352,7 +3537,7 @@ var QueryType = import_zod24.z.object({
3352
3537
  }
3353
3538
  return val;
3354
3539
  },
3355
- import_zod24.z.array(QueryExpression).nonempty("At least one clause is required.").openapi({
3540
+ import_zod25.z.array(QueryExpression).nonempty("At least one clause is required.").openapi({
3356
3541
  default: [
3357
3542
  {
3358
3543
  eventType: TENNIS_CLUB_MEMBERSHIP,
@@ -3373,53 +3558,62 @@ var QueryType = import_zod24.z.object({
3373
3558
  }).openapi({
3374
3559
  ref: "QueryType"
3375
3560
  });
3561
+ var SearchScopeAccessLevels = {
3562
+ MY_JURISDICTION: "my-jurisdiction",
3563
+ ALL: "all"
3564
+ };
3376
3565
 
3377
3566
  // ../commons/src/events/CountryConfigQueryInput.ts
3378
- var SerializableExact = import_zod25.z.object({
3379
- type: import_zod25.z.literal("exact"),
3380
- term: import_zod25.z.union([import_zod25.z.string(), SerializedUserField])
3567
+ var SerializableExact = import_zod26.z.object({
3568
+ type: import_zod26.z.literal("exact"),
3569
+ term: import_zod26.z.union([import_zod26.z.string(), SerializedUserField])
3381
3570
  });
3382
- var SerializableWithin = import_zod25.z.object({
3383
- type: import_zod25.z.literal("within"),
3384
- location: import_zod25.z.union([import_zod25.z.string(), SerializedUserField])
3571
+ var SerializableWithin = import_zod26.z.object({
3572
+ type: import_zod26.z.literal("within"),
3573
+ location: import_zod26.z.union([import_zod26.z.string(), SerializedUserField])
3385
3574
  });
3386
- var SerializedQueryExpression = import_zod25.z.object({
3387
- eventType: import_zod25.z.string(),
3388
- status: import_zod25.z.optional(import_zod25.z.union([AnyOfStatus, ExactStatus])),
3389
- createdAt: import_zod25.z.optional(DateCondition),
3390
- updatedAt: import_zod25.z.optional(DateCondition),
3391
- createdAtLocation: import_zod25.z.optional(
3392
- import_zod25.z.union([SerializableWithin, SerializableExact])
3575
+ var SerializedQueryExpression = import_zod26.z.object({
3576
+ eventType: import_zod26.z.string(),
3577
+ status: import_zod26.z.optional(import_zod26.z.union([AnyOfStatus, ExactStatus])),
3578
+ createdAt: import_zod26.z.optional(DateCondition),
3579
+ updatedAt: import_zod26.z.optional(DateCondition),
3580
+ "legalStatuses.REGISTERED.createdAt": import_zod26.z.optional(DateCondition),
3581
+ "legalStatuses.REGISTERED.createdAtLocation": import_zod26.z.optional(
3582
+ import_zod26.z.union([Within, Exact])
3393
3583
  ),
3394
- updatedAtLocation: import_zod25.z.optional(
3395
- import_zod25.z.union([SerializableWithin, SerializableExact])
3584
+ "legalStatuses.REGISTERED.registrationNumber": import_zod26.z.optional(Exact),
3585
+ createdAtLocation: import_zod26.z.optional(
3586
+ import_zod26.z.union([SerializableWithin, SerializableExact])
3396
3587
  ),
3397
- assignedTo: import_zod25.z.optional(SerializableExact),
3398
- createdBy: import_zod25.z.optional(SerializableExact),
3399
- createdByUserType: TokenUserType,
3400
- updatedBy: import_zod25.z.optional(SerializableExact),
3401
- trackingId: import_zod25.z.optional(Exact),
3402
- flags: import_zod25.z.optional(import_zod25.z.array(import_zod25.z.union([AnyOf, Not]))),
3588
+ updatedAtLocation: import_zod26.z.optional(
3589
+ import_zod26.z.union([SerializableWithin, SerializableExact])
3590
+ ),
3591
+ assignedTo: import_zod26.z.optional(SerializableExact),
3592
+ createdBy: import_zod26.z.optional(SerializableExact),
3593
+ createdByUserType: ExactUserType,
3594
+ updatedBy: import_zod26.z.optional(SerializableExact),
3595
+ trackingId: import_zod26.z.optional(Exact),
3596
+ flags: import_zod26.z.optional(ContainsFlags),
3403
3597
  data: QueryInput
3404
3598
  }).partial();
3405
- var Or2 = import_zod25.z.object({
3406
- type: import_zod25.z.literal("or"),
3407
- clauses: import_zod25.z.array(SerializedQueryExpression)
3599
+ var Or2 = import_zod26.z.object({
3600
+ type: import_zod26.z.literal("or"),
3601
+ clauses: import_zod26.z.array(SerializedQueryExpression)
3408
3602
  });
3409
- var And2 = import_zod25.z.object({
3410
- type: import_zod25.z.literal("and"),
3411
- clauses: import_zod25.z.array(SerializedQueryExpression)
3603
+ var And2 = import_zod26.z.object({
3604
+ type: import_zod26.z.literal("and"),
3605
+ clauses: import_zod26.z.array(SerializedQueryExpression)
3412
3606
  });
3413
- var CountryConfigQueryType = import_zod25.z.discriminatedUnion("type", [And2, Or2]);
3414
- var CountryConfigQueryInputType = import_zod25.z.union([
3607
+ var CountryConfigQueryType = import_zod26.z.discriminatedUnion("type", [And2, Or2]);
3608
+ var CountryConfigQueryInputType = import_zod26.z.union([
3415
3609
  SerializedQueryExpression,
3416
3610
  And2,
3417
3611
  Or2
3418
3612
  ]);
3419
3613
 
3420
3614
  // ../commons/src/icons.ts
3421
- var import_zod26 = require("zod");
3422
- var AvailableIcons = import_zod26.z.enum([
3615
+ var import_zod27 = require("zod");
3616
+ var AvailableIcons = import_zod27.z.enum([
3423
3617
  "Archived",
3424
3618
  "Assigned",
3425
3619
  "Certified",
@@ -3457,7 +3651,6 @@ var AvailableIcons = import_zod26.z.enum([
3457
3651
  "Copy",
3458
3652
  "Database",
3459
3653
  "DotsThreeVertical",
3460
- "DownloadSimple",
3461
3654
  "ArrowCounterClockwise",
3462
3655
  "MagnifyingGlassMinus",
3463
3656
  "MagnifyingGlassPlus",
@@ -3541,42 +3734,42 @@ var mandatoryColumns = defineWorkqueuesColumns([
3541
3734
  value: event.field("updatedAt")
3542
3735
  }
3543
3736
  ]);
3544
- var WorkqueueActionsWithDefault = import_zod27.z.enum([
3737
+ var WorkqueueActionsWithDefault = import_zod28.z.enum([
3545
3738
  ...workqueueActions.options,
3546
3739
  "DEFAULT"
3547
3740
  ]);
3548
- var WorkqueueConfig = import_zod27.z.object({
3549
- slug: import_zod27.z.string().describe("Determines the url of the workqueue."),
3741
+ var WorkqueueConfig = import_zod28.z.object({
3742
+ slug: import_zod28.z.string().describe("Determines the url of the workqueue."),
3550
3743
  name: TranslationConfig.describe(
3551
3744
  "Title of the workflow (both in navigation and on the page)"
3552
3745
  ),
3553
3746
  query: CountryConfigQueryType,
3554
- actions: import_zod27.z.array(
3555
- import_zod27.z.object({
3747
+ actions: import_zod28.z.array(
3748
+ import_zod28.z.object({
3556
3749
  type: WorkqueueActionsWithDefault,
3557
- conditionals: import_zod27.z.array(Conditional).optional()
3750
+ conditionals: import_zod28.z.array(Conditional).optional()
3558
3751
  })
3559
3752
  ),
3560
- columns: import_zod27.z.array(WorkqueueColumn).default(mandatoryColumns),
3753
+ columns: import_zod28.z.array(WorkqueueColumn).default(mandatoryColumns),
3561
3754
  icon: AvailableIcons
3562
3755
  }).describe("Configuration for workqueue.");
3563
3756
  var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
3564
3757
  query: true,
3565
3758
  columns: true
3566
3759
  });
3567
- var WorkqueueConfigInput = import_zod27.z.object({
3568
- slug: import_zod27.z.string().describe("Determines the url of the workqueue."),
3760
+ var WorkqueueConfigInput = import_zod28.z.object({
3761
+ slug: import_zod28.z.string().describe("Determines the url of the workqueue."),
3569
3762
  name: TranslationConfig.describe(
3570
3763
  "Title of the workflow (both in navigation and on the page)"
3571
3764
  ),
3572
3765
  query: CountryConfigQueryInputType,
3573
- actions: import_zod27.z.array(
3574
- import_zod27.z.object({
3766
+ actions: import_zod28.z.array(
3767
+ import_zod28.z.object({
3575
3768
  type: WorkqueueActionsWithDefault,
3576
- conditionals: import_zod27.z.array(Conditional).optional()
3769
+ conditionals: import_zod28.z.array(Conditional).optional()
3577
3770
  })
3578
3771
  ),
3579
- columns: import_zod27.z.array(WorkqueueColumn).default(mandatoryColumns),
3772
+ columns: import_zod28.z.array(WorkqueueColumn).default(mandatoryColumns),
3580
3773
  icon: AvailableIcons
3581
3774
  });
3582
3775
  function defineWorkqueue(workqueueInput) {
@@ -3587,10 +3780,10 @@ function defineWorkqueue(workqueueInput) {
3587
3780
  function defineWorkqueues(workqueues) {
3588
3781
  return workqueues.map((workqueue) => defineWorkqueue(workqueue));
3589
3782
  }
3590
- var WorkqueueCountInput = import_zod27.z.array(
3591
- import_zod27.z.object({ slug: import_zod27.z.string(), query: QueryType })
3783
+ var WorkqueueCountInput = import_zod28.z.array(
3784
+ import_zod28.z.object({ slug: import_zod28.z.string(), query: QueryType })
3592
3785
  );
3593
- var WorkqueueCountOutput = import_zod27.z.record(import_zod27.z.string(), import_zod27.z.number());
3786
+ var WorkqueueCountOutput = import_zod28.z.record(import_zod28.z.string(), import_zod28.z.number());
3594
3787
 
3595
3788
  // ../commons/src/events/workqueueDefaultColumns.ts
3596
3789
  var defaultWorkqueueColumns = [
@@ -3613,115 +3806,115 @@ var defaultWorkqueueColumns = [
3613
3806
  ];
3614
3807
 
3615
3808
  // ../commons/src/events/Draft.ts
3616
- var import_zod29 = require("zod");
3809
+ var import_zod30 = require("zod");
3617
3810
 
3618
3811
  // ../commons/src/events/ActionInput.ts
3619
- var import_zod28 = require("zod");
3620
- var import_zod_openapi10 = require("zod-openapi");
3621
- var import_uuid3 = require("uuid");
3622
- (0, import_zod_openapi10.extendZodWithOpenApi)(import_zod28.z);
3623
- var BaseActionInput = import_zod28.z.object({
3624
- eventId: import_zod28.z.string(),
3625
- transactionId: import_zod28.z.string(),
3812
+ var import_zod29 = require("zod");
3813
+ var import_zod_openapi11 = require("zod-openapi");
3814
+ (0, import_zod_openapi11.extendZodWithOpenApi)(import_zod29.z);
3815
+ var BaseActionInput = import_zod29.z.object({
3816
+ eventId: UUID,
3817
+ transactionId: import_zod29.z.string(),
3626
3818
  declaration: ActionUpdate.default({}),
3627
3819
  annotation: ActionUpdate.optional(),
3628
- originalActionId: import_zod28.z.string().optional(),
3629
- keepAssignment: import_zod28.z.boolean().optional()
3820
+ originalActionId: UUID.optional(),
3821
+ // should not be part of base action.
3822
+ keepAssignment: import_zod29.z.boolean().optional()
3630
3823
  });
3631
3824
  var CreateActionInput = BaseActionInput.merge(
3632
- import_zod28.z.object({
3633
- type: import_zod28.z.literal(ActionType.CREATE).default(ActionType.CREATE),
3825
+ import_zod29.z.object({
3826
+ type: import_zod29.z.literal(ActionType.CREATE).default(ActionType.CREATE),
3634
3827
  createdAtLocation: CreatedAtLocation
3635
3828
  })
3636
3829
  );
3637
3830
  var RegisterActionInput = BaseActionInput.merge(
3638
- import_zod28.z.object({
3639
- type: import_zod28.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
3640
- registrationNumber: import_zod28.z.string().optional()
3831
+ import_zod29.z.object({
3832
+ type: import_zod29.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
3833
+ registrationNumber: import_zod29.z.string().optional()
3641
3834
  })
3642
- );
3835
+ ).strict();
3643
3836
  var ValidateActionInput = BaseActionInput.merge(
3644
- import_zod28.z.object({
3645
- type: import_zod28.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
3646
- duplicates: import_zod28.z.array(import_zod28.z.string())
3837
+ import_zod29.z.object({
3838
+ type: import_zod29.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
3839
+ duplicates: import_zod29.z.array(import_zod29.z.string())
3647
3840
  })
3648
3841
  );
3649
3842
  var NotifyActionInput = BaseActionInput.merge(
3650
- import_zod28.z.object({
3651
- type: import_zod28.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
3843
+ import_zod29.z.object({
3844
+ type: import_zod29.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
3652
3845
  })
3653
3846
  ).openapi({
3654
3847
  default: {
3655
3848
  eventId: "<event-id-here>",
3656
- transactionId: (0, import_uuid3.v4)(),
3849
+ transactionId: getUUID(),
3657
3850
  declaration: {},
3658
3851
  annotation: {},
3659
3852
  type: ActionType.NOTIFY
3660
3853
  }
3661
3854
  });
3662
3855
  var DeclareActionInput = BaseActionInput.merge(
3663
- import_zod28.z.object({
3664
- type: import_zod28.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
3856
+ import_zod29.z.object({
3857
+ type: import_zod29.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
3665
3858
  })
3666
3859
  );
3667
3860
  var PrintCertificateActionInput = BaseActionInput.merge(
3668
- import_zod28.z.object({
3669
- type: import_zod28.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
3861
+ import_zod29.z.object({
3862
+ type: import_zod29.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
3670
3863
  })
3671
3864
  );
3672
3865
  var RejectDeclarationActionInput = BaseActionInput.merge(
3673
- import_zod28.z.object({
3674
- type: import_zod28.z.literal(ActionType.REJECT).default(ActionType.REJECT),
3866
+ import_zod29.z.object({
3867
+ type: import_zod29.z.literal(ActionType.REJECT).default(ActionType.REJECT),
3675
3868
  reason: RejectionReason
3676
3869
  })
3677
3870
  );
3678
3871
  var MarkedAsDuplicateActionInput = BaseActionInput.merge(
3679
- import_zod28.z.object({
3680
- type: import_zod28.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
3872
+ import_zod29.z.object({
3873
+ type: import_zod29.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
3681
3874
  })
3682
3875
  );
3683
3876
  var ArchiveActionInput = BaseActionInput.merge(
3684
- import_zod28.z.object({
3685
- type: import_zod28.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
3877
+ import_zod29.z.object({
3878
+ type: import_zod29.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
3686
3879
  reason: RejectionReason
3687
3880
  })
3688
3881
  );
3689
3882
  var AssignActionInput = BaseActionInput.merge(
3690
- import_zod28.z.object({
3691
- type: import_zod28.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
3692
- assignedTo: import_zod28.z.string()
3883
+ import_zod29.z.object({
3884
+ type: import_zod29.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
3885
+ assignedTo: import_zod29.z.string()
3693
3886
  })
3694
3887
  );
3695
3888
  var UnassignActionInput = BaseActionInput.merge(
3696
- import_zod28.z.object({
3697
- type: import_zod28.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
3698
- assignedTo: import_zod28.z.literal(null).default(null)
3889
+ import_zod29.z.object({
3890
+ type: import_zod29.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
3891
+ assignedTo: import_zod29.z.literal(null).default(null)
3699
3892
  })
3700
3893
  );
3701
3894
  var RequestCorrectionActionInput = BaseActionInput.merge(
3702
- import_zod28.z.object({
3703
- type: import_zod28.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
3895
+ import_zod29.z.object({
3896
+ type: import_zod29.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
3704
3897
  })
3705
3898
  );
3706
3899
  var RejectCorrectionActionInput = BaseActionInput.merge(
3707
- import_zod28.z.object({
3708
- requestId: import_zod28.z.string(),
3709
- type: import_zod28.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
3900
+ import_zod29.z.object({
3901
+ requestId: import_zod29.z.string(),
3902
+ type: import_zod29.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
3710
3903
  })
3711
3904
  );
3712
3905
  var ApproveCorrectionActionInput = BaseActionInput.merge(
3713
- import_zod28.z.object({
3714
- requestId: import_zod28.z.string(),
3715
- type: import_zod28.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
3906
+ import_zod29.z.object({
3907
+ requestId: import_zod29.z.string(),
3908
+ type: import_zod29.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
3716
3909
  })
3717
3910
  );
3718
3911
  var ReadActionInput = BaseActionInput.merge(
3719
- import_zod28.z.object({
3720
- type: import_zod28.z.literal(ActionType.READ).default(ActionType.READ)
3912
+ import_zod29.z.object({
3913
+ type: import_zod29.z.literal(ActionType.READ).default(ActionType.READ)
3721
3914
  })
3722
3915
  );
3723
- var DeleteActionInput = import_zod28.z.object({ eventId: import_zod28.z.string() });
3724
- var ActionInput = import_zod28.z.discriminatedUnion("type", [
3916
+ var DeleteActionInput = import_zod29.z.object({ eventId: UUID });
3917
+ var ActionInput = import_zod29.z.discriminatedUnion("type", [
3725
3918
  CreateActionInput.openapi({ ref: "CreateActionInput" }),
3726
3919
  ValidateActionInput.openapi({ ref: "ValidateActionInput" }),
3727
3920
  RegisterActionInput.openapi({ ref: "RegisterActionInput" }),
@@ -3750,18 +3943,18 @@ var ActionInput = import_zod28.z.discriminatedUnion("type", [
3750
3943
  });
3751
3944
 
3752
3945
  // ../commons/src/events/Draft.ts
3753
- var Draft = import_zod29.z.object({
3754
- id: import_zod29.z.string(),
3755
- eventId: import_zod29.z.string(),
3756
- transactionId: import_zod29.z.string(),
3757
- createdAt: import_zod29.z.string().datetime(),
3946
+ var Draft = import_zod30.z.object({
3947
+ id: UUID,
3948
+ eventId: UUID,
3949
+ transactionId: import_zod30.z.string(),
3950
+ createdAt: import_zod30.z.string().datetime(),
3758
3951
  action: ActionBase.extend({
3759
3952
  type: ActionTypes
3760
3953
  }).omit({ id: true })
3761
3954
  });
3762
3955
  var DraftInput = BaseActionInput.extend({
3763
3956
  type: ActionTypes,
3764
- status: import_zod29.z.enum([
3957
+ status: import_zod30.z.enum([
3765
3958
  ActionStatus.Requested,
3766
3959
  ActionStatus.Accepted,
3767
3960
  ActionStatus.Rejected
@@ -3769,27 +3962,28 @@ var DraftInput = BaseActionInput.extend({
3769
3962
  });
3770
3963
 
3771
3964
  // ../commons/src/events/EventInput.ts
3772
- var import_zod30 = require("zod");
3773
- var import_uuid4 = require("uuid");
3774
- var EventInput = import_zod30.z.object({
3775
- transactionId: import_zod30.z.string(),
3776
- type: import_zod30.z.string()
3777
- }).openapi({ default: { transactionId: (0, import_uuid4.v4)(), type: "v2.birth" } });
3965
+ var import_zod31 = require("zod");
3966
+ var import_uuid8 = require("uuid");
3967
+ var EventInput = import_zod31.z.object({
3968
+ transactionId: import_zod31.z.string(),
3969
+ type: import_zod31.z.string()
3970
+ }).openapi({ default: { transactionId: (0, import_uuid8.v4)(), type: "v2.birth" } });
3778
3971
 
3779
3972
  // ../commons/src/events/EventDocument.ts
3780
- var import_zod31 = require("zod");
3781
- var import_zod_openapi11 = require("zod-openapi");
3782
- (0, import_zod_openapi11.extendZodWithOpenApi)(import_zod31.z);
3783
- var EventDocument = import_zod31.z.object({
3784
- id: import_zod31.z.string(),
3785
- type: import_zod31.z.string(),
3786
- createdAt: import_zod31.z.string().datetime(),
3787
- updatedAt: import_zod31.z.string().datetime(),
3788
- actions: import_zod31.z.array(Action),
3789
- trackingId: import_zod31.z.string()
3973
+ var import_zod32 = require("zod");
3974
+ var import_zod_openapi12 = require("zod-openapi");
3975
+ (0, import_zod_openapi12.extendZodWithOpenApi)(import_zod32.z);
3976
+ var EventDocument = import_zod32.z.object({
3977
+ id: UUID,
3978
+ type: import_zod32.z.string(),
3979
+ createdAt: import_zod32.z.string().datetime(),
3980
+ updatedAt: import_zod32.z.string().datetime(),
3981
+ actions: import_zod32.z.array(Action),
3982
+ trackingId: import_zod32.z.string()
3790
3983
  }).openapi({ ref: "EventDocument" });
3791
3984
 
3792
3985
  // ../commons/src/events/state/utils.ts
3986
+ var import_lodash2 = require("lodash");
3793
3987
  function getActionRequests(actionType, actions) {
3794
3988
  const filtered = actions.filter((action) => action.type === actionType);
3795
3989
  const accept = filtered.find(
@@ -3828,29 +4022,38 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
3828
4022
  registrationNumber
3829
4023
  };
3830
4024
  }
4025
+ var updateActions = ActionTypes.extract([
4026
+ ActionType.CREATE,
4027
+ ActionType.NOTIFY,
4028
+ ActionType.DECLARE,
4029
+ ActionType.VALIDATE,
4030
+ ActionType.REGISTER,
4031
+ ActionType.REJECT,
4032
+ ActionType.ARCHIVE,
4033
+ ActionType.PRINT_CERTIFICATE,
4034
+ ActionType.REQUEST_CORRECTION
4035
+ ]);
3831
4036
  function getActionUpdateMetadata(actions) {
3832
4037
  const createAction = getOrThrow(
3833
4038
  actions.find((action) => action.type === ActionType.CREATE),
3834
4039
  `Event has no ${ActionType.CREATE} action`
3835
4040
  );
3836
- return StatusChangingActions.options.reduce(
3837
- (metadata, actionType) => {
3838
- const { accept, request } = getActionRequests(actionType, actions);
3839
- return {
3840
- createdAt: request?.createdAt ?? accept?.createdAt ?? metadata.createdAt,
3841
- createdBy: request?.createdBy ?? accept?.createdBy ?? metadata.createdBy,
3842
- createdByUserType: request?.createdByUserType ?? accept?.createdByUserType ?? metadata.createdByUserType,
3843
- createdAtLocation: request?.createdAtLocation ?? accept?.createdAtLocation ?? metadata.createdAtLocation,
3844
- createdByRole: request?.createdByRole ?? accept?.createdByRole ?? metadata.createdByRole
3845
- };
4041
+ const metadataFields = [
4042
+ "createdAt",
4043
+ "createdBy",
4044
+ "createdByUserType",
4045
+ "createdAtLocation",
4046
+ "createdByRole"
4047
+ ];
4048
+ return actions.filter(({ type }) => updateActions.safeParse(type).success).filter(({ status }) => status === ActionStatus.Accepted).reduce(
4049
+ (_, action) => {
4050
+ if (action.originalActionId) {
4051
+ const originalAction = actions.find(({ id }) => id === action.originalActionId) ?? action;
4052
+ return (0, import_lodash2.pick)(originalAction, metadataFields);
4053
+ }
4054
+ return (0, import_lodash2.pick)(action, metadataFields);
3846
4055
  },
3847
- {
3848
- createdAt: createAction.createdAt,
3849
- createdBy: createAction.createdBy,
3850
- createdByUserType: createAction.createdByUserType,
3851
- createdAtLocation: createAction.createdAtLocation,
3852
- createdByRole: createAction.createdByRole
3853
- }
4056
+ (0, import_lodash2.pick)(createAction, metadataFields)
3854
4057
  );
3855
4058
  }
3856
4059
  function getLegalStatuses(actions) {
@@ -3866,15 +4069,69 @@ function getLegalStatuses(actions) {
3866
4069
  };
3867
4070
  }
3868
4071
 
3869
- // ../commons/src/events/state/index.ts
3870
- function getStatusFromActions(actions) {
3871
- const hasRejectedAction = actions.some(
3872
- (a) => a.status === ActionStatus.Rejected
4072
+ // ../commons/src/events/state/flags.ts
4073
+ function isCertificatePrinted(actions) {
4074
+ return actions.reduce((prev, { type }) => {
4075
+ if (type === ActionType.PRINT_CERTIFICATE) {
4076
+ return true;
4077
+ }
4078
+ if (type === ActionType.APPROVE_CORRECTION) {
4079
+ return false;
4080
+ }
4081
+ return prev;
4082
+ }, false);
4083
+ }
4084
+ function isCorrectionRequested(actions) {
4085
+ return actions.reduce((prev, { type }) => {
4086
+ if (type === ActionType.REQUEST_CORRECTION) {
4087
+ return true;
4088
+ }
4089
+ if (type === ActionType.APPROVE_CORRECTION) {
4090
+ return false;
4091
+ }
4092
+ if (type === ActionType.REJECT_CORRECTION) {
4093
+ return false;
4094
+ }
4095
+ return prev;
4096
+ }, false);
4097
+ }
4098
+ function isDeclarationIncomplete(actions) {
4099
+ return getStatusFromActions(actions) === EventStatus.enum.NOTIFIED;
4100
+ }
4101
+ function isRejected(actions) {
4102
+ return actions.at(-1)?.type === ActionType.REJECT;
4103
+ }
4104
+ function getFlagsFromActions(actions) {
4105
+ const sortedActions = actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
4106
+ const actionStatus = sortedActions.reduce(
4107
+ (actionStatuses, { type, status }) => ({
4108
+ ...actionStatuses,
4109
+ [type]: status
4110
+ }),
4111
+ {}
3873
4112
  );
3874
- if (hasRejectedAction) {
3875
- return EventStatus.enum.REJECTED;
4113
+ const flags = Object.entries(actionStatus).filter(([, status]) => status !== ActionStatus.Accepted).map(([type, status]) => {
4114
+ const flag = joinValues([type, status], ":").toLowerCase();
4115
+ return flag;
4116
+ });
4117
+ if (isCertificatePrinted(sortedActions)) {
4118
+ flags.push(InherentFlags.PRINTED);
4119
+ }
4120
+ if (isCorrectionRequested(sortedActions)) {
4121
+ flags.push(InherentFlags.CORRECTION_REQUESTED);
4122
+ }
4123
+ if (isDeclarationIncomplete(sortedActions)) {
4124
+ flags.push(InherentFlags.INCOMPLETE);
4125
+ }
4126
+ if (isRejected(sortedActions)) {
4127
+ flags.push(InherentFlags.REJECTED);
3876
4128
  }
3877
- return actions.reduce((status, action) => {
4129
+ return flags;
4130
+ }
4131
+
4132
+ // ../commons/src/events/state/index.ts
4133
+ function getStatusFromActions(actions) {
4134
+ return actions.filter(({ status }) => status === ActionStatus.Accepted).reduce((status, action) => {
3878
4135
  switch (action.type) {
3879
4136
  case ActionType.CREATE:
3880
4137
  return EventStatus.enum.CREATED;
@@ -3884,8 +4141,6 @@ function getStatusFromActions(actions) {
3884
4141
  return EventStatus.enum.VALIDATED;
3885
4142
  case ActionType.REGISTER:
3886
4143
  return EventStatus.enum.REGISTERED;
3887
- case ActionType.REJECT:
3888
- return EventStatus.enum.REJECTED;
3889
4144
  case ActionType.ARCHIVE:
3890
4145
  return EventStatus.enum.ARCHIVED;
3891
4146
  case ActionType.NOTIFY:
@@ -3894,6 +4149,7 @@ function getStatusFromActions(actions) {
3894
4149
  return EventStatus.enum.CERTIFIED;
3895
4150
  case ActionType.ASSIGN:
3896
4151
  case ActionType.UNASSIGN:
4152
+ case ActionType.REJECT:
3897
4153
  case ActionType.REQUEST_CORRECTION:
3898
4154
  case ActionType.APPROVE_CORRECTION:
3899
4155
  case ActionType.MARKED_AS_DUPLICATE:
@@ -3904,38 +4160,6 @@ function getStatusFromActions(actions) {
3904
4160
  }
3905
4161
  }, EventStatus.enum.CREATED);
3906
4162
  }
3907
- function getFlagsFromActions(actions) {
3908
- const sortedactions = actions.sort(
3909
- (a, b) => a.createdAt.localeCompare(b.createdAt)
3910
- );
3911
- const actionStatus = sortedactions.reduce(
3912
- (actionStatuses, { type, status }) => ({
3913
- ...actionStatuses,
3914
- [type]: status
3915
- }),
3916
- {}
3917
- );
3918
- const flags = Object.entries(actionStatus).filter(([, status]) => status !== ActionStatus.Accepted).map(([type, status]) => {
3919
- const flag = `${type.toLowerCase()}:${status.toLowerCase()}`;
3920
- return flag;
3921
- });
3922
- const isCertificatePrinted = sortedactions.reduce(
3923
- (prev, { type }) => {
3924
- if (type === ActionType.PRINT_CERTIFICATE) {
3925
- return true;
3926
- }
3927
- if (type === ActionType.APPROVE_CORRECTION) {
3928
- return false;
3929
- }
3930
- return prev;
3931
- },
3932
- false
3933
- );
3934
- if (isCertificatePrinted) {
3935
- flags.push(CustomFlags.CERTIFICATE_PRINTED);
3936
- }
3937
- return flags;
3938
- }
3939
4163
  function getAssignedUserFromActions(actions) {
3940
4164
  return actions.reduce((user2, action) => {
3941
4165
  if (action.type === ActionType.ASSIGN) {
@@ -3961,7 +4185,8 @@ function getAssignedUserSignatureFromActions(actions) {
3961
4185
  function aggregateActionDeclarations(actions) {
3962
4186
  const excludedActions = [
3963
4187
  ActionType.REQUEST_CORRECTION,
3964
- ActionType.PRINT_CERTIFICATE
4188
+ ActionType.PRINT_CERTIFICATE,
4189
+ ActionType.REJECT_CORRECTION
3965
4190
  ];
3966
4191
  return actions.reduce((declaration, action) => {
3967
4192
  if (excludedActions.some((excludedAction) => excludedAction === action.type)) {
@@ -4002,6 +4227,13 @@ function getAcceptedActions(event2) {
4002
4227
  );
4003
4228
  }
4004
4229
  var DEFAULT_DATE_OF_EVENT_PROPERTY = "createdAt";
4230
+ function resolveDateOfEvent(eventMetadata, declaration, config) {
4231
+ if (!config.dateOfEvent) {
4232
+ return eventMetadata[DEFAULT_DATE_OF_EVENT_PROPERTY].split("T")[0];
4233
+ }
4234
+ const parsedDate = ZodDate.safeParse(declaration[config.dateOfEvent.$$field]);
4235
+ return parsedDate.success ? parsedDate.data : void 0;
4236
+ }
4005
4237
  function getCurrentEventState(event2, config) {
4006
4238
  const creationAction = event2.actions.find(
4007
4239
  (action) => action.type === ActionType.CREATE
@@ -4015,17 +4247,6 @@ function getCurrentEventState(event2, config) {
4015
4247
  const requestActionMetadata = getActionUpdateMetadata(event2.actions);
4016
4248
  const acceptedActionMetadata = getActionUpdateMetadata(acceptedActions);
4017
4249
  const declaration = aggregateActionDeclarations(acceptedActions);
4018
- let dateOfEvent;
4019
- if (config.dateOfEvent) {
4020
- const parsedDate = ZodDate.safeParse(
4021
- declaration[config.dateOfEvent.$$field]
4022
- );
4023
- if (parsedDate.success) {
4024
- dateOfEvent = parsedDate.data;
4025
- }
4026
- } else {
4027
- dateOfEvent = event2[DEFAULT_DATE_OF_EVENT_PROPERTY].split("T")[0];
4028
- }
4029
4250
  return deepDropNulls({
4030
4251
  id: event2.id,
4031
4252
  type: event2.type,
@@ -4044,7 +4265,7 @@ function getCurrentEventState(event2, config) {
4044
4265
  declaration,
4045
4266
  trackingId: event2.trackingId,
4046
4267
  updatedByUserRole: requestActionMetadata.createdByRole,
4047
- dateOfEvent,
4268
+ dateOfEvent: resolveDateOfEvent(event2, declaration, config),
4048
4269
  flags: getFlagsFromActions(event2.actions)
4049
4270
  });
4050
4271
  }
@@ -4073,19 +4294,32 @@ function getCurrentEventStateWithDrafts({
4073
4294
  };
4074
4295
  return getCurrentEventState(withDrafts, configuration);
4075
4296
  }
4076
- function applyDraftsToEventIndex(eventIndex, drafts) {
4297
+ function applyDeclarationToEventIndex(eventIndex, declaration, eventConfiguration) {
4298
+ const updatedDeclaration = deepMerge(eventIndex.declaration, declaration);
4299
+ return {
4300
+ ...eventIndex,
4301
+ dateOfEvent: resolveDateOfEvent(
4302
+ eventIndex,
4303
+ updatedDeclaration,
4304
+ eventConfiguration
4305
+ ),
4306
+ declaration: updatedDeclaration
4307
+ };
4308
+ }
4309
+ function applyDraftsToEventIndex(eventIndex, drafts, eventConfiguration) {
4077
4310
  const indexedAt = eventIndex.updatedAt;
4078
4311
  const activeDrafts = drafts.filter(({ createdAt }) => new Date(createdAt) > new Date(indexedAt)).map((draft) => draft.action).sort();
4079
4312
  if (activeDrafts.length === 0) {
4080
4313
  return eventIndex;
4081
4314
  }
4082
- return {
4083
- ...eventIndex,
4084
- declaration: {
4085
- ...eventIndex.declaration,
4086
- ...activeDrafts[activeDrafts.length - 1].declaration
4087
- }
4088
- };
4315
+ return applyDeclarationToEventIndex(
4316
+ {
4317
+ ...eventIndex,
4318
+ updatedAt: activeDrafts[activeDrafts.length - 1].createdAt
4319
+ },
4320
+ activeDrafts[activeDrafts.length - 1].declaration,
4321
+ eventConfiguration
4322
+ );
4089
4323
  }
4090
4324
  function getAnnotationFromDrafts(drafts) {
4091
4325
  const actions = drafts.map((draft) => draft.action);
@@ -4126,23 +4360,24 @@ function generateTransactionId() {
4126
4360
  }
4127
4361
 
4128
4362
  // ../commons/src/events/User.ts
4129
- var import_zod32 = require("zod");
4130
- var User = import_zod32.z.object({
4131
- id: import_zod32.z.string(),
4132
- name: import_zod32.z.array(
4133
- import_zod32.z.object({
4134
- use: import_zod32.z.string(),
4135
- given: import_zod32.z.array(import_zod32.z.string()),
4136
- family: import_zod32.z.string()
4363
+ var import_zod33 = require("zod");
4364
+ var User = import_zod33.z.object({
4365
+ id: import_zod33.z.string(),
4366
+ name: import_zod33.z.array(
4367
+ import_zod33.z.object({
4368
+ use: import_zod33.z.string(),
4369
+ given: import_zod33.z.array(import_zod33.z.string()),
4370
+ family: import_zod33.z.string()
4137
4371
  })
4138
4372
  ),
4139
- role: import_zod32.z.string(),
4140
- signatureFilename: import_zod32.z.string().optional()
4373
+ role: import_zod33.z.string(),
4374
+ avatar: FullDocumentPath.optional(),
4375
+ signature: FullDocumentPath.optional()
4141
4376
  });
4142
4377
 
4143
4378
  // ../commons/src/events/test.utils.ts
4144
- var import_lodash2 = require("lodash");
4145
- var import_addDays = __toESM(require("date-fns/addDays"));
4379
+ var import_lodash3 = require("lodash");
4380
+ var import_date_fns4 = require("date-fns");
4146
4381
 
4147
4382
  // ../commons/src/field-config/field-configuration.ts
4148
4383
  function createFieldConfig(fieldId, options) {
@@ -4163,7 +4398,7 @@ function field(fieldId, options = {}) {
4163
4398
  }
4164
4399
 
4165
4400
  // ../commons/src/fixtures/forms.ts
4166
- var import_date_fns2 = require("date-fns");
4401
+ var import_date_fns3 = require("date-fns");
4167
4402
  var PRINT_CERTIFICATE_FORM = defineActionForm({
4168
4403
  label: {
4169
4404
  id: "v2.event.tennis-club-membership.action.certificate.form.label",
@@ -4822,7 +5057,7 @@ var PRINT_CERTIFICATE_FORM = defineActionForm({
4822
5057
  var TENNIS_CLUB_DECLARATION_REVIEW = {
4823
5058
  title: {
4824
5059
  id: "v2.event.tennis-club-membership.action.declare.form.review.title",
4825
- defaultMessage: "{applicant.name.firstname, select, __EMPTY__ {Member declaration} other {{applicant.name.surname, select, __EMPTY__ {Member declaration} other {Member declaration for {applicant.name.firstname} {applicant.name.surname}}}}}",
5060
+ defaultMessage: "{applicant.name.firstname, select, __EMPTY__ {Member declaration} other {{applicant.name.surname, select, __EMPTY__ {Member declaration for {applicant.name.firstname}} other {Member declaration for {applicant.name.firstname} {applicant.name.surname}}}}}",
4826
5061
  description: "Title of the review page"
4827
5062
  },
4828
5063
  fields: [
@@ -4882,6 +5117,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
4882
5117
  id: "applicant.email",
4883
5118
  type: "EMAIL",
4884
5119
  required: false,
5120
+ uncorrectable: true,
4885
5121
  conditionals: [],
4886
5122
  label: {
4887
5123
  defaultMessage: "Applicant's email",
@@ -4961,6 +5197,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
4961
5197
  id: "applicant.address",
4962
5198
  type: "ADDRESS",
4963
5199
  required: true,
5200
+ secured: true,
4964
5201
  conditionals: [],
4965
5202
  label: {
4966
5203
  defaultMessage: "Applicant's address",
@@ -5105,7 +5342,7 @@ var statusOptions = [
5105
5342
  }
5106
5343
  },
5107
5344
  {
5108
- value: EventStatus.enum.REJECTED,
5345
+ value: VisibleStatus.enum.REJECTED,
5109
5346
  label: {
5110
5347
  defaultMessage: "Rejected",
5111
5348
  description: "Option for form field: status of record",
@@ -5128,7 +5365,7 @@ var timePeriodOptions = [
5128
5365
  description: "Label for option of time period select: last 7 days",
5129
5366
  id: "form.section.label.timePeriodLast7Days"
5130
5367
  },
5131
- value: `${(0, import_date_fns2.format)((0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 7), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
5368
+ value: `${(0, import_date_fns3.format)((0, import_date_fns3.subDays)(/* @__PURE__ */ new Date(), 7), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
5132
5369
  /* @__PURE__ */ new Date(),
5133
5370
  "yyyy-MM-dd"
5134
5371
  )}`
@@ -5139,7 +5376,7 @@ var timePeriodOptions = [
5139
5376
  description: "Label for option of time period select: last 30 days",
5140
5377
  id: "form.section.label.timePeriodLast30Days"
5141
5378
  },
5142
- value: `${(0, import_date_fns2.format)((0, import_date_fns2.subMonths)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
5379
+ value: `${(0, import_date_fns3.format)((0, import_date_fns3.subMonths)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
5143
5380
  /* @__PURE__ */ new Date(),
5144
5381
  "yyyy-MM-dd"
5145
5382
  )}`
@@ -5150,7 +5387,7 @@ var timePeriodOptions = [
5150
5387
  description: "Label for option of time period select: last 90 days",
5151
5388
  id: "form.section.label.timePeriodLast90Days"
5152
5389
  },
5153
- value: `${(0, import_date_fns2.format)((0, import_date_fns2.subQuarters)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
5390
+ value: `${(0, import_date_fns3.format)((0, import_date_fns3.subQuarters)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
5154
5391
  /* @__PURE__ */ new Date(),
5155
5392
  "yyyy-MM-dd"
5156
5393
  )}`
@@ -5161,7 +5398,7 @@ var timePeriodOptions = [
5161
5398
  description: "Label for option of time period select: last year",
5162
5399
  id: "form.section.label.timePeriodLastYear"
5163
5400
  },
5164
- value: `${(0, import_date_fns2.format)((0, import_date_fns2.subYears)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
5401
+ value: `${(0, import_date_fns3.format)((0, import_date_fns3.subYears)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
5165
5402
  /* @__PURE__ */ new Date(),
5166
5403
  "yyyy-MM-dd"
5167
5404
  )}`
@@ -5245,197 +5482,202 @@ var tennisClubMembershipEvent = defineConfig({
5245
5482
  description: "This is shown as the action name anywhere the user can trigger the action from",
5246
5483
  id: "event.tennis-club-membership.action.correction.request.label"
5247
5484
  },
5248
- onboardingForm: [
5249
- {
5250
- id: "correction-requester",
5251
- type: PageTypes.enum.FORM,
5252
- title: {
5253
- id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
5254
- defaultMessage: "Correction requester",
5255
- description: "This is the title of the section"
5256
- },
5257
- fields: [
5258
- {
5259
- id: "correction.requester.relationshop.intro",
5260
- type: "PAGE_HEADER",
5261
- label: {
5262
- id: "correction.requester.relationshop.intro.label",
5263
- 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.",
5264
- description: "The title for the corrector form"
5265
- }
5485
+ correctionForm: {
5486
+ label: {
5487
+ id: "v2.event.tennis-club-membership.action.request-correction.label",
5488
+ defaultMessage: "Request correction",
5489
+ description: "This is shown as the action name anywhere the user can trigger the action from"
5490
+ },
5491
+ pages: [
5492
+ {
5493
+ id: "correction-requester",
5494
+ type: PageTypes.enum.FORM,
5495
+ title: {
5496
+ id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
5497
+ defaultMessage: "Correction requester",
5498
+ description: "This is the title of the section"
5266
5499
  },
5267
- {
5268
- id: "correction.requester.relationship",
5269
- type: "RADIO_GROUP",
5270
- label: {
5271
- id: "v2.correction.corrector.title",
5272
- defaultMessage: "Who is requesting a change to this record?",
5273
- description: "The title for the corrector form"
5500
+ fields: [
5501
+ {
5502
+ id: "correction.requester.relationshop.intro",
5503
+ type: "PAGE_HEADER",
5504
+ label: {
5505
+ id: "correction.requester.relationshop.intro.label",
5506
+ 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.",
5507
+ description: "The title for the corrector form"
5508
+ }
5274
5509
  },
5275
- defaultValue: "",
5276
- options: [
5277
- {
5278
- value: "INFORMANT",
5279
- label: {
5280
- id: "v2.correction.corrector.informant",
5281
- defaultMessage: "Informant",
5282
- description: "Label for informant option in certificate correction form"
5283
- }
5284
- },
5285
- {
5286
- value: "ANOTHER_AGENT",
5287
- label: {
5288
- id: "v2.correction.corrector.anotherAgent",
5289
- defaultMessage: "Another registration agent or field agent",
5290
- description: "Label for another registration or field agent option in certificate correction form"
5291
- }
5292
- },
5293
- {
5294
- value: "REGISTRAR",
5295
- label: {
5296
- id: "v2.correction.corrector.me",
5297
- defaultMessage: "Me (Registrar)",
5298
- description: "Label for registrar option in certificate correction form"
5299
- }
5510
+ {
5511
+ id: "correction.requester.relationship",
5512
+ type: "RADIO_GROUP",
5513
+ label: {
5514
+ id: "v2.correction.corrector.title",
5515
+ defaultMessage: "Who is requesting a change to this record?",
5516
+ description: "The title for the corrector form"
5300
5517
  },
5301
- {
5302
- value: "OTHER",
5303
- label: {
5304
- id: "v2.correction.corrector.others",
5305
- defaultMessage: "Someone else",
5306
- description: "Label for someone else option in certificate correction form"
5518
+ defaultValue: "",
5519
+ options: [
5520
+ {
5521
+ value: "INFORMANT",
5522
+ label: {
5523
+ id: "v2.correction.corrector.informant",
5524
+ defaultMessage: "Informant",
5525
+ description: "Label for informant option in certificate correction form"
5526
+ }
5527
+ },
5528
+ {
5529
+ value: "ANOTHER_AGENT",
5530
+ label: {
5531
+ id: "v2.correction.corrector.anotherAgent",
5532
+ defaultMessage: "Another registration agent or field agent",
5533
+ description: "Label for another registration or field agent option in certificate correction form"
5534
+ }
5535
+ },
5536
+ {
5537
+ value: "REGISTRAR",
5538
+ label: {
5539
+ id: "v2.correction.corrector.me",
5540
+ defaultMessage: "Me (Registrar)",
5541
+ description: "Label for registrar option in certificate correction form"
5542
+ }
5543
+ },
5544
+ {
5545
+ value: "OTHER",
5546
+ label: {
5547
+ id: "v2.correction.corrector.others",
5548
+ defaultMessage: "Someone else",
5549
+ description: "Label for someone else option in certificate correction form"
5550
+ }
5307
5551
  }
5308
- }
5309
- ]
5310
- }
5311
- ]
5312
- },
5313
- {
5314
- id: "identity-check",
5315
- type: PageTypes.enum.FORM,
5316
- title: {
5317
- id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
5318
- defaultMessage: "Verify their identity",
5319
- description: "This is the title of the section"
5320
- },
5321
- fields: [
5322
- {
5323
- id: "correction.identity-check.instructions",
5324
- type: "PAGE_HEADER",
5325
- label: {
5326
- id: "correction.corrector.identity.instruction",
5327
- defaultMessage: "Please verify the identity of the person making this request",
5328
- description: "The title for the corrector form"
5552
+ ]
5329
5553
  }
5554
+ ]
5555
+ },
5556
+ {
5557
+ id: "identity-check",
5558
+ type: PageTypes.enum.FORM,
5559
+ title: {
5560
+ id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
5561
+ defaultMessage: "Verify their identity",
5562
+ description: "This is the title of the section"
5330
5563
  },
5331
- {
5332
- id: "correction.identity-check.verified",
5333
- type: "RADIO_GROUP",
5334
- label: {
5335
- id: "correction.corrector.identity.verified.label",
5336
- defaultMessage: "Identity verified",
5337
- description: "The title for the corrector form"
5564
+ fields: [
5565
+ {
5566
+ id: "correction.identity-check.instructions",
5567
+ type: "PAGE_HEADER",
5568
+ label: {
5569
+ id: "correction.corrector.identity.instruction",
5570
+ defaultMessage: "Please verify the identity of the person making this request",
5571
+ description: "The title for the corrector form"
5572
+ }
5338
5573
  },
5339
- defaultValue: "",
5340
- required: true,
5341
- options: [
5342
- {
5343
- value: "VERIFIED",
5344
- label: {
5345
- id: "correction.corrector.identity.verified",
5346
- defaultMessage: "I have verified their identity",
5347
- description: "Label for verified option in corrector identity check page"
5574
+ {
5575
+ id: "correction.identity-check.verified",
5576
+ type: "RADIO_GROUP",
5577
+ label: {
5578
+ id: "correction.corrector.identity.verified.label",
5579
+ defaultMessage: "Identity verified",
5580
+ description: "The title for the corrector form"
5581
+ },
5582
+ defaultValue: "",
5583
+ required: true,
5584
+ options: [
5585
+ {
5586
+ value: "VERIFIED",
5587
+ label: {
5588
+ id: "correction.corrector.identity.verified",
5589
+ defaultMessage: "I have verified their identity",
5590
+ description: "Label for verified option in corrector identity check page"
5591
+ }
5348
5592
  }
5349
- }
5350
- ]
5351
- }
5352
- ]
5353
- }
5354
- ],
5355
- additionalDetailsForm: [
5356
- {
5357
- id: "correction-request.supporting-documents",
5358
- type: PageTypes.enum.FORM,
5359
- title: {
5360
- id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
5361
- defaultMessage: "Upload supporting documents",
5362
- description: "This is the title of the section"
5363
- },
5364
- fields: [
5365
- {
5366
- id: "correction.supportingDocs.introduction",
5367
- type: "PAGE_HEADER",
5368
- label: {
5369
- id: "correction.corrector.paragraph.title",
5370
- 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.",
5371
- description: "The title for the corrector form"
5372
- }
5373
- },
5374
- {
5375
- id: "correction.supportingDocs",
5376
- type: FieldType.FILE,
5377
- label: {
5378
- id: "correction.corrector.title",
5379
- defaultMessage: "Upload supporting documents",
5380
- description: "The title for the corrector form"
5593
+ ]
5381
5594
  }
5595
+ ]
5596
+ },
5597
+ {
5598
+ id: "correction-request.supporting-documents",
5599
+ type: PageTypes.enum.FORM,
5600
+ title: {
5601
+ id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
5602
+ defaultMessage: "Upload supporting documents",
5603
+ description: "This is the title of the section"
5382
5604
  },
5383
- {
5384
- id: "correction.request.supportingDocuments",
5385
- type: "RADIO_GROUP",
5386
- label: {
5387
- id: "correction.corrector.title",
5388
- defaultMessage: "Who is requesting a change to this record?",
5389
- description: "The title for the corrector form"
5605
+ fields: [
5606
+ {
5607
+ id: "correction.supportingDocs.introduction",
5608
+ type: "PAGE_HEADER",
5609
+ label: {
5610
+ id: "correction.corrector.paragraph.title",
5611
+ 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.",
5612
+ description: "The title for the corrector form"
5613
+ }
5390
5614
  },
5391
- defaultValue: "",
5392
- configuration: {
5393
- styles: {
5394
- size: "NORMAL"
5615
+ {
5616
+ id: "correction.supportingDocs",
5617
+ type: FieldType.FILE,
5618
+ label: {
5619
+ id: "correction.corrector.title",
5620
+ defaultMessage: "Upload supporting documents",
5621
+ description: "The title for the corrector form"
5395
5622
  }
5396
5623
  },
5397
- options: [
5398
- {
5399
- value: "ATTEST",
5400
- label: {
5401
- id: "correction.supportingDocuments.attest.label",
5402
- defaultMessage: "I attest to seeing supporting documentation and have a copy filed at my office",
5403
- description: ""
5624
+ {
5625
+ id: "correction.request.supportingDocuments",
5626
+ type: "RADIO_GROUP",
5627
+ label: {
5628
+ id: "correction.corrector.title",
5629
+ defaultMessage: "Who is requesting a change to this record?",
5630
+ description: "The title for the corrector form"
5631
+ },
5632
+ defaultValue: "",
5633
+ configuration: {
5634
+ styles: {
5635
+ size: "NORMAL"
5404
5636
  }
5405
5637
  },
5406
- {
5407
- value: "NOT_NEEDED",
5408
- label: {
5409
- id: "correction.supportingDocuments.notNeeded.label",
5410
- defaultMessage: "No supporting documents required",
5411
- description: ""
5638
+ options: [
5639
+ {
5640
+ value: "ATTEST",
5641
+ label: {
5642
+ id: "correction.supportingDocuments.attest.label",
5643
+ defaultMessage: "I attest to seeing supporting documentation and have a copy filed at my office",
5644
+ description: ""
5645
+ }
5646
+ },
5647
+ {
5648
+ value: "NOT_NEEDED",
5649
+ label: {
5650
+ id: "correction.supportingDocuments.notNeeded.label",
5651
+ defaultMessage: "No supporting documents required",
5652
+ description: ""
5653
+ }
5412
5654
  }
5413
- }
5414
- ]
5415
- }
5416
- ]
5417
- },
5418
- {
5419
- id: "correction-request.additional-details",
5420
- type: PageTypes.enum.FORM,
5421
- title: {
5422
- id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
5423
- defaultMessage: "Reason for correction",
5424
- description: "This is the title of the section"
5655
+ ]
5656
+ }
5657
+ ]
5425
5658
  },
5426
- fields: [
5427
- {
5428
- id: "correction.request.reason",
5429
- type: FieldType.TEXT,
5430
- label: {
5431
- id: "correction.reason.title",
5432
- defaultMessage: "Reason for correction?",
5433
- description: "The title for the corrector form"
5659
+ {
5660
+ id: "correction-request.additional-details",
5661
+ type: PageTypes.enum.FORM,
5662
+ title: {
5663
+ id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
5664
+ defaultMessage: "Reason for correction",
5665
+ description: "This is the title of the section"
5666
+ },
5667
+ fields: [
5668
+ {
5669
+ id: "correction.request.reason",
5670
+ type: FieldType.TEXT,
5671
+ label: {
5672
+ id: "correction.reason.title",
5673
+ defaultMessage: "Reason for correction?",
5674
+ description: "The title for the corrector form"
5675
+ }
5434
5676
  }
5435
- }
5436
- ]
5437
- }
5438
- ]
5677
+ ]
5678
+ }
5679
+ ]
5680
+ }
5439
5681
  },
5440
5682
  {
5441
5683
  type: ActionType.APPROVE_CORRECTION,
@@ -5518,10 +5760,10 @@ var tennisClubMembershipEvent = defineConfig({
5518
5760
  id: "v2.advancedSearch.form.registrationDetails"
5519
5761
  },
5520
5762
  fields: [
5521
- event("legalStatus.REGISTERED.createdAtLocation").exact(),
5522
- event("legalStatus.REGISTERED.createdAt").range(),
5523
- event("status", statusOptions).exact(),
5524
- event("updatedAt", timePeriodOptions).range()
5763
+ event("legalStatuses.REGISTERED.createdAtLocation").exact(),
5764
+ event("legalStatuses.REGISTERED.acceptedAt").range(),
5765
+ event("status").exact(),
5766
+ event("updatedAt").range()
5525
5767
  ]
5526
5768
  },
5527
5769
  {
@@ -5638,197 +5880,202 @@ var footballClubMembershipEvent = defineConfig({
5638
5880
  description: "This is shown as the action name anywhere the user can trigger the action from",
5639
5881
  id: "event.football-club-membership.action.correction.request.label"
5640
5882
  },
5641
- onboardingForm: [
5642
- {
5643
- id: "correction-requester",
5644
- type: PageTypes.enum.FORM,
5645
- title: {
5646
- id: "event.football-club-membership.action.requestCorrection.form.section.corrector",
5647
- defaultMessage: "Correction requester",
5648
- description: "This is the title of the section"
5649
- },
5650
- fields: [
5651
- {
5652
- id: "correction.requester.relationshop.intro",
5653
- type: "PAGE_HEADER",
5654
- label: {
5655
- id: "correction.requester.relationshop.intro.label",
5656
- 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.",
5657
- description: "The title for the corrector form"
5658
- }
5883
+ correctionForm: {
5884
+ label: {
5885
+ id: "event.football-club-membership.action.correction.request.label",
5886
+ defaultMessage: "Request correction",
5887
+ description: "This is shown as the action name anywhere the user can trigger the action from"
5888
+ },
5889
+ pages: [
5890
+ {
5891
+ id: "correction-requester",
5892
+ type: PageTypes.enum.FORM,
5893
+ title: {
5894
+ id: "event.football-club-membership.action.requestCorrection.form.section.corrector",
5895
+ defaultMessage: "Correction requester",
5896
+ description: "This is the title of the section"
5659
5897
  },
5660
- {
5661
- id: "correction.requester.relationship",
5662
- type: "RADIO_GROUP",
5663
- label: {
5664
- id: "v2.correction.corrector.title",
5665
- defaultMessage: "Who is requesting a change to this record?",
5666
- description: "The title for the corrector form"
5898
+ fields: [
5899
+ {
5900
+ id: "correction.requester.relationshop.intro",
5901
+ type: "PAGE_HEADER",
5902
+ label: {
5903
+ id: "correction.requester.relationshop.intro.label",
5904
+ 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.",
5905
+ description: "The title for the corrector form"
5906
+ }
5667
5907
  },
5668
- defaultValue: "",
5669
- options: [
5670
- {
5671
- value: "INFORMANT",
5672
- label: {
5673
- id: "v2.correction.corrector.informant",
5674
- defaultMessage: "Informant",
5675
- description: "Label for informant option in certificate correction form"
5676
- }
5677
- },
5678
- {
5679
- value: "ANOTHER_AGENT",
5680
- label: {
5681
- id: "v2.correction.corrector.anotherAgent",
5682
- defaultMessage: "Another registration agent or field agent",
5683
- description: "Label for another registration or field agent option in certificate correction form"
5684
- }
5685
- },
5686
- {
5687
- value: "REGISTRAR",
5688
- label: {
5689
- id: "v2.correction.corrector.me",
5690
- defaultMessage: "Me (Registrar)",
5691
- description: "Label for registrar option in certificate correction form"
5692
- }
5908
+ {
5909
+ id: "correction.requester.relationship",
5910
+ type: "RADIO_GROUP",
5911
+ label: {
5912
+ id: "v2.correction.corrector.title",
5913
+ defaultMessage: "Who is requesting a change to this record?",
5914
+ description: "The title for the corrector form"
5693
5915
  },
5694
- {
5695
- value: "OTHER",
5696
- label: {
5697
- id: "v2.correction.corrector.others",
5698
- defaultMessage: "Someone else",
5699
- description: "Label for someone else option in certificate correction form"
5916
+ defaultValue: "",
5917
+ options: [
5918
+ {
5919
+ value: "INFORMANT",
5920
+ label: {
5921
+ id: "v2.correction.corrector.informant",
5922
+ defaultMessage: "Informant",
5923
+ description: "Label for informant option in certificate correction form"
5924
+ }
5925
+ },
5926
+ {
5927
+ value: "ANOTHER_AGENT",
5928
+ label: {
5929
+ id: "v2.correction.corrector.anotherAgent",
5930
+ defaultMessage: "Another registration agent or field agent",
5931
+ description: "Label for another registration or field agent option in certificate correction form"
5932
+ }
5933
+ },
5934
+ {
5935
+ value: "REGISTRAR",
5936
+ label: {
5937
+ id: "v2.correction.corrector.me",
5938
+ defaultMessage: "Me (Registrar)",
5939
+ description: "Label for registrar option in certificate correction form"
5940
+ }
5941
+ },
5942
+ {
5943
+ value: "OTHER",
5944
+ label: {
5945
+ id: "v2.correction.corrector.others",
5946
+ defaultMessage: "Someone else",
5947
+ description: "Label for someone else option in certificate correction form"
5948
+ }
5700
5949
  }
5701
- }
5702
- ]
5703
- }
5704
- ]
5705
- },
5706
- {
5707
- id: "identity-check",
5708
- type: PageTypes.enum.FORM,
5709
- title: {
5710
- id: "event.football-club-membership.action.requestCorrection.form.section.verify",
5711
- defaultMessage: "Verify their identity",
5712
- description: "This is the title of the section"
5713
- },
5714
- fields: [
5715
- {
5716
- id: "correction.identity-check.instructions",
5717
- type: "PAGE_HEADER",
5718
- label: {
5719
- id: "correction.corrector.identity.instruction",
5720
- defaultMessage: "Please verify the identity of the person making this request",
5721
- description: "The title for the corrector form"
5950
+ ]
5722
5951
  }
5952
+ ]
5953
+ },
5954
+ {
5955
+ id: "identity-check",
5956
+ type: PageTypes.enum.FORM,
5957
+ title: {
5958
+ id: "event.football-club-membership.action.requestCorrection.form.section.verify",
5959
+ defaultMessage: "Verify their identity",
5960
+ description: "This is the title of the section"
5723
5961
  },
5724
- {
5725
- id: "correction.identity-check.verified",
5726
- type: "RADIO_GROUP",
5727
- label: {
5728
- id: "correction.corrector.identity.verified.label",
5729
- defaultMessage: "Identity verified",
5730
- description: "The title for the corrector form"
5962
+ fields: [
5963
+ {
5964
+ id: "correction.identity-check.instructions",
5965
+ type: "PAGE_HEADER",
5966
+ label: {
5967
+ id: "correction.corrector.identity.instruction",
5968
+ defaultMessage: "Please verify the identity of the person making this request",
5969
+ description: "The title for the corrector form"
5970
+ }
5731
5971
  },
5732
- defaultValue: "",
5733
- required: true,
5734
- options: [
5735
- {
5736
- value: "VERIFIED",
5737
- label: {
5738
- id: "correction.corrector.identity.verified",
5739
- defaultMessage: "I have verified their identity",
5740
- description: "Label for verified option in corrector identity check page"
5972
+ {
5973
+ id: "correction.identity-check.verified",
5974
+ type: "RADIO_GROUP",
5975
+ label: {
5976
+ id: "correction.corrector.identity.verified.label",
5977
+ defaultMessage: "Identity verified",
5978
+ description: "The title for the corrector form"
5979
+ },
5980
+ defaultValue: "",
5981
+ required: true,
5982
+ options: [
5983
+ {
5984
+ value: "VERIFIED",
5985
+ label: {
5986
+ id: "correction.corrector.identity.verified",
5987
+ defaultMessage: "I have verified their identity",
5988
+ description: "Label for verified option in corrector identity check page"
5989
+ }
5741
5990
  }
5742
- }
5743
- ]
5744
- }
5745
- ]
5746
- }
5747
- ],
5748
- additionalDetailsForm: [
5749
- {
5750
- id: "correction-request.supporting-documents",
5751
- type: PageTypes.enum.FORM,
5752
- title: {
5753
- id: "event.football-club-membership.action.requestCorrection.form.section.verify",
5754
- defaultMessage: "Upload supporting documents",
5755
- description: "This is the title of the section"
5756
- },
5757
- fields: [
5758
- {
5759
- id: "correction.supportingDocs.introduction",
5760
- type: "PAGE_HEADER",
5761
- label: {
5762
- id: "correction.corrector.paragraph.title",
5763
- 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.",
5764
- description: "The title for the corrector form"
5765
- }
5766
- },
5767
- {
5768
- id: "correction.supportingDocs",
5769
- type: FieldType.FILE,
5770
- label: {
5771
- id: "correction.corrector.title",
5772
- defaultMessage: "Upload supporting documents",
5773
- description: "The title for the corrector form"
5991
+ ]
5774
5992
  }
5993
+ ]
5994
+ },
5995
+ {
5996
+ id: "correction-request.supporting-documents",
5997
+ type: PageTypes.enum.FORM,
5998
+ title: {
5999
+ id: "event.football-club-membership.action.requestCorrection.form.section.verify",
6000
+ defaultMessage: "Upload supporting documents",
6001
+ description: "This is the title of the section"
5775
6002
  },
5776
- {
5777
- id: "correction.request.supportingDocuments",
5778
- type: "RADIO_GROUP",
5779
- label: {
5780
- id: "correction.corrector.title",
5781
- defaultMessage: "Who is requesting a change to this record?",
5782
- description: "The title for the corrector form"
6003
+ fields: [
6004
+ {
6005
+ id: "correction.supportingDocs.introduction",
6006
+ type: "PAGE_HEADER",
6007
+ label: {
6008
+ id: "correction.corrector.paragraph.title",
6009
+ 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.",
6010
+ description: "The title for the corrector form"
6011
+ }
5783
6012
  },
5784
- defaultValue: "",
5785
- configuration: {
5786
- styles: {
5787
- size: "NORMAL"
6013
+ {
6014
+ id: "correction.supportingDocs",
6015
+ type: FieldType.FILE,
6016
+ label: {
6017
+ id: "correction.corrector.title",
6018
+ defaultMessage: "Upload supporting documents",
6019
+ description: "The title for the corrector form"
5788
6020
  }
5789
6021
  },
5790
- options: [
5791
- {
5792
- value: "ATTEST",
5793
- label: {
5794
- id: "correction.supportingDocuments.attest.label",
5795
- defaultMessage: "I attest to seeing supporting documentation and have a copy filed at my office",
5796
- description: ""
6022
+ {
6023
+ id: "correction.request.supportingDocuments",
6024
+ type: "RADIO_GROUP",
6025
+ label: {
6026
+ id: "correction.corrector.title",
6027
+ defaultMessage: "Who is requesting a change to this record?",
6028
+ description: "The title for the corrector form"
6029
+ },
6030
+ defaultValue: "",
6031
+ configuration: {
6032
+ styles: {
6033
+ size: "NORMAL"
5797
6034
  }
5798
6035
  },
5799
- {
5800
- value: "NOT_NEEDED",
5801
- label: {
5802
- id: "correction.supportingDocuments.notNeeded.label",
5803
- defaultMessage: "No supporting documents required",
5804
- description: ""
6036
+ options: [
6037
+ {
6038
+ value: "ATTEST",
6039
+ label: {
6040
+ id: "correction.supportingDocuments.attest.label",
6041
+ defaultMessage: "I attest to seeing supporting documentation and have a copy filed at my office",
6042
+ description: ""
6043
+ }
6044
+ },
6045
+ {
6046
+ value: "NOT_NEEDED",
6047
+ label: {
6048
+ id: "correction.supportingDocuments.notNeeded.label",
6049
+ defaultMessage: "No supporting documents required",
6050
+ description: ""
6051
+ }
5805
6052
  }
5806
- }
5807
- ]
5808
- }
5809
- ]
5810
- },
5811
- {
5812
- id: "correction-request.additional-details",
5813
- type: PageTypes.enum.FORM,
5814
- title: {
5815
- id: "event.football-club-membership.action.requestCorrection.form.section.corrector",
5816
- defaultMessage: "Reason for correction",
5817
- description: "This is the title of the section"
6053
+ ]
6054
+ }
6055
+ ]
5818
6056
  },
5819
- fields: [
5820
- {
5821
- id: "correction.request.reason",
5822
- type: FieldType.TEXT,
5823
- label: {
5824
- id: "correction.reason.title",
5825
- defaultMessage: "Reason for correction?",
5826
- description: "The title for the corrector form"
6057
+ {
6058
+ id: "correction-request.additional-details",
6059
+ type: PageTypes.enum.FORM,
6060
+ title: {
6061
+ id: "event.football-club-membership.action.requestCorrection.form.section.corrector",
6062
+ defaultMessage: "Reason for correction",
6063
+ description: "This is the title of the section"
6064
+ },
6065
+ fields: [
6066
+ {
6067
+ id: "correction.request.reason",
6068
+ type: FieldType.TEXT,
6069
+ label: {
6070
+ id: "correction.reason.title",
6071
+ defaultMessage: "Reason for correction?",
6072
+ description: "The title for the corrector form"
6073
+ }
5827
6074
  }
5828
- }
5829
- ]
5830
- }
5831
- ]
6075
+ ]
6076
+ }
6077
+ ]
6078
+ }
5832
6079
  },
5833
6080
  {
5834
6081
  type: ActionType.APPROVE_CORRECTION,
@@ -5911,10 +6158,10 @@ var footballClubMembershipEvent = defineConfig({
5911
6158
  id: "v2.advancedSearch.form.registrationDetails"
5912
6159
  },
5913
6160
  fields: [
5914
- event("legalStatus.REGISTERED.createdAtLocation").exact(),
5915
- event("legalStatus.REGISTERED.createdAt").range(),
5916
- event("status", statusOptions).exact(),
5917
- event("updatedAt", timePeriodOptions).range()
6161
+ event("legalStatuses.REGISTERED.createdAtLocation").exact(),
6162
+ event("legalStatuses.REGISTERED.acceptedAt").range(),
6163
+ event("status").exact(),
6164
+ event("updatedAt").range()
5918
6165
  ]
5919
6166
  },
5920
6167
  {
@@ -6127,8 +6374,9 @@ var v2BirthEvent = defineConfig({
6127
6374
  });
6128
6375
 
6129
6376
  // ../commons/src/events/test.utils.ts
6130
- var import_zod33 = require("zod");
6131
- var TestUserRole = import_zod33.z.enum([
6377
+ var import_zod34 = require("zod");
6378
+ var TEST_SYSTEM_IANA_TIMEZONE = "Asia/Dhaka";
6379
+ var TestUserRole = import_zod34.z.enum([
6132
6380
  "FIELD_AGENT",
6133
6381
  "LOCAL_REGISTRAR",
6134
6382
  "LOCAL_SYSTEM_ADMIN",
@@ -6213,14 +6461,18 @@ function mapFieldTypeToMockValue(field2, i, rng) {
6213
6461
  };
6214
6462
  case FieldType.DATE:
6215
6463
  return "2021-01-01";
6464
+ case FieldType.SELECT_DATE_RANGE:
6216
6465
  case FieldType.DATE_RANGE:
6217
- return ["2021-01-01", "2021-01-02"];
6466
+ return {
6467
+ start: "2021-01-01",
6468
+ end: "2021-01-31"
6469
+ };
6218
6470
  case FieldType.CHECKBOX:
6219
6471
  return true;
6220
6472
  case FieldType.SIGNATURE:
6221
6473
  case FieldType.FILE:
6222
6474
  return {
6223
- filename: "4f095fc4-4312-4de2-aa38-86dcc0f71044.png",
6475
+ path: "/ocrvs/4f095fc4-4312-4de2-aa38-86dcc0f71044.png",
6224
6476
  originalFilename: "abcd.png",
6225
6477
  type: "image/png"
6226
6478
  };
@@ -6283,7 +6535,11 @@ function eventPayloadGenerator(rng) {
6283
6535
  type: input.type ?? TENNIS_CLUB_MEMBERSHIP,
6284
6536
  id
6285
6537
  }),
6286
- draft: ({ eventId, actionType }, input = {}) => (0, import_lodash2.merge)(
6538
+ draft: ({
6539
+ eventId,
6540
+ actionType,
6541
+ annotation
6542
+ }, input = {}) => (0, import_lodash3.merge)(
6287
6543
  {
6288
6544
  id: getUUID(),
6289
6545
  eventId,
@@ -6299,11 +6555,16 @@ function eventPayloadGenerator(rng) {
6299
6555
  surname: "McLaren"
6300
6556
  },
6301
6557
  "applicant.dob": "2020-01-02",
6302
- "recommender.none": true
6558
+ "applicant.image": {
6559
+ path: "/ocrvs/e56d1dd3-2cd4-452a-b54e-bf3e2d830605.png",
6560
+ originalFilename: "Screenshot.png",
6561
+ type: "image/png"
6562
+ }
6303
6563
  },
6304
6564
  annotation: {
6305
6565
  "correction.requester.relationship": "ANOTHER_AGENT",
6306
- "correction.request.reason": "Child's name was incorrect"
6566
+ "correction.request.reason": "Child's name was incorrect",
6567
+ ...annotation
6307
6568
  },
6308
6569
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
6309
6570
  createdBy: "@todo",
@@ -6337,13 +6598,13 @@ function eventPayloadGenerator(rng) {
6337
6598
  notify: (eventId, input = {}) => {
6338
6599
  let declaration = input.declaration;
6339
6600
  if (!declaration) {
6340
- const partialDeclaration = (0, import_lodash2.omitBy)(
6601
+ const partialDeclaration = (0, import_lodash3.omitBy)(
6341
6602
  generateActionDeclarationInput(
6342
6603
  tennisClubMembershipEvent,
6343
6604
  ActionType.DECLARE,
6344
6605
  rng
6345
6606
  ),
6346
- import_lodash2.isString
6607
+ import_lodash3.isString
6347
6608
  );
6348
6609
  declaration = partialDeclaration;
6349
6610
  }
@@ -6446,10 +6707,13 @@ function eventPayloadGenerator(rng) {
6446
6707
  request: (eventId, input = {}) => ({
6447
6708
  type: ActionType.REQUEST_CORRECTION,
6448
6709
  transactionId: input.transactionId ?? getUUID(),
6449
- declaration: input.declaration ?? generateActionDeclarationInput(
6450
- tennisClubMembershipEvent,
6451
- ActionType.REQUEST_CORRECTION,
6452
- rng
6710
+ declaration: input.declaration ?? (0, import_lodash3.omit)(
6711
+ generateActionDeclarationInput(
6712
+ tennisClubMembershipEvent,
6713
+ ActionType.REQUEST_CORRECTION,
6714
+ rng
6715
+ ),
6716
+ ["applicant.email"]
6453
6717
  ),
6454
6718
  annotation: input.annotation ?? generateActionAnnotationInput(
6455
6719
  tennisClubMembershipEvent,
@@ -6493,17 +6757,18 @@ function generateActionDocument({
6493
6757
  configuration,
6494
6758
  action,
6495
6759
  rng = () => 0.1,
6496
- defaults = {}
6760
+ defaults = {},
6761
+ user: user2 = {}
6497
6762
  }) {
6498
6763
  const actionBase = {
6499
6764
  // Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
6500
6765
  // @TODO: This should be fixed in the future.
6501
6766
  createdAt: new Date(Date.now() - 500).toISOString(),
6502
- createdBy: getUUID(),
6767
+ createdBy: user2.id ?? getUUID(),
6503
6768
  createdByUserType: TokenUserType.Enum.user,
6504
6769
  createdByRole: TestUserRole.Enum.FIELD_AGENT,
6505
6770
  id: getUUID(),
6506
- createdAtLocation: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
6771
+ createdAtLocation: user2.primaryOfficeId ?? "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
6507
6772
  declaration: generateActionDeclarationInput(configuration, action, rng),
6508
6773
  annotation: {},
6509
6774
  status: ActionStatus.Accepted,
@@ -6518,7 +6783,7 @@ function generateActionDocument({
6518
6783
  case ActionType.DECLARE:
6519
6784
  return { ...actionBase, type: action };
6520
6785
  case ActionType.UNASSIGN:
6521
- return { ...actionBase, type: action, assignedTo: null };
6786
+ return { ...actionBase, type: action };
6522
6787
  case ActionType.ASSIGN:
6523
6788
  return { ...actionBase, assignedTo: getUUID(), type: action };
6524
6789
  case ActionType.VALIDATE:
@@ -6557,13 +6822,14 @@ function generateActionDocument({
6557
6822
  function generateEventDocument({
6558
6823
  configuration,
6559
6824
  actions,
6560
- rng = () => 0.1
6825
+ rng = () => 0.1,
6826
+ user: user2
6561
6827
  }) {
6562
6828
  return {
6563
6829
  trackingId: getUUID(),
6564
6830
  type: configuration.id,
6565
6831
  actions: actions.map(
6566
- (action) => generateActionDocument({ configuration, action, rng })
6832
+ (action) => generateActionDocument({ configuration, action, rng, user: user2 })
6567
6833
  ),
6568
6834
  // Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
6569
6835
  // @TODO: This should be fixed in the future.
@@ -6631,7 +6897,7 @@ function createPrng(seed) {
6631
6897
  return state / MODULUS;
6632
6898
  };
6633
6899
  }
6634
- function generateUuid(rng) {
6900
+ function generateUuid(rng = () => 0.1) {
6635
6901
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
6636
6902
  const r = Math.floor(rng() * 16);
6637
6903
  const v = c === "x" ? r : r & 3 | 8;
@@ -6643,6 +6909,11 @@ function generateTrackingId(rng) {
6643
6909
  const trackingId = uuid.slice(0, 6).toUpperCase();
6644
6910
  return trackingId;
6645
6911
  }
6912
+ function generateRegistrationNumber(rng) {
6913
+ const uuid = generateUuid(rng).replace(/-/g, "");
6914
+ const registrationNumber = uuid.slice(0, 12).toUpperCase();
6915
+ return registrationNumber;
6916
+ }
6646
6917
  function generateRandomSignature(rng) {
6647
6918
  return `/random-bucket/${generateUuid(rng)}.png`;
6648
6919
  }
@@ -6663,7 +6934,7 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
6663
6934
  createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
6664
6935
  updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
6665
6936
  createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
6666
- updatedAt: overrides.updatedAt ?? (0, import_addDays.default)(new Date(createdAt), 1).toISOString(),
6937
+ updatedAt: overrides.updatedAt ?? (0, import_date_fns4.addDays)(new Date(createdAt), 1).toISOString(),
6667
6938
  assignedTo: overrides.assignedTo ?? null,
6668
6939
  updatedBy: overrides.updatedBy ?? generateUuid(rng),
6669
6940
  updatedByUserRole: overrides.updatedByUserRole ?? "FIELD_AGENT",
@@ -6735,7 +7006,7 @@ function isFieldConfigDefaultValue(value) {
6735
7006
  }
6736
7007
 
6737
7008
  // ../commons/src/events/scopes.ts
6738
- var import_lodash3 = require("lodash");
7009
+ var import_lodash4 = require("lodash");
6739
7010
  var CONFIG_GET_ALLOWED_SCOPES = [
6740
7011
  SCOPES.RECORD_DECLARE,
6741
7012
  SCOPES.RECORD_READ,
@@ -6782,7 +7053,11 @@ var ACTION_ALLOWED_SCOPES = {
6782
7053
  [ActionType.REGISTER]: [SCOPES.RECORD_REGISTER],
6783
7054
  [ActionType.PRINT_CERTIFICATE]: [SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES],
6784
7055
  [ActionType.REQUEST_CORRECTION]: [
6785
- SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION
7056
+ SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION,
7057
+ SCOPES.RECORD_REGISTRATION_CORRECT
7058
+ ],
7059
+ [ExclusiveActions.REVIEW_CORRECTION_REQUEST]: [
7060
+ SCOPES.RECORD_REGISTRATION_CORRECT
6786
7061
  ],
6787
7062
  [ActionType.REJECT_CORRECTION]: [SCOPES.RECORD_REGISTRATION_CORRECT],
6788
7063
  [ActionType.APPROVE_CORRECTION]: [SCOPES.RECORD_REGISTRATION_CORRECT],
@@ -6819,19 +7094,19 @@ var WRITE_ACTION_SCOPES = [
6819
7094
  ...ACTION_ALLOWED_SCOPES[ActionType.PRINT_CERTIFICATE]
6820
7095
  ];
6821
7096
  function hasAnyOfScopes(a, b) {
6822
- return (0, import_lodash3.intersection)(a, b).length > 0;
7097
+ return (0, import_lodash4.intersection)(a, b).length > 0;
6823
7098
  }
6824
7099
 
6825
7100
  // ../commons/src/events/serializers/user/deserializer.ts
6826
- var import_zod34 = require("zod");
7101
+ var import_zod35 = require("zod");
6827
7102
  var UserWithPrimaryOffice = User.extend({
6828
- primaryOfficeId: import_zod34.z.string()
7103
+ primaryOfficeId: import_zod35.z.string()
6829
7104
  });
6830
7105
  function userDeserializer(serializedUserField, user2) {
6831
7106
  if (typeof serializedUserField === "string") {
6832
7107
  return serializedUserField;
6833
7108
  }
6834
- if (serializedUserField.$userField === "name" || serializedUserField.$userField === "signatureFilename") {
7109
+ if (serializedUserField.$userField === "name" || serializedUserField.$userField === "signature" || serializedUserField.$userField === "avatar") {
6835
7110
  throw new Error(
6836
7111
  `Deserializer for ${serializedUserField.$userField} is not implemented yet`
6837
7112
  );
@@ -6913,20 +7188,21 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
6913
7188
  ActionType.ARCHIVE,
6914
7189
  ActionType.REJECT
6915
7190
  ],
6916
- [EventStatus.enum.REJECTED]: [
6917
- ActionType.READ,
6918
- ActionType.DECLARE,
6919
- ActionType.VALIDATE
6920
- ],
6921
7191
  [EventStatus.enum.REGISTERED]: [
6922
7192
  ActionType.READ,
6923
7193
  ActionType.PRINT_CERTIFICATE,
6924
- ActionType.REQUEST_CORRECTION
7194
+ ActionType.REQUEST_CORRECTION,
7195
+ ActionType.APPROVE_CORRECTION,
7196
+ ActionType.REJECT_CORRECTION,
7197
+ ExclusiveActions.REVIEW_CORRECTION_REQUEST
6925
7198
  ],
6926
7199
  [EventStatus.enum.CERTIFIED]: [
6927
7200
  ActionType.READ,
6928
7201
  ActionType.PRINT_CERTIFICATE,
6929
- ActionType.REQUEST_CORRECTION
7202
+ ActionType.REQUEST_CORRECTION,
7203
+ ActionType.APPROVE_CORRECTION,
7204
+ ActionType.REJECT_CORRECTION,
7205
+ ExclusiveActions.REVIEW_CORRECTION_REQUEST
6930
7206
  ],
6931
7207
  [EventStatus.enum.ARCHIVED]: [
6932
7208
  ActionType.READ,
@@ -6934,3 +7210,10 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
6934
7210
  ActionType.UNASSIGN
6935
7211
  ]
6936
7212
  };
7213
+ var getAvailableActionsForEvent = (event2) => {
7214
+ return event2.flags.includes(InherentFlags.REJECTED) ? [
7215
+ ActionType.READ,
7216
+ event2.status === EventStatus.Enum.VALIDATED ? ActionType.VALIDATE : ActionType.DECLARE,
7217
+ ActionType.ARCHIVE
7218
+ ] : AVAILABLE_ACTIONS_BY_EVENT_STATUS[event2.status];
7219
+ };