@opencrvs/toolkit 2.0.0-rc.e1d7e00 → 2.0.0-rc.e20c746
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 +204 -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 +247 -70
- 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 +189 -7
- package/opencrvs-toolkit-2.0.0-rc.e20c746.tgz +0 -0
- package/package.json +1 -1
- package/opencrvs-toolkit-2.0.0-rc.e1d7e00.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,57 @@ 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
|
+
flags: z24.never().optional().describe(
|
|
3260
|
+
"ASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
|
|
3261
|
+
)
|
|
3262
|
+
}).shape
|
|
3263
|
+
);
|
|
3264
|
+
var UnassignConfig = ActionConfigBase.extend(
|
|
3265
|
+
z24.object({
|
|
3266
|
+
type: z24.literal(ActionType.UNASSIGN),
|
|
3267
|
+
flags: z24.never().optional().describe(
|
|
3268
|
+
"UNASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
|
|
3269
|
+
)
|
|
3270
|
+
}).shape
|
|
3271
|
+
);
|
|
3272
|
+
var DeleteConfig = ActionConfigBase.extend(
|
|
3273
|
+
z24.object({
|
|
3274
|
+
type: z24.literal(ActionType.DELETE)
|
|
3275
|
+
}).shape
|
|
3276
|
+
);
|
|
3218
3277
|
var DeclareConfig = DeclarationActionBase.extend(
|
|
3219
3278
|
z24.object({
|
|
3220
3279
|
type: z24.literal(ActionType.DECLARE),
|
|
@@ -3277,7 +3336,17 @@ var RequestCorrectionConfig = ActionConfigBase.extend(
|
|
|
3277
3336
|
correctionForm: ActionFormConfig
|
|
3278
3337
|
}).shape
|
|
3279
3338
|
);
|
|
3280
|
-
var
|
|
3339
|
+
var ApproveCorrectionConfig = ActionConfigBase.extend(
|
|
3340
|
+
z24.object({
|
|
3341
|
+
type: z24.literal(ActionType.APPROVE_CORRECTION)
|
|
3342
|
+
}).shape
|
|
3343
|
+
);
|
|
3344
|
+
var RejectCorrectionConfig = ActionConfigBase.extend(
|
|
3345
|
+
z24.object({
|
|
3346
|
+
type: z24.literal(ActionType.REJECT_CORRECTION)
|
|
3347
|
+
}).shape
|
|
3348
|
+
);
|
|
3349
|
+
var CustomActionConfig = ActionConfigBase.extend(
|
|
3281
3350
|
z24.object({
|
|
3282
3351
|
type: z24.literal(ActionType.CUSTOM),
|
|
3283
3352
|
customActionType: z24.string().describe("Type identifier of the custom action."),
|
|
@@ -3288,7 +3357,7 @@ var CustomActionConfig = ActionConfigBase.merge(
|
|
|
3288
3357
|
auditHistoryLabel: TranslationConfig.describe(
|
|
3289
3358
|
'The label to show in audit history for this action. For example "Approved".'
|
|
3290
3359
|
)
|
|
3291
|
-
})
|
|
3360
|
+
}).shape
|
|
3292
3361
|
);
|
|
3293
3362
|
var ActionConfig = z24.discriminatedUnion("type", [
|
|
3294
3363
|
/*
|
|
@@ -3299,9 +3368,37 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3299
3368
|
id: "ReadActionConfig",
|
|
3300
3369
|
description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
|
|
3301
3370
|
}),
|
|
3371
|
+
AssignConfig.meta({
|
|
3372
|
+
id: "AssignActionConfig",
|
|
3373
|
+
description: "Configuration for assigning a record to the current user."
|
|
3374
|
+
}),
|
|
3375
|
+
UnassignConfig.meta({
|
|
3376
|
+
id: "UnassignActionConfig",
|
|
3377
|
+
description: "Configuration for unassigning a record from its current assignee."
|
|
3378
|
+
}),
|
|
3379
|
+
DeleteConfig.meta({
|
|
3380
|
+
id: "DeleteActionConfig",
|
|
3381
|
+
description: "Configuration for deleting a draft record."
|
|
3382
|
+
}),
|
|
3383
|
+
NotifyConfig.meta({
|
|
3384
|
+
id: "NotifyActionConfig",
|
|
3385
|
+
description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
|
|
3386
|
+
}),
|
|
3302
3387
|
DeclareConfig.meta({
|
|
3303
3388
|
id: "DeclareActionConfig",
|
|
3304
|
-
description: "Configuration for the declare action. Includes review-page fields.
|
|
3389
|
+
description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
|
|
3390
|
+
}),
|
|
3391
|
+
DuplicateDetectedConfig.meta({
|
|
3392
|
+
id: "DuplicateDetectedActionConfig",
|
|
3393
|
+
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."
|
|
3394
|
+
}),
|
|
3395
|
+
MarkAsDuplicateConfig.meta({
|
|
3396
|
+
id: "MarkAsDuplicateActionConfig",
|
|
3397
|
+
description: "Configuration for marking a record as a duplicate."
|
|
3398
|
+
}),
|
|
3399
|
+
MarkAsNotDuplicateConfig.meta({
|
|
3400
|
+
id: "MarkAsNotDuplicateActionConfig",
|
|
3401
|
+
description: "Configuration for marking a record as not a duplicate, after it was previously flagged as one."
|
|
3305
3402
|
}),
|
|
3306
3403
|
RejectConfig.meta({
|
|
3307
3404
|
id: "RejectActionConfig",
|
|
@@ -3319,6 +3416,14 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3319
3416
|
id: "RequestCorrectionActionConfig",
|
|
3320
3417
|
description: "Configuration for requesting a correction on a registered record."
|
|
3321
3418
|
}),
|
|
3419
|
+
ApproveCorrectionConfig.meta({
|
|
3420
|
+
id: "ApproveCorrectionActionConfig",
|
|
3421
|
+
description: "Configuration for approving a requested correction."
|
|
3422
|
+
}),
|
|
3423
|
+
RejectCorrectionConfig.meta({
|
|
3424
|
+
id: "RejectCorrectionActionConfig",
|
|
3425
|
+
description: "Configuration for rejecting a requested correction."
|
|
3426
|
+
}),
|
|
3322
3427
|
EditActionConfig.meta({
|
|
3323
3428
|
id: "EditActionConfig",
|
|
3324
3429
|
description: "Configuration for editing a record before registration."
|
|
@@ -3908,7 +4013,7 @@ var isHiddenFieldType = (field3) => {
|
|
|
3908
4013
|
return field3.config.type === FieldType.ALPHA_HIDDEN;
|
|
3909
4014
|
};
|
|
3910
4015
|
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.
|
|
4016
|
+
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
4017
|
};
|
|
3913
4018
|
|
|
3914
4019
|
// ../commons/src/conditionals/validate.ts
|
|
@@ -4470,16 +4575,13 @@ function getActionConfig({
|
|
|
4470
4575
|
actionType,
|
|
4471
4576
|
customActionType
|
|
4472
4577
|
}) {
|
|
4578
|
+
if (actionType === ActionType.NOTIFY) {
|
|
4579
|
+
return eventConfiguration.actions.find((a) => a.type === ActionType.NOTIFY) ?? eventConfiguration.actions.find((a) => a.type === ActionType.DECLARE);
|
|
4580
|
+
}
|
|
4473
4581
|
return eventConfiguration.actions.find((a) => {
|
|
4474
4582
|
if (a.type === ActionType.CUSTOM && customActionType) {
|
|
4475
4583
|
return a.customActionType === customActionType;
|
|
4476
4584
|
}
|
|
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
4585
|
return a.type === actionType;
|
|
4484
4586
|
});
|
|
4485
4587
|
}
|
|
@@ -4513,7 +4615,7 @@ var getActionAnnotationFields = (actionConfig) => {
|
|
|
4513
4615
|
if (actionConfig.type === ActionType.CUSTOM) {
|
|
4514
4616
|
return actionConfig.form;
|
|
4515
4617
|
}
|
|
4516
|
-
if ("review" in actionConfig) {
|
|
4618
|
+
if ("review" in actionConfig && actionConfig.review != null) {
|
|
4517
4619
|
return actionConfig.review.fields;
|
|
4518
4620
|
}
|
|
4519
4621
|
return [];
|
|
@@ -5633,7 +5735,7 @@ function validateActionFlags(event2, ctx) {
|
|
|
5633
5735
|
const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
|
|
5634
5736
|
const configuredFlagIds = event2.flags.map((flag2) => flag2.id);
|
|
5635
5737
|
const actionFlagIds = event2.actions.flatMap(
|
|
5636
|
-
(action) => action.flags.map((flag2) => flag2.id)
|
|
5738
|
+
(action) => (action.flags ?? []).map((flag2) => flag2.id)
|
|
5637
5739
|
);
|
|
5638
5740
|
for (const actionFlagId of actionFlagIds) {
|
|
5639
5741
|
const isConfigured = configuredFlagIds.includes(actionFlagId);
|
|
@@ -6485,6 +6587,8 @@ var updateActions = ActionTypes.extract([
|
|
|
6485
6587
|
ActionType.ARCHIVE,
|
|
6486
6588
|
ActionType.PRINT_CERTIFICATE,
|
|
6487
6589
|
ActionType.REQUEST_CORRECTION,
|
|
6590
|
+
ActionType.APPROVE_CORRECTION,
|
|
6591
|
+
ActionType.REJECT_CORRECTION,
|
|
6488
6592
|
ActionType.CUSTOM
|
|
6489
6593
|
]);
|
|
6490
6594
|
function getActionUpdateMetadata(actions) {
|
|
@@ -6526,9 +6630,6 @@ function getLegalStatuses(actions) {
|
|
|
6526
6630
|
// ../commons/src/events/state/flags.ts
|
|
6527
6631
|
var import_lodash3 = require("lodash");
|
|
6528
6632
|
var import_date_fns3 = require("date-fns");
|
|
6529
|
-
function isEditInProgress(actions) {
|
|
6530
|
-
return actions.at(-1)?.type === ActionType.EDIT;
|
|
6531
|
-
}
|
|
6532
6633
|
function findPendingCorrectionAction(writeActions2) {
|
|
6533
6634
|
let correctionRequestAction;
|
|
6534
6635
|
for (let i = writeActions2.length - 1; i >= 0; i--) {
|
|
@@ -6543,29 +6644,6 @@ function findPendingCorrectionAction(writeActions2) {
|
|
|
6543
6644
|
}
|
|
6544
6645
|
return correctionRequestAction;
|
|
6545
6646
|
}
|
|
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
6647
|
function isPotentialDuplicate(actions) {
|
|
6570
6648
|
return actions.reduce((prev, { type }) => {
|
|
6571
6649
|
if (type === ActionType.DUPLICATE_DETECTED) {
|
|
@@ -6593,6 +6671,88 @@ function isFlagConditionMet(conditional, form, action) {
|
|
|
6593
6671
|
}
|
|
6594
6672
|
});
|
|
6595
6673
|
}
|
|
6674
|
+
function actionConfigRemovesFlag(action, flagId, actionsUpToAndIncluding, event2, eventConfiguration) {
|
|
6675
|
+
if (!isActionConfigType(action.type)) {
|
|
6676
|
+
return false;
|
|
6677
|
+
}
|
|
6678
|
+
const actionConfig = getActionConfig({
|
|
6679
|
+
eventConfiguration,
|
|
6680
|
+
actionType: action.type,
|
|
6681
|
+
customActionType: "customActionType" in action ? action.customActionType : void 0
|
|
6682
|
+
});
|
|
6683
|
+
const removeOperations = (actionConfig?.flags ?? []).filter(
|
|
6684
|
+
({ id, operation }) => id === flagId && operation === "remove"
|
|
6685
|
+
);
|
|
6686
|
+
if (removeOperations.length === 0) {
|
|
6687
|
+
return false;
|
|
6688
|
+
}
|
|
6689
|
+
const eventUpToThisAction = { ...event2, actions: actionsUpToAndIncluding };
|
|
6690
|
+
const declaration = aggregateActionDeclarations(eventUpToThisAction);
|
|
6691
|
+
const annotation = aggregateActionAnnotations(eventUpToThisAction);
|
|
6692
|
+
const form = { ...declaration, ...annotation };
|
|
6693
|
+
return removeOperations.some(
|
|
6694
|
+
({ conditional }) => conditional ? isFlagConditionMet(conditional, form, action) : true
|
|
6695
|
+
);
|
|
6696
|
+
}
|
|
6697
|
+
var INHERENT_FLAG_RULES = [
|
|
6698
|
+
{
|
|
6699
|
+
flag: InherentFlags.CORRECTION_REQUESTED,
|
|
6700
|
+
setOn: [ActionType.REQUEST_CORRECTION],
|
|
6701
|
+
resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
|
|
6702
|
+
},
|
|
6703
|
+
{
|
|
6704
|
+
// INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
|
|
6705
|
+
// other status-changing action (see getStatusFromActions).
|
|
6706
|
+
flag: InherentFlags.INCOMPLETE,
|
|
6707
|
+
setOn: [ActionType.NOTIFY],
|
|
6708
|
+
resetOn: [
|
|
6709
|
+
ActionType.CREATE,
|
|
6710
|
+
ActionType.DECLARE,
|
|
6711
|
+
ActionType.REGISTER,
|
|
6712
|
+
ActionType.ARCHIVE
|
|
6713
|
+
]
|
|
6714
|
+
},
|
|
6715
|
+
{
|
|
6716
|
+
flag: InherentFlags.REJECTED,
|
|
6717
|
+
setOn: [ActionType.REJECT],
|
|
6718
|
+
resetOn: [
|
|
6719
|
+
ActionType.NOTIFY,
|
|
6720
|
+
ActionType.DECLARE,
|
|
6721
|
+
ActionType.EDIT,
|
|
6722
|
+
ActionType.REGISTER
|
|
6723
|
+
]
|
|
6724
|
+
},
|
|
6725
|
+
{
|
|
6726
|
+
flag: InherentFlags.POTENTIAL_DUPLICATE,
|
|
6727
|
+
setOn: [ActionType.DUPLICATE_DETECTED],
|
|
6728
|
+
resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
|
|
6729
|
+
},
|
|
6730
|
+
{
|
|
6731
|
+
flag: InherentFlags.EDIT_IN_PROGRESS,
|
|
6732
|
+
setOn: [ActionType.EDIT],
|
|
6733
|
+
resetOnAnyOtherAction: true
|
|
6734
|
+
}
|
|
6735
|
+
];
|
|
6736
|
+
function resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration) {
|
|
6737
|
+
return acceptedActions.reduce((present, action, idx) => {
|
|
6738
|
+
if (rule.setOn.includes(action.type)) {
|
|
6739
|
+
return true;
|
|
6740
|
+
}
|
|
6741
|
+
if (rule.resetOnAnyOtherAction || (rule.resetOn ?? []).includes(action.type)) {
|
|
6742
|
+
return false;
|
|
6743
|
+
}
|
|
6744
|
+
if (actionConfigRemovesFlag(
|
|
6745
|
+
action,
|
|
6746
|
+
rule.flag,
|
|
6747
|
+
acceptedActions.slice(0, idx + 1),
|
|
6748
|
+
event2,
|
|
6749
|
+
eventConfiguration
|
|
6750
|
+
)) {
|
|
6751
|
+
return false;
|
|
6752
|
+
}
|
|
6753
|
+
return present;
|
|
6754
|
+
}, false);
|
|
6755
|
+
}
|
|
6596
6756
|
function resolveEventCustomFlags(event2, eventConfiguration) {
|
|
6597
6757
|
const actions = getAcceptedActions(event2).filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
6598
6758
|
return actions.reduce((acc, action, idx) => {
|
|
@@ -6614,7 +6774,7 @@ function resolveEventCustomFlags(event2, eventConfiguration) {
|
|
|
6614
6774
|
const declaration = aggregateActionDeclarations(eventUpToThisAction);
|
|
6615
6775
|
const annotation = aggregateActionAnnotations(eventUpToThisAction);
|
|
6616
6776
|
const form = { ...declaration, ...annotation };
|
|
6617
|
-
const flagsWithMetConditions = actionConfig.flags.filter(
|
|
6777
|
+
const flagsWithMetConditions = (actionConfig.flags ?? []).filter(
|
|
6618
6778
|
({ conditional }) => (
|
|
6619
6779
|
// If conditional is not provided, the flag is resolved
|
|
6620
6780
|
conditional ? isFlagConditionMet(conditional, form, action) : true
|
|
@@ -6641,33 +6801,19 @@ function getActionStatusFlags(sortedActions) {
|
|
|
6641
6801
|
return flag2;
|
|
6642
6802
|
});
|
|
6643
6803
|
}
|
|
6644
|
-
function getInherentFlags(sortedActions) {
|
|
6804
|
+
function getInherentFlags(sortedActions, event2, eventConfiguration) {
|
|
6645
6805
|
const acceptedActions = sortedActions.filter(
|
|
6646
6806
|
({ status: status2 }) => status2 === ActionStatus.Accepted
|
|
6647
6807
|
);
|
|
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;
|
|
6808
|
+
return INHERENT_FLAG_RULES.filter(
|
|
6809
|
+
(rule) => resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration)
|
|
6810
|
+
).map(({ flag: flag2 }) => flag2);
|
|
6665
6811
|
}
|
|
6666
6812
|
function getEventFlags(event2, config) {
|
|
6667
6813
|
const sortedActions = event2.actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
6668
6814
|
return [
|
|
6669
6815
|
...getActionStatusFlags(sortedActions),
|
|
6670
|
-
...getInherentFlags(sortedActions),
|
|
6816
|
+
...getInherentFlags(sortedActions, event2, config),
|
|
6671
6817
|
...resolveEventCustomFlags(event2, config)
|
|
6672
6818
|
];
|
|
6673
6819
|
}
|
|
@@ -7672,6 +7818,11 @@ var TENNIS_CLUB_DECLARATION_REVIEW = {
|
|
|
7672
7818
|
id: "signature.upload.modal.title",
|
|
7673
7819
|
defaultMessage: "Draw signature",
|
|
7674
7820
|
description: "Title for the modal to draw signature"
|
|
7821
|
+
},
|
|
7822
|
+
// Zod applies the schema default at parse time, but this fixture bypasses
|
|
7823
|
+
// parsing — GeneratedInputField accesses configuration.maxFileSize directly.
|
|
7824
|
+
configuration: {
|
|
7825
|
+
maxFileSize: 5 * 1024 * 1024
|
|
7675
7826
|
}
|
|
7676
7827
|
}
|
|
7677
7828
|
]
|
|
@@ -8228,6 +8379,20 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
8228
8379
|
},
|
|
8229
8380
|
review: TENNIS_CLUB_DECLARATION_REVIEW
|
|
8230
8381
|
},
|
|
8382
|
+
{
|
|
8383
|
+
type: ActionType.NOTIFY,
|
|
8384
|
+
label: {
|
|
8385
|
+
defaultMessage: "Notify health worker",
|
|
8386
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
|
8387
|
+
id: "event.tennis-club-membership.action.notify.label"
|
|
8388
|
+
},
|
|
8389
|
+
flags: [
|
|
8390
|
+
{
|
|
8391
|
+
id: "health-worker-notified",
|
|
8392
|
+
operation: "add"
|
|
8393
|
+
}
|
|
8394
|
+
]
|
|
8395
|
+
},
|
|
8231
8396
|
{
|
|
8232
8397
|
type: ActionType.REJECT,
|
|
8233
8398
|
label: {
|
|
@@ -8470,6 +8635,17 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
8470
8635
|
}
|
|
8471
8636
|
}
|
|
8472
8637
|
],
|
|
8638
|
+
flags: [
|
|
8639
|
+
{
|
|
8640
|
+
id: "health-worker-notified",
|
|
8641
|
+
requiresAction: false,
|
|
8642
|
+
label: {
|
|
8643
|
+
id: "event.tennis-club-membership.flag.health-worker-notified.label",
|
|
8644
|
+
defaultMessage: "Health worker notified",
|
|
8645
|
+
description: "Label for the health-worker-notified flag"
|
|
8646
|
+
}
|
|
8647
|
+
}
|
|
8648
|
+
],
|
|
8473
8649
|
advancedSearch: [
|
|
8474
8650
|
{
|
|
8475
8651
|
title: {
|
|
@@ -10228,7 +10404,7 @@ function matchesJurisdictionFilter(locationIds, filter, user2) {
|
|
|
10228
10404
|
return locationIds.some((id) => id === user2.primaryOfficeId);
|
|
10229
10405
|
}
|
|
10230
10406
|
if (filter === JurisdictionFilter.enum.administrativeArea) {
|
|
10231
|
-
return user2.administrativeAreaId
|
|
10407
|
+
return !user2.administrativeAreaId || locationIds.some((id) => id === user2.administrativeAreaId);
|
|
10232
10408
|
}
|
|
10233
10409
|
return true;
|
|
10234
10410
|
}
|
|
@@ -10317,7 +10493,7 @@ function canAccessUserWithScope({
|
|
|
10317
10493
|
}
|
|
10318
10494
|
const hasAdministrativeAreaInHierarchy = userToAccess.administrativeHierarchy.some(
|
|
10319
10495
|
(id) => user2.administrativeAreaId === id
|
|
10320
|
-
) || user2.administrativeAreaId
|
|
10496
|
+
) || !user2.administrativeAreaId;
|
|
10321
10497
|
if (opts?.accessLevel === JurisdictionFilter.enum.administrativeArea && !hasAdministrativeAreaInHierarchy) {
|
|
10322
10498
|
return false;
|
|
10323
10499
|
}
|
|
@@ -10623,18 +10799,19 @@ var ACTION_FILTERS = {
|
|
|
10623
10799
|
function filterActionsByFlags(actions, flags) {
|
|
10624
10800
|
return actions.filter((action) => ACTION_FILTERS[action]?.(flags) ?? true);
|
|
10625
10801
|
}
|
|
10802
|
+
var REJECTED_ACTIONS = [
|
|
10803
|
+
ActionType.READ,
|
|
10804
|
+
ActionType.NOTIFY,
|
|
10805
|
+
ActionType.CUSTOM,
|
|
10806
|
+
ActionType.EDIT,
|
|
10807
|
+
ActionType.ARCHIVE
|
|
10808
|
+
];
|
|
10626
10809
|
function getAvailableActionsWithoutFlagFilters(status2, flags) {
|
|
10627
10810
|
if (flags.includes(InherentFlags.EDIT_IN_PROGRESS)) {
|
|
10628
10811
|
return [ActionType.NOTIFY, ActionType.DECLARE, ActionType.REGISTER];
|
|
10629
10812
|
}
|
|
10630
|
-
if (flags.includes(InherentFlags.REJECTED)) {
|
|
10631
|
-
return
|
|
10632
|
-
ActionType.READ,
|
|
10633
|
-
ActionType.NOTIFY,
|
|
10634
|
-
ActionType.CUSTOM,
|
|
10635
|
-
ActionType.EDIT,
|
|
10636
|
-
ActionType.ARCHIVE
|
|
10637
|
-
];
|
|
10813
|
+
if (flags.includes(InherentFlags.REJECTED) && status2 !== EventStatus.enum.ARCHIVED) {
|
|
10814
|
+
return REJECTED_ACTIONS;
|
|
10638
10815
|
}
|
|
10639
10816
|
return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status2];
|
|
10640
10817
|
}
|
|
@@ -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",
|