@opencrvs/toolkit 1.8.0-rc.fb8e005 → 1.8.0-rc.fbababd

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 (32) hide show
  1. package/dist/commons/api/router.d.ts +8621 -5643
  2. package/dist/commons/events/ActionConfig.d.ts +18584 -33488
  3. package/dist/commons/events/ActionDocument.d.ts +1083 -1182
  4. package/dist/commons/events/ActionInput.d.ts +726 -726
  5. package/dist/commons/events/AdvancedSearchConfig.d.ts +18 -222
  6. package/dist/commons/events/CompositeFieldValue.d.ts +6 -6
  7. package/dist/commons/events/CountryConfigQueryInput.d.ts +412 -1160
  8. package/dist/commons/events/CreatedAtLocation.d.ts +2 -1
  9. package/dist/commons/events/Draft.d.ts +71 -76
  10. package/dist/commons/events/EventConfig.d.ts +17504 -27573
  11. package/dist/commons/events/EventDocument.d.ts +707 -782
  12. package/dist/commons/events/EventIndex.d.ts +224 -639
  13. package/dist/commons/events/EventMetadata.d.ts +31 -73
  14. package/dist/commons/events/FieldConfig.d.ts +37 -198
  15. package/dist/commons/events/FieldTypeMapping.d.ts +16 -16
  16. package/dist/commons/events/FieldValue.d.ts +12 -12
  17. package/dist/commons/events/FormConfig.d.ts +66 -1200
  18. package/dist/commons/events/PageConfig.d.ts +18 -288
  19. package/dist/commons/events/WorkqueueColumnConfig.d.ts +11 -11
  20. package/dist/commons/events/WorkqueueConfig.d.ts +740 -3237
  21. package/dist/commons/events/defineConfig.d.ts +1589 -3532
  22. package/dist/commons/events/field.d.ts +0 -5
  23. package/dist/commons/events/index.d.ts +0 -1
  24. package/dist/commons/events/scopes.d.ts +3 -2
  25. package/dist/commons/events/test.utils.d.ts +17 -40
  26. package/dist/commons/events/transactions.d.ts +1 -1
  27. package/dist/commons/events/utils.d.ts +1604 -3684
  28. package/dist/conditionals/index.js +17 -20
  29. package/dist/events/index.js +1323 -1695
  30. package/dist/scopes/index.d.ts +1 -4
  31. package/dist/scopes/index.js +17 -67
  32. package/package.json +3 -3
@@ -32,7 +32,6 @@ var events_exports = {};
32
32
  __export(events_exports, {
33
33
  ACTION_ALLOWED_CONFIGURABLE_SCOPES: () => ACTION_ALLOWED_CONFIGURABLE_SCOPES,
34
34
  ACTION_ALLOWED_SCOPES: () => ACTION_ALLOWED_SCOPES,
35
- AVAILABLE_ACTIONS_BY_EVENT_STATUS: () => AVAILABLE_ACTIONS_BY_EVENT_STATUS,
36
35
  Action: () => Action,
37
36
  ActionBase: () => ActionBase,
38
37
  ActionConditional: () => ActionConditional,
@@ -69,7 +68,7 @@ __export(events_exports, {
69
68
  Conditional: () => Conditional,
70
69
  ConditionalType: () => ConditionalType,
71
70
  ConfirmableActions: () => ConfirmableActions,
72
- ContainsFlags: () => ContainsFlags,
71
+ CustomFlags: () => CustomFlags,
73
72
  DEFAULT_DATE_OF_EVENT_PROPERTY: () => DEFAULT_DATE_OF_EVENT_PROPERTY,
74
73
  DataEntry: () => DataEntry,
75
74
  DataFieldValue: () => DataFieldValue,
@@ -104,7 +103,6 @@ __export(events_exports, {
104
103
  EventState: () => EventState,
105
104
  EventStatus: () => EventStatus,
106
105
  Exact: () => Exact,
107
- ExactDate: () => ExactDate,
108
106
  ExactStatus: () => ExactStatus,
109
107
  FieldConditional: () => FieldConditional,
110
108
  FieldConfig: () => FieldConfig,
@@ -124,7 +122,6 @@ __export(events_exports, {
124
122
  GenericAddressValue: () => GenericAddressValue,
125
123
  GeographicalArea: () => GeographicalArea,
126
124
  ImageMimeType: () => ImageMimeType,
127
- InherentFlags: () => InherentFlags,
128
125
  LanguageConfig: () => LanguageConfig,
129
126
  LegalStatuses: () => LegalStatuses,
130
127
  MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
@@ -132,6 +129,7 @@ __export(events_exports, {
132
129
  NameFieldUpdateValue: () => NameFieldUpdateValue,
133
130
  NameFieldValue: () => NameFieldValue,
134
131
  NonEmptyTextValue: () => NonEmptyTextValue,
132
+ Not: () => Not,
135
133
  NotifyActionInput: () => NotifyActionInput,
136
134
  NumberFieldValue: () => NumberFieldValue,
137
135
  PageConfig: () => PageConfig,
@@ -141,7 +139,6 @@ __export(events_exports, {
141
139
  QueryInput: () => QueryInput,
142
140
  QueryType: () => QueryType,
143
141
  Range: () => Range,
144
- RangeDate: () => RangeDate,
145
142
  ReadActionInput: () => ReadActionInput,
146
143
  RegisterAction: () => RegisterAction,
147
144
  RegisterActionInput: () => RegisterActionInput,
@@ -160,7 +157,6 @@ __export(events_exports, {
160
157
  SignatureFieldValue: () => SignatureFieldValue,
161
158
  SummaryConfig: () => SummaryConfig,
162
159
  TENNIS_CLUB_MEMBERSHIP: () => TENNIS_CLUB_MEMBERSHIP,
163
- TestUserRole: () => TestUserRole,
164
160
  TextValue: () => TextValue,
165
161
  TranslationConfig: () => TranslationConfig,
166
162
  UnassignActionInput: () => UnassignActionInput,
@@ -168,10 +164,8 @@ __export(events_exports, {
168
164
  UrbanAddressValue: () => UrbanAddressValue,
169
165
  User: () => User,
170
166
  ValidateActionInput: () => ValidateActionInput,
171
- ValidationConfig: () => ValidationConfig,
172
167
  VerificationActionConfig: () => VerificationActionConfig,
173
168
  VerificationPageConfig: () => VerificationPageConfig,
174
- WRITE_ACTION_SCOPES: () => WRITE_ACTION_SCOPES,
175
169
  Within: () => Within,
176
170
  WorkqueueActionsWithDefault: () => WorkqueueActionsWithDefault,
177
171
  WorkqueueColumn: () => WorkqueueColumn,
@@ -180,7 +174,6 @@ __export(events_exports, {
180
174
  WorkqueueColumnValue: () => WorkqueueColumnValue,
181
175
  WorkqueueConfig: () => WorkqueueConfig,
182
176
  WorkqueueConfigInput: () => WorkqueueConfigInput,
183
- WorkqueueConfigWithoutQuery: () => WorkqueueConfigWithoutQuery,
184
177
  WorkqueueCountInput: () => WorkqueueCountInput,
185
178
  WorkqueueCountOutput: () => WorkqueueCountOutput,
186
179
  ZodDate: () => ZodDate,
@@ -216,6 +209,7 @@ __export(events_exports, {
216
209
  eventQueryDataGenerator: () => eventQueryDataGenerator,
217
210
  field: () => field,
218
211
  fieldTypes: () => fieldTypes,
212
+ filterUnallowedActions: () => filterUnallowedActions,
219
213
  findActiveDrafts: () => findActiveDrafts,
220
214
  findAllFields: () => findAllFields,
221
215
  findLastAssignmentAction: () => findLastAssignmentAction,
@@ -227,10 +221,8 @@ __export(events_exports, {
227
221
  generateEventDraftDocument: () => generateEventDraftDocument,
228
222
  generateRandomName: () => generateRandomName,
229
223
  generateRandomSignature: () => generateRandomSignature,
230
- generateRegistrationNumber: () => generateRegistrationNumber,
231
224
  generateTransactionId: () => generateTransactionId,
232
225
  generateTranslationConfig: () => generateTranslationConfig,
233
- generateUuid: () => generateUuid,
234
226
  generateWorkqueues: () => generateWorkqueues,
235
227
  getAcceptedActions: () => getAcceptedActions,
236
228
  getActionAnnotation: () => getActionAnnotation,
@@ -371,12 +363,6 @@ var FieldConditional = import_zod.z.discriminatedUnion("type", [
371
363
  ref: "FieldConditional"
372
364
  });
373
365
 
374
- // ../commons/src/events/PageConfig.ts
375
- var import_zod6 = require("zod");
376
-
377
- // ../commons/src/events/FieldConfig.ts
378
- var import_zod5 = require("zod");
379
-
380
366
  // ../commons/src/events/TranslationConfig.ts
381
367
  var import_zod2 = require("zod");
382
368
  var import_zod_openapi2 = require("zod-openapi");
@@ -394,6 +380,105 @@ var TranslationConfig = import_zod2.z.object({
394
380
  ref: "TranslationConfig"
395
381
  });
396
382
 
383
+ // ../commons/src/events/ActionType.ts
384
+ var import_zod3 = require("zod");
385
+ var ActionType = {
386
+ // Pre-declaration actions
387
+ DELETE: "DELETE",
388
+ CREATE: "CREATE",
389
+ NOTIFY: "NOTIFY",
390
+ // Declaration actions
391
+ DECLARE: "DECLARE",
392
+ VALIDATE: "VALIDATE",
393
+ REGISTER: "REGISTER",
394
+ // Declaration system actions. Non-configurable.
395
+ DETECT_DUPLICATE: "DETECT_DUPLICATE",
396
+ REJECT: "REJECT",
397
+ // REJECT_DECLARATION
398
+ MARKED_AS_DUPLICATE: "MARKED_AS_DUPLICATE",
399
+ // MARK_AS_DUPLICATE
400
+ ARCHIVE: "ARCHIVE",
401
+ // Record actions
402
+ PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
403
+ REQUEST_CORRECTION: "REQUEST_CORRECTION",
404
+ REJECT_CORRECTION: "REJECT_CORRECTION",
405
+ APPROVE_CORRECTION: "APPROVE_CORRECTION",
406
+ // General actions
407
+ READ: "READ",
408
+ ASSIGN: "ASSIGN",
409
+ UNASSIGN: "UNASSIGN"
410
+ };
411
+ var ConfirmableActions = [
412
+ ActionType.NOTIFY,
413
+ ActionType.DECLARE,
414
+ ActionType.VALIDATE,
415
+ ActionType.REGISTER,
416
+ ActionType.REJECT,
417
+ ActionType.ARCHIVE,
418
+ ActionType.PRINT_CERTIFICATE
419
+ ];
420
+ var ActionTypes = import_zod3.z.enum([
421
+ "DELETE",
422
+ "CREATE",
423
+ "NOTIFY",
424
+ "DECLARE",
425
+ "VALIDATE",
426
+ "REGISTER",
427
+ "DETECT_DUPLICATE",
428
+ "REJECT",
429
+ "MARKED_AS_DUPLICATE",
430
+ "ARCHIVE",
431
+ "PRINT_CERTIFICATE",
432
+ "REQUEST_CORRECTION",
433
+ "REJECT_CORRECTION",
434
+ "APPROVE_CORRECTION",
435
+ "READ",
436
+ "ASSIGN",
437
+ "UNASSIGN"
438
+ ]);
439
+ var declarationActionValues = [
440
+ ActionTypes.enum.DECLARE,
441
+ ActionTypes.enum.VALIDATE,
442
+ ActionTypes.enum.REGISTER
443
+ ];
444
+ var DeclarationActions = ActionTypes.extract(declarationActionValues);
445
+ var declarationUpdateActionValues = [
446
+ ...declarationActionValues,
447
+ ActionTypes.enum.REQUEST_CORRECTION
448
+ ];
449
+ var DeclarationUpdateActions = ActionTypes.extract(
450
+ declarationUpdateActionValues
451
+ );
452
+ var annotationActions = ActionTypes.exclude(declarationActionValues);
453
+ var writeActions = ActionTypes.exclude([
454
+ ActionType.CREATE,
455
+ ActionType.READ,
456
+ ActionType.ASSIGN,
457
+ ActionType.UNASSIGN
458
+ ]);
459
+ var workqueueActions = ActionTypes.exclude([
460
+ ActionType.CREATE,
461
+ ActionType.NOTIFY,
462
+ ActionType.DETECT_DUPLICATE,
463
+ ActionType.REJECT,
464
+ ActionType.MARKED_AS_DUPLICATE,
465
+ ActionType.ARCHIVE,
466
+ ActionType.REQUEST_CORRECTION,
467
+ ActionType.REJECT_CORRECTION,
468
+ ActionType.APPROVE_CORRECTION
469
+ ]);
470
+ var META_ACTIONS = [
471
+ ActionType.ASSIGN,
472
+ ActionType.UNASSIGN,
473
+ ActionType.READ
474
+ ];
475
+ function isMetaAction(actionType) {
476
+ return META_ACTIONS.includes(actionType);
477
+ }
478
+
479
+ // ../commons/src/events/FieldConfig.ts
480
+ var import_zod6 = require("zod");
481
+
397
482
  // ../commons/src/events/FieldType.ts
398
483
  var FieldType = {
399
484
  NAME: "NAME",
@@ -432,10 +517,10 @@ var compositeFieldTypes = [
432
517
  ];
433
518
 
434
519
  // ../commons/src/events/FieldValue.ts
435
- var import_zod4 = require("zod");
520
+ var import_zod5 = require("zod");
436
521
 
437
522
  // ../commons/src/events/CompositeFieldValue.ts
438
- var import_zod3 = require("zod");
523
+ var import_zod4 = require("zod");
439
524
  var GeographicalArea = {
440
525
  URBAN: "URBAN",
441
526
  RURAL: "RURAL"
@@ -444,98 +529,98 @@ var AddressType = {
444
529
  DOMESTIC: "DOMESTIC",
445
530
  INTERNATIONAL: "INTERNATIONAL"
446
531
  };
447
- var FileFieldValue = import_zod3.z.object({
448
- filename: import_zod3.z.string(),
449
- originalFilename: import_zod3.z.string(),
450
- type: import_zod3.z.string()
532
+ var FileFieldValue = import_zod4.z.object({
533
+ filename: import_zod4.z.string(),
534
+ originalFilename: import_zod4.z.string(),
535
+ type: import_zod4.z.string()
451
536
  });
452
- var AdminStructure = import_zod3.z.object({
453
- country: import_zod3.z.string(),
454
- addressType: import_zod3.z.literal(AddressType.DOMESTIC),
455
- province: import_zod3.z.string(),
456
- district: import_zod3.z.string()
537
+ var AdminStructure = import_zod4.z.object({
538
+ country: import_zod4.z.string(),
539
+ addressType: import_zod4.z.literal(AddressType.DOMESTIC),
540
+ province: import_zod4.z.string(),
541
+ district: import_zod4.z.string()
457
542
  });
458
543
  var UrbanAddressValue = AdminStructure.extend({
459
- urbanOrRural: import_zod3.z.literal(GeographicalArea.URBAN),
460
- town: import_zod3.z.string().optional(),
461
- residentialArea: import_zod3.z.string().optional(),
462
- street: import_zod3.z.string().optional(),
463
- number: import_zod3.z.string().optional(),
464
- zipCode: import_zod3.z.string().optional()
544
+ urbanOrRural: import_zod4.z.literal(GeographicalArea.URBAN),
545
+ town: import_zod4.z.string().optional(),
546
+ residentialArea: import_zod4.z.string().optional(),
547
+ street: import_zod4.z.string().optional(),
548
+ number: import_zod4.z.string().optional(),
549
+ zipCode: import_zod4.z.string().optional()
465
550
  });
466
551
  var RuralAddressValue = AdminStructure.extend({
467
- urbanOrRural: import_zod3.z.literal(GeographicalArea.RURAL),
468
- village: import_zod3.z.string().optional()
552
+ urbanOrRural: import_zod4.z.literal(GeographicalArea.RURAL),
553
+ village: import_zod4.z.string().optional()
469
554
  });
470
555
  var UrbanAddressUpdateValue = AdminStructure.extend({
471
- urbanOrRural: import_zod3.z.literal(GeographicalArea.URBAN),
472
- town: import_zod3.z.string().nullish(),
473
- residentialArea: import_zod3.z.string().nullish(),
474
- street: import_zod3.z.string().nullish(),
475
- number: import_zod3.z.string().nullish(),
476
- zipCode: import_zod3.z.string().nullish()
556
+ urbanOrRural: import_zod4.z.literal(GeographicalArea.URBAN),
557
+ town: import_zod4.z.string().nullish(),
558
+ residentialArea: import_zod4.z.string().nullish(),
559
+ street: import_zod4.z.string().nullish(),
560
+ number: import_zod4.z.string().nullish(),
561
+ zipCode: import_zod4.z.string().nullish()
477
562
  });
478
- var NameFieldValue = import_zod3.z.object({
479
- firstname: import_zod3.z.string(),
480
- surname: import_zod3.z.string(),
481
- middlename: import_zod3.z.string().optional()
563
+ var NameFieldValue = import_zod4.z.object({
564
+ firstname: import_zod4.z.string(),
565
+ surname: import_zod4.z.string(),
566
+ middlename: import_zod4.z.string().optional()
482
567
  });
483
- var NameFieldUpdateValue = import_zod3.z.object({
484
- firstname: import_zod3.z.string().nullish(),
485
- surname: import_zod3.z.string().nullish(),
486
- middlename: import_zod3.z.string().nullish()
487
- }).or(import_zod3.z.null()).or(import_zod3.z.undefined());
568
+ var NameFieldUpdateValue = import_zod4.z.object({
569
+ firstname: import_zod4.z.string(),
570
+ surname: import_zod4.z.string(),
571
+ middlename: import_zod4.z.string().nullish()
572
+ }).or(import_zod4.z.null()).or(import_zod4.z.undefined());
488
573
  var RuralAddressUpdateValue = AdminStructure.extend({
489
- urbanOrRural: import_zod3.z.literal(GeographicalArea.RURAL),
490
- village: import_zod3.z.string().nullish()
574
+ urbanOrRural: import_zod4.z.literal(GeographicalArea.RURAL),
575
+ village: import_zod4.z.string().nullish()
491
576
  });
492
- var GenericAddressValue = import_zod3.z.object({
493
- country: import_zod3.z.string(),
494
- addressType: import_zod3.z.literal(AddressType.INTERNATIONAL),
495
- state: import_zod3.z.string(),
496
- district2: import_zod3.z.string(),
497
- cityOrTown: import_zod3.z.string().optional(),
498
- addressLine1: import_zod3.z.string().optional(),
499
- addressLine2: import_zod3.z.string().optional(),
500
- addressLine3: import_zod3.z.string().optional(),
501
- postcodeOrZip: import_zod3.z.string().optional()
577
+ var GenericAddressValue = import_zod4.z.object({
578
+ country: import_zod4.z.string(),
579
+ addressType: import_zod4.z.literal(AddressType.INTERNATIONAL),
580
+ state: import_zod4.z.string(),
581
+ district2: import_zod4.z.string(),
582
+ cityOrTown: import_zod4.z.string().optional(),
583
+ addressLine1: import_zod4.z.string().optional(),
584
+ addressLine2: import_zod4.z.string().optional(),
585
+ addressLine3: import_zod4.z.string().optional(),
586
+ postcodeOrZip: import_zod4.z.string().optional()
502
587
  });
503
- var AddressFieldValue = import_zod3.z.discriminatedUnion("urbanOrRural", [UrbanAddressValue, RuralAddressValue]).or(GenericAddressValue);
504
- var GenericAddressUpdateValue = import_zod3.z.object({
505
- country: import_zod3.z.string(),
506
- addressType: import_zod3.z.literal(AddressType.INTERNATIONAL),
507
- state: import_zod3.z.string(),
508
- district2: import_zod3.z.string(),
509
- cityOrTown: import_zod3.z.string().nullish(),
510
- addressLine1: import_zod3.z.string().nullish(),
511
- addressLine2: import_zod3.z.string().nullish(),
512
- addressLine3: import_zod3.z.string().nullish(),
513
- postcodeOrZip: import_zod3.z.string().nullish()
588
+ var AddressFieldValue = import_zod4.z.discriminatedUnion("urbanOrRural", [UrbanAddressValue, RuralAddressValue]).or(GenericAddressValue);
589
+ var GenericAddressUpdateValue = import_zod4.z.object({
590
+ country: import_zod4.z.string(),
591
+ addressType: import_zod4.z.literal(AddressType.INTERNATIONAL),
592
+ state: import_zod4.z.string(),
593
+ district2: import_zod4.z.string(),
594
+ cityOrTown: import_zod4.z.string().nullish(),
595
+ addressLine1: import_zod4.z.string().nullish(),
596
+ addressLine2: import_zod4.z.string().nullish(),
597
+ addressLine3: import_zod4.z.string().nullish(),
598
+ postcodeOrZip: import_zod4.z.string().nullish()
514
599
  });
515
- var AddressFieldUpdateValue = import_zod3.z.discriminatedUnion("urbanOrRural", [
600
+ var AddressFieldUpdateValue = import_zod4.z.discriminatedUnion("urbanOrRural", [
516
601
  UrbanAddressUpdateValue,
517
602
  RuralAddressUpdateValue
518
603
  ]).or(GenericAddressUpdateValue);
519
- var FileFieldValueWithOption = import_zod3.z.object({
520
- filename: import_zod3.z.string(),
521
- originalFilename: import_zod3.z.string(),
522
- type: import_zod3.z.string(),
523
- option: import_zod3.z.string()
604
+ var FileFieldValueWithOption = import_zod4.z.object({
605
+ filename: import_zod4.z.string(),
606
+ originalFilename: import_zod4.z.string(),
607
+ type: import_zod4.z.string(),
608
+ option: import_zod4.z.string()
524
609
  });
525
- var FileFieldWithOptionValue = import_zod3.z.array(FileFieldValueWithOption);
610
+ var FileFieldWithOptionValue = import_zod4.z.array(FileFieldValueWithOption);
526
611
 
527
612
  // ../commons/src/events/FieldValue.ts
528
- var TextValue = import_zod4.z.string();
613
+ var TextValue = import_zod5.z.string();
529
614
  var NonEmptyTextValue = TextValue.min(1);
530
- var DateValue = import_zod4.z.string().date().describe("Date in the format YYYY-MM-DD");
531
- var DatetimeValue = import_zod4.z.string().datetime();
532
- var DateRangeFieldValue = DateValue.or(import_zod4.z.tuple([DateValue, DateValue]));
533
- var EmailValue = import_zod4.z.string().email();
534
- var CheckboxFieldValue = import_zod4.z.boolean();
535
- var NumberFieldValue = import_zod4.z.number();
536
- var DataFieldValue = import_zod4.z.undefined();
537
- var SignatureFieldValue = import_zod4.z.string();
538
- var FieldValue = import_zod4.z.union([
615
+ var DateValue = import_zod5.z.string().date().describe("Date in the format YYYY-MM-DD");
616
+ var DatetimeValue = import_zod5.z.string().datetime();
617
+ var DateRangeFieldValue = DateValue.or(import_zod5.z.tuple([DateValue, DateValue]));
618
+ var EmailValue = import_zod5.z.string().email();
619
+ var CheckboxFieldValue = import_zod5.z.boolean();
620
+ var NumberFieldValue = import_zod5.z.number();
621
+ var DataFieldValue = import_zod5.z.undefined();
622
+ var SignatureFieldValue = import_zod5.z.string();
623
+ var FieldValue = import_zod5.z.union([
539
624
  TextValue,
540
625
  DateValue,
541
626
  DateRangeFieldValue,
@@ -550,7 +635,7 @@ var FieldValue = import_zod4.z.union([
550
635
  NameFieldValue,
551
636
  NameFieldUpdateValue
552
637
  ]);
553
- var FieldUpdateValue = import_zod4.z.union([
638
+ var FieldUpdateValue = import_zod5.z.union([
554
639
  TextValue,
555
640
  DateValue,
556
641
  DateRangeFieldValue,
@@ -567,63 +652,63 @@ var FieldUpdateValue = import_zod4.z.union([
567
652
 
568
653
  // ../commons/src/events/FieldConfig.ts
569
654
  var import_zod_openapi3 = require("zod-openapi");
570
- (0, import_zod_openapi3.extendZodWithOpenApi)(import_zod5.z);
571
- var FieldId = import_zod5.z.string().describe("Unique identifier for the field");
572
- var FieldReference = import_zod5.z.object({
655
+ (0, import_zod_openapi3.extendZodWithOpenApi)(import_zod6.z);
656
+ var FieldId = import_zod6.z.string().describe("Unique identifier for the field");
657
+ var FieldReference = import_zod6.z.object({
573
658
  $$field: FieldId
574
659
  }).describe("Reference to a field by its ID");
575
660
  var ParentReference = FieldReference.optional();
576
- var ValidationConfig = import_zod5.z.object({
577
- validator: Conditional,
578
- message: TranslationConfig
579
- });
580
- var BaseField = import_zod5.z.object({
661
+ var BaseField = import_zod6.z.object({
581
662
  id: FieldId,
582
663
  parent: ParentReference,
583
- conditionals: import_zod5.z.array(FieldConditional).default([]).optional(),
584
- required: import_zod5.z.boolean().default(false).optional(),
585
- secured: import_zod5.z.boolean().default(false).optional(),
664
+ conditionals: import_zod6.z.array(FieldConditional).default([]).optional(),
665
+ required: import_zod6.z.boolean().default(false).optional(),
586
666
  placeholder: TranslationConfig.optional(),
587
- validation: import_zod5.z.array(ValidationConfig).default([]).optional(),
667
+ validation: import_zod6.z.array(
668
+ import_zod6.z.object({
669
+ validator: Conditional,
670
+ message: TranslationConfig
671
+ })
672
+ ).default([]).optional(),
588
673
  label: TranslationConfig,
589
674
  helperText: TranslationConfig.optional(),
590
- hideLabel: import_zod5.z.boolean().default(false).optional()
675
+ hideLabel: import_zod6.z.boolean().default(false).optional()
591
676
  });
592
677
  var Divider = BaseField.extend({
593
- type: import_zod5.z.literal(FieldType.DIVIDER)
678
+ type: import_zod6.z.literal(FieldType.DIVIDER)
594
679
  });
595
680
  var TextField = BaseField.extend({
596
- type: import_zod5.z.literal(FieldType.TEXT),
681
+ type: import_zod6.z.literal(FieldType.TEXT),
597
682
  defaultValue: NonEmptyTextValue.optional(),
598
- configuration: import_zod5.z.object({
599
- maxLength: import_zod5.z.number().optional().describe("Maximum length of the text"),
600
- type: import_zod5.z.enum(["text", "password"]).optional(),
683
+ configuration: import_zod6.z.object({
684
+ maxLength: import_zod6.z.number().optional().describe("Maximum length of the text"),
685
+ type: import_zod6.z.enum(["text", "password"]).optional(),
601
686
  prefix: TranslationConfig.optional(),
602
687
  postfix: TranslationConfig.optional()
603
688
  }).default({ type: "text" }).optional()
604
689
  }).describe("Text input");
605
690
  var NumberField = BaseField.extend({
606
- type: import_zod5.z.literal(FieldType.NUMBER),
691
+ type: import_zod6.z.literal(FieldType.NUMBER),
607
692
  defaultValue: NumberFieldValue.optional(),
608
- configuration: import_zod5.z.object({
609
- min: import_zod5.z.number().optional().describe("Minimum value"),
610
- max: import_zod5.z.number().optional().describe("Maximum value"),
693
+ configuration: import_zod6.z.object({
694
+ min: import_zod6.z.number().optional().describe("Minimum value"),
695
+ max: import_zod6.z.number().optional().describe("Maximum value"),
611
696
  prefix: TranslationConfig.optional(),
612
697
  postfix: TranslationConfig.optional()
613
698
  }).optional()
614
699
  }).describe("Number input");
615
700
  var TextAreaField = BaseField.extend({
616
- type: import_zod5.z.literal(FieldType.TEXTAREA),
701
+ type: import_zod6.z.literal(FieldType.TEXTAREA),
617
702
  defaultValue: NonEmptyTextValue.optional(),
618
- configuration: import_zod5.z.object({
619
- maxLength: import_zod5.z.number().optional().describe("Maximum length of the text"),
620
- rows: import_zod5.z.number().optional().describe("Number of visible text lines"),
621
- cols: import_zod5.z.number().optional().describe("Number of visible columns"),
703
+ configuration: import_zod6.z.object({
704
+ maxLength: import_zod6.z.number().optional().describe("Maximum length of the text"),
705
+ rows: import_zod6.z.number().optional().describe("Number of visible text lines"),
706
+ cols: import_zod6.z.number().optional().describe("Number of visible columns"),
622
707
  prefix: TranslationConfig.optional(),
623
708
  postfix: TranslationConfig.optional()
624
709
  }).default({ rows: 4 }).optional()
625
710
  }).describe("Multiline text input");
626
- var ImageMimeType = import_zod5.z.enum([
711
+ var ImageMimeType = import_zod6.z.enum([
627
712
  "image/png",
628
713
  "image/jpg",
629
714
  "image/jpeg",
@@ -632,38 +717,38 @@ var ImageMimeType = import_zod5.z.enum([
632
717
  var MimeType = ImageMimeType;
633
718
  var DEFAULT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;
634
719
  var SignatureField = BaseField.extend({
635
- type: import_zod5.z.literal(FieldType.SIGNATURE),
720
+ type: import_zod6.z.literal(FieldType.SIGNATURE),
636
721
  signaturePromptLabel: TranslationConfig.describe(
637
722
  "Title of the signature modal"
638
723
  ),
639
724
  defaultValue: SignatureFieldValue.optional(),
640
- configuration: import_zod5.z.object({
641
- maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
725
+ configuration: import_zod6.z.object({
726
+ maxFileSize: import_zod6.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
642
727
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
643
728
  }).default({
644
729
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
645
730
  })
646
731
  }).describe("Signature input field");
647
732
  var EmailField = BaseField.extend({
648
- type: import_zod5.z.literal(FieldType.EMAIL),
649
- configuration: import_zod5.z.object({
650
- maxLength: import_zod5.z.number().optional().describe("Maximum length of the text")
733
+ type: import_zod6.z.literal(FieldType.EMAIL),
734
+ configuration: import_zod6.z.object({
735
+ maxLength: import_zod6.z.number().optional().describe("Maximum length of the text")
651
736
  }).default({ maxLength: 10 }).optional(),
652
737
  defaultValue: NonEmptyTextValue.optional()
653
738
  });
654
739
  var DateField = BaseField.extend({
655
- type: import_zod5.z.literal(FieldType.DATE),
740
+ type: import_zod6.z.literal(FieldType.DATE),
656
741
  defaultValue: DateValue.optional(),
657
- configuration: import_zod5.z.object({
742
+ configuration: import_zod6.z.object({
658
743
  notice: TranslationConfig.describe(
659
744
  "Text to display above the date input"
660
745
  ).optional()
661
746
  }).optional()
662
747
  }).describe("A single date input (dd-mm-YYYY)");
663
748
  var DateRangeField = BaseField.extend({
664
- type: import_zod5.z.literal(FieldType.DATE_RANGE),
749
+ type: import_zod6.z.literal(FieldType.DATE_RANGE),
665
750
  defaultValue: DateRangeFieldValue.optional(),
666
- configuration: import_zod5.z.object({
751
+ configuration: import_zod6.z.object({
667
752
  notice: TranslationConfig.describe(
668
753
  "Text to display above the date input"
669
754
  ).optional()
@@ -671,7 +756,7 @@ var DateRangeField = BaseField.extend({
671
756
  }).describe(
672
757
  "A date range input ({ rangeStart: dd-mm-YYYY, rangeEnd: dd-mm-YYYY })"
673
758
  );
674
- var HtmlFontVariant = import_zod5.z.enum([
759
+ var HtmlFontVariant = import_zod6.z.enum([
675
760
  "reg12",
676
761
  "reg14",
677
762
  "reg16",
@@ -681,27 +766,31 @@ var HtmlFontVariant = import_zod5.z.enum([
681
766
  "h2",
682
767
  "h1"
683
768
  ]);
769
+ var ParagraphConfiguration = import_zod6.z.object({
770
+ styles: import_zod6.z.object({
771
+ fontVariant: HtmlFontVariant.optional().describe(
772
+ "Font variant to use for the paragraph text"
773
+ ),
774
+ hint: import_zod6.z.boolean().optional().describe("When true, paragraph is styled as a hint with grey color")
775
+ }).optional()
776
+ }).default({});
684
777
  var Paragraph = BaseField.extend({
685
- type: import_zod5.z.literal(FieldType.PARAGRAPH),
778
+ type: import_zod6.z.literal(FieldType.PARAGRAPH),
686
779
  defaultValue: NonEmptyTextValue.optional(),
687
- configuration: import_zod5.z.object({
688
- styles: import_zod5.z.object({
689
- fontVariant: HtmlFontVariant.optional()
690
- }).optional()
691
- }).default({})
780
+ configuration: ParagraphConfiguration
692
781
  }).describe("A read-only HTML <p> paragraph");
693
782
  var PageHeader = BaseField.extend({
694
- type: import_zod5.z.literal(FieldType.PAGE_HEADER),
783
+ type: import_zod6.z.literal(FieldType.PAGE_HEADER),
695
784
  defaultValue: NonEmptyTextValue.optional()
696
785
  }).describe("A read-only header component for form pages");
697
786
  var File = BaseField.extend({
698
- type: import_zod5.z.literal(FieldType.FILE),
787
+ type: import_zod6.z.literal(FieldType.FILE),
699
788
  defaultValue: FileFieldValue.optional(),
700
- configuration: import_zod5.z.object({
701
- maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
789
+ configuration: import_zod6.z.object({
790
+ maxFileSize: import_zod6.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
702
791
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
703
- style: import_zod5.z.object({
704
- width: import_zod5.z.enum(["full", "auto"]).optional().describe(
792
+ style: import_zod6.z.object({
793
+ width: import_zod6.z.enum(["full", "auto"]).optional().describe(
705
794
  "Whether the file upload button should take the full width of the container or not"
706
795
  )
707
796
  }).optional(),
@@ -710,125 +799,123 @@ var File = BaseField.extend({
710
799
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
711
800
  })
712
801
  }).describe("File upload");
713
- var SelectOption = import_zod5.z.object({
714
- value: import_zod5.z.string().describe("The value of the option"),
802
+ var SelectOption = import_zod6.z.object({
803
+ value: import_zod6.z.string().describe("The value of the option"),
715
804
  label: TranslationConfig.describe("The label of the option")
716
805
  });
717
806
  var RadioGroup = BaseField.extend({
718
- type: import_zod5.z.literal(FieldType.RADIO_GROUP),
807
+ type: import_zod6.z.literal(FieldType.RADIO_GROUP),
719
808
  defaultValue: TextValue.optional(),
720
- options: import_zod5.z.array(SelectOption).describe("A list of options"),
721
- configuration: import_zod5.z.object({
722
- styles: import_zod5.z.object({
723
- size: import_zod5.z.enum(["NORMAL", "LARGE"]).optional()
809
+ options: import_zod6.z.array(SelectOption).describe("A list of options"),
810
+ configuration: import_zod6.z.object({
811
+ styles: import_zod6.z.object({
812
+ size: import_zod6.z.enum(["NORMAL", "LARGE"]).optional()
724
813
  }).optional()
725
814
  }).optional()
726
815
  }).describe("Grouped radio options");
727
816
  var BulletList = BaseField.extend({
728
- type: import_zod5.z.literal(FieldType.BULLET_LIST),
817
+ type: import_zod6.z.literal(FieldType.BULLET_LIST),
729
818
  defaultValue: TextValue.optional(),
730
- items: import_zod5.z.array(TranslationConfig).describe("A list of items"),
731
- configuration: import_zod5.z.object({
732
- styles: import_zod5.z.object({
819
+ items: import_zod6.z.array(TranslationConfig).describe("A list of items"),
820
+ configuration: import_zod6.z.object({
821
+ styles: import_zod6.z.object({
733
822
  fontVariant: HtmlFontVariant.optional()
734
823
  }).optional()
735
824
  }).default({})
736
825
  }).describe("A list of bullet points");
737
826
  var Select = BaseField.extend({
738
- type: import_zod5.z.literal(FieldType.SELECT),
827
+ type: import_zod6.z.literal(FieldType.SELECT),
739
828
  defaultValue: TextValue.optional(),
740
- options: import_zod5.z.array(SelectOption).describe("A list of options")
829
+ options: import_zod6.z.array(SelectOption).describe("A list of options")
741
830
  }).describe("Select input");
742
831
  var NameField = BaseField.extend({
743
- type: import_zod5.z.literal(FieldType.NAME),
744
- defaultValue: import_zod5.z.object({
832
+ type: import_zod6.z.literal(FieldType.NAME),
833
+ defaultValue: import_zod6.z.object({
745
834
  firstname: NonEmptyTextValue,
746
835
  surname: NonEmptyTextValue
747
836
  }).optional(),
748
- configuration: import_zod5.z.object({
749
- maxLength: import_zod5.z.number().optional().describe("Maximum length of the text"),
837
+ configuration: import_zod6.z.object({
838
+ maxLength: import_zod6.z.number().optional().describe("Maximum length of the text"),
750
839
  prefix: TranslationConfig.optional(),
751
- postfix: TranslationConfig.optional(),
752
- includeMiddlename: import_zod5.z.boolean().default(false).optional().describe("To make middle name visible in Name form field"),
753
- searchMode: import_zod5.z.boolean().optional()
840
+ postfix: TranslationConfig.optional()
754
841
  }).optional()
755
842
  }).describe("Name input field");
756
843
  var PhoneField = BaseField.extend({
757
844
  defaultValue: NonEmptyTextValue.optional(),
758
- type: import_zod5.z.literal(FieldType.PHONE)
845
+ type: import_zod6.z.literal(FieldType.PHONE)
759
846
  }).describe("Phone input field");
760
847
  var IdField = BaseField.extend({
761
848
  defaultValue: NonEmptyTextValue.optional(),
762
- type: import_zod5.z.literal(FieldType.ID)
849
+ type: import_zod6.z.literal(FieldType.ID)
763
850
  }).describe("ID input field");
764
851
  var Checkbox = BaseField.extend({
765
- type: import_zod5.z.literal(FieldType.CHECKBOX),
852
+ type: import_zod6.z.literal(FieldType.CHECKBOX),
766
853
  defaultValue: CheckboxFieldValue.optional()
767
854
  }).describe("Boolean checkbox field");
768
855
  var Country = BaseField.extend({
769
- type: import_zod5.z.literal(FieldType.COUNTRY),
856
+ type: import_zod6.z.literal(FieldType.COUNTRY),
770
857
  defaultValue: NonEmptyTextValue.optional()
771
858
  }).describe("Country select field");
772
- var AdministrativeAreas = import_zod5.z.enum([
859
+ var AdministrativeAreas = import_zod6.z.enum([
773
860
  "ADMIN_STRUCTURE",
774
861
  "HEALTH_FACILITY",
775
862
  "CRVS_OFFICE"
776
863
  ]);
777
- var AdministrativeAreaConfiguration = import_zod5.z.object({
778
- partOf: import_zod5.z.object({
779
- $declaration: import_zod5.z.string()
864
+ var AdministrativeAreaConfiguration = import_zod6.z.object({
865
+ partOf: import_zod6.z.object({
866
+ $declaration: import_zod6.z.string()
780
867
  }).optional().describe("Parent location"),
781
868
  type: AdministrativeAreas
782
869
  }).describe("Administrative area options");
783
870
  var AdministrativeArea = BaseField.extend({
784
- type: import_zod5.z.literal(FieldType.ADMINISTRATIVE_AREA),
871
+ type: import_zod6.z.literal(FieldType.ADMINISTRATIVE_AREA),
785
872
  defaultValue: NonEmptyTextValue.optional(),
786
873
  configuration: AdministrativeAreaConfiguration
787
874
  }).describe("Administrative area input field e.g. facility, office");
788
875
  var Location = BaseField.extend({
789
- type: import_zod5.z.literal(FieldType.LOCATION),
876
+ type: import_zod6.z.literal(FieldType.LOCATION),
790
877
  defaultValue: NonEmptyTextValue.optional()
791
878
  }).describe("Input field for a location");
792
879
  var FileUploadWithOptions = BaseField.extend({
793
- type: import_zod5.z.literal(FieldType.FILE_WITH_OPTIONS),
794
- options: import_zod5.z.array(SelectOption).describe("A list of options"),
880
+ type: import_zod6.z.literal(FieldType.FILE_WITH_OPTIONS),
881
+ options: import_zod6.z.array(SelectOption).describe("A list of options"),
795
882
  defaultValue: FileFieldWithOptionValue.optional(),
796
- configuration: import_zod5.z.object({
797
- maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
883
+ configuration: import_zod6.z.object({
884
+ maxFileSize: import_zod6.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
798
885
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
799
886
  }).default({
800
887
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
801
888
  })
802
889
  });
803
890
  var Facility = BaseField.extend({
804
- type: import_zod5.z.literal(FieldType.FACILITY),
891
+ type: import_zod6.z.literal(FieldType.FACILITY),
805
892
  defaultValue: NonEmptyTextValue.optional()
806
893
  }).describe("Input field for a facility");
807
894
  var Office = BaseField.extend({
808
- type: import_zod5.z.literal(FieldType.OFFICE),
895
+ type: import_zod6.z.literal(FieldType.OFFICE),
809
896
  defaultValue: NonEmptyTextValue.optional()
810
897
  }).describe("Input field for an office");
811
898
  var Address = BaseField.extend({
812
- type: import_zod5.z.literal(FieldType.ADDRESS),
899
+ type: import_zod6.z.literal(FieldType.ADDRESS),
813
900
  defaultValue: AddressFieldValue.optional()
814
901
  }).describe("Address input field \u2013 a combination of location and text fields");
815
- var DataEntry = import_zod5.z.union([
816
- import_zod5.z.object({
902
+ var DataEntry = import_zod6.z.union([
903
+ import_zod6.z.object({
817
904
  label: TranslationConfig,
818
- value: TranslationConfig.or(import_zod5.z.string())
905
+ value: TranslationConfig.or(import_zod6.z.string())
819
906
  }),
820
- import_zod5.z.object({
821
- fieldId: import_zod5.z.string()
907
+ import_zod6.z.object({
908
+ fieldId: import_zod6.z.string()
822
909
  })
823
910
  ]);
824
911
  var DataField = BaseField.extend({
825
- type: import_zod5.z.literal(FieldType.DATA),
826
- configuration: import_zod5.z.object({
912
+ type: import_zod6.z.literal(FieldType.DATA),
913
+ configuration: import_zod6.z.object({
827
914
  subtitle: TranslationConfig.optional(),
828
- data: import_zod5.z.array(DataEntry)
915
+ data: import_zod6.z.array(DataEntry)
829
916
  })
830
917
  }).describe("Data field for displaying read-only data");
831
- var FieldConfig = import_zod5.z.discriminatedUnion("type", [
918
+ var FieldConfig = import_zod6.z.discriminatedUnion("type", [
832
919
  Address,
833
920
  TextField,
834
921
  NumberField,
@@ -860,14 +947,18 @@ var FieldConfig = import_zod5.z.discriminatedUnion("type", [
860
947
  ref: "FieldConfig"
861
948
  });
862
949
 
950
+ // ../commons/src/events/FormConfig.ts
951
+ var import_zod8 = require("zod");
952
+
863
953
  // ../commons/src/events/PageConfig.ts
954
+ var import_zod7 = require("zod");
864
955
  var import_zod_openapi4 = require("zod-openapi");
865
- (0, import_zod_openapi4.extendZodWithOpenApi)(import_zod6.z);
866
- var PageTypes = import_zod6.z.enum(["FORM", "VERIFICATION"]);
867
- var PageConfigBase = import_zod6.z.object({
868
- id: import_zod6.z.string().describe("Unique identifier for the page"),
956
+ (0, import_zod_openapi4.extendZodWithOpenApi)(import_zod7.z);
957
+ var PageTypes = import_zod7.z.enum(["FORM", "VERIFICATION"]);
958
+ var PageConfigBase = import_zod7.z.object({
959
+ id: import_zod7.z.string().describe("Unique identifier for the page"),
869
960
  title: TranslationConfig.describe("Header title of the page"),
870
- fields: import_zod6.z.array(FieldConfig).describe("Fields to be rendered on the page"),
961
+ fields: import_zod7.z.array(FieldConfig).describe("Fields to be rendered on the page"),
871
962
  conditional: Conditional.optional().describe(
872
963
  "Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
873
964
  )
@@ -876,13 +967,13 @@ var PageConfigBase = import_zod6.z.object({
876
967
  ref: "FormPageConfig"
877
968
  });
878
969
  var FormPageConfig = PageConfigBase.extend({
879
- type: import_zod6.z.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
970
+ type: import_zod7.z.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
880
971
  });
881
- var VerificationActionConfig = import_zod6.z.object({
882
- verify: import_zod6.z.object({ label: TranslationConfig }),
883
- cancel: import_zod6.z.object({
972
+ var VerificationActionConfig = import_zod7.z.object({
973
+ verify: import_zod7.z.object({ label: TranslationConfig }),
974
+ cancel: import_zod7.z.object({
884
975
  label: TranslationConfig,
885
- confirmation: import_zod6.z.object({
976
+ confirmation: import_zod7.z.object({
886
977
  title: TranslationConfig,
887
978
  body: TranslationConfig
888
979
  })
@@ -892,112 +983,15 @@ var VerificationActionConfig = import_zod6.z.object({
892
983
  ref: "VerificationActionConfig"
893
984
  });
894
985
  var VerificationPageConfig = FormPageConfig.extend({
895
- type: import_zod6.z.literal(PageTypes.enum.VERIFICATION),
986
+ type: import_zod7.z.literal(PageTypes.enum.VERIFICATION),
896
987
  actions: VerificationActionConfig
897
988
  });
898
- var PageConfig = import_zod6.z.discriminatedUnion("type", [
989
+ var PageConfig = import_zod7.z.discriminatedUnion("type", [
899
990
  FormPageConfig,
900
991
  VerificationPageConfig
901
992
  ]);
902
993
 
903
- // ../commons/src/events/ActionType.ts
904
- var import_zod7 = require("zod");
905
- var ActionType = {
906
- // Pre-declaration actions
907
- DELETE: "DELETE",
908
- CREATE: "CREATE",
909
- NOTIFY: "NOTIFY",
910
- // Declaration actions
911
- DECLARE: "DECLARE",
912
- VALIDATE: "VALIDATE",
913
- REGISTER: "REGISTER",
914
- // Declaration system actions. Non-configurable.
915
- DETECT_DUPLICATE: "DETECT_DUPLICATE",
916
- REJECT: "REJECT",
917
- // REJECT_DECLARATION
918
- MARKED_AS_DUPLICATE: "MARKED_AS_DUPLICATE",
919
- // MARK_AS_DUPLICATE
920
- ARCHIVE: "ARCHIVE",
921
- // Record actions
922
- PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
923
- REQUEST_CORRECTION: "REQUEST_CORRECTION",
924
- REJECT_CORRECTION: "REJECT_CORRECTION",
925
- APPROVE_CORRECTION: "APPROVE_CORRECTION",
926
- // General actions
927
- READ: "READ",
928
- ASSIGN: "ASSIGN",
929
- UNASSIGN: "UNASSIGN"
930
- };
931
- var ConfirmableActions = [
932
- ActionType.NOTIFY,
933
- ActionType.DECLARE,
934
- ActionType.VALIDATE,
935
- ActionType.REGISTER,
936
- ActionType.REJECT,
937
- ActionType.ARCHIVE,
938
- ActionType.PRINT_CERTIFICATE
939
- ];
940
- var ActionTypes = import_zod7.z.enum([
941
- "DELETE",
942
- "CREATE",
943
- "NOTIFY",
944
- "DECLARE",
945
- "VALIDATE",
946
- "REGISTER",
947
- "DETECT_DUPLICATE",
948
- "REJECT",
949
- "MARKED_AS_DUPLICATE",
950
- "ARCHIVE",
951
- "PRINT_CERTIFICATE",
952
- "REQUEST_CORRECTION",
953
- "REJECT_CORRECTION",
954
- "APPROVE_CORRECTION",
955
- "READ",
956
- "ASSIGN",
957
- "UNASSIGN"
958
- ]);
959
- var declarationActionValues = [
960
- ActionTypes.enum.DECLARE,
961
- ActionTypes.enum.VALIDATE,
962
- ActionTypes.enum.REGISTER
963
- ];
964
- var DeclarationActions = ActionTypes.extract(declarationActionValues);
965
- var declarationUpdateActionValues = [
966
- ...declarationActionValues,
967
- ActionTypes.enum.REQUEST_CORRECTION
968
- ];
969
- var DeclarationUpdateActions = ActionTypes.extract(
970
- declarationUpdateActionValues
971
- );
972
- var annotationActions = ActionTypes.exclude(declarationActionValues);
973
- var writeActions = ActionTypes.exclude([
974
- ActionType.CREATE,
975
- ActionType.READ,
976
- ActionType.ASSIGN,
977
- ActionType.UNASSIGN
978
- ]);
979
- var workqueueActions = ActionTypes.exclude([
980
- ActionType.CREATE,
981
- ActionType.NOTIFY,
982
- ActionType.DETECT_DUPLICATE,
983
- ActionType.REJECT,
984
- ActionType.MARKED_AS_DUPLICATE,
985
- ActionType.ARCHIVE,
986
- ActionType.REQUEST_CORRECTION,
987
- ActionType.REJECT_CORRECTION,
988
- ActionType.APPROVE_CORRECTION
989
- ]);
990
- var META_ACTIONS = [
991
- ActionType.ASSIGN,
992
- ActionType.UNASSIGN,
993
- ActionType.READ
994
- ];
995
- function isMetaAction(actionType) {
996
- return META_ACTIONS.includes(actionType);
997
- }
998
-
999
994
  // ../commons/src/events/FormConfig.ts
1000
- var import_zod8 = require("zod");
1001
995
  var DeclarationFormConfig = import_zod8.z.object({
1002
996
  label: TranslationConfig.describe("Human readable description of the form"),
1003
997
  pages: import_zod8.z.array(FormPageConfig)
@@ -1079,8 +1073,7 @@ var PrintCertificateActionConfig = ActionConfigBase.merge(
1079
1073
  var RequestCorrectionConfig = ActionConfigBase.merge(
1080
1074
  import_zod9.z.object({
1081
1075
  type: import_zod9.z.literal(ActionType.REQUEST_CORRECTION),
1082
- onboardingForm: import_zod9.z.array(PageConfig),
1083
- additionalDetailsForm: import_zod9.z.array(PageConfig)
1076
+ correctionForm: ActionFormConfig
1084
1077
  })
1085
1078
  );
1086
1079
  var RejectCorrectionConfig = ActionConfigBase.merge(
@@ -1156,7 +1149,7 @@ var LanguageConfig = import_zod11.z.object({
1156
1149
  });
1157
1150
 
1158
1151
  // ../commons/src/events/EventConfig.ts
1159
- var import_zod20 = require("zod");
1152
+ var import_zod18 = require("zod");
1160
1153
 
1161
1154
  // ../commons/src/events/DeduplicationConfig.ts
1162
1155
  var import_zod12 = require("zod");
@@ -1295,9 +1288,6 @@ var BaseField3 = import_zod14.z.object({
1295
1288
  'conditionals' to an empty array ('[]') in the search config. This ensures they
1296
1289
  are always rendered in the advanced search form.
1297
1290
  `
1298
- ),
1299
- validations: import_zod14.z.array(ValidationConfig).default([]).optional().describe(
1300
- `In advanced search, we sometimes need to override the default field validations.`
1301
1291
  )
1302
1292
  });
1303
1293
  var SearchQueryParams = import_zod14.z.object({
@@ -1311,582 +1301,149 @@ var FieldConfigSchema = BaseField3.extend({
1311
1301
  });
1312
1302
  var EventFieldId = import_zod14.z.enum([
1313
1303
  "trackingId",
1314
- "status",
1315
- "legalStatus.REGISTERED.createdAt",
1316
- "legalStatus.REGISTERED.createdAtLocation",
1317
- "updatedAt"
1318
- ]);
1319
- var EventFieldConfigSchema = BaseField3.extend({
1320
- fieldId: EventFieldId,
1321
- fieldType: import_zod14.z.literal("event")
1322
- });
1323
- var SearchField = import_zod14.z.discriminatedUnion("fieldType", [
1324
- FieldConfigSchema,
1325
- EventFieldConfigSchema
1326
- ]);
1327
- var AdvancedSearchConfig = import_zod14.z.object({
1328
- title: TranslationConfig.describe("Advanced search tab title"),
1329
- fields: import_zod14.z.array(SearchField).describe("Advanced search fields.")
1330
- });
1331
-
1332
- // ../commons/src/events/utils.ts
1333
- var import_lodash = require("lodash");
1334
-
1335
- // ../commons/src/events/ActionDocument.ts
1336
- var import_zod18 = require("zod");
1337
- var import_zod_openapi7 = require("zod-openapi");
1338
-
1339
- // ../commons/src/uuid.ts
1340
- var import_uuid = require("uuid");
1341
- var import_zod15 = require("zod");
1342
- var UUID = import_zod15.z.string().uuid().brand("UUID");
1343
- function getUUID() {
1344
- return (0, import_uuid.v4)();
1345
- }
1346
-
1347
- // ../commons/src/events/CreatedAtLocation.ts
1348
- var CreatedAtLocation = UUID.nullish();
1349
-
1350
- // ../commons/src/authentication.ts
1351
- var import_jwt_decode = __toESM(require("jwt-decode"));
1352
- var import_zod17 = require("zod");
1353
-
1354
- // ../commons/src/scopes.ts
1355
- var import_zod16 = require("zod");
1356
- var SCOPES = {
1357
- // TODO v1.8 legacy scopes
1358
- NATLSYSADMIN: "natlsysadmin",
1359
- BYPASSRATELIMIT: "bypassratelimit",
1360
- DECLARE: "declare",
1361
- REGISTER: "register",
1362
- VALIDATE: "validate",
1363
- DEMO: "demo",
1364
- CERTIFY: "certify",
1365
- PERFORMANCE: "performance",
1366
- SYSADMIN: "sysadmin",
1367
- TEAMS: "teams",
1368
- CONFIG: "config",
1369
- // systems / integrations
1370
- WEBHOOK: "webhook",
1371
- NATIONALID: "nationalId",
1372
- NOTIFICATION_API: "notification-api",
1373
- RECORDSEARCH: "recordsearch",
1374
- /**
1375
- * @TODO This is a temporary scope to be used for V2 Events custom events declaration
1376
- */
1377
- RECORD_DECLARE: "record.declare-birth",
1378
- // declare
1379
- RECORD_IMPORT: "record.import",
1380
- // declare
1381
- RECORD_DECLARE_BIRTH: "record.declare-birth",
1382
- RECORD_DECLARE_BIRTH_MY_JURISDICTION: "record.declare-birth:my-jurisdiction",
1383
- RECORD_DECLARE_DEATH: "record.declare-death",
1384
- RECORD_DECLARE_DEATH_MY_JURISDICTION: "record.declare-death:my-jurisdiction",
1385
- RECORD_DECLARE_MARRIAGE: "record.declare-marriage",
1386
- RECORD_DECLARE_MARRIAGE_MY_JURISDICTION: "record.declare-marriage:my-jurisdiction",
1387
- RECORD_SUBMIT_INCOMPLETE: "record.declaration-submit-incomplete",
1388
- RECORD_SUBMIT_FOR_REVIEW: "record.declaration-submit-for-review",
1389
- RECORD_UNASSIGN_OTHERS: "record.unassign-others",
1390
- // validate
1391
- RECORD_SUBMIT_FOR_APPROVAL: "record.declaration-submit-for-approval",
1392
- RECORD_SUBMIT_FOR_UPDATES: "record.declaration-submit-for-updates",
1393
- RECORD_DECLARATION_EDIT: "record.declaration-edit",
1394
- RECORD_REVIEW_DUPLICATES: "record.review-duplicates",
1395
- RECORD_DECLARATION_ARCHIVE: "record.declaration-archive",
1396
- RECORD_DECLARATION_REINSTATE: "record.declaration-reinstate",
1397
- // register
1398
- RECORD_REGISTER: "record.register",
1399
- // certify
1400
- RECORD_EXPORT_RECORDS: "record.export-records",
1401
- RECORD_DECLARATION_PRINT: "record.declaration-print",
1402
- RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS: "record.declaration-print-supporting-documents",
1403
- RECORD_REGISTRATION_PRINT: "record.registration-print",
1404
- // v1.8
1405
- /**
1406
- * This scope is used to **print and **issue certified copies of a record
1407
- * after it has been registered. Previously Registrars had this permission.
1408
- */
1409
- RECORD_PRINT_ISSUE_CERTIFIED_COPIES: "record.registration-print&issue-certified-copies",
1410
- RECORD_PRINT_CERTIFIED_COPIES: "record.registration-print-certified-copies",
1411
- // v1.8
1412
- RECORD_BULK_PRINT_CERTIFIED_COPIES: "record.registration-bulk-print-certified-copies",
1413
- // v1.8
1414
- RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES: "record.registration-verify-certified-copies",
1415
- // v1.8
1416
- // correct
1417
- RECORD_REGISTRATION_REQUEST_CORRECTION: "record.registration-request-correction",
1418
- RECORD_REGISTRATION_CORRECT: "record.registration-correct",
1419
- RECORD_REGISTRATION_REQUEST_REVOCATION: "record.registration-request-revocation",
1420
- // v1.8
1421
- RECORD_REGISTRATION_REVOKE: "record.registration-revoke",
1422
- // v1.8
1423
- RECORD_REGISTRATION_REQUEST_REINSTATEMENT: "record.registration-request-reinstatement",
1424
- // v1.8
1425
- RECORD_REGISTRATION_REINSTATE: "record.registration-reinstate",
1426
- // v1.8
1427
- RECORD_CONFIRM_REGISTRATION: "record.confirm-registration",
1428
- RECORD_REJECT_REGISTRATION: "record.reject-registration",
1429
- // search
1430
- SEARCH_BIRTH_MY_JURISDICTION: "search.birth:my-jurisdiction",
1431
- SEARCH_BIRTH: "search.birth",
1432
- SEARCH_DEATH_MY_JURISDICTION: "search.death:my-jurisdiction",
1433
- SEARCH_DEATH: "search.death",
1434
- SEARCH_MARRIAGE_MY_JURISDICTION: "search.marriage:my-jurisdiction",
1435
- SEARCH_MARRIAGE: "search.marriage",
1436
- // audit v1.8
1437
- RECORD_READ: "record.read",
1438
- RECORD_READ_AUDIT: "record.read-audit",
1439
- RECORD_READ_COMMENTS: "record.read-comments",
1440
- RECORD_CREATE_COMMENTS: "record.create-comments",
1441
- // profile
1442
- PROFILE_UPDATE: "profile.update",
1443
- //v1.8
1444
- PROFILE_ELECTRONIC_SIGNATURE: "profile.electronic-signature",
1445
- // performance
1446
- PERFORMANCE_READ: "performance.read",
1447
- PERFORMANCE_READ_DASHBOARDS: "performance.read-dashboards",
1448
- PERFORMANCE_EXPORT_VITAL_STATISTICS: "performance.vital-statistics-export",
1449
- // organisation
1450
- ORGANISATION_READ_LOCATIONS: "organisation.read-locations:all",
1451
- ORGANISATION_READ_LOCATIONS_MY_OFFICE: "organisation.read-locations:my-office",
1452
- ORGANISATION_READ_LOCATIONS_MY_JURISDICTION: "organisation.read-locations:my-jurisdiction",
1453
- // user
1454
- USER_READ: "user.read:all",
1455
- USER_READ_MY_OFFICE: "user.read:my-office",
1456
- USER_READ_MY_JURISDICTION: "user.read:my-jurisdiction",
1457
- USER_READ_ONLY_MY_AUDIT: "user.read:only-my-audit",
1458
- //v1.8
1459
- USER_CREATE: "user.create:all",
1460
- USER_CREATE_MY_JURISDICTION: "user.create:my-jurisdiction",
1461
- USER_UPDATE: "user.update:all",
1462
- USER_UPDATE_MY_JURISDICTION: "user.update:my-jurisdiction",
1463
- // config
1464
- CONFIG_UPDATE_ALL: "config.update:all",
1465
- // data seeding
1466
- USER_DATA_SEEDING: "user.data-seeding"
1467
- };
1468
- var LegacyScopes = import_zod16.z.union([
1469
- import_zod16.z.literal(SCOPES.NATLSYSADMIN),
1470
- import_zod16.z.literal(SCOPES.BYPASSRATELIMIT),
1471
- import_zod16.z.literal(SCOPES.DECLARE),
1472
- import_zod16.z.literal(SCOPES.REGISTER),
1473
- import_zod16.z.literal(SCOPES.VALIDATE),
1474
- import_zod16.z.literal(SCOPES.DEMO),
1475
- import_zod16.z.literal(SCOPES.CERTIFY),
1476
- import_zod16.z.literal(SCOPES.PERFORMANCE),
1477
- import_zod16.z.literal(SCOPES.SYSADMIN),
1478
- import_zod16.z.literal(SCOPES.TEAMS),
1479
- import_zod16.z.literal(SCOPES.CONFIG)
1480
- ]);
1481
- var IntegrationScopes = import_zod16.z.union([
1482
- import_zod16.z.literal(SCOPES.WEBHOOK),
1483
- import_zod16.z.literal(SCOPES.NATIONALID),
1484
- import_zod16.z.literal(SCOPES.NOTIFICATION_API),
1485
- import_zod16.z.literal(SCOPES.RECORDSEARCH)
1486
- ]);
1487
- var DeclareScopes = import_zod16.z.union([
1488
- import_zod16.z.literal(SCOPES.RECORD_DECLARE),
1489
- import_zod16.z.literal(SCOPES.RECORD_IMPORT),
1490
- import_zod16.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
1491
- import_zod16.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
1492
- import_zod16.z.literal(SCOPES.RECORD_DECLARE_DEATH),
1493
- import_zod16.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
1494
- import_zod16.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
1495
- import_zod16.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
1496
- import_zod16.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
1497
- import_zod16.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW)
1498
- ]);
1499
- var UnassignScope = import_zod16.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS);
1500
- var ValidateScopes = import_zod16.z.union([
1501
- import_zod16.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
1502
- import_zod16.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
1503
- import_zod16.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
1504
- import_zod16.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
1505
- import_zod16.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
1506
- import_zod16.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE)
1507
- ]);
1508
- var RegisterScope = import_zod16.z.literal(SCOPES.RECORD_REGISTER);
1509
- var CertifyScopes = import_zod16.z.union([
1510
- import_zod16.z.literal(SCOPES.RECORD_EXPORT_RECORDS),
1511
- import_zod16.z.literal(SCOPES.RECORD_DECLARATION_PRINT),
1512
- import_zod16.z.literal(SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS),
1513
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_PRINT),
1514
- import_zod16.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
1515
- import_zod16.z.literal(SCOPES.RECORD_PRINT_CERTIFIED_COPIES),
1516
- import_zod16.z.literal(SCOPES.RECORD_BULK_PRINT_CERTIFIED_COPIES),
1517
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES)
1518
- ]);
1519
- var CorrectionScopes = import_zod16.z.union([
1520
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
1521
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
1522
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REVOCATION),
1523
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REVOKE),
1524
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REINSTATEMENT),
1525
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REINSTATE),
1526
- import_zod16.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
1527
- import_zod16.z.literal(SCOPES.RECORD_REJECT_REGISTRATION)
1528
- ]);
1529
- var SearchScopes = import_zod16.z.union([
1530
- import_zod16.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
1531
- import_zod16.z.literal(SCOPES.SEARCH_BIRTH),
1532
- import_zod16.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
1533
- import_zod16.z.literal(SCOPES.SEARCH_DEATH),
1534
- import_zod16.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
1535
- import_zod16.z.literal(SCOPES.SEARCH_MARRIAGE)
1536
- ]);
1537
- var AuditScopes = import_zod16.z.union([
1538
- import_zod16.z.literal(SCOPES.RECORD_READ),
1539
- import_zod16.z.literal(SCOPES.RECORD_READ_AUDIT),
1540
- import_zod16.z.literal(SCOPES.RECORD_READ_COMMENTS),
1541
- import_zod16.z.literal(SCOPES.RECORD_CREATE_COMMENTS)
1542
- ]);
1543
- var ProfileScopes = import_zod16.z.union([
1544
- import_zod16.z.literal(SCOPES.PROFILE_UPDATE),
1545
- import_zod16.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE)
1546
- ]);
1547
- var PerformanceScopes = import_zod16.z.union([
1548
- import_zod16.z.literal(SCOPES.PERFORMANCE_READ),
1549
- import_zod16.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
1550
- import_zod16.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS)
1551
- ]);
1552
- var OrganisationScopes = import_zod16.z.union([
1553
- import_zod16.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
1554
- import_zod16.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
1555
- import_zod16.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION)
1556
- ]);
1557
- var UserScopes = import_zod16.z.union([
1558
- import_zod16.z.literal(SCOPES.USER_READ),
1559
- import_zod16.z.literal(SCOPES.USER_READ_MY_OFFICE),
1560
- import_zod16.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
1561
- import_zod16.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
1562
- import_zod16.z.literal(SCOPES.USER_CREATE),
1563
- import_zod16.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
1564
- import_zod16.z.literal(SCOPES.USER_UPDATE),
1565
- import_zod16.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION)
1566
- ]);
1567
- var ConfigScope = import_zod16.z.literal(SCOPES.CONFIG_UPDATE_ALL);
1568
- var DataSeedingScope = import_zod16.z.literal(SCOPES.USER_DATA_SEEDING);
1569
- var LiteralScopes = import_zod16.z.union([
1570
- LegacyScopes,
1571
- IntegrationScopes,
1572
- UnassignScope,
1573
- DeclareScopes,
1574
- ValidateScopes,
1575
- RegisterScope,
1576
- CertifyScopes,
1577
- CorrectionScopes,
1578
- SearchScopes,
1579
- AuditScopes,
1580
- ProfileScopes,
1581
- PerformanceScopes,
1582
- OrganisationScopes,
1583
- UserScopes,
1584
- ConfigScope,
1585
- DataSeedingScope
1586
- ]);
1587
- var rawConfigurableScopeRegex = /^([a-zA-Z\.]+)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
1588
- var rawConfigurableScope = import_zod16.z.string().regex(rawConfigurableScopeRegex);
1589
- var CreateUserScope = import_zod16.z.object({
1590
- type: import_zod16.z.literal("user.create"),
1591
- options: import_zod16.z.object({
1592
- role: import_zod16.z.array(import_zod16.z.string())
1593
- })
1594
- });
1595
- var EditUserScope = import_zod16.z.object({
1596
- type: import_zod16.z.literal("user.edit"),
1597
- options: import_zod16.z.object({
1598
- role: import_zod16.z.array(import_zod16.z.string())
1599
- })
1600
- });
1601
- var WorkqueueScope = import_zod16.z.object({
1602
- type: import_zod16.z.literal("workqueue"),
1603
- options: import_zod16.z.object({
1604
- id: import_zod16.z.array(import_zod16.z.string())
1605
- })
1606
- });
1607
- var NotifyRecordScope = import_zod16.z.object({
1608
- type: import_zod16.z.literal("record.notify"),
1609
- options: import_zod16.z.object({
1610
- event: import_zod16.z.array(import_zod16.z.string())
1611
- })
1612
- });
1613
- var ConfigurableScopes = import_zod16.z.discriminatedUnion("type", [
1614
- CreateUserScope,
1615
- EditUserScope,
1616
- WorkqueueScope,
1617
- NotifyRecordScope
1304
+ "status",
1305
+ "legalStatus.REGISTERED.createdAt",
1306
+ "legalStatus.REGISTERED.createdAtLocation",
1307
+ "updatedAt"
1618
1308
  ]);
1619
- var scopes = Object.values(SCOPES);
1620
- var ActionScopes = import_zod16.z.union([
1621
- DeclareScopes,
1622
- ValidateScopes,
1623
- RegisterScope,
1624
- CertifyScopes,
1625
- CorrectionScopes
1309
+ var EventFieldConfigSchema = BaseField3.extend({
1310
+ fieldId: EventFieldId,
1311
+ fieldType: import_zod14.z.literal("event")
1312
+ });
1313
+ var SearchField = import_zod14.z.discriminatedUnion("fieldType", [
1314
+ FieldConfigSchema,
1315
+ EventFieldConfigSchema
1626
1316
  ]);
1317
+ var AdvancedSearchConfig = import_zod14.z.object({
1318
+ title: TranslationConfig.describe("Advanced search tab title"),
1319
+ fields: import_zod14.z.array(SearchField).describe("Advanced search fields.")
1320
+ });
1627
1321
 
1628
- // ../commons/src/authentication.ts
1629
- var DEFAULT_ROLES_DEFINITION = [
1630
- {
1631
- id: "FIELD_AGENT",
1632
- label: {
1633
- defaultMessage: "Field Agent",
1634
- description: "Name for user role Field Agent",
1635
- id: "userRole.fieldAgent"
1636
- },
1637
- scopes: [
1638
- // new scopes
1639
- SCOPES.RECORD_DECLARE_BIRTH,
1640
- SCOPES.RECORD_DECLARE_DEATH,
1641
- SCOPES.RECORD_DECLARE_MARRIAGE,
1642
- SCOPES.RECORD_SUBMIT_INCOMPLETE,
1643
- SCOPES.RECORD_SUBMIT_FOR_REVIEW,
1644
- SCOPES.SEARCH_BIRTH,
1645
- SCOPES.SEARCH_DEATH,
1646
- SCOPES.SEARCH_MARRIAGE
1647
- ]
1648
- },
1649
- {
1650
- id: "REGISTRATION_AGENT",
1651
- label: {
1652
- defaultMessage: "Registration Agent",
1653
- description: "Name for user role Registration Agent",
1654
- id: "userRole.registrationAgent"
1655
- },
1656
- scopes: [
1657
- SCOPES.PERFORMANCE,
1658
- SCOPES.CERTIFY,
1659
- SCOPES.RECORD_DECLARE_BIRTH,
1660
- SCOPES.RECORD_DECLARE_DEATH,
1661
- SCOPES.RECORD_DECLARE_MARRIAGE,
1662
- SCOPES.RECORD_SUBMIT_FOR_APPROVAL,
1663
- SCOPES.RECORD_SUBMIT_FOR_UPDATES,
1664
- SCOPES.RECORD_DECLARATION_ARCHIVE,
1665
- SCOPES.RECORD_DECLARATION_REINSTATE,
1666
- SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION,
1667
- SCOPES.RECORD_REGISTRATION_PRINT,
1668
- SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS,
1669
- SCOPES.RECORD_EXPORT_RECORDS,
1670
- SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES,
1671
- SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES,
1672
- SCOPES.RECORD_CREATE_COMMENTS,
1673
- SCOPES.PERFORMANCE_READ,
1674
- SCOPES.PERFORMANCE_READ_DASHBOARDS,
1675
- SCOPES.ORGANISATION_READ_LOCATIONS,
1676
- SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE,
1677
- SCOPES.SEARCH_BIRTH,
1678
- SCOPES.SEARCH_DEATH,
1679
- SCOPES.SEARCH_MARRIAGE
1680
- ]
1681
- },
1682
- {
1683
- id: "LOCAL_REGISTRAR",
1684
- label: {
1685
- defaultMessage: "Local Registrar",
1686
- description: "Name for user role Local Registrar",
1687
- id: "userRole.localRegistrar"
1688
- },
1689
- scopes: [
1690
- SCOPES.PERFORMANCE,
1691
- SCOPES.CERTIFY,
1692
- SCOPES.RECORD_DECLARE_BIRTH,
1693
- SCOPES.RECORD_DECLARE_DEATH,
1694
- SCOPES.RECORD_DECLARE_MARRIAGE,
1695
- SCOPES.RECORD_SUBMIT_FOR_UPDATES,
1696
- SCOPES.RECORD_REVIEW_DUPLICATES,
1697
- SCOPES.RECORD_DECLARATION_ARCHIVE,
1698
- SCOPES.RECORD_DECLARATION_REINSTATE,
1699
- SCOPES.RECORD_REGISTER,
1700
- SCOPES.RECORD_REGISTRATION_CORRECT,
1701
- SCOPES.RECORD_REGISTRATION_PRINT,
1702
- SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS,
1703
- SCOPES.RECORD_EXPORT_RECORDS,
1704
- SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES,
1705
- SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES,
1706
- SCOPES.RECORD_CREATE_COMMENTS,
1707
- SCOPES.PERFORMANCE_READ,
1708
- SCOPES.PERFORMANCE_READ_DASHBOARDS,
1709
- SCOPES.ORGANISATION_READ_LOCATIONS,
1710
- SCOPES.PROFILE_ELECTRONIC_SIGNATURE,
1711
- SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE,
1712
- SCOPES.SEARCH_BIRTH,
1713
- SCOPES.SEARCH_DEATH,
1714
- SCOPES.SEARCH_MARRIAGE
1715
- ]
1716
- },
1717
- {
1718
- id: "LOCAL_SYSTEM_ADMIN",
1719
- label: {
1720
- defaultMessage: "Local System Admin",
1721
- description: "Name for user role Local System Admin",
1722
- id: "userRole.localSystemAdmin"
1723
- },
1724
- scopes: [
1725
- SCOPES.SYSADMIN,
1726
- SCOPES.USER_READ_MY_OFFICE,
1727
- SCOPES.USER_CREATE_MY_JURISDICTION,
1728
- SCOPES.USER_UPDATE_MY_JURISDICTION,
1729
- SCOPES.ORGANISATION_READ_LOCATIONS,
1730
- SCOPES.PERFORMANCE_READ,
1731
- SCOPES.PERFORMANCE_READ_DASHBOARDS,
1732
- SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS
1733
- // 'organisation.read-users' ?
1734
- ]
1735
- },
1736
- {
1737
- id: "NATIONAL_SYSTEM_ADMIN",
1738
- label: {
1739
- defaultMessage: "National System Admin",
1740
- description: "Name for user role National System Admin",
1741
- id: "userRole.nationalSystemAdmin"
1742
- },
1743
- scopes: [
1744
- SCOPES.SYSADMIN,
1745
- SCOPES.NATLSYSADMIN,
1746
- SCOPES.USER_CREATE,
1747
- SCOPES.USER_READ,
1748
- SCOPES.USER_UPDATE,
1749
- SCOPES.ORGANISATION_READ_LOCATIONS,
1750
- SCOPES.PERFORMANCE_READ,
1751
- SCOPES.PERFORMANCE_READ_DASHBOARDS,
1752
- SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS
1753
- // 'organisation.read-users' ?
1754
- ]
1755
- },
1756
- {
1757
- id: "PERFORMANCE_MANAGER",
1758
- label: {
1759
- defaultMessage: "Performance Manager",
1760
- description: "Name for user role Performance Manager",
1761
- id: "userRole.performanceManager"
1762
- },
1763
- scopes: [
1764
- SCOPES.PERFORMANCE,
1765
- SCOPES.PERFORMANCE_READ,
1766
- SCOPES.PERFORMANCE_READ_DASHBOARDS,
1767
- SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS
1768
- ]
1769
- }
1770
- ];
1771
- var TokenUserType = import_zod17.z.enum(["user", "system"]);
1772
- var TokenWithBearer = import_zod17.z.string().regex(/^Bearer\s/);
1322
+ // ../commons/src/events/utils.ts
1323
+ var import_lodash = require("lodash");
1324
+
1325
+ // ../commons/src/events/ActionDocument.ts
1326
+ var import_zod16 = require("zod");
1327
+ var import_zod_openapi7 = require("zod-openapi");
1328
+
1329
+ // ../commons/src/events/CreatedAtLocation.ts
1330
+ var import_zod15 = require("zod");
1331
+ var CreatedAtLocation = import_zod15.z.string().nullish();
1773
1332
 
1774
1333
  // ../commons/src/events/ActionDocument.ts
1775
- (0, import_zod_openapi7.extendZodWithOpenApi)(import_zod18.z);
1776
- var ActionUpdate = import_zod18.z.record(import_zod18.z.string(), FieldUpdateValue);
1777
- var EventState = import_zod18.z.record(import_zod18.z.string(), FieldValue);
1334
+ (0, import_zod_openapi7.extendZodWithOpenApi)(import_zod16.z);
1335
+ var ActionUpdate = import_zod16.z.record(import_zod16.z.string(), FieldUpdateValue);
1336
+ var EventState = import_zod16.z.record(import_zod16.z.string(), FieldValue);
1778
1337
  var ActionStatus = {
1779
1338
  Requested: "Requested",
1780
1339
  Accepted: "Accepted",
1781
1340
  Rejected: "Rejected"
1782
1341
  };
1783
- var ActionBase = import_zod18.z.object({
1784
- id: UUID,
1785
- transactionId: import_zod18.z.string(),
1786
- createdByUserType: TokenUserType,
1787
- createdAt: import_zod18.z.string().datetime(),
1788
- createdBy: import_zod18.z.string(),
1789
- createdByRole: import_zod18.z.string(),
1790
- createdBySignature: import_zod18.z.string().nullish().describe("Reference to signature of the user who created the action"),
1342
+ var ActionBase = import_zod16.z.object({
1343
+ id: import_zod16.z.string(),
1344
+ transactionId: import_zod16.z.string(),
1345
+ createdAt: import_zod16.z.string().datetime(),
1346
+ createdBy: import_zod16.z.string(),
1347
+ createdByRole: import_zod16.z.string(),
1348
+ createdBySignature: import_zod16.z.string().nullish().describe("Reference to signature of the user who created the action"),
1791
1349
  createdAtLocation: CreatedAtLocation,
1792
1350
  declaration: ActionUpdate,
1793
- annotation: ActionUpdate.optional().nullable(),
1794
- status: import_zod18.z.enum([
1351
+ annotation: ActionUpdate.optional(),
1352
+ status: import_zod16.z.enum([
1795
1353
  ActionStatus.Requested,
1796
1354
  ActionStatus.Accepted,
1797
1355
  ActionStatus.Rejected
1798
1356
  ]),
1799
1357
  // If the action is an asynchronous confirmation for another action, we will save the original action id here.
1800
- originalActionId: UUID.optional().nullable().describe(
1801
- "Reference to the original action that was asynchronously rejected or accepted by 3rd party integration."
1802
- )
1358
+ originalActionId: import_zod16.z.string().optional()
1803
1359
  });
1804
1360
  var AssignedAction = ActionBase.merge(
1805
- import_zod18.z.object({
1806
- type: import_zod18.z.literal(ActionType.ASSIGN),
1807
- assignedTo: import_zod18.z.string()
1361
+ import_zod16.z.object({
1362
+ type: import_zod16.z.literal(ActionType.ASSIGN),
1363
+ assignedTo: import_zod16.z.string()
1808
1364
  })
1809
1365
  );
1810
1366
  var UnassignedAction = ActionBase.merge(
1811
- import_zod18.z.object({
1812
- type: import_zod18.z.literal(ActionType.UNASSIGN)
1367
+ import_zod16.z.object({
1368
+ type: import_zod16.z.literal(ActionType.UNASSIGN),
1369
+ assignedTo: import_zod16.z.literal(null)
1813
1370
  })
1814
1371
  );
1815
1372
  var RegisterAction = ActionBase.merge(
1816
- import_zod18.z.object({
1817
- type: import_zod18.z.literal(ActionType.REGISTER),
1818
- registrationNumber: import_zod18.z.string().optional()
1373
+ import_zod16.z.object({
1374
+ type: import_zod16.z.literal(ActionType.REGISTER),
1375
+ registrationNumber: import_zod16.z.string().optional()
1819
1376
  })
1820
1377
  );
1821
1378
  var DeclareAction = ActionBase.merge(
1822
- import_zod18.z.object({
1823
- type: import_zod18.z.literal(ActionType.DECLARE)
1379
+ import_zod16.z.object({
1380
+ type: import_zod16.z.literal(ActionType.DECLARE)
1824
1381
  })
1825
1382
  );
1826
1383
  var ValidateAction = ActionBase.merge(
1827
- import_zod18.z.object({
1828
- type: import_zod18.z.literal(ActionType.VALIDATE)
1384
+ import_zod16.z.object({
1385
+ type: import_zod16.z.literal(ActionType.VALIDATE)
1829
1386
  })
1830
1387
  );
1831
- var RejectionReason = import_zod18.z.object({
1832
- message: import_zod18.z.string().min(1, { message: "Message cannot be empty" }).describe("Message describing reason for rejection or archiving"),
1833
- isDuplicate: import_zod18.z.boolean().optional().describe("If a declaration is duplicated")
1388
+ var RejectionReason = import_zod16.z.object({
1389
+ message: import_zod16.z.string().min(1, { message: "Message cannot be empty" }).describe("Message describing reason for rejection or archiving"),
1390
+ isDuplicate: import_zod16.z.boolean().optional().describe("If a declaration is duplicated")
1834
1391
  });
1835
1392
  var RejectAction = ActionBase.merge(
1836
- import_zod18.z.object({
1837
- type: import_zod18.z.literal(ActionType.REJECT),
1393
+ import_zod16.z.object({
1394
+ type: import_zod16.z.literal(ActionType.REJECT),
1838
1395
  reason: RejectionReason
1839
1396
  })
1840
1397
  );
1841
1398
  var MarkAsDuplicateAction = ActionBase.merge(
1842
- import_zod18.z.object({
1843
- type: import_zod18.z.literal(ActionType.MARKED_AS_DUPLICATE)
1399
+ import_zod16.z.object({
1400
+ type: import_zod16.z.literal(ActionType.MARKED_AS_DUPLICATE)
1844
1401
  })
1845
1402
  );
1846
1403
  var ArchiveAction = ActionBase.merge(
1847
- import_zod18.z.object({
1848
- type: import_zod18.z.literal(ActionType.ARCHIVE),
1404
+ import_zod16.z.object({
1405
+ type: import_zod16.z.literal(ActionType.ARCHIVE),
1849
1406
  reason: RejectionReason
1850
1407
  })
1851
1408
  );
1852
1409
  var CreatedAction = ActionBase.merge(
1853
- import_zod18.z.object({
1854
- type: import_zod18.z.literal(ActionType.CREATE)
1410
+ import_zod16.z.object({
1411
+ type: import_zod16.z.literal(ActionType.CREATE)
1855
1412
  })
1856
1413
  );
1857
1414
  var NotifiedAction = ActionBase.merge(
1858
- import_zod18.z.object({
1859
- type: import_zod18.z.literal(ActionType.NOTIFY)
1415
+ import_zod16.z.object({
1416
+ type: import_zod16.z.literal(ActionType.NOTIFY)
1860
1417
  })
1861
1418
  );
1862
1419
  var PrintCertificateAction = ActionBase.merge(
1863
- import_zod18.z.object({
1864
- type: import_zod18.z.literal(ActionType.PRINT_CERTIFICATE)
1420
+ import_zod16.z.object({
1421
+ type: import_zod16.z.literal(ActionType.PRINT_CERTIFICATE)
1865
1422
  })
1866
1423
  );
1867
1424
  var RequestedCorrectionAction = ActionBase.merge(
1868
- import_zod18.z.object({
1869
- type: import_zod18.z.literal(ActionType.REQUEST_CORRECTION)
1425
+ import_zod16.z.object({
1426
+ type: import_zod16.z.literal(ActionType.REQUEST_CORRECTION)
1870
1427
  })
1871
1428
  );
1872
1429
  var ApprovedCorrectionAction = ActionBase.merge(
1873
- import_zod18.z.object({
1874
- type: import_zod18.z.literal(ActionType.APPROVE_CORRECTION),
1875
- requestId: import_zod18.z.string()
1430
+ import_zod16.z.object({
1431
+ type: import_zod16.z.literal(ActionType.APPROVE_CORRECTION),
1432
+ requestId: import_zod16.z.string()
1876
1433
  })
1877
1434
  );
1878
1435
  var RejectedCorrectionAction = ActionBase.merge(
1879
- import_zod18.z.object({
1880
- type: import_zod18.z.literal(ActionType.REJECT_CORRECTION),
1881
- requestId: import_zod18.z.string()
1436
+ import_zod16.z.object({
1437
+ type: import_zod16.z.literal(ActionType.REJECT_CORRECTION),
1438
+ requestId: import_zod16.z.string()
1882
1439
  })
1883
1440
  );
1884
1441
  var ReadAction = ActionBase.merge(
1885
- import_zod18.z.object({
1886
- type: import_zod18.z.literal(ActionType.READ)
1442
+ import_zod16.z.object({
1443
+ type: import_zod16.z.literal(ActionType.READ)
1887
1444
  })
1888
1445
  );
1889
- var ActionDocument = import_zod18.z.discriminatedUnion("type", [
1446
+ var ActionDocument = import_zod16.z.discriminatedUnion("type", [
1890
1447
  CreatedAction.openapi({ ref: "CreatedAction" }),
1891
1448
  ValidateAction.openapi({ ref: "ValidateAction" }),
1892
1449
  RejectAction.openapi({ ref: "RejectAction" }),
@@ -1909,20 +1466,20 @@ var AsyncRejectActionDocument = ActionBase.omit({
1909
1466
  declaration: true,
1910
1467
  annotation: true
1911
1468
  }).merge(
1912
- import_zod18.z.object({
1913
- type: import_zod18.z.enum(ConfirmableActions),
1914
- status: import_zod18.z.literal(ActionStatus.Rejected)
1469
+ import_zod16.z.object({
1470
+ type: import_zod16.z.enum(ConfirmableActions),
1471
+ status: import_zod16.z.literal(ActionStatus.Rejected)
1915
1472
  })
1916
1473
  );
1917
- var Action = import_zod18.z.union([ActionDocument, AsyncRejectActionDocument]);
1918
- var ResolvedUser = import_zod18.z.object({
1919
- id: import_zod18.z.string(),
1920
- role: import_zod18.z.string(),
1921
- name: import_zod18.z.array(
1922
- import_zod18.z.object({
1923
- use: import_zod18.z.string(),
1924
- given: import_zod18.z.array(import_zod18.z.string()),
1925
- family: import_zod18.z.string()
1474
+ var Action = import_zod16.z.union([ActionDocument, AsyncRejectActionDocument]);
1475
+ var ResolvedUser = import_zod16.z.object({
1476
+ id: import_zod16.z.string(),
1477
+ role: import_zod16.z.string(),
1478
+ name: import_zod16.z.array(
1479
+ import_zod16.z.object({
1480
+ use: import_zod16.z.string(),
1481
+ given: import_zod16.z.array(import_zod16.z.string()),
1482
+ family: import_zod16.z.string()
1926
1483
  })
1927
1484
  )
1928
1485
  });
@@ -1933,7 +1490,7 @@ var import_ajv_formats = __toESM(require("ajv-formats"));
1933
1490
  var import_date_fns = require("date-fns");
1934
1491
 
1935
1492
  // ../commons/src/events/FieldTypeMapping.ts
1936
- var import_zod19 = require("zod");
1493
+ var import_zod17 = require("zod");
1937
1494
  function mapFieldTypeToZod(type, required) {
1938
1495
  let schema;
1939
1496
  switch (type) {
@@ -1993,7 +1550,7 @@ function createValidationSchema(config) {
1993
1550
  for (const field2 of config) {
1994
1551
  shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
1995
1552
  }
1996
- return import_zod19.z.object(shape);
1553
+ return import_zod17.z.object(shape);
1997
1554
  }
1998
1555
  function mapFieldTypeToEmptyValue(field2) {
1999
1556
  switch (field2.type) {
@@ -2133,29 +1690,6 @@ var ajv = new import_ajv.default({
2133
1690
  allowUnionTypes: true
2134
1691
  });
2135
1692
  (0, import_ajv_formats.default)(ajv);
2136
- ajv.addKeyword({
2137
- keyword: "daysFromNow",
2138
- type: "string",
2139
- schemaType: "object",
2140
- $data: true,
2141
- errors: true,
2142
- validate(schema, data, _, dataContext) {
2143
- if (!(dataContext && dataContext.rootData && typeof dataContext.rootData === "object" && "$now" in dataContext.rootData && typeof dataContext.rootData.$now === "string")) {
2144
- throw new Error("Validation context must contain $now");
2145
- }
2146
- const { days, clause } = schema;
2147
- if (typeof data !== "string") {
2148
- return false;
2149
- }
2150
- const date = new Date(data);
2151
- if (isNaN(date.getTime())) {
2152
- return false;
2153
- }
2154
- const now = new Date(dataContext.rootData.$now);
2155
- const offsetDate = new Date(now.getTime() + days * 24 * 60 * 60 * 1e3);
2156
- return clause === "after" ? (0, import_date_fns.isAfter)(date, offsetDate) : (0, import_date_fns.isBefore)(date, offsetDate);
2157
- }
2158
- });
2159
1693
  function validate(schema, data) {
2160
1694
  return ajv.validate(schema, data);
2161
1695
  }
@@ -2221,7 +1755,7 @@ var errorMessages = {
2221
1755
  id: "v2.error.invalidEmail"
2222
1756
  },
2223
1757
  requiredField: {
2224
- defaultMessage: "Required",
1758
+ defaultMessage: "Required for registration",
2225
1759
  description: "Error message when required field is missing",
2226
1760
  id: "v2.error.required"
2227
1761
  },
@@ -2369,6 +1903,12 @@ function getValidatorsForField(fieldId, validations) {
2369
1903
  }).filter((x) => x !== null);
2370
1904
  }
2371
1905
 
1906
+ // ../commons/src/uuid.ts
1907
+ var import_uuid = require("uuid");
1908
+ function getUUID() {
1909
+ return (0, import_uuid.v4)();
1910
+ }
1911
+
2372
1912
  // ../commons/src/utils.ts
2373
1913
  function getOrThrow(x, message) {
2374
1914
  if (x === void 0 || x === null) {
@@ -2376,9 +1916,6 @@ function getOrThrow(x, message) {
2376
1916
  }
2377
1917
  return x;
2378
1918
  }
2379
- function joinValues(values, separator = " ") {
2380
- return values.filter((value) => !!value).join(separator).trim();
2381
- }
2382
1919
 
2383
1920
  // ../commons/src/events/utils.ts
2384
1921
  function isDeclarationActionConfig(action) {
@@ -2395,10 +1932,7 @@ function getDeclaration(configuration) {
2395
1932
  }
2396
1933
  var getActionAnnotationFields = (actionConfig) => {
2397
1934
  if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
2398
- return [
2399
- ...actionConfig.onboardingForm.flatMap(({ fields }) => fields),
2400
- ...actionConfig.additionalDetailsForm.flatMap(({ fields }) => fields)
2401
- ];
1935
+ return actionConfig.correctionForm.pages.flatMap(({ fields }) => fields);
2402
1936
  }
2403
1937
  if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
2404
1938
  return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
@@ -2421,7 +1955,7 @@ function getDeclarationFieldById(config, fieldId) {
2421
1955
  var findRecordActionPages = (config, actionType) => {
2422
1956
  const action = config.actions.find((a) => a.type === actionType);
2423
1957
  if (action?.type === ActionType.REQUEST_CORRECTION) {
2424
- return [...action.onboardingForm, ...action.additionalDetailsForm];
1958
+ return action.correctionForm.pages;
2425
1959
  }
2426
1960
  if (action?.type === ActionType.PRINT_CERTIFICATE) {
2427
1961
  return action.printForm.pages;
@@ -2478,9 +2012,8 @@ function createEmptyDraft(eventId, draftId, actionType) {
2478
2012
  declaration: {},
2479
2013
  annotation: {},
2480
2014
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
2481
- createdByUserType: TokenUserType.Enum.user,
2482
2015
  createdBy: "@todo",
2483
- createdAtLocation: "00000000-0000-0000-0000-000000000000",
2016
+ createdAtLocation: "@todo",
2484
2017
  status: ActionStatus.Accepted,
2485
2018
  transactionId: "@todo",
2486
2019
  createdByRole: "@todo"
@@ -2495,13 +2028,10 @@ function getVisibleVerificationPageIds(pages, annotation) {
2495
2028
  }
2496
2029
  function getActionVerificationPageIds(actionConfig, annotation) {
2497
2030
  if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
2498
- return [
2499
- ...getVisibleVerificationPageIds(actionConfig.onboardingForm, annotation),
2500
- ...getVisibleVerificationPageIds(
2501
- actionConfig.additionalDetailsForm,
2502
- annotation
2503
- )
2504
- ];
2031
+ return getVisibleVerificationPageIds(
2032
+ actionConfig.correctionForm.pages,
2033
+ annotation
2034
+ );
2505
2035
  }
2506
2036
  if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
2507
2037
  return getVisibleVerificationPageIds(
@@ -2583,9 +2113,9 @@ function getEventConfigById(eventConfigs, id) {
2583
2113
 
2584
2114
  // ../commons/src/events/EventConfig.ts
2585
2115
  var import_zod_openapi8 = require("zod-openapi");
2586
- (0, import_zod_openapi8.extendZodWithOpenApi)(import_zod20.z);
2587
- var EventConfig = import_zod20.z.object({
2588
- id: import_zod20.z.string().describe(
2116
+ (0, import_zod_openapi8.extendZodWithOpenApi)(import_zod18.z);
2117
+ var EventConfig = import_zod18.z.object({
2118
+ id: import_zod18.z.string().describe(
2589
2119
  'A machine-readable identifier for the event, e.g. "birth" or "death"'
2590
2120
  ),
2591
2121
  dateOfEvent: FieldReference.optional(),
@@ -2595,10 +2125,10 @@ var EventConfig = import_zod20.z.object({
2595
2125
  ),
2596
2126
  summary: SummaryConfig,
2597
2127
  label: TranslationConfig,
2598
- actions: import_zod20.z.array(ActionConfig),
2128
+ actions: import_zod18.z.array(ActionConfig),
2599
2129
  declaration: DeclarationFormConfig,
2600
- deduplication: import_zod20.z.array(DeduplicationConfig).optional().default([]),
2601
- advancedSearch: import_zod20.z.array(AdvancedSearchConfig).optional().default([])
2130
+ deduplication: import_zod18.z.array(DeduplicationConfig).optional().default([]),
2131
+ advancedSearch: import_zod18.z.array(AdvancedSearchConfig).optional().default([])
2602
2132
  }).superRefine((event2, ctx) => {
2603
2133
  const allFields = findAllFields(event2);
2604
2134
  const fieldIds = allFields.map((field2) => field2.id);
@@ -2660,12 +2190,12 @@ var definePage = (page) => PageConfig.parse(page);
2660
2190
  var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
2661
2191
 
2662
2192
  // ../commons/src/events/WorkqueueConfig.ts
2663
- var import_zod27 = require("zod");
2193
+ var import_zod25 = require("zod");
2664
2194
 
2665
2195
  // ../commons/src/events/serializers/user/serializer.ts
2666
- var import_zod21 = require("zod");
2667
- var SerializedUserField = import_zod21.z.object({
2668
- $userField: import_zod21.z.enum([
2196
+ var import_zod19 = require("zod");
2197
+ var SerializedUserField = import_zod19.z.object({
2198
+ $userField: import_zod19.z.enum([
2669
2199
  "id",
2670
2200
  "name",
2671
2201
  "role",
@@ -2773,6 +2303,9 @@ function createEventConditionals() {
2773
2303
  })
2774
2304
  };
2775
2305
  }
2306
+ function getDateFromNow(days) {
2307
+ return new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
2308
+ }
2776
2309
  function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
2777
2310
  return {
2778
2311
  type: "object",
@@ -2791,20 +2324,6 @@ function isFieldReference(value) {
2791
2324
  return typeof value === "object" && value !== null && "$$field" in value;
2792
2325
  }
2793
2326
  function createFieldConditionals(fieldId) {
2794
- const getDayRange = (days, clause) => ({
2795
- type: "object",
2796
- properties: {
2797
- [fieldId]: {
2798
- type: "string",
2799
- format: "date",
2800
- daysFromNow: {
2801
- days,
2802
- clause
2803
- }
2804
- }
2805
- },
2806
- required: [fieldId]
2807
- });
2808
2327
  const getDateRange = (date, clause) => ({
2809
2328
  type: "object",
2810
2329
  properties: {
@@ -2823,8 +2342,12 @@ function createFieldConditionals(fieldId) {
2823
2342
  $$field: fieldId,
2824
2343
  isAfter: () => ({
2825
2344
  days: (days) => ({
2826
- inPast: () => defineFormConditional(getDayRange(-days, "after")),
2827
- inFuture: () => defineFormConditional(getDayRange(days, "after"))
2345
+ inPast: () => defineFormConditional(
2346
+ getDateRange(getDateFromNow(days), "formatMinimum")
2347
+ ),
2348
+ inFuture: () => defineFormConditional(
2349
+ getDateRange(getDateFromNow(-days), "formatMinimum")
2350
+ )
2828
2351
  }),
2829
2352
  date: (date) => {
2830
2353
  if (isFieldReference(date)) {
@@ -2839,12 +2362,16 @@ function createFieldConditionals(fieldId) {
2839
2362
  }
2840
2363
  return defineFormConditional(getDateRange(date, "formatMinimum"));
2841
2364
  },
2842
- now: () => defineFormConditional(getDateRange({ $data: "/$now" }, "formatMinimum"))
2365
+ now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMinimum"))
2843
2366
  }),
2844
2367
  isBefore: () => ({
2845
2368
  days: (days) => ({
2846
- inPast: () => defineFormConditional(getDayRange(days, "before")),
2847
- inFuture: () => defineFormConditional(getDayRange(-days, "before"))
2369
+ inPast: () => defineFormConditional(
2370
+ getDateRange(getDateFromNow(days), "formatMaximum")
2371
+ ),
2372
+ inFuture: () => defineFormConditional(
2373
+ getDateRange(getDateFromNow(-days), "formatMaximum")
2374
+ )
2848
2375
  }),
2849
2376
  date: (date) => {
2850
2377
  if (isFieldReference(date)) {
@@ -2859,7 +2386,7 @@ function createFieldConditionals(fieldId) {
2859
2386
  }
2860
2387
  return defineFormConditional(getDateRange(date, "formatMaximum"));
2861
2388
  },
2862
- now: () => defineFormConditional(getDateRange({ $data: "/$now" }, "formatMaximum"))
2389
+ now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMaximum"))
2863
2390
  }),
2864
2391
  isEqualTo: (value) => {
2865
2392
  if (isFieldReference(value)) {
@@ -3071,11 +2598,11 @@ var event = Object.assign(eventFn, {
3071
2598
  });
3072
2599
 
3073
2600
  // ../commons/src/events/WorkqueueColumnConfig.ts
3074
- var import_zod23 = require("zod");
2601
+ var import_zod21 = require("zod");
3075
2602
 
3076
2603
  // ../commons/src/events/EventMetadata.ts
3077
- var import_zod22 = require("zod");
3078
- var EventStatus = import_zod22.z.enum([
2604
+ var import_zod20 = require("zod");
2605
+ var EventStatus = import_zod20.z.enum([
3079
2606
  "CREATED",
3080
2607
  "NOTIFIED",
3081
2608
  "DECLARED",
@@ -3085,69 +2612,60 @@ var EventStatus = import_zod22.z.enum([
3085
2612
  "REJECTED",
3086
2613
  "ARCHIVED"
3087
2614
  ]);
3088
- var InherentFlags = {
3089
- PRINTED: "printed",
3090
- INCOMPLETE: "incomplete",
3091
- REJECTED: "rejected",
3092
- CORRECTION_REQUESTED: "correction-requested"
2615
+ var CustomFlags = {
2616
+ CERTIFICATE_PRINTED: "certificate-printed"
3093
2617
  };
3094
- var Flag = import_zod22.z.string().regex(
2618
+ var Flag = import_zod20.z.string().regex(
3095
2619
  new RegExp(
3096
2620
  `^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
3097
2621
  ActionStatus
3098
2622
  ).join("|").toLowerCase()})$`
3099
2623
  ),
3100
2624
  "Flag must be in the format ActionType:ActionStatus (lowerCase)"
3101
- ).or(import_zod22.z.nativeEnum(InherentFlags));
3102
- var ZodDate = import_zod22.z.string().date();
3103
- var ActionCreationMetadata = import_zod22.z.object({
3104
- createdAt: import_zod22.z.string().datetime().describe("The timestamp when the action request was created."),
3105
- createdBy: import_zod22.z.string().describe("ID of the user who created the action request."),
2625
+ ).or(import_zod20.z.nativeEnum(CustomFlags));
2626
+ var ZodDate = import_zod20.z.string().date();
2627
+ var ActionCreationMetadata = import_zod20.z.object({
2628
+ createdAt: import_zod20.z.string().datetime().describe("The timestamp when the action request was created."),
2629
+ createdBy: import_zod20.z.string().describe("ID of the user who created the action request."),
3106
2630
  createdAtLocation: CreatedAtLocation.describe(
3107
2631
  "Location of the user who created the action request."
3108
2632
  ),
3109
- createdByUserType: import_zod22.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
3110
- acceptedAt: import_zod22.z.string().datetime().describe("Timestamp when the action request was accepted."),
3111
- createdByRole: import_zod22.z.string().describe("Role of the user at the time of action request creation."),
3112
- createdBySignature: import_zod22.z.string().nullish().describe("Signature of the user who created the action request.")
2633
+ acceptedAt: import_zod20.z.string().datetime().describe("Timestamp when the action request was accepted."),
2634
+ createdByRole: import_zod20.z.string().describe("Role of the user at the time of action request creation."),
2635
+ createdBySignature: import_zod20.z.string().nullish().describe("Signature of the user who created the action request.")
3113
2636
  });
3114
2637
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
3115
- registrationNumber: import_zod22.z.string().describe(
2638
+ registrationNumber: import_zod20.z.string().describe(
3116
2639
  "Registration number of the event. Always present for accepted registrations."
3117
2640
  )
3118
2641
  });
3119
- var LegalStatuses = import_zod22.z.object({
2642
+ var LegalStatuses = import_zod20.z.object({
3120
2643
  [EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
3121
2644
  [EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
3122
2645
  });
3123
- var EventMetadata = import_zod22.z.object({
3124
- id: UUID,
3125
- type: import_zod22.z.string().describe("The type of event, such as birth, death, or marriage."),
2646
+ var EventMetadata = import_zod20.z.object({
2647
+ id: import_zod20.z.string(),
2648
+ type: import_zod20.z.string().describe("The type of event, such as birth, death, or marriage."),
3126
2649
  status: EventStatus,
3127
2650
  legalStatuses: LegalStatuses.describe(
3128
2651
  "Metadata related to the legal registration of the event, such as who registered it and when."
3129
2652
  ),
3130
- createdAt: import_zod22.z.string().datetime().describe("The timestamp when the event was first created and saved."),
2653
+ createdAt: import_zod20.z.string().datetime().describe("The timestamp when the event was first created and saved."),
3131
2654
  dateOfEvent: ZodDate.nullish(),
3132
- createdBy: import_zod22.z.string().describe("ID of the user who created the event."),
3133
- createdByUserType: import_zod22.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
3134
- updatedByUserRole: import_zod22.z.string().describe("Role of the user who last changed the status."),
2655
+ createdBy: import_zod20.z.string().describe("ID of the user who created the event."),
2656
+ updatedByUserRole: import_zod20.z.string().describe("Role of the user who last updated the declaration."),
3135
2657
  createdAtLocation: CreatedAtLocation.describe(
3136
2658
  "Location of the user who created the event."
3137
2659
  ),
3138
- createdBySignature: import_zod22.z.string().nullish().describe("Signature of the user who created the event."),
3139
- updatedAtLocation: UUID.nullish().describe(
3140
- "Location of the user who last changed the status."
3141
- ),
3142
- updatedAt: import_zod22.z.string().datetime().describe(
3143
- "Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
3144
- ),
3145
- assignedTo: import_zod22.z.string().nullish().describe("ID of the user currently assigned to the event."),
3146
- updatedBy: import_zod22.z.string().nullish().describe("ID of the user who last changed the status."),
3147
- trackingId: import_zod22.z.string().describe(
2660
+ createdBySignature: import_zod20.z.string().nullish().describe("Signature of the user who created the event."),
2661
+ updatedAtLocation: import_zod20.z.string().nullish().describe("Location of the user who last updated the declaration."),
2662
+ updatedAt: import_zod20.z.string().datetime().describe("Timestamp of the most recent declaration update."),
2663
+ assignedTo: import_zod20.z.string().nullish().describe("ID of the user currently assigned to the event."),
2664
+ updatedBy: import_zod20.z.string().nullish().describe("ID of the user who last updated the declaration."),
2665
+ trackingId: import_zod20.z.string().describe(
3148
2666
  "System-generated tracking ID used by informants or registrars to look up the event."
3149
2667
  ),
3150
- flags: import_zod22.z.array(Flag)
2668
+ flags: import_zod20.z.array(Flag)
3151
2669
  });
3152
2670
  var EventMetadataKeysArray = [
3153
2671
  "id",
@@ -3156,7 +2674,6 @@ var EventMetadataKeysArray = [
3156
2674
  "createdAt",
3157
2675
  "dateOfEvent",
3158
2676
  "createdBy",
3159
- "createdByUserType",
3160
2677
  "updatedByUserRole",
3161
2678
  "createdAtLocation",
3162
2679
  "updatedAtLocation",
@@ -3167,7 +2684,7 @@ var EventMetadataKeysArray = [
3167
2684
  "legalStatuses",
3168
2685
  "flags"
3169
2686
  ];
3170
- var EventMetadataKeys = import_zod22.z.enum(EventMetadataKeysArray);
2687
+ var EventMetadataKeys = import_zod20.z.enum(EventMetadataKeysArray);
3171
2688
  var eventMetadataLabelMap = {
3172
2689
  "event.assignedTo": {
3173
2690
  id: "event.assignedTo.label",
@@ -3179,11 +2696,6 @@ var eventMetadataLabelMap = {
3179
2696
  defaultMessage: "Created",
3180
2697
  description: "Created At"
3181
2698
  },
3182
- "event.createdByUserType": {
3183
- id: "event.createdByUserType.label",
3184
- defaultMessage: "createdByUserType",
3185
- description: "createdByUserType:user or system"
3186
- },
3187
2699
  "event.dateOfEvent": {
3188
2700
  id: "event.dateOfEvent.label",
3189
2701
  defaultMessage: "Date of Event",
@@ -3249,14 +2761,13 @@ var eventMetadataLabelMap = {
3249
2761
  // ../commons/src/events/WorkqueueColumnConfig.ts
3250
2762
  var WorkqueueColumnKeysArray = [
3251
2763
  ...EventMetadataKeysArray,
3252
- "title",
3253
- "outbox"
2764
+ "title"
3254
2765
  ];
3255
- var WorkqueueColumnKeys = import_zod23.z.enum(WorkqueueColumnKeysArray);
3256
- var WorkqueueColumnValue = import_zod23.z.object({
2766
+ var WorkqueueColumnKeys = import_zod21.z.enum(WorkqueueColumnKeysArray);
2767
+ var WorkqueueColumnValue = import_zod21.z.object({
3257
2768
  $event: WorkqueueColumnKeys
3258
2769
  });
3259
- var WorkqueueColumn = import_zod23.z.object({
2770
+ var WorkqueueColumn = import_zod21.z.object({
3260
2771
  label: TranslationConfig,
3261
2772
  value: WorkqueueColumnValue
3262
2773
  });
@@ -3267,115 +2778,97 @@ function defineWorkqueuesColumns(workqueueColumns) {
3267
2778
  }
3268
2779
 
3269
2780
  // ../commons/src/events/CountryConfigQueryInput.ts
3270
- var import_zod25 = require("zod");
2781
+ var import_zod23 = require("zod");
3271
2782
 
3272
2783
  // ../commons/src/events/EventIndex.ts
3273
- var import_zod24 = require("zod");
2784
+ var import_zod22 = require("zod");
3274
2785
  var import_zod_openapi9 = require("zod-openapi");
3275
- (0, import_zod_openapi9.extendZodWithOpenApi)(import_zod24.z);
2786
+ (0, import_zod_openapi9.extendZodWithOpenApi)(import_zod22.z);
3276
2787
  var EventIndex = EventMetadata.extend({
3277
2788
  declaration: EventState
3278
2789
  }).openapi({
3279
2790
  ref: "EventIndex"
3280
2791
  });
3281
- var EventSearchIndex = import_zod24.z.record(import_zod24.z.string(), import_zod24.z.any()).and(
3282
- import_zod24.z.object({
3283
- type: import_zod24.z.string()
2792
+ var EventSearchIndex = import_zod22.z.record(import_zod22.z.string(), import_zod22.z.any()).and(
2793
+ import_zod22.z.object({
2794
+ type: import_zod22.z.string()
3284
2795
  // Ensures "type" (event-id) exists and is a string
3285
2796
  })
3286
2797
  ).openapi({
3287
2798
  ref: "EventSearchIndex"
3288
2799
  });
3289
- var Fuzzy = import_zod24.z.object({ type: import_zod24.z.literal("fuzzy"), term: import_zod24.z.string() }).openapi({
2800
+ var Fuzzy = import_zod22.z.object({ type: import_zod22.z.literal("fuzzy"), term: import_zod22.z.string() }).openapi({
3290
2801
  ref: "Fuzzy"
3291
2802
  });
3292
- var Exact = import_zod24.z.object({ type: import_zod24.z.literal("exact"), term: import_zod24.z.string() }).openapi({
2803
+ var Exact = import_zod22.z.object({ type: import_zod22.z.literal("exact"), term: import_zod22.z.string() }).openapi({
3293
2804
  ref: "Exact"
3294
2805
  });
3295
- var ExactStatus = import_zod24.z.object({
3296
- type: import_zod24.z.literal("exact"),
3297
- term: EventStatus
2806
+ var AnyOf = import_zod22.z.object({
2807
+ type: import_zod22.z.literal("anyOf"),
2808
+ terms: import_zod22.z.array(import_zod22.z.string())
3298
2809
  }).openapi({
3299
- ref: "ExactStatus"
2810
+ ref: "AnyOf"
3300
2811
  });
3301
- var AnyOf = import_zod24.z.object({
3302
- type: import_zod24.z.literal("anyOf"),
3303
- terms: import_zod24.z.array(import_zod24.z.string())
2812
+ var ExactStatus = import_zod22.z.object({
2813
+ type: import_zod22.z.literal("exact"),
2814
+ term: EventStatus
3304
2815
  }).openapi({
3305
- ref: "AnyOf"
2816
+ ref: "ExactStatus"
3306
2817
  });
3307
- var AnyOfStatus = import_zod24.z.object({
3308
- type: import_zod24.z.literal("anyOf"),
3309
- terms: import_zod24.z.array(EventStatus)
2818
+ var AnyOfStatus = import_zod22.z.object({
2819
+ type: import_zod22.z.literal("anyOf"),
2820
+ terms: import_zod22.z.array(EventStatus)
3310
2821
  }).openapi({
3311
2822
  ref: "AnyOfStatus"
3312
2823
  });
3313
- var Range = import_zod24.z.object({
3314
- type: import_zod24.z.literal("range"),
3315
- gte: import_zod24.z.string(),
3316
- lte: import_zod24.z.string()
2824
+ var Range = import_zod22.z.object({
2825
+ type: import_zod22.z.literal("range"),
2826
+ gte: import_zod22.z.string(),
2827
+ lte: import_zod22.z.string()
3317
2828
  }).openapi({
3318
2829
  ref: "Range"
3319
2830
  });
3320
- var ContainsFlags = import_zod24.z.object({
3321
- anyOf: import_zod24.z.array(Flag).optional(),
3322
- noneOf: import_zod24.z.array(Flag).optional()
3323
- }).openapi({
3324
- ref: "ContainsFlags"
2831
+ var Not = import_zod22.z.object({ type: import_zod22.z.literal("not"), term: import_zod22.z.string() }).openapi({
2832
+ ref: "Not"
3325
2833
  });
3326
- var Within = import_zod24.z.object({ type: import_zod24.z.literal("within"), location: import_zod24.z.string() }).openapi({
2834
+ var Within = import_zod22.z.object({ type: import_zod22.z.literal("within"), location: import_zod22.z.string() }).openapi({
3327
2835
  ref: "Within"
3328
2836
  });
3329
- var RangeDate = Range.extend({
3330
- gte: import_zod24.z.string().date().or(import_zod24.z.string().datetime()),
3331
- lte: import_zod24.z.string().date().or(import_zod24.z.string().datetime())
3332
- }).openapi({
3333
- ref: "RangeDate"
3334
- });
3335
- var ExactDate = Exact.extend({
3336
- term: import_zod24.z.string().date().or(import_zod24.z.string().datetime())
3337
- }).openapi({
3338
- ref: "ExactDate"
3339
- });
3340
- var DateCondition = import_zod24.z.union([ExactDate, RangeDate]).openapi({
2837
+ var DateCondition = import_zod22.z.union([Exact, Range]).openapi({
3341
2838
  ref: "DateCondition"
3342
2839
  });
3343
- var QueryInput = import_zod24.z.lazy(
3344
- () => import_zod24.z.union([
3345
- import_zod24.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf]),
3346
- import_zod24.z.record(import_zod24.z.string(), QueryInput)
2840
+ var QueryInput = import_zod22.z.lazy(
2841
+ () => import_zod22.z.union([
2842
+ import_zod22.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf, Not]),
2843
+ import_zod22.z.record(import_zod22.z.string(), QueryInput)
3347
2844
  ])
3348
2845
  ).openapi({
3349
2846
  ref: "QueryInput"
3350
2847
  });
3351
- var QueryExpression = import_zod24.z.object({
3352
- id: import_zod24.z.optional(import_zod24.z.string()),
3353
- eventType: import_zod24.z.string(),
3354
- status: import_zod24.z.optional(import_zod24.z.union([AnyOfStatus, ExactStatus])),
3355
- createdAt: import_zod24.z.optional(DateCondition),
3356
- updatedAt: import_zod24.z.optional(DateCondition),
3357
- "legalStatus.REGISTERED.createdAt": import_zod24.z.optional(DateCondition),
3358
- "legalStatus.REGISTERED.createdAtLocation": import_zod24.z.optional(
3359
- import_zod24.z.union([Within, Exact])
2848
+ var QueryExpression = import_zod22.z.object({
2849
+ eventType: import_zod22.z.string(),
2850
+ status: import_zod22.z.optional(import_zod22.z.union([AnyOfStatus, ExactStatus])),
2851
+ createdAt: import_zod22.z.optional(DateCondition),
2852
+ updatedAt: import_zod22.z.optional(DateCondition),
2853
+ "legalStatus.REGISTERED.createdAt": import_zod22.z.optional(DateCondition),
2854
+ "legalStatus.REGISTERED.createdAtLocation": import_zod22.z.optional(
2855
+ import_zod22.z.union([Within, Exact])
3360
2856
  ),
3361
- "legalStatus.REGISTERED.registrationNumber": import_zod24.z.optional(Exact),
3362
- createdAtLocation: import_zod24.z.optional(import_zod24.z.union([Within, Exact])),
3363
- updatedAtLocation: import_zod24.z.optional(import_zod24.z.union([Within, Exact])),
3364
- assignedTo: import_zod24.z.optional(Exact),
3365
- createdByUserType: TokenUserType,
3366
- createdBy: import_zod24.z.optional(Exact),
3367
- updatedBy: import_zod24.z.optional(Exact),
3368
- trackingId: import_zod24.z.optional(Exact),
3369
- flags: import_zod24.z.optional(ContainsFlags),
2857
+ "legalStatus.REGISTERED.registrationNumber": import_zod22.z.optional(Exact),
2858
+ createdAtLocation: import_zod22.z.optional(import_zod22.z.union([Within, Exact])),
2859
+ updatedAtLocation: import_zod22.z.optional(import_zod22.z.union([Within, Exact])),
2860
+ assignedTo: import_zod22.z.optional(Exact),
2861
+ createdBy: import_zod22.z.optional(Exact),
2862
+ updatedBy: import_zod22.z.optional(Exact),
2863
+ trackingId: import_zod22.z.optional(Exact),
2864
+ flags: import_zod22.z.optional(import_zod22.z.array(import_zod22.z.union([AnyOf, Not]))),
3370
2865
  data: QueryInput
3371
- }).partial().refine((obj) => Object.values(obj).some((val) => val !== void 0), {
3372
- message: "At least one query field must be specified."
3373
- }).openapi({
2866
+ }).partial().openapi({
3374
2867
  ref: "QueryExpression"
3375
2868
  });
3376
- var QueryType = import_zod24.z.object({
3377
- type: import_zod24.z.literal("and").or(import_zod24.z.literal("or")).openapi({ default: "and" }),
3378
- clauses: import_zod24.z.preprocess(
2869
+ var QueryType = import_zod22.z.object({
2870
+ type: import_zod22.z.literal("and").or(import_zod22.z.literal("or")).openapi({ default: "and" }),
2871
+ clauses: import_zod22.z.preprocess(
3379
2872
  (val) => {
3380
2873
  if (typeof val === "string") {
3381
2874
  return [JSON.parse(val)];
@@ -3385,7 +2878,7 @@ var QueryType = import_zod24.z.object({
3385
2878
  }
3386
2879
  return val;
3387
2880
  },
3388
- import_zod24.z.array(QueryExpression).nonempty("At least one clause is required.").openapi({
2881
+ import_zod22.z.array(QueryExpression).nonempty("At least one clause is required.").openapi({
3389
2882
  default: [
3390
2883
  {
3391
2884
  eventType: TENNIS_CLUB_MEMBERSHIP,
@@ -3408,56 +2901,50 @@ var QueryType = import_zod24.z.object({
3408
2901
  });
3409
2902
 
3410
2903
  // ../commons/src/events/CountryConfigQueryInput.ts
3411
- var SerializableExact = import_zod25.z.object({
3412
- type: import_zod25.z.literal("exact"),
3413
- term: import_zod25.z.union([import_zod25.z.string(), SerializedUserField])
2904
+ var SerializableExact = import_zod23.z.object({
2905
+ type: import_zod23.z.literal("exact"),
2906
+ term: import_zod23.z.union([import_zod23.z.string(), SerializedUserField])
3414
2907
  });
3415
- var SerializableWithin = import_zod25.z.object({
3416
- type: import_zod25.z.literal("within"),
3417
- location: import_zod25.z.union([import_zod25.z.string(), SerializedUserField])
2908
+ var SerializableWithin = import_zod23.z.object({
2909
+ type: import_zod23.z.literal("within"),
2910
+ location: import_zod23.z.union([import_zod23.z.string(), SerializedUserField])
3418
2911
  });
3419
- var SerializedQueryExpression = import_zod25.z.object({
3420
- eventType: import_zod25.z.string(),
3421
- status: import_zod25.z.optional(import_zod25.z.union([AnyOfStatus, ExactStatus])),
3422
- createdAt: import_zod25.z.optional(DateCondition),
3423
- updatedAt: import_zod25.z.optional(DateCondition),
3424
- "legalStatus.REGISTERED.createdAt": import_zod25.z.optional(DateCondition),
3425
- "legalStatus.REGISTERED.createdAtLocation": import_zod25.z.optional(
3426
- import_zod25.z.union([Within, Exact])
3427
- ),
3428
- "legalStatus.REGISTERED.registrationNumber": import_zod25.z.optional(Exact),
3429
- createdAtLocation: import_zod25.z.optional(
3430
- import_zod25.z.union([SerializableWithin, SerializableExact])
2912
+ var SerializedQueryExpression = import_zod23.z.object({
2913
+ eventType: import_zod23.z.string(),
2914
+ status: import_zod23.z.optional(import_zod23.z.union([AnyOfStatus, ExactStatus])),
2915
+ createdAt: import_zod23.z.optional(DateCondition),
2916
+ updatedAt: import_zod23.z.optional(DateCondition),
2917
+ createdAtLocation: import_zod23.z.optional(
2918
+ import_zod23.z.union([SerializableWithin, SerializableExact])
3431
2919
  ),
3432
- updatedAtLocation: import_zod25.z.optional(
3433
- import_zod25.z.union([SerializableWithin, SerializableExact])
2920
+ updatedAtLocation: import_zod23.z.optional(
2921
+ import_zod23.z.union([SerializableWithin, SerializableExact])
3434
2922
  ),
3435
- assignedTo: import_zod25.z.optional(SerializableExact),
3436
- createdBy: import_zod25.z.optional(SerializableExact),
3437
- createdByUserType: TokenUserType,
3438
- updatedBy: import_zod25.z.optional(SerializableExact),
3439
- trackingId: import_zod25.z.optional(Exact),
3440
- flags: import_zod25.z.optional(ContainsFlags),
2923
+ assignedTo: import_zod23.z.optional(SerializableExact),
2924
+ createdBy: import_zod23.z.optional(SerializableExact),
2925
+ updatedBy: import_zod23.z.optional(SerializableExact),
2926
+ trackingId: import_zod23.z.optional(Exact),
2927
+ flags: import_zod23.z.optional(import_zod23.z.array(import_zod23.z.union([AnyOf, Not]))),
3441
2928
  data: QueryInput
3442
2929
  }).partial();
3443
- var Or2 = import_zod25.z.object({
3444
- type: import_zod25.z.literal("or"),
3445
- clauses: import_zod25.z.array(SerializedQueryExpression)
2930
+ var Or2 = import_zod23.z.object({
2931
+ type: import_zod23.z.literal("or"),
2932
+ clauses: import_zod23.z.array(SerializedQueryExpression)
3446
2933
  });
3447
- var And2 = import_zod25.z.object({
3448
- type: import_zod25.z.literal("and"),
3449
- clauses: import_zod25.z.array(SerializedQueryExpression)
2934
+ var And2 = import_zod23.z.object({
2935
+ type: import_zod23.z.literal("and"),
2936
+ clauses: import_zod23.z.array(SerializedQueryExpression)
3450
2937
  });
3451
- var CountryConfigQueryType = import_zod25.z.discriminatedUnion("type", [And2, Or2]);
3452
- var CountryConfigQueryInputType = import_zod25.z.union([
2938
+ var CountryConfigQueryType = import_zod23.z.discriminatedUnion("type", [And2, Or2]);
2939
+ var CountryConfigQueryInputType = import_zod23.z.union([
3453
2940
  SerializedQueryExpression,
3454
2941
  And2,
3455
2942
  Or2
3456
2943
  ]);
3457
2944
 
3458
2945
  // ../commons/src/icons.ts
3459
- var import_zod26 = require("zod");
3460
- var AvailableIcons = import_zod26.z.enum([
2946
+ var import_zod24 = require("zod");
2947
+ var AvailableIcons = import_zod24.z.enum([
3461
2948
  "Archived",
3462
2949
  "Assigned",
3463
2950
  "Certified",
@@ -3495,6 +2982,7 @@ var AvailableIcons = import_zod26.z.enum([
3495
2982
  "Copy",
3496
2983
  "Database",
3497
2984
  "DotsThreeVertical",
2985
+ "DownloadSimple",
3498
2986
  "ArrowCounterClockwise",
3499
2987
  "MagnifyingGlassMinus",
3500
2988
  "MagnifyingGlassPlus",
@@ -3578,42 +3066,38 @@ var mandatoryColumns = defineWorkqueuesColumns([
3578
3066
  value: event.field("updatedAt")
3579
3067
  }
3580
3068
  ]);
3581
- var WorkqueueActionsWithDefault = import_zod27.z.enum([
3069
+ var WorkqueueActionsWithDefault = import_zod25.z.enum([
3582
3070
  ...workqueueActions.options,
3583
3071
  "DEFAULT"
3584
3072
  ]);
3585
- var WorkqueueConfig = import_zod27.z.object({
3586
- slug: import_zod27.z.string().describe("Determines the url of the workqueue."),
3073
+ var WorkqueueConfig = import_zod25.z.object({
3074
+ slug: import_zod25.z.string().describe("Determines the url of the workqueue."),
3587
3075
  name: TranslationConfig.describe(
3588
3076
  "Title of the workflow (both in navigation and on the page)"
3589
3077
  ),
3590
3078
  query: CountryConfigQueryType,
3591
- actions: import_zod27.z.array(
3592
- import_zod27.z.object({
3079
+ actions: import_zod25.z.array(
3080
+ import_zod25.z.object({
3593
3081
  type: WorkqueueActionsWithDefault,
3594
- conditionals: import_zod27.z.array(Conditional).optional()
3082
+ conditionals: import_zod25.z.array(Conditional).optional()
3595
3083
  })
3596
3084
  ),
3597
- columns: import_zod27.z.array(WorkqueueColumn).default(mandatoryColumns),
3085
+ columns: import_zod25.z.array(WorkqueueColumn).default(mandatoryColumns),
3598
3086
  icon: AvailableIcons
3599
3087
  }).describe("Configuration for workqueue.");
3600
- var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
3601
- query: true,
3602
- columns: true
3603
- });
3604
- var WorkqueueConfigInput = import_zod27.z.object({
3605
- slug: import_zod27.z.string().describe("Determines the url of the workqueue."),
3088
+ var WorkqueueConfigInput = import_zod25.z.object({
3089
+ slug: import_zod25.z.string().describe("Determines the url of the workqueue."),
3606
3090
  name: TranslationConfig.describe(
3607
3091
  "Title of the workflow (both in navigation and on the page)"
3608
3092
  ),
3609
3093
  query: CountryConfigQueryInputType,
3610
- actions: import_zod27.z.array(
3611
- import_zod27.z.object({
3094
+ actions: import_zod25.z.array(
3095
+ import_zod25.z.object({
3612
3096
  type: WorkqueueActionsWithDefault,
3613
- conditionals: import_zod27.z.array(Conditional).optional()
3097
+ conditionals: import_zod25.z.array(Conditional).optional()
3614
3098
  })
3615
3099
  ),
3616
- columns: import_zod27.z.array(WorkqueueColumn).default(mandatoryColumns),
3100
+ columns: import_zod25.z.array(WorkqueueColumn).default(mandatoryColumns),
3617
3101
  icon: AvailableIcons
3618
3102
  });
3619
3103
  function defineWorkqueue(workqueueInput) {
@@ -3624,10 +3108,10 @@ function defineWorkqueue(workqueueInput) {
3624
3108
  function defineWorkqueues(workqueues) {
3625
3109
  return workqueues.map((workqueue) => defineWorkqueue(workqueue));
3626
3110
  }
3627
- var WorkqueueCountInput = import_zod27.z.array(
3628
- import_zod27.z.object({ slug: import_zod27.z.string(), query: QueryType })
3111
+ var WorkqueueCountInput = import_zod25.z.array(
3112
+ import_zod25.z.object({ slug: import_zod25.z.string(), query: QueryType })
3629
3113
  );
3630
- var WorkqueueCountOutput = import_zod27.z.record(import_zod27.z.string(), import_zod27.z.number());
3114
+ var WorkqueueCountOutput = import_zod25.z.record(import_zod25.z.string(), import_zod25.z.number());
3631
3115
 
3632
3116
  // ../commons/src/events/workqueueDefaultColumns.ts
3633
3117
  var defaultWorkqueueColumns = [
@@ -3650,115 +3134,115 @@ var defaultWorkqueueColumns = [
3650
3134
  ];
3651
3135
 
3652
3136
  // ../commons/src/events/Draft.ts
3653
- var import_zod29 = require("zod");
3137
+ var import_zod27 = require("zod");
3654
3138
 
3655
3139
  // ../commons/src/events/ActionInput.ts
3656
- var import_zod28 = require("zod");
3140
+ var import_zod26 = require("zod");
3657
3141
  var import_zod_openapi10 = require("zod-openapi");
3658
- (0, import_zod_openapi10.extendZodWithOpenApi)(import_zod28.z);
3659
- var BaseActionInput = import_zod28.z.object({
3660
- eventId: UUID,
3661
- transactionId: import_zod28.z.string(),
3142
+ var import_uuid3 = require("uuid");
3143
+ (0, import_zod_openapi10.extendZodWithOpenApi)(import_zod26.z);
3144
+ var BaseActionInput = import_zod26.z.object({
3145
+ eventId: import_zod26.z.string(),
3146
+ transactionId: import_zod26.z.string(),
3662
3147
  declaration: ActionUpdate.default({}),
3663
3148
  annotation: ActionUpdate.optional(),
3664
- originalActionId: UUID.optional(),
3665
- // should not be part of base action.
3666
- keepAssignment: import_zod28.z.boolean().optional()
3149
+ originalActionId: import_zod26.z.string().optional(),
3150
+ keepAssignment: import_zod26.z.boolean().optional()
3667
3151
  });
3668
3152
  var CreateActionInput = BaseActionInput.merge(
3669
- import_zod28.z.object({
3670
- type: import_zod28.z.literal(ActionType.CREATE).default(ActionType.CREATE),
3153
+ import_zod26.z.object({
3154
+ type: import_zod26.z.literal(ActionType.CREATE).default(ActionType.CREATE),
3671
3155
  createdAtLocation: CreatedAtLocation
3672
3156
  })
3673
3157
  );
3674
3158
  var RegisterActionInput = BaseActionInput.merge(
3675
- import_zod28.z.object({
3676
- type: import_zod28.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
3677
- registrationNumber: import_zod28.z.string().optional()
3159
+ import_zod26.z.object({
3160
+ type: import_zod26.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
3161
+ registrationNumber: import_zod26.z.string().optional()
3678
3162
  })
3679
- ).strict();
3163
+ );
3680
3164
  var ValidateActionInput = BaseActionInput.merge(
3681
- import_zod28.z.object({
3682
- type: import_zod28.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
3683
- duplicates: import_zod28.z.array(import_zod28.z.string())
3165
+ import_zod26.z.object({
3166
+ type: import_zod26.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
3167
+ duplicates: import_zod26.z.array(import_zod26.z.string())
3684
3168
  })
3685
3169
  );
3686
3170
  var NotifyActionInput = BaseActionInput.merge(
3687
- import_zod28.z.object({
3688
- type: import_zod28.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
3171
+ import_zod26.z.object({
3172
+ type: import_zod26.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
3689
3173
  })
3690
3174
  ).openapi({
3691
3175
  default: {
3692
3176
  eventId: "<event-id-here>",
3693
- transactionId: getUUID(),
3177
+ transactionId: (0, import_uuid3.v4)(),
3694
3178
  declaration: {},
3695
3179
  annotation: {},
3696
3180
  type: ActionType.NOTIFY
3697
3181
  }
3698
3182
  });
3699
3183
  var DeclareActionInput = BaseActionInput.merge(
3700
- import_zod28.z.object({
3701
- type: import_zod28.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
3184
+ import_zod26.z.object({
3185
+ type: import_zod26.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
3702
3186
  })
3703
3187
  );
3704
3188
  var PrintCertificateActionInput = BaseActionInput.merge(
3705
- import_zod28.z.object({
3706
- type: import_zod28.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
3189
+ import_zod26.z.object({
3190
+ type: import_zod26.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
3707
3191
  })
3708
3192
  );
3709
3193
  var RejectDeclarationActionInput = BaseActionInput.merge(
3710
- import_zod28.z.object({
3711
- type: import_zod28.z.literal(ActionType.REJECT).default(ActionType.REJECT),
3194
+ import_zod26.z.object({
3195
+ type: import_zod26.z.literal(ActionType.REJECT).default(ActionType.REJECT),
3712
3196
  reason: RejectionReason
3713
3197
  })
3714
3198
  );
3715
3199
  var MarkedAsDuplicateActionInput = BaseActionInput.merge(
3716
- import_zod28.z.object({
3717
- type: import_zod28.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
3200
+ import_zod26.z.object({
3201
+ type: import_zod26.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
3718
3202
  })
3719
3203
  );
3720
3204
  var ArchiveActionInput = BaseActionInput.merge(
3721
- import_zod28.z.object({
3722
- type: import_zod28.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
3205
+ import_zod26.z.object({
3206
+ type: import_zod26.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
3723
3207
  reason: RejectionReason
3724
3208
  })
3725
3209
  );
3726
3210
  var AssignActionInput = BaseActionInput.merge(
3727
- import_zod28.z.object({
3728
- type: import_zod28.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
3729
- assignedTo: import_zod28.z.string()
3211
+ import_zod26.z.object({
3212
+ type: import_zod26.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
3213
+ assignedTo: import_zod26.z.string()
3730
3214
  })
3731
3215
  );
3732
3216
  var UnassignActionInput = BaseActionInput.merge(
3733
- import_zod28.z.object({
3734
- type: import_zod28.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
3735
- assignedTo: import_zod28.z.literal(null).default(null)
3217
+ import_zod26.z.object({
3218
+ type: import_zod26.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
3219
+ assignedTo: import_zod26.z.literal(null).default(null)
3736
3220
  })
3737
3221
  );
3738
3222
  var RequestCorrectionActionInput = BaseActionInput.merge(
3739
- import_zod28.z.object({
3740
- type: import_zod28.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
3223
+ import_zod26.z.object({
3224
+ type: import_zod26.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
3741
3225
  })
3742
3226
  );
3743
3227
  var RejectCorrectionActionInput = BaseActionInput.merge(
3744
- import_zod28.z.object({
3745
- requestId: import_zod28.z.string(),
3746
- type: import_zod28.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
3228
+ import_zod26.z.object({
3229
+ requestId: import_zod26.z.string(),
3230
+ type: import_zod26.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
3747
3231
  })
3748
3232
  );
3749
3233
  var ApproveCorrectionActionInput = BaseActionInput.merge(
3750
- import_zod28.z.object({
3751
- requestId: import_zod28.z.string(),
3752
- type: import_zod28.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
3234
+ import_zod26.z.object({
3235
+ requestId: import_zod26.z.string(),
3236
+ type: import_zod26.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
3753
3237
  })
3754
3238
  );
3755
3239
  var ReadActionInput = BaseActionInput.merge(
3756
- import_zod28.z.object({
3757
- type: import_zod28.z.literal(ActionType.READ).default(ActionType.READ)
3240
+ import_zod26.z.object({
3241
+ type: import_zod26.z.literal(ActionType.READ).default(ActionType.READ)
3758
3242
  })
3759
3243
  );
3760
- var DeleteActionInput = import_zod28.z.object({ eventId: UUID });
3761
- var ActionInput = import_zod28.z.discriminatedUnion("type", [
3244
+ var DeleteActionInput = import_zod26.z.object({ eventId: import_zod26.z.string() });
3245
+ var ActionInput = import_zod26.z.discriminatedUnion("type", [
3762
3246
  CreateActionInput.openapi({ ref: "CreateActionInput" }),
3763
3247
  ValidateActionInput.openapi({ ref: "ValidateActionInput" }),
3764
3248
  RegisterActionInput.openapi({ ref: "RegisterActionInput" }),
@@ -3787,18 +3271,18 @@ var ActionInput = import_zod28.z.discriminatedUnion("type", [
3787
3271
  });
3788
3272
 
3789
3273
  // ../commons/src/events/Draft.ts
3790
- var Draft = import_zod29.z.object({
3791
- id: UUID,
3792
- eventId: UUID,
3793
- transactionId: import_zod29.z.string(),
3794
- createdAt: import_zod29.z.string().datetime(),
3274
+ var Draft = import_zod27.z.object({
3275
+ id: import_zod27.z.string(),
3276
+ eventId: import_zod27.z.string(),
3277
+ transactionId: import_zod27.z.string(),
3278
+ createdAt: import_zod27.z.string().datetime(),
3795
3279
  action: ActionBase.extend({
3796
3280
  type: ActionTypes
3797
3281
  }).omit({ id: true })
3798
3282
  });
3799
3283
  var DraftInput = BaseActionInput.extend({
3800
3284
  type: ActionTypes,
3801
- status: import_zod29.z.enum([
3285
+ status: import_zod27.z.enum([
3802
3286
  ActionStatus.Requested,
3803
3287
  ActionStatus.Accepted,
3804
3288
  ActionStatus.Rejected
@@ -3806,28 +3290,27 @@ var DraftInput = BaseActionInput.extend({
3806
3290
  });
3807
3291
 
3808
3292
  // ../commons/src/events/EventInput.ts
3809
- var import_zod30 = require("zod");
3810
- var import_uuid8 = require("uuid");
3811
- var EventInput = import_zod30.z.object({
3812
- transactionId: import_zod30.z.string(),
3813
- type: import_zod30.z.string()
3814
- }).openapi({ default: { transactionId: (0, import_uuid8.v4)(), type: "v2.birth" } });
3293
+ var import_zod28 = require("zod");
3294
+ var import_uuid4 = require("uuid");
3295
+ var EventInput = import_zod28.z.object({
3296
+ transactionId: import_zod28.z.string(),
3297
+ type: import_zod28.z.string()
3298
+ }).openapi({ default: { transactionId: (0, import_uuid4.v4)(), type: "v2.birth" } });
3815
3299
 
3816
3300
  // ../commons/src/events/EventDocument.ts
3817
- var import_zod31 = require("zod");
3301
+ var import_zod29 = require("zod");
3818
3302
  var import_zod_openapi11 = require("zod-openapi");
3819
- (0, import_zod_openapi11.extendZodWithOpenApi)(import_zod31.z);
3820
- var EventDocument = import_zod31.z.object({
3821
- id: UUID,
3822
- type: import_zod31.z.string(),
3823
- createdAt: import_zod31.z.string().datetime(),
3824
- updatedAt: import_zod31.z.string().datetime(),
3825
- actions: import_zod31.z.array(Action),
3826
- trackingId: import_zod31.z.string()
3303
+ (0, import_zod_openapi11.extendZodWithOpenApi)(import_zod29.z);
3304
+ var EventDocument = import_zod29.z.object({
3305
+ id: import_zod29.z.string(),
3306
+ type: import_zod29.z.string(),
3307
+ createdAt: import_zod29.z.string().datetime(),
3308
+ updatedAt: import_zod29.z.string().datetime(),
3309
+ actions: import_zod29.z.array(Action),
3310
+ trackingId: import_zod29.z.string()
3827
3311
  }).openapi({ ref: "EventDocument" });
3828
3312
 
3829
3313
  // ../commons/src/events/state/utils.ts
3830
- var import_lodash2 = require("lodash");
3831
3314
  function getActionRequests(actionType, actions) {
3832
3315
  const filtered = actions.filter((action) => action.type === actionType);
3833
3316
  const accept = filtered.find(
@@ -3858,7 +3341,6 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
3858
3341
  // When 3rd party API returns 200 OK, we assume that the request was accepted, and persist single 'accepted' action.
3859
3342
  createdAt: requestAction?.createdAt ?? acceptAction.createdAt,
3860
3343
  createdBy: requestAction?.createdBy ?? acceptAction.createdBy,
3861
- createdByUserType: requestAction?.createdByUserType ?? acceptAction.createdByUserType,
3862
3344
  createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
3863
3345
  acceptedAt: acceptAction.createdAt,
3864
3346
  createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
@@ -3866,38 +3348,27 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
3866
3348
  registrationNumber
3867
3349
  };
3868
3350
  }
3869
- var updateActions = ActionTypes.extract([
3870
- ActionType.CREATE,
3871
- ActionType.NOTIFY,
3872
- ActionType.DECLARE,
3873
- ActionType.VALIDATE,
3874
- ActionType.REGISTER,
3875
- ActionType.REJECT,
3876
- ActionType.ARCHIVE,
3877
- ActionType.PRINT_CERTIFICATE,
3878
- ActionType.REQUEST_CORRECTION
3879
- ]);
3880
- function getActionUpdateMetadata(actions) {
3351
+ function getDeclarationActionUpdateMetadata(actions) {
3881
3352
  const createAction = getOrThrow(
3882
3353
  actions.find((action) => action.type === ActionType.CREATE),
3883
3354
  `Event has no ${ActionType.CREATE} action`
3884
3355
  );
3885
- const metadataFields = [
3886
- "createdAt",
3887
- "createdBy",
3888
- "createdByUserType",
3889
- "createdAtLocation",
3890
- "createdByRole"
3891
- ];
3892
- return actions.filter(({ type }) => updateActions.safeParse(type).success).filter(({ status }) => status === ActionStatus.Accepted).reduce(
3893
- (_, action) => {
3894
- if (action.originalActionId) {
3895
- const originalAction = actions.find(({ id }) => id === action.originalActionId) ?? action;
3896
- return (0, import_lodash2.pick)(originalAction, metadataFields);
3897
- }
3898
- return (0, import_lodash2.pick)(action, metadataFields);
3356
+ return [ActionType.DECLARE, ActionType.VALIDATE, ActionType.REGISTER].reduce(
3357
+ (metadata, actionType) => {
3358
+ const { accept, request } = getActionRequests(actionType, actions);
3359
+ return {
3360
+ createdAt: request?.createdAt ?? accept?.createdAt ?? metadata.createdAt,
3361
+ createdBy: request?.createdBy ?? accept?.createdBy ?? metadata.createdBy,
3362
+ createdAtLocation: request?.createdAtLocation ?? accept?.createdAtLocation ?? metadata.createdAtLocation,
3363
+ createdByRole: request?.createdByRole ?? accept?.createdByRole ?? metadata.createdByRole
3364
+ };
3899
3365
  },
3900
- (0, import_lodash2.pick)(createAction, metadataFields)
3366
+ {
3367
+ createdAt: createAction.createdAt,
3368
+ createdBy: createAction.createdBy,
3369
+ createdAtLocation: createAction.createdAtLocation,
3370
+ createdByRole: createAction.createdByRole
3371
+ }
3901
3372
  );
3902
3373
  }
3903
3374
  function getLegalStatuses(actions) {
@@ -3913,69 +3384,15 @@ function getLegalStatuses(actions) {
3913
3384
  };
3914
3385
  }
3915
3386
 
3916
- // ../commons/src/events/state/flags.ts
3917
- function isCertificatePrinted(actions) {
3918
- return actions.reduce((prev, { type }) => {
3919
- if (type === ActionType.PRINT_CERTIFICATE) {
3920
- return true;
3921
- }
3922
- if (type === ActionType.APPROVE_CORRECTION) {
3923
- return false;
3924
- }
3925
- return prev;
3926
- }, false);
3927
- }
3928
- function isCorrectionRequested(actions) {
3929
- return actions.reduce((prev, { type }) => {
3930
- if (type === ActionType.REQUEST_CORRECTION) {
3931
- return true;
3932
- }
3933
- if (type === ActionType.APPROVE_CORRECTION) {
3934
- return false;
3935
- }
3936
- if (type === ActionType.REJECT_CORRECTION) {
3937
- return false;
3938
- }
3939
- return prev;
3940
- }, false);
3941
- }
3942
- function isDeclarationIncomplete(actions) {
3943
- return getStatusFromActions(actions) === EventStatus.enum.NOTIFIED;
3944
- }
3945
- function isRejected(actions) {
3946
- return getStatusFromActions(actions) === EventStatus.enum.REJECTED;
3947
- }
3948
- function getFlagsFromActions(actions) {
3949
- const sortedActions = actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
3950
- const actionStatus = sortedActions.reduce(
3951
- (actionStatuses, { type, status }) => ({
3952
- ...actionStatuses,
3953
- [type]: status
3954
- }),
3955
- {}
3956
- );
3957
- const flags = Object.entries(actionStatus).filter(([, status]) => status !== ActionStatus.Accepted).map(([type, status]) => {
3958
- const flag = joinValues([type, status], ":").toLowerCase();
3959
- return flag;
3960
- });
3961
- if (isCertificatePrinted(sortedActions)) {
3962
- flags.push(InherentFlags.PRINTED);
3963
- }
3964
- if (isCorrectionRequested(sortedActions)) {
3965
- flags.push(InherentFlags.CORRECTION_REQUESTED);
3966
- }
3967
- if (isDeclarationIncomplete(sortedActions)) {
3968
- flags.push(InherentFlags.INCOMPLETE);
3969
- }
3970
- if (isRejected(sortedActions)) {
3971
- flags.push(InherentFlags.REJECTED);
3972
- }
3973
- return flags;
3974
- }
3975
-
3976
3387
  // ../commons/src/events/state/index.ts
3977
3388
  function getStatusFromActions(actions) {
3978
- return actions.filter(({ status }) => status === ActionStatus.Accepted).reduce((status, action) => {
3389
+ const hasRejectedAction = actions.some(
3390
+ (a) => a.status === ActionStatus.Rejected
3391
+ );
3392
+ if (hasRejectedAction) {
3393
+ return EventStatus.enum.REJECTED;
3394
+ }
3395
+ return actions.reduce((status, action) => {
3979
3396
  switch (action.type) {
3980
3397
  case ActionType.CREATE:
3981
3398
  return EventStatus.enum.CREATED;
@@ -4005,6 +3422,38 @@ function getStatusFromActions(actions) {
4005
3422
  }
4006
3423
  }, EventStatus.enum.CREATED);
4007
3424
  }
3425
+ function getFlagsFromActions(actions) {
3426
+ const sortedactions = actions.sort(
3427
+ (a, b) => a.createdAt.localeCompare(b.createdAt)
3428
+ );
3429
+ const actionStatus = sortedactions.reduce(
3430
+ (actionStatuses, { type, status }) => ({
3431
+ ...actionStatuses,
3432
+ [type]: status
3433
+ }),
3434
+ {}
3435
+ );
3436
+ const flags = Object.entries(actionStatus).filter(([, status]) => status !== ActionStatus.Accepted).map(([type, status]) => {
3437
+ const flag = `${type.toLowerCase()}:${status.toLowerCase()}`;
3438
+ return flag;
3439
+ });
3440
+ const isCertificatePrinted = sortedactions.reduce(
3441
+ (prev, { type }) => {
3442
+ if (type === ActionType.PRINT_CERTIFICATE) {
3443
+ return true;
3444
+ }
3445
+ if (type === ActionType.APPROVE_CORRECTION) {
3446
+ return false;
3447
+ }
3448
+ return prev;
3449
+ },
3450
+ false
3451
+ );
3452
+ if (isCertificatePrinted) {
3453
+ flags.push(CustomFlags.CERTIFICATE_PRINTED);
3454
+ }
3455
+ return flags;
3456
+ }
4008
3457
  function getAssignedUserFromActions(actions) {
4009
3458
  return actions.reduce((user2, action) => {
4010
3459
  if (action.type === ActionType.ASSIGN) {
@@ -4078,11 +3527,10 @@ function getCurrentEventState(event2, config) {
4078
3527
  if (!creationAction) {
4079
3528
  throw new Error(`Event ${event2.id} has no creation action`);
4080
3529
  }
4081
- const acceptedActions = getAcceptedActions(event2).sort(
4082
- (a, b) => a.createdAt.localeCompare(b.createdAt)
3530
+ const acceptedActions = getAcceptedActions(event2);
3531
+ const declarationUpdateMetadata = getDeclarationActionUpdateMetadata(
3532
+ event2.actions
4083
3533
  );
4084
- const requestActionMetadata = getActionUpdateMetadata(event2.actions);
4085
- const acceptedActionMetadata = getActionUpdateMetadata(acceptedActions);
4086
3534
  const declaration = aggregateActionDeclarations(acceptedActions);
4087
3535
  let dateOfEvent;
4088
3536
  if (config.dateOfEvent) {
@@ -4102,17 +3550,16 @@ function getCurrentEventState(event2, config) {
4102
3550
  legalStatuses: getLegalStatuses(event2.actions),
4103
3551
  createdAt: creationAction.createdAt,
4104
3552
  createdBy: creationAction.createdBy,
4105
- createdByUserType: creationAction.createdByUserType,
4106
3553
  createdAtLocation: creationAction.createdAtLocation,
4107
3554
  createdBySignature: creationAction.createdBySignature,
4108
- updatedAt: acceptedActionMetadata.createdAt,
3555
+ updatedAt: declarationUpdateMetadata.createdAt,
4109
3556
  assignedTo: getAssignedUserFromActions(acceptedActions),
4110
3557
  assignedToSignature: getAssignedUserSignatureFromActions(acceptedActions),
4111
- updatedBy: requestActionMetadata.createdBy,
4112
- updatedAtLocation: requestActionMetadata.createdAtLocation,
3558
+ updatedBy: declarationUpdateMetadata.createdBy,
3559
+ updatedAtLocation: declarationUpdateMetadata.createdAtLocation,
4113
3560
  declaration,
4114
3561
  trackingId: event2.trackingId,
4115
- updatedByUserRole: requestActionMetadata.createdByRole,
3562
+ updatedByUserRole: declarationUpdateMetadata.createdByRole,
4116
3563
  dateOfEvent,
4117
3564
  flags: getFlagsFromActions(event2.actions)
4118
3565
  });
@@ -4195,23 +3642,23 @@ function generateTransactionId() {
4195
3642
  }
4196
3643
 
4197
3644
  // ../commons/src/events/User.ts
4198
- var import_zod32 = require("zod");
4199
- var User = import_zod32.z.object({
4200
- id: import_zod32.z.string(),
4201
- name: import_zod32.z.array(
4202
- import_zod32.z.object({
4203
- use: import_zod32.z.string(),
4204
- given: import_zod32.z.array(import_zod32.z.string()),
4205
- family: import_zod32.z.string()
3645
+ var import_zod30 = require("zod");
3646
+ var User = import_zod30.z.object({
3647
+ id: import_zod30.z.string(),
3648
+ name: import_zod30.z.array(
3649
+ import_zod30.z.object({
3650
+ use: import_zod30.z.string(),
3651
+ given: import_zod30.z.array(import_zod30.z.string()),
3652
+ family: import_zod30.z.string()
4206
3653
  })
4207
3654
  ),
4208
- role: import_zod32.z.string(),
4209
- signatureFilename: import_zod32.z.string().optional()
3655
+ role: import_zod30.z.string(),
3656
+ signatureFilename: import_zod30.z.string().optional()
4210
3657
  });
4211
3658
 
4212
3659
  // ../commons/src/events/test.utils.ts
4213
- var import_lodash3 = require("lodash");
4214
- var import_date_fns3 = require("date-fns");
3660
+ var import_lodash2 = require("lodash");
3661
+ var import_addDays = __toESM(require("date-fns/addDays"));
4215
3662
 
4216
3663
  // ../commons/src/field-config/field-configuration.ts
4217
3664
  function createFieldConfig(fieldId, options) {
@@ -4891,7 +4338,7 @@ var PRINT_CERTIFICATE_FORM = defineActionForm({
4891
4338
  var TENNIS_CLUB_DECLARATION_REVIEW = {
4892
4339
  title: {
4893
4340
  id: "v2.event.tennis-club-membership.action.declare.form.review.title",
4894
- defaultMessage: "{applicant.name.firstname, select, __EMPTY__ {Member declaration} other {{applicant.name.surname, select, __EMPTY__ {Member declaration for {applicant.name.firstname}} other {Member declaration for {applicant.name.firstname} {applicant.name.surname}}}}}",
4341
+ defaultMessage: "{applicant.name.firstname, select, __EMPTY__ {Member declaration} other {{applicant.name.surname, select, __EMPTY__ {Member declaration} other {Member declaration for {applicant.name.firstname} {applicant.name.surname}}}}}",
4895
4342
  description: "Title of the review page"
4896
4343
  },
4897
4344
  fields: [
@@ -5030,7 +4477,6 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
5030
4477
  id: "applicant.address",
5031
4478
  type: "ADDRESS",
5032
4479
  required: true,
5033
- secured: true,
5034
4480
  conditionals: [],
5035
4481
  label: {
5036
4482
  defaultMessage: "Applicant's address",
@@ -5315,197 +4761,202 @@ var tennisClubMembershipEvent = defineConfig({
5315
4761
  description: "This is shown as the action name anywhere the user can trigger the action from",
5316
4762
  id: "event.tennis-club-membership.action.correction.request.label"
5317
4763
  },
5318
- onboardingForm: [
5319
- {
5320
- id: "correction-requester",
5321
- type: PageTypes.enum.FORM,
5322
- title: {
5323
- id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
5324
- defaultMessage: "Correction requester",
5325
- description: "This is the title of the section"
5326
- },
5327
- fields: [
5328
- {
5329
- id: "correction.requester.relationshop.intro",
5330
- type: "PAGE_HEADER",
5331
- label: {
5332
- id: "correction.requester.relationshop.intro.label",
5333
- defaultMessage: "Note: In the case that the child is now of legal age (18) then only they should be able to request a change to their birth record.",
5334
- description: "The title for the corrector form"
5335
- }
4764
+ correctionForm: {
4765
+ label: {
4766
+ id: "v2.event.tennis-club-membership.action.request-correction.label",
4767
+ defaultMessage: "Request correction",
4768
+ description: "This is shown as the action name anywhere the user can trigger the action from"
4769
+ },
4770
+ pages: [
4771
+ {
4772
+ id: "correction-requester",
4773
+ type: PageTypes.enum.FORM,
4774
+ title: {
4775
+ id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
4776
+ defaultMessage: "Correction requester",
4777
+ description: "This is the title of the section"
5336
4778
  },
5337
- {
5338
- id: "correction.requester.relationship",
5339
- type: "RADIO_GROUP",
5340
- label: {
5341
- id: "v2.correction.corrector.title",
5342
- defaultMessage: "Who is requesting a change to this record?",
5343
- description: "The title for the corrector form"
4779
+ fields: [
4780
+ {
4781
+ id: "correction.requester.relationshop.intro",
4782
+ type: "PAGE_HEADER",
4783
+ label: {
4784
+ id: "correction.requester.relationshop.intro.label",
4785
+ defaultMessage: "Note: In the case that the child is now of legal age (18) then only they should be able to request a change to their birth record.",
4786
+ description: "The title for the corrector form"
4787
+ }
5344
4788
  },
5345
- defaultValue: "",
5346
- options: [
5347
- {
5348
- value: "INFORMANT",
5349
- label: {
5350
- id: "v2.correction.corrector.informant",
5351
- defaultMessage: "Informant",
5352
- description: "Label for informant option in certificate correction form"
5353
- }
5354
- },
5355
- {
5356
- value: "ANOTHER_AGENT",
5357
- label: {
5358
- id: "v2.correction.corrector.anotherAgent",
5359
- defaultMessage: "Another registration agent or field agent",
5360
- description: "Label for another registration or field agent option in certificate correction form"
5361
- }
5362
- },
5363
- {
5364
- value: "REGISTRAR",
5365
- label: {
5366
- id: "v2.correction.corrector.me",
5367
- defaultMessage: "Me (Registrar)",
5368
- description: "Label for registrar option in certificate correction form"
5369
- }
4789
+ {
4790
+ id: "correction.requester.relationship",
4791
+ type: "RADIO_GROUP",
4792
+ label: {
4793
+ id: "v2.correction.corrector.title",
4794
+ defaultMessage: "Who is requesting a change to this record?",
4795
+ description: "The title for the corrector form"
5370
4796
  },
5371
- {
5372
- value: "OTHER",
5373
- label: {
5374
- id: "v2.correction.corrector.others",
5375
- defaultMessage: "Someone else",
5376
- description: "Label for someone else option in certificate correction form"
4797
+ defaultValue: "",
4798
+ options: [
4799
+ {
4800
+ value: "INFORMANT",
4801
+ label: {
4802
+ id: "v2.correction.corrector.informant",
4803
+ defaultMessage: "Informant",
4804
+ description: "Label for informant option in certificate correction form"
4805
+ }
4806
+ },
4807
+ {
4808
+ value: "ANOTHER_AGENT",
4809
+ label: {
4810
+ id: "v2.correction.corrector.anotherAgent",
4811
+ defaultMessage: "Another registration agent or field agent",
4812
+ description: "Label for another registration or field agent option in certificate correction form"
4813
+ }
4814
+ },
4815
+ {
4816
+ value: "REGISTRAR",
4817
+ label: {
4818
+ id: "v2.correction.corrector.me",
4819
+ defaultMessage: "Me (Registrar)",
4820
+ description: "Label for registrar option in certificate correction form"
4821
+ }
4822
+ },
4823
+ {
4824
+ value: "OTHER",
4825
+ label: {
4826
+ id: "v2.correction.corrector.others",
4827
+ defaultMessage: "Someone else",
4828
+ description: "Label for someone else option in certificate correction form"
4829
+ }
5377
4830
  }
5378
- }
5379
- ]
5380
- }
5381
- ]
5382
- },
5383
- {
5384
- id: "identity-check",
5385
- type: PageTypes.enum.FORM,
5386
- title: {
5387
- id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
5388
- defaultMessage: "Verify their identity",
5389
- description: "This is the title of the section"
5390
- },
5391
- fields: [
5392
- {
5393
- id: "correction.identity-check.instructions",
5394
- type: "PAGE_HEADER",
5395
- label: {
5396
- id: "correction.corrector.identity.instruction",
5397
- defaultMessage: "Please verify the identity of the person making this request",
5398
- description: "The title for the corrector form"
4831
+ ]
5399
4832
  }
5400
- },
5401
- {
5402
- id: "correction.identity-check.verified",
5403
- type: "RADIO_GROUP",
5404
- label: {
5405
- id: "correction.corrector.identity.verified.label",
5406
- defaultMessage: "Identity verified",
5407
- description: "The title for the corrector form"
5408
- },
5409
- defaultValue: "",
5410
- required: true,
5411
- options: [
5412
- {
5413
- value: "VERIFIED",
5414
- label: {
5415
- id: "correction.corrector.identity.verified",
5416
- defaultMessage: "I have verified their identity",
5417
- description: "Label for verified option in corrector identity check page"
5418
- }
5419
- }
5420
- ]
5421
- }
5422
- ]
5423
- }
5424
- ],
5425
- additionalDetailsForm: [
5426
- {
5427
- id: "correction-request.supporting-documents",
5428
- type: PageTypes.enum.FORM,
5429
- title: {
5430
- id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
5431
- defaultMessage: "Upload supporting documents",
5432
- description: "This is the title of the section"
4833
+ ]
5433
4834
  },
5434
- fields: [
5435
- {
5436
- id: "correction.supportingDocs.introduction",
5437
- type: "PAGE_HEADER",
5438
- label: {
5439
- id: "correction.corrector.paragraph.title",
5440
- defaultMessage: "For all record corrections at a minimum an affidavit must be provided. For material errors and omissions eg. in paternity cases, a court order must also be provided.",
5441
- description: "The title for the corrector form"
5442
- }
4835
+ {
4836
+ id: "identity-check",
4837
+ type: PageTypes.enum.FORM,
4838
+ title: {
4839
+ id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
4840
+ defaultMessage: "Verify their identity",
4841
+ description: "This is the title of the section"
5443
4842
  },
5444
- {
5445
- id: "correction.supportingDocs",
5446
- type: FieldType.FILE,
5447
- label: {
5448
- id: "correction.corrector.title",
5449
- defaultMessage: "Upload supporting documents",
5450
- description: "The title for the corrector form"
4843
+ fields: [
4844
+ {
4845
+ id: "correction.identity-check.instructions",
4846
+ type: "PAGE_HEADER",
4847
+ label: {
4848
+ id: "correction.corrector.identity.instruction",
4849
+ defaultMessage: "Please verify the identity of the person making this request",
4850
+ description: "The title for the corrector form"
4851
+ }
4852
+ },
4853
+ {
4854
+ id: "correction.identity-check.verified",
4855
+ type: "RADIO_GROUP",
4856
+ label: {
4857
+ id: "correction.corrector.identity.verified.label",
4858
+ defaultMessage: "Identity verified",
4859
+ description: "The title for the corrector form"
4860
+ },
4861
+ defaultValue: "",
4862
+ required: true,
4863
+ options: [
4864
+ {
4865
+ value: "VERIFIED",
4866
+ label: {
4867
+ id: "correction.corrector.identity.verified",
4868
+ defaultMessage: "I have verified their identity",
4869
+ description: "Label for verified option in corrector identity check page"
4870
+ }
4871
+ }
4872
+ ]
5451
4873
  }
4874
+ ]
4875
+ },
4876
+ {
4877
+ id: "correction-request.supporting-documents",
4878
+ type: PageTypes.enum.FORM,
4879
+ title: {
4880
+ id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
4881
+ defaultMessage: "Upload supporting documents",
4882
+ description: "This is the title of the section"
5452
4883
  },
5453
- {
5454
- id: "correction.request.supportingDocuments",
5455
- type: "RADIO_GROUP",
5456
- label: {
5457
- id: "correction.corrector.title",
5458
- defaultMessage: "Who is requesting a change to this record?",
5459
- description: "The title for the corrector form"
4884
+ fields: [
4885
+ {
4886
+ id: "correction.supportingDocs.introduction",
4887
+ type: "PAGE_HEADER",
4888
+ label: {
4889
+ id: "correction.corrector.paragraph.title",
4890
+ defaultMessage: "For all record corrections at a minimum an affidavit must be provided. For material errors and omissions eg. in paternity cases, a court order must also be provided.",
4891
+ description: "The title for the corrector form"
4892
+ }
5460
4893
  },
5461
- defaultValue: "",
5462
- configuration: {
5463
- styles: {
5464
- size: "NORMAL"
4894
+ {
4895
+ id: "correction.supportingDocs",
4896
+ type: FieldType.FILE,
4897
+ label: {
4898
+ id: "correction.corrector.title",
4899
+ defaultMessage: "Upload supporting documents",
4900
+ description: "The title for the corrector form"
5465
4901
  }
5466
4902
  },
5467
- options: [
5468
- {
5469
- value: "ATTEST",
5470
- label: {
5471
- id: "correction.supportingDocuments.attest.label",
5472
- defaultMessage: "I attest to seeing supporting documentation and have a copy filed at my office",
5473
- description: ""
4903
+ {
4904
+ id: "correction.request.supportingDocuments",
4905
+ type: "RADIO_GROUP",
4906
+ label: {
4907
+ id: "correction.corrector.title",
4908
+ defaultMessage: "Who is requesting a change to this record?",
4909
+ description: "The title for the corrector form"
4910
+ },
4911
+ defaultValue: "",
4912
+ configuration: {
4913
+ styles: {
4914
+ size: "NORMAL"
5474
4915
  }
5475
4916
  },
5476
- {
5477
- value: "NOT_NEEDED",
5478
- label: {
5479
- id: "correction.supportingDocuments.notNeeded.label",
5480
- defaultMessage: "No supporting documents required",
5481
- description: ""
4917
+ options: [
4918
+ {
4919
+ value: "ATTEST",
4920
+ label: {
4921
+ id: "correction.supportingDocuments.attest.label",
4922
+ defaultMessage: "I attest to seeing supporting documentation and have a copy filed at my office",
4923
+ description: ""
4924
+ }
4925
+ },
4926
+ {
4927
+ value: "NOT_NEEDED",
4928
+ label: {
4929
+ id: "correction.supportingDocuments.notNeeded.label",
4930
+ defaultMessage: "No supporting documents required",
4931
+ description: ""
4932
+ }
5482
4933
  }
5483
- }
5484
- ]
5485
- }
5486
- ]
5487
- },
5488
- {
5489
- id: "correction-request.additional-details",
5490
- type: PageTypes.enum.FORM,
5491
- title: {
5492
- id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
5493
- defaultMessage: "Reason for correction",
5494
- description: "This is the title of the section"
4934
+ ]
4935
+ }
4936
+ ]
5495
4937
  },
5496
- fields: [
5497
- {
5498
- id: "correction.request.reason",
5499
- type: FieldType.TEXT,
5500
- label: {
5501
- id: "correction.reason.title",
5502
- defaultMessage: "Reason for correction?",
5503
- description: "The title for the corrector form"
4938
+ {
4939
+ id: "correction-request.additional-details",
4940
+ type: PageTypes.enum.FORM,
4941
+ title: {
4942
+ id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
4943
+ defaultMessage: "Reason for correction",
4944
+ description: "This is the title of the section"
4945
+ },
4946
+ fields: [
4947
+ {
4948
+ id: "correction.request.reason",
4949
+ type: FieldType.TEXT,
4950
+ label: {
4951
+ id: "correction.reason.title",
4952
+ defaultMessage: "Reason for correction?",
4953
+ description: "The title for the corrector form"
4954
+ }
5504
4955
  }
5505
- }
5506
- ]
5507
- }
5508
- ]
4956
+ ]
4957
+ }
4958
+ ]
4959
+ }
5509
4960
  },
5510
4961
  {
5511
4962
  type: ActionType.APPROVE_CORRECTION,
@@ -5708,197 +5159,202 @@ var footballClubMembershipEvent = defineConfig({
5708
5159
  description: "This is shown as the action name anywhere the user can trigger the action from",
5709
5160
  id: "event.football-club-membership.action.correction.request.label"
5710
5161
  },
5711
- onboardingForm: [
5712
- {
5713
- id: "correction-requester",
5714
- type: PageTypes.enum.FORM,
5715
- title: {
5716
- id: "event.football-club-membership.action.requestCorrection.form.section.corrector",
5717
- defaultMessage: "Correction requester",
5718
- description: "This is the title of the section"
5719
- },
5720
- fields: [
5721
- {
5722
- id: "correction.requester.relationshop.intro",
5723
- type: "PAGE_HEADER",
5724
- label: {
5725
- id: "correction.requester.relationshop.intro.label",
5726
- defaultMessage: "Note: In the case that the child is now of legal age (18) then only they should be able to request a change to their birth record.",
5727
- description: "The title for the corrector form"
5728
- }
5162
+ correctionForm: {
5163
+ label: {
5164
+ id: "event.football-club-membership.action.correction.request.label",
5165
+ defaultMessage: "Request correction",
5166
+ description: "This is shown as the action name anywhere the user can trigger the action from"
5167
+ },
5168
+ pages: [
5169
+ {
5170
+ id: "correction-requester",
5171
+ type: PageTypes.enum.FORM,
5172
+ title: {
5173
+ id: "event.football-club-membership.action.requestCorrection.form.section.corrector",
5174
+ defaultMessage: "Correction requester",
5175
+ description: "This is the title of the section"
5729
5176
  },
5730
- {
5731
- id: "correction.requester.relationship",
5732
- type: "RADIO_GROUP",
5733
- label: {
5734
- id: "v2.correction.corrector.title",
5735
- defaultMessage: "Who is requesting a change to this record?",
5736
- description: "The title for the corrector form"
5177
+ fields: [
5178
+ {
5179
+ id: "correction.requester.relationshop.intro",
5180
+ type: "PAGE_HEADER",
5181
+ label: {
5182
+ id: "correction.requester.relationshop.intro.label",
5183
+ defaultMessage: "Note: In the case that the child is now of legal age (18) then only they should be able to request a change to their birth record.",
5184
+ description: "The title for the corrector form"
5185
+ }
5737
5186
  },
5738
- defaultValue: "",
5739
- options: [
5740
- {
5741
- value: "INFORMANT",
5742
- label: {
5743
- id: "v2.correction.corrector.informant",
5744
- defaultMessage: "Informant",
5745
- description: "Label for informant option in certificate correction form"
5746
- }
5747
- },
5748
- {
5749
- value: "ANOTHER_AGENT",
5750
- label: {
5751
- id: "v2.correction.corrector.anotherAgent",
5752
- defaultMessage: "Another registration agent or field agent",
5753
- description: "Label for another registration or field agent option in certificate correction form"
5754
- }
5755
- },
5756
- {
5757
- value: "REGISTRAR",
5758
- label: {
5759
- id: "v2.correction.corrector.me",
5760
- defaultMessage: "Me (Registrar)",
5761
- description: "Label for registrar option in certificate correction form"
5762
- }
5187
+ {
5188
+ id: "correction.requester.relationship",
5189
+ type: "RADIO_GROUP",
5190
+ label: {
5191
+ id: "v2.correction.corrector.title",
5192
+ defaultMessage: "Who is requesting a change to this record?",
5193
+ description: "The title for the corrector form"
5763
5194
  },
5764
- {
5765
- value: "OTHER",
5766
- label: {
5767
- id: "v2.correction.corrector.others",
5768
- defaultMessage: "Someone else",
5769
- description: "Label for someone else option in certificate correction form"
5195
+ defaultValue: "",
5196
+ options: [
5197
+ {
5198
+ value: "INFORMANT",
5199
+ label: {
5200
+ id: "v2.correction.corrector.informant",
5201
+ defaultMessage: "Informant",
5202
+ description: "Label for informant option in certificate correction form"
5203
+ }
5204
+ },
5205
+ {
5206
+ value: "ANOTHER_AGENT",
5207
+ label: {
5208
+ id: "v2.correction.corrector.anotherAgent",
5209
+ defaultMessage: "Another registration agent or field agent",
5210
+ description: "Label for another registration or field agent option in certificate correction form"
5211
+ }
5212
+ },
5213
+ {
5214
+ value: "REGISTRAR",
5215
+ label: {
5216
+ id: "v2.correction.corrector.me",
5217
+ defaultMessage: "Me (Registrar)",
5218
+ description: "Label for registrar option in certificate correction form"
5219
+ }
5220
+ },
5221
+ {
5222
+ value: "OTHER",
5223
+ label: {
5224
+ id: "v2.correction.corrector.others",
5225
+ defaultMessage: "Someone else",
5226
+ description: "Label for someone else option in certificate correction form"
5227
+ }
5770
5228
  }
5771
- }
5772
- ]
5773
- }
5774
- ]
5775
- },
5776
- {
5777
- id: "identity-check",
5778
- type: PageTypes.enum.FORM,
5779
- title: {
5780
- id: "event.football-club-membership.action.requestCorrection.form.section.verify",
5781
- defaultMessage: "Verify their identity",
5782
- description: "This is the title of the section"
5783
- },
5784
- fields: [
5785
- {
5786
- id: "correction.identity-check.instructions",
5787
- type: "PAGE_HEADER",
5788
- label: {
5789
- id: "correction.corrector.identity.instruction",
5790
- defaultMessage: "Please verify the identity of the person making this request",
5791
- description: "The title for the corrector form"
5229
+ ]
5792
5230
  }
5231
+ ]
5232
+ },
5233
+ {
5234
+ id: "identity-check",
5235
+ type: PageTypes.enum.FORM,
5236
+ title: {
5237
+ id: "event.football-club-membership.action.requestCorrection.form.section.verify",
5238
+ defaultMessage: "Verify their identity",
5239
+ description: "This is the title of the section"
5793
5240
  },
5794
- {
5795
- id: "correction.identity-check.verified",
5796
- type: "RADIO_GROUP",
5797
- label: {
5798
- id: "correction.corrector.identity.verified.label",
5799
- defaultMessage: "Identity verified",
5800
- description: "The title for the corrector form"
5241
+ fields: [
5242
+ {
5243
+ id: "correction.identity-check.instructions",
5244
+ type: "PAGE_HEADER",
5245
+ label: {
5246
+ id: "correction.corrector.identity.instruction",
5247
+ defaultMessage: "Please verify the identity of the person making this request",
5248
+ description: "The title for the corrector form"
5249
+ }
5801
5250
  },
5802
- defaultValue: "",
5803
- required: true,
5804
- options: [
5805
- {
5806
- value: "VERIFIED",
5807
- label: {
5808
- id: "correction.corrector.identity.verified",
5809
- defaultMessage: "I have verified their identity",
5810
- description: "Label for verified option in corrector identity check page"
5251
+ {
5252
+ id: "correction.identity-check.verified",
5253
+ type: "RADIO_GROUP",
5254
+ label: {
5255
+ id: "correction.corrector.identity.verified.label",
5256
+ defaultMessage: "Identity verified",
5257
+ description: "The title for the corrector form"
5258
+ },
5259
+ defaultValue: "",
5260
+ required: true,
5261
+ options: [
5262
+ {
5263
+ value: "VERIFIED",
5264
+ label: {
5265
+ id: "correction.corrector.identity.verified",
5266
+ defaultMessage: "I have verified their identity",
5267
+ description: "Label for verified option in corrector identity check page"
5268
+ }
5811
5269
  }
5812
- }
5813
- ]
5814
- }
5815
- ]
5816
- }
5817
- ],
5818
- additionalDetailsForm: [
5819
- {
5820
- id: "correction-request.supporting-documents",
5821
- type: PageTypes.enum.FORM,
5822
- title: {
5823
- id: "event.football-club-membership.action.requestCorrection.form.section.verify",
5824
- defaultMessage: "Upload supporting documents",
5825
- description: "This is the title of the section"
5826
- },
5827
- fields: [
5828
- {
5829
- id: "correction.supportingDocs.introduction",
5830
- type: "PAGE_HEADER",
5831
- label: {
5832
- id: "correction.corrector.paragraph.title",
5833
- defaultMessage: "For all record corrections at a minimum an affidavit must be provided. For material errors and omissions eg. in paternity cases, a court order must also be provided.",
5834
- description: "The title for the corrector form"
5835
- }
5836
- },
5837
- {
5838
- id: "correction.supportingDocs",
5839
- type: FieldType.FILE,
5840
- label: {
5841
- id: "correction.corrector.title",
5842
- defaultMessage: "Upload supporting documents",
5843
- description: "The title for the corrector form"
5270
+ ]
5844
5271
  }
5272
+ ]
5273
+ },
5274
+ {
5275
+ id: "correction-request.supporting-documents",
5276
+ type: PageTypes.enum.FORM,
5277
+ title: {
5278
+ id: "event.football-club-membership.action.requestCorrection.form.section.verify",
5279
+ defaultMessage: "Upload supporting documents",
5280
+ description: "This is the title of the section"
5845
5281
  },
5846
- {
5847
- id: "correction.request.supportingDocuments",
5848
- type: "RADIO_GROUP",
5849
- label: {
5850
- id: "correction.corrector.title",
5851
- defaultMessage: "Who is requesting a change to this record?",
5852
- description: "The title for the corrector form"
5282
+ fields: [
5283
+ {
5284
+ id: "correction.supportingDocs.introduction",
5285
+ type: "PAGE_HEADER",
5286
+ label: {
5287
+ id: "correction.corrector.paragraph.title",
5288
+ defaultMessage: "For all record corrections at a minimum an affidavit must be provided. For material errors and omissions eg. in paternity cases, a court order must also be provided.",
5289
+ description: "The title for the corrector form"
5290
+ }
5853
5291
  },
5854
- defaultValue: "",
5855
- configuration: {
5856
- styles: {
5857
- size: "NORMAL"
5292
+ {
5293
+ id: "correction.supportingDocs",
5294
+ type: FieldType.FILE,
5295
+ label: {
5296
+ id: "correction.corrector.title",
5297
+ defaultMessage: "Upload supporting documents",
5298
+ description: "The title for the corrector form"
5858
5299
  }
5859
5300
  },
5860
- options: [
5861
- {
5862
- value: "ATTEST",
5863
- label: {
5864
- id: "correction.supportingDocuments.attest.label",
5865
- defaultMessage: "I attest to seeing supporting documentation and have a copy filed at my office",
5866
- description: ""
5301
+ {
5302
+ id: "correction.request.supportingDocuments",
5303
+ type: "RADIO_GROUP",
5304
+ label: {
5305
+ id: "correction.corrector.title",
5306
+ defaultMessage: "Who is requesting a change to this record?",
5307
+ description: "The title for the corrector form"
5308
+ },
5309
+ defaultValue: "",
5310
+ configuration: {
5311
+ styles: {
5312
+ size: "NORMAL"
5867
5313
  }
5868
5314
  },
5869
- {
5870
- value: "NOT_NEEDED",
5871
- label: {
5872
- id: "correction.supportingDocuments.notNeeded.label",
5873
- defaultMessage: "No supporting documents required",
5874
- description: ""
5315
+ options: [
5316
+ {
5317
+ value: "ATTEST",
5318
+ label: {
5319
+ id: "correction.supportingDocuments.attest.label",
5320
+ defaultMessage: "I attest to seeing supporting documentation and have a copy filed at my office",
5321
+ description: ""
5322
+ }
5323
+ },
5324
+ {
5325
+ value: "NOT_NEEDED",
5326
+ label: {
5327
+ id: "correction.supportingDocuments.notNeeded.label",
5328
+ defaultMessage: "No supporting documents required",
5329
+ description: ""
5330
+ }
5875
5331
  }
5876
- }
5877
- ]
5878
- }
5879
- ]
5880
- },
5881
- {
5882
- id: "correction-request.additional-details",
5883
- type: PageTypes.enum.FORM,
5884
- title: {
5885
- id: "event.football-club-membership.action.requestCorrection.form.section.corrector",
5886
- defaultMessage: "Reason for correction",
5887
- description: "This is the title of the section"
5332
+ ]
5333
+ }
5334
+ ]
5888
5335
  },
5889
- fields: [
5890
- {
5891
- id: "correction.request.reason",
5892
- type: FieldType.TEXT,
5893
- label: {
5894
- id: "correction.reason.title",
5895
- defaultMessage: "Reason for correction?",
5896
- description: "The title for the corrector form"
5336
+ {
5337
+ id: "correction-request.additional-details",
5338
+ type: PageTypes.enum.FORM,
5339
+ title: {
5340
+ id: "event.football-club-membership.action.requestCorrection.form.section.corrector",
5341
+ defaultMessage: "Reason for correction",
5342
+ description: "This is the title of the section"
5343
+ },
5344
+ fields: [
5345
+ {
5346
+ id: "correction.request.reason",
5347
+ type: FieldType.TEXT,
5348
+ label: {
5349
+ id: "correction.reason.title",
5350
+ defaultMessage: "Reason for correction?",
5351
+ description: "The title for the corrector form"
5352
+ }
5897
5353
  }
5898
- }
5899
- ]
5900
- }
5901
- ]
5354
+ ]
5355
+ }
5356
+ ]
5357
+ }
5902
5358
  },
5903
5359
  {
5904
5360
  type: ActionType.APPROVE_CORRECTION,
@@ -6197,14 +5653,6 @@ var v2BirthEvent = defineConfig({
6197
5653
  });
6198
5654
 
6199
5655
  // ../commons/src/events/test.utils.ts
6200
- var import_zod33 = require("zod");
6201
- var TestUserRole = import_zod33.z.enum([
6202
- "FIELD_AGENT",
6203
- "LOCAL_REGISTRAR",
6204
- "LOCAL_SYSTEM_ADMIN",
6205
- "NATIONAL_REGISTRAR",
6206
- "REGISTRATION_AGENT"
6207
- ]);
6208
5656
  function pickRandom(rng, items) {
6209
5657
  return items[Math.floor(rng() * items.length)];
6210
5658
  }
@@ -6353,7 +5801,7 @@ function eventPayloadGenerator(rng) {
6353
5801
  type: input.type ?? TENNIS_CLUB_MEMBERSHIP,
6354
5802
  id
6355
5803
  }),
6356
- draft: ({ eventId, actionType }, input = {}) => (0, import_lodash3.merge)(
5804
+ draft: ({ eventId, actionType }, input = {}) => (0, import_lodash2.merge)(
6357
5805
  {
6358
5806
  id: getUUID(),
6359
5807
  eventId,
@@ -6377,7 +5825,6 @@ function eventPayloadGenerator(rng) {
6377
5825
  },
6378
5826
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
6379
5827
  createdBy: "@todo",
6380
- createdByUserType: TokenUserType.Enum.user,
6381
5828
  createdByRole: "@todo",
6382
5829
  createdAtLocation: "@todo"
6383
5830
  }
@@ -6407,13 +5854,13 @@ function eventPayloadGenerator(rng) {
6407
5854
  notify: (eventId, input = {}) => {
6408
5855
  let declaration = input.declaration;
6409
5856
  if (!declaration) {
6410
- const partialDeclaration = (0, import_lodash3.omitBy)(
5857
+ const partialDeclaration = (0, import_lodash2.omitBy)(
6411
5858
  generateActionDeclarationInput(
6412
5859
  tennisClubMembershipEvent,
6413
5860
  ActionType.DECLARE,
6414
5861
  rng
6415
5862
  ),
6416
- import_lodash3.isString
5863
+ import_lodash2.isString
6417
5864
  );
6418
5865
  declaration = partialDeclaration;
6419
5866
  }
@@ -6563,18 +6010,16 @@ function generateActionDocument({
6563
6010
  configuration,
6564
6011
  action,
6565
6012
  rng = () => 0.1,
6566
- defaults = {},
6567
- user: user2 = {}
6013
+ defaults = {}
6568
6014
  }) {
6569
6015
  const actionBase = {
6570
6016
  // Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
6571
6017
  // @TODO: This should be fixed in the future.
6572
6018
  createdAt: new Date(Date.now() - 500).toISOString(),
6573
- createdBy: user2.id ?? getUUID(),
6574
- createdByUserType: TokenUserType.Enum.user,
6575
- createdByRole: TestUserRole.Enum.FIELD_AGENT,
6019
+ createdBy: getUUID(),
6020
+ createdByRole: "FIELD_AGENT",
6576
6021
  id: getUUID(),
6577
- createdAtLocation: user2.primaryOfficeId ?? "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
6022
+ createdAtLocation: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
6578
6023
  declaration: generateActionDeclarationInput(configuration, action, rng),
6579
6024
  annotation: {},
6580
6025
  status: ActionStatus.Accepted,
@@ -6589,7 +6034,7 @@ function generateActionDocument({
6589
6034
  case ActionType.DECLARE:
6590
6035
  return { ...actionBase, type: action };
6591
6036
  case ActionType.UNASSIGN:
6592
- return { ...actionBase, type: action };
6037
+ return { ...actionBase, type: action, assignedTo: null };
6593
6038
  case ActionType.ASSIGN:
6594
6039
  return { ...actionBase, assignedTo: getUUID(), type: action };
6595
6040
  case ActionType.VALIDATE:
@@ -6628,14 +6073,13 @@ function generateActionDocument({
6628
6073
  function generateEventDocument({
6629
6074
  configuration,
6630
6075
  actions,
6631
- rng = () => 0.1,
6632
- user: user2
6076
+ rng = () => 0.1
6633
6077
  }) {
6634
6078
  return {
6635
6079
  trackingId: getUUID(),
6636
6080
  type: configuration.id,
6637
6081
  actions: actions.map(
6638
- (action) => generateActionDocument({ configuration, action, rng, user: user2 })
6082
+ (action) => generateActionDocument({ configuration, action, rng })
6639
6083
  ),
6640
6084
  // Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
6641
6085
  // @TODO: This should be fixed in the future.
@@ -6703,7 +6147,7 @@ function createPrng(seed) {
6703
6147
  return state / MODULUS;
6704
6148
  };
6705
6149
  }
6706
- function generateUuid(rng = () => 0.1) {
6150
+ function generateUuid(rng) {
6707
6151
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
6708
6152
  const r = Math.floor(rng() * 16);
6709
6153
  const v = c === "x" ? r : r & 3 | 8;
@@ -6715,11 +6159,6 @@ function generateTrackingId(rng) {
6715
6159
  const trackingId = uuid.slice(0, 6).toUpperCase();
6716
6160
  return trackingId;
6717
6161
  }
6718
- function generateRegistrationNumber(rng) {
6719
- const uuid = generateUuid(rng).replace(/-/g, "");
6720
- const registrationNumber = uuid.slice(0, 12).toUpperCase();
6721
- return registrationNumber;
6722
- }
6723
6162
  function generateRandomSignature(rng) {
6724
6163
  return `/random-bucket/${generateUuid(rng)}.png`;
6725
6164
  }
@@ -6735,12 +6174,11 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
6735
6174
  type: overrides.type ?? TENNIS_CLUB_MEMBERSHIP,
6736
6175
  status: overrides.status ?? pickRandom(rng, EventStatus.options),
6737
6176
  createdAt: overrides.createdAt ?? createdAt,
6738
- createdByUserType: overrides.createdByUserType ?? "user",
6739
6177
  createdBy: overrides.createdBy ?? generateUuid(rng),
6740
6178
  createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
6741
6179
  updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
6742
6180
  createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
6743
- updatedAt: overrides.updatedAt ?? (0, import_date_fns3.addDays)(new Date(createdAt), 1).toISOString(),
6181
+ updatedAt: overrides.updatedAt ?? (0, import_addDays.default)(new Date(createdAt), 1).toISOString(),
6744
6182
  assignedTo: overrides.assignedTo ?? null,
6745
6183
  updatedBy: overrides.updatedBy ?? generateUuid(rng),
6746
6184
  updatedByUserRole: overrides.updatedByUserRole ?? "FIELD_AGENT",
@@ -6812,7 +6250,235 @@ function isFieldConfigDefaultValue(value) {
6812
6250
  }
6813
6251
 
6814
6252
  // ../commons/src/events/scopes.ts
6815
- var import_lodash4 = require("lodash");
6253
+ var import_lodash3 = require("lodash");
6254
+
6255
+ // ../commons/src/scopes.ts
6256
+ var import_zod31 = require("zod");
6257
+ var SCOPES = {
6258
+ // TODO v1.8 legacy scopes
6259
+ NATLSYSADMIN: "natlsysadmin",
6260
+ BYPASSRATELIMIT: "bypassratelimit",
6261
+ DECLARE: "declare",
6262
+ REGISTER: "register",
6263
+ VALIDATE: "validate",
6264
+ DEMO: "demo",
6265
+ CERTIFY: "certify",
6266
+ PERFORMANCE: "performance",
6267
+ SYSADMIN: "sysadmin",
6268
+ TEAMS: "teams",
6269
+ CONFIG: "config",
6270
+ // systems / integrations
6271
+ WEBHOOK: "webhook",
6272
+ NATIONALID: "nationalId",
6273
+ NOTIFICATION_API: "notification-api",
6274
+ RECORDSEARCH: "recordsearch",
6275
+ /**
6276
+ * @TODO This is a temporary scope to be used for V2 Events custom events declaration
6277
+ */
6278
+ RECORD_DECLARE: "record.declare-birth",
6279
+ // declare
6280
+ RECORD_IMPORT: "record.import",
6281
+ // declare
6282
+ RECORD_DECLARE_BIRTH: "record.declare-birth",
6283
+ RECORD_DECLARE_BIRTH_MY_JURISDICTION: "record.declare-birth:my-jurisdiction",
6284
+ RECORD_DECLARE_DEATH: "record.declare-death",
6285
+ RECORD_DECLARE_DEATH_MY_JURISDICTION: "record.declare-death:my-jurisdiction",
6286
+ RECORD_DECLARE_MARRIAGE: "record.declare-marriage",
6287
+ RECORD_DECLARE_MARRIAGE_MY_JURISDICTION: "record.declare-marriage:my-jurisdiction",
6288
+ RECORD_SUBMIT_INCOMPLETE: "record.declaration-submit-incomplete",
6289
+ RECORD_SUBMIT_FOR_REVIEW: "record.declaration-submit-for-review",
6290
+ RECORD_UNASSIGN_OTHERS: "record.unassign-others",
6291
+ // validate
6292
+ RECORD_SUBMIT_FOR_APPROVAL: "record.declaration-submit-for-approval",
6293
+ RECORD_SUBMIT_FOR_UPDATES: "record.declaration-submit-for-updates",
6294
+ RECORD_DECLARATION_EDIT: "record.declaration-edit",
6295
+ RECORD_REVIEW_DUPLICATES: "record.review-duplicates",
6296
+ RECORD_DECLARATION_ARCHIVE: "record.declaration-archive",
6297
+ RECORD_DECLARATION_REINSTATE: "record.declaration-reinstate",
6298
+ // register
6299
+ RECORD_REGISTER: "record.register",
6300
+ // certify
6301
+ RECORD_EXPORT_RECORDS: "record.export-records",
6302
+ RECORD_DECLARATION_PRINT: "record.declaration-print",
6303
+ RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS: "record.declaration-print-supporting-documents",
6304
+ RECORD_REGISTRATION_PRINT: "record.registration-print",
6305
+ // v1.8
6306
+ /**
6307
+ * This scope is used to **print and **issue certified copies of a record
6308
+ * after it has been registered. Previously Registrars had this permission.
6309
+ */
6310
+ RECORD_PRINT_ISSUE_CERTIFIED_COPIES: "record.registration-print&issue-certified-copies",
6311
+ RECORD_PRINT_CERTIFIED_COPIES: "record.registration-print-certified-copies",
6312
+ // v1.8
6313
+ RECORD_BULK_PRINT_CERTIFIED_COPIES: "record.registration-bulk-print-certified-copies",
6314
+ // v1.8
6315
+ RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES: "record.registration-verify-certified-copies",
6316
+ // v1.8
6317
+ // correct
6318
+ RECORD_REGISTRATION_REQUEST_CORRECTION: "record.registration-request-correction",
6319
+ RECORD_REGISTRATION_CORRECT: "record.registration-correct",
6320
+ RECORD_REGISTRATION_REQUEST_REVOCATION: "record.registration-request-revocation",
6321
+ // v1.8
6322
+ RECORD_REGISTRATION_REVOKE: "record.registration-revoke",
6323
+ // v1.8
6324
+ RECORD_REGISTRATION_REQUEST_REINSTATEMENT: "record.registration-request-reinstatement",
6325
+ // v1.8
6326
+ RECORD_REGISTRATION_REINSTATE: "record.registration-reinstate",
6327
+ // v1.8
6328
+ RECORD_CONFIRM_REGISTRATION: "record.confirm-registration",
6329
+ RECORD_REJECT_REGISTRATION: "record.reject-registration",
6330
+ // search
6331
+ SEARCH_BIRTH_MY_JURISDICTION: "search.birth:my-jurisdiction",
6332
+ SEARCH_BIRTH: "search.birth",
6333
+ SEARCH_DEATH_MY_JURISDICTION: "search.death:my-jurisdiction",
6334
+ SEARCH_DEATH: "search.death",
6335
+ SEARCH_MARRIAGE_MY_JURISDICTION: "search.marriage:my-jurisdiction",
6336
+ SEARCH_MARRIAGE: "search.marriage",
6337
+ // audit v1.8
6338
+ RECORD_READ: "record.read",
6339
+ RECORD_READ_AUDIT: "record.read-audit",
6340
+ RECORD_READ_COMMENTS: "record.read-comments",
6341
+ RECORD_CREATE_COMMENTS: "record.create-comments",
6342
+ // profile
6343
+ PROFILE_UPDATE: "profile.update",
6344
+ //v1.8
6345
+ PROFILE_ELECTRONIC_SIGNATURE: "profile.electronic-signature",
6346
+ // performance
6347
+ PERFORMANCE_READ: "performance.read",
6348
+ PERFORMANCE_READ_DASHBOARDS: "performance.read-dashboards",
6349
+ PERFORMANCE_EXPORT_VITAL_STATISTICS: "performance.vital-statistics-export",
6350
+ // organisation
6351
+ ORGANISATION_READ_LOCATIONS: "organisation.read-locations:all",
6352
+ ORGANISATION_READ_LOCATIONS_MY_OFFICE: "organisation.read-locations:my-office",
6353
+ ORGANISATION_READ_LOCATIONS_MY_JURISDICTION: "organisation.read-locations:my-jurisdiction",
6354
+ // user
6355
+ USER_READ: "user.read:all",
6356
+ USER_READ_MY_OFFICE: "user.read:my-office",
6357
+ USER_READ_MY_JURISDICTION: "user.read:my-jurisdiction",
6358
+ USER_READ_ONLY_MY_AUDIT: "user.read:only-my-audit",
6359
+ //v1.8
6360
+ USER_CREATE: "user.create:all",
6361
+ USER_CREATE_MY_JURISDICTION: "user.create:my-jurisdiction",
6362
+ USER_UPDATE: "user.update:all",
6363
+ USER_UPDATE_MY_JURISDICTION: "user.update:my-jurisdiction",
6364
+ // config
6365
+ CONFIG_UPDATE_ALL: "config.update:all",
6366
+ // data seeding
6367
+ USER_DATA_SEEDING: "user.data-seeding"
6368
+ };
6369
+ var LiteralScopes = import_zod31.z.union([
6370
+ import_zod31.z.literal(SCOPES.NATLSYSADMIN),
6371
+ import_zod31.z.literal(SCOPES.BYPASSRATELIMIT),
6372
+ import_zod31.z.literal(SCOPES.DECLARE),
6373
+ import_zod31.z.literal(SCOPES.REGISTER),
6374
+ import_zod31.z.literal(SCOPES.VALIDATE),
6375
+ import_zod31.z.literal(SCOPES.DEMO),
6376
+ import_zod31.z.literal(SCOPES.CERTIFY),
6377
+ import_zod31.z.literal(SCOPES.PERFORMANCE),
6378
+ import_zod31.z.literal(SCOPES.SYSADMIN),
6379
+ import_zod31.z.literal(SCOPES.TEAMS),
6380
+ import_zod31.z.literal(SCOPES.CONFIG),
6381
+ import_zod31.z.literal(SCOPES.WEBHOOK),
6382
+ import_zod31.z.literal(SCOPES.NATIONALID),
6383
+ import_zod31.z.literal(SCOPES.NOTIFICATION_API),
6384
+ import_zod31.z.literal(SCOPES.RECORDSEARCH),
6385
+ import_zod31.z.literal(SCOPES.RECORD_IMPORT),
6386
+ import_zod31.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
6387
+ import_zod31.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
6388
+ import_zod31.z.literal(SCOPES.RECORD_DECLARE_DEATH),
6389
+ import_zod31.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
6390
+ import_zod31.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
6391
+ import_zod31.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
6392
+ import_zod31.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
6393
+ import_zod31.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW),
6394
+ import_zod31.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS),
6395
+ import_zod31.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
6396
+ import_zod31.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
6397
+ import_zod31.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
6398
+ import_zod31.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
6399
+ import_zod31.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
6400
+ import_zod31.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE),
6401
+ import_zod31.z.literal(SCOPES.RECORD_REGISTER),
6402
+ import_zod31.z.literal(SCOPES.RECORD_EXPORT_RECORDS),
6403
+ import_zod31.z.literal(SCOPES.RECORD_DECLARATION_PRINT),
6404
+ import_zod31.z.literal(SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS),
6405
+ import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_PRINT),
6406
+ import_zod31.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
6407
+ import_zod31.z.literal(SCOPES.RECORD_PRINT_CERTIFIED_COPIES),
6408
+ import_zod31.z.literal(SCOPES.RECORD_BULK_PRINT_CERTIFIED_COPIES),
6409
+ import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES),
6410
+ import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
6411
+ import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
6412
+ import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REVOCATION),
6413
+ import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REVOKE),
6414
+ import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REINSTATEMENT),
6415
+ import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REINSTATE),
6416
+ import_zod31.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
6417
+ import_zod31.z.literal(SCOPES.RECORD_REJECT_REGISTRATION),
6418
+ import_zod31.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
6419
+ import_zod31.z.literal(SCOPES.SEARCH_BIRTH),
6420
+ import_zod31.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
6421
+ import_zod31.z.literal(SCOPES.SEARCH_DEATH),
6422
+ import_zod31.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
6423
+ import_zod31.z.literal(SCOPES.SEARCH_MARRIAGE),
6424
+ import_zod31.z.literal(SCOPES.RECORD_READ),
6425
+ import_zod31.z.literal(SCOPES.RECORD_READ_AUDIT),
6426
+ import_zod31.z.literal(SCOPES.RECORD_READ_COMMENTS),
6427
+ import_zod31.z.literal(SCOPES.RECORD_CREATE_COMMENTS),
6428
+ import_zod31.z.literal(SCOPES.PROFILE_UPDATE),
6429
+ import_zod31.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE),
6430
+ import_zod31.z.literal(SCOPES.PERFORMANCE_READ),
6431
+ import_zod31.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
6432
+ import_zod31.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS),
6433
+ import_zod31.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
6434
+ import_zod31.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
6435
+ import_zod31.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION),
6436
+ import_zod31.z.literal(SCOPES.USER_READ),
6437
+ import_zod31.z.literal(SCOPES.USER_READ_MY_OFFICE),
6438
+ import_zod31.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
6439
+ import_zod31.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
6440
+ import_zod31.z.literal(SCOPES.USER_CREATE),
6441
+ import_zod31.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
6442
+ import_zod31.z.literal(SCOPES.USER_UPDATE),
6443
+ import_zod31.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION),
6444
+ import_zod31.z.literal(SCOPES.CONFIG_UPDATE_ALL),
6445
+ import_zod31.z.literal(SCOPES.USER_DATA_SEEDING)
6446
+ ]);
6447
+ var rawConfigurableScopeRegex = /^([a-zA-Z\.]+)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
6448
+ var rawConfigurableScope = import_zod31.z.string().regex(rawConfigurableScopeRegex);
6449
+ var CreateUserScope = import_zod31.z.object({
6450
+ type: import_zod31.z.literal("user.create"),
6451
+ options: import_zod31.z.object({
6452
+ role: import_zod31.z.array(import_zod31.z.string())
6453
+ })
6454
+ });
6455
+ var EditUserScope = import_zod31.z.object({
6456
+ type: import_zod31.z.literal("user.edit"),
6457
+ options: import_zod31.z.object({
6458
+ role: import_zod31.z.array(import_zod31.z.string())
6459
+ })
6460
+ });
6461
+ var WorkqueueScope = import_zod31.z.object({
6462
+ type: import_zod31.z.literal("workqueue"),
6463
+ options: import_zod31.z.object({
6464
+ id: import_zod31.z.array(import_zod31.z.string())
6465
+ })
6466
+ });
6467
+ var NotifyRecordScope = import_zod31.z.object({
6468
+ type: import_zod31.z.literal("record.notify"),
6469
+ options: import_zod31.z.object({
6470
+ event: import_zod31.z.array(import_zod31.z.string())
6471
+ })
6472
+ });
6473
+ var ConfigurableScopes = import_zod31.z.discriminatedUnion("type", [
6474
+ CreateUserScope,
6475
+ EditUserScope,
6476
+ WorkqueueScope,
6477
+ NotifyRecordScope
6478
+ ]);
6479
+ var scopes = Object.values(SCOPES);
6480
+
6481
+ // ../commons/src/events/scopes.ts
6816
6482
  var CONFIG_GET_ALLOWED_SCOPES = [
6817
6483
  SCOPES.RECORD_DECLARE,
6818
6484
  SCOPES.RECORD_READ,
@@ -6859,7 +6525,8 @@ var ACTION_ALLOWED_SCOPES = {
6859
6525
  [ActionType.REGISTER]: [SCOPES.RECORD_REGISTER],
6860
6526
  [ActionType.PRINT_CERTIFICATE]: [SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES],
6861
6527
  [ActionType.REQUEST_CORRECTION]: [
6862
- SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION
6528
+ SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION,
6529
+ SCOPES.RECORD_REGISTRATION_CORRECT
6863
6530
  ],
6864
6531
  [ActionType.REJECT_CORRECTION]: [SCOPES.RECORD_REGISTRATION_CORRECT],
6865
6532
  [ActionType.APPROVE_CORRECTION]: [SCOPES.RECORD_REGISTRATION_CORRECT],
@@ -6889,20 +6556,30 @@ var ACTION_ALLOWED_CONFIGURABLE_SCOPES = {
6889
6556
  [ActionType.UNASSIGN]: [],
6890
6557
  [ActionType.DETECT_DUPLICATE]: []
6891
6558
  };
6892
- var WRITE_ACTION_SCOPES = [
6893
- ...ACTION_ALLOWED_SCOPES[ActionType.DECLARE],
6894
- ...ACTION_ALLOWED_SCOPES[ActionType.VALIDATE],
6895
- ...ACTION_ALLOWED_SCOPES[ActionType.REGISTER],
6896
- ...ACTION_ALLOWED_SCOPES[ActionType.PRINT_CERTIFICATE]
6897
- ];
6898
6559
  function hasAnyOfScopes(a, b) {
6899
- return (0, import_lodash4.intersection)(a, b).length > 0;
6560
+ return (0, import_lodash3.intersection)(a, b).length > 0;
6561
+ }
6562
+ function filterUnallowedActions(actions, userScopes) {
6563
+ const allowedActions = actions.filter((action) => {
6564
+ const requiredScopes = ACTION_ALLOWED_SCOPES[action];
6565
+ if (requiredScopes === null) {
6566
+ return true;
6567
+ }
6568
+ return hasAnyOfScopes(userScopes, requiredScopes);
6569
+ });
6570
+ const hasOtherAllowedActions = allowedActions.some(
6571
+ (action) => !isMetaAction(action)
6572
+ );
6573
+ if (hasOtherAllowedActions) {
6574
+ return allowedActions;
6575
+ }
6576
+ return [ActionType.READ];
6900
6577
  }
6901
6578
 
6902
6579
  // ../commons/src/events/serializers/user/deserializer.ts
6903
- var import_zod34 = require("zod");
6580
+ var import_zod32 = require("zod");
6904
6581
  var UserWithPrimaryOffice = User.extend({
6905
- primaryOfficeId: import_zod34.z.string()
6582
+ primaryOfficeId: import_zod32.z.string()
6906
6583
  });
6907
6584
  function userDeserializer(serializedUserField, user2) {
6908
6585
  if (typeof serializedUserField === "string") {
@@ -6922,7 +6599,6 @@ function deserializeQueryExpression(expression, user2) {
6922
6599
  ...expression.assignedTo,
6923
6600
  term: userDeserializer(expression.assignedTo.term, user2)
6924
6601
  },
6925
- createdByUserType: expression.createdByUserType,
6926
6602
  createdBy: expression.createdBy && {
6927
6603
  ...expression.createdBy,
6928
6604
  term: userDeserializer(expression.createdBy.term, user2)
@@ -6963,51 +6639,3 @@ function deserializeQuery(query, user2) {
6963
6639
  )
6964
6640
  };
6965
6641
  }
6966
-
6967
- // ../commons/src/events/state/availableActions.ts
6968
- var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
6969
- [EventStatus.enum.CREATED]: [
6970
- ActionType.READ,
6971
- ActionType.DECLARE,
6972
- ActionType.NOTIFY,
6973
- ActionType.DELETE
6974
- ],
6975
- [EventStatus.enum.NOTIFIED]: [
6976
- ActionType.READ,
6977
- ActionType.DECLARE,
6978
- ActionType.ARCHIVE,
6979
- ActionType.REJECT
6980
- ],
6981
- [EventStatus.enum.DECLARED]: [
6982
- ActionType.READ,
6983
- ActionType.VALIDATE,
6984
- ActionType.ARCHIVE,
6985
- ActionType.REJECT
6986
- ],
6987
- [EventStatus.enum.VALIDATED]: [
6988
- ActionType.READ,
6989
- ActionType.REGISTER,
6990
- ActionType.ARCHIVE,
6991
- ActionType.REJECT
6992
- ],
6993
- [EventStatus.enum.REJECTED]: [
6994
- ActionType.READ,
6995
- ActionType.DECLARE,
6996
- ActionType.VALIDATE
6997
- ],
6998
- [EventStatus.enum.REGISTERED]: [
6999
- ActionType.READ,
7000
- ActionType.PRINT_CERTIFICATE,
7001
- ActionType.REQUEST_CORRECTION
7002
- ],
7003
- [EventStatus.enum.CERTIFIED]: [
7004
- ActionType.READ,
7005
- ActionType.PRINT_CERTIFICATE,
7006
- ActionType.REQUEST_CORRECTION
7007
- ],
7008
- [EventStatus.enum.ARCHIVED]: [
7009
- ActionType.READ,
7010
- ActionType.ASSIGN,
7011
- ActionType.UNASSIGN
7012
- ]
7013
- };