@opencrvs/toolkit 2.0.0-rc.31403f2 → 2.0.0-rc.315863

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 (34) hide show
  1. package/build.sh +2 -2
  2. package/dist/application-config/index.js +12 -0
  3. package/dist/cli.js +5110 -167
  4. package/dist/commons/api/router.d.ts +613 -20
  5. package/dist/commons/conditionals/conditionals.d.ts +3 -3
  6. package/dist/commons/events/ActionConfig.d.ts +8 -158
  7. package/dist/commons/events/ActionDocument.d.ts +44 -0
  8. package/dist/commons/events/ActionInput.d.ts +26 -0
  9. package/dist/commons/events/ActionType.d.ts +6 -1
  10. package/dist/commons/events/AdvancedSearchConfig.d.ts +6 -0
  11. package/dist/commons/events/AuditLog.d.ts +2 -0
  12. package/dist/commons/events/Draft.d.ts +2 -0
  13. package/dist/commons/events/EventDocument.d.ts +22 -0
  14. package/dist/commons/events/FieldConfig.d.ts +5 -0
  15. package/dist/commons/events/WorkqueueConfig.d.ts +5 -2
  16. package/dist/commons/events/scopes.d.ts +1 -0
  17. package/dist/commons/events/test.utils.d.ts +9 -1
  18. package/dist/commons/events/utils.d.ts +15 -1
  19. package/dist/conditionals/index.js +2 -0
  20. package/dist/events/index.js +81 -103
  21. package/dist/migrations/v2.0/index.js +5146 -88
  22. package/dist/notification/index.js +43 -99
  23. package/dist/scopes/index.d.ts +7 -1
  24. package/dist/scopes/index.js +2 -0
  25. package/opencrvs-toolkit-2.0.0-rc.0315863.tgz +0 -0
  26. package/package.json +1 -1
  27. package/tsconfig.tsbuildinfo +1 -1
  28. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts +0 -3
  29. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts.map +0 -1
  30. package/dist/migrations/v2.1/add-explicit-correction-flags.js +0 -234
  31. package/dist/migrations/v2.1/index.d.ts +0 -6
  32. package/dist/migrations/v2.1/index.d.ts.map +0 -1
  33. package/dist/migrations/v2.1/index.js +0 -218
  34. package/opencrvs-toolkit-2.0.0-rc.31403f2.tgz +0 -0
@@ -328,6 +328,20 @@ export declare function findLastAssignmentAction(actions: Action[]): {
328
328
  createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
329
329
  annotation?: Record<string, import("./FieldValue").FieldUpdateValue> | null | undefined;
330
330
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
331
+ } | {
332
+ id: string & import("zod").$brand<"UUID">;
333
+ transactionId: string;
334
+ createdByUserType: "user" | "system";
335
+ createdAt: string;
336
+ createdBy: string;
337
+ declaration: Record<string, import("./FieldValue").FieldUpdateValue>;
338
+ status: "Requested" | "Accepted" | "Rejected";
339
+ type: "UNARCHIVE";
340
+ createdByRole?: string | undefined;
341
+ createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
342
+ createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
343
+ annotation?: Record<string, import("./FieldValue").FieldUpdateValue> | null | undefined;
344
+ originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
331
345
  } | {
332
346
  id: string & import("zod").$brand<"UUID">;
333
347
  transactionId: string;
@@ -441,7 +455,7 @@ export declare function findLastAssignmentAction(actions: Action[]): {
441
455
  createdByUserType: "user" | "system";
442
456
  createdAt: string;
443
457
  createdBy: string;
444
- type: "CUSTOM" | "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
458
+ type: "CUSTOM" | "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "UNARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
445
459
  status: "Rejected";
446
460
  createdByRole?: string | undefined;
447
461
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
@@ -152,6 +152,7 @@ var RecordScopeTypeV2 = z6.enum([
152
152
  "record.edit",
153
153
  "record.reject",
154
154
  "record.archive",
155
+ "record.unarchive",
155
156
  "record.review-duplicates",
156
157
  "record.register",
157
158
  "record.print-certified-copies",
@@ -257,6 +258,7 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
257
258
  "record.edit",
258
259
  "record.reject",
259
260
  "record.archive",
261
+ "record.unarchive",
260
262
  "record.review-duplicates",
261
263
  "record.register"
262
264
  ]);
@@ -214,6 +214,7 @@ __export(events_exports, {
214
214
  TimeValue: () => TimeValue,
215
215
  TranslationConfig: () => TranslationConfig,
216
216
  UUID: () => UUID,
217
+ UnarchiveActionInput: () => UnarchiveActionInput,
217
218
  UnassignActionInput: () => UnassignActionInput,
218
219
  UserAuditRecordInput: () => UserAuditRecordInput,
219
220
  V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS: () => V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS,
@@ -481,6 +482,7 @@ var RecordScopeTypeV2 = z2.enum([
481
482
  "record.edit",
482
483
  "record.reject",
483
484
  "record.archive",
485
+ "record.unarchive",
484
486
  "record.review-duplicates",
485
487
  "record.register",
486
488
  "record.print-certified-copies",
@@ -586,6 +588,7 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
586
588
  "record.edit",
587
589
  "record.reject",
588
590
  "record.archive",
591
+ "record.unarchive",
589
592
  "record.review-duplicates",
590
593
  "record.register"
591
594
  ]);
@@ -772,6 +775,7 @@ var ActionType = {
772
775
  MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
773
776
  MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
774
777
  ARCHIVE: "ARCHIVE",
778
+ UNARCHIVE: "UNARCHIVE",
775
779
  // Record actions
776
780
  PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
777
781
  REQUEST_CORRECTION: "REQUEST_CORRECTION",
@@ -791,6 +795,7 @@ var ConfirmableActions = [
791
795
  ActionType.REGISTER,
792
796
  ActionType.REJECT,
793
797
  ActionType.ARCHIVE,
798
+ ActionType.UNARCHIVE,
794
799
  ActionType.PRINT_CERTIFICATE,
795
800
  ActionType.REQUEST_CORRECTION,
796
801
  ActionType.APPROVE_CORRECTION,
@@ -809,6 +814,7 @@ var ActionTypes = z4.enum([
809
814
  "MARK_AS_DUPLICATE",
810
815
  "MARK_AS_NOT_DUPLICATE",
811
816
  "ARCHIVE",
817
+ "UNARCHIVE",
812
818
  "PRINT_CERTIFICATE",
813
819
  "REQUEST_CORRECTION",
814
820
  "REJECT_CORRECTION",
@@ -852,6 +858,7 @@ var WorkqueueActionType = ActionTypes.extract([
852
858
  ActionType.REJECT,
853
859
  ActionType.MARK_AS_DUPLICATE,
854
860
  ActionType.ARCHIVE,
861
+ ActionType.UNARCHIVE,
855
862
  ActionType.PRINT_CERTIFICATE,
856
863
  ActionType.REQUEST_CORRECTION
857
864
  ]);
@@ -916,6 +923,7 @@ var EventActionEntrySchema = AuditLogEntryBase.extend({
916
923
  "event.actions.unassign.request",
917
924
  "event.actions.read.request",
918
925
  "event.actions.archive.request",
926
+ "event.actions.unarchive.request",
919
927
  "event.actions.reinstate.request",
920
928
  "event.actions.print_certificate.request",
921
929
  "event.actions.correction.request.request",
@@ -1649,6 +1657,11 @@ var ArchiveAction = ActionBase.extend(
1649
1657
  content: ReasonContent
1650
1658
  }).shape
1651
1659
  );
1660
+ var UnarchiveAction = ActionBase.extend(
1661
+ z14.object({
1662
+ type: z14.literal(ActionType.UNARCHIVE)
1663
+ }).shape
1664
+ );
1652
1665
  var CreatedAction = ActionBase.extend(
1653
1666
  z14.object({
1654
1667
  type: z14.literal(ActionType.CREATE)
@@ -1715,6 +1728,7 @@ var ActionDocument = z14.discriminatedUnion("type", [
1715
1728
  MarkNotDuplicateAction.meta({ id: "MarkNotDuplicateAction" }),
1716
1729
  MarkAsDuplicateAction.meta({ id: "MarkAsDuplicateAction" }),
1717
1730
  ArchiveAction.meta({ id: "ArchiveAction" }),
1731
+ UnarchiveAction.meta({ id: "UnarchiveAction" }),
1718
1732
  NotifiedAction.meta({ id: "NotifiedAction" }),
1719
1733
  RegisterAction.meta({ id: "RegisterAction" }),
1720
1734
  DeclareAction.meta({ id: "DeclareAction" }),
@@ -3238,52 +3252,6 @@ var NotifyConfig = ActionConfigBase.extend(
3238
3252
  type: z24.literal(ActionType.NOTIFY)
3239
3253
  }).shape
3240
3254
  );
3241
- var DuplicateDetectedConfig = ActionConfigBase.extend(
3242
- z24.object({
3243
- type: z24.literal(ActionType.DUPLICATE_DETECTED),
3244
- label: z24.never().optional().describe(
3245
- "DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no label."
3246
- ),
3247
- supportingCopy: z24.never().optional(),
3248
- icon: z24.never().optional().describe(
3249
- "DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no icon."
3250
- ),
3251
- conditionals: z24.never().optional().describe(
3252
- "DUPLICATE_DETECTED is system-generated and never shown as a button, so it cannot be disabled or hidden with conditionals."
3253
- )
3254
- }).shape
3255
- );
3256
- var MarkAsDuplicateConfig = ActionConfigBase.extend(
3257
- z24.object({
3258
- type: z24.literal(ActionType.MARK_AS_DUPLICATE)
3259
- }).shape
3260
- );
3261
- var MarkAsNotDuplicateConfig = ActionConfigBase.extend(
3262
- z24.object({
3263
- type: z24.literal(ActionType.MARK_AS_NOT_DUPLICATE)
3264
- }).shape
3265
- );
3266
- var AssignConfig = ActionConfigBase.extend(
3267
- z24.object({
3268
- type: z24.literal(ActionType.ASSIGN),
3269
- flags: z24.never().optional().describe(
3270
- "ASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
3271
- )
3272
- }).shape
3273
- );
3274
- var UnassignConfig = ActionConfigBase.extend(
3275
- z24.object({
3276
- type: z24.literal(ActionType.UNASSIGN),
3277
- flags: z24.never().optional().describe(
3278
- "UNASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
3279
- )
3280
- }).shape
3281
- );
3282
- var DeleteConfig = ActionConfigBase.extend(
3283
- z24.object({
3284
- type: z24.literal(ActionType.DELETE)
3285
- }).shape
3286
- );
3287
3255
  var DeclareConfig = DeclarationActionBase.extend(
3288
3256
  z24.object({
3289
3257
  type: z24.literal(ActionType.DECLARE),
@@ -3308,6 +3276,11 @@ var ArchiveConfig = ActionConfigBase.extend(
3308
3276
  type: z24.literal(ActionType.ARCHIVE)
3309
3277
  }).shape
3310
3278
  );
3279
+ var UnarchiveConfig = ActionConfigBase.extend(
3280
+ z24.object({
3281
+ type: z24.literal(ActionType.UNARCHIVE)
3282
+ }).shape
3283
+ );
3311
3284
  var EditActionConfig = ActionConfigBase.extend(
3312
3285
  z24.object({
3313
3286
  type: z24.literal(ActionType.EDIT),
@@ -3346,17 +3319,7 @@ var RequestCorrectionConfig = ActionConfigBase.extend(
3346
3319
  correctionForm: ActionFormConfig
3347
3320
  }).shape
3348
3321
  );
3349
- var ApproveCorrectionConfig = ActionConfigBase.extend(
3350
- z24.object({
3351
- type: z24.literal(ActionType.APPROVE_CORRECTION)
3352
- }).shape
3353
- );
3354
- var RejectCorrectionConfig = ActionConfigBase.extend(
3355
- z24.object({
3356
- type: z24.literal(ActionType.REJECT_CORRECTION)
3357
- }).shape
3358
- );
3359
- var CustomActionConfig = ActionConfigBase.extend(
3322
+ var CustomActionConfig = ActionConfigBase.merge(
3360
3323
  z24.object({
3361
3324
  type: z24.literal(ActionType.CUSTOM),
3362
3325
  customActionType: z24.string().describe("Type identifier of the custom action."),
@@ -3367,7 +3330,7 @@ var CustomActionConfig = ActionConfigBase.extend(
3367
3330
  auditHistoryLabel: TranslationConfig.describe(
3368
3331
  'The label to show in audit history for this action. For example "Approved".'
3369
3332
  )
3370
- }).shape
3333
+ })
3371
3334
  );
3372
3335
  var ActionConfig = z24.discriminatedUnion("type", [
3373
3336
  /*
@@ -3378,18 +3341,6 @@ var ActionConfig = z24.discriminatedUnion("type", [
3378
3341
  id: "ReadActionConfig",
3379
3342
  description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
3380
3343
  }),
3381
- AssignConfig.meta({
3382
- id: "AssignActionConfig",
3383
- description: "Configuration for assigning a record to the current user."
3384
- }),
3385
- UnassignConfig.meta({
3386
- id: "UnassignActionConfig",
3387
- description: "Configuration for unassigning a record from its current assignee."
3388
- }),
3389
- DeleteConfig.meta({
3390
- id: "DeleteActionConfig",
3391
- description: "Configuration for deleting a draft record."
3392
- }),
3393
3344
  NotifyConfig.meta({
3394
3345
  id: "NotifyActionConfig",
3395
3346
  description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
@@ -3398,18 +3349,6 @@ var ActionConfig = z24.discriminatedUnion("type", [
3398
3349
  id: "DeclareActionConfig",
3399
3350
  description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
3400
3351
  }),
3401
- DuplicateDetectedConfig.meta({
3402
- id: "DuplicateDetectedActionConfig",
3403
- description: "Configuration for the system-generated duplicate-detection action. Never shown as a button, so it only supports flags \u2014 not label, icon, or conditionals."
3404
- }),
3405
- MarkAsDuplicateConfig.meta({
3406
- id: "MarkAsDuplicateActionConfig",
3407
- description: "Configuration for marking a record as a duplicate."
3408
- }),
3409
- MarkAsNotDuplicateConfig.meta({
3410
- id: "MarkAsNotDuplicateActionConfig",
3411
- description: "Configuration for marking a record as not a duplicate, after it was previously flagged as one."
3412
- }),
3413
3352
  RejectConfig.meta({
3414
3353
  id: "RejectActionConfig",
3415
3354
  description: "Configuration for rejecting a record before registration."
@@ -3426,14 +3365,6 @@ var ActionConfig = z24.discriminatedUnion("type", [
3426
3365
  id: "RequestCorrectionActionConfig",
3427
3366
  description: "Configuration for requesting a correction on a registered record."
3428
3367
  }),
3429
- ApproveCorrectionConfig.meta({
3430
- id: "ApproveCorrectionActionConfig",
3431
- description: "Configuration for approving a requested correction."
3432
- }),
3433
- RejectCorrectionConfig.meta({
3434
- id: "RejectCorrectionActionConfig",
3435
- description: "Configuration for rejecting a requested correction."
3436
- }),
3437
3368
  EditActionConfig.meta({
3438
3369
  id: "EditActionConfig",
3439
3370
  description: "Configuration for editing a record before registration."
@@ -3442,6 +3373,10 @@ var ActionConfig = z24.discriminatedUnion("type", [
3442
3373
  id: "ArchiveActionConfig",
3443
3374
  description: "Configuration for archiving a record."
3444
3375
  }),
3376
+ UnarchiveConfig.meta({
3377
+ id: "UnarchiveActionConfig",
3378
+ description: "Configuration for unarchiving a record."
3379
+ }),
3445
3380
  CustomActionConfig.meta({
3446
3381
  id: "CustomActionConfig",
3447
3382
  description: "Configuration for a country-defined custom action. An event may include any number of these."
@@ -4592,6 +4527,9 @@ function getActionConfig({
4592
4527
  if (a.type === ActionType.CUSTOM && customActionType) {
4593
4528
  return a.customActionType === customActionType;
4594
4529
  }
4530
+ if (actionType === ActionType.APPROVE_CORRECTION || actionType === ActionType.REJECT_CORRECTION) {
4531
+ return a.type === ActionType.REQUEST_CORRECTION;
4532
+ }
4595
4533
  return a.type === actionType;
4596
4534
  });
4597
4535
  }
@@ -5745,7 +5683,7 @@ function validateActionFlags(event2, ctx) {
5745
5683
  const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
5746
5684
  const configuredFlagIds = event2.flags.map((flag2) => flag2.id);
5747
5685
  const actionFlagIds = event2.actions.flatMap(
5748
- (action) => (action.flags ?? []).map((flag2) => flag2.id)
5686
+ (action) => action.flags.map((flag2) => flag2.id)
5749
5687
  );
5750
5688
  for (const actionFlagId of actionFlagIds) {
5751
5689
  const isConfigured = configuredFlagIds.includes(actionFlagId);
@@ -6420,6 +6358,11 @@ var ArchiveActionInput = BaseActionInput.extend(
6420
6358
  content: ReasonContent
6421
6359
  }).shape
6422
6360
  );
6361
+ var UnarchiveActionInput = BaseActionInput.extend(
6362
+ z38.object({
6363
+ type: z38.literal(ActionType.UNARCHIVE).default(ActionType.UNARCHIVE)
6364
+ }).shape
6365
+ );
6423
6366
  var AssignActionInput = BaseActionInput.extend(
6424
6367
  z38.object({
6425
6368
  type: z38.literal(ActionType.ASSIGN),
@@ -6481,6 +6424,7 @@ var ActionInput = z38.discriminatedUnion("type", [
6481
6424
  id: "MarkNotDuplicateActionInput"
6482
6425
  }),
6483
6426
  ArchiveActionInput.meta({ id: "ArchiveActionInput" }),
6427
+ UnarchiveActionInput.meta({ id: "UnarchiveActionInput" }),
6484
6428
  AssignActionInput.meta({ id: "AssignActionInput" }),
6485
6429
  UnassignActionInput.meta({ id: "UnassignActionInput" }),
6486
6430
  PrintCertificateActionInput.meta({ id: "PrintCertificateActionInput" }),
@@ -6595,6 +6539,7 @@ var updateActions = ActionTypes.extract([
6595
6539
  ActionType.REGISTER,
6596
6540
  ActionType.REJECT,
6597
6541
  ActionType.ARCHIVE,
6542
+ ActionType.UNARCHIVE,
6598
6543
  ActionType.PRINT_CERTIFICATE,
6599
6544
  ActionType.REQUEST_CORRECTION,
6600
6545
  ActionType.APPROVE_CORRECTION,
@@ -6716,15 +6661,12 @@ var INHERENT_FLAG_RULES = [
6716
6661
  },
6717
6662
  {
6718
6663
  // INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
6719
- // other status-changing action (see getStatusFromActions).
6664
+ // other status-changing action (see getStatusFromActions). ARCHIVE/UNARCHIVE
6665
+ // are deliberately excluded so the flag freezes across an archive/unarchive
6666
+ // round trip and comes back exactly as it was.
6720
6667
  flag: InherentFlags.INCOMPLETE,
6721
6668
  setOn: [ActionType.NOTIFY],
6722
- resetOn: [
6723
- ActionType.CREATE,
6724
- ActionType.DECLARE,
6725
- ActionType.REGISTER,
6726
- ActionType.ARCHIVE
6727
- ]
6669
+ resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
6728
6670
  },
6729
6671
  {
6730
6672
  flag: InherentFlags.REJECTED,
@@ -6788,7 +6730,7 @@ function resolveEventCustomFlags(event2, eventConfiguration) {
6788
6730
  const declaration = aggregateActionDeclarations(eventUpToThisAction);
6789
6731
  const annotation = aggregateActionAnnotations(eventUpToThisAction);
6790
6732
  const form = { ...declaration, ...annotation };
6791
- const flagsWithMetConditions = (actionConfig.flags ?? []).filter(
6733
+ const flagsWithMetConditions = actionConfig.flags.filter(
6792
6734
  ({ conditional }) => (
6793
6735
  // If conditional is not provided, the flag is resolved
6794
6736
  conditional ? isFlagConditionMet(conditional, form, action) : true
@@ -6834,7 +6776,27 @@ function getEventFlags(event2, config) {
6834
6776
 
6835
6777
  // ../commons/src/events/state/index.ts
6836
6778
  function getStatusFromActions(actions) {
6837
- return actions.filter(({ status: status2 }) => status2 === ActionStatus.Accepted).reduce((status2, action) => {
6779
+ const acceptedActions = actions.filter(
6780
+ ({ status: status2 }) => status2 === ActionStatus.Accepted
6781
+ );
6782
+ const isCurrentlyArchived = acceptedActions.reduce(
6783
+ (archived, action) => {
6784
+ if (action.type === ActionType.ARCHIVE) {
6785
+ return true;
6786
+ }
6787
+ if (action.type === ActionType.UNARCHIVE) {
6788
+ return false;
6789
+ }
6790
+ return archived;
6791
+ },
6792
+ false
6793
+ );
6794
+ if (isCurrentlyArchived) {
6795
+ return EventStatus.enum.ARCHIVED;
6796
+ }
6797
+ return acceptedActions.filter(
6798
+ ({ type }) => type !== ActionType.ARCHIVE && type !== ActionType.UNARCHIVE
6799
+ ).reduce((status2, action) => {
6838
6800
  switch (action.type) {
6839
6801
  case ActionType.CREATE:
6840
6802
  return EventStatus.enum.CREATED;
@@ -6842,10 +6804,11 @@ function getStatusFromActions(actions) {
6842
6804
  return EventStatus.enum.DECLARED;
6843
6805
  case ActionType.REGISTER:
6844
6806
  return EventStatus.enum.REGISTERED;
6845
- case ActionType.ARCHIVE:
6846
- return EventStatus.enum.ARCHIVED;
6847
6807
  case ActionType.NOTIFY:
6848
6808
  return EventStatus.enum.NOTIFIED;
6809
+ // Already filtered out above; listed here only to satisfy exhaustiveness.
6810
+ case ActionType.ARCHIVE:
6811
+ case ActionType.UNARCHIVE:
6849
6812
  case ActionType.CUSTOM:
6850
6813
  case ActionType.PRINT_CERTIFICATE:
6851
6814
  case ActionType.ASSIGN:
@@ -9930,6 +9893,14 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
9930
9893
  },
9931
9894
  ...input
9932
9895
  }),
9896
+ unarchive: (eventId, input = {}) => ({
9897
+ type: ActionType.UNARCHIVE,
9898
+ transactionId: input.transactionId ?? getUUID(),
9899
+ declaration: {},
9900
+ annotation: {},
9901
+ eventId,
9902
+ ...input
9903
+ }),
9933
9904
  reject: (eventId, input = {}) => ({
9934
9905
  type: ActionType.REJECT,
9935
9906
  transactionId: input.transactionId ?? getUUID(),
@@ -10088,6 +10059,7 @@ function generateActionDocument({
10088
10059
  case ActionType.NOTIFY:
10089
10060
  case ActionType.REGISTER:
10090
10061
  case ActionType.REQUEST_CORRECTION:
10062
+ case ActionType.UNARCHIVE:
10091
10063
  return { ...actionBase, type: action };
10092
10064
  case ActionType.EDIT:
10093
10065
  return {
@@ -10606,6 +10578,7 @@ var ACTION_SCOPE_MAP = {
10606
10578
  [ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
10607
10579
  [ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
10608
10580
  [ActionType.ARCHIVE]: ["record.archive"],
10581
+ [ActionType.UNARCHIVE]: ["record.unarchive"],
10609
10582
  [ActionType.REJECT]: ["record.reject"],
10610
10583
  [ActionType.ASSIGN]: null,
10611
10584
  [ActionType.UNASSIGN]: null,
@@ -10812,7 +10785,11 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
10812
10785
  ActionType.CUSTOM,
10813
10786
  ClientSpecificAction.REVIEW_CORRECTION_REQUEST
10814
10787
  ],
10815
- [EventStatus.enum.ARCHIVED]: [ActionType.READ, ActionType.CUSTOM]
10788
+ [EventStatus.enum.ARCHIVED]: [
10789
+ ActionType.READ,
10790
+ ActionType.CUSTOM,
10791
+ ActionType.UNARCHIVE
10792
+ ]
10816
10793
  };
10817
10794
  var ACTION_FILTERS = {
10818
10795
  [ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
@@ -10825,6 +10802,7 @@ var ACTION_FILTERS = {
10825
10802
  [ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
10826
10803
  [ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
10827
10804
  [ActionType.ARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
10805
+ [ActionType.UNARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
10828
10806
  [ActionType.ASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
10829
10807
  [ActionType.UNASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
10830
10808
  [ActionType.CUSTOM]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested"))