@opencrvs/toolkit 2.0.0-rc.d4ca5e7 → 2.0.0-rc.d549cc4

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.
@@ -206,6 +206,11 @@ var FieldTypesToHideInReview = [
206
206
  FieldType.ALPHA_PRINT_BUTTON,
207
207
  FieldType.ALPHA_HIDDEN
208
208
  ];
209
+ var HiddenFieldTypes = [
210
+ FieldType.HTTP,
211
+ FieldType.QUERY_PARAM_READER,
212
+ FieldType.ALPHA_HIDDEN
213
+ ];
209
214
 
210
215
  // ../commons/src/events/FieldValue.ts
211
216
  var z7 = __toESM(require("zod/v4"));
@@ -324,7 +329,7 @@ var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date i
324
329
  // ../commons/src/events/FieldValue.ts
325
330
  var TextValue = z7.string();
326
331
  var HiddenFieldValue = z7.string();
327
- var NonEmptyTextValue = TextValue.min(1);
332
+ var NonEmptyTextValue = z7.string().trim().min(1);
328
333
  var DateValue = z7.iso.date().describe("Date in the format YYYY-MM-DD");
329
334
  var AgeValue = z7.object({
330
335
  age: z7.number(),
@@ -1495,6 +1500,7 @@ var NumberField = BaseField.extend({
1495
1500
  configuration: import_v43.default.object({
1496
1501
  min: import_v43.default.number().optional().describe("Minimum value"),
1497
1502
  max: import_v43.default.number().optional().describe("Maximum value"),
1503
+ integer: import_v43.default.boolean().optional().describe("When true, only whole numbers are allowed"),
1498
1504
  prefix: TranslationConfig.optional(),
1499
1505
  postfix: TranslationConfig.optional()
1500
1506
  }).optional()
@@ -7374,9 +7374,13 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
7374
7374
  output: void;
7375
7375
  meta: import("trpc-to-openapi").OpenApiMeta;
7376
7376
  }>;
7377
- sendVerifyCode: import("@trpc/server").TRPCMutationProcedure<{
7377
+ requestContactChange: import("@trpc/server").TRPCMutationProcedure<{
7378
7378
  input: {
7379
- notificationEvent: "change-phone-number" | "change-email-address";
7379
+ notificationEvent: "change-email-address";
7380
+ email: string;
7381
+ } | {
7382
+ notificationEvent: "change-phone-number";
7383
+ phoneNumber: string;
7380
7384
  };
7381
7385
  output: {
7382
7386
  nonce: string;
@@ -267,6 +267,7 @@ declare const NumberField: z.ZodObject<{
267
267
  configuration: z.ZodOptional<z.ZodObject<{
268
268
  min: z.ZodOptional<z.ZodNumber>;
269
269
  max: z.ZodOptional<z.ZodNumber>;
270
+ integer: z.ZodOptional<z.ZodBoolean>;
270
271
  prefix: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>>;
271
272
  postfix: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>>;
272
273
  }, z.core.$strip>>;
@@ -75,4 +75,5 @@ export type FieldType = (typeof fieldTypes)[number];
75
75
  */
76
76
  export declare const compositeFieldTypes: ("NAME" | "ADDRESS" | "DATE_RANGE" | "FILE" | "FILE_WITH_OPTIONS" | "DATA" | "ID_READER")[];
77
77
  export declare const FieldTypesToHideInReview: ("IMAGE_VIEW" | "PARAGRAPH" | "PAGE_HEADER" | "BULLET_LIST" | "DIVIDER" | "DATA" | "ALPHA_PRINT_BUTTON" | "HTTP" | "QUERY_PARAM_READER" | "ID_READER" | "LOADER" | "ALPHA_HIDDEN")[];
78
+ export declare const HiddenFieldTypes: ("HTTP" | "QUERY_PARAM_READER" | "ALPHA_HIDDEN")[];
78
79
  //# sourceMappingURL=FieldType.d.ts.map
@@ -690,7 +690,7 @@ export declare const isHiddenFieldType: (field: {
690
690
  value: undefined;
691
691
  config: HiddenField;
692
692
  };
693
- export type NonInteractiveFieldType = Divider | PageHeader | ImageViewField | Paragraph | Heading | BulletList | DataField | AlphaPrintButton | HttpField | LinkButtonField | QueryParamReaderField | LoaderField | AutocompleteField;
693
+ export type NonInteractiveFieldType = Divider | PageHeader | ImageViewField | Paragraph | Heading | BulletList | DataField | AlphaPrintButton | LinkButtonField | LoaderField | AutocompleteField;
694
694
  export type InteractiveFieldType = Exclude<FieldConfig, NonInteractiveFieldType>;
695
695
  export declare const isNonInteractiveFieldType: (field: FieldConfig) => field is NonInteractiveFieldType;
696
696
  export {};
@@ -151,6 +151,7 @@ __export(events_exports, {
151
151
  FormPageConfig: () => FormPageConfig,
152
152
  Fuzzy: () => Fuzzy,
153
153
  GeographicalArea: () => GeographicalArea,
154
+ HiddenFieldTypes: () => HiddenFieldTypes,
154
155
  HiddenFieldValue: () => HiddenFieldValue,
155
156
  HttpFieldUpdateValue: () => HttpFieldUpdateValue,
156
157
  HttpFieldValue: () => HttpFieldValue,
@@ -1219,6 +1220,11 @@ var FieldTypesToHideInReview = [
1219
1220
  FieldType.ALPHA_PRINT_BUTTON,
1220
1221
  FieldType.ALPHA_HIDDEN
1221
1222
  ];
1223
+ var HiddenFieldTypes = [
1224
+ FieldType.HTTP,
1225
+ FieldType.QUERY_PARAM_READER,
1226
+ FieldType.ALPHA_HIDDEN
1227
+ ];
1222
1228
 
1223
1229
  // ../commons/src/events/FieldValue.ts
1224
1230
  var z12 = __toESM(require("zod/v4"));
@@ -1345,7 +1351,7 @@ function plainDateToLocalDate(date) {
1345
1351
  // ../commons/src/events/FieldValue.ts
1346
1352
  var TextValue = z12.string();
1347
1353
  var HiddenFieldValue = z12.string();
1348
- var NonEmptyTextValue = TextValue.min(1);
1354
+ var NonEmptyTextValue = z12.string().trim().min(1);
1349
1355
  var DateValue = z12.iso.date().describe("Date in the format YYYY-MM-DD");
1350
1356
  var AgeValue = z12.object({
1351
1357
  age: z12.number(),
@@ -2292,6 +2298,7 @@ var NumberField = BaseField.extend({
2292
2298
  configuration: import_v43.default.object({
2293
2299
  min: import_v43.default.number().optional().describe("Minimum value"),
2294
2300
  max: import_v43.default.number().optional().describe("Maximum value"),
2301
+ integer: import_v43.default.boolean().optional().describe("When true, only whole numbers are allowed"),
2295
2302
  prefix: TranslationConfig.optional(),
2296
2303
  postfix: TranslationConfig.optional()
2297
2304
  }).optional()
@@ -3908,7 +3915,7 @@ var isHiddenFieldType = (field3) => {
3908
3915
  return field3.config.type === FieldType.ALPHA_HIDDEN;
3909
3916
  };
3910
3917
  var isNonInteractiveFieldType = (field3) => {
3911
- return field3.type === FieldType.DIVIDER || field3.type === FieldType.PAGE_HEADER || field3.type === FieldType.PARAGRAPH || field3.type === FieldType.HEADING || field3.type === FieldType.BULLET_LIST || field3.type === FieldType.DATA || field3.type === FieldType.ALPHA_PRINT_BUTTON || field3.type === FieldType.HTTP || field3.type === FieldType.LINK_BUTTON || field3.type === FieldType.QUERY_PARAM_READER || field3.type === FieldType.LOADER;
3918
+ return field3.type === FieldType.DIVIDER || field3.type === FieldType.PAGE_HEADER || field3.type === FieldType.PARAGRAPH || field3.type === FieldType.HEADING || field3.type === FieldType.BULLET_LIST || field3.type === FieldType.DATA || field3.type === FieldType.ALPHA_PRINT_BUTTON || field3.type === FieldType.LINK_BUTTON || field3.type === FieldType.LOADER;
3912
3919
  };
3913
3920
 
3914
3921
  // ../commons/src/conditionals/validate.ts
@@ -6485,6 +6492,8 @@ var updateActions = ActionTypes.extract([
6485
6492
  ActionType.ARCHIVE,
6486
6493
  ActionType.PRINT_CERTIFICATE,
6487
6494
  ActionType.REQUEST_CORRECTION,
6495
+ ActionType.APPROVE_CORRECTION,
6496
+ ActionType.REJECT_CORRECTION,
6488
6497
  ActionType.CUSTOM
6489
6498
  ]);
6490
6499
  function getActionUpdateMetadata(actions) {
@@ -10623,18 +10632,19 @@ var ACTION_FILTERS = {
10623
10632
  function filterActionsByFlags(actions, flags) {
10624
10633
  return actions.filter((action) => ACTION_FILTERS[action]?.(flags) ?? true);
10625
10634
  }
10635
+ var REJECTED_ACTIONS = [
10636
+ ActionType.READ,
10637
+ ActionType.NOTIFY,
10638
+ ActionType.CUSTOM,
10639
+ ActionType.EDIT,
10640
+ ActionType.ARCHIVE
10641
+ ];
10626
10642
  function getAvailableActionsWithoutFlagFilters(status2, flags) {
10627
10643
  if (flags.includes(InherentFlags.EDIT_IN_PROGRESS)) {
10628
10644
  return [ActionType.NOTIFY, ActionType.DECLARE, ActionType.REGISTER];
10629
10645
  }
10630
- if (flags.includes(InherentFlags.REJECTED)) {
10631
- return [
10632
- ActionType.READ,
10633
- ActionType.NOTIFY,
10634
- ActionType.CUSTOM,
10635
- ActionType.EDIT,
10636
- ActionType.ARCHIVE
10637
- ];
10646
+ if (flags.includes(InherentFlags.REJECTED) && status2 !== EventStatus.enum.ARCHIVED) {
10647
+ return REJECTED_ACTIONS;
10638
10648
  }
10639
10649
  return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status2];
10640
10650
  }
@@ -770,6 +770,11 @@ var FieldTypesToHideInReview = [
770
770
  FieldType.ALPHA_PRINT_BUTTON,
771
771
  FieldType.ALPHA_HIDDEN
772
772
  ];
773
+ var HiddenFieldTypes = [
774
+ FieldType.HTTP,
775
+ FieldType.QUERY_PARAM_READER,
776
+ FieldType.ALPHA_HIDDEN
777
+ ];
773
778
 
774
779
  // ../commons/src/events/FieldValue.ts
775
780
  var z12 = __toESM(require("zod/v4"));
@@ -888,7 +893,7 @@ var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date i
888
893
  // ../commons/src/events/FieldValue.ts
889
894
  var TextValue = z12.string();
890
895
  var HiddenFieldValue = z12.string();
891
- var NonEmptyTextValue = TextValue.min(1);
896
+ var NonEmptyTextValue = z12.string().trim().min(1);
892
897
  var DateValue = z12.iso.date().describe("Date in the format YYYY-MM-DD");
893
898
  var AgeValue = z12.object({
894
899
  age: z12.number(),
@@ -1750,6 +1755,7 @@ var NumberField = BaseField.extend({
1750
1755
  configuration: import_v43.default.object({
1751
1756
  min: import_v43.default.number().optional().describe("Minimum value"),
1752
1757
  max: import_v43.default.number().optional().describe("Maximum value"),
1758
+ integer: import_v43.default.boolean().optional().describe("When true, only whole numbers are allowed"),
1753
1759
  prefix: TranslationConfig.optional(),
1754
1760
  postfix: TranslationConfig.optional()
1755
1761
  }).optional()
@@ -4697,6 +4703,8 @@ var updateActions = ActionTypes.extract([
4697
4703
  ActionType.ARCHIVE,
4698
4704
  ActionType.PRINT_CERTIFICATE,
4699
4705
  ActionType.REQUEST_CORRECTION,
4706
+ ActionType.APPROVE_CORRECTION,
4707
+ ActionType.REJECT_CORRECTION,
4700
4708
  ActionType.CUSTOM
4701
4709
  ]);
4702
4710
 
@@ -7241,6 +7249,13 @@ var ACTION_FILTERS = {
7241
7249
  [ActionType.UNASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
7242
7250
  [ActionType.CUSTOM]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))
7243
7251
  };
7252
+ var REJECTED_ACTIONS = [
7253
+ ActionType.READ,
7254
+ ActionType.NOTIFY,
7255
+ ActionType.CUSTOM,
7256
+ ActionType.EDIT,
7257
+ ActionType.ARCHIVE
7258
+ ];
7244
7259
 
7245
7260
  // ../commons/src/events/FileUtils.ts
7246
7261
  var import_lodash7 = require("lodash");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "2.0.0-rc.d4ca5e7",
3
+ "version": "2.0.0-rc.d549cc4",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "bin": {