@opencrvs/toolkit 2.0.0-rc.45e2fdc → 2.0.0-rc.4844c26

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 (52) hide show
  1. package/create-countryconfig/index.js +73 -0
  2. package/create-countryconfig/package.json +11 -0
  3. package/dist/application-config/index.js +248 -92
  4. package/dist/cli.js +539 -175
  5. package/dist/commons/api/router.d.ts +3296 -247
  6. package/dist/commons/application-config/index.d.ts +16 -4
  7. package/dist/commons/conditionals/conditionals.d.ts +6 -6
  8. package/dist/commons/conditionals/validate.d.ts +1 -0
  9. package/dist/commons/events/ActionInput.d.ts +72 -0
  10. package/dist/commons/events/Draft.d.ts +2 -0
  11. package/dist/commons/events/EventIndex.d.ts +0 -3
  12. package/dist/commons/events/EventMetadata.d.ts +0 -7
  13. package/dist/commons/events/FieldConfig.d.ts +10 -0
  14. package/dist/commons/events/WorkqueueConfig.d.ts +150 -150
  15. package/dist/commons/events/locations.d.ts +38 -1
  16. package/dist/commons/events/mocks.test.utils.d.ts +19 -0
  17. package/dist/commons/events/scopes.d.ts +24 -1
  18. package/dist/commons/events/state/index.d.ts +0 -4
  19. package/dist/commons/events/state/utils.d.ts +0 -2
  20. package/dist/commons/events/utils.d.ts +1 -1
  21. package/dist/conditionals/index.js +40 -8
  22. package/dist/events/index.js +393 -144
  23. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -1
  24. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +60 -35
  25. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
  26. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  27. package/dist/migrations/v2.0/checkout-upstream-files.js +1 -2
  28. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +9 -1
  29. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -1
  30. package/dist/migrations/v2.0/delete-infrastructure-directory.js +66 -20
  31. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +3 -0
  32. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +1 -0
  33. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +110 -0
  34. package/dist/migrations/v2.0/index.d.ts +5 -3
  35. package/dist/migrations/v2.0/index.d.ts.map +1 -1
  36. package/dist/migrations/v2.0/index.js +537 -173
  37. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -1
  38. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +90 -1
  39. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +11 -1
  40. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -1
  41. package/dist/migrations/v2.0/merge-infrastructure-directory.js +17 -16
  42. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
  43. package/dist/migrations/v2.0/migrate-scopes.js +54 -30
  44. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
  45. package/dist/migrations/v2.0/migrate-workqueue-configs.js +140 -59
  46. package/dist/notification/index.js +287 -114
  47. package/dist/scopes/index.d.ts +87 -10
  48. package/dist/scopes/index.js +46 -9
  49. package/opencrvs-toolkit-2.0.0-rc.4844c26.tgz +0 -0
  50. package/package.json +1 -1
  51. package/tsconfig.tsbuildinfo +1 -1
  52. package/opencrvs-toolkit-2.0.0-rc.45e2fdc.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
+ description: "Action conditional configuration",
80
+ id: "ActionConditional"
81
+ });
79
82
  var DisplayOnReviewConditional = z.object({
80
83
  type: z.literal(ConditionalType.DISPLAY_ON_REVIEW),
81
84
  conditional: Conditional
@@ -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
@@ -1055,6 +1082,9 @@ var FlagConfig = z14.object({
1055
1082
  "Indicates if this flag expects an action to be performed to be cleared."
1056
1083
  ),
1057
1084
  label: TranslationConfig.describe("Human readable label of the flag.")
1085
+ }).meta({
1086
+ description: "Flag configuration",
1087
+ id: "FlagConfig"
1058
1088
  });
1059
1089
  var ActionFlagConfig = z14.object({
1060
1090
  id: Flag,
@@ -1062,6 +1092,9 @@ var ActionFlagConfig = z14.object({
1062
1092
  conditional: Conditional.optional().describe(
1063
1093
  "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
1064
1094
  )
1095
+ }).meta({
1096
+ description: "Action flag configuration",
1097
+ id: "ActionFlagConfig"
1065
1098
  });
1066
1099
 
1067
1100
  // ../commons/src/events/EventMetadata.ts
@@ -1083,8 +1116,7 @@ var ActionCreationMetadata = z15.object({
1083
1116
  ),
1084
1117
  createdByUserType: z15.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1085
1118
  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.")
1119
+ createdByRole: z15.string().optional().describe("Role of the user at the time of action request creation.")
1088
1120
  });
1089
1121
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1090
1122
  registrationNumber: z15.string().describe(
@@ -1112,9 +1144,6 @@ var EventMetadata = z15.object({
1112
1144
  createdAtLocation: UUID.nullish().describe(
1113
1145
  "Location of the user who created the event."
1114
1146
  ),
1115
- createdBySignature: DocumentPath.nullish().describe(
1116
- "Signature of the user who created the event."
1117
- ),
1118
1147
  updatedAtLocation: UUID.nullish().describe(
1119
1148
  "Location of the user who last changed the status."
1120
1149
  ),
@@ -1378,7 +1407,7 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
1378
1407
  }
1379
1408
  }).describe("Unique identifier for the field");
1380
1409
  var FieldReference = import_v43.default.object({
1381
- $$field: FieldId,
1410
+ $$field: FieldId.describe("Id of the field to reference"),
1382
1411
  $$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
1383
1412
  'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
1384
1413
  )
@@ -1424,6 +1453,9 @@ var BaseField = import_v43.default.object({
1424
1453
  }).describe("Common properties shared across all field types.");
1425
1454
  var Divider = BaseField.extend({
1426
1455
  type: import_v43.default.literal(FieldType.DIVIDER)
1456
+ }).meta({
1457
+ description: "A horizontal line divider",
1458
+ id: "Divider"
1427
1459
  });
1428
1460
  var TextField = BaseField.extend({
1429
1461
  type: import_v43.default.literal(FieldType.TEXT),
@@ -1434,7 +1466,10 @@ var TextField = BaseField.extend({
1434
1466
  prefix: TranslationConfig.optional(),
1435
1467
  postfix: TranslationConfig.optional()
1436
1468
  }).default({ type: "text" }).optional()
1437
- }).describe("Text input");
1469
+ }).meta({
1470
+ description: "A text input field",
1471
+ id: "TextField"
1472
+ });
1438
1473
  var NumberField = BaseField.extend({
1439
1474
  type: import_v43.default.literal(FieldType.NUMBER),
1440
1475
  defaultValue: NumberFieldValue.optional(),
@@ -1444,7 +1479,10 @@ var NumberField = BaseField.extend({
1444
1479
  prefix: TranslationConfig.optional(),
1445
1480
  postfix: TranslationConfig.optional()
1446
1481
  }).optional()
1447
- }).describe("Number input");
1482
+ }).meta({
1483
+ description: "A number input field",
1484
+ id: "NumberField"
1485
+ });
1448
1486
  var TextAreaField = BaseField.extend({
1449
1487
  type: import_v43.default.literal(FieldType.TEXTAREA),
1450
1488
  defaultValue: NonEmptyTextValue.optional(),
@@ -1455,7 +1493,10 @@ var TextAreaField = BaseField.extend({
1455
1493
  prefix: TranslationConfig.optional(),
1456
1494
  postfix: TranslationConfig.optional()
1457
1495
  }).default({ rows: 4 }).optional()
1458
- }).describe("Multiline text input");
1496
+ }).meta({
1497
+ description: "A multiline text input",
1498
+ id: "TextAreaField"
1499
+ });
1459
1500
  var ImageMimeType = import_v43.default.enum([
1460
1501
  "image/png",
1461
1502
  "image/jpg",
@@ -1485,13 +1526,19 @@ var SignatureField = BaseField.extend({
1485
1526
  }).default({
1486
1527
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1487
1528
  })
1488
- }).describe("Signature input field");
1529
+ }).meta({
1530
+ description: "A signature input field",
1531
+ id: "SignatureField"
1532
+ });
1489
1533
  var EmailField = BaseField.extend({
1490
1534
  type: import_v43.default.literal(FieldType.EMAIL),
1491
1535
  configuration: import_v43.default.object({
1492
1536
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
1493
1537
  }).default({ maxLength: 255 }).optional(),
1494
1538
  defaultValue: NonEmptyTextValue.optional()
1539
+ }).meta({
1540
+ description: "An email input field",
1541
+ id: "EmailField"
1495
1542
  });
1496
1543
  var DateField = BaseField.extend({
1497
1544
  type: import_v43.default.literal(FieldType.DATE),
@@ -1501,7 +1548,10 @@ var DateField = BaseField.extend({
1501
1548
  "Text to display above the date input"
1502
1549
  ).optional()
1503
1550
  }).optional()
1504
- }).describe("A single date input (yyyy-MM-dd)");
1551
+ }).meta({
1552
+ description: "A date input (yyyy-MM-dd)",
1553
+ id: "DateField"
1554
+ });
1505
1555
  var AgeField = BaseField.extend({
1506
1556
  type: import_v43.default.literal(FieldType.AGE),
1507
1557
  defaultValue: NumberFieldValue.optional(),
@@ -1510,7 +1560,10 @@ var AgeField = BaseField.extend({
1510
1560
  prefix: TranslationConfig.optional(),
1511
1561
  postfix: TranslationConfig.optional()
1512
1562
  })
1513
- }).describe("An age input field which uses the current date as the asOfDate");
1563
+ }).meta({
1564
+ description: "An age input field which uses the current date as the asOfDate",
1565
+ id: "AgeField"
1566
+ });
1514
1567
  var TimeField = BaseField.extend({
1515
1568
  type: import_v43.default.literal(FieldType.TIME),
1516
1569
  defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
@@ -1520,7 +1573,10 @@ var TimeField = BaseField.extend({
1520
1573
  "Text to display above the time input"
1521
1574
  ).optional()
1522
1575
  }).optional()
1523
- }).describe("A single date input (HH-mm)");
1576
+ }).meta({
1577
+ description: "A single time input (HH-mm)",
1578
+ id: "TimeField"
1579
+ });
1524
1580
  var DateRangeField = BaseField.extend({
1525
1581
  type: import_v43.default.literal(FieldType.DATE_RANGE),
1526
1582
  defaultValue: DateRangeFieldValue.optional(),
@@ -1529,7 +1585,10 @@ var DateRangeField = BaseField.extend({
1529
1585
  "Text to display above the date input"
1530
1586
  ).optional()
1531
1587
  }).optional()
1532
- }).describe("A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })");
1588
+ }).meta({
1589
+ description: "A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })",
1590
+ id: "DateRangeField"
1591
+ });
1533
1592
  var HtmlFontVariant = import_v43.default.enum([
1534
1593
  "reg12",
1535
1594
  "reg14",
@@ -1573,18 +1632,30 @@ var ImageViewField = BaseField.extend({
1573
1632
  type: import_v43.default.literal(FieldType.IMAGE_VIEW),
1574
1633
  defaultValue: NonEmptyTextValue.optional(),
1575
1634
  configuration: ImageConfiguration
1576
- }).describe("A read-only image component for form pages");
1635
+ }).meta({
1636
+ description: "A read-only image component for form pages",
1637
+ id: "ImageViewField"
1638
+ });
1577
1639
  var Paragraph = BaseField.extend({
1578
1640
  type: import_v43.default.literal(FieldType.PARAGRAPH),
1579
1641
  configuration: ParagraphConfiguration
1580
- }).describe("A read-only HTML <p> paragraph");
1642
+ }).meta({
1643
+ description: "A read-only HTML <p> paragraph",
1644
+ id: "Paragraph"
1645
+ });
1581
1646
  var Heading = BaseField.extend({
1582
1647
  type: import_v43.default.literal(FieldType.HEADING),
1583
1648
  configuration: HeadingConfiguration
1584
- }).describe("A read-only heading component for form pages");
1649
+ }).meta({
1650
+ description: "A read-only heading component for form pages",
1651
+ id: "Heading"
1652
+ });
1585
1653
  var PageHeader = BaseField.extend({
1586
1654
  type: import_v43.default.literal(FieldType.PAGE_HEADER)
1587
- }).describe("A read-only header component for form pages");
1655
+ }).meta({
1656
+ description: "A read-only header component for form pages",
1657
+ id: "PageHeader"
1658
+ });
1588
1659
  var File = BaseField.extend({
1589
1660
  type: import_v43.default.literal(FieldType.FILE),
1590
1661
  defaultValue: FileFieldValue.optional(),
@@ -1603,7 +1674,10 @@ var File = BaseField.extend({
1603
1674
  }).default({
1604
1675
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1605
1676
  })
1606
- }).describe("File upload");
1677
+ }).meta({
1678
+ description: "A file upload field",
1679
+ id: "File"
1680
+ });
1607
1681
  var SelectOption = import_v43.default.object({
1608
1682
  value: import_v43.default.string().describe("The value of the option"),
1609
1683
  label: import_v43.default.union([import_v43.default.string(), TranslationConfig]).describe("The label of the option"),
@@ -1620,7 +1694,10 @@ var NumberWithUnitField = BaseField.extend({
1620
1694
  "Placeholder for the number field"
1621
1695
  )
1622
1696
  }).optional()
1623
- }).describe("Number with unit input");
1697
+ }).meta({
1698
+ description: "A number with unit input field",
1699
+ id: "NumberWithUnitField"
1700
+ });
1624
1701
  var RadioGroup = BaseField.extend({
1625
1702
  type: import_v43.default.literal(FieldType.RADIO_GROUP),
1626
1703
  defaultValue: TextValue.optional(),
@@ -1630,7 +1707,10 @@ var RadioGroup = BaseField.extend({
1630
1707
  size: import_v43.default.enum(["NORMAL", "LARGE"]).optional()
1631
1708
  }).optional()
1632
1709
  }).optional()
1633
- }).describe("Grouped radio options");
1710
+ }).meta({
1711
+ description: "A grouped radio button field",
1712
+ id: "RadioGroup"
1713
+ });
1634
1714
  var BulletList = BaseField.extend({
1635
1715
  type: import_v43.default.literal(FieldType.BULLET_LIST),
1636
1716
  items: import_v43.default.array(TranslationConfig).describe("A list of items"),
@@ -1639,7 +1719,10 @@ var BulletList = BaseField.extend({
1639
1719
  fontVariant: HtmlFontVariant.optional()
1640
1720
  }).optional()
1641
1721
  }).default({})
1642
- }).describe("A list of bullet points");
1722
+ }).meta({
1723
+ description: "A list of bullet points",
1724
+ id: "BulletList"
1725
+ });
1643
1726
  var Select = BaseField.extend({
1644
1727
  type: import_v43.default.literal(FieldType.SELECT),
1645
1728
  defaultValue: TextValue.optional(),
@@ -1654,7 +1737,10 @@ var Select = BaseField.extend({
1654
1737
  { ..., defaultMessage: "'{input}' is not listed among the health facilities." }
1655
1738
  `
1656
1739
  )
1657
- }).describe("Select input");
1740
+ }).meta({
1741
+ description: "A select input field",
1742
+ id: "Select"
1743
+ });
1658
1744
  var SelectDateRangeOption = import_v43.default.object({
1659
1745
  value: SelectDateRangeValue.describe("The value of the option"),
1660
1746
  label: TranslationConfig.describe("The label of the option")
@@ -1663,7 +1749,10 @@ var SelectDateRangeField = BaseField.extend({
1663
1749
  type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
1664
1750
  defaultValue: SelectDateRangeValue.optional(),
1665
1751
  options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
1666
- }).describe("Select input with date range options");
1752
+ }).meta({
1753
+ description: "A date range selection field",
1754
+ id: "SelectDateRangeField"
1755
+ });
1667
1756
  var NameConfig = import_v43.default.object({
1668
1757
  firstname: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
1669
1758
  middlename: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
@@ -1694,26 +1783,41 @@ var NameField = BaseField.extend({
1694
1783
  surname: { required: true }
1695
1784
  }
1696
1785
  }).optional()
1697
- }).describe("Name input field");
1786
+ }).meta({
1787
+ description: "A field for entering a persons name",
1788
+ id: "NameField"
1789
+ });
1698
1790
  var PhoneField = BaseField.extend({
1699
1791
  defaultValue: NonEmptyTextValue.optional(),
1700
1792
  type: import_v43.default.literal(FieldType.PHONE)
1701
- }).describe("Phone input field");
1793
+ }).meta({
1794
+ description: "A field for entering a phone number",
1795
+ id: "PhoneField"
1796
+ });
1702
1797
  var IdField = BaseField.extend({
1703
1798
  defaultValue: NonEmptyTextValue.optional(),
1704
1799
  type: import_v43.default.literal(FieldType.ID)
1705
- }).describe("ID input field");
1800
+ }).meta({
1801
+ description: "A field for entering an ID",
1802
+ id: "IdField"
1803
+ });
1706
1804
  var Checkbox = BaseField.extend({
1707
1805
  type: import_v43.default.literal(FieldType.CHECKBOX),
1708
1806
  defaultValue: CheckboxFieldValue.default(false)
1709
- }).describe("Boolean checkbox field");
1807
+ }).meta({
1808
+ description: "A boolean checkbox field",
1809
+ id: "Checkbox"
1810
+ });
1710
1811
  var Country = BaseField.extend({
1711
1812
  type: import_v43.default.literal(FieldType.COUNTRY),
1712
1813
  defaultValue: NonEmptyTextValue.optional(),
1713
1814
  optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
1714
1815
  "Conditionals for specific countries. Countries not listed are always shown and enabled."
1715
1816
  )
1716
- }).describe("Country select field");
1817
+ }).meta({
1818
+ description: "A field for selecting a country",
1819
+ id: "Country"
1820
+ });
1717
1821
  var AllowedLocations = JurisdictionReference.optional().describe(
1718
1822
  "Limits which location options are selectable depending on user jurisdiction and location."
1719
1823
  );
@@ -1722,16 +1826,18 @@ var AdministrativeAreas = import_v43.default.enum([
1722
1826
  "HEALTH_FACILITY",
1723
1827
  "CRVS_OFFICE"
1724
1828
  ]);
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
1829
  var AdministrativeAreaField = BaseField.extend({
1731
1830
  type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
1732
1831
  defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
1733
- configuration: AdministrativeAreaConfiguration
1734
- }).describe("Administrative area input field e.g. facility, office");
1832
+ configuration: import_v43.default.object({
1833
+ partOf: FieldReference.optional().describe("Parent location"),
1834
+ type: AdministrativeAreas,
1835
+ allowedLocations: AllowedLocations
1836
+ }).describe("Administrative area options")
1837
+ }).meta({
1838
+ description: "Administrative area input field",
1839
+ id: "AdministrativeAreaField"
1840
+ });
1735
1841
  var LocationInput = BaseField.extend({
1736
1842
  type: import_v43.default.literal(FieldType.LOCATION),
1737
1843
  defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
@@ -1739,7 +1845,10 @@ var LocationInput = BaseField.extend({
1739
1845
  locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
1740
1846
  allowedLocations: AllowedLocations
1741
1847
  }).optional()
1742
- }).describe("Input field for a location");
1848
+ }).meta({
1849
+ description: "A field for selecting a location",
1850
+ id: "LocationInput"
1851
+ });
1743
1852
  var FileUploadWithOptions = BaseField.extend({
1744
1853
  type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
1745
1854
  options: import_v43.default.array(SelectOption).describe("A list of options"),
@@ -1753,6 +1862,9 @@ var FileUploadWithOptions = BaseField.extend({
1753
1862
  }).default({
1754
1863
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1755
1864
  })
1865
+ }).meta({
1866
+ description: "A field for uploading files with file type options",
1867
+ id: "FileUploadWithOptions"
1756
1868
  });
1757
1869
  var Facility = BaseField.extend({
1758
1870
  type: import_v43.default.literal(FieldType.FACILITY),
@@ -1798,7 +1910,10 @@ var Address = BaseField.extend({
1798
1910
  allowedLocations: AllowedLocations
1799
1911
  }).optional(),
1800
1912
  defaultValue: DefaultAddressFieldValue.optional()
1801
- }).describe("Address input field \u2013 a combination of location and text fields");
1913
+ }).meta({
1914
+ description: "Address input field \u2013 a combination of location and text fields",
1915
+ id: "Address"
1916
+ });
1802
1917
  var StaticDataEntry = import_v43.default.object({
1803
1918
  id: import_v43.default.string().describe("ID for the data entry."),
1804
1919
  label: TranslationConfig,
@@ -1813,7 +1928,10 @@ var DataField = BaseField.extend({
1813
1928
  subtitle: TranslationConfig.optional(),
1814
1929
  data: import_v43.default.array(DataEntry)
1815
1930
  })
1816
- }).describe("Data field for displaying read-only data");
1931
+ }).meta({
1932
+ description: "A field for displaying a table of read-only data",
1933
+ id: "DataField"
1934
+ });
1817
1935
  var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
1818
1936
  var ButtonType = import_v43.default.enum([
1819
1937
  "primary",
@@ -1840,11 +1958,17 @@ var ButtonField = BaseField.extend({
1840
1958
  type: import_v43.default.literal(FieldType.BUTTON),
1841
1959
  defaultValue: ButtonFieldValue.optional(),
1842
1960
  configuration: ButtonConfiguration
1843
- }).describe("Generic button without any built-in functionality");
1961
+ }).meta({
1962
+ description: "A generic button that can be used to trigger an action",
1963
+ id: "ButtonField"
1964
+ });
1844
1965
  var FieldGroup = BaseField.extend({
1845
1966
  type: import_v43.default.literal(FieldType.FIELD_GROUP),
1846
1967
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
1847
1968
  fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig))
1969
+ }).meta({
1970
+ description: "A group of fields that are displayed together",
1971
+ id: "FieldGroup"
1848
1972
  });
1849
1973
  var AlphaPrintButton = BaseField.extend({
1850
1974
  type: import_v43.default.literal(FieldType.ALPHA_PRINT_BUTTON),
@@ -1854,7 +1978,10 @@ var AlphaPrintButton = BaseField.extend({
1854
1978
  "Label for the print button"
1855
1979
  )
1856
1980
  })
1857
- }).describe("Print button field for printing certificates");
1981
+ }).meta({
1982
+ description: "An experimental print button field for printing certificates during the declaration process",
1983
+ id: "AlphaPrintButton"
1984
+ });
1858
1985
  var HttpField = BaseField.extend({
1859
1986
  type: import_v43.default.literal(FieldType.HTTP),
1860
1987
  defaultValue: HttpFieldValue.optional(),
@@ -1870,20 +1997,30 @@ var HttpField = BaseField.extend({
1870
1997
  params: import_v43.default.record(import_v43.default.string(), import_v43.default.union([import_v43.default.string(), FieldReference])).optional(),
1871
1998
  timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
1872
1999
  })
1873
- }).describe("HTTP request function triggered by a button click or other event");
2000
+ }).meta({
2001
+ 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.",
2002
+ id: "HttpField"
2003
+ });
1874
2004
  var AutocompleteField = BaseField.extend({
1875
2005
  type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
1876
2006
  configuration: import_v43.default.object({
1877
- url: import_v43.default.string().describe("URL to fetch autocomplete suggestions from").optional(),
2007
+ url: import_v43.default.string().describe(
2008
+ "URL to fetch autocomplete suggestions from. This should be a country config server endpoint."
2009
+ ).optional(),
1878
2010
  method: import_v43.default.enum(["GET", "POST"]).default("GET").optional(),
1879
2011
  defaultOptions: import_v43.default.array(
1880
2012
  import_v43.default.object({
1881
2013
  label: import_v43.default.string(),
1882
2014
  value: import_v43.default.string()
1883
2015
  })
1884
- ).optional()
2016
+ ).optional().describe(
2017
+ "Manual entry is supported through configuration, allowing users to provide values not currently represented in the dataset."
2018
+ )
1885
2019
  })
1886
- }).describe("Autocomplete input field");
2020
+ }).meta({
2021
+ 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.",
2022
+ id: "AutocompleteField"
2023
+ });
1887
2024
  var SearchField = HttpField.extend({
1888
2025
  type: import_v43.default.literal(FieldType.SEARCH),
1889
2026
  configuration: SearchQuery.pick({
@@ -1916,6 +2053,9 @@ var SearchField = HttpField.extend({
1916
2053
  ok: TranslationConfig.optional()
1917
2054
  }).optional()
1918
2055
  })
2056
+ }).meta({
2057
+ description: "A search input field",
2058
+ id: "SearchField"
1919
2059
  });
1920
2060
  var LinkButtonField = BaseField.extend({
1921
2061
  type: import_v43.default.literal(FieldType.LINK_BUTTON),
@@ -1924,7 +2064,10 @@ var LinkButtonField = BaseField.extend({
1924
2064
  text: TranslationConfig.describe("Text to display on the button"),
1925
2065
  icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
1926
2066
  })
1927
- }).describe("Button that opens a link");
2067
+ }).meta({
2068
+ description: "A button that opens a URL link",
2069
+ id: "LinkButtonField"
2070
+ });
1928
2071
  var VerificationStatus = BaseField.extend({
1929
2072
  type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
1930
2073
  defaultValue: VerificationStatusValue.optional(),
@@ -1934,15 +2077,19 @@ var VerificationStatus = BaseField.extend({
1934
2077
  "Explaining text on the banner in form."
1935
2078
  )
1936
2079
  })
2080
+ }).meta({
2081
+ 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.",
2082
+ id: "VerificationStatus"
1937
2083
  });
1938
2084
  var QueryParamReaderField = BaseField.extend({
1939
2085
  type: import_v43.default.literal(FieldType.QUERY_PARAM_READER),
1940
2086
  configuration: import_v43.default.object({
1941
2087
  pickParams: import_v43.default.array(import_v43.default.string()).describe("List of query parameters to read from the URL")
1942
2088
  })
1943
- }).describe(
1944
- "A field that maps URL query params into form values and clears them afterward"
1945
- );
2089
+ }).meta({
2090
+ description: "A field that maps URL query params into form values and clears them afterward",
2091
+ id: "QueryParamReaderField"
2092
+ });
1946
2093
  var QrReaderField = BaseField.extend({
1947
2094
  type: import_v43.default.literal(FieldType.QR_READER),
1948
2095
  defaultValue: QrReaderFieldValue.optional(),
@@ -1953,7 +2100,7 @@ var QrReaderField = BaseField.extend({
1953
2100
  })
1954
2101
  }).optional()
1955
2102
  }).meta({
1956
- description: "Configuration for QR code reader field, including optional JSON Schema validator.",
2103
+ description: "QR code reader field, including optional JSON Schema validator.",
1957
2104
  id: "QrReaderField"
1958
2105
  });
1959
2106
  var IdReaderField = BaseField.extend({
@@ -1962,12 +2109,18 @@ var IdReaderField = BaseField.extend({
1962
2109
  methods: import_v43.default.array(
1963
2110
  import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
1964
2111
  )
2112
+ }).meta({
2113
+ description: "A wrapper around nested form fields, specifically QR_READER and LINK_BUTTON. It can hold the QR_READERs value.",
2114
+ id: "IdReaderField"
1965
2115
  });
1966
2116
  var CustomField = BaseField.extend({
1967
2117
  type: import_v43.default.literal(FieldType._EXPERIMENTAL_CUSTOM),
1968
2118
  defaultValue: CustomFieldValue.optional(),
1969
2119
  src: import_v43.default.string().describe("Module source path for the custom field component"),
1970
2120
  configuration: import_v43.default.unknown().optional()
2121
+ }).meta({
2122
+ description: "An expiremental custom field that is defined by a module source path",
2123
+ id: "CustomField"
1971
2124
  });
1972
2125
  var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
1973
2126
  var LoaderField = BaseField.extend({
@@ -1977,22 +2130,25 @@ var LoaderField = BaseField.extend({
1977
2130
  configuration: import_v43.default.object({
1978
2131
  text: TranslationConfig.describe("Display text above the loading spinner")
1979
2132
  })
1980
- }).describe(
1981
- "A non-interactive field that indicates an in progress operation in form"
1982
- );
2133
+ }).meta({
2134
+ description: "A non-interactive field that indicates an in progress operation in form",
2135
+ id: "LoaderField"
2136
+ });
1983
2137
  var HiddenField = BaseField.extend({
1984
2138
  type: import_v43.default.literal(FieldType.ALPHA_HIDDEN),
1985
2139
  required: import_v43.default.boolean().default(false).optional(),
1986
2140
  defaultValue: TextValue.optional()
1987
- }).describe(
1988
- "A non-interactive, hidden field that only hold a value in the form"
1989
- );
2141
+ }).meta({
2142
+ description: "A non-interactive, hidden field that only hold a value in the form",
2143
+ id: "HiddenField"
2144
+ });
1990
2145
  var UserRoleField = BaseField.extend({
1991
2146
  type: import_v43.default.literal(FieldType.USER_ROLE),
1992
2147
  defaultValue: TextValue.optional()
1993
- }).describe(
1994
- "A select dropdown that is automatically populated with available user roles"
1995
- );
2148
+ }).meta({
2149
+ description: "A select dropdown that is automatically populated with available user roles",
2150
+ id: "UserRoleField"
2151
+ });
1996
2152
  var FieldConfig = import_v43.default.discriminatedUnion("type", [
1997
2153
  FieldGroup,
1998
2154
  Address,
@@ -2078,8 +2234,8 @@ var ApplicationConfig = z20.object({
2078
2234
  })
2079
2235
  ),
2080
2236
  PHONE_NUMBER_PATTERN: z20.string().or(z20.instanceof(RegExp)),
2081
- USER_NOTIFICATION_DELIVERY_METHOD: z20.string(),
2082
- INFORMANT_NOTIFICATION_DELIVERY_METHOD: z20.string(),
2237
+ USER_NOTIFICATION_DELIVERY_METHOD: z20.enum(["email", "sms"]),
2238
+ INFORMANT_NOTIFICATION_DELIVERY_METHOD: z20.enum(["email", "sms"]),
2083
2239
  SEARCH_DEFAULT_CRITERIA: SearchCriteria.optional().default("TRACKING_ID"),
2084
2240
  ADDITIONAL_USER_FIELDS: z20.array(FieldConfig).optional().default([])
2085
2241
  });
@@ -2097,8 +2253,8 @@ var BackgroundConfig = z20.object({
2097
2253
  var LoginConfig = z20.object({
2098
2254
  COUNTRY: z20.string(),
2099
2255
  LANGUAGES: z20.array(z20.string()),
2100
- USER_NOTIFICATION_DELIVERY_METHOD: z20.string(),
2101
- INFORMANT_NOTIFICATION_DELIVERY_METHOD: z20.string(),
2256
+ USER_NOTIFICATION_DELIVERY_METHOD: z20.enum(["email", "sms"]),
2257
+ INFORMANT_NOTIFICATION_DELIVERY_METHOD: z20.enum(["email", "sms"]),
2102
2258
  PHONE_NUMBER_PATTERN: z20.string().or(z20.instanceof(RegExp)),
2103
2259
  LOGIN_BACKGROUND: BackgroundConfig,
2104
2260
  SENTRY: z20.string().optional()