@opencrvs/toolkit 1.8.1-rc.38ac682 → 1.8.1-rc.38b4f18

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.
@@ -139,6 +139,7 @@ __export(events_exports, {
139
139
  PageConfig: () => PageConfig,
140
140
  PageTypes: () => PageTypes,
141
141
  PrintCertificateActionInput: () => PrintCertificateActionInput,
142
+ PrintContent: () => PrintContent,
142
143
  QueryExpression: () => QueryExpression,
143
144
  QueryInput: () => QueryInput,
144
145
  QueryType: () => QueryType,
@@ -297,7 +298,6 @@ __export(events_exports, {
297
298
  isPageVisible: () => isPageVisible,
298
299
  isParagraphFieldType: () => isParagraphFieldType,
299
300
  isPhoneFieldType: () => isPhoneFieldType,
300
- isPrintButtonFieldType: () => isPrintButtonFieldType,
301
301
  isRadioGroupFieldType: () => isRadioGroupFieldType,
302
302
  isSelectDateRangeFieldType: () => isSelectDateRangeFieldType,
303
303
  isSelectFieldType: () => isSelectFieldType,
@@ -538,8 +538,7 @@ var FieldType = {
538
538
  FACILITY: "FACILITY",
539
539
  OFFICE: "OFFICE",
540
540
  SIGNATURE: "SIGNATURE",
541
- DATA: "DATA",
542
- PRINT_BUTTON: "PRINT_BUTTON"
541
+ DATA: "DATA"
543
542
  };
544
543
  var fieldTypes = Object.values(FieldType);
545
544
  var compositeFieldTypes = [
@@ -608,8 +607,8 @@ var UrbanAddressUpdateValue = AdminStructure.extend({
608
607
  zipCode: import_zod5.z.string().nullish()
609
608
  });
610
609
  var NameFieldValue = import_zod5.z.object({
611
- firstname: import_zod5.z.string(),
612
- surname: import_zod5.z.string(),
610
+ firstname: import_zod5.z.string().min(1),
611
+ surname: import_zod5.z.string().min(1),
613
612
  middlename: import_zod5.z.string().optional()
614
613
  });
615
614
  var NameFieldUpdateValue = import_zod5.z.object({
@@ -1006,15 +1005,6 @@ var DataField = BaseField.extend({
1006
1005
  data: import_zod7.z.array(DataEntry)
1007
1006
  })
1008
1007
  }).describe("Data field for displaying read-only data");
1009
- var PrintButton = BaseField.extend({
1010
- type: import_zod7.z.literal(FieldType.PRINT_BUTTON),
1011
- configuration: import_zod7.z.object({
1012
- template: import_zod7.z.string().describe("Template ID from countryconfig templates to use for printing"),
1013
- buttonLabel: TranslationConfig.optional().describe(
1014
- "Label for the print button"
1015
- )
1016
- })
1017
- }).describe("Print button field for printing certificates");
1018
1008
  var FieldConfig = import_zod7.z.discriminatedUnion("type", [
1019
1009
  Address,
1020
1010
  TextField,
@@ -1043,8 +1033,7 @@ var FieldConfig = import_zod7.z.discriminatedUnion("type", [
1043
1033
  SignatureField,
1044
1034
  EmailField,
1045
1035
  FileUploadWithOptions,
1046
- DataField,
1047
- PrintButton
1036
+ DataField
1048
1037
  ]).openapi({
1049
1038
  description: "Form field configuration",
1050
1039
  ref: "FieldConfig"
@@ -1352,7 +1341,7 @@ var SummaryConfig = import_zod14.z.object({
1352
1341
 
1353
1342
  // ../commons/src/events/AdvancedSearchConfig.ts
1354
1343
  var import_zod15 = require("zod");
1355
- var MatchType = import_zod15.z.enum(["fuzzy", "exact", "range"]);
1344
+ var MatchType = import_zod15.z.enum(["fuzzy", "exact", "range", "within"]);
1356
1345
  var BaseField3 = import_zod15.z.object({
1357
1346
  config: import_zod15.z.object({
1358
1347
  type: MatchType.describe("Determines the type of field")
@@ -1914,11 +1903,15 @@ var ActionBase = import_zod19.z.object({
1914
1903
  originalActionId: UUID.optional().nullable().describe(
1915
1904
  "Reference to the original action that was asynchronously rejected or accepted by 3rd party integration."
1916
1905
  )
1906
+ // 'content' field reserved for additional data
1907
+ // Each action can define its own content specifc to the action
1908
+ // See PrintCertificateAction
1917
1909
  });
1918
1910
  var AssignedAction = ActionBase.merge(
1919
1911
  import_zod19.z.object({
1920
1912
  type: import_zod19.z.literal(ActionType.ASSIGN),
1921
1913
  assignedTo: import_zod19.z.string()
1914
+ // TODO move into 'content' property
1922
1915
  })
1923
1916
  );
1924
1917
  var UnassignedAction = ActionBase.merge(
@@ -1930,6 +1923,7 @@ var RegisterAction = ActionBase.merge(
1930
1923
  import_zod19.z.object({
1931
1924
  type: import_zod19.z.literal(ActionType.REGISTER),
1932
1925
  registrationNumber: import_zod19.z.string().optional()
1926
+ // TODO move into 'content' property
1933
1927
  })
1934
1928
  );
1935
1929
  var DeclareAction = ActionBase.merge(
@@ -1950,6 +1944,7 @@ var RejectAction = ActionBase.merge(
1950
1944
  import_zod19.z.object({
1951
1945
  type: import_zod19.z.literal(ActionType.REJECT),
1952
1946
  reason: RejectionReason
1947
+ // TODO move into 'content' property
1953
1948
  })
1954
1949
  );
1955
1950
  var MarkAsDuplicateAction = ActionBase.merge(
@@ -1961,6 +1956,7 @@ var ArchiveAction = ActionBase.merge(
1961
1956
  import_zod19.z.object({
1962
1957
  type: import_zod19.z.literal(ActionType.ARCHIVE),
1963
1958
  reason: RejectionReason
1959
+ // TODO move into 'content' property
1964
1960
  })
1965
1961
  );
1966
1962
  var CreatedAction = ActionBase.merge(
@@ -1973,9 +1969,13 @@ var NotifiedAction = ActionBase.merge(
1973
1969
  type: import_zod19.z.literal(ActionType.NOTIFY)
1974
1970
  })
1975
1971
  );
1972
+ var PrintContent = import_zod19.z.object({
1973
+ templateId: import_zod19.z.string().optional()
1974
+ });
1976
1975
  var PrintCertificateAction = ActionBase.merge(
1977
1976
  import_zod19.z.object({
1978
- type: import_zod19.z.literal(ActionType.PRINT_CERTIFICATE)
1977
+ type: import_zod19.z.literal(ActionType.PRINT_CERTIFICATE),
1978
+ content: PrintContent.optional().nullable()
1979
1979
  })
1980
1980
  );
1981
1981
  var RequestedCorrectionAction = ActionBase.merge(
@@ -1987,12 +1987,14 @@ var ApprovedCorrectionAction = ActionBase.merge(
1987
1987
  import_zod19.z.object({
1988
1988
  type: import_zod19.z.literal(ActionType.APPROVE_CORRECTION),
1989
1989
  requestId: import_zod19.z.string()
1990
+ // TODO move into 'content' property
1990
1991
  })
1991
1992
  );
1992
1993
  var RejectedCorrectionAction = ActionBase.merge(
1993
1994
  import_zod19.z.object({
1994
1995
  type: import_zod19.z.literal(ActionType.REJECT_CORRECTION),
1995
1996
  requestId: import_zod19.z.string(),
1997
+ // TODO move into 'content' property
1996
1998
  reason: RejectionReason
1997
1999
  })
1998
2000
  );
@@ -2106,9 +2108,6 @@ function mapFieldTypeToZod(type, required) {
2106
2108
  case FieldType.NAME:
2107
2109
  schema = required ? NameFieldValue : NameFieldUpdateValue;
2108
2110
  break;
2109
- case FieldType.PRINT_BUTTON:
2110
- schema = TextValue;
2111
- break;
2112
2111
  }
2113
2112
  return required ? schema : schema.nullish();
2114
2113
  }
@@ -2169,8 +2168,6 @@ function mapFieldTypeToEmptyValue(field2) {
2169
2168
  };
2170
2169
  case FieldType.FILE_WITH_OPTIONS:
2171
2170
  return [];
2172
- case FieldType.PRINT_BUTTON:
2173
- return null;
2174
2171
  }
2175
2172
  }
2176
2173
  var isParagraphFieldType = (field2) => {
@@ -2257,9 +2254,6 @@ var isOfficeFieldType = (field2) => {
2257
2254
  var isDataFieldType = (field2) => {
2258
2255
  return field2.config.type === FieldType.DATA;
2259
2256
  };
2260
- var isPrintButtonFieldType = (field2) => {
2261
- return field2.config.type === FieldType.PRINT_BUTTON;
2262
- };
2263
2257
  var isNonInteractiveFieldType = (field2) => {
2264
2258
  return field2.type === FieldType.DIVIDER || field2.type === FieldType.PAGE_HEADER || field2.type === FieldType.PARAGRAPH || field2.type === FieldType.BULLET_LIST || field2.type === FieldType.DATA;
2265
2259
  };
@@ -3195,6 +3189,19 @@ function createSearchConfig(baseField) {
3195
3189
  fuzzy: () => ({
3196
3190
  ...baseField,
3197
3191
  config: { type: "fuzzy" }
3192
+ }),
3193
+ /**
3194
+ * Creates a configuration for matching locations and the child locations
3195
+ * @returns An object containing the field ID and a configuration object with a type of 'within'.
3196
+ * @example field('createdAtLocation').within()
3197
+ * // {
3198
+ * // ...
3199
+ * // config: { type: 'within' }
3200
+ * // }
3201
+ */
3202
+ within: () => ({
3203
+ ...baseField,
3204
+ config: { type: "within" }
3198
3205
  })
3199
3206
  };
3200
3207
  }
@@ -3544,6 +3551,9 @@ var QueryExpression = import_zod25.z.object({
3544
3551
  createdAt: import_zod25.z.optional(DateCondition),
3545
3552
  updatedAt: import_zod25.z.optional(DateCondition),
3546
3553
  "legalStatuses.REGISTERED.acceptedAt": import_zod25.z.optional(DateCondition),
3554
+ "legalStatuses.DECLARED.createdAtLocation": import_zod25.z.optional(
3555
+ import_zod25.z.union([Within, Exact])
3556
+ ),
3547
3557
  "legalStatuses.REGISTERED.createdAtLocation": import_zod25.z.optional(
3548
3558
  import_zod25.z.union([Within, Exact])
3549
3559
  ),
@@ -3897,7 +3907,8 @@ var DeclareActionInput = BaseActionInput.merge(
3897
3907
  );
3898
3908
  var PrintCertificateActionInput = BaseActionInput.merge(
3899
3909
  import_zod29.z.object({
3900
- type: import_zod29.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
3910
+ type: import_zod29.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
3911
+ content: PrintContent.optional()
3901
3912
  })
3902
3913
  );
3903
3914
  var RejectDeclarationActionInput = BaseActionInput.merge(
@@ -6503,8 +6514,6 @@ function mapFieldTypeToMockValue(field2, i, rng) {
6503
6514
  return "2021-01-01";
6504
6515
  case FieldType.TIME:
6505
6516
  return "09:33";
6506
- case FieldType.PRINT_BUTTON:
6507
- return void 0;
6508
6517
  case FieldType.DATE_RANGE:
6509
6518
  return {
6510
6519
  start: "2021-01-01",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "1.8.1-rc.38ac682",
3
+ "version": "1.8.1-rc.38b4f18",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "exports": {