@opencrvs/toolkit 2.0.0-rc.fd53d03 → 2.0.0-rc.fd79e2e
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.
- package/dist/application-config/index.js +9 -2
- package/dist/cli.js +1 -1
- package/dist/commons/api/router.d.ts +13 -2
- package/dist/commons/events/ActionConfig.d.ts +230 -2
- package/dist/commons/events/CountryConfigQueryInput.d.ts +42 -0
- package/dist/commons/events/EventIndex.d.ts +14 -0
- package/dist/commons/events/FieldConfig.d.ts +1 -0
- package/dist/commons/events/FieldType.d.ts +1 -0
- package/dist/commons/events/FieldTypeMapping.d.ts +1 -1
- package/dist/commons/events/WorkqueueConfig.d.ts +39 -0
- package/dist/events/index.js +239 -68
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.js +1 -1
- package/dist/migrations/v2.0/index.js +1 -1
- package/dist/notification/index.js +182 -6
- package/opencrvs-toolkit-2.0.0-rc.fd79e2e.tgz +0 -0
- package/package.json +1 -1
- package/opencrvs-toolkit-2.0.0-rc.fd53d03.tgz +0 -0
package/dist/events/index.js
CHANGED
|
@@ -151,6 +151,7 @@ __export(events_exports, {
|
|
|
151
151
|
FormPageConfig: () => FormPageConfig,
|
|
152
152
|
Fuzzy: () => Fuzzy,
|
|
153
153
|
GeographicalArea: () => GeographicalArea,
|
|
154
|
+
HiddenFieldTypes: () => HiddenFieldTypes,
|
|
154
155
|
HiddenFieldValue: () => HiddenFieldValue,
|
|
155
156
|
HttpFieldUpdateValue: () => HttpFieldUpdateValue,
|
|
156
157
|
HttpFieldValue: () => HttpFieldValue,
|
|
@@ -1219,6 +1220,11 @@ var FieldTypesToHideInReview = [
|
|
|
1219
1220
|
FieldType.ALPHA_PRINT_BUTTON,
|
|
1220
1221
|
FieldType.ALPHA_HIDDEN
|
|
1221
1222
|
];
|
|
1223
|
+
var HiddenFieldTypes = [
|
|
1224
|
+
FieldType.HTTP,
|
|
1225
|
+
FieldType.QUERY_PARAM_READER,
|
|
1226
|
+
FieldType.ALPHA_HIDDEN
|
|
1227
|
+
];
|
|
1222
1228
|
|
|
1223
1229
|
// ../commons/src/events/FieldValue.ts
|
|
1224
1230
|
var z12 = __toESM(require("zod/v4"));
|
|
@@ -1345,7 +1351,7 @@ function plainDateToLocalDate(date) {
|
|
|
1345
1351
|
// ../commons/src/events/FieldValue.ts
|
|
1346
1352
|
var TextValue = z12.string();
|
|
1347
1353
|
var HiddenFieldValue = z12.string();
|
|
1348
|
-
var NonEmptyTextValue =
|
|
1354
|
+
var NonEmptyTextValue = z12.string().trim().min(1);
|
|
1349
1355
|
var DateValue = z12.iso.date().describe("Date in the format YYYY-MM-DD");
|
|
1350
1356
|
var AgeValue = z12.object({
|
|
1351
1357
|
age: z12.number(),
|
|
@@ -2017,7 +2023,8 @@ var Range = import_v4.z.object({
|
|
|
2017
2023
|
});
|
|
2018
2024
|
var ContainsFlags = import_v4.z.object({
|
|
2019
2025
|
anyOf: import_v4.z.array(Flag).optional(),
|
|
2020
|
-
noneOf: import_v4.z.array(Flag).optional()
|
|
2026
|
+
noneOf: import_v4.z.array(Flag).optional(),
|
|
2027
|
+
allOf: import_v4.z.array(Flag).optional()
|
|
2021
2028
|
}).meta({
|
|
2022
2029
|
id: "ContainsFlags"
|
|
2023
2030
|
});
|
|
@@ -2292,6 +2299,7 @@ var NumberField = BaseField.extend({
|
|
|
2292
2299
|
configuration: import_v43.default.object({
|
|
2293
2300
|
min: import_v43.default.number().optional().describe("Minimum value"),
|
|
2294
2301
|
max: import_v43.default.number().optional().describe("Maximum value"),
|
|
2302
|
+
integer: import_v43.default.boolean().optional().describe("When true, only whole numbers are allowed"),
|
|
2295
2303
|
prefix: TranslationConfig.optional(),
|
|
2296
2304
|
postfix: TranslationConfig.optional()
|
|
2297
2305
|
}).optional()
|
|
@@ -3215,6 +3223,51 @@ var ReadActionConfig = ActionConfigBase.extend(
|
|
|
3215
3223
|
conditionals: z24.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
|
|
3216
3224
|
}).shape
|
|
3217
3225
|
);
|
|
3226
|
+
var NotifyConfig = ActionConfigBase.extend(
|
|
3227
|
+
z24.object({
|
|
3228
|
+
type: z24.literal(ActionType.NOTIFY)
|
|
3229
|
+
}).shape
|
|
3230
|
+
);
|
|
3231
|
+
var DuplicateDetectedConfig = ActionConfigBase.extend(
|
|
3232
|
+
z24.object({
|
|
3233
|
+
type: z24.literal(ActionType.DUPLICATE_DETECTED),
|
|
3234
|
+
label: z24.never().optional().describe(
|
|
3235
|
+
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no label."
|
|
3236
|
+
),
|
|
3237
|
+
supportingCopy: z24.never().optional(),
|
|
3238
|
+
icon: z24.never().optional().describe(
|
|
3239
|
+
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no icon."
|
|
3240
|
+
),
|
|
3241
|
+
conditionals: z24.never().optional().describe(
|
|
3242
|
+
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it cannot be disabled or hidden with conditionals."
|
|
3243
|
+
)
|
|
3244
|
+
}).shape
|
|
3245
|
+
);
|
|
3246
|
+
var MarkAsDuplicateConfig = ActionConfigBase.extend(
|
|
3247
|
+
z24.object({
|
|
3248
|
+
type: z24.literal(ActionType.MARK_AS_DUPLICATE)
|
|
3249
|
+
}).shape
|
|
3250
|
+
);
|
|
3251
|
+
var MarkAsNotDuplicateConfig = ActionConfigBase.extend(
|
|
3252
|
+
z24.object({
|
|
3253
|
+
type: z24.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
3254
|
+
}).shape
|
|
3255
|
+
);
|
|
3256
|
+
var AssignConfig = ActionConfigBase.extend(
|
|
3257
|
+
z24.object({
|
|
3258
|
+
type: z24.literal(ActionType.ASSIGN)
|
|
3259
|
+
}).shape
|
|
3260
|
+
);
|
|
3261
|
+
var UnassignConfig = ActionConfigBase.extend(
|
|
3262
|
+
z24.object({
|
|
3263
|
+
type: z24.literal(ActionType.UNASSIGN)
|
|
3264
|
+
}).shape
|
|
3265
|
+
);
|
|
3266
|
+
var DeleteConfig = ActionConfigBase.extend(
|
|
3267
|
+
z24.object({
|
|
3268
|
+
type: z24.literal(ActionType.DELETE)
|
|
3269
|
+
}).shape
|
|
3270
|
+
);
|
|
3218
3271
|
var DeclareConfig = DeclarationActionBase.extend(
|
|
3219
3272
|
z24.object({
|
|
3220
3273
|
type: z24.literal(ActionType.DECLARE),
|
|
@@ -3277,7 +3330,17 @@ var RequestCorrectionConfig = ActionConfigBase.extend(
|
|
|
3277
3330
|
correctionForm: ActionFormConfig
|
|
3278
3331
|
}).shape
|
|
3279
3332
|
);
|
|
3280
|
-
var
|
|
3333
|
+
var ApproveCorrectionConfig = ActionConfigBase.extend(
|
|
3334
|
+
z24.object({
|
|
3335
|
+
type: z24.literal(ActionType.APPROVE_CORRECTION)
|
|
3336
|
+
}).shape
|
|
3337
|
+
);
|
|
3338
|
+
var RejectCorrectionConfig = ActionConfigBase.extend(
|
|
3339
|
+
z24.object({
|
|
3340
|
+
type: z24.literal(ActionType.REJECT_CORRECTION)
|
|
3341
|
+
}).shape
|
|
3342
|
+
);
|
|
3343
|
+
var CustomActionConfig = ActionConfigBase.extend(
|
|
3281
3344
|
z24.object({
|
|
3282
3345
|
type: z24.literal(ActionType.CUSTOM),
|
|
3283
3346
|
customActionType: z24.string().describe("Type identifier of the custom action."),
|
|
@@ -3288,7 +3351,7 @@ var CustomActionConfig = ActionConfigBase.merge(
|
|
|
3288
3351
|
auditHistoryLabel: TranslationConfig.describe(
|
|
3289
3352
|
'The label to show in audit history for this action. For example "Approved".'
|
|
3290
3353
|
)
|
|
3291
|
-
})
|
|
3354
|
+
}).shape
|
|
3292
3355
|
);
|
|
3293
3356
|
var ActionConfig = z24.discriminatedUnion("type", [
|
|
3294
3357
|
/*
|
|
@@ -3299,9 +3362,37 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3299
3362
|
id: "ReadActionConfig",
|
|
3300
3363
|
description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
|
|
3301
3364
|
}),
|
|
3365
|
+
AssignConfig.meta({
|
|
3366
|
+
id: "AssignActionConfig",
|
|
3367
|
+
description: "Configuration for assigning a record to the current user."
|
|
3368
|
+
}),
|
|
3369
|
+
UnassignConfig.meta({
|
|
3370
|
+
id: "UnassignActionConfig",
|
|
3371
|
+
description: "Configuration for unassigning a record from its current assignee."
|
|
3372
|
+
}),
|
|
3373
|
+
DeleteConfig.meta({
|
|
3374
|
+
id: "DeleteActionConfig",
|
|
3375
|
+
description: "Configuration for deleting a draft record."
|
|
3376
|
+
}),
|
|
3377
|
+
NotifyConfig.meta({
|
|
3378
|
+
id: "NotifyActionConfig",
|
|
3379
|
+
description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
|
|
3380
|
+
}),
|
|
3302
3381
|
DeclareConfig.meta({
|
|
3303
3382
|
id: "DeclareActionConfig",
|
|
3304
|
-
description: "Configuration for the declare action. Includes review-page fields.
|
|
3383
|
+
description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
|
|
3384
|
+
}),
|
|
3385
|
+
DuplicateDetectedConfig.meta({
|
|
3386
|
+
id: "DuplicateDetectedActionConfig",
|
|
3387
|
+
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."
|
|
3388
|
+
}),
|
|
3389
|
+
MarkAsDuplicateConfig.meta({
|
|
3390
|
+
id: "MarkAsDuplicateActionConfig",
|
|
3391
|
+
description: "Configuration for marking a record as a duplicate."
|
|
3392
|
+
}),
|
|
3393
|
+
MarkAsNotDuplicateConfig.meta({
|
|
3394
|
+
id: "MarkAsNotDuplicateActionConfig",
|
|
3395
|
+
description: "Configuration for marking a record as not a duplicate, after it was previously flagged as one."
|
|
3305
3396
|
}),
|
|
3306
3397
|
RejectConfig.meta({
|
|
3307
3398
|
id: "RejectActionConfig",
|
|
@@ -3319,6 +3410,14 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3319
3410
|
id: "RequestCorrectionActionConfig",
|
|
3320
3411
|
description: "Configuration for requesting a correction on a registered record."
|
|
3321
3412
|
}),
|
|
3413
|
+
ApproveCorrectionConfig.meta({
|
|
3414
|
+
id: "ApproveCorrectionActionConfig",
|
|
3415
|
+
description: "Configuration for approving a requested correction."
|
|
3416
|
+
}),
|
|
3417
|
+
RejectCorrectionConfig.meta({
|
|
3418
|
+
id: "RejectCorrectionActionConfig",
|
|
3419
|
+
description: "Configuration for rejecting a requested correction."
|
|
3420
|
+
}),
|
|
3322
3421
|
EditActionConfig.meta({
|
|
3323
3422
|
id: "EditActionConfig",
|
|
3324
3423
|
description: "Configuration for editing a record before registration."
|
|
@@ -3908,7 +4007,7 @@ var isHiddenFieldType = (field3) => {
|
|
|
3908
4007
|
return field3.config.type === FieldType.ALPHA_HIDDEN;
|
|
3909
4008
|
};
|
|
3910
4009
|
var isNonInteractiveFieldType = (field3) => {
|
|
3911
|
-
return field3.type === FieldType.DIVIDER || field3.type === FieldType.PAGE_HEADER || field3.type === FieldType.PARAGRAPH || field3.type === FieldType.HEADING || field3.type === FieldType.BULLET_LIST || field3.type === FieldType.DATA || field3.type === FieldType.ALPHA_PRINT_BUTTON || field3.type === FieldType.
|
|
4010
|
+
return field3.type === FieldType.DIVIDER || field3.type === FieldType.PAGE_HEADER || field3.type === FieldType.PARAGRAPH || field3.type === FieldType.HEADING || field3.type === FieldType.BULLET_LIST || field3.type === FieldType.DATA || field3.type === FieldType.ALPHA_PRINT_BUTTON || field3.type === FieldType.LINK_BUTTON || field3.type === FieldType.LOADER;
|
|
3912
4011
|
};
|
|
3913
4012
|
|
|
3914
4013
|
// ../commons/src/conditionals/validate.ts
|
|
@@ -4470,16 +4569,13 @@ function getActionConfig({
|
|
|
4470
4569
|
actionType,
|
|
4471
4570
|
customActionType
|
|
4472
4571
|
}) {
|
|
4572
|
+
if (actionType === ActionType.NOTIFY) {
|
|
4573
|
+
return eventConfiguration.actions.find((a) => a.type === ActionType.NOTIFY) ?? eventConfiguration.actions.find((a) => a.type === ActionType.DECLARE);
|
|
4574
|
+
}
|
|
4473
4575
|
return eventConfiguration.actions.find((a) => {
|
|
4474
4576
|
if (a.type === ActionType.CUSTOM && customActionType) {
|
|
4475
4577
|
return a.customActionType === customActionType;
|
|
4476
4578
|
}
|
|
4477
|
-
if (actionType === ActionType.NOTIFY) {
|
|
4478
|
-
return a.type === ActionType.DECLARE;
|
|
4479
|
-
}
|
|
4480
|
-
if (actionType === ActionType.APPROVE_CORRECTION || actionType === ActionType.REJECT_CORRECTION) {
|
|
4481
|
-
return a.type === ActionType.REQUEST_CORRECTION;
|
|
4482
|
-
}
|
|
4483
4579
|
return a.type === actionType;
|
|
4484
4580
|
});
|
|
4485
4581
|
}
|
|
@@ -4513,7 +4609,7 @@ var getActionAnnotationFields = (actionConfig) => {
|
|
|
4513
4609
|
if (actionConfig.type === ActionType.CUSTOM) {
|
|
4514
4610
|
return actionConfig.form;
|
|
4515
4611
|
}
|
|
4516
|
-
if ("review" in actionConfig) {
|
|
4612
|
+
if ("review" in actionConfig && actionConfig.review != null) {
|
|
4517
4613
|
return actionConfig.review.fields;
|
|
4518
4614
|
}
|
|
4519
4615
|
return [];
|
|
@@ -6485,6 +6581,8 @@ var updateActions = ActionTypes.extract([
|
|
|
6485
6581
|
ActionType.ARCHIVE,
|
|
6486
6582
|
ActionType.PRINT_CERTIFICATE,
|
|
6487
6583
|
ActionType.REQUEST_CORRECTION,
|
|
6584
|
+
ActionType.APPROVE_CORRECTION,
|
|
6585
|
+
ActionType.REJECT_CORRECTION,
|
|
6488
6586
|
ActionType.CUSTOM
|
|
6489
6587
|
]);
|
|
6490
6588
|
function getActionUpdateMetadata(actions) {
|
|
@@ -6526,9 +6624,6 @@ function getLegalStatuses(actions) {
|
|
|
6526
6624
|
// ../commons/src/events/state/flags.ts
|
|
6527
6625
|
var import_lodash3 = require("lodash");
|
|
6528
6626
|
var import_date_fns3 = require("date-fns");
|
|
6529
|
-
function isEditInProgress(actions) {
|
|
6530
|
-
return actions.at(-1)?.type === ActionType.EDIT;
|
|
6531
|
-
}
|
|
6532
6627
|
function findPendingCorrectionAction(writeActions2) {
|
|
6533
6628
|
let correctionRequestAction;
|
|
6534
6629
|
for (let i = writeActions2.length - 1; i >= 0; i--) {
|
|
@@ -6543,29 +6638,6 @@ function findPendingCorrectionAction(writeActions2) {
|
|
|
6543
6638
|
}
|
|
6544
6639
|
return correctionRequestAction;
|
|
6545
6640
|
}
|
|
6546
|
-
function isCorrectionRequested(actions) {
|
|
6547
|
-
return findPendingCorrectionAction(actions) !== void 0;
|
|
6548
|
-
}
|
|
6549
|
-
function isDeclarationIncomplete(actions) {
|
|
6550
|
-
return getStatusFromActions(actions) === EventStatus.enum.NOTIFIED;
|
|
6551
|
-
}
|
|
6552
|
-
function isRejected(actions) {
|
|
6553
|
-
const resettingActionTypes = [
|
|
6554
|
-
ActionType.NOTIFY,
|
|
6555
|
-
ActionType.DECLARE,
|
|
6556
|
-
ActionType.EDIT,
|
|
6557
|
-
ActionType.REGISTER
|
|
6558
|
-
];
|
|
6559
|
-
return actions.reduce((prev, { type }) => {
|
|
6560
|
-
if (type === ActionType.REJECT) {
|
|
6561
|
-
return true;
|
|
6562
|
-
}
|
|
6563
|
-
if (resettingActionTypes.includes(type)) {
|
|
6564
|
-
return false;
|
|
6565
|
-
}
|
|
6566
|
-
return prev;
|
|
6567
|
-
}, false);
|
|
6568
|
-
}
|
|
6569
6641
|
function isPotentialDuplicate(actions) {
|
|
6570
6642
|
return actions.reduce((prev, { type }) => {
|
|
6571
6643
|
if (type === ActionType.DUPLICATE_DETECTED) {
|
|
@@ -6593,6 +6665,88 @@ function isFlagConditionMet(conditional, form, action) {
|
|
|
6593
6665
|
}
|
|
6594
6666
|
});
|
|
6595
6667
|
}
|
|
6668
|
+
function actionConfigRemovesFlag(action, flagId, actionsUpToAndIncluding, event2, eventConfiguration) {
|
|
6669
|
+
if (!isActionConfigType(action.type)) {
|
|
6670
|
+
return false;
|
|
6671
|
+
}
|
|
6672
|
+
const actionConfig = getActionConfig({
|
|
6673
|
+
eventConfiguration,
|
|
6674
|
+
actionType: action.type,
|
|
6675
|
+
customActionType: "customActionType" in action ? action.customActionType : void 0
|
|
6676
|
+
});
|
|
6677
|
+
const removeOperations = (actionConfig?.flags ?? []).filter(
|
|
6678
|
+
({ id, operation }) => id === flagId && operation === "remove"
|
|
6679
|
+
);
|
|
6680
|
+
if (removeOperations.length === 0) {
|
|
6681
|
+
return false;
|
|
6682
|
+
}
|
|
6683
|
+
const eventUpToThisAction = { ...event2, actions: actionsUpToAndIncluding };
|
|
6684
|
+
const declaration = aggregateActionDeclarations(eventUpToThisAction);
|
|
6685
|
+
const annotation = aggregateActionAnnotations(eventUpToThisAction);
|
|
6686
|
+
const form = { ...declaration, ...annotation };
|
|
6687
|
+
return removeOperations.some(
|
|
6688
|
+
({ conditional }) => conditional ? isFlagConditionMet(conditional, form, action) : true
|
|
6689
|
+
);
|
|
6690
|
+
}
|
|
6691
|
+
var INHERENT_FLAG_RULES = [
|
|
6692
|
+
{
|
|
6693
|
+
flag: InherentFlags.CORRECTION_REQUESTED,
|
|
6694
|
+
setOn: [ActionType.REQUEST_CORRECTION],
|
|
6695
|
+
resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
|
|
6696
|
+
},
|
|
6697
|
+
{
|
|
6698
|
+
// INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
|
|
6699
|
+
// other status-changing action (see getStatusFromActions).
|
|
6700
|
+
flag: InherentFlags.INCOMPLETE,
|
|
6701
|
+
setOn: [ActionType.NOTIFY],
|
|
6702
|
+
resetOn: [
|
|
6703
|
+
ActionType.CREATE,
|
|
6704
|
+
ActionType.DECLARE,
|
|
6705
|
+
ActionType.REGISTER,
|
|
6706
|
+
ActionType.ARCHIVE
|
|
6707
|
+
]
|
|
6708
|
+
},
|
|
6709
|
+
{
|
|
6710
|
+
flag: InherentFlags.REJECTED,
|
|
6711
|
+
setOn: [ActionType.REJECT],
|
|
6712
|
+
resetOn: [
|
|
6713
|
+
ActionType.NOTIFY,
|
|
6714
|
+
ActionType.DECLARE,
|
|
6715
|
+
ActionType.EDIT,
|
|
6716
|
+
ActionType.REGISTER
|
|
6717
|
+
]
|
|
6718
|
+
},
|
|
6719
|
+
{
|
|
6720
|
+
flag: InherentFlags.POTENTIAL_DUPLICATE,
|
|
6721
|
+
setOn: [ActionType.DUPLICATE_DETECTED],
|
|
6722
|
+
resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
|
|
6723
|
+
},
|
|
6724
|
+
{
|
|
6725
|
+
flag: InherentFlags.EDIT_IN_PROGRESS,
|
|
6726
|
+
setOn: [ActionType.EDIT],
|
|
6727
|
+
resetOnAnyOtherAction: true
|
|
6728
|
+
}
|
|
6729
|
+
];
|
|
6730
|
+
function resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration) {
|
|
6731
|
+
return acceptedActions.reduce((present, action, idx) => {
|
|
6732
|
+
if (rule.setOn.includes(action.type)) {
|
|
6733
|
+
return true;
|
|
6734
|
+
}
|
|
6735
|
+
if (rule.resetOnAnyOtherAction || (rule.resetOn ?? []).includes(action.type)) {
|
|
6736
|
+
return false;
|
|
6737
|
+
}
|
|
6738
|
+
if (actionConfigRemovesFlag(
|
|
6739
|
+
action,
|
|
6740
|
+
rule.flag,
|
|
6741
|
+
acceptedActions.slice(0, idx + 1),
|
|
6742
|
+
event2,
|
|
6743
|
+
eventConfiguration
|
|
6744
|
+
)) {
|
|
6745
|
+
return false;
|
|
6746
|
+
}
|
|
6747
|
+
return present;
|
|
6748
|
+
}, false);
|
|
6749
|
+
}
|
|
6596
6750
|
function resolveEventCustomFlags(event2, eventConfiguration) {
|
|
6597
6751
|
const actions = getAcceptedActions(event2).filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
6598
6752
|
return actions.reduce((acc, action, idx) => {
|
|
@@ -6641,33 +6795,19 @@ function getActionStatusFlags(sortedActions) {
|
|
|
6641
6795
|
return flag2;
|
|
6642
6796
|
});
|
|
6643
6797
|
}
|
|
6644
|
-
function getInherentFlags(sortedActions) {
|
|
6798
|
+
function getInherentFlags(sortedActions, event2, eventConfiguration) {
|
|
6645
6799
|
const acceptedActions = sortedActions.filter(
|
|
6646
6800
|
({ status: status2 }) => status2 === ActionStatus.Accepted
|
|
6647
6801
|
);
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
}
|
|
6652
|
-
if (isDeclarationIncomplete(acceptedActions)) {
|
|
6653
|
-
inherentFlags.push(InherentFlags.INCOMPLETE);
|
|
6654
|
-
}
|
|
6655
|
-
if (isRejected(acceptedActions)) {
|
|
6656
|
-
inherentFlags.push(InherentFlags.REJECTED);
|
|
6657
|
-
}
|
|
6658
|
-
if (isPotentialDuplicate(acceptedActions)) {
|
|
6659
|
-
inherentFlags.push(InherentFlags.POTENTIAL_DUPLICATE);
|
|
6660
|
-
}
|
|
6661
|
-
if (isEditInProgress(acceptedActions)) {
|
|
6662
|
-
inherentFlags.push(InherentFlags.EDIT_IN_PROGRESS);
|
|
6663
|
-
}
|
|
6664
|
-
return inherentFlags;
|
|
6802
|
+
return INHERENT_FLAG_RULES.filter(
|
|
6803
|
+
(rule) => resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration)
|
|
6804
|
+
).map(({ flag: flag2 }) => flag2);
|
|
6665
6805
|
}
|
|
6666
6806
|
function getEventFlags(event2, config) {
|
|
6667
6807
|
const sortedActions = event2.actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
6668
6808
|
return [
|
|
6669
6809
|
...getActionStatusFlags(sortedActions),
|
|
6670
|
-
...getInherentFlags(sortedActions),
|
|
6810
|
+
...getInherentFlags(sortedActions, event2, config),
|
|
6671
6811
|
...resolveEventCustomFlags(event2, config)
|
|
6672
6812
|
];
|
|
6673
6813
|
}
|
|
@@ -7672,6 +7812,11 @@ var TENNIS_CLUB_DECLARATION_REVIEW = {
|
|
|
7672
7812
|
id: "signature.upload.modal.title",
|
|
7673
7813
|
defaultMessage: "Draw signature",
|
|
7674
7814
|
description: "Title for the modal to draw signature"
|
|
7815
|
+
},
|
|
7816
|
+
// Zod applies the schema default at parse time, but this fixture bypasses
|
|
7817
|
+
// parsing — GeneratedInputField accesses configuration.maxFileSize directly.
|
|
7818
|
+
configuration: {
|
|
7819
|
+
maxFileSize: 5 * 1024 * 1024
|
|
7675
7820
|
}
|
|
7676
7821
|
}
|
|
7677
7822
|
]
|
|
@@ -8228,6 +8373,20 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
8228
8373
|
},
|
|
8229
8374
|
review: TENNIS_CLUB_DECLARATION_REVIEW
|
|
8230
8375
|
},
|
|
8376
|
+
{
|
|
8377
|
+
type: ActionType.NOTIFY,
|
|
8378
|
+
label: {
|
|
8379
|
+
defaultMessage: "Notify health worker",
|
|
8380
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
|
8381
|
+
id: "event.tennis-club-membership.action.notify.label"
|
|
8382
|
+
},
|
|
8383
|
+
flags: [
|
|
8384
|
+
{
|
|
8385
|
+
id: "health-worker-notified",
|
|
8386
|
+
operation: "add"
|
|
8387
|
+
}
|
|
8388
|
+
]
|
|
8389
|
+
},
|
|
8231
8390
|
{
|
|
8232
8391
|
type: ActionType.REJECT,
|
|
8233
8392
|
label: {
|
|
@@ -8470,6 +8629,17 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
8470
8629
|
}
|
|
8471
8630
|
}
|
|
8472
8631
|
],
|
|
8632
|
+
flags: [
|
|
8633
|
+
{
|
|
8634
|
+
id: "health-worker-notified",
|
|
8635
|
+
requiresAction: false,
|
|
8636
|
+
label: {
|
|
8637
|
+
id: "event.tennis-club-membership.flag.health-worker-notified.label",
|
|
8638
|
+
defaultMessage: "Health worker notified",
|
|
8639
|
+
description: "Label for the health-worker-notified flag"
|
|
8640
|
+
}
|
|
8641
|
+
}
|
|
8642
|
+
],
|
|
8473
8643
|
advancedSearch: [
|
|
8474
8644
|
{
|
|
8475
8645
|
title: {
|
|
@@ -10228,7 +10398,7 @@ function matchesJurisdictionFilter(locationIds, filter, user2) {
|
|
|
10228
10398
|
return locationIds.some((id) => id === user2.primaryOfficeId);
|
|
10229
10399
|
}
|
|
10230
10400
|
if (filter === JurisdictionFilter.enum.administrativeArea) {
|
|
10231
|
-
return user2.administrativeAreaId
|
|
10401
|
+
return !user2.administrativeAreaId || locationIds.some((id) => id === user2.administrativeAreaId);
|
|
10232
10402
|
}
|
|
10233
10403
|
return true;
|
|
10234
10404
|
}
|
|
@@ -10317,7 +10487,7 @@ function canAccessUserWithScope({
|
|
|
10317
10487
|
}
|
|
10318
10488
|
const hasAdministrativeAreaInHierarchy = userToAccess.administrativeHierarchy.some(
|
|
10319
10489
|
(id) => user2.administrativeAreaId === id
|
|
10320
|
-
) || user2.administrativeAreaId
|
|
10490
|
+
) || !user2.administrativeAreaId;
|
|
10321
10491
|
if (opts?.accessLevel === JurisdictionFilter.enum.administrativeArea && !hasAdministrativeAreaInHierarchy) {
|
|
10322
10492
|
return false;
|
|
10323
10493
|
}
|
|
@@ -10623,18 +10793,19 @@ var ACTION_FILTERS = {
|
|
|
10623
10793
|
function filterActionsByFlags(actions, flags) {
|
|
10624
10794
|
return actions.filter((action) => ACTION_FILTERS[action]?.(flags) ?? true);
|
|
10625
10795
|
}
|
|
10796
|
+
var REJECTED_ACTIONS = [
|
|
10797
|
+
ActionType.READ,
|
|
10798
|
+
ActionType.NOTIFY,
|
|
10799
|
+
ActionType.CUSTOM,
|
|
10800
|
+
ActionType.EDIT,
|
|
10801
|
+
ActionType.ARCHIVE
|
|
10802
|
+
];
|
|
10626
10803
|
function getAvailableActionsWithoutFlagFilters(status2, flags) {
|
|
10627
10804
|
if (flags.includes(InherentFlags.EDIT_IN_PROGRESS)) {
|
|
10628
10805
|
return [ActionType.NOTIFY, ActionType.DECLARE, ActionType.REGISTER];
|
|
10629
10806
|
}
|
|
10630
|
-
if (flags.includes(InherentFlags.REJECTED)) {
|
|
10631
|
-
return
|
|
10632
|
-
ActionType.READ,
|
|
10633
|
-
ActionType.NOTIFY,
|
|
10634
|
-
ActionType.CUSTOM,
|
|
10635
|
-
ActionType.EDIT,
|
|
10636
|
-
ActionType.ARCHIVE
|
|
10637
|
-
];
|
|
10807
|
+
if (flags.includes(InherentFlags.REJECTED) && status2 !== EventStatus.enum.ARCHIVED) {
|
|
10808
|
+
return REJECTED_ACTIONS;
|
|
10638
10809
|
}
|
|
10639
10810
|
return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status2];
|
|
10640
10811
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const UPSTREAM_URL = "https://github.com/opencrvs/opencrvs-countryconfig.git";
|
|
2
|
-
export declare const UPSTREAM_BRANCH = "release
|
|
2
|
+
export declare const UPSTREAM_BRANCH = "release/2.0.0";
|
|
3
3
|
/**
|
|
4
4
|
* Runs a git command in the country config working directory.
|
|
5
5
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkout-upstream-files.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/checkout-upstream-files.ts"],"names":[],"mappings":"AA8CA,eAAO,MAAM,YAAY,2DACiC,CAAA;AAE1D,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"checkout-upstream-files.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/checkout-upstream-files.ts"],"names":[],"mappings":"AA8CA,eAAO,MAAM,YAAY,2DACiC,CAAA;AAE1D,eAAO,MAAM,eAAe,kBAAkB,CAAA;AAc9C;;;;;;GAMG;AACH,wBAAgB,MAAM,CACpB,IAAI,EAAE,MAAM,EAAE,EACd,EAAE,MAAc,EAAE,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GAC5C,MAAM,CAMR;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAO9C;AAED,wBAAgB,eAAe,IAAI,IAAI,CAMtC;AAID,iBAAe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAuDnC;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -59,7 +59,7 @@ exports.main = main;
|
|
|
59
59
|
*/
|
|
60
60
|
const child_process_1 = require("child_process");
|
|
61
61
|
exports.UPSTREAM_URL = 'https://github.com/opencrvs/opencrvs-countryconfig.git';
|
|
62
|
-
exports.UPSTREAM_BRANCH = 'release
|
|
62
|
+
exports.UPSTREAM_BRANCH = 'release/2.0.0';
|
|
63
63
|
// Remote name used only for the duration of this codemod. Prefixed to avoid
|
|
64
64
|
// clashing with remotes the user may have (origin, upstream, etc.).
|
|
65
65
|
const TEMP_REMOTE = 'opencrvs-upgrade-v19-v20-codemod';
|
|
@@ -4312,7 +4312,7 @@ Saved ${handlerRelPath}.`);
|
|
|
4312
4312
|
// src/migrations/v2.0/checkout-upstream-files.ts
|
|
4313
4313
|
var import_child_process = require("child_process");
|
|
4314
4314
|
var UPSTREAM_URL = "https://github.com/opencrvs/opencrvs-countryconfig.git";
|
|
4315
|
-
var UPSTREAM_BRANCH = "release
|
|
4315
|
+
var UPSTREAM_BRANCH = "release/2.0.0";
|
|
4316
4316
|
var TEMP_REMOTE = "opencrvs-upgrade-v19-v20-codemod";
|
|
4317
4317
|
var FILES_TO_CHECKOUT = [
|
|
4318
4318
|
"src/analytics/analytics.ts",
|