@opencrvs/toolkit 2.1.0-rc.69ab488 → 2.1.0-rc.8d76997
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/dist/commons/events/ActionConfig.d.ts +7 -0
- package/dist/commons/events/utils.d.ts +8 -0
- package/dist/events/index.js +29 -12
- package/dist/notification/index.js +15 -11
- package/opencrvs-toolkit-2.1.0-rc.8d76997.tgz +0 -0
- package/package.json +1 -1
- package/opencrvs-toolkit-2.1.0-rc.69ab488.tgz +0 -0
|
@@ -163,6 +163,7 @@ export declare const ActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
163
163
|
conditional: z.ZodAny;
|
|
164
164
|
}, z.core.$strip>], "type">>>;
|
|
165
165
|
type: z.ZodLiteral<"NOTIFY">;
|
|
166
|
+
form: z.ZodOptional<z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>>;
|
|
166
167
|
}, z.core.$strip>, z.ZodObject<{
|
|
167
168
|
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
|
|
168
169
|
flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -198,6 +199,7 @@ export declare const ActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
198
199
|
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
|
|
199
200
|
fields: z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>;
|
|
200
201
|
}, z.core.$strip>;
|
|
202
|
+
form: z.ZodOptional<z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>>;
|
|
201
203
|
dialogCopy: z.ZodOptional<z.ZodObject<{
|
|
202
204
|
notify: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
|
|
203
205
|
declare: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
|
|
@@ -301,6 +303,7 @@ export declare const ActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
301
303
|
conditional: z.ZodAny;
|
|
302
304
|
}, z.core.$strip>], "type">>>;
|
|
303
305
|
type: z.ZodLiteral<"REJECT">;
|
|
306
|
+
form: z.ZodOptional<z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>>;
|
|
304
307
|
}, z.core.$strip>, z.ZodObject<{
|
|
305
308
|
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
|
|
306
309
|
flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -332,6 +335,7 @@ export declare const ActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
332
335
|
query: z.ZodType<import("./DeduplicationConfig").ClauseOutput, import("./DeduplicationConfig").ClauseInput, z.core.$ZodTypeInternals<import("./DeduplicationConfig").ClauseOutput, import("./DeduplicationConfig").ClauseInput>>;
|
|
333
336
|
}, z.core.$strip>>;
|
|
334
337
|
type: z.ZodLiteral<"REGISTER">;
|
|
338
|
+
form: z.ZodOptional<z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>>;
|
|
335
339
|
}, z.core.$strip>, z.ZodObject<{
|
|
336
340
|
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
|
|
337
341
|
flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -553,6 +557,7 @@ export declare const ActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
553
557
|
conditional: z.ZodAny;
|
|
554
558
|
}, z.core.$strip>], "type">>>;
|
|
555
559
|
type: z.ZodLiteral<"ARCHIVE">;
|
|
560
|
+
form: z.ZodOptional<z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>>;
|
|
556
561
|
}, z.core.$strip>, z.ZodObject<{
|
|
557
562
|
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
|
|
558
563
|
flags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -655,6 +660,7 @@ export declare const DeclarationActionConfig: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
655
660
|
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
|
|
656
661
|
fields: z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>;
|
|
657
662
|
}, z.core.$strip>;
|
|
663
|
+
form: z.ZodOptional<z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>>;
|
|
658
664
|
dialogCopy: z.ZodOptional<z.ZodObject<{
|
|
659
665
|
notify: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
|
|
660
666
|
declare: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
|
|
@@ -691,6 +697,7 @@ export declare const DeclarationActionConfig: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
691
697
|
query: z.ZodType<import("./DeduplicationConfig").ClauseOutput, import("./DeduplicationConfig").ClauseInput, z.core.$ZodTypeInternals<import("./DeduplicationConfig").ClauseOutput, import("./DeduplicationConfig").ClauseInput>>;
|
|
692
698
|
}, z.core.$strip>>;
|
|
693
699
|
type: z.ZodLiteral<"REGISTER">;
|
|
700
|
+
form: z.ZodOptional<z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>>;
|
|
694
701
|
}, z.core.$strip>], "type">;
|
|
695
702
|
export type DeclarationActionConfig = z.infer<typeof DeclarationActionConfig>;
|
|
696
703
|
export {};
|
|
@@ -50,6 +50,14 @@ export declare function getActionConfig({ eventConfiguration, actionType, custom
|
|
|
50
50
|
customActionType?: string;
|
|
51
51
|
}): ActionConfig | undefined;
|
|
52
52
|
export declare function getCustomActionFields(eventConfiguration: EventConfig, customActionType: string): FieldConfig[];
|
|
53
|
+
/**
|
|
54
|
+
* Returns the fields configured for an action's confirmation dialog.
|
|
55
|
+
*
|
|
56
|
+
* Unlike review fields and supporting copy, NOTIFY does NOT fall back to the
|
|
57
|
+
* DECLARE config here: dialog fields always come from the action's own
|
|
58
|
+
* configuration entry.
|
|
59
|
+
*/
|
|
60
|
+
export declare function getActionFormFields(eventConfiguration: EventConfig, actionType: ActionType, customActionType?: string): FieldConfig[];
|
|
53
61
|
export declare function getPrintCertificatePages(configuration: EventConfig): ({
|
|
54
62
|
id: string;
|
|
55
63
|
title: {
|
package/dist/events/index.js
CHANGED
|
@@ -313,6 +313,7 @@ __export(events_exports, {
|
|
|
313
313
|
getActionAnnotation: () => getActionAnnotation,
|
|
314
314
|
getActionAnnotationFields: () => getActionAnnotationFields,
|
|
315
315
|
getActionConfig: () => getActionConfig,
|
|
316
|
+
getActionFormFields: () => getActionFormFields,
|
|
316
317
|
getActionReview: () => getActionReview,
|
|
317
318
|
getActionReviewFields: () => getActionReviewFields,
|
|
318
319
|
getAdministrativeAreaHierarchy: () => getAdministrativeAreaHierarchy,
|
|
@@ -3238,6 +3239,9 @@ var ActionConfigBase = z24.object({
|
|
|
3238
3239
|
var DeclarationActionBase = ActionConfigBase.extend({
|
|
3239
3240
|
deduplication: DeduplicationConfig.optional()
|
|
3240
3241
|
});
|
|
3242
|
+
var actionConfirmationForm = z24.array(FieldConfig).optional().describe(
|
|
3243
|
+
"Fields rendered on the action confirmation dialog. Submitted values are stored in the action annotation and shown in the audit history."
|
|
3244
|
+
);
|
|
3241
3245
|
var ReadActionConfig = ActionConfigBase.extend(
|
|
3242
3246
|
z24.object({
|
|
3243
3247
|
type: z24.literal(ActionType.READ),
|
|
@@ -3249,7 +3253,8 @@ var ReadActionConfig = ActionConfigBase.extend(
|
|
|
3249
3253
|
);
|
|
3250
3254
|
var NotifyConfig = ActionConfigBase.extend(
|
|
3251
3255
|
z24.object({
|
|
3252
|
-
type: z24.literal(ActionType.NOTIFY)
|
|
3256
|
+
type: z24.literal(ActionType.NOTIFY),
|
|
3257
|
+
form: actionConfirmationForm
|
|
3253
3258
|
}).shape
|
|
3254
3259
|
);
|
|
3255
3260
|
var DuplicateDetectedConfig = ActionConfigBase.extend(
|
|
@@ -3304,6 +3309,7 @@ var DeclareConfig = DeclarationActionBase.extend(
|
|
|
3304
3309
|
review: DeclarationReviewConfig.describe(
|
|
3305
3310
|
"Configuration of the review page fields."
|
|
3306
3311
|
),
|
|
3312
|
+
form: actionConfirmationForm,
|
|
3307
3313
|
dialogCopy: z24.object({
|
|
3308
3314
|
notify: TranslationConfig.describe(
|
|
3309
3315
|
"Confirmation text for the notify action"
|
|
@@ -3319,7 +3325,8 @@ var DeclareConfig = DeclarationActionBase.extend(
|
|
|
3319
3325
|
);
|
|
3320
3326
|
var ArchiveConfig = ActionConfigBase.extend(
|
|
3321
3327
|
z24.object({
|
|
3322
|
-
type: z24.literal(ActionType.ARCHIVE)
|
|
3328
|
+
type: z24.literal(ActionType.ARCHIVE),
|
|
3329
|
+
form: actionConfirmationForm
|
|
3323
3330
|
}).shape
|
|
3324
3331
|
);
|
|
3325
3332
|
var UnarchiveConfig = ActionConfigBase.extend(
|
|
@@ -3345,12 +3352,14 @@ var EditActionConfig = ActionConfigBase.extend(
|
|
|
3345
3352
|
);
|
|
3346
3353
|
var RejectConfig = ActionConfigBase.extend(
|
|
3347
3354
|
z24.object({
|
|
3348
|
-
type: z24.literal(ActionType.REJECT)
|
|
3355
|
+
type: z24.literal(ActionType.REJECT),
|
|
3356
|
+
form: actionConfirmationForm
|
|
3349
3357
|
}).shape
|
|
3350
3358
|
);
|
|
3351
3359
|
var RegisterConfig = DeclarationActionBase.extend(
|
|
3352
3360
|
z24.object({
|
|
3353
|
-
type: z24.literal(ActionType.REGISTER)
|
|
3361
|
+
type: z24.literal(ActionType.REGISTER),
|
|
3362
|
+
form: actionConfirmationForm
|
|
3354
3363
|
}).shape
|
|
3355
3364
|
);
|
|
3356
3365
|
var PrintCertificateActionConfig = ActionConfigBase.extend(
|
|
@@ -4624,7 +4633,19 @@ function getCustomActionFields(eventConfiguration, customActionType) {
|
|
|
4624
4633
|
customActionType,
|
|
4625
4634
|
actionType: ActionType.CUSTOM
|
|
4626
4635
|
});
|
|
4627
|
-
if (!actionConfig ||
|
|
4636
|
+
if (!actionConfig || actionConfig.type !== ActionType.CUSTOM) {
|
|
4637
|
+
return [];
|
|
4638
|
+
}
|
|
4639
|
+
return actionConfig.form;
|
|
4640
|
+
}
|
|
4641
|
+
function getActionFormFields(eventConfiguration, actionType, customActionType) {
|
|
4642
|
+
const actionConfig = eventConfiguration.actions.find((a) => {
|
|
4643
|
+
if (a.type === ActionType.CUSTOM && customActionType) {
|
|
4644
|
+
return a.customActionType === customActionType;
|
|
4645
|
+
}
|
|
4646
|
+
return a.type === actionType;
|
|
4647
|
+
});
|
|
4648
|
+
if (!actionConfig || !("form" in actionConfig) || actionConfig.form == null) {
|
|
4628
4649
|
return [];
|
|
4629
4650
|
}
|
|
4630
4651
|
return actionConfig.form;
|
|
@@ -4645,13 +4666,9 @@ var getActionAnnotationFields = (actionConfig) => {
|
|
|
4645
4666
|
if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
|
|
4646
4667
|
return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
|
|
4647
4668
|
}
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
if ("review" in actionConfig && actionConfig.review != null) {
|
|
4652
|
-
return actionConfig.review.fields;
|
|
4653
|
-
}
|
|
4654
|
-
return [];
|
|
4669
|
+
const reviewFields = "review" in actionConfig && actionConfig.review != null ? actionConfig.review.fields : [];
|
|
4670
|
+
const formFields = "form" in actionConfig && actionConfig.form != null ? actionConfig.form : [];
|
|
4671
|
+
return [...reviewFields, ...formFields];
|
|
4655
4672
|
};
|
|
4656
4673
|
function getAllAnnotationFields(config) {
|
|
4657
4674
|
return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
|
|
@@ -2694,6 +2694,9 @@ var ActionConfigBase = z24.object({
|
|
|
2694
2694
|
var DeclarationActionBase = ActionConfigBase.extend({
|
|
2695
2695
|
deduplication: DeduplicationConfig.optional()
|
|
2696
2696
|
});
|
|
2697
|
+
var actionConfirmationForm = z24.array(FieldConfig).optional().describe(
|
|
2698
|
+
"Fields rendered on the action confirmation dialog. Submitted values are stored in the action annotation and shown in the audit history."
|
|
2699
|
+
);
|
|
2697
2700
|
var ReadActionConfig = ActionConfigBase.extend(
|
|
2698
2701
|
z24.object({
|
|
2699
2702
|
type: z24.literal(ActionType.READ),
|
|
@@ -2705,7 +2708,8 @@ var ReadActionConfig = ActionConfigBase.extend(
|
|
|
2705
2708
|
);
|
|
2706
2709
|
var NotifyConfig = ActionConfigBase.extend(
|
|
2707
2710
|
z24.object({
|
|
2708
|
-
type: z24.literal(ActionType.NOTIFY)
|
|
2711
|
+
type: z24.literal(ActionType.NOTIFY),
|
|
2712
|
+
form: actionConfirmationForm
|
|
2709
2713
|
}).shape
|
|
2710
2714
|
);
|
|
2711
2715
|
var DuplicateDetectedConfig = ActionConfigBase.extend(
|
|
@@ -2760,6 +2764,7 @@ var DeclareConfig = DeclarationActionBase.extend(
|
|
|
2760
2764
|
review: DeclarationReviewConfig.describe(
|
|
2761
2765
|
"Configuration of the review page fields."
|
|
2762
2766
|
),
|
|
2767
|
+
form: actionConfirmationForm,
|
|
2763
2768
|
dialogCopy: z24.object({
|
|
2764
2769
|
notify: TranslationConfig.describe(
|
|
2765
2770
|
"Confirmation text for the notify action"
|
|
@@ -2775,7 +2780,8 @@ var DeclareConfig = DeclarationActionBase.extend(
|
|
|
2775
2780
|
);
|
|
2776
2781
|
var ArchiveConfig = ActionConfigBase.extend(
|
|
2777
2782
|
z24.object({
|
|
2778
|
-
type: z24.literal(ActionType.ARCHIVE)
|
|
2783
|
+
type: z24.literal(ActionType.ARCHIVE),
|
|
2784
|
+
form: actionConfirmationForm
|
|
2779
2785
|
}).shape
|
|
2780
2786
|
);
|
|
2781
2787
|
var UnarchiveConfig = ActionConfigBase.extend(
|
|
@@ -2801,12 +2807,14 @@ var EditActionConfig = ActionConfigBase.extend(
|
|
|
2801
2807
|
);
|
|
2802
2808
|
var RejectConfig = ActionConfigBase.extend(
|
|
2803
2809
|
z24.object({
|
|
2804
|
-
type: z24.literal(ActionType.REJECT)
|
|
2810
|
+
type: z24.literal(ActionType.REJECT),
|
|
2811
|
+
form: actionConfirmationForm
|
|
2805
2812
|
}).shape
|
|
2806
2813
|
);
|
|
2807
2814
|
var RegisterConfig = DeclarationActionBase.extend(
|
|
2808
2815
|
z24.object({
|
|
2809
|
-
type: z24.literal(ActionType.REGISTER)
|
|
2816
|
+
type: z24.literal(ActionType.REGISTER),
|
|
2817
|
+
form: actionConfirmationForm
|
|
2810
2818
|
}).shape
|
|
2811
2819
|
);
|
|
2812
2820
|
var PrintCertificateActionConfig = ActionConfigBase.extend(
|
|
@@ -3326,13 +3334,9 @@ var getActionAnnotationFields = (actionConfig) => {
|
|
|
3326
3334
|
if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
|
|
3327
3335
|
return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
|
|
3328
3336
|
}
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
if ("review" in actionConfig && actionConfig.review != null) {
|
|
3333
|
-
return actionConfig.review.fields;
|
|
3334
|
-
}
|
|
3335
|
-
return [];
|
|
3337
|
+
const reviewFields = "review" in actionConfig && actionConfig.review != null ? actionConfig.review.fields : [];
|
|
3338
|
+
const formFields = "form" in actionConfig && actionConfig.form != null ? actionConfig.form : [];
|
|
3339
|
+
return [...reviewFields, ...formFields];
|
|
3336
3340
|
};
|
|
3337
3341
|
function getAllAnnotationFields(config) {
|
|
3338
3342
|
return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
|
|
Binary file
|
package/package.json
CHANGED
|
Binary file
|