@opencrvs/toolkit 1.8.1-rc.25f3d5c → 1.8.1-rc.3068713

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.
@@ -39,7 +39,6 @@ __export(events_exports, {
39
39
  ActionConfig: () => ActionConfig,
40
40
  ActionConfigBase: () => ActionConfigBase,
41
41
  ActionCreationMetadata: () => ActionCreationMetadata,
42
- ActionDetails: () => ActionDetails,
43
42
  ActionDocument: () => ActionDocument,
44
43
  ActionFormConfig: () => ActionFormConfig,
45
44
  ActionInput: () => ActionInput,
@@ -140,6 +139,7 @@ __export(events_exports, {
140
139
  PageConfig: () => PageConfig,
141
140
  PageTypes: () => PageTypes,
142
141
  PrintCertificateActionInput: () => PrintCertificateActionInput,
142
+ PrintContent: () => PrintContent,
143
143
  QueryExpression: () => QueryExpression,
144
144
  QueryInput: () => QueryInput,
145
145
  QueryType: () => QueryType,
@@ -607,8 +607,8 @@ var UrbanAddressUpdateValue = AdminStructure.extend({
607
607
  zipCode: import_zod5.z.string().nullish()
608
608
  });
609
609
  var NameFieldValue = import_zod5.z.object({
610
- firstname: import_zod5.z.string(),
611
- surname: import_zod5.z.string(),
610
+ firstname: import_zod5.z.string().min(1),
611
+ surname: import_zod5.z.string().min(1),
612
612
  middlename: import_zod5.z.string().optional()
613
613
  });
614
614
  var NameFieldUpdateValue = import_zod5.z.object({
@@ -1341,7 +1341,7 @@ var SummaryConfig = import_zod14.z.object({
1341
1341
 
1342
1342
  // ../commons/src/events/AdvancedSearchConfig.ts
1343
1343
  var import_zod15 = require("zod");
1344
- var MatchType = import_zod15.z.enum(["fuzzy", "exact", "range"]);
1344
+ var MatchType = import_zod15.z.enum(["fuzzy", "exact", "range", "within"]);
1345
1345
  var BaseField3 = import_zod15.z.object({
1346
1346
  config: import_zod15.z.object({
1347
1347
  type: MatchType.describe("Determines the type of field")
@@ -1883,10 +1883,6 @@ var ActionStatus = {
1883
1883
  Accepted: "Accepted",
1884
1884
  Rejected: "Rejected"
1885
1885
  };
1886
- var ActionDetails = import_zod19.z.object({
1887
- templateId: import_zod19.z.string().optional(),
1888
- isImmediateCorrection: import_zod19.z.boolean().optional()
1889
- });
1890
1886
  var ActionBase = import_zod19.z.object({
1891
1887
  id: UUID,
1892
1888
  transactionId: import_zod19.z.string(),
@@ -1898,7 +1894,6 @@ var ActionBase = import_zod19.z.object({
1898
1894
  createdAtLocation: CreatedAtLocation,
1899
1895
  declaration: ActionUpdate,
1900
1896
  annotation: ActionUpdate.optional().nullable(),
1901
- actionDetails: ActionDetails.optional().nullable(),
1902
1897
  status: import_zod19.z.enum([
1903
1898
  ActionStatus.Requested,
1904
1899
  ActionStatus.Accepted,
@@ -1908,11 +1903,15 @@ var ActionBase = import_zod19.z.object({
1908
1903
  originalActionId: UUID.optional().nullable().describe(
1909
1904
  "Reference to the original action that was asynchronously rejected or accepted by 3rd party integration."
1910
1905
  )
1906
+ // 'content' field reserved for additional data
1907
+ // Each action can define its own content specifc to the action
1908
+ // See PrintCertificateAction
1911
1909
  });
1912
1910
  var AssignedAction = ActionBase.merge(
1913
1911
  import_zod19.z.object({
1914
1912
  type: import_zod19.z.literal(ActionType.ASSIGN),
1915
1913
  assignedTo: import_zod19.z.string()
1914
+ // TODO move into 'content' property
1916
1915
  })
1917
1916
  );
1918
1917
  var UnassignedAction = ActionBase.merge(
@@ -1924,6 +1923,7 @@ var RegisterAction = ActionBase.merge(
1924
1923
  import_zod19.z.object({
1925
1924
  type: import_zod19.z.literal(ActionType.REGISTER),
1926
1925
  registrationNumber: import_zod19.z.string().optional()
1926
+ // TODO move into 'content' property
1927
1927
  })
1928
1928
  );
1929
1929
  var DeclareAction = ActionBase.merge(
@@ -1944,6 +1944,7 @@ var RejectAction = ActionBase.merge(
1944
1944
  import_zod19.z.object({
1945
1945
  type: import_zod19.z.literal(ActionType.REJECT),
1946
1946
  reason: RejectionReason
1947
+ // TODO move into 'content' property
1947
1948
  })
1948
1949
  );
1949
1950
  var MarkAsDuplicateAction = ActionBase.merge(
@@ -1955,6 +1956,7 @@ var ArchiveAction = ActionBase.merge(
1955
1956
  import_zod19.z.object({
1956
1957
  type: import_zod19.z.literal(ActionType.ARCHIVE),
1957
1958
  reason: RejectionReason
1959
+ // TODO move into 'content' property
1958
1960
  })
1959
1961
  );
1960
1962
  var CreatedAction = ActionBase.merge(
@@ -1967,9 +1969,13 @@ var NotifiedAction = ActionBase.merge(
1967
1969
  type: import_zod19.z.literal(ActionType.NOTIFY)
1968
1970
  })
1969
1971
  );
1972
+ var PrintContent = import_zod19.z.object({
1973
+ templateId: import_zod19.z.string().optional()
1974
+ });
1970
1975
  var PrintCertificateAction = ActionBase.merge(
1971
1976
  import_zod19.z.object({
1972
- type: import_zod19.z.literal(ActionType.PRINT_CERTIFICATE)
1977
+ type: import_zod19.z.literal(ActionType.PRINT_CERTIFICATE),
1978
+ content: PrintContent.optional().nullable()
1973
1979
  })
1974
1980
  );
1975
1981
  var RequestedCorrectionAction = ActionBase.merge(
@@ -1981,12 +1987,15 @@ var ApprovedCorrectionAction = ActionBase.merge(
1981
1987
  import_zod19.z.object({
1982
1988
  type: import_zod19.z.literal(ActionType.APPROVE_CORRECTION),
1983
1989
  requestId: import_zod19.z.string()
1990
+ // TODO move into 'content' property
1984
1991
  })
1985
1992
  );
1986
1993
  var RejectedCorrectionAction = ActionBase.merge(
1987
1994
  import_zod19.z.object({
1988
1995
  type: import_zod19.z.literal(ActionType.REJECT_CORRECTION),
1989
- requestId: import_zod19.z.string()
1996
+ requestId: import_zod19.z.string(),
1997
+ // TODO move into 'content' property
1998
+ reason: RejectionReason
1990
1999
  })
1991
2000
  );
1992
2001
  var ReadAction = ActionBase.merge(
@@ -3180,6 +3189,19 @@ function createSearchConfig(baseField) {
3180
3189
  fuzzy: () => ({
3181
3190
  ...baseField,
3182
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" }
3183
3205
  })
3184
3206
  };
3185
3207
  }
@@ -3529,6 +3551,9 @@ var QueryExpression = import_zod25.z.object({
3529
3551
  createdAt: import_zod25.z.optional(DateCondition),
3530
3552
  updatedAt: import_zod25.z.optional(DateCondition),
3531
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
+ ),
3532
3557
  "legalStatuses.REGISTERED.createdAtLocation": import_zod25.z.optional(
3533
3558
  import_zod25.z.union([Within, Exact])
3534
3559
  ),
@@ -3840,7 +3865,6 @@ var BaseActionInput = import_zod29.z.object({
3840
3865
  transactionId: import_zod29.z.string(),
3841
3866
  declaration: ActionUpdate.default({}),
3842
3867
  annotation: ActionUpdate.optional(),
3843
- actionDetails: ActionDetails.optional(),
3844
3868
  originalActionId: UUID.optional(),
3845
3869
  // should not be part of base action.
3846
3870
  keepAssignment: import_zod29.z.boolean().optional()
@@ -3883,7 +3907,8 @@ var DeclareActionInput = BaseActionInput.merge(
3883
3907
  );
3884
3908
  var PrintCertificateActionInput = BaseActionInput.merge(
3885
3909
  import_zod29.z.object({
3886
- 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()
3887
3912
  })
3888
3913
  );
3889
3914
  var RejectDeclarationActionInput = BaseActionInput.merge(
@@ -3923,7 +3948,8 @@ var RequestCorrectionActionInput = BaseActionInput.merge(
3923
3948
  var RejectCorrectionActionInput = BaseActionInput.merge(
3924
3949
  import_zod29.z.object({
3925
3950
  requestId: import_zod29.z.string(),
3926
- type: import_zod29.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
3951
+ type: import_zod29.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION),
3952
+ reason: RejectionReason
3927
3953
  })
3928
3954
  );
3929
3955
  var ApproveCorrectionActionInput = BaseActionInput.merge(
@@ -6762,7 +6788,7 @@ function eventPayloadGenerator(rng) {
6762
6788
  requestId,
6763
6789
  keepAssignment: input.keepAssignment
6764
6790
  }),
6765
- reject: (eventId, requestId, input = {}) => ({
6791
+ reject: (eventId, requestId, input) => ({
6766
6792
  type: ActionType.REJECT_CORRECTION,
6767
6793
  transactionId: input.transactionId ?? getUUID(),
6768
6794
  declaration: {},
@@ -6773,7 +6799,8 @@ function eventPayloadGenerator(rng) {
6773
6799
  ),
6774
6800
  eventId,
6775
6801
  requestId,
6776
- keepAssignment: input.keepAssignment
6802
+ keepAssignment: input.keepAssignment,
6803
+ reason: input.reason ?? { message: "" }
6777
6804
  })
6778
6805
  }
6779
6806
  }
@@ -6832,7 +6859,8 @@ function generateActionDocument({
6832
6859
  return {
6833
6860
  ...actionBase,
6834
6861
  requestId: getUUID(),
6835
- type: action
6862
+ type: action,
6863
+ reason: { message: "Correction rejection" }
6836
6864
  };
6837
6865
  case ActionType.REGISTER:
6838
6866
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "1.8.1-rc.25f3d5c",
3
+ "version": "1.8.1-rc.3068713",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "exports": {