@opencrvs/toolkit 2.0.0-rc.147ca01 → 2.0.0-rc.1498d58
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/dist/application-config/index.js +35 -6
- 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 +230 -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 +15 -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 +351 -78
- 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 +236 -12
- 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.0.0-rc.1498d58.tgz +0 -0
- package/package.json +15 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.0.0-rc.147ca01.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,
|
|
@@ -480,6 +482,7 @@ var RecordScopeTypeV2 = z2.enum([
|
|
|
480
482
|
"record.edit",
|
|
481
483
|
"record.reject",
|
|
482
484
|
"record.archive",
|
|
485
|
+
"record.unarchive",
|
|
483
486
|
"record.review-duplicates",
|
|
484
487
|
"record.register",
|
|
485
488
|
"record.print-certified-copies",
|
|
@@ -519,11 +522,13 @@ var scopeOptionsPlaceEvent = z2.object({
|
|
|
519
522
|
event: scopeByEvent,
|
|
520
523
|
placeOfEvent: JurisdictionFilter.optional()
|
|
521
524
|
}).describe("Options applicable to all record scopes.");
|
|
522
|
-
var
|
|
525
|
+
var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
526
|
+
notifiedIn: JurisdictionFilter.optional(),
|
|
527
|
+
notifiedBy: UserFilter.optional(),
|
|
523
528
|
declaredIn: JurisdictionFilter.optional(),
|
|
524
529
|
declaredBy: UserFilter.optional()
|
|
525
530
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
526
|
-
var AllRecordScopeOptions =
|
|
531
|
+
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
527
532
|
registeredIn: JurisdictionFilter.optional(),
|
|
528
533
|
registeredBy: UserFilter.optional()
|
|
529
534
|
}).describe(
|
|
@@ -561,6 +566,8 @@ var ResolvedScopeOptionsPlaceEvent = z2.object({
|
|
|
561
566
|
"Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
|
|
562
567
|
);
|
|
563
568
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
569
|
+
notifiedIn: UUID.nullish(),
|
|
570
|
+
notifiedBy: z2.string().optional(),
|
|
564
571
|
declaredIn: UUID.nullish(),
|
|
565
572
|
declaredBy: z2.string().optional()
|
|
566
573
|
}).describe(
|
|
@@ -581,6 +588,7 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
|
581
588
|
"record.edit",
|
|
582
589
|
"record.reject",
|
|
583
590
|
"record.archive",
|
|
591
|
+
"record.unarchive",
|
|
584
592
|
"record.review-duplicates",
|
|
585
593
|
"record.register"
|
|
586
594
|
]);
|
|
@@ -606,7 +614,7 @@ var RecordScopeV2 = z2.discriminatedUnion("type", [
|
|
|
606
614
|
}),
|
|
607
615
|
z2.object({
|
|
608
616
|
type: ScopesWithDeclaredOptions,
|
|
609
|
-
options:
|
|
617
|
+
options: scopeOptionsDeclaredOrNotified.optional()
|
|
610
618
|
}),
|
|
611
619
|
z2.object({
|
|
612
620
|
type: ScopesWithFullOptions,
|
|
@@ -729,8 +737,9 @@ var decodeScope = (encodedScope) => {
|
|
|
729
737
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
730
738
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
731
739
|
accessLevel: JurisdictionFilter.enum.all,
|
|
732
|
-
|
|
733
|
-
declaredIn: JurisdictionFilter.enum.all
|
|
740
|
+
notifiedIn: JurisdictionFilter.enum.all,
|
|
741
|
+
declaredIn: JurisdictionFilter.enum.all,
|
|
742
|
+
registeredIn: JurisdictionFilter.enum.all
|
|
734
743
|
};
|
|
735
744
|
function getAcceptedScopesByType({
|
|
736
745
|
acceptedScopes,
|
|
@@ -766,6 +775,7 @@ var ActionType = {
|
|
|
766
775
|
MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
|
|
767
776
|
MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
|
|
768
777
|
ARCHIVE: "ARCHIVE",
|
|
778
|
+
UNARCHIVE: "UNARCHIVE",
|
|
769
779
|
// Record actions
|
|
770
780
|
PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
|
|
771
781
|
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
|
@@ -785,6 +795,7 @@ var ConfirmableActions = [
|
|
|
785
795
|
ActionType.REGISTER,
|
|
786
796
|
ActionType.REJECT,
|
|
787
797
|
ActionType.ARCHIVE,
|
|
798
|
+
ActionType.UNARCHIVE,
|
|
788
799
|
ActionType.PRINT_CERTIFICATE,
|
|
789
800
|
ActionType.REQUEST_CORRECTION,
|
|
790
801
|
ActionType.APPROVE_CORRECTION,
|
|
@@ -803,6 +814,7 @@ var ActionTypes = z4.enum([
|
|
|
803
814
|
"MARK_AS_DUPLICATE",
|
|
804
815
|
"MARK_AS_NOT_DUPLICATE",
|
|
805
816
|
"ARCHIVE",
|
|
817
|
+
"UNARCHIVE",
|
|
806
818
|
"PRINT_CERTIFICATE",
|
|
807
819
|
"REQUEST_CORRECTION",
|
|
808
820
|
"REJECT_CORRECTION",
|
|
@@ -846,6 +858,7 @@ var WorkqueueActionType = ActionTypes.extract([
|
|
|
846
858
|
ActionType.REJECT,
|
|
847
859
|
ActionType.MARK_AS_DUPLICATE,
|
|
848
860
|
ActionType.ARCHIVE,
|
|
861
|
+
ActionType.UNARCHIVE,
|
|
849
862
|
ActionType.PRINT_CERTIFICATE,
|
|
850
863
|
ActionType.REQUEST_CORRECTION
|
|
851
864
|
]);
|
|
@@ -910,6 +923,7 @@ var EventActionEntrySchema = AuditLogEntryBase.extend({
|
|
|
910
923
|
"event.actions.unassign.request",
|
|
911
924
|
"event.actions.read.request",
|
|
912
925
|
"event.actions.archive.request",
|
|
926
|
+
"event.actions.unarchive.request",
|
|
913
927
|
"event.actions.reinstate.request",
|
|
914
928
|
"event.actions.print_certificate.request",
|
|
915
929
|
"event.actions.correction.request.request",
|
|
@@ -1219,6 +1233,11 @@ var FieldTypesToHideInReview = [
|
|
|
1219
1233
|
FieldType.ALPHA_PRINT_BUTTON,
|
|
1220
1234
|
FieldType.ALPHA_HIDDEN
|
|
1221
1235
|
];
|
|
1236
|
+
var HiddenFieldTypes = [
|
|
1237
|
+
FieldType.HTTP,
|
|
1238
|
+
FieldType.QUERY_PARAM_READER,
|
|
1239
|
+
FieldType.ALPHA_HIDDEN
|
|
1240
|
+
];
|
|
1222
1241
|
|
|
1223
1242
|
// ../commons/src/events/FieldValue.ts
|
|
1224
1243
|
var z12 = __toESM(require("zod/v4"));
|
|
@@ -1638,6 +1657,11 @@ var ArchiveAction = ActionBase.extend(
|
|
|
1638
1657
|
content: ReasonContent
|
|
1639
1658
|
}).shape
|
|
1640
1659
|
);
|
|
1660
|
+
var UnarchiveAction = ActionBase.extend(
|
|
1661
|
+
z14.object({
|
|
1662
|
+
type: z14.literal(ActionType.UNARCHIVE)
|
|
1663
|
+
}).shape
|
|
1664
|
+
);
|
|
1641
1665
|
var CreatedAction = ActionBase.extend(
|
|
1642
1666
|
z14.object({
|
|
1643
1667
|
type: z14.literal(ActionType.CREATE)
|
|
@@ -1704,6 +1728,7 @@ var ActionDocument = z14.discriminatedUnion("type", [
|
|
|
1704
1728
|
MarkNotDuplicateAction.meta({ id: "MarkNotDuplicateAction" }),
|
|
1705
1729
|
MarkAsDuplicateAction.meta({ id: "MarkAsDuplicateAction" }),
|
|
1706
1730
|
ArchiveAction.meta({ id: "ArchiveAction" }),
|
|
1731
|
+
UnarchiveAction.meta({ id: "UnarchiveAction" }),
|
|
1707
1732
|
NotifiedAction.meta({ id: "NotifiedAction" }),
|
|
1708
1733
|
RegisterAction.meta({ id: "RegisterAction" }),
|
|
1709
1734
|
DeclareAction.meta({ id: "DeclareAction" }),
|
|
@@ -1809,6 +1834,7 @@ var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
|
1809
1834
|
)
|
|
1810
1835
|
});
|
|
1811
1836
|
var LegalStatuses = z16.object({
|
|
1837
|
+
[EventStatus.enum.NOTIFIED]: ActionCreationMetadata.nullish(),
|
|
1812
1838
|
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
|
1813
1839
|
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
|
1814
1840
|
});
|
|
@@ -1950,6 +1976,8 @@ var eventMetadataLabelMap = {
|
|
|
1950
1976
|
var EventMetadataDateFieldIdInput = z16.enum([
|
|
1951
1977
|
"createdAt",
|
|
1952
1978
|
"updatedAt",
|
|
1979
|
+
"legalStatuses.NOTIFIED.createdAt",
|
|
1980
|
+
"legalStatuses.NOTIFIED.acceptedAt",
|
|
1953
1981
|
"legalStatuses.DECLARED.createdAt",
|
|
1954
1982
|
"legalStatuses.DECLARED.acceptedAt",
|
|
1955
1983
|
"legalStatuses.REGISTERED.createdAt",
|
|
@@ -1958,6 +1986,8 @@ var EventMetadataDateFieldIdInput = z16.enum([
|
|
|
1958
1986
|
var EventMetadataDateFieldId = z16.enum([
|
|
1959
1987
|
"event.createdAt",
|
|
1960
1988
|
"event.updatedAt",
|
|
1989
|
+
"event.legalStatuses.NOTIFIED.createdAt",
|
|
1990
|
+
"event.legalStatuses.NOTIFIED.acceptedAt",
|
|
1961
1991
|
"event.legalStatuses.DECLARED.createdAt",
|
|
1962
1992
|
"event.legalStatuses.DECLARED.acceptedAt",
|
|
1963
1993
|
"event.legalStatuses.REGISTERED.createdAt",
|
|
@@ -2017,7 +2047,8 @@ var Range = import_v4.z.object({
|
|
|
2017
2047
|
});
|
|
2018
2048
|
var ContainsFlags = import_v4.z.object({
|
|
2019
2049
|
anyOf: import_v4.z.array(Flag).optional(),
|
|
2020
|
-
noneOf: import_v4.z.array(Flag).optional()
|
|
2050
|
+
noneOf: import_v4.z.array(Flag).optional(),
|
|
2051
|
+
allOf: import_v4.z.array(Flag).optional()
|
|
2021
2052
|
}).meta({
|
|
2022
2053
|
id: "ContainsFlags"
|
|
2023
2054
|
});
|
|
@@ -2292,6 +2323,7 @@ var NumberField = BaseField.extend({
|
|
|
2292
2323
|
configuration: import_v43.default.object({
|
|
2293
2324
|
min: import_v43.default.number().optional().describe("Minimum value"),
|
|
2294
2325
|
max: import_v43.default.number().optional().describe("Maximum value"),
|
|
2326
|
+
integer: import_v43.default.boolean().optional().describe("When true, only whole numbers are allowed"),
|
|
2295
2327
|
prefix: TranslationConfig.optional(),
|
|
2296
2328
|
postfix: TranslationConfig.optional()
|
|
2297
2329
|
}).optional()
|
|
@@ -3215,6 +3247,57 @@ var ReadActionConfig = ActionConfigBase.extend(
|
|
|
3215
3247
|
conditionals: z24.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
|
|
3216
3248
|
}).shape
|
|
3217
3249
|
);
|
|
3250
|
+
var NotifyConfig = ActionConfigBase.extend(
|
|
3251
|
+
z24.object({
|
|
3252
|
+
type: z24.literal(ActionType.NOTIFY)
|
|
3253
|
+
}).shape
|
|
3254
|
+
);
|
|
3255
|
+
var DuplicateDetectedConfig = ActionConfigBase.extend(
|
|
3256
|
+
z24.object({
|
|
3257
|
+
type: z24.literal(ActionType.DUPLICATE_DETECTED),
|
|
3258
|
+
label: z24.never().optional().describe(
|
|
3259
|
+
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no label."
|
|
3260
|
+
),
|
|
3261
|
+
supportingCopy: z24.never().optional(),
|
|
3262
|
+
icon: z24.never().optional().describe(
|
|
3263
|
+
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no icon."
|
|
3264
|
+
),
|
|
3265
|
+
conditionals: z24.never().optional().describe(
|
|
3266
|
+
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it cannot be disabled or hidden with conditionals."
|
|
3267
|
+
)
|
|
3268
|
+
}).shape
|
|
3269
|
+
);
|
|
3270
|
+
var MarkAsDuplicateConfig = ActionConfigBase.extend(
|
|
3271
|
+
z24.object({
|
|
3272
|
+
type: z24.literal(ActionType.MARK_AS_DUPLICATE)
|
|
3273
|
+
}).shape
|
|
3274
|
+
);
|
|
3275
|
+
var MarkAsNotDuplicateConfig = ActionConfigBase.extend(
|
|
3276
|
+
z24.object({
|
|
3277
|
+
type: z24.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
3278
|
+
}).shape
|
|
3279
|
+
);
|
|
3280
|
+
var AssignConfig = ActionConfigBase.extend(
|
|
3281
|
+
z24.object({
|
|
3282
|
+
type: z24.literal(ActionType.ASSIGN),
|
|
3283
|
+
flags: z24.never().optional().describe(
|
|
3284
|
+
"ASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
|
|
3285
|
+
)
|
|
3286
|
+
}).shape
|
|
3287
|
+
);
|
|
3288
|
+
var UnassignConfig = ActionConfigBase.extend(
|
|
3289
|
+
z24.object({
|
|
3290
|
+
type: z24.literal(ActionType.UNASSIGN),
|
|
3291
|
+
flags: z24.never().optional().describe(
|
|
3292
|
+
"UNASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
|
|
3293
|
+
)
|
|
3294
|
+
}).shape
|
|
3295
|
+
);
|
|
3296
|
+
var DeleteConfig = ActionConfigBase.extend(
|
|
3297
|
+
z24.object({
|
|
3298
|
+
type: z24.literal(ActionType.DELETE)
|
|
3299
|
+
}).shape
|
|
3300
|
+
);
|
|
3218
3301
|
var DeclareConfig = DeclarationActionBase.extend(
|
|
3219
3302
|
z24.object({
|
|
3220
3303
|
type: z24.literal(ActionType.DECLARE),
|
|
@@ -3239,6 +3322,11 @@ var ArchiveConfig = ActionConfigBase.extend(
|
|
|
3239
3322
|
type: z24.literal(ActionType.ARCHIVE)
|
|
3240
3323
|
}).shape
|
|
3241
3324
|
);
|
|
3325
|
+
var UnarchiveConfig = ActionConfigBase.extend(
|
|
3326
|
+
z24.object({
|
|
3327
|
+
type: z24.literal(ActionType.UNARCHIVE)
|
|
3328
|
+
}).shape
|
|
3329
|
+
);
|
|
3242
3330
|
var EditActionConfig = ActionConfigBase.extend(
|
|
3243
3331
|
z24.object({
|
|
3244
3332
|
type: z24.literal(ActionType.EDIT),
|
|
@@ -3277,7 +3365,17 @@ var RequestCorrectionConfig = ActionConfigBase.extend(
|
|
|
3277
3365
|
correctionForm: ActionFormConfig
|
|
3278
3366
|
}).shape
|
|
3279
3367
|
);
|
|
3280
|
-
var
|
|
3368
|
+
var ApproveCorrectionConfig = ActionConfigBase.extend(
|
|
3369
|
+
z24.object({
|
|
3370
|
+
type: z24.literal(ActionType.APPROVE_CORRECTION)
|
|
3371
|
+
}).shape
|
|
3372
|
+
);
|
|
3373
|
+
var RejectCorrectionConfig = ActionConfigBase.extend(
|
|
3374
|
+
z24.object({
|
|
3375
|
+
type: z24.literal(ActionType.REJECT_CORRECTION)
|
|
3376
|
+
}).shape
|
|
3377
|
+
);
|
|
3378
|
+
var CustomActionConfig = ActionConfigBase.extend(
|
|
3281
3379
|
z24.object({
|
|
3282
3380
|
type: z24.literal(ActionType.CUSTOM),
|
|
3283
3381
|
customActionType: z24.string().describe("Type identifier of the custom action."),
|
|
@@ -3288,7 +3386,7 @@ var CustomActionConfig = ActionConfigBase.merge(
|
|
|
3288
3386
|
auditHistoryLabel: TranslationConfig.describe(
|
|
3289
3387
|
'The label to show in audit history for this action. For example "Approved".'
|
|
3290
3388
|
)
|
|
3291
|
-
})
|
|
3389
|
+
}).shape
|
|
3292
3390
|
);
|
|
3293
3391
|
var ActionConfig = z24.discriminatedUnion("type", [
|
|
3294
3392
|
/*
|
|
@@ -3299,9 +3397,37 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3299
3397
|
id: "ReadActionConfig",
|
|
3300
3398
|
description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
|
|
3301
3399
|
}),
|
|
3400
|
+
AssignConfig.meta({
|
|
3401
|
+
id: "AssignActionConfig",
|
|
3402
|
+
description: "Configuration for assigning a record to the current user."
|
|
3403
|
+
}),
|
|
3404
|
+
UnassignConfig.meta({
|
|
3405
|
+
id: "UnassignActionConfig",
|
|
3406
|
+
description: "Configuration for unassigning a record from its current assignee."
|
|
3407
|
+
}),
|
|
3408
|
+
DeleteConfig.meta({
|
|
3409
|
+
id: "DeleteActionConfig",
|
|
3410
|
+
description: "Configuration for deleting a draft record."
|
|
3411
|
+
}),
|
|
3412
|
+
NotifyConfig.meta({
|
|
3413
|
+
id: "NotifyActionConfig",
|
|
3414
|
+
description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
|
|
3415
|
+
}),
|
|
3302
3416
|
DeclareConfig.meta({
|
|
3303
3417
|
id: "DeclareActionConfig",
|
|
3304
|
-
description: "Configuration for the declare action. Includes review-page fields.
|
|
3418
|
+
description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
|
|
3419
|
+
}),
|
|
3420
|
+
DuplicateDetectedConfig.meta({
|
|
3421
|
+
id: "DuplicateDetectedActionConfig",
|
|
3422
|
+
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."
|
|
3423
|
+
}),
|
|
3424
|
+
MarkAsDuplicateConfig.meta({
|
|
3425
|
+
id: "MarkAsDuplicateActionConfig",
|
|
3426
|
+
description: "Configuration for marking a record as a duplicate."
|
|
3427
|
+
}),
|
|
3428
|
+
MarkAsNotDuplicateConfig.meta({
|
|
3429
|
+
id: "MarkAsNotDuplicateActionConfig",
|
|
3430
|
+
description: "Configuration for marking a record as not a duplicate, after it was previously flagged as one."
|
|
3305
3431
|
}),
|
|
3306
3432
|
RejectConfig.meta({
|
|
3307
3433
|
id: "RejectActionConfig",
|
|
@@ -3319,6 +3445,14 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3319
3445
|
id: "RequestCorrectionActionConfig",
|
|
3320
3446
|
description: "Configuration for requesting a correction on a registered record."
|
|
3321
3447
|
}),
|
|
3448
|
+
ApproveCorrectionConfig.meta({
|
|
3449
|
+
id: "ApproveCorrectionActionConfig",
|
|
3450
|
+
description: "Configuration for approving a requested correction."
|
|
3451
|
+
}),
|
|
3452
|
+
RejectCorrectionConfig.meta({
|
|
3453
|
+
id: "RejectCorrectionActionConfig",
|
|
3454
|
+
description: "Configuration for rejecting a requested correction."
|
|
3455
|
+
}),
|
|
3322
3456
|
EditActionConfig.meta({
|
|
3323
3457
|
id: "EditActionConfig",
|
|
3324
3458
|
description: "Configuration for editing a record before registration."
|
|
@@ -3327,6 +3461,10 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3327
3461
|
id: "ArchiveActionConfig",
|
|
3328
3462
|
description: "Configuration for archiving a record."
|
|
3329
3463
|
}),
|
|
3464
|
+
UnarchiveConfig.meta({
|
|
3465
|
+
id: "UnarchiveActionConfig",
|
|
3466
|
+
description: "Configuration for unarchiving a record."
|
|
3467
|
+
}),
|
|
3330
3468
|
CustomActionConfig.meta({
|
|
3331
3469
|
id: "CustomActionConfig",
|
|
3332
3470
|
description: "Configuration for a country-defined custom action. An event may include any number of these."
|
|
@@ -3908,7 +4046,7 @@ var isHiddenFieldType = (field3) => {
|
|
|
3908
4046
|
return field3.config.type === FieldType.ALPHA_HIDDEN;
|
|
3909
4047
|
};
|
|
3910
4048
|
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.
|
|
4049
|
+
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
4050
|
};
|
|
3913
4051
|
|
|
3914
4052
|
// ../commons/src/conditionals/validate.ts
|
|
@@ -4470,16 +4608,13 @@ function getActionConfig({
|
|
|
4470
4608
|
actionType,
|
|
4471
4609
|
customActionType
|
|
4472
4610
|
}) {
|
|
4611
|
+
if (actionType === ActionType.NOTIFY) {
|
|
4612
|
+
return eventConfiguration.actions.find((a) => a.type === ActionType.NOTIFY) ?? eventConfiguration.actions.find((a) => a.type === ActionType.DECLARE);
|
|
4613
|
+
}
|
|
4473
4614
|
return eventConfiguration.actions.find((a) => {
|
|
4474
4615
|
if (a.type === ActionType.CUSTOM && customActionType) {
|
|
4475
4616
|
return a.customActionType === customActionType;
|
|
4476
4617
|
}
|
|
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
4618
|
return a.type === actionType;
|
|
4484
4619
|
});
|
|
4485
4620
|
}
|
|
@@ -4513,7 +4648,7 @@ var getActionAnnotationFields = (actionConfig) => {
|
|
|
4513
4648
|
if (actionConfig.type === ActionType.CUSTOM) {
|
|
4514
4649
|
return actionConfig.form;
|
|
4515
4650
|
}
|
|
4516
|
-
if ("review" in actionConfig) {
|
|
4651
|
+
if ("review" in actionConfig && actionConfig.review != null) {
|
|
4517
4652
|
return actionConfig.review.fields;
|
|
4518
4653
|
}
|
|
4519
4654
|
return [];
|
|
@@ -5633,7 +5768,7 @@ function validateActionFlags(event2, ctx) {
|
|
|
5633
5768
|
const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
|
|
5634
5769
|
const configuredFlagIds = event2.flags.map((flag2) => flag2.id);
|
|
5635
5770
|
const actionFlagIds = event2.actions.flatMap(
|
|
5636
|
-
(action) => action.flags.map((flag2) => flag2.id)
|
|
5771
|
+
(action) => (action.flags ?? []).map((flag2) => flag2.id)
|
|
5637
5772
|
);
|
|
5638
5773
|
for (const actionFlagId of actionFlagIds) {
|
|
5639
5774
|
const isConfigured = configuredFlagIds.includes(actionFlagId);
|
|
@@ -6308,6 +6443,11 @@ var ArchiveActionInput = BaseActionInput.extend(
|
|
|
6308
6443
|
content: ReasonContent
|
|
6309
6444
|
}).shape
|
|
6310
6445
|
);
|
|
6446
|
+
var UnarchiveActionInput = BaseActionInput.extend(
|
|
6447
|
+
z38.object({
|
|
6448
|
+
type: z38.literal(ActionType.UNARCHIVE).default(ActionType.UNARCHIVE)
|
|
6449
|
+
}).shape
|
|
6450
|
+
);
|
|
6311
6451
|
var AssignActionInput = BaseActionInput.extend(
|
|
6312
6452
|
z38.object({
|
|
6313
6453
|
type: z38.literal(ActionType.ASSIGN),
|
|
@@ -6369,6 +6509,7 @@ var ActionInput = z38.discriminatedUnion("type", [
|
|
|
6369
6509
|
id: "MarkNotDuplicateActionInput"
|
|
6370
6510
|
}),
|
|
6371
6511
|
ArchiveActionInput.meta({ id: "ArchiveActionInput" }),
|
|
6512
|
+
UnarchiveActionInput.meta({ id: "UnarchiveActionInput" }),
|
|
6372
6513
|
AssignActionInput.meta({ id: "AssignActionInput" }),
|
|
6373
6514
|
UnassignActionInput.meta({ id: "UnassignActionInput" }),
|
|
6374
6515
|
PrintCertificateActionInput.meta({ id: "PrintCertificateActionInput" }),
|
|
@@ -6483,8 +6624,11 @@ var updateActions = ActionTypes.extract([
|
|
|
6483
6624
|
ActionType.REGISTER,
|
|
6484
6625
|
ActionType.REJECT,
|
|
6485
6626
|
ActionType.ARCHIVE,
|
|
6627
|
+
ActionType.UNARCHIVE,
|
|
6486
6628
|
ActionType.PRINT_CERTIFICATE,
|
|
6487
6629
|
ActionType.REQUEST_CORRECTION,
|
|
6630
|
+
ActionType.APPROVE_CORRECTION,
|
|
6631
|
+
ActionType.REJECT_CORRECTION,
|
|
6488
6632
|
ActionType.CUSTOM
|
|
6489
6633
|
]);
|
|
6490
6634
|
function getActionUpdateMetadata(actions) {
|
|
@@ -6512,6 +6656,10 @@ function getActionUpdateMetadata(actions) {
|
|
|
6512
6656
|
}
|
|
6513
6657
|
function getLegalStatuses(actions) {
|
|
6514
6658
|
return {
|
|
6659
|
+
[EventStatus.enum.NOTIFIED]: getDeclarationActionCreationMetadata(
|
|
6660
|
+
ActionType.NOTIFY,
|
|
6661
|
+
actions
|
|
6662
|
+
),
|
|
6515
6663
|
[EventStatus.enum.DECLARED]: getDeclarationActionCreationMetadata(
|
|
6516
6664
|
ActionType.DECLARE,
|
|
6517
6665
|
actions
|
|
@@ -6526,9 +6674,6 @@ function getLegalStatuses(actions) {
|
|
|
6526
6674
|
// ../commons/src/events/state/flags.ts
|
|
6527
6675
|
var import_lodash3 = require("lodash");
|
|
6528
6676
|
var import_date_fns3 = require("date-fns");
|
|
6529
|
-
function isEditInProgress(actions) {
|
|
6530
|
-
return actions.at(-1)?.type === ActionType.EDIT;
|
|
6531
|
-
}
|
|
6532
6677
|
function findPendingCorrectionAction(writeActions2) {
|
|
6533
6678
|
let correctionRequestAction;
|
|
6534
6679
|
for (let i = writeActions2.length - 1; i >= 0; i--) {
|
|
@@ -6543,29 +6688,6 @@ function findPendingCorrectionAction(writeActions2) {
|
|
|
6543
6688
|
}
|
|
6544
6689
|
return correctionRequestAction;
|
|
6545
6690
|
}
|
|
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
6691
|
function isPotentialDuplicate(actions) {
|
|
6570
6692
|
return actions.reduce((prev, { type }) => {
|
|
6571
6693
|
if (type === ActionType.DUPLICATE_DETECTED) {
|
|
@@ -6593,6 +6715,85 @@ function isFlagConditionMet(conditional, form, action) {
|
|
|
6593
6715
|
}
|
|
6594
6716
|
});
|
|
6595
6717
|
}
|
|
6718
|
+
function actionConfigRemovesFlag(action, flagId, actionsUpToAndIncluding, event2, eventConfiguration) {
|
|
6719
|
+
if (!isActionConfigType(action.type)) {
|
|
6720
|
+
return false;
|
|
6721
|
+
}
|
|
6722
|
+
const actionConfig = getActionConfig({
|
|
6723
|
+
eventConfiguration,
|
|
6724
|
+
actionType: action.type,
|
|
6725
|
+
customActionType: "customActionType" in action ? action.customActionType : void 0
|
|
6726
|
+
});
|
|
6727
|
+
const removeOperations = (actionConfig?.flags ?? []).filter(
|
|
6728
|
+
({ id, operation }) => id === flagId && operation === "remove"
|
|
6729
|
+
);
|
|
6730
|
+
if (removeOperations.length === 0) {
|
|
6731
|
+
return false;
|
|
6732
|
+
}
|
|
6733
|
+
const eventUpToThisAction = { ...event2, actions: actionsUpToAndIncluding };
|
|
6734
|
+
const declaration = aggregateActionDeclarations(eventUpToThisAction);
|
|
6735
|
+
const annotation = aggregateActionAnnotations(eventUpToThisAction);
|
|
6736
|
+
const form = { ...declaration, ...annotation };
|
|
6737
|
+
return removeOperations.some(
|
|
6738
|
+
({ conditional }) => conditional ? isFlagConditionMet(conditional, form, action) : true
|
|
6739
|
+
);
|
|
6740
|
+
}
|
|
6741
|
+
var INHERENT_FLAG_RULES = [
|
|
6742
|
+
{
|
|
6743
|
+
flag: InherentFlags.CORRECTION_REQUESTED,
|
|
6744
|
+
setOn: [ActionType.REQUEST_CORRECTION],
|
|
6745
|
+
resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
|
|
6746
|
+
},
|
|
6747
|
+
{
|
|
6748
|
+
// INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
|
|
6749
|
+
// other status-changing action (see getStatusFromActions). ARCHIVE/UNARCHIVE
|
|
6750
|
+
// are deliberately excluded so the flag freezes across an archive/unarchive
|
|
6751
|
+
// round trip and comes back exactly as it was.
|
|
6752
|
+
flag: InherentFlags.INCOMPLETE,
|
|
6753
|
+
setOn: [ActionType.NOTIFY],
|
|
6754
|
+
resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
|
|
6755
|
+
},
|
|
6756
|
+
{
|
|
6757
|
+
flag: InherentFlags.REJECTED,
|
|
6758
|
+
setOn: [ActionType.REJECT],
|
|
6759
|
+
resetOn: [
|
|
6760
|
+
ActionType.NOTIFY,
|
|
6761
|
+
ActionType.DECLARE,
|
|
6762
|
+
ActionType.EDIT,
|
|
6763
|
+
ActionType.REGISTER
|
|
6764
|
+
]
|
|
6765
|
+
},
|
|
6766
|
+
{
|
|
6767
|
+
flag: InherentFlags.POTENTIAL_DUPLICATE,
|
|
6768
|
+
setOn: [ActionType.DUPLICATE_DETECTED],
|
|
6769
|
+
resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
|
|
6770
|
+
},
|
|
6771
|
+
{
|
|
6772
|
+
flag: InherentFlags.EDIT_IN_PROGRESS,
|
|
6773
|
+
setOn: [ActionType.EDIT],
|
|
6774
|
+
resetOnAnyOtherAction: true
|
|
6775
|
+
}
|
|
6776
|
+
];
|
|
6777
|
+
function resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration) {
|
|
6778
|
+
return acceptedActions.reduce((present, action, idx) => {
|
|
6779
|
+
if (rule.setOn.includes(action.type)) {
|
|
6780
|
+
return true;
|
|
6781
|
+
}
|
|
6782
|
+
if (rule.resetOnAnyOtherAction || (rule.resetOn ?? []).includes(action.type)) {
|
|
6783
|
+
return false;
|
|
6784
|
+
}
|
|
6785
|
+
if (actionConfigRemovesFlag(
|
|
6786
|
+
action,
|
|
6787
|
+
rule.flag,
|
|
6788
|
+
acceptedActions.slice(0, idx + 1),
|
|
6789
|
+
event2,
|
|
6790
|
+
eventConfiguration
|
|
6791
|
+
)) {
|
|
6792
|
+
return false;
|
|
6793
|
+
}
|
|
6794
|
+
return present;
|
|
6795
|
+
}, false);
|
|
6796
|
+
}
|
|
6596
6797
|
function resolveEventCustomFlags(event2, eventConfiguration) {
|
|
6597
6798
|
const actions = getAcceptedActions(event2).filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
6598
6799
|
return actions.reduce((acc, action, idx) => {
|
|
@@ -6614,7 +6815,7 @@ function resolveEventCustomFlags(event2, eventConfiguration) {
|
|
|
6614
6815
|
const declaration = aggregateActionDeclarations(eventUpToThisAction);
|
|
6615
6816
|
const annotation = aggregateActionAnnotations(eventUpToThisAction);
|
|
6616
6817
|
const form = { ...declaration, ...annotation };
|
|
6617
|
-
const flagsWithMetConditions = actionConfig.flags.filter(
|
|
6818
|
+
const flagsWithMetConditions = (actionConfig.flags ?? []).filter(
|
|
6618
6819
|
({ conditional }) => (
|
|
6619
6820
|
// If conditional is not provided, the flag is resolved
|
|
6620
6821
|
conditional ? isFlagConditionMet(conditional, form, action) : true
|
|
@@ -6641,40 +6842,46 @@ function getActionStatusFlags(sortedActions) {
|
|
|
6641
6842
|
return flag2;
|
|
6642
6843
|
});
|
|
6643
6844
|
}
|
|
6644
|
-
function getInherentFlags(sortedActions) {
|
|
6845
|
+
function getInherentFlags(sortedActions, event2, eventConfiguration) {
|
|
6645
6846
|
const acceptedActions = sortedActions.filter(
|
|
6646
6847
|
({ status: status2 }) => status2 === ActionStatus.Accepted
|
|
6647
6848
|
);
|
|
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;
|
|
6849
|
+
return INHERENT_FLAG_RULES.filter(
|
|
6850
|
+
(rule) => resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration)
|
|
6851
|
+
).map(({ flag: flag2 }) => flag2);
|
|
6665
6852
|
}
|
|
6666
6853
|
function getEventFlags(event2, config) {
|
|
6667
6854
|
const sortedActions = event2.actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
6668
6855
|
return [
|
|
6669
6856
|
...getActionStatusFlags(sortedActions),
|
|
6670
|
-
...getInherentFlags(sortedActions),
|
|
6857
|
+
...getInherentFlags(sortedActions, event2, config),
|
|
6671
6858
|
...resolveEventCustomFlags(event2, config)
|
|
6672
6859
|
];
|
|
6673
6860
|
}
|
|
6674
6861
|
|
|
6675
6862
|
// ../commons/src/events/state/index.ts
|
|
6676
6863
|
function getStatusFromActions(actions) {
|
|
6677
|
-
|
|
6864
|
+
const acceptedActions = actions.filter(
|
|
6865
|
+
({ status: status2 }) => status2 === ActionStatus.Accepted
|
|
6866
|
+
);
|
|
6867
|
+
const isCurrentlyArchived = acceptedActions.reduce(
|
|
6868
|
+
(archived, action) => {
|
|
6869
|
+
if (action.type === ActionType.ARCHIVE) {
|
|
6870
|
+
return true;
|
|
6871
|
+
}
|
|
6872
|
+
if (action.type === ActionType.UNARCHIVE) {
|
|
6873
|
+
return false;
|
|
6874
|
+
}
|
|
6875
|
+
return archived;
|
|
6876
|
+
},
|
|
6877
|
+
false
|
|
6878
|
+
);
|
|
6879
|
+
if (isCurrentlyArchived) {
|
|
6880
|
+
return EventStatus.enum.ARCHIVED;
|
|
6881
|
+
}
|
|
6882
|
+
return acceptedActions.filter(
|
|
6883
|
+
({ type }) => type !== ActionType.ARCHIVE && type !== ActionType.UNARCHIVE
|
|
6884
|
+
).reduce((status2, action) => {
|
|
6678
6885
|
switch (action.type) {
|
|
6679
6886
|
case ActionType.CREATE:
|
|
6680
6887
|
return EventStatus.enum.CREATED;
|
|
@@ -6682,10 +6889,11 @@ function getStatusFromActions(actions) {
|
|
|
6682
6889
|
return EventStatus.enum.DECLARED;
|
|
6683
6890
|
case ActionType.REGISTER:
|
|
6684
6891
|
return EventStatus.enum.REGISTERED;
|
|
6685
|
-
case ActionType.ARCHIVE:
|
|
6686
|
-
return EventStatus.enum.ARCHIVED;
|
|
6687
6892
|
case ActionType.NOTIFY:
|
|
6688
6893
|
return EventStatus.enum.NOTIFIED;
|
|
6894
|
+
// Already filtered out above; listed here only to satisfy exhaustiveness.
|
|
6895
|
+
case ActionType.ARCHIVE:
|
|
6896
|
+
case ActionType.UNARCHIVE:
|
|
6689
6897
|
case ActionType.CUSTOM:
|
|
6690
6898
|
case ActionType.PRINT_CERTIFICATE:
|
|
6691
6899
|
case ActionType.ASSIGN:
|
|
@@ -7672,6 +7880,11 @@ var TENNIS_CLUB_DECLARATION_REVIEW = {
|
|
|
7672
7880
|
id: "signature.upload.modal.title",
|
|
7673
7881
|
defaultMessage: "Draw signature",
|
|
7674
7882
|
description: "Title for the modal to draw signature"
|
|
7883
|
+
},
|
|
7884
|
+
// Zod applies the schema default at parse time, but this fixture bypasses
|
|
7885
|
+
// parsing — GeneratedInputField accesses configuration.maxFileSize directly.
|
|
7886
|
+
configuration: {
|
|
7887
|
+
maxFileSize: 5 * 1024 * 1024
|
|
7675
7888
|
}
|
|
7676
7889
|
}
|
|
7677
7890
|
]
|
|
@@ -8228,6 +8441,20 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
8228
8441
|
},
|
|
8229
8442
|
review: TENNIS_CLUB_DECLARATION_REVIEW
|
|
8230
8443
|
},
|
|
8444
|
+
{
|
|
8445
|
+
type: ActionType.NOTIFY,
|
|
8446
|
+
label: {
|
|
8447
|
+
defaultMessage: "Notify health worker",
|
|
8448
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
|
8449
|
+
id: "event.tennis-club-membership.action.notify.label"
|
|
8450
|
+
},
|
|
8451
|
+
flags: [
|
|
8452
|
+
{
|
|
8453
|
+
id: "health-worker-notified",
|
|
8454
|
+
operation: "add"
|
|
8455
|
+
}
|
|
8456
|
+
]
|
|
8457
|
+
},
|
|
8231
8458
|
{
|
|
8232
8459
|
type: ActionType.REJECT,
|
|
8233
8460
|
label: {
|
|
@@ -8470,6 +8697,17 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
8470
8697
|
}
|
|
8471
8698
|
}
|
|
8472
8699
|
],
|
|
8700
|
+
flags: [
|
|
8701
|
+
{
|
|
8702
|
+
id: "health-worker-notified",
|
|
8703
|
+
requiresAction: false,
|
|
8704
|
+
label: {
|
|
8705
|
+
id: "event.tennis-club-membership.flag.health-worker-notified.label",
|
|
8706
|
+
defaultMessage: "Health worker notified",
|
|
8707
|
+
description: "Label for the health-worker-notified flag"
|
|
8708
|
+
}
|
|
8709
|
+
}
|
|
8710
|
+
],
|
|
8473
8711
|
advancedSearch: [
|
|
8474
8712
|
{
|
|
8475
8713
|
title: {
|
|
@@ -9740,6 +9978,14 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
|
|
|
9740
9978
|
},
|
|
9741
9979
|
...input
|
|
9742
9980
|
}),
|
|
9981
|
+
unarchive: (eventId, input = {}) => ({
|
|
9982
|
+
type: ActionType.UNARCHIVE,
|
|
9983
|
+
transactionId: input.transactionId ?? getUUID(),
|
|
9984
|
+
declaration: {},
|
|
9985
|
+
annotation: {},
|
|
9986
|
+
eventId,
|
|
9987
|
+
...input
|
|
9988
|
+
}),
|
|
9743
9989
|
reject: (eventId, input = {}) => ({
|
|
9744
9990
|
type: ActionType.REJECT,
|
|
9745
9991
|
transactionId: input.transactionId ?? getUUID(),
|
|
@@ -9898,6 +10144,7 @@ function generateActionDocument({
|
|
|
9898
10144
|
case ActionType.NOTIFY:
|
|
9899
10145
|
case ActionType.REGISTER:
|
|
9900
10146
|
case ActionType.REQUEST_CORRECTION:
|
|
10147
|
+
case ActionType.UNARCHIVE:
|
|
9901
10148
|
return { ...actionBase, type: action };
|
|
9902
10149
|
case ActionType.EDIT:
|
|
9903
10150
|
return {
|
|
@@ -10228,7 +10475,7 @@ function matchesJurisdictionFilter(locationIds, filter, user2) {
|
|
|
10228
10475
|
return locationIds.some((id) => id === user2.primaryOfficeId);
|
|
10229
10476
|
}
|
|
10230
10477
|
if (filter === JurisdictionFilter.enum.administrativeArea) {
|
|
10231
|
-
return user2.administrativeAreaId
|
|
10478
|
+
return !user2.administrativeAreaId || locationIds.some((id) => id === user2.administrativeAreaId);
|
|
10232
10479
|
}
|
|
10233
10480
|
return true;
|
|
10234
10481
|
}
|
|
@@ -10255,6 +10502,25 @@ function canAccessEventWithScope(event2, scope, user2, customActionType) {
|
|
|
10255
10502
|
}
|
|
10256
10503
|
if (scopeUsesDeclaredOptions(scope)) {
|
|
10257
10504
|
const { options } = scope;
|
|
10505
|
+
if (options?.notifiedBy === UserFilter.enum.user) {
|
|
10506
|
+
if (event2.legalStatuses?.NOTIFIED?.createdBy !== user2.id) {
|
|
10507
|
+
return false;
|
|
10508
|
+
}
|
|
10509
|
+
}
|
|
10510
|
+
if (options?.notifiedIn === JurisdictionFilter.enum.location && !matchesJurisdictionFilter(
|
|
10511
|
+
event2.legalStatuses?.NOTIFIED?.createdAtLocation,
|
|
10512
|
+
JurisdictionFilter.enum.location,
|
|
10513
|
+
user2
|
|
10514
|
+
)) {
|
|
10515
|
+
return false;
|
|
10516
|
+
}
|
|
10517
|
+
if (options?.notifiedIn === JurisdictionFilter.enum.administrativeArea && !matchesJurisdictionFilter(
|
|
10518
|
+
event2.legalStatuses?.NOTIFIED?.createdAtLocation,
|
|
10519
|
+
JurisdictionFilter.enum.administrativeArea,
|
|
10520
|
+
user2
|
|
10521
|
+
)) {
|
|
10522
|
+
return false;
|
|
10523
|
+
}
|
|
10258
10524
|
if (options?.declaredBy === UserFilter.enum.user) {
|
|
10259
10525
|
if (event2.legalStatuses?.DECLARED?.createdBy !== user2.id) {
|
|
10260
10526
|
return false;
|
|
@@ -10317,7 +10583,7 @@ function canAccessUserWithScope({
|
|
|
10317
10583
|
}
|
|
10318
10584
|
const hasAdministrativeAreaInHierarchy = userToAccess.administrativeHierarchy.some(
|
|
10319
10585
|
(id) => user2.administrativeAreaId === id
|
|
10320
|
-
) || user2.administrativeAreaId
|
|
10586
|
+
) || !user2.administrativeAreaId;
|
|
10321
10587
|
if (opts?.accessLevel === JurisdictionFilter.enum.administrativeArea && !hasAdministrativeAreaInHierarchy) {
|
|
10322
10588
|
return false;
|
|
10323
10589
|
}
|
|
@@ -10397,6 +10663,7 @@ var ACTION_SCOPE_MAP = {
|
|
|
10397
10663
|
[ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
|
|
10398
10664
|
[ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
|
|
10399
10665
|
[ActionType.ARCHIVE]: ["record.archive"],
|
|
10666
|
+
[ActionType.UNARCHIVE]: ["record.unarchive"],
|
|
10400
10667
|
[ActionType.REJECT]: ["record.reject"],
|
|
10401
10668
|
[ActionType.ASSIGN]: null,
|
|
10402
10669
|
[ActionType.UNASSIGN]: null,
|
|
@@ -10603,7 +10870,11 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
|
10603
10870
|
ActionType.CUSTOM,
|
|
10604
10871
|
ClientSpecificAction.REVIEW_CORRECTION_REQUEST
|
|
10605
10872
|
],
|
|
10606
|
-
[EventStatus.enum.ARCHIVED]: [
|
|
10873
|
+
[EventStatus.enum.ARCHIVED]: [
|
|
10874
|
+
ActionType.READ,
|
|
10875
|
+
ActionType.CUSTOM,
|
|
10876
|
+
ActionType.UNARCHIVE
|
|
10877
|
+
]
|
|
10607
10878
|
};
|
|
10608
10879
|
var ACTION_FILTERS = {
|
|
10609
10880
|
[ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
@@ -10616,6 +10887,7 @@ var ACTION_FILTERS = {
|
|
|
10616
10887
|
[ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10617
10888
|
[ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10618
10889
|
[ActionType.ARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10890
|
+
[ActionType.UNARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10619
10891
|
[ActionType.ASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10620
10892
|
[ActionType.UNASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10621
10893
|
[ActionType.CUSTOM]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested"))
|
|
@@ -10623,18 +10895,19 @@ var ACTION_FILTERS = {
|
|
|
10623
10895
|
function filterActionsByFlags(actions, flags) {
|
|
10624
10896
|
return actions.filter((action) => ACTION_FILTERS[action]?.(flags) ?? true);
|
|
10625
10897
|
}
|
|
10898
|
+
var REJECTED_ACTIONS = [
|
|
10899
|
+
ActionType.READ,
|
|
10900
|
+
ActionType.NOTIFY,
|
|
10901
|
+
ActionType.CUSTOM,
|
|
10902
|
+
ActionType.EDIT,
|
|
10903
|
+
ActionType.ARCHIVE
|
|
10904
|
+
];
|
|
10626
10905
|
function getAvailableActionsWithoutFlagFilters(status2, flags) {
|
|
10627
10906
|
if (flags.includes(InherentFlags.EDIT_IN_PROGRESS)) {
|
|
10628
10907
|
return [ActionType.NOTIFY, ActionType.DECLARE, ActionType.REGISTER];
|
|
10629
10908
|
}
|
|
10630
|
-
if (flags.includes(InherentFlags.REJECTED)) {
|
|
10631
|
-
return
|
|
10632
|
-
ActionType.READ,
|
|
10633
|
-
ActionType.NOTIFY,
|
|
10634
|
-
ActionType.CUSTOM,
|
|
10635
|
-
ActionType.EDIT,
|
|
10636
|
-
ActionType.ARCHIVE
|
|
10637
|
-
];
|
|
10909
|
+
if (flags.includes(InherentFlags.REJECTED) && status2 !== EventStatus.enum.ARCHIVED) {
|
|
10910
|
+
return REJECTED_ACTIONS;
|
|
10638
10911
|
}
|
|
10639
10912
|
return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status2];
|
|
10640
10913
|
}
|