@opencrvs/toolkit 2.0.0-rc.99921a2 → 2.0.0-rc.99b8626
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 +0 -12
- package/dist/cli.js +5108 -167
- package/dist/commons/api/router.d.ts +75 -668
- package/dist/commons/conditionals/conditionals.d.ts +3 -3
- 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 -6
- package/dist/commons/events/AuditLog.d.ts +0 -2
- package/dist/commons/events/Draft.d.ts +0 -2
- package/dist/commons/events/EventDocument.d.ts +0 -22
- package/dist/commons/events/FieldConfig.d.ts +0 -5
- package/dist/commons/events/WorkqueueConfig.d.ts +2 -5
- package/dist/commons/events/scopes.d.ts +0 -1
- package/dist/commons/events/test.utils.d.ts +1 -9
- package/dist/commons/events/utils.d.ts +1 -15
- package/dist/conditionals/index.js +0 -2
- package/dist/events/index.js +18 -166
- package/dist/migrations/v2.0/index.js +5144 -88
- package/dist/notification/index.js +11 -131
- package/dist/scopes/index.d.ts +1 -7
- package/dist/scopes/index.js +0 -2
- package/opencrvs-toolkit-2.0.0-rc.99b8626.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.99921a2.tgz +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UUID } from '../uuid';
|
|
2
2
|
import { ActionDocument, ActionUpdate } from './ActionDocument';
|
|
3
|
-
import { ApproveCorrectionActionInput, ArchiveActionInput, AssignActionInput, DeclareActionInput, EditActionInput, MarkAsDuplicateActionInput, MarkNotDuplicateActionInput, NotifyActionInput, RegisterActionInput, RejectCorrectionActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput,
|
|
3
|
+
import { ApproveCorrectionActionInput, ArchiveActionInput, AssignActionInput, DeclareActionInput, EditActionInput, MarkAsDuplicateActionInput, MarkNotDuplicateActionInput, NotifyActionInput, RegisterActionInput, RejectCorrectionActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnassignActionInput } from './ActionInput';
|
|
4
4
|
import { ActionType } from './ActionType';
|
|
5
5
|
import { Draft } from './Draft';
|
|
6
6
|
import { EventConfig } from './EventConfig';
|
|
@@ -131,14 +131,6 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
|
|
|
131
131
|
reason: string;
|
|
132
132
|
};
|
|
133
133
|
};
|
|
134
|
-
unarchive: (eventId: string, input?: Partial<Pick<UnarchiveActionInput, "transactionId" | "declaration" | "keepAssignment">>) => {
|
|
135
|
-
transactionId: string;
|
|
136
|
-
declaration: Record<string, import("./FieldValue").FieldUpdateValue>;
|
|
137
|
-
keepAssignment?: boolean | undefined;
|
|
138
|
-
type: "UNARCHIVE";
|
|
139
|
-
annotation: {};
|
|
140
|
-
eventId: string;
|
|
141
|
-
};
|
|
142
134
|
reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
|
|
143
135
|
transactionId: string;
|
|
144
136
|
annotation: {};
|
|
@@ -328,20 +328,6 @@ export declare function findLastAssignmentAction(actions: Action[]): {
|
|
|
328
328
|
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
329
329
|
annotation?: Record<string, import("./FieldValue").FieldUpdateValue> | null | undefined;
|
|
330
330
|
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
331
|
-
} | {
|
|
332
|
-
id: string & import("zod").$brand<"UUID">;
|
|
333
|
-
transactionId: string;
|
|
334
|
-
createdByUserType: "user" | "system";
|
|
335
|
-
createdAt: string;
|
|
336
|
-
createdBy: string;
|
|
337
|
-
declaration: Record<string, import("./FieldValue").FieldUpdateValue>;
|
|
338
|
-
status: "Requested" | "Accepted" | "Rejected";
|
|
339
|
-
type: "UNARCHIVE";
|
|
340
|
-
createdByRole?: string | undefined;
|
|
341
|
-
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
342
|
-
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
343
|
-
annotation?: Record<string, import("./FieldValue").FieldUpdateValue> | null | undefined;
|
|
344
|
-
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
345
331
|
} | {
|
|
346
332
|
id: string & import("zod").$brand<"UUID">;
|
|
347
333
|
transactionId: string;
|
|
@@ -455,7 +441,7 @@ export declare function findLastAssignmentAction(actions: Action[]): {
|
|
|
455
441
|
createdByUserType: "user" | "system";
|
|
456
442
|
createdAt: string;
|
|
457
443
|
createdBy: string;
|
|
458
|
-
type: "CUSTOM" | "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "
|
|
444
|
+
type: "CUSTOM" | "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
|
|
459
445
|
status: "Rejected";
|
|
460
446
|
createdByRole?: string | undefined;
|
|
461
447
|
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
@@ -152,7 +152,6 @@ var RecordScopeTypeV2 = z6.enum([
|
|
|
152
152
|
"record.edit",
|
|
153
153
|
"record.reject",
|
|
154
154
|
"record.archive",
|
|
155
|
-
"record.unarchive",
|
|
156
155
|
"record.review-duplicates",
|
|
157
156
|
"record.register",
|
|
158
157
|
"record.print-certified-copies",
|
|
@@ -258,7 +257,6 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
|
258
257
|
"record.edit",
|
|
259
258
|
"record.reject",
|
|
260
259
|
"record.archive",
|
|
261
|
-
"record.unarchive",
|
|
262
260
|
"record.review-duplicates",
|
|
263
261
|
"record.register"
|
|
264
262
|
]);
|
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",
|
|
@@ -588,7 +586,6 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
|
588
586
|
"record.edit",
|
|
589
587
|
"record.reject",
|
|
590
588
|
"record.archive",
|
|
591
|
-
"record.unarchive",
|
|
592
589
|
"record.review-duplicates",
|
|
593
590
|
"record.register"
|
|
594
591
|
]);
|
|
@@ -775,7 +772,6 @@ var ActionType = {
|
|
|
775
772
|
MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
|
|
776
773
|
MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
|
|
777
774
|
ARCHIVE: "ARCHIVE",
|
|
778
|
-
UNARCHIVE: "UNARCHIVE",
|
|
779
775
|
// Record actions
|
|
780
776
|
PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
|
|
781
777
|
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
|
@@ -795,7 +791,6 @@ var ConfirmableActions = [
|
|
|
795
791
|
ActionType.REGISTER,
|
|
796
792
|
ActionType.REJECT,
|
|
797
793
|
ActionType.ARCHIVE,
|
|
798
|
-
ActionType.UNARCHIVE,
|
|
799
794
|
ActionType.PRINT_CERTIFICATE,
|
|
800
795
|
ActionType.REQUEST_CORRECTION,
|
|
801
796
|
ActionType.APPROVE_CORRECTION,
|
|
@@ -814,7 +809,6 @@ var ActionTypes = z4.enum([
|
|
|
814
809
|
"MARK_AS_DUPLICATE",
|
|
815
810
|
"MARK_AS_NOT_DUPLICATE",
|
|
816
811
|
"ARCHIVE",
|
|
817
|
-
"UNARCHIVE",
|
|
818
812
|
"PRINT_CERTIFICATE",
|
|
819
813
|
"REQUEST_CORRECTION",
|
|
820
814
|
"REJECT_CORRECTION",
|
|
@@ -858,7 +852,6 @@ var WorkqueueActionType = ActionTypes.extract([
|
|
|
858
852
|
ActionType.REJECT,
|
|
859
853
|
ActionType.MARK_AS_DUPLICATE,
|
|
860
854
|
ActionType.ARCHIVE,
|
|
861
|
-
ActionType.UNARCHIVE,
|
|
862
855
|
ActionType.PRINT_CERTIFICATE,
|
|
863
856
|
ActionType.REQUEST_CORRECTION
|
|
864
857
|
]);
|
|
@@ -923,7 +916,6 @@ var EventActionEntrySchema = AuditLogEntryBase.extend({
|
|
|
923
916
|
"event.actions.unassign.request",
|
|
924
917
|
"event.actions.read.request",
|
|
925
918
|
"event.actions.archive.request",
|
|
926
|
-
"event.actions.unarchive.request",
|
|
927
919
|
"event.actions.reinstate.request",
|
|
928
920
|
"event.actions.print_certificate.request",
|
|
929
921
|
"event.actions.correction.request.request",
|
|
@@ -1657,11 +1649,6 @@ var ArchiveAction = ActionBase.extend(
|
|
|
1657
1649
|
content: ReasonContent
|
|
1658
1650
|
}).shape
|
|
1659
1651
|
);
|
|
1660
|
-
var UnarchiveAction = ActionBase.extend(
|
|
1661
|
-
z14.object({
|
|
1662
|
-
type: z14.literal(ActionType.UNARCHIVE)
|
|
1663
|
-
}).shape
|
|
1664
|
-
);
|
|
1665
1652
|
var CreatedAction = ActionBase.extend(
|
|
1666
1653
|
z14.object({
|
|
1667
1654
|
type: z14.literal(ActionType.CREATE)
|
|
@@ -1728,7 +1715,6 @@ var ActionDocument = z14.discriminatedUnion("type", [
|
|
|
1728
1715
|
MarkNotDuplicateAction.meta({ id: "MarkNotDuplicateAction" }),
|
|
1729
1716
|
MarkAsDuplicateAction.meta({ id: "MarkAsDuplicateAction" }),
|
|
1730
1717
|
ArchiveAction.meta({ id: "ArchiveAction" }),
|
|
1731
|
-
UnarchiveAction.meta({ id: "UnarchiveAction" }),
|
|
1732
1718
|
NotifiedAction.meta({ id: "NotifiedAction" }),
|
|
1733
1719
|
RegisterAction.meta({ id: "RegisterAction" }),
|
|
1734
1720
|
DeclareAction.meta({ id: "DeclareAction" }),
|
|
@@ -3252,52 +3238,6 @@ var NotifyConfig = ActionConfigBase.extend(
|
|
|
3252
3238
|
type: z24.literal(ActionType.NOTIFY)
|
|
3253
3239
|
}).shape
|
|
3254
3240
|
);
|
|
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
3241
|
var DeclareConfig = DeclarationActionBase.extend(
|
|
3302
3242
|
z24.object({
|
|
3303
3243
|
type: z24.literal(ActionType.DECLARE),
|
|
@@ -3322,11 +3262,6 @@ var ArchiveConfig = ActionConfigBase.extend(
|
|
|
3322
3262
|
type: z24.literal(ActionType.ARCHIVE)
|
|
3323
3263
|
}).shape
|
|
3324
3264
|
);
|
|
3325
|
-
var UnarchiveConfig = ActionConfigBase.extend(
|
|
3326
|
-
z24.object({
|
|
3327
|
-
type: z24.literal(ActionType.UNARCHIVE)
|
|
3328
|
-
}).shape
|
|
3329
|
-
);
|
|
3330
3265
|
var EditActionConfig = ActionConfigBase.extend(
|
|
3331
3266
|
z24.object({
|
|
3332
3267
|
type: z24.literal(ActionType.EDIT),
|
|
@@ -3365,17 +3300,7 @@ var RequestCorrectionConfig = ActionConfigBase.extend(
|
|
|
3365
3300
|
correctionForm: ActionFormConfig
|
|
3366
3301
|
}).shape
|
|
3367
3302
|
);
|
|
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(
|
|
3303
|
+
var CustomActionConfig = ActionConfigBase.merge(
|
|
3379
3304
|
z24.object({
|
|
3380
3305
|
type: z24.literal(ActionType.CUSTOM),
|
|
3381
3306
|
customActionType: z24.string().describe("Type identifier of the custom action."),
|
|
@@ -3386,7 +3311,7 @@ var CustomActionConfig = ActionConfigBase.extend(
|
|
|
3386
3311
|
auditHistoryLabel: TranslationConfig.describe(
|
|
3387
3312
|
'The label to show in audit history for this action. For example "Approved".'
|
|
3388
3313
|
)
|
|
3389
|
-
})
|
|
3314
|
+
})
|
|
3390
3315
|
);
|
|
3391
3316
|
var ActionConfig = z24.discriminatedUnion("type", [
|
|
3392
3317
|
/*
|
|
@@ -3397,18 +3322,6 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3397
3322
|
id: "ReadActionConfig",
|
|
3398
3323
|
description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
|
|
3399
3324
|
}),
|
|
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
3325
|
NotifyConfig.meta({
|
|
3413
3326
|
id: "NotifyActionConfig",
|
|
3414
3327
|
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 +3330,6 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3417
3330
|
id: "DeclareActionConfig",
|
|
3418
3331
|
description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
|
|
3419
3332
|
}),
|
|
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
3333
|
RejectConfig.meta({
|
|
3433
3334
|
id: "RejectActionConfig",
|
|
3434
3335
|
description: "Configuration for rejecting a record before registration."
|
|
@@ -3445,14 +3346,6 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3445
3346
|
id: "RequestCorrectionActionConfig",
|
|
3446
3347
|
description: "Configuration for requesting a correction on a registered record."
|
|
3447
3348
|
}),
|
|
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
3349
|
EditActionConfig.meta({
|
|
3457
3350
|
id: "EditActionConfig",
|
|
3458
3351
|
description: "Configuration for editing a record before registration."
|
|
@@ -3461,10 +3354,6 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3461
3354
|
id: "ArchiveActionConfig",
|
|
3462
3355
|
description: "Configuration for archiving a record."
|
|
3463
3356
|
}),
|
|
3464
|
-
UnarchiveConfig.meta({
|
|
3465
|
-
id: "UnarchiveActionConfig",
|
|
3466
|
-
description: "Configuration for unarchiving a record."
|
|
3467
|
-
}),
|
|
3468
3357
|
CustomActionConfig.meta({
|
|
3469
3358
|
id: "CustomActionConfig",
|
|
3470
3359
|
description: "Configuration for a country-defined custom action. An event may include any number of these."
|
|
@@ -4615,6 +4504,9 @@ function getActionConfig({
|
|
|
4615
4504
|
if (a.type === ActionType.CUSTOM && customActionType) {
|
|
4616
4505
|
return a.customActionType === customActionType;
|
|
4617
4506
|
}
|
|
4507
|
+
if (actionType === ActionType.APPROVE_CORRECTION || actionType === ActionType.REJECT_CORRECTION) {
|
|
4508
|
+
return a.type === ActionType.REQUEST_CORRECTION;
|
|
4509
|
+
}
|
|
4618
4510
|
return a.type === actionType;
|
|
4619
4511
|
});
|
|
4620
4512
|
}
|
|
@@ -5768,7 +5660,7 @@ function validateActionFlags(event2, ctx) {
|
|
|
5768
5660
|
const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
|
|
5769
5661
|
const configuredFlagIds = event2.flags.map((flag2) => flag2.id);
|
|
5770
5662
|
const actionFlagIds = event2.actions.flatMap(
|
|
5771
|
-
(action) =>
|
|
5663
|
+
(action) => action.flags.map((flag2) => flag2.id)
|
|
5772
5664
|
);
|
|
5773
5665
|
for (const actionFlagId of actionFlagIds) {
|
|
5774
5666
|
const isConfigured = configuredFlagIds.includes(actionFlagId);
|
|
@@ -6443,11 +6335,6 @@ var ArchiveActionInput = BaseActionInput.extend(
|
|
|
6443
6335
|
content: ReasonContent
|
|
6444
6336
|
}).shape
|
|
6445
6337
|
);
|
|
6446
|
-
var UnarchiveActionInput = BaseActionInput.extend(
|
|
6447
|
-
z38.object({
|
|
6448
|
-
type: z38.literal(ActionType.UNARCHIVE).default(ActionType.UNARCHIVE)
|
|
6449
|
-
}).shape
|
|
6450
|
-
);
|
|
6451
6338
|
var AssignActionInput = BaseActionInput.extend(
|
|
6452
6339
|
z38.object({
|
|
6453
6340
|
type: z38.literal(ActionType.ASSIGN),
|
|
@@ -6509,7 +6396,6 @@ var ActionInput = z38.discriminatedUnion("type", [
|
|
|
6509
6396
|
id: "MarkNotDuplicateActionInput"
|
|
6510
6397
|
}),
|
|
6511
6398
|
ArchiveActionInput.meta({ id: "ArchiveActionInput" }),
|
|
6512
|
-
UnarchiveActionInput.meta({ id: "UnarchiveActionInput" }),
|
|
6513
6399
|
AssignActionInput.meta({ id: "AssignActionInput" }),
|
|
6514
6400
|
UnassignActionInput.meta({ id: "UnassignActionInput" }),
|
|
6515
6401
|
PrintCertificateActionInput.meta({ id: "PrintCertificateActionInput" }),
|
|
@@ -6624,7 +6510,6 @@ var updateActions = ActionTypes.extract([
|
|
|
6624
6510
|
ActionType.REGISTER,
|
|
6625
6511
|
ActionType.REJECT,
|
|
6626
6512
|
ActionType.ARCHIVE,
|
|
6627
|
-
ActionType.UNARCHIVE,
|
|
6628
6513
|
ActionType.PRINT_CERTIFICATE,
|
|
6629
6514
|
ActionType.REQUEST_CORRECTION,
|
|
6630
6515
|
ActionType.APPROVE_CORRECTION,
|
|
@@ -6746,12 +6631,15 @@ var INHERENT_FLAG_RULES = [
|
|
|
6746
6631
|
},
|
|
6747
6632
|
{
|
|
6748
6633
|
// 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.
|
|
6634
|
+
// other status-changing action (see getStatusFromActions).
|
|
6752
6635
|
flag: InherentFlags.INCOMPLETE,
|
|
6753
6636
|
setOn: [ActionType.NOTIFY],
|
|
6754
|
-
resetOn: [
|
|
6637
|
+
resetOn: [
|
|
6638
|
+
ActionType.CREATE,
|
|
6639
|
+
ActionType.DECLARE,
|
|
6640
|
+
ActionType.REGISTER,
|
|
6641
|
+
ActionType.ARCHIVE
|
|
6642
|
+
]
|
|
6755
6643
|
},
|
|
6756
6644
|
{
|
|
6757
6645
|
flag: InherentFlags.REJECTED,
|
|
@@ -6815,7 +6703,7 @@ function resolveEventCustomFlags(event2, eventConfiguration) {
|
|
|
6815
6703
|
const declaration = aggregateActionDeclarations(eventUpToThisAction);
|
|
6816
6704
|
const annotation = aggregateActionAnnotations(eventUpToThisAction);
|
|
6817
6705
|
const form = { ...declaration, ...annotation };
|
|
6818
|
-
const flagsWithMetConditions =
|
|
6706
|
+
const flagsWithMetConditions = actionConfig.flags.filter(
|
|
6819
6707
|
({ conditional }) => (
|
|
6820
6708
|
// If conditional is not provided, the flag is resolved
|
|
6821
6709
|
conditional ? isFlagConditionMet(conditional, form, action) : true
|
|
@@ -6861,27 +6749,7 @@ function getEventFlags(event2, config) {
|
|
|
6861
6749
|
|
|
6862
6750
|
// ../commons/src/events/state/index.ts
|
|
6863
6751
|
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) => {
|
|
6752
|
+
return actions.filter(({ status: status2 }) => status2 === ActionStatus.Accepted).reduce((status2, action) => {
|
|
6885
6753
|
switch (action.type) {
|
|
6886
6754
|
case ActionType.CREATE:
|
|
6887
6755
|
return EventStatus.enum.CREATED;
|
|
@@ -6889,11 +6757,10 @@ function getStatusFromActions(actions) {
|
|
|
6889
6757
|
return EventStatus.enum.DECLARED;
|
|
6890
6758
|
case ActionType.REGISTER:
|
|
6891
6759
|
return EventStatus.enum.REGISTERED;
|
|
6760
|
+
case ActionType.ARCHIVE:
|
|
6761
|
+
return EventStatus.enum.ARCHIVED;
|
|
6892
6762
|
case ActionType.NOTIFY:
|
|
6893
6763
|
return EventStatus.enum.NOTIFIED;
|
|
6894
|
-
// Already filtered out above; listed here only to satisfy exhaustiveness.
|
|
6895
|
-
case ActionType.ARCHIVE:
|
|
6896
|
-
case ActionType.UNARCHIVE:
|
|
6897
6764
|
case ActionType.CUSTOM:
|
|
6898
6765
|
case ActionType.PRINT_CERTIFICATE:
|
|
6899
6766
|
case ActionType.ASSIGN:
|
|
@@ -9978,14 +9845,6 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
|
|
|
9978
9845
|
},
|
|
9979
9846
|
...input
|
|
9980
9847
|
}),
|
|
9981
|
-
unarchive: (eventId, input = {}) => ({
|
|
9982
|
-
type: ActionType.UNARCHIVE,
|
|
9983
|
-
transactionId: input.transactionId ?? getUUID(),
|
|
9984
|
-
declaration: {},
|
|
9985
|
-
annotation: {},
|
|
9986
|
-
eventId,
|
|
9987
|
-
...input
|
|
9988
|
-
}),
|
|
9989
9848
|
reject: (eventId, input = {}) => ({
|
|
9990
9849
|
type: ActionType.REJECT,
|
|
9991
9850
|
transactionId: input.transactionId ?? getUUID(),
|
|
@@ -10144,7 +10003,6 @@ function generateActionDocument({
|
|
|
10144
10003
|
case ActionType.NOTIFY:
|
|
10145
10004
|
case ActionType.REGISTER:
|
|
10146
10005
|
case ActionType.REQUEST_CORRECTION:
|
|
10147
|
-
case ActionType.UNARCHIVE:
|
|
10148
10006
|
return { ...actionBase, type: action };
|
|
10149
10007
|
case ActionType.EDIT:
|
|
10150
10008
|
return {
|
|
@@ -10663,7 +10521,6 @@ var ACTION_SCOPE_MAP = {
|
|
|
10663
10521
|
[ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
|
|
10664
10522
|
[ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
|
|
10665
10523
|
[ActionType.ARCHIVE]: ["record.archive"],
|
|
10666
|
-
[ActionType.UNARCHIVE]: ["record.unarchive"],
|
|
10667
10524
|
[ActionType.REJECT]: ["record.reject"],
|
|
10668
10525
|
[ActionType.ASSIGN]: null,
|
|
10669
10526
|
[ActionType.UNASSIGN]: null,
|
|
@@ -10870,11 +10727,7 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
|
10870
10727
|
ActionType.CUSTOM,
|
|
10871
10728
|
ClientSpecificAction.REVIEW_CORRECTION_REQUEST
|
|
10872
10729
|
],
|
|
10873
|
-
[EventStatus.enum.ARCHIVED]: [
|
|
10874
|
-
ActionType.READ,
|
|
10875
|
-
ActionType.CUSTOM,
|
|
10876
|
-
ActionType.UNARCHIVE
|
|
10877
|
-
]
|
|
10730
|
+
[EventStatus.enum.ARCHIVED]: [ActionType.READ, ActionType.CUSTOM]
|
|
10878
10731
|
};
|
|
10879
10732
|
var ACTION_FILTERS = {
|
|
10880
10733
|
[ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
@@ -10887,7 +10740,6 @@ var ACTION_FILTERS = {
|
|
|
10887
10740
|
[ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10888
10741
|
[ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10889
10742
|
[ActionType.ARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10890
|
-
[ActionType.UNARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10891
10743
|
[ActionType.ASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10892
10744
|
[ActionType.UNASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10893
10745
|
[ActionType.CUSTOM]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested"))
|