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