@opencrvs/toolkit 2.0.0-rc.b44df63 → 2.0.0-rc.b4b035e
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.
|
@@ -7374,12 +7374,17 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
7374
7374
|
output: void;
|
|
7375
7375
|
meta: import("trpc-to-openapi").OpenApiMeta;
|
|
7376
7376
|
}>;
|
|
7377
|
-
|
|
7377
|
+
requestEmailChange: import("@trpc/server").TRPCMutationProcedure<{
|
|
7378
7378
|
input: {
|
|
7379
|
-
notificationEvent: "change-email-address";
|
|
7380
7379
|
email: string;
|
|
7381
|
-
}
|
|
7382
|
-
|
|
7380
|
+
};
|
|
7381
|
+
output: {
|
|
7382
|
+
nonce: string;
|
|
7383
|
+
};
|
|
7384
|
+
meta: import("trpc-to-openapi").OpenApiMeta;
|
|
7385
|
+
}>;
|
|
7386
|
+
requestPhoneChange: import("@trpc/server").TRPCMutationProcedure<{
|
|
7387
|
+
input: {
|
|
7383
7388
|
phoneNumber: string;
|
|
7384
7389
|
};
|
|
7385
7390
|
output: {
|
package/dist/events/index.js
CHANGED
|
@@ -6492,6 +6492,8 @@ var updateActions = ActionTypes.extract([
|
|
|
6492
6492
|
ActionType.ARCHIVE,
|
|
6493
6493
|
ActionType.PRINT_CERTIFICATE,
|
|
6494
6494
|
ActionType.REQUEST_CORRECTION,
|
|
6495
|
+
ActionType.APPROVE_CORRECTION,
|
|
6496
|
+
ActionType.REJECT_CORRECTION,
|
|
6495
6497
|
ActionType.CUSTOM
|
|
6496
6498
|
]);
|
|
6497
6499
|
function getActionUpdateMetadata(actions) {
|
|
@@ -6533,9 +6535,6 @@ function getLegalStatuses(actions) {
|
|
|
6533
6535
|
// ../commons/src/events/state/flags.ts
|
|
6534
6536
|
var import_lodash3 = require("lodash");
|
|
6535
6537
|
var import_date_fns3 = require("date-fns");
|
|
6536
|
-
function isEditInProgress(actions) {
|
|
6537
|
-
return actions.at(-1)?.type === ActionType.EDIT;
|
|
6538
|
-
}
|
|
6539
6538
|
function findPendingCorrectionAction(writeActions2) {
|
|
6540
6539
|
let correctionRequestAction;
|
|
6541
6540
|
for (let i = writeActions2.length - 1; i >= 0; i--) {
|
|
@@ -6550,29 +6549,6 @@ function findPendingCorrectionAction(writeActions2) {
|
|
|
6550
6549
|
}
|
|
6551
6550
|
return correctionRequestAction;
|
|
6552
6551
|
}
|
|
6553
|
-
function isCorrectionRequested(actions) {
|
|
6554
|
-
return findPendingCorrectionAction(actions) !== void 0;
|
|
6555
|
-
}
|
|
6556
|
-
function isDeclarationIncomplete(actions) {
|
|
6557
|
-
return getStatusFromActions(actions) === EventStatus.enum.NOTIFIED;
|
|
6558
|
-
}
|
|
6559
|
-
function isRejected(actions) {
|
|
6560
|
-
const resettingActionTypes = [
|
|
6561
|
-
ActionType.NOTIFY,
|
|
6562
|
-
ActionType.DECLARE,
|
|
6563
|
-
ActionType.EDIT,
|
|
6564
|
-
ActionType.REGISTER
|
|
6565
|
-
];
|
|
6566
|
-
return actions.reduce((prev, { type }) => {
|
|
6567
|
-
if (type === ActionType.REJECT) {
|
|
6568
|
-
return true;
|
|
6569
|
-
}
|
|
6570
|
-
if (resettingActionTypes.includes(type)) {
|
|
6571
|
-
return false;
|
|
6572
|
-
}
|
|
6573
|
-
return prev;
|
|
6574
|
-
}, false);
|
|
6575
|
-
}
|
|
6576
6552
|
function isPotentialDuplicate(actions) {
|
|
6577
6553
|
return actions.reduce((prev, { type }) => {
|
|
6578
6554
|
if (type === ActionType.DUPLICATE_DETECTED) {
|
|
@@ -6600,6 +6576,88 @@ function isFlagConditionMet(conditional, form, action) {
|
|
|
6600
6576
|
}
|
|
6601
6577
|
});
|
|
6602
6578
|
}
|
|
6579
|
+
function actionConfigRemovesFlag(action, flagId, actionsUpToAndIncluding, event2, eventConfiguration) {
|
|
6580
|
+
if (!isActionConfigType(action.type)) {
|
|
6581
|
+
return false;
|
|
6582
|
+
}
|
|
6583
|
+
const actionConfig = getActionConfig({
|
|
6584
|
+
eventConfiguration,
|
|
6585
|
+
actionType: action.type,
|
|
6586
|
+
customActionType: "customActionType" in action ? action.customActionType : void 0
|
|
6587
|
+
});
|
|
6588
|
+
const removeOperations = (actionConfig?.flags ?? []).filter(
|
|
6589
|
+
({ id, operation }) => id === flagId && operation === "remove"
|
|
6590
|
+
);
|
|
6591
|
+
if (removeOperations.length === 0) {
|
|
6592
|
+
return false;
|
|
6593
|
+
}
|
|
6594
|
+
const eventUpToThisAction = { ...event2, actions: actionsUpToAndIncluding };
|
|
6595
|
+
const declaration = aggregateActionDeclarations(eventUpToThisAction);
|
|
6596
|
+
const annotation = aggregateActionAnnotations(eventUpToThisAction);
|
|
6597
|
+
const form = { ...declaration, ...annotation };
|
|
6598
|
+
return removeOperations.some(
|
|
6599
|
+
({ conditional }) => conditional ? isFlagConditionMet(conditional, form, action) : true
|
|
6600
|
+
);
|
|
6601
|
+
}
|
|
6602
|
+
var INHERENT_FLAG_RULES = [
|
|
6603
|
+
{
|
|
6604
|
+
flag: InherentFlags.CORRECTION_REQUESTED,
|
|
6605
|
+
setOn: [ActionType.REQUEST_CORRECTION],
|
|
6606
|
+
resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
|
|
6607
|
+
},
|
|
6608
|
+
{
|
|
6609
|
+
// INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
|
|
6610
|
+
// other status-changing action (see getStatusFromActions).
|
|
6611
|
+
flag: InherentFlags.INCOMPLETE,
|
|
6612
|
+
setOn: [ActionType.NOTIFY],
|
|
6613
|
+
resetOn: [
|
|
6614
|
+
ActionType.CREATE,
|
|
6615
|
+
ActionType.DECLARE,
|
|
6616
|
+
ActionType.REGISTER,
|
|
6617
|
+
ActionType.ARCHIVE
|
|
6618
|
+
]
|
|
6619
|
+
},
|
|
6620
|
+
{
|
|
6621
|
+
flag: InherentFlags.REJECTED,
|
|
6622
|
+
setOn: [ActionType.REJECT],
|
|
6623
|
+
resetOn: [
|
|
6624
|
+
ActionType.NOTIFY,
|
|
6625
|
+
ActionType.DECLARE,
|
|
6626
|
+
ActionType.EDIT,
|
|
6627
|
+
ActionType.REGISTER
|
|
6628
|
+
]
|
|
6629
|
+
},
|
|
6630
|
+
{
|
|
6631
|
+
flag: InherentFlags.POTENTIAL_DUPLICATE,
|
|
6632
|
+
setOn: [ActionType.DUPLICATE_DETECTED],
|
|
6633
|
+
resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
|
|
6634
|
+
},
|
|
6635
|
+
{
|
|
6636
|
+
flag: InherentFlags.EDIT_IN_PROGRESS,
|
|
6637
|
+
setOn: [ActionType.EDIT],
|
|
6638
|
+
resetOnAnyOtherAction: true
|
|
6639
|
+
}
|
|
6640
|
+
];
|
|
6641
|
+
function resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration) {
|
|
6642
|
+
return acceptedActions.reduce((present, action, idx) => {
|
|
6643
|
+
if (rule.setOn.includes(action.type)) {
|
|
6644
|
+
return true;
|
|
6645
|
+
}
|
|
6646
|
+
if (rule.resetOnAnyOtherAction || (rule.resetOn ?? []).includes(action.type)) {
|
|
6647
|
+
return false;
|
|
6648
|
+
}
|
|
6649
|
+
if (actionConfigRemovesFlag(
|
|
6650
|
+
action,
|
|
6651
|
+
rule.flag,
|
|
6652
|
+
acceptedActions.slice(0, idx + 1),
|
|
6653
|
+
event2,
|
|
6654
|
+
eventConfiguration
|
|
6655
|
+
)) {
|
|
6656
|
+
return false;
|
|
6657
|
+
}
|
|
6658
|
+
return present;
|
|
6659
|
+
}, false);
|
|
6660
|
+
}
|
|
6603
6661
|
function resolveEventCustomFlags(event2, eventConfiguration) {
|
|
6604
6662
|
const actions = getAcceptedActions(event2).filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
6605
6663
|
return actions.reduce((acc, action, idx) => {
|
|
@@ -6648,33 +6706,19 @@ function getActionStatusFlags(sortedActions) {
|
|
|
6648
6706
|
return flag2;
|
|
6649
6707
|
});
|
|
6650
6708
|
}
|
|
6651
|
-
function getInherentFlags(sortedActions) {
|
|
6709
|
+
function getInherentFlags(sortedActions, event2, eventConfiguration) {
|
|
6652
6710
|
const acceptedActions = sortedActions.filter(
|
|
6653
6711
|
({ status: status2 }) => status2 === ActionStatus.Accepted
|
|
6654
6712
|
);
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
}
|
|
6659
|
-
if (isDeclarationIncomplete(acceptedActions)) {
|
|
6660
|
-
inherentFlags.push(InherentFlags.INCOMPLETE);
|
|
6661
|
-
}
|
|
6662
|
-
if (isRejected(acceptedActions)) {
|
|
6663
|
-
inherentFlags.push(InherentFlags.REJECTED);
|
|
6664
|
-
}
|
|
6665
|
-
if (isPotentialDuplicate(acceptedActions)) {
|
|
6666
|
-
inherentFlags.push(InherentFlags.POTENTIAL_DUPLICATE);
|
|
6667
|
-
}
|
|
6668
|
-
if (isEditInProgress(acceptedActions)) {
|
|
6669
|
-
inherentFlags.push(InherentFlags.EDIT_IN_PROGRESS);
|
|
6670
|
-
}
|
|
6671
|
-
return inherentFlags;
|
|
6713
|
+
return INHERENT_FLAG_RULES.filter(
|
|
6714
|
+
(rule) => resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration)
|
|
6715
|
+
).map(({ flag: flag2 }) => flag2);
|
|
6672
6716
|
}
|
|
6673
6717
|
function getEventFlags(event2, config) {
|
|
6674
6718
|
const sortedActions = event2.actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
6675
6719
|
return [
|
|
6676
6720
|
...getActionStatusFlags(sortedActions),
|
|
6677
|
-
...getInherentFlags(sortedActions),
|
|
6721
|
+
...getInherentFlags(sortedActions, event2, config),
|
|
6678
6722
|
...resolveEventCustomFlags(event2, config)
|
|
6679
6723
|
];
|
|
6680
6724
|
}
|
|
@@ -7679,6 +7723,11 @@ var TENNIS_CLUB_DECLARATION_REVIEW = {
|
|
|
7679
7723
|
id: "signature.upload.modal.title",
|
|
7680
7724
|
defaultMessage: "Draw signature",
|
|
7681
7725
|
description: "Title for the modal to draw signature"
|
|
7726
|
+
},
|
|
7727
|
+
// Zod applies the schema default at parse time, but this fixture bypasses
|
|
7728
|
+
// parsing — GeneratedInputField accesses configuration.maxFileSize directly.
|
|
7729
|
+
configuration: {
|
|
7730
|
+
maxFileSize: 5 * 1024 * 1024
|
|
7682
7731
|
}
|
|
7683
7732
|
}
|
|
7684
7733
|
]
|
|
@@ -10235,7 +10284,7 @@ function matchesJurisdictionFilter(locationIds, filter, user2) {
|
|
|
10235
10284
|
return locationIds.some((id) => id === user2.primaryOfficeId);
|
|
10236
10285
|
}
|
|
10237
10286
|
if (filter === JurisdictionFilter.enum.administrativeArea) {
|
|
10238
|
-
return user2.administrativeAreaId
|
|
10287
|
+
return !user2.administrativeAreaId || locationIds.some((id) => id === user2.administrativeAreaId);
|
|
10239
10288
|
}
|
|
10240
10289
|
return true;
|
|
10241
10290
|
}
|
|
@@ -10324,7 +10373,7 @@ function canAccessUserWithScope({
|
|
|
10324
10373
|
}
|
|
10325
10374
|
const hasAdministrativeAreaInHierarchy = userToAccess.administrativeHierarchy.some(
|
|
10326
10375
|
(id) => user2.administrativeAreaId === id
|
|
10327
|
-
) || user2.administrativeAreaId
|
|
10376
|
+
) || !user2.administrativeAreaId;
|
|
10328
10377
|
if (opts?.accessLevel === JurisdictionFilter.enum.administrativeArea && !hasAdministrativeAreaInHierarchy) {
|
|
10329
10378
|
return false;
|
|
10330
10379
|
}
|
|
@@ -4703,12 +4703,53 @@ var updateActions = ActionTypes.extract([
|
|
|
4703
4703
|
ActionType.ARCHIVE,
|
|
4704
4704
|
ActionType.PRINT_CERTIFICATE,
|
|
4705
4705
|
ActionType.REQUEST_CORRECTION,
|
|
4706
|
+
ActionType.APPROVE_CORRECTION,
|
|
4707
|
+
ActionType.REJECT_CORRECTION,
|
|
4706
4708
|
ActionType.CUSTOM
|
|
4707
4709
|
]);
|
|
4708
4710
|
|
|
4709
4711
|
// ../commons/src/events/state/flags.ts
|
|
4710
4712
|
var import_lodash3 = require("lodash");
|
|
4711
4713
|
var import_date_fns3 = require("date-fns");
|
|
4714
|
+
var INHERENT_FLAG_RULES = [
|
|
4715
|
+
{
|
|
4716
|
+
flag: InherentFlags.CORRECTION_REQUESTED,
|
|
4717
|
+
setOn: [ActionType.REQUEST_CORRECTION],
|
|
4718
|
+
resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
|
|
4719
|
+
},
|
|
4720
|
+
{
|
|
4721
|
+
// INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
|
|
4722
|
+
// other status-changing action (see getStatusFromActions).
|
|
4723
|
+
flag: InherentFlags.INCOMPLETE,
|
|
4724
|
+
setOn: [ActionType.NOTIFY],
|
|
4725
|
+
resetOn: [
|
|
4726
|
+
ActionType.CREATE,
|
|
4727
|
+
ActionType.DECLARE,
|
|
4728
|
+
ActionType.REGISTER,
|
|
4729
|
+
ActionType.ARCHIVE
|
|
4730
|
+
]
|
|
4731
|
+
},
|
|
4732
|
+
{
|
|
4733
|
+
flag: InherentFlags.REJECTED,
|
|
4734
|
+
setOn: [ActionType.REJECT],
|
|
4735
|
+
resetOn: [
|
|
4736
|
+
ActionType.NOTIFY,
|
|
4737
|
+
ActionType.DECLARE,
|
|
4738
|
+
ActionType.EDIT,
|
|
4739
|
+
ActionType.REGISTER
|
|
4740
|
+
]
|
|
4741
|
+
},
|
|
4742
|
+
{
|
|
4743
|
+
flag: InherentFlags.POTENTIAL_DUPLICATE,
|
|
4744
|
+
setOn: [ActionType.DUPLICATE_DETECTED],
|
|
4745
|
+
resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
|
|
4746
|
+
},
|
|
4747
|
+
{
|
|
4748
|
+
flag: InherentFlags.EDIT_IN_PROGRESS,
|
|
4749
|
+
setOn: [ActionType.EDIT],
|
|
4750
|
+
resetOnAnyOtherAction: true
|
|
4751
|
+
}
|
|
4752
|
+
];
|
|
4712
4753
|
|
|
4713
4754
|
// ../commons/src/events/defineConfig.ts
|
|
4714
4755
|
var IGNORED_EVENT_TYPES = [
|
|
@@ -5454,6 +5495,11 @@ var TENNIS_CLUB_DECLARATION_REVIEW = {
|
|
|
5454
5495
|
id: "signature.upload.modal.title",
|
|
5455
5496
|
defaultMessage: "Draw signature",
|
|
5456
5497
|
description: "Title for the modal to draw signature"
|
|
5498
|
+
},
|
|
5499
|
+
// Zod applies the schema default at parse time, but this fixture bypasses
|
|
5500
|
+
// parsing — GeneratedInputField accesses configuration.maxFileSize directly.
|
|
5501
|
+
configuration: {
|
|
5502
|
+
maxFileSize: 5 * 1024 * 1024
|
|
5457
5503
|
}
|
|
5458
5504
|
}
|
|
5459
5505
|
]
|
|
Binary file
|
package/package.json
CHANGED
|
Binary file
|