@opencrvs/toolkit 2.0.0-rc.cedcafb → 2.0.0-rc.cf1e3e0

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 (100) hide show
  1. package/create-countryconfig/index.js +103 -0
  2. package/create-countryconfig/package.json +21 -0
  3. package/dist/application-config/index.js +261 -97
  4. package/dist/cli.js +1952 -347
  5. package/dist/commons/api/router.d.ts +3387 -255
  6. package/dist/commons/application-config/index.d.ts +16 -4
  7. package/dist/commons/conditionals/conditionals.d.ts +12 -6
  8. package/dist/commons/conditionals/validate.d.ts +1 -0
  9. package/dist/commons/events/ActionDocument.d.ts +6 -0
  10. package/dist/commons/events/ActionInput.d.ts +114 -0
  11. package/dist/commons/events/Draft.d.ts +4 -2
  12. package/dist/commons/events/EventDocument.d.ts +3 -0
  13. package/dist/commons/events/EventIndex.d.ts +0 -3
  14. package/dist/commons/events/EventMetadata.d.ts +0 -7
  15. package/dist/commons/events/FieldConfig.d.ts +10 -0
  16. package/dist/commons/events/WorkqueueConfig.d.ts +150 -150
  17. package/dist/commons/events/index.d.ts +2 -0
  18. package/dist/commons/events/locations.d.ts +38 -1
  19. package/dist/commons/events/mocks.test.utils.d.ts +19 -0
  20. package/dist/commons/events/scopes.d.ts +24 -1
  21. package/dist/commons/events/state/flags.d.ts +16 -0
  22. package/dist/commons/events/state/index.d.ts +0 -4
  23. package/dist/commons/events/state/utils.d.ts +3 -2
  24. package/dist/commons/events/utils.d.ts +12 -1
  25. package/dist/conditionals/index.js +44 -8
  26. package/dist/events/index.js +883 -181
  27. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -1
  28. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +63 -39
  29. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts +3 -0
  30. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts.map +1 -0
  31. package/dist/migrations/v2.0/add-resend-invite-notification.js +373 -0
  32. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +19 -0
  33. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  34. package/dist/migrations/v2.0/checkout-upstream-files.js +17 -14
  35. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +1 -1
  36. package/dist/migrations/v2.0/convert-config-files-to-ts.js +4 -5
  37. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +1 -1
  38. package/dist/migrations/v2.0/convert-paragraph-to-heading.js +4 -5
  39. package/dist/migrations/v2.0/create-events-index.d.ts.map +1 -1
  40. package/dist/migrations/v2.0/create-events-index.js +1 -2
  41. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +11 -0
  42. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -0
  43. package/dist/migrations/v2.0/delete-infrastructure-directory.js +123 -0
  44. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +3 -0
  45. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +1 -0
  46. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +110 -0
  47. package/dist/migrations/v2.0/index.d.ts +10 -4
  48. package/dist/migrations/v2.0/index.d.ts.map +1 -1
  49. package/dist/migrations/v2.0/index.js +1920 -344
  50. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -1
  51. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +95 -7
  52. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +13 -0
  53. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -0
  54. package/dist/migrations/v2.0/merge-infrastructure-directory.js +222 -0
  55. package/dist/migrations/v2.0/migrate-application-config-url.d.ts +3 -0
  56. package/dist/migrations/v2.0/migrate-application-config-url.d.ts.map +1 -0
  57. package/dist/migrations/v2.0/migrate-application-config-url.js +342 -0
  58. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
  59. package/dist/migrations/v2.0/migrate-scopes.js +55 -32
  60. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +1 -1
  61. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +3 -4
  62. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
  63. package/dist/migrations/v2.0/migrate-workqueue-configs.js +143 -63
  64. package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +1 -1
  65. package/dist/migrations/v2.0/remove-delete-actions.js +3 -4
  66. package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +1 -1
  67. package/dist/migrations/v2.0/remove-demo-scope.js +2 -3
  68. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +1 -1
  69. package/dist/migrations/v2.0/remove-deprecated-imports.js +3 -4
  70. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts +3 -0
  71. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts.map +1 -0
  72. package/dist/migrations/v2.0/remove-fhir-url-helpers.js +163 -0
  73. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +1 -1
  74. package/dist/migrations/v2.0/remove-hearth-migrations.js +1 -2
  75. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts +3 -0
  76. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts.map +1 -0
  77. package/dist/migrations/v2.0/remove-old-statistics-service.js +356 -0
  78. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +1 -1
  79. package/dist/migrations/v2.0/remove-pending-certification-flag.js +3 -4
  80. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +1 -1
  81. package/dist/migrations/v2.0/remove-review-from-register-action.js +3 -4
  82. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts +3 -0
  83. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts.map +1 -0
  84. package/dist/migrations/v2.0/remove-unused-environment-variables.js +186 -0
  85. package/dist/migrations/v2.0/rename-api-paths.d.ts.map +1 -1
  86. package/dist/migrations/v2.0/rename-api-paths.js +3 -4
  87. package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +1 -1
  88. package/dist/migrations/v2.0/rename-location-parent-id.js +3 -4
  89. package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts.map +1 -1
  90. package/dist/migrations/v2.0/simplify-analytics-precalculations.js +1 -2
  91. package/dist/migrations/v2.0/update-package-json.d.ts +3 -0
  92. package/dist/migrations/v2.0/update-package-json.d.ts.map +1 -0
  93. package/dist/migrations/v2.0/update-package-json.js +105 -0
  94. package/dist/notification/index.js +693 -126
  95. package/dist/scopes/index.d.ts +87 -10
  96. package/dist/scopes/index.js +46 -9
  97. package/opencrvs-toolkit-2.0.0-rc.cf1e3e0.tgz +0 -0
  98. package/package.json +6 -2
  99. package/tsconfig.tsbuildinfo +1 -1
  100. package/opencrvs-toolkit-2.0.0-rc.cedcafb.tgz +0 -0
@@ -75,7 +75,10 @@ var ActionConditional = z.discriminatedUnion("type", [
75
75
  ShowConditional,
76
76
  // Action can be shown to the user in the list but as disabled
77
77
  EnableConditional
78
- ]);
78
+ ]).meta({
79
+ id: "ActionConditional",
80
+ description: "Conditional gating whether an action is shown (SHOW) or enabled (ENABLE). When omitted from an action, the action is shown and enabled for everyone."
81
+ });
79
82
  var DisplayOnReviewConditional = z.object({
80
83
  type: z.literal(ConditionalType.DISPLAY_ON_REVIEW),
81
84
  conditional: Conditional
@@ -90,8 +93,8 @@ var FieldConditional = z.discriminatedUnion("type", [
90
93
  // Field output can be shown / hidden on the review page
91
94
  DisplayOnReviewConditional
92
95
  ]).meta({
93
- description: "Field conditional configuration",
94
- id: "FieldConditional"
96
+ id: "FieldConditional",
97
+ description: "Conditional gating whether a form field is shown (SHOW), enabled (ENABLE), or displayed on the review page (DISPLAY_ON_REVIEW). When omitted, the field is shown and enabled for everyone, and is displayed on review whenever it has a value."
95
98
  });
96
99
 
97
100
  // ../commons/src/events/TranslationConfig.ts
@@ -418,28 +421,20 @@ function schemaPriority(schema) {
418
421
  return idx === -1 ? 9999 : idx;
419
422
  }
420
423
  function safeUnion(schemas) {
424
+ const sortedSchemas = [...schemas].sort(
425
+ (a, b) => schemaPriority(a) - schemaPriority(b)
426
+ );
421
427
  return z7.any().superRefine((val, ctx) => {
422
- const successful = schemas.filter((s) => s.safeParse(val).success);
423
- if (successful.length === 1) {
424
- return;
425
- }
426
- if (successful.length === 0) {
427
- ctx.addIssue({
428
- code: "invalid_type",
429
- expected: "custom",
430
- message: "Value does not match any schema"
431
- });
432
- return;
433
- }
434
- successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
435
- const best = successful[0];
436
- if (!best.safeParse(val).success) {
437
- ctx.addIssue({
438
- expected: "custom",
439
- code: "invalid_type",
440
- message: "Value did not match the best schema"
441
- });
428
+ for (const schema of sortedSchemas) {
429
+ if (schema.safeParse(val).success) {
430
+ return;
431
+ }
442
432
  }
433
+ ctx.addIssue({
434
+ code: "invalid_type",
435
+ expected: "custom",
436
+ message: "Value does not match any schema"
437
+ });
443
438
  }).meta({
444
439
  description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
445
440
  });
@@ -656,6 +651,10 @@ var scopeByEvent = z11.preprocess(
656
651
  (val) => val === void 0 ? void 0 : [val].flat(),
657
652
  z11.array(z11.string()).optional()
658
653
  ).describe("Event type, e.g. birth, death");
654
+ var userRole = z11.preprocess(
655
+ (val) => val === void 0 ? void 0 : [val].flat(),
656
+ z11.array(z11.string()).optional()
657
+ ).describe("User role, e.g. admin, field agent");
659
658
  var scopeOptionsPlaceEvent = z11.object({
660
659
  event: scopeByEvent,
661
660
  placeOfEvent: JurisdictionFilter.optional()
@@ -679,6 +678,9 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
679
678
  var AccessLevelOptions = z11.object({
680
679
  accessLevel: JurisdictionFilter.optional()
681
680
  });
681
+ var AllUserScopeOptions = AccessLevelOptions.extend({
682
+ role: userRole.optional()
683
+ });
682
684
  var WorkqueueOrDashboardOptions = z11.object({
683
685
  ids: z11.preprocess(
684
686
  (val) => val === void 0 ? void 0 : [val].flat(),
@@ -688,6 +690,7 @@ var WorkqueueOrDashboardOptions = z11.object({
688
690
  var AllScopeOptions = z11.object({
689
691
  ...AllRecordScopeOptions.shape,
690
692
  ...AccessLevelOptions.shape,
693
+ ...AllUserScopeOptions.shape,
691
694
  ...WorkqueueOrDashboardOptions.shape
692
695
  });
693
696
  var ScopeOptionKey = AllScopeOptions.keyof();
@@ -760,6 +763,30 @@ var RecordScopeV2 = z11.discriminatedUnion("type", [
760
763
  ]).describe(
761
764
  "Scopes used to check user's permission to perform actions on a record."
762
765
  );
766
+ var SystemScopeType = z11.enum([
767
+ "organisation.read-locations",
768
+ "user.read",
769
+ "user.create",
770
+ "user.edit",
771
+ "user.search"
772
+ ]);
773
+ var UserScopeType = SystemScopeType.extract([
774
+ "user.read",
775
+ "user.create",
776
+ "user.edit",
777
+ "user.search"
778
+ ]);
779
+ var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
780
+ var UserScopeV2 = z11.discriminatedUnion("type", [
781
+ z11.object({
782
+ type: ScopesWithRoleOption,
783
+ options: AllUserScopeOptions.optional()
784
+ }),
785
+ z11.object({
786
+ type: UserScopeType.extract(["user.read", "user.search"]),
787
+ options: AccessLevelOptions.optional()
788
+ })
789
+ ]);
763
790
  var ResolvedRecordScopeV2 = z11.discriminatedUnion("type", [
764
791
  z11.object({
765
792
  type: ScopesWithPlaceEventOptions,
@@ -780,16 +807,14 @@ var ResolvedRecordScopeV2 = z11.discriminatedUnion("type", [
780
807
  }).optional()
781
808
  })
782
809
  ]).describe("Resolved scope with location/user IDs instead of filters.");
783
- var SystemScopeType = z11.enum([
784
- "organisation.read-locations",
785
- "user.read",
786
- "user.create",
787
- "user.edit"
788
- ]);
789
810
  var Scope = z11.discriminatedUnion("type", [
790
811
  z11.object({ type: PlainScopeType }),
791
812
  ...RecordScopeV2.options,
792
- z11.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
813
+ ...UserScopeV2.options,
814
+ z11.object({
815
+ type: z11.literal("organisation.read-locations"),
816
+ options: AccessLevelOptions.optional()
817
+ }),
793
818
  z11.object({
794
819
  type: z11.literal("workqueue"),
795
820
  options: WorkqueueOrDashboardOptions
@@ -809,7 +834,9 @@ var ScopeType = z11.enum([
809
834
  var EncodedScope = z11.string().brand("EncodedScope");
810
835
  var DEFAULT_SCOPE_OPTIONS = {
811
836
  placeOfEvent: JurisdictionFilter.enum.all,
812
- accessLevel: JurisdictionFilter.enum.all
837
+ accessLevel: JurisdictionFilter.enum.all,
838
+ registeredIn: JurisdictionFilter.enum.all,
839
+ declaredIn: JurisdictionFilter.enum.all
813
840
  };
814
841
 
815
842
  // ../commons/src/authentication.ts
@@ -962,8 +989,9 @@ var RequestedCorrectionAction = ActionBase.extend(
962
989
  var ApprovedCorrectionAction = ActionBase.extend(
963
990
  z13.object({
964
991
  type: z13.literal(ActionType.APPROVE_CORRECTION),
965
- requestId: z13.string()
992
+ requestId: z13.string(),
966
993
  // TODO move into 'content' property
994
+ content: z13.object({ immediateCorrection: z13.boolean().optional() }).optional()
967
995
  }).shape
968
996
  );
969
997
  var RejectedCorrectionAction = ActionBase.extend(
@@ -1055,6 +1083,9 @@ var FlagConfig = z14.object({
1055
1083
  "Indicates if this flag expects an action to be performed to be cleared."
1056
1084
  ),
1057
1085
  label: TranslationConfig.describe("Human readable label of the flag.")
1086
+ }).meta({
1087
+ id: "FlagConfig",
1088
+ description: "Configuration for a custom flag that can be added to or removed from records by event actions."
1058
1089
  });
1059
1090
  var ActionFlagConfig = z14.object({
1060
1091
  id: Flag,
@@ -1062,6 +1093,9 @@ var ActionFlagConfig = z14.object({
1062
1093
  conditional: Conditional.optional().describe(
1063
1094
  "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
1064
1095
  )
1096
+ }).meta({
1097
+ id: "ActionFlagConfig",
1098
+ description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
1065
1099
  });
1066
1100
 
1067
1101
  // ../commons/src/events/EventMetadata.ts
@@ -1083,8 +1117,7 @@ var ActionCreationMetadata = z15.object({
1083
1117
  ),
1084
1118
  createdByUserType: z15.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1085
1119
  acceptedAt: z15.iso.datetime().describe("Timestamp when the action request was accepted."),
1086
- createdByRole: z15.string().optional().describe("Role of the user at the time of action request creation."),
1087
- createdBySignature: z15.string().nullish().describe("Signature of the user who created the action request.")
1120
+ createdByRole: z15.string().optional().describe("Role of the user at the time of action request creation.")
1088
1121
  });
1089
1122
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1090
1123
  registrationNumber: z15.string().describe(
@@ -1112,9 +1145,6 @@ var EventMetadata = z15.object({
1112
1145
  createdAtLocation: UUID.nullish().describe(
1113
1146
  "Location of the user who created the event."
1114
1147
  ),
1115
- createdBySignature: DocumentPath.nullish().describe(
1116
- "Signature of the user who created the event."
1117
- ),
1118
1148
  updatedAtLocation: UUID.nullish().describe(
1119
1149
  "Location of the user who last changed the status."
1120
1150
  ),
@@ -1378,14 +1408,21 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
1378
1408
  }
1379
1409
  }).describe("Unique identifier for the field");
1380
1410
  var FieldReference = import_v43.default.object({
1381
- $$field: FieldId,
1411
+ $$field: FieldId.describe("Id of the field to reference"),
1382
1412
  $$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
1383
1413
  'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
1384
1414
  )
1385
1415
  }).describe("Reference to a field by its ID");
1386
1416
  var ValidationConfig = import_v43.default.object({
1387
- validator: Conditional,
1388
- message: TranslationConfig
1417
+ validator: Conditional.describe(
1418
+ "Conditional expression that must hold for the field value to be considered valid."
1419
+ ),
1420
+ message: TranslationConfig.describe(
1421
+ "Error message displayed when the validator does not hold."
1422
+ )
1423
+ }).meta({
1424
+ id: "ValidationConfig",
1425
+ description: "Validation rule applied to a form field. The validator is a conditional expression that must hold for the field value to be considered valid."
1389
1426
  });
1390
1427
  var requiredSchema = import_v43.default.union([
1391
1428
  import_v43.default.boolean(),
@@ -1424,6 +1461,9 @@ var BaseField = import_v43.default.object({
1424
1461
  }).describe("Common properties shared across all field types.");
1425
1462
  var Divider = BaseField.extend({
1426
1463
  type: import_v43.default.literal(FieldType.DIVIDER)
1464
+ }).meta({
1465
+ description: "A horizontal line divider",
1466
+ id: "Divider"
1427
1467
  });
1428
1468
  var TextField = BaseField.extend({
1429
1469
  type: import_v43.default.literal(FieldType.TEXT),
@@ -1434,7 +1474,10 @@ var TextField = BaseField.extend({
1434
1474
  prefix: TranslationConfig.optional(),
1435
1475
  postfix: TranslationConfig.optional()
1436
1476
  }).default({ type: "text" }).optional()
1437
- }).describe("Text input");
1477
+ }).meta({
1478
+ description: "A text input field",
1479
+ id: "TextField"
1480
+ });
1438
1481
  var NumberField = BaseField.extend({
1439
1482
  type: import_v43.default.literal(FieldType.NUMBER),
1440
1483
  defaultValue: NumberFieldValue.optional(),
@@ -1444,7 +1487,10 @@ var NumberField = BaseField.extend({
1444
1487
  prefix: TranslationConfig.optional(),
1445
1488
  postfix: TranslationConfig.optional()
1446
1489
  }).optional()
1447
- }).describe("Number input");
1490
+ }).meta({
1491
+ description: "A number input field",
1492
+ id: "NumberField"
1493
+ });
1448
1494
  var TextAreaField = BaseField.extend({
1449
1495
  type: import_v43.default.literal(FieldType.TEXTAREA),
1450
1496
  defaultValue: NonEmptyTextValue.optional(),
@@ -1455,7 +1501,10 @@ var TextAreaField = BaseField.extend({
1455
1501
  prefix: TranslationConfig.optional(),
1456
1502
  postfix: TranslationConfig.optional()
1457
1503
  }).default({ rows: 4 }).optional()
1458
- }).describe("Multiline text input");
1504
+ }).meta({
1505
+ description: "A multiline text input",
1506
+ id: "TextAreaField"
1507
+ });
1459
1508
  var ImageMimeType = import_v43.default.enum([
1460
1509
  "image/png",
1461
1510
  "image/jpg",
@@ -1485,13 +1534,19 @@ var SignatureField = BaseField.extend({
1485
1534
  }).default({
1486
1535
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1487
1536
  })
1488
- }).describe("Signature input field");
1537
+ }).meta({
1538
+ description: "A signature input field",
1539
+ id: "SignatureField"
1540
+ });
1489
1541
  var EmailField = BaseField.extend({
1490
1542
  type: import_v43.default.literal(FieldType.EMAIL),
1491
1543
  configuration: import_v43.default.object({
1492
1544
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
1493
1545
  }).default({ maxLength: 255 }).optional(),
1494
1546
  defaultValue: NonEmptyTextValue.optional()
1547
+ }).meta({
1548
+ description: "An email input field",
1549
+ id: "EmailField"
1495
1550
  });
1496
1551
  var DateField = BaseField.extend({
1497
1552
  type: import_v43.default.literal(FieldType.DATE),
@@ -1501,7 +1556,10 @@ var DateField = BaseField.extend({
1501
1556
  "Text to display above the date input"
1502
1557
  ).optional()
1503
1558
  }).optional()
1504
- }).describe("A single date input (yyyy-MM-dd)");
1559
+ }).meta({
1560
+ description: "A date input (yyyy-MM-dd)",
1561
+ id: "DateField"
1562
+ });
1505
1563
  var AgeField = BaseField.extend({
1506
1564
  type: import_v43.default.literal(FieldType.AGE),
1507
1565
  defaultValue: NumberFieldValue.optional(),
@@ -1510,7 +1568,10 @@ var AgeField = BaseField.extend({
1510
1568
  prefix: TranslationConfig.optional(),
1511
1569
  postfix: TranslationConfig.optional()
1512
1570
  })
1513
- }).describe("An age input field which uses the current date as the asOfDate");
1571
+ }).meta({
1572
+ description: "An age input field which uses the current date as the asOfDate",
1573
+ id: "AgeField"
1574
+ });
1514
1575
  var TimeField = BaseField.extend({
1515
1576
  type: import_v43.default.literal(FieldType.TIME),
1516
1577
  defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
@@ -1520,7 +1581,10 @@ var TimeField = BaseField.extend({
1520
1581
  "Text to display above the time input"
1521
1582
  ).optional()
1522
1583
  }).optional()
1523
- }).describe("A single date input (HH-mm)");
1584
+ }).meta({
1585
+ description: "A single time input (HH-mm)",
1586
+ id: "TimeField"
1587
+ });
1524
1588
  var DateRangeField = BaseField.extend({
1525
1589
  type: import_v43.default.literal(FieldType.DATE_RANGE),
1526
1590
  defaultValue: DateRangeFieldValue.optional(),
@@ -1529,7 +1593,10 @@ var DateRangeField = BaseField.extend({
1529
1593
  "Text to display above the date input"
1530
1594
  ).optional()
1531
1595
  }).optional()
1532
- }).describe("A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })");
1596
+ }).meta({
1597
+ description: "A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })",
1598
+ id: "DateRangeField"
1599
+ });
1533
1600
  var HtmlFontVariant = import_v43.default.enum([
1534
1601
  "reg12",
1535
1602
  "reg14",
@@ -1573,18 +1640,30 @@ var ImageViewField = BaseField.extend({
1573
1640
  type: import_v43.default.literal(FieldType.IMAGE_VIEW),
1574
1641
  defaultValue: NonEmptyTextValue.optional(),
1575
1642
  configuration: ImageConfiguration
1576
- }).describe("A read-only image component for form pages");
1643
+ }).meta({
1644
+ description: "A read-only image component for form pages",
1645
+ id: "ImageViewField"
1646
+ });
1577
1647
  var Paragraph = BaseField.extend({
1578
1648
  type: import_v43.default.literal(FieldType.PARAGRAPH),
1579
1649
  configuration: ParagraphConfiguration
1580
- }).describe("A read-only HTML <p> paragraph");
1650
+ }).meta({
1651
+ description: "A read-only HTML <p> paragraph",
1652
+ id: "Paragraph"
1653
+ });
1581
1654
  var Heading = BaseField.extend({
1582
1655
  type: import_v43.default.literal(FieldType.HEADING),
1583
1656
  configuration: HeadingConfiguration
1584
- }).describe("A read-only heading component for form pages");
1657
+ }).meta({
1658
+ description: "A read-only heading component for form pages",
1659
+ id: "Heading"
1660
+ });
1585
1661
  var PageHeader = BaseField.extend({
1586
1662
  type: import_v43.default.literal(FieldType.PAGE_HEADER)
1587
- }).describe("A read-only header component for form pages");
1663
+ }).meta({
1664
+ description: "A read-only header component for form pages",
1665
+ id: "PageHeader"
1666
+ });
1588
1667
  var File = BaseField.extend({
1589
1668
  type: import_v43.default.literal(FieldType.FILE),
1590
1669
  defaultValue: FileFieldValue.optional(),
@@ -1603,7 +1682,10 @@ var File = BaseField.extend({
1603
1682
  }).default({
1604
1683
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1605
1684
  })
1606
- }).describe("File upload");
1685
+ }).meta({
1686
+ description: "A file upload field",
1687
+ id: "File"
1688
+ });
1607
1689
  var SelectOption = import_v43.default.object({
1608
1690
  value: import_v43.default.string().describe("The value of the option"),
1609
1691
  label: import_v43.default.union([import_v43.default.string(), TranslationConfig]).describe("The label of the option"),
@@ -1620,7 +1702,10 @@ var NumberWithUnitField = BaseField.extend({
1620
1702
  "Placeholder for the number field"
1621
1703
  )
1622
1704
  }).optional()
1623
- }).describe("Number with unit input");
1705
+ }).meta({
1706
+ description: "A number with unit input field",
1707
+ id: "NumberWithUnitField"
1708
+ });
1624
1709
  var RadioGroup = BaseField.extend({
1625
1710
  type: import_v43.default.literal(FieldType.RADIO_GROUP),
1626
1711
  defaultValue: TextValue.optional(),
@@ -1630,7 +1715,10 @@ var RadioGroup = BaseField.extend({
1630
1715
  size: import_v43.default.enum(["NORMAL", "LARGE"]).optional()
1631
1716
  }).optional()
1632
1717
  }).optional()
1633
- }).describe("Grouped radio options");
1718
+ }).meta({
1719
+ description: "A grouped radio button field",
1720
+ id: "RadioGroup"
1721
+ });
1634
1722
  var BulletList = BaseField.extend({
1635
1723
  type: import_v43.default.literal(FieldType.BULLET_LIST),
1636
1724
  items: import_v43.default.array(TranslationConfig).describe("A list of items"),
@@ -1639,7 +1727,10 @@ var BulletList = BaseField.extend({
1639
1727
  fontVariant: HtmlFontVariant.optional()
1640
1728
  }).optional()
1641
1729
  }).default({})
1642
- }).describe("A list of bullet points");
1730
+ }).meta({
1731
+ description: "A list of bullet points",
1732
+ id: "BulletList"
1733
+ });
1643
1734
  var Select = BaseField.extend({
1644
1735
  type: import_v43.default.literal(FieldType.SELECT),
1645
1736
  defaultValue: TextValue.optional(),
@@ -1654,7 +1745,10 @@ var Select = BaseField.extend({
1654
1745
  { ..., defaultMessage: "'{input}' is not listed among the health facilities." }
1655
1746
  `
1656
1747
  )
1657
- }).describe("Select input");
1748
+ }).meta({
1749
+ description: "A select input field",
1750
+ id: "Select"
1751
+ });
1658
1752
  var SelectDateRangeOption = import_v43.default.object({
1659
1753
  value: SelectDateRangeValue.describe("The value of the option"),
1660
1754
  label: TranslationConfig.describe("The label of the option")
@@ -1663,7 +1757,10 @@ var SelectDateRangeField = BaseField.extend({
1663
1757
  type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
1664
1758
  defaultValue: SelectDateRangeValue.optional(),
1665
1759
  options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
1666
- }).describe("Select input with date range options");
1760
+ }).meta({
1761
+ description: "A date range selection field",
1762
+ id: "SelectDateRangeField"
1763
+ });
1667
1764
  var NameConfig = import_v43.default.object({
1668
1765
  firstname: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
1669
1766
  middlename: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
@@ -1694,26 +1791,41 @@ var NameField = BaseField.extend({
1694
1791
  surname: { required: true }
1695
1792
  }
1696
1793
  }).optional()
1697
- }).describe("Name input field");
1794
+ }).meta({
1795
+ description: "A field for entering a persons name",
1796
+ id: "NameField"
1797
+ });
1698
1798
  var PhoneField = BaseField.extend({
1699
1799
  defaultValue: NonEmptyTextValue.optional(),
1700
1800
  type: import_v43.default.literal(FieldType.PHONE)
1701
- }).describe("Phone input field");
1801
+ }).meta({
1802
+ description: "A field for entering a phone number",
1803
+ id: "PhoneField"
1804
+ });
1702
1805
  var IdField = BaseField.extend({
1703
1806
  defaultValue: NonEmptyTextValue.optional(),
1704
1807
  type: import_v43.default.literal(FieldType.ID)
1705
- }).describe("ID input field");
1808
+ }).meta({
1809
+ description: "A field for entering an ID",
1810
+ id: "IdField"
1811
+ });
1706
1812
  var Checkbox = BaseField.extend({
1707
1813
  type: import_v43.default.literal(FieldType.CHECKBOX),
1708
1814
  defaultValue: CheckboxFieldValue.default(false)
1709
- }).describe("Boolean checkbox field");
1815
+ }).meta({
1816
+ description: "A boolean checkbox field",
1817
+ id: "Checkbox"
1818
+ });
1710
1819
  var Country = BaseField.extend({
1711
1820
  type: import_v43.default.literal(FieldType.COUNTRY),
1712
1821
  defaultValue: NonEmptyTextValue.optional(),
1713
1822
  optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
1714
1823
  "Conditionals for specific countries. Countries not listed are always shown and enabled."
1715
1824
  )
1716
- }).describe("Country select field");
1825
+ }).meta({
1826
+ description: "A field for selecting a country",
1827
+ id: "Country"
1828
+ });
1717
1829
  var AllowedLocations = JurisdictionReference.optional().describe(
1718
1830
  "Limits which location options are selectable depending on user jurisdiction and location."
1719
1831
  );
@@ -1722,16 +1834,18 @@ var AdministrativeAreas = import_v43.default.enum([
1722
1834
  "HEALTH_FACILITY",
1723
1835
  "CRVS_OFFICE"
1724
1836
  ]);
1725
- var AdministrativeAreaConfiguration = import_v43.default.object({
1726
- partOf: FieldReference.optional().describe("Parent location"),
1727
- type: AdministrativeAreas,
1728
- allowedLocations: AllowedLocations
1729
- }).describe("Administrative area options");
1730
1837
  var AdministrativeAreaField = BaseField.extend({
1731
1838
  type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
1732
1839
  defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
1733
- configuration: AdministrativeAreaConfiguration
1734
- }).describe("Administrative area input field e.g. facility, office");
1840
+ configuration: import_v43.default.object({
1841
+ partOf: FieldReference.optional().describe("Parent location"),
1842
+ type: AdministrativeAreas,
1843
+ allowedLocations: AllowedLocations
1844
+ }).describe("Administrative area options")
1845
+ }).meta({
1846
+ description: "Administrative area input field",
1847
+ id: "AdministrativeAreaField"
1848
+ });
1735
1849
  var LocationInput = BaseField.extend({
1736
1850
  type: import_v43.default.literal(FieldType.LOCATION),
1737
1851
  defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
@@ -1739,7 +1853,10 @@ var LocationInput = BaseField.extend({
1739
1853
  locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
1740
1854
  allowedLocations: AllowedLocations
1741
1855
  }).optional()
1742
- }).describe("Input field for a location");
1856
+ }).meta({
1857
+ description: "A field for selecting a location",
1858
+ id: "LocationInput"
1859
+ });
1743
1860
  var FileUploadWithOptions = BaseField.extend({
1744
1861
  type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
1745
1862
  options: import_v43.default.array(SelectOption).describe("A list of options"),
@@ -1753,6 +1870,9 @@ var FileUploadWithOptions = BaseField.extend({
1753
1870
  }).default({
1754
1871
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1755
1872
  })
1873
+ }).meta({
1874
+ description: "A field for uploading files with file type options",
1875
+ id: "FileUploadWithOptions"
1756
1876
  });
1757
1877
  var Facility = BaseField.extend({
1758
1878
  type: import_v43.default.literal(FieldType.FACILITY),
@@ -1798,7 +1918,10 @@ var Address = BaseField.extend({
1798
1918
  allowedLocations: AllowedLocations
1799
1919
  }).optional(),
1800
1920
  defaultValue: DefaultAddressFieldValue.optional()
1801
- }).describe("Address input field \u2013 a combination of location and text fields");
1921
+ }).meta({
1922
+ description: "Address input field \u2013 a combination of location and text fields",
1923
+ id: "Address"
1924
+ });
1802
1925
  var StaticDataEntry = import_v43.default.object({
1803
1926
  id: import_v43.default.string().describe("ID for the data entry."),
1804
1927
  label: TranslationConfig,
@@ -1813,7 +1936,10 @@ var DataField = BaseField.extend({
1813
1936
  subtitle: TranslationConfig.optional(),
1814
1937
  data: import_v43.default.array(DataEntry)
1815
1938
  })
1816
- }).describe("Data field for displaying read-only data");
1939
+ }).meta({
1940
+ description: "A field for displaying a table of read-only data",
1941
+ id: "DataField"
1942
+ });
1817
1943
  var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
1818
1944
  var ButtonType = import_v43.default.enum([
1819
1945
  "primary",
@@ -1840,11 +1966,17 @@ var ButtonField = BaseField.extend({
1840
1966
  type: import_v43.default.literal(FieldType.BUTTON),
1841
1967
  defaultValue: ButtonFieldValue.optional(),
1842
1968
  configuration: ButtonConfiguration
1843
- }).describe("Generic button without any built-in functionality");
1969
+ }).meta({
1970
+ description: "A generic button that can be used to trigger an action",
1971
+ id: "ButtonField"
1972
+ });
1844
1973
  var FieldGroup = BaseField.extend({
1845
1974
  type: import_v43.default.literal(FieldType.FIELD_GROUP),
1846
1975
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
1847
1976
  fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig))
1977
+ }).meta({
1978
+ description: "A group of fields that are displayed together",
1979
+ id: "FieldGroup"
1848
1980
  });
1849
1981
  var AlphaPrintButton = BaseField.extend({
1850
1982
  type: import_v43.default.literal(FieldType.ALPHA_PRINT_BUTTON),
@@ -1854,7 +1986,10 @@ var AlphaPrintButton = BaseField.extend({
1854
1986
  "Label for the print button"
1855
1987
  )
1856
1988
  })
1857
- }).describe("Print button field for printing certificates");
1989
+ }).meta({
1990
+ description: "An experimental print button field for printing certificates during the declaration process",
1991
+ id: "AlphaPrintButton"
1992
+ });
1858
1993
  var HttpField = BaseField.extend({
1859
1994
  type: import_v43.default.literal(FieldType.HTTP),
1860
1995
  defaultValue: HttpFieldValue.optional(),
@@ -1870,20 +2005,30 @@ var HttpField = BaseField.extend({
1870
2005
  params: import_v43.default.record(import_v43.default.string(), import_v43.default.union([import_v43.default.string(), FieldReference])).optional(),
1871
2006
  timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
1872
2007
  })
1873
- }).describe("HTTP request function triggered by a button click or other event");
2008
+ }).meta({
2009
+ description: "Makes a background HTTP request to an external service and stores the response so other fields can use it. Has no visible UI \u2014 pair with LOADER to show request status.",
2010
+ id: "HttpField"
2011
+ });
1874
2012
  var AutocompleteField = BaseField.extend({
1875
2013
  type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
1876
2014
  configuration: import_v43.default.object({
1877
- url: import_v43.default.string().describe("URL to fetch autocomplete suggestions from").optional(),
2015
+ url: import_v43.default.string().describe(
2016
+ "URL to fetch autocomplete suggestions from. This should be a country config server endpoint."
2017
+ ).optional(),
1878
2018
  method: import_v43.default.enum(["GET", "POST"]).default("GET").optional(),
1879
2019
  defaultOptions: import_v43.default.array(
1880
2020
  import_v43.default.object({
1881
2021
  label: import_v43.default.string(),
1882
2022
  value: import_v43.default.string()
1883
2023
  })
1884
- ).optional()
2024
+ ).optional().describe(
2025
+ "Manual entry is supported through configuration, allowing users to provide values not currently represented in the dataset."
2026
+ )
1885
2027
  })
1886
- }).describe("Autocomplete input field");
2028
+ }).meta({
2029
+ description: "Generic autocomplete component designed for use with large dictionary-based datasets. The component supports dynamic retrieval of options from configurable data sources and is intended for datasets that may contain tens or hundreds of thousands of records.",
2030
+ id: "AutocompleteField"
2031
+ });
1887
2032
  var SearchField = HttpField.extend({
1888
2033
  type: import_v43.default.literal(FieldType.SEARCH),
1889
2034
  configuration: SearchQuery.pick({
@@ -1916,6 +2061,9 @@ var SearchField = HttpField.extend({
1916
2061
  ok: TranslationConfig.optional()
1917
2062
  }).optional()
1918
2063
  })
2064
+ }).meta({
2065
+ description: "A search input field",
2066
+ id: "SearchField"
1919
2067
  });
1920
2068
  var LinkButtonField = BaseField.extend({
1921
2069
  type: import_v43.default.literal(FieldType.LINK_BUTTON),
@@ -1924,7 +2072,10 @@ var LinkButtonField = BaseField.extend({
1924
2072
  text: TranslationConfig.describe("Text to display on the button"),
1925
2073
  icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
1926
2074
  })
1927
- }).describe("Button that opens a link");
2075
+ }).meta({
2076
+ description: "A button that opens a URL link",
2077
+ id: "LinkButtonField"
2078
+ });
1928
2079
  var VerificationStatus = BaseField.extend({
1929
2080
  type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
1930
2081
  defaultValue: VerificationStatusValue.optional(),
@@ -1934,15 +2085,19 @@ var VerificationStatus = BaseField.extend({
1934
2085
  "Explaining text on the banner in form."
1935
2086
  )
1936
2087
  })
2088
+ }).meta({
2089
+ description: "Displays a verification state (e.g. ID verified / pending). Often paired with ID_READER \u2014 it can read its value off an ID_READER rather than holding its own.",
2090
+ id: "VerificationStatus"
1937
2091
  });
1938
2092
  var QueryParamReaderField = BaseField.extend({
1939
2093
  type: import_v43.default.literal(FieldType.QUERY_PARAM_READER),
1940
2094
  configuration: import_v43.default.object({
1941
2095
  pickParams: import_v43.default.array(import_v43.default.string()).describe("List of query parameters to read from the URL")
1942
2096
  })
1943
- }).describe(
1944
- "A field that maps URL query params into form values and clears them afterward"
1945
- );
2097
+ }).meta({
2098
+ description: "A field that maps URL query params into form values and clears them afterward",
2099
+ id: "QueryParamReaderField"
2100
+ });
1946
2101
  var QrReaderField = BaseField.extend({
1947
2102
  type: import_v43.default.literal(FieldType.QR_READER),
1948
2103
  defaultValue: QrReaderFieldValue.optional(),
@@ -1953,7 +2108,7 @@ var QrReaderField = BaseField.extend({
1953
2108
  })
1954
2109
  }).optional()
1955
2110
  }).meta({
1956
- description: "Configuration for QR code reader field, including optional JSON Schema validator.",
2111
+ description: "QR code reader field, including optional JSON Schema validator.",
1957
2112
  id: "QrReaderField"
1958
2113
  });
1959
2114
  var IdReaderField = BaseField.extend({
@@ -1962,12 +2117,18 @@ var IdReaderField = BaseField.extend({
1962
2117
  methods: import_v43.default.array(
1963
2118
  import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
1964
2119
  )
2120
+ }).meta({
2121
+ description: "A wrapper around nested form fields, specifically QR_READER and LINK_BUTTON. It can hold the QR_READERs value.",
2122
+ id: "IdReaderField"
1965
2123
  });
1966
2124
  var CustomField = BaseField.extend({
1967
2125
  type: import_v43.default.literal(FieldType._EXPERIMENTAL_CUSTOM),
1968
2126
  defaultValue: CustomFieldValue.optional(),
1969
2127
  src: import_v43.default.string().describe("Module source path for the custom field component"),
1970
2128
  configuration: import_v43.default.unknown().optional()
2129
+ }).meta({
2130
+ description: "An expiremental custom field that is defined by a module source path",
2131
+ id: "CustomField"
1971
2132
  });
1972
2133
  var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
1973
2134
  var LoaderField = BaseField.extend({
@@ -1977,22 +2138,25 @@ var LoaderField = BaseField.extend({
1977
2138
  configuration: import_v43.default.object({
1978
2139
  text: TranslationConfig.describe("Display text above the loading spinner")
1979
2140
  })
1980
- }).describe(
1981
- "A non-interactive field that indicates an in progress operation in form"
1982
- );
2141
+ }).meta({
2142
+ description: "A non-interactive field that indicates an in progress operation in form",
2143
+ id: "LoaderField"
2144
+ });
1983
2145
  var HiddenField = BaseField.extend({
1984
2146
  type: import_v43.default.literal(FieldType.ALPHA_HIDDEN),
1985
2147
  required: import_v43.default.boolean().default(false).optional(),
1986
2148
  defaultValue: TextValue.optional()
1987
- }).describe(
1988
- "A non-interactive, hidden field that only hold a value in the form"
1989
- );
2149
+ }).meta({
2150
+ description: "A non-interactive, hidden field that only hold a value in the form",
2151
+ id: "HiddenField"
2152
+ });
1990
2153
  var UserRoleField = BaseField.extend({
1991
2154
  type: import_v43.default.literal(FieldType.USER_ROLE),
1992
2155
  defaultValue: TextValue.optional()
1993
- }).describe(
1994
- "A select dropdown that is automatically populated with available user roles"
1995
- );
2156
+ }).meta({
2157
+ description: "A select dropdown that is automatically populated with available user roles",
2158
+ id: "UserRoleField"
2159
+ });
1996
2160
  var FieldConfig = import_v43.default.discriminatedUnion("type", [
1997
2161
  FieldGroup,
1998
2162
  Address,
@@ -2078,8 +2242,8 @@ var ApplicationConfig = z20.object({
2078
2242
  })
2079
2243
  ),
2080
2244
  PHONE_NUMBER_PATTERN: z20.string().or(z20.instanceof(RegExp)),
2081
- USER_NOTIFICATION_DELIVERY_METHOD: z20.string(),
2082
- INFORMANT_NOTIFICATION_DELIVERY_METHOD: z20.string(),
2245
+ USER_NOTIFICATION_DELIVERY_METHOD: z20.enum(["email", "sms"]),
2246
+ INFORMANT_NOTIFICATION_DELIVERY_METHOD: z20.enum(["email", "sms"]),
2083
2247
  SEARCH_DEFAULT_CRITERIA: SearchCriteria.optional().default("TRACKING_ID"),
2084
2248
  ADDITIONAL_USER_FIELDS: z20.array(FieldConfig).optional().default([])
2085
2249
  });
@@ -2097,8 +2261,8 @@ var BackgroundConfig = z20.object({
2097
2261
  var LoginConfig = z20.object({
2098
2262
  COUNTRY: z20.string(),
2099
2263
  LANGUAGES: z20.array(z20.string()),
2100
- USER_NOTIFICATION_DELIVERY_METHOD: z20.string(),
2101
- INFORMANT_NOTIFICATION_DELIVERY_METHOD: z20.string(),
2264
+ USER_NOTIFICATION_DELIVERY_METHOD: z20.enum(["email", "sms"]),
2265
+ INFORMANT_NOTIFICATION_DELIVERY_METHOD: z20.enum(["email", "sms"]),
2102
2266
  PHONE_NUMBER_PATTERN: z20.string().or(z20.instanceof(RegExp)),
2103
2267
  LOGIN_BACKGROUND: BackgroundConfig,
2104
2268
  SENTRY: z20.string().optional()