@opencrvs/toolkit 2.0.0-rc.474f7a9 → 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 +3334 -268
  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 +108 -0
  10. package/dist/commons/events/Draft.d.ts +3 -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 +394 -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 +288 -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.474f7a9.tgz +0 -0
@@ -110,6 +110,10 @@ var scopeByEvent = z2.preprocess(
110
110
  (val) => val === void 0 ? void 0 : [val].flat(),
111
111
  z2.array(z2.string()).optional()
112
112
  ).describe("Event type, e.g. birth, death");
113
+ var userRole = z2.preprocess(
114
+ (val) => val === void 0 ? void 0 : [val].flat(),
115
+ z2.array(z2.string()).optional()
116
+ ).describe("User role, e.g. admin, field agent");
113
117
  var scopeOptionsPlaceEvent = z2.object({
114
118
  event: scopeByEvent,
115
119
  placeOfEvent: JurisdictionFilter.optional()
@@ -133,6 +137,9 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
133
137
  var AccessLevelOptions = z2.object({
134
138
  accessLevel: JurisdictionFilter.optional()
135
139
  });
140
+ var AllUserScopeOptions = AccessLevelOptions.extend({
141
+ role: userRole.optional()
142
+ });
136
143
  var WorkqueueOrDashboardOptions = z2.object({
137
144
  ids: z2.preprocess(
138
145
  (val) => val === void 0 ? void 0 : [val].flat(),
@@ -142,6 +149,7 @@ var WorkqueueOrDashboardOptions = z2.object({
142
149
  var AllScopeOptions = z2.object({
143
150
  ...AllRecordScopeOptions.shape,
144
151
  ...AccessLevelOptions.shape,
152
+ ...AllUserScopeOptions.shape,
145
153
  ...WorkqueueOrDashboardOptions.shape
146
154
  });
147
155
  var ScopeOptionKey = AllScopeOptions.keyof();
@@ -214,6 +222,30 @@ var RecordScopeV2 = z2.discriminatedUnion("type", [
214
222
  ]).describe(
215
223
  "Scopes used to check user's permission to perform actions on a record."
216
224
  );
225
+ var SystemScopeType = z2.enum([
226
+ "organisation.read-locations",
227
+ "user.read",
228
+ "user.create",
229
+ "user.edit",
230
+ "user.search"
231
+ ]);
232
+ var UserScopeType = SystemScopeType.extract([
233
+ "user.read",
234
+ "user.create",
235
+ "user.edit",
236
+ "user.search"
237
+ ]);
238
+ var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
239
+ var UserScopeV2 = z2.discriminatedUnion("type", [
240
+ z2.object({
241
+ type: ScopesWithRoleOption,
242
+ options: AllUserScopeOptions.optional()
243
+ }),
244
+ z2.object({
245
+ type: UserScopeType.extract(["user.read", "user.search"]),
246
+ options: AccessLevelOptions.optional()
247
+ })
248
+ ]);
217
249
  var ResolvedRecordScopeV2 = z2.discriminatedUnion("type", [
218
250
  z2.object({
219
251
  type: ScopesWithPlaceEventOptions,
@@ -234,16 +266,14 @@ var ResolvedRecordScopeV2 = z2.discriminatedUnion("type", [
234
266
  }).optional()
235
267
  })
236
268
  ]).describe("Resolved scope with location/user IDs instead of filters.");
237
- var SystemScopeType = z2.enum([
238
- "organisation.read-locations",
239
- "user.read",
240
- "user.create",
241
- "user.edit"
242
- ]);
243
269
  var Scope = z2.discriminatedUnion("type", [
244
270
  z2.object({ type: PlainScopeType }),
245
271
  ...RecordScopeV2.options,
246
- z2.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
272
+ ...UserScopeV2.options,
273
+ z2.object({
274
+ type: z2.literal("organisation.read-locations"),
275
+ options: AccessLevelOptions.optional()
276
+ }),
247
277
  z2.object({
248
278
  type: z2.literal("workqueue"),
249
279
  options: WorkqueueOrDashboardOptions
@@ -263,7 +293,9 @@ var ScopeType = z2.enum([
263
293
  var EncodedScope = z2.string().brand("EncodedScope");
264
294
  var DEFAULT_SCOPE_OPTIONS = {
265
295
  placeOfEvent: JurisdictionFilter.enum.all,
266
- accessLevel: JurisdictionFilter.enum.all
296
+ accessLevel: JurisdictionFilter.enum.all,
297
+ registeredIn: JurisdictionFilter.enum.all,
298
+ declaredIn: JurisdictionFilter.enum.all
267
299
  };
268
300
 
269
301
  // ../commons/src/authentication.ts
@@ -622,7 +654,10 @@ var ActionConditional = z7.discriminatedUnion("type", [
622
654
  ShowConditional,
623
655
  // Action can be shown to the user in the list but as disabled
624
656
  EnableConditional
625
- ]);
657
+ ]).meta({
658
+ description: "Action conditional configuration",
659
+ id: "ActionConditional"
660
+ });
626
661
  var DisplayOnReviewConditional = z7.object({
627
662
  type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
628
663
  conditional: Conditional
@@ -950,28 +985,20 @@ function schemaPriority(schema) {
950
985
  return idx === -1 ? 9999 : idx;
951
986
  }
952
987
  function safeUnion(schemas) {
988
+ const sortedSchemas = [...schemas].sort(
989
+ (a, b) => schemaPriority(a) - schemaPriority(b)
990
+ );
953
991
  return z12.any().superRefine((val, ctx) => {
954
- const successful = schemas.filter((s) => s.safeParse(val).success);
955
- if (successful.length === 1) {
956
- return;
957
- }
958
- if (successful.length === 0) {
959
- ctx.addIssue({
960
- code: "invalid_type",
961
- expected: "custom",
962
- message: "Value does not match any schema"
963
- });
964
- return;
965
- }
966
- successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
967
- const best = successful[0];
968
- if (!best.safeParse(val).success) {
969
- ctx.addIssue({
970
- expected: "custom",
971
- code: "invalid_type",
972
- message: "Value did not match the best schema"
973
- });
992
+ for (const schema of sortedSchemas) {
993
+ if (schema.safeParse(val).success) {
994
+ return;
995
+ }
974
996
  }
997
+ ctx.addIssue({
998
+ code: "invalid_type",
999
+ expected: "custom",
1000
+ message: "Value does not match any schema"
1001
+ });
975
1002
  }).meta({
976
1003
  description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
977
1004
  });
@@ -1281,6 +1308,9 @@ var FlagConfig = z15.object({
1281
1308
  "Indicates if this flag expects an action to be performed to be cleared."
1282
1309
  ),
1283
1310
  label: TranslationConfig.describe("Human readable label of the flag.")
1311
+ }).meta({
1312
+ description: "Flag configuration",
1313
+ id: "FlagConfig"
1284
1314
  });
1285
1315
  var ActionFlagConfig = z15.object({
1286
1316
  id: Flag,
@@ -1288,6 +1318,9 @@ var ActionFlagConfig = z15.object({
1288
1318
  conditional: Conditional.optional().describe(
1289
1319
  "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
1290
1320
  )
1321
+ }).meta({
1322
+ description: "Action flag configuration",
1323
+ id: "ActionFlagConfig"
1291
1324
  });
1292
1325
 
1293
1326
  // ../commons/src/events/EventMetadata.ts
@@ -1309,8 +1342,7 @@ var ActionCreationMetadata = z16.object({
1309
1342
  ),
1310
1343
  createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1311
1344
  acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
1312
- createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation."),
1313
- createdBySignature: z16.string().nullish().describe("Signature of the user who created the action request.")
1345
+ createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
1314
1346
  });
1315
1347
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1316
1348
  registrationNumber: z16.string().describe(
@@ -1338,9 +1370,6 @@ var EventMetadata = z16.object({
1338
1370
  createdAtLocation: UUID.nullish().describe(
1339
1371
  "Location of the user who created the event."
1340
1372
  ),
1341
- createdBySignature: DocumentPath.nullish().describe(
1342
- "Signature of the user who created the event."
1343
- ),
1344
1373
  updatedAtLocation: UUID.nullish().describe(
1345
1374
  "Location of the user who last changed the status."
1346
1375
  ),
@@ -1633,7 +1662,7 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
1633
1662
  }
1634
1663
  }).describe("Unique identifier for the field");
1635
1664
  var FieldReference = import_v43.default.object({
1636
- $$field: FieldId,
1665
+ $$field: FieldId.describe("Id of the field to reference"),
1637
1666
  $$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
1638
1667
  'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
1639
1668
  )
@@ -1679,6 +1708,9 @@ var BaseField = import_v43.default.object({
1679
1708
  }).describe("Common properties shared across all field types.");
1680
1709
  var Divider = BaseField.extend({
1681
1710
  type: import_v43.default.literal(FieldType.DIVIDER)
1711
+ }).meta({
1712
+ description: "A horizontal line divider",
1713
+ id: "Divider"
1682
1714
  });
1683
1715
  var TextField = BaseField.extend({
1684
1716
  type: import_v43.default.literal(FieldType.TEXT),
@@ -1689,7 +1721,10 @@ var TextField = BaseField.extend({
1689
1721
  prefix: TranslationConfig.optional(),
1690
1722
  postfix: TranslationConfig.optional()
1691
1723
  }).default({ type: "text" }).optional()
1692
- }).describe("Text input");
1724
+ }).meta({
1725
+ description: "A text input field",
1726
+ id: "TextField"
1727
+ });
1693
1728
  var NumberField = BaseField.extend({
1694
1729
  type: import_v43.default.literal(FieldType.NUMBER),
1695
1730
  defaultValue: NumberFieldValue.optional(),
@@ -1699,7 +1734,10 @@ var NumberField = BaseField.extend({
1699
1734
  prefix: TranslationConfig.optional(),
1700
1735
  postfix: TranslationConfig.optional()
1701
1736
  }).optional()
1702
- }).describe("Number input");
1737
+ }).meta({
1738
+ description: "A number input field",
1739
+ id: "NumberField"
1740
+ });
1703
1741
  var TextAreaField = BaseField.extend({
1704
1742
  type: import_v43.default.literal(FieldType.TEXTAREA),
1705
1743
  defaultValue: NonEmptyTextValue.optional(),
@@ -1710,7 +1748,10 @@ var TextAreaField = BaseField.extend({
1710
1748
  prefix: TranslationConfig.optional(),
1711
1749
  postfix: TranslationConfig.optional()
1712
1750
  }).default({ rows: 4 }).optional()
1713
- }).describe("Multiline text input");
1751
+ }).meta({
1752
+ description: "A multiline text input",
1753
+ id: "TextAreaField"
1754
+ });
1714
1755
  var ImageMimeType = import_v43.default.enum([
1715
1756
  "image/png",
1716
1757
  "image/jpg",
@@ -1740,13 +1781,19 @@ var SignatureField = BaseField.extend({
1740
1781
  }).default({
1741
1782
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1742
1783
  })
1743
- }).describe("Signature input field");
1784
+ }).meta({
1785
+ description: "A signature input field",
1786
+ id: "SignatureField"
1787
+ });
1744
1788
  var EmailField = BaseField.extend({
1745
1789
  type: import_v43.default.literal(FieldType.EMAIL),
1746
1790
  configuration: import_v43.default.object({
1747
1791
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
1748
1792
  }).default({ maxLength: 255 }).optional(),
1749
1793
  defaultValue: NonEmptyTextValue.optional()
1794
+ }).meta({
1795
+ description: "An email input field",
1796
+ id: "EmailField"
1750
1797
  });
1751
1798
  var DateField = BaseField.extend({
1752
1799
  type: import_v43.default.literal(FieldType.DATE),
@@ -1756,7 +1803,10 @@ var DateField = BaseField.extend({
1756
1803
  "Text to display above the date input"
1757
1804
  ).optional()
1758
1805
  }).optional()
1759
- }).describe("A single date input (yyyy-MM-dd)");
1806
+ }).meta({
1807
+ description: "A date input (yyyy-MM-dd)",
1808
+ id: "DateField"
1809
+ });
1760
1810
  var AgeField = BaseField.extend({
1761
1811
  type: import_v43.default.literal(FieldType.AGE),
1762
1812
  defaultValue: NumberFieldValue.optional(),
@@ -1765,7 +1815,10 @@ var AgeField = BaseField.extend({
1765
1815
  prefix: TranslationConfig.optional(),
1766
1816
  postfix: TranslationConfig.optional()
1767
1817
  })
1768
- }).describe("An age input field which uses the current date as the asOfDate");
1818
+ }).meta({
1819
+ description: "An age input field which uses the current date as the asOfDate",
1820
+ id: "AgeField"
1821
+ });
1769
1822
  var TimeField = BaseField.extend({
1770
1823
  type: import_v43.default.literal(FieldType.TIME),
1771
1824
  defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
@@ -1775,7 +1828,10 @@ var TimeField = BaseField.extend({
1775
1828
  "Text to display above the time input"
1776
1829
  ).optional()
1777
1830
  }).optional()
1778
- }).describe("A single date input (HH-mm)");
1831
+ }).meta({
1832
+ description: "A single time input (HH-mm)",
1833
+ id: "TimeField"
1834
+ });
1779
1835
  var DateRangeField = BaseField.extend({
1780
1836
  type: import_v43.default.literal(FieldType.DATE_RANGE),
1781
1837
  defaultValue: DateRangeFieldValue.optional(),
@@ -1784,7 +1840,10 @@ var DateRangeField = BaseField.extend({
1784
1840
  "Text to display above the date input"
1785
1841
  ).optional()
1786
1842
  }).optional()
1787
- }).describe("A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })");
1843
+ }).meta({
1844
+ description: "A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })",
1845
+ id: "DateRangeField"
1846
+ });
1788
1847
  var HtmlFontVariant = import_v43.default.enum([
1789
1848
  "reg12",
1790
1849
  "reg14",
@@ -1828,18 +1887,30 @@ var ImageViewField = BaseField.extend({
1828
1887
  type: import_v43.default.literal(FieldType.IMAGE_VIEW),
1829
1888
  defaultValue: NonEmptyTextValue.optional(),
1830
1889
  configuration: ImageConfiguration
1831
- }).describe("A read-only image component for form pages");
1890
+ }).meta({
1891
+ description: "A read-only image component for form pages",
1892
+ id: "ImageViewField"
1893
+ });
1832
1894
  var Paragraph = BaseField.extend({
1833
1895
  type: import_v43.default.literal(FieldType.PARAGRAPH),
1834
1896
  configuration: ParagraphConfiguration
1835
- }).describe("A read-only HTML <p> paragraph");
1897
+ }).meta({
1898
+ description: "A read-only HTML <p> paragraph",
1899
+ id: "Paragraph"
1900
+ });
1836
1901
  var Heading = BaseField.extend({
1837
1902
  type: import_v43.default.literal(FieldType.HEADING),
1838
1903
  configuration: HeadingConfiguration
1839
- }).describe("A read-only heading component for form pages");
1904
+ }).meta({
1905
+ description: "A read-only heading component for form pages",
1906
+ id: "Heading"
1907
+ });
1840
1908
  var PageHeader = BaseField.extend({
1841
1909
  type: import_v43.default.literal(FieldType.PAGE_HEADER)
1842
- }).describe("A read-only header component for form pages");
1910
+ }).meta({
1911
+ description: "A read-only header component for form pages",
1912
+ id: "PageHeader"
1913
+ });
1843
1914
  var File = BaseField.extend({
1844
1915
  type: import_v43.default.literal(FieldType.FILE),
1845
1916
  defaultValue: FileFieldValue.optional(),
@@ -1858,7 +1929,10 @@ var File = BaseField.extend({
1858
1929
  }).default({
1859
1930
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1860
1931
  })
1861
- }).describe("File upload");
1932
+ }).meta({
1933
+ description: "A file upload field",
1934
+ id: "File"
1935
+ });
1862
1936
  var SelectOption = import_v43.default.object({
1863
1937
  value: import_v43.default.string().describe("The value of the option"),
1864
1938
  label: import_v43.default.union([import_v43.default.string(), TranslationConfig]).describe("The label of the option"),
@@ -1875,7 +1949,10 @@ var NumberWithUnitField = BaseField.extend({
1875
1949
  "Placeholder for the number field"
1876
1950
  )
1877
1951
  }).optional()
1878
- }).describe("Number with unit input");
1952
+ }).meta({
1953
+ description: "A number with unit input field",
1954
+ id: "NumberWithUnitField"
1955
+ });
1879
1956
  var RadioGroup = BaseField.extend({
1880
1957
  type: import_v43.default.literal(FieldType.RADIO_GROUP),
1881
1958
  defaultValue: TextValue.optional(),
@@ -1885,7 +1962,10 @@ var RadioGroup = BaseField.extend({
1885
1962
  size: import_v43.default.enum(["NORMAL", "LARGE"]).optional()
1886
1963
  }).optional()
1887
1964
  }).optional()
1888
- }).describe("Grouped radio options");
1965
+ }).meta({
1966
+ description: "A grouped radio button field",
1967
+ id: "RadioGroup"
1968
+ });
1889
1969
  var BulletList = BaseField.extend({
1890
1970
  type: import_v43.default.literal(FieldType.BULLET_LIST),
1891
1971
  items: import_v43.default.array(TranslationConfig).describe("A list of items"),
@@ -1894,7 +1974,10 @@ var BulletList = BaseField.extend({
1894
1974
  fontVariant: HtmlFontVariant.optional()
1895
1975
  }).optional()
1896
1976
  }).default({})
1897
- }).describe("A list of bullet points");
1977
+ }).meta({
1978
+ description: "A list of bullet points",
1979
+ id: "BulletList"
1980
+ });
1898
1981
  var Select = BaseField.extend({
1899
1982
  type: import_v43.default.literal(FieldType.SELECT),
1900
1983
  defaultValue: TextValue.optional(),
@@ -1909,7 +1992,10 @@ var Select = BaseField.extend({
1909
1992
  { ..., defaultMessage: "'{input}' is not listed among the health facilities." }
1910
1993
  `
1911
1994
  )
1912
- }).describe("Select input");
1995
+ }).meta({
1996
+ description: "A select input field",
1997
+ id: "Select"
1998
+ });
1913
1999
  var SelectDateRangeOption = import_v43.default.object({
1914
2000
  value: SelectDateRangeValue.describe("The value of the option"),
1915
2001
  label: TranslationConfig.describe("The label of the option")
@@ -1918,7 +2004,10 @@ var SelectDateRangeField = BaseField.extend({
1918
2004
  type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
1919
2005
  defaultValue: SelectDateRangeValue.optional(),
1920
2006
  options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
1921
- }).describe("Select input with date range options");
2007
+ }).meta({
2008
+ description: "A date range selection field",
2009
+ id: "SelectDateRangeField"
2010
+ });
1922
2011
  var NameConfig = import_v43.default.object({
1923
2012
  firstname: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
1924
2013
  middlename: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
@@ -1949,26 +2038,41 @@ var NameField = BaseField.extend({
1949
2038
  surname: { required: true }
1950
2039
  }
1951
2040
  }).optional()
1952
- }).describe("Name input field");
2041
+ }).meta({
2042
+ description: "A field for entering a persons name",
2043
+ id: "NameField"
2044
+ });
1953
2045
  var PhoneField = BaseField.extend({
1954
2046
  defaultValue: NonEmptyTextValue.optional(),
1955
2047
  type: import_v43.default.literal(FieldType.PHONE)
1956
- }).describe("Phone input field");
2048
+ }).meta({
2049
+ description: "A field for entering a phone number",
2050
+ id: "PhoneField"
2051
+ });
1957
2052
  var IdField = BaseField.extend({
1958
2053
  defaultValue: NonEmptyTextValue.optional(),
1959
2054
  type: import_v43.default.literal(FieldType.ID)
1960
- }).describe("ID input field");
2055
+ }).meta({
2056
+ description: "A field for entering an ID",
2057
+ id: "IdField"
2058
+ });
1961
2059
  var Checkbox = BaseField.extend({
1962
2060
  type: import_v43.default.literal(FieldType.CHECKBOX),
1963
2061
  defaultValue: CheckboxFieldValue.default(false)
1964
- }).describe("Boolean checkbox field");
2062
+ }).meta({
2063
+ description: "A boolean checkbox field",
2064
+ id: "Checkbox"
2065
+ });
1965
2066
  var Country = BaseField.extend({
1966
2067
  type: import_v43.default.literal(FieldType.COUNTRY),
1967
2068
  defaultValue: NonEmptyTextValue.optional(),
1968
2069
  optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
1969
2070
  "Conditionals for specific countries. Countries not listed are always shown and enabled."
1970
2071
  )
1971
- }).describe("Country select field");
2072
+ }).meta({
2073
+ description: "A field for selecting a country",
2074
+ id: "Country"
2075
+ });
1972
2076
  var AllowedLocations = JurisdictionReference.optional().describe(
1973
2077
  "Limits which location options are selectable depending on user jurisdiction and location."
1974
2078
  );
@@ -1977,16 +2081,18 @@ var AdministrativeAreas = import_v43.default.enum([
1977
2081
  "HEALTH_FACILITY",
1978
2082
  "CRVS_OFFICE"
1979
2083
  ]);
1980
- var AdministrativeAreaConfiguration = import_v43.default.object({
1981
- partOf: FieldReference.optional().describe("Parent location"),
1982
- type: AdministrativeAreas,
1983
- allowedLocations: AllowedLocations
1984
- }).describe("Administrative area options");
1985
2084
  var AdministrativeAreaField = BaseField.extend({
1986
2085
  type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
1987
2086
  defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
1988
- configuration: AdministrativeAreaConfiguration
1989
- }).describe("Administrative area input field e.g. facility, office");
2087
+ configuration: import_v43.default.object({
2088
+ partOf: FieldReference.optional().describe("Parent location"),
2089
+ type: AdministrativeAreas,
2090
+ allowedLocations: AllowedLocations
2091
+ }).describe("Administrative area options")
2092
+ }).meta({
2093
+ description: "Administrative area input field",
2094
+ id: "AdministrativeAreaField"
2095
+ });
1990
2096
  var LocationInput = BaseField.extend({
1991
2097
  type: import_v43.default.literal(FieldType.LOCATION),
1992
2098
  defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
@@ -1994,7 +2100,10 @@ var LocationInput = BaseField.extend({
1994
2100
  locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
1995
2101
  allowedLocations: AllowedLocations
1996
2102
  }).optional()
1997
- }).describe("Input field for a location");
2103
+ }).meta({
2104
+ description: "A field for selecting a location",
2105
+ id: "LocationInput"
2106
+ });
1998
2107
  var FileUploadWithOptions = BaseField.extend({
1999
2108
  type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
2000
2109
  options: import_v43.default.array(SelectOption).describe("A list of options"),
@@ -2008,6 +2117,9 @@ var FileUploadWithOptions = BaseField.extend({
2008
2117
  }).default({
2009
2118
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
2010
2119
  })
2120
+ }).meta({
2121
+ description: "A field for uploading files with file type options",
2122
+ id: "FileUploadWithOptions"
2011
2123
  });
2012
2124
  var Facility = BaseField.extend({
2013
2125
  type: import_v43.default.literal(FieldType.FACILITY),
@@ -2053,7 +2165,10 @@ var Address = BaseField.extend({
2053
2165
  allowedLocations: AllowedLocations
2054
2166
  }).optional(),
2055
2167
  defaultValue: DefaultAddressFieldValue.optional()
2056
- }).describe("Address input field \u2013 a combination of location and text fields");
2168
+ }).meta({
2169
+ description: "Address input field \u2013 a combination of location and text fields",
2170
+ id: "Address"
2171
+ });
2057
2172
  var StaticDataEntry = import_v43.default.object({
2058
2173
  id: import_v43.default.string().describe("ID for the data entry."),
2059
2174
  label: TranslationConfig,
@@ -2068,7 +2183,10 @@ var DataField = BaseField.extend({
2068
2183
  subtitle: TranslationConfig.optional(),
2069
2184
  data: import_v43.default.array(DataEntry)
2070
2185
  })
2071
- }).describe("Data field for displaying read-only data");
2186
+ }).meta({
2187
+ description: "A field for displaying a table of read-only data",
2188
+ id: "DataField"
2189
+ });
2072
2190
  var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
2073
2191
  var ButtonType = import_v43.default.enum([
2074
2192
  "primary",
@@ -2095,11 +2213,17 @@ var ButtonField = BaseField.extend({
2095
2213
  type: import_v43.default.literal(FieldType.BUTTON),
2096
2214
  defaultValue: ButtonFieldValue.optional(),
2097
2215
  configuration: ButtonConfiguration
2098
- }).describe("Generic button without any built-in functionality");
2216
+ }).meta({
2217
+ description: "A generic button that can be used to trigger an action",
2218
+ id: "ButtonField"
2219
+ });
2099
2220
  var FieldGroup = BaseField.extend({
2100
2221
  type: import_v43.default.literal(FieldType.FIELD_GROUP),
2101
2222
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
2102
2223
  fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig))
2224
+ }).meta({
2225
+ description: "A group of fields that are displayed together",
2226
+ id: "FieldGroup"
2103
2227
  });
2104
2228
  var AlphaPrintButton = BaseField.extend({
2105
2229
  type: import_v43.default.literal(FieldType.ALPHA_PRINT_BUTTON),
@@ -2109,7 +2233,10 @@ var AlphaPrintButton = BaseField.extend({
2109
2233
  "Label for the print button"
2110
2234
  )
2111
2235
  })
2112
- }).describe("Print button field for printing certificates");
2236
+ }).meta({
2237
+ description: "An experimental print button field for printing certificates during the declaration process",
2238
+ id: "AlphaPrintButton"
2239
+ });
2113
2240
  var HttpField = BaseField.extend({
2114
2241
  type: import_v43.default.literal(FieldType.HTTP),
2115
2242
  defaultValue: HttpFieldValue.optional(),
@@ -2125,20 +2252,30 @@ var HttpField = BaseField.extend({
2125
2252
  params: import_v43.default.record(import_v43.default.string(), import_v43.default.union([import_v43.default.string(), FieldReference])).optional(),
2126
2253
  timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
2127
2254
  })
2128
- }).describe("HTTP request function triggered by a button click or other event");
2255
+ }).meta({
2256
+ 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.",
2257
+ id: "HttpField"
2258
+ });
2129
2259
  var AutocompleteField = BaseField.extend({
2130
2260
  type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
2131
2261
  configuration: import_v43.default.object({
2132
- url: import_v43.default.string().describe("URL to fetch autocomplete suggestions from").optional(),
2262
+ url: import_v43.default.string().describe(
2263
+ "URL to fetch autocomplete suggestions from. This should be a country config server endpoint."
2264
+ ).optional(),
2133
2265
  method: import_v43.default.enum(["GET", "POST"]).default("GET").optional(),
2134
2266
  defaultOptions: import_v43.default.array(
2135
2267
  import_v43.default.object({
2136
2268
  label: import_v43.default.string(),
2137
2269
  value: import_v43.default.string()
2138
2270
  })
2139
- ).optional()
2271
+ ).optional().describe(
2272
+ "Manual entry is supported through configuration, allowing users to provide values not currently represented in the dataset."
2273
+ )
2140
2274
  })
2141
- }).describe("Autocomplete input field");
2275
+ }).meta({
2276
+ 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.",
2277
+ id: "AutocompleteField"
2278
+ });
2142
2279
  var SearchField = HttpField.extend({
2143
2280
  type: import_v43.default.literal(FieldType.SEARCH),
2144
2281
  configuration: SearchQuery.pick({
@@ -2171,6 +2308,9 @@ var SearchField = HttpField.extend({
2171
2308
  ok: TranslationConfig.optional()
2172
2309
  }).optional()
2173
2310
  })
2311
+ }).meta({
2312
+ description: "A search input field",
2313
+ id: "SearchField"
2174
2314
  });
2175
2315
  var LinkButtonField = BaseField.extend({
2176
2316
  type: import_v43.default.literal(FieldType.LINK_BUTTON),
@@ -2179,7 +2319,10 @@ var LinkButtonField = BaseField.extend({
2179
2319
  text: TranslationConfig.describe("Text to display on the button"),
2180
2320
  icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
2181
2321
  })
2182
- }).describe("Button that opens a link");
2322
+ }).meta({
2323
+ description: "A button that opens a URL link",
2324
+ id: "LinkButtonField"
2325
+ });
2183
2326
  var VerificationStatus = BaseField.extend({
2184
2327
  type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
2185
2328
  defaultValue: VerificationStatusValue.optional(),
@@ -2189,15 +2332,19 @@ var VerificationStatus = BaseField.extend({
2189
2332
  "Explaining text on the banner in form."
2190
2333
  )
2191
2334
  })
2335
+ }).meta({
2336
+ 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.",
2337
+ id: "VerificationStatus"
2192
2338
  });
2193
2339
  var QueryParamReaderField = BaseField.extend({
2194
2340
  type: import_v43.default.literal(FieldType.QUERY_PARAM_READER),
2195
2341
  configuration: import_v43.default.object({
2196
2342
  pickParams: import_v43.default.array(import_v43.default.string()).describe("List of query parameters to read from the URL")
2197
2343
  })
2198
- }).describe(
2199
- "A field that maps URL query params into form values and clears them afterward"
2200
- );
2344
+ }).meta({
2345
+ description: "A field that maps URL query params into form values and clears them afterward",
2346
+ id: "QueryParamReaderField"
2347
+ });
2201
2348
  var QrReaderField = BaseField.extend({
2202
2349
  type: import_v43.default.literal(FieldType.QR_READER),
2203
2350
  defaultValue: QrReaderFieldValue.optional(),
@@ -2208,7 +2355,7 @@ var QrReaderField = BaseField.extend({
2208
2355
  })
2209
2356
  }).optional()
2210
2357
  }).meta({
2211
- description: "Configuration for QR code reader field, including optional JSON Schema validator.",
2358
+ description: "QR code reader field, including optional JSON Schema validator.",
2212
2359
  id: "QrReaderField"
2213
2360
  });
2214
2361
  var IdReaderField = BaseField.extend({
@@ -2217,12 +2364,18 @@ var IdReaderField = BaseField.extend({
2217
2364
  methods: import_v43.default.array(
2218
2365
  import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
2219
2366
  )
2367
+ }).meta({
2368
+ description: "A wrapper around nested form fields, specifically QR_READER and LINK_BUTTON. It can hold the QR_READERs value.",
2369
+ id: "IdReaderField"
2220
2370
  });
2221
2371
  var CustomField = BaseField.extend({
2222
2372
  type: import_v43.default.literal(FieldType._EXPERIMENTAL_CUSTOM),
2223
2373
  defaultValue: CustomFieldValue.optional(),
2224
2374
  src: import_v43.default.string().describe("Module source path for the custom field component"),
2225
2375
  configuration: import_v43.default.unknown().optional()
2376
+ }).meta({
2377
+ description: "An expiremental custom field that is defined by a module source path",
2378
+ id: "CustomField"
2226
2379
  });
2227
2380
  var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
2228
2381
  var LoaderField = BaseField.extend({
@@ -2232,22 +2385,25 @@ var LoaderField = BaseField.extend({
2232
2385
  configuration: import_v43.default.object({
2233
2386
  text: TranslationConfig.describe("Display text above the loading spinner")
2234
2387
  })
2235
- }).describe(
2236
- "A non-interactive field that indicates an in progress operation in form"
2237
- );
2388
+ }).meta({
2389
+ description: "A non-interactive field that indicates an in progress operation in form",
2390
+ id: "LoaderField"
2391
+ });
2238
2392
  var HiddenField = BaseField.extend({
2239
2393
  type: import_v43.default.literal(FieldType.ALPHA_HIDDEN),
2240
2394
  required: import_v43.default.boolean().default(false).optional(),
2241
2395
  defaultValue: TextValue.optional()
2242
- }).describe(
2243
- "A non-interactive, hidden field that only hold a value in the form"
2244
- );
2396
+ }).meta({
2397
+ description: "A non-interactive, hidden field that only hold a value in the form",
2398
+ id: "HiddenField"
2399
+ });
2245
2400
  var UserRoleField = BaseField.extend({
2246
2401
  type: import_v43.default.literal(FieldType.USER_ROLE),
2247
2402
  defaultValue: TextValue.optional()
2248
- }).describe(
2249
- "A select dropdown that is automatically populated with available user roles"
2250
- );
2403
+ }).meta({
2404
+ description: "A select dropdown that is automatically populated with available user roles",
2405
+ id: "UserRoleField"
2406
+ });
2251
2407
  var FieldConfig = import_v43.default.discriminatedUnion("type", [
2252
2408
  FieldGroup,
2253
2409
  Address,
@@ -2346,10 +2502,10 @@ var VerificationPageConfig = FormPageConfig.extend({
2346
2502
  type: z21.literal(PageTypes.enum.VERIFICATION),
2347
2503
  actions: VerificationActionConfig
2348
2504
  });
2349
- var PageConfig = z21.discriminatedUnion("type", [
2350
- FormPageConfig,
2351
- VerificationPageConfig
2352
- ]);
2505
+ var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
2506
+ description: "Page configuration",
2507
+ id: "PageConfig"
2508
+ });
2353
2509
 
2354
2510
  // ../commons/src/events/FormConfig.ts
2355
2511
  var DeclarationFormConfig = z22.object({
@@ -2572,17 +2728,39 @@ var ActionConfig = z24.discriminatedUnion("type", [
2572
2728
  * OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
2573
2729
  * and treat them as "models" instead of duplicating the data structure in each endpoint.
2574
2730
  */
2575
- ReadActionConfig.meta({ id: "ReadActionConfig" }),
2576
- DeclareConfig.meta({ id: "DeclareActionConfig" }),
2577
- RejectConfig.meta({ id: "RejectActionConfig" }),
2578
- RegisterConfig.meta({ id: "RegisterActionConfig" }),
2731
+ ReadActionConfig.meta({
2732
+ id: "ReadActionConfig",
2733
+ description: "Record-tab content displayed on the event overview page."
2734
+ }),
2735
+ DeclareConfig.meta({
2736
+ id: "DeclareActionConfig",
2737
+ description: "Submitting a new declaration (includes review fields). This config is also shared with ActionType.NOTIFY."
2738
+ }),
2739
+ RejectConfig.meta({
2740
+ id: "RejectActionConfig",
2741
+ description: "Rejecting a record before registration"
2742
+ }),
2743
+ RegisterConfig.meta({
2744
+ id: "RegisterActionConfig",
2745
+ description: "Registering a record"
2746
+ }),
2579
2747
  PrintCertificateActionConfig.meta({
2580
- id: "PrintCertificateActionConfig"
2748
+ id: "PrintCertificateActionConfig",
2749
+ description: "Printing a certificate"
2581
2750
  }),
2582
2751
  RequestCorrectionConfig.meta({ id: "RequestCorrectionActionConfig" }),
2583
- EditActionConfig.meta({ id: "EditActionConfig" }),
2584
- ArchiveConfig.meta({ id: "ArchiveActionConfig" }),
2585
- CustomActionConfig.meta({ id: "CustomActionConfig" })
2752
+ EditActionConfig.meta({
2753
+ id: "EditActionConfig",
2754
+ description: "Editing a record before registration"
2755
+ }),
2756
+ ArchiveConfig.meta({
2757
+ id: "ArchiveActionConfig",
2758
+ description: "Archiving a record"
2759
+ }),
2760
+ CustomActionConfig.meta({
2761
+ id: "CustomActionConfig",
2762
+ description: "Custom action configuration"
2763
+ })
2586
2764
  ]).describe(
2587
2765
  "Configuration of an action available for an event. Data collected depends on the action type and is accessible through the annotation property in ActionDocument."
2588
2766
  ).meta({ id: "ActionConfig" });
@@ -3649,7 +3827,7 @@ var _EventConfigBase = z33.object({
3649
3827
  ),
3650
3828
  label: TranslationConfig.describe("Human-readable label for the event type."),
3651
3829
  actions: z33.array(ActionConfig).describe(
3652
- "Configuration of system-defined actions associated with the event."
3830
+ "Configuration of core and custom actions associated with the event."
3653
3831
  ),
3654
3832
  actionOrder: z33.array(z33.string()).optional().describe(
3655
3833
  "Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
@@ -3661,7 +3839,7 @@ var _EventConfigBase = z33.object({
3661
3839
  "Configuration of fields available in the advanced search feature."
3662
3840
  ),
3663
3841
  flags: z33.array(FlagConfig).optional().default([]).describe(
3664
- "Configuration of flags associated with the actions of this event type."
3842
+ "Configuration of custom flags associated with the actions of this event type."
3665
3843
  ),
3666
3844
  analytics: z33.boolean().optional().default(true).describe(
3667
3845
  "Indicates whether the records of this event type are included in analytics"
@@ -4099,18 +4277,11 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
4099
4277
  query: true,
4100
4278
  columns: true
4101
4279
  });
4102
- var WorkqueueConfigInput = z37.object({
4103
- slug: z37.string().describe("Determines the url of the workqueue."),
4104
- name: TranslationConfig.describe(
4105
- "Title of the workflow (both in navigation and on the page)"
4106
- ),
4107
- query: CountryConfigQueryInputType,
4108
- action: z37.object({ type: WorkqueueActionType }).optional().describe(
4109
- "Workqueue call-to-action button configuration. This determines the quick action button shown on each event card and the action taken when the button is clicked."
4110
- ),
4111
- columns: z37.array(WorkqueueColumn).default(mandatoryColumns),
4112
- icon: AvailableIcons,
4113
- emptyMessage: TranslationConfig.optional()
4280
+ var WorkqueueConfigInput = WorkqueueConfig.extend({
4281
+ query: CountryConfigQueryInputType
4282
+ }).meta({
4283
+ description: "Workqueue configuration",
4284
+ id: "WorkqueueConfig"
4114
4285
  });
4115
4286
  var WorkqueueCountInput = z37.array(
4116
4287
  z37.object({ slug: z37.string(), query: QueryType })
@@ -4150,6 +4321,9 @@ var BaseActionInput = z38.object({
4150
4321
  originalActionId: UUID.optional(),
4151
4322
  // should not be part of base action.
4152
4323
  keepAssignment: z38.boolean().optional(),
4324
+ keepAssignmentIfAccepted: z38.boolean().optional(),
4325
+ keepAssignmentIfRejected: z38.boolean().optional(),
4326
+ waitFor: z38.boolean().optional(),
4153
4327
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
4154
4328
  // @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
4155
4329
  createdAtLocation: UUID.nullish().describe(