@opencrvs/toolkit 2.0.0-rc.55a319c → 2.0.0-rc.55d8479
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.
|
@@ -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';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Action
|
|
1
|
+
import { Action } from '../ActionDocument';
|
|
2
2
|
import { Flag, CustomFlag } from '../Flag';
|
|
3
3
|
import { EventConfig } from '../EventConfig';
|
|
4
4
|
import { EventDocument } from '../EventDocument';
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function isPotentialDuplicate(actions: Action[]): boolean;
|
|
6
6
|
/**
|
|
7
7
|
* This function resolves custom flags for an event based on its actions.
|
|
8
8
|
* Flags are not stored to the event state or any database directly, instead they are always computed/evaluated from the event actions.
|
package/dist/events/index.js
CHANGED
|
@@ -323,6 +323,7 @@ __export(events_exports, {
|
|
|
323
323
|
getDeclarationFields: () => getDeclarationFields,
|
|
324
324
|
getDeclarationPages: () => getDeclarationPages,
|
|
325
325
|
getEventConfigById: () => getEventConfigById,
|
|
326
|
+
getEventFlags: () => getEventFlags,
|
|
326
327
|
getFilePathsFromEvent: () => getFilePathsFromEvent,
|
|
327
328
|
getLocationHierarchy: () => getLocationHierarchy,
|
|
328
329
|
getMixedPath: () => getMixedPath,
|
|
@@ -385,6 +386,7 @@ __export(events_exports, {
|
|
|
385
386
|
isPageVisible: () => isPageVisible,
|
|
386
387
|
isParagraphFieldType: () => isParagraphFieldType,
|
|
387
388
|
isPhoneFieldType: () => isPhoneFieldType,
|
|
389
|
+
isPotentialDuplicate: () => isPotentialDuplicate,
|
|
388
390
|
isPrintButtonFieldType: () => isPrintButtonFieldType,
|
|
389
391
|
isQrReaderFieldType: () => isQrReaderFieldType,
|
|
390
392
|
isQueryParamReaderFieldType: () => isQueryParamReaderFieldType,
|
|
@@ -418,6 +420,7 @@ __export(events_exports, {
|
|
|
418
420
|
plainDateToLocalDate: () => plainDateToLocalDate,
|
|
419
421
|
precompileActionSchemas: () => precompileActionSchemas,
|
|
420
422
|
resolveDateOfEvent: () => resolveDateOfEvent,
|
|
423
|
+
resolveEventCustomFlags: () => resolveEventCustomFlags,
|
|
421
424
|
resolvePlaceOfEvent: () => resolvePlaceOfEvent,
|
|
422
425
|
runFieldValidations: () => runFieldValidations,
|
|
423
426
|
runStructuralValidations: () => runStructuralValidations,
|
|
@@ -6388,24 +6391,19 @@ var import_date_fns3 = require("date-fns");
|
|
|
6388
6391
|
function isEditInProgress(actions) {
|
|
6389
6392
|
return actions.at(-1)?.type === ActionType.EDIT;
|
|
6390
6393
|
}
|
|
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
6394
|
function isCorrectionRequested(actions) {
|
|
6408
|
-
return
|
|
6395
|
+
return actions.reduce((prev, { type }) => {
|
|
6396
|
+
if (type === ActionType.REQUEST_CORRECTION) {
|
|
6397
|
+
return true;
|
|
6398
|
+
}
|
|
6399
|
+
if (type === ActionType.APPROVE_CORRECTION) {
|
|
6400
|
+
return false;
|
|
6401
|
+
}
|
|
6402
|
+
if (type === ActionType.REJECT_CORRECTION) {
|
|
6403
|
+
return false;
|
|
6404
|
+
}
|
|
6405
|
+
return prev;
|
|
6406
|
+
}, false);
|
|
6409
6407
|
}
|
|
6410
6408
|
function isDeclarationIncomplete(actions) {
|
|
6411
6409
|
return getStatusFromActions(actions) === EventStatus.enum.NOTIFIED;
|
|
Binary file
|
package/package.json
CHANGED
|
Binary file
|