@opencrvs/toolkit 1.8.1-rc.6e305c5 → 1.8.1-rc.6eacccb

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.
@@ -341,7 +341,7 @@ var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
341
341
  var BIRTH_EVENT = "v2-birth";
342
342
 
343
343
  // ../commons/src/events/ActionConfig.ts
344
- var import_zod10 = require("zod");
344
+ var import_zod11 = require("zod");
345
345
 
346
346
  // ../commons/src/events/Conditional.ts
347
347
  var import_zod = require("zod");
@@ -1114,91 +1114,168 @@ var ActionFormConfig = import_zod9.z.object({
1114
1114
  });
1115
1115
  var FormConfig = import_zod9.z.union([DeclarationFormConfig, ActionFormConfig]);
1116
1116
 
1117
- // ../commons/src/events/ActionConfig.ts
1117
+ // ../commons/src/events/DeduplicationConfig.ts
1118
+ var import_zod10 = require("zod");
1118
1119
  var import_zod_openapi6 = require("zod-openapi");
1119
1120
  (0, import_zod_openapi6.extendZodWithOpenApi)(import_zod10.z);
1120
- var ActionConditional2 = import_zod10.z.discriminatedUnion("type", [
1121
+ var FieldReference2 = import_zod10.z.string();
1122
+ var Matcher = import_zod10.z.object({
1123
+ /**
1124
+ * The reference to the field to match against.
1125
+ *
1126
+ * For `dateDistance` type matcher the value of this field will
1127
+ * be used as the origin date to calculate the distance from.
1128
+ */
1129
+ fieldId: FieldReference2,
1130
+ options: import_zod10.z.object({
1131
+ boost: import_zod10.z.number().optional()
1132
+ }).optional().default({
1133
+ boost: 1
1134
+ })
1135
+ });
1136
+ var FuzzyMatcher = Matcher.extend({
1137
+ type: import_zod10.z.literal("fuzzy"),
1138
+ options: import_zod10.z.object({
1139
+ /**
1140
+ * Names of length 3 or less characters = 0 edits allowed
1141
+ * Names of length 4 - 6 characters = 1 edit allowed
1142
+ * Names of length >7 characters = 2 edits allowed
1143
+ */
1144
+ fuzziness: import_zod10.z.union([import_zod10.z.string(), import_zod10.z.number()]).optional().default("AUTO:4,7"),
1145
+ boost: import_zod10.z.number().optional().default(1)
1146
+ }).optional().default({
1147
+ fuzziness: "AUTO:4,7",
1148
+ boost: 1
1149
+ })
1150
+ });
1151
+ var StrictMatcher = Matcher.extend({
1152
+ type: import_zod10.z.literal("strict"),
1153
+ options: import_zod10.z.object({
1154
+ boost: import_zod10.z.number().optional().default(1)
1155
+ }).optional().default({
1156
+ boost: 1
1157
+ })
1158
+ });
1159
+ var DateDistanceMatcher = Matcher.extend({
1160
+ type: import_zod10.z.literal("dateDistance"),
1161
+ options: import_zod10.z.object({
1162
+ days: import_zod10.z.number(),
1163
+ boost: import_zod10.z.number().optional().default(1)
1164
+ })
1165
+ });
1166
+ var And = import_zod10.z.object({
1167
+ type: import_zod10.z.literal("and"),
1168
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
1169
+ clauses: import_zod10.z.lazy(() => Clause.array())
1170
+ });
1171
+ var Or = import_zod10.z.object({
1172
+ type: import_zod10.z.literal("or"),
1173
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
1174
+ clauses: import_zod10.z.lazy(() => Clause.array())
1175
+ });
1176
+ var Clause = import_zod10.z.lazy(
1177
+ () => import_zod10.z.discriminatedUnion("type", [
1178
+ And,
1179
+ Or,
1180
+ FuzzyMatcher,
1181
+ StrictMatcher,
1182
+ DateDistanceMatcher
1183
+ ])
1184
+ ).openapi({
1185
+ ref: "Clause"
1186
+ });
1187
+ var DeduplicationConfig = import_zod10.z.object({
1188
+ id: import_zod10.z.string(),
1189
+ label: TranslationConfig,
1190
+ query: Clause
1191
+ });
1192
+
1193
+ // ../commons/src/events/ActionConfig.ts
1194
+ var import_zod_openapi7 = require("zod-openapi");
1195
+ (0, import_zod_openapi7.extendZodWithOpenApi)(import_zod11.z);
1196
+ var ActionConditional2 = import_zod11.z.discriminatedUnion("type", [
1121
1197
  /** If conditional is defined, the action is shown to the user only if the condition is met */
1122
1198
  ShowConditional,
1123
1199
  /** If conditional is defined, the action is enabled only if the condition is met */
1124
1200
  EnableConditional
1125
1201
  ]);
1126
- var DeclarationReviewConfig = import_zod10.z.object({
1202
+ var DeclarationReviewConfig = import_zod11.z.object({
1127
1203
  title: TranslationConfig.describe("Title of the review page"),
1128
- fields: import_zod10.z.array(FieldConfig).describe("Fields to be rendered on the review page for annotations.")
1204
+ fields: import_zod11.z.array(FieldConfig).describe("Fields to be rendered on the review page for annotations.")
1129
1205
  }).describe("Configuration for **declaration** review page.");
1130
- var ActionConfigBase = import_zod10.z.object({
1206
+ var ActionConfigBase = import_zod11.z.object({
1131
1207
  label: TranslationConfig,
1132
- conditionals: import_zod10.z.array(ActionConditional2).optional().default([]),
1133
- draft: import_zod10.z.boolean().optional()
1208
+ conditionals: import_zod11.z.array(ActionConditional2).optional().default([]),
1209
+ deduplication: DeduplicationConfig.optional(),
1210
+ draft: import_zod11.z.boolean().optional()
1134
1211
  });
1135
1212
  var ReadActionConfig = ActionConfigBase.merge(
1136
- import_zod10.z.object({
1137
- type: import_zod10.z.literal(ActionType.READ),
1213
+ import_zod11.z.object({
1214
+ type: import_zod11.z.literal(ActionType.READ),
1138
1215
  review: DeclarationReviewConfig
1139
1216
  })
1140
1217
  );
1141
1218
  var DeclareConfig = ActionConfigBase.merge(
1142
- import_zod10.z.object({
1143
- type: import_zod10.z.literal(ActionType.DECLARE),
1219
+ import_zod11.z.object({
1220
+ type: import_zod11.z.literal(ActionType.DECLARE),
1144
1221
  review: DeclarationReviewConfig
1145
1222
  })
1146
1223
  );
1147
1224
  var ValidateConfig = ActionConfigBase.merge(
1148
- import_zod10.z.object({
1149
- type: import_zod10.z.literal(ActionType.VALIDATE),
1225
+ import_zod11.z.object({
1226
+ type: import_zod11.z.literal(ActionType.VALIDATE),
1150
1227
  review: DeclarationReviewConfig
1151
1228
  })
1152
1229
  );
1153
1230
  var RegisterConfig = ActionConfigBase.merge(
1154
- import_zod10.z.object({
1155
- type: import_zod10.z.literal(ActionType.REGISTER),
1231
+ import_zod11.z.object({
1232
+ type: import_zod11.z.literal(ActionType.REGISTER),
1156
1233
  review: DeclarationReviewConfig
1157
1234
  })
1158
1235
  );
1159
1236
  var RejectDeclarationConfig = ActionConfigBase.merge(
1160
- import_zod10.z.object({
1161
- type: import_zod10.z.literal(ActionType.REJECT)
1237
+ import_zod11.z.object({
1238
+ type: import_zod11.z.literal(ActionType.REJECT)
1162
1239
  })
1163
1240
  );
1164
1241
  var MarkedAsDuplicateConfig = ActionConfigBase.merge(
1165
- import_zod10.z.object({
1166
- type: import_zod10.z.literal(ActionType.MARKED_AS_DUPLICATE)
1242
+ import_zod11.z.object({
1243
+ type: import_zod11.z.literal(ActionType.MARKED_AS_DUPLICATE)
1167
1244
  })
1168
1245
  );
1169
1246
  var ArchiveConfig = ActionConfigBase.merge(
1170
- import_zod10.z.object({
1171
- type: import_zod10.z.literal(ActionType.ARCHIVE)
1247
+ import_zod11.z.object({
1248
+ type: import_zod11.z.literal(ActionType.ARCHIVE)
1172
1249
  })
1173
1250
  );
1174
1251
  var DeleteConfig = ActionConfigBase.merge(
1175
- import_zod10.z.object({
1176
- type: import_zod10.z.literal(ActionType.DELETE)
1252
+ import_zod11.z.object({
1253
+ type: import_zod11.z.literal(ActionType.DELETE)
1177
1254
  })
1178
1255
  );
1179
1256
  var PrintCertificateActionConfig = ActionConfigBase.merge(
1180
- import_zod10.z.object({
1181
- type: import_zod10.z.literal(ActionType.PRINT_CERTIFICATE),
1257
+ import_zod11.z.object({
1258
+ type: import_zod11.z.literal(ActionType.PRINT_CERTIFICATE),
1182
1259
  printForm: ActionFormConfig
1183
1260
  })
1184
1261
  );
1185
1262
  var RequestCorrectionConfig = ActionConfigBase.merge(
1186
- import_zod10.z.object({
1187
- type: import_zod10.z.literal(ActionType.REQUEST_CORRECTION),
1263
+ import_zod11.z.object({
1264
+ type: import_zod11.z.literal(ActionType.REQUEST_CORRECTION),
1188
1265
  correctionForm: ActionFormConfig
1189
1266
  })
1190
1267
  );
1191
1268
  var RejectCorrectionConfig = ActionConfigBase.merge(
1192
- import_zod10.z.object({
1193
- type: import_zod10.z.literal(ActionType.REJECT_CORRECTION)
1269
+ import_zod11.z.object({
1270
+ type: import_zod11.z.literal(ActionType.REJECT_CORRECTION)
1194
1271
  })
1195
1272
  );
1196
1273
  var ApproveCorrectionConfig = ActionConfigBase.merge(
1197
- import_zod10.z.object({
1198
- type: import_zod10.z.literal(ActionType.APPROVE_CORRECTION)
1274
+ import_zod11.z.object({
1275
+ type: import_zod11.z.literal(ActionType.APPROVE_CORRECTION)
1199
1276
  })
1200
1277
  );
1201
- var ActionConfig = import_zod10.z.discriminatedUnion("type", [
1278
+ var ActionConfig = import_zod11.z.discriminatedUnion("type", [
1202
1279
  /*
1203
1280
  * OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
1204
1281
  * and treat them as "models" instead of duplicating the data structure in each endpoint.
@@ -1218,125 +1295,52 @@ var ActionConfig = import_zod10.z.discriminatedUnion("type", [
1218
1295
  RejectCorrectionConfig.openapi({ ref: "RejectCorrectionActionConfig" }),
1219
1296
  ApproveCorrectionConfig.openapi({ ref: "ApproveCorrectionActionConfig" })
1220
1297
  ]).openapi({ ref: "ActionConfig" });
1221
- var DeclarationActionConfig = import_zod10.z.discriminatedUnion("type", [
1298
+ var DeclarationActionConfig = import_zod11.z.discriminatedUnion("type", [
1222
1299
  DeclareConfig,
1223
1300
  ValidateConfig,
1224
1301
  RegisterConfig
1225
1302
  ]);
1226
1303
 
1227
1304
  // ../commons/src/events/offline/CertificateConfig.ts
1228
- var import_zod11 = require("zod");
1229
- var FontFamily = import_zod11.z.object({
1230
- normal: import_zod11.z.string(),
1231
- bold: import_zod11.z.string(),
1232
- italics: import_zod11.z.string(),
1233
- bolditalics: import_zod11.z.string()
1305
+ var import_zod12 = require("zod");
1306
+ var FontFamily = import_zod12.z.object({
1307
+ normal: import_zod12.z.string(),
1308
+ bold: import_zod12.z.string(),
1309
+ italics: import_zod12.z.string(),
1310
+ bolditalics: import_zod12.z.string()
1234
1311
  });
1235
- var CertificateConfig = import_zod11.z.object({
1236
- id: import_zod11.z.string(),
1237
- event: import_zod11.z.string(),
1312
+ var CertificateConfig = import_zod12.z.object({
1313
+ id: import_zod12.z.string(),
1314
+ event: import_zod12.z.string(),
1238
1315
  label: TranslationConfig,
1239
- isDefault: import_zod11.z.boolean(),
1240
- fee: import_zod11.z.object({
1241
- onTime: import_zod11.z.number(),
1242
- late: import_zod11.z.number(),
1243
- delayed: import_zod11.z.number()
1316
+ isDefault: import_zod12.z.boolean(),
1317
+ fee: import_zod12.z.object({
1318
+ onTime: import_zod12.z.number(),
1319
+ late: import_zod12.z.number(),
1320
+ delayed: import_zod12.z.number()
1244
1321
  }),
1245
- svgUrl: import_zod11.z.string(),
1246
- fonts: import_zod11.z.record(FontFamily).optional(),
1247
- conditionals: import_zod11.z.array(ShowConditional).optional()
1322
+ svgUrl: import_zod12.z.string(),
1323
+ fonts: import_zod12.z.record(FontFamily).optional(),
1324
+ conditionals: import_zod12.z.array(ShowConditional).optional()
1248
1325
  });
1249
1326
  var CertificateTemplateConfig = CertificateConfig.extend({
1250
- hash: import_zod11.z.string().optional(),
1251
- svg: import_zod11.z.string()
1327
+ hash: import_zod12.z.string().optional(),
1328
+ svg: import_zod12.z.string()
1252
1329
  });
1253
1330
 
1254
1331
  // ../commons/src/events/offline/LanguageConfig.ts
1255
- var import_zod12 = require("zod");
1256
- var LanguageConfig = import_zod12.z.object({
1257
- lang: import_zod12.z.string(),
1332
+ var import_zod13 = require("zod");
1333
+ var LanguageConfig = import_zod13.z.object({
1334
+ lang: import_zod13.z.string(),
1258
1335
  /**
1259
1336
  * client.csv contents
1260
1337
  */
1261
- messages: import_zod12.z.record(import_zod12.z.string())
1338
+ messages: import_zod13.z.record(import_zod13.z.string())
1262
1339
  });
1263
1340
 
1264
1341
  // ../commons/src/events/EventConfig.ts
1265
1342
  var import_zod21 = require("zod");
1266
1343
 
1267
- // ../commons/src/events/DeduplicationConfig.ts
1268
- var import_zod13 = require("zod");
1269
- var import_zod_openapi7 = require("zod-openapi");
1270
- (0, import_zod_openapi7.extendZodWithOpenApi)(import_zod13.z);
1271
- var FieldReference2 = import_zod13.z.string();
1272
- var Matcher = import_zod13.z.object({
1273
- fieldId: import_zod13.z.string(),
1274
- options: import_zod13.z.object({
1275
- boost: import_zod13.z.number().optional()
1276
- }).optional().default({})
1277
- });
1278
- var FuzzyMatcher = Matcher.extend({
1279
- type: import_zod13.z.literal("fuzzy"),
1280
- options: import_zod13.z.object({
1281
- /**
1282
- * Names of length 3 or less characters = 0 edits allowed
1283
- * Names of length 4 - 6 characters = 1 edit allowed
1284
- * Names of length >7 characters = 2 edits allowed
1285
- */
1286
- fuzziness: import_zod13.z.union([import_zod13.z.string(), import_zod13.z.number()]).optional().default("AUTO:4,7"),
1287
- boost: import_zod13.z.number().optional().default(1)
1288
- }).optional().default({})
1289
- });
1290
- var StrictMatcher = Matcher.extend({
1291
- type: import_zod13.z.literal("strict"),
1292
- options: import_zod13.z.object({
1293
- boost: import_zod13.z.number().optional().default(1)
1294
- }).optional().default({})
1295
- });
1296
- var DateRangeMatcher = Matcher.extend({
1297
- type: import_zod13.z.literal("dateRange"),
1298
- options: import_zod13.z.object({
1299
- days: import_zod13.z.number(),
1300
- origin: FieldReference2,
1301
- boost: import_zod13.z.number().optional().default(1)
1302
- })
1303
- });
1304
- var DateDistanceMatcher = Matcher.extend({
1305
- type: import_zod13.z.literal("dateDistance"),
1306
- options: import_zod13.z.object({
1307
- days: import_zod13.z.number(),
1308
- origin: FieldReference2,
1309
- boost: import_zod13.z.number().optional().default(1)
1310
- })
1311
- });
1312
- var And = import_zod13.z.object({
1313
- type: import_zod13.z.literal("and"),
1314
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
1315
- clauses: import_zod13.z.lazy(() => Clause.array())
1316
- });
1317
- var Or = import_zod13.z.object({
1318
- type: import_zod13.z.literal("or"),
1319
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
1320
- clauses: import_zod13.z.lazy(() => Clause.array())
1321
- });
1322
- var Clause = import_zod13.z.lazy(
1323
- () => import_zod13.z.discriminatedUnion("type", [
1324
- And,
1325
- Or,
1326
- FuzzyMatcher,
1327
- StrictMatcher,
1328
- DateRangeMatcher,
1329
- DateDistanceMatcher
1330
- ])
1331
- ).openapi({
1332
- ref: "Clause"
1333
- });
1334
- var DeduplicationConfig = import_zod13.z.object({
1335
- id: import_zod13.z.string(),
1336
- label: TranslationConfig,
1337
- query: Clause
1338
- });
1339
-
1340
1344
  // ../commons/src/events/SummaryConfig.ts
1341
1345
  var import_zod14 = require("zod");
1342
1346
  var BaseField2 = import_zod14.z.object({
@@ -2806,7 +2810,6 @@ var EventConfig = import_zod21.z.object({
2806
2810
  label: TranslationConfig,
2807
2811
  actions: import_zod21.z.array(ActionConfig),
2808
2812
  declaration: DeclarationFormConfig,
2809
- deduplication: import_zod21.z.array(DeduplicationConfig).optional().default([]),
2810
2813
  advancedSearch: import_zod21.z.array(AdvancedSearchConfig).optional().default([])
2811
2814
  }).superRefine((event2, ctx) => {
2812
2815
  const allFields = findAllFields(event2);
@@ -4258,9 +4261,6 @@ function isPendingCertification(actions) {
4258
4261
  if (type === ActionType.PRINT_CERTIFICATE) {
4259
4262
  return false;
4260
4263
  }
4261
- if (type === ActionType.REQUEST_CORRECTION) {
4262
- return false;
4263
- }
4264
4264
  if (type === ActionType.APPROVE_CORRECTION) {
4265
4265
  return true;
4266
4266
  }
@@ -6447,33 +6447,24 @@ var child = defineFormPage({
6447
6447
  },
6448
6448
  fields: [
6449
6449
  {
6450
- id: "child.firstNames",
6451
- type: FieldType.TEXT,
6452
- required: true,
6453
- configuration: { maxLength: 32 },
6454
- hideLabel: true,
6455
- label: {
6456
- defaultMessage: "Child's first name",
6457
- description: "This is the label for the field",
6458
- id: "v2.event.birth.action.declare.form.section.child.field.name.label"
6459
- }
6460
- },
6461
- {
6462
- id: "child.familyName",
6463
- type: FieldType.TEXT,
6450
+ id: "child.name",
6451
+ type: FieldType.NAME,
6464
6452
  required: true,
6465
6453
  configuration: { maxLength: 32 },
6466
6454
  hideLabel: true,
6467
6455
  label: {
6468
- defaultMessage: "Child's last name",
6456
+ defaultMessage: "Child's name",
6469
6457
  description: "This is the label for the field",
6470
6458
  id: "v2.event.birth.action.declare.form.section.child.field.name.label"
6471
- }
6459
+ },
6460
+ validation: []
6472
6461
  },
6473
6462
  {
6474
- id: "child.DoB",
6463
+ id: "child.dob",
6475
6464
  type: "DATE",
6476
6465
  required: true,
6466
+ secured: true,
6467
+ validation: [],
6477
6468
  label: {
6478
6469
  defaultMessage: "Date of birth",
6479
6470
  description: "This is the label for the field",
@@ -6492,46 +6483,43 @@ var mother = defineFormPage({
6492
6483
  },
6493
6484
  fields: [
6494
6485
  {
6495
- id: "mother.firstNames",
6496
- configuration: { maxLength: 32 },
6497
- type: FieldType.TEXT,
6486
+ id: "mother.name",
6487
+ type: FieldType.NAME,
6498
6488
  required: true,
6499
- label: {
6500
- defaultMessage: "First name(s)",
6501
- description: "This is the label for the field",
6502
- id: `v2.event.birth.action.declare.form.section.person.field.firstname.label`
6503
- }
6504
- },
6505
- {
6506
- id: `mother.familyName`,
6507
6489
  configuration: { maxLength: 32 },
6508
- type: FieldType.TEXT,
6509
- required: true,
6490
+ hideLabel: true,
6510
6491
  label: {
6511
- defaultMessage: "Last name",
6492
+ defaultMessage: "Mother's name",
6512
6493
  description: "This is the label for the field",
6513
- id: `v2.event.birth.action.declare.form.section.person.field.surname.label`
6514
- }
6494
+ id: "v2.event.birth.action.declare.form.section.mother.field.name.label"
6495
+ },
6496
+ conditionals: [],
6497
+ validation: []
6515
6498
  },
6516
6499
  {
6517
- id: `mother.DoB`,
6500
+ id: "mother.dob",
6518
6501
  type: "DATE",
6519
6502
  required: true,
6503
+ secured: true,
6504
+ validation: [],
6520
6505
  label: {
6521
6506
  defaultMessage: "Date of birth",
6522
6507
  description: "This is the label for the field",
6523
- id: `v2.event.birth.action.declare.form.section.person.field.dob.label`
6524
- }
6508
+ id: "v2.event.birth.action.declare.form.section.person.field.dob.label"
6509
+ },
6510
+ conditionals: []
6525
6511
  },
6526
6512
  {
6527
- id: "mother.identifier",
6513
+ id: "mother.nid",
6528
6514
  type: FieldType.ID,
6529
6515
  required: true,
6530
6516
  label: {
6531
6517
  defaultMessage: "ID Number",
6532
6518
  description: "This is the label for the field",
6533
- id: `v2.event.birth.action.declare.form.section.person.field.nid.label`
6534
- }
6519
+ id: "v2.event.birth.action.declare.form.section.person.field.nid.label"
6520
+ },
6521
+ conditionals: [],
6522
+ validation: []
6535
6523
  }
6536
6524
  ]
6537
6525
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "1.8.1-rc.6e305c5",
3
+ "version": "1.8.1-rc.6eacccb",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "exports": {