@opencrvs/toolkit 2.0.0-rc.157566a → 2.0.0-rc.1584152
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 +29 -6
- package/dist/cli.js +3186 -4921
- package/dist/commons/api/router.d.ts +623 -20
- package/dist/commons/conditionals/conditionals.d.ts +6 -6
- package/dist/commons/events/ActionConfig.d.ts +202 -0
- 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 +15 -0
- 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 +206 -24
- 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 +148 -17
- 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.1584152.tgz +0 -0
- package/package.json +15 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.0.0-rc.157566a.tgz +0 -0
package/dist/events/index.js
CHANGED
|
@@ -214,6 +214,7 @@ __export(events_exports, {
|
|
|
214
214
|
TimeValue: () => TimeValue,
|
|
215
215
|
TranslationConfig: () => TranslationConfig,
|
|
216
216
|
UUID: () => UUID,
|
|
217
|
+
UnarchiveActionInput: () => UnarchiveActionInput,
|
|
217
218
|
UnassignActionInput: () => UnassignActionInput,
|
|
218
219
|
UserAuditRecordInput: () => UserAuditRecordInput,
|
|
219
220
|
V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS: () => V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS,
|
|
@@ -481,6 +482,7 @@ var RecordScopeTypeV2 = z2.enum([
|
|
|
481
482
|
"record.edit",
|
|
482
483
|
"record.reject",
|
|
483
484
|
"record.archive",
|
|
485
|
+
"record.unarchive",
|
|
484
486
|
"record.review-duplicates",
|
|
485
487
|
"record.register",
|
|
486
488
|
"record.print-certified-copies",
|
|
@@ -520,11 +522,13 @@ var scopeOptionsPlaceEvent = z2.object({
|
|
|
520
522
|
event: scopeByEvent,
|
|
521
523
|
placeOfEvent: JurisdictionFilter.optional()
|
|
522
524
|
}).describe("Options applicable to all record scopes.");
|
|
523
|
-
var
|
|
525
|
+
var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
526
|
+
notifiedIn: JurisdictionFilter.optional(),
|
|
527
|
+
notifiedBy: UserFilter.optional(),
|
|
524
528
|
declaredIn: JurisdictionFilter.optional(),
|
|
525
529
|
declaredBy: UserFilter.optional()
|
|
526
530
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
527
|
-
var AllRecordScopeOptions =
|
|
531
|
+
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
528
532
|
registeredIn: JurisdictionFilter.optional(),
|
|
529
533
|
registeredBy: UserFilter.optional()
|
|
530
534
|
}).describe(
|
|
@@ -562,6 +566,8 @@ var ResolvedScopeOptionsPlaceEvent = z2.object({
|
|
|
562
566
|
"Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
|
|
563
567
|
);
|
|
564
568
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
569
|
+
notifiedIn: UUID.nullish(),
|
|
570
|
+
notifiedBy: z2.string().optional(),
|
|
565
571
|
declaredIn: UUID.nullish(),
|
|
566
572
|
declaredBy: z2.string().optional()
|
|
567
573
|
}).describe(
|
|
@@ -582,6 +588,7 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
|
582
588
|
"record.edit",
|
|
583
589
|
"record.reject",
|
|
584
590
|
"record.archive",
|
|
591
|
+
"record.unarchive",
|
|
585
592
|
"record.review-duplicates",
|
|
586
593
|
"record.register"
|
|
587
594
|
]);
|
|
@@ -607,7 +614,7 @@ var RecordScopeV2 = z2.discriminatedUnion("type", [
|
|
|
607
614
|
}),
|
|
608
615
|
z2.object({
|
|
609
616
|
type: ScopesWithDeclaredOptions,
|
|
610
|
-
options:
|
|
617
|
+
options: scopeOptionsDeclaredOrNotified.optional()
|
|
611
618
|
}),
|
|
612
619
|
z2.object({
|
|
613
620
|
type: ScopesWithFullOptions,
|
|
@@ -730,8 +737,9 @@ var decodeScope = (encodedScope) => {
|
|
|
730
737
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
731
738
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
732
739
|
accessLevel: JurisdictionFilter.enum.all,
|
|
733
|
-
|
|
734
|
-
declaredIn: JurisdictionFilter.enum.all
|
|
740
|
+
notifiedIn: JurisdictionFilter.enum.all,
|
|
741
|
+
declaredIn: JurisdictionFilter.enum.all,
|
|
742
|
+
registeredIn: JurisdictionFilter.enum.all
|
|
735
743
|
};
|
|
736
744
|
function getAcceptedScopesByType({
|
|
737
745
|
acceptedScopes,
|
|
@@ -767,6 +775,7 @@ var ActionType = {
|
|
|
767
775
|
MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
|
|
768
776
|
MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
|
|
769
777
|
ARCHIVE: "ARCHIVE",
|
|
778
|
+
UNARCHIVE: "UNARCHIVE",
|
|
770
779
|
// Record actions
|
|
771
780
|
PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
|
|
772
781
|
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
|
@@ -786,6 +795,7 @@ var ConfirmableActions = [
|
|
|
786
795
|
ActionType.REGISTER,
|
|
787
796
|
ActionType.REJECT,
|
|
788
797
|
ActionType.ARCHIVE,
|
|
798
|
+
ActionType.UNARCHIVE,
|
|
789
799
|
ActionType.PRINT_CERTIFICATE,
|
|
790
800
|
ActionType.REQUEST_CORRECTION,
|
|
791
801
|
ActionType.APPROVE_CORRECTION,
|
|
@@ -804,6 +814,7 @@ var ActionTypes = z4.enum([
|
|
|
804
814
|
"MARK_AS_DUPLICATE",
|
|
805
815
|
"MARK_AS_NOT_DUPLICATE",
|
|
806
816
|
"ARCHIVE",
|
|
817
|
+
"UNARCHIVE",
|
|
807
818
|
"PRINT_CERTIFICATE",
|
|
808
819
|
"REQUEST_CORRECTION",
|
|
809
820
|
"REJECT_CORRECTION",
|
|
@@ -847,6 +858,7 @@ var WorkqueueActionType = ActionTypes.extract([
|
|
|
847
858
|
ActionType.REJECT,
|
|
848
859
|
ActionType.MARK_AS_DUPLICATE,
|
|
849
860
|
ActionType.ARCHIVE,
|
|
861
|
+
ActionType.UNARCHIVE,
|
|
850
862
|
ActionType.PRINT_CERTIFICATE,
|
|
851
863
|
ActionType.REQUEST_CORRECTION
|
|
852
864
|
]);
|
|
@@ -911,6 +923,7 @@ var EventActionEntrySchema = AuditLogEntryBase.extend({
|
|
|
911
923
|
"event.actions.unassign.request",
|
|
912
924
|
"event.actions.read.request",
|
|
913
925
|
"event.actions.archive.request",
|
|
926
|
+
"event.actions.unarchive.request",
|
|
914
927
|
"event.actions.reinstate.request",
|
|
915
928
|
"event.actions.print_certificate.request",
|
|
916
929
|
"event.actions.correction.request.request",
|
|
@@ -1644,6 +1657,11 @@ var ArchiveAction = ActionBase.extend(
|
|
|
1644
1657
|
content: ReasonContent
|
|
1645
1658
|
}).shape
|
|
1646
1659
|
);
|
|
1660
|
+
var UnarchiveAction = ActionBase.extend(
|
|
1661
|
+
z14.object({
|
|
1662
|
+
type: z14.literal(ActionType.UNARCHIVE)
|
|
1663
|
+
}).shape
|
|
1664
|
+
);
|
|
1647
1665
|
var CreatedAction = ActionBase.extend(
|
|
1648
1666
|
z14.object({
|
|
1649
1667
|
type: z14.literal(ActionType.CREATE)
|
|
@@ -1710,6 +1728,7 @@ var ActionDocument = z14.discriminatedUnion("type", [
|
|
|
1710
1728
|
MarkNotDuplicateAction.meta({ id: "MarkNotDuplicateAction" }),
|
|
1711
1729
|
MarkAsDuplicateAction.meta({ id: "MarkAsDuplicateAction" }),
|
|
1712
1730
|
ArchiveAction.meta({ id: "ArchiveAction" }),
|
|
1731
|
+
UnarchiveAction.meta({ id: "UnarchiveAction" }),
|
|
1713
1732
|
NotifiedAction.meta({ id: "NotifiedAction" }),
|
|
1714
1733
|
RegisterAction.meta({ id: "RegisterAction" }),
|
|
1715
1734
|
DeclareAction.meta({ id: "DeclareAction" }),
|
|
@@ -1815,6 +1834,7 @@ var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
|
1815
1834
|
)
|
|
1816
1835
|
});
|
|
1817
1836
|
var LegalStatuses = z16.object({
|
|
1837
|
+
[EventStatus.enum.NOTIFIED]: ActionCreationMetadata.nullish(),
|
|
1818
1838
|
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
|
1819
1839
|
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
|
1820
1840
|
});
|
|
@@ -1956,6 +1976,8 @@ var eventMetadataLabelMap = {
|
|
|
1956
1976
|
var EventMetadataDateFieldIdInput = z16.enum([
|
|
1957
1977
|
"createdAt",
|
|
1958
1978
|
"updatedAt",
|
|
1979
|
+
"legalStatuses.NOTIFIED.createdAt",
|
|
1980
|
+
"legalStatuses.NOTIFIED.acceptedAt",
|
|
1959
1981
|
"legalStatuses.DECLARED.createdAt",
|
|
1960
1982
|
"legalStatuses.DECLARED.acceptedAt",
|
|
1961
1983
|
"legalStatuses.REGISTERED.createdAt",
|
|
@@ -1964,6 +1986,8 @@ var EventMetadataDateFieldIdInput = z16.enum([
|
|
|
1964
1986
|
var EventMetadataDateFieldId = z16.enum([
|
|
1965
1987
|
"event.createdAt",
|
|
1966
1988
|
"event.updatedAt",
|
|
1989
|
+
"event.legalStatuses.NOTIFIED.createdAt",
|
|
1990
|
+
"event.legalStatuses.NOTIFIED.acceptedAt",
|
|
1967
1991
|
"event.legalStatuses.DECLARED.createdAt",
|
|
1968
1992
|
"event.legalStatuses.DECLARED.acceptedAt",
|
|
1969
1993
|
"event.legalStatuses.REGISTERED.createdAt",
|
|
@@ -2023,7 +2047,8 @@ var Range = import_v4.z.object({
|
|
|
2023
2047
|
});
|
|
2024
2048
|
var ContainsFlags = import_v4.z.object({
|
|
2025
2049
|
anyOf: import_v4.z.array(Flag).optional(),
|
|
2026
|
-
noneOf: import_v4.z.array(Flag).optional()
|
|
2050
|
+
noneOf: import_v4.z.array(Flag).optional(),
|
|
2051
|
+
allOf: import_v4.z.array(Flag).optional()
|
|
2027
2052
|
}).meta({
|
|
2028
2053
|
id: "ContainsFlags"
|
|
2029
2054
|
});
|
|
@@ -3227,6 +3252,52 @@ var NotifyConfig = ActionConfigBase.extend(
|
|
|
3227
3252
|
type: z24.literal(ActionType.NOTIFY)
|
|
3228
3253
|
}).shape
|
|
3229
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
|
+
);
|
|
3230
3301
|
var DeclareConfig = DeclarationActionBase.extend(
|
|
3231
3302
|
z24.object({
|
|
3232
3303
|
type: z24.literal(ActionType.DECLARE),
|
|
@@ -3251,6 +3322,11 @@ var ArchiveConfig = ActionConfigBase.extend(
|
|
|
3251
3322
|
type: z24.literal(ActionType.ARCHIVE)
|
|
3252
3323
|
}).shape
|
|
3253
3324
|
);
|
|
3325
|
+
var UnarchiveConfig = ActionConfigBase.extend(
|
|
3326
|
+
z24.object({
|
|
3327
|
+
type: z24.literal(ActionType.UNARCHIVE)
|
|
3328
|
+
}).shape
|
|
3329
|
+
);
|
|
3254
3330
|
var EditActionConfig = ActionConfigBase.extend(
|
|
3255
3331
|
z24.object({
|
|
3256
3332
|
type: z24.literal(ActionType.EDIT),
|
|
@@ -3289,7 +3365,17 @@ var RequestCorrectionConfig = ActionConfigBase.extend(
|
|
|
3289
3365
|
correctionForm: ActionFormConfig
|
|
3290
3366
|
}).shape
|
|
3291
3367
|
);
|
|
3292
|
-
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(
|
|
3293
3379
|
z24.object({
|
|
3294
3380
|
type: z24.literal(ActionType.CUSTOM),
|
|
3295
3381
|
customActionType: z24.string().describe("Type identifier of the custom action."),
|
|
@@ -3300,7 +3386,7 @@ var CustomActionConfig = ActionConfigBase.merge(
|
|
|
3300
3386
|
auditHistoryLabel: TranslationConfig.describe(
|
|
3301
3387
|
'The label to show in audit history for this action. For example "Approved".'
|
|
3302
3388
|
)
|
|
3303
|
-
})
|
|
3389
|
+
}).shape
|
|
3304
3390
|
);
|
|
3305
3391
|
var ActionConfig = z24.discriminatedUnion("type", [
|
|
3306
3392
|
/*
|
|
@@ -3311,6 +3397,18 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3311
3397
|
id: "ReadActionConfig",
|
|
3312
3398
|
description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
|
|
3313
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
|
+
}),
|
|
3314
3412
|
NotifyConfig.meta({
|
|
3315
3413
|
id: "NotifyActionConfig",
|
|
3316
3414
|
description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
|
|
@@ -3319,6 +3417,18 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3319
3417
|
id: "DeclareActionConfig",
|
|
3320
3418
|
description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
|
|
3321
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."
|
|
3431
|
+
}),
|
|
3322
3432
|
RejectConfig.meta({
|
|
3323
3433
|
id: "RejectActionConfig",
|
|
3324
3434
|
description: "Configuration for rejecting a record before registration."
|
|
@@ -3335,6 +3445,14 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3335
3445
|
id: "RequestCorrectionActionConfig",
|
|
3336
3446
|
description: "Configuration for requesting a correction on a registered record."
|
|
3337
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
|
+
}),
|
|
3338
3456
|
EditActionConfig.meta({
|
|
3339
3457
|
id: "EditActionConfig",
|
|
3340
3458
|
description: "Configuration for editing a record before registration."
|
|
@@ -3343,6 +3461,10 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3343
3461
|
id: "ArchiveActionConfig",
|
|
3344
3462
|
description: "Configuration for archiving a record."
|
|
3345
3463
|
}),
|
|
3464
|
+
UnarchiveConfig.meta({
|
|
3465
|
+
id: "UnarchiveActionConfig",
|
|
3466
|
+
description: "Configuration for unarchiving a record."
|
|
3467
|
+
}),
|
|
3346
3468
|
CustomActionConfig.meta({
|
|
3347
3469
|
id: "CustomActionConfig",
|
|
3348
3470
|
description: "Configuration for a country-defined custom action. An event may include any number of these."
|
|
@@ -4493,9 +4615,6 @@ function getActionConfig({
|
|
|
4493
4615
|
if (a.type === ActionType.CUSTOM && customActionType) {
|
|
4494
4616
|
return a.customActionType === customActionType;
|
|
4495
4617
|
}
|
|
4496
|
-
if (actionType === ActionType.APPROVE_CORRECTION || actionType === ActionType.REJECT_CORRECTION) {
|
|
4497
|
-
return a.type === ActionType.REQUEST_CORRECTION;
|
|
4498
|
-
}
|
|
4499
4618
|
return a.type === actionType;
|
|
4500
4619
|
});
|
|
4501
4620
|
}
|
|
@@ -5649,7 +5768,7 @@ function validateActionFlags(event2, ctx) {
|
|
|
5649
5768
|
const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
|
|
5650
5769
|
const configuredFlagIds = event2.flags.map((flag2) => flag2.id);
|
|
5651
5770
|
const actionFlagIds = event2.actions.flatMap(
|
|
5652
|
-
(action) => action.flags.map((flag2) => flag2.id)
|
|
5771
|
+
(action) => (action.flags ?? []).map((flag2) => flag2.id)
|
|
5653
5772
|
);
|
|
5654
5773
|
for (const actionFlagId of actionFlagIds) {
|
|
5655
5774
|
const isConfigured = configuredFlagIds.includes(actionFlagId);
|
|
@@ -6324,6 +6443,11 @@ var ArchiveActionInput = BaseActionInput.extend(
|
|
|
6324
6443
|
content: ReasonContent
|
|
6325
6444
|
}).shape
|
|
6326
6445
|
);
|
|
6446
|
+
var UnarchiveActionInput = BaseActionInput.extend(
|
|
6447
|
+
z38.object({
|
|
6448
|
+
type: z38.literal(ActionType.UNARCHIVE).default(ActionType.UNARCHIVE)
|
|
6449
|
+
}).shape
|
|
6450
|
+
);
|
|
6327
6451
|
var AssignActionInput = BaseActionInput.extend(
|
|
6328
6452
|
z38.object({
|
|
6329
6453
|
type: z38.literal(ActionType.ASSIGN),
|
|
@@ -6385,6 +6509,7 @@ var ActionInput = z38.discriminatedUnion("type", [
|
|
|
6385
6509
|
id: "MarkNotDuplicateActionInput"
|
|
6386
6510
|
}),
|
|
6387
6511
|
ArchiveActionInput.meta({ id: "ArchiveActionInput" }),
|
|
6512
|
+
UnarchiveActionInput.meta({ id: "UnarchiveActionInput" }),
|
|
6388
6513
|
AssignActionInput.meta({ id: "AssignActionInput" }),
|
|
6389
6514
|
UnassignActionInput.meta({ id: "UnassignActionInput" }),
|
|
6390
6515
|
PrintCertificateActionInput.meta({ id: "PrintCertificateActionInput" }),
|
|
@@ -6499,6 +6624,7 @@ var updateActions = ActionTypes.extract([
|
|
|
6499
6624
|
ActionType.REGISTER,
|
|
6500
6625
|
ActionType.REJECT,
|
|
6501
6626
|
ActionType.ARCHIVE,
|
|
6627
|
+
ActionType.UNARCHIVE,
|
|
6502
6628
|
ActionType.PRINT_CERTIFICATE,
|
|
6503
6629
|
ActionType.REQUEST_CORRECTION,
|
|
6504
6630
|
ActionType.APPROVE_CORRECTION,
|
|
@@ -6530,6 +6656,10 @@ function getActionUpdateMetadata(actions) {
|
|
|
6530
6656
|
}
|
|
6531
6657
|
function getLegalStatuses(actions) {
|
|
6532
6658
|
return {
|
|
6659
|
+
[EventStatus.enum.NOTIFIED]: getDeclarationActionCreationMetadata(
|
|
6660
|
+
ActionType.NOTIFY,
|
|
6661
|
+
actions
|
|
6662
|
+
),
|
|
6533
6663
|
[EventStatus.enum.DECLARED]: getDeclarationActionCreationMetadata(
|
|
6534
6664
|
ActionType.DECLARE,
|
|
6535
6665
|
actions
|
|
@@ -6616,15 +6746,12 @@ var INHERENT_FLAG_RULES = [
|
|
|
6616
6746
|
},
|
|
6617
6747
|
{
|
|
6618
6748
|
// INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
|
|
6619
|
-
// other status-changing action (see getStatusFromActions).
|
|
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.
|
|
6620
6752
|
flag: InherentFlags.INCOMPLETE,
|
|
6621
6753
|
setOn: [ActionType.NOTIFY],
|
|
6622
|
-
resetOn: [
|
|
6623
|
-
ActionType.CREATE,
|
|
6624
|
-
ActionType.DECLARE,
|
|
6625
|
-
ActionType.REGISTER,
|
|
6626
|
-
ActionType.ARCHIVE
|
|
6627
|
-
]
|
|
6754
|
+
resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
|
|
6628
6755
|
},
|
|
6629
6756
|
{
|
|
6630
6757
|
flag: InherentFlags.REJECTED,
|
|
@@ -6688,7 +6815,7 @@ function resolveEventCustomFlags(event2, eventConfiguration) {
|
|
|
6688
6815
|
const declaration = aggregateActionDeclarations(eventUpToThisAction);
|
|
6689
6816
|
const annotation = aggregateActionAnnotations(eventUpToThisAction);
|
|
6690
6817
|
const form = { ...declaration, ...annotation };
|
|
6691
|
-
const flagsWithMetConditions = actionConfig.flags.filter(
|
|
6818
|
+
const flagsWithMetConditions = (actionConfig.flags ?? []).filter(
|
|
6692
6819
|
({ conditional }) => (
|
|
6693
6820
|
// If conditional is not provided, the flag is resolved
|
|
6694
6821
|
conditional ? isFlagConditionMet(conditional, form, action) : true
|
|
@@ -6734,7 +6861,27 @@ function getEventFlags(event2, config) {
|
|
|
6734
6861
|
|
|
6735
6862
|
// ../commons/src/events/state/index.ts
|
|
6736
6863
|
function getStatusFromActions(actions) {
|
|
6737
|
-
|
|
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) => {
|
|
6738
6885
|
switch (action.type) {
|
|
6739
6886
|
case ActionType.CREATE:
|
|
6740
6887
|
return EventStatus.enum.CREATED;
|
|
@@ -6742,10 +6889,11 @@ function getStatusFromActions(actions) {
|
|
|
6742
6889
|
return EventStatus.enum.DECLARED;
|
|
6743
6890
|
case ActionType.REGISTER:
|
|
6744
6891
|
return EventStatus.enum.REGISTERED;
|
|
6745
|
-
case ActionType.ARCHIVE:
|
|
6746
|
-
return EventStatus.enum.ARCHIVED;
|
|
6747
6892
|
case ActionType.NOTIFY:
|
|
6748
6893
|
return EventStatus.enum.NOTIFIED;
|
|
6894
|
+
// Already filtered out above; listed here only to satisfy exhaustiveness.
|
|
6895
|
+
case ActionType.ARCHIVE:
|
|
6896
|
+
case ActionType.UNARCHIVE:
|
|
6749
6897
|
case ActionType.CUSTOM:
|
|
6750
6898
|
case ActionType.PRINT_CERTIFICATE:
|
|
6751
6899
|
case ActionType.ASSIGN:
|
|
@@ -9830,6 +9978,14 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
|
|
|
9830
9978
|
},
|
|
9831
9979
|
...input
|
|
9832
9980
|
}),
|
|
9981
|
+
unarchive: (eventId, input = {}) => ({
|
|
9982
|
+
type: ActionType.UNARCHIVE,
|
|
9983
|
+
transactionId: input.transactionId ?? getUUID(),
|
|
9984
|
+
declaration: {},
|
|
9985
|
+
annotation: {},
|
|
9986
|
+
eventId,
|
|
9987
|
+
...input
|
|
9988
|
+
}),
|
|
9833
9989
|
reject: (eventId, input = {}) => ({
|
|
9834
9990
|
type: ActionType.REJECT,
|
|
9835
9991
|
transactionId: input.transactionId ?? getUUID(),
|
|
@@ -9988,6 +10144,7 @@ function generateActionDocument({
|
|
|
9988
10144
|
case ActionType.NOTIFY:
|
|
9989
10145
|
case ActionType.REGISTER:
|
|
9990
10146
|
case ActionType.REQUEST_CORRECTION:
|
|
10147
|
+
case ActionType.UNARCHIVE:
|
|
9991
10148
|
return { ...actionBase, type: action };
|
|
9992
10149
|
case ActionType.EDIT:
|
|
9993
10150
|
return {
|
|
@@ -10345,6 +10502,25 @@ function canAccessEventWithScope(event2, scope, user2, customActionType) {
|
|
|
10345
10502
|
}
|
|
10346
10503
|
if (scopeUsesDeclaredOptions(scope)) {
|
|
10347
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
|
+
}
|
|
10348
10524
|
if (options?.declaredBy === UserFilter.enum.user) {
|
|
10349
10525
|
if (event2.legalStatuses?.DECLARED?.createdBy !== user2.id) {
|
|
10350
10526
|
return false;
|
|
@@ -10487,6 +10663,7 @@ var ACTION_SCOPE_MAP = {
|
|
|
10487
10663
|
[ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
|
|
10488
10664
|
[ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
|
|
10489
10665
|
[ActionType.ARCHIVE]: ["record.archive"],
|
|
10666
|
+
[ActionType.UNARCHIVE]: ["record.unarchive"],
|
|
10490
10667
|
[ActionType.REJECT]: ["record.reject"],
|
|
10491
10668
|
[ActionType.ASSIGN]: null,
|
|
10492
10669
|
[ActionType.UNASSIGN]: null,
|
|
@@ -10693,7 +10870,11 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
|
10693
10870
|
ActionType.CUSTOM,
|
|
10694
10871
|
ClientSpecificAction.REVIEW_CORRECTION_REQUEST
|
|
10695
10872
|
],
|
|
10696
|
-
[EventStatus.enum.ARCHIVED]: [
|
|
10873
|
+
[EventStatus.enum.ARCHIVED]: [
|
|
10874
|
+
ActionType.READ,
|
|
10875
|
+
ActionType.CUSTOM,
|
|
10876
|
+
ActionType.UNARCHIVE
|
|
10877
|
+
]
|
|
10697
10878
|
};
|
|
10698
10879
|
var ACTION_FILTERS = {
|
|
10699
10880
|
[ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
@@ -10706,6 +10887,7 @@ var ACTION_FILTERS = {
|
|
|
10706
10887
|
[ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10707
10888
|
[ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10708
10889
|
[ActionType.ARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10890
|
+
[ActionType.UNARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10709
10891
|
[ActionType.ASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10710
10892
|
[ActionType.UNASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10711
10893
|
[ActionType.CUSTOM]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested"))
|