@opencrvs/toolkit 1.9.2-rc.e90dda1 → 1.9.2-rc.ebb7011

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 (32) hide show
  1. package/dist/commons/api/router.d.ts +958 -609
  2. package/dist/commons/events/ActionConfig.d.ts +440 -13
  3. package/dist/commons/events/ActionDocument.d.ts +90 -167
  4. package/dist/commons/events/ActionInput.d.ts +72 -98
  5. package/dist/commons/events/ActionType.d.ts +1 -7
  6. package/dist/commons/events/AdvancedSearchConfig.d.ts +7 -2
  7. package/dist/commons/events/CompositeFieldValue.d.ts +2 -0
  8. package/dist/commons/events/CountryConfigQueryInput.d.ts +0 -12
  9. package/dist/commons/events/Draft.d.ts +4 -6
  10. package/dist/commons/events/EventConfig.d.ts +354 -8
  11. package/dist/commons/events/EventDocument.d.ts +36 -61
  12. package/dist/commons/events/EventIndex.d.ts +1 -6
  13. package/dist/commons/events/EventMetadata.d.ts +0 -1
  14. package/dist/commons/events/FieldConfig.d.ts +90 -0
  15. package/dist/commons/events/FieldType.d.ts +2 -1
  16. package/dist/commons/events/FieldTypeMapping.d.ts +13 -6
  17. package/dist/commons/events/FieldValue.d.ts +5 -5
  18. package/dist/commons/events/Flag.d.ts +0 -3
  19. package/dist/commons/events/FormConfig.d.ts +264 -0
  20. package/dist/commons/events/PageConfig.d.ts +176 -0
  21. package/dist/commons/events/WorkqueueConfig.d.ts +2 -16
  22. package/dist/commons/events/defineConfig.d.ts +514 -2
  23. package/dist/commons/events/scopes.d.ts +0 -1
  24. package/dist/commons/events/state/index.d.ts +1 -1
  25. package/dist/commons/events/state/utils.d.ts +37 -54
  26. package/dist/commons/events/test.utils.d.ts +9 -17
  27. package/dist/commons/events/utils.d.ts +1996 -1095
  28. package/dist/events/index.js +57 -85
  29. package/dist/notification/index.js +18 -34
  30. package/dist/scopes/index.d.ts +2 -6
  31. package/dist/scopes/index.js +0 -1
  32. package/package.json +1 -1
@@ -75,6 +75,7 @@ __export(events_exports, {
75
75
  ConfirmableActions: () => ConfirmableActions,
76
76
  ContainsFlags: () => ContainsFlags,
77
77
  CustomActionInput: () => CustomActionInput,
78
+ CustomFieldValue: () => CustomFieldValue,
78
79
  CustomFlag: () => CustomFlag,
79
80
  DEFAULT_DATE_OF_EVENT_PROPERTY: () => DEFAULT_DATE_OF_EVENT_PROPERTY,
80
81
  DataEntry: () => DataEntry,
@@ -99,7 +100,6 @@ __export(events_exports, {
99
100
  DraftInput: () => DraftInput,
100
101
  DuplicateDetectedAction: () => DuplicateDetectedAction,
101
102
  DuplicateDetectedActionInput: () => DuplicateDetectedActionInput,
102
- EditActionInput: () => EditActionInput,
103
103
  EmailField: () => EmailField,
104
104
  EmailValue: () => EmailValue,
105
105
  EnableConditional: () => EnableConditional,
@@ -318,6 +318,7 @@ __export(events_exports, {
318
318
  isCheckboxFieldType: () => isCheckboxFieldType,
319
319
  isConditionMet: () => isConditionMet,
320
320
  isCountryFieldType: () => isCountryFieldType,
321
+ isCustomFieldType: () => isCustomFieldType,
321
322
  isDataFieldType: () => isDataFieldType,
322
323
  isDateFieldType: () => isDateFieldType,
323
324
  isDateRangeFieldType: () => isDateRangeFieldType,
@@ -425,7 +426,6 @@ var ActionType = {
425
426
  DECLARE: "DECLARE",
426
427
  VALIDATE: "VALIDATE",
427
428
  REGISTER: "REGISTER",
428
- EDIT: "EDIT",
429
429
  // Declaration system actions. Non-configurable.
430
430
  DUPLICATE_DETECTED: "DUPLICATE_DETECTED",
431
431
  REJECT: "REJECT",
@@ -448,7 +448,6 @@ var ActionType = {
448
448
  var ConfirmableActions = [
449
449
  ActionType.NOTIFY,
450
450
  ActionType.DECLARE,
451
- ActionType.EDIT,
452
451
  ActionType.VALIDATE,
453
452
  ActionType.REGISTER,
454
453
  ActionType.REJECT,
@@ -464,7 +463,6 @@ var ActionTypes = z2.enum([
464
463
  "CREATE",
465
464
  "NOTIFY",
466
465
  "DECLARE",
467
- "EDIT",
468
466
  "VALIDATE",
469
467
  "REGISTER",
470
468
  "DUPLICATE_DETECTED",
@@ -486,7 +484,6 @@ var ClientSpecificAction = {
486
484
  };
487
485
  var declarationActionValues = [
488
486
  ActionTypes.enum.DECLARE,
489
- ActionTypes.enum.EDIT,
490
487
  ActionTypes.enum.VALIDATE,
491
488
  ActionTypes.enum.REGISTER,
492
489
  ActionTypes.enum.NOTIFY,
@@ -619,7 +616,8 @@ var FieldType = {
619
616
  QUERY_PARAM_READER: "QUERY_PARAM_READER",
620
617
  QR_READER: "QR_READER",
621
618
  ID_READER: "ID_READER",
622
- LOADER: "LOADER"
619
+ LOADER: "LOADER",
620
+ CUSTOM: "CUSTOM"
623
621
  };
624
622
  var FileFieldType = z4.enum([
625
623
  FieldType.FILE,
@@ -750,6 +748,7 @@ var ReadDataValue = z6.object({
750
748
  });
751
749
  var QrReaderFieldValue = ReadDataValue;
752
750
  var IdReaderFieldValue = ReadDataValue;
751
+ var CustomFieldValue = z6.unknown();
753
752
 
754
753
  // ../commons/src/events/FieldValue.ts
755
754
  var TextValue = z7.string();
@@ -804,7 +803,8 @@ var FieldValuesWithoutDataField = z7.union([
804
803
  VerificationStatusValue,
805
804
  QueryParamReaderFieldValue,
806
805
  QrReaderFieldValue,
807
- IdReaderFieldValue
806
+ IdReaderFieldValue,
807
+ CustomFieldValue
808
808
  ]);
809
809
  var DataFieldValue = z7.object({
810
810
  data: z7.record(z7.string(), FieldValuesWithoutDataField)
@@ -878,7 +878,8 @@ var FieldUpdateValue = safeUnion([
878
878
  DataFieldValue.describe("DataFieldValue"),
879
879
  NameFieldUpdateValue.describe("NameFieldUpdateValue"),
880
880
  HttpFieldUpdateValue.describe("HttpFieldUpdateValue"),
881
- QueryParamReaderFieldUpdateValue.describe("QueryParamReaderFieldUpdateValue")
881
+ QueryParamReaderFieldUpdateValue.describe("QueryParamReaderFieldUpdateValue"),
882
+ CustomFieldValue.describe("CustomFieldValue")
882
883
  ]);
883
884
 
884
885
  // ../commons/src/uuid.ts
@@ -1139,7 +1140,6 @@ var RecordScopeType = z10.enum([
1139
1140
  "record.read",
1140
1141
  "record.declare",
1141
1142
  "record.notify",
1142
- "record.declared.edit",
1143
1143
  "record.declared.validate",
1144
1144
  "record.declared.reject",
1145
1145
  "record.declared.archive",
@@ -1497,14 +1497,6 @@ var NotifiedAction = ActionBase.extend(
1497
1497
  type: z12.literal(ActionType.NOTIFY)
1498
1498
  }).shape
1499
1499
  );
1500
- var EditAction = ActionBase.extend(
1501
- z12.object({
1502
- type: z12.literal(ActionType.EDIT),
1503
- content: z12.object({
1504
- comment: z12.string().describe("Comment for the edit action.").optional()
1505
- })
1506
- }).shape
1507
- );
1508
1500
  var PrintContent = z12.object({
1509
1501
  templateId: z12.string().optional()
1510
1502
  });
@@ -1563,7 +1555,6 @@ var ActionDocument = z12.discriminatedUnion("type", [
1563
1555
  UnassignedAction.meta({ id: "UnassignedAction" }),
1564
1556
  PrintCertificateAction.meta({ id: "PrintCertificateAction" }),
1565
1557
  ReadAction.meta({ id: "ReadAction" }),
1566
- EditAction.meta({ id: "EditAction" }),
1567
1558
  CustomAction.meta({ id: "CustomAction" })
1568
1559
  ]).meta({
1569
1560
  id: "ActionDocument"
@@ -1586,8 +1577,7 @@ var InherentFlags = {
1586
1577
  INCOMPLETE: "incomplete",
1587
1578
  REJECTED: "rejected",
1588
1579
  CORRECTION_REQUESTED: "correction-requested",
1589
- POTENTIAL_DUPLICATE: "potential-duplicate",
1590
- EDIT_IN_PROGRESS: "edit-in-progress"
1580
+ POTENTIAL_DUPLICATE: "potential-duplicate"
1591
1581
  };
1592
1582
  var ActionFlag = z13.string().regex(
1593
1583
  new RegExp(
@@ -2453,6 +2443,12 @@ var IdReaderField = BaseField.extend({
2453
2443
  z16.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
2454
2444
  )
2455
2445
  });
2446
+ var CustomField = BaseField.extend({
2447
+ type: z16.literal(FieldType.CUSTOM),
2448
+ defaultValue: CustomFieldValue.optional(),
2449
+ src: z16.string().describe("Module source path for the custom field component"),
2450
+ configuration: z16.unknown().optional()
2451
+ });
2456
2452
  var LoaderField = BaseField.extend({
2457
2453
  type: z16.literal(FieldType.LOADER),
2458
2454
  configuration: z16.object({
@@ -2500,7 +2496,8 @@ var FieldConfig = z16.discriminatedUnion("type", [
2500
2496
  IdReaderField,
2501
2497
  QueryParamReaderField,
2502
2498
  LoaderField,
2503
- SearchField
2499
+ SearchField,
2500
+ CustomField
2504
2501
  ]).meta({
2505
2502
  description: "Form field configuration",
2506
2503
  id: "FieldConfig"
@@ -3175,6 +3172,9 @@ function mapFieldTypeToZod(field3, actionType) {
3175
3172
  case FieldType.ID_READER:
3176
3173
  schema = IdReaderFieldValue;
3177
3174
  break;
3175
+ case FieldType.CUSTOM:
3176
+ schema = CustomFieldValue;
3177
+ break;
3178
3178
  }
3179
3179
  return field3.required ? schema : schema.nullish();
3180
3180
  }
@@ -3232,6 +3232,8 @@ function mapFieldTypeToEmptyValue(field3) {
3232
3232
  };
3233
3233
  case FieldType.FILE_WITH_OPTIONS:
3234
3234
  return [];
3235
+ case FieldType.CUSTOM:
3236
+ return void 0;
3235
3237
  }
3236
3238
  }
3237
3239
  var isParagraphFieldType = (field3) => {
@@ -3351,6 +3353,9 @@ var isIdReaderFieldType = (field3) => {
3351
3353
  var isLoaderFieldType = (field3) => {
3352
3354
  return field3.config.type === FieldType.LOADER;
3353
3355
  };
3356
+ var isCustomFieldType = (field3) => {
3357
+ return field3.config.type === FieldType.CUSTOM;
3358
+ };
3354
3359
  var isNonInteractiveFieldType = (field3) => {
3355
3360
  return field3.type === FieldType.DIVIDER || field3.type === FieldType.PAGE_HEADER || field3.type === FieldType.PARAGRAPH || 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;
3356
3361
  };
@@ -3795,7 +3800,7 @@ function getActionConfig({
3795
3800
  if (a.type === ActionType.CUSTOM && customActionType) {
3796
3801
  return a.customActionType === customActionType;
3797
3802
  }
3798
- if (actionType === ActionType.NOTIFY || actionType === ActionType.EDIT) {
3803
+ if (actionType === ActionType.NOTIFY) {
3799
3804
  return a.type === ActionType.DECLARE;
3800
3805
  }
3801
3806
  if (actionType === ActionType.APPROVE_CORRECTION || actionType === ActionType.REJECT_CORRECTION) {
@@ -3857,13 +3862,9 @@ var findRecordActionPages = (config, actionType) => {
3857
3862
  return [];
3858
3863
  };
3859
3864
  function getActionReview(configuration, actionType) {
3860
- const actionConfig = getActionConfig({
3861
- eventConfiguration: configuration,
3862
- actionType
3863
- });
3864
- if (!actionConfig) {
3865
- throw "Tried to get action review for an action that is not a declaration action";
3866
- }
3865
+ const [actionConfig] = configuration.actions.filter(
3866
+ (a) => a.type === actionType
3867
+ );
3867
3868
  if ("review" in actionConfig) {
3868
3869
  return actionConfig.review;
3869
3870
  }
@@ -5180,14 +5181,6 @@ var DeclareActionInput = BaseActionInput.extend(
5180
5181
  type: z33.literal(ActionType.DECLARE).default(ActionType.DECLARE)
5181
5182
  }).shape
5182
5183
  );
5183
- var EditActionInput = BaseActionInput.extend(
5184
- z33.object({
5185
- type: z33.literal(ActionType.EDIT).default(ActionType.EDIT),
5186
- content: z33.object({
5187
- comment: z33.string().describe("Comment for the edit action.").optional()
5188
- })
5189
- }).shape
5190
- );
5191
5184
  var PrintCertificateActionInput = BaseActionInput.extend(
5192
5185
  z33.object({
5193
5186
  type: z33.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
@@ -5299,8 +5292,7 @@ var ActionInput = z33.discriminatedUnion("type", [
5299
5292
  id: "ApproveCorrectionActionInput"
5300
5293
  }),
5301
5294
  ReadActionInput.meta({ id: "ReadActionInput" }),
5302
- CustomActionInput.meta({ id: "CustomActionInput" }),
5303
- EditActionInput.meta({ id: "EditActionInput" })
5295
+ CustomActionInput.meta({ id: "CustomActionInput" })
5304
5296
  ]).meta({
5305
5297
  id: "ActionInput"
5306
5298
  });
@@ -5443,9 +5435,6 @@ function getLegalStatuses(actions) {
5443
5435
  // ../commons/src/events/state/flags.ts
5444
5436
  var import_lodash3 = require("lodash");
5445
5437
  var import_date_fns3 = require("date-fns");
5446
- function isEditInProgress(actions) {
5447
- return actions.at(-1)?.type === ActionType.EDIT;
5448
- }
5449
5438
  function isPendingCertification(actions) {
5450
5439
  if (getStatusFromActions(actions) !== EventStatus.enum.REGISTERED) {
5451
5440
  return false;
@@ -5508,14 +5497,8 @@ function isFlagConditionMet(conditional, form, action) {
5508
5497
  });
5509
5498
  }
5510
5499
  function resolveEventCustomFlags(event2, eventConfiguration) {
5511
- const sortedActions = getAcceptedActions(event2).filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
5512
- const declareIndexes = sortedActions.map((a, i) => a.type === ActionType.DECLARE ? i : -1).filter((i) => i !== -1);
5513
- let actions = sortedActions;
5514
- if (declareIndexes.length >= 2) {
5515
- const secondLast = declareIndexes[declareIndexes.length - 2];
5516
- const last = declareIndexes[declareIndexes.length - 1];
5517
- actions = sortedActions.filter((_, idx) => idx < secondLast || idx >= last);
5518
- }
5500
+ const acceptedActions = getAcceptedActions(event2);
5501
+ const actions = acceptedActions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
5519
5502
  return actions.reduce((acc, action, idx) => {
5520
5503
  let actionConfig;
5521
5504
  if (isActionConfigType(action.type)) {
@@ -5577,9 +5560,6 @@ function getEventFlags(event2, config) {
5577
5560
  if (isPotentialDuplicate(sortedActions)) {
5578
5561
  flags.push(InherentFlags.POTENTIAL_DUPLICATE);
5579
5562
  }
5580
- if (isEditInProgress(sortedActions)) {
5581
- flags.push(InherentFlags.EDIT_IN_PROGRESS);
5582
- }
5583
5563
  return [...flags, ...resolveEventCustomFlags(event2, config)];
5584
5564
  }
5585
5565
 
@@ -5609,8 +5589,8 @@ function getStatusFromActions(actions) {
5609
5589
  case ActionType.MARK_AS_DUPLICATE:
5610
5590
  case ActionType.REJECT_CORRECTION:
5611
5591
  case ActionType.READ:
5592
+ case ActionType.CUSTOM:
5612
5593
  case ActionType.VALIDATE:
5613
- case ActionType.EDIT:
5614
5594
  default:
5615
5595
  return status2;
5616
5596
  }
@@ -8122,6 +8102,7 @@ function mapFieldTypeToMockValue(field3, i, rng) {
8122
8102
  };
8123
8103
  case FieldType.FILE_WITH_OPTIONS:
8124
8104
  case FieldType.DATA:
8105
+ case FieldType.CUSTOM:
8125
8106
  return void 0;
8126
8107
  case FieldType.QR_READER:
8127
8108
  return /* @__PURE__ */ Object.create(null);
@@ -8286,14 +8267,6 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
8286
8267
  keepAssignment: input.keepAssignment
8287
8268
  };
8288
8269
  },
8289
- edit: (eventId, input = {}) => ({
8290
- type: ActionType.EDIT,
8291
- transactionId: input.transactionId ?? getUUID(),
8292
- declaration: input.declaration ?? generateActionDeclarationInput(configuration, ActionType.EDIT, rng),
8293
- annotation: input.annotation ?? generateActionAnnotationInput(configuration, ActionType.EDIT, rng),
8294
- eventId,
8295
- ...input
8296
- }),
8297
8270
  validate: (eventId, input = {}) => ({
8298
8271
  type: ActionType.VALIDATE,
8299
8272
  transactionId: input.transactionId ?? getUUID(),
@@ -8485,30 +8458,22 @@ function generateActionDocument({
8485
8458
  ...defaults
8486
8459
  };
8487
8460
  switch (action) {
8488
- case ActionType.READ:
8489
- case ActionType.MARK_AS_NOT_DUPLICATE:
8490
- case ActionType.DECLARE:
8491
- case ActionType.UNASSIGN:
8492
- case ActionType.CREATE:
8493
- case ActionType.NOTIFY:
8494
- case ActionType.VALIDATE:
8495
- case ActionType.REGISTER:
8496
- case ActionType.REQUEST_CORRECTION:
8497
- return { ...actionBase, type: action };
8498
- case ActionType.EDIT:
8499
- return {
8500
- ...actionBase,
8501
- type: action,
8502
- content: { comment: "Test comment" }
8503
- };
8504
8461
  case ActionType.CUSTOM:
8505
8462
  return {
8506
8463
  ...actionBase,
8507
8464
  type: action,
8508
8465
  customActionType: "CUSTOM_ACTION_TYPE"
8509
8466
  };
8467
+ case ActionType.READ:
8468
+ return { ...actionBase, type: action };
8469
+ case ActionType.MARK_AS_NOT_DUPLICATE:
8470
+ return { ...actionBase, type: action };
8510
8471
  case ActionType.MARK_AS_DUPLICATE:
8511
8472
  return { ...actionBase, type: action, content: void 0 };
8473
+ case ActionType.DECLARE:
8474
+ return { ...actionBase, type: action };
8475
+ case ActionType.UNASSIGN:
8476
+ return { ...actionBase, type: action };
8512
8477
  case ActionType.ASSIGN: {
8513
8478
  const assignActionDefaults = defaults;
8514
8479
  return {
@@ -8517,10 +8482,16 @@ function generateActionDocument({
8517
8482
  type: action
8518
8483
  };
8519
8484
  }
8485
+ case ActionType.VALIDATE:
8486
+ return { ...actionBase, type: action };
8520
8487
  case ActionType.ARCHIVE:
8521
8488
  return { ...actionBase, type: action, content: { reason: "Archive" } };
8522
8489
  case ActionType.REJECT:
8523
8490
  return { ...actionBase, type: action, content: { reason: "Reject" } };
8491
+ case ActionType.CREATE:
8492
+ return { ...actionBase, type: action };
8493
+ case ActionType.NOTIFY:
8494
+ return { ...actionBase, type: action };
8524
8495
  case ActionType.PRINT_CERTIFICATE: {
8525
8496
  const printActionDefaults = defaults;
8526
8497
  return {
@@ -8529,6 +8500,8 @@ function generateActionDocument({
8529
8500
  content: printActionDefaults?.content
8530
8501
  };
8531
8502
  }
8503
+ case ActionType.REQUEST_CORRECTION:
8504
+ return { ...actionBase, type: action };
8532
8505
  case ActionType.APPROVE_CORRECTION:
8533
8506
  return { ...actionBase, requestId: getUUID(), type: action };
8534
8507
  case ActionType.REJECT_CORRECTION:
@@ -8538,6 +8511,11 @@ function generateActionDocument({
8538
8511
  type: action,
8539
8512
  content: { reason: "Correction rejection" }
8540
8513
  };
8514
+ case ActionType.REGISTER:
8515
+ return {
8516
+ ...actionBase,
8517
+ type: action
8518
+ };
8541
8519
  case ActionType.DUPLICATE_DETECTED: {
8542
8520
  const duplicateActionDefaults = defaults;
8543
8521
  return {
@@ -8763,7 +8741,6 @@ var ACTION_SCOPE_MAP = {
8763
8741
  "record.declared.validate",
8764
8742
  "record.register"
8765
8743
  ],
8766
- [ActionType.EDIT]: ["record.declared.edit"],
8767
8744
  [ActionType.DELETE]: ["record.declare"],
8768
8745
  [ActionType.VALIDATE]: ["record.declared.validate", "record.register"],
8769
8746
  [ActionType.REGISTER]: ["record.register"],
@@ -8904,8 +8881,7 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
8904
8881
  ActionType.MARK_AS_DUPLICATE,
8905
8882
  ActionType.ARCHIVE,
8906
8883
  ActionType.REJECT,
8907
- ActionType.CUSTOM,
8908
- ActionType.EDIT
8884
+ ActionType.CUSTOM
8909
8885
  ],
8910
8886
  [EventStatus.enum.REGISTERED]: [
8911
8887
  ActionType.READ,
@@ -8931,7 +8907,6 @@ var ACTION_FILTERS = {
8931
8907
  [ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8932
8908
  [ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
8933
8909
  [ActionType.VALIDATE]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
8934
- [ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
8935
8910
  [ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
8936
8911
  [ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8937
8912
  [ActionType.ARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested"))
@@ -8960,9 +8935,6 @@ function getAvailableActionsWithoutFlagFilters(status2, flags) {
8960
8935
  flags.filter((flag2) => flag2 !== InherentFlags.REJECTED)
8961
8936
  ).filter((action) => action !== ActionType.DELETE).concat(ActionType.ARCHIVE);
8962
8937
  }
8963
- if (flags.includes(InherentFlags.EDIT_IN_PROGRESS)) {
8964
- return [ActionType.DECLARE, ActionType.REGISTER];
8965
- }
8966
8938
  return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status2];
8967
8939
  }
8968
8940
  case EventStatus.enum.REGISTERED: {
@@ -79,7 +79,6 @@ var ActionType = {
79
79
  DECLARE: "DECLARE",
80
80
  VALIDATE: "VALIDATE",
81
81
  REGISTER: "REGISTER",
82
- EDIT: "EDIT",
83
82
  // Declaration system actions. Non-configurable.
84
83
  DUPLICATE_DETECTED: "DUPLICATE_DETECTED",
85
84
  REJECT: "REJECT",
@@ -102,7 +101,6 @@ var ActionType = {
102
101
  var ConfirmableActions = [
103
102
  ActionType.NOTIFY,
104
103
  ActionType.DECLARE,
105
- ActionType.EDIT,
106
104
  ActionType.VALIDATE,
107
105
  ActionType.REGISTER,
108
106
  ActionType.REJECT,
@@ -118,7 +116,6 @@ var ActionTypes = z2.enum([
118
116
  "CREATE",
119
117
  "NOTIFY",
120
118
  "DECLARE",
121
- "EDIT",
122
119
  "VALIDATE",
123
120
  "REGISTER",
124
121
  "DUPLICATE_DETECTED",
@@ -140,7 +137,6 @@ var ClientSpecificAction = {
140
137
  };
141
138
  var declarationActionValues = [
142
139
  ActionTypes.enum.DECLARE,
143
- ActionTypes.enum.EDIT,
144
140
  ActionTypes.enum.VALIDATE,
145
141
  ActionTypes.enum.REGISTER,
146
142
  ActionTypes.enum.NOTIFY,
@@ -270,7 +266,8 @@ var FieldType = {
270
266
  QUERY_PARAM_READER: "QUERY_PARAM_READER",
271
267
  QR_READER: "QR_READER",
272
268
  ID_READER: "ID_READER",
273
- LOADER: "LOADER"
269
+ LOADER: "LOADER",
270
+ CUSTOM: "CUSTOM"
274
271
  };
275
272
  var FileFieldType = z4.enum([
276
273
  FieldType.FILE,
@@ -397,6 +394,7 @@ var ReadDataValue = z6.object({
397
394
  });
398
395
  var QrReaderFieldValue = ReadDataValue;
399
396
  var IdReaderFieldValue = ReadDataValue;
397
+ var CustomFieldValue = z6.unknown();
400
398
 
401
399
  // ../commons/src/events/FieldValue.ts
402
400
  var TextValue = z7.string();
@@ -451,7 +449,8 @@ var FieldValuesWithoutDataField = z7.union([
451
449
  VerificationStatusValue,
452
450
  QueryParamReaderFieldValue,
453
451
  QrReaderFieldValue,
454
- IdReaderFieldValue
452
+ IdReaderFieldValue,
453
+ CustomFieldValue
455
454
  ]);
456
455
  var DataFieldValue = z7.object({
457
456
  data: z7.record(z7.string(), FieldValuesWithoutDataField)
@@ -525,7 +524,8 @@ var FieldUpdateValue = safeUnion([
525
524
  DataFieldValue.describe("DataFieldValue"),
526
525
  NameFieldUpdateValue.describe("NameFieldUpdateValue"),
527
526
  HttpFieldUpdateValue.describe("HttpFieldUpdateValue"),
528
- QueryParamReaderFieldUpdateValue.describe("QueryParamReaderFieldUpdateValue")
527
+ QueryParamReaderFieldUpdateValue.describe("QueryParamReaderFieldUpdateValue"),
528
+ CustomFieldValue.describe("CustomFieldValue")
529
529
  ]);
530
530
 
531
531
  // ../commons/src/uuid.ts
@@ -786,7 +786,6 @@ var RecordScopeType = z10.enum([
786
786
  "record.read",
787
787
  "record.declare",
788
788
  "record.notify",
789
- "record.declared.edit",
790
789
  "record.declared.validate",
791
790
  "record.declared.reject",
792
791
  "record.declared.archive",
@@ -1090,14 +1089,6 @@ var NotifiedAction = ActionBase.extend(
1090
1089
  type: z12.literal(ActionType.NOTIFY)
1091
1090
  }).shape
1092
1091
  );
1093
- var EditAction = ActionBase.extend(
1094
- z12.object({
1095
- type: z12.literal(ActionType.EDIT),
1096
- content: z12.object({
1097
- comment: z12.string().describe("Comment for the edit action.").optional()
1098
- })
1099
- }).shape
1100
- );
1101
1092
  var PrintContent = z12.object({
1102
1093
  templateId: z12.string().optional()
1103
1094
  });
@@ -1156,7 +1147,6 @@ var ActionDocument = z12.discriminatedUnion("type", [
1156
1147
  UnassignedAction.meta({ id: "UnassignedAction" }),
1157
1148
  PrintCertificateAction.meta({ id: "PrintCertificateAction" }),
1158
1149
  ReadAction.meta({ id: "ReadAction" }),
1159
- EditAction.meta({ id: "EditAction" }),
1160
1150
  CustomAction.meta({ id: "CustomAction" })
1161
1151
  ]).meta({
1162
1152
  id: "ActionDocument"
@@ -1179,8 +1169,7 @@ var InherentFlags = {
1179
1169
  INCOMPLETE: "incomplete",
1180
1170
  REJECTED: "rejected",
1181
1171
  CORRECTION_REQUESTED: "correction-requested",
1182
- POTENTIAL_DUPLICATE: "potential-duplicate",
1183
- EDIT_IN_PROGRESS: "edit-in-progress"
1172
+ POTENTIAL_DUPLICATE: "potential-duplicate"
1184
1173
  };
1185
1174
  var ActionFlag = z13.string().regex(
1186
1175
  new RegExp(
@@ -1965,6 +1954,12 @@ var IdReaderField = BaseField.extend({
1965
1954
  z16.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
1966
1955
  )
1967
1956
  });
1957
+ var CustomField = BaseField.extend({
1958
+ type: z16.literal(FieldType.CUSTOM),
1959
+ defaultValue: CustomFieldValue.optional(),
1960
+ src: z16.string().describe("Module source path for the custom field component"),
1961
+ configuration: z16.unknown().optional()
1962
+ });
1968
1963
  var LoaderField = BaseField.extend({
1969
1964
  type: z16.literal(FieldType.LOADER),
1970
1965
  configuration: z16.object({
@@ -2012,7 +2007,8 @@ var FieldConfig = z16.discriminatedUnion("type", [
2012
2007
  IdReaderField,
2013
2008
  QueryParamReaderField,
2014
2009
  LoaderField,
2015
- SearchField
2010
+ SearchField,
2011
+ CustomField
2016
2012
  ]).meta({
2017
2013
  description: "Form field configuration",
2018
2014
  id: "FieldConfig"
@@ -3701,14 +3697,6 @@ var DeclareActionInput = BaseActionInput.extend(
3701
3697
  type: z33.literal(ActionType.DECLARE).default(ActionType.DECLARE)
3702
3698
  }).shape
3703
3699
  );
3704
- var EditActionInput = BaseActionInput.extend(
3705
- z33.object({
3706
- type: z33.literal(ActionType.EDIT).default(ActionType.EDIT),
3707
- content: z33.object({
3708
- comment: z33.string().describe("Comment for the edit action.").optional()
3709
- })
3710
- }).shape
3711
- );
3712
3700
  var PrintCertificateActionInput = BaseActionInput.extend(
3713
3701
  z33.object({
3714
3702
  type: z33.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
@@ -3820,8 +3808,7 @@ var ActionInput = z33.discriminatedUnion("type", [
3820
3808
  id: "ApproveCorrectionActionInput"
3821
3809
  }),
3822
3810
  ReadActionInput.meta({ id: "ReadActionInput" }),
3823
- CustomActionInput.meta({ id: "CustomActionInput" }),
3824
- EditActionInput.meta({ id: "EditActionInput" })
3811
+ CustomActionInput.meta({ id: "CustomActionInput" })
3825
3812
  ]).meta({
3826
3813
  id: "ActionInput"
3827
3814
  });
@@ -6080,7 +6067,6 @@ var ACTION_SCOPE_MAP = {
6080
6067
  "record.declared.validate",
6081
6068
  "record.register"
6082
6069
  ],
6083
- [ActionType.EDIT]: ["record.declared.edit"],
6084
6070
  [ActionType.DELETE]: ["record.declare"],
6085
6071
  [ActionType.VALIDATE]: ["record.declared.validate", "record.register"],
6086
6072
  [ActionType.REGISTER]: ["record.register"],
@@ -6128,8 +6114,7 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
6128
6114
  ActionType.MARK_AS_DUPLICATE,
6129
6115
  ActionType.ARCHIVE,
6130
6116
  ActionType.REJECT,
6131
- ActionType.CUSTOM,
6132
- ActionType.EDIT
6117
+ ActionType.CUSTOM
6133
6118
  ],
6134
6119
  [EventStatus.enum.REGISTERED]: [
6135
6120
  ActionType.READ,
@@ -6155,7 +6140,6 @@ var ACTION_FILTERS = {
6155
6140
  [ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
6156
6141
  [ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
6157
6142
  [ActionType.VALIDATE]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
6158
- [ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
6159
6143
  [ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
6160
6144
  [ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
6161
6145
  [ActionType.ARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested"))
@@ -82,7 +82,6 @@ export declare const RecordScopeType: z.ZodEnum<{
82
82
  "record.create": "record.create";
83
83
  "record.declare": "record.declare";
84
84
  "record.notify": "record.notify";
85
- "record.declared.edit": "record.declared.edit";
86
85
  "record.declared.validate": "record.declared.validate";
87
86
  "record.declared.reject": "record.declared.reject";
88
87
  "record.declared.archive": "record.declared.archive";
@@ -100,7 +99,6 @@ export declare const RecordScope: z.ZodObject<{
100
99
  "record.create": "record.create";
101
100
  "record.declare": "record.declare";
102
101
  "record.notify": "record.notify";
103
- "record.declared.edit": "record.declared.edit";
104
102
  "record.declared.validate": "record.declared.validate";
105
103
  "record.declared.reject": "record.declared.reject";
106
104
  "record.declared.archive": "record.declared.archive";
@@ -154,7 +152,6 @@ declare const ConfigurableRawScopes: z.ZodDiscriminatedUnion<[z.ZodObject<{
154
152
  "record.create": "record.create";
155
153
  "record.declare": "record.declare";
156
154
  "record.notify": "record.notify";
157
- "record.declared.edit": "record.declared.edit";
158
155
  "record.declared.validate": "record.declared.validate";
159
156
  "record.declared.reject": "record.declared.reject";
160
157
  "record.declared.archive": "record.declared.archive";
@@ -181,7 +178,6 @@ export declare const ConfigurableActionScopes: z.ZodDiscriminatedUnion<[z.ZodObj
181
178
  "record.create": "record.create";
182
179
  "record.declare": "record.declare";
183
180
  "record.notify": "record.notify";
184
- "record.declared.edit": "record.declared.edit";
185
181
  "record.declared.validate": "record.declared.validate";
186
182
  "record.declared.reject": "record.declared.reject";
187
183
  "record.declared.archive": "record.declared.archive";
@@ -231,7 +227,7 @@ export declare function findScope<T extends ConfigurableScopeType>(scopes: strin
231
227
  }, {
232
228
  type: T;
233
229
  }> | Extract<{
234
- type: "record.unassign-others" | "record.register" | "record.read" | "record.create" | "record.declare" | "record.notify" | "record.declared.edit" | "record.declared.validate" | "record.declared.reject" | "record.declared.archive" | "record.declared.review-duplicates" | "record.registered.print-certified-copies" | "record.registered.request-correction" | "record.registered.correct";
230
+ type: "record.unassign-others" | "record.register" | "record.read" | "record.create" | "record.declare" | "record.notify" | "record.declared.validate" | "record.declared.reject" | "record.declared.archive" | "record.declared.review-duplicates" | "record.registered.print-certified-copies" | "record.registered.request-correction" | "record.registered.correct";
235
231
  options: {
236
232
  event: string[];
237
233
  };
@@ -278,7 +274,7 @@ export declare function parseConfigurableScope(scope: string): {
278
274
  id: string[];
279
275
  };
280
276
  } | {
281
- type: "record.unassign-others" | "record.register" | "record.read" | "record.create" | "record.declare" | "record.notify" | "record.declared.edit" | "record.declared.validate" | "record.declared.reject" | "record.declared.archive" | "record.declared.review-duplicates" | "record.registered.print-certified-copies" | "record.registered.request-correction" | "record.registered.correct";
277
+ type: "record.unassign-others" | "record.register" | "record.read" | "record.create" | "record.declare" | "record.notify" | "record.declared.validate" | "record.declared.reject" | "record.declared.archive" | "record.declared.review-duplicates" | "record.registered.print-certified-copies" | "record.registered.request-correction" | "record.registered.correct";
282
278
  options: {
283
279
  event: string[];
284
280
  };
@@ -251,7 +251,6 @@ var RecordScopeType = z.enum([
251
251
  "record.read",
252
252
  "record.declare",
253
253
  "record.notify",
254
- "record.declared.edit",
255
254
  "record.declared.validate",
256
255
  "record.declared.reject",
257
256
  "record.declared.archive",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "1.9.2-rc.e90dda1",
3
+ "version": "1.9.2-rc.ebb7011",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "exports": {