@opencrvs/toolkit 2.0.0-rc.ff99998 → 2.1.0-rc.0066f38
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/README.md +15 -0
- package/build.sh +5 -4
- package/create-countryconfig/package.json +1 -1
- package/dist/application-config/index.js +36 -7
- package/dist/cli.js +3186 -4921
- package/dist/commons/api/router.d.ts +634 -22
- package/dist/commons/conditionals/conditionals.d.ts +6 -6
- package/dist/commons/events/ActionConfig.d.ts +237 -2
- package/dist/commons/events/ActionDocument.d.ts +44 -0
- package/dist/commons/events/ActionInput.d.ts +26 -0
- package/dist/commons/events/ActionType.d.ts +6 -1
- package/dist/commons/events/AdvancedSearchConfig.d.ts +18 -0
- package/dist/commons/events/AuditLog.d.ts +2 -0
- package/dist/commons/events/CountryConfigQueryInput.d.ts +42 -0
- package/dist/commons/events/Draft.d.ts +2 -0
- package/dist/commons/events/EventConfig.d.ts +2 -0
- package/dist/commons/events/EventDocument.d.ts +22 -0
- package/dist/commons/events/EventIndex.d.ts +25 -0
- package/dist/commons/events/EventMetadata.d.ts +26 -0
- package/dist/commons/events/FieldConfig.d.ts +16 -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 +44 -2
- package/dist/commons/events/locations.d.ts +1 -0
- package/dist/commons/events/scopes.d.ts +1 -0
- package/dist/commons/events/state/index.d.ts +8 -0
- package/dist/commons/events/state/utils.d.ts +9 -0
- package/dist/commons/events/test.utils.d.ts +9 -1
- package/dist/commons/events/utils.d.ts +23 -1
- package/dist/conditionals/index.js +12 -5
- package/dist/environment/custom-types.d.ts +33 -0
- package/dist/environment/custom-types.d.ts.map +1 -0
- package/dist/environment/custom-types.js +12 -0
- package/dist/environment/derived-variables.d.ts +134 -0
- package/dist/environment/derived-variables.d.ts.map +1 -0
- package/dist/environment/derived-variables.js +169 -0
- package/dist/environment/editor-questions.d.ts +4 -0
- package/dist/environment/editor-questions.d.ts.map +1 -0
- package/dist/environment/editor-questions.js +67 -0
- package/dist/environment/git.d.ts +5 -0
- package/dist/environment/git.d.ts.map +1 -0
- package/dist/environment/git.js +38 -0
- package/dist/environment/github.d.ts +26 -0
- package/dist/environment/github.d.ts.map +1 -0
- package/dist/environment/github.js +247 -0
- package/dist/environment/index.d.ts +5 -0
- package/dist/environment/index.d.ts.map +1 -0
- package/dist/environment/index.js +71 -0
- package/dist/environment/logger.d.ts +15 -0
- package/dist/environment/logger.d.ts.map +1 -0
- package/dist/environment/logger.js +25 -0
- package/dist/environment/manage-users.d.ts +11 -0
- package/dist/environment/manage-users.d.ts.map +1 -0
- package/dist/environment/manage-users.js +497 -0
- package/dist/environment/questions-helper.d.ts +15 -0
- package/dist/environment/questions-helper.d.ts.map +1 -0
- package/dist/environment/questions-helper.js +70 -0
- package/dist/environment/questions.d.ts +199 -0
- package/dist/environment/questions.d.ts.map +1 -0
- package/dist/environment/questions.js +412 -0
- package/dist/environment/setup-environment.d.ts +2 -0
- package/dist/environment/setup-environment.d.ts.map +1 -0
- package/dist/environment/setup-environment.js +794 -0
- package/dist/environment/ssh-keygen.d.ts +5 -0
- package/dist/environment/ssh-keygen.d.ts.map +1 -0
- package/dist/environment/ssh-keygen.js +21 -0
- package/dist/environment/swarm-to-k8s.d.ts +2 -0
- package/dist/environment/swarm-to-k8s.d.ts.map +1 -0
- package/dist/environment/swarm-to-k8s.js +173 -0
- package/dist/environment/templates.d.ts +27 -0
- package/dist/environment/templates.d.ts.map +1 -0
- package/dist/environment/templates.js +163 -0
- package/dist/environment/update-workflows.d.ts +2 -0
- package/dist/environment/update-workflows.d.ts.map +1 -0
- package/dist/environment/update-workflows.js +169 -0
- package/dist/environment/users.d.ts +2 -0
- package/dist/environment/users.d.ts.map +1 -0
- package/dist/environment/users.js +112 -0
- package/dist/environment/utils.d.ts +18 -0
- package/dist/environment/utils.d.ts.map +1 -0
- package/dist/environment/utils.js +100 -0
- package/dist/events/index.js +379 -89
- 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 +88 -5139
- package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts +3 -0
- package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts.map +1 -0
- package/dist/migrations/v2.1/add-explicit-correction-flags.js +234 -0
- package/dist/migrations/v2.1/index.d.ts +6 -0
- package/dist/migrations/v2.1/index.d.ts.map +1 -0
- package/dist/migrations/v2.1/index.js +218 -0
- package/dist/notification/index.js +250 -22
- package/dist/scopes/index.d.ts +96 -2
- package/dist/scopes/index.js +12 -5
- package/dist/templates/charts-values/dependencies/values.override.yaml +4 -0
- package/dist/templates/charts-values/dependencies/values.yaml +83 -0
- package/dist/templates/charts-values/opencrvs-services/values.override.yaml +4 -0
- package/dist/templates/charts-values/opencrvs-services/values.yaml +81 -0
- package/dist/templates/charts-values/traefik/values.override.yaml +4 -0
- package/dist/templates/charts-values/traefik/values.yaml +115 -0
- package/dist/templates/inventory/inventory.template.yml +100 -0
- package/dist/templates/inventory/production.example.yml +77 -0
- package/dist/templates/inventory/qa.example.yml +48 -0
- package/opencrvs-toolkit-2.1.0-rc.0066f38.tgz +0 -0
- package/package.json +15 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.0.0-rc.ff99998.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,
|
|
@@ -213,6 +214,7 @@ __export(events_exports, {
|
|
|
213
214
|
TimeValue: () => TimeValue,
|
|
214
215
|
TranslationConfig: () => TranslationConfig,
|
|
215
216
|
UUID: () => UUID,
|
|
217
|
+
UnarchiveActionInput: () => UnarchiveActionInput,
|
|
216
218
|
UnassignActionInput: () => UnassignActionInput,
|
|
217
219
|
UserAuditRecordInput: () => UserAuditRecordInput,
|
|
218
220
|
V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS: () => V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS,
|
|
@@ -311,6 +313,7 @@ __export(events_exports, {
|
|
|
311
313
|
getActionAnnotation: () => getActionAnnotation,
|
|
312
314
|
getActionAnnotationFields: () => getActionAnnotationFields,
|
|
313
315
|
getActionConfig: () => getActionConfig,
|
|
316
|
+
getActionFormFields: () => getActionFormFields,
|
|
314
317
|
getActionReview: () => getActionReview,
|
|
315
318
|
getActionReviewFields: () => getActionReviewFields,
|
|
316
319
|
getAdministrativeAreaHierarchy: () => getAdministrativeAreaHierarchy,
|
|
@@ -480,6 +483,7 @@ var RecordScopeTypeV2 = z2.enum([
|
|
|
480
483
|
"record.edit",
|
|
481
484
|
"record.reject",
|
|
482
485
|
"record.archive",
|
|
486
|
+
"record.unarchive",
|
|
483
487
|
"record.review-duplicates",
|
|
484
488
|
"record.register",
|
|
485
489
|
"record.print-certified-copies",
|
|
@@ -519,11 +523,13 @@ var scopeOptionsPlaceEvent = z2.object({
|
|
|
519
523
|
event: scopeByEvent,
|
|
520
524
|
placeOfEvent: JurisdictionFilter.optional()
|
|
521
525
|
}).describe("Options applicable to all record scopes.");
|
|
522
|
-
var
|
|
526
|
+
var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
527
|
+
notifiedIn: JurisdictionFilter.optional(),
|
|
528
|
+
notifiedBy: UserFilter.optional(),
|
|
523
529
|
declaredIn: JurisdictionFilter.optional(),
|
|
524
530
|
declaredBy: UserFilter.optional()
|
|
525
531
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
526
|
-
var AllRecordScopeOptions =
|
|
532
|
+
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
527
533
|
registeredIn: JurisdictionFilter.optional(),
|
|
528
534
|
registeredBy: UserFilter.optional()
|
|
529
535
|
}).describe(
|
|
@@ -561,6 +567,8 @@ var ResolvedScopeOptionsPlaceEvent = z2.object({
|
|
|
561
567
|
"Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
|
|
562
568
|
);
|
|
563
569
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
570
|
+
notifiedIn: UUID.nullish(),
|
|
571
|
+
notifiedBy: z2.string().optional(),
|
|
564
572
|
declaredIn: UUID.nullish(),
|
|
565
573
|
declaredBy: z2.string().optional()
|
|
566
574
|
}).describe(
|
|
@@ -581,6 +589,7 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
|
581
589
|
"record.edit",
|
|
582
590
|
"record.reject",
|
|
583
591
|
"record.archive",
|
|
592
|
+
"record.unarchive",
|
|
584
593
|
"record.review-duplicates",
|
|
585
594
|
"record.register"
|
|
586
595
|
]);
|
|
@@ -606,7 +615,7 @@ var RecordScopeV2 = z2.discriminatedUnion("type", [
|
|
|
606
615
|
}),
|
|
607
616
|
z2.object({
|
|
608
617
|
type: ScopesWithDeclaredOptions,
|
|
609
|
-
options:
|
|
618
|
+
options: scopeOptionsDeclaredOrNotified.optional()
|
|
610
619
|
}),
|
|
611
620
|
z2.object({
|
|
612
621
|
type: ScopesWithFullOptions,
|
|
@@ -729,8 +738,9 @@ var decodeScope = (encodedScope) => {
|
|
|
729
738
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
730
739
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
731
740
|
accessLevel: JurisdictionFilter.enum.all,
|
|
732
|
-
|
|
733
|
-
declaredIn: JurisdictionFilter.enum.all
|
|
741
|
+
notifiedIn: JurisdictionFilter.enum.all,
|
|
742
|
+
declaredIn: JurisdictionFilter.enum.all,
|
|
743
|
+
registeredIn: JurisdictionFilter.enum.all
|
|
734
744
|
};
|
|
735
745
|
function getAcceptedScopesByType({
|
|
736
746
|
acceptedScopes,
|
|
@@ -766,6 +776,7 @@ var ActionType = {
|
|
|
766
776
|
MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
|
|
767
777
|
MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
|
|
768
778
|
ARCHIVE: "ARCHIVE",
|
|
779
|
+
UNARCHIVE: "UNARCHIVE",
|
|
769
780
|
// Record actions
|
|
770
781
|
PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
|
|
771
782
|
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
|
@@ -785,6 +796,7 @@ var ConfirmableActions = [
|
|
|
785
796
|
ActionType.REGISTER,
|
|
786
797
|
ActionType.REJECT,
|
|
787
798
|
ActionType.ARCHIVE,
|
|
799
|
+
ActionType.UNARCHIVE,
|
|
788
800
|
ActionType.PRINT_CERTIFICATE,
|
|
789
801
|
ActionType.REQUEST_CORRECTION,
|
|
790
802
|
ActionType.APPROVE_CORRECTION,
|
|
@@ -803,6 +815,7 @@ var ActionTypes = z4.enum([
|
|
|
803
815
|
"MARK_AS_DUPLICATE",
|
|
804
816
|
"MARK_AS_NOT_DUPLICATE",
|
|
805
817
|
"ARCHIVE",
|
|
818
|
+
"UNARCHIVE",
|
|
806
819
|
"PRINT_CERTIFICATE",
|
|
807
820
|
"REQUEST_CORRECTION",
|
|
808
821
|
"REJECT_CORRECTION",
|
|
@@ -846,6 +859,7 @@ var WorkqueueActionType = ActionTypes.extract([
|
|
|
846
859
|
ActionType.REJECT,
|
|
847
860
|
ActionType.MARK_AS_DUPLICATE,
|
|
848
861
|
ActionType.ARCHIVE,
|
|
862
|
+
ActionType.UNARCHIVE,
|
|
849
863
|
ActionType.PRINT_CERTIFICATE,
|
|
850
864
|
ActionType.REQUEST_CORRECTION
|
|
851
865
|
]);
|
|
@@ -910,6 +924,7 @@ var EventActionEntrySchema = AuditLogEntryBase.extend({
|
|
|
910
924
|
"event.actions.unassign.request",
|
|
911
925
|
"event.actions.read.request",
|
|
912
926
|
"event.actions.archive.request",
|
|
927
|
+
"event.actions.unarchive.request",
|
|
913
928
|
"event.actions.reinstate.request",
|
|
914
929
|
"event.actions.print_certificate.request",
|
|
915
930
|
"event.actions.correction.request.request",
|
|
@@ -1219,6 +1234,11 @@ var FieldTypesToHideInReview = [
|
|
|
1219
1234
|
FieldType.ALPHA_PRINT_BUTTON,
|
|
1220
1235
|
FieldType.ALPHA_HIDDEN
|
|
1221
1236
|
];
|
|
1237
|
+
var HiddenFieldTypes = [
|
|
1238
|
+
FieldType.HTTP,
|
|
1239
|
+
FieldType.QUERY_PARAM_READER,
|
|
1240
|
+
FieldType.ALPHA_HIDDEN
|
|
1241
|
+
];
|
|
1222
1242
|
|
|
1223
1243
|
// ../commons/src/events/FieldValue.ts
|
|
1224
1244
|
var z12 = __toESM(require("zod/v4"));
|
|
@@ -1345,7 +1365,7 @@ function plainDateToLocalDate(date) {
|
|
|
1345
1365
|
// ../commons/src/events/FieldValue.ts
|
|
1346
1366
|
var TextValue = z12.string();
|
|
1347
1367
|
var HiddenFieldValue = z12.string();
|
|
1348
|
-
var NonEmptyTextValue =
|
|
1368
|
+
var NonEmptyTextValue = z12.string().trim().min(1);
|
|
1349
1369
|
var DateValue = z12.iso.date().describe("Date in the format YYYY-MM-DD");
|
|
1350
1370
|
var AgeValue = z12.object({
|
|
1351
1371
|
age: z12.number(),
|
|
@@ -1638,6 +1658,11 @@ var ArchiveAction = ActionBase.extend(
|
|
|
1638
1658
|
content: ReasonContent
|
|
1639
1659
|
}).shape
|
|
1640
1660
|
);
|
|
1661
|
+
var UnarchiveAction = ActionBase.extend(
|
|
1662
|
+
z14.object({
|
|
1663
|
+
type: z14.literal(ActionType.UNARCHIVE)
|
|
1664
|
+
}).shape
|
|
1665
|
+
);
|
|
1641
1666
|
var CreatedAction = ActionBase.extend(
|
|
1642
1667
|
z14.object({
|
|
1643
1668
|
type: z14.literal(ActionType.CREATE)
|
|
@@ -1704,6 +1729,7 @@ var ActionDocument = z14.discriminatedUnion("type", [
|
|
|
1704
1729
|
MarkNotDuplicateAction.meta({ id: "MarkNotDuplicateAction" }),
|
|
1705
1730
|
MarkAsDuplicateAction.meta({ id: "MarkAsDuplicateAction" }),
|
|
1706
1731
|
ArchiveAction.meta({ id: "ArchiveAction" }),
|
|
1732
|
+
UnarchiveAction.meta({ id: "UnarchiveAction" }),
|
|
1707
1733
|
NotifiedAction.meta({ id: "NotifiedAction" }),
|
|
1708
1734
|
RegisterAction.meta({ id: "RegisterAction" }),
|
|
1709
1735
|
DeclareAction.meta({ id: "DeclareAction" }),
|
|
@@ -1809,6 +1835,7 @@ var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
|
1809
1835
|
)
|
|
1810
1836
|
});
|
|
1811
1837
|
var LegalStatuses = z16.object({
|
|
1838
|
+
[EventStatus.enum.NOTIFIED]: ActionCreationMetadata.nullish(),
|
|
1812
1839
|
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
|
1813
1840
|
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
|
1814
1841
|
});
|
|
@@ -1950,6 +1977,8 @@ var eventMetadataLabelMap = {
|
|
|
1950
1977
|
var EventMetadataDateFieldIdInput = z16.enum([
|
|
1951
1978
|
"createdAt",
|
|
1952
1979
|
"updatedAt",
|
|
1980
|
+
"legalStatuses.NOTIFIED.createdAt",
|
|
1981
|
+
"legalStatuses.NOTIFIED.acceptedAt",
|
|
1953
1982
|
"legalStatuses.DECLARED.createdAt",
|
|
1954
1983
|
"legalStatuses.DECLARED.acceptedAt",
|
|
1955
1984
|
"legalStatuses.REGISTERED.createdAt",
|
|
@@ -1958,6 +1987,8 @@ var EventMetadataDateFieldIdInput = z16.enum([
|
|
|
1958
1987
|
var EventMetadataDateFieldId = z16.enum([
|
|
1959
1988
|
"event.createdAt",
|
|
1960
1989
|
"event.updatedAt",
|
|
1990
|
+
"event.legalStatuses.NOTIFIED.createdAt",
|
|
1991
|
+
"event.legalStatuses.NOTIFIED.acceptedAt",
|
|
1961
1992
|
"event.legalStatuses.DECLARED.createdAt",
|
|
1962
1993
|
"event.legalStatuses.DECLARED.acceptedAt",
|
|
1963
1994
|
"event.legalStatuses.REGISTERED.createdAt",
|
|
@@ -2017,7 +2048,8 @@ var Range = import_v4.z.object({
|
|
|
2017
2048
|
});
|
|
2018
2049
|
var ContainsFlags = import_v4.z.object({
|
|
2019
2050
|
anyOf: import_v4.z.array(Flag).optional(),
|
|
2020
|
-
noneOf: import_v4.z.array(Flag).optional()
|
|
2051
|
+
noneOf: import_v4.z.array(Flag).optional(),
|
|
2052
|
+
allOf: import_v4.z.array(Flag).optional()
|
|
2021
2053
|
}).meta({
|
|
2022
2054
|
id: "ContainsFlags"
|
|
2023
2055
|
});
|
|
@@ -2292,6 +2324,7 @@ var NumberField = BaseField.extend({
|
|
|
2292
2324
|
configuration: import_v43.default.object({
|
|
2293
2325
|
min: import_v43.default.number().optional().describe("Minimum value"),
|
|
2294
2326
|
max: import_v43.default.number().optional().describe("Maximum value"),
|
|
2327
|
+
integer: import_v43.default.boolean().optional().describe("When true, only whole numbers are allowed"),
|
|
2295
2328
|
prefix: TranslationConfig.optional(),
|
|
2296
2329
|
postfix: TranslationConfig.optional()
|
|
2297
2330
|
}).optional()
|
|
@@ -3206,6 +3239,9 @@ var ActionConfigBase = z24.object({
|
|
|
3206
3239
|
var DeclarationActionBase = ActionConfigBase.extend({
|
|
3207
3240
|
deduplication: DeduplicationConfig.optional()
|
|
3208
3241
|
});
|
|
3242
|
+
var actionConfirmationForm = z24.array(FieldConfig).optional().describe(
|
|
3243
|
+
"Fields rendered on the action confirmation dialog. Submitted values are stored in the action annotation and shown in the audit history."
|
|
3244
|
+
);
|
|
3209
3245
|
var ReadActionConfig = ActionConfigBase.extend(
|
|
3210
3246
|
z24.object({
|
|
3211
3247
|
type: z24.literal(ActionType.READ),
|
|
@@ -3215,12 +3251,65 @@ var ReadActionConfig = ActionConfigBase.extend(
|
|
|
3215
3251
|
conditionals: z24.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
|
|
3216
3252
|
}).shape
|
|
3217
3253
|
);
|
|
3254
|
+
var NotifyConfig = ActionConfigBase.extend(
|
|
3255
|
+
z24.object({
|
|
3256
|
+
type: z24.literal(ActionType.NOTIFY),
|
|
3257
|
+
form: actionConfirmationForm
|
|
3258
|
+
}).shape
|
|
3259
|
+
);
|
|
3260
|
+
var DuplicateDetectedConfig = ActionConfigBase.extend(
|
|
3261
|
+
z24.object({
|
|
3262
|
+
type: z24.literal(ActionType.DUPLICATE_DETECTED),
|
|
3263
|
+
label: z24.never().optional().describe(
|
|
3264
|
+
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no label."
|
|
3265
|
+
),
|
|
3266
|
+
supportingCopy: z24.never().optional(),
|
|
3267
|
+
icon: z24.never().optional().describe(
|
|
3268
|
+
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no icon."
|
|
3269
|
+
),
|
|
3270
|
+
conditionals: z24.never().optional().describe(
|
|
3271
|
+
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it cannot be disabled or hidden with conditionals."
|
|
3272
|
+
)
|
|
3273
|
+
}).shape
|
|
3274
|
+
);
|
|
3275
|
+
var MarkAsDuplicateConfig = ActionConfigBase.extend(
|
|
3276
|
+
z24.object({
|
|
3277
|
+
type: z24.literal(ActionType.MARK_AS_DUPLICATE)
|
|
3278
|
+
}).shape
|
|
3279
|
+
);
|
|
3280
|
+
var MarkAsNotDuplicateConfig = ActionConfigBase.extend(
|
|
3281
|
+
z24.object({
|
|
3282
|
+
type: z24.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
3283
|
+
}).shape
|
|
3284
|
+
);
|
|
3285
|
+
var AssignConfig = ActionConfigBase.extend(
|
|
3286
|
+
z24.object({
|
|
3287
|
+
type: z24.literal(ActionType.ASSIGN),
|
|
3288
|
+
flags: z24.never().optional().describe(
|
|
3289
|
+
"ASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
|
|
3290
|
+
)
|
|
3291
|
+
}).shape
|
|
3292
|
+
);
|
|
3293
|
+
var UnassignConfig = ActionConfigBase.extend(
|
|
3294
|
+
z24.object({
|
|
3295
|
+
type: z24.literal(ActionType.UNASSIGN),
|
|
3296
|
+
flags: z24.never().optional().describe(
|
|
3297
|
+
"UNASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
|
|
3298
|
+
)
|
|
3299
|
+
}).shape
|
|
3300
|
+
);
|
|
3301
|
+
var DeleteConfig = ActionConfigBase.extend(
|
|
3302
|
+
z24.object({
|
|
3303
|
+
type: z24.literal(ActionType.DELETE)
|
|
3304
|
+
}).shape
|
|
3305
|
+
);
|
|
3218
3306
|
var DeclareConfig = DeclarationActionBase.extend(
|
|
3219
3307
|
z24.object({
|
|
3220
3308
|
type: z24.literal(ActionType.DECLARE),
|
|
3221
3309
|
review: DeclarationReviewConfig.describe(
|
|
3222
3310
|
"Configuration of the review page fields."
|
|
3223
3311
|
),
|
|
3312
|
+
form: actionConfirmationForm,
|
|
3224
3313
|
dialogCopy: z24.object({
|
|
3225
3314
|
notify: TranslationConfig.describe(
|
|
3226
3315
|
"Confirmation text for the notify action"
|
|
@@ -3236,7 +3325,13 @@ var DeclareConfig = DeclarationActionBase.extend(
|
|
|
3236
3325
|
);
|
|
3237
3326
|
var ArchiveConfig = ActionConfigBase.extend(
|
|
3238
3327
|
z24.object({
|
|
3239
|
-
type: z24.literal(ActionType.ARCHIVE)
|
|
3328
|
+
type: z24.literal(ActionType.ARCHIVE),
|
|
3329
|
+
form: actionConfirmationForm
|
|
3330
|
+
}).shape
|
|
3331
|
+
);
|
|
3332
|
+
var UnarchiveConfig = ActionConfigBase.extend(
|
|
3333
|
+
z24.object({
|
|
3334
|
+
type: z24.literal(ActionType.UNARCHIVE)
|
|
3240
3335
|
}).shape
|
|
3241
3336
|
);
|
|
3242
3337
|
var EditActionConfig = ActionConfigBase.extend(
|
|
@@ -3257,12 +3352,14 @@ var EditActionConfig = ActionConfigBase.extend(
|
|
|
3257
3352
|
);
|
|
3258
3353
|
var RejectConfig = ActionConfigBase.extend(
|
|
3259
3354
|
z24.object({
|
|
3260
|
-
type: z24.literal(ActionType.REJECT)
|
|
3355
|
+
type: z24.literal(ActionType.REJECT),
|
|
3356
|
+
form: actionConfirmationForm
|
|
3261
3357
|
}).shape
|
|
3262
3358
|
);
|
|
3263
3359
|
var RegisterConfig = DeclarationActionBase.extend(
|
|
3264
3360
|
z24.object({
|
|
3265
|
-
type: z24.literal(ActionType.REGISTER)
|
|
3361
|
+
type: z24.literal(ActionType.REGISTER),
|
|
3362
|
+
form: actionConfirmationForm
|
|
3266
3363
|
}).shape
|
|
3267
3364
|
);
|
|
3268
3365
|
var PrintCertificateActionConfig = ActionConfigBase.extend(
|
|
@@ -3277,7 +3374,17 @@ var RequestCorrectionConfig = ActionConfigBase.extend(
|
|
|
3277
3374
|
correctionForm: ActionFormConfig
|
|
3278
3375
|
}).shape
|
|
3279
3376
|
);
|
|
3280
|
-
var
|
|
3377
|
+
var ApproveCorrectionConfig = ActionConfigBase.extend(
|
|
3378
|
+
z24.object({
|
|
3379
|
+
type: z24.literal(ActionType.APPROVE_CORRECTION)
|
|
3380
|
+
}).shape
|
|
3381
|
+
);
|
|
3382
|
+
var RejectCorrectionConfig = ActionConfigBase.extend(
|
|
3383
|
+
z24.object({
|
|
3384
|
+
type: z24.literal(ActionType.REJECT_CORRECTION)
|
|
3385
|
+
}).shape
|
|
3386
|
+
);
|
|
3387
|
+
var CustomActionConfig = ActionConfigBase.extend(
|
|
3281
3388
|
z24.object({
|
|
3282
3389
|
type: z24.literal(ActionType.CUSTOM),
|
|
3283
3390
|
customActionType: z24.string().describe("Type identifier of the custom action."),
|
|
@@ -3288,7 +3395,7 @@ var CustomActionConfig = ActionConfigBase.merge(
|
|
|
3288
3395
|
auditHistoryLabel: TranslationConfig.describe(
|
|
3289
3396
|
'The label to show in audit history for this action. For example "Approved".'
|
|
3290
3397
|
)
|
|
3291
|
-
})
|
|
3398
|
+
}).shape
|
|
3292
3399
|
);
|
|
3293
3400
|
var ActionConfig = z24.discriminatedUnion("type", [
|
|
3294
3401
|
/*
|
|
@@ -3299,9 +3406,37 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3299
3406
|
id: "ReadActionConfig",
|
|
3300
3407
|
description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
|
|
3301
3408
|
}),
|
|
3409
|
+
AssignConfig.meta({
|
|
3410
|
+
id: "AssignActionConfig",
|
|
3411
|
+
description: "Configuration for assigning a record to the current user."
|
|
3412
|
+
}),
|
|
3413
|
+
UnassignConfig.meta({
|
|
3414
|
+
id: "UnassignActionConfig",
|
|
3415
|
+
description: "Configuration for unassigning a record from its current assignee."
|
|
3416
|
+
}),
|
|
3417
|
+
DeleteConfig.meta({
|
|
3418
|
+
id: "DeleteActionConfig",
|
|
3419
|
+
description: "Configuration for deleting a draft record."
|
|
3420
|
+
}),
|
|
3421
|
+
NotifyConfig.meta({
|
|
3422
|
+
id: "NotifyActionConfig",
|
|
3423
|
+
description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
|
|
3424
|
+
}),
|
|
3302
3425
|
DeclareConfig.meta({
|
|
3303
3426
|
id: "DeclareActionConfig",
|
|
3304
|
-
description: "Configuration for the declare action. Includes review-page fields.
|
|
3427
|
+
description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
|
|
3428
|
+
}),
|
|
3429
|
+
DuplicateDetectedConfig.meta({
|
|
3430
|
+
id: "DuplicateDetectedActionConfig",
|
|
3431
|
+
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."
|
|
3432
|
+
}),
|
|
3433
|
+
MarkAsDuplicateConfig.meta({
|
|
3434
|
+
id: "MarkAsDuplicateActionConfig",
|
|
3435
|
+
description: "Configuration for marking a record as a duplicate."
|
|
3436
|
+
}),
|
|
3437
|
+
MarkAsNotDuplicateConfig.meta({
|
|
3438
|
+
id: "MarkAsNotDuplicateActionConfig",
|
|
3439
|
+
description: "Configuration for marking a record as not a duplicate, after it was previously flagged as one."
|
|
3305
3440
|
}),
|
|
3306
3441
|
RejectConfig.meta({
|
|
3307
3442
|
id: "RejectActionConfig",
|
|
@@ -3319,6 +3454,14 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3319
3454
|
id: "RequestCorrectionActionConfig",
|
|
3320
3455
|
description: "Configuration for requesting a correction on a registered record."
|
|
3321
3456
|
}),
|
|
3457
|
+
ApproveCorrectionConfig.meta({
|
|
3458
|
+
id: "ApproveCorrectionActionConfig",
|
|
3459
|
+
description: "Configuration for approving a requested correction."
|
|
3460
|
+
}),
|
|
3461
|
+
RejectCorrectionConfig.meta({
|
|
3462
|
+
id: "RejectCorrectionActionConfig",
|
|
3463
|
+
description: "Configuration for rejecting a requested correction."
|
|
3464
|
+
}),
|
|
3322
3465
|
EditActionConfig.meta({
|
|
3323
3466
|
id: "EditActionConfig",
|
|
3324
3467
|
description: "Configuration for editing a record before registration."
|
|
@@ -3327,6 +3470,10 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3327
3470
|
id: "ArchiveActionConfig",
|
|
3328
3471
|
description: "Configuration for archiving a record."
|
|
3329
3472
|
}),
|
|
3473
|
+
UnarchiveConfig.meta({
|
|
3474
|
+
id: "UnarchiveActionConfig",
|
|
3475
|
+
description: "Configuration for unarchiving a record."
|
|
3476
|
+
}),
|
|
3330
3477
|
CustomActionConfig.meta({
|
|
3331
3478
|
id: "CustomActionConfig",
|
|
3332
3479
|
description: "Configuration for a country-defined custom action. An event may include any number of these."
|
|
@@ -3908,7 +4055,7 @@ var isHiddenFieldType = (field3) => {
|
|
|
3908
4055
|
return field3.config.type === FieldType.ALPHA_HIDDEN;
|
|
3909
4056
|
};
|
|
3910
4057
|
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.
|
|
4058
|
+
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
4059
|
};
|
|
3913
4060
|
|
|
3914
4061
|
// ../commons/src/conditionals/validate.ts
|
|
@@ -4470,16 +4617,13 @@ function getActionConfig({
|
|
|
4470
4617
|
actionType,
|
|
4471
4618
|
customActionType
|
|
4472
4619
|
}) {
|
|
4620
|
+
if (actionType === ActionType.NOTIFY) {
|
|
4621
|
+
return eventConfiguration.actions.find((a) => a.type === ActionType.NOTIFY) ?? eventConfiguration.actions.find((a) => a.type === ActionType.DECLARE);
|
|
4622
|
+
}
|
|
4473
4623
|
return eventConfiguration.actions.find((a) => {
|
|
4474
4624
|
if (a.type === ActionType.CUSTOM && customActionType) {
|
|
4475
4625
|
return a.customActionType === customActionType;
|
|
4476
4626
|
}
|
|
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
4627
|
return a.type === actionType;
|
|
4484
4628
|
});
|
|
4485
4629
|
}
|
|
@@ -4489,7 +4633,19 @@ function getCustomActionFields(eventConfiguration, customActionType) {
|
|
|
4489
4633
|
customActionType,
|
|
4490
4634
|
actionType: ActionType.CUSTOM
|
|
4491
4635
|
});
|
|
4492
|
-
if (!actionConfig ||
|
|
4636
|
+
if (!actionConfig || actionConfig.type !== ActionType.CUSTOM) {
|
|
4637
|
+
return [];
|
|
4638
|
+
}
|
|
4639
|
+
return actionConfig.form;
|
|
4640
|
+
}
|
|
4641
|
+
function getActionFormFields(eventConfiguration, actionType, customActionType) {
|
|
4642
|
+
const actionConfig = eventConfiguration.actions.find((a) => {
|
|
4643
|
+
if (a.type === ActionType.CUSTOM && customActionType) {
|
|
4644
|
+
return a.customActionType === customActionType;
|
|
4645
|
+
}
|
|
4646
|
+
return a.type === actionType;
|
|
4647
|
+
});
|
|
4648
|
+
if (!actionConfig || !("form" in actionConfig) || actionConfig.form == null) {
|
|
4493
4649
|
return [];
|
|
4494
4650
|
}
|
|
4495
4651
|
return actionConfig.form;
|
|
@@ -4510,13 +4666,9 @@ var getActionAnnotationFields = (actionConfig) => {
|
|
|
4510
4666
|
if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
|
|
4511
4667
|
return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
|
|
4512
4668
|
}
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
if ("review" in actionConfig) {
|
|
4517
|
-
return actionConfig.review.fields;
|
|
4518
|
-
}
|
|
4519
|
-
return [];
|
|
4669
|
+
const reviewFields = "review" in actionConfig && actionConfig.review != null ? actionConfig.review.fields : [];
|
|
4670
|
+
const formFields = "form" in actionConfig && actionConfig.form != null ? actionConfig.form : [];
|
|
4671
|
+
return [...reviewFields, ...formFields];
|
|
4520
4672
|
};
|
|
4521
4673
|
function getAllAnnotationFields(config) {
|
|
4522
4674
|
return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
|
|
@@ -5633,7 +5785,7 @@ function validateActionFlags(event2, ctx) {
|
|
|
5633
5785
|
const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
|
|
5634
5786
|
const configuredFlagIds = event2.flags.map((flag2) => flag2.id);
|
|
5635
5787
|
const actionFlagIds = event2.actions.flatMap(
|
|
5636
|
-
(action) => action.flags.map((flag2) => flag2.id)
|
|
5788
|
+
(action) => (action.flags ?? []).map((flag2) => flag2.id)
|
|
5637
5789
|
);
|
|
5638
5790
|
for (const actionFlagId of actionFlagIds) {
|
|
5639
5791
|
const isConfigured = configuredFlagIds.includes(actionFlagId);
|
|
@@ -6308,6 +6460,11 @@ var ArchiveActionInput = BaseActionInput.extend(
|
|
|
6308
6460
|
content: ReasonContent
|
|
6309
6461
|
}).shape
|
|
6310
6462
|
);
|
|
6463
|
+
var UnarchiveActionInput = BaseActionInput.extend(
|
|
6464
|
+
z38.object({
|
|
6465
|
+
type: z38.literal(ActionType.UNARCHIVE).default(ActionType.UNARCHIVE)
|
|
6466
|
+
}).shape
|
|
6467
|
+
);
|
|
6311
6468
|
var AssignActionInput = BaseActionInput.extend(
|
|
6312
6469
|
z38.object({
|
|
6313
6470
|
type: z38.literal(ActionType.ASSIGN),
|
|
@@ -6369,6 +6526,7 @@ var ActionInput = z38.discriminatedUnion("type", [
|
|
|
6369
6526
|
id: "MarkNotDuplicateActionInput"
|
|
6370
6527
|
}),
|
|
6371
6528
|
ArchiveActionInput.meta({ id: "ArchiveActionInput" }),
|
|
6529
|
+
UnarchiveActionInput.meta({ id: "UnarchiveActionInput" }),
|
|
6372
6530
|
AssignActionInput.meta({ id: "AssignActionInput" }),
|
|
6373
6531
|
UnassignActionInput.meta({ id: "UnassignActionInput" }),
|
|
6374
6532
|
PrintCertificateActionInput.meta({ id: "PrintCertificateActionInput" }),
|
|
@@ -6483,8 +6641,11 @@ var updateActions = ActionTypes.extract([
|
|
|
6483
6641
|
ActionType.REGISTER,
|
|
6484
6642
|
ActionType.REJECT,
|
|
6485
6643
|
ActionType.ARCHIVE,
|
|
6644
|
+
ActionType.UNARCHIVE,
|
|
6486
6645
|
ActionType.PRINT_CERTIFICATE,
|
|
6487
6646
|
ActionType.REQUEST_CORRECTION,
|
|
6647
|
+
ActionType.APPROVE_CORRECTION,
|
|
6648
|
+
ActionType.REJECT_CORRECTION,
|
|
6488
6649
|
ActionType.CUSTOM
|
|
6489
6650
|
]);
|
|
6490
6651
|
function getActionUpdateMetadata(actions) {
|
|
@@ -6512,6 +6673,10 @@ function getActionUpdateMetadata(actions) {
|
|
|
6512
6673
|
}
|
|
6513
6674
|
function getLegalStatuses(actions) {
|
|
6514
6675
|
return {
|
|
6676
|
+
[EventStatus.enum.NOTIFIED]: getDeclarationActionCreationMetadata(
|
|
6677
|
+
ActionType.NOTIFY,
|
|
6678
|
+
actions
|
|
6679
|
+
),
|
|
6515
6680
|
[EventStatus.enum.DECLARED]: getDeclarationActionCreationMetadata(
|
|
6516
6681
|
ActionType.DECLARE,
|
|
6517
6682
|
actions
|
|
@@ -6526,9 +6691,6 @@ function getLegalStatuses(actions) {
|
|
|
6526
6691
|
// ../commons/src/events/state/flags.ts
|
|
6527
6692
|
var import_lodash3 = require("lodash");
|
|
6528
6693
|
var import_date_fns3 = require("date-fns");
|
|
6529
|
-
function isEditInProgress(actions) {
|
|
6530
|
-
return actions.at(-1)?.type === ActionType.EDIT;
|
|
6531
|
-
}
|
|
6532
6694
|
function findPendingCorrectionAction(writeActions2) {
|
|
6533
6695
|
let correctionRequestAction;
|
|
6534
6696
|
for (let i = writeActions2.length - 1; i >= 0; i--) {
|
|
@@ -6543,29 +6705,6 @@ function findPendingCorrectionAction(writeActions2) {
|
|
|
6543
6705
|
}
|
|
6544
6706
|
return correctionRequestAction;
|
|
6545
6707
|
}
|
|
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
6708
|
function isPotentialDuplicate(actions) {
|
|
6570
6709
|
return actions.reduce((prev, { type }) => {
|
|
6571
6710
|
if (type === ActionType.DUPLICATE_DETECTED) {
|
|
@@ -6593,6 +6732,85 @@ function isFlagConditionMet(conditional, form, action) {
|
|
|
6593
6732
|
}
|
|
6594
6733
|
});
|
|
6595
6734
|
}
|
|
6735
|
+
function actionConfigRemovesFlag(action, flagId, actionsUpToAndIncluding, event2, eventConfiguration) {
|
|
6736
|
+
if (!isActionConfigType(action.type)) {
|
|
6737
|
+
return false;
|
|
6738
|
+
}
|
|
6739
|
+
const actionConfig = getActionConfig({
|
|
6740
|
+
eventConfiguration,
|
|
6741
|
+
actionType: action.type,
|
|
6742
|
+
customActionType: "customActionType" in action ? action.customActionType : void 0
|
|
6743
|
+
});
|
|
6744
|
+
const removeOperations = (actionConfig?.flags ?? []).filter(
|
|
6745
|
+
({ id, operation }) => id === flagId && operation === "remove"
|
|
6746
|
+
);
|
|
6747
|
+
if (removeOperations.length === 0) {
|
|
6748
|
+
return false;
|
|
6749
|
+
}
|
|
6750
|
+
const eventUpToThisAction = { ...event2, actions: actionsUpToAndIncluding };
|
|
6751
|
+
const declaration = aggregateActionDeclarations(eventUpToThisAction);
|
|
6752
|
+
const annotation = aggregateActionAnnotations(eventUpToThisAction);
|
|
6753
|
+
const form = { ...declaration, ...annotation };
|
|
6754
|
+
return removeOperations.some(
|
|
6755
|
+
({ conditional }) => conditional ? isFlagConditionMet(conditional, form, action) : true
|
|
6756
|
+
);
|
|
6757
|
+
}
|
|
6758
|
+
var INHERENT_FLAG_RULES = [
|
|
6759
|
+
{
|
|
6760
|
+
flag: InherentFlags.CORRECTION_REQUESTED,
|
|
6761
|
+
setOn: [ActionType.REQUEST_CORRECTION],
|
|
6762
|
+
resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
|
|
6763
|
+
},
|
|
6764
|
+
{
|
|
6765
|
+
// INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
|
|
6766
|
+
// other status-changing action (see getStatusFromActions). ARCHIVE/UNARCHIVE
|
|
6767
|
+
// are deliberately excluded so the flag freezes across an archive/unarchive
|
|
6768
|
+
// round trip and comes back exactly as it was.
|
|
6769
|
+
flag: InherentFlags.INCOMPLETE,
|
|
6770
|
+
setOn: [ActionType.NOTIFY],
|
|
6771
|
+
resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
|
|
6772
|
+
},
|
|
6773
|
+
{
|
|
6774
|
+
flag: InherentFlags.REJECTED,
|
|
6775
|
+
setOn: [ActionType.REJECT],
|
|
6776
|
+
resetOn: [
|
|
6777
|
+
ActionType.NOTIFY,
|
|
6778
|
+
ActionType.DECLARE,
|
|
6779
|
+
ActionType.EDIT,
|
|
6780
|
+
ActionType.REGISTER
|
|
6781
|
+
]
|
|
6782
|
+
},
|
|
6783
|
+
{
|
|
6784
|
+
flag: InherentFlags.POTENTIAL_DUPLICATE,
|
|
6785
|
+
setOn: [ActionType.DUPLICATE_DETECTED],
|
|
6786
|
+
resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
|
|
6787
|
+
},
|
|
6788
|
+
{
|
|
6789
|
+
flag: InherentFlags.EDIT_IN_PROGRESS,
|
|
6790
|
+
setOn: [ActionType.EDIT],
|
|
6791
|
+
resetOnAnyOtherAction: true
|
|
6792
|
+
}
|
|
6793
|
+
];
|
|
6794
|
+
function resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration) {
|
|
6795
|
+
return acceptedActions.reduce((present, action, idx) => {
|
|
6796
|
+
if (rule.setOn.includes(action.type)) {
|
|
6797
|
+
return true;
|
|
6798
|
+
}
|
|
6799
|
+
if (rule.resetOnAnyOtherAction || (rule.resetOn ?? []).includes(action.type)) {
|
|
6800
|
+
return false;
|
|
6801
|
+
}
|
|
6802
|
+
if (actionConfigRemovesFlag(
|
|
6803
|
+
action,
|
|
6804
|
+
rule.flag,
|
|
6805
|
+
acceptedActions.slice(0, idx + 1),
|
|
6806
|
+
event2,
|
|
6807
|
+
eventConfiguration
|
|
6808
|
+
)) {
|
|
6809
|
+
return false;
|
|
6810
|
+
}
|
|
6811
|
+
return present;
|
|
6812
|
+
}, false);
|
|
6813
|
+
}
|
|
6596
6814
|
function resolveEventCustomFlags(event2, eventConfiguration) {
|
|
6597
6815
|
const actions = getAcceptedActions(event2).filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
6598
6816
|
return actions.reduce((acc, action, idx) => {
|
|
@@ -6614,7 +6832,7 @@ function resolveEventCustomFlags(event2, eventConfiguration) {
|
|
|
6614
6832
|
const declaration = aggregateActionDeclarations(eventUpToThisAction);
|
|
6615
6833
|
const annotation = aggregateActionAnnotations(eventUpToThisAction);
|
|
6616
6834
|
const form = { ...declaration, ...annotation };
|
|
6617
|
-
const flagsWithMetConditions = actionConfig.flags.filter(
|
|
6835
|
+
const flagsWithMetConditions = (actionConfig.flags ?? []).filter(
|
|
6618
6836
|
({ conditional }) => (
|
|
6619
6837
|
// If conditional is not provided, the flag is resolved
|
|
6620
6838
|
conditional ? isFlagConditionMet(conditional, form, action) : true
|
|
@@ -6641,40 +6859,46 @@ function getActionStatusFlags(sortedActions) {
|
|
|
6641
6859
|
return flag2;
|
|
6642
6860
|
});
|
|
6643
6861
|
}
|
|
6644
|
-
function getInherentFlags(sortedActions) {
|
|
6862
|
+
function getInherentFlags(sortedActions, event2, eventConfiguration) {
|
|
6645
6863
|
const acceptedActions = sortedActions.filter(
|
|
6646
6864
|
({ status: status2 }) => status2 === ActionStatus.Accepted
|
|
6647
6865
|
);
|
|
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;
|
|
6866
|
+
return INHERENT_FLAG_RULES.filter(
|
|
6867
|
+
(rule) => resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration)
|
|
6868
|
+
).map(({ flag: flag2 }) => flag2);
|
|
6665
6869
|
}
|
|
6666
6870
|
function getEventFlags(event2, config) {
|
|
6667
6871
|
const sortedActions = event2.actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
6668
6872
|
return [
|
|
6669
6873
|
...getActionStatusFlags(sortedActions),
|
|
6670
|
-
...getInherentFlags(sortedActions),
|
|
6874
|
+
...getInherentFlags(sortedActions, event2, config),
|
|
6671
6875
|
...resolveEventCustomFlags(event2, config)
|
|
6672
6876
|
];
|
|
6673
6877
|
}
|
|
6674
6878
|
|
|
6675
6879
|
// ../commons/src/events/state/index.ts
|
|
6676
6880
|
function getStatusFromActions(actions) {
|
|
6677
|
-
|
|
6881
|
+
const acceptedActions = actions.filter(
|
|
6882
|
+
({ status: status2 }) => status2 === ActionStatus.Accepted
|
|
6883
|
+
);
|
|
6884
|
+
const isCurrentlyArchived = acceptedActions.reduce(
|
|
6885
|
+
(archived, action) => {
|
|
6886
|
+
if (action.type === ActionType.ARCHIVE) {
|
|
6887
|
+
return true;
|
|
6888
|
+
}
|
|
6889
|
+
if (action.type === ActionType.UNARCHIVE) {
|
|
6890
|
+
return false;
|
|
6891
|
+
}
|
|
6892
|
+
return archived;
|
|
6893
|
+
},
|
|
6894
|
+
false
|
|
6895
|
+
);
|
|
6896
|
+
if (isCurrentlyArchived) {
|
|
6897
|
+
return EventStatus.enum.ARCHIVED;
|
|
6898
|
+
}
|
|
6899
|
+
return acceptedActions.filter(
|
|
6900
|
+
({ type }) => type !== ActionType.ARCHIVE && type !== ActionType.UNARCHIVE
|
|
6901
|
+
).reduce((status2, action) => {
|
|
6678
6902
|
switch (action.type) {
|
|
6679
6903
|
case ActionType.CREATE:
|
|
6680
6904
|
return EventStatus.enum.CREATED;
|
|
@@ -6682,10 +6906,11 @@ function getStatusFromActions(actions) {
|
|
|
6682
6906
|
return EventStatus.enum.DECLARED;
|
|
6683
6907
|
case ActionType.REGISTER:
|
|
6684
6908
|
return EventStatus.enum.REGISTERED;
|
|
6685
|
-
case ActionType.ARCHIVE:
|
|
6686
|
-
return EventStatus.enum.ARCHIVED;
|
|
6687
6909
|
case ActionType.NOTIFY:
|
|
6688
6910
|
return EventStatus.enum.NOTIFIED;
|
|
6911
|
+
// Already filtered out above; listed here only to satisfy exhaustiveness.
|
|
6912
|
+
case ActionType.ARCHIVE:
|
|
6913
|
+
case ActionType.UNARCHIVE:
|
|
6689
6914
|
case ActionType.CUSTOM:
|
|
6690
6915
|
case ActionType.PRINT_CERTIFICATE:
|
|
6691
6916
|
case ActionType.ASSIGN:
|
|
@@ -7672,6 +7897,11 @@ var TENNIS_CLUB_DECLARATION_REVIEW = {
|
|
|
7672
7897
|
id: "signature.upload.modal.title",
|
|
7673
7898
|
defaultMessage: "Draw signature",
|
|
7674
7899
|
description: "Title for the modal to draw signature"
|
|
7900
|
+
},
|
|
7901
|
+
// Zod applies the schema default at parse time, but this fixture bypasses
|
|
7902
|
+
// parsing — GeneratedInputField accesses configuration.maxFileSize directly.
|
|
7903
|
+
configuration: {
|
|
7904
|
+
maxFileSize: 5 * 1024 * 1024
|
|
7675
7905
|
}
|
|
7676
7906
|
}
|
|
7677
7907
|
]
|
|
@@ -8228,6 +8458,20 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
8228
8458
|
},
|
|
8229
8459
|
review: TENNIS_CLUB_DECLARATION_REVIEW
|
|
8230
8460
|
},
|
|
8461
|
+
{
|
|
8462
|
+
type: ActionType.NOTIFY,
|
|
8463
|
+
label: {
|
|
8464
|
+
defaultMessage: "Notify health worker",
|
|
8465
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
|
8466
|
+
id: "event.tennis-club-membership.action.notify.label"
|
|
8467
|
+
},
|
|
8468
|
+
flags: [
|
|
8469
|
+
{
|
|
8470
|
+
id: "health-worker-notified",
|
|
8471
|
+
operation: "add"
|
|
8472
|
+
}
|
|
8473
|
+
]
|
|
8474
|
+
},
|
|
8231
8475
|
{
|
|
8232
8476
|
type: ActionType.REJECT,
|
|
8233
8477
|
label: {
|
|
@@ -8470,6 +8714,17 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
8470
8714
|
}
|
|
8471
8715
|
}
|
|
8472
8716
|
],
|
|
8717
|
+
flags: [
|
|
8718
|
+
{
|
|
8719
|
+
id: "health-worker-notified",
|
|
8720
|
+
requiresAction: false,
|
|
8721
|
+
label: {
|
|
8722
|
+
id: "event.tennis-club-membership.flag.health-worker-notified.label",
|
|
8723
|
+
defaultMessage: "Health worker notified",
|
|
8724
|
+
description: "Label for the health-worker-notified flag"
|
|
8725
|
+
}
|
|
8726
|
+
}
|
|
8727
|
+
],
|
|
8473
8728
|
advancedSearch: [
|
|
8474
8729
|
{
|
|
8475
8730
|
title: {
|
|
@@ -9740,6 +9995,14 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
|
|
|
9740
9995
|
},
|
|
9741
9996
|
...input
|
|
9742
9997
|
}),
|
|
9998
|
+
unarchive: (eventId, input = {}) => ({
|
|
9999
|
+
type: ActionType.UNARCHIVE,
|
|
10000
|
+
transactionId: input.transactionId ?? getUUID(),
|
|
10001
|
+
declaration: {},
|
|
10002
|
+
annotation: {},
|
|
10003
|
+
eventId,
|
|
10004
|
+
...input
|
|
10005
|
+
}),
|
|
9743
10006
|
reject: (eventId, input = {}) => ({
|
|
9744
10007
|
type: ActionType.REJECT,
|
|
9745
10008
|
transactionId: input.transactionId ?? getUUID(),
|
|
@@ -9898,6 +10161,7 @@ function generateActionDocument({
|
|
|
9898
10161
|
case ActionType.NOTIFY:
|
|
9899
10162
|
case ActionType.REGISTER:
|
|
9900
10163
|
case ActionType.REQUEST_CORRECTION:
|
|
10164
|
+
case ActionType.UNARCHIVE:
|
|
9901
10165
|
return { ...actionBase, type: action };
|
|
9902
10166
|
case ActionType.EDIT:
|
|
9903
10167
|
return {
|
|
@@ -10228,7 +10492,7 @@ function matchesJurisdictionFilter(locationIds, filter, user2) {
|
|
|
10228
10492
|
return locationIds.some((id) => id === user2.primaryOfficeId);
|
|
10229
10493
|
}
|
|
10230
10494
|
if (filter === JurisdictionFilter.enum.administrativeArea) {
|
|
10231
|
-
return user2.administrativeAreaId
|
|
10495
|
+
return !user2.administrativeAreaId || locationIds.some((id) => id === user2.administrativeAreaId);
|
|
10232
10496
|
}
|
|
10233
10497
|
return true;
|
|
10234
10498
|
}
|
|
@@ -10255,6 +10519,25 @@ function canAccessEventWithScope(event2, scope, user2, customActionType) {
|
|
|
10255
10519
|
}
|
|
10256
10520
|
if (scopeUsesDeclaredOptions(scope)) {
|
|
10257
10521
|
const { options } = scope;
|
|
10522
|
+
if (options?.notifiedBy === UserFilter.enum.user) {
|
|
10523
|
+
if (event2.legalStatuses?.NOTIFIED?.createdBy !== user2.id) {
|
|
10524
|
+
return false;
|
|
10525
|
+
}
|
|
10526
|
+
}
|
|
10527
|
+
if (options?.notifiedIn === JurisdictionFilter.enum.location && !matchesJurisdictionFilter(
|
|
10528
|
+
event2.legalStatuses?.NOTIFIED?.createdAtLocation,
|
|
10529
|
+
JurisdictionFilter.enum.location,
|
|
10530
|
+
user2
|
|
10531
|
+
)) {
|
|
10532
|
+
return false;
|
|
10533
|
+
}
|
|
10534
|
+
if (options?.notifiedIn === JurisdictionFilter.enum.administrativeArea && !matchesJurisdictionFilter(
|
|
10535
|
+
event2.legalStatuses?.NOTIFIED?.createdAtLocation,
|
|
10536
|
+
JurisdictionFilter.enum.administrativeArea,
|
|
10537
|
+
user2
|
|
10538
|
+
)) {
|
|
10539
|
+
return false;
|
|
10540
|
+
}
|
|
10258
10541
|
if (options?.declaredBy === UserFilter.enum.user) {
|
|
10259
10542
|
if (event2.legalStatuses?.DECLARED?.createdBy !== user2.id) {
|
|
10260
10543
|
return false;
|
|
@@ -10317,7 +10600,7 @@ function canAccessUserWithScope({
|
|
|
10317
10600
|
}
|
|
10318
10601
|
const hasAdministrativeAreaInHierarchy = userToAccess.administrativeHierarchy.some(
|
|
10319
10602
|
(id) => user2.administrativeAreaId === id
|
|
10320
|
-
) || user2.administrativeAreaId
|
|
10603
|
+
) || !user2.administrativeAreaId;
|
|
10321
10604
|
if (opts?.accessLevel === JurisdictionFilter.enum.administrativeArea && !hasAdministrativeAreaInHierarchy) {
|
|
10322
10605
|
return false;
|
|
10323
10606
|
}
|
|
@@ -10397,6 +10680,7 @@ var ACTION_SCOPE_MAP = {
|
|
|
10397
10680
|
[ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
|
|
10398
10681
|
[ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
|
|
10399
10682
|
[ActionType.ARCHIVE]: ["record.archive"],
|
|
10683
|
+
[ActionType.UNARCHIVE]: ["record.unarchive"],
|
|
10400
10684
|
[ActionType.REJECT]: ["record.reject"],
|
|
10401
10685
|
[ActionType.ASSIGN]: null,
|
|
10402
10686
|
[ActionType.UNASSIGN]: null,
|
|
@@ -10603,7 +10887,11 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
|
10603
10887
|
ActionType.CUSTOM,
|
|
10604
10888
|
ClientSpecificAction.REVIEW_CORRECTION_REQUEST
|
|
10605
10889
|
],
|
|
10606
|
-
[EventStatus.enum.ARCHIVED]: [
|
|
10890
|
+
[EventStatus.enum.ARCHIVED]: [
|
|
10891
|
+
ActionType.READ,
|
|
10892
|
+
ActionType.CUSTOM,
|
|
10893
|
+
ActionType.UNARCHIVE
|
|
10894
|
+
]
|
|
10607
10895
|
};
|
|
10608
10896
|
var ACTION_FILTERS = {
|
|
10609
10897
|
[ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
@@ -10616,6 +10904,7 @@ var ACTION_FILTERS = {
|
|
|
10616
10904
|
[ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10617
10905
|
[ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10618
10906
|
[ActionType.ARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10907
|
+
[ActionType.UNARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10619
10908
|
[ActionType.ASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10620
10909
|
[ActionType.UNASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10621
10910
|
[ActionType.CUSTOM]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested"))
|
|
@@ -10623,18 +10912,19 @@ var ACTION_FILTERS = {
|
|
|
10623
10912
|
function filterActionsByFlags(actions, flags) {
|
|
10624
10913
|
return actions.filter((action) => ACTION_FILTERS[action]?.(flags) ?? true);
|
|
10625
10914
|
}
|
|
10915
|
+
var REJECTED_ACTIONS = [
|
|
10916
|
+
ActionType.READ,
|
|
10917
|
+
ActionType.NOTIFY,
|
|
10918
|
+
ActionType.CUSTOM,
|
|
10919
|
+
ActionType.EDIT,
|
|
10920
|
+
ActionType.ARCHIVE
|
|
10921
|
+
];
|
|
10626
10922
|
function getAvailableActionsWithoutFlagFilters(status2, flags) {
|
|
10627
10923
|
if (flags.includes(InherentFlags.EDIT_IN_PROGRESS)) {
|
|
10628
10924
|
return [ActionType.NOTIFY, ActionType.DECLARE, ActionType.REGISTER];
|
|
10629
10925
|
}
|
|
10630
|
-
if (flags.includes(InherentFlags.REJECTED)) {
|
|
10631
|
-
return
|
|
10632
|
-
ActionType.READ,
|
|
10633
|
-
ActionType.NOTIFY,
|
|
10634
|
-
ActionType.CUSTOM,
|
|
10635
|
-
ActionType.EDIT,
|
|
10636
|
-
ActionType.ARCHIVE
|
|
10637
|
-
];
|
|
10926
|
+
if (flags.includes(InherentFlags.REJECTED) && status2 !== EventStatus.enum.ARCHIVED) {
|
|
10927
|
+
return REJECTED_ACTIONS;
|
|
10638
10928
|
}
|
|
10639
10929
|
return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status2];
|
|
10640
10930
|
}
|