@opencrvs/toolkit 2.0.0-rc.a0ce994 → 2.0.0-rc.a0fc425

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 +103 -0
  2. package/create-countryconfig/package.json +21 -0
  3. package/dist/application-config/index.js +267 -120
  4. package/dist/cli.js +397 -131
  5. package/dist/commons/api/router.d.ts +3331 -266
  6. package/dist/commons/application-config/index.d.ts +1 -0
  7. package/dist/commons/conditionals/conditionals.d.ts +357 -7
  8. package/dist/commons/conditionals/validate.d.ts +52 -2
  9. package/dist/commons/events/ActionInput.d.ts +108 -0
  10. package/dist/commons/events/Draft.d.ts +4 -2
  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 +382 -50
  14. package/dist/commons/events/FieldValue.d.ts +6 -0
  15. package/dist/commons/events/WorkqueueConfig.d.ts +150 -150
  16. package/dist/commons/events/field.d.ts +47 -1
  17. package/dist/commons/events/index.d.ts +2 -0
  18. package/dist/commons/events/locations.d.ts +21 -0
  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 +0 -2
  24. package/dist/commons/events/utils.d.ts +2 -2
  25. package/dist/conditionals/index.js +60 -5
  26. package/dist/events/index.js +976 -249
  27. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
  28. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  29. package/dist/migrations/v2.0/checkout-upstream-files.js +1 -2
  30. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +9 -1
  31. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -1
  32. package/dist/migrations/v2.0/delete-infrastructure-directory.js +66 -20
  33. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +3 -0
  34. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +1 -0
  35. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +110 -0
  36. package/dist/migrations/v2.0/index.d.ts +5 -3
  37. package/dist/migrations/v2.0/index.d.ts.map +1 -1
  38. package/dist/migrations/v2.0/index.js +395 -129
  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 +802 -154
  47. package/dist/scopes/index.d.ts +6 -1
  48. package/dist/scopes/index.js +8 -4
  49. package/opencrvs-toolkit-2.0.0-rc.a0fc425.tgz +0 -0
  50. package/package.json +6 -2
  51. package/tsconfig.tsbuildinfo +1 -1
  52. package/opencrvs-toolkit-2.0.0-rc.a0ce994.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
@@ -350,6 +353,7 @@ var DateRangeFieldValue = z7.object({
350
353
  var EmailValue = z7.email();
351
354
  var CheckboxFieldValue = z7.boolean();
352
355
  var NumberFieldValue = z7.number();
356
+ var SignatureFieldValue = FileFieldValue;
353
357
  var ButtonFieldValue = z7.number();
354
358
  var VerificationStatusValue = z7.enum([
355
359
  "verified",
@@ -418,28 +422,20 @@ function schemaPriority(schema) {
418
422
  return idx === -1 ? 9999 : idx;
419
423
  }
420
424
  function safeUnion(schemas) {
425
+ const sortedSchemas = [...schemas].sort(
426
+ (a, b) => schemaPriority(a) - schemaPriority(b)
427
+ );
421
428
  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
- });
429
+ for (const schema of sortedSchemas) {
430
+ if (schema.safeParse(val).success) {
431
+ return;
432
+ }
442
433
  }
434
+ ctx.addIssue({
435
+ code: "invalid_type",
436
+ expected: "custom",
437
+ message: "Value does not match any schema"
438
+ });
443
439
  }).meta({
444
440
  description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
445
441
  });
@@ -772,12 +768,14 @@ var SystemScopeType = z11.enum([
772
768
  "organisation.read-locations",
773
769
  "user.read",
774
770
  "user.create",
775
- "user.edit"
771
+ "user.edit",
772
+ "user.search"
776
773
  ]);
777
774
  var UserScopeType = SystemScopeType.extract([
778
775
  "user.read",
779
776
  "user.create",
780
- "user.edit"
777
+ "user.edit",
778
+ "user.search"
781
779
  ]);
782
780
  var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
783
781
  var UserScopeV2 = z11.discriminatedUnion("type", [
@@ -786,7 +784,7 @@ var UserScopeV2 = z11.discriminatedUnion("type", [
786
784
  options: AllUserScopeOptions.optional()
787
785
  }),
788
786
  z11.object({
789
- type: UserScopeType.extract(["user.read"]),
787
+ type: UserScopeType.extract(["user.read", "user.search"]),
790
788
  options: AccessLevelOptions.optional()
791
789
  })
792
790
  ]);
@@ -837,7 +835,9 @@ var ScopeType = z11.enum([
837
835
  var EncodedScope = z11.string().brand("EncodedScope");
838
836
  var DEFAULT_SCOPE_OPTIONS = {
839
837
  placeOfEvent: JurisdictionFilter.enum.all,
840
- accessLevel: JurisdictionFilter.enum.all
838
+ accessLevel: JurisdictionFilter.enum.all,
839
+ registeredIn: JurisdictionFilter.enum.all,
840
+ declaredIn: JurisdictionFilter.enum.all
841
841
  };
842
842
 
843
843
  // ../commons/src/authentication.ts
@@ -1083,6 +1083,9 @@ var FlagConfig = z14.object({
1083
1083
  "Indicates if this flag expects an action to be performed to be cleared."
1084
1084
  ),
1085
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."
1086
1089
  });
1087
1090
  var ActionFlagConfig = z14.object({
1088
1091
  id: Flag,
@@ -1090,6 +1093,9 @@ var ActionFlagConfig = z14.object({
1090
1093
  conditional: Conditional.optional().describe(
1091
1094
  "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
1092
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."
1093
1099
  });
1094
1100
 
1095
1101
  // ../commons/src/events/EventMetadata.ts
@@ -1111,8 +1117,7 @@ var ActionCreationMetadata = z15.object({
1111
1117
  ),
1112
1118
  createdByUserType: z15.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1113
1119
  acceptedAt: z15.iso.datetime().describe("Timestamp when the action request was accepted."),
1114
- createdByRole: z15.string().optional().describe("Role of the user at the time of action request creation."),
1115
- 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.")
1116
1121
  });
1117
1122
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1118
1123
  registrationNumber: z15.string().describe(
@@ -1140,9 +1145,6 @@ var EventMetadata = z15.object({
1140
1145
  createdAtLocation: UUID.nullish().describe(
1141
1146
  "Location of the user who created the event."
1142
1147
  ),
1143
- createdBySignature: DocumentPath.nullish().describe(
1144
- "Signature of the user who created the event."
1145
- ),
1146
1148
  updatedAtLocation: UUID.nullish().describe(
1147
1149
  "Location of the user who last changed the status."
1148
1150
  ),
@@ -1406,14 +1408,31 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
1406
1408
  }
1407
1409
  }).describe("Unique identifier for the field");
1408
1410
  var FieldReference = import_v43.default.object({
1409
- $$field: FieldId,
1411
+ $$field: FieldId.describe("Id of the field to reference"),
1410
1412
  $$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
1411
1413
  'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
1414
+ ),
1415
+ $$code: import_v43.default.string().optional().describe(
1416
+ "Serialised client-side function body. When present the expression is evaluated rather than dereferenced."
1417
+ )
1418
+ }).describe(
1419
+ "Reference to a field value, with an optional client-side computation applied."
1420
+ );
1421
+ var ComputedDefaultValue = import_v43.default.object({
1422
+ $$code: import_v43.default.string().describe(
1423
+ "Serialised client-side function body. Receives (undefined, context) where context includes $now, $online, and system variables."
1412
1424
  )
1413
- }).describe("Reference to a field by its ID");
1425
+ }).describe("A context-only computation used as a field default value.");
1414
1426
  var ValidationConfig = import_v43.default.object({
1415
- validator: Conditional,
1416
- message: TranslationConfig
1427
+ validator: Conditional.describe(
1428
+ "Conditional expression that must hold for the field value to be considered valid."
1429
+ ),
1430
+ message: TranslationConfig.describe(
1431
+ "Error message displayed when the validator does not hold."
1432
+ )
1433
+ }).meta({
1434
+ id: "ValidationConfig",
1435
+ 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."
1417
1436
  });
1418
1437
  var requiredSchema = import_v43.default.union([
1419
1438
  import_v43.default.boolean(),
@@ -1444,7 +1463,7 @@ var BaseField = import_v43.default.object({
1444
1463
  "Indicates whether the field can be modified during record correction."
1445
1464
  ),
1446
1465
  value: FieldReference.or(import_v43.default.array(FieldReference)).optional().describe(
1447
- "Reference to the source field or fields. When a value is defined, it is copied from the parent field when changed. If multiple references are provided, the first truthy value is used."
1466
+ "Reference to the source field or fields. When a value is defined, it is copied from the parent field when changed. If multiple references are provided, the first truthy value is used. A FieldReference with $$code computes the value via a custom client-side function."
1448
1467
  ),
1449
1468
  analytics: import_v43.default.boolean().default(false).optional().describe(
1450
1469
  "Indicates whether the field is included in analytics. When enabled, its value becomes available in the analytics dashboard."
@@ -1452,30 +1471,39 @@ var BaseField = import_v43.default.object({
1452
1471
  }).describe("Common properties shared across all field types.");
1453
1472
  var Divider = BaseField.extend({
1454
1473
  type: import_v43.default.literal(FieldType.DIVIDER)
1474
+ }).meta({
1475
+ description: "A horizontal line divider",
1476
+ id: "Divider"
1455
1477
  });
1456
1478
  var TextField = BaseField.extend({
1457
1479
  type: import_v43.default.literal(FieldType.TEXT),
1458
- defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
1480
+ defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
1459
1481
  configuration: import_v43.default.object({
1460
1482
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
1461
1483
  type: import_v43.default.enum(["text", "password"]).optional(),
1462
1484
  prefix: TranslationConfig.optional(),
1463
1485
  postfix: TranslationConfig.optional()
1464
1486
  }).default({ type: "text" }).optional()
1465
- }).describe("Text input");
1487
+ }).meta({
1488
+ description: "A text input field",
1489
+ id: "TextField"
1490
+ });
1466
1491
  var NumberField = BaseField.extend({
1467
1492
  type: import_v43.default.literal(FieldType.NUMBER),
1468
- defaultValue: NumberFieldValue.optional(),
1493
+ defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
1469
1494
  configuration: import_v43.default.object({
1470
1495
  min: import_v43.default.number().optional().describe("Minimum value"),
1471
1496
  max: import_v43.default.number().optional().describe("Maximum value"),
1472
1497
  prefix: TranslationConfig.optional(),
1473
1498
  postfix: TranslationConfig.optional()
1474
1499
  }).optional()
1475
- }).describe("Number input");
1500
+ }).meta({
1501
+ description: "A number input field",
1502
+ id: "NumberField"
1503
+ });
1476
1504
  var TextAreaField = BaseField.extend({
1477
1505
  type: import_v43.default.literal(FieldType.TEXTAREA),
1478
- defaultValue: NonEmptyTextValue.optional(),
1506
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1479
1507
  configuration: import_v43.default.object({
1480
1508
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
1481
1509
  rows: import_v43.default.number().optional().describe("Number of visible text lines"),
@@ -1483,7 +1511,10 @@ var TextAreaField = BaseField.extend({
1483
1511
  prefix: TranslationConfig.optional(),
1484
1512
  postfix: TranslationConfig.optional()
1485
1513
  }).default({ rows: 4 }).optional()
1486
- }).describe("Multiline text input");
1514
+ }).meta({
1515
+ description: "A multiline text input",
1516
+ id: "TextAreaField"
1517
+ });
1487
1518
  var ImageMimeType = import_v43.default.enum([
1488
1519
  "image/png",
1489
1520
  "image/jpg",
@@ -1506,58 +1537,76 @@ var SignatureField = BaseField.extend({
1506
1537
  signaturePromptLabel: TranslationConfig.describe(
1507
1538
  "Title of the signature modal"
1508
1539
  ),
1509
- defaultValue: FieldValue.optional(),
1540
+ defaultValue: SignatureFieldValue.or(ComputedDefaultValue).optional(),
1510
1541
  configuration: import_v43.default.object({
1511
1542
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1512
1543
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
1513
1544
  }).default({
1514
1545
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1515
1546
  })
1516
- }).describe("Signature input field");
1547
+ }).meta({
1548
+ description: "A signature input field",
1549
+ id: "SignatureField"
1550
+ });
1517
1551
  var EmailField = BaseField.extend({
1518
1552
  type: import_v43.default.literal(FieldType.EMAIL),
1519
1553
  configuration: import_v43.default.object({
1520
1554
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
1521
1555
  }).default({ maxLength: 255 }).optional(),
1522
- defaultValue: NonEmptyTextValue.optional()
1556
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional()
1557
+ }).meta({
1558
+ description: "An email input field",
1559
+ id: "EmailField"
1523
1560
  });
1524
1561
  var DateField = BaseField.extend({
1525
1562
  type: import_v43.default.literal(FieldType.DATE),
1526
- defaultValue: SerializedNowDateTime.or(PlainDate).optional().describe("Default date value(yyyy-MM-dd)"),
1563
+ defaultValue: SerializedNowDateTime.or(PlainDate).or(ComputedDefaultValue).optional().describe("Default date value(yyyy-MM-dd)"),
1527
1564
  configuration: import_v43.default.object({
1528
1565
  notice: TranslationConfig.describe(
1529
1566
  "Text to display above the date input"
1530
1567
  ).optional()
1531
1568
  }).optional()
1532
- }).describe("A single date input (yyyy-MM-dd)");
1569
+ }).meta({
1570
+ description: "A date input (yyyy-MM-dd)",
1571
+ id: "DateField"
1572
+ });
1533
1573
  var AgeField = BaseField.extend({
1534
1574
  type: import_v43.default.literal(FieldType.AGE),
1535
- defaultValue: NumberFieldValue.optional(),
1575
+ defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
1536
1576
  configuration: import_v43.default.object({
1537
1577
  asOfDate: FieldReference,
1538
1578
  prefix: TranslationConfig.optional(),
1539
1579
  postfix: TranslationConfig.optional()
1540
1580
  })
1541
- }).describe("An age input field which uses the current date as the asOfDate");
1581
+ }).meta({
1582
+ description: "An age input field which uses the current date as the asOfDate",
1583
+ id: "AgeField"
1584
+ });
1542
1585
  var TimeField = BaseField.extend({
1543
1586
  type: import_v43.default.literal(FieldType.TIME),
1544
- defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
1587
+ defaultValue: SerializedNowDateTime.or(TimeValue).or(ComputedDefaultValue).optional().describe("Default time value (HH-mm)"),
1545
1588
  configuration: import_v43.default.object({
1546
1589
  use12HourFormat: import_v43.default.boolean().optional().describe("Whether to use 12-hour format"),
1547
1590
  notice: TranslationConfig.describe(
1548
1591
  "Text to display above the time input"
1549
1592
  ).optional()
1550
1593
  }).optional()
1551
- }).describe("A single date input (HH-mm)");
1594
+ }).meta({
1595
+ description: "A single time input (HH-mm)",
1596
+ id: "TimeField"
1597
+ });
1552
1598
  var DateRangeField = BaseField.extend({
1553
1599
  type: import_v43.default.literal(FieldType.DATE_RANGE),
1554
- defaultValue: DateRangeFieldValue.optional(),
1600
+ defaultValue: DateRangeFieldValue.or(ComputedDefaultValue).optional(),
1555
1601
  configuration: import_v43.default.object({
1556
1602
  notice: TranslationConfig.describe(
1557
1603
  "Text to display above the date input"
1558
1604
  ).optional()
1559
1605
  }).optional()
1560
- }).describe("A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })");
1606
+ }).meta({
1607
+ description: "A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })",
1608
+ id: "DateRangeField"
1609
+ });
1561
1610
  var HtmlFontVariant = import_v43.default.enum([
1562
1611
  "reg12",
1563
1612
  "reg14",
@@ -1601,21 +1650,33 @@ var ImageViewField = BaseField.extend({
1601
1650
  type: import_v43.default.literal(FieldType.IMAGE_VIEW),
1602
1651
  defaultValue: NonEmptyTextValue.optional(),
1603
1652
  configuration: ImageConfiguration
1604
- }).describe("A read-only image component for form pages");
1653
+ }).meta({
1654
+ description: "A read-only image component for form pages",
1655
+ id: "ImageViewField"
1656
+ });
1605
1657
  var Paragraph = BaseField.extend({
1606
1658
  type: import_v43.default.literal(FieldType.PARAGRAPH),
1607
1659
  configuration: ParagraphConfiguration
1608
- }).describe("A read-only HTML <p> paragraph");
1660
+ }).meta({
1661
+ description: "A read-only HTML <p> paragraph",
1662
+ id: "Paragraph"
1663
+ });
1609
1664
  var Heading = BaseField.extend({
1610
1665
  type: import_v43.default.literal(FieldType.HEADING),
1611
1666
  configuration: HeadingConfiguration
1612
- }).describe("A read-only heading component for form pages");
1667
+ }).meta({
1668
+ description: "A read-only heading component for form pages",
1669
+ id: "Heading"
1670
+ });
1613
1671
  var PageHeader = BaseField.extend({
1614
1672
  type: import_v43.default.literal(FieldType.PAGE_HEADER)
1615
- }).describe("A read-only header component for form pages");
1673
+ }).meta({
1674
+ description: "A read-only header component for form pages",
1675
+ id: "PageHeader"
1676
+ });
1616
1677
  var File = BaseField.extend({
1617
1678
  type: import_v43.default.literal(FieldType.FILE),
1618
- defaultValue: FileFieldValue.optional(),
1679
+ defaultValue: FileFieldValue.or(ComputedDefaultValue).optional(),
1619
1680
  configuration: import_v43.default.object({
1620
1681
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1621
1682
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
@@ -1631,7 +1692,10 @@ var File = BaseField.extend({
1631
1692
  }).default({
1632
1693
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1633
1694
  })
1634
- }).describe("File upload");
1695
+ }).meta({
1696
+ description: "A file upload field",
1697
+ id: "File"
1698
+ });
1635
1699
  var SelectOption = import_v43.default.object({
1636
1700
  value: import_v43.default.string().describe("The value of the option"),
1637
1701
  label: import_v43.default.union([import_v43.default.string(), TranslationConfig]).describe("The label of the option"),
@@ -1639,7 +1703,7 @@ var SelectOption = import_v43.default.object({
1639
1703
  });
1640
1704
  var NumberWithUnitField = BaseField.extend({
1641
1705
  type: import_v43.default.literal(FieldType.NUMBER_WITH_UNIT),
1642
- defaultValue: NumberWithUnitFieldValue.optional(),
1706
+ defaultValue: NumberWithUnitFieldValue.or(ComputedDefaultValue).optional(),
1643
1707
  options: import_v43.default.array(SelectOption).describe("A list of options for the unit select"),
1644
1708
  configuration: import_v43.default.object({
1645
1709
  min: import_v43.default.number().optional().describe("Minimum value of the number field"),
@@ -1648,17 +1712,23 @@ var NumberWithUnitField = BaseField.extend({
1648
1712
  "Placeholder for the number field"
1649
1713
  )
1650
1714
  }).optional()
1651
- }).describe("Number with unit input");
1715
+ }).meta({
1716
+ description: "A number with unit input field",
1717
+ id: "NumberWithUnitField"
1718
+ });
1652
1719
  var RadioGroup = BaseField.extend({
1653
1720
  type: import_v43.default.literal(FieldType.RADIO_GROUP),
1654
- defaultValue: TextValue.optional(),
1721
+ defaultValue: TextValue.or(ComputedDefaultValue).optional(),
1655
1722
  options: import_v43.default.array(SelectOption).describe("A list of options"),
1656
1723
  configuration: import_v43.default.object({
1657
1724
  styles: import_v43.default.object({
1658
1725
  size: import_v43.default.enum(["NORMAL", "LARGE"]).optional()
1659
1726
  }).optional()
1660
1727
  }).optional()
1661
- }).describe("Grouped radio options");
1728
+ }).meta({
1729
+ description: "A grouped radio button field",
1730
+ id: "RadioGroup"
1731
+ });
1662
1732
  var BulletList = BaseField.extend({
1663
1733
  type: import_v43.default.literal(FieldType.BULLET_LIST),
1664
1734
  items: import_v43.default.array(TranslationConfig).describe("A list of items"),
@@ -1667,10 +1737,13 @@ var BulletList = BaseField.extend({
1667
1737
  fontVariant: HtmlFontVariant.optional()
1668
1738
  }).optional()
1669
1739
  }).default({})
1670
- }).describe("A list of bullet points");
1740
+ }).meta({
1741
+ description: "A list of bullet points",
1742
+ id: "BulletList"
1743
+ });
1671
1744
  var Select = BaseField.extend({
1672
1745
  type: import_v43.default.literal(FieldType.SELECT),
1673
- defaultValue: TextValue.optional(),
1746
+ defaultValue: TextValue.or(ComputedDefaultValue).optional(),
1674
1747
  options: import_v43.default.array(SelectOption).describe("A list of options"),
1675
1748
  noOptionsMessage: TranslationConfig.optional().describe(
1676
1749
  `
@@ -1682,16 +1755,22 @@ var Select = BaseField.extend({
1682
1755
  { ..., defaultMessage: "'{input}' is not listed among the health facilities." }
1683
1756
  `
1684
1757
  )
1685
- }).describe("Select input");
1758
+ }).meta({
1759
+ description: "A select input field",
1760
+ id: "Select"
1761
+ });
1686
1762
  var SelectDateRangeOption = import_v43.default.object({
1687
1763
  value: SelectDateRangeValue.describe("The value of the option"),
1688
1764
  label: TranslationConfig.describe("The label of the option")
1689
1765
  });
1690
1766
  var SelectDateRangeField = BaseField.extend({
1691
1767
  type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
1692
- defaultValue: SelectDateRangeValue.optional(),
1768
+ defaultValue: SelectDateRangeValue.or(ComputedDefaultValue).optional(),
1693
1769
  options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
1694
- }).describe("Select input with date range options");
1770
+ }).meta({
1771
+ description: "A date range selection field",
1772
+ id: "SelectDateRangeField"
1773
+ });
1695
1774
  var NameConfig = import_v43.default.object({
1696
1775
  firstname: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
1697
1776
  middlename: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
@@ -1703,7 +1782,7 @@ var NameField = BaseField.extend({
1703
1782
  firstname: SerializedUserField.or(NonEmptyTextValue).optional(),
1704
1783
  middlename: SerializedUserField.or(NonEmptyTextValue).optional(),
1705
1784
  surname: SerializedUserField.or(NonEmptyTextValue).optional()
1706
- }).optional(),
1785
+ }).or(ComputedDefaultValue).optional(),
1707
1786
  configuration: import_v43.default.object({
1708
1787
  name: NameConfig.default({
1709
1788
  firstname: { required: true },
@@ -1722,26 +1801,41 @@ var NameField = BaseField.extend({
1722
1801
  surname: { required: true }
1723
1802
  }
1724
1803
  }).optional()
1725
- }).describe("Name input field");
1804
+ }).meta({
1805
+ description: "A field for entering a persons name",
1806
+ id: "NameField"
1807
+ });
1726
1808
  var PhoneField = BaseField.extend({
1727
- defaultValue: NonEmptyTextValue.optional(),
1809
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1728
1810
  type: import_v43.default.literal(FieldType.PHONE)
1729
- }).describe("Phone input field");
1811
+ }).meta({
1812
+ description: "A field for entering a phone number",
1813
+ id: "PhoneField"
1814
+ });
1730
1815
  var IdField = BaseField.extend({
1731
- defaultValue: NonEmptyTextValue.optional(),
1816
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1732
1817
  type: import_v43.default.literal(FieldType.ID)
1733
- }).describe("ID input field");
1818
+ }).meta({
1819
+ description: "A field for entering an ID",
1820
+ id: "IdField"
1821
+ });
1734
1822
  var Checkbox = BaseField.extend({
1735
1823
  type: import_v43.default.literal(FieldType.CHECKBOX),
1736
- defaultValue: CheckboxFieldValue.default(false)
1737
- }).describe("Boolean checkbox field");
1824
+ defaultValue: CheckboxFieldValue.or(ComputedDefaultValue).default(false)
1825
+ }).meta({
1826
+ description: "A boolean checkbox field",
1827
+ id: "Checkbox"
1828
+ });
1738
1829
  var Country = BaseField.extend({
1739
1830
  type: import_v43.default.literal(FieldType.COUNTRY),
1740
- defaultValue: NonEmptyTextValue.optional(),
1831
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1741
1832
  optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
1742
1833
  "Conditionals for specific countries. Countries not listed are always shown and enabled."
1743
1834
  )
1744
- }).describe("Country select field");
1835
+ }).meta({
1836
+ description: "A field for selecting a country",
1837
+ id: "Country"
1838
+ });
1745
1839
  var AllowedLocations = JurisdictionReference.optional().describe(
1746
1840
  "Limits which location options are selectable depending on user jurisdiction and location."
1747
1841
  );
@@ -1750,28 +1844,33 @@ var AdministrativeAreas = import_v43.default.enum([
1750
1844
  "HEALTH_FACILITY",
1751
1845
  "CRVS_OFFICE"
1752
1846
  ]);
1753
- var AdministrativeAreaConfiguration = import_v43.default.object({
1754
- partOf: FieldReference.optional().describe("Parent location"),
1755
- type: AdministrativeAreas,
1756
- allowedLocations: AllowedLocations
1757
- }).describe("Administrative area options");
1758
1847
  var AdministrativeAreaField = BaseField.extend({
1759
1848
  type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
1760
- defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
1761
- configuration: AdministrativeAreaConfiguration
1762
- }).describe("Administrative area input field e.g. facility, office");
1849
+ defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
1850
+ configuration: import_v43.default.object({
1851
+ partOf: FieldReference.optional().describe("Parent location"),
1852
+ type: AdministrativeAreas,
1853
+ allowedLocations: AllowedLocations
1854
+ }).describe("Administrative area options")
1855
+ }).meta({
1856
+ description: "Administrative area input field",
1857
+ id: "AdministrativeAreaField"
1858
+ });
1763
1859
  var LocationInput = BaseField.extend({
1764
1860
  type: import_v43.default.literal(FieldType.LOCATION),
1765
- defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
1861
+ defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
1766
1862
  configuration: import_v43.default.object({
1767
1863
  locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
1768
1864
  allowedLocations: AllowedLocations
1769
1865
  }).optional()
1770
- }).describe("Input field for a location");
1866
+ }).meta({
1867
+ description: "A field for selecting a location",
1868
+ id: "LocationInput"
1869
+ });
1771
1870
  var FileUploadWithOptions = BaseField.extend({
1772
1871
  type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
1773
1872
  options: import_v43.default.array(SelectOption).describe("A list of options"),
1774
- defaultValue: FileFieldWithOptionValue.optional(),
1873
+ defaultValue: FileFieldWithOptionValue.or(ComputedDefaultValue).optional(),
1775
1874
  configuration: import_v43.default.object({
1776
1875
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1777
1876
  maxImageSize: import_v43.default.object({
@@ -1781,15 +1880,18 @@ var FileUploadWithOptions = BaseField.extend({
1781
1880
  }).default({
1782
1881
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1783
1882
  })
1883
+ }).meta({
1884
+ description: "A field for uploading files with file type options",
1885
+ id: "FileUploadWithOptions"
1784
1886
  });
1785
1887
  var Facility = BaseField.extend({
1786
1888
  type: import_v43.default.literal(FieldType.FACILITY),
1787
- defaultValue: NonEmptyTextValue.optional(),
1889
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1788
1890
  configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
1789
1891
  }).describe("Input field for a facility");
1790
1892
  var Office = BaseField.extend({
1791
1893
  type: import_v43.default.literal(FieldType.OFFICE),
1792
- defaultValue: NonEmptyTextValue.optional(),
1894
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1793
1895
  configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
1794
1896
  }).describe("Input field for an office");
1795
1897
  var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
@@ -1825,8 +1927,11 @@ var Address = BaseField.extend({
1825
1927
  ).optional(),
1826
1928
  allowedLocations: AllowedLocations
1827
1929
  }).optional(),
1828
- defaultValue: DefaultAddressFieldValue.optional()
1829
- }).describe("Address input field \u2013 a combination of location and text fields");
1930
+ defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
1931
+ }).meta({
1932
+ description: "Address input field \u2013 a combination of location and text fields",
1933
+ id: "Address"
1934
+ });
1830
1935
  var StaticDataEntry = import_v43.default.object({
1831
1936
  id: import_v43.default.string().describe("ID for the data entry."),
1832
1937
  label: TranslationConfig,
@@ -1841,7 +1946,10 @@ var DataField = BaseField.extend({
1841
1946
  subtitle: TranslationConfig.optional(),
1842
1947
  data: import_v43.default.array(DataEntry)
1843
1948
  })
1844
- }).describe("Data field for displaying read-only data");
1949
+ }).meta({
1950
+ description: "A field for displaying a table of read-only data",
1951
+ id: "DataField"
1952
+ });
1845
1953
  var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
1846
1954
  var ButtonType = import_v43.default.enum([
1847
1955
  "primary",
@@ -1866,13 +1974,19 @@ var ButtonConfiguration = import_v43.default.object({
1866
1974
  });
1867
1975
  var ButtonField = BaseField.extend({
1868
1976
  type: import_v43.default.literal(FieldType.BUTTON),
1869
- defaultValue: ButtonFieldValue.optional(),
1977
+ defaultValue: ButtonFieldValue.or(ComputedDefaultValue).optional(),
1870
1978
  configuration: ButtonConfiguration
1871
- }).describe("Generic button without any built-in functionality");
1979
+ }).meta({
1980
+ description: "A generic button that can be used to trigger an action",
1981
+ id: "ButtonField"
1982
+ });
1872
1983
  var FieldGroup = BaseField.extend({
1873
1984
  type: import_v43.default.literal(FieldType.FIELD_GROUP),
1874
1985
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
1875
1986
  fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig))
1987
+ }).meta({
1988
+ description: "A group of fields that are displayed together",
1989
+ id: "FieldGroup"
1876
1990
  });
1877
1991
  var AlphaPrintButton = BaseField.extend({
1878
1992
  type: import_v43.default.literal(FieldType.ALPHA_PRINT_BUTTON),
@@ -1882,10 +1996,13 @@ var AlphaPrintButton = BaseField.extend({
1882
1996
  "Label for the print button"
1883
1997
  )
1884
1998
  })
1885
- }).describe("Print button field for printing certificates");
1999
+ }).meta({
2000
+ description: "An experimental print button field for printing certificates during the declaration process",
2001
+ id: "AlphaPrintButton"
2002
+ });
1886
2003
  var HttpField = BaseField.extend({
1887
2004
  type: import_v43.default.literal(FieldType.HTTP),
1888
- defaultValue: HttpFieldValue.optional(),
2005
+ defaultValue: HttpFieldValue.or(ComputedDefaultValue).optional(),
1889
2006
  configuration: import_v43.default.object({
1890
2007
  trigger: FieldReference.optional().describe(
1891
2008
  "Reference to the field that triggers the HTTP request when its value changes. If not provided, the HTTP request is triggered once on component mount."
@@ -1898,20 +2015,30 @@ var HttpField = BaseField.extend({
1898
2015
  params: import_v43.default.record(import_v43.default.string(), import_v43.default.union([import_v43.default.string(), FieldReference])).optional(),
1899
2016
  timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
1900
2017
  })
1901
- }).describe("HTTP request function triggered by a button click or other event");
2018
+ }).meta({
2019
+ 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.",
2020
+ id: "HttpField"
2021
+ });
1902
2022
  var AutocompleteField = BaseField.extend({
1903
2023
  type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
1904
2024
  configuration: import_v43.default.object({
1905
- url: import_v43.default.string().describe("URL to fetch autocomplete suggestions from").optional(),
2025
+ url: import_v43.default.string().describe(
2026
+ "URL to fetch autocomplete suggestions from. This should be a country config server endpoint."
2027
+ ).optional(),
1906
2028
  method: import_v43.default.enum(["GET", "POST"]).default("GET").optional(),
1907
2029
  defaultOptions: import_v43.default.array(
1908
2030
  import_v43.default.object({
1909
2031
  label: import_v43.default.string(),
1910
2032
  value: import_v43.default.string()
1911
2033
  })
1912
- ).optional()
2034
+ ).optional().describe(
2035
+ "Manual entry is supported through configuration, allowing users to provide values not currently represented in the dataset."
2036
+ )
1913
2037
  })
1914
- }).describe("Autocomplete input field");
2038
+ }).meta({
2039
+ 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.",
2040
+ id: "AutocompleteField"
2041
+ });
1915
2042
  var SearchField = HttpField.extend({
1916
2043
  type: import_v43.default.literal(FieldType.SEARCH),
1917
2044
  configuration: SearchQuery.pick({
@@ -1944,6 +2071,9 @@ var SearchField = HttpField.extend({
1944
2071
  ok: TranslationConfig.optional()
1945
2072
  }).optional()
1946
2073
  })
2074
+ }).meta({
2075
+ description: "A search input field",
2076
+ id: "SearchField"
1947
2077
  });
1948
2078
  var LinkButtonField = BaseField.extend({
1949
2079
  type: import_v43.default.literal(FieldType.LINK_BUTTON),
@@ -1952,28 +2082,35 @@ var LinkButtonField = BaseField.extend({
1952
2082
  text: TranslationConfig.describe("Text to display on the button"),
1953
2083
  icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
1954
2084
  })
1955
- }).describe("Button that opens a link");
2085
+ }).meta({
2086
+ description: "A button that opens a URL link",
2087
+ id: "LinkButtonField"
2088
+ });
1956
2089
  var VerificationStatus = BaseField.extend({
1957
2090
  type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
1958
- defaultValue: VerificationStatusValue.optional(),
2091
+ defaultValue: VerificationStatusValue.or(ComputedDefaultValue).optional(),
1959
2092
  configuration: import_v43.default.object({
1960
2093
  status: TranslationConfig.describe("Text to display on the status pill."),
1961
2094
  description: TranslationConfig.describe(
1962
2095
  "Explaining text on the banner in form."
1963
2096
  )
1964
2097
  })
2098
+ }).meta({
2099
+ 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.",
2100
+ id: "VerificationStatus"
1965
2101
  });
1966
2102
  var QueryParamReaderField = BaseField.extend({
1967
2103
  type: import_v43.default.literal(FieldType.QUERY_PARAM_READER),
1968
2104
  configuration: import_v43.default.object({
1969
2105
  pickParams: import_v43.default.array(import_v43.default.string()).describe("List of query parameters to read from the URL")
1970
2106
  })
1971
- }).describe(
1972
- "A field that maps URL query params into form values and clears them afterward"
1973
- );
2107
+ }).meta({
2108
+ description: "A field that maps URL query params into form values and clears them afterward",
2109
+ id: "QueryParamReaderField"
2110
+ });
1974
2111
  var QrReaderField = BaseField.extend({
1975
2112
  type: import_v43.default.literal(FieldType.QR_READER),
1976
- defaultValue: QrReaderFieldValue.optional(),
2113
+ defaultValue: QrReaderFieldValue.or(ComputedDefaultValue).optional(),
1977
2114
  configuration: import_v43.default.object({
1978
2115
  validator: import_v43.default.any().meta({
1979
2116
  description: "JSON Schema to validate the scanned QR code data against before populating the form fields.",
@@ -1981,21 +2118,27 @@ var QrReaderField = BaseField.extend({
1981
2118
  })
1982
2119
  }).optional()
1983
2120
  }).meta({
1984
- description: "Configuration for QR code reader field, including optional JSON Schema validator.",
2121
+ description: "QR code reader field, including optional JSON Schema validator.",
1985
2122
  id: "QrReaderField"
1986
2123
  });
1987
2124
  var IdReaderField = BaseField.extend({
1988
2125
  type: import_v43.default.literal(FieldType.ID_READER),
1989
- defaultValue: IdReaderFieldValue.optional(),
2126
+ defaultValue: IdReaderFieldValue.or(ComputedDefaultValue).optional(),
1990
2127
  methods: import_v43.default.array(
1991
2128
  import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
1992
2129
  )
2130
+ }).meta({
2131
+ description: "A wrapper around nested form fields, specifically QR_READER and LINK_BUTTON. It can hold the QR_READERs value.",
2132
+ id: "IdReaderField"
1993
2133
  });
1994
2134
  var CustomField = BaseField.extend({
1995
2135
  type: import_v43.default.literal(FieldType._EXPERIMENTAL_CUSTOM),
1996
2136
  defaultValue: CustomFieldValue.optional(),
1997
2137
  src: import_v43.default.string().describe("Module source path for the custom field component"),
1998
2138
  configuration: import_v43.default.unknown().optional()
2139
+ }).meta({
2140
+ description: "An expiremental custom field that is defined by a module source path",
2141
+ id: "CustomField"
1999
2142
  });
2000
2143
  var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
2001
2144
  var LoaderField = BaseField.extend({
@@ -2005,22 +2148,25 @@ var LoaderField = BaseField.extend({
2005
2148
  configuration: import_v43.default.object({
2006
2149
  text: TranslationConfig.describe("Display text above the loading spinner")
2007
2150
  })
2008
- }).describe(
2009
- "A non-interactive field that indicates an in progress operation in form"
2010
- );
2151
+ }).meta({
2152
+ description: "A non-interactive field that indicates an in progress operation in form",
2153
+ id: "LoaderField"
2154
+ });
2011
2155
  var HiddenField = BaseField.extend({
2012
2156
  type: import_v43.default.literal(FieldType.ALPHA_HIDDEN),
2013
2157
  required: import_v43.default.boolean().default(false).optional(),
2014
2158
  defaultValue: TextValue.optional()
2015
- }).describe(
2016
- "A non-interactive, hidden field that only hold a value in the form"
2017
- );
2159
+ }).meta({
2160
+ description: "A non-interactive, hidden field that only hold a value in the form",
2161
+ id: "HiddenField"
2162
+ });
2018
2163
  var UserRoleField = BaseField.extend({
2019
2164
  type: import_v43.default.literal(FieldType.USER_ROLE),
2020
2165
  defaultValue: TextValue.optional()
2021
- }).describe(
2022
- "A select dropdown that is automatically populated with available user roles"
2023
- );
2166
+ }).meta({
2167
+ description: "A select dropdown that is automatically populated with available user roles",
2168
+ id: "UserRoleField"
2169
+ });
2024
2170
  var FieldConfig = import_v43.default.discriminatedUnion("type", [
2025
2171
  FieldGroup,
2026
2172
  Address,
@@ -2138,6 +2284,7 @@ var ClientConfig = z20.object({
2138
2284
  COUNTRY: z20.string(),
2139
2285
  LANGUAGES: z20.array(z20.string()),
2140
2286
  SENTRY: z20.string().optional(),
2287
+ LOGIN_URL: z20.string().optional(),
2141
2288
  REGISTER_BACKGROUND: BackgroundConfig,
2142
2289
  DASHBOARDS: z20.array(
2143
2290
  z20.object({