@opencrvs/toolkit 2.0.0-rc.6f77a66 → 2.0.0-rc.70282f8

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: {
@@ -22,6 +22,7 @@ export * from './FieldValue';
22
22
  export * from './FormConfig';
23
23
  export * from './CompositeFieldValue';
24
24
  export * from './state';
25
+ export * from './state/flags';
25
26
  export * from './utils';
26
27
  export * from './defineConfig';
27
28
  export * from './DeduplicationConfig';
@@ -3,6 +3,7 @@ import { Flag, CustomFlag } from '../Flag';
3
3
  import { EventConfig } from '../EventConfig';
4
4
  import { EventDocument } from '../EventDocument';
5
5
  export declare function findPendingCorrectionAction(writeActions: Action[]): RequestedCorrectionAction | undefined;
6
+ export declare function isPotentialDuplicate(actions: Action[]): boolean;
6
7
  /**
7
8
  * This function resolves custom flags for an event based on its actions.
8
9
  * Flags are not stored to the event state or any database directly, instead they are always computed/evaluated from the event actions.
@@ -20,5 +21,18 @@ export declare function findPendingCorrectionAction(writeActions: Action[]): Req
20
21
  * // Returns: ['flag-1', 'flag-3']
21
22
  */
22
23
  export declare function resolveEventCustomFlags(event: EventDocument, eventConfiguration: EventConfig): CustomFlag[];
24
+ /**
25
+ * Computes all flags (inherent, action status, and custom) that should be attached to the given event,
26
+ * based on its actions and event-specific configuration.
27
+ *
28
+ * Flags are determined by combining:
29
+ * - Action status flags (format 'ActionType:ActionStatus')
30
+ * - Inherent flags (e.g. incomplete, rejected, correction requested, potential duplicate, edit in progress)
31
+ * - Event type-specific custom flags defined in the event configuration
32
+ *
33
+ * @param event - The EventDocument containing the action history and payload
34
+ * @param config - The EventConfig providing rules for custom flag evaluation
35
+ * @returns An array of flags currently relevant/applicable to the event
36
+ */
23
37
  export declare function getEventFlags(event: EventDocument, config: EventConfig): Flag[];
24
38
  //# sourceMappingURL=flags.d.ts.map
@@ -282,6 +282,7 @@ __export(events_exports, {
282
282
  findActiveDraftForEvent: () => findActiveDraftForEvent,
283
283
  findAllFields: () => findAllFields,
284
284
  findLastAssignmentAction: () => findLastAssignmentAction,
285
+ findPendingCorrectionAction: () => findPendingCorrectionAction,
285
286
  findRecordActionPages: () => findRecordActionPages,
286
287
  flag: () => flag,
287
288
  flattenFieldReference: () => flattenFieldReference,
@@ -323,6 +324,7 @@ __export(events_exports, {
323
324
  getDeclarationFields: () => getDeclarationFields,
324
325
  getDeclarationPages: () => getDeclarationPages,
325
326
  getEventConfigById: () => getEventConfigById,
327
+ getEventFlags: () => getEventFlags,
326
328
  getFilePathsFromEvent: () => getFilePathsFromEvent,
327
329
  getLocationHierarchy: () => getLocationHierarchy,
328
330
  getMixedPath: () => getMixedPath,
@@ -385,6 +387,7 @@ __export(events_exports, {
385
387
  isPageVisible: () => isPageVisible,
386
388
  isParagraphFieldType: () => isParagraphFieldType,
387
389
  isPhoneFieldType: () => isPhoneFieldType,
390
+ isPotentialDuplicate: () => isPotentialDuplicate,
388
391
  isPrintButtonFieldType: () => isPrintButtonFieldType,
389
392
  isQrReaderFieldType: () => isQrReaderFieldType,
390
393
  isQueryParamReaderFieldType: () => isQueryParamReaderFieldType,
@@ -418,6 +421,7 @@ __export(events_exports, {
418
421
  plainDateToLocalDate: () => plainDateToLocalDate,
419
422
  precompileActionSchemas: () => precompileActionSchemas,
420
423
  resolveDateOfEvent: () => resolveDateOfEvent,
424
+ resolveEventCustomFlags: () => resolveEventCustomFlags,
421
425
  resolvePlaceOfEvent: () => resolvePlaceOfEvent,
422
426
  runFieldValidations: () => runFieldValidations,
423
427
  runStructuralValidations: () => runStructuralValidations,
@@ -6395,7 +6399,7 @@ function findPendingCorrectionAction(writeActions2) {
6395
6399
  if (action.type === ActionType.APPROVE_CORRECTION || action.type === ActionType.REJECT_CORRECTION) {
6396
6400
  break;
6397
6401
  }
6398
- if (action.type === ActionType.REQUEST_CORRECTION && action.status === ActionStatus.Accepted) {
6402
+ if (action.type === ActionType.REQUEST_CORRECTION) {
6399
6403
  correctionRequestAction = action;
6400
6404
  break;
6401
6405
  }
@@ -6409,7 +6413,21 @@ function isDeclarationIncomplete(actions) {
6409
6413
  return getStatusFromActions(actions) === EventStatus.enum.NOTIFIED;
6410
6414
  }
6411
6415
  function isRejected(actions) {
6412
- return actions.at(-1)?.type === ActionType.REJECT;
6416
+ const resettingActionTypes = [
6417
+ ActionType.NOTIFY,
6418
+ ActionType.DECLARE,
6419
+ ActionType.EDIT,
6420
+ ActionType.REGISTER
6421
+ ];
6422
+ return actions.reduce((prev, { type }) => {
6423
+ if (type === ActionType.REJECT) {
6424
+ return true;
6425
+ }
6426
+ if (resettingActionTypes.includes(type)) {
6427
+ return false;
6428
+ }
6429
+ return prev;
6430
+ }, false);
6413
6431
  }
6414
6432
  function isPotentialDuplicate(actions) {
6415
6433
  return actions.reduce((prev, { type }) => {
@@ -6473,8 +6491,7 @@ function resolveEventCustomFlags(event2, eventConfiguration) {
6473
6491
  return (0, import_lodash3.uniq)(flags);
6474
6492
  }, []);
6475
6493
  }
6476
- function getEventFlags(event2, config) {
6477
- const sortedActions = event2.actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
6494
+ function getActionStatusFlags(sortedActions) {
6478
6495
  const actionStatus = sortedActions.reduce(
6479
6496
  (actionStatuses, { type, status: status2 }) => ({
6480
6497
  ...actionStatuses,
@@ -6482,26 +6499,40 @@ function getEventFlags(event2, config) {
6482
6499
  }),
6483
6500
  {}
6484
6501
  );
6485
- const flags = Object.entries(actionStatus).filter(([, status2]) => status2 !== ActionStatus.Accepted).map(([type, status2]) => {
6502
+ return Object.entries(actionStatus).filter(([, status2]) => status2 !== ActionStatus.Accepted).map(([type, status2]) => {
6486
6503
  const flag2 = joinValues([type, status2], ":").toLowerCase();
6487
6504
  return flag2;
6488
6505
  });
6489
- if (isCorrectionRequested(sortedActions)) {
6490
- flags.push(InherentFlags.CORRECTION_REQUESTED);
6506
+ }
6507
+ function getInherentFlags(sortedActions) {
6508
+ const acceptedActions = sortedActions.filter(
6509
+ ({ status: status2 }) => status2 === ActionStatus.Accepted
6510
+ );
6511
+ const inherentFlags = [];
6512
+ if (isCorrectionRequested(acceptedActions)) {
6513
+ inherentFlags.push(InherentFlags.CORRECTION_REQUESTED);
6491
6514
  }
6492
- if (isDeclarationIncomplete(sortedActions)) {
6493
- flags.push(InherentFlags.INCOMPLETE);
6515
+ if (isDeclarationIncomplete(acceptedActions)) {
6516
+ inherentFlags.push(InherentFlags.INCOMPLETE);
6494
6517
  }
6495
- if (isRejected(sortedActions)) {
6496
- flags.push(InherentFlags.REJECTED);
6518
+ if (isRejected(acceptedActions)) {
6519
+ inherentFlags.push(InherentFlags.REJECTED);
6497
6520
  }
6498
- if (isPotentialDuplicate(sortedActions)) {
6499
- flags.push(InherentFlags.POTENTIAL_DUPLICATE);
6521
+ if (isPotentialDuplicate(acceptedActions)) {
6522
+ inherentFlags.push(InherentFlags.POTENTIAL_DUPLICATE);
6500
6523
  }
6501
- if (isEditInProgress(sortedActions)) {
6502
- flags.push(InherentFlags.EDIT_IN_PROGRESS);
6524
+ if (isEditInProgress(acceptedActions)) {
6525
+ inherentFlags.push(InherentFlags.EDIT_IN_PROGRESS);
6503
6526
  }
6504
- return [...flags, ...resolveEventCustomFlags(event2, config)];
6527
+ return inherentFlags;
6528
+ }
6529
+ function getEventFlags(event2, config) {
6530
+ const sortedActions = event2.actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
6531
+ return [
6532
+ ...getActionStatusFlags(sortedActions),
6533
+ ...getInherentFlags(sortedActions),
6534
+ ...resolveEventCustomFlags(event2, config)
6535
+ ];
6505
6536
  }
6506
6537
 
6507
6538
  // ../commons/src/events/state/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "2.0.0-rc.6f77a66",
3
+ "version": "2.0.0-rc.70282f8",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "bin": {