@opencrvs/toolkit 1.8.0-rc.f872339 → 1.8.0-rc.f881988
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/api/router.d.ts +7266 -4144
- package/dist/commons/conditionals/conditionals.d.ts +9 -6
- package/dist/commons/events/ActionConfig.d.ts +86380 -1682
- package/dist/commons/events/ActionDocument.d.ts +418 -107
- package/dist/commons/events/ActionInput.d.ts +68 -60
- package/dist/commons/events/AdvancedSearchConfig.d.ts +371 -25
- package/dist/commons/events/Draft.d.ts +24 -9
- package/dist/commons/events/EventConfig.d.ts +40980 -1394
- package/dist/commons/events/EventDocument.d.ts +331 -82
- package/dist/commons/events/EventIndex.d.ts +912 -4
- package/dist/commons/events/EventInput.d.ts +13 -0
- package/dist/commons/events/EventMetadata.d.ts +10 -3
- package/dist/commons/events/FieldConfig.d.ts +3415 -711
- package/dist/commons/events/FieldType.d.ts +1 -2
- package/dist/commons/events/FieldValue.d.ts +1 -1
- package/dist/commons/events/FormConfig.d.ts +38845 -517
- package/dist/commons/events/PageConfig.d.ts +9671 -203
- package/dist/commons/events/SummaryConfig.d.ts +0 -47
- package/dist/commons/events/WorkqueueConfig.d.ts +44 -20
- package/dist/commons/events/defineConfig.d.ts +6669 -30
- package/dist/commons/events/event.d.ts +25 -0
- package/dist/commons/events/field.d.ts +68 -0
- package/dist/commons/events/index.d.ts +2 -0
- package/dist/commons/events/scopes.d.ts +1 -0
- package/dist/commons/events/test.utils.d.ts +1 -38
- package/dist/commons/events/utils.d.ts +3401 -90
- package/dist/conditionals/index.js +36 -33
- package/dist/events/index.js +707 -577
- package/package.json +3 -2
package/dist/events/index.js
CHANGED
@@ -54,6 +54,7 @@ __export(events_exports, {
|
|
54
54
|
AsyncRejectActionDocument: () => AsyncRejectActionDocument,
|
55
55
|
BaseActionInput: () => BaseActionInput,
|
56
56
|
CONFIG_GET_ALLOWED_SCOPES: () => CONFIG_GET_ALLOWED_SCOPES,
|
57
|
+
CONFIG_SEARCH_ALLOWED_SCOPES: () => CONFIG_SEARCH_ALLOWED_SCOPES,
|
57
58
|
CertificateConfig: () => CertificateConfig,
|
58
59
|
CertificateTemplateConfig: () => CertificateTemplateConfig,
|
59
60
|
CheckboxFieldValue: () => CheckboxFieldValue,
|
@@ -71,6 +72,7 @@ __export(events_exports, {
|
|
71
72
|
DeclarationUpdateActions: () => DeclarationUpdateActions,
|
72
73
|
DeclareActionInput: () => DeclareActionInput,
|
73
74
|
DeduplicationConfig: () => DeduplicationConfig,
|
75
|
+
DeleteActionInput: () => DeleteActionInput,
|
74
76
|
DisplayOnReviewConditional: () => DisplayOnReviewConditional,
|
75
77
|
Draft: () => Draft,
|
76
78
|
DraftInput: () => DraftInput,
|
@@ -79,6 +81,8 @@ __export(events_exports, {
|
|
79
81
|
EnableConditional: () => EnableConditional,
|
80
82
|
EventConfig: () => EventConfig,
|
81
83
|
EventDocument: () => EventDocument,
|
84
|
+
EventFieldConfigSchema: () => EventFieldConfigSchema,
|
85
|
+
EventFieldId: () => EventFieldId,
|
82
86
|
EventIndex: () => EventIndex,
|
83
87
|
EventInput: () => EventInput,
|
84
88
|
EventMetadata: () => EventMetadata,
|
@@ -87,6 +91,7 @@ __export(events_exports, {
|
|
87
91
|
EventStatuses: () => EventStatuses,
|
88
92
|
FieldConditional: () => FieldConditional,
|
89
93
|
FieldConfig: () => FieldConfig,
|
94
|
+
FieldConfigSchema: () => FieldConfigSchema,
|
90
95
|
FieldType: () => FieldType,
|
91
96
|
FieldUpdateValue: () => FieldUpdateValue,
|
92
97
|
FieldValue: () => FieldValue,
|
@@ -101,22 +106,27 @@ __export(events_exports, {
|
|
101
106
|
ImageMimeType: () => ImageMimeType,
|
102
107
|
LanguageConfig: () => LanguageConfig,
|
103
108
|
MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
|
109
|
+
MatchType: () => MatchType,
|
104
110
|
MimeType: () => MimeType,
|
111
|
+
NonEmptyTextValue: () => NonEmptyTextValue,
|
105
112
|
NotifyActionInput: () => NotifyActionInput,
|
106
113
|
NumberFieldValue: () => NumberFieldValue,
|
107
114
|
PageConfig: () => PageConfig,
|
108
115
|
PageTypes: () => PageTypes,
|
109
116
|
PrintCertificateActionInput: () => PrintCertificateActionInput,
|
117
|
+
QueryInput: () => QueryInput,
|
118
|
+
QueryType: () => QueryType,
|
110
119
|
ReadActionInput: () => ReadActionInput,
|
111
120
|
RegisterAction: () => RegisterAction,
|
112
121
|
RegisterActionInput: () => RegisterActionInput,
|
113
122
|
RejectCorrectionActionInput: () => RejectCorrectionActionInput,
|
114
123
|
RejectDeclarationActionInput: () => RejectDeclarationActionInput,
|
115
124
|
RequestCorrectionActionInput: () => RequestCorrectionActionInput,
|
116
|
-
RequiredTextValue: () => RequiredTextValue,
|
117
125
|
ResolvedUser: () => ResolvedUser,
|
118
126
|
RuralAddressUpdateValue: () => RuralAddressUpdateValue,
|
119
127
|
RuralAddressValue: () => RuralAddressValue,
|
128
|
+
SearchField: () => SearchField,
|
129
|
+
SelectOption: () => SelectOption,
|
120
130
|
ShowConditional: () => ShowConditional,
|
121
131
|
SummaryConfig: () => SummaryConfig,
|
122
132
|
TextValue: () => TextValue,
|
@@ -128,6 +138,7 @@ __export(events_exports, {
|
|
128
138
|
VerificationActionConfig: () => VerificationActionConfig,
|
129
139
|
VerificationPageConfig: () => VerificationPageConfig,
|
130
140
|
WorkqueueConfig: () => WorkqueueConfig,
|
141
|
+
ZodDate: () => ZodDate,
|
131
142
|
alwaysTrue: () => alwaysTrue,
|
132
143
|
and: () => and,
|
133
144
|
annotationActions: () => annotationActions,
|
@@ -135,6 +146,8 @@ __export(events_exports, {
|
|
135
146
|
areConditionsMet: () => areConditionsMet,
|
136
147
|
compositeFieldTypes: () => compositeFieldTypes,
|
137
148
|
createEmptyDraft: () => createEmptyDraft,
|
149
|
+
createEventConditionals: () => createEventConditionals,
|
150
|
+
createFieldConditionals: () => createFieldConditionals,
|
138
151
|
createValidationSchema: () => createValidationSchema,
|
139
152
|
deepDropNulls: () => deepDropNulls,
|
140
153
|
deepMerge: () => deepMerge,
|
@@ -145,6 +158,7 @@ __export(events_exports, {
|
|
145
158
|
defineFormConditional: () => defineFormConditional,
|
146
159
|
defineFormPage: () => defineFormPage,
|
147
160
|
definePage: () => definePage,
|
161
|
+
defineWorkqueue: () => defineWorkqueue,
|
148
162
|
errorMessages: () => errorMessages,
|
149
163
|
event: () => event,
|
150
164
|
eventMetadataLabelMap: () => eventMetadataLabelMap,
|
@@ -170,13 +184,15 @@ __export(events_exports, {
|
|
170
184
|
getActionAnnotationFields: () => getActionAnnotationFields,
|
171
185
|
getActionReview: () => getActionReview,
|
172
186
|
getActionReviewFields: () => getActionReviewFields,
|
173
|
-
|
187
|
+
getActionVerificationPageIds: () => getActionVerificationPageIds,
|
174
188
|
getAnnotationFromDrafts: () => getAnnotationFromDrafts,
|
189
|
+
getAssignedUserFromActions: () => getAssignedUserFromActions,
|
175
190
|
getCurrentEventState: () => getCurrentEventState,
|
176
191
|
getCurrentEventStateWithDrafts: () => getCurrentEventStateWithDrafts,
|
177
192
|
getDeclaration: () => getDeclaration,
|
178
193
|
getDeclarationFields: () => getDeclarationFields,
|
179
194
|
getDeclarationPages: () => getDeclarationPages,
|
195
|
+
getVisibleVerificationPageIds: () => getVisibleVerificationPageIds,
|
180
196
|
hasAnyOfScopes: () => hasAnyOfScopes,
|
181
197
|
isAddressFieldType: () => isAddressFieldType,
|
182
198
|
isAdministrativeAreaFieldType: () => isAdministrativeAreaFieldType,
|
@@ -217,6 +233,7 @@ __export(events_exports, {
|
|
217
233
|
mapFieldTypeToZod: () => mapFieldTypeToZod,
|
218
234
|
never: () => never,
|
219
235
|
not: () => not,
|
236
|
+
omitHiddenAnnotationFields: () => omitHiddenAnnotationFields,
|
220
237
|
omitHiddenFields: () => omitHiddenFields,
|
221
238
|
omitHiddenPaginatedFields: () => omitHiddenPaginatedFields,
|
222
239
|
or: () => or,
|
@@ -224,7 +241,6 @@ __export(events_exports, {
|
|
224
241
|
user: () => user,
|
225
242
|
validate: () => validate,
|
226
243
|
validateFieldInput: () => validateFieldInput,
|
227
|
-
validateWorkqueueConfig: () => validateWorkqueueConfig,
|
228
244
|
writeActions: () => writeActions
|
229
245
|
});
|
230
246
|
module.exports = __toCommonJS(events_exports);
|
@@ -306,7 +322,6 @@ var FieldType = {
|
|
306
322
|
RADIO_GROUP: "RADIO_GROUP",
|
307
323
|
FILE: "FILE",
|
308
324
|
FILE_WITH_OPTIONS: "FILE_WITH_OPTIONS",
|
309
|
-
HIDDEN: "HIDDEN",
|
310
325
|
BULLET_LIST: "BULLET_LIST",
|
311
326
|
CHECKBOX: "CHECKBOX",
|
312
327
|
SELECT: "SELECT",
|
@@ -411,7 +426,7 @@ var FileFieldWithOptionValue = import_zod3.z.array(FileFieldValueWithOption);
|
|
411
426
|
|
412
427
|
// ../commons/src/events/FieldValue.ts
|
413
428
|
var TextValue = import_zod4.z.string();
|
414
|
-
var
|
429
|
+
var NonEmptyTextValue = TextValue.min(1);
|
415
430
|
var DateValue = import_zod4.z.string().date().describe("Date in the format YYYY-MM-DD");
|
416
431
|
var EmailValue = import_zod4.z.string().email();
|
417
432
|
var CheckboxFieldValue = import_zod4.z.boolean();
|
@@ -444,27 +459,21 @@ var FieldUpdateValue = import_zod4.z.union([
|
|
444
459
|
|
445
460
|
// ../commons/src/events/FieldConfig.ts
|
446
461
|
var FieldId = import_zod5.z.string();
|
447
|
-
var
|
448
|
-
|
449
|
-
|
450
|
-
});
|
462
|
+
var ParentReference = import_zod5.z.object({
|
463
|
+
_fieldId: FieldId.optional()
|
464
|
+
}).optional();
|
451
465
|
var BaseField = import_zod5.z.object({
|
452
466
|
id: FieldId,
|
453
467
|
defaultValue: import_zod5.z.union([
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
NumberFieldValue,
|
460
|
-
CheckboxFieldValue
|
461
|
-
]),
|
462
|
-
DependencyExpression
|
468
|
+
TextValue,
|
469
|
+
NonEmptyTextValue,
|
470
|
+
DateValue,
|
471
|
+
NumberFieldValue,
|
472
|
+
CheckboxFieldValue
|
463
473
|
]).optional(),
|
474
|
+
parent: ParentReference,
|
464
475
|
conditionals: import_zod5.z.array(FieldConditional).default([]).optional(),
|
465
476
|
required: import_zod5.z.boolean().default(false).optional(),
|
466
|
-
disabled: import_zod5.z.boolean().default(false).optional(),
|
467
|
-
hidden: import_zod5.z.boolean().default(false).optional(),
|
468
477
|
placeholder: TranslationConfig.optional(),
|
469
478
|
validation: import_zod5.z.array(
|
470
479
|
import_zod5.z.object({
|
@@ -472,7 +481,6 @@ var BaseField = import_zod5.z.object({
|
|
472
481
|
message: TranslationConfig
|
473
482
|
})
|
474
483
|
).default([]).optional(),
|
475
|
-
dependsOn: import_zod5.z.array(FieldId).default([]).optional(),
|
476
484
|
label: TranslationConfig,
|
477
485
|
hideLabel: import_zod5.z.boolean().default(false).optional()
|
478
486
|
});
|
@@ -481,7 +489,7 @@ var Divider = BaseField.extend({
|
|
481
489
|
});
|
482
490
|
var TextField = BaseField.extend({
|
483
491
|
type: import_zod5.z.literal(FieldType.TEXT),
|
484
|
-
defaultValue:
|
492
|
+
defaultValue: NonEmptyTextValue.optional(),
|
485
493
|
configuration: import_zod5.z.object({
|
486
494
|
maxLength: import_zod5.z.number().optional().describe("Maximum length of the text"),
|
487
495
|
type: import_zod5.z.enum(["text", "password"]).optional(),
|
@@ -491,7 +499,7 @@ var TextField = BaseField.extend({
|
|
491
499
|
}).describe("Text input");
|
492
500
|
var NumberField = BaseField.extend({
|
493
501
|
type: import_zod5.z.literal(FieldType.NUMBER),
|
494
|
-
defaultValue:
|
502
|
+
defaultValue: NumberFieldValue.optional(),
|
495
503
|
configuration: import_zod5.z.object({
|
496
504
|
min: import_zod5.z.number().optional().describe("Minimum value"),
|
497
505
|
max: import_zod5.z.number().optional().describe("Maximum value"),
|
@@ -501,7 +509,7 @@ var NumberField = BaseField.extend({
|
|
501
509
|
}).describe("Number input");
|
502
510
|
var TextAreaField = BaseField.extend({
|
503
511
|
type: import_zod5.z.literal(FieldType.TEXTAREA),
|
504
|
-
defaultValue:
|
512
|
+
defaultValue: NonEmptyTextValue.optional(),
|
505
513
|
configuration: import_zod5.z.object({
|
506
514
|
maxLength: import_zod5.z.number().optional().describe("Maximum length of the text"),
|
507
515
|
rows: import_zod5.z.number().optional().describe("Number of visible text lines"),
|
@@ -535,11 +543,11 @@ var EmailField = BaseField.extend({
|
|
535
543
|
configuration: import_zod5.z.object({
|
536
544
|
maxLength: import_zod5.z.number().optional().describe("Maximum length of the text")
|
537
545
|
}).default({ maxLength: 10 }).optional(),
|
538
|
-
defaultValue:
|
546
|
+
defaultValue: NonEmptyTextValue.optional()
|
539
547
|
});
|
540
548
|
var DateField = BaseField.extend({
|
541
549
|
type: import_zod5.z.literal(FieldType.DATE),
|
542
|
-
defaultValue:
|
550
|
+
defaultValue: DateValue.optional(),
|
543
551
|
configuration: import_zod5.z.object({
|
544
552
|
notice: TranslationConfig.describe(
|
545
553
|
"Text to display above the date input"
|
@@ -558,7 +566,7 @@ var HtmlFontVariant = import_zod5.z.enum([
|
|
558
566
|
]);
|
559
567
|
var Paragraph = BaseField.extend({
|
560
568
|
type: import_zod5.z.literal(FieldType.PARAGRAPH),
|
561
|
-
defaultValue:
|
569
|
+
defaultValue: NonEmptyTextValue.optional(),
|
562
570
|
configuration: import_zod5.z.object({
|
563
571
|
styles: import_zod5.z.object({
|
564
572
|
fontVariant: HtmlFontVariant.optional()
|
@@ -567,7 +575,7 @@ var Paragraph = BaseField.extend({
|
|
567
575
|
}).describe("A read-only HTML <p> paragraph");
|
568
576
|
var PageHeader = BaseField.extend({
|
569
577
|
type: import_zod5.z.literal(FieldType.PAGE_HEADER),
|
570
|
-
defaultValue:
|
578
|
+
defaultValue: NonEmptyTextValue.optional()
|
571
579
|
}).describe("A read-only header component for form pages");
|
572
580
|
var File = BaseField.extend({
|
573
581
|
type: import_zod5.z.literal(FieldType.FILE),
|
@@ -590,7 +598,7 @@ var SelectOption = import_zod5.z.object({
|
|
590
598
|
});
|
591
599
|
var RadioGroup = BaseField.extend({
|
592
600
|
type: import_zod5.z.literal(FieldType.RADIO_GROUP),
|
593
|
-
defaultValue:
|
601
|
+
defaultValue: TextValue.optional(),
|
594
602
|
options: import_zod5.z.array(SelectOption).describe("A list of options"),
|
595
603
|
configuration: import_zod5.z.object({
|
596
604
|
styles: import_zod5.z.object({
|
@@ -600,7 +608,7 @@ var RadioGroup = BaseField.extend({
|
|
600
608
|
}).describe("Grouped radio options");
|
601
609
|
var BulletList = BaseField.extend({
|
602
610
|
type: import_zod5.z.literal(FieldType.BULLET_LIST),
|
603
|
-
defaultValue:
|
611
|
+
defaultValue: TextValue.optional(),
|
604
612
|
items: import_zod5.z.array(TranslationConfig).describe("A list of items"),
|
605
613
|
configuration: import_zod5.z.object({
|
606
614
|
styles: import_zod5.z.object({
|
@@ -610,16 +618,16 @@ var BulletList = BaseField.extend({
|
|
610
618
|
}).describe("A list of bullet points");
|
611
619
|
var Select = BaseField.extend({
|
612
620
|
type: import_zod5.z.literal(FieldType.SELECT),
|
613
|
-
defaultValue:
|
621
|
+
defaultValue: TextValue.optional(),
|
614
622
|
options: import_zod5.z.array(SelectOption).describe("A list of options")
|
615
623
|
}).describe("Select input");
|
616
624
|
var Checkbox = BaseField.extend({
|
617
625
|
type: import_zod5.z.literal(FieldType.CHECKBOX),
|
618
|
-
defaultValue:
|
626
|
+
defaultValue: CheckboxFieldValue.optional()
|
619
627
|
}).describe("Boolean checkbox field");
|
620
628
|
var Country = BaseField.extend({
|
621
629
|
type: import_zod5.z.literal(FieldType.COUNTRY),
|
622
|
-
defaultValue:
|
630
|
+
defaultValue: NonEmptyTextValue.optional()
|
623
631
|
}).describe("Country select field");
|
624
632
|
var AdministrativeAreas = import_zod5.z.enum([
|
625
633
|
"ADMIN_STRUCTURE",
|
@@ -634,12 +642,12 @@ var AdministrativeAreaConfiguration = import_zod5.z.object({
|
|
634
642
|
}).describe("Administrative area options");
|
635
643
|
var AdministrativeArea = BaseField.extend({
|
636
644
|
type: import_zod5.z.literal(FieldType.ADMINISTRATIVE_AREA),
|
637
|
-
defaultValue:
|
645
|
+
defaultValue: NonEmptyTextValue.optional(),
|
638
646
|
configuration: AdministrativeAreaConfiguration
|
639
647
|
}).describe("Administrative area input field e.g. facility, office");
|
640
648
|
var Location = BaseField.extend({
|
641
649
|
type: import_zod5.z.literal(FieldType.LOCATION),
|
642
|
-
defaultValue:
|
650
|
+
defaultValue: NonEmptyTextValue.optional()
|
643
651
|
}).describe("Input field for a location");
|
644
652
|
var FileUploadWithOptions = BaseField.extend({
|
645
653
|
type: import_zod5.z.literal(FieldType.FILE_WITH_OPTIONS),
|
@@ -653,11 +661,11 @@ var FileUploadWithOptions = BaseField.extend({
|
|
653
661
|
});
|
654
662
|
var Facility = BaseField.extend({
|
655
663
|
type: import_zod5.z.literal(FieldType.FACILITY),
|
656
|
-
defaultValue:
|
664
|
+
defaultValue: NonEmptyTextValue.optional()
|
657
665
|
}).describe("Input field for a facility");
|
658
666
|
var Office = BaseField.extend({
|
659
667
|
type: import_zod5.z.literal(FieldType.OFFICE),
|
660
|
-
defaultValue:
|
668
|
+
defaultValue: NonEmptyTextValue.optional()
|
661
669
|
}).describe("Input field for an office");
|
662
670
|
var Address = BaseField.extend({
|
663
671
|
type: import_zod5.z.literal(FieldType.ADDRESS),
|
@@ -702,7 +710,6 @@ var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
|
702
710
|
EmailField,
|
703
711
|
FileUploadWithOptions,
|
704
712
|
DataField
|
705
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
706
713
|
]);
|
707
714
|
|
708
715
|
// ../commons/src/events/PageConfig.ts
|
@@ -827,6 +834,8 @@ var ActionFormConfig = import_zod8.z.object({
|
|
827
834
|
var FormConfig = import_zod8.z.union([DeclarationFormConfig, ActionFormConfig]);
|
828
835
|
|
829
836
|
// ../commons/src/events/ActionConfig.ts
|
837
|
+
var import_zod_openapi = require("zod-openapi");
|
838
|
+
(0, import_zod_openapi.extendZodWithOpenApi)(import_zod9.z);
|
830
839
|
var ActionConditional2 = import_zod9.z.discriminatedUnion("type", [
|
831
840
|
/** If conditional is defined, the action is shown to the user only if the condition is met */
|
832
841
|
ShowConditional,
|
@@ -904,18 +913,24 @@ var ApproveCorrectionConfig = ActionConfigBase.merge(
|
|
904
913
|
})
|
905
914
|
);
|
906
915
|
var ActionConfig = import_zod9.z.discriminatedUnion("type", [
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
916
|
+
/*
|
917
|
+
* OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
|
918
|
+
* and treat them as "models" instead of duplicating the data structure in each endpoint.
|
919
|
+
*/
|
920
|
+
DeclareConfig.openapi({ ref: "DeclareActionConfig" }),
|
921
|
+
ValidateConfig.openapi({ ref: "ValidateActionConfig" }),
|
922
|
+
RejectDeclarationConfig.openapi({ ref: "RejectDeclarationActionConfig" }),
|
923
|
+
MarkedAsDuplicateConfig.openapi({ ref: "MarkedAsDuplicateActionConfig" }),
|
924
|
+
ArchiveConfig.openapi({ ref: "ArchiveActionConfig" }),
|
925
|
+
RegisterConfig.openapi({ ref: "RegisterActionConfig" }),
|
926
|
+
DeleteConfig.openapi({ ref: "DeleteActionConfig" }),
|
927
|
+
PrintCertificateActionConfig.openapi({
|
928
|
+
ref: "PrintCertificateActionConfig"
|
929
|
+
}),
|
930
|
+
RequestCorrectionConfig.openapi({ ref: "RequestCorrectionActionConfig" }),
|
931
|
+
RejectCorrectionConfig.openapi({ ref: "RejectCorrectionActionConfig" }),
|
932
|
+
ApproveCorrectionConfig.openapi({ ref: "ApproveCorrectionActionConfig" })
|
933
|
+
]).openapi({ ref: "ActionConfig" });
|
919
934
|
var DeclarationActionConfig = import_zod9.z.discriminatedUnion("type", [
|
920
935
|
DeclareConfig,
|
921
936
|
ValidateConfig,
|
@@ -959,10 +974,12 @@ var LanguageConfig = import_zod11.z.object({
|
|
959
974
|
});
|
960
975
|
|
961
976
|
// ../commons/src/events/EventConfig.ts
|
962
|
-
var
|
977
|
+
var import_zod16 = require("zod");
|
963
978
|
|
964
979
|
// ../commons/src/events/DeduplicationConfig.ts
|
965
980
|
var import_zod12 = require("zod");
|
981
|
+
var import_zod_openapi2 = require("zod-openapi");
|
982
|
+
(0, import_zod_openapi2.extendZodWithOpenApi)(import_zod12.z);
|
966
983
|
var FieldReference = import_zod12.z.string();
|
967
984
|
var Matcher = import_zod12.z.object({
|
968
985
|
fieldId: import_zod12.z.string(),
|
@@ -1023,7 +1040,9 @@ var Clause = import_zod12.z.lazy(
|
|
1023
1040
|
DateRangeMatcher,
|
1024
1041
|
DateDistanceMatcher
|
1025
1042
|
])
|
1026
|
-
)
|
1043
|
+
).openapi({
|
1044
|
+
ref: "Clause"
|
1045
|
+
});
|
1027
1046
|
var DeduplicationConfig = import_zod12.z.object({
|
1028
1047
|
id: import_zod12.z.string(),
|
1029
1048
|
label: TranslationConfig,
|
@@ -1047,270 +1066,47 @@ var Field = BaseField2.extend({
|
|
1047
1066
|
label: TranslationConfig,
|
1048
1067
|
emptyValueMessage: TranslationConfig.optional()
|
1049
1068
|
}).describe("Custom configured field");
|
1050
|
-
var Title = import_zod13.z.object({
|
1051
|
-
id: import_zod13.z.string(),
|
1052
|
-
label: TranslationConfig.describe("Title content"),
|
1053
|
-
emptyValueMessage: TranslationConfig.optional()
|
1054
|
-
});
|
1055
1069
|
var SummaryConfig = import_zod13.z.object({
|
1056
|
-
title: Title.describe("Title of summary view."),
|
1057
1070
|
fields: import_zod13.z.array(import_zod13.z.union([Field, ReferenceField])).describe("Fields rendered in summary view.")
|
1058
1071
|
}).describe("Configuration for summary in event.");
|
1059
1072
|
|
1060
|
-
// ../commons/src/events/
|
1061
|
-
var import_zod15 = require("zod");
|
1062
|
-
|
1063
|
-
// ../commons/src/events/EventMetadata.ts
|
1073
|
+
// ../commons/src/events/AdvancedSearchConfig.ts
|
1064
1074
|
var import_zod14 = require("zod");
|
1065
|
-
var
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
CERTIFIED: "CERTIFIED",
|
1072
|
-
REJECTED: "REJECTED",
|
1073
|
-
ARCHIVED: "ARCHIVED"
|
1074
|
-
};
|
1075
|
-
var eventStatuses = Object.values(EventStatus);
|
1076
|
-
var EventStatuses = import_zod14.z.nativeEnum(EventStatus);
|
1077
|
-
var EventMetadata = import_zod14.z.object({
|
1078
|
-
id: import_zod14.z.string(),
|
1079
|
-
type: import_zod14.z.string(),
|
1080
|
-
status: EventStatuses,
|
1081
|
-
createdAt: import_zod14.z.string().datetime(),
|
1082
|
-
createdBy: import_zod14.z.string(),
|
1083
|
-
createdAtLocation: import_zod14.z.string(),
|
1084
|
-
updatedAtLocation: import_zod14.z.string(),
|
1085
|
-
modifiedAt: import_zod14.z.string().datetime(),
|
1086
|
-
assignedTo: import_zod14.z.string().nullish(),
|
1087
|
-
updatedBy: import_zod14.z.string(),
|
1088
|
-
trackingId: import_zod14.z.string(),
|
1089
|
-
registrationNumber: import_zod14.z.string().nullish()
|
1075
|
+
var MatchType = import_zod14.z.enum(["FUZZY", "EXACT", "RANGE", "ANY_OF"]);
|
1076
|
+
var BaseField3 = import_zod14.z.object({
|
1077
|
+
config: import_zod14.z.object({
|
1078
|
+
type: MatchType.describe("Determines the type of field")
|
1079
|
+
}),
|
1080
|
+
options: import_zod14.z.array(SelectOption).optional()
|
1090
1081
|
});
|
1091
|
-
var
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
description: "Created At Location"
|
1106
|
-
},
|
1107
|
-
"event.updatedAtLocation": {
|
1108
|
-
id: "event.updatedAtLocation.label",
|
1109
|
-
defaultMessage: "Location",
|
1110
|
-
description: "Updated At Location"
|
1111
|
-
},
|
1112
|
-
"event.createdBy": {
|
1113
|
-
id: "event.createdBy.label",
|
1114
|
-
defaultMessage: "Created By",
|
1115
|
-
description: "Created By"
|
1116
|
-
},
|
1117
|
-
"event.id": {
|
1118
|
-
id: "event.id.label",
|
1119
|
-
defaultMessage: "ID",
|
1120
|
-
description: "ID"
|
1121
|
-
},
|
1122
|
-
"event.modifiedAt": {
|
1123
|
-
id: "event.modifiedAt.label",
|
1124
|
-
defaultMessage: "Updated",
|
1125
|
-
description: "Modified At"
|
1126
|
-
},
|
1127
|
-
"event.status": {
|
1128
|
-
id: "event.status.label",
|
1129
|
-
defaultMessage: "Status",
|
1130
|
-
description: "Status"
|
1131
|
-
},
|
1132
|
-
"event.type": {
|
1133
|
-
id: "event.type.label",
|
1134
|
-
defaultMessage: "Type",
|
1135
|
-
description: "Type"
|
1136
|
-
},
|
1137
|
-
"event.updatedBy": {
|
1138
|
-
id: "event.updatedBy.label",
|
1139
|
-
defaultMessage: "Updated By",
|
1140
|
-
description: "Updated By"
|
1141
|
-
},
|
1142
|
-
"event.trackingId": {
|
1143
|
-
id: "event.trackingId.label",
|
1144
|
-
defaultMessage: "Tracking ID",
|
1145
|
-
description: "Tracking ID"
|
1146
|
-
},
|
1147
|
-
"event.registrationNumber": {
|
1148
|
-
id: "event.registrationNumber.label",
|
1149
|
-
defaultMessage: "Registration Number",
|
1150
|
-
description: "Registration Number"
|
1151
|
-
}
|
1152
|
-
};
|
1153
|
-
|
1154
|
-
// ../commons/src/events/WorkqueueConfig.ts
|
1155
|
-
var WorkqueueConfig = import_zod15.z.object({
|
1156
|
-
id: import_zod15.z.string().describe("Unique identifier for workqueue."),
|
1157
|
-
filters: import_zod15.z.array(
|
1158
|
-
import_zod15.z.object({
|
1159
|
-
status: import_zod15.z.array(EventStatuses).describe("Defines which statusese are included in the workqueue.")
|
1160
|
-
})
|
1161
|
-
).describe("Filters to be applied to workqueue.")
|
1162
|
-
}).describe("Configuration for workqueue.");
|
1163
|
-
|
1164
|
-
// ../commons/src/events/AdvancedSearchConfig.ts
|
1165
|
-
var import_zod16 = require("zod");
|
1166
|
-
var AdvancedSearchConfig = import_zod16.z.object({
|
1082
|
+
var FieldConfigSchema = BaseField3.extend({
|
1083
|
+
fieldId: import_zod14.z.string(),
|
1084
|
+
fieldType: import_zod14.z.literal("field")
|
1085
|
+
});
|
1086
|
+
var EventFieldId = import_zod14.z.enum(["trackingId", "status"]);
|
1087
|
+
var EventFieldConfigSchema = BaseField3.extend({
|
1088
|
+
fieldId: EventFieldId,
|
1089
|
+
fieldType: import_zod14.z.literal("event")
|
1090
|
+
});
|
1091
|
+
var SearchField = import_zod14.z.discriminatedUnion("fieldType", [
|
1092
|
+
FieldConfigSchema,
|
1093
|
+
EventFieldConfigSchema
|
1094
|
+
]);
|
1095
|
+
var AdvancedSearchConfig = import_zod14.z.object({
|
1167
1096
|
title: TranslationConfig.describe("Advanced search tab title"),
|
1168
|
-
fields:
|
1169
|
-
import_zod16.z.object({
|
1170
|
-
fieldId: import_zod16.z.string(),
|
1171
|
-
config: import_zod16.z.object({
|
1172
|
-
type: import_zod16.z.enum(["FUZZY", "EXACT", "RANGE"]).describe("Determines the type of field")
|
1173
|
-
}).optional().describe("Configuration options for the field")
|
1174
|
-
})
|
1175
|
-
).optional().default([]).describe("Advanced search fields.")
|
1097
|
+
fields: import_zod14.z.array(SearchField).describe("Advanced search fields.")
|
1176
1098
|
});
|
1177
1099
|
|
1178
1100
|
// ../commons/src/events/utils.ts
|
1179
1101
|
var import_lodash = require("lodash");
|
1180
1102
|
|
1181
|
-
// ../commons/src/workqueues/WorkqueueConfig.ts
|
1182
|
-
var import_zod18 = require("zod");
|
1183
|
-
|
1184
|
-
// ../commons/src/workqueues/defaultColumns.ts
|
1185
|
-
var import_zod17 = require("zod");
|
1186
|
-
var WorkQueueColumnConfig = import_zod17.z.object({
|
1187
|
-
id: import_zod17.z.string(),
|
1188
|
-
label: TranslationConfig
|
1189
|
-
});
|
1190
|
-
var defaultColumns = {
|
1191
|
-
event: {
|
1192
|
-
id: "event",
|
1193
|
-
label: {
|
1194
|
-
defaultMessage: "Event",
|
1195
|
-
description: "This is the label for the workqueue column",
|
1196
|
-
id: "workqueue.default.column.event"
|
1197
|
-
}
|
1198
|
-
},
|
1199
|
-
status: {
|
1200
|
-
id: "status",
|
1201
|
-
label: {
|
1202
|
-
defaultMessage: "Status",
|
1203
|
-
description: "This is the label for the workqueue column",
|
1204
|
-
id: "workqueue.default.column.status"
|
1205
|
-
}
|
1206
|
-
},
|
1207
|
-
createdAt: {
|
1208
|
-
id: "createdAt",
|
1209
|
-
label: {
|
1210
|
-
defaultMessage: "Created",
|
1211
|
-
description: "This is the label for the workqueue column",
|
1212
|
-
id: "workqueue.default.column.createdAt"
|
1213
|
-
}
|
1214
|
-
},
|
1215
|
-
modifiedAt: {
|
1216
|
-
id: "modifiedAt",
|
1217
|
-
label: {
|
1218
|
-
defaultMessage: "Modified",
|
1219
|
-
description: "This is the label for the workqueue column",
|
1220
|
-
id: "workqueue.default.column.modifiedAt"
|
1221
|
-
}
|
1222
|
-
}
|
1223
|
-
};
|
1224
|
-
var DefaultColumnKeys = import_zod17.z.enum(
|
1225
|
-
Object.keys(defaultColumns)
|
1226
|
-
);
|
1227
|
-
|
1228
|
-
// ../commons/src/workqueues/WorkqueueConfig.ts
|
1229
|
-
var rootWorkqueueConfig = import_zod18.z.object({
|
1230
|
-
id: import_zod18.z.string(),
|
1231
|
-
title: TranslationConfig,
|
1232
|
-
columns: import_zod18.z.array(WorkQueueColumnConfig),
|
1233
|
-
defaultColumns: import_zod18.z.array(DefaultColumnKeys)
|
1234
|
-
});
|
1235
|
-
var defineWorkqueue = (config) => rootWorkqueueConfig.parse(config);
|
1236
|
-
|
1237
|
-
// ../commons/src/workqueues/all.ts
|
1238
|
-
var allWorkqueue = defineWorkqueue({
|
1239
|
-
id: "all",
|
1240
|
-
title: {
|
1241
|
-
defaultMessage: "All events",
|
1242
|
-
description: "This is the label for the workqueue",
|
1243
|
-
id: "workqueue.all.label"
|
1244
|
-
},
|
1245
|
-
columns: [
|
1246
|
-
{
|
1247
|
-
id: "title",
|
1248
|
-
label: {
|
1249
|
-
defaultMessage: "Title",
|
1250
|
-
description: "This is the label for the workqueue column",
|
1251
|
-
id: "workqueue.all.column.title"
|
1252
|
-
}
|
1253
|
-
}
|
1254
|
-
],
|
1255
|
-
defaultColumns: ["event", "status", "createdAt", "modifiedAt"]
|
1256
|
-
});
|
1257
|
-
|
1258
|
-
// ../commons/src/workqueues/readyForReview.ts
|
1259
|
-
var inReviewWorkqueue = defineWorkqueue({
|
1260
|
-
id: "ready-for-review",
|
1261
|
-
title: {
|
1262
|
-
defaultMessage: "Ready for review",
|
1263
|
-
description: "Label for in review workqueue",
|
1264
|
-
id: "event.workqueue.in-review.label"
|
1265
|
-
},
|
1266
|
-
columns: [
|
1267
|
-
{
|
1268
|
-
id: "title",
|
1269
|
-
label: {
|
1270
|
-
defaultMessage: "Title",
|
1271
|
-
description: "This is the label for the workqueue column",
|
1272
|
-
id: "workqueue.in-reveiw.column.title"
|
1273
|
-
}
|
1274
|
-
}
|
1275
|
-
],
|
1276
|
-
defaultColumns: ["event", "createdAt", "modifiedAt"]
|
1277
|
-
});
|
1278
|
-
|
1279
|
-
// ../commons/src/workqueues/readyToPrint.ts
|
1280
|
-
var registeredWorkqueue = defineWorkqueue({
|
1281
|
-
id: "registered",
|
1282
|
-
title: {
|
1283
|
-
defaultMessage: "Ready to print",
|
1284
|
-
description: "Label for registered workqueue",
|
1285
|
-
id: "event.workqueue.registered.label"
|
1286
|
-
},
|
1287
|
-
columns: [
|
1288
|
-
{
|
1289
|
-
id: "title",
|
1290
|
-
label: {
|
1291
|
-
defaultMessage: "Title",
|
1292
|
-
description: "This is the label for the workqueue column",
|
1293
|
-
id: "workqueue.registered.column.title"
|
1294
|
-
}
|
1295
|
-
}
|
1296
|
-
],
|
1297
|
-
defaultColumns: ["event", "createdAt", "modifiedAt"]
|
1298
|
-
});
|
1299
|
-
|
1300
|
-
// ../commons/src/workqueues/index.ts
|
1301
|
-
var workqueues = {
|
1302
|
-
all: allWorkqueue,
|
1303
|
-
registered: registeredWorkqueue,
|
1304
|
-
inReview: inReviewWorkqueue
|
1305
|
-
};
|
1306
|
-
|
1307
1103
|
// ../commons/src/conditionals/validate.ts
|
1308
1104
|
var import_ajv = __toESM(require("ajv"));
|
1309
1105
|
var import_ajv_formats = __toESM(require("ajv-formats"));
|
1310
1106
|
var import_date_fns = require("date-fns");
|
1311
1107
|
|
1312
1108
|
// ../commons/src/events/FieldTypeMapping.ts
|
1313
|
-
var
|
1109
|
+
var import_zod15 = require("zod");
|
1314
1110
|
function mapFieldTypeToZod(type, required) {
|
1315
1111
|
let schema;
|
1316
1112
|
switch (type) {
|
@@ -1334,8 +1130,7 @@ function mapFieldTypeToZod(type, required) {
|
|
1334
1130
|
case FieldType.FACILITY:
|
1335
1131
|
case FieldType.OFFICE:
|
1336
1132
|
case FieldType.SIGNATURE:
|
1337
|
-
|
1338
|
-
schema = required ? RequiredTextValue : TextValue;
|
1133
|
+
schema = required ? NonEmptyTextValue : TextValue;
|
1339
1134
|
break;
|
1340
1135
|
case FieldType.NUMBER:
|
1341
1136
|
schema = NumberFieldValue;
|
@@ -1363,7 +1158,7 @@ function createValidationSchema(config) {
|
|
1363
1158
|
for (const field2 of config) {
|
1364
1159
|
shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
|
1365
1160
|
}
|
1366
|
-
return
|
1161
|
+
return import_zod15.z.object(shape);
|
1367
1162
|
}
|
1368
1163
|
function mapFieldTypeToMockValue(field2, i) {
|
1369
1164
|
switch (field2.type) {
|
@@ -1572,6 +1367,10 @@ function isFieldConditionMet(field2, form, conditionalType) {
|
|
1572
1367
|
function isFieldVisible(field2, form) {
|
1573
1368
|
return isFieldConditionMet(field2, form, ConditionalType.SHOW);
|
1574
1369
|
}
|
1370
|
+
function isFieldEmptyAndNotRequired(field2, form) {
|
1371
|
+
const fieldValue = form[field2.id];
|
1372
|
+
return !field2.required && (fieldValue === void 0 || fieldValue === "");
|
1373
|
+
}
|
1575
1374
|
function isFieldEnabled(field2, form) {
|
1576
1375
|
return isFieldConditionMet(field2, form, ConditionalType.ENABLE);
|
1577
1376
|
}
|
@@ -1676,7 +1475,7 @@ function runFieldValidations({
|
|
1676
1475
|
field: field2,
|
1677
1476
|
values
|
1678
1477
|
}) {
|
1679
|
-
if (!isFieldVisible(field2, values)) {
|
1478
|
+
if (!isFieldVisible(field2, values) || isFieldEmptyAndNotRequired(field2, values)) {
|
1680
1479
|
return {
|
1681
1480
|
errors: []
|
1682
1481
|
};
|
@@ -1741,15 +1540,9 @@ var getActionAnnotationFields = (actionConfig) => {
|
|
1741
1540
|
}
|
1742
1541
|
return [];
|
1743
1542
|
};
|
1744
|
-
|
1543
|
+
function getAllAnnotationFields(config) {
|
1745
1544
|
return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
|
1746
|
-
}
|
1747
|
-
var findAllFields = (config) => {
|
1748
|
-
return (0, import_lodash.flattenDeep)([
|
1749
|
-
...getDeclarationFields(config),
|
1750
|
-
...getAllAnnotationFields(config)
|
1751
|
-
]);
|
1752
|
-
};
|
1545
|
+
}
|
1753
1546
|
var findRecordActionPages = (config, actionType) => {
|
1754
1547
|
const action = config.actions.find((a) => a.type === actionType);
|
1755
1548
|
if (action?.type === ActionType.REQUEST_CORRECTION) {
|
@@ -1772,31 +1565,22 @@ function getActionReview(configuration, actionType) {
|
|
1772
1565
|
function getActionReviewFields(configuration, actionType) {
|
1773
1566
|
return getActionReview(configuration, actionType).fields;
|
1774
1567
|
}
|
1775
|
-
function validateWorkqueueConfig(workqueueConfigs) {
|
1776
|
-
workqueueConfigs.map((workqueue) => {
|
1777
|
-
const rootWorkqueue = Object.values(workqueues).find(
|
1778
|
-
(wq) => wq.id === workqueue.id
|
1779
|
-
);
|
1780
|
-
if (!rootWorkqueue) {
|
1781
|
-
throw new Error(
|
1782
|
-
`Invalid workqueue configuration: workqueue not found with id: ${workqueue.id}`
|
1783
|
-
);
|
1784
|
-
}
|
1785
|
-
});
|
1786
|
-
}
|
1787
1568
|
function isPageVisible(page, formValues) {
|
1788
1569
|
if (!page.conditional) {
|
1789
1570
|
return true;
|
1790
1571
|
}
|
1791
1572
|
return isConditionMet(page.conditional, formValues);
|
1792
1573
|
}
|
1793
|
-
function omitHiddenFields(fields, values) {
|
1574
|
+
function omitHiddenFields(fields, values, visibleVerificationPageIds = []) {
|
1794
1575
|
return (0, import_lodash.omitBy)(values, (_, fieldId) => {
|
1795
|
-
|
1796
|
-
|
1576
|
+
if (visibleVerificationPageIds.includes(fieldId)) {
|
1577
|
+
return false;
|
1578
|
+
}
|
1579
|
+
const fieldConfigs = fields.filter((f) => f.id === fieldId);
|
1580
|
+
if (!fieldConfigs.length) {
|
1797
1581
|
return true;
|
1798
1582
|
}
|
1799
|
-
return !isFieldVisible(
|
1583
|
+
return fieldConfigs.every((f) => !isFieldVisible(f, values));
|
1800
1584
|
});
|
1801
1585
|
}
|
1802
1586
|
function omitHiddenPaginatedFields(formConfig, declaration) {
|
@@ -1827,6 +1611,39 @@ function createEmptyDraft(eventId, draftId, actionType) {
|
|
1827
1611
|
function isVerificationPage(page) {
|
1828
1612
|
return page.type === PageTypes.enum.VERIFICATION;
|
1829
1613
|
}
|
1614
|
+
function getVisibleVerificationPageIds(pages, annotation) {
|
1615
|
+
return pages.filter((page) => isVerificationPage(page)).filter((page) => isPageVisible(page, annotation)).map((page) => page.id);
|
1616
|
+
}
|
1617
|
+
function getActionVerificationPageIds(actionConfig, annotation) {
|
1618
|
+
if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
|
1619
|
+
return [
|
1620
|
+
...getVisibleVerificationPageIds(actionConfig.onboardingForm, annotation),
|
1621
|
+
...getVisibleVerificationPageIds(
|
1622
|
+
actionConfig.additionalDetailsForm,
|
1623
|
+
annotation
|
1624
|
+
)
|
1625
|
+
];
|
1626
|
+
}
|
1627
|
+
if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
|
1628
|
+
return getVisibleVerificationPageIds(
|
1629
|
+
actionConfig.printForm.pages,
|
1630
|
+
annotation
|
1631
|
+
);
|
1632
|
+
}
|
1633
|
+
return [];
|
1634
|
+
}
|
1635
|
+
function omitHiddenAnnotationFields(actionConfig, declaration, annotation) {
|
1636
|
+
const annotationFields = getActionAnnotationFields(actionConfig);
|
1637
|
+
const visibleVerificationPageIds = getActionVerificationPageIds(
|
1638
|
+
actionConfig,
|
1639
|
+
annotation
|
1640
|
+
);
|
1641
|
+
return omitHiddenFields(
|
1642
|
+
annotationFields,
|
1643
|
+
{ ...declaration, ...annotation },
|
1644
|
+
visibleVerificationPageIds
|
1645
|
+
);
|
1646
|
+
}
|
1830
1647
|
function deepMerge(currentDocument, actionDocument) {
|
1831
1648
|
return (0, import_lodash.mergeWith)(
|
1832
1649
|
currentDocument,
|
@@ -1853,19 +1670,31 @@ function findLastAssignmentAction(actions) {
|
|
1853
1670
|
function isWriteAction(actionType) {
|
1854
1671
|
return writeActions.safeParse(actionType).success;
|
1855
1672
|
}
|
1673
|
+
var findAllFields = (config) => {
|
1674
|
+
return (0, import_lodash.flattenDeep)([
|
1675
|
+
...getDeclarationFields(config),
|
1676
|
+
...getAllAnnotationFields(config)
|
1677
|
+
]);
|
1678
|
+
};
|
1856
1679
|
|
1857
1680
|
// ../commons/src/events/EventConfig.ts
|
1858
|
-
var
|
1859
|
-
|
1681
|
+
var import_zod_openapi3 = require("zod-openapi");
|
1682
|
+
(0, import_zod_openapi3.extendZodWithOpenApi)(import_zod16.z);
|
1683
|
+
var EventConfig = import_zod16.z.object({
|
1684
|
+
id: import_zod16.z.string().describe(
|
1860
1685
|
'A machine-readable identifier for the event, e.g. "birth" or "death"'
|
1861
1686
|
),
|
1687
|
+
dateOfEvent: import_zod16.z.object({ fieldId: import_zod16.z.string() }).optional(),
|
1688
|
+
title: TranslationConfig,
|
1689
|
+
fallbackTitle: TranslationConfig.optional().describe(
|
1690
|
+
"This is a fallback title if actual title resolves to empty string"
|
1691
|
+
),
|
1862
1692
|
summary: SummaryConfig,
|
1863
1693
|
label: TranslationConfig,
|
1864
|
-
actions:
|
1694
|
+
actions: import_zod16.z.array(ActionConfig),
|
1865
1695
|
declaration: DeclarationFormConfig,
|
1866
|
-
|
1867
|
-
|
1868
|
-
advancedSearch: import_zod20.z.array(AdvancedSearchConfig).optional().default([])
|
1696
|
+
deduplication: import_zod16.z.array(DeduplicationConfig).optional().default([]),
|
1697
|
+
advancedSearch: import_zod16.z.array(AdvancedSearchConfig).optional().default([])
|
1869
1698
|
}).superRefine((event2, ctx) => {
|
1870
1699
|
const allFields = findAllFields(event2);
|
1871
1700
|
const fieldIds = allFields.map((field2) => field2.id);
|
@@ -1881,16 +1710,43 @@ var EventConfig = import_zod20.z.object({
|
|
1881
1710
|
});
|
1882
1711
|
}
|
1883
1712
|
const invalidFields = event2.advancedSearch.flatMap(
|
1884
|
-
(section) =>
|
1713
|
+
(section) => (
|
1714
|
+
// Check if the fieldId is not in the fieldIds array
|
1715
|
+
// and also not in the metadataFields array
|
1716
|
+
section.fields.filter(
|
1717
|
+
(field2) => !(fieldIds.includes(field2.fieldId) || EventFieldId.options.includes(field2.fieldId))
|
1718
|
+
)
|
1719
|
+
)
|
1885
1720
|
);
|
1886
1721
|
if (invalidFields.length > 0) {
|
1887
1722
|
ctx.addIssue({
|
1888
1723
|
code: "custom",
|
1889
|
-
message: `Advanced search id must match a field id
|
1724
|
+
message: `Advanced search id must match a field id of form fields or pre-defined metadata fields.
|
1890
1725
|
Invalid AdvancedSearch field IDs for event ${event2.id}: ${invalidFields.map((f) => f.fieldId).join(", ")}`,
|
1891
1726
|
path: ["advancedSearch"]
|
1892
1727
|
});
|
1893
1728
|
}
|
1729
|
+
if (event2.dateOfEvent) {
|
1730
|
+
const eventDateFieldId = getDeclarationFields(event2).find(
|
1731
|
+
({ id }) => id === event2.dateOfEvent?.fieldId
|
1732
|
+
);
|
1733
|
+
if (!eventDateFieldId) {
|
1734
|
+
ctx.addIssue({
|
1735
|
+
code: "custom",
|
1736
|
+
message: `Date of event field id must match a field id in fields array.
|
1737
|
+
Invalid date of event field ID for event ${event2.id}: ${event2.dateOfEvent.fieldId}`,
|
1738
|
+
path: ["dateOfEvent"]
|
1739
|
+
});
|
1740
|
+
} else if (eventDateFieldId.type !== FieldType.DATE) {
|
1741
|
+
ctx.addIssue({
|
1742
|
+
code: "custom",
|
1743
|
+
message: `Field specified for date of event is of type: ${eventDateFieldId.type}, but it needs to be of type: ${FieldType.DATE}`,
|
1744
|
+
path: ["dateOfEvent.fieldType"]
|
1745
|
+
});
|
1746
|
+
}
|
1747
|
+
}
|
1748
|
+
}).openapi({
|
1749
|
+
ref: "EventConfig"
|
1894
1750
|
});
|
1895
1751
|
|
1896
1752
|
// ../commons/src/events/EventConfigInput.ts
|
@@ -1899,269 +1755,313 @@ var defineActionForm = (actionForm) => ActionFormConfig.parse(actionForm);
|
|
1899
1755
|
var definePage = (page) => PageConfig.parse(page);
|
1900
1756
|
var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
|
1901
1757
|
|
1758
|
+
// ../commons/src/events/WorkqueueConfig.ts
|
1759
|
+
var import_zod17 = require("zod");
|
1760
|
+
var WorkqueueConfig = import_zod17.z.object({
|
1761
|
+
slug: import_zod17.z.string().describe("Determines the url of the workqueue."),
|
1762
|
+
name: TranslationConfig.describe(
|
1763
|
+
"Title of the workflow (both in navigation and on the page)"
|
1764
|
+
),
|
1765
|
+
/**
|
1766
|
+
* Placeholder untill the following gets merged to develop
|
1767
|
+
* https://github.com/opencrvs/opencrvs-core/blob/5fbe9854a88504a7a13fcc856b3e82594b70c38c/packages/commons/src/events/EventIndex.ts#L92-L93
|
1768
|
+
*/
|
1769
|
+
query: import_zod17.z.string(),
|
1770
|
+
actions: import_zod17.z.array(
|
1771
|
+
import_zod17.z.object({
|
1772
|
+
type: import_zod17.z.string(),
|
1773
|
+
conditionals: import_zod17.z.array(Conditional).optional()
|
1774
|
+
})
|
1775
|
+
)
|
1776
|
+
}).describe("Configuration for workqueue.");
|
1777
|
+
function defineWorkqueue(workqueues) {
|
1778
|
+
return workqueues.map((workqueue) => WorkqueueConfig.parse(workqueue));
|
1779
|
+
}
|
1780
|
+
|
1902
1781
|
// ../commons/src/events/Draft.ts
|
1903
|
-
var
|
1782
|
+
var import_zod20 = require("zod");
|
1904
1783
|
|
1905
1784
|
// ../commons/src/events/ActionDocument.ts
|
1906
|
-
var
|
1907
|
-
var
|
1785
|
+
var import_zod18 = require("zod");
|
1786
|
+
var import_zod_openapi4 = require("zod-openapi");
|
1787
|
+
(0, import_zod_openapi4.extendZodWithOpenApi)(import_zod18.z);
|
1788
|
+
var ActionUpdate = import_zod18.z.record(import_zod18.z.string(), FieldUpdateValue);
|
1908
1789
|
var ActionStatus = {
|
1909
1790
|
Requested: "Requested",
|
1910
1791
|
Accepted: "Accepted",
|
1911
1792
|
Rejected: "Rejected"
|
1912
1793
|
};
|
1913
|
-
var ActionBase =
|
1914
|
-
id:
|
1915
|
-
|
1916
|
-
|
1794
|
+
var ActionBase = import_zod18.z.object({
|
1795
|
+
id: import_zod18.z.string(),
|
1796
|
+
transactionId: import_zod18.z.string(),
|
1797
|
+
createdAt: import_zod18.z.string().datetime(),
|
1798
|
+
createdBy: import_zod18.z.string(),
|
1799
|
+
createdByRole: import_zod18.z.string(),
|
1917
1800
|
declaration: ActionUpdate,
|
1918
1801
|
annotation: ActionUpdate.optional(),
|
1919
|
-
createdAtLocation:
|
1920
|
-
|
1802
|
+
createdAtLocation: import_zod18.z.string().optional(),
|
1803
|
+
updatedAtLocation: import_zod18.z.string().optional(),
|
1804
|
+
status: import_zod18.z.enum([
|
1921
1805
|
ActionStatus.Requested,
|
1922
1806
|
ActionStatus.Accepted,
|
1923
1807
|
ActionStatus.Rejected
|
1924
1808
|
]),
|
1925
1809
|
// If the action is an asynchronous confirmation for another action, we will save the original action id here.
|
1926
|
-
originalActionId:
|
1810
|
+
originalActionId: import_zod18.z.string().optional()
|
1927
1811
|
});
|
1928
1812
|
var AssignedAction = ActionBase.merge(
|
1929
|
-
|
1930
|
-
type:
|
1931
|
-
assignedTo:
|
1813
|
+
import_zod18.z.object({
|
1814
|
+
type: import_zod18.z.literal(ActionType.ASSIGN),
|
1815
|
+
assignedTo: import_zod18.z.string()
|
1932
1816
|
})
|
1933
1817
|
);
|
1934
1818
|
var UnassignedAction = ActionBase.merge(
|
1935
|
-
|
1936
|
-
type:
|
1937
|
-
assignedTo:
|
1819
|
+
import_zod18.z.object({
|
1820
|
+
type: import_zod18.z.literal(ActionType.UNASSIGN),
|
1821
|
+
assignedTo: import_zod18.z.literal(null)
|
1938
1822
|
})
|
1939
1823
|
);
|
1940
1824
|
var RegisterAction = ActionBase.merge(
|
1941
|
-
|
1942
|
-
type:
|
1943
|
-
registrationNumber:
|
1825
|
+
import_zod18.z.object({
|
1826
|
+
type: import_zod18.z.literal(ActionType.REGISTER),
|
1827
|
+
registrationNumber: import_zod18.z.string().optional()
|
1944
1828
|
})
|
1945
1829
|
);
|
1946
1830
|
var DeclareAction = ActionBase.merge(
|
1947
|
-
|
1948
|
-
type:
|
1831
|
+
import_zod18.z.object({
|
1832
|
+
type: import_zod18.z.literal(ActionType.DECLARE)
|
1949
1833
|
})
|
1950
1834
|
);
|
1951
1835
|
var ValidateAction = ActionBase.merge(
|
1952
|
-
|
1953
|
-
type:
|
1836
|
+
import_zod18.z.object({
|
1837
|
+
type: import_zod18.z.literal(ActionType.VALIDATE)
|
1954
1838
|
})
|
1955
1839
|
);
|
1956
1840
|
var RejectAction = ActionBase.merge(
|
1957
|
-
|
1958
|
-
type:
|
1841
|
+
import_zod18.z.object({
|
1842
|
+
type: import_zod18.z.literal(ActionType.REJECT)
|
1959
1843
|
})
|
1960
1844
|
);
|
1961
1845
|
var MarkAsDuplicateAction = ActionBase.merge(
|
1962
|
-
|
1963
|
-
type:
|
1846
|
+
import_zod18.z.object({
|
1847
|
+
type: import_zod18.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1964
1848
|
})
|
1965
1849
|
);
|
1966
1850
|
var ArchiveAction = ActionBase.merge(
|
1967
|
-
|
1968
|
-
type:
|
1851
|
+
import_zod18.z.object({
|
1852
|
+
type: import_zod18.z.literal(ActionType.ARCHIVE)
|
1969
1853
|
})
|
1970
1854
|
);
|
1971
1855
|
var CreatedAction = ActionBase.merge(
|
1972
|
-
|
1973
|
-
type:
|
1856
|
+
import_zod18.z.object({
|
1857
|
+
type: import_zod18.z.literal(ActionType.CREATE)
|
1974
1858
|
})
|
1975
1859
|
);
|
1976
1860
|
var NotifiedAction = ActionBase.merge(
|
1977
|
-
|
1978
|
-
type:
|
1861
|
+
import_zod18.z.object({
|
1862
|
+
type: import_zod18.z.literal(ActionType.NOTIFY)
|
1979
1863
|
})
|
1980
1864
|
);
|
1981
1865
|
var PrintCertificateAction = ActionBase.merge(
|
1982
|
-
|
1983
|
-
type:
|
1866
|
+
import_zod18.z.object({
|
1867
|
+
type: import_zod18.z.literal(ActionType.PRINT_CERTIFICATE)
|
1984
1868
|
})
|
1985
1869
|
);
|
1986
1870
|
var RequestedCorrectionAction = ActionBase.merge(
|
1987
|
-
|
1988
|
-
type:
|
1871
|
+
import_zod18.z.object({
|
1872
|
+
type: import_zod18.z.literal(ActionType.REQUEST_CORRECTION)
|
1989
1873
|
})
|
1990
1874
|
);
|
1991
1875
|
var ApprovedCorrectionAction = ActionBase.merge(
|
1992
|
-
|
1993
|
-
type:
|
1994
|
-
requestId:
|
1876
|
+
import_zod18.z.object({
|
1877
|
+
type: import_zod18.z.literal(ActionType.APPROVE_CORRECTION),
|
1878
|
+
requestId: import_zod18.z.string()
|
1995
1879
|
})
|
1996
1880
|
);
|
1997
1881
|
var RejectedCorrectionAction = ActionBase.merge(
|
1998
|
-
|
1999
|
-
type:
|
2000
|
-
requestId:
|
1882
|
+
import_zod18.z.object({
|
1883
|
+
type: import_zod18.z.literal(ActionType.REJECT_CORRECTION),
|
1884
|
+
requestId: import_zod18.z.string()
|
2001
1885
|
})
|
2002
1886
|
);
|
2003
1887
|
var ReadAction = ActionBase.merge(
|
2004
|
-
|
2005
|
-
type:
|
1888
|
+
import_zod18.z.object({
|
1889
|
+
type: import_zod18.z.literal(ActionType.READ)
|
2006
1890
|
})
|
2007
1891
|
);
|
2008
|
-
var ActionDocument =
|
2009
|
-
CreatedAction,
|
2010
|
-
ValidateAction,
|
2011
|
-
RejectAction,
|
2012
|
-
MarkAsDuplicateAction,
|
2013
|
-
ArchiveAction,
|
2014
|
-
NotifiedAction,
|
2015
|
-
RegisterAction,
|
2016
|
-
DeclareAction,
|
2017
|
-
AssignedAction,
|
2018
|
-
RequestedCorrectionAction,
|
2019
|
-
ApprovedCorrectionAction,
|
2020
|
-
RejectedCorrectionAction,
|
2021
|
-
UnassignedAction,
|
2022
|
-
PrintCertificateAction,
|
2023
|
-
ReadAction
|
2024
|
-
])
|
1892
|
+
var ActionDocument = import_zod18.z.discriminatedUnion("type", [
|
1893
|
+
CreatedAction.openapi({ ref: "CreatedAction" }),
|
1894
|
+
ValidateAction.openapi({ ref: "ValidateAction" }),
|
1895
|
+
RejectAction.openapi({ ref: "RejectAction" }),
|
1896
|
+
MarkAsDuplicateAction.openapi({ ref: "MarkAsDuplicateAction" }),
|
1897
|
+
ArchiveAction.openapi({ ref: "ArchiveAction" }),
|
1898
|
+
NotifiedAction.openapi({ ref: "NotifiedAction" }),
|
1899
|
+
RegisterAction.openapi({ ref: "RegisterAction" }),
|
1900
|
+
DeclareAction.openapi({ ref: "DeclareAction" }),
|
1901
|
+
AssignedAction.openapi({ ref: "AssignedAction" }),
|
1902
|
+
RequestedCorrectionAction.openapi({ ref: "RequestedCorrectionAction" }),
|
1903
|
+
ApprovedCorrectionAction.openapi({ ref: "ApprovedCorrectionAction" }),
|
1904
|
+
RejectedCorrectionAction.openapi({ ref: "RejectedCorrectionAction" }),
|
1905
|
+
UnassignedAction.openapi({ ref: "UnassignedAction" }),
|
1906
|
+
PrintCertificateAction.openapi({ ref: "PrintCertificateAction" }),
|
1907
|
+
ReadAction.openapi({ ref: "ReadAction" })
|
1908
|
+
]).openapi({
|
1909
|
+
ref: "ActionDocument"
|
1910
|
+
});
|
2025
1911
|
var AsyncRejectActionDocument = ActionBase.omit({
|
2026
1912
|
declaration: true,
|
2027
1913
|
annotation: true,
|
2028
1914
|
createdBy: true,
|
1915
|
+
createdByRole: true,
|
2029
1916
|
createdAtLocation: true
|
2030
1917
|
}).merge(
|
2031
|
-
|
2032
|
-
type:
|
2033
|
-
status:
|
1918
|
+
import_zod18.z.object({
|
1919
|
+
type: import_zod18.z.enum(ConfirmableActions),
|
1920
|
+
status: import_zod18.z.literal(ActionStatus.Rejected)
|
2034
1921
|
})
|
2035
1922
|
);
|
2036
|
-
var Action =
|
2037
|
-
var ResolvedUser =
|
2038
|
-
id:
|
2039
|
-
role:
|
2040
|
-
name:
|
2041
|
-
|
2042
|
-
use:
|
2043
|
-
given:
|
2044
|
-
family:
|
1923
|
+
var Action = import_zod18.z.union([ActionDocument, AsyncRejectActionDocument]);
|
1924
|
+
var ResolvedUser = import_zod18.z.object({
|
1925
|
+
id: import_zod18.z.string(),
|
1926
|
+
role: import_zod18.z.string(),
|
1927
|
+
name: import_zod18.z.array(
|
1928
|
+
import_zod18.z.object({
|
1929
|
+
use: import_zod18.z.string(),
|
1930
|
+
given: import_zod18.z.array(import_zod18.z.string()),
|
1931
|
+
family: import_zod18.z.string()
|
2045
1932
|
})
|
2046
1933
|
)
|
2047
1934
|
});
|
2048
1935
|
|
2049
1936
|
// ../commons/src/events/ActionInput.ts
|
2050
|
-
var
|
2051
|
-
var
|
2052
|
-
|
2053
|
-
|
1937
|
+
var import_zod19 = require("zod");
|
1938
|
+
var import_zod_openapi5 = require("zod-openapi");
|
1939
|
+
(0, import_zod_openapi5.extendZodWithOpenApi)(import_zod19.z);
|
1940
|
+
var BaseActionInput = import_zod19.z.object({
|
1941
|
+
eventId: import_zod19.z.string(),
|
1942
|
+
transactionId: import_zod19.z.string(),
|
2054
1943
|
declaration: ActionUpdate.default({}),
|
2055
1944
|
annotation: ActionUpdate.optional(),
|
2056
|
-
originalActionId:
|
2057
|
-
keepAssignment:
|
1945
|
+
originalActionId: import_zod19.z.string().optional(),
|
1946
|
+
keepAssignment: import_zod19.z.boolean().optional()
|
2058
1947
|
});
|
2059
1948
|
var CreateActionInput = BaseActionInput.merge(
|
2060
|
-
|
2061
|
-
type:
|
2062
|
-
createdAtLocation:
|
1949
|
+
import_zod19.z.object({
|
1950
|
+
type: import_zod19.z.literal(ActionType.CREATE).default(ActionType.CREATE),
|
1951
|
+
createdAtLocation: import_zod19.z.string()
|
2063
1952
|
})
|
2064
1953
|
);
|
2065
1954
|
var RegisterActionInput = BaseActionInput.merge(
|
2066
|
-
|
2067
|
-
type:
|
2068
|
-
registrationNumber:
|
1955
|
+
import_zod19.z.object({
|
1956
|
+
type: import_zod19.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
1957
|
+
registrationNumber: import_zod19.z.string().optional()
|
2069
1958
|
})
|
2070
1959
|
);
|
2071
1960
|
var ValidateActionInput = BaseActionInput.merge(
|
2072
|
-
|
2073
|
-
type:
|
2074
|
-
duplicates:
|
1961
|
+
import_zod19.z.object({
|
1962
|
+
type: import_zod19.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
|
1963
|
+
duplicates: import_zod19.z.array(import_zod19.z.string())
|
2075
1964
|
})
|
2076
1965
|
);
|
2077
1966
|
var NotifyActionInput = BaseActionInput.merge(
|
2078
|
-
|
2079
|
-
type:
|
1967
|
+
import_zod19.z.object({
|
1968
|
+
type: import_zod19.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
|
2080
1969
|
})
|
2081
1970
|
);
|
2082
1971
|
var DeclareActionInput = BaseActionInput.merge(
|
2083
|
-
|
2084
|
-
type:
|
1972
|
+
import_zod19.z.object({
|
1973
|
+
type: import_zod19.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
2085
1974
|
})
|
2086
1975
|
);
|
2087
1976
|
var PrintCertificateActionInput = BaseActionInput.merge(
|
2088
|
-
|
2089
|
-
type:
|
1977
|
+
import_zod19.z.object({
|
1978
|
+
type: import_zod19.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
|
2090
1979
|
})
|
2091
1980
|
);
|
2092
1981
|
var RejectDeclarationActionInput = BaseActionInput.merge(
|
2093
|
-
|
2094
|
-
type:
|
1982
|
+
import_zod19.z.object({
|
1983
|
+
type: import_zod19.z.literal(ActionType.REJECT).default(ActionType.REJECT)
|
2095
1984
|
})
|
2096
1985
|
);
|
2097
1986
|
var MarkedAsDuplicateActionInput = BaseActionInput.merge(
|
2098
|
-
|
2099
|
-
type:
|
1987
|
+
import_zod19.z.object({
|
1988
|
+
type: import_zod19.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
|
2100
1989
|
})
|
2101
1990
|
);
|
2102
1991
|
var ArchiveActionInput = BaseActionInput.merge(
|
2103
|
-
|
2104
|
-
type:
|
1992
|
+
import_zod19.z.object({
|
1993
|
+
type: import_zod19.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE)
|
2105
1994
|
})
|
2106
1995
|
);
|
2107
1996
|
var AssignActionInput = BaseActionInput.merge(
|
2108
|
-
|
2109
|
-
type:
|
2110
|
-
assignedTo:
|
1997
|
+
import_zod19.z.object({
|
1998
|
+
type: import_zod19.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
|
1999
|
+
assignedTo: import_zod19.z.string()
|
2111
2000
|
})
|
2112
2001
|
);
|
2113
2002
|
var UnassignActionInput = BaseActionInput.merge(
|
2114
|
-
|
2115
|
-
type:
|
2116
|
-
assignedTo:
|
2003
|
+
import_zod19.z.object({
|
2004
|
+
type: import_zod19.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
|
2005
|
+
assignedTo: import_zod19.z.literal(null).default(null)
|
2117
2006
|
})
|
2118
2007
|
);
|
2119
2008
|
var RequestCorrectionActionInput = BaseActionInput.merge(
|
2120
|
-
|
2121
|
-
type:
|
2009
|
+
import_zod19.z.object({
|
2010
|
+
type: import_zod19.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
2122
2011
|
})
|
2123
2012
|
);
|
2124
2013
|
var RejectCorrectionActionInput = BaseActionInput.merge(
|
2125
|
-
|
2126
|
-
requestId:
|
2127
|
-
type:
|
2014
|
+
import_zod19.z.object({
|
2015
|
+
requestId: import_zod19.z.string(),
|
2016
|
+
type: import_zod19.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
|
2128
2017
|
})
|
2129
2018
|
);
|
2130
2019
|
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
2131
|
-
|
2132
|
-
requestId:
|
2133
|
-
type:
|
2020
|
+
import_zod19.z.object({
|
2021
|
+
requestId: import_zod19.z.string(),
|
2022
|
+
type: import_zod19.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
2134
2023
|
})
|
2135
2024
|
);
|
2136
2025
|
var ReadActionInput = BaseActionInput.merge(
|
2137
|
-
|
2138
|
-
type:
|
2026
|
+
import_zod19.z.object({
|
2027
|
+
type: import_zod19.z.literal(ActionType.READ).default(ActionType.READ)
|
2139
2028
|
})
|
2140
2029
|
);
|
2141
|
-
var
|
2142
|
-
|
2143
|
-
|
2144
|
-
|
2145
|
-
|
2146
|
-
|
2147
|
-
|
2148
|
-
|
2149
|
-
|
2150
|
-
|
2151
|
-
|
2152
|
-
|
2153
|
-
|
2154
|
-
|
2155
|
-
|
2156
|
-
|
2157
|
-
|
2030
|
+
var DeleteActionInput = import_zod19.z.object({ eventId: import_zod19.z.string() });
|
2031
|
+
var ActionInput = import_zod19.z.discriminatedUnion("type", [
|
2032
|
+
CreateActionInput.openapi({ ref: "CreateActionInput" }),
|
2033
|
+
ValidateActionInput.openapi({ ref: "ValidateActionInput" }),
|
2034
|
+
RegisterActionInput.openapi({ ref: "RegisterActionInput" }),
|
2035
|
+
NotifyActionInput.openapi({ ref: "NotifyActionInput" }),
|
2036
|
+
DeclareActionInput.openapi({ ref: "DeclareActionInput" }),
|
2037
|
+
RejectDeclarationActionInput.openapi({
|
2038
|
+
ref: "RejectDeclarationActionInput"
|
2039
|
+
}),
|
2040
|
+
MarkedAsDuplicateActionInput.openapi({
|
2041
|
+
ref: "MarkedAsDuplicateActionInput"
|
2042
|
+
}),
|
2043
|
+
ArchiveActionInput.openapi({ ref: "ArchiveActionInput" }),
|
2044
|
+
AssignActionInput.openapi({ ref: "AssignActionInput" }),
|
2045
|
+
UnassignActionInput.openapi({ ref: "UnassignActionInput" }),
|
2046
|
+
PrintCertificateActionInput.openapi({ ref: "PrintCertificateActionInput" }),
|
2047
|
+
RequestCorrectionActionInput.openapi({
|
2048
|
+
ref: "RequestCorrectionActionInput"
|
2049
|
+
}),
|
2050
|
+
RejectCorrectionActionInput.openapi({ ref: "RejectCorrectionActionInput" }),
|
2051
|
+
ApproveCorrectionActionInput.openapi({
|
2052
|
+
ref: "ApproveCorrectionActionInput"
|
2053
|
+
}),
|
2054
|
+
ReadActionInput.openapi({ ref: "ReadActionInput" })
|
2055
|
+
]).openapi({
|
2056
|
+
ref: "ActionInput"
|
2057
|
+
});
|
2158
2058
|
|
2159
2059
|
// ../commons/src/events/Draft.ts
|
2160
|
-
var Draft =
|
2161
|
-
id:
|
2162
|
-
eventId:
|
2163
|
-
transactionId:
|
2164
|
-
createdAt:
|
2060
|
+
var Draft = import_zod20.z.object({
|
2061
|
+
id: import_zod20.z.string(),
|
2062
|
+
eventId: import_zod20.z.string(),
|
2063
|
+
transactionId: import_zod20.z.string(),
|
2064
|
+
createdAt: import_zod20.z.string().datetime(),
|
2165
2065
|
action: ActionBase.extend({
|
2166
2066
|
type: ActionTypes
|
2167
2067
|
}).omit({ id: true })
|
@@ -2170,36 +2070,181 @@ var DraftInput = BaseActionInput.extend({
|
|
2170
2070
|
type: ActionTypes
|
2171
2071
|
});
|
2172
2072
|
|
2073
|
+
// ../commons/src/events/EventMetadata.ts
|
2074
|
+
var import_zod21 = require("zod");
|
2075
|
+
var EventStatus = {
|
2076
|
+
CREATED: "CREATED",
|
2077
|
+
NOTIFIED: "NOTIFIED",
|
2078
|
+
DECLARED: "DECLARED",
|
2079
|
+
VALIDATED: "VALIDATED",
|
2080
|
+
REGISTERED: "REGISTERED",
|
2081
|
+
CERTIFIED: "CERTIFIED",
|
2082
|
+
REJECTED: "REJECTED",
|
2083
|
+
ARCHIVED: "ARCHIVED"
|
2084
|
+
};
|
2085
|
+
var eventStatuses = Object.values(EventStatus);
|
2086
|
+
var EventStatuses = import_zod21.z.nativeEnum(EventStatus);
|
2087
|
+
var ZodDate = import_zod21.z.string().date();
|
2088
|
+
var EventMetadata = import_zod21.z.object({
|
2089
|
+
id: import_zod21.z.string(),
|
2090
|
+
type: import_zod21.z.string(),
|
2091
|
+
status: EventStatuses,
|
2092
|
+
createdAt: import_zod21.z.string().datetime(),
|
2093
|
+
dateOfEvent: ZodDate.nullish(),
|
2094
|
+
createdBy: import_zod21.z.string(),
|
2095
|
+
updatedByUserRole: import_zod21.z.string(),
|
2096
|
+
createdAtLocation: import_zod21.z.string(),
|
2097
|
+
updatedAtLocation: import_zod21.z.string(),
|
2098
|
+
updatedAt: import_zod21.z.string().datetime(),
|
2099
|
+
assignedTo: import_zod21.z.string().nullish(),
|
2100
|
+
updatedBy: import_zod21.z.string(),
|
2101
|
+
trackingId: import_zod21.z.string(),
|
2102
|
+
registrationNumber: import_zod21.z.string().nullish()
|
2103
|
+
});
|
2104
|
+
var eventMetadataLabelMap = {
|
2105
|
+
"event.assignedTo": {
|
2106
|
+
id: "event.assignedTo.label",
|
2107
|
+
defaultMessage: "Assigned To",
|
2108
|
+
description: "Assigned To"
|
2109
|
+
},
|
2110
|
+
"event.createdAt": {
|
2111
|
+
id: "event.createdAt.label",
|
2112
|
+
defaultMessage: "Created",
|
2113
|
+
description: "Created At"
|
2114
|
+
},
|
2115
|
+
"event.dateOfEvent": {
|
2116
|
+
id: "event.dateOfEvent.label",
|
2117
|
+
defaultMessage: "Date of Event",
|
2118
|
+
description: "Date of Event"
|
2119
|
+
},
|
2120
|
+
"event.createdAtLocation": {
|
2121
|
+
id: "event.createdAtLocation.label",
|
2122
|
+
defaultMessage: "Location",
|
2123
|
+
description: "Created At Location"
|
2124
|
+
},
|
2125
|
+
"event.updatedAtLocation": {
|
2126
|
+
id: "event.updatedAtLocation.label",
|
2127
|
+
defaultMessage: "Location",
|
2128
|
+
description: "Updated At Location"
|
2129
|
+
},
|
2130
|
+
"event.createdBy": {
|
2131
|
+
id: "event.createdBy.label",
|
2132
|
+
defaultMessage: "Created By",
|
2133
|
+
description: "Created By"
|
2134
|
+
},
|
2135
|
+
"event.updatedByUserRole": {
|
2136
|
+
id: "event.updatedByUserRole.label",
|
2137
|
+
defaultMessage: "Updated By Role",
|
2138
|
+
description: "Updated By Role"
|
2139
|
+
},
|
2140
|
+
"event.id": {
|
2141
|
+
id: "event.id.label",
|
2142
|
+
defaultMessage: "ID",
|
2143
|
+
description: "ID"
|
2144
|
+
},
|
2145
|
+
"event.updatedAt": {
|
2146
|
+
id: "event.modifiedAt.label",
|
2147
|
+
defaultMessage: "Updated",
|
2148
|
+
description: "Modified At"
|
2149
|
+
},
|
2150
|
+
"event.status": {
|
2151
|
+
id: "event.status.label",
|
2152
|
+
defaultMessage: "Status",
|
2153
|
+
description: "Status"
|
2154
|
+
},
|
2155
|
+
"event.type": {
|
2156
|
+
id: "event.type.label",
|
2157
|
+
defaultMessage: "Type",
|
2158
|
+
description: "Type"
|
2159
|
+
},
|
2160
|
+
"event.updatedBy": {
|
2161
|
+
id: "event.updatedBy.label",
|
2162
|
+
defaultMessage: "Updated By",
|
2163
|
+
description: "Updated By"
|
2164
|
+
},
|
2165
|
+
"event.trackingId": {
|
2166
|
+
id: "event.trackingId.label",
|
2167
|
+
defaultMessage: "Tracking ID",
|
2168
|
+
description: "Tracking ID"
|
2169
|
+
},
|
2170
|
+
"event.registrationNumber": {
|
2171
|
+
id: "event.registrationNumber.label",
|
2172
|
+
defaultMessage: "Registration Number",
|
2173
|
+
description: "Registration Number"
|
2174
|
+
}
|
2175
|
+
};
|
2176
|
+
|
2173
2177
|
// ../commons/src/events/EventInput.ts
|
2174
|
-
var
|
2175
|
-
var EventInput =
|
2176
|
-
transactionId:
|
2177
|
-
type:
|
2178
|
+
var import_zod22 = require("zod");
|
2179
|
+
var EventInput = import_zod22.z.object({
|
2180
|
+
transactionId: import_zod22.z.string(),
|
2181
|
+
type: import_zod22.z.string(),
|
2182
|
+
dateOfEvent: import_zod22.z.object({ fieldId: import_zod22.z.string() }).optional()
|
2178
2183
|
});
|
2179
2184
|
|
2180
2185
|
// ../commons/src/events/EventDocument.ts
|
2181
|
-
var
|
2182
|
-
var
|
2183
|
-
|
2184
|
-
|
2185
|
-
|
2186
|
-
|
2187
|
-
|
2188
|
-
|
2189
|
-
|
2190
|
-
|
2186
|
+
var import_zod23 = require("zod");
|
2187
|
+
var import_zod_openapi6 = require("zod-openapi");
|
2188
|
+
(0, import_zod_openapi6.extendZodWithOpenApi)(import_zod23.z);
|
2189
|
+
var EventDocument = import_zod23.z.object({
|
2190
|
+
id: import_zod23.z.string(),
|
2191
|
+
type: import_zod23.z.string(),
|
2192
|
+
dateOfEvent: import_zod23.z.object({ fieldId: import_zod23.z.string() }).optional(),
|
2193
|
+
createdAt: import_zod23.z.string().datetime(),
|
2194
|
+
updatedAt: import_zod23.z.string().datetime(),
|
2195
|
+
updatedAtLocation: import_zod23.z.string(),
|
2196
|
+
actions: import_zod23.z.array(Action),
|
2197
|
+
trackingId: import_zod23.z.string()
|
2198
|
+
}).openapi({ ref: "EventDocument" });
|
2191
2199
|
|
2192
2200
|
// ../commons/src/events/EventIndex.ts
|
2193
|
-
var
|
2201
|
+
var import_zod24 = require("zod");
|
2194
2202
|
var EventIndex = EventMetadata.extend({
|
2195
|
-
declaration:
|
2203
|
+
declaration: import_zod24.z.record(import_zod24.z.string(), import_zod24.z.any())
|
2196
2204
|
});
|
2197
|
-
var EventSearchIndex =
|
2198
|
-
|
2199
|
-
type:
|
2205
|
+
var EventSearchIndex = import_zod24.z.record(import_zod24.z.string(), import_zod24.z.any()).and(
|
2206
|
+
import_zod24.z.object({
|
2207
|
+
type: import_zod24.z.string()
|
2200
2208
|
// Ensures "type" (event-id) exists and is a string
|
2201
2209
|
})
|
2202
2210
|
);
|
2211
|
+
var Fuzzy = import_zod24.z.object({ type: import_zod24.z.literal("fuzzy"), term: import_zod24.z.string() });
|
2212
|
+
var Exact = import_zod24.z.object({ type: import_zod24.z.literal("exact"), term: import_zod24.z.string() });
|
2213
|
+
var AnyOf = import_zod24.z.object({
|
2214
|
+
type: import_zod24.z.literal("anyOf"),
|
2215
|
+
terms: import_zod24.z.array(import_zod24.z.string())
|
2216
|
+
});
|
2217
|
+
var Range = import_zod24.z.object({
|
2218
|
+
type: import_zod24.z.literal("range"),
|
2219
|
+
gte: import_zod24.z.string(),
|
2220
|
+
lte: import_zod24.z.string()
|
2221
|
+
});
|
2222
|
+
var Within = import_zod24.z.object({ type: import_zod24.z.literal("within"), location: import_zod24.z.string() });
|
2223
|
+
var DateCondition = import_zod24.z.union([Exact, Range]);
|
2224
|
+
var QueryInput = import_zod24.z.lazy(
|
2225
|
+
() => import_zod24.z.union([
|
2226
|
+
import_zod24.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf]),
|
2227
|
+
import_zod24.z.record(import_zod24.z.string(), QueryInput)
|
2228
|
+
])
|
2229
|
+
);
|
2230
|
+
var QueryExpression = import_zod24.z.object({
|
2231
|
+
type: import_zod24.z.literal("and"),
|
2232
|
+
eventType: import_zod24.z.string(),
|
2233
|
+
status: import_zod24.z.optional(import_zod24.z.union([AnyOf, Exact])),
|
2234
|
+
createdAt: import_zod24.z.optional(DateCondition),
|
2235
|
+
updatedAt: import_zod24.z.optional(DateCondition),
|
2236
|
+
createAtLocation: import_zod24.z.optional(import_zod24.z.union([Within, Exact])),
|
2237
|
+
updatedAtLocation: import_zod24.z.optional(import_zod24.z.union([Within, Exact])),
|
2238
|
+
createdBy: import_zod24.z.optional(Exact),
|
2239
|
+
updatedBy: import_zod24.z.optional(Exact),
|
2240
|
+
trackingId: import_zod24.z.optional(Exact),
|
2241
|
+
data: QueryInput
|
2242
|
+
}).partial();
|
2243
|
+
var Or2 = import_zod24.z.object({
|
2244
|
+
type: import_zod24.z.literal("or"),
|
2245
|
+
clauses: import_zod24.z.array(QueryExpression)
|
2246
|
+
});
|
2247
|
+
var QueryType = import_zod24.z.discriminatedUnion("type", [QueryExpression, Or2]);
|
2203
2248
|
|
2204
2249
|
// ../commons/src/events/state/index.ts
|
2205
2250
|
function getStatusFromActions(actions) {
|
@@ -2226,6 +2271,7 @@ function getStatusFromActions(actions) {
|
|
2226
2271
|
case ActionType.NOTIFY:
|
2227
2272
|
return EventStatus.NOTIFIED;
|
2228
2273
|
case ActionType.PRINT_CERTIFICATE:
|
2274
|
+
return EventStatus.CERTIFIED;
|
2229
2275
|
case ActionType.ASSIGN:
|
2230
2276
|
case ActionType.UNASSIGN:
|
2231
2277
|
case ActionType.REQUEST_CORRECTION:
|
@@ -2238,6 +2284,18 @@ function getStatusFromActions(actions) {
|
|
2238
2284
|
}
|
2239
2285
|
}, EventStatus.CREATED);
|
2240
2286
|
}
|
2287
|
+
function getLastUpdatedByUserRoleFromActions(actions) {
|
2288
|
+
const actionsWithRoles = actions.filter(
|
2289
|
+
(action) => !isWriteAction(action.type) && action.status !== ActionStatus.Rejected
|
2290
|
+
).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
2291
|
+
const lastAction = actionsWithRoles.at(-1);
|
2292
|
+
if (!lastAction) {
|
2293
|
+
throw new Error(
|
2294
|
+
"Should never happen, at least CREATE action should be present"
|
2295
|
+
);
|
2296
|
+
}
|
2297
|
+
return ActionDocument.parse(lastAction).createdByRole;
|
2298
|
+
}
|
2241
2299
|
function getAssignedUserFromActions(actions) {
|
2242
2300
|
return actions.reduce((user2, action) => {
|
2243
2301
|
if (action.type === ActionType.ASSIGN) {
|
@@ -2305,20 +2363,29 @@ function getCurrentEventState(event2) {
|
|
2305
2363
|
(a) => a.type === ActionType.REGISTER && a.status === ActionStatus.Accepted
|
2306
2364
|
);
|
2307
2365
|
const registrationNumber = registrationAction?.registrationNumber ?? null;
|
2366
|
+
const declaration = aggregateActionDeclarations(activeActions);
|
2367
|
+
let dateOfEvent = event2.createdAt.split("T")[0];
|
2368
|
+
if (event2.dateOfEvent) {
|
2369
|
+
const parsedDate = ZodDate.safeParse(declaration[event2.dateOfEvent.fieldId]);
|
2370
|
+
dateOfEvent = parsedDate.success ? parsedDate.data : null;
|
2371
|
+
}
|
2308
2372
|
return deepDropNulls({
|
2309
2373
|
id: event2.id,
|
2310
2374
|
type: event2.type,
|
2311
2375
|
status: getStatusFromActions(event2.actions),
|
2312
2376
|
createdAt: event2.createdAt,
|
2313
2377
|
createdBy: creationAction.createdBy,
|
2314
|
-
createdAtLocation: creationAction.createdAtLocation,
|
2315
|
-
|
2378
|
+
createdAtLocation: creationAction.createdAtLocation ?? "",
|
2379
|
+
// @todo remove using empty string
|
2380
|
+
updatedAt: latestAction.createdAt,
|
2316
2381
|
assignedTo: getAssignedUserFromActions(activeActions),
|
2317
2382
|
updatedBy: latestAction.createdBy,
|
2318
2383
|
updatedAtLocation: event2.updatedAtLocation,
|
2319
|
-
declaration
|
2384
|
+
declaration,
|
2320
2385
|
trackingId: event2.trackingId,
|
2321
|
-
registrationNumber
|
2386
|
+
registrationNumber,
|
2387
|
+
updatedByUserRole: getLastUpdatedByUserRoleFromActions(event2.actions),
|
2388
|
+
dateOfEvent
|
2322
2389
|
});
|
2323
2390
|
}
|
2324
2391
|
function getCurrentEventStateWithDrafts(event2, drafts) {
|
@@ -2343,7 +2410,7 @@ function getCurrentEventStateWithDrafts(event2, drafts) {
|
|
2343
2410
|
return getCurrentEventState(withDrafts);
|
2344
2411
|
}
|
2345
2412
|
function applyDraftsToEventIndex(eventIndex, drafts) {
|
2346
|
-
const indexedAt = eventIndex.
|
2413
|
+
const indexedAt = eventIndex.updatedAt;
|
2347
2414
|
const activeDrafts = drafts.filter(({ createdAt }) => new Date(createdAt) > new Date(indexedAt)).map((draft) => draft.action).sort();
|
2348
2415
|
if (activeDrafts.length === 0) {
|
2349
2416
|
return eventIndex;
|
@@ -2366,7 +2433,7 @@ function getAnnotationFromDrafts(drafts) {
|
|
2366
2433
|
function getActionAnnotation({
|
2367
2434
|
event: event2,
|
2368
2435
|
actionType,
|
2369
|
-
drafts
|
2436
|
+
drafts = []
|
2370
2437
|
}) {
|
2371
2438
|
const activeActions = getAcceptedActions(event2);
|
2372
2439
|
const action = activeActions.find(
|
@@ -2385,7 +2452,6 @@ function getActionAnnotation({
|
|
2385
2452
|
|
2386
2453
|
// ../commons/src/events/defineConfig.ts
|
2387
2454
|
var defineConfig = (config) => {
|
2388
|
-
validateWorkqueueConfig(config.workqueues);
|
2389
2455
|
const input = EventConfig.parse(config);
|
2390
2456
|
return input;
|
2391
2457
|
};
|
@@ -2460,32 +2526,38 @@ var user = {
|
|
2460
2526
|
required: ["$user"]
|
2461
2527
|
})
|
2462
2528
|
};
|
2463
|
-
|
2464
|
-
|
2465
|
-
|
2466
|
-
|
2467
|
-
|
2468
|
-
|
2469
|
-
|
2470
|
-
|
2471
|
-
|
2472
|
-
|
2473
|
-
|
2474
|
-
|
2475
|
-
|
2476
|
-
|
2477
|
-
|
2478
|
-
|
2479
|
-
|
2529
|
+
function createEventConditionals() {
|
2530
|
+
return {
|
2531
|
+
/**
|
2532
|
+
* Checks if the event contains a specific action type.
|
2533
|
+
* @param action - The action type to check for.
|
2534
|
+
*/
|
2535
|
+
hasAction: (action) => defineConditional({
|
2536
|
+
type: "object",
|
2537
|
+
properties: {
|
2538
|
+
$event: {
|
2539
|
+
type: "object",
|
2540
|
+
properties: {
|
2541
|
+
actions: {
|
2542
|
+
type: "array",
|
2543
|
+
contains: {
|
2544
|
+
type: "object",
|
2545
|
+
properties: {
|
2546
|
+
type: {
|
2547
|
+
const: action
|
2548
|
+
}
|
2549
|
+
},
|
2550
|
+
required: ["type"]
|
2551
|
+
}
|
2480
2552
|
}
|
2481
|
-
}
|
2482
|
-
|
2483
|
-
|
2484
|
-
}
|
2485
|
-
|
2486
|
-
|
2487
|
-
}
|
2488
|
-
}
|
2553
|
+
},
|
2554
|
+
required: ["actions"]
|
2555
|
+
}
|
2556
|
+
},
|
2557
|
+
required: ["$event"]
|
2558
|
+
})
|
2559
|
+
};
|
2560
|
+
}
|
2489
2561
|
function getDateFromNow(days) {
|
2490
2562
|
return new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
|
2491
2563
|
}
|
@@ -2506,7 +2578,7 @@ function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
|
|
2506
2578
|
function isFieldReference(value) {
|
2507
2579
|
return typeof value === "object" && value !== null && "_fieldId" in value;
|
2508
2580
|
}
|
2509
|
-
function
|
2581
|
+
function createFieldConditionals(fieldId) {
|
2510
2582
|
const getDateRange = (date, clause) => ({
|
2511
2583
|
type: "object",
|
2512
2584
|
properties: {
|
@@ -2519,10 +2591,6 @@ function field(fieldId) {
|
|
2519
2591
|
required: [fieldId]
|
2520
2592
|
});
|
2521
2593
|
return {
|
2522
|
-
/**
|
2523
|
-
* @private Internal property used for field reference tracking.
|
2524
|
-
*/
|
2525
|
-
_fieldId: fieldId,
|
2526
2594
|
isAfter: () => ({
|
2527
2595
|
days: (days) => ({
|
2528
2596
|
inPast: () => defineFormConditional(
|
@@ -2689,10 +2757,74 @@ function field(fieldId) {
|
|
2689
2757
|
}
|
2690
2758
|
},
|
2691
2759
|
required: [fieldId]
|
2760
|
+
}),
|
2761
|
+
getId: () => ({ fieldId })
|
2762
|
+
};
|
2763
|
+
}
|
2764
|
+
|
2765
|
+
// ../commons/src/field-config/field-configuration.ts
|
2766
|
+
function createFieldConfigs(fieldId) {
|
2767
|
+
const baseField = {
|
2768
|
+
fieldId,
|
2769
|
+
fieldType: "field"
|
2770
|
+
};
|
2771
|
+
return {
|
2772
|
+
/**
|
2773
|
+
* Creates a range configuration for the specified field.
|
2774
|
+
*
|
2775
|
+
* @returns An object containing the field ID and a configuration object with a type of 'RANGE'.
|
2776
|
+
*
|
2777
|
+
* @example field('age').range()
|
2778
|
+
* // {
|
2779
|
+
* // fieldId: 'age',
|
2780
|
+
* // config: { type: 'RANGE' }
|
2781
|
+
* // }
|
2782
|
+
*/
|
2783
|
+
range: () => ({
|
2784
|
+
...baseField,
|
2785
|
+
config: { type: "RANGE" }
|
2786
|
+
}),
|
2787
|
+
/**
|
2788
|
+
* Creates a configuration for exact matching of the specified field.
|
2789
|
+
* @returns An object containing the field ID and a configuration object with a type of 'EXACT'.
|
2790
|
+
* @example field('dob').exact()
|
2791
|
+
* // {
|
2792
|
+
* // fieldId: 'dob',
|
2793
|
+
* // config: { type: 'EXACT' }
|
2794
|
+
* // }
|
2795
|
+
*/
|
2796
|
+
exact: () => ({
|
2797
|
+
...baseField,
|
2798
|
+
config: { type: "EXACT" }
|
2799
|
+
}),
|
2800
|
+
/**
|
2801
|
+
* Creates a configuration for fuzzy matching of the specified field.
|
2802
|
+
* @returns An object containing the field ID and a configuration object with a type of 'EXACT'.
|
2803
|
+
* @example field('name').fuzzy()
|
2804
|
+
* // {
|
2805
|
+
* // fieldId: 'name',
|
2806
|
+
* // config: { type: 'FUZZY' }
|
2807
|
+
* // }
|
2808
|
+
*/
|
2809
|
+
fuzzy: () => ({
|
2810
|
+
...baseField,
|
2811
|
+
config: { type: "FUZZY" }
|
2692
2812
|
})
|
2693
2813
|
};
|
2694
2814
|
}
|
2695
2815
|
|
2816
|
+
// ../commons/src/events/field.ts
|
2817
|
+
function field(fieldId) {
|
2818
|
+
return {
|
2819
|
+
/**
|
2820
|
+
* @private Internal property used for field reference tracking.
|
2821
|
+
*/
|
2822
|
+
_fieldId: fieldId,
|
2823
|
+
...createFieldConditionals(fieldId),
|
2824
|
+
...createFieldConfigs(fieldId)
|
2825
|
+
};
|
2826
|
+
}
|
2827
|
+
|
2696
2828
|
// ../commons/src/fixtures/tennis-club-membership-event.ts
|
2697
2829
|
var PRINT_CERTIFICATE_FORM = defineActionForm({
|
2698
2830
|
label: {
|
@@ -3609,20 +3741,12 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3609
3741
|
description: "This is what this event is referred as in the system",
|
3610
3742
|
id: "event.tennis-club-membership.label"
|
3611
3743
|
},
|
3744
|
+
title: {
|
3745
|
+
defaultMessage: "{applicant.firstname} {applicant.surname}",
|
3746
|
+
description: "This is the title of the summary",
|
3747
|
+
id: "v2.event.tennis-club-membership.title"
|
3748
|
+
},
|
3612
3749
|
summary: {
|
3613
|
-
title: {
|
3614
|
-
id: "event.tennis-club-membership.summary.title",
|
3615
|
-
label: {
|
3616
|
-
defaultMessage: "{applicant.firstname} {applicant.surname}",
|
3617
|
-
description: "This is the title of the summary",
|
3618
|
-
id: "v2.event.tennis-club-membership.summary.title"
|
3619
|
-
},
|
3620
|
-
emptyValueMessage: {
|
3621
|
-
defaultMessage: "Membership application",
|
3622
|
-
description: "This is the message shown when the applicant name is missing",
|
3623
|
-
id: "event.tennis-club-membership.summary.title.empty"
|
3624
|
-
}
|
3625
|
-
},
|
3626
3750
|
fields: [
|
3627
3751
|
{
|
3628
3752
|
id: "applicant.firstname",
|
@@ -3662,28 +3786,6 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3662
3786
|
}
|
3663
3787
|
]
|
3664
3788
|
},
|
3665
|
-
workqueues: [
|
3666
|
-
{
|
3667
|
-
id: "all",
|
3668
|
-
filters: []
|
3669
|
-
},
|
3670
|
-
{
|
3671
|
-
id: "ready-for-review",
|
3672
|
-
filters: [
|
3673
|
-
{
|
3674
|
-
status: ["DECLARED"]
|
3675
|
-
}
|
3676
|
-
]
|
3677
|
-
},
|
3678
|
-
{
|
3679
|
-
id: "registered",
|
3680
|
-
filters: [
|
3681
|
-
{
|
3682
|
-
status: ["REGISTERED"]
|
3683
|
-
}
|
3684
|
-
]
|
3685
|
-
}
|
3686
|
-
],
|
3687
3789
|
actions: [
|
3688
3790
|
{
|
3689
3791
|
type: ActionType.DECLARE,
|
@@ -3991,11 +4093,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3991
4093
|
description: "This is what this event is referred as in the system",
|
3992
4094
|
id: "v2.event.tennis-club-membership.search"
|
3993
4095
|
},
|
3994
|
-
fields: [
|
3995
|
-
{
|
3996
|
-
fieldId: "applicant.dob"
|
3997
|
-
}
|
3998
|
-
]
|
4096
|
+
fields: [field("applicant.dob").exact()]
|
3999
4097
|
}
|
4000
4098
|
],
|
4001
4099
|
declaration: TENNIS_CLUB_DECLARATION_FORM
|
@@ -4028,10 +4126,10 @@ function generateActionAnnotationInput(configuration, action) {
|
|
4028
4126
|
);
|
4029
4127
|
const annotationFields = actionConfig ? getActionAnnotationFields(actionConfig) : [];
|
4030
4128
|
const annotation = fieldConfigsToActionPayload(annotationFields);
|
4031
|
-
const visibleVerificationPageIds =
|
4032
|
-
configuration,
|
4033
|
-
|
4034
|
-
)
|
4129
|
+
const visibleVerificationPageIds = getVisibleVerificationPageIds(
|
4130
|
+
findRecordActionPages(configuration, action),
|
4131
|
+
annotation
|
4132
|
+
);
|
4035
4133
|
const visiblePageVerificationMap = visibleVerificationPageIds.reduce(
|
4036
4134
|
(acc, pageId) => ({
|
4037
4135
|
...acc,
|
@@ -4062,6 +4160,7 @@ var eventPayloadGenerator = {
|
|
4062
4160
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
4063
4161
|
transactionId: getUUID(),
|
4064
4162
|
action: {
|
4163
|
+
transactionId: getUUID(),
|
4065
4164
|
type: actionType,
|
4066
4165
|
status: ActionStatus.Accepted,
|
4067
4166
|
declaration: {
|
@@ -4076,7 +4175,9 @@ var eventPayloadGenerator = {
|
|
4076
4175
|
},
|
4077
4176
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
4078
4177
|
createdBy: "@todo",
|
4079
|
-
|
4178
|
+
createdByRole: "@todo",
|
4179
|
+
createdAtLocation: "@todo",
|
4180
|
+
updatedAtLocation: "@todo"
|
4080
4181
|
}
|
4081
4182
|
},
|
4082
4183
|
input
|
@@ -4237,12 +4338,15 @@ function generateActionDocument({
|
|
4237
4338
|
// @TODO: This should be fixed in the future.
|
4238
4339
|
createdAt: new Date(Date.now() - 500).toISOString(),
|
4239
4340
|
createdBy: getUUID(),
|
4341
|
+
createdByRole: "FIELD_AGENT",
|
4240
4342
|
id: getUUID(),
|
4241
4343
|
createdAtLocation: "TODO",
|
4344
|
+
updatedAtLocation: "TODO",
|
4242
4345
|
declaration: generateActionDeclarationInput(configuration, action),
|
4243
4346
|
annotation: {},
|
4244
4347
|
...defaults,
|
4245
|
-
status: ActionStatus.Accepted
|
4348
|
+
status: ActionStatus.Accepted,
|
4349
|
+
transactionId: getUUID()
|
4246
4350
|
};
|
4247
4351
|
switch (action) {
|
4248
4352
|
case ActionType.READ:
|
@@ -4301,7 +4405,8 @@ function generateEventDocument({
|
|
4301
4405
|
// Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
|
4302
4406
|
// @TODO: This should be fixed in the future.
|
4303
4407
|
updatedAt: new Date(Date.now() - 1e3).toISOString(),
|
4304
|
-
|
4408
|
+
dateOfEvent: configuration.dateOfEvent,
|
4409
|
+
updatedAtLocation: getUUID()
|
4305
4410
|
};
|
4306
4411
|
}
|
4307
4412
|
function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE, declaration = {}) {
|
@@ -4331,9 +4436,10 @@ var eventQueryDataGenerator = (overrides = {}) => ({
|
|
4331
4436
|
createdBy: overrides.createdBy ?? getUUID(),
|
4332
4437
|
createdAtLocation: overrides.createdAtLocation ?? getUUID(),
|
4333
4438
|
updatedAtLocation: overrides.updatedAtLocation ?? getUUID(),
|
4334
|
-
|
4439
|
+
updatedAt: overrides.updatedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
4335
4440
|
assignedTo: overrides.assignedTo ?? null,
|
4336
4441
|
updatedBy: overrides.updatedBy ?? getUUID(),
|
4442
|
+
updatedByUserRole: overrides.updatedByUserRole ?? "FIELD_AGENT",
|
4337
4443
|
declaration: overrides.declaration ?? {
|
4338
4444
|
"recommender.none": true,
|
4339
4445
|
"applicant.firstname": "Danny",
|
@@ -4510,6 +4616,14 @@ var CONFIG_GET_ALLOWED_SCOPES = [
|
|
4510
4616
|
SCOPES.CONFIG,
|
4511
4617
|
SCOPES.CONFIG_UPDATE_ALL
|
4512
4618
|
];
|
4619
|
+
var CONFIG_SEARCH_ALLOWED_SCOPES = [
|
4620
|
+
SCOPES.SEARCH_BIRTH,
|
4621
|
+
SCOPES.SEARCH_DEATH,
|
4622
|
+
SCOPES.SEARCH_MARRIAGE,
|
4623
|
+
SCOPES.SEARCH_BIRTH_MY_JURISDICTION,
|
4624
|
+
SCOPES.SEARCH_DEATH_MY_JURISDICTION,
|
4625
|
+
SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION
|
4626
|
+
];
|
4513
4627
|
var ACTION_ALLOWED_SCOPES = {
|
4514
4628
|
[ActionType.READ]: [
|
4515
4629
|
SCOPES.RECORD_DECLARE,
|
@@ -4565,3 +4679,19 @@ function filterUnallowedActions(actions, userScopes) {
|
|
4565
4679
|
}
|
4566
4680
|
return [ActionType.READ];
|
4567
4681
|
}
|
4682
|
+
|
4683
|
+
// ../commons/src/event-config/event-configuration.ts
|
4684
|
+
function createEventFieldConfig(fieldId, options) {
|
4685
|
+
return {
|
4686
|
+
fieldId,
|
4687
|
+
options,
|
4688
|
+
config: { type: "EXACT" },
|
4689
|
+
fieldType: "event"
|
4690
|
+
};
|
4691
|
+
}
|
4692
|
+
|
4693
|
+
// ../commons/src/events/event.ts
|
4694
|
+
function eventFn(fieldId, options) {
|
4695
|
+
return createEventFieldConfig(fieldId, options);
|
4696
|
+
}
|
4697
|
+
var event = Object.assign(eventFn, createEventConditionals());
|