@opencrvs/toolkit 1.9.2-rc.c3822a1 → 1.9.2-rc.f6dcfa6

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 (56) hide show
  1. package/dist/commons/api/router.d.ts +1620 -26666
  2. package/dist/commons/conditionals/conditionals.d.ts +1 -10
  3. package/dist/commons/conditionals/validate.d.ts +4 -11
  4. package/dist/commons/events/ActionConfig.d.ts +1525 -21293
  5. package/dist/commons/events/ActionDocument.d.ts +1849 -764
  6. package/dist/commons/events/ActionInput.d.ts +1066 -264
  7. package/dist/commons/events/ActionType.d.ts +8 -85
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +1238 -211
  9. package/dist/commons/events/CompositeFieldValue.d.ts +176 -25
  10. package/dist/commons/events/Conditional.d.ts +38 -26
  11. package/dist/commons/events/Constants.d.ts +1 -1
  12. package/dist/commons/events/CountryConfigQueryInput.d.ts +4169 -919
  13. package/dist/commons/events/CreatedAtLocation.d.ts +1 -1
  14. package/dist/commons/events/DeduplicationConfig.d.ts +150 -15
  15. package/dist/commons/events/Draft.d.ts +105 -70
  16. package/dist/commons/events/DynamicFieldValue.d.ts +91 -7
  17. package/dist/commons/events/EventConfig.d.ts +2096 -17110
  18. package/dist/commons/events/EventConfigInput.d.ts +1 -1
  19. package/dist/commons/events/EventDocument.d.ts +1326 -311
  20. package/dist/commons/events/EventIndex.d.ts +967 -191
  21. package/dist/commons/events/EventInput.d.ts +8 -2
  22. package/dist/commons/events/EventMetadata.d.ts +345 -102
  23. package/dist/commons/events/FieldConfig.d.ts +11775 -4088
  24. package/dist/commons/events/FieldType.d.ts +2 -6
  25. package/dist/commons/events/FieldTypeMapping.d.ts +810 -164
  26. package/dist/commons/events/FieldValue.d.ts +354 -80
  27. package/dist/commons/events/FormConfig.d.ts +697 -12636
  28. package/dist/commons/events/PageConfig.d.ts +314 -8441
  29. package/dist/commons/events/SummaryConfig.d.ts +161 -14
  30. package/dist/commons/events/TranslationConfig.d.ts +2 -2
  31. package/dist/commons/events/WorkqueueColumnConfig.d.ts +36 -70
  32. package/dist/commons/events/WorkqueueConfig.d.ts +7080 -1597
  33. package/dist/commons/events/deduplication.d.ts +3 -3
  34. package/dist/commons/events/defineConfig.d.ts +155 -24703
  35. package/dist/commons/events/index.d.ts +0 -1
  36. package/dist/commons/events/locations.d.ts +19 -15
  37. package/dist/commons/events/scopes.d.ts +0 -1
  38. package/dist/commons/events/state/availableActions.d.ts +1 -2
  39. package/dist/commons/events/state/flags.d.ts +3 -21
  40. package/dist/commons/events/state/index.d.ts +19 -17
  41. package/dist/commons/events/state/utils.d.ts +112 -127
  42. package/dist/commons/events/test.utils.d.ts +5 -11
  43. package/dist/commons/events/transactions.d.ts +1 -1
  44. package/dist/commons/events/utils.d.ts +359 -49444
  45. package/dist/commons/notification/UserNotifications.d.ts +636 -55
  46. package/dist/conditionals/index.d.ts.map +1 -1
  47. package/dist/conditionals/index.js +5 -38
  48. package/dist/events/deduplication.d.ts +3 -3
  49. package/dist/events/index.js +1360 -1502
  50. package/dist/notification/index.d.ts.map +1 -1
  51. package/dist/notification/index.js +1279 -1276
  52. package/dist/scopes/index.d.ts +136 -106
  53. package/dist/scopes/index.d.ts.map +1 -1
  54. package/dist/scopes/index.js +93 -116
  55. package/package.json +5 -5
  56. package/dist/commons/events/Flag.d.ts +0 -43
@@ -39,7 +39,6 @@ __export(events_exports, {
39
39
  ActionCreationMetadata: () => ActionCreationMetadata,
40
40
  ActionDocument: () => ActionDocument,
41
41
  ActionFlag: () => ActionFlag,
42
- ActionFlagConfig: () => ActionFlagConfig,
43
42
  ActionFormConfig: () => ActionFormConfig,
44
43
  ActionInput: () => ActionInput,
45
44
  ActionStatus: () => ActionStatus,
@@ -61,10 +60,10 @@ __export(events_exports, {
61
60
  ArchiveActionInput: () => ArchiveActionInput,
62
61
  AssignActionInput: () => AssignActionInput,
63
62
  AsyncRejectActionDocument: () => AsyncRejectActionDocument,
63
+ BIRTH_EVENT: () => BIRTH_EVENT,
64
64
  BaseActionInput: () => BaseActionInput,
65
65
  BearerTokenByUserType: () => BearerTokenByUserType,
66
66
  ButtonFieldValue: () => ButtonFieldValue,
67
- CHILD_ONBOARDING_EVENT: () => CHILD_ONBOARDING_EVENT,
68
67
  CertificateConfig: () => CertificateConfig,
69
68
  CertificateTemplateConfig: () => CertificateTemplateConfig,
70
69
  CheckboxFieldValue: () => CheckboxFieldValue,
@@ -74,8 +73,6 @@ __export(events_exports, {
74
73
  ConditionalType: () => ConditionalType,
75
74
  ConfirmableActions: () => ConfirmableActions,
76
75
  ContainsFlags: () => ContainsFlags,
77
- CustomActionInput: () => CustomActionInput,
78
- CustomFlag: () => CustomFlag,
79
76
  DEFAULT_DATE_OF_EVENT_PROPERTY: () => DEFAULT_DATE_OF_EVENT_PROPERTY,
80
77
  DataEntry: () => DataEntry,
81
78
  DataFieldValue: () => DataFieldValue,
@@ -83,6 +80,7 @@ __export(events_exports, {
83
80
  DateRangeFieldValue: () => DateRangeFieldValue,
84
81
  DateValue: () => DateValue,
85
82
  DatetimeValue: () => DatetimeValue,
83
+ DeclarationActionBase: () => DeclarationActionBase,
86
84
  DeclarationActionConfig: () => DeclarationActionConfig,
87
85
  DeclarationActions: () => DeclarationActions,
88
86
  DeclarationFormConfig: () => DeclarationFormConfig,
@@ -132,7 +130,6 @@ __export(events_exports, {
132
130
  FileFieldValueWithOption: () => FileFieldValueWithOption,
133
131
  FileFieldWithOptionValue: () => FileFieldWithOptionValue,
134
132
  Flag: () => Flag,
135
- FlagConfig: () => FlagConfig,
136
133
  FormConfig: () => FormConfig,
137
134
  FormPageConfig: () => FormPageConfig,
138
135
  Fuzzy: () => Fuzzy,
@@ -214,7 +211,6 @@ __export(events_exports, {
214
211
  WorkqueueCountInput: () => WorkqueueCountInput,
215
212
  WorkqueueCountOutput: () => WorkqueueCountOutput,
216
213
  ZodDate: () => ZodDate,
217
- actionConfigTypes: () => actionConfigTypes,
218
214
  ageToDate: () => ageToDate,
219
215
  aggregateActionDeclarations: () => aggregateActionDeclarations,
220
216
  alwaysTrue: () => alwaysTrue,
@@ -258,7 +254,6 @@ __export(events_exports, {
258
254
  findAllFields: () => findAllFields,
259
255
  findLastAssignmentAction: () => findLastAssignmentAction,
260
256
  findRecordActionPages: () => findRecordActionPages,
261
- flag: () => flag,
262
257
  generateActionDeclarationInput: () => generateActionDeclarationInput,
263
258
  generateActionDocument: () => generateActionDocument,
264
259
  generateActionDuplicateDeclarationInput: () => generateActionDuplicateDeclarationInput,
@@ -276,7 +271,6 @@ __export(events_exports, {
276
271
  getAcceptedActions: () => getAcceptedActions,
277
272
  getActionAnnotation: () => getActionAnnotation,
278
273
  getActionAnnotationFields: () => getActionAnnotationFields,
279
- getActionConfig: () => getActionConfig,
280
274
  getActionReview: () => getActionReview,
281
275
  getActionReviewFields: () => getActionReviewFields,
282
276
  getAllUniqueFields: () => getAllUniqueFields,
@@ -288,7 +282,6 @@ __export(events_exports, {
288
282
  getCompleteActionAnnotation: () => getCompleteActionAnnotation,
289
283
  getCompleteActionDeclaration: () => getCompleteActionDeclaration,
290
284
  getCurrentEventState: () => getCurrentEventState,
291
- getCustomActionFields: () => getCustomActionFields,
292
285
  getDeclaration: () => getDeclaration,
293
286
  getDeclarationFieldById: () => getDeclarationFieldById,
294
287
  getDeclarationFields: () => getDeclarationFields,
@@ -303,11 +296,7 @@ __export(events_exports, {
303
296
  getValidatorsForField: () => getValidatorsForField,
304
297
  getVisibleVerificationPageIds: () => getVisibleVerificationPageIds,
305
298
  hasAnyOfScopes: () => hasAnyOfScopes,
306
- isActionAvailable: () => isActionAvailable,
307
- isActionConfigType: () => isActionConfigType,
308
- isActionEnabled: () => isActionEnabled,
309
299
  isActionInScope: () => isActionInScope,
310
- isActionVisible: () => isActionVisible,
311
300
  isAddressFieldType: () => isAddressFieldType,
312
301
  isAdministrativeAreaFieldType: () => isAdministrativeAreaFieldType,
313
302
  isAgeFieldType: () => isAgeFieldType,
@@ -367,18 +356,16 @@ __export(events_exports, {
367
356
  mapFieldTypeToEmptyValue: () => mapFieldTypeToEmptyValue,
368
357
  mapFieldTypeToZod: () => mapFieldTypeToZod,
369
358
  mergeDrafts: () => mergeDrafts,
370
- never: () => never2,
359
+ never: () => never,
371
360
  not: () => not,
372
361
  omitHiddenAnnotationFields: () => omitHiddenAnnotationFields,
373
362
  omitHiddenFields: () => omitHiddenFields,
374
363
  omitHiddenPaginatedFields: () => omitHiddenPaginatedFields,
375
364
  or: () => or,
376
- pickRandom: () => pickRandom,
377
365
  resolveDateOfEvent: () => resolveDateOfEvent,
378
366
  runFieldValidations: () => runFieldValidations,
379
367
  runStructuralValidations: () => runStructuralValidations,
380
368
  safeUnion: () => safeUnion,
381
- status: () => status,
382
369
  timePeriodToDateRange: () => timePeriodToDateRange,
383
370
  user: () => user,
384
371
  validate: () => validate,
@@ -392,28 +379,30 @@ module.exports = __toCommonJS(events_exports);
392
379
 
393
380
  // ../commons/src/events/Constants.ts
394
381
  var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
395
- var CHILD_ONBOARDING_EVENT = "child-onboarding";
382
+ var BIRTH_EVENT = "birth";
396
383
 
397
384
  // ../commons/src/events/ActionConfig.ts
398
- var z20 = __toESM(require("zod/v4"));
385
+ var import_zod19 = require("zod");
399
386
 
400
387
  // ../commons/src/events/TranslationConfig.ts
401
- var z = __toESM(require("zod/v4"));
402
- var TranslationConfig = z.object({
403
- id: z.string().describe(
388
+ var import_zod = require("zod");
389
+ var import_zod_openapi = require("zod-openapi");
390
+ (0, import_zod_openapi.extendZodWithOpenApi)(import_zod.z);
391
+ var TranslationConfig = import_zod.z.object({
392
+ id: import_zod.z.string().describe(
404
393
  "The identifier of the translation referred in translation CSV files"
405
394
  ),
406
- defaultMessage: z.string().describe("Default translation message"),
407
- description: z.string().describe(
395
+ defaultMessage: import_zod.z.string().describe("Default translation message"),
396
+ description: import_zod.z.string().describe(
408
397
  "Describe the translation for a translator to be able to identify it."
409
398
  )
410
- }).meta({
399
+ }).openapi({
411
400
  description: "Translation configuration",
412
- id: "TranslationConfig"
401
+ ref: "TranslationConfig"
413
402
  });
414
403
 
415
404
  // ../commons/src/events/ActionType.ts
416
- var z2 = __toESM(require("zod/v4"));
405
+ var import_zod2 = require("zod");
417
406
  var ActionType = {
418
407
  // Pre-declaration actions
419
408
  DELETE: "DELETE",
@@ -438,9 +427,7 @@ var ActionType = {
438
427
  // General actions
439
428
  READ: "READ",
440
429
  ASSIGN: "ASSIGN",
441
- UNASSIGN: "UNASSIGN",
442
- // Custom action
443
- CUSTOM: "CUSTOM"
430
+ UNASSIGN: "UNASSIGN"
444
431
  };
445
432
  var ConfirmableActions = [
446
433
  ActionType.NOTIFY,
@@ -452,10 +439,9 @@ var ConfirmableActions = [
452
439
  ActionType.PRINT_CERTIFICATE,
453
440
  ActionType.REQUEST_CORRECTION,
454
441
  ActionType.APPROVE_CORRECTION,
455
- ActionType.REJECT_CORRECTION,
456
- ActionType.CUSTOM
442
+ ActionType.REJECT_CORRECTION
457
443
  ];
458
- var ActionTypes = z2.enum([
444
+ var ActionTypes = import_zod2.z.enum([
459
445
  "DELETE",
460
446
  "CREATE",
461
447
  "NOTIFY",
@@ -473,8 +459,7 @@ var ActionTypes = z2.enum([
473
459
  "APPROVE_CORRECTION",
474
460
  "READ",
475
461
  "ASSIGN",
476
- "UNASSIGN",
477
- "CUSTOM"
462
+ "UNASSIGN"
478
463
  ]);
479
464
  var ClientSpecificAction = {
480
465
  REVIEW_CORRECTION_REQUEST: "REVIEW_CORRECTION_REQUEST"
@@ -502,14 +487,13 @@ var writeActions = ActionTypes.exclude([
502
487
  ActionType.UNASSIGN
503
488
  ]);
504
489
  var workqueueActions = ActionTypes.exclude([
505
- ActionType.READ,
506
490
  ActionType.CREATE,
507
491
  ActionType.NOTIFY,
508
492
  ActionType.DUPLICATE_DETECTED,
493
+ ActionType.REJECT,
509
494
  ActionType.MARK_AS_NOT_DUPLICATE,
510
495
  ActionType.REJECT_CORRECTION,
511
- ActionType.APPROVE_CORRECTION,
512
- ActionType.CUSTOM
496
+ ActionType.APPROVE_CORRECTION
513
497
  ]);
514
498
  var META_ACTIONS = [
515
499
  ActionType.ASSIGN,
@@ -521,57 +505,59 @@ function isMetaAction(actionType) {
521
505
  }
522
506
 
523
507
  // ../commons/src/events/FieldConfig.ts
524
- var z16 = __toESM(require("zod/v4"));
508
+ var import_zod15 = require("zod");
525
509
 
526
510
  // ../commons/src/events/Conditional.ts
527
- var z3 = __toESM(require("zod/v4"));
528
- var Conditional = z3.any().describe("JSONSchema").meta({
511
+ var import_zod3 = require("zod");
512
+ var import_zod_openapi2 = require("zod-openapi");
513
+ (0, import_zod_openapi2.extendZodWithOpenApi)(import_zod3.z);
514
+ var Conditional = import_zod3.z.custom((val) => typeof val === "object" && val !== null).openapi({
529
515
  description: "JSON schema conditional configuration",
530
- id: "Conditional"
516
+ ref: "Conditional"
531
517
  });
532
518
  var ConditionalType = {
533
519
  SHOW: "SHOW",
534
520
  ENABLE: "ENABLE",
535
521
  DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
536
522
  };
537
- var ShowConditional = z3.object({
538
- type: z3.literal(ConditionalType.SHOW),
523
+ var ShowConditional = import_zod3.z.object({
524
+ type: import_zod3.z.literal(ConditionalType.SHOW),
539
525
  conditional: Conditional
540
526
  }).describe(
541
527
  "If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
542
528
  );
543
- var EnableConditional = z3.object({
544
- type: z3.literal(ConditionalType.ENABLE),
529
+ var EnableConditional = import_zod3.z.object({
530
+ type: import_zod3.z.literal(ConditionalType.ENABLE),
545
531
  conditional: Conditional
546
532
  }).describe(
547
533
  "If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
548
534
  );
549
- var ActionConditional = z3.discriminatedUnion("type", [
535
+ var ActionConditional = import_zod3.z.discriminatedUnion("type", [
550
536
  // Action can be shown / hidden
551
537
  ShowConditional,
552
538
  // Action can be shown to the user in the list but as disabled
553
539
  EnableConditional
554
540
  ]);
555
- var DisplayOnReviewConditional = z3.object({
556
- type: z3.literal(ConditionalType.DISPLAY_ON_REVIEW),
541
+ var DisplayOnReviewConditional = import_zod3.z.object({
542
+ type: import_zod3.z.literal(ConditionalType.DISPLAY_ON_REVIEW),
557
543
  conditional: Conditional
558
544
  }).describe(
559
545
  "If 'DISPLAY_ON_REVIEW' conditional is defined, the component is shown on the review page only if both the 'DISPLAY_ON_REVIEW' and 'SHOW' conditions are met. This should only be used for fields within declaration forms, as they are the only ones with review pages."
560
546
  );
561
- var FieldConditional = z3.discriminatedUnion("type", [
547
+ var FieldConditional = import_zod3.z.discriminatedUnion("type", [
562
548
  // Field input can be shown / hidden
563
549
  ShowConditional,
564
550
  // Field input can be shown to the user but as disabled
565
551
  EnableConditional,
566
552
  // Field output can be shown / hidden on the review page
567
553
  DisplayOnReviewConditional
568
- ]).meta({
554
+ ]).openapi({
569
555
  description: "Field conditional configuration",
570
- id: "FieldConditional"
556
+ ref: "FieldConditional"
571
557
  });
572
558
 
573
559
  // ../commons/src/events/FieldType.ts
574
- var z4 = __toESM(require("zod/v4"));
560
+ var import_zod4 = require("zod");
575
561
  var FieldType = {
576
562
  NAME: "NAME",
577
563
  PHONE: "PHONE",
@@ -615,7 +601,7 @@ var FieldType = {
615
601
  ID_READER: "ID_READER",
616
602
  LOADER: "LOADER"
617
603
  };
618
- var FileFieldType = z4.enum([
604
+ var FileFieldType = import_zod4.z.enum([
619
605
  FieldType.FILE,
620
606
  FieldType.FILE_WITH_OPTIONS,
621
607
  FieldType.SIGNATURE
@@ -642,22 +628,24 @@ var FieldTypesToHideInReview = [
642
628
  ];
643
629
 
644
630
  // ../commons/src/events/FieldValue.ts
645
- var z7 = __toESM(require("zod/v4"));
631
+ var import_zod7 = require("zod");
646
632
 
647
633
  // ../commons/src/documents.ts
648
- var z5 = __toESM(require("zod/v4"));
649
- var FullDocumentUrl = z5.string().brand("FullDocumentUrl").describe(
634
+ var import_zod5 = require("zod");
635
+ var import_zod_openapi3 = require("zod-openapi");
636
+ (0, import_zod_openapi3.extendZodWithOpenApi)(import_zod5.z);
637
+ var FullDocumentUrl = import_zod5.z.string().brand("FullDocumentUrl").describe(
650
638
  "A full url with protocol, host, bucket name, starting from the root of the S3 server, https://minio.opencrvs.com/bucket-name/document-id.jpg"
651
639
  );
652
- var FullDocumentPath = z5.string().overwrite((val) => val.startsWith("/") ? val : `/${val}`).meta({ effectType: "input", type: "string" }).describe(
640
+ var FullDocumentPath = import_zod5.z.string().transform((val) => val.startsWith("/") ? val : `/${val}`).openapi({ effectType: "input", type: "string" }).describe(
653
641
  "A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
654
642
  );
655
- var DocumentPath = z5.string().brand("DocumentPath").describe(
643
+ var DocumentPath = import_zod5.z.string().brand("DocumentPath").describe(
656
644
  "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"
657
645
  );
658
646
 
659
647
  // ../commons/src/events/CompositeFieldValue.ts
660
- var z6 = __toESM(require("zod/v4"));
648
+ var import_zod6 = require("zod");
661
649
  var GeographicalArea = {
662
650
  URBAN: "URBAN",
663
651
  RURAL: "RURAL"
@@ -666,120 +654,120 @@ var AddressType = {
666
654
  DOMESTIC: "DOMESTIC",
667
655
  INTERNATIONAL: "INTERNATIONAL"
668
656
  };
669
- var FileFieldValue = z6.object({
657
+ var FileFieldValue = import_zod6.z.object({
670
658
  path: FullDocumentPath,
671
- originalFilename: z6.string(),
672
- type: z6.string()
659
+ originalFilename: import_zod6.z.string(),
660
+ type: import_zod6.z.string()
673
661
  });
674
- var NameFieldValue = z6.object({
675
- firstname: z6.string(),
676
- surname: z6.string(),
677
- middlename: z6.string().optional()
662
+ var NameFieldValue = import_zod6.z.object({
663
+ firstname: import_zod6.z.string(),
664
+ surname: import_zod6.z.string(),
665
+ middlename: import_zod6.z.string().optional()
678
666
  });
679
- var NameFieldUpdateValue = z6.object({
680
- firstname: z6.string().nullish(),
681
- surname: z6.string().nullish(),
682
- middlename: z6.string().nullish()
683
- }).or(z6.null()).or(z6.undefined());
684
- var StreetLevelDetailsValue = z6.record(z6.string(), z6.string()).optional();
685
- var StreetLevelDetailsUpdateValue = z6.record(z6.string(), z6.string().nullable()).nullish();
686
- var BaseAddressFieldValue = z6.object({
687
- country: z6.string(),
667
+ var NameFieldUpdateValue = import_zod6.z.object({
668
+ firstname: import_zod6.z.string().nullish(),
669
+ surname: import_zod6.z.string().nullish(),
670
+ middlename: import_zod6.z.string().nullish()
671
+ }).or(import_zod6.z.null()).or(import_zod6.z.undefined());
672
+ var StreetLevelDetailsValue = import_zod6.z.record(import_zod6.z.string(), import_zod6.z.string()).optional();
673
+ var StreetLevelDetailsUpdateValue = import_zod6.z.record(import_zod6.z.string(), import_zod6.z.string().nullable()).nullish();
674
+ var BaseAddressFieldValue = import_zod6.z.object({
675
+ country: import_zod6.z.string(),
688
676
  streetLevelDetails: StreetLevelDetailsValue
689
677
  });
690
- var BaseAddressFieldUpdateValue = z6.object({
691
- country: z6.string().nullish(),
678
+ var BaseAddressFieldUpdateValue = import_zod6.z.object({
679
+ country: import_zod6.z.string().nullish(),
692
680
  streetLevelDetails: StreetLevelDetailsUpdateValue
693
681
  });
694
682
  var DomesticAddressFieldValue = BaseAddressFieldValue.extend({
695
- addressType: z6.literal(AddressType.DOMESTIC),
696
- administrativeArea: z6.string().uuid()
683
+ addressType: import_zod6.z.literal(AddressType.DOMESTIC),
684
+ administrativeArea: import_zod6.z.string().uuid()
697
685
  });
698
686
  var InternationalAddressFieldValue = BaseAddressFieldValue.extend({
699
- addressType: z6.literal(AddressType.INTERNATIONAL)
687
+ addressType: import_zod6.z.literal(AddressType.INTERNATIONAL)
700
688
  });
701
- var AddressFieldValue = z6.discriminatedUnion("addressType", [
689
+ var AddressFieldValue = import_zod6.z.discriminatedUnion("addressType", [
702
690
  DomesticAddressFieldValue,
703
691
  InternationalAddressFieldValue
704
692
  ]);
705
693
  var DomesticAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend({
706
- addressType: z6.literal(AddressType.DOMESTIC),
707
- administrativeArea: z6.string().uuid().nullish()
694
+ addressType: import_zod6.z.literal(AddressType.DOMESTIC),
695
+ administrativeArea: import_zod6.z.string().uuid().nullish()
708
696
  /* Leaf level admin structure */
709
697
  });
710
698
  var InternationalAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend(
711
699
  {
712
- addressType: z6.literal(AddressType.INTERNATIONAL)
700
+ addressType: import_zod6.z.literal(AddressType.INTERNATIONAL)
713
701
  }
714
702
  );
715
- var AddressFieldUpdateValue = z6.discriminatedUnion("addressType", [
703
+ var AddressFieldUpdateValue = import_zod6.z.discriminatedUnion("addressType", [
716
704
  DomesticAddressUpdateFieldValue,
717
705
  InternationalAddressUpdateFieldValue
718
706
  ]).nullish();
719
- var FileFieldValueWithOption = z6.object({
707
+ var FileFieldValueWithOption = import_zod6.z.object({
720
708
  path: FullDocumentPath,
721
- originalFilename: z6.string(),
722
- type: z6.string(),
723
- option: z6.string()
709
+ originalFilename: import_zod6.z.string(),
710
+ type: import_zod6.z.string(),
711
+ option: import_zod6.z.string()
724
712
  });
725
- var FileFieldWithOptionValue = z6.array(FileFieldValueWithOption);
726
- var HttpFieldValue = z6.object({
727
- loading: z6.boolean(),
728
- error: z6.object({ statusCode: z6.number(), message: z6.string() }).nullish(),
729
- data: z6.any()
713
+ var FileFieldWithOptionValue = import_zod6.z.array(FileFieldValueWithOption);
714
+ var HttpFieldValue = import_zod6.z.object({
715
+ loading: import_zod6.z.boolean(),
716
+ error: import_zod6.z.object({ statusCode: import_zod6.z.number(), message: import_zod6.z.string() }).nullish(),
717
+ data: import_zod6.z.any()
730
718
  });
731
- var HttpFieldUpdateValue = z6.object({
732
- loading: z6.boolean().nullish(),
733
- error: z6.object({ statusCode: z6.number(), message: z6.string() }).nullish(),
734
- data: z6.any().nullish()
735
- }).or(z6.null()).or(z6.undefined());
736
- var QueryParamReaderFieldValue = z6.object({
737
- data: z6.record(z6.string(), z6.string())
719
+ var HttpFieldUpdateValue = import_zod6.z.object({
720
+ loading: import_zod6.z.boolean().nullish(),
721
+ error: import_zod6.z.object({ statusCode: import_zod6.z.number(), message: import_zod6.z.string() }).nullish(),
722
+ data: import_zod6.z.any().nullish()
723
+ }).or(import_zod6.z.null()).or(import_zod6.z.undefined());
724
+ var QueryParamReaderFieldValue = import_zod6.z.object({
725
+ data: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.string())
738
726
  }).nullish();
739
- var QueryParamReaderFieldUpdateValue = z6.object({
740
- data: z6.record(z6.string(), z6.string())
727
+ var QueryParamReaderFieldUpdateValue = import_zod6.z.object({
728
+ data: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.string())
741
729
  });
742
- var ReadDataValue = z6.object({
743
- data: z6.any()
730
+ var ReadDataValue = import_zod6.z.object({
731
+ data: import_zod6.z.any()
744
732
  });
745
733
  var QrReaderFieldValue = ReadDataValue;
746
734
  var IdReaderFieldValue = ReadDataValue;
747
735
 
748
736
  // ../commons/src/events/FieldValue.ts
749
- var TextValue = z7.string();
737
+ var TextValue = import_zod7.z.string();
750
738
  var NonEmptyTextValue = TextValue.min(1);
751
- var DateValue = z7.iso.date().describe("Date in the format YYYY-MM-DD");
752
- var AgeValue = z7.object({
753
- age: z7.number(),
754
- asOfDateRef: z7.string()
739
+ var DateValue = import_zod7.z.string().date().describe("Date in the format YYYY-MM-DD");
740
+ var AgeValue = import_zod7.z.object({
741
+ age: import_zod7.z.number(),
742
+ asOfDateRef: import_zod7.z.string()
755
743
  });
756
744
  var AgeUpdateValue = AgeValue.optional().nullable();
757
- var TimeValue = z7.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/);
758
- var DatetimeValue = z7.iso.datetime();
759
- var SelectDateRangeValue = z7.enum([
745
+ var TimeValue = import_zod7.z.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/);
746
+ var DatetimeValue = import_zod7.z.string().datetime();
747
+ var SelectDateRangeValue = import_zod7.z.enum([
760
748
  "last7Days",
761
749
  "last30Days",
762
750
  "last90Days",
763
751
  "last365Days"
764
752
  ]);
765
- var DateRangeFieldValue = z7.object({
753
+ var DateRangeFieldValue = import_zod7.z.object({
766
754
  start: DateValue,
767
755
  end: DateValue
768
756
  }).or(DateValue).describe(
769
757
  "Date range with start and end dates in the format YYYY-MM-DD. Inclusive start, exclusive end."
770
758
  );
771
- var EmailValue = z7.email();
772
- var CheckboxFieldValue = z7.boolean();
773
- var NumberFieldValue = z7.number();
774
- var SignatureFieldValue = z7.string();
775
- var ButtonFieldValue = z7.number();
776
- var VerificationStatusValue = z7.enum([
759
+ var EmailValue = import_zod7.z.string().email();
760
+ var CheckboxFieldValue = import_zod7.z.boolean();
761
+ var NumberFieldValue = import_zod7.z.number();
762
+ var SignatureFieldValue = import_zod7.z.string();
763
+ var ButtonFieldValue = import_zod7.z.number();
764
+ var VerificationStatusValue = import_zod7.z.enum([
777
765
  "verified",
778
766
  "authenticated",
779
767
  "failed",
780
768
  "pending"
781
769
  ]);
782
- var FieldValuesWithoutDataField = z7.union([
770
+ var FieldValuesWithoutDataField = import_zod7.z.union([
783
771
  AddressFieldValue,
784
772
  TextValue,
785
773
  DateValue,
@@ -800,10 +788,10 @@ var FieldValuesWithoutDataField = z7.union([
800
788
  QrReaderFieldValue,
801
789
  IdReaderFieldValue
802
790
  ]);
803
- var DataFieldValue = z7.object({
804
- data: z7.record(z7.string(), FieldValuesWithoutDataField)
791
+ var DataFieldValue = import_zod7.z.object({
792
+ data: import_zod7.z.record(import_zod7.z.string(), FieldValuesWithoutDataField)
805
793
  }).nullish();
806
- var FieldValue = z7.union([
794
+ var FieldValue = import_zod7.z.union([
807
795
  FieldValuesWithoutDataField,
808
796
  DataFieldValue
809
797
  ]);
@@ -823,38 +811,22 @@ var PRIORITY_ORDER = [
823
811
  "DataFieldValue"
824
812
  ];
825
813
  function schemaPriority(schema) {
826
- const name = schema.description;
827
- if (!name) {
828
- return 9999;
829
- }
814
+ const name = schema._def?.description;
830
815
  const idx = PRIORITY_ORDER.indexOf(name);
831
816
  return idx === -1 ? 9999 : idx;
832
817
  }
833
818
  function safeUnion(schemas) {
834
- return z7.any().superRefine((val, ctx) => {
819
+ return import_zod7.z.custom((val) => {
835
820
  const successful = schemas.filter((s) => s.safeParse(val).success);
836
821
  if (successful.length === 1) {
837
- return;
822
+ return true;
838
823
  }
839
824
  if (successful.length === 0) {
840
- ctx.addIssue({
841
- code: "invalid_type",
842
- expected: "custom",
843
- message: "Value does not match any schema"
844
- });
845
- return;
825
+ return false;
846
826
  }
847
827
  successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
848
828
  const best = successful[0];
849
- if (!best.safeParse(val).success) {
850
- ctx.addIssue({
851
- expected: "custom",
852
- code: "invalid_type",
853
- message: "Value did not match the best schema"
854
- });
855
- }
856
- }).meta({
857
- description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
829
+ return best.safeParse(val).success;
858
830
  });
859
831
  }
860
832
  var FieldUpdateValue = safeUnion([
@@ -875,18 +847,21 @@ var FieldUpdateValue = safeUnion([
875
847
  QueryParamReaderFieldUpdateValue.describe("QueryParamReaderFieldUpdateValue")
876
848
  ]);
877
849
 
850
+ // ../commons/src/events/FieldConfig.ts
851
+ var import_zod_openapi6 = require("zod-openapi");
852
+
878
853
  // ../commons/src/uuid.ts
879
854
  var import_uuid = require("uuid");
880
- var z8 = __toESM(require("zod/v4"));
881
- var UUID = z8.uuid().brand("UUID");
855
+ var import_zod8 = require("zod");
856
+ var UUID = import_zod8.z.string().uuid().brand("UUID");
882
857
  function getUUID() {
883
858
  return (0, import_uuid.v4)();
884
859
  }
885
860
 
886
861
  // ../commons/src/events/serializers/user/serializer.ts
887
- var z9 = __toESM(require("zod/v4"));
888
- var SerializedUserField = z9.object({
889
- $userField: z9.enum([
862
+ var import_zod9 = require("zod");
863
+ var SerializedUserField = import_zod9.z.object({
864
+ $userField: import_zod9.z.enum([
890
865
  "id",
891
866
  "name",
892
867
  "role",
@@ -894,7 +869,7 @@ var SerializedUserField = z9.object({
894
869
  "avatar",
895
870
  "primaryOfficeId"
896
871
  ]),
897
- $location: z9.string().optional()
872
+ $location: import_zod9.z.string().optional()
898
873
  });
899
874
  function userSerializer(userField) {
900
875
  return {
@@ -914,23 +889,24 @@ function userSerializer(userField) {
914
889
  }
915
890
 
916
891
  // ../commons/src/events/EventIndex.ts
917
- var import_v4 = require("zod/v4");
892
+ var import_zod14 = require("zod");
918
893
 
919
894
  // ../commons/src/events/EventMetadata.ts
920
- var z14 = __toESM(require("zod/v4"));
895
+ var import_zod13 = require("zod");
921
896
 
922
897
  // ../commons/src/events/ActionDocument.ts
923
- var z12 = __toESM(require("zod/v4"));
898
+ var import_zod12 = require("zod");
899
+ var import_zod_openapi4 = require("zod-openapi");
924
900
 
925
901
  // ../commons/src/events/CreatedAtLocation.ts
926
902
  var CreatedAtLocation = UUID.nullish();
927
903
 
928
904
  // ../commons/src/authentication.ts
929
905
  var import_jwt_decode = __toESM(require("jwt-decode"));
930
- var z11 = __toESM(require("zod/v4"));
906
+ var import_zod11 = require("zod");
931
907
 
932
908
  // ../commons/src/scopes.ts
933
- var z10 = __toESM(require("zod/v4"));
909
+ var import_zod10 = require("zod");
934
910
  var SCOPES = {
935
911
  // TODO v1.8 legacy scopes
936
912
  BYPASSRATELIMIT: "bypassratelimit",
@@ -1009,91 +985,91 @@ var SCOPES = {
1009
985
  // data seeding
1010
986
  USER_DATA_SEEDING: "user.data-seeding"
1011
987
  };
1012
- var LegacyScopes = z10.union([
1013
- z10.literal(SCOPES.BYPASSRATELIMIT),
1014
- z10.literal(SCOPES.REGISTER),
1015
- z10.literal(SCOPES.DEMO),
1016
- z10.literal(SCOPES.CONFIG)
988
+ var LegacyScopes = import_zod10.z.union([
989
+ import_zod10.z.literal(SCOPES.BYPASSRATELIMIT),
990
+ import_zod10.z.literal(SCOPES.REGISTER),
991
+ import_zod10.z.literal(SCOPES.DEMO),
992
+ import_zod10.z.literal(SCOPES.CONFIG)
1017
993
  ]);
1018
- var IntegrationScopes = z10.union([
1019
- z10.literal(SCOPES.WEBHOOK),
1020
- z10.literal(SCOPES.NATIONALID),
1021
- z10.literal(SCOPES.NOTIFICATION_API),
1022
- z10.literal(SCOPES.RECORDSEARCH)
994
+ var IntegrationScopes = import_zod10.z.union([
995
+ import_zod10.z.literal(SCOPES.WEBHOOK),
996
+ import_zod10.z.literal(SCOPES.NATIONALID),
997
+ import_zod10.z.literal(SCOPES.NOTIFICATION_API),
998
+ import_zod10.z.literal(SCOPES.RECORDSEARCH)
1023
999
  ]);
1024
- var InternalOperationsScopes = z10.union([
1025
- z10.literal(SCOPES.RECORD_REINDEX),
1026
- z10.literal(SCOPES.RECORD_IMPORT)
1000
+ var InternalOperationsScopes = import_zod10.z.union([
1001
+ import_zod10.z.literal(SCOPES.RECORD_REINDEX),
1002
+ import_zod10.z.literal(SCOPES.RECORD_IMPORT)
1027
1003
  ]);
1028
- var DeclareScopes = z10.union([
1029
- z10.literal(SCOPES.RECORD_DECLARE_BIRTH),
1030
- z10.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
1031
- z10.literal(SCOPES.RECORD_DECLARE_DEATH),
1032
- z10.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
1033
- z10.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
1034
- z10.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
1035
- z10.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
1036
- z10.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW)
1004
+ var DeclareScopes = import_zod10.z.union([
1005
+ import_zod10.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
1006
+ import_zod10.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
1007
+ import_zod10.z.literal(SCOPES.RECORD_DECLARE_DEATH),
1008
+ import_zod10.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
1009
+ import_zod10.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
1010
+ import_zod10.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
1011
+ import_zod10.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
1012
+ import_zod10.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW)
1037
1013
  ]);
1038
- var UnassignScope = z10.literal(SCOPES.RECORD_UNASSIGN_OTHERS);
1039
- var ValidateScopes = z10.union([
1040
- z10.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
1041
- z10.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
1042
- z10.literal(SCOPES.RECORD_DECLARATION_EDIT),
1043
- z10.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
1044
- z10.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
1045
- z10.literal(SCOPES.RECORD_DECLARATION_REINSTATE)
1014
+ var UnassignScope = import_zod10.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS);
1015
+ var ValidateScopes = import_zod10.z.union([
1016
+ import_zod10.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
1017
+ import_zod10.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
1018
+ import_zod10.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
1019
+ import_zod10.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
1020
+ import_zod10.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
1021
+ import_zod10.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE)
1046
1022
  ]);
1047
- var RegisterScope = z10.literal(SCOPES.RECORD_REGISTER);
1048
- var CorrectionScopes = z10.union([
1049
- z10.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
1050
- z10.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
1051
- z10.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
1052
- z10.literal(SCOPES.RECORD_REJECT_REGISTRATION)
1023
+ var RegisterScope = import_zod10.z.literal(SCOPES.RECORD_REGISTER);
1024
+ var CorrectionScopes = import_zod10.z.union([
1025
+ import_zod10.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
1026
+ import_zod10.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
1027
+ import_zod10.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
1028
+ import_zod10.z.literal(SCOPES.RECORD_REJECT_REGISTRATION)
1053
1029
  ]);
1054
- var SearchScopes = z10.union([
1055
- z10.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
1056
- z10.literal(SCOPES.SEARCH_BIRTH),
1057
- z10.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
1058
- z10.literal(SCOPES.SEARCH_DEATH),
1059
- z10.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
1060
- z10.literal(SCOPES.SEARCH_MARRIAGE)
1030
+ var SearchScopes = import_zod10.z.union([
1031
+ import_zod10.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
1032
+ import_zod10.z.literal(SCOPES.SEARCH_BIRTH),
1033
+ import_zod10.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
1034
+ import_zod10.z.literal(SCOPES.SEARCH_DEATH),
1035
+ import_zod10.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
1036
+ import_zod10.z.literal(SCOPES.SEARCH_MARRIAGE)
1061
1037
  ]);
1062
- var AuditScopes = z10.literal(SCOPES.RECORD_READ);
1063
- var PerformanceScopes = z10.union([
1064
- z10.literal(SCOPES.PERFORMANCE_READ),
1065
- z10.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
1066
- z10.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS)
1038
+ var AuditScopes = import_zod10.z.literal(SCOPES.RECORD_READ);
1039
+ var PerformanceScopes = import_zod10.z.union([
1040
+ import_zod10.z.literal(SCOPES.PERFORMANCE_READ),
1041
+ import_zod10.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
1042
+ import_zod10.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS)
1067
1043
  ]);
1068
- var OrganisationScopes = z10.union([
1069
- z10.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
1070
- z10.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
1071
- z10.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION)
1044
+ var OrganisationScopes = import_zod10.z.union([
1045
+ import_zod10.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
1046
+ import_zod10.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
1047
+ import_zod10.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION)
1072
1048
  ]);
1073
- var UserScopes = z10.union([
1074
- z10.literal(SCOPES.USER_READ),
1075
- z10.literal(SCOPES.USER_READ_MY_OFFICE),
1076
- z10.literal(SCOPES.USER_READ_MY_JURISDICTION),
1077
- z10.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
1078
- z10.literal(SCOPES.USER_CREATE),
1079
- z10.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
1080
- z10.literal(SCOPES.USER_UPDATE),
1081
- z10.literal(SCOPES.USER_UPDATE_MY_JURISDICTION)
1049
+ var UserScopes = import_zod10.z.union([
1050
+ import_zod10.z.literal(SCOPES.USER_READ),
1051
+ import_zod10.z.literal(SCOPES.USER_READ_MY_OFFICE),
1052
+ import_zod10.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
1053
+ import_zod10.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
1054
+ import_zod10.z.literal(SCOPES.USER_CREATE),
1055
+ import_zod10.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
1056
+ import_zod10.z.literal(SCOPES.USER_UPDATE),
1057
+ import_zod10.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION)
1082
1058
  ]);
1083
- var ConfigScope = z10.literal(SCOPES.CONFIG_UPDATE_ALL);
1084
- var DataSeedingScope = z10.literal(SCOPES.USER_DATA_SEEDING);
1085
- var LiteralScopes = z10.union([
1059
+ var ConfigScope = import_zod10.z.literal(SCOPES.CONFIG_UPDATE_ALL);
1060
+ var DataSeedingScope = import_zod10.z.literal(SCOPES.USER_DATA_SEEDING);
1061
+ var LiteralScopes = import_zod10.z.union([
1086
1062
  LegacyScopes,
1087
1063
  IntegrationScopes,
1088
1064
  UnassignScope,
1089
1065
  DeclareScopes,
1090
1066
  ValidateScopes,
1091
1067
  RegisterScope,
1092
- z10.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
1068
+ import_zod10.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
1093
1069
  CorrectionScopes,
1094
1070
  SearchScopes,
1095
1071
  AuditScopes,
1096
- z10.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE),
1072
+ import_zod10.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE),
1097
1073
  PerformanceScopes,
1098
1074
  OrganisationScopes,
1099
1075
  UserScopes,
@@ -1102,33 +1078,33 @@ var LiteralScopes = z10.union([
1102
1078
  InternalOperationsScopes
1103
1079
  ]);
1104
1080
  var rawConfigurableScopeRegex = /^([a-zA-Z][a-zA-Z0-9.-]*(?:\.[a-zA-Z0-9.-]+)*)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
1105
- var rawConfigurableScope = z10.string().regex(rawConfigurableScopeRegex);
1106
- var CreateUserScope = z10.object({
1107
- type: z10.literal("user.create"),
1108
- options: z10.object({
1109
- role: z10.array(z10.string())
1081
+ var rawConfigurableScope = import_zod10.z.string().regex(rawConfigurableScopeRegex);
1082
+ var CreateUserScope = import_zod10.z.object({
1083
+ type: import_zod10.z.literal("user.create"),
1084
+ options: import_zod10.z.object({
1085
+ role: import_zod10.z.array(import_zod10.z.string())
1110
1086
  })
1111
1087
  });
1112
- var EditUserScope = z10.object({
1113
- type: z10.literal("user.edit"),
1114
- options: z10.object({
1115
- role: z10.array(z10.string())
1088
+ var EditUserScope = import_zod10.z.object({
1089
+ type: import_zod10.z.literal("user.edit"),
1090
+ options: import_zod10.z.object({
1091
+ role: import_zod10.z.array(import_zod10.z.string())
1116
1092
  })
1117
1093
  });
1118
- var WorkqueueScope = z10.object({
1119
- type: z10.literal("workqueue"),
1120
- options: z10.object({
1121
- id: z10.array(z10.string())
1094
+ var WorkqueueScope = import_zod10.z.object({
1095
+ type: import_zod10.z.literal("workqueue"),
1096
+ options: import_zod10.z.object({
1097
+ id: import_zod10.z.array(import_zod10.z.string())
1122
1098
  })
1123
1099
  });
1124
- var SearchScope = z10.object({
1125
- type: z10.literal("search"),
1126
- options: z10.object({
1127
- event: z10.array(z10.string()).length(1),
1128
- access: z10.array(z10.enum(["my-jurisdiction", "all"])).length(1)
1100
+ var SearchScope = import_zod10.z.object({
1101
+ type: import_zod10.z.literal("search"),
1102
+ options: import_zod10.z.object({
1103
+ event: import_zod10.z.array(import_zod10.z.string()).length(1),
1104
+ access: import_zod10.z.array(import_zod10.z.enum(["my-jurisdiction", "all"])).length(1)
1129
1105
  })
1130
1106
  });
1131
- var RecordScopeType = z10.enum([
1107
+ var RecordScopeType = import_zod10.z.enum([
1132
1108
  "record.create",
1133
1109
  "record.read",
1134
1110
  "record.declare",
@@ -1143,28 +1119,20 @@ var RecordScopeType = z10.enum([
1143
1119
  "record.registered.correct",
1144
1120
  "record.unassign-others"
1145
1121
  ]);
1146
- var RecordScope = z10.object({
1122
+ var RecordScope = import_zod10.z.object({
1147
1123
  type: RecordScopeType,
1148
- options: z10.object({
1149
- event: z10.array(z10.string()).describe("Event type, e.g. birth, death")
1124
+ options: import_zod10.z.object({
1125
+ event: import_zod10.z.array(import_zod10.z.string()).describe("Event type, e.g. birth, death")
1150
1126
  })
1151
1127
  }).describe(
1152
1128
  "Scopes used to check user's permission to perform actions on a record."
1153
1129
  );
1154
- var CustomActionScope = z10.object({
1155
- type: z10.literal("record.custom-action"),
1156
- options: z10.object({
1157
- event: z10.array(z10.string()).describe("Allowed event type, e.g. birth, death"),
1158
- customActionType: z10.array(z10.string()).describe("Allowed custom action types")
1159
- })
1160
- });
1161
- var ConfigurableRawScopes = z10.discriminatedUnion("type", [
1130
+ var ConfigurableRawScopes = import_zod10.z.discriminatedUnion("type", [
1162
1131
  SearchScope,
1163
1132
  CreateUserScope,
1164
1133
  EditUserScope,
1165
1134
  WorkqueueScope,
1166
- RecordScope,
1167
- CustomActionScope
1135
+ RecordScope
1168
1136
  ]);
1169
1137
  function flattenAndMergeScopes(scopes2) {
1170
1138
  if (scopes2.length === 0) return null;
@@ -1221,11 +1189,11 @@ function getAuthorizedEventsFromScopes(scopes2) {
1221
1189
  }).filter((event2) => event2 !== void 0).filter((event2, index, self) => self.indexOf(event2) === index);
1222
1190
  }
1223
1191
  var scopes = Object.values(SCOPES);
1224
- var ActionScopes = z10.union([
1192
+ var ActionScopes = import_zod10.z.union([
1225
1193
  DeclareScopes,
1226
1194
  ValidateScopes,
1227
1195
  RegisterScope,
1228
- z10.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
1196
+ import_zod10.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
1229
1197
  CorrectionScopes
1230
1198
  ]);
1231
1199
 
@@ -1359,14 +1327,15 @@ var DEFAULT_ROLES_DEFINITION = [
1359
1327
  ]
1360
1328
  }
1361
1329
  ];
1362
- var TokenUserType = z11.enum(["user", "system"]);
1363
- var TokenWithBearer = z11.string().regex(/^Bearer\s/);
1330
+ var TokenUserType = import_zod11.z.enum(["user", "system"]);
1331
+ var TokenWithBearer = import_zod11.z.string().regex(/^Bearer\s/);
1364
1332
 
1365
1333
  // ../commons/src/events/ActionDocument.ts
1366
- var ActionUpdate = z12.record(z12.string(), FieldUpdateValue).describe(
1334
+ (0, import_zod_openapi4.extendZodWithOpenApi)(import_zod12.z);
1335
+ var ActionUpdate = import_zod12.z.record(import_zod12.z.string(), FieldUpdateValue).describe(
1367
1336
  "Record of field-level changes made by an action. Supports partial updates and nullable values."
1368
1337
  );
1369
- var EventState = z12.record(z12.string(), FieldValue).describe(
1338
+ var EventState = import_zod12.z.record(import_zod12.z.string(), FieldValue).describe(
1370
1339
  "Aggregate representation of event data after all actions have been applied, with all updates consolidated and null values removed."
1371
1340
  );
1372
1341
  var ActionStatus = {
@@ -1374,16 +1343,16 @@ var ActionStatus = {
1374
1343
  Accepted: "Accepted",
1375
1344
  Rejected: "Rejected"
1376
1345
  };
1377
- var ActionBase = z12.object({
1346
+ var ActionBase = import_zod12.z.object({
1378
1347
  id: UUID.describe("Unique identifier of the action."),
1379
- transactionId: z12.string().describe("Unique identifier of the transaction."),
1348
+ transactionId: import_zod12.z.string().describe("Unique identifier of the transaction."),
1380
1349
  createdByUserType: TokenUserType.describe(
1381
1350
  "Indicates whether the action was created by a human-user or by a system-user."
1382
1351
  ),
1383
- createdAt: z12.string().datetime().describe("Timestamp indicating when the action was created."),
1384
- createdBy: z12.string().describe("Identifier of the user who created the action."),
1385
- createdByRole: z12.string().describe("Role of the user who created the action."),
1386
- createdBySignature: z12.string().nullish().describe("Reference to the signature of the user who created the action."),
1352
+ createdAt: import_zod12.z.string().datetime().describe("Timestamp indicating when the action was created."),
1353
+ createdBy: import_zod12.z.string().describe("Identifier of the user who created the action."),
1354
+ createdByRole: import_zod12.z.string().describe("Role of the user who created the action."),
1355
+ createdBySignature: import_zod12.z.string().nullish().describe("Reference to the signature of the user who created the action."),
1387
1356
  createdAtLocation: CreatedAtLocation.describe(
1388
1357
  "Reference to the location of the user who created the action."
1389
1358
  ),
@@ -1391,7 +1360,7 @@ var ActionBase = z12.object({
1391
1360
  "Declaration data defined by the ActionConfig. Supports partial updates."
1392
1361
  ),
1393
1362
  annotation: ActionUpdate.optional().nullable().describe("Action-specific metadata used to annotate the event."),
1394
- status: z12.enum([
1363
+ status: import_zod12.z.enum([
1395
1364
  ActionStatus.Requested,
1396
1365
  ActionStatus.Accepted,
1397
1366
  ActionStatus.Rejected
@@ -1402,164 +1371,164 @@ var ActionBase = z12.object({
1402
1371
  "Reference to the original action asynchronously accepted or rejected by a third-party integration."
1403
1372
  )
1404
1373
  });
1405
- var AssignedAction = ActionBase.extend(
1406
- z12.object({
1407
- type: z12.literal(ActionType.ASSIGN),
1408
- assignedTo: z12.string().describe("Identifier of the user to whom the action is assigned.")
1374
+ var AssignedAction = ActionBase.merge(
1375
+ import_zod12.z.object({
1376
+ type: import_zod12.z.literal(ActionType.ASSIGN),
1377
+ assignedTo: import_zod12.z.string().describe("Identifier of the user to whom the action is assigned.")
1409
1378
  // TODO move into 'content' property
1410
- }).shape
1379
+ })
1411
1380
  );
1412
- var UnassignedAction = ActionBase.extend(
1413
- z12.object({
1414
- type: z12.literal(ActionType.UNASSIGN)
1415
- }).shape
1381
+ var UnassignedAction = ActionBase.merge(
1382
+ import_zod12.z.object({
1383
+ type: import_zod12.z.literal(ActionType.UNASSIGN)
1384
+ })
1416
1385
  );
1417
- var RegisterAction = ActionBase.extend(
1418
- z12.object({
1419
- type: z12.literal(ActionType.REGISTER),
1420
- registrationNumber: z12.string().optional().describe(
1386
+ var RegisterAction = ActionBase.merge(
1387
+ import_zod12.z.object({
1388
+ type: import_zod12.z.literal(ActionType.REGISTER),
1389
+ registrationNumber: import_zod12.z.string().optional().describe(
1421
1390
  "Registration number of the event. Always present for accepted registrations."
1422
1391
  )
1423
1392
  // TODO move into 'content' property
1424
- }).shape
1393
+ })
1425
1394
  );
1426
- var DeclareAction = ActionBase.extend(
1427
- z12.object({
1428
- type: z12.literal(ActionType.DECLARE)
1429
- }).shape
1395
+ var DeclareAction = ActionBase.merge(
1396
+ import_zod12.z.object({
1397
+ type: import_zod12.z.literal(ActionType.DECLARE)
1398
+ })
1430
1399
  );
1431
- var ValidateAction = ActionBase.extend(
1432
- z12.object({
1433
- type: z12.literal(ActionType.VALIDATE)
1434
- }).shape
1400
+ var ValidateAction = ActionBase.merge(
1401
+ import_zod12.z.object({
1402
+ type: import_zod12.z.literal(ActionType.VALIDATE)
1403
+ })
1435
1404
  );
1436
- var ReasonContent = z12.object({
1437
- reason: z12.string().min(1, { error: "Message cannot be empty" }).describe(
1405
+ var ReasonContent = import_zod12.z.object({
1406
+ reason: import_zod12.z.string().min(1, { message: "Message cannot be empty" }).describe(
1438
1407
  "Message describing the reason for rejecting or archiving the event."
1439
1408
  )
1440
1409
  });
1441
- var RejectAction = ActionBase.extend(
1442
- z12.object({
1443
- type: z12.literal(ActionType.REJECT),
1410
+ var RejectAction = ActionBase.merge(
1411
+ import_zod12.z.object({
1412
+ type: import_zod12.z.literal(ActionType.REJECT),
1444
1413
  content: ReasonContent
1445
- }).shape
1414
+ })
1446
1415
  );
1447
- var PotentialDuplicate = z12.object({
1416
+ var PotentialDuplicate = import_zod12.z.object({
1448
1417
  id: UUID,
1449
- trackingId: z12.string()
1418
+ trackingId: import_zod12.z.string()
1450
1419
  });
1451
- var DuplicateDetectedAction = ActionBase.extend(
1452
- z12.object({
1453
- type: z12.literal(ActionType.DUPLICATE_DETECTED),
1454
- content: z12.object({
1455
- duplicates: z12.array(PotentialDuplicate)
1420
+ var DuplicateDetectedAction = ActionBase.merge(
1421
+ import_zod12.z.object({
1422
+ type: import_zod12.z.literal(ActionType.DUPLICATE_DETECTED),
1423
+ content: import_zod12.z.object({
1424
+ duplicates: import_zod12.z.array(PotentialDuplicate)
1456
1425
  })
1457
- }).shape
1426
+ })
1458
1427
  );
1459
- var MarkNotDuplicateAction = ActionBase.extend(
1460
- z12.object({
1461
- type: z12.literal(ActionType.MARK_AS_NOT_DUPLICATE)
1462
- }).shape
1428
+ var MarkNotDuplicateAction = ActionBase.merge(
1429
+ import_zod12.z.object({
1430
+ type: import_zod12.z.literal(ActionType.MARK_AS_NOT_DUPLICATE)
1431
+ })
1463
1432
  );
1464
- var MarkAsDuplicateAction = ActionBase.extend(
1465
- z12.object({
1466
- type: z12.literal(ActionType.MARK_AS_DUPLICATE),
1467
- content: z12.object({
1433
+ var MarkAsDuplicateAction = ActionBase.merge(
1434
+ import_zod12.z.object({
1435
+ type: import_zod12.z.literal(ActionType.MARK_AS_DUPLICATE),
1436
+ content: import_zod12.z.object({
1468
1437
  duplicateOf: UUID
1469
1438
  }).optional()
1470
- }).shape
1439
+ })
1471
1440
  );
1472
- var ArchiveAction = ActionBase.extend(
1473
- z12.object({
1474
- type: z12.literal(ActionType.ARCHIVE),
1441
+ var ArchiveAction = ActionBase.merge(
1442
+ import_zod12.z.object({
1443
+ type: import_zod12.z.literal(ActionType.ARCHIVE),
1475
1444
  content: ReasonContent
1476
- }).shape
1445
+ })
1477
1446
  );
1478
- var CreatedAction = ActionBase.extend(
1479
- z12.object({
1480
- type: z12.literal(ActionType.CREATE)
1481
- }).shape
1447
+ var CreatedAction = ActionBase.merge(
1448
+ import_zod12.z.object({
1449
+ type: import_zod12.z.literal(ActionType.CREATE)
1450
+ })
1482
1451
  );
1483
- var NotifiedAction = ActionBase.extend(
1484
- z12.object({
1485
- type: z12.literal(ActionType.NOTIFY)
1486
- }).shape
1452
+ var NotifiedAction = ActionBase.merge(
1453
+ import_zod12.z.object({
1454
+ type: import_zod12.z.literal(ActionType.NOTIFY)
1455
+ })
1487
1456
  );
1488
- var PrintContent = z12.object({
1489
- templateId: z12.string().optional()
1457
+ var PrintContent = import_zod12.z.object({
1458
+ templateId: import_zod12.z.string().optional()
1490
1459
  });
1491
- var PrintCertificateAction = ActionBase.extend(
1492
- z12.object({
1493
- type: z12.literal(ActionType.PRINT_CERTIFICATE),
1460
+ var PrintCertificateAction = ActionBase.merge(
1461
+ import_zod12.z.object({
1462
+ type: import_zod12.z.literal(ActionType.PRINT_CERTIFICATE),
1494
1463
  content: PrintContent.optional().nullable()
1495
- }).shape
1464
+ })
1496
1465
  );
1497
- var RequestedCorrectionAction = ActionBase.extend(
1498
- z12.object({
1499
- type: z12.literal(ActionType.REQUEST_CORRECTION)
1500
- }).shape
1466
+ var RequestedCorrectionAction = ActionBase.merge(
1467
+ import_zod12.z.object({
1468
+ type: import_zod12.z.literal(ActionType.REQUEST_CORRECTION)
1469
+ })
1501
1470
  );
1502
- var ApprovedCorrectionAction = ActionBase.extend(
1503
- z12.object({
1504
- type: z12.literal(ActionType.APPROVE_CORRECTION),
1505
- requestId: z12.string()
1471
+ var ApprovedCorrectionAction = ActionBase.merge(
1472
+ import_zod12.z.object({
1473
+ type: import_zod12.z.literal(ActionType.APPROVE_CORRECTION),
1474
+ requestId: import_zod12.z.string()
1506
1475
  // TODO move into 'content' property
1507
- }).shape
1476
+ })
1508
1477
  );
1509
- var RejectedCorrectionAction = ActionBase.extend(
1510
- z12.object({
1511
- type: z12.literal(ActionType.REJECT_CORRECTION),
1512
- requestId: z12.string(),
1478
+ var RejectedCorrectionAction = ActionBase.merge(
1479
+ import_zod12.z.object({
1480
+ type: import_zod12.z.literal(ActionType.REJECT_CORRECTION),
1481
+ requestId: import_zod12.z.string(),
1513
1482
  // TODO move into 'content' property
1514
1483
  content: ReasonContent
1515
- }).shape
1516
- );
1517
- var ReadAction = ActionBase.extend(
1518
- z12.object({
1519
- type: z12.literal(ActionType.READ)
1520
- }).shape
1484
+ })
1521
1485
  );
1522
- var CustomAction = ActionBase.merge(
1523
- z12.object({
1524
- type: z12.literal(ActionType.CUSTOM),
1525
- customActionType: z12.string()
1486
+ var ReadAction = ActionBase.merge(
1487
+ import_zod12.z.object({
1488
+ type: import_zod12.z.literal(ActionType.READ)
1526
1489
  })
1527
1490
  );
1528
- var ActionDocument = z12.discriminatedUnion("type", [
1529
- CreatedAction.meta({ id: "CreatedAction" }),
1530
- ValidateAction.meta({ id: "ValidateAction" }),
1531
- RejectAction.meta({ id: "RejectAction" }),
1532
- DuplicateDetectedAction.meta({ id: "DuplicateDetectedAction" }),
1533
- MarkNotDuplicateAction.meta({ id: "MarkNotDuplicateAction" }),
1534
- MarkAsDuplicateAction.meta({ id: "MarkAsDuplicateAction" }),
1535
- ArchiveAction.meta({ id: "ArchiveAction" }),
1536
- NotifiedAction.meta({ id: "NotifiedAction" }),
1537
- RegisterAction.meta({ id: "RegisterAction" }),
1538
- DeclareAction.meta({ id: "DeclareAction" }),
1539
- AssignedAction.meta({ id: "AssignedAction" }),
1540
- RequestedCorrectionAction.meta({ id: "RequestedCorrectionAction" }),
1541
- ApprovedCorrectionAction.meta({ id: "ApprovedCorrectionAction" }),
1542
- RejectedCorrectionAction.meta({ id: "RejectedCorrectionAction" }),
1543
- UnassignedAction.meta({ id: "UnassignedAction" }),
1544
- PrintCertificateAction.meta({ id: "PrintCertificateAction" }),
1545
- ReadAction.meta({ id: "ReadAction" }),
1546
- CustomAction.meta({ id: "CustomAction" })
1547
- ]).meta({
1548
- id: "ActionDocument"
1491
+ var ActionDocument = import_zod12.z.discriminatedUnion("type", [
1492
+ CreatedAction.openapi({ ref: "CreatedAction" }),
1493
+ ValidateAction.openapi({ ref: "ValidateAction" }),
1494
+ RejectAction.openapi({ ref: "RejectAction" }),
1495
+ DuplicateDetectedAction.openapi({ ref: "DuplicateDetectedAction" }),
1496
+ MarkNotDuplicateAction.openapi({ ref: "MarkNotDuplicateAction" }),
1497
+ MarkAsDuplicateAction.openapi({ ref: "MarkAsDuplicateAction" }),
1498
+ ArchiveAction.openapi({ ref: "ArchiveAction" }),
1499
+ NotifiedAction.openapi({ ref: "NotifiedAction" }),
1500
+ RegisterAction.openapi({ ref: "RegisterAction" }),
1501
+ DeclareAction.openapi({ ref: "DeclareAction" }),
1502
+ AssignedAction.openapi({ ref: "AssignedAction" }),
1503
+ RequestedCorrectionAction.openapi({ ref: "RequestedCorrectionAction" }),
1504
+ ApprovedCorrectionAction.openapi({ ref: "ApprovedCorrectionAction" }),
1505
+ RejectedCorrectionAction.openapi({ ref: "RejectedCorrectionAction" }),
1506
+ UnassignedAction.openapi({ ref: "UnassignedAction" }),
1507
+ PrintCertificateAction.openapi({ ref: "PrintCertificateAction" }),
1508
+ ReadAction.openapi({ ref: "ReadAction" })
1509
+ ]).openapi({
1510
+ ref: "ActionDocument"
1549
1511
  });
1550
1512
  var AsyncRejectActionDocument = ActionBase.omit({
1551
1513
  declaration: true,
1552
1514
  annotation: true
1553
- }).extend(
1554
- z12.object({
1555
- type: z12.enum(ConfirmableActions),
1556
- status: z12.literal(ActionStatus.Rejected)
1557
- }).shape
1515
+ }).merge(
1516
+ import_zod12.z.object({
1517
+ type: import_zod12.z.enum(ConfirmableActions),
1518
+ status: import_zod12.z.literal(ActionStatus.Rejected)
1519
+ })
1558
1520
  );
1559
- var Action = z12.union([ActionDocument, AsyncRejectActionDocument]);
1521
+ var Action = import_zod12.z.union([ActionDocument, AsyncRejectActionDocument]);
1560
1522
 
1561
- // ../commons/src/events/Flag.ts
1562
- var z13 = __toESM(require("zod/v4"));
1523
+ // ../commons/src/events/EventMetadata.ts
1524
+ var EventStatus = import_zod13.z.enum([
1525
+ "CREATED",
1526
+ "NOTIFIED",
1527
+ "DECLARED",
1528
+ "VALIDATED",
1529
+ "REGISTERED",
1530
+ "ARCHIVED"
1531
+ ]);
1563
1532
  var InherentFlags = {
1564
1533
  PENDING_CERTIFICATION: "pending-certification",
1565
1534
  INCOMPLETE: "incomplete",
@@ -1567,7 +1536,7 @@ var InherentFlags = {
1567
1536
  CORRECTION_REQUESTED: "correction-requested",
1568
1537
  POTENTIAL_DUPLICATE: "potential-duplicate"
1569
1538
  };
1570
- var ActionFlag = z13.string().regex(
1539
+ var ActionFlag = import_zod13.z.string().regex(
1571
1540
  new RegExp(
1572
1541
  `^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
1573
1542
  ActionStatus
@@ -1575,89 +1544,59 @@ var ActionFlag = z13.string().regex(
1575
1544
  ),
1576
1545
  "Flag must be in the format ActionType:ActionStatus (lowerCase)"
1577
1546
  );
1578
- var CustomFlag = z13.string().refine((val) => !Object.values(InherentFlags).includes(val), {
1579
- message: `Custom flag cannot be one of the inherent flags: ${Object.values(
1580
- InherentFlags
1581
- ).join(", ")}`
1582
- }).refine((val) => !ActionFlag.safeParse(val).success, {
1583
- message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
1584
- }).describe("Custom flag identifier defined by the country config.");
1585
- var Flag = ActionFlag.or(z13.enum(InherentFlags)).or(CustomFlag);
1586
- var FlagConfig = z13.object({
1587
- id: CustomFlag,
1588
- requiresAction: z13.boolean().describe(
1589
- "Indicates if this flag expects an action to be performed to be cleared."
1590
- ),
1591
- label: TranslationConfig.describe("Human readable label of the flag.")
1592
- });
1593
- var ActionFlagConfig = z13.object({
1594
- id: CustomFlag,
1595
- operation: z13.enum(["add", "remove"]).describe("Operation to perform on the flag."),
1596
- conditional: Conditional.optional().describe(
1597
- "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
1598
- )
1599
- });
1600
-
1601
- // ../commons/src/events/EventMetadata.ts
1602
- var EventStatus = z14.enum([
1603
- "CREATED",
1604
- "NOTIFIED",
1605
- "DECLARED",
1606
- "REGISTERED",
1607
- "ARCHIVED"
1608
- ]);
1609
- var ZodDate = z14.iso.date();
1610
- var ActionCreationMetadata = z14.object({
1611
- createdAt: z14.iso.datetime().describe("The timestamp when the action request was created."),
1612
- createdBy: z14.string().describe("ID of the user who created the action request."),
1547
+ var Flag = ActionFlag.or(import_zod13.z.nativeEnum(InherentFlags));
1548
+ var ZodDate = import_zod13.z.string().date();
1549
+ var ActionCreationMetadata = import_zod13.z.object({
1550
+ createdAt: import_zod13.z.string().datetime().describe("The timestamp when the action request was created."),
1551
+ createdBy: import_zod13.z.string().describe("ID of the user who created the action request."),
1613
1552
  createdAtLocation: CreatedAtLocation.describe(
1614
1553
  "Location of the user who created the action request."
1615
1554
  ),
1616
- createdByUserType: z14.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1617
- acceptedAt: z14.iso.datetime().describe("Timestamp when the action request was accepted."),
1618
- createdByRole: z14.string().describe("Role of the user at the time of action request creation."),
1619
- createdBySignature: z14.string().nullish().describe("Signature of the user who created the action request.")
1555
+ createdByUserType: import_zod13.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1556
+ acceptedAt: import_zod13.z.string().datetime().describe("Timestamp when the action request was accepted."),
1557
+ createdByRole: import_zod13.z.string().describe("Role of the user at the time of action request creation."),
1558
+ createdBySignature: import_zod13.z.string().nullish().describe("Signature of the user who created the action request.")
1620
1559
  });
1621
1560
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1622
- registrationNumber: z14.string().describe(
1561
+ registrationNumber: import_zod13.z.string().describe(
1623
1562
  "Registration number of the event. Always present for accepted registrations."
1624
1563
  )
1625
1564
  });
1626
- var LegalStatuses = z14.object({
1565
+ var LegalStatuses = import_zod13.z.object({
1627
1566
  [EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
1628
1567
  [EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
1629
1568
  });
1630
- var EventMetadata = z14.object({
1569
+ var EventMetadata = import_zod13.z.object({
1631
1570
  id: UUID,
1632
- type: z14.string().describe("The type of event, such as birth, death, or marriage."),
1571
+ type: import_zod13.z.string().describe("The type of event, such as birth, death, or marriage."),
1633
1572
  status: EventStatus,
1634
1573
  legalStatuses: LegalStatuses.describe(
1635
1574
  "Metadata related to the legal registration of the event, such as who registered it and when."
1636
1575
  ),
1637
- createdAt: z14.iso.datetime().describe("The timestamp when the event was first created and saved."),
1576
+ createdAt: import_zod13.z.string().datetime().describe("The timestamp when the event was first created and saved."),
1638
1577
  dateOfEvent: ZodDate.nullish(),
1639
- createdBy: z14.string().describe("ID of the user who created the event."),
1640
- createdByUserType: z14.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1641
- updatedByUserRole: z14.string().describe("Role of the user who last changed the status."),
1578
+ createdBy: import_zod13.z.string().describe("ID of the user who created the event."),
1579
+ createdByUserType: import_zod13.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1580
+ updatedByUserRole: import_zod13.z.string().describe("Role of the user who last changed the status."),
1642
1581
  createdAtLocation: CreatedAtLocation.describe(
1643
1582
  "Location of the user who created the event."
1644
1583
  ),
1645
- createdBySignature: z14.string().nullish().describe("Signature of the user who created the event."),
1584
+ createdBySignature: import_zod13.z.string().nullish().describe("Signature of the user who created the event."),
1646
1585
  updatedAtLocation: UUID.nullish().describe(
1647
1586
  "Location of the user who last changed the status."
1648
1587
  ),
1649
- updatedAt: z14.iso.datetime().describe(
1588
+ updatedAt: import_zod13.z.string().datetime().describe(
1650
1589
  "Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
1651
1590
  ),
1652
- assignedTo: z14.string().nullish().describe("ID of the user currently assigned to the event."),
1653
- updatedBy: z14.string().nullish().describe("ID of the user who last changed the status."),
1654
- trackingId: z14.string().describe(
1591
+ assignedTo: import_zod13.z.string().nullish().describe("ID of the user currently assigned to the event."),
1592
+ updatedBy: import_zod13.z.string().nullish().describe("ID of the user who last changed the status."),
1593
+ trackingId: import_zod13.z.string().describe(
1655
1594
  "System-generated tracking ID used by informants or registrars to look up the event."
1656
1595
  ),
1657
- potentialDuplicates: z14.array(PotentialDuplicate).describe(
1596
+ potentialDuplicates: import_zod13.z.array(PotentialDuplicate).describe(
1658
1597
  "List of event IDs and their tracking IDs that this event could be a duplicate of."
1659
1598
  ),
1660
- flags: z14.array(Flag)
1599
+ flags: import_zod13.z.array(Flag)
1661
1600
  });
1662
1601
  var EventMetadataKeysArray = [
1663
1602
  "id",
@@ -1677,7 +1616,7 @@ var EventMetadataKeysArray = [
1677
1616
  "legalStatuses",
1678
1617
  "flags"
1679
1618
  ];
1680
- var EventMetadataKeys = z14.enum(EventMetadataKeysArray);
1619
+ var EventMetadataKeys = import_zod13.z.enum(EventMetadataKeysArray);
1681
1620
  var eventMetadataLabelMap = {
1682
1621
  "event.assignedTo": {
1683
1622
  id: "event.assignedTo.label",
@@ -1757,125 +1696,127 @@ var eventMetadataLabelMap = {
1757
1696
  };
1758
1697
 
1759
1698
  // ../commons/src/events/EventIndex.ts
1699
+ var import_zod_openapi5 = require("zod-openapi");
1700
+ (0, import_zod_openapi5.extendZodWithOpenApi)(import_zod14.z);
1760
1701
  var EventIndex = EventMetadata.extend({
1761
1702
  declaration: EventState
1762
- }).meta({
1763
- id: "EventIndex"
1703
+ }).openapi({
1704
+ ref: "EventIndex"
1764
1705
  });
1765
- var EventSearchIndex = import_v4.z.record(import_v4.z.string(), import_v4.z.any()).and(
1766
- import_v4.z.object({
1767
- type: import_v4.z.string()
1706
+ var EventSearchIndex = import_zod14.z.record(import_zod14.z.string(), import_zod14.z.any()).and(
1707
+ import_zod14.z.object({
1708
+ type: import_zod14.z.string()
1768
1709
  // Ensures "type" (event-id) exists and is a string
1769
1710
  })
1770
- ).meta({
1771
- id: "EventSearchIndex"
1711
+ ).openapi({
1712
+ ref: "EventSearchIndex"
1772
1713
  });
1773
- var Fuzzy = import_v4.z.object({ type: import_v4.z.literal("fuzzy"), term: import_v4.z.string() }).meta({
1774
- id: "Fuzzy"
1714
+ var Fuzzy = import_zod14.z.object({ type: import_zod14.z.literal("fuzzy"), term: import_zod14.z.string() }).openapi({
1715
+ ref: "Fuzzy"
1775
1716
  });
1776
- var Exact = import_v4.z.object({ type: import_v4.z.literal("exact"), term: import_v4.z.string() }).meta({
1777
- id: "Exact"
1717
+ var Exact = import_zod14.z.object({ type: import_zod14.z.literal("exact"), term: import_zod14.z.string() }).openapi({
1718
+ ref: "Exact"
1778
1719
  });
1779
- var ExactStatus = import_v4.z.object({
1780
- type: import_v4.z.literal("exact"),
1720
+ var ExactStatus = import_zod14.z.object({
1721
+ type: import_zod14.z.literal("exact"),
1781
1722
  term: EventStatus
1782
- }).meta({
1783
- id: "ExactStatus"
1723
+ }).openapi({
1724
+ ref: "ExactStatus"
1784
1725
  });
1785
- var ExactUserType = import_v4.z.object({
1786
- type: import_v4.z.literal("exact"),
1726
+ var ExactUserType = import_zod14.z.object({
1727
+ type: import_zod14.z.literal("exact"),
1787
1728
  term: TokenUserType
1788
- }).meta({
1789
- id: "ExactUserType"
1729
+ }).openapi({
1730
+ ref: "ExactUserType"
1790
1731
  });
1791
- var AnyOf = import_v4.z.object({
1792
- type: import_v4.z.literal("anyOf"),
1793
- terms: import_v4.z.array(import_v4.z.string())
1794
- }).meta({
1795
- id: "AnyOf"
1732
+ var AnyOf = import_zod14.z.object({
1733
+ type: import_zod14.z.literal("anyOf"),
1734
+ terms: import_zod14.z.array(import_zod14.z.string())
1735
+ }).openapi({
1736
+ ref: "AnyOf"
1796
1737
  });
1797
- var AnyOfStatus = import_v4.z.object({
1798
- type: import_v4.z.literal("anyOf"),
1799
- terms: import_v4.z.array(EventStatus)
1800
- }).meta({
1801
- id: "AnyOfStatus"
1738
+ var AnyOfStatus = import_zod14.z.object({
1739
+ type: import_zod14.z.literal("anyOf"),
1740
+ terms: import_zod14.z.array(EventStatus)
1741
+ }).openapi({
1742
+ ref: "AnyOfStatus"
1802
1743
  });
1803
- var Range = import_v4.z.object({
1804
- type: import_v4.z.literal("range"),
1805
- gte: import_v4.z.string(),
1806
- lte: import_v4.z.string()
1807
- }).meta({
1808
- id: "Range"
1744
+ var Range = import_zod14.z.object({
1745
+ type: import_zod14.z.literal("range"),
1746
+ gte: import_zod14.z.string(),
1747
+ lte: import_zod14.z.string()
1748
+ }).openapi({
1749
+ ref: "Range"
1809
1750
  });
1810
- var ContainsFlags = import_v4.z.object({
1811
- anyOf: import_v4.z.array(Flag).optional(),
1812
- noneOf: import_v4.z.array(Flag).optional()
1813
- }).meta({
1814
- id: "ContainsFlags"
1751
+ var ContainsFlags = import_zod14.z.object({
1752
+ anyOf: import_zod14.z.array(Flag).optional(),
1753
+ noneOf: import_zod14.z.array(Flag).optional()
1754
+ }).openapi({
1755
+ ref: "ContainsFlags"
1815
1756
  });
1816
- var Within = import_v4.z.object({ type: import_v4.z.literal("within"), location: import_v4.z.string() }).meta({
1817
- id: "Within"
1757
+ var Within = import_zod14.z.object({ type: import_zod14.z.literal("within"), location: import_zod14.z.string() }).openapi({
1758
+ ref: "Within"
1818
1759
  });
1819
- var RangeDate = import_v4.z.object({
1820
- type: import_v4.z.literal("range"),
1821
- gte: import_v4.z.iso.date().or(import_v4.z.iso.datetime()),
1822
- lte: import_v4.z.iso.date().or(import_v4.z.iso.datetime())
1823
- }).meta({ id: "RangeDate" });
1760
+ var RangeDate = import_zod14.z.object({
1761
+ type: import_zod14.z.literal("range"),
1762
+ gte: import_zod14.z.string().date().or(import_zod14.z.string().datetime()),
1763
+ lte: import_zod14.z.string().date().or(import_zod14.z.string().datetime())
1764
+ }).openapi({ ref: "RangeDate" });
1824
1765
  var ExactDate = Exact.extend({
1825
- term: import_v4.z.iso.date().or(import_v4.z.iso.datetime())
1826
- }).meta({
1827
- id: "ExactDate"
1766
+ term: import_zod14.z.string().date().or(import_zod14.z.string().datetime())
1767
+ }).openapi({
1768
+ ref: "ExactDate"
1828
1769
  });
1829
- var TimePeriod = import_v4.z.object({
1830
- type: import_v4.z.literal("timePeriod"),
1770
+ var TimePeriod = import_zod14.z.object({
1771
+ type: import_zod14.z.literal("timePeriod"),
1831
1772
  term: SelectDateRangeValue
1832
- }).meta({
1833
- id: "TimePeriod"
1773
+ }).openapi({
1774
+ ref: "TimePeriod"
1834
1775
  });
1835
- var DateCondition = import_v4.z.union([ExactDate, RangeDate, TimePeriod]).meta({
1836
- id: "DateCondition"
1776
+ var DateCondition = import_zod14.z.union([ExactDate, RangeDate, TimePeriod]).openapi({
1777
+ ref: "DateCondition"
1837
1778
  });
1838
- var QueryInput = import_v4.z.lazy(
1839
- () => import_v4.z.union([
1840
- import_v4.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf]),
1841
- import_v4.z.record(import_v4.z.string(), QueryInput)
1779
+ var QueryInput = import_zod14.z.lazy(
1780
+ () => import_zod14.z.union([
1781
+ import_zod14.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf]),
1782
+ import_zod14.z.record(import_zod14.z.string(), QueryInput)
1842
1783
  ])
1843
- ).meta({
1844
- id: "QueryInput"
1784
+ ).openapi({
1785
+ ref: "QueryInput"
1845
1786
  });
1846
- var QueryExpression = import_v4.z.object({
1847
- id: import_v4.z.optional(import_v4.z.string()),
1848
- eventType: import_v4.z.string(),
1849
- status: import_v4.z.optional(import_v4.z.union([AnyOfStatus, ExactStatus])),
1850
- createdAt: import_v4.z.optional(DateCondition),
1851
- updatedAt: import_v4.z.optional(DateCondition),
1852
- "legalStatuses.REGISTERED.acceptedAt": import_v4.z.optional(DateCondition),
1853
- "legalStatuses.DECLARED.createdAtLocation": import_v4.z.optional(
1854
- import_v4.z.union([Within, Exact])
1787
+ var QueryExpression = import_zod14.z.object({
1788
+ id: import_zod14.z.optional(import_zod14.z.string()),
1789
+ eventType: import_zod14.z.string(),
1790
+ status: import_zod14.z.optional(import_zod14.z.union([AnyOfStatus, ExactStatus])),
1791
+ createdAt: import_zod14.z.optional(DateCondition),
1792
+ updatedAt: import_zod14.z.optional(DateCondition),
1793
+ "legalStatuses.REGISTERED.acceptedAt": import_zod14.z.optional(DateCondition),
1794
+ "legalStatuses.DECLARED.createdAtLocation": import_zod14.z.optional(
1795
+ import_zod14.z.union([Within, Exact])
1855
1796
  ),
1856
- "legalStatuses.REGISTERED.createdAtLocation": import_v4.z.optional(
1857
- import_v4.z.union([Within, Exact])
1797
+ "legalStatuses.REGISTERED.createdAtLocation": import_zod14.z.optional(
1798
+ import_zod14.z.union([Within, Exact])
1858
1799
  ),
1859
- "legalStatuses.REGISTERED.registrationNumber": import_v4.z.optional(Exact),
1860
- createdAtLocation: import_v4.z.optional(import_v4.z.union([Within, Exact])),
1861
- updatedAtLocation: import_v4.z.optional(import_v4.z.union([Within, Exact])),
1862
- assignedTo: import_v4.z.optional(Exact),
1863
- createdByUserType: import_v4.z.optional(ExactUserType),
1864
- createdBy: import_v4.z.optional(Exact),
1865
- updatedBy: import_v4.z.optional(Exact),
1866
- trackingId: import_v4.z.optional(Exact),
1867
- flags: import_v4.z.optional(ContainsFlags),
1800
+ "legalStatuses.REGISTERED.registrationNumber": import_zod14.z.optional(Exact),
1801
+ createdAtLocation: import_zod14.z.optional(import_zod14.z.union([Within, Exact])),
1802
+ updatedAtLocation: import_zod14.z.optional(import_zod14.z.union([Within, Exact])),
1803
+ assignedTo: import_zod14.z.optional(Exact),
1804
+ createdByUserType: import_zod14.z.optional(ExactUserType),
1805
+ createdBy: import_zod14.z.optional(Exact),
1806
+ updatedBy: import_zod14.z.optional(Exact),
1807
+ trackingId: import_zod14.z.optional(Exact),
1808
+ flags: import_zod14.z.optional(ContainsFlags),
1868
1809
  // @todo: The type for this comes out as "any"
1869
1810
  data: QueryInput
1870
1811
  }).partial().refine((obj) => Object.values(obj).some((val) => val !== void 0), {
1871
- error: "At least one query field must be specified."
1872
- }).meta({
1873
- id: "QueryExpression"
1812
+ message: "At least one query field must be specified."
1813
+ }).openapi({
1814
+ ref: "QueryExpression"
1874
1815
  });
1875
- var QueryType = import_v4.z.lazy(
1876
- () => import_v4.z.object({
1877
- type: import_v4.z.literal("and").or(import_v4.z.literal("or")).meta({ default: "and" }),
1878
- clauses: import_v4.z.array(import_v4.z.union([QueryExpression, QueryType])).nonempty("At least one clause is required.").meta({
1816
+ var QueryType = import_zod14.z.lazy(
1817
+ () => import_zod14.z.object({
1818
+ type: import_zod14.z.literal("and").or(import_zod14.z.literal("or")).openapi({ default: "and" }),
1819
+ clauses: import_zod14.z.array(import_zod14.z.union([QueryExpression, QueryType])).nonempty("At least one clause is required.").openapi({
1879
1820
  default: [
1880
1821
  {
1881
1822
  eventType: TENNIS_CLUB_MEMBERSHIP,
@@ -1893,8 +1834,8 @@ var QueryType = import_v4.z.lazy(
1893
1834
  ]
1894
1835
  })
1895
1836
  })
1896
- ).meta({
1897
- id: "QueryType"
1837
+ ).openapi({
1838
+ ref: "QueryType"
1898
1839
  });
1899
1840
  function parseStringifiedQueryField(val) {
1900
1841
  if (typeof val === "string") {
@@ -1902,8 +1843,8 @@ function parseStringifiedQueryField(val) {
1902
1843
  }
1903
1844
  return val;
1904
1845
  }
1905
- var SearchQuery = import_v4.z.object({
1906
- query: import_v4.z.preprocess(parseStringifiedQueryField, QueryType).meta({
1846
+ var SearchQuery = import_zod14.z.object({
1847
+ query: import_zod14.z.preprocess(parseStringifiedQueryField, QueryType).openapi({
1907
1848
  default: {
1908
1849
  type: "and",
1909
1850
  clauses: [
@@ -1923,19 +1864,19 @@ var SearchQuery = import_v4.z.object({
1923
1864
  ]
1924
1865
  }
1925
1866
  }),
1926
- limit: import_v4.z.number().optional().default(100),
1927
- offset: import_v4.z.number().optional().default(0),
1928
- sort: import_v4.z.preprocess(
1867
+ limit: import_zod14.z.number().optional().default(100),
1868
+ offset: import_zod14.z.number().optional().default(0),
1869
+ sort: import_zod14.z.preprocess(
1929
1870
  parseStringifiedQueryField,
1930
- import_v4.z.array(
1931
- import_v4.z.object({
1932
- field: import_v4.z.string(),
1933
- direction: import_v4.z.enum(["asc", "desc"]).default("asc")
1871
+ import_zod14.z.array(
1872
+ import_zod14.z.object({
1873
+ field: import_zod14.z.string(),
1874
+ direction: import_zod14.z.enum(["asc", "desc"]).default("asc")
1934
1875
  })
1935
1876
  )
1936
1877
  ).optional()
1937
- }).meta({
1938
- id: "SearchQuery"
1878
+ }).openapi({
1879
+ ref: "SearchQuery"
1939
1880
  });
1940
1881
  var SearchScopeAccessLevels = {
1941
1882
  MY_JURISDICTION: "my-jurisdiction",
@@ -1943,168 +1884,174 @@ var SearchScopeAccessLevels = {
1943
1884
  };
1944
1885
 
1945
1886
  // ../commons/src/events/FieldConfig.ts
1946
- var FieldId = z16.string().superRefine((val, ctx) => {
1947
- if (val.includes("_")) {
1948
- ctx.addIssue({
1949
- code: z16.ZodIssueCode.custom,
1950
- message: `id: '${val}' must not contain underscores '_'`
1951
- });
1952
- }
1953
- }).describe("Unique identifier for the field");
1954
- var FieldReference = z16.object({
1887
+ (0, import_zod_openapi6.extendZodWithOpenApi)(import_zod15.z);
1888
+ var FieldId = import_zod15.z.string().refine(
1889
+ /*
1890
+ * Disallow underscores '_' in field ids.
1891
+ * Why? Theres two reasons:
1892
+ * 1. We transform dots to underscores as separator in Formik field ids, so this avoids any issues with the Formik transformations.
1893
+ * 2. On Kysely-SQL queries, we use the CamelCasePlugin. This plugin transforms snake_case to camelCase also on nested (jsonb) object keys.
1894
+ * This could be disabled via 'maintainNestedObjectKeys: true', but this would also affect SQL queries which use e.g. json_agg() or to_jsonb() to aggregate results.
1895
+ */
1896
+ (val) => !val.includes("_"),
1897
+ (val) => ({
1898
+ message: `id: '${val}' must not contain underscores '_'`
1899
+ })
1900
+ ).describe("Unique identifier for the field");
1901
+ var FieldReference = import_zod15.z.object({
1955
1902
  $$field: FieldId,
1956
- $$subfield: z16.array(z16.string()).optional().describe(
1903
+ $$subfield: import_zod15.z.array(import_zod15.z.string()).optional().describe(
1957
1904
  'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
1958
1905
  )
1959
1906
  }).describe("Reference to a field by its ID");
1960
- var ValidationConfig = z16.object({
1907
+ var ValidationConfig = import_zod15.z.object({
1961
1908
  validator: Conditional,
1962
1909
  message: TranslationConfig
1963
1910
  });
1964
- var requiredSchema = z16.union([
1965
- z16.boolean(),
1966
- z16.object({
1911
+ var requiredSchema = import_zod15.z.union([
1912
+ import_zod15.z.boolean(),
1913
+ import_zod15.z.object({
1967
1914
  message: TranslationConfig.describe("Custom required validation message")
1968
1915
  })
1969
1916
  ]).default(false).optional();
1970
- var BaseField = z16.object({
1917
+ var BaseField = import_zod15.z.object({
1971
1918
  id: FieldId.describe("Unique identifier of the field."),
1972
1919
  label: TranslationConfig.describe("Human-readable label of the field."),
1973
- parent: FieldReference.or(z16.array(FieldReference)).optional().describe(
1920
+ parent: FieldReference.or(import_zod15.z.array(FieldReference)).optional().describe(
1974
1921
  "Reference to the parent field or fields. When a parent field changes, this field is reset."
1975
1922
  ),
1976
1923
  required: requiredSchema.describe(
1977
1924
  "Indicates whether the field is mandatory."
1978
1925
  ),
1979
- conditionals: z16.array(FieldConditional).default([]).optional().describe(
1926
+ conditionals: import_zod15.z.array(FieldConditional).default([]).optional().describe(
1980
1927
  "Conditions determining when the field is shown or enabled. By default, the field is always shown and enabled."
1981
1928
  ),
1982
- secured: z16.boolean().default(false).optional().describe(
1929
+ secured: import_zod15.z.boolean().default(false).optional().describe(
1983
1930
  "Indicates whether the field is secured. Secured fields are not indexed for search and are only visible when explicitly assigned."
1984
1931
  ),
1985
1932
  placeholder: TranslationConfig.optional(),
1986
- validation: z16.array(ValidationConfig).default([]).optional().describe("Additional validation rules applied to the field."),
1933
+ validation: import_zod15.z.array(ValidationConfig).default([]).optional().describe("Additional validation rules applied to the field."),
1987
1934
  helperText: TranslationConfig.optional(),
1988
- hideLabel: z16.boolean().default(false).optional(),
1989
- uncorrectable: z16.boolean().default(false).optional().describe(
1935
+ hideLabel: import_zod15.z.boolean().default(false).optional(),
1936
+ uncorrectable: import_zod15.z.boolean().default(false).optional().describe(
1990
1937
  "Indicates whether the field can be modified during record correction."
1991
1938
  ),
1992
- value: FieldReference.or(z16.array(FieldReference)).optional().describe(
1939
+ value: FieldReference.or(import_zod15.z.array(FieldReference)).optional().describe(
1993
1940
  "Reference to the source field or fields. When a value is defined, it is copied from the parent field when changed. If multiple references are provided, the first truthy value is used."
1994
1941
  ),
1995
- analytics: z16.boolean().default(false).optional().describe(
1942
+ analytics: import_zod15.z.boolean().default(false).optional().describe(
1996
1943
  "Indicates whether the field is included in analytics. When enabled, its value becomes available in the analytics dashboard."
1997
1944
  )
1998
1945
  }).describe("Common properties shared across all field types.");
1999
1946
  var Divider = BaseField.extend({
2000
- type: z16.literal(FieldType.DIVIDER)
1947
+ type: import_zod15.z.literal(FieldType.DIVIDER)
2001
1948
  });
2002
1949
  var TextField = BaseField.extend({
2003
- type: z16.literal(FieldType.TEXT),
1950
+ type: import_zod15.z.literal(FieldType.TEXT),
2004
1951
  defaultValue: NonEmptyTextValue.optional(),
2005
- configuration: z16.object({
2006
- maxLength: z16.number().optional().describe("Maximum length of the text"),
2007
- type: z16.enum(["text", "password"]).optional(),
1952
+ configuration: import_zod15.z.object({
1953
+ maxLength: import_zod15.z.number().optional().describe("Maximum length of the text"),
1954
+ type: import_zod15.z.enum(["text", "password"]).optional(),
2008
1955
  prefix: TranslationConfig.optional(),
2009
1956
  postfix: TranslationConfig.optional()
2010
1957
  }).default({ type: "text" }).optional()
2011
1958
  }).describe("Text input");
2012
1959
  var NumberField = BaseField.extend({
2013
- type: z16.literal(FieldType.NUMBER),
1960
+ type: import_zod15.z.literal(FieldType.NUMBER),
2014
1961
  defaultValue: NumberFieldValue.optional(),
2015
- configuration: z16.object({
2016
- min: z16.number().optional().describe("Minimum value"),
2017
- max: z16.number().optional().describe("Maximum value"),
1962
+ configuration: import_zod15.z.object({
1963
+ min: import_zod15.z.number().optional().describe("Minimum value"),
1964
+ max: import_zod15.z.number().optional().describe("Maximum value"),
2018
1965
  prefix: TranslationConfig.optional(),
2019
1966
  postfix: TranslationConfig.optional()
2020
1967
  }).optional()
2021
1968
  }).describe("Number input");
2022
1969
  var TextAreaField = BaseField.extend({
2023
- type: z16.literal(FieldType.TEXTAREA),
1970
+ type: import_zod15.z.literal(FieldType.TEXTAREA),
2024
1971
  defaultValue: NonEmptyTextValue.optional(),
2025
- configuration: z16.object({
2026
- maxLength: z16.number().optional().describe("Maximum length of the text"),
2027
- rows: z16.number().optional().describe("Number of visible text lines"),
2028
- cols: z16.number().optional().describe("Number of visible columns"),
1972
+ configuration: import_zod15.z.object({
1973
+ maxLength: import_zod15.z.number().optional().describe("Maximum length of the text"),
1974
+ rows: import_zod15.z.number().optional().describe("Number of visible text lines"),
1975
+ cols: import_zod15.z.number().optional().describe("Number of visible columns"),
2029
1976
  prefix: TranslationConfig.optional(),
2030
1977
  postfix: TranslationConfig.optional()
2031
1978
  }).default({ rows: 4 }).optional()
2032
1979
  }).describe("Multiline text input");
2033
- var ImageMimeType = z16.enum([
1980
+ var ImageMimeType = import_zod15.z.enum([
2034
1981
  "image/png",
2035
1982
  "image/jpg",
2036
1983
  "image/jpeg",
2037
1984
  "image/svg+xml"
2038
1985
  ]);
2039
- var DocumentMimeType = z16.enum([
1986
+ var DocumentMimeType = import_zod15.z.enum([
2040
1987
  "application/pdf",
2041
1988
  "application/msword",
2042
1989
  "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
2043
1990
  "application/vnd.oasis.opendocument.text"
2044
1991
  ]);
2045
- var MimeType = z16.enum([
1992
+ var MimeType = import_zod15.z.enum([
2046
1993
  ...ImageMimeType.options,
2047
1994
  ...DocumentMimeType.options
2048
1995
  ]);
2049
1996
  var DEFAULT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;
2050
1997
  var SignatureField = BaseField.extend({
2051
- type: z16.literal(FieldType.SIGNATURE),
1998
+ type: import_zod15.z.literal(FieldType.SIGNATURE),
2052
1999
  signaturePromptLabel: TranslationConfig.describe(
2053
2000
  "Title of the signature modal"
2054
2001
  ),
2055
2002
  defaultValue: SignatureFieldValue.optional(),
2056
- configuration: z16.object({
2057
- maxFileSize: z16.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
2003
+ configuration: import_zod15.z.object({
2004
+ maxFileSize: import_zod15.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
2058
2005
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
2059
2006
  }).default({
2060
2007
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
2061
2008
  })
2062
2009
  }).describe("Signature input field");
2063
2010
  var EmailField = BaseField.extend({
2064
- type: z16.literal(FieldType.EMAIL),
2065
- configuration: z16.object({
2066
- maxLength: z16.number().optional().describe("Maximum length of the text")
2067
- }).default({ maxLength: 255 }).optional(),
2011
+ type: import_zod15.z.literal(FieldType.EMAIL),
2012
+ configuration: import_zod15.z.object({
2013
+ maxLength: import_zod15.z.number().optional().describe("Maximum length of the text")
2014
+ }).default({ maxLength: 10 }).optional(),
2068
2015
  defaultValue: NonEmptyTextValue.optional()
2069
2016
  });
2070
2017
  var DateField = BaseField.extend({
2071
- type: z16.literal(FieldType.DATE),
2018
+ type: import_zod15.z.literal(FieldType.DATE),
2072
2019
  defaultValue: DateValue.optional(),
2073
- configuration: z16.object({
2020
+ configuration: import_zod15.z.object({
2074
2021
  notice: TranslationConfig.describe(
2075
2022
  "Text to display above the date input"
2076
2023
  ).optional()
2077
2024
  }).optional()
2078
2025
  }).describe("A single date input (yyyy-MM-dd)");
2079
2026
  var AgeField = BaseField.extend({
2080
- type: z16.literal(FieldType.AGE),
2027
+ type: import_zod15.z.literal(FieldType.AGE),
2081
2028
  defaultValue: NumberFieldValue.optional(),
2082
- configuration: z16.object({
2029
+ configuration: import_zod15.z.object({
2083
2030
  asOfDate: FieldReference,
2084
2031
  prefix: TranslationConfig.optional(),
2085
2032
  postfix: TranslationConfig.optional()
2086
2033
  })
2087
2034
  }).describe("An age input field which uses the current date as the asOfDate");
2088
2035
  var TimeField = BaseField.extend({
2089
- type: z16.literal(FieldType.TIME),
2036
+ type: import_zod15.z.literal(FieldType.TIME),
2090
2037
  defaultValue: TimeValue.optional(),
2091
- configuration: z16.object({
2092
- use12HourFormat: z16.boolean().optional().describe("Whether to use 12-hour format"),
2038
+ configuration: import_zod15.z.object({
2039
+ use12HourFormat: import_zod15.z.boolean().optional().describe("Whether to use 12-hour format"),
2093
2040
  notice: TranslationConfig.describe(
2094
2041
  "Text to display above the time input"
2095
2042
  ).optional()
2096
2043
  }).optional()
2097
2044
  }).describe("A single date input (HH-mm)");
2098
2045
  var DateRangeField = BaseField.extend({
2099
- type: z16.literal(FieldType.DATE_RANGE),
2046
+ type: import_zod15.z.literal(FieldType.DATE_RANGE),
2100
2047
  defaultValue: DateRangeFieldValue.optional(),
2101
- configuration: z16.object({
2048
+ configuration: import_zod15.z.object({
2102
2049
  notice: TranslationConfig.describe(
2103
2050
  "Text to display above the date input"
2104
2051
  ).optional()
2105
2052
  }).optional()
2106
2053
  }).describe("A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })");
2107
- var HtmlFontVariant = z16.enum([
2054
+ var HtmlFontVariant = import_zod15.z.enum([
2108
2055
  "reg12",
2109
2056
  "reg14",
2110
2057
  "reg16",
@@ -2114,31 +2061,31 @@ var HtmlFontVariant = z16.enum([
2114
2061
  "h2",
2115
2062
  "h1"
2116
2063
  ]);
2117
- var ParagraphConfiguration = z16.object({
2118
- styles: z16.object({
2064
+ var ParagraphConfiguration = import_zod15.z.object({
2065
+ styles: import_zod15.z.object({
2119
2066
  fontVariant: HtmlFontVariant.optional().describe(
2120
2067
  "Font variant to use for the paragraph text"
2121
2068
  ),
2122
- hint: z16.boolean().optional().describe("When true, paragraph is styled as a hint with grey color")
2069
+ hint: import_zod15.z.boolean().optional().describe("When true, paragraph is styled as a hint with grey color")
2123
2070
  }).optional()
2124
2071
  }).default({});
2125
2072
  var Paragraph = BaseField.extend({
2126
- type: z16.literal(FieldType.PARAGRAPH),
2073
+ type: import_zod15.z.literal(FieldType.PARAGRAPH),
2127
2074
  defaultValue: NonEmptyTextValue.optional(),
2128
2075
  configuration: ParagraphConfiguration
2129
2076
  }).describe("A read-only HTML <p> paragraph");
2130
2077
  var PageHeader = BaseField.extend({
2131
- type: z16.literal(FieldType.PAGE_HEADER),
2078
+ type: import_zod15.z.literal(FieldType.PAGE_HEADER),
2132
2079
  defaultValue: NonEmptyTextValue.optional()
2133
2080
  }).describe("A read-only header component for form pages");
2134
2081
  var File = BaseField.extend({
2135
- type: z16.literal(FieldType.FILE),
2082
+ type: import_zod15.z.literal(FieldType.FILE),
2136
2083
  defaultValue: FileFieldValue.optional(),
2137
- configuration: z16.object({
2138
- maxFileSize: z16.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
2084
+ configuration: import_zod15.z.object({
2085
+ maxFileSize: import_zod15.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
2139
2086
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
2140
- style: z16.object({
2141
- width: z16.enum(["full", "auto"]).optional().describe(
2087
+ style: import_zod15.z.object({
2088
+ width: import_zod15.z.enum(["full", "auto"]).optional().describe(
2142
2089
  "Whether the file upload button should take the full width of the container or not"
2143
2090
  )
2144
2091
  }).optional(),
@@ -2147,34 +2094,34 @@ var File = BaseField.extend({
2147
2094
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
2148
2095
  })
2149
2096
  }).describe("File upload");
2150
- var SelectOption = z16.object({
2151
- value: z16.string().describe("The value of the option"),
2152
- label: z16.union([z16.string(), TranslationConfig]).describe("The label of the option")
2097
+ var SelectOption = import_zod15.z.object({
2098
+ value: import_zod15.z.string().describe("The value of the option"),
2099
+ label: import_zod15.z.union([import_zod15.z.string(), TranslationConfig]).describe("The label of the option")
2153
2100
  });
2154
2101
  var RadioGroup = BaseField.extend({
2155
- type: z16.literal(FieldType.RADIO_GROUP),
2102
+ type: import_zod15.z.literal(FieldType.RADIO_GROUP),
2156
2103
  defaultValue: TextValue.optional(),
2157
- options: z16.array(SelectOption).describe("A list of options"),
2158
- configuration: z16.object({
2159
- styles: z16.object({
2160
- size: z16.enum(["NORMAL", "LARGE"]).optional()
2104
+ options: import_zod15.z.array(SelectOption).describe("A list of options"),
2105
+ configuration: import_zod15.z.object({
2106
+ styles: import_zod15.z.object({
2107
+ size: import_zod15.z.enum(["NORMAL", "LARGE"]).optional()
2161
2108
  }).optional()
2162
2109
  }).optional()
2163
2110
  }).describe("Grouped radio options");
2164
2111
  var BulletList = BaseField.extend({
2165
- type: z16.literal(FieldType.BULLET_LIST),
2112
+ type: import_zod15.z.literal(FieldType.BULLET_LIST),
2166
2113
  defaultValue: TextValue.optional(),
2167
- items: z16.array(TranslationConfig).describe("A list of items"),
2168
- configuration: z16.object({
2169
- styles: z16.object({
2114
+ items: import_zod15.z.array(TranslationConfig).describe("A list of items"),
2115
+ configuration: import_zod15.z.object({
2116
+ styles: import_zod15.z.object({
2170
2117
  fontVariant: HtmlFontVariant.optional()
2171
2118
  }).optional()
2172
2119
  }).default({})
2173
2120
  }).describe("A list of bullet points");
2174
2121
  var Select = BaseField.extend({
2175
- type: z16.literal(FieldType.SELECT),
2122
+ type: import_zod15.z.literal(FieldType.SELECT),
2176
2123
  defaultValue: TextValue.optional(),
2177
- options: z16.array(SelectOption).describe("A list of options"),
2124
+ options: import_zod15.z.array(SelectOption).describe("A list of options"),
2178
2125
  noOptionsMessage: TranslationConfig.optional().describe(
2179
2126
  `
2180
2127
  A translation configuration object used to display a message when no options are available.
@@ -2186,34 +2133,34 @@ var Select = BaseField.extend({
2186
2133
  `
2187
2134
  )
2188
2135
  }).describe("Select input");
2189
- var SelectDateRangeOption = z16.object({
2136
+ var SelectDateRangeOption = import_zod15.z.object({
2190
2137
  value: SelectDateRangeValue.describe("The value of the option"),
2191
2138
  label: TranslationConfig.describe("The label of the option")
2192
2139
  });
2193
2140
  var SelectDateRangeField = BaseField.extend({
2194
- type: z16.literal(FieldType.SELECT_DATE_RANGE),
2141
+ type: import_zod15.z.literal(FieldType.SELECT_DATE_RANGE),
2195
2142
  defaultValue: SelectDateRangeValue.optional(),
2196
- options: z16.array(SelectDateRangeOption).describe("A list of options")
2143
+ options: import_zod15.z.array(SelectDateRangeOption).describe("A list of options")
2197
2144
  }).describe("Select input with date range options");
2198
- var NameConfig = z16.object({
2199
- firstname: z16.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
2200
- middlename: z16.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
2201
- surname: z16.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional()
2145
+ var NameConfig = import_zod15.z.object({
2146
+ firstname: import_zod15.z.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
2147
+ middlename: import_zod15.z.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
2148
+ surname: import_zod15.z.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional()
2202
2149
  });
2203
2150
  var NameField = BaseField.extend({
2204
- type: z16.literal(FieldType.NAME),
2205
- defaultValue: z16.object({
2151
+ type: import_zod15.z.literal(FieldType.NAME),
2152
+ defaultValue: import_zod15.z.object({
2206
2153
  firstname: NonEmptyTextValue.optional(),
2207
2154
  middlename: NonEmptyTextValue.optional(),
2208
2155
  surname: NonEmptyTextValue.optional()
2209
2156
  }).optional(),
2210
- configuration: z16.object({
2157
+ configuration: import_zod15.z.object({
2211
2158
  name: NameConfig.default({
2212
2159
  firstname: { required: true },
2213
2160
  surname: { required: true }
2214
2161
  }).optional(),
2215
- order: z16.array(z16.enum(["firstname", "middlename", "surname"])).optional(),
2216
- maxLength: z16.number().optional().describe("Maximum length of the text"),
2162
+ order: import_zod15.z.array(import_zod15.z.enum(["firstname", "middlename", "surname"])).optional(),
2163
+ maxLength: import_zod15.z.number().optional().describe("Maximum length of the text"),
2217
2164
  prefix: TranslationConfig.optional(),
2218
2165
  postfix: TranslationConfig.optional()
2219
2166
  }).default({
@@ -2225,142 +2172,142 @@ var NameField = BaseField.extend({
2225
2172
  }).describe("Name input field");
2226
2173
  var PhoneField = BaseField.extend({
2227
2174
  defaultValue: NonEmptyTextValue.optional(),
2228
- type: z16.literal(FieldType.PHONE)
2175
+ type: import_zod15.z.literal(FieldType.PHONE)
2229
2176
  }).describe("Phone input field");
2230
2177
  var IdField = BaseField.extend({
2231
2178
  defaultValue: NonEmptyTextValue.optional(),
2232
- type: z16.literal(FieldType.ID)
2179
+ type: import_zod15.z.literal(FieldType.ID)
2233
2180
  }).describe("ID input field");
2234
2181
  var Checkbox = BaseField.extend({
2235
- type: z16.literal(FieldType.CHECKBOX),
2182
+ type: import_zod15.z.literal(FieldType.CHECKBOX),
2236
2183
  defaultValue: CheckboxFieldValue.default(false)
2237
2184
  }).describe("Boolean checkbox field");
2238
2185
  var Country = BaseField.extend({
2239
- type: z16.literal(FieldType.COUNTRY),
2186
+ type: import_zod15.z.literal(FieldType.COUNTRY),
2240
2187
  defaultValue: NonEmptyTextValue.optional()
2241
2188
  }).describe("Country select field");
2242
- var AdministrativeAreas = z16.enum([
2189
+ var AdministrativeAreas = import_zod15.z.enum([
2243
2190
  "ADMIN_STRUCTURE",
2244
2191
  "HEALTH_FACILITY",
2245
2192
  "CRVS_OFFICE"
2246
2193
  ]);
2247
- var AdministrativeAreaConfiguration = z16.object({
2248
- partOf: z16.object({
2249
- $declaration: z16.string()
2194
+ var AdministrativeAreaConfiguration = import_zod15.z.object({
2195
+ partOf: import_zod15.z.object({
2196
+ $declaration: import_zod15.z.string()
2250
2197
  }).optional().describe("Parent location"),
2251
2198
  type: AdministrativeAreas
2252
2199
  }).describe("Administrative area options");
2253
2200
  var AdministrativeArea = BaseField.extend({
2254
- type: z16.literal(FieldType.ADMINISTRATIVE_AREA),
2201
+ type: import_zod15.z.literal(FieldType.ADMINISTRATIVE_AREA),
2255
2202
  defaultValue: NonEmptyTextValue.optional(),
2256
2203
  configuration: AdministrativeAreaConfiguration
2257
2204
  }).describe("Administrative area input field e.g. facility, office");
2258
2205
  var LocationInput = BaseField.extend({
2259
- type: z16.literal(FieldType.LOCATION),
2206
+ type: import_zod15.z.literal(FieldType.LOCATION),
2260
2207
  defaultValue: NonEmptyTextValue.optional(),
2261
- configuration: z16.object({
2262
- searchableResource: z16.array(z16.enum(["locations", "facilities", "offices"]))
2208
+ configuration: import_zod15.z.object({
2209
+ searchableResource: import_zod15.z.array(import_zod15.z.enum(["locations", "facilities", "offices"]))
2263
2210
  })
2264
2211
  }).describe("Input field for a location");
2265
2212
  var FileUploadWithOptions = BaseField.extend({
2266
- type: z16.literal(FieldType.FILE_WITH_OPTIONS),
2267
- options: z16.array(SelectOption).describe("A list of options"),
2213
+ type: import_zod15.z.literal(FieldType.FILE_WITH_OPTIONS),
2214
+ options: import_zod15.z.array(SelectOption).describe("A list of options"),
2268
2215
  defaultValue: FileFieldWithOptionValue.optional(),
2269
- configuration: z16.object({
2270
- maxFileSize: z16.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
2216
+ configuration: import_zod15.z.object({
2217
+ maxFileSize: import_zod15.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
2271
2218
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
2272
2219
  }).default({
2273
2220
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
2274
2221
  })
2275
2222
  });
2276
2223
  var Facility = BaseField.extend({
2277
- type: z16.literal(FieldType.FACILITY),
2224
+ type: import_zod15.z.literal(FieldType.FACILITY),
2278
2225
  defaultValue: NonEmptyTextValue.optional()
2279
2226
  }).describe("Input field for a facility");
2280
2227
  var Office = BaseField.extend({
2281
- type: z16.literal(FieldType.OFFICE),
2228
+ type: import_zod15.z.literal(FieldType.OFFICE),
2282
2229
  defaultValue: NonEmptyTextValue.optional()
2283
2230
  }).describe("Input field for an office");
2284
2231
  var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
2285
- administrativeArea: z16.union([UUID, SerializedUserField]).optional()
2232
+ administrativeArea: import_zod15.z.union([UUID, SerializedUserField]).optional()
2286
2233
  });
2287
2234
  var Address = BaseField.extend({
2288
- type: z16.literal(FieldType.ADDRESS),
2289
- configuration: z16.object({
2290
- lineSeparator: z16.string().optional(),
2291
- fields: z16.array(z16.enum(["country", "administrativeArea"])).optional(),
2292
- administrativeLevels: z16.array(z16.string()).optional(),
2293
- streetAddressForm: z16.array(
2294
- z16.object({
2295
- id: z16.string(),
2235
+ type: import_zod15.z.literal(FieldType.ADDRESS),
2236
+ configuration: import_zod15.z.object({
2237
+ lineSeparator: import_zod15.z.string().optional(),
2238
+ fields: import_zod15.z.array(import_zod15.z.enum(["country", "administrativeArea"])).optional(),
2239
+ administrativeLevels: import_zod15.z.array(import_zod15.z.string()).optional(),
2240
+ streetAddressForm: import_zod15.z.array(
2241
+ import_zod15.z.object({
2242
+ id: import_zod15.z.string(),
2296
2243
  required: requiredSchema,
2297
2244
  label: TranslationConfig,
2298
- type: z16.literal(FieldType.TEXT),
2299
- conditionals: z16.array(FieldConditional).default([]).optional(),
2245
+ type: import_zod15.z.literal(FieldType.TEXT),
2246
+ conditionals: import_zod15.z.array(FieldConditional).default([]).optional(),
2300
2247
  parent: FieldReference.optional()
2301
2248
  })
2302
2249
  ).optional()
2303
2250
  }).optional(),
2304
2251
  defaultValue: DefaultAddressFieldValue.optional()
2305
2252
  }).describe("Address input field \u2013 a combination of location and text fields");
2306
- var StaticDataEntry = z16.object({
2307
- id: z16.string().describe("ID for the data entry."),
2253
+ var StaticDataEntry = import_zod15.z.object({
2254
+ id: import_zod15.z.string().describe("ID for the data entry."),
2308
2255
  label: TranslationConfig,
2309
- value: TranslationConfig.or(z16.string()).or(FieldReference)
2256
+ value: TranslationConfig.or(import_zod15.z.string()).or(FieldReference)
2310
2257
  }).describe("Static data entry");
2311
- var DataEntry = z16.union([StaticDataEntry, z16.object({ fieldId: z16.string() })]).describe(
2258
+ var DataEntry = import_zod15.z.union([StaticDataEntry, import_zod15.z.object({ fieldId: import_zod15.z.string() })]).describe(
2312
2259
  "Data entry can be either a static data entry, or a reference to another field in the current form or the declaration."
2313
2260
  );
2314
2261
  var DataField = BaseField.extend({
2315
- type: z16.literal(FieldType.DATA),
2316
- configuration: z16.object({
2262
+ type: import_zod15.z.literal(FieldType.DATA),
2263
+ configuration: import_zod15.z.object({
2317
2264
  subtitle: TranslationConfig.optional(),
2318
- data: z16.array(DataEntry)
2265
+ data: import_zod15.z.array(DataEntry)
2319
2266
  })
2320
2267
  }).describe("Data field for displaying read-only data");
2321
2268
  var ButtonField = BaseField.extend({
2322
- type: z16.literal(FieldType.BUTTON),
2269
+ type: import_zod15.z.literal(FieldType.BUTTON),
2323
2270
  defaultValue: ButtonFieldValue.optional(),
2324
- configuration: z16.object({
2325
- icon: z16.string().optional().describe(
2271
+ configuration: import_zod15.z.object({
2272
+ icon: import_zod15.z.string().optional().describe(
2326
2273
  "Icon for the button. You can find icons from OpenCRVS UI-Kit."
2327
2274
  ),
2328
- loading: z16.boolean().optional().describe("Whether the button is in a loading state and shows a spinner"),
2275
+ loading: import_zod15.z.boolean().optional().describe("Whether the button is in a loading state and shows a spinner"),
2329
2276
  text: TranslationConfig.describe("Text to display on the button")
2330
2277
  })
2331
2278
  }).describe("Generic button without any built-in functionality");
2332
2279
  var AlphaPrintButton = BaseField.extend({
2333
- type: z16.literal(FieldType.ALPHA_PRINT_BUTTON),
2334
- configuration: z16.object({
2335
- template: z16.string().describe("Template ID from countryconfig templates to use for printing"),
2280
+ type: import_zod15.z.literal(FieldType.ALPHA_PRINT_BUTTON),
2281
+ configuration: import_zod15.z.object({
2282
+ template: import_zod15.z.string().describe("Template ID from countryconfig templates to use for printing"),
2336
2283
  buttonLabel: TranslationConfig.optional().describe(
2337
2284
  "Label for the print button"
2338
2285
  )
2339
2286
  })
2340
2287
  }).describe("Print button field for printing certificates");
2341
2288
  var HttpField = BaseField.extend({
2342
- type: z16.literal(FieldType.HTTP),
2289
+ type: import_zod15.z.literal(FieldType.HTTP),
2343
2290
  defaultValue: HttpFieldValue.optional(),
2344
- configuration: z16.object({
2291
+ configuration: import_zod15.z.object({
2345
2292
  trigger: FieldReference,
2346
- url: z16.string().describe("URL to send the HTTP request to"),
2347
- method: z16.enum(["GET", "POST", "PUT", "DELETE"]),
2348
- headers: z16.record(z16.string(), z16.string()).optional(),
2349
- body: z16.record(z16.string(), z16.any()).optional(),
2350
- errorValue: z16.any().optional().describe("Value to set if the request fails"),
2351
- params: z16.record(z16.string(), z16.union([z16.string(), FieldReference])).optional(),
2352
- timeout: z16.number().default(15e3).describe("Request timeout in milliseconds")
2293
+ url: import_zod15.z.string().describe("URL to send the HTTP request to"),
2294
+ method: import_zod15.z.enum(["GET", "POST", "PUT", "DELETE"]),
2295
+ headers: import_zod15.z.record(import_zod15.z.string()).optional(),
2296
+ body: import_zod15.z.record(import_zod15.z.any()).optional(),
2297
+ errorValue: import_zod15.z.any().optional().describe("Value to set if the request fails"),
2298
+ params: import_zod15.z.record(import_zod15.z.string(), import_zod15.z.union([import_zod15.z.string(), FieldReference])).optional(),
2299
+ timeout: import_zod15.z.number().default(15e3).describe("Request timeout in milliseconds")
2353
2300
  })
2354
2301
  }).describe("HTTP request function triggered by a button click or other event");
2355
2302
  var SearchField = HttpField.extend({
2356
- type: z16.literal(FieldType.SEARCH),
2303
+ type: import_zod15.z.literal(FieldType.SEARCH),
2357
2304
  configuration: SearchQuery.pick({
2358
2305
  query: true,
2359
2306
  limit: true,
2360
2307
  offset: true
2361
2308
  }).extend({
2362
2309
  validation: ValidationConfig,
2363
- indicators: z16.object({
2310
+ indicators: import_zod15.z.object({
2364
2311
  loading: TranslationConfig.optional().describe(
2365
2312
  "Text to display while the search is in progress"
2366
2313
  ),
@@ -2375,7 +2322,7 @@ var SearchField = HttpField.extend({
2375
2322
  ),
2376
2323
  confirmButton: TranslationConfig.optional(),
2377
2324
  clearButton: TranslationConfig.optional(),
2378
- clearModal: z16.object({
2325
+ clearModal: import_zod15.z.object({
2379
2326
  title: TranslationConfig.optional(),
2380
2327
  description: TranslationConfig.optional(),
2381
2328
  cancel: TranslationConfig.optional(),
@@ -2386,17 +2333,17 @@ var SearchField = HttpField.extend({
2386
2333
  })
2387
2334
  });
2388
2335
  var LinkButtonField = BaseField.extend({
2389
- type: z16.literal(FieldType.LINK_BUTTON),
2390
- configuration: z16.object({
2391
- url: z16.string().describe("URL to open"),
2336
+ type: import_zod15.z.literal(FieldType.LINK_BUTTON),
2337
+ configuration: import_zod15.z.object({
2338
+ url: import_zod15.z.string().describe("URL to open"),
2392
2339
  text: TranslationConfig.describe("Text to display on the button"),
2393
- icon: z16.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
2340
+ icon: import_zod15.z.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
2394
2341
  })
2395
2342
  }).describe("Button that opens a link");
2396
2343
  var VerificationStatus = BaseField.extend({
2397
- type: z16.literal(FieldType.VERIFICATION_STATUS),
2344
+ type: import_zod15.z.literal(FieldType.VERIFICATION_STATUS),
2398
2345
  defaultValue: VerificationStatusValue.optional(),
2399
- configuration: z16.object({
2346
+ configuration: import_zod15.z.object({
2400
2347
  status: TranslationConfig.describe("Text to display on the status pill."),
2401
2348
  description: TranslationConfig.describe(
2402
2349
  "Explaining text on the banner in form."
@@ -2404,42 +2351,38 @@ var VerificationStatus = BaseField.extend({
2404
2351
  })
2405
2352
  });
2406
2353
  var QueryParamReaderField = BaseField.extend({
2407
- type: z16.literal(FieldType.QUERY_PARAM_READER),
2408
- configuration: z16.object({
2409
- pickParams: z16.array(z16.string()).describe("List of query parameters to read from the URL")
2354
+ type: import_zod15.z.literal(FieldType.QUERY_PARAM_READER),
2355
+ configuration: import_zod15.z.object({
2356
+ pickParams: import_zod15.z.array(import_zod15.z.string()).describe("List of query parameters to read from the URL")
2410
2357
  })
2411
2358
  }).describe(
2412
2359
  "A field that maps URL query params into form values and clears them afterward"
2413
2360
  );
2414
2361
  var QrReaderField = BaseField.extend({
2415
- type: z16.literal(FieldType.QR_READER),
2362
+ type: import_zod15.z.literal(FieldType.QR_READER),
2416
2363
  defaultValue: QrReaderFieldValue.optional(),
2417
- configuration: z16.object({
2418
- validator: z16.any().meta({
2419
- description: "JSON Schema to validate the scanned QR code data against before populating the form fields.",
2420
- id: "QrReaderFieldValidator"
2421
- })
2364
+ configuration: import_zod15.z.object({
2365
+ validator: import_zod15.z.custom(
2366
+ (val) => typeof val === "object" && val !== null
2367
+ )
2422
2368
  }).optional()
2423
- }).meta({
2424
- description: "Configuration for QR code reader field, including optional JSON Schema validator.",
2425
- id: "QrReaderField"
2426
2369
  });
2427
2370
  var IdReaderField = BaseField.extend({
2428
- type: z16.literal(FieldType.ID_READER),
2371
+ type: import_zod15.z.literal(FieldType.ID_READER),
2429
2372
  defaultValue: IdReaderFieldValue.optional(),
2430
- methods: z16.array(
2431
- z16.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
2373
+ methods: import_zod15.z.array(
2374
+ import_zod15.z.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
2432
2375
  )
2433
2376
  });
2434
2377
  var LoaderField = BaseField.extend({
2435
- type: z16.literal(FieldType.LOADER),
2436
- configuration: z16.object({
2378
+ type: import_zod15.z.literal(FieldType.LOADER),
2379
+ configuration: import_zod15.z.object({
2437
2380
  text: TranslationConfig.describe("Display text above the loading spinner")
2438
2381
  })
2439
2382
  }).describe(
2440
2383
  "A non-interactive field that indicates an in progress operation in form"
2441
2384
  );
2442
- var FieldConfig = z16.discriminatedUnion("type", [
2385
+ var FieldConfig = import_zod15.z.discriminatedUnion("type", [
2443
2386
  Address,
2444
2387
  TextField,
2445
2388
  NumberField,
@@ -2479,75 +2422,79 @@ var FieldConfig = z16.discriminatedUnion("type", [
2479
2422
  QueryParamReaderField,
2480
2423
  LoaderField,
2481
2424
  SearchField
2482
- ]).meta({
2425
+ ]).openapi({
2483
2426
  description: "Form field configuration",
2484
- id: "FieldConfig"
2427
+ ref: "FieldConfig"
2485
2428
  });
2486
- var AnyFileField = z16.discriminatedUnion("type", [
2429
+ var AnyFileField = import_zod15.z.discriminatedUnion("type", [
2487
2430
  SignatureField,
2488
2431
  File,
2489
2432
  FileUploadWithOptions
2490
2433
  ]);
2491
2434
 
2492
2435
  // ../commons/src/events/FormConfig.ts
2493
- var z18 = __toESM(require("zod/v4"));
2436
+ var import_zod17 = require("zod");
2494
2437
 
2495
2438
  // ../commons/src/events/PageConfig.ts
2496
- var z17 = __toESM(require("zod/v4"));
2497
- var PageTypes = z17.enum(["FORM", "VERIFICATION"]);
2498
- var PageConfigBase = z17.object({
2499
- id: z17.string().describe("Unique identifier for the page"),
2439
+ var import_zod16 = require("zod");
2440
+ var import_zod_openapi7 = require("zod-openapi");
2441
+ (0, import_zod_openapi7.extendZodWithOpenApi)(import_zod16.z);
2442
+ var PageTypes = import_zod16.z.enum(["FORM", "VERIFICATION"]);
2443
+ var PageConfigBase = import_zod16.z.object({
2444
+ id: import_zod16.z.string().describe("Unique identifier for the page"),
2500
2445
  title: TranslationConfig.describe("Header title of the page"),
2501
- fields: z17.array(FieldConfig).describe("Fields to be rendered on the page"),
2446
+ fields: import_zod16.z.array(FieldConfig).describe("Fields to be rendered on the page"),
2502
2447
  conditional: Conditional.optional().describe(
2503
2448
  "Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
2504
2449
  )
2505
- }).meta({
2450
+ }).openapi({
2506
2451
  description: "Form page configuration",
2507
- id: "FormPageConfig"
2452
+ ref: "FormPageConfig"
2508
2453
  });
2509
2454
  var FormPageConfig = PageConfigBase.extend({
2510
- type: z17.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
2455
+ type: import_zod16.z.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
2511
2456
  });
2512
- var VerificationActionConfig = z17.object({
2513
- verify: z17.object({ label: TranslationConfig }),
2514
- cancel: z17.object({
2457
+ var VerificationActionConfig = import_zod16.z.object({
2458
+ verify: import_zod16.z.object({ label: TranslationConfig }),
2459
+ cancel: import_zod16.z.object({
2515
2460
  label: TranslationConfig,
2516
- confirmation: z17.object({
2461
+ confirmation: import_zod16.z.object({
2517
2462
  title: TranslationConfig,
2518
2463
  body: TranslationConfig
2519
2464
  })
2520
2465
  })
2521
- }).describe("Actions available on the verification page").meta({
2466
+ }).describe("Actions available on the verification page").openapi({
2522
2467
  description: "Verification action configuration",
2523
- id: "VerificationActionConfig"
2468
+ ref: "VerificationActionConfig"
2524
2469
  });
2525
2470
  var VerificationPageConfig = FormPageConfig.extend({
2526
- type: z17.literal(PageTypes.enum.VERIFICATION),
2471
+ type: import_zod16.z.literal(PageTypes.enum.VERIFICATION),
2527
2472
  actions: VerificationActionConfig
2528
2473
  });
2529
- var PageConfig = z17.discriminatedUnion("type", [
2474
+ var PageConfig = import_zod16.z.discriminatedUnion("type", [
2530
2475
  FormPageConfig,
2531
2476
  VerificationPageConfig
2532
2477
  ]);
2533
2478
 
2534
2479
  // ../commons/src/events/FormConfig.ts
2535
- var DeclarationFormConfig = z18.object({
2480
+ var DeclarationFormConfig = import_zod17.z.object({
2536
2481
  label: TranslationConfig.describe("Human readable description of the form"),
2537
- pages: z18.array(FormPageConfig)
2482
+ pages: import_zod17.z.array(FormPageConfig)
2538
2483
  }).describe("Configuration of the declaration form.");
2539
- var ActionFormConfig = z18.object({
2484
+ var ActionFormConfig = import_zod17.z.object({
2540
2485
  label: TranslationConfig.describe("Human readable description of the form"),
2541
- pages: z18.array(PageConfig)
2486
+ pages: import_zod17.z.array(PageConfig)
2542
2487
  }).describe(
2543
2488
  "Configuration of the form used for system actions beyond declaration, supporting a wider range of page types."
2544
2489
  );
2545
- var FormConfig = z18.union([DeclarationFormConfig, ActionFormConfig]);
2490
+ var FormConfig = import_zod17.z.union([DeclarationFormConfig, ActionFormConfig]);
2546
2491
 
2547
2492
  // ../commons/src/events/DeduplicationConfig.ts
2548
- var z19 = __toESM(require("zod/v4"));
2549
- var FieldReference2 = z19.string();
2550
- var Matcher = z19.object({
2493
+ var import_zod18 = require("zod");
2494
+ var import_zod_openapi8 = require("zod-openapi");
2495
+ (0, import_zod_openapi8.extendZodWithOpenApi)(import_zod18.z);
2496
+ var FieldReference2 = import_zod18.z.string();
2497
+ var Matcher = import_zod18.z.object({
2551
2498
  /**
2552
2499
  * Reference to the field used in matching.
2553
2500
  *
@@ -2555,68 +2502,68 @@ var Matcher = z19.object({
2555
2502
  * be used as the origin date to calculate the distance from.
2556
2503
  */
2557
2504
  fieldId: FieldReference2,
2558
- options: z19.object({
2559
- boost: z19.number().optional()
2505
+ options: import_zod18.z.object({
2506
+ boost: import_zod18.z.number().optional()
2560
2507
  }).optional().default({
2561
2508
  boost: 1
2562
2509
  })
2563
2510
  });
2564
2511
  var FuzzyMatcher = Matcher.extend({
2565
- type: z19.literal("fuzzy"),
2566
- options: z19.object({
2512
+ type: import_zod18.z.literal("fuzzy"),
2513
+ options: import_zod18.z.object({
2567
2514
  /**
2568
2515
  * Names of length 3 or less characters = 0 edits allowed
2569
2516
  * Names of length 4 - 6 characters = 1 edit allowed
2570
2517
  * Names of length >7 characters = 2 edits allowed
2571
2518
  */
2572
- fuzziness: z19.union([z19.string(), z19.number()]).optional().default("AUTO:4,7"),
2573
- boost: z19.number().optional().default(1)
2519
+ fuzziness: import_zod18.z.union([import_zod18.z.string(), import_zod18.z.number()]).optional().default("AUTO:4,7"),
2520
+ boost: import_zod18.z.number().optional().default(1)
2574
2521
  }).optional().default({
2575
2522
  fuzziness: "AUTO:4,7",
2576
2523
  boost: 1
2577
2524
  })
2578
2525
  });
2579
2526
  var StrictMatcher = Matcher.extend({
2580
- type: z19.literal("strict"),
2581
- options: z19.object({
2582
- boost: z19.number().optional().default(1),
2527
+ type: import_zod18.z.literal("strict"),
2528
+ options: import_zod18.z.object({
2529
+ boost: import_zod18.z.number().optional().default(1),
2583
2530
  /**
2584
2531
  * The constant value to be present in the field for both records
2585
2532
  */
2586
- value: z19.string().optional()
2533
+ value: import_zod18.z.string().optional()
2587
2534
  }).optional().default({
2588
2535
  boost: 1
2589
2536
  })
2590
2537
  });
2591
2538
  var DateRangeMatcher = Matcher.extend({
2592
- type: z19.literal("dateRange"),
2593
- options: z19.object({
2539
+ type: import_zod18.z.literal("dateRange"),
2540
+ options: import_zod18.z.object({
2594
2541
  /**
2595
2542
  * The distance pivot in days. Distance from the origin (the value of
2596
2543
  * fieldId) at which relevance scores receive half of the boost value
2597
2544
  */
2598
- pivot: z19.number().optional(),
2599
- days: z19.number(),
2600
- boost: z19.number().optional().default(1)
2545
+ pivot: import_zod18.z.number().optional(),
2546
+ days: import_zod18.z.number(),
2547
+ boost: import_zod18.z.number().optional().default(1)
2601
2548
  })
2602
2549
  });
2603
- var Not = z19.object({
2604
- type: z19.literal("not"),
2550
+ var Not = import_zod18.z.object({
2551
+ type: import_zod18.z.literal("not"),
2605
2552
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
2606
- clause: z19.lazy(() => Clause)
2553
+ clause: import_zod18.z.lazy(() => Clause)
2607
2554
  });
2608
- var And = z19.object({
2609
- type: z19.literal("and"),
2555
+ var And = import_zod18.z.object({
2556
+ type: import_zod18.z.literal("and"),
2610
2557
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
2611
- clauses: z19.lazy(() => Clause.array())
2558
+ clauses: import_zod18.z.lazy(() => Clause.array())
2612
2559
  });
2613
- var Or = z19.object({
2614
- type: z19.literal("or"),
2560
+ var Or = import_zod18.z.object({
2561
+ type: import_zod18.z.literal("or"),
2615
2562
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
2616
- clauses: z19.lazy(() => Clause.array())
2563
+ clauses: import_zod18.z.lazy(() => Clause.array())
2617
2564
  });
2618
- var Clause = z19.lazy(
2619
- () => z19.discriminatedUnion("type", [
2565
+ var Clause = import_zod18.z.lazy(
2566
+ () => import_zod18.z.discriminatedUnion("type", [
2620
2567
  Not,
2621
2568
  And,
2622
2569
  Or,
@@ -2624,192 +2571,193 @@ var Clause = z19.lazy(
2624
2571
  StrictMatcher,
2625
2572
  DateRangeMatcher
2626
2573
  ])
2627
- ).meta({
2628
- id: "Clause"
2574
+ ).openapi({
2575
+ ref: "Clause"
2629
2576
  });
2630
- var DeduplicationConfig = z19.object({
2631
- id: z19.string(),
2577
+ var DeduplicationConfig = import_zod18.z.object({
2578
+ id: import_zod18.z.string(),
2632
2579
  label: TranslationConfig,
2633
2580
  query: Clause
2634
2581
  });
2635
2582
 
2636
2583
  // ../commons/src/events/ActionConfig.ts
2637
- var DeclarationReviewConfig = z20.object({
2584
+ var import_zod_openapi9 = require("zod-openapi");
2585
+ (0, import_zod_openapi9.extendZodWithOpenApi)(import_zod19.z);
2586
+ var DeclarationReviewConfig = import_zod19.z.object({
2638
2587
  title: TranslationConfig.describe("Title of the review page"),
2639
- fields: z20.array(FieldConfig).describe("Fields displayed on the review page for annotations.")
2588
+ fields: import_zod19.z.array(FieldConfig).describe("Fields displayed on the review page for annotations.")
2640
2589
  }).describe(
2641
2590
  "Configuration of the declaration review page for collecting event-related metadata."
2642
2591
  );
2643
- var ActionConfigBase = z20.object({
2644
- label: TranslationConfig.describe("Human readable description of the action"),
2645
- flags: z20.array(ActionFlagConfig).optional().default([]).describe("Flag actions which are executed when the action is performed."),
2646
- auditHistoryLabel: TranslationConfig.describe(
2647
- 'The label to show in audit history for this action. For example "Approved".'
2648
- ).optional(),
2649
- supportingCopy: TranslationConfig.optional().describe(
2650
- "Text displayed on the confirmation"
2651
- ),
2652
- conditionals: z20.array(ActionConditional).optional().describe("Conditionals which can disable or hide actions.")
2592
+ var ActionConfigBase = import_zod19.z.object({
2593
+ label: TranslationConfig.describe("Human readable description of the action")
2653
2594
  });
2654
2595
  var DeclarationActionBase = ActionConfigBase.extend({
2596
+ review: DeclarationReviewConfig,
2655
2597
  deduplication: DeduplicationConfig.optional()
2656
2598
  });
2657
- var ReadActionConfig = ActionConfigBase.extend(
2658
- z20.object({
2659
- type: z20.literal(ActionType.READ),
2599
+ var ReadActionConfig = ActionConfigBase.merge(
2600
+ import_zod19.z.object({
2601
+ type: import_zod19.z.literal(ActionType.READ),
2660
2602
  review: DeclarationReviewConfig.describe(
2661
2603
  "Configuration of the review page for read-only view."
2662
- ),
2663
- conditionals: z20.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
2664
- }).shape
2665
- );
2666
- var DeclareConfig = DeclarationActionBase.extend(
2667
- z20.object({
2668
- type: z20.literal(ActionType.DECLARE),
2669
- review: DeclarationReviewConfig.describe(
2670
- "Configuration of the review page fields."
2671
2604
  )
2672
- }).shape
2605
+ })
2673
2606
  );
2674
- var RejectConfig = ActionConfigBase.extend(
2675
- z20.object({
2676
- type: z20.literal(ActionType.REJECT)
2677
- }).shape
2607
+ var DeclareConfig = DeclarationActionBase.merge(
2608
+ import_zod19.z.object({
2609
+ type: import_zod19.z.literal(ActionType.DECLARE)
2610
+ })
2611
+ );
2612
+ var ValidateConfig = DeclarationActionBase.merge(
2613
+ import_zod19.z.object({
2614
+ type: import_zod19.z.literal(ActionType.VALIDATE)
2615
+ })
2678
2616
  );
2679
- var ValidateConfig = DeclarationActionBase.extend(
2680
- z20.object({
2681
- type: z20.literal(ActionType.VALIDATE)
2682
- }).shape
2617
+ var RegisterConfig = DeclarationActionBase.merge(
2618
+ import_zod19.z.object({
2619
+ type: import_zod19.z.literal(ActionType.REGISTER)
2620
+ })
2683
2621
  );
2684
- var RegisterConfig = DeclarationActionBase.extend(
2685
- z20.object({
2686
- type: z20.literal(ActionType.REGISTER)
2687
- }).shape
2622
+ var RejectDeclarationConfig = ActionConfigBase.merge(
2623
+ import_zod19.z.object({
2624
+ type: import_zod19.z.literal(ActionType.REJECT)
2625
+ })
2688
2626
  );
2689
- var PrintCertificateActionConfig = ActionConfigBase.extend(
2690
- z20.object({
2691
- type: z20.literal(ActionType.PRINT_CERTIFICATE),
2627
+ var ArchiveConfig = ActionConfigBase.merge(
2628
+ import_zod19.z.object({
2629
+ type: import_zod19.z.literal(ActionType.ARCHIVE)
2630
+ })
2631
+ );
2632
+ var DeleteConfig = ActionConfigBase.merge(
2633
+ import_zod19.z.object({
2634
+ type: import_zod19.z.literal(ActionType.DELETE)
2635
+ })
2636
+ );
2637
+ var PrintCertificateActionConfig = ActionConfigBase.merge(
2638
+ import_zod19.z.object({
2639
+ type: import_zod19.z.literal(ActionType.PRINT_CERTIFICATE),
2692
2640
  printForm: ActionFormConfig
2693
- }).shape
2641
+ })
2694
2642
  );
2695
- var RequestCorrectionConfig = ActionConfigBase.extend(
2696
- z20.object({
2697
- type: z20.literal(ActionType.REQUEST_CORRECTION),
2643
+ var RequestCorrectionConfig = ActionConfigBase.merge(
2644
+ import_zod19.z.object({
2645
+ type: import_zod19.z.literal(ActionType.REQUEST_CORRECTION),
2698
2646
  correctionForm: ActionFormConfig
2699
- }).shape
2647
+ })
2700
2648
  );
2701
- var CustomActionConfig = ActionConfigBase.merge(
2702
- z20.object({
2703
- type: z20.literal(ActionType.CUSTOM),
2704
- customActionType: z20.string().describe("Type identifier of the custom action."),
2705
- /** Custom action form configuration supports a simple array of field configs, which should be rendered on the action modal. In the future, we might add support for pages etc. */
2706
- form: z20.array(FieldConfig).describe(
2707
- "Form configuration for the custom action. The form configured here will be used on the custom action confirmation modal."
2708
- )
2649
+ var RejectCorrectionConfig = ActionConfigBase.merge(
2650
+ import_zod19.z.object({
2651
+ type: import_zod19.z.literal(ActionType.REJECT_CORRECTION)
2652
+ })
2653
+ );
2654
+ var ApproveCorrectionConfig = ActionConfigBase.merge(
2655
+ import_zod19.z.object({
2656
+ type: import_zod19.z.literal(ActionType.APPROVE_CORRECTION)
2709
2657
  })
2710
2658
  );
2711
- var ActionConfig = z20.discriminatedUnion("type", [
2659
+ var ActionConfig = import_zod19.z.discriminatedUnion("type", [
2712
2660
  /*
2713
2661
  * OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
2714
2662
  * and treat them as "models" instead of duplicating the data structure in each endpoint.
2715
2663
  */
2716
- ReadActionConfig.meta({ id: "ReadActionConfig" }),
2717
- DeclareConfig.meta({ id: "DeclareActionConfig" }),
2718
- RejectConfig.meta({ id: "RejectActionConfig" }),
2719
- ValidateConfig.meta({ id: "ValidateActionConfig" }),
2720
- RegisterConfig.meta({ id: "RegisterActionConfig" }),
2721
- PrintCertificateActionConfig.meta({
2722
- id: "PrintCertificateActionConfig"
2664
+ ReadActionConfig.openapi({ ref: "ReadActionConfig" }),
2665
+ DeclareConfig.openapi({ ref: "DeclareActionConfig" }),
2666
+ ValidateConfig.openapi({ ref: "ValidateActionConfig" }),
2667
+ RejectDeclarationConfig.openapi({ ref: "RejectDeclarationActionConfig" }),
2668
+ ArchiveConfig.openapi({ ref: "ArchiveActionConfig" }),
2669
+ RegisterConfig.openapi({ ref: "RegisterActionConfig" }),
2670
+ DeleteConfig.openapi({ ref: "DeleteActionConfig" }),
2671
+ PrintCertificateActionConfig.openapi({
2672
+ ref: "PrintCertificateActionConfig"
2723
2673
  }),
2724
- RequestCorrectionConfig.meta({ id: "RequestCorrectionActionConfig" }),
2725
- CustomActionConfig.meta({ id: "CustomActionConfig" })
2674
+ RequestCorrectionConfig.openapi({ ref: "RequestCorrectionActionConfig" }),
2675
+ RejectCorrectionConfig.openapi({ ref: "RejectCorrectionActionConfig" }),
2676
+ ApproveCorrectionConfig.openapi({ ref: "ApproveCorrectionActionConfig" })
2726
2677
  ]).describe(
2727
2678
  "Configuration of an action available for an event. Data collected depends on the action type and is accessible through the annotation property in ActionDocument."
2728
- ).meta({ id: "ActionConfig" });
2729
- var actionConfigTypes = new Set(
2730
- ActionConfig.options.map((opt) => opt.shape.type.value)
2731
- );
2732
- var DeclarationActionConfig = z20.discriminatedUnion("type", [
2679
+ ).openapi({ ref: "ActionConfig" });
2680
+ var DeclarationActionConfig = import_zod19.z.discriminatedUnion("type", [
2733
2681
  DeclareConfig,
2734
2682
  ValidateConfig,
2735
2683
  RegisterConfig
2736
2684
  ]);
2737
2685
 
2738
2686
  // ../commons/src/events/offline/CertificateConfig.ts
2739
- var z21 = __toESM(require("zod/v4"));
2740
- var FontFamily = z21.object({
2741
- normal: z21.string(),
2742
- bold: z21.string(),
2743
- italics: z21.string(),
2744
- bolditalics: z21.string()
2687
+ var import_zod20 = require("zod");
2688
+ var FontFamily = import_zod20.z.object({
2689
+ normal: import_zod20.z.string(),
2690
+ bold: import_zod20.z.string(),
2691
+ italics: import_zod20.z.string(),
2692
+ bolditalics: import_zod20.z.string()
2745
2693
  });
2746
- var CertificateConfig = z21.object({
2747
- id: z21.string(),
2748
- event: z21.string(),
2749
- isV2Template: z21.boolean().optional(),
2694
+ var CertificateConfig = import_zod20.z.object({
2695
+ id: import_zod20.z.string(),
2696
+ event: import_zod20.z.string(),
2697
+ isV2Template: import_zod20.z.boolean().optional(),
2750
2698
  label: TranslationConfig,
2751
- isDefault: z21.boolean(),
2752
- fee: z21.object({
2753
- onTime: z21.number(),
2754
- late: z21.number(),
2755
- delayed: z21.number()
2699
+ isDefault: import_zod20.z.boolean(),
2700
+ fee: import_zod20.z.object({
2701
+ onTime: import_zod20.z.number(),
2702
+ late: import_zod20.z.number(),
2703
+ delayed: import_zod20.z.number()
2756
2704
  }),
2757
- svgUrl: z21.string(),
2758
- fonts: z21.record(z21.string(), FontFamily).optional(),
2759
- conditionals: z21.array(ShowConditional).optional()
2705
+ svgUrl: import_zod20.z.string(),
2706
+ fonts: import_zod20.z.record(FontFamily).optional(),
2707
+ conditionals: import_zod20.z.array(ShowConditional).optional()
2760
2708
  });
2761
2709
  var CertificateTemplateConfig = CertificateConfig.extend({
2762
- hash: z21.string().optional(),
2763
- svg: z21.string()
2710
+ hash: import_zod20.z.string().optional(),
2711
+ svg: import_zod20.z.string()
2764
2712
  });
2765
2713
 
2766
2714
  // ../commons/src/events/offline/LanguageConfig.ts
2767
- var z22 = __toESM(require("zod/v4"));
2768
- var LanguageConfig = z22.object({
2769
- lang: z22.string(),
2715
+ var import_zod21 = require("zod");
2716
+ var LanguageConfig = import_zod21.z.object({
2717
+ lang: import_zod21.z.string(),
2770
2718
  /**
2771
2719
  * client.csv contents
2772
2720
  */
2773
- messages: z22.record(z22.string(), z22.string())
2721
+ messages: import_zod21.z.record(import_zod21.z.string())
2774
2722
  });
2775
2723
 
2776
2724
  // ../commons/src/events/EventConfig.ts
2777
- var z28 = __toESM(require("zod/v4"));
2725
+ var import_zod26 = require("zod");
2778
2726
 
2779
2727
  // ../commons/src/events/SummaryConfig.ts
2780
- var z23 = __toESM(require("zod/v4"));
2781
- var BaseField2 = z23.object({
2728
+ var import_zod22 = require("zod");
2729
+ var BaseField2 = import_zod22.z.object({
2782
2730
  emptyValueMessage: TranslationConfig.optional().describe(
2783
2731
  "Default message displayed when the field value is empty."
2784
2732
  ),
2785
- conditionals: z23.array(ShowConditional).default([]).optional()
2733
+ conditionals: import_zod22.z.array(ShowConditional).default([]).optional()
2786
2734
  });
2787
2735
  var ReferenceField = BaseField2.extend({
2788
- fieldId: z23.string(),
2736
+ fieldId: import_zod22.z.string(),
2789
2737
  label: TranslationConfig.optional().describe(
2790
2738
  "Overrides the default label from the referenced field when provided."
2791
2739
  )
2792
2740
  }).describe("Field referencing existing event data by field ID.");
2793
2741
  var Field = BaseField2.extend({
2794
- id: z23.string().describe("Identifier of the summary field."),
2742
+ id: import_zod22.z.string().describe("Identifier of the summary field."),
2795
2743
  value: TranslationConfig.describe(
2796
2744
  'Field value template supporting variables from configuration and EventMetadata (e.g. "{informant.phoneNo} {informant.email}").'
2797
2745
  ),
2798
2746
  label: TranslationConfig
2799
2747
  }).describe("Custom field defined for the summary view.");
2800
- var SummaryConfig = z23.object({
2801
- fields: z23.array(z23.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
2748
+ var SummaryConfig = import_zod22.z.object({
2749
+ fields: import_zod22.z.array(import_zod22.z.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
2802
2750
  }).describe("Configuration of the event summary section.");
2803
2751
 
2804
2752
  // ../commons/src/events/AdvancedSearchConfig.ts
2805
- var z24 = __toESM(require("zod/v4"));
2806
- var MatchType = z24.enum(["fuzzy", "exact", "range", "within"]);
2807
- var BaseField3 = z24.object({
2808
- config: z24.object({
2753
+ var import_zod23 = require("zod");
2754
+ var MatchType = import_zod23.z.enum(["fuzzy", "exact", "range", "within"]);
2755
+ var BaseField3 = import_zod23.z.object({
2756
+ config: import_zod23.z.object({
2809
2757
  type: MatchType.describe(
2810
2758
  "Determines the search type of field. How to match value."
2811
2759
  ),
2812
- searchFields: z24.array(z24.string()).optional().describe(
2760
+ searchFields: import_zod23.z.array(import_zod23.z.string()).optional().describe(
2813
2761
  `
2814
2762
  Defines multiple form fields that should be searched when this field has a value.
2815
2763
  All specified fields will be combined using OR logic.
@@ -2819,7 +2767,7 @@ var BaseField3 = z24.object({
2819
2767
  `
2820
2768
  )
2821
2769
  }),
2822
- type: z24.nativeEnum(FieldType).optional().describe(
2770
+ type: import_zod23.z.nativeEnum(FieldType).optional().describe(
2823
2771
  `
2824
2772
  Explicitly specify the field type for searchFields.
2825
2773
  This is required when searchFields is defined, to show the correct control in the UI.
@@ -2833,7 +2781,7 @@ var BaseField3 = z24.object({
2833
2781
  This is required when searchFields is defined.
2834
2782
  `
2835
2783
  ),
2836
- options: z24.array(SelectOption).optional(),
2784
+ options: import_zod23.z.array(SelectOption).optional(),
2837
2785
  searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
2838
2786
  `
2839
2787
  This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
@@ -2854,7 +2802,7 @@ var BaseField3 = z24.object({
2854
2802
  in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
2855
2803
  `
2856
2804
  ),
2857
- conditionals: z24.array(FieldConditional).optional().describe(
2805
+ conditionals: import_zod23.z.array(FieldConditional).default([]).optional().describe(
2858
2806
  `
2859
2807
  In advanced search, we sometimes need to override the default field visibility conditionals.
2860
2808
 
@@ -2868,20 +2816,20 @@ var BaseField3 = z24.object({
2868
2816
  are always rendered in the advanced search form.
2869
2817
  `
2870
2818
  ),
2871
- validations: z24.array(ValidationConfig).optional().describe(
2819
+ validations: import_zod23.z.array(ValidationConfig).default([]).optional().describe(
2872
2820
  `Option for overriding the field validations specifically for advanced search form.`
2873
2821
  )
2874
2822
  });
2875
- var SearchQueryParams = z24.object({
2876
- eventType: z24.string().optional().describe(
2823
+ var SearchQueryParams = import_zod23.z.object({
2824
+ eventType: import_zod23.z.string().optional().describe(
2877
2825
  "Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
2878
2826
  )
2879
2827
  }).catchall(FieldValue);
2880
2828
  var FieldConfigSchema = BaseField3.extend({
2881
- fieldId: z24.string(),
2882
- fieldType: z24.literal("field")
2829
+ fieldId: import_zod23.z.string(),
2830
+ fieldType: import_zod23.z.literal("field")
2883
2831
  });
2884
- var EventFieldIdInput = z24.enum([
2832
+ var EventFieldIdInput = import_zod23.z.enum([
2885
2833
  "trackingId",
2886
2834
  "status",
2887
2835
  "legalStatuses.REGISTERED.acceptedAt",
@@ -2889,7 +2837,7 @@ var EventFieldIdInput = z24.enum([
2889
2837
  "updatedAt"
2890
2838
  ]);
2891
2839
  var METADATA_FIELD_PREFIX = "event.";
2892
- var EventFieldId = z24.enum([
2840
+ var EventFieldId = import_zod23.z.enum([
2893
2841
  `${METADATA_FIELD_PREFIX}trackingId`,
2894
2842
  `${METADATA_FIELD_PREFIX}status`,
2895
2843
  `${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
@@ -2898,29 +2846,29 @@ var EventFieldId = z24.enum([
2898
2846
  ]);
2899
2847
  var EventFieldConfigSchema = BaseField3.extend({
2900
2848
  fieldId: EventFieldId,
2901
- fieldType: z24.literal("event")
2849
+ fieldType: import_zod23.z.literal("event")
2902
2850
  });
2903
- var AdvancedSearchField = z24.discriminatedUnion("fieldType", [FieldConfigSchema, EventFieldConfigSchema]).superRefine((data, ctx) => {
2851
+ var AdvancedSearchField = import_zod23.z.discriminatedUnion("fieldType", [FieldConfigSchema, EventFieldConfigSchema]).superRefine((data, ctx) => {
2904
2852
  if (data.config.searchFields && data.config.searchFields.length > 0) {
2905
2853
  if (!data.label) {
2906
2854
  ctx.addIssue({
2907
- code: z24.ZodIssueCode.custom,
2855
+ code: import_zod23.z.ZodIssueCode.custom,
2908
2856
  message: "label is required when config.searchFields is defined.",
2909
2857
  path: ["label"]
2910
2858
  });
2911
2859
  }
2912
2860
  if (!data.type) {
2913
2861
  ctx.addIssue({
2914
- code: z24.ZodIssueCode.custom,
2862
+ code: import_zod23.z.ZodIssueCode.custom,
2915
2863
  message: "type is required when config.searchFields is defined.",
2916
2864
  path: ["type"]
2917
2865
  });
2918
2866
  }
2919
2867
  }
2920
2868
  });
2921
- var AdvancedSearchConfig = z24.object({
2869
+ var AdvancedSearchConfig = import_zod23.z.object({
2922
2870
  title: TranslationConfig.describe("Advanced search tab title"),
2923
- fields: z24.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
2871
+ fields: import_zod23.z.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
2924
2872
  });
2925
2873
 
2926
2874
  // ../commons/src/events/utils.ts
@@ -2929,14 +2877,14 @@ var import_lodash = require("lodash");
2929
2877
  // ../commons/src/conditionals/validate.ts
2930
2878
  var import__ = __toESM(require("ajv/dist/2019"));
2931
2879
  var import_ajv_formats = __toESM(require("ajv-formats"));
2932
- var z26 = __toESM(require("zod/v4"));
2880
+ var import_zod25 = require("zod");
2933
2881
  var import_date_fns = require("date-fns");
2934
2882
 
2935
2883
  // ../commons/src/events/DynamicFieldValue.ts
2936
- var z25 = __toESM(require("zod/v4"));
2884
+ var import_zod24 = require("zod");
2937
2885
  function getDynamicNameValue(field3) {
2938
2886
  const nameConfiguration = field3.configuration?.name;
2939
- return z25.object({
2887
+ return import_zod24.z.object({
2940
2888
  firstname: nameConfiguration?.firstname?.required ? NonEmptyTextValue : TextValue,
2941
2889
  surname: nameConfiguration?.surname?.required ? NonEmptyTextValue : TextValue,
2942
2890
  middlename: nameConfiguration?.middlename?.required ? NonEmptyTextValue : TextValue.optional()
@@ -2946,10 +2894,7 @@ function getDynamicAddressFieldValue(field3) {
2946
2894
  const schema = field3.required ? AddressFieldValue : AddressFieldUpdateValue;
2947
2895
  const configIds = field3.configuration?.streetAddressForm?.map((a) => a.id) ?? [];
2948
2896
  return schema.refine((arg) => {
2949
- if (!arg) {
2950
- return true;
2951
- }
2952
- const submittedKeys = Object.keys(arg.streetLevelDetails ?? {});
2897
+ const submittedKeys = Object.keys(arg?.streetLevelDetails ?? {});
2953
2898
  const invalidKeys = submittedKeys.filter((k) => !configIds.includes(k));
2954
2899
  if (invalidKeys.length) {
2955
2900
  console.log(
@@ -3232,9 +3177,9 @@ var ajv = new import__.default({
3232
3177
  strict: false
3233
3178
  // Allow minContains and other newer features
3234
3179
  });
3235
- var DataContext = z26.object({
3236
- rootData: z26.object({
3237
- $leafAdminStructureLocationIds: z26.array(z26.object({ id: UUID }))
3180
+ var DataContext = import_zod25.z.object({
3181
+ rootData: import_zod25.z.object({
3182
+ $leafAdminStructureLocationIds: import_zod25.z.array(import_zod25.z.object({ id: UUID }))
3238
3183
  })
3239
3184
  });
3240
3185
  (0, import_ajv_formats.default)(ajv);
@@ -3314,15 +3259,13 @@ function isOnline() {
3314
3259
  }
3315
3260
  return true;
3316
3261
  }
3317
- function isConditionMet(conditional, values, context, eventIndex) {
3262
+ function isConditionMet(conditional, values, context) {
3318
3263
  return validate(conditional, {
3319
3264
  $form: values,
3320
3265
  $now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
3321
3266
  $online: isOnline(),
3322
3267
  $user: context.user,
3323
- $leafAdminStructureLocationIds: context.leafAdminStructureLocationIds ?? [],
3324
- $flags: eventIndex?.flags ?? [],
3325
- $status: eventIndex?.status
3268
+ $leafAdminStructureLocationIds: context.leafAdminStructureLocationIds ?? []
3326
3269
  });
3327
3270
  }
3328
3271
  function getConditionalActionsForField(field3, values) {
@@ -3331,9 +3274,9 @@ function getConditionalActionsForField(field3, values) {
3331
3274
  }
3332
3275
  return field3.conditionals.filter((conditional) => validate(conditional.conditional, values)).map((conditional) => conditional.type);
3333
3276
  }
3334
- function areConditionsMet(conditions, values, context, event2) {
3277
+ function areConditionsMet(conditions, values, context) {
3335
3278
  return conditions.every(
3336
- (condition) => isConditionMet(condition.conditional, values, context, event2)
3279
+ (condition) => isConditionMet(condition.conditional, values, context)
3337
3280
  );
3338
3281
  }
3339
3282
  function isFieldConditionMet(field3, form, conditionalType, context) {
@@ -3365,37 +3308,6 @@ function isFieldEnabled(field3, form, context) {
3365
3308
  function isFieldDisplayedOnReview(field3, form, context) {
3366
3309
  return isFieldVisible(field3, form, context) && isFieldConditionMet(field3, form, ConditionalType.DISPLAY_ON_REVIEW, context);
3367
3310
  }
3368
- function isActionConditionMet(actionConfig, event2, context, conditionalType) {
3369
- if (!actionConfig.conditionals) {
3370
- return true;
3371
- }
3372
- const rule = actionConfig.conditionals.find(
3373
- (conditional) => conditional.type === conditionalType
3374
- );
3375
- if (!rule) {
3376
- return true;
3377
- }
3378
- return isConditionMet(rule.conditional, event2.declaration, context, event2);
3379
- }
3380
- function isActionEnabled(actionConfig, event2, context) {
3381
- return isActionConditionMet(
3382
- actionConfig,
3383
- event2,
3384
- context,
3385
- ConditionalType.ENABLE
3386
- );
3387
- }
3388
- function isActionVisible(actionConfig, event2, context) {
3389
- return isActionConditionMet(
3390
- actionConfig,
3391
- event2,
3392
- context,
3393
- ConditionalType.SHOW
3394
- );
3395
- }
3396
- function isActionAvailable(actionConfig, event2, context) {
3397
- return isActionVisible(actionConfig, event2, context) && isActionEnabled(actionConfig, event2, context);
3398
- }
3399
3311
  var errorMessages = {
3400
3312
  hiddenField: {
3401
3313
  id: "error.hidden",
@@ -3440,51 +3352,43 @@ function createIntlError(message) {
3440
3352
  }
3441
3353
  };
3442
3354
  }
3443
- function zodToIntlErrorMap(issue, value, field3) {
3355
+ function zodToIntlErrorMap(issue, _ctx, field3) {
3444
3356
  const requiredMessage = field3.required && typeof field3.required === "object" ? field3.required.message : errorMessages.requiredField;
3445
3357
  switch (issue.code) {
3446
- case "too_small": {
3447
- if (issue.message === void 0) {
3358
+ case "invalid_string": {
3359
+ if (_ctx.data === "") {
3448
3360
  return createIntlError(requiredMessage);
3449
3361
  }
3362
+ if (issue.validation === "date") {
3363
+ return createIntlError(errorMessages.invalidDate);
3364
+ }
3365
+ if (issue.validation === "email") {
3366
+ return createIntlError(errorMessages.invalidEmail);
3367
+ }
3450
3368
  break;
3451
3369
  }
3452
3370
  case "invalid_type": {
3453
- if (issue.hasOwnProperty("input") && (issue.input === void 0 || issue.input === null)) {
3371
+ if (issue.expected !== issue.received && (issue.received === "undefined" || issue.received === "null")) {
3454
3372
  return createIntlError(requiredMessage);
3455
3373
  }
3456
- return createIntlError(errorMessages.invalidInput);
3374
+ break;
3375
+ }
3376
+ case "too_small": {
3377
+ if (issue.message === void 0) {
3378
+ return createIntlError(requiredMessage);
3379
+ }
3380
+ break;
3457
3381
  }
3458
3382
  case "invalid_union": {
3459
- for (const unionError of issue.errors) {
3460
- for (const e of unionError) {
3461
- const intlErr = zodToIntlErrorMap(e, value, field3);
3462
- if (intlErr.message.message.id !== "error.required") {
3383
+ for (const { issues } of issue.unionErrors) {
3384
+ for (const e of issues) {
3385
+ if (zodToIntlErrorMap(e, _ctx, field3).message.message.id !== "error.required") {
3463
3386
  return createIntlError(errorMessages.invalidInput);
3464
3387
  }
3465
3388
  }
3466
3389
  }
3467
3390
  return createIntlError(requiredMessage);
3468
3391
  }
3469
- case "invalid_format":
3470
- if (value === "") {
3471
- return createIntlError(requiredMessage);
3472
- }
3473
- if (issue.format === "date-time" || issue.format === "date") {
3474
- return createIntlError(errorMessages.invalidDate);
3475
- }
3476
- if (issue.format === "email") {
3477
- return createIntlError(errorMessages.invalidEmail);
3478
- }
3479
- return createIntlError(errorMessages.invalidInput);
3480
- case "custom":
3481
- case "unrecognized_keys":
3482
- case "invalid_value":
3483
- case "invalid_key":
3484
- case "too_big":
3485
- case "not_multiple_of":
3486
- case "invalid_element":
3487
- return createIntlError(errorMessages.invalidInput);
3488
3392
  }
3489
3393
  return createIntlError(errorMessages.invalidInput);
3490
3394
  }
@@ -3504,7 +3408,7 @@ function validateFieldInput({
3504
3408
  const zodType = mapFieldTypeToZod(field3, actionType);
3505
3409
  const rawError = zodType.safeParse(value, {
3506
3410
  // @ts-expect-error
3507
- error: (issue) => zodToIntlErrorMap(issue, value, field3)
3411
+ errorMap: (issue, _ctx) => zodToIntlErrorMap(issue, _ctx, field3)
3508
3412
  });
3509
3413
  return rawError.error?.issues.map((issue) => issue.message) ?? [];
3510
3414
  }
@@ -3539,6 +3443,7 @@ function runFieldValidations({
3539
3443
  * In real use cases, there can be hundreds of thousands of locations.
3540
3444
  * Make sure that the context contains only the locations that are needed for validation.
3541
3445
  * E.g. if the user is a leaf admin, only the leaf locations under their admin structure are needed.
3446
+ *
3542
3447
  * Loading few megabytes of locations to memory just for validation is not efficient and will choke the application.
3543
3448
  */
3544
3449
  $leafAdminStructureLocationIds: context.leafAdminStructureLocationIds ?? [],
@@ -3605,7 +3510,7 @@ function areCertificateConditionsMet(conditions, values) {
3605
3510
  }
3606
3511
 
3607
3512
  // ../commons/src/utils.ts
3608
- var z27 = __toESM(require("zod/v4"));
3513
+ var z26 = __toESM(require("zod"));
3609
3514
  function getOrThrow(x, message) {
3610
3515
  if (x === void 0 || x === null) {
3611
3516
  throw new Error(message);
@@ -3615,11 +3520,11 @@ function getOrThrow(x, message) {
3615
3520
  function joinValues(values, separator = " ") {
3616
3521
  return values.filter((value) => !!value).join(separator).trim();
3617
3522
  }
3618
- var FullNameV1 = z27.array(
3619
- z27.object({
3620
- use: z27.string(),
3621
- family: z27.string(),
3622
- given: z27.array(z27.string())
3523
+ var FullNameV1 = z26.array(
3524
+ z26.object({
3525
+ use: z26.string(),
3526
+ family: z26.string(),
3527
+ given: z26.array(z26.string())
3623
3528
  })
3624
3529
  );
3625
3530
  function omitKeyDeep(obj, keyToRemove) {
@@ -3644,6 +3549,9 @@ function ageToDate(age, asOfDate) {
3644
3549
  const date = new Date(asOfDate);
3645
3550
  return DateValue.parse((0, import_date_fns2.format)((0, import_date_fns2.subYears)(date, age), "yyyy-MM-dd"));
3646
3551
  }
3552
+ function isDeclarationActionConfig(action) {
3553
+ return DeclarationActions.safeParse(action.type).success;
3554
+ }
3647
3555
  function getDeclarationFields(configuration) {
3648
3556
  return configuration.declaration.pages.flatMap(({ fields }) => fields);
3649
3557
  }
@@ -3653,38 +3561,6 @@ function getDeclarationPages(configuration) {
3653
3561
  function getDeclaration(configuration) {
3654
3562
  return configuration.declaration;
3655
3563
  }
3656
- function isActionConfigType(type) {
3657
- return actionConfigTypes.has(type);
3658
- }
3659
- function getActionConfig({
3660
- eventConfiguration,
3661
- actionType,
3662
- customActionType
3663
- }) {
3664
- return eventConfiguration.actions.find((a) => {
3665
- if (a.type === ActionType.CUSTOM && customActionType) {
3666
- return a.customActionType === customActionType;
3667
- }
3668
- if (actionType === ActionType.NOTIFY) {
3669
- return a.type === ActionType.DECLARE;
3670
- }
3671
- if (actionType === ActionType.APPROVE_CORRECTION || actionType === ActionType.REJECT_CORRECTION) {
3672
- return a.type === ActionType.REQUEST_CORRECTION;
3673
- }
3674
- return a.type === actionType;
3675
- });
3676
- }
3677
- function getCustomActionFields(eventConfiguration, customActionType) {
3678
- const actionConfig = getActionConfig({
3679
- eventConfiguration,
3680
- customActionType,
3681
- actionType: ActionType.CUSTOM
3682
- });
3683
- if (!actionConfig || !("form" in actionConfig)) {
3684
- return [];
3685
- }
3686
- return actionConfig.form;
3687
- }
3688
3564
  function getPrintCertificatePages(configuration) {
3689
3565
  const action = configuration.actions.find(
3690
3566
  (a) => a.type === ActionType.PRINT_CERTIFICATE
@@ -3701,7 +3577,7 @@ var getActionAnnotationFields = (actionConfig) => {
3701
3577
  if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
3702
3578
  return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
3703
3579
  }
3704
- if ("review" in actionConfig) {
3580
+ if (isDeclarationActionConfig(actionConfig)) {
3705
3581
  return actionConfig.review.fields;
3706
3582
  }
3707
3583
  return [];
@@ -3730,17 +3606,13 @@ function getActionReview(configuration, actionType) {
3730
3606
  const [actionConfig] = configuration.actions.filter(
3731
3607
  (a) => a.type === actionType
3732
3608
  );
3733
- if ("review" in actionConfig) {
3734
- return actionConfig.review;
3735
- }
3736
- return void 0;
3609
+ return getOrThrow(
3610
+ actionConfig.review,
3611
+ `No review config found for ${actionType}`
3612
+ );
3737
3613
  }
3738
3614
  function getActionReviewFields(configuration, actionType) {
3739
- const review = getActionReview(configuration, actionType);
3740
- if (!review) {
3741
- return [];
3742
- }
3743
- return review.fields;
3615
+ return getActionReview(configuration, actionType).fields;
3744
3616
  }
3745
3617
  function isPageVisible(page, formValues, context) {
3746
3618
  if (!page.conditional) {
@@ -3795,7 +3667,7 @@ function createEmptyDraft(eventId, draftId, actionType) {
3795
3667
  declaration: {},
3796
3668
  annotation: {},
3797
3669
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
3798
- createdByUserType: TokenUserType.enum.user,
3670
+ createdByUserType: TokenUserType.Enum.user,
3799
3671
  createdBy: "@todo",
3800
3672
  status: ActionStatus.Accepted,
3801
3673
  transactionId: "@todo",
@@ -3997,8 +3869,10 @@ function aggregateActionDeclarations(event2) {
3997
3869
  }
3998
3870
 
3999
3871
  // ../commons/src/events/EventConfig.ts
4000
- var EventConfig = z28.object({
4001
- id: z28.string().describe(
3872
+ var import_zod_openapi10 = require("zod-openapi");
3873
+ (0, import_zod_openapi10.extendZodWithOpenApi)(import_zod26.z);
3874
+ var EventConfig = import_zod26.z.object({
3875
+ id: import_zod26.z.string().describe(
4002
3876
  'Machine-readable identifier of the event (e.g. "birth", "death").'
4003
3877
  ),
4004
3878
  dateOfEvent: FieldReference.optional().describe(
@@ -4016,17 +3890,14 @@ var EventConfig = z28.object({
4016
3890
  label: TranslationConfig.describe(
4017
3891
  "Human-readable label for the event type."
4018
3892
  ),
4019
- actions: z28.array(ActionConfig).describe(
3893
+ actions: import_zod26.z.array(ActionConfig).describe(
4020
3894
  "Configuration of system-defined actions associated with the event."
4021
3895
  ),
4022
3896
  declaration: DeclarationFormConfig.describe(
4023
3897
  "Configuration of the form used to gather event data."
4024
3898
  ),
4025
- advancedSearch: z28.array(AdvancedSearchConfig).optional().default([]).describe(
3899
+ advancedSearch: import_zod26.z.array(AdvancedSearchConfig).optional().default([]).describe(
4026
3900
  "Configuration of fields available in the advanced search feature."
4027
- ),
4028
- flags: z28.array(FlagConfig).optional().default([]).describe(
4029
- "Configuration of flags associated with the actions of this event type."
4030
3901
  )
4031
3902
  }).superRefine((event2, ctx) => {
4032
3903
  const allFields = findAllFields(event2);
@@ -4078,21 +3949,8 @@ var EventConfig = z28.object({
4078
3949
  });
4079
3950
  }
4080
3951
  }
4081
- const configuredFlagIds = event2.flags.map((flag2) => flag2.id);
4082
- const actionFlagIds = event2.actions.flatMap(
4083
- (action) => action.flags.map((flag2) => flag2.id)
4084
- );
4085
- for (const actionFlagId of actionFlagIds) {
4086
- if (!configuredFlagIds.includes(actionFlagId)) {
4087
- ctx.addIssue({
4088
- code: "custom",
4089
- message: `Action flag id must match a configured flag in the flags array. Invalid action flag ID for event '${event2.id}': '${actionFlagId}'`,
4090
- path: ["actions"]
4091
- });
4092
- }
4093
- }
4094
- }).meta({
4095
- id: "EventConfig"
3952
+ }).openapi({
3953
+ ref: "EventConfig"
4096
3954
  }).describe("Configuration defining an event type.");
4097
3955
 
4098
3956
  // ../commons/src/events/EventConfigInput.ts
@@ -4102,7 +3960,7 @@ var definePage = (page) => PageConfig.parse(page);
4102
3960
  var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
4103
3961
 
4104
3962
  // ../commons/src/events/WorkqueueConfig.ts
4105
- var z32 = __toESM(require("zod/v4"));
3963
+ var import_zod30 = require("zod");
4106
3964
 
4107
3965
  // ../commons/src/conditionals/conditionals.ts
4108
3966
  var objectHash = __toESM(require("object-hash"));
@@ -4147,7 +4005,7 @@ function not(condition) {
4147
4005
  required: []
4148
4006
  });
4149
4007
  }
4150
- function never2() {
4008
+ function never() {
4151
4009
  return not(alwaysTrue());
4152
4010
  }
4153
4011
  function jsonFieldPath(field3) {
@@ -4289,33 +4147,6 @@ function defineComparison(field3, value, keyword) {
4289
4147
  required: [field3.$$field]
4290
4148
  });
4291
4149
  }
4292
- function flag(flagvalue) {
4293
- return defineConditional({
4294
- type: "object",
4295
- properties: {
4296
- $flags: {
4297
- type: "array",
4298
- contains: {
4299
- type: "string",
4300
- const: flagvalue
4301
- }
4302
- }
4303
- },
4304
- required: ["$flags"]
4305
- });
4306
- }
4307
- function status(statusValue) {
4308
- return defineConditional({
4309
- type: "object",
4310
- properties: {
4311
- $status: {
4312
- type: "string",
4313
- const: statusValue
4314
- }
4315
- },
4316
- required: ["$status"]
4317
- });
4318
- }
4319
4150
  function createFieldConditionals(fieldId) {
4320
4151
  const getDayRange = (field3, days, clause) => ({
4321
4152
  type: "object",
@@ -4823,17 +4654,17 @@ var event = Object.assign(eventFn, {
4823
4654
  });
4824
4655
 
4825
4656
  // ../commons/src/events/WorkqueueColumnConfig.ts
4826
- var z29 = __toESM(require("zod/v4"));
4657
+ var import_zod27 = require("zod");
4827
4658
  var WorkqueueColumnKeysArray = [
4828
4659
  ...EventMetadataKeysArray,
4829
4660
  "title",
4830
4661
  "outbox"
4831
4662
  ];
4832
- var WorkqueueColumnKeys = z29.enum(WorkqueueColumnKeysArray);
4833
- var WorkqueueColumnValue = z29.object({
4663
+ var WorkqueueColumnKeys = import_zod27.z.enum(WorkqueueColumnKeysArray);
4664
+ var WorkqueueColumnValue = import_zod27.z.object({
4834
4665
  $event: WorkqueueColumnKeys
4835
4666
  });
4836
- var WorkqueueColumn = z29.object({
4667
+ var WorkqueueColumn = import_zod27.z.object({
4837
4668
  label: TranslationConfig,
4838
4669
  value: WorkqueueColumnValue
4839
4670
  });
@@ -4844,57 +4675,57 @@ function defineWorkqueuesColumns(workqueueColumns) {
4844
4675
  }
4845
4676
 
4846
4677
  // ../commons/src/events/CountryConfigQueryInput.ts
4847
- var z30 = __toESM(require("zod/v4"));
4848
- var SerializableExact = z30.object({
4849
- type: z30.literal("exact"),
4850
- term: z30.union([z30.string(), SerializedUserField])
4678
+ var import_zod28 = require("zod");
4679
+ var SerializableExact = import_zod28.z.object({
4680
+ type: import_zod28.z.literal("exact"),
4681
+ term: import_zod28.z.union([import_zod28.z.string(), SerializedUserField])
4851
4682
  });
4852
- var SerializableWithin = z30.object({
4853
- type: z30.literal("within"),
4854
- location: z30.union([z30.string(), SerializedUserField])
4683
+ var SerializableWithin = import_zod28.z.object({
4684
+ type: import_zod28.z.literal("within"),
4685
+ location: import_zod28.z.union([import_zod28.z.string(), SerializedUserField])
4855
4686
  });
4856
- var SerializedQueryExpression = z30.object({
4857
- eventType: z30.string(),
4858
- status: z30.optional(z30.union([AnyOfStatus, ExactStatus])),
4859
- createdAt: z30.optional(DateCondition),
4860
- updatedAt: z30.optional(DateCondition),
4861
- "legalStatuses.REGISTERED.createdAt": z30.optional(DateCondition),
4862
- "legalStatuses.REGISTERED.createdAtLocation": z30.optional(
4863
- z30.union([Within, Exact])
4687
+ var SerializedQueryExpression = import_zod28.z.object({
4688
+ eventType: import_zod28.z.string(),
4689
+ status: import_zod28.z.optional(import_zod28.z.union([AnyOfStatus, ExactStatus])),
4690
+ createdAt: import_zod28.z.optional(DateCondition),
4691
+ updatedAt: import_zod28.z.optional(DateCondition),
4692
+ "legalStatuses.REGISTERED.createdAt": import_zod28.z.optional(DateCondition),
4693
+ "legalStatuses.REGISTERED.createdAtLocation": import_zod28.z.optional(
4694
+ import_zod28.z.union([Within, Exact])
4864
4695
  ),
4865
- "legalStatuses.REGISTERED.registrationNumber": z30.optional(Exact),
4866
- createdAtLocation: z30.optional(
4867
- z30.union([SerializableWithin, SerializableExact])
4696
+ "legalStatuses.REGISTERED.registrationNumber": import_zod28.z.optional(Exact),
4697
+ createdAtLocation: import_zod28.z.optional(
4698
+ import_zod28.z.union([SerializableWithin, SerializableExact])
4868
4699
  ),
4869
- updatedAtLocation: z30.optional(
4870
- z30.union([SerializableWithin, SerializableExact])
4700
+ updatedAtLocation: import_zod28.z.optional(
4701
+ import_zod28.z.union([SerializableWithin, SerializableExact])
4871
4702
  ),
4872
- assignedTo: z30.optional(SerializableExact),
4873
- createdBy: z30.optional(SerializableExact),
4703
+ assignedTo: import_zod28.z.optional(SerializableExact),
4704
+ createdBy: import_zod28.z.optional(SerializableExact),
4874
4705
  createdByUserType: ExactUserType,
4875
- updatedBy: z30.optional(SerializableExact),
4876
- trackingId: z30.optional(Exact),
4877
- flags: z30.optional(ContainsFlags),
4706
+ updatedBy: import_zod28.z.optional(SerializableExact),
4707
+ trackingId: import_zod28.z.optional(Exact),
4708
+ flags: import_zod28.z.optional(ContainsFlags),
4878
4709
  data: QueryInput
4879
4710
  }).partial();
4880
- var Or2 = z30.object({
4881
- type: z30.literal("or"),
4882
- clauses: z30.array(SerializedQueryExpression)
4711
+ var Or2 = import_zod28.z.object({
4712
+ type: import_zod28.z.literal("or"),
4713
+ clauses: import_zod28.z.array(SerializedQueryExpression)
4883
4714
  });
4884
- var And2 = z30.object({
4885
- type: z30.literal("and"),
4886
- clauses: z30.array(SerializedQueryExpression)
4715
+ var And2 = import_zod28.z.object({
4716
+ type: import_zod28.z.literal("and"),
4717
+ clauses: import_zod28.z.array(SerializedQueryExpression)
4887
4718
  });
4888
- var CountryConfigQueryType = z30.discriminatedUnion("type", [And2, Or2]);
4889
- var CountryConfigQueryInputType = z30.union([
4719
+ var CountryConfigQueryType = import_zod28.z.discriminatedUnion("type", [And2, Or2]);
4720
+ var CountryConfigQueryInputType = import_zod28.z.union([
4890
4721
  SerializedQueryExpression,
4891
4722
  And2,
4892
4723
  Or2
4893
4724
  ]);
4894
4725
 
4895
4726
  // ../commons/src/icons.ts
4896
- var z31 = __toESM(require("zod/v4"));
4897
- var AvailableIcons = z31.enum([
4727
+ var import_zod29 = require("zod");
4728
+ var AvailableIcons = import_zod29.z.enum([
4898
4729
  "Archived",
4899
4730
  "Assigned",
4900
4731
  "Certified",
@@ -5015,24 +4846,23 @@ var mandatoryColumns = defineWorkqueuesColumns([
5015
4846
  value: event.field("updatedAt")
5016
4847
  }
5017
4848
  ]);
5018
- var WorkqueueActionsWithDefault = z32.enum([
4849
+ var WorkqueueActionsWithDefault = import_zod30.z.enum([
5019
4850
  ...workqueueActions.options,
5020
- "DEFAULT",
5021
- ActionType.READ
4851
+ "DEFAULT"
5022
4852
  ]);
5023
- var WorkqueueConfig = z32.object({
5024
- slug: z32.string().describe("Determines the url of the workqueue."),
4853
+ var WorkqueueConfig = import_zod30.z.object({
4854
+ slug: import_zod30.z.string().describe("Determines the url of the workqueue."),
5025
4855
  name: TranslationConfig.describe(
5026
4856
  "Title of the workflow (both in navigation and on the page)"
5027
4857
  ),
5028
4858
  query: CountryConfigQueryType,
5029
- actions: z32.array(
5030
- z32.object({
4859
+ actions: import_zod30.z.array(
4860
+ import_zod30.z.object({
5031
4861
  type: WorkqueueActionsWithDefault,
5032
- conditionals: z32.array(Conditional).optional()
4862
+ conditionals: import_zod30.z.array(Conditional).optional()
5033
4863
  })
5034
4864
  ),
5035
- columns: z32.array(WorkqueueColumn).default(mandatoryColumns),
4865
+ columns: import_zod30.z.array(WorkqueueColumn).default(mandatoryColumns),
5036
4866
  icon: AvailableIcons,
5037
4867
  emptyMessage: TranslationConfig.optional()
5038
4868
  }).describe("Configuration for workqueue.");
@@ -5040,19 +4870,19 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
5040
4870
  query: true,
5041
4871
  columns: true
5042
4872
  });
5043
- var WorkqueueConfigInput = z32.object({
5044
- slug: z32.string().describe("Determines the url of the workqueue."),
4873
+ var WorkqueueConfigInput = import_zod30.z.object({
4874
+ slug: import_zod30.z.string().describe("Determines the url of the workqueue."),
5045
4875
  name: TranslationConfig.describe(
5046
4876
  "Title of the workflow (both in navigation and on the page)"
5047
4877
  ),
5048
4878
  query: CountryConfigQueryInputType,
5049
- actions: z32.array(
5050
- z32.object({
4879
+ actions: import_zod30.z.array(
4880
+ import_zod30.z.object({
5051
4881
  type: WorkqueueActionsWithDefault,
5052
- conditionals: z32.array(Conditional).optional()
4882
+ conditionals: import_zod30.z.array(Conditional).optional()
5053
4883
  })
5054
4884
  ),
5055
- columns: z32.array(WorkqueueColumn).default(mandatoryColumns),
4885
+ columns: import_zod30.z.array(WorkqueueColumn).default(mandatoryColumns),
5056
4886
  icon: AvailableIcons,
5057
4887
  emptyMessage: TranslationConfig.optional()
5058
4888
  });
@@ -5064,10 +4894,10 @@ function defineWorkqueue(workqueueInput) {
5064
4894
  function defineWorkqueues(workqueues) {
5065
4895
  return workqueues.map((workqueue) => defineWorkqueue(workqueue));
5066
4896
  }
5067
- var WorkqueueCountInput = z32.array(
5068
- z32.object({ slug: z32.string(), query: QueryType })
4897
+ var WorkqueueCountInput = import_zod30.z.array(
4898
+ import_zod30.z.object({ slug: import_zod30.z.string(), query: QueryType })
5069
4899
  );
5070
- var WorkqueueCountOutput = z32.record(z32.string(), z32.number());
4900
+ var WorkqueueCountOutput = import_zod30.z.record(import_zod30.z.string(), import_zod30.z.number());
5071
4901
 
5072
4902
  // ../commons/src/events/workqueueDefaultColumns.ts
5073
4903
  var defaultWorkqueueColumns = [
@@ -5090,45 +4920,47 @@ var defaultWorkqueueColumns = [
5090
4920
  ];
5091
4921
 
5092
4922
  // ../commons/src/events/Draft.ts
5093
- var z34 = __toESM(require("zod/v4"));
4923
+ var import_zod32 = require("zod");
5094
4924
 
5095
4925
  // ../commons/src/events/ActionInput.ts
5096
- var z33 = __toESM(require("zod/v4"));
5097
- var BaseActionInput = z33.object({
4926
+ var import_zod31 = require("zod");
4927
+ var import_zod_openapi11 = require("zod-openapi");
4928
+ (0, import_zod_openapi11.extendZodWithOpenApi)(import_zod31.z);
4929
+ var BaseActionInput = import_zod31.z.object({
5098
4930
  eventId: UUID,
5099
- transactionId: z33.string(),
4931
+ transactionId: import_zod31.z.string(),
5100
4932
  declaration: ActionUpdate.default({}),
5101
4933
  annotation: ActionUpdate.optional(),
5102
4934
  originalActionId: UUID.optional(),
5103
4935
  // should not be part of base action.
5104
- keepAssignment: z33.boolean().optional(),
4936
+ keepAssignment: import_zod31.z.boolean().optional(),
5105
4937
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
5106
4938
  createdAtLocation: CreatedAtLocation.describe(
5107
4939
  "A valid office location ID. This is required for system users performing actions. The provided location must be a leaf-location, i.e. it must not have any children locations."
5108
4940
  )
5109
4941
  });
5110
- var CreateActionInput = BaseActionInput.extend(
5111
- z33.object({
5112
- type: z33.literal(ActionType.CREATE).default(ActionType.CREATE),
4942
+ var CreateActionInput = BaseActionInput.merge(
4943
+ import_zod31.z.object({
4944
+ type: import_zod31.z.literal(ActionType.CREATE).default(ActionType.CREATE),
5113
4945
  createdAtLocation: CreatedAtLocation
5114
- }).shape
5115
- );
5116
- var RegisterActionInput = BaseActionInput.extend(
5117
- z33.strictObject({
5118
- type: z33.literal(ActionType.REGISTER).default(ActionType.REGISTER),
5119
- registrationNumber: z33.string().optional()
5120
- }).shape
4946
+ })
5121
4947
  );
5122
- var ValidateActionInput = BaseActionInput.extend(
5123
- z33.object({
5124
- type: z33.literal(ActionType.VALIDATE).default(ActionType.VALIDATE)
5125
- }).shape
4948
+ var RegisterActionInput = BaseActionInput.merge(
4949
+ import_zod31.z.object({
4950
+ type: import_zod31.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
4951
+ registrationNumber: import_zod31.z.string().optional()
4952
+ })
4953
+ ).strict();
4954
+ var ValidateActionInput = BaseActionInput.merge(
4955
+ import_zod31.z.object({
4956
+ type: import_zod31.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE)
4957
+ })
5126
4958
  );
5127
- var NotifyActionInput = BaseActionInput.extend(
5128
- z33.object({
5129
- type: z33.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
5130
- }).shape
5131
- ).meta({
4959
+ var NotifyActionInput = BaseActionInput.merge(
4960
+ import_zod31.z.object({
4961
+ type: import_zod31.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
4962
+ })
4963
+ ).openapi({
5132
4964
  default: {
5133
4965
  eventId: "<event-id-here>",
5134
4966
  transactionId: getUUID(),
@@ -5137,142 +4969,135 @@ var NotifyActionInput = BaseActionInput.extend(
5137
4969
  type: ActionType.NOTIFY
5138
4970
  }
5139
4971
  });
5140
- var DeclareActionInput = BaseActionInput.extend(
5141
- z33.object({
5142
- type: z33.literal(ActionType.DECLARE).default(ActionType.DECLARE)
5143
- }).shape
4972
+ var DeclareActionInput = BaseActionInput.merge(
4973
+ import_zod31.z.object({
4974
+ type: import_zod31.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
4975
+ })
5144
4976
  );
5145
- var PrintCertificateActionInput = BaseActionInput.extend(
5146
- z33.object({
5147
- type: z33.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
4977
+ var PrintCertificateActionInput = BaseActionInput.merge(
4978
+ import_zod31.z.object({
4979
+ type: import_zod31.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
5148
4980
  content: PrintContent.optional()
5149
- }).shape
4981
+ })
5150
4982
  );
5151
- var RejectDeclarationActionInput = BaseActionInput.extend(
5152
- z33.object({
5153
- type: z33.literal(ActionType.REJECT).default(ActionType.REJECT),
4983
+ var RejectDeclarationActionInput = BaseActionInput.merge(
4984
+ import_zod31.z.object({
4985
+ type: import_zod31.z.literal(ActionType.REJECT).default(ActionType.REJECT),
5154
4986
  content: ReasonContent
5155
- }).shape
4987
+ })
5156
4988
  );
5157
- var DuplicateDetectedActionInput = BaseActionInput.extend(
5158
- z33.object({
5159
- type: z33.literal(ActionType.DUPLICATE_DETECTED).default(ActionType.DUPLICATE_DETECTED),
5160
- content: z33.object({
5161
- duplicates: z33.array(PotentialDuplicate)
4989
+ var DuplicateDetectedActionInput = BaseActionInput.merge(
4990
+ import_zod31.z.object({
4991
+ type: import_zod31.z.literal(ActionType.DUPLICATE_DETECTED).default(ActionType.DUPLICATE_DETECTED),
4992
+ content: import_zod31.z.object({
4993
+ duplicates: import_zod31.z.array(PotentialDuplicate)
5162
4994
  })
5163
- }).shape
4995
+ })
5164
4996
  );
5165
- var MarkAsDuplicateActionInput = BaseActionInput.extend(
5166
- z33.object({
5167
- type: z33.literal(ActionType.MARK_AS_DUPLICATE).default(ActionType.MARK_AS_DUPLICATE),
5168
- content: z33.object({
4997
+ var MarkAsDuplicateActionInput = BaseActionInput.merge(
4998
+ import_zod31.z.object({
4999
+ type: import_zod31.z.literal(ActionType.MARK_AS_DUPLICATE).default(ActionType.MARK_AS_DUPLICATE),
5000
+ content: import_zod31.z.object({
5169
5001
  duplicateOf: UUID
5170
5002
  }).optional()
5171
- }).shape
5003
+ })
5172
5004
  );
5173
- var MarkNotDuplicateActionInput = BaseActionInput.extend(
5174
- z33.object({
5175
- type: z33.literal(ActionType.MARK_AS_NOT_DUPLICATE).default(ActionType.MARK_AS_NOT_DUPLICATE)
5176
- }).shape
5005
+ var MarkNotDuplicateActionInput = BaseActionInput.merge(
5006
+ import_zod31.z.object({
5007
+ type: import_zod31.z.literal(ActionType.MARK_AS_NOT_DUPLICATE).default(ActionType.MARK_AS_NOT_DUPLICATE)
5008
+ })
5177
5009
  );
5178
- var ArchiveActionInput = BaseActionInput.extend(
5179
- z33.object({
5180
- type: z33.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
5010
+ var ArchiveActionInput = BaseActionInput.merge(
5011
+ import_zod31.z.object({
5012
+ type: import_zod31.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
5181
5013
  content: ReasonContent
5182
- }).shape
5014
+ })
5183
5015
  );
5184
- var AssignActionInput = BaseActionInput.extend(
5185
- z33.object({
5186
- type: z33.literal(ActionType.ASSIGN),
5187
- assignedTo: z33.string()
5188
- }).shape
5016
+ var AssignActionInput = BaseActionInput.merge(
5017
+ import_zod31.z.object({
5018
+ type: import_zod31.z.literal(ActionType.ASSIGN),
5019
+ assignedTo: import_zod31.z.string()
5020
+ })
5189
5021
  );
5190
- var UnassignActionInput = BaseActionInput.extend(
5191
- z33.object({
5192
- type: z33.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
5193
- assignedTo: z33.literal(null).default(null)
5194
- }).shape
5022
+ var UnassignActionInput = BaseActionInput.merge(
5023
+ import_zod31.z.object({
5024
+ type: import_zod31.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
5025
+ assignedTo: import_zod31.z.literal(null).default(null)
5026
+ })
5195
5027
  );
5196
- var RequestCorrectionActionInput = BaseActionInput.extend(
5197
- z33.object({
5198
- type: z33.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
5199
- }).shape
5028
+ var RequestCorrectionActionInput = BaseActionInput.merge(
5029
+ import_zod31.z.object({
5030
+ type: import_zod31.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
5031
+ })
5200
5032
  );
5201
- var RejectCorrectionActionInput = BaseActionInput.extend(
5202
- z33.object({
5203
- requestId: z33.string(),
5204
- type: z33.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION),
5033
+ var RejectCorrectionActionInput = BaseActionInput.merge(
5034
+ import_zod31.z.object({
5035
+ requestId: import_zod31.z.string(),
5036
+ type: import_zod31.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION),
5205
5037
  content: ReasonContent
5206
- }).shape
5207
- );
5208
- var ApproveCorrectionActionInput = BaseActionInput.extend(
5209
- z33.object({
5210
- requestId: z33.string(),
5211
- type: z33.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
5212
- }).shape
5038
+ })
5213
5039
  );
5214
- var ReadActionInput = BaseActionInput.extend(
5215
- z33.object({
5216
- type: z33.literal(ActionType.READ).default(ActionType.READ)
5217
- }).shape
5040
+ var ApproveCorrectionActionInput = BaseActionInput.merge(
5041
+ import_zod31.z.object({
5042
+ requestId: import_zod31.z.string(),
5043
+ type: import_zod31.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
5044
+ })
5218
5045
  );
5219
- var DeleteActionInput = z33.object({ eventId: UUID });
5220
- var CustomActionInput = BaseActionInput.extend(
5221
- z33.object({
5222
- type: z33.literal(ActionType.CUSTOM).default(ActionType.CUSTOM),
5223
- customActionType: z33.string().describe("Name of the custom action.")
5224
- }).shape
5046
+ var ReadActionInput = BaseActionInput.merge(
5047
+ import_zod31.z.object({
5048
+ type: import_zod31.z.literal(ActionType.READ).default(ActionType.READ)
5049
+ })
5225
5050
  );
5226
- var ActionInput = z33.discriminatedUnion("type", [
5227
- CreateActionInput.meta({ id: "CreateActionInput" }),
5228
- ValidateActionInput.meta({ id: "ValidateActionInput" }),
5229
- RegisterActionInput.meta({ id: "RegisterActionInput" }),
5230
- NotifyActionInput.meta({ id: "NotifyActionInput" }),
5231
- DeclareActionInput.meta({ id: "DeclareActionInput" }),
5232
- RejectDeclarationActionInput.meta({
5233
- id: "RejectDeclarationActionInput"
5051
+ var DeleteActionInput = import_zod31.z.object({ eventId: UUID });
5052
+ var ActionInput = import_zod31.z.discriminatedUnion("type", [
5053
+ CreateActionInput.openapi({ ref: "CreateActionInput" }),
5054
+ ValidateActionInput.openapi({ ref: "ValidateActionInput" }),
5055
+ RegisterActionInput.openapi({ ref: "RegisterActionInput" }),
5056
+ NotifyActionInput.openapi({ ref: "NotifyActionInput" }),
5057
+ DeclareActionInput.openapi({ ref: "DeclareActionInput" }),
5058
+ RejectDeclarationActionInput.openapi({
5059
+ ref: "RejectDeclarationActionInput"
5234
5060
  }),
5235
- DuplicateDetectedActionInput.meta({
5236
- id: "DuplicateDetectedActionInput"
5061
+ DuplicateDetectedActionInput.openapi({
5062
+ ref: "DuplicateDetectedActionInput"
5237
5063
  }),
5238
- MarkAsDuplicateActionInput.meta({
5239
- id: "MarkAsDuplicateActionInput"
5064
+ MarkAsDuplicateActionInput.openapi({
5065
+ ref: "MarkAsDuplicateActionInput"
5240
5066
  }),
5241
- MarkNotDuplicateActionInput.meta({
5242
- id: "MarkNotDuplicateActionInput"
5067
+ MarkNotDuplicateActionInput.openapi({
5068
+ ref: "MarkNotDuplicateActionInput"
5243
5069
  }),
5244
- ArchiveActionInput.meta({ id: "ArchiveActionInput" }),
5245
- AssignActionInput.meta({ id: "AssignActionInput" }),
5246
- UnassignActionInput.meta({ id: "UnassignActionInput" }),
5247
- PrintCertificateActionInput.meta({ id: "PrintCertificateActionInput" }),
5248
- RequestCorrectionActionInput.meta({
5249
- id: "RequestCorrectionActionInput"
5070
+ ArchiveActionInput.openapi({ ref: "ArchiveActionInput" }),
5071
+ AssignActionInput.openapi({ ref: "AssignActionInput" }),
5072
+ UnassignActionInput.openapi({ ref: "UnassignActionInput" }),
5073
+ PrintCertificateActionInput.openapi({ ref: "PrintCertificateActionInput" }),
5074
+ RequestCorrectionActionInput.openapi({
5075
+ ref: "RequestCorrectionActionInput"
5250
5076
  }),
5251
- RejectCorrectionActionInput.meta({ id: "RejectCorrectionActionInput" }),
5252
- ApproveCorrectionActionInput.meta({
5253
- id: "ApproveCorrectionActionInput"
5077
+ RejectCorrectionActionInput.openapi({ ref: "RejectCorrectionActionInput" }),
5078
+ ApproveCorrectionActionInput.openapi({
5079
+ ref: "ApproveCorrectionActionInput"
5254
5080
  }),
5255
- ReadActionInput.meta({ id: "ReadActionInput" }),
5256
- CustomActionInput.meta({ id: "CustomActionInput" })
5257
- ]).meta({
5258
- id: "ActionInput"
5081
+ ReadActionInput.openapi({ ref: "ReadActionInput" })
5082
+ ]).openapi({
5083
+ ref: "ActionInput"
5259
5084
  });
5260
5085
 
5261
5086
  // ../commons/src/events/Draft.ts
5262
- var Draft = z34.object({
5087
+ var Draft = import_zod32.z.object({
5263
5088
  id: UUID,
5264
5089
  eventId: UUID,
5265
- transactionId: z34.string(),
5266
- createdAt: z34.string().datetime(),
5090
+ transactionId: import_zod32.z.string(),
5091
+ createdAt: import_zod32.z.string().datetime(),
5267
5092
  action: ActionBase.extend({
5268
- type: ActionTypes.exclude([ActionTypes.enum.DELETE])
5093
+ type: ActionTypes.exclude([ActionTypes.Enum.DELETE])
5269
5094
  }).omit({ id: true, createdAtLocation: true })
5270
5095
  }).describe(
5271
5096
  "A temporary storage for an action. Stored with details of the event, creator and creation time."
5272
5097
  );
5273
5098
  var DraftInput = BaseActionInput.extend({
5274
- type: ActionTypes.exclude([ActionTypes.enum.DELETE]),
5275
- status: z34.enum([
5099
+ type: ActionTypes.exclude([ActionTypes.Enum.DELETE]),
5100
+ status: import_zod32.z.enum([
5276
5101
  ActionStatus.Requested,
5277
5102
  ActionStatus.Accepted,
5278
5103
  ActionStatus.Rejected
@@ -5280,30 +5105,32 @@ var DraftInput = BaseActionInput.extend({
5280
5105
  });
5281
5106
 
5282
5107
  // ../commons/src/events/EventInput.ts
5283
- var z35 = __toESM(require("zod/v4"));
5108
+ var import_zod33 = require("zod");
5284
5109
  var import_uuid10 = require("uuid");
5285
- var EventInput = z35.object({
5286
- transactionId: z35.string(),
5287
- type: z35.string()
5288
- }).meta({ default: { transactionId: (0, import_uuid10.v4)(), type: "birth" } });
5110
+ var EventInput = import_zod33.z.object({
5111
+ transactionId: import_zod33.z.string(),
5112
+ type: import_zod33.z.string()
5113
+ }).openapi({ default: { transactionId: (0, import_uuid10.v4)(), type: "birth" } });
5289
5114
 
5290
5115
  // ../commons/src/events/EventDocument.ts
5291
- var z36 = __toESM(require("zod/v4"));
5292
- var EventDocument = z36.object({
5116
+ var import_zod34 = require("zod");
5117
+ var import_zod_openapi12 = require("zod-openapi");
5118
+ (0, import_zod_openapi12.extendZodWithOpenApi)(import_zod34.z);
5119
+ var EventDocument = import_zod34.z.object({
5293
5120
  id: UUID.describe("Unique identifier of the event."),
5294
- type: z36.string().describe("Type of the event (e.g. birth, death, marriage)."),
5295
- createdAt: z36.string().datetime().describe("Timestamp indicating when the event was created."),
5296
- updatedAt: z36.string().datetime().describe(
5121
+ type: import_zod34.z.string().describe("Type of the event (e.g. birth, death, marriage)."),
5122
+ createdAt: import_zod34.z.string().datetime().describe("Timestamp indicating when the event was created."),
5123
+ updatedAt: import_zod34.z.string().datetime().describe(
5297
5124
  "Timestamp of the last update, excluding changes from actions."
5298
5125
  ),
5299
- actions: z36.array(Action).describe("Ordered list of actions associated with the event."),
5300
- trackingId: z36.string().describe(
5126
+ actions: import_zod34.z.array(Action).describe("Ordered list of actions associated with the event."),
5127
+ trackingId: import_zod34.z.string().describe(
5301
5128
  "System-generated tracking identifier used to look up the event."
5302
5129
  )
5303
- }).meta({ id: "EventDocument" });
5130
+ }).openapi({ ref: "EventDocument" });
5304
5131
 
5305
5132
  // ../commons/src/events/state/index.ts
5306
- var import_lodash4 = require("lodash");
5133
+ var import_lodash3 = require("lodash");
5307
5134
 
5308
5135
  // ../commons/src/events/state/utils.ts
5309
5136
  var import_lodash2 = require("lodash");
@@ -5368,7 +5195,7 @@ function getActionUpdateMetadata(actions) {
5368
5195
  "createdAtLocation",
5369
5196
  "createdByRole"
5370
5197
  ];
5371
- return actions.filter(({ type }) => updateActions.safeParse(type).success).filter(({ status: status2 }) => status2 === ActionStatus.Accepted).reduce(
5198
+ return actions.filter(({ type }) => updateActions.safeParse(type).success).filter(({ status }) => status === ActionStatus.Accepted).reduce(
5372
5199
  (_, action) => {
5373
5200
  if (action.originalActionId) {
5374
5201
  const originalAction = actions.find(({ id }) => id === action.originalActionId) ?? action;
@@ -5393,8 +5220,6 @@ function getLegalStatuses(actions) {
5393
5220
  }
5394
5221
 
5395
5222
  // ../commons/src/events/state/flags.ts
5396
- var import_lodash3 = require("lodash");
5397
- var import_date_fns3 = require("date-fns");
5398
5223
  function isPendingCertification(actions) {
5399
5224
  if (getStatusFromActions(actions) !== EventStatus.enum.REGISTERED) {
5400
5225
  return false;
@@ -5440,70 +5265,18 @@ function isPotentialDuplicate(actions) {
5440
5265
  return prev;
5441
5266
  }, false);
5442
5267
  }
5443
- function isFlagConditionMet(conditional, form, action) {
5444
- const now = (0, import_date_fns3.isValid)((0, import_date_fns3.parseISO)(action.createdAt)) ? (0, import_date_fns3.formatISO)((0, import_date_fns3.parseISO)(action.createdAt), { representation: "date" }) : (0, import_date_fns3.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
5445
- return validate(conditional, {
5446
- $form: form,
5447
- $now: now,
5448
- $online: true,
5449
- $user: {
5450
- sub: "",
5451
- exp: "",
5452
- role: action.createdByRole,
5453
- algorithm: "",
5454
- scope: [],
5455
- userType: action.createdByUserType
5456
- }
5457
- });
5458
- }
5459
- function resolveEventCustomFlags(event2, eventConfiguration) {
5460
- const acceptedActions = getAcceptedActions(event2);
5461
- const actions = acceptedActions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
5462
- return actions.reduce((acc, action, idx) => {
5463
- let actionConfig;
5464
- if (isActionConfigType(action.type)) {
5465
- actionConfig = getActionConfig({
5466
- eventConfiguration,
5467
- actionType: action.type,
5468
- customActionType: "customActionType" in action ? action.customActionType : void 0
5469
- });
5470
- }
5471
- if (!actionConfig) {
5472
- return acc;
5473
- }
5474
- const eventUpToThisAction = {
5475
- ...event2,
5476
- actions: actions.slice(0, idx + 1)
5477
- };
5478
- const declaration = aggregateActionDeclarations(eventUpToThisAction);
5479
- const annotation = aggregateActionDeclarations(eventUpToThisAction);
5480
- const form = { ...declaration, ...annotation };
5481
- const flagsWithMetConditions = actionConfig.flags.filter(
5482
- ({ conditional }) => (
5483
- // If conditional is not provided, the flag is resolved
5484
- conditional ? isFlagConditionMet(conditional, form, action) : true
5485
- )
5486
- );
5487
- const addedFlags = flagsWithMetConditions.filter(({ operation }) => operation === "add").map(({ id }) => id);
5488
- const removedFlags = flagsWithMetConditions.filter(({ operation }) => operation === "remove").map(({ id }) => id);
5489
- const flags = [...acc, ...addedFlags].filter(
5490
- (flagId) => !removedFlags.includes(flagId)
5491
- );
5492
- return (0, import_lodash3.uniq)(flags);
5493
- }, []);
5494
- }
5495
- function getEventFlags(event2, config) {
5496
- const sortedActions = event2.actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
5268
+ function getFlagsFromActions(actions) {
5269
+ const sortedActions = actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
5497
5270
  const actionStatus = sortedActions.reduce(
5498
- (actionStatuses, { type, status: status2 }) => ({
5271
+ (actionStatuses, { type, status }) => ({
5499
5272
  ...actionStatuses,
5500
- [type]: status2
5273
+ [type]: status
5501
5274
  }),
5502
5275
  {}
5503
5276
  );
5504
- const flags = Object.entries(actionStatus).filter(([, status2]) => status2 !== ActionStatus.Accepted).map(([type, status2]) => {
5505
- const flag2 = joinValues([type, status2], ":").toLowerCase();
5506
- return flag2;
5277
+ const flags = Object.entries(actionStatus).filter(([, status]) => status !== ActionStatus.Accepted).map(([type, status]) => {
5278
+ const flag = joinValues([type, status], ":").toLowerCase();
5279
+ return flag;
5507
5280
  });
5508
5281
  if (isPendingCertification(sortedActions)) {
5509
5282
  flags.push(InherentFlags.PENDING_CERTIFICATION);
@@ -5520,24 +5293,25 @@ function getEventFlags(event2, config) {
5520
5293
  if (isPotentialDuplicate(sortedActions)) {
5521
5294
  flags.push(InherentFlags.POTENTIAL_DUPLICATE);
5522
5295
  }
5523
- return [...flags, ...resolveEventCustomFlags(event2, config)];
5296
+ return flags;
5524
5297
  }
5525
5298
 
5526
5299
  // ../commons/src/events/state/index.ts
5527
5300
  function getStatusFromActions(actions) {
5528
- return actions.filter(({ status: status2 }) => status2 === ActionStatus.Accepted).reduce((status2, action) => {
5301
+ return actions.filter(({ status }) => status === ActionStatus.Accepted).reduce((status, action) => {
5529
5302
  switch (action.type) {
5530
5303
  case ActionType.CREATE:
5531
5304
  return EventStatus.enum.CREATED;
5532
5305
  case ActionType.DECLARE:
5533
5306
  return EventStatus.enum.DECLARED;
5307
+ case ActionType.VALIDATE:
5308
+ return EventStatus.enum.VALIDATED;
5534
5309
  case ActionType.REGISTER:
5535
5310
  return EventStatus.enum.REGISTERED;
5536
5311
  case ActionType.ARCHIVE:
5537
5312
  return EventStatus.enum.ARCHIVED;
5538
5313
  case ActionType.NOTIFY:
5539
5314
  return EventStatus.enum.NOTIFIED;
5540
- case ActionType.CUSTOM:
5541
5315
  case ActionType.PRINT_CERTIFICATE:
5542
5316
  case ActionType.ASSIGN:
5543
5317
  case ActionType.UNASSIGN:
@@ -5549,10 +5323,8 @@ function getStatusFromActions(actions) {
5549
5323
  case ActionType.MARK_AS_DUPLICATE:
5550
5324
  case ActionType.REJECT_CORRECTION:
5551
5325
  case ActionType.READ:
5552
- case ActionType.CUSTOM:
5553
- case ActionType.VALIDATE:
5554
5326
  default:
5555
- return status2;
5327
+ return status;
5556
5328
  }
5557
5329
  }, EventStatus.enum.CREATED);
5558
5330
  }
@@ -5594,8 +5366,8 @@ function deepDropNulls(obj) {
5594
5366
  }
5595
5367
  return obj;
5596
5368
  }
5597
- function isUndeclaredDraft(status2) {
5598
- return status2 === EventStatus.enum.CREATED;
5369
+ function isUndeclaredDraft(status) {
5370
+ return status === EventStatus.enum.CREATED;
5599
5371
  }
5600
5372
  var DEFAULT_DATE_OF_EVENT_PROPERTY = "createdAt";
5601
5373
  function resolveDateOfEvent(eventMetadata, declaration, config) {
@@ -5650,7 +5422,7 @@ function getCurrentEventState(event2, config) {
5650
5422
  updatedByUserRole: requestActionMetadata.createdByRole,
5651
5423
  dateOfEvent: resolveDateOfEvent(event2, declaration, config),
5652
5424
  potentialDuplicates: extractPotentialDuplicatesFromActions(sortedActions),
5653
- flags: getEventFlags(event2, config)
5425
+ flags: getFlagsFromActions(sortedActions)
5654
5426
  });
5655
5427
  }
5656
5428
  function dangerouslyGetCurrentEventStateWithDrafts({
@@ -5673,7 +5445,7 @@ function dangerouslyGetCurrentEventStateWithDrafts({
5673
5445
  }
5674
5446
  ]
5675
5447
  ) : [{ ...draft.action, id: getUUID() }];
5676
- const actionsWithDraft = (0, import_lodash4.orderBy)(
5448
+ const actionsWithDraft = (0, import_lodash3.orderBy)(
5677
5449
  [...actions, ...draftActions],
5678
5450
  ["createdAt"],
5679
5451
  "asc"
@@ -5719,13 +5491,13 @@ function getActionAnnotation({
5719
5491
  draft
5720
5492
  }) {
5721
5493
  const activeActions = getAcceptedActions(event2);
5722
- const action = (0, import_lodash4.findLast)(activeActions, (a) => a.type === actionType);
5494
+ const action = (0, import_lodash3.findLast)(activeActions, (a) => a.type === actionType);
5723
5495
  const actionWithCompleteAnnotation = action && {
5724
5496
  ...action,
5725
5497
  annotation: getCompleteActionAnnotation({}, event2, action)
5726
5498
  };
5727
5499
  const matchingDraft = draft?.action.type === actionType ? draft : void 0;
5728
- const sortedActions = (0, import_lodash4.orderBy)(
5500
+ const sortedActions = (0, import_lodash3.orderBy)(
5729
5501
  [actionWithCompleteAnnotation, matchingDraft?.action].filter(
5730
5502
  (a) => a !== void 0
5731
5503
  ),
@@ -5750,7 +5522,7 @@ function generateTransactionId() {
5750
5522
  }
5751
5523
 
5752
5524
  // ../commons/src/events/test.utils.ts
5753
- var import_lodash5 = require("lodash");
5525
+ var import_lodash4 = require("lodash");
5754
5526
  var import_date_fns4 = require("date-fns");
5755
5527
 
5756
5528
  // ../commons/src/field-config/field-configuration.ts
@@ -5772,6 +5544,7 @@ function field(fieldId, options = {}) {
5772
5544
  }
5773
5545
 
5774
5546
  // ../commons/src/fixtures/forms.ts
5547
+ var import_date_fns3 = require("date-fns");
5775
5548
  var PRINT_CERTIFICATE_FORM = defineActionForm({
5776
5549
  label: {
5777
5550
  id: "event.tennis-club-membership.action.certificate.form.label",
@@ -6569,7 +6342,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
6569
6342
  conditionals: [
6570
6343
  {
6571
6344
  type: ConditionalType.DISPLAY_ON_REVIEW,
6572
- conditional: never2()
6345
+ conditional: never()
6573
6346
  }
6574
6347
  ]
6575
6348
  },
@@ -6952,16 +6725,119 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
6952
6725
  }
6953
6726
  }
6954
6727
  ],
6955
- conditional: not(never2())
6728
+ conditional: not(never())
6956
6729
  // Intentional always-true page conditional to exercise interactions between page-level and field-level conditionals in tests
6957
6730
  }
6958
6731
  ]
6959
6732
  });
6733
+ var statusOptions = [
6734
+ {
6735
+ value: "ALL",
6736
+ label: {
6737
+ defaultMessage: "Any status",
6738
+ description: "Option for form field: status of record",
6739
+ id: "advancedSearch.form.recordStatusAny"
6740
+ }
6741
+ },
6742
+ {
6743
+ value: EventStatus.enum.CREATED,
6744
+ label: {
6745
+ defaultMessage: "Draft",
6746
+ description: "Option for form field: status of record",
6747
+ id: "advancedSearch.form.recordStatusCreated"
6748
+ }
6749
+ },
6750
+ {
6751
+ value: EventStatus.enum.NOTIFIED,
6752
+ label: {
6753
+ defaultMessage: "Notified",
6754
+ description: "Option for form field: status of record",
6755
+ id: "advancedSearch.form.recordStatusNotified"
6756
+ }
6757
+ },
6758
+ {
6759
+ value: EventStatus.enum.DECLARED,
6760
+ label: {
6761
+ defaultMessage: "Declared",
6762
+ description: "Option for form field: status of record",
6763
+ id: "advancedSearch.form.recordStatusDeclared"
6764
+ }
6765
+ },
6766
+ {
6767
+ value: EventStatus.enum.VALIDATED,
6768
+ label: {
6769
+ defaultMessage: "Validated",
6770
+ description: "Option for form field: status of record",
6771
+ id: "advancedSearch.form.recordStatusValidated"
6772
+ }
6773
+ },
6774
+ {
6775
+ value: EventStatus.enum.REGISTERED,
6776
+ label: {
6777
+ defaultMessage: "Registered",
6778
+ description: "Option for form field: status of record",
6779
+ id: "advancedSearch.form.recordStatusRegistered"
6780
+ }
6781
+ },
6782
+ {
6783
+ value: EventStatus.enum.ARCHIVED,
6784
+ label: {
6785
+ defaultMessage: "Archived",
6786
+ description: "Option for form field: status of record",
6787
+ id: "advancedSearch.form.recordStatusArchived"
6788
+ }
6789
+ }
6790
+ ];
6791
+ var timePeriodOptions = [
6792
+ {
6793
+ label: {
6794
+ defaultMessage: "Last 7 days",
6795
+ description: "Label for option of time period select: last 7 days",
6796
+ id: "form.section.label.timePeriodLast7Days"
6797
+ },
6798
+ value: `${(0, import_date_fns3.format)((0, import_date_fns3.subDays)(/* @__PURE__ */ new Date(), 7), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
6799
+ /* @__PURE__ */ new Date(),
6800
+ "yyyy-MM-dd"
6801
+ )}`
6802
+ },
6803
+ {
6804
+ label: {
6805
+ defaultMessage: "Last 30 days",
6806
+ description: "Label for option of time period select: last 30 days",
6807
+ id: "form.section.label.timePeriodLast30Days"
6808
+ },
6809
+ value: `${(0, import_date_fns3.format)((0, import_date_fns3.subMonths)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
6810
+ /* @__PURE__ */ new Date(),
6811
+ "yyyy-MM-dd"
6812
+ )}`
6813
+ },
6814
+ {
6815
+ label: {
6816
+ defaultMessage: "Last 90 days",
6817
+ description: "Label for option of time period select: last 90 days",
6818
+ id: "form.section.label.timePeriodLast90Days"
6819
+ },
6820
+ value: `${(0, import_date_fns3.format)((0, import_date_fns3.subQuarters)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
6821
+ /* @__PURE__ */ new Date(),
6822
+ "yyyy-MM-dd"
6823
+ )}`
6824
+ },
6825
+ {
6826
+ label: {
6827
+ defaultMessage: "Last year",
6828
+ description: "Label for option of time period select: last year",
6829
+ id: "form.section.label.timePeriodLastYear"
6830
+ },
6831
+ value: `${(0, import_date_fns3.format)((0, import_date_fns3.subYears)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
6832
+ /* @__PURE__ */ new Date(),
6833
+ "yyyy-MM-dd"
6834
+ )}`
6835
+ }
6836
+ ];
6960
6837
 
6961
6838
  // ../commons/src/fixtures/tennis-club-membership-event.ts
6962
6839
  var tennisClubMembershipEvent = defineConfig({
6963
6840
  id: TENNIS_CLUB_MEMBERSHIP,
6964
- declaration: TENNIS_CLUB_DECLARATION_FORM,
6965
6841
  label: {
6966
6842
  defaultMessage: "Tennis club membership application",
6967
6843
  description: "This is what this event is referred as in the system",
@@ -6992,17 +6868,6 @@ var tennisClubMembershipEvent = defineConfig({
6992
6868
  }
6993
6869
  ]
6994
6870
  },
6995
- flags: [
6996
- {
6997
- id: "validated",
6998
- label: {
6999
- id: "event.tennis-club-membership.flag.validated",
7000
- defaultMessage: "Validated",
7001
- description: "Flag label for validated"
7002
- },
7003
- requiresAction: true
7004
- }
7005
- ],
7006
6871
  actions: [
7007
6872
  {
7008
6873
  type: ActionType.READ,
@@ -7029,19 +6894,7 @@ var tennisClubMembershipEvent = defineConfig({
7029
6894
  description: "This is shown as the action name anywhere the user can trigger the action from",
7030
6895
  id: "event.tennis-club-membership.action.validate.label"
7031
6896
  },
7032
- flags: [{ id: "validated", operation: "add" }],
7033
- conditionals: [
7034
- { type: ConditionalType.SHOW, conditional: not(flag("validated")) }
7035
- ]
7036
- },
7037
- {
7038
- type: ActionType.REJECT,
7039
- label: {
7040
- defaultMessage: "Reject",
7041
- description: "This is shown as the action name anywhere the user can trigger the action from",
7042
- id: "event.tennis-club-membership.action.reject.label"
7043
- },
7044
- flags: [{ id: "validated", operation: "remove" }]
6897
+ review: TENNIS_CLUB_DECLARATION_REVIEW
7045
6898
  },
7046
6899
  {
7047
6900
  type: ActionType.REGISTER,
@@ -7049,7 +6902,8 @@ var tennisClubMembershipEvent = defineConfig({
7049
6902
  defaultMessage: "Register",
7050
6903
  description: "This is shown as the action name anywhere the user can trigger the action from",
7051
6904
  id: "event.tennis-club-membership.action.register.label"
7052
- }
6905
+ },
6906
+ review: TENNIS_CLUB_DECLARATION_REVIEW
7053
6907
  },
7054
6908
  {
7055
6909
  type: ActionType.REQUEST_CORRECTION,
@@ -7252,6 +7106,14 @@ var tennisClubMembershipEvent = defineConfig({
7252
7106
  ]
7253
7107
  }
7254
7108
  },
7109
+ {
7110
+ type: ActionType.APPROVE_CORRECTION,
7111
+ label: {
7112
+ defaultMessage: "Approve correction",
7113
+ description: "This is shown as the action name anywhere the user can trigger the action from",
7114
+ id: "event.tennis-club-membership.action.correction.approve.label"
7115
+ }
7116
+ },
7255
7117
  {
7256
7118
  type: ActionType.PRINT_CERTIFICATE,
7257
7119
  label: {
@@ -7260,6 +7122,22 @@ var tennisClubMembershipEvent = defineConfig({
7260
7122
  description: "This is shown as the action name anywhere the user can trigger the action from"
7261
7123
  },
7262
7124
  printForm: PRINT_CERTIFICATE_FORM
7125
+ },
7126
+ {
7127
+ type: ActionType.ARCHIVE,
7128
+ label: {
7129
+ id: "event.tennis-club-membership.action.archive.label",
7130
+ defaultMessage: "Archive",
7131
+ description: "This is shown as the action name anywhere the user can trigger the action from"
7132
+ }
7133
+ },
7134
+ {
7135
+ type: ActionType.REJECT,
7136
+ label: {
7137
+ id: "event.tennis-club-membership.action.reject.label",
7138
+ defaultMessage: "Reject",
7139
+ description: "This is shown as the action name anywhere the user can trigger the action from"
7140
+ }
7263
7141
  }
7264
7142
  ],
7265
7143
  advancedSearch: [
@@ -7296,7 +7174,8 @@ var tennisClubMembershipEvent = defineConfig({
7296
7174
  },
7297
7175
  fields: [field("recommender.name").fuzzy()]
7298
7176
  }
7299
- ]
7177
+ ],
7178
+ declaration: TENNIS_CLUB_DECLARATION_FORM
7300
7179
  });
7301
7180
 
7302
7181
  // ../commons/src/fixtures/football-club-membership-event.ts
@@ -7370,7 +7249,8 @@ var footballClubMembershipEvent = defineConfig({
7370
7249
  defaultMessage: "Validate",
7371
7250
  description: "This is shown as the action name anywhere the user can trigger the action from",
7372
7251
  id: "event.football-club-membership.action.validate.label"
7373
- }
7252
+ },
7253
+ review: TENNIS_CLUB_DECLARATION_REVIEW
7374
7254
  },
7375
7255
  {
7376
7256
  type: ActionType.REGISTER,
@@ -7378,7 +7258,8 @@ var footballClubMembershipEvent = defineConfig({
7378
7258
  defaultMessage: "Register",
7379
7259
  description: "This is shown as the action name anywhere the user can trigger the action from",
7380
7260
  id: "event.football-club-membership.action.register.label"
7381
- }
7261
+ },
7262
+ review: TENNIS_CLUB_DECLARATION_REVIEW
7382
7263
  },
7383
7264
  {
7384
7265
  type: ActionType.REQUEST_CORRECTION,
@@ -7584,6 +7465,14 @@ var footballClubMembershipEvent = defineConfig({
7584
7465
  ]
7585
7466
  }
7586
7467
  },
7468
+ {
7469
+ type: ActionType.APPROVE_CORRECTION,
7470
+ label: {
7471
+ defaultMessage: "Approve correction",
7472
+ description: "This is shown as the action name anywhere the user can trigger the action from",
7473
+ id: "event.football-club-membership.action.correction.approve.label"
7474
+ }
7475
+ },
7587
7476
  {
7588
7477
  type: ActionType.PRINT_CERTIFICATE,
7589
7478
  label: {
@@ -7592,6 +7481,22 @@ var footballClubMembershipEvent = defineConfig({
7592
7481
  description: "This is shown as the action name anywhere the user can trigger the action from"
7593
7482
  },
7594
7483
  printForm: PRINT_CERTIFICATE_FORM
7484
+ },
7485
+ {
7486
+ type: ActionType.ARCHIVE,
7487
+ label: {
7488
+ id: "event.football-club-membership.action.archive.label",
7489
+ defaultMessage: "Archive",
7490
+ description: "This is shown as the action name anywhere the user can trigger the action from"
7491
+ }
7492
+ },
7493
+ {
7494
+ type: ActionType.REJECT,
7495
+ label: {
7496
+ id: "event.football-club-membership.action.reject.label",
7497
+ defaultMessage: "Reject",
7498
+ description: "This is shown as the action name anywhere the user can trigger the action from"
7499
+ }
7595
7500
  }
7596
7501
  ],
7597
7502
  advancedSearch: [
@@ -7691,7 +7596,7 @@ var libraryMembershipEvent = defineConfig({
7691
7596
  declaration: libraryMembershipForm
7692
7597
  });
7693
7598
 
7694
- // ../commons/src/fixtures/child-onboarding-event.ts
7599
+ // ../commons/src/fixtures/v2-birth-event.ts
7695
7600
  function generateTranslationConfig(message) {
7696
7601
  return {
7697
7602
  defaultMessage: message,
@@ -7720,61 +7625,6 @@ var child = defineFormPage({
7720
7625
  secured: true,
7721
7626
  validation: [],
7722
7627
  label: generateTranslationConfig("Date of birth")
7723
- },
7724
- {
7725
- id: "child.placeOfBirth",
7726
- analytics: true,
7727
- type: FieldType.SELECT,
7728
- required: true,
7729
- secured: true,
7730
- label: {
7731
- defaultMessage: "Place of delivery",
7732
- description: "This is the label for the field",
7733
- id: "event.birth.action.declare.form.section.child.field.placeOfBirth.label"
7734
- },
7735
- options: [
7736
- {
7737
- value: "child.placeOfBirth-SELECT-2",
7738
- label: generateTranslationConfig("Health Institution")
7739
- },
7740
- {
7741
- value: "PRIVATE_HOME",
7742
- label: generateTranslationConfig("Residential address")
7743
- }
7744
- ]
7745
- },
7746
- {
7747
- id: "child.birthLocation",
7748
- analytics: true,
7749
- type: "FACILITY",
7750
- required: true,
7751
- secured: true,
7752
- label: generateTranslationConfig("Health Institution"),
7753
- conditionals: [
7754
- {
7755
- type: "SHOW",
7756
- conditional: field("child.placeOfBirth").isEqualTo(
7757
- "child.placeOfBirth-SELECT-2"
7758
- )
7759
- }
7760
- ]
7761
- },
7762
- {
7763
- id: "child.birthLocation.privateHome",
7764
- analytics: true,
7765
- type: FieldType.ADDRESS,
7766
- secured: true,
7767
- hideLabel: true,
7768
- label: generateTranslationConfig("Child's address"),
7769
- conditionals: [
7770
- {
7771
- type: "SHOW",
7772
- conditional: field("child.placeOfBirth").isEqualTo("PRIVATE_HOME")
7773
- }
7774
- ],
7775
- configuration: {
7776
- streetAddressForm: []
7777
- }
7778
7628
  }
7779
7629
  ]
7780
7630
  });
@@ -7851,7 +7701,7 @@ var mother = defineFormPage({
7851
7701
  }
7852
7702
  ]
7853
7703
  });
7854
- var CHILD_ONBOARDING_DECLARATION_REVIEW = {
7704
+ var BIRTH_DECLARATION_REVIEW = {
7855
7705
  title: generateTranslationConfig(
7856
7706
  "{child.name.firstname, select, __EMPTY__ {Birth declaration} other {{child.name.surname, select, __EMPTY__ {Birth declaration for {child.name.firstname}} other {Birth declaration for {child.name.firstname} {child.name.surname}}}}}"
7857
7707
  ),
@@ -7871,12 +7721,12 @@ var CHILD_ONBOARDING_DECLARATION_REVIEW = {
7871
7721
  }
7872
7722
  ]
7873
7723
  };
7874
- var CHILD_ONBOARDING_DECLARATION_FORM = defineDeclarationForm({
7724
+ var BIRTH_DECLARATION_FORM = defineDeclarationForm({
7875
7725
  label: generateTranslationConfig("Birth decalration form"),
7876
7726
  pages: [child, mother]
7877
7727
  });
7878
- var ChildOnboardingEvent = defineConfig({
7879
- id: CHILD_ONBOARDING_EVENT,
7728
+ var v2BirthEvent = defineConfig({
7729
+ id: BIRTH_EVENT,
7880
7730
  title: generateTranslationConfig(
7881
7731
  "{child.name.firstname} {child.name.surname}"
7882
7732
  ),
@@ -7884,34 +7734,36 @@ var ChildOnboardingEvent = defineConfig({
7884
7734
  summary: {
7885
7735
  fields: []
7886
7736
  },
7887
- declaration: CHILD_ONBOARDING_DECLARATION_FORM,
7737
+ declaration: BIRTH_DECLARATION_FORM,
7888
7738
  actions: [
7889
7739
  {
7890
7740
  type: ActionType.READ,
7891
7741
  label: generateTranslationConfig("Read"),
7892
- review: CHILD_ONBOARDING_DECLARATION_REVIEW
7742
+ review: BIRTH_DECLARATION_REVIEW
7893
7743
  },
7894
7744
  {
7895
7745
  type: ActionType.DECLARE,
7896
7746
  label: generateTranslationConfig("Declare"),
7897
- review: CHILD_ONBOARDING_DECLARATION_REVIEW
7747
+ review: BIRTH_DECLARATION_REVIEW
7898
7748
  },
7899
7749
  {
7900
7750
  type: ActionType.VALIDATE,
7901
- label: generateTranslationConfig("Validate")
7751
+ label: generateTranslationConfig("Validate"),
7752
+ review: BIRTH_DECLARATION_REVIEW
7902
7753
  },
7903
7754
  {
7904
7755
  type: ActionType.REGISTER,
7905
- label: generateTranslationConfig("Register")
7756
+ label: generateTranslationConfig("Register"),
7757
+ review: BIRTH_DECLARATION_REVIEW
7906
7758
  }
7907
7759
  ],
7908
7760
  advancedSearch: []
7909
7761
  });
7910
7762
 
7911
7763
  // ../commons/src/events/test.utils.ts
7912
- var z37 = __toESM(require("zod/v4"));
7764
+ var import_zod35 = require("zod");
7913
7765
  var TEST_SYSTEM_IANA_TIMEZONE = "Asia/Dhaka";
7914
- var TestUserRole = z37.enum([
7766
+ var TestUserRole = import_zod35.z.enum([
7915
7767
  "FIELD_AGENT",
7916
7768
  "LOCAL_REGISTRAR",
7917
7769
  "LOCAL_SYSTEM_ADMIN",
@@ -7967,13 +7819,13 @@ function generateUuid(rng = () => 0.1) {
7967
7819
  });
7968
7820
  }
7969
7821
  function generateTrackingId(rng) {
7970
- const uuid2 = generateUuid(rng).replace(/-/g, "");
7971
- const trackingId = uuid2.slice(0, 6).toUpperCase();
7822
+ const uuid = generateUuid(rng).replace(/-/g, "");
7823
+ const trackingId = uuid.slice(0, 6).toUpperCase();
7972
7824
  return trackingId;
7973
7825
  }
7974
7826
  function generateRegistrationNumber(rng) {
7975
- const uuid2 = generateUuid(rng).replace(/-/g, "");
7976
- const registrationNumber = uuid2.slice(0, 12).toUpperCase();
7827
+ const uuid = generateUuid(rng).replace(/-/g, "");
7828
+ const registrationNumber = uuid.slice(0, 12).toUpperCase();
7977
7829
  return registrationNumber;
7978
7830
  }
7979
7831
  function generateRandomSignature(rng) {
@@ -8080,7 +7932,7 @@ function fieldConfigsToActionPayload(fields, rng) {
8080
7932
  }
8081
7933
  function generateActionDeclarationInput(configuration, action, rng, overrides) {
8082
7934
  const parsed = DeclarationUpdateActions.safeParse(action);
8083
- if ((0, import_lodash5.isEmpty)(overrides) && typeof overrides === "object") {
7935
+ if ((0, import_lodash4.isEmpty)(overrides) && typeof overrides === "object") {
8084
7936
  return {};
8085
7937
  }
8086
7938
  if (parsed.success) {
@@ -8182,12 +8034,12 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
8182
8034
  },
8183
8035
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
8184
8036
  createdBy: "@todo",
8185
- createdByUserType: TokenUserType.enum.user,
8037
+ createdByUserType: TokenUserType.Enum.user,
8186
8038
  createdByRole: "@todo"
8187
8039
  }
8188
8040
  };
8189
- base.action.declaration = (0, import_lodash5.omit)(base.action.declaration, omitFields);
8190
- return (0, import_lodash5.merge)(base, input);
8041
+ base.action.declaration = (0, import_lodash4.omit)(base.action.declaration, omitFields);
8042
+ return (0, import_lodash4.merge)(base, input);
8191
8043
  },
8192
8044
  actions: {
8193
8045
  declare: (eventId, input = {}) => ({
@@ -8208,13 +8060,13 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
8208
8060
  notify: (eventId, input = {}) => {
8209
8061
  let declaration = input.declaration;
8210
8062
  if (!declaration) {
8211
- const partialDeclaration = (0, import_lodash5.omitBy)(
8063
+ const partialDeclaration = (0, import_lodash4.omitBy)(
8212
8064
  generateActionDeclarationInput(
8213
8065
  configuration,
8214
8066
  ActionType.NOTIFY,
8215
8067
  rng
8216
8068
  ),
8217
- import_lodash5.isString
8069
+ import_lodash4.isString
8218
8070
  );
8219
8071
  declaration = partialDeclaration;
8220
8072
  }
@@ -8239,6 +8091,7 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
8239
8091
  ActionType.VALIDATE,
8240
8092
  rng
8241
8093
  ),
8094
+ duplicates: [],
8242
8095
  eventId,
8243
8096
  ...input
8244
8097
  }),
@@ -8261,6 +8114,7 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
8261
8114
  transactionId: input.transactionId ?? getUUID(),
8262
8115
  declaration: {},
8263
8116
  annotation: {},
8117
+ duplicates: [],
8264
8118
  eventId,
8265
8119
  content: {
8266
8120
  reason: `${ActionType.ARCHIVE}`
@@ -8272,6 +8126,7 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
8272
8126
  transactionId: input.transactionId ?? getUUID(),
8273
8127
  declaration: {},
8274
8128
  annotation: input.annotation ?? generateActionAnnotationInput(configuration, ActionType.REJECT, rng),
8129
+ duplicates: [],
8275
8130
  eventId,
8276
8131
  content: { reason: `${ActionType.REJECT}` },
8277
8132
  ...input
@@ -8308,7 +8163,7 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
8308
8163
  request: (eventId, input = {}) => ({
8309
8164
  type: ActionType.REQUEST_CORRECTION,
8310
8165
  transactionId: input.transactionId ?? getUUID(),
8311
- declaration: input.declaration ?? (0, import_lodash5.omit)(
8166
+ declaration: input.declaration ?? (0, import_lodash4.omit)(
8312
8167
  generateActionDeclarationInput(
8313
8168
  configuration,
8314
8169
  ActionType.REQUEST_CORRECTION,
@@ -8401,8 +8256,8 @@ function generateActionDocument({
8401
8256
  // @TODO: This should be fixed in the future.
8402
8257
  createdAt: new Date(Date.now() - 500).toISOString(),
8403
8258
  createdBy: generateUuid(rng),
8404
- createdByUserType: TokenUserType.enum.user,
8405
- createdByRole: TestUserRole.enum.FIELD_AGENT,
8259
+ createdByUserType: TokenUserType.Enum.user,
8260
+ createdByRole: TestUserRole.Enum.FIELD_AGENT,
8406
8261
  id: getUUID(),
8407
8262
  createdAtLocation: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
8408
8263
  declaration: generateActionDeclarationInput(
@@ -8417,12 +8272,6 @@ function generateActionDocument({
8417
8272
  ...defaults
8418
8273
  };
8419
8274
  switch (action) {
8420
- case ActionType.CUSTOM:
8421
- return {
8422
- ...actionBase,
8423
- type: action,
8424
- customActionType: "CUSTOM_ACTION_TYPE"
8425
- };
8426
8275
  case ActionType.READ:
8427
8276
  return { ...actionBase, type: action };
8428
8277
  case ActionType.MARK_AS_NOT_DUPLICATE:
@@ -8507,7 +8356,7 @@ function generateEventDocument({
8507
8356
  defaults = {}
8508
8357
  }) {
8509
8358
  return {
8510
- trackingId: generateTrackingId(rng),
8359
+ trackingId: getUUID(),
8511
8360
  type: configuration.id,
8512
8361
  actions: actions.map(
8513
8362
  (action, i) => generateActionDocument({
@@ -8690,7 +8539,7 @@ function isFieldConfigDefaultValue(value) {
8690
8539
  }
8691
8540
 
8692
8541
  // ../commons/src/events/scopes.ts
8693
- var import_lodash6 = require("lodash");
8542
+ var import_lodash5 = require("lodash");
8694
8543
  var ACTION_SCOPE_MAP = {
8695
8544
  [ActionType.READ]: ["record.read"],
8696
8545
  [ActionType.CREATE]: ["record.create"],
@@ -8719,11 +8568,10 @@ var ACTION_SCOPE_MAP = {
8719
8568
  [ActionType.REJECT]: ["record.declared.reject"],
8720
8569
  [ActionType.ASSIGN]: null,
8721
8570
  [ActionType.UNASSIGN]: null,
8722
- [ActionType.DUPLICATE_DETECTED]: [],
8723
- [ActionType.CUSTOM]: []
8571
+ [ActionType.DUPLICATE_DETECTED]: []
8724
8572
  };
8725
8573
  function hasAnyOfScopes(a, b) {
8726
- return (0, import_lodash6.intersection)(a, b).length > 0;
8574
+ return (0, import_lodash5.intersection)(a, b).length > 0;
8727
8575
  }
8728
8576
  function configurableEventScopeAllowed(scopes2, allowedConfigurableScopes, eventType) {
8729
8577
  const parsedScopes = allowedConfigurableScopes.map((scope) => findScope(scopes2, scope)).filter((scope) => scope !== void 0);
@@ -8822,25 +8670,28 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
8822
8670
  ActionType.READ,
8823
8671
  ActionType.DECLARE,
8824
8672
  ActionType.NOTIFY,
8825
- ActionType.DELETE,
8826
- ActionType.CUSTOM
8673
+ ActionType.DELETE
8827
8674
  ],
8828
8675
  [EventStatus.enum.NOTIFIED]: [
8829
8676
  ActionType.READ,
8830
8677
  ActionType.DECLARE,
8831
8678
  ActionType.MARK_AS_DUPLICATE,
8832
8679
  ActionType.ARCHIVE,
8833
- ActionType.REJECT,
8834
- ActionType.CUSTOM
8680
+ ActionType.REJECT
8835
8681
  ],
8836
8682
  [EventStatus.enum.DECLARED]: [
8837
8683
  ActionType.READ,
8838
8684
  ActionType.VALIDATE,
8685
+ ActionType.MARK_AS_DUPLICATE,
8686
+ ActionType.ARCHIVE,
8687
+ ActionType.REJECT
8688
+ ],
8689
+ [EventStatus.enum.VALIDATED]: [
8690
+ ActionType.READ,
8839
8691
  ActionType.REGISTER,
8840
8692
  ActionType.MARK_AS_DUPLICATE,
8841
8693
  ActionType.ARCHIVE,
8842
- ActionType.REJECT,
8843
- ActionType.CUSTOM
8694
+ ActionType.REJECT
8844
8695
  ],
8845
8696
  [EventStatus.enum.REGISTERED]: [
8846
8697
  ActionType.READ,
@@ -8848,65 +8699,72 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
8848
8699
  ActionType.REQUEST_CORRECTION,
8849
8700
  ActionType.APPROVE_CORRECTION,
8850
8701
  ActionType.REJECT_CORRECTION,
8851
- ActionType.CUSTOM,
8852
8702
  ClientSpecificAction.REVIEW_CORRECTION_REQUEST
8853
8703
  ],
8854
8704
  [EventStatus.enum.ARCHIVED]: [
8855
8705
  ActionType.READ,
8856
8706
  ActionType.ASSIGN,
8857
- ActionType.UNASSIGN,
8858
- ActionType.CUSTOM
8707
+ ActionType.UNASSIGN
8859
8708
  ]
8860
8709
  };
8861
8710
  var ACTION_FILTERS = {
8862
- [ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8863
- [ActionType.REQUEST_CORRECTION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8864
- [ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8865
- [ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8866
- [ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8867
- [ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
8868
- [ActionType.VALIDATE]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
8869
- [ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
8870
- [ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8871
- [ActionType.ARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested"))
8711
+ [ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
8712
+ [ActionType.REQUEST_CORRECTION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
8713
+ [ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
8714
+ [ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
8715
+ [ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
8716
+ [ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
8717
+ [ActionType.VALIDATE]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
8718
+ [ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
8719
+ [ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag) => flag.endsWith(":requested")),
8720
+ [ActionType.ARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))
8872
8721
  };
8873
8722
  function filterActionsByFlags(actions, flags) {
8874
8723
  return actions.filter((action) => ACTION_FILTERS[action]?.(flags) ?? true);
8875
8724
  }
8876
- function getAvailableActionsWithoutFlagFilters(status2, flags) {
8877
- switch (status2) {
8878
- case EventStatus.enum.CREATED: {
8879
- return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status2];
8725
+ function getAvailableActionsWithoutFlagFilters(status, flags) {
8726
+ switch (status) {
8727
+ case EventStatus.Enum.CREATED: {
8728
+ return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status];
8880
8729
  }
8881
- case EventStatus.enum.NOTIFIED: {
8730
+ case EventStatus.Enum.NOTIFIED: {
8882
8731
  if (flags.includes(InherentFlags.REJECTED)) {
8883
8732
  return getAvailableActionsWithoutFlagFilters(
8884
- EventStatus.enum.CREATED,
8885
- flags.filter((flag2) => flag2 !== InherentFlags.REJECTED)
8733
+ EventStatus.Enum.CREATED,
8734
+ flags.filter((flag) => flag !== InherentFlags.REJECTED)
8886
8735
  ).filter((action) => action !== ActionType.DELETE).concat(ActionType.ARCHIVE);
8887
8736
  }
8888
- return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status2];
8737
+ return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status];
8889
8738
  }
8890
- case EventStatus.enum.DECLARED: {
8739
+ case EventStatus.Enum.DECLARED: {
8891
8740
  if (flags.includes(InherentFlags.REJECTED)) {
8892
8741
  return getAvailableActionsWithoutFlagFilters(
8893
- EventStatus.enum.CREATED,
8894
- flags.filter((flag2) => flag2 !== InherentFlags.REJECTED)
8742
+ EventStatus.Enum.CREATED,
8743
+ flags.filter((flag) => flag !== InherentFlags.REJECTED)
8895
8744
  ).filter((action) => action !== ActionType.DELETE).concat(ActionType.ARCHIVE);
8896
8745
  }
8897
- return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status2];
8746
+ return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status];
8898
8747
  }
8899
- case EventStatus.enum.REGISTERED: {
8900
- return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status2];
8748
+ case EventStatus.Enum.VALIDATED: {
8749
+ if (flags.includes(InherentFlags.REJECTED)) {
8750
+ return getAvailableActionsWithoutFlagFilters(
8751
+ EventStatus.Enum.DECLARED,
8752
+ flags.filter((flag) => flag !== InherentFlags.REJECTED)
8753
+ );
8754
+ }
8755
+ return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status];
8901
8756
  }
8902
- case EventStatus.enum.ARCHIVED: {
8903
- return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status2];
8757
+ case EventStatus.Enum.REGISTERED: {
8758
+ return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status];
8759
+ }
8760
+ case EventStatus.Enum.ARCHIVED: {
8761
+ return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status];
8904
8762
  }
8905
8763
  }
8906
8764
  }
8907
- function getAvailableActions(status2, flags) {
8765
+ function getAvailableActions(status, flags) {
8908
8766
  return filterActionsByFlags(
8909
- getAvailableActionsWithoutFlagFilters(status2, flags),
8767
+ getAvailableActionsWithoutFlagFilters(status, flags),
8910
8768
  flags
8911
8769
  );
8912
8770
  }
@@ -8918,7 +8776,7 @@ function getAvailableActionsForEvent(event2) {
8918
8776
  }
8919
8777
 
8920
8778
  // ../commons/src/events/FileUtils.ts
8921
- var import_lodash7 = require("lodash");
8779
+ var import_lodash6 = require("lodash");
8922
8780
  function getFilePathsFromEvent(event2) {
8923
8781
  const filepaths = event2.actions.filter(
8924
8782
  (action) => action.status !== ActionStatus.Rejected
@@ -8941,20 +8799,20 @@ function getFilePathsFromEvent(event2) {
8941
8799
  });
8942
8800
  return actionFilePaths;
8943
8801
  });
8944
- return (0, import_lodash7.uniq)(filepaths);
8802
+ return (0, import_lodash6.uniq)(filepaths);
8945
8803
  }
8946
8804
 
8947
8805
  // ../commons/src/events/locations.ts
8948
- var z38 = __toESM(require("zod/v4"));
8949
- var LocationType = z38.enum([
8806
+ var import_zod36 = require("zod");
8807
+ var LocationType = import_zod36.z.enum([
8950
8808
  "ADMIN_STRUCTURE",
8951
8809
  "CRVS_OFFICE",
8952
8810
  "HEALTH_FACILITY"
8953
8811
  ]);
8954
- var Location = z38.object({
8812
+ var Location = import_zod36.z.object({
8955
8813
  id: UUID,
8956
- name: z38.string(),
8814
+ name: import_zod36.z.string(),
8957
8815
  parentId: UUID.nullable(),
8958
- validUntil: z38.iso.datetime().nullable(),
8816
+ validUntil: import_zod36.z.string().datetime().nullable(),
8959
8817
  locationType: LocationType.nullable()
8960
8818
  });