@opencrvs/toolkit 2.0.0-rc.9dcc61c → 2.0.0-rc.9dee074

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.
@@ -414,7 +414,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
414
414
  createdByUserType: "system" | "user";
415
415
  createdAt: string;
416
416
  createdBy: string;
417
- type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "APPROVE_CORRECTION" | "REJECT_CORRECTION";
417
+ type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
418
418
  status: "Rejected";
419
419
  createdByRole?: string | undefined;
420
420
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
@@ -723,7 +723,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
723
723
  createdByUserType: "system" | "user";
724
724
  createdAt: string;
725
725
  createdBy: string;
726
- type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "APPROVE_CORRECTION" | "REJECT_CORRECTION";
726
+ type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
727
727
  status: "Rejected";
728
728
  createdByRole?: string | undefined;
729
729
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
@@ -1031,7 +1031,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1031
1031
  createdByUserType: "system" | "user";
1032
1032
  createdAt: string;
1033
1033
  createdBy: string;
1034
- type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "APPROVE_CORRECTION" | "REJECT_CORRECTION";
1034
+ type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
1035
1035
  status: "Rejected";
1036
1036
  createdByRole?: string | undefined;
1037
1037
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
@@ -1081,7 +1081,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1081
1081
  transactionId: string;
1082
1082
  createdAt: string;
1083
1083
  action: {
1084
- type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "MARK_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "READ" | "CUSTOM" | "CREATE" | "DUPLICATE_DETECTED" | "MARK_AS_NOT_DUPLICATE" | "NOTIFY" | "ASSIGN" | "APPROVE_CORRECTION" | "REJECT_CORRECTION" | "UNASSIGN";
1084
+ type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "MARK_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "READ" | "CUSTOM" | "CREATE" | "NOTIFY" | "DUPLICATE_DETECTED" | "MARK_AS_NOT_DUPLICATE" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "ASSIGN" | "UNASSIGN";
1085
1085
  transactionId: string;
1086
1086
  createdByUserType: "system" | "user";
1087
1087
  createdAt: string;
@@ -1100,7 +1100,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1100
1100
  input: {
1101
1101
  transactionId: string;
1102
1102
  eventId: string;
1103
- type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "MARK_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "READ" | "CUSTOM" | "CREATE" | "DUPLICATE_DETECTED" | "MARK_AS_NOT_DUPLICATE" | "NOTIFY" | "ASSIGN" | "APPROVE_CORRECTION" | "REJECT_CORRECTION" | "UNASSIGN";
1103
+ type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "MARK_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "READ" | "CUSTOM" | "CREATE" | "NOTIFY" | "DUPLICATE_DETECTED" | "MARK_AS_NOT_DUPLICATE" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "ASSIGN" | "UNASSIGN";
1104
1104
  status: "Requested" | "Accepted" | "Rejected";
1105
1105
  createdAtLocation?: string | null | undefined;
1106
1106
  declaration?: Record<string, unknown> | undefined;
@@ -1116,7 +1116,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1116
1116
  transactionId: string;
1117
1117
  createdAt: string;
1118
1118
  action: {
1119
- type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "MARK_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "READ" | "CUSTOM" | "CREATE" | "DUPLICATE_DETECTED" | "MARK_AS_NOT_DUPLICATE" | "NOTIFY" | "ASSIGN" | "APPROVE_CORRECTION" | "REJECT_CORRECTION" | "UNASSIGN";
1119
+ type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "MARK_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "READ" | "CUSTOM" | "CREATE" | "NOTIFY" | "DUPLICATE_DETECTED" | "MARK_AS_NOT_DUPLICATE" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "ASSIGN" | "UNASSIGN";
1120
1120
  transactionId: string;
1121
1121
  createdByUserType: "system" | "user";
1122
1122
  createdAt: string;
@@ -1773,7 +1773,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1773
1773
  createdByUserType: "system" | "user";
1774
1774
  createdAt: string;
1775
1775
  createdBy: string;
1776
- type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "APPROVE_CORRECTION" | "REJECT_CORRECTION";
1776
+ type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
1777
1777
  status: "Rejected";
1778
1778
  createdByRole?: string | undefined;
1779
1779
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
@@ -2113,7 +2113,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
2113
2113
  createdByUserType: "system" | "user";
2114
2114
  createdAt: string;
2115
2115
  createdBy: string;
2116
- type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "APPROVE_CORRECTION" | "REJECT_CORRECTION";
2116
+ type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
2117
2117
  status: "Rejected";
2118
2118
  createdByRole?: string | undefined;
2119
2119
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
@@ -4178,7 +4178,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4178
4178
  createdByUserType: "system" | "user";
4179
4179
  createdAt: string;
4180
4180
  createdBy: string;
4181
- type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "APPROVE_CORRECTION" | "REJECT_CORRECTION";
4181
+ type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
4182
4182
  status: "Rejected";
4183
4183
  createdByRole?: string | undefined;
4184
4184
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
@@ -4783,7 +4783,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4783
4783
  createdByUserType: "system" | "user";
4784
4784
  createdAt: string;
4785
4785
  createdBy: string;
4786
- type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "APPROVE_CORRECTION" | "REJECT_CORRECTION";
4786
+ type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
4787
4787
  status: "Rejected";
4788
4788
  createdByRole?: string | undefined;
4789
4789
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
@@ -5101,7 +5101,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
5101
5101
  createdByUserType: "system" | "user";
5102
5102
  createdAt: string;
5103
5103
  createdBy: string;
5104
- type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "APPROVE_CORRECTION" | "REJECT_CORRECTION";
5104
+ type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
5105
5105
  status: "Rejected";
5106
5106
  createdByRole?: string | undefined;
5107
5107
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
@@ -6343,7 +6343,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
6343
6343
  createdByUserType: "system" | "user";
6344
6344
  createdAt: string;
6345
6345
  createdBy: string;
6346
- type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "APPROVE_CORRECTION" | "REJECT_CORRECTION";
6346
+ type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
6347
6347
  status: "Rejected";
6348
6348
  createdByRole?: string | undefined;
6349
6349
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
@@ -6660,7 +6660,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
6660
6660
  createdByUserType: "system" | "user";
6661
6661
  createdAt: string;
6662
6662
  createdBy: string;
6663
- type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "APPROVE_CORRECTION" | "REJECT_CORRECTION";
6663
+ type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
6664
6664
  status: "Rejected";
6665
6665
  createdByRole?: string | undefined;
6666
6666
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
@@ -7020,7 +7020,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
7020
7020
  createdByUserType: "system" | "user";
7021
7021
  createdAt: string;
7022
7022
  createdBy: string;
7023
- type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "APPROVE_CORRECTION" | "REJECT_CORRECTION";
7023
+ type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
7024
7024
  status: "Rejected";
7025
7025
  createdByRole?: string | undefined;
7026
7026
  createdBySignature?: string | null | undefined;
@@ -7238,7 +7238,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
7238
7238
  count?: number | undefined;
7239
7239
  timeStart?: string | undefined;
7240
7240
  timeEnd?: string | undefined;
7241
- actionTypes?: ("DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "MARK_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "READ" | "CUSTOM" | "CREATE" | "DUPLICATE_DETECTED" | "MARK_AS_NOT_DUPLICATE" | "NOTIFY" | "ASSIGN" | "APPROVE_CORRECTION" | "REJECT_CORRECTION" | "UNASSIGN")[] | undefined;
7241
+ actionTypes?: ("DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "MARK_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "READ" | "CUSTOM" | "CREATE" | "NOTIFY" | "DUPLICATE_DETECTED" | "MARK_AS_NOT_DUPLICATE" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "ASSIGN" | "UNASSIGN")[] | undefined;
7242
7242
  };
7243
7243
  output: {
7244
7244
  results: {
@@ -1,8 +1,6 @@
1
- import { Action, RequestedCorrectionAction } from '../ActionDocument';
2
1
  import { Flag, CustomFlag } from '../Flag';
3
2
  import { EventConfig } from '../EventConfig';
4
3
  import { EventDocument } from '../EventDocument';
5
- export declare function findPendingCorrectionAction(writeActions: Action[]): RequestedCorrectionAction | undefined;
6
4
  /**
7
5
  * This function resolves custom flags for an event based on its actions.
8
6
  * Flags are not stored to the event state or any database directly, instead they are always computed/evaluated from the event actions.
@@ -6388,24 +6388,19 @@ var import_date_fns3 = require("date-fns");
6388
6388
  function isEditInProgress(actions) {
6389
6389
  return actions.at(-1)?.type === ActionType.EDIT;
6390
6390
  }
6391
- function findPendingCorrectionAction(writeActions2) {
6392
- let correctionRequestAction;
6393
- for (let i = writeActions2.length - 1; i >= 0; i--) {
6394
- const action = writeActions2[i];
6395
- if (action.status === ActionStatus.Accepted) {
6396
- if (action.type === ActionType.APPROVE_CORRECTION || action.type === ActionType.REJECT_CORRECTION) {
6397
- break;
6398
- }
6399
- if (action.type === ActionType.REQUEST_CORRECTION) {
6400
- correctionRequestAction = action;
6401
- break;
6402
- }
6403
- }
6404
- }
6405
- return correctionRequestAction;
6406
- }
6407
6391
  function isCorrectionRequested(actions) {
6408
- return findPendingCorrectionAction(actions) !== void 0;
6392
+ return actions.reduce((prev, { type }) => {
6393
+ if (type === ActionType.REQUEST_CORRECTION) {
6394
+ return true;
6395
+ }
6396
+ if (type === ActionType.APPROVE_CORRECTION) {
6397
+ return false;
6398
+ }
6399
+ if (type === ActionType.REJECT_CORRECTION) {
6400
+ return false;
6401
+ }
6402
+ return prev;
6403
+ }, false);
6409
6404
  }
6410
6405
  function isDeclarationIncomplete(actions) {
6411
6406
  return getStatusFromActions(actions) === EventStatus.enum.NOTIFIED;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "2.0.0-rc.9dcc61c",
3
+ "version": "2.0.0-rc.9dee074",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "bin": {