@opencrvs/toolkit 1.8.0-rc.fb96ec1 → 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 (30) hide show
  1. package/dist/commons/api/router.d.ts +5865 -12088
  2. package/dist/commons/events/ActionConfig.d.ts +18584 -30632
  3. package/dist/commons/events/ActionDocument.d.ts +387 -486
  4. package/dist/commons/events/ActionInput.d.ts +126 -126
  5. package/dist/commons/events/ActionType.d.ts +0 -2
  6. package/dist/commons/events/AdvancedSearchConfig.d.ts +0 -204
  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 +23 -28
  10. package/dist/commons/events/EventConfig.d.ts +17504 -26141
  11. package/dist/commons/events/EventDocument.d.ts +275 -350
  12. package/dist/commons/events/EventIndex.d.ts +214 -629
  13. package/dist/commons/events/EventMetadata.d.ts +31 -73
  14. package/dist/commons/events/FieldConfig.d.ts +37 -19
  15. package/dist/commons/events/FormConfig.d.ts +66 -0
  16. package/dist/commons/events/PageConfig.d.ts +18 -0
  17. package/dist/commons/events/WorkqueueColumnConfig.d.ts +11 -11
  18. package/dist/commons/events/WorkqueueConfig.d.ts +740 -3237
  19. package/dist/commons/events/defineConfig.d.ts +1589 -3224
  20. package/dist/commons/events/field.d.ts +0 -5
  21. package/dist/commons/events/index.d.ts +0 -1
  22. package/dist/commons/events/scopes.d.ts +3 -2
  23. package/dist/commons/events/test.utils.d.ts +5 -28
  24. package/dist/commons/events/transactions.d.ts +1 -1
  25. package/dist/commons/events/utils.d.ts +1600 -3232
  26. package/dist/conditionals/index.js +17 -20
  27. package/dist/events/index.js +1312 -1681
  28. package/dist/scopes/index.d.ts +1 -4
  29. package/dist/scopes/index.js +17 -67
  30. 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,
@@ -158,10 +155,8 @@ __export(events_exports, {
158
155
  SelectOption: () => SelectOption,
159
156
  ShowConditional: () => ShowConditional,
160
157
  SignatureFieldValue: () => SignatureFieldValue,
161
- StatusChangingActions: () => StatusChangingActions,
162
158
  SummaryConfig: () => SummaryConfig,
163
159
  TENNIS_CLUB_MEMBERSHIP: () => TENNIS_CLUB_MEMBERSHIP,
164
- TestUserRole: () => TestUserRole,
165
160
  TextValue: () => TextValue,
166
161
  TranslationConfig: () => TranslationConfig,
167
162
  UnassignActionInput: () => UnassignActionInput,
@@ -169,10 +164,8 @@ __export(events_exports, {
169
164
  UrbanAddressValue: () => UrbanAddressValue,
170
165
  User: () => User,
171
166
  ValidateActionInput: () => ValidateActionInput,
172
- ValidationConfig: () => ValidationConfig,
173
167
  VerificationActionConfig: () => VerificationActionConfig,
174
168
  VerificationPageConfig: () => VerificationPageConfig,
175
- WRITE_ACTION_SCOPES: () => WRITE_ACTION_SCOPES,
176
169
  Within: () => Within,
177
170
  WorkqueueActionsWithDefault: () => WorkqueueActionsWithDefault,
178
171
  WorkqueueColumn: () => WorkqueueColumn,
@@ -181,7 +174,6 @@ __export(events_exports, {
181
174
  WorkqueueColumnValue: () => WorkqueueColumnValue,
182
175
  WorkqueueConfig: () => WorkqueueConfig,
183
176
  WorkqueueConfigInput: () => WorkqueueConfigInput,
184
- WorkqueueConfigWithoutQuery: () => WorkqueueConfigWithoutQuery,
185
177
  WorkqueueCountInput: () => WorkqueueCountInput,
186
178
  WorkqueueCountOutput: () => WorkqueueCountOutput,
187
179
  ZodDate: () => ZodDate,
@@ -217,6 +209,7 @@ __export(events_exports, {
217
209
  eventQueryDataGenerator: () => eventQueryDataGenerator,
218
210
  field: () => field,
219
211
  fieldTypes: () => fieldTypes,
212
+ filterUnallowedActions: () => filterUnallowedActions,
220
213
  findActiveDrafts: () => findActiveDrafts,
221
214
  findAllFields: () => findAllFields,
222
215
  findLastAssignmentAction: () => findLastAssignmentAction,
@@ -228,10 +221,8 @@ __export(events_exports, {
228
221
  generateEventDraftDocument: () => generateEventDraftDocument,
229
222
  generateRandomName: () => generateRandomName,
230
223
  generateRandomSignature: () => generateRandomSignature,
231
- generateRegistrationNumber: () => generateRegistrationNumber,
232
224
  generateTransactionId: () => generateTransactionId,
233
225
  generateTranslationConfig: () => generateTranslationConfig,
234
- generateUuid: () => generateUuid,
235
226
  generateWorkqueues: () => generateWorkqueues,
236
227
  getAcceptedActions: () => getAcceptedActions,
237
228
  getActionAnnotation: () => getActionAnnotation,
@@ -372,12 +363,6 @@ var FieldConditional = import_zod.z.discriminatedUnion("type", [
372
363
  ref: "FieldConditional"
373
364
  });
374
365
 
375
- // ../commons/src/events/PageConfig.ts
376
- var import_zod6 = require("zod");
377
-
378
- // ../commons/src/events/FieldConfig.ts
379
- var import_zod5 = require("zod");
380
-
381
366
  // ../commons/src/events/TranslationConfig.ts
382
367
  var import_zod2 = require("zod");
383
368
  var import_zod_openapi2 = require("zod-openapi");
@@ -395,6 +380,105 @@ var TranslationConfig = import_zod2.z.object({
395
380
  ref: "TranslationConfig"
396
381
  });
397
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
+
398
482
  // ../commons/src/events/FieldType.ts
399
483
  var FieldType = {
400
484
  NAME: "NAME",
@@ -433,10 +517,10 @@ var compositeFieldTypes = [
433
517
  ];
434
518
 
435
519
  // ../commons/src/events/FieldValue.ts
436
- var import_zod4 = require("zod");
520
+ var import_zod5 = require("zod");
437
521
 
438
522
  // ../commons/src/events/CompositeFieldValue.ts
439
- var import_zod3 = require("zod");
523
+ var import_zod4 = require("zod");
440
524
  var GeographicalArea = {
441
525
  URBAN: "URBAN",
442
526
  RURAL: "RURAL"
@@ -445,98 +529,98 @@ var AddressType = {
445
529
  DOMESTIC: "DOMESTIC",
446
530
  INTERNATIONAL: "INTERNATIONAL"
447
531
  };
448
- var FileFieldValue = import_zod3.z.object({
449
- filename: import_zod3.z.string(),
450
- originalFilename: import_zod3.z.string(),
451
- type: import_zod3.z.string()
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()
452
536
  });
453
- var AdminStructure = import_zod3.z.object({
454
- country: import_zod3.z.string(),
455
- addressType: import_zod3.z.literal(AddressType.DOMESTIC),
456
- province: import_zod3.z.string(),
457
- district: import_zod3.z.string()
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()
458
542
  });
459
543
  var UrbanAddressValue = AdminStructure.extend({
460
- urbanOrRural: import_zod3.z.literal(GeographicalArea.URBAN),
461
- town: import_zod3.z.string().optional(),
462
- residentialArea: import_zod3.z.string().optional(),
463
- street: import_zod3.z.string().optional(),
464
- number: import_zod3.z.string().optional(),
465
- zipCode: import_zod3.z.string().optional()
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()
466
550
  });
467
551
  var RuralAddressValue = AdminStructure.extend({
468
- urbanOrRural: import_zod3.z.literal(GeographicalArea.RURAL),
469
- village: import_zod3.z.string().optional()
552
+ urbanOrRural: import_zod4.z.literal(GeographicalArea.RURAL),
553
+ village: import_zod4.z.string().optional()
470
554
  });
471
555
  var UrbanAddressUpdateValue = AdminStructure.extend({
472
- urbanOrRural: import_zod3.z.literal(GeographicalArea.URBAN),
473
- town: import_zod3.z.string().nullish(),
474
- residentialArea: import_zod3.z.string().nullish(),
475
- street: import_zod3.z.string().nullish(),
476
- number: import_zod3.z.string().nullish(),
477
- zipCode: import_zod3.z.string().nullish()
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()
478
562
  });
479
- var NameFieldValue = import_zod3.z.object({
480
- firstname: import_zod3.z.string(),
481
- surname: import_zod3.z.string(),
482
- middlename: import_zod3.z.string().optional()
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()
483
567
  });
484
- var NameFieldUpdateValue = import_zod3.z.object({
485
- firstname: import_zod3.z.string(),
486
- surname: import_zod3.z.string(),
487
- middlename: import_zod3.z.string().nullish()
488
- }).or(import_zod3.z.null()).or(import_zod3.z.undefined());
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());
489
573
  var RuralAddressUpdateValue = AdminStructure.extend({
490
- urbanOrRural: import_zod3.z.literal(GeographicalArea.RURAL),
491
- village: import_zod3.z.string().nullish()
574
+ urbanOrRural: import_zod4.z.literal(GeographicalArea.RURAL),
575
+ village: import_zod4.z.string().nullish()
492
576
  });
493
- var GenericAddressValue = import_zod3.z.object({
494
- country: import_zod3.z.string(),
495
- addressType: import_zod3.z.literal(AddressType.INTERNATIONAL),
496
- state: import_zod3.z.string(),
497
- district2: import_zod3.z.string(),
498
- cityOrTown: import_zod3.z.string().optional(),
499
- addressLine1: import_zod3.z.string().optional(),
500
- addressLine2: import_zod3.z.string().optional(),
501
- addressLine3: import_zod3.z.string().optional(),
502
- postcodeOrZip: import_zod3.z.string().optional()
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()
503
587
  });
504
- var AddressFieldValue = import_zod3.z.discriminatedUnion("urbanOrRural", [UrbanAddressValue, RuralAddressValue]).or(GenericAddressValue);
505
- var GenericAddressUpdateValue = import_zod3.z.object({
506
- country: import_zod3.z.string(),
507
- addressType: import_zod3.z.literal(AddressType.INTERNATIONAL),
508
- state: import_zod3.z.string(),
509
- district2: import_zod3.z.string(),
510
- cityOrTown: import_zod3.z.string().nullish(),
511
- addressLine1: import_zod3.z.string().nullish(),
512
- addressLine2: import_zod3.z.string().nullish(),
513
- addressLine3: import_zod3.z.string().nullish(),
514
- postcodeOrZip: import_zod3.z.string().nullish()
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()
515
599
  });
516
- var AddressFieldUpdateValue = import_zod3.z.discriminatedUnion("urbanOrRural", [
600
+ var AddressFieldUpdateValue = import_zod4.z.discriminatedUnion("urbanOrRural", [
517
601
  UrbanAddressUpdateValue,
518
602
  RuralAddressUpdateValue
519
603
  ]).or(GenericAddressUpdateValue);
520
- var FileFieldValueWithOption = import_zod3.z.object({
521
- filename: import_zod3.z.string(),
522
- originalFilename: import_zod3.z.string(),
523
- type: import_zod3.z.string(),
524
- option: import_zod3.z.string()
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()
525
609
  });
526
- var FileFieldWithOptionValue = import_zod3.z.array(FileFieldValueWithOption);
610
+ var FileFieldWithOptionValue = import_zod4.z.array(FileFieldValueWithOption);
527
611
 
528
612
  // ../commons/src/events/FieldValue.ts
529
- var TextValue = import_zod4.z.string();
613
+ var TextValue = import_zod5.z.string();
530
614
  var NonEmptyTextValue = TextValue.min(1);
531
- var DateValue = import_zod4.z.string().date().describe("Date in the format YYYY-MM-DD");
532
- var DatetimeValue = import_zod4.z.string().datetime();
533
- var DateRangeFieldValue = DateValue.or(import_zod4.z.tuple([DateValue, DateValue]));
534
- var EmailValue = import_zod4.z.string().email();
535
- var CheckboxFieldValue = import_zod4.z.boolean();
536
- var NumberFieldValue = import_zod4.z.number();
537
- var DataFieldValue = import_zod4.z.undefined();
538
- var SignatureFieldValue = import_zod4.z.string();
539
- var FieldValue = import_zod4.z.union([
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([
540
624
  TextValue,
541
625
  DateValue,
542
626
  DateRangeFieldValue,
@@ -551,7 +635,7 @@ var FieldValue = import_zod4.z.union([
551
635
  NameFieldValue,
552
636
  NameFieldUpdateValue
553
637
  ]);
554
- var FieldUpdateValue = import_zod4.z.union([
638
+ var FieldUpdateValue = import_zod5.z.union([
555
639
  TextValue,
556
640
  DateValue,
557
641
  DateRangeFieldValue,
@@ -568,62 +652,63 @@ var FieldUpdateValue = import_zod4.z.union([
568
652
 
569
653
  // ../commons/src/events/FieldConfig.ts
570
654
  var import_zod_openapi3 = require("zod-openapi");
571
- (0, import_zod_openapi3.extendZodWithOpenApi)(import_zod5.z);
572
- var FieldId = import_zod5.z.string().describe("Unique identifier for the field");
573
- var FieldReference = import_zod5.z.object({
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({
574
658
  $$field: FieldId
575
659
  }).describe("Reference to a field by its ID");
576
660
  var ParentReference = FieldReference.optional();
577
- var ValidationConfig = import_zod5.z.object({
578
- validator: Conditional,
579
- message: TranslationConfig
580
- });
581
- var BaseField = import_zod5.z.object({
661
+ var BaseField = import_zod6.z.object({
582
662
  id: FieldId,
583
663
  parent: ParentReference,
584
- conditionals: import_zod5.z.array(FieldConditional).default([]).optional(),
585
- required: 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,123 +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
840
  postfix: TranslationConfig.optional()
752
841
  }).optional()
753
842
  }).describe("Name input field");
754
843
  var PhoneField = BaseField.extend({
755
844
  defaultValue: NonEmptyTextValue.optional(),
756
- type: import_zod5.z.literal(FieldType.PHONE)
845
+ type: import_zod6.z.literal(FieldType.PHONE)
757
846
  }).describe("Phone input field");
758
847
  var IdField = BaseField.extend({
759
848
  defaultValue: NonEmptyTextValue.optional(),
760
- type: import_zod5.z.literal(FieldType.ID)
849
+ type: import_zod6.z.literal(FieldType.ID)
761
850
  }).describe("ID input field");
762
851
  var Checkbox = BaseField.extend({
763
- type: import_zod5.z.literal(FieldType.CHECKBOX),
852
+ type: import_zod6.z.literal(FieldType.CHECKBOX),
764
853
  defaultValue: CheckboxFieldValue.optional()
765
854
  }).describe("Boolean checkbox field");
766
855
  var Country = BaseField.extend({
767
- type: import_zod5.z.literal(FieldType.COUNTRY),
856
+ type: import_zod6.z.literal(FieldType.COUNTRY),
768
857
  defaultValue: NonEmptyTextValue.optional()
769
858
  }).describe("Country select field");
770
- var AdministrativeAreas = import_zod5.z.enum([
859
+ var AdministrativeAreas = import_zod6.z.enum([
771
860
  "ADMIN_STRUCTURE",
772
861
  "HEALTH_FACILITY",
773
862
  "CRVS_OFFICE"
774
863
  ]);
775
- var AdministrativeAreaConfiguration = import_zod5.z.object({
776
- partOf: import_zod5.z.object({
777
- $declaration: import_zod5.z.string()
864
+ var AdministrativeAreaConfiguration = import_zod6.z.object({
865
+ partOf: import_zod6.z.object({
866
+ $declaration: import_zod6.z.string()
778
867
  }).optional().describe("Parent location"),
779
868
  type: AdministrativeAreas
780
869
  }).describe("Administrative area options");
781
870
  var AdministrativeArea = BaseField.extend({
782
- type: import_zod5.z.literal(FieldType.ADMINISTRATIVE_AREA),
871
+ type: import_zod6.z.literal(FieldType.ADMINISTRATIVE_AREA),
783
872
  defaultValue: NonEmptyTextValue.optional(),
784
873
  configuration: AdministrativeAreaConfiguration
785
874
  }).describe("Administrative area input field e.g. facility, office");
786
875
  var Location = BaseField.extend({
787
- type: import_zod5.z.literal(FieldType.LOCATION),
876
+ type: import_zod6.z.literal(FieldType.LOCATION),
788
877
  defaultValue: NonEmptyTextValue.optional()
789
878
  }).describe("Input field for a location");
790
879
  var FileUploadWithOptions = BaseField.extend({
791
- type: import_zod5.z.literal(FieldType.FILE_WITH_OPTIONS),
792
- options: import_zod5.z.array(SelectOption).describe("A list of options"),
880
+ type: import_zod6.z.literal(FieldType.FILE_WITH_OPTIONS),
881
+ options: import_zod6.z.array(SelectOption).describe("A list of options"),
793
882
  defaultValue: FileFieldWithOptionValue.optional(),
794
- configuration: import_zod5.z.object({
795
- maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
883
+ configuration: import_zod6.z.object({
884
+ maxFileSize: import_zod6.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
796
885
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
797
886
  }).default({
798
887
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
799
888
  })
800
889
  });
801
890
  var Facility = BaseField.extend({
802
- type: import_zod5.z.literal(FieldType.FACILITY),
891
+ type: import_zod6.z.literal(FieldType.FACILITY),
803
892
  defaultValue: NonEmptyTextValue.optional()
804
893
  }).describe("Input field for a facility");
805
894
  var Office = BaseField.extend({
806
- type: import_zod5.z.literal(FieldType.OFFICE),
895
+ type: import_zod6.z.literal(FieldType.OFFICE),
807
896
  defaultValue: NonEmptyTextValue.optional()
808
897
  }).describe("Input field for an office");
809
898
  var Address = BaseField.extend({
810
- type: import_zod5.z.literal(FieldType.ADDRESS),
899
+ type: import_zod6.z.literal(FieldType.ADDRESS),
811
900
  defaultValue: AddressFieldValue.optional()
812
901
  }).describe("Address input field \u2013 a combination of location and text fields");
813
- var DataEntry = import_zod5.z.union([
814
- import_zod5.z.object({
902
+ var DataEntry = import_zod6.z.union([
903
+ import_zod6.z.object({
815
904
  label: TranslationConfig,
816
- value: TranslationConfig.or(import_zod5.z.string())
905
+ value: TranslationConfig.or(import_zod6.z.string())
817
906
  }),
818
- import_zod5.z.object({
819
- fieldId: import_zod5.z.string()
907
+ import_zod6.z.object({
908
+ fieldId: import_zod6.z.string()
820
909
  })
821
910
  ]);
822
911
  var DataField = BaseField.extend({
823
- type: import_zod5.z.literal(FieldType.DATA),
824
- configuration: import_zod5.z.object({
912
+ type: import_zod6.z.literal(FieldType.DATA),
913
+ configuration: import_zod6.z.object({
825
914
  subtitle: TranslationConfig.optional(),
826
- data: import_zod5.z.array(DataEntry)
915
+ data: import_zod6.z.array(DataEntry)
827
916
  })
828
917
  }).describe("Data field for displaying read-only data");
829
- var FieldConfig = import_zod5.z.discriminatedUnion("type", [
918
+ var FieldConfig = import_zod6.z.discriminatedUnion("type", [
830
919
  Address,
831
920
  TextField,
832
921
  NumberField,
@@ -858,14 +947,18 @@ var FieldConfig = import_zod5.z.discriminatedUnion("type", [
858
947
  ref: "FieldConfig"
859
948
  });
860
949
 
950
+ // ../commons/src/events/FormConfig.ts
951
+ var import_zod8 = require("zod");
952
+
861
953
  // ../commons/src/events/PageConfig.ts
954
+ var import_zod7 = require("zod");
862
955
  var import_zod_openapi4 = require("zod-openapi");
863
- (0, import_zod_openapi4.extendZodWithOpenApi)(import_zod6.z);
864
- var PageTypes = import_zod6.z.enum(["FORM", "VERIFICATION"]);
865
- var PageConfigBase = import_zod6.z.object({
866
- id: import_zod6.z.string().describe("Unique identifier for the page"),
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"),
867
960
  title: TranslationConfig.describe("Header title of the page"),
868
- 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"),
869
962
  conditional: Conditional.optional().describe(
870
963
  "Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
871
964
  )
@@ -874,13 +967,13 @@ var PageConfigBase = import_zod6.z.object({
874
967
  ref: "FormPageConfig"
875
968
  });
876
969
  var FormPageConfig = PageConfigBase.extend({
877
- 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)
878
971
  });
879
- var VerificationActionConfig = import_zod6.z.object({
880
- verify: import_zod6.z.object({ label: TranslationConfig }),
881
- 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({
882
975
  label: TranslationConfig,
883
- confirmation: import_zod6.z.object({
976
+ confirmation: import_zod7.z.object({
884
977
  title: TranslationConfig,
885
978
  body: TranslationConfig
886
979
  })
@@ -890,122 +983,15 @@ var VerificationActionConfig = import_zod6.z.object({
890
983
  ref: "VerificationActionConfig"
891
984
  });
892
985
  var VerificationPageConfig = FormPageConfig.extend({
893
- type: import_zod6.z.literal(PageTypes.enum.VERIFICATION),
986
+ type: import_zod7.z.literal(PageTypes.enum.VERIFICATION),
894
987
  actions: VerificationActionConfig
895
988
  });
896
- var PageConfig = import_zod6.z.discriminatedUnion("type", [
989
+ var PageConfig = import_zod7.z.discriminatedUnion("type", [
897
990
  FormPageConfig,
898
991
  VerificationPageConfig
899
992
  ]);
900
993
 
901
- // ../commons/src/events/ActionType.ts
902
- var import_zod7 = require("zod");
903
- var ActionType = {
904
- // Pre-declaration actions
905
- DELETE: "DELETE",
906
- CREATE: "CREATE",
907
- NOTIFY: "NOTIFY",
908
- // Declaration actions
909
- DECLARE: "DECLARE",
910
- VALIDATE: "VALIDATE",
911
- REGISTER: "REGISTER",
912
- // Declaration system actions. Non-configurable.
913
- DETECT_DUPLICATE: "DETECT_DUPLICATE",
914
- REJECT: "REJECT",
915
- // REJECT_DECLARATION
916
- MARKED_AS_DUPLICATE: "MARKED_AS_DUPLICATE",
917
- // MARK_AS_DUPLICATE
918
- ARCHIVE: "ARCHIVE",
919
- // Record actions
920
- PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
921
- REQUEST_CORRECTION: "REQUEST_CORRECTION",
922
- REJECT_CORRECTION: "REJECT_CORRECTION",
923
- APPROVE_CORRECTION: "APPROVE_CORRECTION",
924
- // General actions
925
- READ: "READ",
926
- ASSIGN: "ASSIGN",
927
- UNASSIGN: "UNASSIGN"
928
- };
929
- var ConfirmableActions = [
930
- ActionType.NOTIFY,
931
- ActionType.DECLARE,
932
- ActionType.VALIDATE,
933
- ActionType.REGISTER,
934
- ActionType.REJECT,
935
- ActionType.ARCHIVE,
936
- ActionType.PRINT_CERTIFICATE
937
- ];
938
- var ActionTypes = import_zod7.z.enum([
939
- "DELETE",
940
- "CREATE",
941
- "NOTIFY",
942
- "DECLARE",
943
- "VALIDATE",
944
- "REGISTER",
945
- "DETECT_DUPLICATE",
946
- "REJECT",
947
- "MARKED_AS_DUPLICATE",
948
- "ARCHIVE",
949
- "PRINT_CERTIFICATE",
950
- "REQUEST_CORRECTION",
951
- "REJECT_CORRECTION",
952
- "APPROVE_CORRECTION",
953
- "READ",
954
- "ASSIGN",
955
- "UNASSIGN"
956
- ]);
957
- var declarationActionValues = [
958
- ActionTypes.enum.DECLARE,
959
- ActionTypes.enum.VALIDATE,
960
- ActionTypes.enum.REGISTER
961
- ];
962
- var DeclarationActions = ActionTypes.extract(declarationActionValues);
963
- var declarationUpdateActionValues = [
964
- ...declarationActionValues,
965
- ActionTypes.enum.REQUEST_CORRECTION
966
- ];
967
- var DeclarationUpdateActions = ActionTypes.extract(
968
- declarationUpdateActionValues
969
- );
970
- var annotationActions = ActionTypes.exclude(declarationActionValues);
971
- var writeActions = ActionTypes.exclude([
972
- ActionType.CREATE,
973
- ActionType.READ,
974
- ActionType.ASSIGN,
975
- ActionType.UNASSIGN
976
- ]);
977
- var StatusChangingActions = ActionTypes.extract([
978
- ActionType.CREATE,
979
- ActionType.NOTIFY,
980
- ActionType.DECLARE,
981
- ActionType.VALIDATE,
982
- ActionType.REGISTER,
983
- ActionType.REJECT,
984
- ActionType.ARCHIVE,
985
- ActionType.PRINT_CERTIFICATE
986
- ]);
987
- var workqueueActions = ActionTypes.exclude([
988
- ActionType.CREATE,
989
- ActionType.NOTIFY,
990
- ActionType.DETECT_DUPLICATE,
991
- ActionType.REJECT,
992
- ActionType.MARKED_AS_DUPLICATE,
993
- ActionType.ARCHIVE,
994
- ActionType.REQUEST_CORRECTION,
995
- ActionType.REJECT_CORRECTION,
996
- ActionType.APPROVE_CORRECTION
997
- ]);
998
- var META_ACTIONS = [
999
- ActionType.ASSIGN,
1000
- ActionType.UNASSIGN,
1001
- ActionType.READ
1002
- ];
1003
- function isMetaAction(actionType) {
1004
- return META_ACTIONS.includes(actionType);
1005
- }
1006
-
1007
994
  // ../commons/src/events/FormConfig.ts
1008
- var import_zod8 = require("zod");
1009
995
  var DeclarationFormConfig = import_zod8.z.object({
1010
996
  label: TranslationConfig.describe("Human readable description of the form"),
1011
997
  pages: import_zod8.z.array(FormPageConfig)
@@ -1087,8 +1073,7 @@ var PrintCertificateActionConfig = ActionConfigBase.merge(
1087
1073
  var RequestCorrectionConfig = ActionConfigBase.merge(
1088
1074
  import_zod9.z.object({
1089
1075
  type: import_zod9.z.literal(ActionType.REQUEST_CORRECTION),
1090
- onboardingForm: import_zod9.z.array(PageConfig),
1091
- additionalDetailsForm: import_zod9.z.array(PageConfig)
1076
+ correctionForm: ActionFormConfig
1092
1077
  })
1093
1078
  );
1094
1079
  var RejectCorrectionConfig = ActionConfigBase.merge(
@@ -1164,7 +1149,7 @@ var LanguageConfig = import_zod11.z.object({
1164
1149
  });
1165
1150
 
1166
1151
  // ../commons/src/events/EventConfig.ts
1167
- var import_zod20 = require("zod");
1152
+ var import_zod18 = require("zod");
1168
1153
 
1169
1154
  // ../commons/src/events/DeduplicationConfig.ts
1170
1155
  var import_zod12 = require("zod");
@@ -1301,600 +1286,164 @@ var BaseField3 = import_zod14.z.object({
1301
1286
  However, in advanced search we often want to make all Informant fields searchable,
1302
1287
  regardless of their original visibility logic. To do this, we explicitly set their
1303
1288
  'conditionals' to an empty array ('[]') in the search config. This ensures they
1304
- are always rendered in the advanced search form.
1305
- `
1306
- ),
1307
- validations: import_zod14.z.array(ValidationConfig).default([]).optional().describe(
1308
- `In advanced search, we sometimes need to override the default field validations.`
1309
- )
1310
- });
1311
- var SearchQueryParams = import_zod14.z.object({
1312
- eventType: import_zod14.z.string().optional().describe(
1313
- "Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
1314
- )
1315
- }).catchall(FieldValue);
1316
- var FieldConfigSchema = BaseField3.extend({
1317
- fieldId: import_zod14.z.string(),
1318
- fieldType: import_zod14.z.literal("field")
1319
- });
1320
- var EventFieldId = import_zod14.z.enum([
1321
- "trackingId",
1322
- "status",
1323
- "legalStatus.REGISTERED.createdAt",
1324
- "legalStatus.REGISTERED.createdAtLocation",
1325
- "updatedAt"
1326
- ]);
1327
- var EventFieldConfigSchema = BaseField3.extend({
1328
- fieldId: EventFieldId,
1329
- fieldType: import_zod14.z.literal("event")
1330
- });
1331
- var SearchField = import_zod14.z.discriminatedUnion("fieldType", [
1332
- FieldConfigSchema,
1333
- EventFieldConfigSchema
1334
- ]);
1335
- var AdvancedSearchConfig = import_zod14.z.object({
1336
- title: TranslationConfig.describe("Advanced search tab title"),
1337
- fields: import_zod14.z.array(SearchField).describe("Advanced search fields.")
1338
- });
1339
-
1340
- // ../commons/src/events/utils.ts
1341
- var import_lodash = require("lodash");
1342
-
1343
- // ../commons/src/events/ActionDocument.ts
1344
- var import_zod18 = require("zod");
1345
- var import_zod_openapi7 = require("zod-openapi");
1346
-
1347
- // ../commons/src/uuid.ts
1348
- var import_uuid = require("uuid");
1349
- var import_zod15 = require("zod");
1350
- var UUID = import_zod15.z.string().uuid().brand("UUID");
1351
- function getUUID() {
1352
- return (0, import_uuid.v4)();
1353
- }
1354
-
1355
- // ../commons/src/events/CreatedAtLocation.ts
1356
- var CreatedAtLocation = UUID.nullish();
1357
-
1358
- // ../commons/src/authentication.ts
1359
- var import_jwt_decode = __toESM(require("jwt-decode"));
1360
- var import_zod17 = require("zod");
1361
-
1362
- // ../commons/src/scopes.ts
1363
- var import_zod16 = require("zod");
1364
- var SCOPES = {
1365
- // TODO v1.8 legacy scopes
1366
- NATLSYSADMIN: "natlsysadmin",
1367
- BYPASSRATELIMIT: "bypassratelimit",
1368
- DECLARE: "declare",
1369
- REGISTER: "register",
1370
- VALIDATE: "validate",
1371
- DEMO: "demo",
1372
- CERTIFY: "certify",
1373
- PERFORMANCE: "performance",
1374
- SYSADMIN: "sysadmin",
1375
- TEAMS: "teams",
1376
- CONFIG: "config",
1377
- // systems / integrations
1378
- WEBHOOK: "webhook",
1379
- NATIONALID: "nationalId",
1380
- NOTIFICATION_API: "notification-api",
1381
- RECORDSEARCH: "recordsearch",
1382
- /**
1383
- * @TODO This is a temporary scope to be used for V2 Events custom events declaration
1384
- */
1385
- RECORD_DECLARE: "record.declare-birth",
1386
- // declare
1387
- RECORD_IMPORT: "record.import",
1388
- // declare
1389
- RECORD_DECLARE_BIRTH: "record.declare-birth",
1390
- RECORD_DECLARE_BIRTH_MY_JURISDICTION: "record.declare-birth:my-jurisdiction",
1391
- RECORD_DECLARE_DEATH: "record.declare-death",
1392
- RECORD_DECLARE_DEATH_MY_JURISDICTION: "record.declare-death:my-jurisdiction",
1393
- RECORD_DECLARE_MARRIAGE: "record.declare-marriage",
1394
- RECORD_DECLARE_MARRIAGE_MY_JURISDICTION: "record.declare-marriage:my-jurisdiction",
1395
- RECORD_SUBMIT_INCOMPLETE: "record.declaration-submit-incomplete",
1396
- RECORD_SUBMIT_FOR_REVIEW: "record.declaration-submit-for-review",
1397
- RECORD_UNASSIGN_OTHERS: "record.unassign-others",
1398
- // validate
1399
- RECORD_SUBMIT_FOR_APPROVAL: "record.declaration-submit-for-approval",
1400
- RECORD_SUBMIT_FOR_UPDATES: "record.declaration-submit-for-updates",
1401
- RECORD_DECLARATION_EDIT: "record.declaration-edit",
1402
- RECORD_REVIEW_DUPLICATES: "record.review-duplicates",
1403
- RECORD_DECLARATION_ARCHIVE: "record.declaration-archive",
1404
- RECORD_DECLARATION_REINSTATE: "record.declaration-reinstate",
1405
- // register
1406
- RECORD_REGISTER: "record.register",
1407
- // certify
1408
- RECORD_EXPORT_RECORDS: "record.export-records",
1409
- RECORD_DECLARATION_PRINT: "record.declaration-print",
1410
- RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS: "record.declaration-print-supporting-documents",
1411
- RECORD_REGISTRATION_PRINT: "record.registration-print",
1412
- // v1.8
1413
- /**
1414
- * This scope is used to **print and **issue certified copies of a record
1415
- * after it has been registered. Previously Registrars had this permission.
1416
- */
1417
- RECORD_PRINT_ISSUE_CERTIFIED_COPIES: "record.registration-print&issue-certified-copies",
1418
- RECORD_PRINT_CERTIFIED_COPIES: "record.registration-print-certified-copies",
1419
- // v1.8
1420
- RECORD_BULK_PRINT_CERTIFIED_COPIES: "record.registration-bulk-print-certified-copies",
1421
- // v1.8
1422
- RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES: "record.registration-verify-certified-copies",
1423
- // v1.8
1424
- // correct
1425
- RECORD_REGISTRATION_REQUEST_CORRECTION: "record.registration-request-correction",
1426
- RECORD_REGISTRATION_CORRECT: "record.registration-correct",
1427
- RECORD_REGISTRATION_REQUEST_REVOCATION: "record.registration-request-revocation",
1428
- // v1.8
1429
- RECORD_REGISTRATION_REVOKE: "record.registration-revoke",
1430
- // v1.8
1431
- RECORD_REGISTRATION_REQUEST_REINSTATEMENT: "record.registration-request-reinstatement",
1432
- // v1.8
1433
- RECORD_REGISTRATION_REINSTATE: "record.registration-reinstate",
1434
- // v1.8
1435
- RECORD_CONFIRM_REGISTRATION: "record.confirm-registration",
1436
- RECORD_REJECT_REGISTRATION: "record.reject-registration",
1437
- // search
1438
- SEARCH_BIRTH_MY_JURISDICTION: "search.birth:my-jurisdiction",
1439
- SEARCH_BIRTH: "search.birth",
1440
- SEARCH_DEATH_MY_JURISDICTION: "search.death:my-jurisdiction",
1441
- SEARCH_DEATH: "search.death",
1442
- SEARCH_MARRIAGE_MY_JURISDICTION: "search.marriage:my-jurisdiction",
1443
- SEARCH_MARRIAGE: "search.marriage",
1444
- // audit v1.8
1445
- RECORD_READ: "record.read",
1446
- RECORD_READ_AUDIT: "record.read-audit",
1447
- RECORD_READ_COMMENTS: "record.read-comments",
1448
- RECORD_CREATE_COMMENTS: "record.create-comments",
1449
- // profile
1450
- PROFILE_UPDATE: "profile.update",
1451
- //v1.8
1452
- PROFILE_ELECTRONIC_SIGNATURE: "profile.electronic-signature",
1453
- // performance
1454
- PERFORMANCE_READ: "performance.read",
1455
- PERFORMANCE_READ_DASHBOARDS: "performance.read-dashboards",
1456
- PERFORMANCE_EXPORT_VITAL_STATISTICS: "performance.vital-statistics-export",
1457
- // organisation
1458
- ORGANISATION_READ_LOCATIONS: "organisation.read-locations:all",
1459
- ORGANISATION_READ_LOCATIONS_MY_OFFICE: "organisation.read-locations:my-office",
1460
- ORGANISATION_READ_LOCATIONS_MY_JURISDICTION: "organisation.read-locations:my-jurisdiction",
1461
- // user
1462
- USER_READ: "user.read:all",
1463
- USER_READ_MY_OFFICE: "user.read:my-office",
1464
- USER_READ_MY_JURISDICTION: "user.read:my-jurisdiction",
1465
- USER_READ_ONLY_MY_AUDIT: "user.read:only-my-audit",
1466
- //v1.8
1467
- USER_CREATE: "user.create:all",
1468
- USER_CREATE_MY_JURISDICTION: "user.create:my-jurisdiction",
1469
- USER_UPDATE: "user.update:all",
1470
- USER_UPDATE_MY_JURISDICTION: "user.update:my-jurisdiction",
1471
- // config
1472
- CONFIG_UPDATE_ALL: "config.update:all",
1473
- // data seeding
1474
- USER_DATA_SEEDING: "user.data-seeding"
1475
- };
1476
- var LegacyScopes = import_zod16.z.union([
1477
- import_zod16.z.literal(SCOPES.NATLSYSADMIN),
1478
- import_zod16.z.literal(SCOPES.BYPASSRATELIMIT),
1479
- import_zod16.z.literal(SCOPES.DECLARE),
1480
- import_zod16.z.literal(SCOPES.REGISTER),
1481
- import_zod16.z.literal(SCOPES.VALIDATE),
1482
- import_zod16.z.literal(SCOPES.DEMO),
1483
- import_zod16.z.literal(SCOPES.CERTIFY),
1484
- import_zod16.z.literal(SCOPES.PERFORMANCE),
1485
- import_zod16.z.literal(SCOPES.SYSADMIN),
1486
- import_zod16.z.literal(SCOPES.TEAMS),
1487
- import_zod16.z.literal(SCOPES.CONFIG)
1488
- ]);
1489
- var IntegrationScopes = import_zod16.z.union([
1490
- import_zod16.z.literal(SCOPES.WEBHOOK),
1491
- import_zod16.z.literal(SCOPES.NATIONALID),
1492
- import_zod16.z.literal(SCOPES.NOTIFICATION_API),
1493
- import_zod16.z.literal(SCOPES.RECORDSEARCH)
1494
- ]);
1495
- var DeclareScopes = import_zod16.z.union([
1496
- import_zod16.z.literal(SCOPES.RECORD_DECLARE),
1497
- import_zod16.z.literal(SCOPES.RECORD_IMPORT),
1498
- import_zod16.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
1499
- import_zod16.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
1500
- import_zod16.z.literal(SCOPES.RECORD_DECLARE_DEATH),
1501
- import_zod16.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
1502
- import_zod16.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
1503
- import_zod16.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
1504
- import_zod16.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
1505
- import_zod16.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW)
1506
- ]);
1507
- var UnassignScope = import_zod16.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS);
1508
- var ValidateScopes = import_zod16.z.union([
1509
- import_zod16.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
1510
- import_zod16.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
1511
- import_zod16.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
1512
- import_zod16.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
1513
- import_zod16.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
1514
- import_zod16.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE)
1515
- ]);
1516
- var RegisterScope = import_zod16.z.literal(SCOPES.RECORD_REGISTER);
1517
- var CertifyScopes = import_zod16.z.union([
1518
- import_zod16.z.literal(SCOPES.RECORD_EXPORT_RECORDS),
1519
- import_zod16.z.literal(SCOPES.RECORD_DECLARATION_PRINT),
1520
- import_zod16.z.literal(SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS),
1521
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_PRINT),
1522
- import_zod16.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
1523
- import_zod16.z.literal(SCOPES.RECORD_PRINT_CERTIFIED_COPIES),
1524
- import_zod16.z.literal(SCOPES.RECORD_BULK_PRINT_CERTIFIED_COPIES),
1525
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES)
1526
- ]);
1527
- var CorrectionScopes = import_zod16.z.union([
1528
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
1529
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
1530
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REVOCATION),
1531
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REVOKE),
1532
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REINSTATEMENT),
1533
- import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REINSTATE),
1534
- import_zod16.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
1535
- import_zod16.z.literal(SCOPES.RECORD_REJECT_REGISTRATION)
1536
- ]);
1537
- var SearchScopes = import_zod16.z.union([
1538
- import_zod16.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
1539
- import_zod16.z.literal(SCOPES.SEARCH_BIRTH),
1540
- import_zod16.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
1541
- import_zod16.z.literal(SCOPES.SEARCH_DEATH),
1542
- import_zod16.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
1543
- import_zod16.z.literal(SCOPES.SEARCH_MARRIAGE)
1544
- ]);
1545
- var AuditScopes = import_zod16.z.union([
1546
- import_zod16.z.literal(SCOPES.RECORD_READ),
1547
- import_zod16.z.literal(SCOPES.RECORD_READ_AUDIT),
1548
- import_zod16.z.literal(SCOPES.RECORD_READ_COMMENTS),
1549
- import_zod16.z.literal(SCOPES.RECORD_CREATE_COMMENTS)
1550
- ]);
1551
- var ProfileScopes = import_zod16.z.union([
1552
- import_zod16.z.literal(SCOPES.PROFILE_UPDATE),
1553
- import_zod16.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE)
1554
- ]);
1555
- var PerformanceScopes = import_zod16.z.union([
1556
- import_zod16.z.literal(SCOPES.PERFORMANCE_READ),
1557
- import_zod16.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
1558
- import_zod16.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS)
1559
- ]);
1560
- var OrganisationScopes = import_zod16.z.union([
1561
- import_zod16.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
1562
- import_zod16.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
1563
- import_zod16.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION)
1564
- ]);
1565
- var UserScopes = import_zod16.z.union([
1566
- import_zod16.z.literal(SCOPES.USER_READ),
1567
- import_zod16.z.literal(SCOPES.USER_READ_MY_OFFICE),
1568
- import_zod16.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
1569
- import_zod16.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
1570
- import_zod16.z.literal(SCOPES.USER_CREATE),
1571
- import_zod16.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
1572
- import_zod16.z.literal(SCOPES.USER_UPDATE),
1573
- import_zod16.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION)
1574
- ]);
1575
- var ConfigScope = import_zod16.z.literal(SCOPES.CONFIG_UPDATE_ALL);
1576
- var DataSeedingScope = import_zod16.z.literal(SCOPES.USER_DATA_SEEDING);
1577
- var LiteralScopes = import_zod16.z.union([
1578
- LegacyScopes,
1579
- IntegrationScopes,
1580
- UnassignScope,
1581
- DeclareScopes,
1582
- ValidateScopes,
1583
- RegisterScope,
1584
- CertifyScopes,
1585
- CorrectionScopes,
1586
- SearchScopes,
1587
- AuditScopes,
1588
- ProfileScopes,
1589
- PerformanceScopes,
1590
- OrganisationScopes,
1591
- UserScopes,
1592
- ConfigScope,
1593
- DataSeedingScope
1594
- ]);
1595
- var rawConfigurableScopeRegex = /^([a-zA-Z\.]+)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
1596
- var rawConfigurableScope = import_zod16.z.string().regex(rawConfigurableScopeRegex);
1597
- var CreateUserScope = import_zod16.z.object({
1598
- type: import_zod16.z.literal("user.create"),
1599
- options: import_zod16.z.object({
1600
- role: import_zod16.z.array(import_zod16.z.string())
1601
- })
1602
- });
1603
- var EditUserScope = import_zod16.z.object({
1604
- type: import_zod16.z.literal("user.edit"),
1605
- options: import_zod16.z.object({
1606
- role: import_zod16.z.array(import_zod16.z.string())
1607
- })
1608
- });
1609
- var WorkqueueScope = import_zod16.z.object({
1610
- type: import_zod16.z.literal("workqueue"),
1611
- options: import_zod16.z.object({
1612
- id: import_zod16.z.array(import_zod16.z.string())
1613
- })
1289
+ are always rendered in the advanced search form.
1290
+ `
1291
+ )
1614
1292
  });
1615
- var NotifyRecordScope = import_zod16.z.object({
1616
- type: import_zod16.z.literal("record.notify"),
1617
- options: import_zod16.z.object({
1618
- event: import_zod16.z.array(import_zod16.z.string())
1619
- })
1293
+ var SearchQueryParams = import_zod14.z.object({
1294
+ eventType: import_zod14.z.string().optional().describe(
1295
+ "Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
1296
+ )
1297
+ }).catchall(FieldValue);
1298
+ var FieldConfigSchema = BaseField3.extend({
1299
+ fieldId: import_zod14.z.string(),
1300
+ fieldType: import_zod14.z.literal("field")
1620
1301
  });
1621
- var ConfigurableScopes = import_zod16.z.discriminatedUnion("type", [
1622
- CreateUserScope,
1623
- EditUserScope,
1624
- WorkqueueScope,
1625
- NotifyRecordScope
1302
+ var EventFieldId = import_zod14.z.enum([
1303
+ "trackingId",
1304
+ "status",
1305
+ "legalStatus.REGISTERED.createdAt",
1306
+ "legalStatus.REGISTERED.createdAtLocation",
1307
+ "updatedAt"
1626
1308
  ]);
1627
- var scopes = Object.values(SCOPES);
1628
- var ActionScopes = import_zod16.z.union([
1629
- DeclareScopes,
1630
- ValidateScopes,
1631
- RegisterScope,
1632
- CertifyScopes,
1633
- 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
1634
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
+ });
1635
1321
 
1636
- // ../commons/src/authentication.ts
1637
- var DEFAULT_ROLES_DEFINITION = [
1638
- {
1639
- id: "FIELD_AGENT",
1640
- label: {
1641
- defaultMessage: "Field Agent",
1642
- description: "Name for user role Field Agent",
1643
- id: "userRole.fieldAgent"
1644
- },
1645
- scopes: [
1646
- // new scopes
1647
- SCOPES.RECORD_DECLARE_BIRTH,
1648
- SCOPES.RECORD_DECLARE_DEATH,
1649
- SCOPES.RECORD_DECLARE_MARRIAGE,
1650
- SCOPES.RECORD_SUBMIT_INCOMPLETE,
1651
- SCOPES.RECORD_SUBMIT_FOR_REVIEW,
1652
- SCOPES.SEARCH_BIRTH,
1653
- SCOPES.SEARCH_DEATH,
1654
- SCOPES.SEARCH_MARRIAGE
1655
- ]
1656
- },
1657
- {
1658
- id: "REGISTRATION_AGENT",
1659
- label: {
1660
- defaultMessage: "Registration Agent",
1661
- description: "Name for user role Registration Agent",
1662
- id: "userRole.registrationAgent"
1663
- },
1664
- scopes: [
1665
- SCOPES.PERFORMANCE,
1666
- SCOPES.CERTIFY,
1667
- SCOPES.RECORD_DECLARE_BIRTH,
1668
- SCOPES.RECORD_DECLARE_DEATH,
1669
- SCOPES.RECORD_DECLARE_MARRIAGE,
1670
- SCOPES.RECORD_SUBMIT_FOR_APPROVAL,
1671
- SCOPES.RECORD_SUBMIT_FOR_UPDATES,
1672
- SCOPES.RECORD_DECLARATION_ARCHIVE,
1673
- SCOPES.RECORD_DECLARATION_REINSTATE,
1674
- SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION,
1675
- SCOPES.RECORD_REGISTRATION_PRINT,
1676
- SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS,
1677
- SCOPES.RECORD_EXPORT_RECORDS,
1678
- SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES,
1679
- SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES,
1680
- SCOPES.RECORD_CREATE_COMMENTS,
1681
- SCOPES.PERFORMANCE_READ,
1682
- SCOPES.PERFORMANCE_READ_DASHBOARDS,
1683
- SCOPES.ORGANISATION_READ_LOCATIONS,
1684
- SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE,
1685
- SCOPES.SEARCH_BIRTH,
1686
- SCOPES.SEARCH_DEATH,
1687
- SCOPES.SEARCH_MARRIAGE
1688
- ]
1689
- },
1690
- {
1691
- id: "LOCAL_REGISTRAR",
1692
- label: {
1693
- defaultMessage: "Local Registrar",
1694
- description: "Name for user role Local Registrar",
1695
- id: "userRole.localRegistrar"
1696
- },
1697
- scopes: [
1698
- SCOPES.PERFORMANCE,
1699
- SCOPES.CERTIFY,
1700
- SCOPES.RECORD_DECLARE_BIRTH,
1701
- SCOPES.RECORD_DECLARE_DEATH,
1702
- SCOPES.RECORD_DECLARE_MARRIAGE,
1703
- SCOPES.RECORD_SUBMIT_FOR_UPDATES,
1704
- SCOPES.RECORD_REVIEW_DUPLICATES,
1705
- SCOPES.RECORD_DECLARATION_ARCHIVE,
1706
- SCOPES.RECORD_DECLARATION_REINSTATE,
1707
- SCOPES.RECORD_REGISTER,
1708
- SCOPES.RECORD_REGISTRATION_CORRECT,
1709
- SCOPES.RECORD_REGISTRATION_PRINT,
1710
- SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS,
1711
- SCOPES.RECORD_EXPORT_RECORDS,
1712
- SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES,
1713
- SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES,
1714
- SCOPES.RECORD_CREATE_COMMENTS,
1715
- SCOPES.PERFORMANCE_READ,
1716
- SCOPES.PERFORMANCE_READ_DASHBOARDS,
1717
- SCOPES.ORGANISATION_READ_LOCATIONS,
1718
- SCOPES.PROFILE_ELECTRONIC_SIGNATURE,
1719
- SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE,
1720
- SCOPES.SEARCH_BIRTH,
1721
- SCOPES.SEARCH_DEATH,
1722
- SCOPES.SEARCH_MARRIAGE
1723
- ]
1724
- },
1725
- {
1726
- id: "LOCAL_SYSTEM_ADMIN",
1727
- label: {
1728
- defaultMessage: "Local System Admin",
1729
- description: "Name for user role Local System Admin",
1730
- id: "userRole.localSystemAdmin"
1731
- },
1732
- scopes: [
1733
- SCOPES.SYSADMIN,
1734
- SCOPES.USER_READ_MY_OFFICE,
1735
- SCOPES.USER_CREATE_MY_JURISDICTION,
1736
- SCOPES.USER_UPDATE_MY_JURISDICTION,
1737
- SCOPES.ORGANISATION_READ_LOCATIONS,
1738
- SCOPES.PERFORMANCE_READ,
1739
- SCOPES.PERFORMANCE_READ_DASHBOARDS,
1740
- SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS
1741
- // 'organisation.read-users' ?
1742
- ]
1743
- },
1744
- {
1745
- id: "NATIONAL_SYSTEM_ADMIN",
1746
- label: {
1747
- defaultMessage: "National System Admin",
1748
- description: "Name for user role National System Admin",
1749
- id: "userRole.nationalSystemAdmin"
1750
- },
1751
- scopes: [
1752
- SCOPES.SYSADMIN,
1753
- SCOPES.NATLSYSADMIN,
1754
- SCOPES.USER_CREATE,
1755
- SCOPES.USER_READ,
1756
- SCOPES.USER_UPDATE,
1757
- SCOPES.ORGANISATION_READ_LOCATIONS,
1758
- SCOPES.PERFORMANCE_READ,
1759
- SCOPES.PERFORMANCE_READ_DASHBOARDS,
1760
- SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS
1761
- // 'organisation.read-users' ?
1762
- ]
1763
- },
1764
- {
1765
- id: "PERFORMANCE_MANAGER",
1766
- label: {
1767
- defaultMessage: "Performance Manager",
1768
- description: "Name for user role Performance Manager",
1769
- id: "userRole.performanceManager"
1770
- },
1771
- scopes: [
1772
- SCOPES.PERFORMANCE,
1773
- SCOPES.PERFORMANCE_READ,
1774
- SCOPES.PERFORMANCE_READ_DASHBOARDS,
1775
- SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS
1776
- ]
1777
- }
1778
- ];
1779
- var TokenUserType = import_zod17.z.enum(["user", "system"]);
1780
- 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();
1781
1332
 
1782
1333
  // ../commons/src/events/ActionDocument.ts
1783
- (0, import_zod_openapi7.extendZodWithOpenApi)(import_zod18.z);
1784
- var ActionUpdate = import_zod18.z.record(import_zod18.z.string(), FieldUpdateValue);
1785
- var EventState = import_zod18.z.record(import_zod18.z.string(), FieldValue);
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);
1786
1337
  var ActionStatus = {
1787
1338
  Requested: "Requested",
1788
1339
  Accepted: "Accepted",
1789
1340
  Rejected: "Rejected"
1790
1341
  };
1791
- var ActionBase = import_zod18.z.object({
1792
- id: UUID,
1793
- transactionId: import_zod18.z.string(),
1794
- createdByUserType: TokenUserType,
1795
- createdAt: import_zod18.z.string().datetime(),
1796
- createdBy: import_zod18.z.string(),
1797
- createdByRole: import_zod18.z.string(),
1798
- createdBySignature: import_zod18.z.string().nullish().describe("Reference to signature of the user who created the action"),
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"),
1799
1349
  createdAtLocation: CreatedAtLocation,
1800
1350
  declaration: ActionUpdate,
1801
- annotation: ActionUpdate.optional().nullable(),
1802
- status: import_zod18.z.enum([
1351
+ annotation: ActionUpdate.optional(),
1352
+ status: import_zod16.z.enum([
1803
1353
  ActionStatus.Requested,
1804
1354
  ActionStatus.Accepted,
1805
1355
  ActionStatus.Rejected
1806
1356
  ]),
1807
1357
  // If the action is an asynchronous confirmation for another action, we will save the original action id here.
1808
- originalActionId: UUID.optional().nullable().describe(
1809
- "Reference to the original action that was asynchronously rejected or accepted by 3rd party integration."
1810
- )
1358
+ originalActionId: import_zod16.z.string().optional()
1811
1359
  });
1812
1360
  var AssignedAction = ActionBase.merge(
1813
- import_zod18.z.object({
1814
- type: import_zod18.z.literal(ActionType.ASSIGN),
1815
- assignedTo: import_zod18.z.string()
1361
+ import_zod16.z.object({
1362
+ type: import_zod16.z.literal(ActionType.ASSIGN),
1363
+ assignedTo: import_zod16.z.string()
1816
1364
  })
1817
1365
  );
1818
1366
  var UnassignedAction = ActionBase.merge(
1819
- import_zod18.z.object({
1820
- 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)
1821
1370
  })
1822
1371
  );
1823
1372
  var RegisterAction = ActionBase.merge(
1824
- import_zod18.z.object({
1825
- type: import_zod18.z.literal(ActionType.REGISTER),
1826
- 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()
1827
1376
  })
1828
1377
  );
1829
1378
  var DeclareAction = ActionBase.merge(
1830
- import_zod18.z.object({
1831
- type: import_zod18.z.literal(ActionType.DECLARE)
1379
+ import_zod16.z.object({
1380
+ type: import_zod16.z.literal(ActionType.DECLARE)
1832
1381
  })
1833
1382
  );
1834
1383
  var ValidateAction = ActionBase.merge(
1835
- import_zod18.z.object({
1836
- type: import_zod18.z.literal(ActionType.VALIDATE)
1384
+ import_zod16.z.object({
1385
+ type: import_zod16.z.literal(ActionType.VALIDATE)
1837
1386
  })
1838
1387
  );
1839
- var RejectionReason = import_zod18.z.object({
1840
- message: import_zod18.z.string().min(1, { message: "Message cannot be empty" }).describe("Message describing reason for rejection or archiving"),
1841
- isDuplicate: import_zod18.z.boolean().optional().describe("If a declaration is duplicated")
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")
1842
1391
  });
1843
1392
  var RejectAction = ActionBase.merge(
1844
- import_zod18.z.object({
1845
- type: import_zod18.z.literal(ActionType.REJECT),
1393
+ import_zod16.z.object({
1394
+ type: import_zod16.z.literal(ActionType.REJECT),
1846
1395
  reason: RejectionReason
1847
1396
  })
1848
1397
  );
1849
1398
  var MarkAsDuplicateAction = ActionBase.merge(
1850
- import_zod18.z.object({
1851
- type: import_zod18.z.literal(ActionType.MARKED_AS_DUPLICATE)
1399
+ import_zod16.z.object({
1400
+ type: import_zod16.z.literal(ActionType.MARKED_AS_DUPLICATE)
1852
1401
  })
1853
1402
  );
1854
1403
  var ArchiveAction = ActionBase.merge(
1855
- import_zod18.z.object({
1856
- type: import_zod18.z.literal(ActionType.ARCHIVE),
1404
+ import_zod16.z.object({
1405
+ type: import_zod16.z.literal(ActionType.ARCHIVE),
1857
1406
  reason: RejectionReason
1858
1407
  })
1859
1408
  );
1860
1409
  var CreatedAction = ActionBase.merge(
1861
- import_zod18.z.object({
1862
- type: import_zod18.z.literal(ActionType.CREATE)
1410
+ import_zod16.z.object({
1411
+ type: import_zod16.z.literal(ActionType.CREATE)
1863
1412
  })
1864
1413
  );
1865
1414
  var NotifiedAction = ActionBase.merge(
1866
- import_zod18.z.object({
1867
- type: import_zod18.z.literal(ActionType.NOTIFY)
1415
+ import_zod16.z.object({
1416
+ type: import_zod16.z.literal(ActionType.NOTIFY)
1868
1417
  })
1869
1418
  );
1870
1419
  var PrintCertificateAction = ActionBase.merge(
1871
- import_zod18.z.object({
1872
- type: import_zod18.z.literal(ActionType.PRINT_CERTIFICATE)
1420
+ import_zod16.z.object({
1421
+ type: import_zod16.z.literal(ActionType.PRINT_CERTIFICATE)
1873
1422
  })
1874
1423
  );
1875
1424
  var RequestedCorrectionAction = ActionBase.merge(
1876
- import_zod18.z.object({
1877
- type: import_zod18.z.literal(ActionType.REQUEST_CORRECTION)
1425
+ import_zod16.z.object({
1426
+ type: import_zod16.z.literal(ActionType.REQUEST_CORRECTION)
1878
1427
  })
1879
1428
  );
1880
1429
  var ApprovedCorrectionAction = ActionBase.merge(
1881
- import_zod18.z.object({
1882
- type: import_zod18.z.literal(ActionType.APPROVE_CORRECTION),
1883
- 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()
1884
1433
  })
1885
1434
  );
1886
1435
  var RejectedCorrectionAction = ActionBase.merge(
1887
- import_zod18.z.object({
1888
- type: import_zod18.z.literal(ActionType.REJECT_CORRECTION),
1889
- 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()
1890
1439
  })
1891
1440
  );
1892
1441
  var ReadAction = ActionBase.merge(
1893
- import_zod18.z.object({
1894
- type: import_zod18.z.literal(ActionType.READ)
1442
+ import_zod16.z.object({
1443
+ type: import_zod16.z.literal(ActionType.READ)
1895
1444
  })
1896
1445
  );
1897
- var ActionDocument = import_zod18.z.discriminatedUnion("type", [
1446
+ var ActionDocument = import_zod16.z.discriminatedUnion("type", [
1898
1447
  CreatedAction.openapi({ ref: "CreatedAction" }),
1899
1448
  ValidateAction.openapi({ ref: "ValidateAction" }),
1900
1449
  RejectAction.openapi({ ref: "RejectAction" }),
@@ -1917,20 +1466,20 @@ var AsyncRejectActionDocument = ActionBase.omit({
1917
1466
  declaration: true,
1918
1467
  annotation: true
1919
1468
  }).merge(
1920
- import_zod18.z.object({
1921
- type: import_zod18.z.enum(ConfirmableActions),
1922
- 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)
1923
1472
  })
1924
1473
  );
1925
- var Action = import_zod18.z.union([ActionDocument, AsyncRejectActionDocument]);
1926
- var ResolvedUser = import_zod18.z.object({
1927
- id: import_zod18.z.string(),
1928
- role: import_zod18.z.string(),
1929
- name: import_zod18.z.array(
1930
- import_zod18.z.object({
1931
- use: import_zod18.z.string(),
1932
- given: import_zod18.z.array(import_zod18.z.string()),
1933
- family: import_zod18.z.string()
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()
1934
1483
  })
1935
1484
  )
1936
1485
  });
@@ -1941,7 +1490,7 @@ var import_ajv_formats = __toESM(require("ajv-formats"));
1941
1490
  var import_date_fns = require("date-fns");
1942
1491
 
1943
1492
  // ../commons/src/events/FieldTypeMapping.ts
1944
- var import_zod19 = require("zod");
1493
+ var import_zod17 = require("zod");
1945
1494
  function mapFieldTypeToZod(type, required) {
1946
1495
  let schema;
1947
1496
  switch (type) {
@@ -2001,7 +1550,7 @@ function createValidationSchema(config) {
2001
1550
  for (const field2 of config) {
2002
1551
  shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
2003
1552
  }
2004
- return import_zod19.z.object(shape);
1553
+ return import_zod17.z.object(shape);
2005
1554
  }
2006
1555
  function mapFieldTypeToEmptyValue(field2) {
2007
1556
  switch (field2.type) {
@@ -2141,29 +1690,6 @@ var ajv = new import_ajv.default({
2141
1690
  allowUnionTypes: true
2142
1691
  });
2143
1692
  (0, import_ajv_formats.default)(ajv);
2144
- ajv.addKeyword({
2145
- keyword: "daysFromNow",
2146
- type: "string",
2147
- schemaType: "object",
2148
- $data: true,
2149
- errors: true,
2150
- validate(schema, data, _, dataContext) {
2151
- if (!(dataContext && dataContext.rootData && typeof dataContext.rootData === "object" && "$now" in dataContext.rootData && typeof dataContext.rootData.$now === "string")) {
2152
- throw new Error("Validation context must contain $now");
2153
- }
2154
- const { days, clause } = schema;
2155
- if (typeof data !== "string") {
2156
- return false;
2157
- }
2158
- const date = new Date(data);
2159
- if (isNaN(date.getTime())) {
2160
- return false;
2161
- }
2162
- const now = new Date(dataContext.rootData.$now);
2163
- const offsetDate = new Date(now.getTime() + days * 24 * 60 * 60 * 1e3);
2164
- return clause === "after" ? (0, import_date_fns.isAfter)(date, offsetDate) : (0, import_date_fns.isBefore)(date, offsetDate);
2165
- }
2166
- });
2167
1693
  function validate(schema, data) {
2168
1694
  return ajv.validate(schema, data);
2169
1695
  }
@@ -2377,6 +1903,12 @@ function getValidatorsForField(fieldId, validations) {
2377
1903
  }).filter((x) => x !== null);
2378
1904
  }
2379
1905
 
1906
+ // ../commons/src/uuid.ts
1907
+ var import_uuid = require("uuid");
1908
+ function getUUID() {
1909
+ return (0, import_uuid.v4)();
1910
+ }
1911
+
2380
1912
  // ../commons/src/utils.ts
2381
1913
  function getOrThrow(x, message) {
2382
1914
  if (x === void 0 || x === null) {
@@ -2384,9 +1916,6 @@ function getOrThrow(x, message) {
2384
1916
  }
2385
1917
  return x;
2386
1918
  }
2387
- function joinValues(values, separator = " ") {
2388
- return values.filter((value) => !!value).join(separator).trim();
2389
- }
2390
1919
 
2391
1920
  // ../commons/src/events/utils.ts
2392
1921
  function isDeclarationActionConfig(action) {
@@ -2403,10 +1932,7 @@ function getDeclaration(configuration) {
2403
1932
  }
2404
1933
  var getActionAnnotationFields = (actionConfig) => {
2405
1934
  if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
2406
- return [
2407
- ...actionConfig.onboardingForm.flatMap(({ fields }) => fields),
2408
- ...actionConfig.additionalDetailsForm.flatMap(({ fields }) => fields)
2409
- ];
1935
+ return actionConfig.correctionForm.pages.flatMap(({ fields }) => fields);
2410
1936
  }
2411
1937
  if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
2412
1938
  return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
@@ -2429,7 +1955,7 @@ function getDeclarationFieldById(config, fieldId) {
2429
1955
  var findRecordActionPages = (config, actionType) => {
2430
1956
  const action = config.actions.find((a) => a.type === actionType);
2431
1957
  if (action?.type === ActionType.REQUEST_CORRECTION) {
2432
- return [...action.onboardingForm, ...action.additionalDetailsForm];
1958
+ return action.correctionForm.pages;
2433
1959
  }
2434
1960
  if (action?.type === ActionType.PRINT_CERTIFICATE) {
2435
1961
  return action.printForm.pages;
@@ -2486,9 +2012,8 @@ function createEmptyDraft(eventId, draftId, actionType) {
2486
2012
  declaration: {},
2487
2013
  annotation: {},
2488
2014
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
2489
- createdByUserType: TokenUserType.Enum.user,
2490
2015
  createdBy: "@todo",
2491
- createdAtLocation: "00000000-0000-0000-0000-000000000000",
2016
+ createdAtLocation: "@todo",
2492
2017
  status: ActionStatus.Accepted,
2493
2018
  transactionId: "@todo",
2494
2019
  createdByRole: "@todo"
@@ -2503,13 +2028,10 @@ function getVisibleVerificationPageIds(pages, annotation) {
2503
2028
  }
2504
2029
  function getActionVerificationPageIds(actionConfig, annotation) {
2505
2030
  if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
2506
- return [
2507
- ...getVisibleVerificationPageIds(actionConfig.onboardingForm, annotation),
2508
- ...getVisibleVerificationPageIds(
2509
- actionConfig.additionalDetailsForm,
2510
- annotation
2511
- )
2512
- ];
2031
+ return getVisibleVerificationPageIds(
2032
+ actionConfig.correctionForm.pages,
2033
+ annotation
2034
+ );
2513
2035
  }
2514
2036
  if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
2515
2037
  return getVisibleVerificationPageIds(
@@ -2591,9 +2113,9 @@ function getEventConfigById(eventConfigs, id) {
2591
2113
 
2592
2114
  // ../commons/src/events/EventConfig.ts
2593
2115
  var import_zod_openapi8 = require("zod-openapi");
2594
- (0, import_zod_openapi8.extendZodWithOpenApi)(import_zod20.z);
2595
- var EventConfig = import_zod20.z.object({
2596
- 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(
2597
2119
  'A machine-readable identifier for the event, e.g. "birth" or "death"'
2598
2120
  ),
2599
2121
  dateOfEvent: FieldReference.optional(),
@@ -2603,10 +2125,10 @@ var EventConfig = import_zod20.z.object({
2603
2125
  ),
2604
2126
  summary: SummaryConfig,
2605
2127
  label: TranslationConfig,
2606
- actions: import_zod20.z.array(ActionConfig),
2128
+ actions: import_zod18.z.array(ActionConfig),
2607
2129
  declaration: DeclarationFormConfig,
2608
- deduplication: import_zod20.z.array(DeduplicationConfig).optional().default([]),
2609
- 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([])
2610
2132
  }).superRefine((event2, ctx) => {
2611
2133
  const allFields = findAllFields(event2);
2612
2134
  const fieldIds = allFields.map((field2) => field2.id);
@@ -2668,12 +2190,12 @@ var definePage = (page) => PageConfig.parse(page);
2668
2190
  var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
2669
2191
 
2670
2192
  // ../commons/src/events/WorkqueueConfig.ts
2671
- var import_zod27 = require("zod");
2193
+ var import_zod25 = require("zod");
2672
2194
 
2673
2195
  // ../commons/src/events/serializers/user/serializer.ts
2674
- var import_zod21 = require("zod");
2675
- var SerializedUserField = import_zod21.z.object({
2676
- $userField: import_zod21.z.enum([
2196
+ var import_zod19 = require("zod");
2197
+ var SerializedUserField = import_zod19.z.object({
2198
+ $userField: import_zod19.z.enum([
2677
2199
  "id",
2678
2200
  "name",
2679
2201
  "role",
@@ -2781,6 +2303,9 @@ function createEventConditionals() {
2781
2303
  })
2782
2304
  };
2783
2305
  }
2306
+ function getDateFromNow(days) {
2307
+ return new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
2308
+ }
2784
2309
  function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
2785
2310
  return {
2786
2311
  type: "object",
@@ -2799,20 +2324,6 @@ function isFieldReference(value) {
2799
2324
  return typeof value === "object" && value !== null && "$$field" in value;
2800
2325
  }
2801
2326
  function createFieldConditionals(fieldId) {
2802
- const getDayRange = (days, clause) => ({
2803
- type: "object",
2804
- properties: {
2805
- [fieldId]: {
2806
- type: "string",
2807
- format: "date",
2808
- daysFromNow: {
2809
- days,
2810
- clause
2811
- }
2812
- }
2813
- },
2814
- required: [fieldId]
2815
- });
2816
2327
  const getDateRange = (date, clause) => ({
2817
2328
  type: "object",
2818
2329
  properties: {
@@ -2831,8 +2342,12 @@ function createFieldConditionals(fieldId) {
2831
2342
  $$field: fieldId,
2832
2343
  isAfter: () => ({
2833
2344
  days: (days) => ({
2834
- inPast: () => defineFormConditional(getDayRange(-days, "after")),
2835
- inFuture: () => defineFormConditional(getDayRange(days, "after"))
2345
+ inPast: () => defineFormConditional(
2346
+ getDateRange(getDateFromNow(days), "formatMinimum")
2347
+ ),
2348
+ inFuture: () => defineFormConditional(
2349
+ getDateRange(getDateFromNow(-days), "formatMinimum")
2350
+ )
2836
2351
  }),
2837
2352
  date: (date) => {
2838
2353
  if (isFieldReference(date)) {
@@ -2847,12 +2362,16 @@ function createFieldConditionals(fieldId) {
2847
2362
  }
2848
2363
  return defineFormConditional(getDateRange(date, "formatMinimum"));
2849
2364
  },
2850
- now: () => defineFormConditional(getDateRange({ $data: "/$now" }, "formatMinimum"))
2365
+ now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMinimum"))
2851
2366
  }),
2852
2367
  isBefore: () => ({
2853
2368
  days: (days) => ({
2854
- inPast: () => defineFormConditional(getDayRange(days, "before")),
2855
- inFuture: () => defineFormConditional(getDayRange(-days, "before"))
2369
+ inPast: () => defineFormConditional(
2370
+ getDateRange(getDateFromNow(days), "formatMaximum")
2371
+ ),
2372
+ inFuture: () => defineFormConditional(
2373
+ getDateRange(getDateFromNow(-days), "formatMaximum")
2374
+ )
2856
2375
  }),
2857
2376
  date: (date) => {
2858
2377
  if (isFieldReference(date)) {
@@ -2867,7 +2386,7 @@ function createFieldConditionals(fieldId) {
2867
2386
  }
2868
2387
  return defineFormConditional(getDateRange(date, "formatMaximum"));
2869
2388
  },
2870
- now: () => defineFormConditional(getDateRange({ $data: "/$now" }, "formatMaximum"))
2389
+ now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMaximum"))
2871
2390
  }),
2872
2391
  isEqualTo: (value) => {
2873
2392
  if (isFieldReference(value)) {
@@ -3079,11 +2598,11 @@ var event = Object.assign(eventFn, {
3079
2598
  });
3080
2599
 
3081
2600
  // ../commons/src/events/WorkqueueColumnConfig.ts
3082
- var import_zod23 = require("zod");
2601
+ var import_zod21 = require("zod");
3083
2602
 
3084
2603
  // ../commons/src/events/EventMetadata.ts
3085
- var import_zod22 = require("zod");
3086
- var EventStatus = import_zod22.z.enum([
2604
+ var import_zod20 = require("zod");
2605
+ var EventStatus = import_zod20.z.enum([
3087
2606
  "CREATED",
3088
2607
  "NOTIFIED",
3089
2608
  "DECLARED",
@@ -3093,69 +2612,60 @@ var EventStatus = import_zod22.z.enum([
3093
2612
  "REJECTED",
3094
2613
  "ARCHIVED"
3095
2614
  ]);
3096
- var InherentFlags = {
3097
- PRINTED: "printed",
3098
- INCOMPLETE: "incomplete",
3099
- REJECTED: "rejected",
3100
- CORRECTION_REQUESTED: "correction-requested"
2615
+ var CustomFlags = {
2616
+ CERTIFICATE_PRINTED: "certificate-printed"
3101
2617
  };
3102
- var Flag = import_zod22.z.string().regex(
2618
+ var Flag = import_zod20.z.string().regex(
3103
2619
  new RegExp(
3104
2620
  `^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
3105
2621
  ActionStatus
3106
2622
  ).join("|").toLowerCase()})$`
3107
2623
  ),
3108
2624
  "Flag must be in the format ActionType:ActionStatus (lowerCase)"
3109
- ).or(import_zod22.z.nativeEnum(InherentFlags));
3110
- var ZodDate = import_zod22.z.string().date();
3111
- var ActionCreationMetadata = import_zod22.z.object({
3112
- createdAt: import_zod22.z.string().datetime().describe("The timestamp when the action request was created."),
3113
- 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."),
3114
2630
  createdAtLocation: CreatedAtLocation.describe(
3115
2631
  "Location of the user who created the action request."
3116
2632
  ),
3117
- createdByUserType: import_zod22.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
3118
- acceptedAt: import_zod22.z.string().datetime().describe("Timestamp when the action request was accepted."),
3119
- createdByRole: import_zod22.z.string().describe("Role of the user at the time of action request creation."),
3120
- 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.")
3121
2636
  });
3122
2637
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
3123
- registrationNumber: import_zod22.z.string().describe(
2638
+ registrationNumber: import_zod20.z.string().describe(
3124
2639
  "Registration number of the event. Always present for accepted registrations."
3125
2640
  )
3126
2641
  });
3127
- var LegalStatuses = import_zod22.z.object({
2642
+ var LegalStatuses = import_zod20.z.object({
3128
2643
  [EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
3129
2644
  [EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
3130
2645
  });
3131
- var EventMetadata = import_zod22.z.object({
3132
- id: UUID,
3133
- 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."),
3134
2649
  status: EventStatus,
3135
2650
  legalStatuses: LegalStatuses.describe(
3136
2651
  "Metadata related to the legal registration of the event, such as who registered it and when."
3137
2652
  ),
3138
- 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."),
3139
2654
  dateOfEvent: ZodDate.nullish(),
3140
- createdBy: import_zod22.z.string().describe("ID of the user who created the event."),
3141
- createdByUserType: import_zod22.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
3142
- 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."),
3143
2657
  createdAtLocation: CreatedAtLocation.describe(
3144
2658
  "Location of the user who created the event."
3145
2659
  ),
3146
- createdBySignature: import_zod22.z.string().nullish().describe("Signature of the user who created the event."),
3147
- updatedAtLocation: UUID.nullish().describe(
3148
- "Location of the user who last changed the status."
3149
- ),
3150
- updatedAt: import_zod22.z.string().datetime().describe(
3151
- "Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
3152
- ),
3153
- assignedTo: import_zod22.z.string().nullish().describe("ID of the user currently assigned to the event."),
3154
- updatedBy: import_zod22.z.string().nullish().describe("ID of the user who last changed the status."),
3155
- 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(
3156
2666
  "System-generated tracking ID used by informants or registrars to look up the event."
3157
2667
  ),
3158
- flags: import_zod22.z.array(Flag)
2668
+ flags: import_zod20.z.array(Flag)
3159
2669
  });
3160
2670
  var EventMetadataKeysArray = [
3161
2671
  "id",
@@ -3164,7 +2674,6 @@ var EventMetadataKeysArray = [
3164
2674
  "createdAt",
3165
2675
  "dateOfEvent",
3166
2676
  "createdBy",
3167
- "createdByUserType",
3168
2677
  "updatedByUserRole",
3169
2678
  "createdAtLocation",
3170
2679
  "updatedAtLocation",
@@ -3175,7 +2684,7 @@ var EventMetadataKeysArray = [
3175
2684
  "legalStatuses",
3176
2685
  "flags"
3177
2686
  ];
3178
- var EventMetadataKeys = import_zod22.z.enum(EventMetadataKeysArray);
2687
+ var EventMetadataKeys = import_zod20.z.enum(EventMetadataKeysArray);
3179
2688
  var eventMetadataLabelMap = {
3180
2689
  "event.assignedTo": {
3181
2690
  id: "event.assignedTo.label",
@@ -3187,11 +2696,6 @@ var eventMetadataLabelMap = {
3187
2696
  defaultMessage: "Created",
3188
2697
  description: "Created At"
3189
2698
  },
3190
- "event.createdByUserType": {
3191
- id: "event.createdByUserType.label",
3192
- defaultMessage: "createdByUserType",
3193
- description: "createdByUserType:user or system"
3194
- },
3195
2699
  "event.dateOfEvent": {
3196
2700
  id: "event.dateOfEvent.label",
3197
2701
  defaultMessage: "Date of Event",
@@ -3257,14 +2761,13 @@ var eventMetadataLabelMap = {
3257
2761
  // ../commons/src/events/WorkqueueColumnConfig.ts
3258
2762
  var WorkqueueColumnKeysArray = [
3259
2763
  ...EventMetadataKeysArray,
3260
- "title",
3261
- "outbox"
2764
+ "title"
3262
2765
  ];
3263
- var WorkqueueColumnKeys = import_zod23.z.enum(WorkqueueColumnKeysArray);
3264
- var WorkqueueColumnValue = import_zod23.z.object({
2766
+ var WorkqueueColumnKeys = import_zod21.z.enum(WorkqueueColumnKeysArray);
2767
+ var WorkqueueColumnValue = import_zod21.z.object({
3265
2768
  $event: WorkqueueColumnKeys
3266
2769
  });
3267
- var WorkqueueColumn = import_zod23.z.object({
2770
+ var WorkqueueColumn = import_zod21.z.object({
3268
2771
  label: TranslationConfig,
3269
2772
  value: WorkqueueColumnValue
3270
2773
  });
@@ -3275,115 +2778,97 @@ function defineWorkqueuesColumns(workqueueColumns) {
3275
2778
  }
3276
2779
 
3277
2780
  // ../commons/src/events/CountryConfigQueryInput.ts
3278
- var import_zod25 = require("zod");
2781
+ var import_zod23 = require("zod");
3279
2782
 
3280
2783
  // ../commons/src/events/EventIndex.ts
3281
- var import_zod24 = require("zod");
2784
+ var import_zod22 = require("zod");
3282
2785
  var import_zod_openapi9 = require("zod-openapi");
3283
- (0, import_zod_openapi9.extendZodWithOpenApi)(import_zod24.z);
2786
+ (0, import_zod_openapi9.extendZodWithOpenApi)(import_zod22.z);
3284
2787
  var EventIndex = EventMetadata.extend({
3285
2788
  declaration: EventState
3286
2789
  }).openapi({
3287
2790
  ref: "EventIndex"
3288
2791
  });
3289
- var EventSearchIndex = import_zod24.z.record(import_zod24.z.string(), import_zod24.z.any()).and(
3290
- import_zod24.z.object({
3291
- 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()
3292
2795
  // Ensures "type" (event-id) exists and is a string
3293
2796
  })
3294
2797
  ).openapi({
3295
2798
  ref: "EventSearchIndex"
3296
2799
  });
3297
- 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({
3298
2801
  ref: "Fuzzy"
3299
2802
  });
3300
- 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({
3301
2804
  ref: "Exact"
3302
2805
  });
3303
- var ExactStatus = import_zod24.z.object({
3304
- type: import_zod24.z.literal("exact"),
3305
- 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())
3306
2809
  }).openapi({
3307
- ref: "ExactStatus"
2810
+ ref: "AnyOf"
3308
2811
  });
3309
- var AnyOf = import_zod24.z.object({
3310
- type: import_zod24.z.literal("anyOf"),
3311
- 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
3312
2815
  }).openapi({
3313
- ref: "AnyOf"
2816
+ ref: "ExactStatus"
3314
2817
  });
3315
- var AnyOfStatus = import_zod24.z.object({
3316
- type: import_zod24.z.literal("anyOf"),
3317
- 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)
3318
2821
  }).openapi({
3319
2822
  ref: "AnyOfStatus"
3320
2823
  });
3321
- var Range = import_zod24.z.object({
3322
- type: import_zod24.z.literal("range"),
3323
- gte: import_zod24.z.string(),
3324
- 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()
3325
2828
  }).openapi({
3326
2829
  ref: "Range"
3327
2830
  });
3328
- var ContainsFlags = import_zod24.z.object({
3329
- anyOf: import_zod24.z.array(Flag).optional(),
3330
- noneOf: import_zod24.z.array(Flag).optional()
3331
- }).openapi({
3332
- ref: "ContainsFlags"
2831
+ var Not = import_zod22.z.object({ type: import_zod22.z.literal("not"), term: import_zod22.z.string() }).openapi({
2832
+ ref: "Not"
3333
2833
  });
3334
- 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({
3335
2835
  ref: "Within"
3336
2836
  });
3337
- var RangeDate = Range.extend({
3338
- gte: import_zod24.z.string().date().or(import_zod24.z.string().datetime()),
3339
- lte: import_zod24.z.string().date().or(import_zod24.z.string().datetime())
3340
- }).openapi({
3341
- ref: "RangeDate"
3342
- });
3343
- var ExactDate = Exact.extend({
3344
- term: import_zod24.z.string().date().or(import_zod24.z.string().datetime())
3345
- }).openapi({
3346
- ref: "ExactDate"
3347
- });
3348
- var DateCondition = import_zod24.z.union([ExactDate, RangeDate]).openapi({
2837
+ var DateCondition = import_zod22.z.union([Exact, Range]).openapi({
3349
2838
  ref: "DateCondition"
3350
2839
  });
3351
- var QueryInput = import_zod24.z.lazy(
3352
- () => import_zod24.z.union([
3353
- import_zod24.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf]),
3354
- 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)
3355
2844
  ])
3356
2845
  ).openapi({
3357
2846
  ref: "QueryInput"
3358
2847
  });
3359
- var QueryExpression = import_zod24.z.object({
3360
- id: import_zod24.z.optional(import_zod24.z.string()),
3361
- eventType: import_zod24.z.string(),
3362
- status: import_zod24.z.optional(import_zod24.z.union([AnyOfStatus, ExactStatus])),
3363
- createdAt: import_zod24.z.optional(DateCondition),
3364
- updatedAt: import_zod24.z.optional(DateCondition),
3365
- "legalStatus.REGISTERED.createdAt": import_zod24.z.optional(DateCondition),
3366
- "legalStatus.REGISTERED.createdAtLocation": import_zod24.z.optional(
3367
- 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])
3368
2856
  ),
3369
- "legalStatus.REGISTERED.registrationNumber": import_zod24.z.optional(Exact),
3370
- createdAtLocation: import_zod24.z.optional(import_zod24.z.union([Within, Exact])),
3371
- updatedAtLocation: import_zod24.z.optional(import_zod24.z.union([Within, Exact])),
3372
- assignedTo: import_zod24.z.optional(Exact),
3373
- createdByUserType: TokenUserType,
3374
- createdBy: import_zod24.z.optional(Exact),
3375
- updatedBy: import_zod24.z.optional(Exact),
3376
- trackingId: import_zod24.z.optional(Exact),
3377
- 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]))),
3378
2865
  data: QueryInput
3379
- }).partial().refine((obj) => Object.values(obj).some((val) => val !== void 0), {
3380
- message: "At least one query field must be specified."
3381
- }).openapi({
2866
+ }).partial().openapi({
3382
2867
  ref: "QueryExpression"
3383
2868
  });
3384
- var QueryType = import_zod24.z.object({
3385
- type: import_zod24.z.literal("and").or(import_zod24.z.literal("or")).openapi({ default: "and" }),
3386
- 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(
3387
2872
  (val) => {
3388
2873
  if (typeof val === "string") {
3389
2874
  return [JSON.parse(val)];
@@ -3393,7 +2878,7 @@ var QueryType = import_zod24.z.object({
3393
2878
  }
3394
2879
  return val;
3395
2880
  },
3396
- 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({
3397
2882
  default: [
3398
2883
  {
3399
2884
  eventType: TENNIS_CLUB_MEMBERSHIP,
@@ -3416,56 +2901,50 @@ var QueryType = import_zod24.z.object({
3416
2901
  });
3417
2902
 
3418
2903
  // ../commons/src/events/CountryConfigQueryInput.ts
3419
- var SerializableExact = import_zod25.z.object({
3420
- type: import_zod25.z.literal("exact"),
3421
- 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])
3422
2907
  });
3423
- var SerializableWithin = import_zod25.z.object({
3424
- type: import_zod25.z.literal("within"),
3425
- 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])
3426
2911
  });
3427
- var SerializedQueryExpression = import_zod25.z.object({
3428
- eventType: import_zod25.z.string(),
3429
- status: import_zod25.z.optional(import_zod25.z.union([AnyOfStatus, ExactStatus])),
3430
- createdAt: import_zod25.z.optional(DateCondition),
3431
- updatedAt: import_zod25.z.optional(DateCondition),
3432
- "legalStatus.REGISTERED.createdAt": import_zod25.z.optional(DateCondition),
3433
- "legalStatus.REGISTERED.createdAtLocation": import_zod25.z.optional(
3434
- import_zod25.z.union([Within, Exact])
3435
- ),
3436
- "legalStatus.REGISTERED.registrationNumber": import_zod25.z.optional(Exact),
3437
- createdAtLocation: import_zod25.z.optional(
3438
- 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])
3439
2919
  ),
3440
- updatedAtLocation: import_zod25.z.optional(
3441
- import_zod25.z.union([SerializableWithin, SerializableExact])
2920
+ updatedAtLocation: import_zod23.z.optional(
2921
+ import_zod23.z.union([SerializableWithin, SerializableExact])
3442
2922
  ),
3443
- assignedTo: import_zod25.z.optional(SerializableExact),
3444
- createdBy: import_zod25.z.optional(SerializableExact),
3445
- createdByUserType: TokenUserType,
3446
- updatedBy: import_zod25.z.optional(SerializableExact),
3447
- trackingId: import_zod25.z.optional(Exact),
3448
- 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]))),
3449
2928
  data: QueryInput
3450
2929
  }).partial();
3451
- var Or2 = import_zod25.z.object({
3452
- type: import_zod25.z.literal("or"),
3453
- 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)
3454
2933
  });
3455
- var And2 = import_zod25.z.object({
3456
- type: import_zod25.z.literal("and"),
3457
- 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)
3458
2937
  });
3459
- var CountryConfigQueryType = import_zod25.z.discriminatedUnion("type", [And2, Or2]);
3460
- var CountryConfigQueryInputType = import_zod25.z.union([
2938
+ var CountryConfigQueryType = import_zod23.z.discriminatedUnion("type", [And2, Or2]);
2939
+ var CountryConfigQueryInputType = import_zod23.z.union([
3461
2940
  SerializedQueryExpression,
3462
2941
  And2,
3463
2942
  Or2
3464
2943
  ]);
3465
2944
 
3466
2945
  // ../commons/src/icons.ts
3467
- var import_zod26 = require("zod");
3468
- var AvailableIcons = import_zod26.z.enum([
2946
+ var import_zod24 = require("zod");
2947
+ var AvailableIcons = import_zod24.z.enum([
3469
2948
  "Archived",
3470
2949
  "Assigned",
3471
2950
  "Certified",
@@ -3503,6 +2982,7 @@ var AvailableIcons = import_zod26.z.enum([
3503
2982
  "Copy",
3504
2983
  "Database",
3505
2984
  "DotsThreeVertical",
2985
+ "DownloadSimple",
3506
2986
  "ArrowCounterClockwise",
3507
2987
  "MagnifyingGlassMinus",
3508
2988
  "MagnifyingGlassPlus",
@@ -3586,42 +3066,38 @@ var mandatoryColumns = defineWorkqueuesColumns([
3586
3066
  value: event.field("updatedAt")
3587
3067
  }
3588
3068
  ]);
3589
- var WorkqueueActionsWithDefault = import_zod27.z.enum([
3069
+ var WorkqueueActionsWithDefault = import_zod25.z.enum([
3590
3070
  ...workqueueActions.options,
3591
3071
  "DEFAULT"
3592
3072
  ]);
3593
- var WorkqueueConfig = import_zod27.z.object({
3594
- 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."),
3595
3075
  name: TranslationConfig.describe(
3596
3076
  "Title of the workflow (both in navigation and on the page)"
3597
3077
  ),
3598
3078
  query: CountryConfigQueryType,
3599
- actions: import_zod27.z.array(
3600
- import_zod27.z.object({
3079
+ actions: import_zod25.z.array(
3080
+ import_zod25.z.object({
3601
3081
  type: WorkqueueActionsWithDefault,
3602
- conditionals: import_zod27.z.array(Conditional).optional()
3082
+ conditionals: import_zod25.z.array(Conditional).optional()
3603
3083
  })
3604
3084
  ),
3605
- columns: import_zod27.z.array(WorkqueueColumn).default(mandatoryColumns),
3085
+ columns: import_zod25.z.array(WorkqueueColumn).default(mandatoryColumns),
3606
3086
  icon: AvailableIcons
3607
3087
  }).describe("Configuration for workqueue.");
3608
- var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
3609
- query: true,
3610
- columns: true
3611
- });
3612
- var WorkqueueConfigInput = import_zod27.z.object({
3613
- 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."),
3614
3090
  name: TranslationConfig.describe(
3615
3091
  "Title of the workflow (both in navigation and on the page)"
3616
3092
  ),
3617
3093
  query: CountryConfigQueryInputType,
3618
- actions: import_zod27.z.array(
3619
- import_zod27.z.object({
3094
+ actions: import_zod25.z.array(
3095
+ import_zod25.z.object({
3620
3096
  type: WorkqueueActionsWithDefault,
3621
- conditionals: import_zod27.z.array(Conditional).optional()
3097
+ conditionals: import_zod25.z.array(Conditional).optional()
3622
3098
  })
3623
3099
  ),
3624
- columns: import_zod27.z.array(WorkqueueColumn).default(mandatoryColumns),
3100
+ columns: import_zod25.z.array(WorkqueueColumn).default(mandatoryColumns),
3625
3101
  icon: AvailableIcons
3626
3102
  });
3627
3103
  function defineWorkqueue(workqueueInput) {
@@ -3632,10 +3108,10 @@ function defineWorkqueue(workqueueInput) {
3632
3108
  function defineWorkqueues(workqueues) {
3633
3109
  return workqueues.map((workqueue) => defineWorkqueue(workqueue));
3634
3110
  }
3635
- var WorkqueueCountInput = import_zod27.z.array(
3636
- 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 })
3637
3113
  );
3638
- 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());
3639
3115
 
3640
3116
  // ../commons/src/events/workqueueDefaultColumns.ts
3641
3117
  var defaultWorkqueueColumns = [
@@ -3658,115 +3134,115 @@ var defaultWorkqueueColumns = [
3658
3134
  ];
3659
3135
 
3660
3136
  // ../commons/src/events/Draft.ts
3661
- var import_zod29 = require("zod");
3137
+ var import_zod27 = require("zod");
3662
3138
 
3663
3139
  // ../commons/src/events/ActionInput.ts
3664
- var import_zod28 = require("zod");
3140
+ var import_zod26 = require("zod");
3665
3141
  var import_zod_openapi10 = require("zod-openapi");
3666
- (0, import_zod_openapi10.extendZodWithOpenApi)(import_zod28.z);
3667
- var BaseActionInput = import_zod28.z.object({
3668
- eventId: UUID,
3669
- 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(),
3670
3147
  declaration: ActionUpdate.default({}),
3671
3148
  annotation: ActionUpdate.optional(),
3672
- originalActionId: UUID.optional(),
3673
- // should not be part of base action.
3674
- keepAssignment: import_zod28.z.boolean().optional()
3149
+ originalActionId: import_zod26.z.string().optional(),
3150
+ keepAssignment: import_zod26.z.boolean().optional()
3675
3151
  });
3676
3152
  var CreateActionInput = BaseActionInput.merge(
3677
- import_zod28.z.object({
3678
- 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),
3679
3155
  createdAtLocation: CreatedAtLocation
3680
3156
  })
3681
3157
  );
3682
3158
  var RegisterActionInput = BaseActionInput.merge(
3683
- import_zod28.z.object({
3684
- type: import_zod28.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
3685
- 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()
3686
3162
  })
3687
- ).strict();
3163
+ );
3688
3164
  var ValidateActionInput = BaseActionInput.merge(
3689
- import_zod28.z.object({
3690
- type: import_zod28.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
3691
- 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())
3692
3168
  })
3693
3169
  );
3694
3170
  var NotifyActionInput = BaseActionInput.merge(
3695
- import_zod28.z.object({
3696
- 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)
3697
3173
  })
3698
3174
  ).openapi({
3699
3175
  default: {
3700
3176
  eventId: "<event-id-here>",
3701
- transactionId: getUUID(),
3177
+ transactionId: (0, import_uuid3.v4)(),
3702
3178
  declaration: {},
3703
3179
  annotation: {},
3704
3180
  type: ActionType.NOTIFY
3705
3181
  }
3706
3182
  });
3707
3183
  var DeclareActionInput = BaseActionInput.merge(
3708
- import_zod28.z.object({
3709
- 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)
3710
3186
  })
3711
3187
  );
3712
3188
  var PrintCertificateActionInput = BaseActionInput.merge(
3713
- import_zod28.z.object({
3714
- 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)
3715
3191
  })
3716
3192
  );
3717
3193
  var RejectDeclarationActionInput = BaseActionInput.merge(
3718
- import_zod28.z.object({
3719
- 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),
3720
3196
  reason: RejectionReason
3721
3197
  })
3722
3198
  );
3723
3199
  var MarkedAsDuplicateActionInput = BaseActionInput.merge(
3724
- import_zod28.z.object({
3725
- 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)
3726
3202
  })
3727
3203
  );
3728
3204
  var ArchiveActionInput = BaseActionInput.merge(
3729
- import_zod28.z.object({
3730
- 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),
3731
3207
  reason: RejectionReason
3732
3208
  })
3733
3209
  );
3734
3210
  var AssignActionInput = BaseActionInput.merge(
3735
- import_zod28.z.object({
3736
- type: import_zod28.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
3737
- 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()
3738
3214
  })
3739
3215
  );
3740
3216
  var UnassignActionInput = BaseActionInput.merge(
3741
- import_zod28.z.object({
3742
- type: import_zod28.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
3743
- 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)
3744
3220
  })
3745
3221
  );
3746
3222
  var RequestCorrectionActionInput = BaseActionInput.merge(
3747
- import_zod28.z.object({
3748
- 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)
3749
3225
  })
3750
3226
  );
3751
3227
  var RejectCorrectionActionInput = BaseActionInput.merge(
3752
- import_zod28.z.object({
3753
- requestId: import_zod28.z.string(),
3754
- 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)
3755
3231
  })
3756
3232
  );
3757
3233
  var ApproveCorrectionActionInput = BaseActionInput.merge(
3758
- import_zod28.z.object({
3759
- requestId: import_zod28.z.string(),
3760
- 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)
3761
3237
  })
3762
3238
  );
3763
3239
  var ReadActionInput = BaseActionInput.merge(
3764
- import_zod28.z.object({
3765
- 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)
3766
3242
  })
3767
3243
  );
3768
- var DeleteActionInput = import_zod28.z.object({ eventId: UUID });
3769
- 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", [
3770
3246
  CreateActionInput.openapi({ ref: "CreateActionInput" }),
3771
3247
  ValidateActionInput.openapi({ ref: "ValidateActionInput" }),
3772
3248
  RegisterActionInput.openapi({ ref: "RegisterActionInput" }),
@@ -3795,18 +3271,18 @@ var ActionInput = import_zod28.z.discriminatedUnion("type", [
3795
3271
  });
3796
3272
 
3797
3273
  // ../commons/src/events/Draft.ts
3798
- var Draft = import_zod29.z.object({
3799
- id: UUID,
3800
- eventId: UUID,
3801
- transactionId: import_zod29.z.string(),
3802
- 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(),
3803
3279
  action: ActionBase.extend({
3804
3280
  type: ActionTypes
3805
3281
  }).omit({ id: true })
3806
3282
  });
3807
3283
  var DraftInput = BaseActionInput.extend({
3808
3284
  type: ActionTypes,
3809
- status: import_zod29.z.enum([
3285
+ status: import_zod27.z.enum([
3810
3286
  ActionStatus.Requested,
3811
3287
  ActionStatus.Accepted,
3812
3288
  ActionStatus.Rejected
@@ -3814,24 +3290,24 @@ var DraftInput = BaseActionInput.extend({
3814
3290
  });
3815
3291
 
3816
3292
  // ../commons/src/events/EventInput.ts
3817
- var import_zod30 = require("zod");
3818
- var import_uuid8 = require("uuid");
3819
- var EventInput = import_zod30.z.object({
3820
- transactionId: import_zod30.z.string(),
3821
- type: import_zod30.z.string()
3822
- }).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" } });
3823
3299
 
3824
3300
  // ../commons/src/events/EventDocument.ts
3825
- var import_zod31 = require("zod");
3301
+ var import_zod29 = require("zod");
3826
3302
  var import_zod_openapi11 = require("zod-openapi");
3827
- (0, import_zod_openapi11.extendZodWithOpenApi)(import_zod31.z);
3828
- var EventDocument = import_zod31.z.object({
3829
- id: UUID,
3830
- type: import_zod31.z.string(),
3831
- createdAt: import_zod31.z.string().datetime(),
3832
- updatedAt: import_zod31.z.string().datetime(),
3833
- actions: import_zod31.z.array(Action),
3834
- 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()
3835
3311
  }).openapi({ ref: "EventDocument" });
3836
3312
 
3837
3313
  // ../commons/src/events/state/utils.ts
@@ -3865,7 +3341,6 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
3865
3341
  // When 3rd party API returns 200 OK, we assume that the request was accepted, and persist single 'accepted' action.
3866
3342
  createdAt: requestAction?.createdAt ?? acceptAction.createdAt,
3867
3343
  createdBy: requestAction?.createdBy ?? acceptAction.createdBy,
3868
- createdByUserType: requestAction?.createdByUserType ?? acceptAction.createdByUserType,
3869
3344
  createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
3870
3345
  acceptedAt: acceptAction.createdAt,
3871
3346
  createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
@@ -3873,18 +3348,17 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
3873
3348
  registrationNumber
3874
3349
  };
3875
3350
  }
3876
- function getActionUpdateMetadata(actions) {
3351
+ function getDeclarationActionUpdateMetadata(actions) {
3877
3352
  const createAction = getOrThrow(
3878
3353
  actions.find((action) => action.type === ActionType.CREATE),
3879
3354
  `Event has no ${ActionType.CREATE} action`
3880
3355
  );
3881
- return StatusChangingActions.options.reduce(
3356
+ return [ActionType.DECLARE, ActionType.VALIDATE, ActionType.REGISTER].reduce(
3882
3357
  (metadata, actionType) => {
3883
3358
  const { accept, request } = getActionRequests(actionType, actions);
3884
3359
  return {
3885
3360
  createdAt: request?.createdAt ?? accept?.createdAt ?? metadata.createdAt,
3886
3361
  createdBy: request?.createdBy ?? accept?.createdBy ?? metadata.createdBy,
3887
- createdByUserType: request?.createdByUserType ?? accept?.createdByUserType ?? metadata.createdByUserType,
3888
3362
  createdAtLocation: request?.createdAtLocation ?? accept?.createdAtLocation ?? metadata.createdAtLocation,
3889
3363
  createdByRole: request?.createdByRole ?? accept?.createdByRole ?? metadata.createdByRole
3890
3364
  };
@@ -3892,7 +3366,6 @@ function getActionUpdateMetadata(actions) {
3892
3366
  {
3893
3367
  createdAt: createAction.createdAt,
3894
3368
  createdBy: createAction.createdBy,
3895
- createdByUserType: createAction.createdByUserType,
3896
3369
  createdAtLocation: createAction.createdAtLocation,
3897
3370
  createdByRole: createAction.createdByRole
3898
3371
  }
@@ -3911,69 +3384,15 @@ function getLegalStatuses(actions) {
3911
3384
  };
3912
3385
  }
3913
3386
 
3914
- // ../commons/src/events/state/flags.ts
3915
- function isCertificatePrinted(actions) {
3916
- return actions.reduce((prev, { type }) => {
3917
- if (type === ActionType.PRINT_CERTIFICATE) {
3918
- return true;
3919
- }
3920
- if (type === ActionType.APPROVE_CORRECTION) {
3921
- return false;
3922
- }
3923
- return prev;
3924
- }, false);
3925
- }
3926
- function isCorrectionRequested(actions) {
3927
- return actions.reduce((prev, { type }) => {
3928
- if (type === ActionType.REQUEST_CORRECTION) {
3929
- return true;
3930
- }
3931
- if (type === ActionType.APPROVE_CORRECTION) {
3932
- return false;
3933
- }
3934
- if (type === ActionType.REJECT_CORRECTION) {
3935
- return false;
3936
- }
3937
- return prev;
3938
- }, false);
3939
- }
3940
- function isDeclarationIncomplete(actions) {
3941
- return getStatusFromActions(actions) === EventStatus.enum.NOTIFIED;
3942
- }
3943
- function isRejected(actions) {
3944
- return getStatusFromActions(actions) === EventStatus.enum.REJECTED;
3945
- }
3946
- function getFlagsFromActions(actions) {
3947
- const sortedActions = actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
3948
- const actionStatus = sortedActions.reduce(
3949
- (actionStatuses, { type, status }) => ({
3950
- ...actionStatuses,
3951
- [type]: status
3952
- }),
3953
- {}
3954
- );
3955
- const flags = Object.entries(actionStatus).filter(([, status]) => status !== ActionStatus.Accepted).map(([type, status]) => {
3956
- const flag = joinValues([type, status], ":").toLowerCase();
3957
- return flag;
3958
- });
3959
- if (isCertificatePrinted(sortedActions)) {
3960
- flags.push(InherentFlags.PRINTED);
3961
- }
3962
- if (isCorrectionRequested(sortedActions)) {
3963
- flags.push(InherentFlags.CORRECTION_REQUESTED);
3964
- }
3965
- if (isDeclarationIncomplete(sortedActions)) {
3966
- flags.push(InherentFlags.INCOMPLETE);
3967
- }
3968
- if (isRejected(sortedActions)) {
3969
- flags.push(InherentFlags.REJECTED);
3970
- }
3971
- return flags;
3972
- }
3973
-
3974
3387
  // ../commons/src/events/state/index.ts
3975
3388
  function getStatusFromActions(actions) {
3976
- 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) => {
3977
3396
  switch (action.type) {
3978
3397
  case ActionType.CREATE:
3979
3398
  return EventStatus.enum.CREATED;
@@ -4003,6 +3422,38 @@ function getStatusFromActions(actions) {
4003
3422
  }
4004
3423
  }, EventStatus.enum.CREATED);
4005
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
+ }
4006
3457
  function getAssignedUserFromActions(actions) {
4007
3458
  return actions.reduce((user2, action) => {
4008
3459
  if (action.type === ActionType.ASSIGN) {
@@ -4076,11 +3527,10 @@ function getCurrentEventState(event2, config) {
4076
3527
  if (!creationAction) {
4077
3528
  throw new Error(`Event ${event2.id} has no creation action`);
4078
3529
  }
4079
- const acceptedActions = getAcceptedActions(event2).sort(
4080
- (a, b) => a.createdAt.localeCompare(b.createdAt)
3530
+ const acceptedActions = getAcceptedActions(event2);
3531
+ const declarationUpdateMetadata = getDeclarationActionUpdateMetadata(
3532
+ event2.actions
4081
3533
  );
4082
- const requestActionMetadata = getActionUpdateMetadata(event2.actions);
4083
- const acceptedActionMetadata = getActionUpdateMetadata(acceptedActions);
4084
3534
  const declaration = aggregateActionDeclarations(acceptedActions);
4085
3535
  let dateOfEvent;
4086
3536
  if (config.dateOfEvent) {
@@ -4100,17 +3550,16 @@ function getCurrentEventState(event2, config) {
4100
3550
  legalStatuses: getLegalStatuses(event2.actions),
4101
3551
  createdAt: creationAction.createdAt,
4102
3552
  createdBy: creationAction.createdBy,
4103
- createdByUserType: creationAction.createdByUserType,
4104
3553
  createdAtLocation: creationAction.createdAtLocation,
4105
3554
  createdBySignature: creationAction.createdBySignature,
4106
- updatedAt: acceptedActionMetadata.createdAt,
3555
+ updatedAt: declarationUpdateMetadata.createdAt,
4107
3556
  assignedTo: getAssignedUserFromActions(acceptedActions),
4108
3557
  assignedToSignature: getAssignedUserSignatureFromActions(acceptedActions),
4109
- updatedBy: requestActionMetadata.createdBy,
4110
- updatedAtLocation: requestActionMetadata.createdAtLocation,
3558
+ updatedBy: declarationUpdateMetadata.createdBy,
3559
+ updatedAtLocation: declarationUpdateMetadata.createdAtLocation,
4111
3560
  declaration,
4112
3561
  trackingId: event2.trackingId,
4113
- updatedByUserRole: requestActionMetadata.createdByRole,
3562
+ updatedByUserRole: declarationUpdateMetadata.createdByRole,
4114
3563
  dateOfEvent,
4115
3564
  flags: getFlagsFromActions(event2.actions)
4116
3565
  });
@@ -4193,18 +3642,18 @@ function generateTransactionId() {
4193
3642
  }
4194
3643
 
4195
3644
  // ../commons/src/events/User.ts
4196
- var import_zod32 = require("zod");
4197
- var User = import_zod32.z.object({
4198
- id: import_zod32.z.string(),
4199
- name: import_zod32.z.array(
4200
- import_zod32.z.object({
4201
- use: import_zod32.z.string(),
4202
- given: import_zod32.z.array(import_zod32.z.string()),
4203
- 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()
4204
3653
  })
4205
3654
  ),
4206
- role: import_zod32.z.string(),
4207
- signatureFilename: import_zod32.z.string().optional()
3655
+ role: import_zod30.z.string(),
3656
+ signatureFilename: import_zod30.z.string().optional()
4208
3657
  });
4209
3658
 
4210
3659
  // ../commons/src/events/test.utils.ts
@@ -4889,7 +4338,7 @@ var PRINT_CERTIFICATE_FORM = defineActionForm({
4889
4338
  var TENNIS_CLUB_DECLARATION_REVIEW = {
4890
4339
  title: {
4891
4340
  id: "v2.event.tennis-club-membership.action.declare.form.review.title",
4892
- 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}}}}}",
4893
4342
  description: "Title of the review page"
4894
4343
  },
4895
4344
  fields: [
@@ -5312,197 +4761,202 @@ var tennisClubMembershipEvent = defineConfig({
5312
4761
  description: "This is shown as the action name anywhere the user can trigger the action from",
5313
4762
  id: "event.tennis-club-membership.action.correction.request.label"
5314
4763
  },
5315
- onboardingForm: [
5316
- {
5317
- id: "correction-requester",
5318
- type: PageTypes.enum.FORM,
5319
- title: {
5320
- id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
5321
- defaultMessage: "Correction requester",
5322
- description: "This is the title of the section"
5323
- },
5324
- fields: [
5325
- {
5326
- id: "correction.requester.relationshop.intro",
5327
- type: "PAGE_HEADER",
5328
- label: {
5329
- id: "correction.requester.relationshop.intro.label",
5330
- 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.",
5331
- description: "The title for the corrector form"
5332
- }
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"
5333
4778
  },
5334
- {
5335
- id: "correction.requester.relationship",
5336
- type: "RADIO_GROUP",
5337
- label: {
5338
- id: "v2.correction.corrector.title",
5339
- defaultMessage: "Who is requesting a change to this record?",
5340
- 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
+ }
5341
4788
  },
5342
- defaultValue: "",
5343
- options: [
5344
- {
5345
- value: "INFORMANT",
5346
- label: {
5347
- id: "v2.correction.corrector.informant",
5348
- defaultMessage: "Informant",
5349
- description: "Label for informant option in certificate correction form"
5350
- }
5351
- },
5352
- {
5353
- value: "ANOTHER_AGENT",
5354
- label: {
5355
- id: "v2.correction.corrector.anotherAgent",
5356
- defaultMessage: "Another registration agent or field agent",
5357
- description: "Label for another registration or field agent option in certificate correction form"
5358
- }
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"
5359
4796
  },
5360
- {
5361
- value: "REGISTRAR",
5362
- label: {
5363
- id: "v2.correction.corrector.me",
5364
- defaultMessage: "Me (Registrar)",
5365
- description: "Label for registrar option in certificate correction form"
5366
- }
5367
- },
5368
- {
5369
- value: "OTHER",
5370
- label: {
5371
- id: "v2.correction.corrector.others",
5372
- defaultMessage: "Someone else",
5373
- 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
+ }
5374
4830
  }
5375
- }
5376
- ]
5377
- }
5378
- ]
5379
- },
5380
- {
5381
- id: "identity-check",
5382
- type: PageTypes.enum.FORM,
5383
- title: {
5384
- id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
5385
- defaultMessage: "Verify their identity",
5386
- description: "This is the title of the section"
5387
- },
5388
- fields: [
5389
- {
5390
- id: "correction.identity-check.instructions",
5391
- type: "PAGE_HEADER",
5392
- label: {
5393
- id: "correction.corrector.identity.instruction",
5394
- defaultMessage: "Please verify the identity of the person making this request",
5395
- description: "The title for the corrector form"
4831
+ ]
5396
4832
  }
5397
- },
5398
- {
5399
- id: "correction.identity-check.verified",
5400
- type: "RADIO_GROUP",
5401
- label: {
5402
- id: "correction.corrector.identity.verified.label",
5403
- defaultMessage: "Identity verified",
5404
- description: "The title for the corrector form"
5405
- },
5406
- defaultValue: "",
5407
- required: true,
5408
- options: [
5409
- {
5410
- value: "VERIFIED",
5411
- label: {
5412
- id: "correction.corrector.identity.verified",
5413
- defaultMessage: "I have verified their identity",
5414
- description: "Label for verified option in corrector identity check page"
5415
- }
5416
- }
5417
- ]
5418
- }
5419
- ]
5420
- }
5421
- ],
5422
- additionalDetailsForm: [
5423
- {
5424
- id: "correction-request.supporting-documents",
5425
- type: PageTypes.enum.FORM,
5426
- title: {
5427
- id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
5428
- defaultMessage: "Upload supporting documents",
5429
- description: "This is the title of the section"
4833
+ ]
5430
4834
  },
5431
- fields: [
5432
- {
5433
- id: "correction.supportingDocs.introduction",
5434
- type: "PAGE_HEADER",
5435
- label: {
5436
- id: "correction.corrector.paragraph.title",
5437
- 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.",
5438
- description: "The title for the corrector form"
5439
- }
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"
5440
4842
  },
5441
- {
5442
- id: "correction.supportingDocs",
5443
- type: FieldType.FILE,
5444
- label: {
5445
- id: "correction.corrector.title",
5446
- defaultMessage: "Upload supporting documents",
5447
- 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
+ ]
5448
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"
5449
4883
  },
5450
- {
5451
- id: "correction.request.supportingDocuments",
5452
- type: "RADIO_GROUP",
5453
- label: {
5454
- id: "correction.corrector.title",
5455
- defaultMessage: "Who is requesting a change to this record?",
5456
- 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
+ }
5457
4893
  },
5458
- defaultValue: "",
5459
- configuration: {
5460
- styles: {
5461
- 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"
5462
4901
  }
5463
4902
  },
5464
- options: [
5465
- {
5466
- value: "ATTEST",
5467
- label: {
5468
- id: "correction.supportingDocuments.attest.label",
5469
- defaultMessage: "I attest to seeing supporting documentation and have a copy filed at my office",
5470
- 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"
5471
4915
  }
5472
4916
  },
5473
- {
5474
- value: "NOT_NEEDED",
5475
- label: {
5476
- id: "correction.supportingDocuments.notNeeded.label",
5477
- defaultMessage: "No supporting documents required",
5478
- 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
+ }
5479
4933
  }
5480
- }
5481
- ]
5482
- }
5483
- ]
5484
- },
5485
- {
5486
- id: "correction-request.additional-details",
5487
- type: PageTypes.enum.FORM,
5488
- title: {
5489
- id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
5490
- defaultMessage: "Reason for correction",
5491
- description: "This is the title of the section"
4934
+ ]
4935
+ }
4936
+ ]
5492
4937
  },
5493
- fields: [
5494
- {
5495
- id: "correction.request.reason",
5496
- type: FieldType.TEXT,
5497
- label: {
5498
- id: "correction.reason.title",
5499
- defaultMessage: "Reason for correction?",
5500
- 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
+ }
5501
4955
  }
5502
- }
5503
- ]
5504
- }
5505
- ]
4956
+ ]
4957
+ }
4958
+ ]
4959
+ }
5506
4960
  },
5507
4961
  {
5508
4962
  type: ActionType.APPROVE_CORRECTION,
@@ -5705,197 +5159,202 @@ var footballClubMembershipEvent = defineConfig({
5705
5159
  description: "This is shown as the action name anywhere the user can trigger the action from",
5706
5160
  id: "event.football-club-membership.action.correction.request.label"
5707
5161
  },
5708
- onboardingForm: [
5709
- {
5710
- id: "correction-requester",
5711
- type: PageTypes.enum.FORM,
5712
- title: {
5713
- id: "event.football-club-membership.action.requestCorrection.form.section.corrector",
5714
- defaultMessage: "Correction requester",
5715
- description: "This is the title of the section"
5716
- },
5717
- fields: [
5718
- {
5719
- id: "correction.requester.relationshop.intro",
5720
- type: "PAGE_HEADER",
5721
- label: {
5722
- id: "correction.requester.relationshop.intro.label",
5723
- 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.",
5724
- description: "The title for the corrector form"
5725
- }
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"
5726
5176
  },
5727
- {
5728
- id: "correction.requester.relationship",
5729
- type: "RADIO_GROUP",
5730
- label: {
5731
- id: "v2.correction.corrector.title",
5732
- defaultMessage: "Who is requesting a change to this record?",
5733
- 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
+ }
5734
5186
  },
5735
- defaultValue: "",
5736
- options: [
5737
- {
5738
- value: "INFORMANT",
5739
- label: {
5740
- id: "v2.correction.corrector.informant",
5741
- defaultMessage: "Informant",
5742
- description: "Label for informant option in certificate correction form"
5743
- }
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"
5744
5194
  },
5745
- {
5746
- value: "ANOTHER_AGENT",
5747
- label: {
5748
- id: "v2.correction.corrector.anotherAgent",
5749
- defaultMessage: "Another registration agent or field agent",
5750
- description: "Label for another registration or field agent option in certificate correction form"
5751
- }
5752
- },
5753
- {
5754
- value: "REGISTRAR",
5755
- label: {
5756
- id: "v2.correction.corrector.me",
5757
- defaultMessage: "Me (Registrar)",
5758
- description: "Label for registrar option in certificate correction form"
5759
- }
5760
- },
5761
- {
5762
- value: "OTHER",
5763
- label: {
5764
- id: "v2.correction.corrector.others",
5765
- defaultMessage: "Someone else",
5766
- 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
+ }
5767
5228
  }
5768
- }
5769
- ]
5770
- }
5771
- ]
5772
- },
5773
- {
5774
- id: "identity-check",
5775
- type: PageTypes.enum.FORM,
5776
- title: {
5777
- id: "event.football-club-membership.action.requestCorrection.form.section.verify",
5778
- defaultMessage: "Verify their identity",
5779
- description: "This is the title of the section"
5780
- },
5781
- fields: [
5782
- {
5783
- id: "correction.identity-check.instructions",
5784
- type: "PAGE_HEADER",
5785
- label: {
5786
- id: "correction.corrector.identity.instruction",
5787
- defaultMessage: "Please verify the identity of the person making this request",
5788
- description: "The title for the corrector form"
5229
+ ]
5789
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"
5790
5240
  },
5791
- {
5792
- id: "correction.identity-check.verified",
5793
- type: "RADIO_GROUP",
5794
- label: {
5795
- id: "correction.corrector.identity.verified.label",
5796
- defaultMessage: "Identity verified",
5797
- 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
+ }
5798
5250
  },
5799
- defaultValue: "",
5800
- required: true,
5801
- options: [
5802
- {
5803
- value: "VERIFIED",
5804
- label: {
5805
- id: "correction.corrector.identity.verified",
5806
- defaultMessage: "I have verified their identity",
5807
- 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
+ }
5808
5269
  }
5809
- }
5810
- ]
5811
- }
5812
- ]
5813
- }
5814
- ],
5815
- additionalDetailsForm: [
5816
- {
5817
- id: "correction-request.supporting-documents",
5818
- type: PageTypes.enum.FORM,
5819
- title: {
5820
- id: "event.football-club-membership.action.requestCorrection.form.section.verify",
5821
- defaultMessage: "Upload supporting documents",
5822
- description: "This is the title of the section"
5823
- },
5824
- fields: [
5825
- {
5826
- id: "correction.supportingDocs.introduction",
5827
- type: "PAGE_HEADER",
5828
- label: {
5829
- id: "correction.corrector.paragraph.title",
5830
- 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.",
5831
- description: "The title for the corrector form"
5832
- }
5833
- },
5834
- {
5835
- id: "correction.supportingDocs",
5836
- type: FieldType.FILE,
5837
- label: {
5838
- id: "correction.corrector.title",
5839
- defaultMessage: "Upload supporting documents",
5840
- description: "The title for the corrector form"
5270
+ ]
5841
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"
5842
5281
  },
5843
- {
5844
- id: "correction.request.supportingDocuments",
5845
- type: "RADIO_GROUP",
5846
- label: {
5847
- id: "correction.corrector.title",
5848
- defaultMessage: "Who is requesting a change to this record?",
5849
- 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
+ }
5850
5291
  },
5851
- defaultValue: "",
5852
- configuration: {
5853
- styles: {
5854
- 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"
5855
5299
  }
5856
5300
  },
5857
- options: [
5858
- {
5859
- value: "ATTEST",
5860
- label: {
5861
- id: "correction.supportingDocuments.attest.label",
5862
- defaultMessage: "I attest to seeing supporting documentation and have a copy filed at my office",
5863
- 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"
5864
5313
  }
5865
5314
  },
5866
- {
5867
- value: "NOT_NEEDED",
5868
- label: {
5869
- id: "correction.supportingDocuments.notNeeded.label",
5870
- defaultMessage: "No supporting documents required",
5871
- 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
+ }
5872
5331
  }
5873
- }
5874
- ]
5875
- }
5876
- ]
5877
- },
5878
- {
5879
- id: "correction-request.additional-details",
5880
- type: PageTypes.enum.FORM,
5881
- title: {
5882
- id: "event.football-club-membership.action.requestCorrection.form.section.corrector",
5883
- defaultMessage: "Reason for correction",
5884
- description: "This is the title of the section"
5332
+ ]
5333
+ }
5334
+ ]
5885
5335
  },
5886
- fields: [
5887
- {
5888
- id: "correction.request.reason",
5889
- type: FieldType.TEXT,
5890
- label: {
5891
- id: "correction.reason.title",
5892
- defaultMessage: "Reason for correction?",
5893
- 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
+ }
5894
5353
  }
5895
- }
5896
- ]
5897
- }
5898
- ]
5354
+ ]
5355
+ }
5356
+ ]
5357
+ }
5899
5358
  },
5900
5359
  {
5901
5360
  type: ActionType.APPROVE_CORRECTION,
@@ -6194,14 +5653,6 @@ var v2BirthEvent = defineConfig({
6194
5653
  });
6195
5654
 
6196
5655
  // ../commons/src/events/test.utils.ts
6197
- var import_zod33 = require("zod");
6198
- var TestUserRole = import_zod33.z.enum([
6199
- "FIELD_AGENT",
6200
- "LOCAL_REGISTRAR",
6201
- "LOCAL_SYSTEM_ADMIN",
6202
- "NATIONAL_REGISTRAR",
6203
- "REGISTRATION_AGENT"
6204
- ]);
6205
5656
  function pickRandom(rng, items) {
6206
5657
  return items[Math.floor(rng() * items.length)];
6207
5658
  }
@@ -6374,7 +5825,6 @@ function eventPayloadGenerator(rng) {
6374
5825
  },
6375
5826
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
6376
5827
  createdBy: "@todo",
6377
- createdByUserType: TokenUserType.Enum.user,
6378
5828
  createdByRole: "@todo",
6379
5829
  createdAtLocation: "@todo"
6380
5830
  }
@@ -6560,18 +6010,16 @@ function generateActionDocument({
6560
6010
  configuration,
6561
6011
  action,
6562
6012
  rng = () => 0.1,
6563
- defaults = {},
6564
- user: user2 = {}
6013
+ defaults = {}
6565
6014
  }) {
6566
6015
  const actionBase = {
6567
6016
  // Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
6568
6017
  // @TODO: This should be fixed in the future.
6569
6018
  createdAt: new Date(Date.now() - 500).toISOString(),
6570
- createdBy: user2.id ?? getUUID(),
6571
- createdByUserType: TokenUserType.Enum.user,
6572
- createdByRole: TestUserRole.Enum.FIELD_AGENT,
6019
+ createdBy: getUUID(),
6020
+ createdByRole: "FIELD_AGENT",
6573
6021
  id: getUUID(),
6574
- createdAtLocation: user2.primaryOfficeId ?? "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
6022
+ createdAtLocation: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
6575
6023
  declaration: generateActionDeclarationInput(configuration, action, rng),
6576
6024
  annotation: {},
6577
6025
  status: ActionStatus.Accepted,
@@ -6586,7 +6034,7 @@ function generateActionDocument({
6586
6034
  case ActionType.DECLARE:
6587
6035
  return { ...actionBase, type: action };
6588
6036
  case ActionType.UNASSIGN:
6589
- return { ...actionBase, type: action };
6037
+ return { ...actionBase, type: action, assignedTo: null };
6590
6038
  case ActionType.ASSIGN:
6591
6039
  return { ...actionBase, assignedTo: getUUID(), type: action };
6592
6040
  case ActionType.VALIDATE:
@@ -6625,14 +6073,13 @@ function generateActionDocument({
6625
6073
  function generateEventDocument({
6626
6074
  configuration,
6627
6075
  actions,
6628
- rng = () => 0.1,
6629
- user: user2
6076
+ rng = () => 0.1
6630
6077
  }) {
6631
6078
  return {
6632
6079
  trackingId: getUUID(),
6633
6080
  type: configuration.id,
6634
6081
  actions: actions.map(
6635
- (action) => generateActionDocument({ configuration, action, rng, user: user2 })
6082
+ (action) => generateActionDocument({ configuration, action, rng })
6636
6083
  ),
6637
6084
  // Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
6638
6085
  // @TODO: This should be fixed in the future.
@@ -6700,7 +6147,7 @@ function createPrng(seed) {
6700
6147
  return state / MODULUS;
6701
6148
  };
6702
6149
  }
6703
- function generateUuid(rng = () => 0.1) {
6150
+ function generateUuid(rng) {
6704
6151
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
6705
6152
  const r = Math.floor(rng() * 16);
6706
6153
  const v = c === "x" ? r : r & 3 | 8;
@@ -6712,11 +6159,6 @@ function generateTrackingId(rng) {
6712
6159
  const trackingId = uuid.slice(0, 6).toUpperCase();
6713
6160
  return trackingId;
6714
6161
  }
6715
- function generateRegistrationNumber(rng) {
6716
- const uuid = generateUuid(rng).replace(/-/g, "");
6717
- const registrationNumber = uuid.slice(0, 12).toUpperCase();
6718
- return registrationNumber;
6719
- }
6720
6162
  function generateRandomSignature(rng) {
6721
6163
  return `/random-bucket/${generateUuid(rng)}.png`;
6722
6164
  }
@@ -6732,7 +6174,6 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
6732
6174
  type: overrides.type ?? TENNIS_CLUB_MEMBERSHIP,
6733
6175
  status: overrides.status ?? pickRandom(rng, EventStatus.options),
6734
6176
  createdAt: overrides.createdAt ?? createdAt,
6735
- createdByUserType: overrides.createdByUserType ?? "user",
6736
6177
  createdBy: overrides.createdBy ?? generateUuid(rng),
6737
6178
  createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
6738
6179
  updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
@@ -6810,6 +6251,234 @@ function isFieldConfigDefaultValue(value) {
6810
6251
 
6811
6252
  // ../commons/src/events/scopes.ts
6812
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
6813
6482
  var CONFIG_GET_ALLOWED_SCOPES = [
6814
6483
  SCOPES.RECORD_DECLARE,
6815
6484
  SCOPES.RECORD_READ,
@@ -6856,7 +6525,8 @@ var ACTION_ALLOWED_SCOPES = {
6856
6525
  [ActionType.REGISTER]: [SCOPES.RECORD_REGISTER],
6857
6526
  [ActionType.PRINT_CERTIFICATE]: [SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES],
6858
6527
  [ActionType.REQUEST_CORRECTION]: [
6859
- SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION
6528
+ SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION,
6529
+ SCOPES.RECORD_REGISTRATION_CORRECT
6860
6530
  ],
6861
6531
  [ActionType.REJECT_CORRECTION]: [SCOPES.RECORD_REGISTRATION_CORRECT],
6862
6532
  [ActionType.APPROVE_CORRECTION]: [SCOPES.RECORD_REGISTRATION_CORRECT],
@@ -6886,20 +6556,30 @@ var ACTION_ALLOWED_CONFIGURABLE_SCOPES = {
6886
6556
  [ActionType.UNASSIGN]: [],
6887
6557
  [ActionType.DETECT_DUPLICATE]: []
6888
6558
  };
6889
- var WRITE_ACTION_SCOPES = [
6890
- ...ACTION_ALLOWED_SCOPES[ActionType.DECLARE],
6891
- ...ACTION_ALLOWED_SCOPES[ActionType.VALIDATE],
6892
- ...ACTION_ALLOWED_SCOPES[ActionType.REGISTER],
6893
- ...ACTION_ALLOWED_SCOPES[ActionType.PRINT_CERTIFICATE]
6894
- ];
6895
6559
  function hasAnyOfScopes(a, b) {
6896
6560
  return (0, import_lodash3.intersection)(a, b).length > 0;
6897
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];
6577
+ }
6898
6578
 
6899
6579
  // ../commons/src/events/serializers/user/deserializer.ts
6900
- var import_zod34 = require("zod");
6580
+ var import_zod32 = require("zod");
6901
6581
  var UserWithPrimaryOffice = User.extend({
6902
- primaryOfficeId: import_zod34.z.string()
6582
+ primaryOfficeId: import_zod32.z.string()
6903
6583
  });
6904
6584
  function userDeserializer(serializedUserField, user2) {
6905
6585
  if (typeof serializedUserField === "string") {
@@ -6919,7 +6599,6 @@ function deserializeQueryExpression(expression, user2) {
6919
6599
  ...expression.assignedTo,
6920
6600
  term: userDeserializer(expression.assignedTo.term, user2)
6921
6601
  },
6922
- createdByUserType: expression.createdByUserType,
6923
6602
  createdBy: expression.createdBy && {
6924
6603
  ...expression.createdBy,
6925
6604
  term: userDeserializer(expression.createdBy.term, user2)
@@ -6960,51 +6639,3 @@ function deserializeQuery(query, user2) {
6960
6639
  )
6961
6640
  };
6962
6641
  }
6963
-
6964
- // ../commons/src/events/state/availableActions.ts
6965
- var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
6966
- [EventStatus.enum.CREATED]: [
6967
- ActionType.READ,
6968
- ActionType.DECLARE,
6969
- ActionType.NOTIFY,
6970
- ActionType.DELETE
6971
- ],
6972
- [EventStatus.enum.NOTIFIED]: [
6973
- ActionType.READ,
6974
- ActionType.DECLARE,
6975
- ActionType.ARCHIVE,
6976
- ActionType.REJECT
6977
- ],
6978
- [EventStatus.enum.DECLARED]: [
6979
- ActionType.READ,
6980
- ActionType.VALIDATE,
6981
- ActionType.ARCHIVE,
6982
- ActionType.REJECT
6983
- ],
6984
- [EventStatus.enum.VALIDATED]: [
6985
- ActionType.READ,
6986
- ActionType.REGISTER,
6987
- ActionType.ARCHIVE,
6988
- ActionType.REJECT
6989
- ],
6990
- [EventStatus.enum.REJECTED]: [
6991
- ActionType.READ,
6992
- ActionType.DECLARE,
6993
- ActionType.VALIDATE
6994
- ],
6995
- [EventStatus.enum.REGISTERED]: [
6996
- ActionType.READ,
6997
- ActionType.PRINT_CERTIFICATE,
6998
- ActionType.REQUEST_CORRECTION
6999
- ],
7000
- [EventStatus.enum.CERTIFIED]: [
7001
- ActionType.READ,
7002
- ActionType.PRINT_CERTIFICATE,
7003
- ActionType.REQUEST_CORRECTION
7004
- ],
7005
- [EventStatus.enum.ARCHIVED]: [
7006
- ActionType.READ,
7007
- ActionType.ASSIGN,
7008
- ActionType.UNASSIGN
7009
- ]
7010
- };