@opencrvs/toolkit 1.8.0-rc.f82791e → 1.8.0-rc.f8296f8
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 +7485 -3044
- package/dist/commons/conditionals/conditionals.d.ts +2 -1
- package/dist/commons/events/ActionConfig.d.ts +20595 -2656
- package/dist/commons/events/ActionDocument.d.ts +760 -553
- package/dist/commons/events/ActionInput.d.ts +377 -305
- package/dist/commons/events/AdvancedSearchConfig.d.ts +637 -48
- package/dist/commons/events/Constants.d.ts +2 -0
- package/dist/commons/events/CountryConfigQueryInput.d.ts +2982 -0
- package/dist/commons/events/CreatedAtLocation.d.ts +2 -0
- package/dist/commons/events/Draft.d.ts +43 -40
- package/dist/commons/events/EventConfig.d.ts +16491 -7434
- package/dist/commons/events/EventDocument.d.ts +471 -423
- package/dist/commons/events/EventIndex.d.ts +694 -293
- package/dist/commons/events/EventInput.d.ts +0 -13
- package/dist/commons/events/EventMetadata.d.ts +262 -16
- package/dist/commons/events/FieldConfig.d.ts +850 -69
- package/dist/commons/events/FieldType.d.ts +3 -2
- package/dist/commons/events/FieldTypeMapping.d.ts +11 -4
- package/dist/commons/events/FieldValue.d.ts +6 -3
- package/dist/commons/events/FormConfig.d.ts +5749 -925
- package/dist/commons/events/PageConfig.d.ts +1191 -3
- package/dist/commons/events/SummaryConfig.d.ts +17 -0
- package/dist/commons/events/User.d.ts +31 -7
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +53 -0
- package/dist/commons/events/WorkqueueConfig.d.ts +4491 -10
- package/dist/commons/events/defineConfig.d.ts +1269 -7
- package/dist/commons/events/event.d.ts +37 -8
- package/dist/commons/events/field.d.ts +24 -10
- package/dist/commons/events/index.d.ts +4 -0
- package/dist/commons/events/scopes.d.ts +20 -1
- package/dist/commons/events/serializer.d.ts +2 -0
- package/dist/commons/events/test.utils.d.ts +35 -14
- package/dist/commons/events/transactions.d.ts +1 -1
- package/dist/commons/events/utils.d.ts +313 -24
- package/dist/commons/events/workqueueDefaultColumns.d.ts +3 -0
- package/dist/conditionals/index.js +19 -2
- package/dist/events/index.js +2859 -1192
- package/dist/scopes/index.d.ts +158 -1
- package/dist/scopes/index.js +152 -1
- package/package.json +1 -1
package/dist/events/index.js
CHANGED
@@ -30,12 +30,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
30
30
|
// src/events/index.ts
|
31
31
|
var events_exports = {};
|
32
32
|
__export(events_exports, {
|
33
|
+
ACTION_ALLOWED_CONFIGURABLE_SCOPES: () => ACTION_ALLOWED_CONFIGURABLE_SCOPES,
|
33
34
|
ACTION_ALLOWED_SCOPES: () => ACTION_ALLOWED_SCOPES,
|
34
35
|
Action: () => Action,
|
35
36
|
ActionBase: () => ActionBase,
|
36
37
|
ActionConditional: () => ActionConditional,
|
37
38
|
ActionConfig: () => ActionConfig,
|
38
39
|
ActionConfigBase: () => ActionConfigBase,
|
40
|
+
ActionCreationMetadata: () => ActionCreationMetadata,
|
39
41
|
ActionDocument: () => ActionDocument,
|
40
42
|
ActionFormConfig: () => ActionFormConfig,
|
41
43
|
ActionInput: () => ActionInput,
|
@@ -48,11 +50,14 @@ __export(events_exports, {
|
|
48
50
|
AddressType: () => AddressType,
|
49
51
|
AdministrativeAreas: () => AdministrativeAreas,
|
50
52
|
AdvancedSearchConfig: () => AdvancedSearchConfig,
|
53
|
+
AnyOf: () => AnyOf,
|
54
|
+
AnyOfStatus: () => AnyOfStatus,
|
51
55
|
ApproveCorrectionActionInput: () => ApproveCorrectionActionInput,
|
52
56
|
ArchiveActionInput: () => ArchiveActionInput,
|
53
57
|
AssignActionInput: () => AssignActionInput,
|
54
58
|
AsyncRejectActionDocument: () => AsyncRejectActionDocument,
|
55
59
|
BaseActionInput: () => BaseActionInput,
|
60
|
+
BearerTokenByUserType: () => BearerTokenByUserType,
|
56
61
|
CONFIG_GET_ALLOWED_SCOPES: () => CONFIG_GET_ALLOWED_SCOPES,
|
57
62
|
CONFIG_SEARCH_ALLOWED_SCOPES: () => CONFIG_SEARCH_ALLOWED_SCOPES,
|
58
63
|
CertificateConfig: () => CertificateConfig,
|
@@ -62,9 +67,14 @@ __export(events_exports, {
|
|
62
67
|
Conditional: () => Conditional,
|
63
68
|
ConditionalType: () => ConditionalType,
|
64
69
|
ConfirmableActions: () => ConfirmableActions,
|
70
|
+
CustomFlags: () => CustomFlags,
|
71
|
+
DEFAULT_DATE_OF_EVENT_PROPERTY: () => DEFAULT_DATE_OF_EVENT_PROPERTY,
|
65
72
|
DataEntry: () => DataEntry,
|
66
73
|
DataFieldValue: () => DataFieldValue,
|
74
|
+
DateCondition: () => DateCondition,
|
75
|
+
DateRangeFieldValue: () => DateRangeFieldValue,
|
67
76
|
DateValue: () => DateValue,
|
77
|
+
DatetimeValue: () => DatetimeValue,
|
68
78
|
DeclarationActionConfig: () => DeclarationActionConfig,
|
69
79
|
DeclarationActions: () => DeclarationActions,
|
70
80
|
DeclarationFormConfig: () => DeclarationFormConfig,
|
@@ -86,9 +96,15 @@ __export(events_exports, {
|
|
86
96
|
EventIndex: () => EventIndex,
|
87
97
|
EventInput: () => EventInput,
|
88
98
|
EventMetadata: () => EventMetadata,
|
99
|
+
EventMetadataKeys: () => EventMetadataKeys,
|
100
|
+
EventMetadataKeysArray: () => EventMetadataKeysArray,
|
89
101
|
EventSearchIndex: () => EventSearchIndex,
|
102
|
+
EventState: () => EventState,
|
90
103
|
EventStatus: () => EventStatus,
|
104
|
+
EventStatusEnum: () => EventStatusEnum,
|
91
105
|
EventStatuses: () => EventStatuses,
|
106
|
+
Exact: () => Exact,
|
107
|
+
ExactStatus: () => ExactStatus,
|
92
108
|
FieldConditional: () => FieldConditional,
|
93
109
|
FieldConfig: () => FieldConfig,
|
94
110
|
FieldConfigSchema: () => FieldConfigSchema,
|
@@ -98,46 +114,64 @@ __export(events_exports, {
|
|
98
114
|
FileFieldValue: () => FileFieldValue,
|
99
115
|
FileFieldValueWithOption: () => FileFieldValueWithOption,
|
100
116
|
FileFieldWithOptionValue: () => FileFieldWithOptionValue,
|
117
|
+
Flag: () => Flag,
|
101
118
|
FormConfig: () => FormConfig,
|
102
119
|
FormPageConfig: () => FormPageConfig,
|
120
|
+
Fuzzy: () => Fuzzy,
|
103
121
|
GenericAddressUpdateValue: () => GenericAddressUpdateValue,
|
104
122
|
GenericAddressValue: () => GenericAddressValue,
|
105
123
|
GeographicalArea: () => GeographicalArea,
|
106
124
|
ImageMimeType: () => ImageMimeType,
|
107
125
|
LanguageConfig: () => LanguageConfig,
|
126
|
+
LegalStatuses: () => LegalStatuses,
|
108
127
|
MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
|
109
|
-
MatchType: () => MatchType,
|
110
128
|
MimeType: () => MimeType,
|
111
129
|
NonEmptyTextValue: () => NonEmptyTextValue,
|
130
|
+
Not: () => Not,
|
112
131
|
NotifyActionInput: () => NotifyActionInput,
|
113
132
|
NumberFieldValue: () => NumberFieldValue,
|
114
133
|
PageConfig: () => PageConfig,
|
115
134
|
PageTypes: () => PageTypes,
|
116
135
|
PrintCertificateActionInput: () => PrintCertificateActionInput,
|
136
|
+
QueryExpression: () => QueryExpression,
|
117
137
|
QueryInput: () => QueryInput,
|
118
138
|
QueryType: () => QueryType,
|
139
|
+
Range: () => Range,
|
119
140
|
ReadActionInput: () => ReadActionInput,
|
120
141
|
RegisterAction: () => RegisterAction,
|
121
142
|
RegisterActionInput: () => RegisterActionInput,
|
143
|
+
RegistrationCreationMetadata: () => RegistrationCreationMetadata,
|
122
144
|
RejectCorrectionActionInput: () => RejectCorrectionActionInput,
|
123
145
|
RejectDeclarationActionInput: () => RejectDeclarationActionInput,
|
146
|
+
RejectionReason: () => RejectionReason,
|
124
147
|
RequestCorrectionActionInput: () => RequestCorrectionActionInput,
|
125
148
|
ResolvedUser: () => ResolvedUser,
|
126
149
|
RuralAddressUpdateValue: () => RuralAddressUpdateValue,
|
127
150
|
RuralAddressValue: () => RuralAddressValue,
|
128
151
|
SearchField: () => SearchField,
|
152
|
+
SearchQueryParams: () => SearchQueryParams,
|
129
153
|
SelectOption: () => SelectOption,
|
130
154
|
ShowConditional: () => ShowConditional,
|
131
155
|
SummaryConfig: () => SummaryConfig,
|
156
|
+
TENNIS_CLUB_MEMBERSHIP: () => TENNIS_CLUB_MEMBERSHIP,
|
132
157
|
TextValue: () => TextValue,
|
133
158
|
TranslationConfig: () => TranslationConfig,
|
134
159
|
UnassignActionInput: () => UnassignActionInput,
|
135
160
|
UrbanAddressUpdateValue: () => UrbanAddressUpdateValue,
|
136
161
|
UrbanAddressValue: () => UrbanAddressValue,
|
162
|
+
User: () => User,
|
137
163
|
ValidateActionInput: () => ValidateActionInput,
|
138
164
|
VerificationActionConfig: () => VerificationActionConfig,
|
139
165
|
VerificationPageConfig: () => VerificationPageConfig,
|
166
|
+
Within: () => Within,
|
167
|
+
WorkqueueColumn: () => WorkqueueColumn,
|
168
|
+
WorkqueueColumnKeys: () => WorkqueueColumnKeys,
|
169
|
+
WorkqueueColumnKeysArray: () => WorkqueueColumnKeysArray,
|
170
|
+
WorkqueueColumnValue: () => WorkqueueColumnValue,
|
140
171
|
WorkqueueConfig: () => WorkqueueConfig,
|
172
|
+
WorkqueueConfigInput: () => WorkqueueConfigInput,
|
173
|
+
WorkqueueCountInput: () => WorkqueueCountInput,
|
174
|
+
WorkqueueCountOutput: () => WorkqueueCountOutput,
|
141
175
|
ZodDate: () => ZodDate,
|
142
176
|
alwaysTrue: () => alwaysTrue,
|
143
177
|
and: () => and,
|
@@ -148,9 +182,12 @@ __export(events_exports, {
|
|
148
182
|
createEmptyDraft: () => createEmptyDraft,
|
149
183
|
createEventConditionals: () => createEventConditionals,
|
150
184
|
createFieldConditionals: () => createFieldConditionals,
|
185
|
+
createPseudoRandomNumberGenerator: () => createPseudoRandomNumberGenerator,
|
151
186
|
createValidationSchema: () => createValidationSchema,
|
187
|
+
dateOfEventColumn: () => dateOfEventColumn,
|
152
188
|
deepDropNulls: () => deepDropNulls,
|
153
189
|
deepMerge: () => deepMerge,
|
190
|
+
defaultWorkqueueColumns: () => defaultWorkqueueColumns,
|
154
191
|
defineActionForm: () => defineActionForm,
|
155
192
|
defineConditional: () => defineConditional,
|
156
193
|
defineConfig: () => defineConfig,
|
@@ -159,6 +196,9 @@ __export(events_exports, {
|
|
159
196
|
defineFormPage: () => defineFormPage,
|
160
197
|
definePage: () => definePage,
|
161
198
|
defineWorkqueue: () => defineWorkqueue,
|
199
|
+
defineWorkqueues: () => defineWorkqueues,
|
200
|
+
defineWorkqueuesColumns: () => defineWorkqueuesColumns,
|
201
|
+
deserializeQuery: () => deserializeQuery,
|
162
202
|
errorMessages: () => errorMessages,
|
163
203
|
event: () => event,
|
164
204
|
eventMetadataLabelMap: () => eventMetadataLabelMap,
|
@@ -177,8 +217,10 @@ __export(events_exports, {
|
|
177
217
|
generateActionDocument: () => generateActionDocument,
|
178
218
|
generateEventDocument: () => generateEventDocument,
|
179
219
|
generateEventDraftDocument: () => generateEventDraftDocument,
|
220
|
+
generateRandomSignature: () => generateRandomSignature,
|
180
221
|
generateTransactionId: () => generateTransactionId,
|
181
222
|
generateTranslationConfig: () => generateTranslationConfig,
|
223
|
+
generateWorkqueues: () => generateWorkqueues,
|
182
224
|
getAcceptedActions: () => getAcceptedActions,
|
183
225
|
getActionAnnotation: () => getActionAnnotation,
|
184
226
|
getActionAnnotationFields: () => getActionAnnotationFields,
|
@@ -187,11 +229,15 @@ __export(events_exports, {
|
|
187
229
|
getActionVerificationPageIds: () => getActionVerificationPageIds,
|
188
230
|
getAnnotationFromDrafts: () => getAnnotationFromDrafts,
|
189
231
|
getAssignedUserFromActions: () => getAssignedUserFromActions,
|
232
|
+
getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
|
190
233
|
getCurrentEventState: () => getCurrentEventState,
|
191
234
|
getCurrentEventStateWithDrafts: () => getCurrentEventStateWithDrafts,
|
192
235
|
getDeclaration: () => getDeclaration,
|
193
236
|
getDeclarationFields: () => getDeclarationFields,
|
194
237
|
getDeclarationPages: () => getDeclarationPages,
|
238
|
+
getMixedPath: () => getMixedPath,
|
239
|
+
getRandomDatetime: () => getRandomDatetime,
|
240
|
+
getStatusFromActions: () => getStatusFromActions,
|
195
241
|
getVisibleVerificationPageIds: () => getVisibleVerificationPageIds,
|
196
242
|
hasAnyOfScopes: () => hasAnyOfScopes,
|
197
243
|
isAddressFieldType: () => isAddressFieldType,
|
@@ -202,6 +248,7 @@ __export(events_exports, {
|
|
202
248
|
isCountryFieldType: () => isCountryFieldType,
|
203
249
|
isDataFieldType: () => isDataFieldType,
|
204
250
|
isDateFieldType: () => isDateFieldType,
|
251
|
+
isDateRangeFieldType: () => isDateRangeFieldType,
|
205
252
|
isDividerFieldType: () => isDividerFieldType,
|
206
253
|
isEmailFieldType: () => isEmailFieldType,
|
207
254
|
isFacilityFieldType: () => isFacilityFieldType,
|
@@ -245,14 +292,20 @@ __export(events_exports, {
|
|
245
292
|
});
|
246
293
|
module.exports = __toCommonJS(events_exports);
|
247
294
|
|
295
|
+
// ../commons/src/events/Constants.ts
|
296
|
+
var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
|
297
|
+
|
248
298
|
// ../commons/src/events/ActionConfig.ts
|
249
299
|
var import_zod9 = require("zod");
|
250
300
|
|
251
301
|
// ../commons/src/events/Conditional.ts
|
252
302
|
var import_zod = require("zod");
|
253
|
-
var
|
254
|
-
|
255
|
-
)
|
303
|
+
var import_zod_openapi = require("zod-openapi");
|
304
|
+
(0, import_zod_openapi.extendZodWithOpenApi)(import_zod.z);
|
305
|
+
var Conditional = import_zod.z.custom((val) => typeof val === "object" && val !== null).openapi({
|
306
|
+
description: "JSON schema conditional configuration",
|
307
|
+
ref: "Conditional"
|
308
|
+
});
|
256
309
|
var ConditionalType = {
|
257
310
|
SHOW: "SHOW",
|
258
311
|
ENABLE: "ENABLE",
|
@@ -289,7 +342,10 @@ var FieldConditional = import_zod.z.discriminatedUnion("type", [
|
|
289
342
|
EnableConditional,
|
290
343
|
// Field output can be shown / hidden on the review page
|
291
344
|
DisplayOnReviewConditional
|
292
|
-
])
|
345
|
+
]).openapi({
|
346
|
+
description: "Field conditional configuration",
|
347
|
+
ref: "FieldConditional"
|
348
|
+
});
|
293
349
|
|
294
350
|
// ../commons/src/events/PageConfig.ts
|
295
351
|
var import_zod6 = require("zod");
|
@@ -299,6 +355,8 @@ var import_zod5 = require("zod");
|
|
299
355
|
|
300
356
|
// ../commons/src/events/TranslationConfig.ts
|
301
357
|
var import_zod2 = require("zod");
|
358
|
+
var import_zod_openapi2 = require("zod-openapi");
|
359
|
+
(0, import_zod_openapi2.extendZodWithOpenApi)(import_zod2.z);
|
302
360
|
var TranslationConfig = import_zod2.z.object({
|
303
361
|
id: import_zod2.z.string().describe(
|
304
362
|
"The identifier of the translation referred in translation CSV files"
|
@@ -307,6 +365,9 @@ var TranslationConfig = import_zod2.z.object({
|
|
307
365
|
description: import_zod2.z.string().describe(
|
308
366
|
"Describe the translation for a translator to be able to identify it."
|
309
367
|
)
|
368
|
+
}).openapi({
|
369
|
+
description: "Translation configuration",
|
370
|
+
ref: "TranslationConfig"
|
310
371
|
});
|
311
372
|
|
312
373
|
// ../commons/src/events/FieldType.ts
|
@@ -317,6 +378,7 @@ var FieldType = {
|
|
317
378
|
TEXTAREA: "TEXTAREA",
|
318
379
|
EMAIL: "EMAIL",
|
319
380
|
DATE: "DATE",
|
381
|
+
DATE_RANGE: "DATE_RANGE",
|
320
382
|
PARAGRAPH: "PARAGRAPH",
|
321
383
|
PAGE_HEADER: "PAGE_HEADER",
|
322
384
|
RADIO_GROUP: "RADIO_GROUP",
|
@@ -336,6 +398,7 @@ var FieldType = {
|
|
336
398
|
};
|
337
399
|
var fieldTypes = Object.values(FieldType);
|
338
400
|
var compositeFieldTypes = [
|
401
|
+
FieldType.DATE_RANGE,
|
339
402
|
FieldType.ADDRESS,
|
340
403
|
FieldType.FILE_WITH_OPTIONS,
|
341
404
|
FieldType.FILE
|
@@ -428,6 +491,8 @@ var FileFieldWithOptionValue = import_zod3.z.array(FileFieldValueWithOption);
|
|
428
491
|
var TextValue = import_zod4.z.string();
|
429
492
|
var NonEmptyTextValue = TextValue.min(1);
|
430
493
|
var DateValue = import_zod4.z.string().date().describe("Date in the format YYYY-MM-DD");
|
494
|
+
var DatetimeValue = import_zod4.z.string().datetime();
|
495
|
+
var DateRangeFieldValue = DateValue.or(import_zod4.z.tuple([DateValue, DateValue]));
|
431
496
|
var EmailValue = import_zod4.z.string().email();
|
432
497
|
var CheckboxFieldValue = import_zod4.z.boolean();
|
433
498
|
var NumberFieldValue = import_zod4.z.number();
|
@@ -435,6 +500,7 @@ var DataFieldValue = import_zod4.z.undefined();
|
|
435
500
|
var FieldValue = import_zod4.z.union([
|
436
501
|
TextValue,
|
437
502
|
DateValue,
|
503
|
+
DateRangeFieldValue,
|
438
504
|
CheckboxFieldValue,
|
439
505
|
NumberFieldValue,
|
440
506
|
FileFieldValue,
|
@@ -447,6 +513,7 @@ var FieldValue = import_zod4.z.union([
|
|
447
513
|
var FieldUpdateValue = import_zod4.z.union([
|
448
514
|
TextValue,
|
449
515
|
DateValue,
|
516
|
+
DateRangeFieldValue,
|
450
517
|
CheckboxFieldValue,
|
451
518
|
NumberFieldValue,
|
452
519
|
FileFieldValue,
|
@@ -458,6 +525,8 @@ var FieldUpdateValue = import_zod4.z.union([
|
|
458
525
|
]);
|
459
526
|
|
460
527
|
// ../commons/src/events/FieldConfig.ts
|
528
|
+
var import_zod_openapi3 = require("zod-openapi");
|
529
|
+
(0, import_zod_openapi3.extendZodWithOpenApi)(import_zod5.z);
|
461
530
|
var FieldId = import_zod5.z.string();
|
462
531
|
var ParentReference = import_zod5.z.object({
|
463
532
|
_fieldId: FieldId.optional()
|
@@ -482,6 +551,7 @@ var BaseField = import_zod5.z.object({
|
|
482
551
|
})
|
483
552
|
).default([]).optional(),
|
484
553
|
label: TranslationConfig,
|
554
|
+
helperText: TranslationConfig.optional(),
|
485
555
|
hideLabel: import_zod5.z.boolean().default(false).optional()
|
486
556
|
});
|
487
557
|
var Divider = BaseField.extend({
|
@@ -554,6 +624,17 @@ var DateField = BaseField.extend({
|
|
554
624
|
).optional()
|
555
625
|
}).optional()
|
556
626
|
}).describe("A single date input (dd-mm-YYYY)");
|
627
|
+
var DateRangeField = BaseField.extend({
|
628
|
+
type: import_zod5.z.literal(FieldType.DATE_RANGE),
|
629
|
+
defaultValue: DateRangeFieldValue.optional(),
|
630
|
+
configuration: import_zod5.z.object({
|
631
|
+
notice: TranslationConfig.describe(
|
632
|
+
"Text to display above the date input"
|
633
|
+
).optional()
|
634
|
+
}).optional()
|
635
|
+
}).describe(
|
636
|
+
"A date range input ({ rangeStart: dd-mm-YYYY, rangeEnd: dd-mm-YYYY })"
|
637
|
+
);
|
557
638
|
var HtmlFontVariant = import_zod5.z.enum([
|
558
639
|
"reg12",
|
559
640
|
"reg14",
|
@@ -693,6 +774,7 @@ var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
|
693
774
|
NumberField,
|
694
775
|
TextAreaField,
|
695
776
|
DateField,
|
777
|
+
DateRangeField,
|
696
778
|
Paragraph,
|
697
779
|
RadioGroup,
|
698
780
|
BulletList,
|
@@ -710,9 +792,14 @@ var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
|
710
792
|
EmailField,
|
711
793
|
FileUploadWithOptions,
|
712
794
|
DataField
|
713
|
-
])
|
795
|
+
]).openapi({
|
796
|
+
description: "Form field configuration",
|
797
|
+
ref: "FieldConfig"
|
798
|
+
});
|
714
799
|
|
715
800
|
// ../commons/src/events/PageConfig.ts
|
801
|
+
var import_zod_openapi4 = require("zod-openapi");
|
802
|
+
(0, import_zod_openapi4.extendZodWithOpenApi)(import_zod6.z);
|
716
803
|
var PageTypes = import_zod6.z.enum(["FORM", "VERIFICATION"]);
|
717
804
|
var PageConfigBase = import_zod6.z.object({
|
718
805
|
id: import_zod6.z.string().describe("Unique identifier for the page"),
|
@@ -721,6 +808,9 @@ var PageConfigBase = import_zod6.z.object({
|
|
721
808
|
conditional: Conditional.optional().describe(
|
722
809
|
"Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
|
723
810
|
)
|
811
|
+
}).openapi({
|
812
|
+
description: "Form page configuration",
|
813
|
+
ref: "FormPageConfig"
|
724
814
|
});
|
725
815
|
var FormPageConfig = PageConfigBase.extend({
|
726
816
|
type: import_zod6.z.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
|
@@ -734,7 +824,10 @@ var VerificationActionConfig = import_zod6.z.object({
|
|
734
824
|
body: TranslationConfig
|
735
825
|
})
|
736
826
|
})
|
737
|
-
}).describe("Actions available on the verification page")
|
827
|
+
}).describe("Actions available on the verification page").openapi({
|
828
|
+
description: "Verification action configuration",
|
829
|
+
ref: "VerificationActionConfig"
|
830
|
+
});
|
738
831
|
var VerificationPageConfig = FormPageConfig.extend({
|
739
832
|
type: import_zod6.z.literal(PageTypes.enum.VERIFICATION),
|
740
833
|
actions: VerificationActionConfig
|
@@ -834,8 +927,8 @@ var ActionFormConfig = import_zod8.z.object({
|
|
834
927
|
var FormConfig = import_zod8.z.union([DeclarationFormConfig, ActionFormConfig]);
|
835
928
|
|
836
929
|
// ../commons/src/events/ActionConfig.ts
|
837
|
-
var
|
838
|
-
(0,
|
930
|
+
var import_zod_openapi5 = require("zod-openapi");
|
931
|
+
(0, import_zod_openapi5.extendZodWithOpenApi)(import_zod9.z);
|
839
932
|
var ActionConditional2 = import_zod9.z.discriminatedUnion("type", [
|
840
933
|
/** If conditional is defined, the action is shown to the user only if the condition is met */
|
841
934
|
ShowConditional,
|
@@ -851,6 +944,12 @@ var ActionConfigBase = import_zod9.z.object({
|
|
851
944
|
conditionals: import_zod9.z.array(ActionConditional2).optional().default([]),
|
852
945
|
draft: import_zod9.z.boolean().optional()
|
853
946
|
});
|
947
|
+
var ReadActionConfig = ActionConfigBase.merge(
|
948
|
+
import_zod9.z.object({
|
949
|
+
type: import_zod9.z.literal(ActionType.READ),
|
950
|
+
review: DeclarationReviewConfig
|
951
|
+
})
|
952
|
+
);
|
854
953
|
var DeclareConfig = ActionConfigBase.merge(
|
855
954
|
import_zod9.z.object({
|
856
955
|
type: import_zod9.z.literal(ActionType.DECLARE),
|
@@ -917,6 +1016,7 @@ var ActionConfig = import_zod9.z.discriminatedUnion("type", [
|
|
917
1016
|
* OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
|
918
1017
|
* and treat them as "models" instead of duplicating the data structure in each endpoint.
|
919
1018
|
*/
|
1019
|
+
ReadActionConfig.openapi({ ref: "ReadActionConfig" }),
|
920
1020
|
DeclareConfig.openapi({ ref: "DeclareActionConfig" }),
|
921
1021
|
ValidateConfig.openapi({ ref: "ValidateActionConfig" }),
|
922
1022
|
RejectDeclarationConfig.openapi({ ref: "RejectDeclarationActionConfig" }),
|
@@ -974,12 +1074,12 @@ var LanguageConfig = import_zod11.z.object({
|
|
974
1074
|
});
|
975
1075
|
|
976
1076
|
// ../commons/src/events/EventConfig.ts
|
977
|
-
var
|
1077
|
+
var import_zod18 = require("zod");
|
978
1078
|
|
979
1079
|
// ../commons/src/events/DeduplicationConfig.ts
|
980
1080
|
var import_zod12 = require("zod");
|
981
|
-
var
|
982
|
-
(0,
|
1081
|
+
var import_zod_openapi6 = require("zod-openapi");
|
1082
|
+
(0, import_zod_openapi6.extendZodWithOpenApi)(import_zod12.z);
|
983
1083
|
var FieldReference = import_zod12.z.string();
|
984
1084
|
var Matcher = import_zod12.z.object({
|
985
1085
|
fieldId: import_zod12.z.string(),
|
@@ -1056,7 +1156,10 @@ var BaseField2 = import_zod13.z.object({
|
|
1056
1156
|
conditionals: import_zod13.z.array(ShowConditional).default([]).optional()
|
1057
1157
|
});
|
1058
1158
|
var ReferenceField = BaseField2.extend({
|
1059
|
-
fieldId: import_zod13.z.string()
|
1159
|
+
fieldId: import_zod13.z.string(),
|
1160
|
+
label: TranslationConfig.optional().describe(
|
1161
|
+
"By default, the configured field's label is used. This can be overridden by providing a custom label."
|
1162
|
+
)
|
1060
1163
|
}).describe("Field directly referencing event data with field id");
|
1061
1164
|
var Field = BaseField2.extend({
|
1062
1165
|
id: import_zod13.z.string().describe("Id of summary field"),
|
@@ -1072,18 +1175,63 @@ var SummaryConfig = import_zod13.z.object({
|
|
1072
1175
|
|
1073
1176
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
1074
1177
|
var import_zod14 = require("zod");
|
1075
|
-
var MatchType = import_zod14.z.enum(["
|
1178
|
+
var MatchType = import_zod14.z.enum(["fuzzy", "exact", "range"]);
|
1076
1179
|
var BaseField3 = import_zod14.z.object({
|
1077
1180
|
config: import_zod14.z.object({
|
1078
1181
|
type: MatchType.describe("Determines the type of field")
|
1079
1182
|
}),
|
1080
|
-
options: import_zod14.z.array(SelectOption).optional()
|
1183
|
+
options: import_zod14.z.array(SelectOption).optional(),
|
1184
|
+
searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
|
1185
|
+
`
|
1186
|
+
This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
|
1187
|
+
when rendering search parameter labels \u2014 for example, in the search results page to indicate which fields were used in the search.
|
1188
|
+
|
1189
|
+
For example, a field config like { id: "child.firstname", label: { defaultMessage: "First Name(s)" } } would render as "First Name(s)" by default.
|
1190
|
+
|
1191
|
+
A field config like { id: "mother.firstname", label: { defaultMessage: "First Name(s)" } } would also render as "First Name(s)" by default.
|
1192
|
+
|
1193
|
+
So, if both child.firstname and mother.firstname are used in a search, the resulting search criteria labels would be "First Name(s)", "First Name(s)",
|
1194
|
+
which is ambiguous.
|
1195
|
+
|
1196
|
+
Now, if we treat the field ID prefix as a label (e.g., "applicant.firstname" \u2192 "Applicant"), and the field label is already
|
1197
|
+
descriptive \u2014 like { id: "applicant.firstname", label: { defaultMessage: "Applicant's First Name" } } \u2014 then the resulting
|
1198
|
+
label would be "Applicant Applicant's First Name", which is redundant and awkward.
|
1199
|
+
|
1200
|
+
By setting searchCriteriaLabelPrefix to a translation config object, we can explicitly define the desired prefix
|
1201
|
+
in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
|
1202
|
+
`
|
1203
|
+
),
|
1204
|
+
conditionals: import_zod14.z.array(FieldConditional).default([]).optional().describe(
|
1205
|
+
`
|
1206
|
+
In advanced search, we sometimes need to override the default field visibility conditionals.
|
1207
|
+
|
1208
|
+
For example, Informant fields in the declaration form may have conditional logic
|
1209
|
+
that hides them based on other field values. Since the advanced search form reuses
|
1210
|
+
the declaration form config, those same conditionals would apply by default.
|
1211
|
+
|
1212
|
+
However, in advanced search we often want to make all Informant fields searchable,
|
1213
|
+
regardless of their original visibility logic. To do this, we explicitly set their
|
1214
|
+
'conditionals' to an empty array ('[]') in the search config. This ensures they
|
1215
|
+
are always rendered in the advanced search form.
|
1216
|
+
`
|
1217
|
+
)
|
1081
1218
|
});
|
1219
|
+
var SearchQueryParams = import_zod14.z.object({
|
1220
|
+
eventType: import_zod14.z.string().optional().describe(
|
1221
|
+
"Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
|
1222
|
+
)
|
1223
|
+
}).catchall(FieldValue);
|
1082
1224
|
var FieldConfigSchema = BaseField3.extend({
|
1083
1225
|
fieldId: import_zod14.z.string(),
|
1084
1226
|
fieldType: import_zod14.z.literal("field")
|
1085
1227
|
});
|
1086
|
-
var EventFieldId = import_zod14.z.enum([
|
1228
|
+
var EventFieldId = import_zod14.z.enum([
|
1229
|
+
"trackingId",
|
1230
|
+
"status",
|
1231
|
+
"legalStatus.REGISTERED.createdAt",
|
1232
|
+
"legalStatus.REGISTERED.createdAtLocation",
|
1233
|
+
"updatedAt"
|
1234
|
+
]);
|
1087
1235
|
var EventFieldConfigSchema = BaseField3.extend({
|
1088
1236
|
fieldId: EventFieldId,
|
1089
1237
|
fieldType: import_zod14.z.literal("event")
|
@@ -1100,13 +1248,182 @@ var AdvancedSearchConfig = import_zod14.z.object({
|
|
1100
1248
|
// ../commons/src/events/utils.ts
|
1101
1249
|
var import_lodash = require("lodash");
|
1102
1250
|
|
1251
|
+
// ../commons/src/events/ActionDocument.ts
|
1252
|
+
var import_zod16 = require("zod");
|
1253
|
+
var import_zod_openapi7 = require("zod-openapi");
|
1254
|
+
|
1255
|
+
// ../commons/src/uuid.ts
|
1256
|
+
var import_uuid = require("uuid");
|
1257
|
+
var import_zod15 = require("zod");
|
1258
|
+
var UUID = import_zod15.z.string().uuid().brand("UUID");
|
1259
|
+
function getUUID() {
|
1260
|
+
return (0, import_uuid.v4)();
|
1261
|
+
}
|
1262
|
+
|
1263
|
+
// ../commons/src/events/CreatedAtLocation.ts
|
1264
|
+
var CreatedAtLocation = UUID.nullish();
|
1265
|
+
|
1266
|
+
// ../commons/src/events/ActionDocument.ts
|
1267
|
+
(0, import_zod_openapi7.extendZodWithOpenApi)(import_zod16.z);
|
1268
|
+
var ActionUpdate = import_zod16.z.record(import_zod16.z.string(), FieldUpdateValue);
|
1269
|
+
var EventState = import_zod16.z.record(import_zod16.z.string(), FieldValue);
|
1270
|
+
var ActionStatus = {
|
1271
|
+
Requested: "Requested",
|
1272
|
+
Accepted: "Accepted",
|
1273
|
+
Rejected: "Rejected"
|
1274
|
+
};
|
1275
|
+
var ActionBase = import_zod16.z.object({
|
1276
|
+
id: import_zod16.z.string(),
|
1277
|
+
transactionId: import_zod16.z.string(),
|
1278
|
+
createdAt: import_zod16.z.string().datetime(),
|
1279
|
+
createdBy: import_zod16.z.string(),
|
1280
|
+
createdByRole: import_zod16.z.string(),
|
1281
|
+
createdBySignature: import_zod16.z.string().nullish().describe("URL to Signature file of the user who created the action"),
|
1282
|
+
createdAtLocation: CreatedAtLocation,
|
1283
|
+
declaration: ActionUpdate,
|
1284
|
+
annotation: ActionUpdate.optional().nullable(),
|
1285
|
+
status: import_zod16.z.enum([
|
1286
|
+
ActionStatus.Requested,
|
1287
|
+
ActionStatus.Accepted,
|
1288
|
+
ActionStatus.Rejected
|
1289
|
+
]),
|
1290
|
+
// If the action is an asynchronous confirmation for another action, we will save the original action id here.
|
1291
|
+
originalActionId: UUID.optional().nullable()
|
1292
|
+
});
|
1293
|
+
var AssignedAction = ActionBase.merge(
|
1294
|
+
import_zod16.z.object({
|
1295
|
+
type: import_zod16.z.literal(ActionType.ASSIGN),
|
1296
|
+
assignedTo: import_zod16.z.string()
|
1297
|
+
})
|
1298
|
+
);
|
1299
|
+
var UnassignedAction = ActionBase.merge(
|
1300
|
+
import_zod16.z.object({
|
1301
|
+
type: import_zod16.z.literal(ActionType.UNASSIGN),
|
1302
|
+
assignedTo: import_zod16.z.literal(null)
|
1303
|
+
})
|
1304
|
+
);
|
1305
|
+
var RegisterAction = ActionBase.merge(
|
1306
|
+
import_zod16.z.object({
|
1307
|
+
type: import_zod16.z.literal(ActionType.REGISTER),
|
1308
|
+
registrationNumber: import_zod16.z.string().optional()
|
1309
|
+
})
|
1310
|
+
);
|
1311
|
+
var DeclareAction = ActionBase.merge(
|
1312
|
+
import_zod16.z.object({
|
1313
|
+
type: import_zod16.z.literal(ActionType.DECLARE)
|
1314
|
+
})
|
1315
|
+
);
|
1316
|
+
var ValidateAction = ActionBase.merge(
|
1317
|
+
import_zod16.z.object({
|
1318
|
+
type: import_zod16.z.literal(ActionType.VALIDATE)
|
1319
|
+
})
|
1320
|
+
);
|
1321
|
+
var RejectionReason = import_zod16.z.object({
|
1322
|
+
message: import_zod16.z.string().min(1, { message: "Message cannot be empty" }).describe("Message describing reason for rejection or archiving"),
|
1323
|
+
isDuplicate: import_zod16.z.boolean().optional().describe("If a declaration is duplicated")
|
1324
|
+
});
|
1325
|
+
var RejectAction = ActionBase.merge(
|
1326
|
+
import_zod16.z.object({
|
1327
|
+
type: import_zod16.z.literal(ActionType.REJECT),
|
1328
|
+
reason: RejectionReason
|
1329
|
+
})
|
1330
|
+
);
|
1331
|
+
var MarkAsDuplicateAction = ActionBase.merge(
|
1332
|
+
import_zod16.z.object({
|
1333
|
+
type: import_zod16.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1334
|
+
})
|
1335
|
+
);
|
1336
|
+
var ArchiveAction = ActionBase.merge(
|
1337
|
+
import_zod16.z.object({
|
1338
|
+
type: import_zod16.z.literal(ActionType.ARCHIVE),
|
1339
|
+
reason: RejectionReason
|
1340
|
+
})
|
1341
|
+
);
|
1342
|
+
var CreatedAction = ActionBase.merge(
|
1343
|
+
import_zod16.z.object({
|
1344
|
+
type: import_zod16.z.literal(ActionType.CREATE)
|
1345
|
+
})
|
1346
|
+
);
|
1347
|
+
var NotifiedAction = ActionBase.merge(
|
1348
|
+
import_zod16.z.object({
|
1349
|
+
type: import_zod16.z.literal(ActionType.NOTIFY)
|
1350
|
+
})
|
1351
|
+
);
|
1352
|
+
var PrintCertificateAction = ActionBase.merge(
|
1353
|
+
import_zod16.z.object({
|
1354
|
+
type: import_zod16.z.literal(ActionType.PRINT_CERTIFICATE)
|
1355
|
+
})
|
1356
|
+
);
|
1357
|
+
var RequestedCorrectionAction = ActionBase.merge(
|
1358
|
+
import_zod16.z.object({
|
1359
|
+
type: import_zod16.z.literal(ActionType.REQUEST_CORRECTION)
|
1360
|
+
})
|
1361
|
+
);
|
1362
|
+
var ApprovedCorrectionAction = ActionBase.merge(
|
1363
|
+
import_zod16.z.object({
|
1364
|
+
type: import_zod16.z.literal(ActionType.APPROVE_CORRECTION),
|
1365
|
+
requestId: import_zod16.z.string()
|
1366
|
+
})
|
1367
|
+
);
|
1368
|
+
var RejectedCorrectionAction = ActionBase.merge(
|
1369
|
+
import_zod16.z.object({
|
1370
|
+
type: import_zod16.z.literal(ActionType.REJECT_CORRECTION),
|
1371
|
+
requestId: import_zod16.z.string()
|
1372
|
+
})
|
1373
|
+
);
|
1374
|
+
var ReadAction = ActionBase.merge(
|
1375
|
+
import_zod16.z.object({
|
1376
|
+
type: import_zod16.z.literal(ActionType.READ)
|
1377
|
+
})
|
1378
|
+
);
|
1379
|
+
var ActionDocument = import_zod16.z.discriminatedUnion("type", [
|
1380
|
+
CreatedAction.openapi({ ref: "CreatedAction" }),
|
1381
|
+
ValidateAction.openapi({ ref: "ValidateAction" }),
|
1382
|
+
RejectAction.openapi({ ref: "RejectAction" }),
|
1383
|
+
MarkAsDuplicateAction.openapi({ ref: "MarkAsDuplicateAction" }),
|
1384
|
+
ArchiveAction.openapi({ ref: "ArchiveAction" }),
|
1385
|
+
NotifiedAction.openapi({ ref: "NotifiedAction" }),
|
1386
|
+
RegisterAction.openapi({ ref: "RegisterAction" }),
|
1387
|
+
DeclareAction.openapi({ ref: "DeclareAction" }),
|
1388
|
+
AssignedAction.openapi({ ref: "AssignedAction" }),
|
1389
|
+
RequestedCorrectionAction.openapi({ ref: "RequestedCorrectionAction" }),
|
1390
|
+
ApprovedCorrectionAction.openapi({ ref: "ApprovedCorrectionAction" }),
|
1391
|
+
RejectedCorrectionAction.openapi({ ref: "RejectedCorrectionAction" }),
|
1392
|
+
UnassignedAction.openapi({ ref: "UnassignedAction" }),
|
1393
|
+
PrintCertificateAction.openapi({ ref: "PrintCertificateAction" }),
|
1394
|
+
ReadAction.openapi({ ref: "ReadAction" })
|
1395
|
+
]).openapi({
|
1396
|
+
ref: "ActionDocument"
|
1397
|
+
});
|
1398
|
+
var AsyncRejectActionDocument = ActionBase.omit({
|
1399
|
+
declaration: true,
|
1400
|
+
annotation: true
|
1401
|
+
}).merge(
|
1402
|
+
import_zod16.z.object({
|
1403
|
+
type: import_zod16.z.enum(ConfirmableActions),
|
1404
|
+
status: import_zod16.z.literal(ActionStatus.Rejected)
|
1405
|
+
})
|
1406
|
+
);
|
1407
|
+
var Action = import_zod16.z.union([ActionDocument, AsyncRejectActionDocument]);
|
1408
|
+
var ResolvedUser = import_zod16.z.object({
|
1409
|
+
id: import_zod16.z.string(),
|
1410
|
+
role: import_zod16.z.string(),
|
1411
|
+
name: import_zod16.z.array(
|
1412
|
+
import_zod16.z.object({
|
1413
|
+
use: import_zod16.z.string(),
|
1414
|
+
given: import_zod16.z.array(import_zod16.z.string()),
|
1415
|
+
family: import_zod16.z.string()
|
1416
|
+
})
|
1417
|
+
)
|
1418
|
+
});
|
1419
|
+
|
1103
1420
|
// ../commons/src/conditionals/validate.ts
|
1104
1421
|
var import_ajv = __toESM(require("ajv"));
|
1105
1422
|
var import_ajv_formats = __toESM(require("ajv-formats"));
|
1106
1423
|
var import_date_fns = require("date-fns");
|
1107
1424
|
|
1108
1425
|
// ../commons/src/events/FieldTypeMapping.ts
|
1109
|
-
var
|
1426
|
+
var import_zod17 = require("zod");
|
1110
1427
|
function mapFieldTypeToZod(type, required) {
|
1111
1428
|
let schema;
|
1112
1429
|
switch (type) {
|
@@ -1116,6 +1433,9 @@ function mapFieldTypeToZod(type, required) {
|
|
1116
1433
|
case FieldType.EMAIL:
|
1117
1434
|
schema = EmailValue;
|
1118
1435
|
break;
|
1436
|
+
case FieldType.DATE_RANGE:
|
1437
|
+
schema = DateRangeFieldValue;
|
1438
|
+
break;
|
1119
1439
|
case FieldType.TEXT:
|
1120
1440
|
case FieldType.TEXTAREA:
|
1121
1441
|
case FieldType.DIVIDER:
|
@@ -1158,7 +1478,7 @@ function createValidationSchema(config) {
|
|
1158
1478
|
for (const field2 of config) {
|
1159
1479
|
shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
|
1160
1480
|
}
|
1161
|
-
return
|
1481
|
+
return import_zod17.z.object(shape);
|
1162
1482
|
}
|
1163
1483
|
function mapFieldTypeToMockValue(field2, i) {
|
1164
1484
|
switch (field2.type) {
|
@@ -1196,6 +1516,8 @@ function mapFieldTypeToMockValue(field2, i) {
|
|
1196
1516
|
};
|
1197
1517
|
case FieldType.DATE:
|
1198
1518
|
return "2021-01-01";
|
1519
|
+
case FieldType.DATE_RANGE:
|
1520
|
+
return ["2021-01-01", "2021-01-02"];
|
1199
1521
|
case FieldType.CHECKBOX:
|
1200
1522
|
return true;
|
1201
1523
|
case FieldType.FILE:
|
@@ -1230,6 +1552,7 @@ function mapFieldTypeToEmptyValue(field2) {
|
|
1230
1552
|
case FieldType.EMAIL:
|
1231
1553
|
case FieldType.DATE:
|
1232
1554
|
case FieldType.CHECKBOX:
|
1555
|
+
case FieldType.DATE_RANGE:
|
1233
1556
|
case FieldType.DATA:
|
1234
1557
|
return null;
|
1235
1558
|
case FieldType.ADDRESS:
|
@@ -1262,6 +1585,9 @@ var isParagraphFieldType = (field2) => {
|
|
1262
1585
|
var isDateFieldType = (field2) => {
|
1263
1586
|
return field2.config.type === FieldType.DATE;
|
1264
1587
|
};
|
1588
|
+
var isDateRangeFieldType = (field2) => {
|
1589
|
+
return field2.config.type === FieldType.DATE_RANGE;
|
1590
|
+
};
|
1265
1591
|
var isPageHeaderFieldType = (field2) => {
|
1266
1592
|
return field2.config.type === FieldType.PAGE_HEADER;
|
1267
1593
|
};
|
@@ -1498,12 +1824,6 @@ function runFieldValidations({
|
|
1498
1824
|
};
|
1499
1825
|
}
|
1500
1826
|
|
1501
|
-
// ../commons/src/uuid.ts
|
1502
|
-
var import_uuid = require("uuid");
|
1503
|
-
function getUUID() {
|
1504
|
-
return (0, import_uuid.v4)();
|
1505
|
-
}
|
1506
|
-
|
1507
1827
|
// ../commons/src/utils.ts
|
1508
1828
|
function getOrThrow(x, message) {
|
1509
1829
|
if (x === void 0 || x === null) {
|
@@ -1604,7 +1924,10 @@ function createEmptyDraft(eventId, draftId, actionType) {
|
|
1604
1924
|
annotation: {},
|
1605
1925
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
1606
1926
|
createdBy: "@todo",
|
1607
|
-
createdAtLocation: "
|
1927
|
+
createdAtLocation: "00000000-0000-0000-0000-000000000000",
|
1928
|
+
status: ActionStatus.Accepted,
|
1929
|
+
transactionId: "@todo",
|
1930
|
+
createdByRole: "@todo"
|
1608
1931
|
}
|
1609
1932
|
};
|
1610
1933
|
}
|
@@ -1676,25 +1999,43 @@ var findAllFields = (config) => {
|
|
1676
1999
|
...getAllAnnotationFields(config)
|
1677
2000
|
]);
|
1678
2001
|
};
|
2002
|
+
function getMixedPath(obj, path, defaultValue) {
|
2003
|
+
const parts = path.split(".");
|
2004
|
+
const resolve = (current, segments) => {
|
2005
|
+
if (current == null || segments.length === 0) {
|
2006
|
+
return current;
|
2007
|
+
}
|
2008
|
+
for (let i = segments.length; i > 0; i--) {
|
2009
|
+
const compoundKey = segments.slice(0, i).join(".");
|
2010
|
+
if ((0, import_lodash.has)(current, compoundKey)) {
|
2011
|
+
const next = (0, import_lodash.get)(current, compoundKey);
|
2012
|
+
return resolve(next, segments.slice(i));
|
2013
|
+
}
|
2014
|
+
}
|
2015
|
+
return void 0;
|
2016
|
+
};
|
2017
|
+
const result = resolve(obj, parts);
|
2018
|
+
return (0, import_lodash.isNil)(result) ? defaultValue : result;
|
2019
|
+
}
|
1679
2020
|
|
1680
2021
|
// ../commons/src/events/EventConfig.ts
|
1681
|
-
var
|
1682
|
-
(0,
|
1683
|
-
var EventConfig =
|
1684
|
-
id:
|
2022
|
+
var import_zod_openapi8 = require("zod-openapi");
|
2023
|
+
(0, import_zod_openapi8.extendZodWithOpenApi)(import_zod18.z);
|
2024
|
+
var EventConfig = import_zod18.z.object({
|
2025
|
+
id: import_zod18.z.string().describe(
|
1685
2026
|
'A machine-readable identifier for the event, e.g. "birth" or "death"'
|
1686
2027
|
),
|
1687
|
-
dateOfEvent:
|
2028
|
+
dateOfEvent: import_zod18.z.object({ fieldId: import_zod18.z.string() }).optional(),
|
1688
2029
|
title: TranslationConfig,
|
1689
2030
|
fallbackTitle: TranslationConfig.optional().describe(
|
1690
2031
|
"This is a fallback title if actual title resolves to empty string"
|
1691
2032
|
),
|
1692
2033
|
summary: SummaryConfig,
|
1693
2034
|
label: TranslationConfig,
|
1694
|
-
actions:
|
2035
|
+
actions: import_zod18.z.array(ActionConfig),
|
1695
2036
|
declaration: DeclarationFormConfig,
|
1696
|
-
deduplication:
|
1697
|
-
advancedSearch:
|
2037
|
+
deduplication: import_zod18.z.array(DeduplicationConfig).optional().default([]),
|
2038
|
+
advancedSearch: import_zod18.z.array(AdvancedSearchConfig).optional().default([])
|
1698
2039
|
}).superRefine((event2, ctx) => {
|
1699
2040
|
const allFields = findAllFields(event2);
|
1700
2041
|
const fieldIds = allFields.map((field2) => field2.id);
|
@@ -1756,322 +2097,398 @@ var definePage = (page) => PageConfig.parse(page);
|
|
1756
2097
|
var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
|
1757
2098
|
|
1758
2099
|
// ../commons/src/events/WorkqueueConfig.ts
|
1759
|
-
var
|
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
|
-
|
1781
|
-
// ../commons/src/events/Draft.ts
|
1782
|
-
var import_zod20 = require("zod");
|
2100
|
+
var import_zod25 = require("zod");
|
1783
2101
|
|
1784
|
-
// ../commons/src/events/
|
1785
|
-
var
|
1786
|
-
var
|
1787
|
-
|
1788
|
-
|
1789
|
-
|
1790
|
-
|
1791
|
-
|
1792
|
-
|
1793
|
-
|
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(),
|
1800
|
-
declaration: ActionUpdate,
|
1801
|
-
annotation: ActionUpdate.optional(),
|
1802
|
-
createdAtLocation: import_zod18.z.string().optional(),
|
1803
|
-
updatedAtLocation: import_zod18.z.string().optional(),
|
1804
|
-
status: import_zod18.z.enum([
|
1805
|
-
ActionStatus.Requested,
|
1806
|
-
ActionStatus.Accepted,
|
1807
|
-
ActionStatus.Rejected
|
1808
|
-
]),
|
1809
|
-
// If the action is an asynchronous confirmation for another action, we will save the original action id here.
|
1810
|
-
originalActionId: import_zod18.z.string().optional()
|
2102
|
+
// ../commons/src/events/serializers/user/serializer.ts
|
2103
|
+
var import_zod19 = require("zod");
|
2104
|
+
var SerializedUserField = import_zod19.z.object({
|
2105
|
+
$userField: import_zod19.z.enum([
|
2106
|
+
"id",
|
2107
|
+
"name",
|
2108
|
+
"role",
|
2109
|
+
"signatureFilename",
|
2110
|
+
"primaryOfficeId"
|
2111
|
+
])
|
1811
2112
|
});
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
1816
|
-
|
1817
|
-
|
1818
|
-
|
1819
|
-
|
1820
|
-
|
1821
|
-
|
1822
|
-
|
1823
|
-
|
1824
|
-
|
1825
|
-
|
1826
|
-
|
1827
|
-
|
2113
|
+
function userSerializer(userField) {
|
2114
|
+
return {
|
2115
|
+
$userField: userField
|
2116
|
+
};
|
2117
|
+
}
|
2118
|
+
|
2119
|
+
// ../commons/src/conditionals/conditionals.ts
|
2120
|
+
function defineConditional(schema) {
|
2121
|
+
return schema;
|
2122
|
+
}
|
2123
|
+
function defineFormConditional(schema) {
|
2124
|
+
const schemaWithForm = {
|
2125
|
+
type: "object",
|
2126
|
+
properties: {
|
2127
|
+
$form: schema
|
2128
|
+
},
|
2129
|
+
required: ["$form"]
|
2130
|
+
};
|
2131
|
+
return defineConditional(schemaWithForm);
|
2132
|
+
}
|
2133
|
+
function alwaysTrue() {
|
2134
|
+
return {};
|
2135
|
+
}
|
2136
|
+
function and(...conditions) {
|
2137
|
+
return defineConditional({
|
2138
|
+
type: "object",
|
2139
|
+
allOf: conditions,
|
2140
|
+
required: []
|
2141
|
+
});
|
2142
|
+
}
|
2143
|
+
function or(...conditions) {
|
2144
|
+
return defineConditional({
|
2145
|
+
type: "object",
|
2146
|
+
anyOf: conditions,
|
2147
|
+
required: []
|
2148
|
+
});
|
2149
|
+
}
|
2150
|
+
function not(condition) {
|
2151
|
+
return defineConditional({
|
2152
|
+
type: "object",
|
2153
|
+
not: condition,
|
2154
|
+
required: []
|
2155
|
+
});
|
2156
|
+
}
|
2157
|
+
function never() {
|
2158
|
+
return not(alwaysTrue());
|
2159
|
+
}
|
2160
|
+
var user = Object.assign(userSerializer, {
|
2161
|
+
hasScope: (scope) => defineConditional({
|
2162
|
+
type: "object",
|
2163
|
+
properties: {
|
2164
|
+
$user: {
|
2165
|
+
type: "object",
|
2166
|
+
required: ["scope"],
|
2167
|
+
properties: {
|
2168
|
+
scope: {
|
2169
|
+
type: "array",
|
2170
|
+
contains: {
|
2171
|
+
type: "string",
|
2172
|
+
const: scope
|
2173
|
+
}
|
2174
|
+
}
|
2175
|
+
}
|
2176
|
+
}
|
2177
|
+
},
|
2178
|
+
required: ["$user"]
|
1828
2179
|
})
|
1829
|
-
);
|
1830
|
-
var DeclareAction = ActionBase.merge(
|
1831
|
-
import_zod18.z.object({
|
1832
|
-
type: import_zod18.z.literal(ActionType.DECLARE)
|
1833
|
-
})
|
1834
|
-
);
|
1835
|
-
var ValidateAction = ActionBase.merge(
|
1836
|
-
import_zod18.z.object({
|
1837
|
-
type: import_zod18.z.literal(ActionType.VALIDATE)
|
1838
|
-
})
|
1839
|
-
);
|
1840
|
-
var RejectAction = ActionBase.merge(
|
1841
|
-
import_zod18.z.object({
|
1842
|
-
type: import_zod18.z.literal(ActionType.REJECT)
|
1843
|
-
})
|
1844
|
-
);
|
1845
|
-
var MarkAsDuplicateAction = ActionBase.merge(
|
1846
|
-
import_zod18.z.object({
|
1847
|
-
type: import_zod18.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1848
|
-
})
|
1849
|
-
);
|
1850
|
-
var ArchiveAction = ActionBase.merge(
|
1851
|
-
import_zod18.z.object({
|
1852
|
-
type: import_zod18.z.literal(ActionType.ARCHIVE)
|
1853
|
-
})
|
1854
|
-
);
|
1855
|
-
var CreatedAction = ActionBase.merge(
|
1856
|
-
import_zod18.z.object({
|
1857
|
-
type: import_zod18.z.literal(ActionType.CREATE)
|
1858
|
-
})
|
1859
|
-
);
|
1860
|
-
var NotifiedAction = ActionBase.merge(
|
1861
|
-
import_zod18.z.object({
|
1862
|
-
type: import_zod18.z.literal(ActionType.NOTIFY)
|
1863
|
-
})
|
1864
|
-
);
|
1865
|
-
var PrintCertificateAction = ActionBase.merge(
|
1866
|
-
import_zod18.z.object({
|
1867
|
-
type: import_zod18.z.literal(ActionType.PRINT_CERTIFICATE)
|
1868
|
-
})
|
1869
|
-
);
|
1870
|
-
var RequestedCorrectionAction = ActionBase.merge(
|
1871
|
-
import_zod18.z.object({
|
1872
|
-
type: import_zod18.z.literal(ActionType.REQUEST_CORRECTION)
|
1873
|
-
})
|
1874
|
-
);
|
1875
|
-
var ApprovedCorrectionAction = ActionBase.merge(
|
1876
|
-
import_zod18.z.object({
|
1877
|
-
type: import_zod18.z.literal(ActionType.APPROVE_CORRECTION),
|
1878
|
-
requestId: import_zod18.z.string()
|
1879
|
-
})
|
1880
|
-
);
|
1881
|
-
var RejectedCorrectionAction = ActionBase.merge(
|
1882
|
-
import_zod18.z.object({
|
1883
|
-
type: import_zod18.z.literal(ActionType.REJECT_CORRECTION),
|
1884
|
-
requestId: import_zod18.z.string()
|
1885
|
-
})
|
1886
|
-
);
|
1887
|
-
var ReadAction = ActionBase.merge(
|
1888
|
-
import_zod18.z.object({
|
1889
|
-
type: import_zod18.z.literal(ActionType.READ)
|
1890
|
-
})
|
1891
|
-
);
|
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
2180
|
});
|
1911
|
-
|
1912
|
-
|
1913
|
-
|
1914
|
-
|
1915
|
-
|
1916
|
-
|
1917
|
-
|
1918
|
-
|
1919
|
-
|
1920
|
-
|
1921
|
-
|
1922
|
-
|
1923
|
-
|
1924
|
-
|
1925
|
-
|
1926
|
-
|
1927
|
-
|
1928
|
-
|
1929
|
-
|
1930
|
-
|
1931
|
-
|
2181
|
+
function createEventConditionals() {
|
2182
|
+
return {
|
2183
|
+
/**
|
2184
|
+
* Checks if the event contains a specific action type.
|
2185
|
+
* @param action - The action type to check for.
|
2186
|
+
*/
|
2187
|
+
hasAction: (action) => defineConditional({
|
2188
|
+
type: "object",
|
2189
|
+
properties: {
|
2190
|
+
$event: {
|
2191
|
+
type: "object",
|
2192
|
+
properties: {
|
2193
|
+
actions: {
|
2194
|
+
type: "array",
|
2195
|
+
contains: {
|
2196
|
+
type: "object",
|
2197
|
+
properties: {
|
2198
|
+
type: {
|
2199
|
+
const: action
|
2200
|
+
}
|
2201
|
+
},
|
2202
|
+
required: ["type"]
|
2203
|
+
}
|
2204
|
+
}
|
2205
|
+
},
|
2206
|
+
required: ["actions"]
|
2207
|
+
}
|
2208
|
+
},
|
2209
|
+
required: ["$event"]
|
1932
2210
|
})
|
1933
|
-
|
1934
|
-
}
|
2211
|
+
};
|
2212
|
+
}
|
2213
|
+
function getDateFromNow(days) {
|
2214
|
+
return new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
|
2215
|
+
}
|
2216
|
+
function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
|
2217
|
+
return {
|
2218
|
+
type: "object",
|
2219
|
+
properties: {
|
2220
|
+
[fieldId]: {
|
2221
|
+
type: "string",
|
2222
|
+
format: "date",
|
2223
|
+
[clause]: { $data: `1/${comparedFieldId}` }
|
2224
|
+
},
|
2225
|
+
[comparedFieldId]: { type: "string", format: "date" }
|
2226
|
+
},
|
2227
|
+
required: [fieldId]
|
2228
|
+
};
|
2229
|
+
}
|
2230
|
+
function isFieldReference(value) {
|
2231
|
+
return typeof value === "object" && value !== null && "_fieldId" in value;
|
2232
|
+
}
|
2233
|
+
function createFieldConditionals(fieldId) {
|
2234
|
+
const getDateRange = (date, clause) => ({
|
2235
|
+
type: "object",
|
2236
|
+
properties: {
|
2237
|
+
[fieldId]: {
|
2238
|
+
type: "string",
|
2239
|
+
format: "date",
|
2240
|
+
[clause]: date
|
2241
|
+
}
|
2242
|
+
},
|
2243
|
+
required: [fieldId]
|
2244
|
+
});
|
2245
|
+
return {
|
2246
|
+
isAfter: () => ({
|
2247
|
+
days: (days) => ({
|
2248
|
+
inPast: () => defineFormConditional(
|
2249
|
+
getDateRange(getDateFromNow(days), "formatMinimum")
|
2250
|
+
),
|
2251
|
+
inFuture: () => defineFormConditional(
|
2252
|
+
getDateRange(getDateFromNow(-days), "formatMinimum")
|
2253
|
+
)
|
2254
|
+
}),
|
2255
|
+
date: (date) => {
|
2256
|
+
if (isFieldReference(date)) {
|
2257
|
+
const comparedFieldId = date._fieldId;
|
2258
|
+
return defineFormConditional(
|
2259
|
+
getDateRangeToFieldReference(
|
2260
|
+
fieldId,
|
2261
|
+
comparedFieldId,
|
2262
|
+
"formatMinimum"
|
2263
|
+
)
|
2264
|
+
);
|
2265
|
+
}
|
2266
|
+
return defineFormConditional(getDateRange(date, "formatMinimum"));
|
2267
|
+
},
|
2268
|
+
now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMinimum"))
|
2269
|
+
}),
|
2270
|
+
isBefore: () => ({
|
2271
|
+
days: (days) => ({
|
2272
|
+
inPast: () => defineFormConditional(
|
2273
|
+
getDateRange(getDateFromNow(days), "formatMaximum")
|
2274
|
+
),
|
2275
|
+
inFuture: () => defineFormConditional(
|
2276
|
+
getDateRange(getDateFromNow(-days), "formatMaximum")
|
2277
|
+
)
|
2278
|
+
}),
|
2279
|
+
date: (date) => {
|
2280
|
+
if (isFieldReference(date)) {
|
2281
|
+
const comparedFieldId = date._fieldId;
|
2282
|
+
return defineFormConditional(
|
2283
|
+
getDateRangeToFieldReference(
|
2284
|
+
fieldId,
|
2285
|
+
comparedFieldId,
|
2286
|
+
"formatMaximum"
|
2287
|
+
)
|
2288
|
+
);
|
2289
|
+
}
|
2290
|
+
return defineFormConditional(getDateRange(date, "formatMaximum"));
|
2291
|
+
},
|
2292
|
+
now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMaximum"))
|
2293
|
+
}),
|
2294
|
+
isEqualTo: (value) => {
|
2295
|
+
if (isFieldReference(value)) {
|
2296
|
+
const comparedFieldId = value._fieldId;
|
2297
|
+
return defineFormConditional({
|
2298
|
+
type: "object",
|
2299
|
+
properties: {
|
2300
|
+
[fieldId]: {
|
2301
|
+
type: ["string", "boolean"],
|
2302
|
+
const: { $data: `1/${comparedFieldId}` }
|
2303
|
+
},
|
2304
|
+
[comparedFieldId]: { type: ["string", "boolean"] }
|
2305
|
+
},
|
2306
|
+
required: [fieldId, comparedFieldId]
|
2307
|
+
});
|
2308
|
+
}
|
2309
|
+
return defineFormConditional({
|
2310
|
+
type: "object",
|
2311
|
+
properties: {
|
2312
|
+
[fieldId]: {
|
2313
|
+
oneOf: [
|
2314
|
+
{ type: "string", const: value },
|
2315
|
+
{ type: "boolean", const: value }
|
2316
|
+
],
|
2317
|
+
const: value
|
2318
|
+
}
|
2319
|
+
},
|
2320
|
+
required: [fieldId]
|
2321
|
+
});
|
2322
|
+
},
|
2323
|
+
/**
|
2324
|
+
* Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
|
2325
|
+
* @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
|
2326
|
+
* @returns whether the field is falsy (undefined, false, null, empty string)
|
2327
|
+
*
|
2328
|
+
* NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
|
2329
|
+
*
|
2330
|
+
*/
|
2331
|
+
isFalsy: () => defineFormConditional({
|
2332
|
+
type: "object",
|
2333
|
+
properties: {
|
2334
|
+
[fieldId]: {
|
2335
|
+
anyOf: [
|
2336
|
+
{ const: "undefined" },
|
2337
|
+
{ const: false },
|
2338
|
+
{ const: null },
|
2339
|
+
{ const: "" }
|
2340
|
+
]
|
2341
|
+
}
|
2342
|
+
},
|
2343
|
+
anyOf: [
|
2344
|
+
{
|
2345
|
+
required: [fieldId]
|
2346
|
+
},
|
2347
|
+
{
|
2348
|
+
not: {
|
2349
|
+
required: [fieldId]
|
2350
|
+
}
|
2351
|
+
}
|
2352
|
+
]
|
2353
|
+
}),
|
2354
|
+
isUndefined: () => defineFormConditional({
|
2355
|
+
type: "object",
|
2356
|
+
properties: {
|
2357
|
+
[fieldId]: {
|
2358
|
+
type: "string",
|
2359
|
+
enum: ["undefined"]
|
2360
|
+
}
|
2361
|
+
},
|
2362
|
+
not: {
|
2363
|
+
required: [fieldId]
|
2364
|
+
}
|
2365
|
+
}),
|
2366
|
+
inArray: (values) => defineFormConditional({
|
2367
|
+
type: "object",
|
2368
|
+
properties: {
|
2369
|
+
[fieldId]: {
|
2370
|
+
type: "string",
|
2371
|
+
enum: values
|
2372
|
+
}
|
2373
|
+
},
|
2374
|
+
required: [fieldId]
|
2375
|
+
}),
|
2376
|
+
isValidEnglishName: () => defineFormConditional({
|
2377
|
+
type: "object",
|
2378
|
+
properties: {
|
2379
|
+
[fieldId]: {
|
2380
|
+
type: "string",
|
2381
|
+
pattern: "^[\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*( [\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*)*$",
|
2382
|
+
description: "Name must contain only letters, numbers, and allowed special characters ('._-). No double spaces."
|
2383
|
+
}
|
2384
|
+
},
|
2385
|
+
required: [fieldId]
|
2386
|
+
}),
|
2387
|
+
/**
|
2388
|
+
* Checks if the field value matches a given regular expression pattern.
|
2389
|
+
* @param pattern - The regular expression pattern to match the field value against.
|
2390
|
+
* @returns A JSONSchema conditional that validates the field value against the pattern.
|
2391
|
+
*/
|
2392
|
+
matches: (pattern) => defineFormConditional({
|
2393
|
+
type: "object",
|
2394
|
+
properties: {
|
2395
|
+
[fieldId]: {
|
2396
|
+
type: "string",
|
2397
|
+
pattern
|
2398
|
+
}
|
2399
|
+
},
|
2400
|
+
required: [fieldId]
|
2401
|
+
}),
|
2402
|
+
isBetween: (min, max) => defineFormConditional({
|
2403
|
+
type: "object",
|
2404
|
+
properties: {
|
2405
|
+
[fieldId]: {
|
2406
|
+
type: "number",
|
2407
|
+
minimum: min,
|
2408
|
+
maximum: max
|
2409
|
+
}
|
2410
|
+
},
|
2411
|
+
required: [fieldId]
|
2412
|
+
}),
|
2413
|
+
getId: () => ({ fieldId })
|
2414
|
+
};
|
2415
|
+
}
|
1935
2416
|
|
1936
|
-
// ../commons/src/
|
1937
|
-
|
1938
|
-
|
1939
|
-
|
1940
|
-
|
1941
|
-
|
1942
|
-
|
1943
|
-
|
1944
|
-
|
1945
|
-
|
1946
|
-
|
1947
|
-
}
|
1948
|
-
|
1949
|
-
|
1950
|
-
|
1951
|
-
|
1952
|
-
|
1953
|
-
)
|
1954
|
-
|
1955
|
-
|
1956
|
-
|
1957
|
-
|
1958
|
-
|
1959
|
-
|
1960
|
-
|
1961
|
-
|
1962
|
-
|
1963
|
-
|
1964
|
-
|
1965
|
-
|
1966
|
-
|
1967
|
-
|
1968
|
-
|
1969
|
-
|
1970
|
-
)
|
1971
|
-
|
1972
|
-
|
1973
|
-
|
1974
|
-
|
1975
|
-
|
1976
|
-
|
1977
|
-
|
1978
|
-
|
1979
|
-
|
1980
|
-
|
1981
|
-
|
1982
|
-
import_zod19.z.object({
|
1983
|
-
type: import_zod19.z.literal(ActionType.REJECT).default(ActionType.REJECT)
|
1984
|
-
})
|
1985
|
-
);
|
1986
|
-
var MarkedAsDuplicateActionInput = BaseActionInput.merge(
|
1987
|
-
import_zod19.z.object({
|
1988
|
-
type: import_zod19.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
|
1989
|
-
})
|
1990
|
-
);
|
1991
|
-
var ArchiveActionInput = BaseActionInput.merge(
|
1992
|
-
import_zod19.z.object({
|
1993
|
-
type: import_zod19.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE)
|
1994
|
-
})
|
1995
|
-
);
|
1996
|
-
var AssignActionInput = BaseActionInput.merge(
|
1997
|
-
import_zod19.z.object({
|
1998
|
-
type: import_zod19.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
|
1999
|
-
assignedTo: import_zod19.z.string()
|
2000
|
-
})
|
2001
|
-
);
|
2002
|
-
var UnassignActionInput = BaseActionInput.merge(
|
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)
|
2006
|
-
})
|
2007
|
-
);
|
2008
|
-
var RequestCorrectionActionInput = BaseActionInput.merge(
|
2009
|
-
import_zod19.z.object({
|
2010
|
-
type: import_zod19.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
2011
|
-
})
|
2012
|
-
);
|
2013
|
-
var RejectCorrectionActionInput = BaseActionInput.merge(
|
2014
|
-
import_zod19.z.object({
|
2015
|
-
requestId: import_zod19.z.string(),
|
2016
|
-
type: import_zod19.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
|
2017
|
-
})
|
2018
|
-
);
|
2019
|
-
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
2020
|
-
import_zod19.z.object({
|
2021
|
-
requestId: import_zod19.z.string(),
|
2022
|
-
type: import_zod19.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
2023
|
-
})
|
2024
|
-
);
|
2025
|
-
var ReadActionInput = BaseActionInput.merge(
|
2026
|
-
import_zod19.z.object({
|
2027
|
-
type: import_zod19.z.literal(ActionType.READ).default(ActionType.READ)
|
2028
|
-
})
|
2029
|
-
);
|
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
|
-
});
|
2417
|
+
// ../commons/src/searchConfigs.ts
|
2418
|
+
function createSearchConfig(baseField) {
|
2419
|
+
return {
|
2420
|
+
/**
|
2421
|
+
* Creates a range configuration for the specified field.
|
2422
|
+
*
|
2423
|
+
* @returns An object containing the field ID and a configuration object with a type of 'range'.
|
2424
|
+
*
|
2425
|
+
* @example event('legalStatus.REGISTERED.createdAt').range()
|
2426
|
+
* // {
|
2427
|
+
* // ...
|
2428
|
+
* // config: { type: 'range' }
|
2429
|
+
* // }
|
2430
|
+
*/
|
2431
|
+
range: () => ({
|
2432
|
+
...baseField,
|
2433
|
+
config: { type: "range" }
|
2434
|
+
}),
|
2435
|
+
/**
|
2436
|
+
* Creates a configuration for exact matching of the specified field.
|
2437
|
+
* @returns An object containing the field ID and a configuration object with a type of 'exact'.
|
2438
|
+
* @example field('dob').exact()
|
2439
|
+
* // {
|
2440
|
+
* // ...
|
2441
|
+
* // config: { type: 'exact' }
|
2442
|
+
* // }
|
2443
|
+
*/
|
2444
|
+
exact: () => ({
|
2445
|
+
...baseField,
|
2446
|
+
config: { type: "exact" }
|
2447
|
+
}),
|
2448
|
+
/**
|
2449
|
+
* Creates a configuration for fuzzy matching of the specified field.
|
2450
|
+
* @returns An object containing the field ID and a configuration object with a type of 'exact'.
|
2451
|
+
* @example field('name').fuzzy()
|
2452
|
+
* // {
|
2453
|
+
* // ...
|
2454
|
+
* // config: { type: 'fuzzy' }
|
2455
|
+
* // }
|
2456
|
+
*/
|
2457
|
+
fuzzy: () => ({
|
2458
|
+
...baseField,
|
2459
|
+
config: { type: "fuzzy" }
|
2460
|
+
})
|
2461
|
+
};
|
2462
|
+
}
|
2058
2463
|
|
2059
|
-
// ../commons/src/
|
2060
|
-
|
2061
|
-
|
2062
|
-
|
2063
|
-
|
2064
|
-
|
2065
|
-
|
2066
|
-
|
2067
|
-
|
2068
|
-
|
2069
|
-
|
2070
|
-
|
2464
|
+
// ../commons/src/event-config/event-configuration.ts
|
2465
|
+
function createEventFieldConfig(fieldId, options) {
|
2466
|
+
const baseField = {
|
2467
|
+
fieldId,
|
2468
|
+
options,
|
2469
|
+
fieldType: "event"
|
2470
|
+
};
|
2471
|
+
return createSearchConfig(baseField);
|
2472
|
+
}
|
2473
|
+
|
2474
|
+
// ../commons/src/events/event.ts
|
2475
|
+
function eventFn(fieldId, options) {
|
2476
|
+
return createEventFieldConfig(fieldId, options);
|
2477
|
+
}
|
2478
|
+
var event = Object.assign(eventFn, {
|
2479
|
+
...createEventConditionals(),
|
2480
|
+
field(field2) {
|
2481
|
+
return {
|
2482
|
+
$event: field2
|
2483
|
+
};
|
2484
|
+
}
|
2071
2485
|
});
|
2072
2486
|
|
2073
|
-
// ../commons/src/events/
|
2487
|
+
// ../commons/src/events/WorkqueueColumnConfig.ts
|
2074
2488
|
var import_zod21 = require("zod");
|
2489
|
+
|
2490
|
+
// ../commons/src/events/EventMetadata.ts
|
2491
|
+
var import_zod20 = require("zod");
|
2075
2492
|
var EventStatus = {
|
2076
2493
|
CREATED: "CREATED",
|
2077
2494
|
NOTIFIED: "NOTIFIED",
|
@@ -2082,25 +2499,93 @@ var EventStatus = {
|
|
2082
2499
|
REJECTED: "REJECTED",
|
2083
2500
|
ARCHIVED: "ARCHIVED"
|
2084
2501
|
};
|
2502
|
+
var eventStatusValues = [
|
2503
|
+
EventStatus.CREATED,
|
2504
|
+
EventStatus.NOTIFIED,
|
2505
|
+
EventStatus.DECLARED,
|
2506
|
+
EventStatus.VALIDATED,
|
2507
|
+
EventStatus.REGISTERED,
|
2508
|
+
EventStatus.CERTIFIED,
|
2509
|
+
EventStatus.REJECTED,
|
2510
|
+
EventStatus.ARCHIVED
|
2511
|
+
];
|
2512
|
+
var EventStatusEnum = import_zod20.z.enum(eventStatusValues);
|
2513
|
+
var CustomFlags = {
|
2514
|
+
CERTIFICATE_PRINTED: "certificate-printed"
|
2515
|
+
};
|
2516
|
+
var Flag = import_zod20.z.string().regex(
|
2517
|
+
new RegExp(
|
2518
|
+
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
2519
|
+
ActionStatus
|
2520
|
+
).join("|").toLowerCase()})$`
|
2521
|
+
),
|
2522
|
+
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
2523
|
+
).or(import_zod20.z.nativeEnum(CustomFlags));
|
2085
2524
|
var eventStatuses = Object.values(EventStatus);
|
2086
|
-
var EventStatuses =
|
2087
|
-
var ZodDate =
|
2088
|
-
var
|
2089
|
-
|
2090
|
-
|
2525
|
+
var EventStatuses = import_zod20.z.nativeEnum(EventStatus);
|
2526
|
+
var ZodDate = import_zod20.z.string().date();
|
2527
|
+
var ActionCreationMetadata = import_zod20.z.object({
|
2528
|
+
createdAt: import_zod20.z.string().datetime().describe("The timestamp when the action request was created."),
|
2529
|
+
createdBy: import_zod20.z.string().describe("ID of the user who created the action request."),
|
2530
|
+
createdAtLocation: CreatedAtLocation.describe(
|
2531
|
+
"Location of the user who created the action request."
|
2532
|
+
),
|
2533
|
+
acceptedAt: import_zod20.z.string().datetime().describe("Timestamp when the action request was accepted."),
|
2534
|
+
createdByRole: import_zod20.z.string().describe("Role of the user at the time of action request creation.")
|
2535
|
+
});
|
2536
|
+
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
2537
|
+
registrationNumber: import_zod20.z.string().describe(
|
2538
|
+
"Registration number of the event. Always present for accepted registrations."
|
2539
|
+
)
|
2540
|
+
});
|
2541
|
+
var LegalStatuses = import_zod20.z.object({
|
2542
|
+
[EventStatus.DECLARED]: ActionCreationMetadata.nullish(),
|
2543
|
+
[EventStatus.REGISTERED]: RegistrationCreationMetadata.nullish()
|
2544
|
+
});
|
2545
|
+
var EventMetadata = import_zod20.z.object({
|
2546
|
+
id: UUID,
|
2547
|
+
type: import_zod20.z.string().describe("The type of event, such as birth, death, or marriage."),
|
2091
2548
|
status: EventStatuses,
|
2092
|
-
|
2549
|
+
legalStatuses: LegalStatuses.describe(
|
2550
|
+
"Metadata related to the legal registration of the event, such as who registered it and when."
|
2551
|
+
),
|
2552
|
+
createdAt: import_zod20.z.string().datetime().describe("The timestamp when the event was first created and saved."),
|
2093
2553
|
dateOfEvent: ZodDate.nullish(),
|
2094
|
-
createdBy:
|
2095
|
-
updatedByUserRole:
|
2096
|
-
createdAtLocation:
|
2097
|
-
|
2098
|
-
|
2099
|
-
|
2100
|
-
|
2101
|
-
|
2102
|
-
|
2554
|
+
createdBy: import_zod20.z.string().describe("ID of the user who created the event."),
|
2555
|
+
updatedByUserRole: import_zod20.z.string().describe("Role of the user who last updated the declaration."),
|
2556
|
+
createdAtLocation: CreatedAtLocation.describe(
|
2557
|
+
"Location of the user who created the event."
|
2558
|
+
),
|
2559
|
+
createdBySignature: import_zod20.z.string().nullish().describe("Signature of the user who created the event."),
|
2560
|
+
updatedAtLocation: UUID.nullish().describe(
|
2561
|
+
"Location of the user who last updated the declaration."
|
2562
|
+
),
|
2563
|
+
updatedAt: import_zod20.z.string().datetime().describe("Timestamp of the most recent declaration update."),
|
2564
|
+
assignedTo: import_zod20.z.string().nullish().describe("ID of the user currently assigned to the event."),
|
2565
|
+
updatedBy: import_zod20.z.string().nullish().describe("ID of the user who last updated the declaration."),
|
2566
|
+
trackingId: import_zod20.z.string().describe(
|
2567
|
+
"System-generated tracking ID used by informants or registrars to look up the event."
|
2568
|
+
),
|
2569
|
+
flags: import_zod20.z.array(Flag)
|
2103
2570
|
});
|
2571
|
+
var EventMetadataKeysArray = [
|
2572
|
+
"id",
|
2573
|
+
"type",
|
2574
|
+
"status",
|
2575
|
+
"createdAt",
|
2576
|
+
"dateOfEvent",
|
2577
|
+
"createdBy",
|
2578
|
+
"updatedByUserRole",
|
2579
|
+
"createdAtLocation",
|
2580
|
+
"updatedAtLocation",
|
2581
|
+
"updatedAt",
|
2582
|
+
"assignedTo",
|
2583
|
+
"updatedBy",
|
2584
|
+
"trackingId",
|
2585
|
+
"legalStatuses",
|
2586
|
+
"flags"
|
2587
|
+
];
|
2588
|
+
var EventMetadataKeys = import_zod20.z.enum(EventMetadataKeysArray);
|
2104
2589
|
var eventMetadataLabelMap = {
|
2105
2590
|
"event.assignedTo": {
|
2106
2591
|
id: "event.assignedTo.label",
|
@@ -2167,665 +2652,941 @@ var eventMetadataLabelMap = {
|
|
2167
2652
|
defaultMessage: "Tracking ID",
|
2168
2653
|
description: "Tracking ID"
|
2169
2654
|
},
|
2170
|
-
"event.
|
2171
|
-
id: "event.
|
2172
|
-
defaultMessage: "
|
2173
|
-
description: "
|
2655
|
+
"event.flags": {
|
2656
|
+
id: "event.flags.label",
|
2657
|
+
defaultMessage: "Flags",
|
2658
|
+
description: "Flags"
|
2174
2659
|
}
|
2175
2660
|
};
|
2176
2661
|
|
2177
|
-
// ../commons/src/events/
|
2178
|
-
var
|
2179
|
-
|
2180
|
-
|
2181
|
-
|
2182
|
-
|
2662
|
+
// ../commons/src/events/WorkqueueColumnConfig.ts
|
2663
|
+
var WorkqueueColumnKeysArray = [
|
2664
|
+
...EventMetadataKeysArray,
|
2665
|
+
"title"
|
2666
|
+
];
|
2667
|
+
var WorkqueueColumnKeys = import_zod21.z.enum(WorkqueueColumnKeysArray);
|
2668
|
+
var WorkqueueColumnValue = import_zod21.z.object({
|
2669
|
+
$event: WorkqueueColumnKeys
|
2670
|
+
});
|
2671
|
+
var WorkqueueColumn = import_zod21.z.object({
|
2672
|
+
label: TranslationConfig,
|
2673
|
+
value: WorkqueueColumnValue
|
2183
2674
|
});
|
2675
|
+
function defineWorkqueuesColumns(workqueueColumns) {
|
2676
|
+
return workqueueColumns.map(
|
2677
|
+
(workqueueColumn) => WorkqueueColumn.parse(workqueueColumn)
|
2678
|
+
);
|
2679
|
+
}
|
2184
2680
|
|
2185
|
-
// ../commons/src/events/
|
2681
|
+
// ../commons/src/events/CountryConfigQueryInput.ts
|
2186
2682
|
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" });
|
2199
2683
|
|
2200
2684
|
// ../commons/src/events/EventIndex.ts
|
2201
|
-
var
|
2685
|
+
var import_zod22 = require("zod");
|
2686
|
+
var import_zod_openapi9 = require("zod-openapi");
|
2687
|
+
(0, import_zod_openapi9.extendZodWithOpenApi)(import_zod22.z);
|
2202
2688
|
var EventIndex = EventMetadata.extend({
|
2203
|
-
declaration:
|
2689
|
+
declaration: EventState
|
2690
|
+
}).openapi({
|
2691
|
+
ref: "EventIndex"
|
2204
2692
|
});
|
2205
|
-
var EventSearchIndex =
|
2206
|
-
|
2207
|
-
type:
|
2693
|
+
var EventSearchIndex = import_zod22.z.record(import_zod22.z.string(), import_zod22.z.any()).and(
|
2694
|
+
import_zod22.z.object({
|
2695
|
+
type: import_zod22.z.string()
|
2208
2696
|
// Ensures "type" (event-id) exists and is a string
|
2209
2697
|
})
|
2210
|
-
)
|
2211
|
-
|
2212
|
-
|
2213
|
-
var
|
2214
|
-
|
2215
|
-
|
2698
|
+
).openapi({
|
2699
|
+
ref: "EventSearchIndex"
|
2700
|
+
});
|
2701
|
+
var Fuzzy = import_zod22.z.object({ type: import_zod22.z.literal("fuzzy"), term: import_zod22.z.string() }).openapi({
|
2702
|
+
ref: "Fuzzy"
|
2703
|
+
});
|
2704
|
+
var Exact = import_zod22.z.object({ type: import_zod22.z.literal("exact"), term: import_zod22.z.string() }).openapi({
|
2705
|
+
ref: "Exact"
|
2706
|
+
});
|
2707
|
+
var AnyOf = import_zod22.z.object({
|
2708
|
+
type: import_zod22.z.literal("anyOf"),
|
2709
|
+
terms: import_zod22.z.array(import_zod22.z.string())
|
2710
|
+
}).openapi({
|
2711
|
+
ref: "AnyOf"
|
2712
|
+
});
|
2713
|
+
var ExactStatus = import_zod22.z.object({
|
2714
|
+
type: import_zod22.z.literal("exact"),
|
2715
|
+
term: EventStatusEnum
|
2716
|
+
}).openapi({
|
2717
|
+
ref: "ExactStatus"
|
2718
|
+
});
|
2719
|
+
var AnyOfStatus = import_zod22.z.object({
|
2720
|
+
type: import_zod22.z.literal("anyOf"),
|
2721
|
+
terms: import_zod22.z.array(EventStatusEnum)
|
2722
|
+
}).openapi({
|
2723
|
+
ref: "AnyOfStatus"
|
2724
|
+
});
|
2725
|
+
var Range = import_zod22.z.object({
|
2726
|
+
type: import_zod22.z.literal("range"),
|
2727
|
+
gte: import_zod22.z.string(),
|
2728
|
+
lte: import_zod22.z.string()
|
2729
|
+
}).openapi({
|
2730
|
+
ref: "Range"
|
2731
|
+
});
|
2732
|
+
var Not = import_zod22.z.object({ type: import_zod22.z.literal("not"), term: import_zod22.z.string() }).openapi({
|
2733
|
+
ref: "Not"
|
2216
2734
|
});
|
2217
|
-
var
|
2218
|
-
|
2219
|
-
gte: import_zod24.z.string(),
|
2220
|
-
lte: import_zod24.z.string()
|
2735
|
+
var Within = import_zod22.z.object({ type: import_zod22.z.literal("within"), location: import_zod22.z.string() }).openapi({
|
2736
|
+
ref: "Within"
|
2221
2737
|
});
|
2222
|
-
var
|
2223
|
-
|
2224
|
-
|
2225
|
-
|
2226
|
-
|
2227
|
-
|
2738
|
+
var DateCondition = import_zod22.z.union([Exact, Range]).openapi({
|
2739
|
+
ref: "DateCondition"
|
2740
|
+
});
|
2741
|
+
var QueryInput = import_zod22.z.lazy(
|
2742
|
+
() => import_zod22.z.union([
|
2743
|
+
import_zod22.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf, Not]),
|
2744
|
+
import_zod22.z.record(import_zod22.z.string(), QueryInput)
|
2228
2745
|
])
|
2229
|
-
)
|
2230
|
-
|
2231
|
-
|
2232
|
-
|
2233
|
-
|
2234
|
-
|
2235
|
-
|
2236
|
-
|
2237
|
-
|
2238
|
-
|
2239
|
-
|
2240
|
-
|
2746
|
+
).openapi({
|
2747
|
+
ref: "QueryInput"
|
2748
|
+
});
|
2749
|
+
var QueryExpression = import_zod22.z.object({
|
2750
|
+
eventType: import_zod22.z.string(),
|
2751
|
+
status: import_zod22.z.optional(import_zod22.z.union([AnyOfStatus, ExactStatus])),
|
2752
|
+
createdAt: import_zod22.z.optional(DateCondition),
|
2753
|
+
updatedAt: import_zod22.z.optional(DateCondition),
|
2754
|
+
"legalStatus.REGISTERED.createdAt": import_zod22.z.optional(DateCondition),
|
2755
|
+
"legalStatus.REGISTERED.createdAtLocation": import_zod22.z.optional(
|
2756
|
+
import_zod22.z.union([Within, Exact])
|
2757
|
+
),
|
2758
|
+
createdAtLocation: import_zod22.z.optional(import_zod22.z.union([Within, Exact])),
|
2759
|
+
updatedAtLocation: import_zod22.z.optional(import_zod22.z.union([Within, Exact])),
|
2760
|
+
assignedTo: import_zod22.z.optional(Exact),
|
2761
|
+
createdBy: import_zod22.z.optional(Exact),
|
2762
|
+
updatedBy: import_zod22.z.optional(Exact),
|
2763
|
+
trackingId: import_zod22.z.optional(Exact),
|
2764
|
+
flags: import_zod22.z.optional(import_zod22.z.array(import_zod22.z.union([AnyOf, Not]))),
|
2765
|
+
data: QueryInput
|
2766
|
+
}).partial().openapi({
|
2767
|
+
ref: "QueryExpression"
|
2768
|
+
});
|
2769
|
+
var QueryType = import_zod22.z.object({
|
2770
|
+
type: import_zod22.z.literal("and").or(import_zod22.z.literal("or")).openapi({ default: "and" }),
|
2771
|
+
clauses: import_zod22.z.preprocess(
|
2772
|
+
(val) => {
|
2773
|
+
if (typeof val === "string") {
|
2774
|
+
return [JSON.parse(val)];
|
2775
|
+
}
|
2776
|
+
if (Array.isArray(val)) {
|
2777
|
+
return val.map((v) => typeof v === "string" ? JSON.parse(v) : v);
|
2778
|
+
}
|
2779
|
+
return val;
|
2780
|
+
},
|
2781
|
+
import_zod22.z.array(QueryExpression).openapi({
|
2782
|
+
default: [
|
2783
|
+
{
|
2784
|
+
eventType: TENNIS_CLUB_MEMBERSHIP,
|
2785
|
+
status: {
|
2786
|
+
type: "anyOf",
|
2787
|
+
terms: [
|
2788
|
+
"CREATED",
|
2789
|
+
"NOTIFIED",
|
2790
|
+
"DECLARED",
|
2791
|
+
"VALIDATED",
|
2792
|
+
"REGISTERED",
|
2793
|
+
"CERTIFIED",
|
2794
|
+
"REJECTED",
|
2795
|
+
"ARCHIVED"
|
2796
|
+
]
|
2797
|
+
},
|
2798
|
+
updatedAt: {
|
2799
|
+
type: "range",
|
2800
|
+
gte: "2025-05-22",
|
2801
|
+
lte: "2025-05-29"
|
2802
|
+
},
|
2803
|
+
data: {}
|
2804
|
+
}
|
2805
|
+
]
|
2806
|
+
})
|
2807
|
+
)
|
2808
|
+
}).openapi({
|
2809
|
+
ref: "QueryType"
|
2810
|
+
});
|
2811
|
+
|
2812
|
+
// ../commons/src/events/CountryConfigQueryInput.ts
|
2813
|
+
var SerializableExact = import_zod23.z.object({
|
2814
|
+
type: import_zod23.z.literal("exact"),
|
2815
|
+
term: import_zod23.z.union([import_zod23.z.string(), SerializedUserField])
|
2816
|
+
});
|
2817
|
+
var SerializableWithin = import_zod23.z.object({
|
2818
|
+
type: import_zod23.z.literal("within"),
|
2819
|
+
location: import_zod23.z.union([import_zod23.z.string(), SerializedUserField])
|
2820
|
+
});
|
2821
|
+
var SerializedQueryExpression = import_zod23.z.object({
|
2822
|
+
eventType: import_zod23.z.string(),
|
2823
|
+
status: import_zod23.z.optional(import_zod23.z.union([AnyOfStatus, ExactStatus])),
|
2824
|
+
createdAt: import_zod23.z.optional(DateCondition),
|
2825
|
+
updatedAt: import_zod23.z.optional(DateCondition),
|
2826
|
+
createdAtLocation: import_zod23.z.optional(
|
2827
|
+
import_zod23.z.union([SerializableWithin, SerializableExact])
|
2828
|
+
),
|
2829
|
+
updatedAtLocation: import_zod23.z.optional(
|
2830
|
+
import_zod23.z.union([SerializableWithin, SerializableExact])
|
2831
|
+
),
|
2832
|
+
assignedTo: import_zod23.z.optional(SerializableExact),
|
2833
|
+
createdBy: import_zod23.z.optional(SerializableExact),
|
2834
|
+
updatedBy: import_zod23.z.optional(SerializableExact),
|
2835
|
+
trackingId: import_zod23.z.optional(Exact),
|
2836
|
+
flags: import_zod23.z.optional(import_zod23.z.array(import_zod23.z.union([AnyOf, Not]))),
|
2241
2837
|
data: QueryInput
|
2242
2838
|
}).partial();
|
2243
|
-
var Or2 =
|
2244
|
-
type:
|
2245
|
-
clauses:
|
2839
|
+
var Or2 = import_zod23.z.object({
|
2840
|
+
type: import_zod23.z.literal("or"),
|
2841
|
+
clauses: import_zod23.z.array(SerializedQueryExpression)
|
2246
2842
|
});
|
2247
|
-
var
|
2843
|
+
var And2 = import_zod23.z.object({
|
2844
|
+
type: import_zod23.z.literal("and"),
|
2845
|
+
clauses: import_zod23.z.array(SerializedQueryExpression)
|
2846
|
+
});
|
2847
|
+
var CountryConfigQueryType = import_zod23.z.discriminatedUnion("type", [And2, Or2]);
|
2848
|
+
var CountryConfigQueryInputType = import_zod23.z.union([
|
2849
|
+
SerializedQueryExpression,
|
2850
|
+
And2,
|
2851
|
+
Or2
|
2852
|
+
]);
|
2248
2853
|
|
2249
|
-
// ../commons/src/
|
2250
|
-
|
2251
|
-
|
2252
|
-
|
2253
|
-
|
2254
|
-
|
2255
|
-
|
2256
|
-
|
2257
|
-
|
2258
|
-
|
2259
|
-
|
2260
|
-
|
2261
|
-
|
2262
|
-
|
2263
|
-
|
2264
|
-
|
2265
|
-
|
2266
|
-
|
2267
|
-
|
2268
|
-
|
2269
|
-
|
2270
|
-
|
2271
|
-
|
2272
|
-
|
2273
|
-
|
2274
|
-
|
2275
|
-
|
2276
|
-
|
2277
|
-
|
2278
|
-
|
2279
|
-
|
2280
|
-
|
2281
|
-
|
2282
|
-
|
2283
|
-
|
2284
|
-
|
2285
|
-
|
2286
|
-
|
2287
|
-
|
2288
|
-
|
2289
|
-
|
2290
|
-
|
2291
|
-
|
2292
|
-
|
2293
|
-
|
2294
|
-
|
2295
|
-
|
2854
|
+
// ../commons/src/icons.ts
|
2855
|
+
var import_zod24 = require("zod");
|
2856
|
+
var AvailableIcons = import_zod24.z.enum([
|
2857
|
+
"Archived",
|
2858
|
+
"Assigned",
|
2859
|
+
"Certified",
|
2860
|
+
"Close",
|
2861
|
+
"Collapse",
|
2862
|
+
"Draft",
|
2863
|
+
"DuplicateYellow",
|
2864
|
+
"Expand",
|
2865
|
+
"ExternalValidate",
|
2866
|
+
"FilledCheck",
|
2867
|
+
"InReview",
|
2868
|
+
"Offline",
|
2869
|
+
"Registered",
|
2870
|
+
"RequiresUpdates",
|
2871
|
+
"Sent",
|
2872
|
+
"Validated",
|
2873
|
+
"WaitingApproval",
|
2874
|
+
"ChartActivity",
|
2875
|
+
"Activity",
|
2876
|
+
"Archive",
|
2877
|
+
"ArchiveTray",
|
2878
|
+
"ArrowLeft",
|
2879
|
+
"ArrowRight",
|
2880
|
+
"Buildings",
|
2881
|
+
"Circle",
|
2882
|
+
"CaretDown",
|
2883
|
+
"CaretLeft",
|
2884
|
+
"CaretRight",
|
2885
|
+
"ChartBar",
|
2886
|
+
"ChartLine",
|
2887
|
+
"ChatCircle",
|
2888
|
+
"CheckSquare",
|
2889
|
+
"Compass",
|
2890
|
+
"Check",
|
2891
|
+
"Copy",
|
2892
|
+
"Database",
|
2893
|
+
"DotsThreeVertical",
|
2894
|
+
"DownloadSimple",
|
2895
|
+
"ArrowCounterClockwise",
|
2896
|
+
"MagnifyingGlassMinus",
|
2897
|
+
"MagnifyingGlassPlus",
|
2898
|
+
"Export",
|
2899
|
+
"Eye",
|
2900
|
+
"EyeSlash",
|
2901
|
+
"Envelope",
|
2902
|
+
"File",
|
2903
|
+
"FileSearch",
|
2904
|
+
"FileMinus",
|
2905
|
+
"FilePlus",
|
2906
|
+
"FileText",
|
2907
|
+
"FileX",
|
2908
|
+
"Handshake",
|
2909
|
+
"Gear",
|
2910
|
+
"GitBranch",
|
2911
|
+
"IdentificationCard",
|
2912
|
+
"List",
|
2913
|
+
"ListBullets",
|
2914
|
+
"Lock",
|
2915
|
+
"MagnifyingGlass",
|
2916
|
+
"MapPin",
|
2917
|
+
"Medal",
|
2918
|
+
"NotePencil",
|
2919
|
+
"Paperclip",
|
2920
|
+
"PaperPlaneTilt",
|
2921
|
+
"Pen",
|
2922
|
+
"Pencil",
|
2923
|
+
"PencilSimpleLine",
|
2924
|
+
"Phone",
|
2925
|
+
"Plus",
|
2926
|
+
"Printer",
|
2927
|
+
"SignOut",
|
2928
|
+
"Star",
|
2929
|
+
"Target",
|
2930
|
+
"TextT",
|
2931
|
+
"Trash",
|
2932
|
+
"UploadSimple",
|
2933
|
+
"User",
|
2934
|
+
"UserPlus",
|
2935
|
+
"Users",
|
2936
|
+
"WarningCircle",
|
2937
|
+
"X",
|
2938
|
+
"CircleWavyCheck",
|
2939
|
+
"CircleWavyQuestion",
|
2940
|
+
"ArchiveBox",
|
2941
|
+
"ArrowCircleDown",
|
2942
|
+
"FileArrowUp",
|
2943
|
+
"FileDotted",
|
2944
|
+
"Files",
|
2945
|
+
"PencilLine",
|
2946
|
+
"PencilCircle",
|
2947
|
+
"UserCircle",
|
2948
|
+
"Clock",
|
2949
|
+
"QrCode",
|
2950
|
+
"Webcam",
|
2951
|
+
"Sun",
|
2952
|
+
"DeviceTabletCamera",
|
2953
|
+
"Globe",
|
2954
|
+
"Fingerprint",
|
2955
|
+
"PushPin",
|
2956
|
+
"Timer"
|
2957
|
+
]);
|
2958
|
+
|
2959
|
+
// ../commons/src/events/WorkqueueConfig.ts
|
2960
|
+
var dateOfEventColumn = defineWorkqueuesColumns([
|
2961
|
+
{
|
2962
|
+
label: {
|
2963
|
+
id: "workqueues.dateOfEvent",
|
2964
|
+
defaultMessage: "Date of Event",
|
2965
|
+
description: "Label for workqueue column: dateOfEvent"
|
2966
|
+
},
|
2967
|
+
value: event.field("dateOfEvent")
|
2968
|
+
},
|
2969
|
+
{
|
2970
|
+
label: {
|
2971
|
+
defaultMessage: "Last updated",
|
2972
|
+
description: "This is the label for the workqueue column",
|
2973
|
+
id: "workqueue.default.column.modifiedAt"
|
2974
|
+
},
|
2975
|
+
value: event.field("updatedAt")
|
2296
2976
|
}
|
2297
|
-
|
2298
|
-
|
2299
|
-
|
2300
|
-
|
2301
|
-
|
2302
|
-
|
2303
|
-
|
2304
|
-
|
2305
|
-
|
2306
|
-
|
2307
|
-
|
2308
|
-
|
2977
|
+
]);
|
2978
|
+
var WorkqueueConfig = import_zod25.z.object({
|
2979
|
+
slug: import_zod25.z.string().describe("Determines the url of the workqueue."),
|
2980
|
+
name: TranslationConfig.describe(
|
2981
|
+
"Title of the workflow (both in navigation and on the page)"
|
2982
|
+
),
|
2983
|
+
query: CountryConfigQueryType,
|
2984
|
+
actions: import_zod25.z.array(
|
2985
|
+
import_zod25.z.object({
|
2986
|
+
type: import_zod25.z.string(),
|
2987
|
+
conditionals: import_zod25.z.array(Conditional).optional()
|
2988
|
+
})
|
2989
|
+
),
|
2990
|
+
columns: import_zod25.z.array(WorkqueueColumn).default(dateOfEventColumn),
|
2991
|
+
icon: AvailableIcons
|
2992
|
+
}).describe("Configuration for workqueue.");
|
2993
|
+
var WorkqueueConfigInput = import_zod25.z.object({
|
2994
|
+
slug: import_zod25.z.string().describe("Determines the url of the workqueue."),
|
2995
|
+
name: TranslationConfig.describe(
|
2996
|
+
"Title of the workflow (both in navigation and on the page)"
|
2997
|
+
),
|
2998
|
+
query: CountryConfigQueryInputType,
|
2999
|
+
actions: import_zod25.z.array(
|
3000
|
+
import_zod25.z.object({
|
3001
|
+
type: import_zod25.z.string(),
|
3002
|
+
conditionals: import_zod25.z.array(Conditional).optional()
|
3003
|
+
})
|
3004
|
+
),
|
3005
|
+
columns: import_zod25.z.array(WorkqueueColumn).default(dateOfEventColumn),
|
3006
|
+
icon: AvailableIcons
|
3007
|
+
});
|
3008
|
+
function defineWorkqueue(workqueueInput) {
|
3009
|
+
const queryInput = workqueueInput.query;
|
3010
|
+
const query = "type" in queryInput ? queryInput : { type: "and", clauses: [queryInput] };
|
3011
|
+
return WorkqueueConfig.parse({ ...workqueueInput, query });
|
2309
3012
|
}
|
2310
|
-
function
|
2311
|
-
|
2312
|
-
ActionType.REQUEST_CORRECTION,
|
2313
|
-
ActionType.PRINT_CERTIFICATE
|
2314
|
-
];
|
2315
|
-
return actions.reduce((status, action) => {
|
2316
|
-
if (excludedActions.some((excludedAction) => excludedAction === action.type)) {
|
2317
|
-
return status;
|
2318
|
-
}
|
2319
|
-
if (action.type === ActionType.APPROVE_CORRECTION) {
|
2320
|
-
const requestAction = actions.find(({ id }) => id === action.requestId);
|
2321
|
-
if (!requestAction) {
|
2322
|
-
return status;
|
2323
|
-
}
|
2324
|
-
return deepMerge(status, requestAction.declaration);
|
2325
|
-
}
|
2326
|
-
return deepMerge(status, action.declaration);
|
2327
|
-
}, {});
|
3013
|
+
function defineWorkqueues(workqueues) {
|
3014
|
+
return workqueues.map((workqueue) => defineWorkqueue(workqueue));
|
2328
3015
|
}
|
2329
|
-
|
2330
|
-
|
2331
|
-
|
3016
|
+
var WorkqueueCountInput = import_zod25.z.array(
|
3017
|
+
import_zod25.z.object({ slug: import_zod25.z.string(), query: QueryType })
|
3018
|
+
);
|
3019
|
+
var WorkqueueCountOutput = import_zod25.z.record(import_zod25.z.string(), import_zod25.z.number());
|
3020
|
+
|
3021
|
+
// ../commons/src/events/workqueueDefaultColumns.ts
|
3022
|
+
var defaultWorkqueueColumns = [
|
3023
|
+
{
|
3024
|
+
label: {
|
3025
|
+
defaultMessage: "Title",
|
3026
|
+
description: "This is the label for the workqueue column",
|
3027
|
+
id: "workqueue.in-reveiw.column.title"
|
3028
|
+
},
|
3029
|
+
value: event.field("title")
|
3030
|
+
},
|
3031
|
+
{
|
3032
|
+
label: {
|
3033
|
+
defaultMessage: "Event",
|
3034
|
+
description: "This is the label for the workqueue column",
|
3035
|
+
id: "workqueue.default.column.event"
|
3036
|
+
},
|
3037
|
+
value: event.field("type")
|
2332
3038
|
}
|
2333
|
-
|
2334
|
-
|
2335
|
-
|
2336
|
-
|
2337
|
-
|
2338
|
-
|
2339
|
-
|
2340
|
-
|
2341
|
-
|
3039
|
+
];
|
3040
|
+
|
3041
|
+
// ../commons/src/events/Draft.ts
|
3042
|
+
var import_zod27 = require("zod");
|
3043
|
+
|
3044
|
+
// ../commons/src/events/ActionInput.ts
|
3045
|
+
var import_zod26 = require("zod");
|
3046
|
+
var import_zod_openapi10 = require("zod-openapi");
|
3047
|
+
(0, import_zod_openapi10.extendZodWithOpenApi)(import_zod26.z);
|
3048
|
+
var BaseActionInput = import_zod26.z.object({
|
3049
|
+
eventId: UUID,
|
3050
|
+
transactionId: import_zod26.z.string(),
|
3051
|
+
declaration: ActionUpdate.default({}),
|
3052
|
+
annotation: ActionUpdate.optional(),
|
3053
|
+
originalActionId: UUID.optional(),
|
3054
|
+
keepAssignment: import_zod26.z.boolean().optional()
|
3055
|
+
});
|
3056
|
+
var CreateActionInput = BaseActionInput.merge(
|
3057
|
+
import_zod26.z.object({
|
3058
|
+
type: import_zod26.z.literal(ActionType.CREATE).default(ActionType.CREATE),
|
3059
|
+
createdAtLocation: CreatedAtLocation
|
3060
|
+
})
|
3061
|
+
);
|
3062
|
+
var RegisterActionInput = BaseActionInput.merge(
|
3063
|
+
import_zod26.z.object({
|
3064
|
+
type: import_zod26.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
3065
|
+
registrationNumber: import_zod26.z.string().optional()
|
3066
|
+
})
|
3067
|
+
);
|
3068
|
+
var ValidateActionInput = BaseActionInput.merge(
|
3069
|
+
import_zod26.z.object({
|
3070
|
+
type: import_zod26.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
|
3071
|
+
duplicates: import_zod26.z.array(import_zod26.z.string())
|
3072
|
+
})
|
3073
|
+
);
|
3074
|
+
var NotifyActionInput = BaseActionInput.merge(
|
3075
|
+
import_zod26.z.object({
|
3076
|
+
type: import_zod26.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
|
3077
|
+
})
|
3078
|
+
).openapi({
|
3079
|
+
default: {
|
3080
|
+
eventId: "<event-id-here>",
|
3081
|
+
transactionId: getUUID(),
|
3082
|
+
declaration: {},
|
3083
|
+
annotation: {},
|
3084
|
+
type: ActionType.NOTIFY
|
2342
3085
|
}
|
2343
|
-
|
2344
|
-
|
2345
|
-
|
2346
|
-
|
2347
|
-
}
|
2348
|
-
|
2349
|
-
|
2350
|
-
|
3086
|
+
});
|
3087
|
+
var DeclareActionInput = BaseActionInput.merge(
|
3088
|
+
import_zod26.z.object({
|
3089
|
+
type: import_zod26.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
3090
|
+
})
|
3091
|
+
);
|
3092
|
+
var PrintCertificateActionInput = BaseActionInput.merge(
|
3093
|
+
import_zod26.z.object({
|
3094
|
+
type: import_zod26.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
|
3095
|
+
})
|
3096
|
+
);
|
3097
|
+
var RejectDeclarationActionInput = BaseActionInput.merge(
|
3098
|
+
import_zod26.z.object({
|
3099
|
+
type: import_zod26.z.literal(ActionType.REJECT).default(ActionType.REJECT),
|
3100
|
+
reason: RejectionReason
|
3101
|
+
})
|
3102
|
+
);
|
3103
|
+
var MarkedAsDuplicateActionInput = BaseActionInput.merge(
|
3104
|
+
import_zod26.z.object({
|
3105
|
+
type: import_zod26.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
|
3106
|
+
})
|
3107
|
+
);
|
3108
|
+
var ArchiveActionInput = BaseActionInput.merge(
|
3109
|
+
import_zod26.z.object({
|
3110
|
+
type: import_zod26.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
|
3111
|
+
reason: RejectionReason
|
3112
|
+
})
|
3113
|
+
);
|
3114
|
+
var AssignActionInput = BaseActionInput.merge(
|
3115
|
+
import_zod26.z.object({
|
3116
|
+
type: import_zod26.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
|
3117
|
+
assignedTo: import_zod26.z.string()
|
3118
|
+
})
|
3119
|
+
);
|
3120
|
+
var UnassignActionInput = BaseActionInput.merge(
|
3121
|
+
import_zod26.z.object({
|
3122
|
+
type: import_zod26.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
|
3123
|
+
assignedTo: import_zod26.z.literal(null).default(null)
|
3124
|
+
})
|
3125
|
+
);
|
3126
|
+
var RequestCorrectionActionInput = BaseActionInput.merge(
|
3127
|
+
import_zod26.z.object({
|
3128
|
+
type: import_zod26.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
3129
|
+
})
|
3130
|
+
);
|
3131
|
+
var RejectCorrectionActionInput = BaseActionInput.merge(
|
3132
|
+
import_zod26.z.object({
|
3133
|
+
requestId: import_zod26.z.string(),
|
3134
|
+
type: import_zod26.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
|
3135
|
+
})
|
3136
|
+
);
|
3137
|
+
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
3138
|
+
import_zod26.z.object({
|
3139
|
+
requestId: import_zod26.z.string(),
|
3140
|
+
type: import_zod26.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
3141
|
+
})
|
3142
|
+
);
|
3143
|
+
var ReadActionInput = BaseActionInput.merge(
|
3144
|
+
import_zod26.z.object({
|
3145
|
+
type: import_zod26.z.literal(ActionType.READ).default(ActionType.READ)
|
3146
|
+
})
|
3147
|
+
);
|
3148
|
+
var DeleteActionInput = import_zod26.z.object({ eventId: UUID });
|
3149
|
+
var ActionInput = import_zod26.z.discriminatedUnion("type", [
|
3150
|
+
CreateActionInput.openapi({ ref: "CreateActionInput" }),
|
3151
|
+
ValidateActionInput.openapi({ ref: "ValidateActionInput" }),
|
3152
|
+
RegisterActionInput.openapi({ ref: "RegisterActionInput" }),
|
3153
|
+
NotifyActionInput.openapi({ ref: "NotifyActionInput" }),
|
3154
|
+
DeclareActionInput.openapi({ ref: "DeclareActionInput" }),
|
3155
|
+
RejectDeclarationActionInput.openapi({
|
3156
|
+
ref: "RejectDeclarationActionInput"
|
3157
|
+
}),
|
3158
|
+
MarkedAsDuplicateActionInput.openapi({
|
3159
|
+
ref: "MarkedAsDuplicateActionInput"
|
3160
|
+
}),
|
3161
|
+
ArchiveActionInput.openapi({ ref: "ArchiveActionInput" }),
|
3162
|
+
AssignActionInput.openapi({ ref: "AssignActionInput" }),
|
3163
|
+
UnassignActionInput.openapi({ ref: "UnassignActionInput" }),
|
3164
|
+
PrintCertificateActionInput.openapi({ ref: "PrintCertificateActionInput" }),
|
3165
|
+
RequestCorrectionActionInput.openapi({
|
3166
|
+
ref: "RequestCorrectionActionInput"
|
3167
|
+
}),
|
3168
|
+
RejectCorrectionActionInput.openapi({ ref: "RejectCorrectionActionInput" }),
|
3169
|
+
ApproveCorrectionActionInput.openapi({
|
3170
|
+
ref: "ApproveCorrectionActionInput"
|
3171
|
+
}),
|
3172
|
+
ReadActionInput.openapi({ ref: "ReadActionInput" })
|
3173
|
+
]).openapi({
|
3174
|
+
ref: "ActionInput"
|
3175
|
+
});
|
3176
|
+
|
3177
|
+
// ../commons/src/events/Draft.ts
|
3178
|
+
var Draft = import_zod27.z.object({
|
3179
|
+
id: UUID,
|
3180
|
+
eventId: UUID,
|
3181
|
+
transactionId: import_zod27.z.string(),
|
3182
|
+
createdAt: import_zod27.z.string().datetime(),
|
3183
|
+
action: ActionBase.extend({
|
3184
|
+
type: ActionTypes
|
3185
|
+
}).omit({ id: true })
|
3186
|
+
});
|
3187
|
+
var DraftInput = BaseActionInput.extend({
|
3188
|
+
type: ActionTypes,
|
3189
|
+
status: import_zod27.z.enum([
|
3190
|
+
ActionStatus.Requested,
|
3191
|
+
ActionStatus.Accepted,
|
3192
|
+
ActionStatus.Rejected
|
3193
|
+
])
|
3194
|
+
});
|
3195
|
+
|
3196
|
+
// ../commons/src/events/EventInput.ts
|
3197
|
+
var import_zod28 = require("zod");
|
3198
|
+
var import_uuid8 = require("uuid");
|
3199
|
+
var EventInput = import_zod28.z.object({
|
3200
|
+
transactionId: import_zod28.z.string(),
|
3201
|
+
type: import_zod28.z.string()
|
3202
|
+
}).openapi({ default: { transactionId: (0, import_uuid8.v4)(), type: "v2.birth" } });
|
3203
|
+
|
3204
|
+
// ../commons/src/events/EventDocument.ts
|
3205
|
+
var import_zod29 = require("zod");
|
3206
|
+
var import_zod_openapi11 = require("zod-openapi");
|
3207
|
+
(0, import_zod_openapi11.extendZodWithOpenApi)(import_zod29.z);
|
3208
|
+
var EventDocument = import_zod29.z.object({
|
3209
|
+
id: UUID,
|
3210
|
+
type: import_zod29.z.string(),
|
3211
|
+
createdAt: import_zod29.z.string().datetime(),
|
3212
|
+
updatedAt: import_zod29.z.string().datetime(),
|
3213
|
+
actions: import_zod29.z.array(Action),
|
3214
|
+
trackingId: import_zod29.z.string()
|
3215
|
+
}).openapi({ ref: "EventDocument" });
|
3216
|
+
|
3217
|
+
// ../commons/src/events/state/utils.ts
|
3218
|
+
function getActionRequests(actionType, actions) {
|
3219
|
+
const filtered = actions.filter((action) => action.type === actionType);
|
3220
|
+
const accept = filtered.find(
|
3221
|
+
(action) => action.status === ActionStatus.Accepted
|
2351
3222
|
);
|
2352
|
-
|
2353
|
-
|
2354
|
-
const creationAction = event2.actions.find(
|
2355
|
-
(action) => action.type === ActionType.CREATE
|
3223
|
+
const request = filtered.find(
|
3224
|
+
(action) => action.status === ActionStatus.Requested
|
2356
3225
|
);
|
2357
|
-
|
2358
|
-
|
2359
|
-
}
|
2360
|
-
const activeActions = getAcceptedActions(event2);
|
2361
|
-
const latestAction = activeActions[activeActions.length - 1];
|
2362
|
-
const registrationAction = activeActions.find(
|
2363
|
-
(a) => a.type === ActionType.REGISTER && a.status === ActionStatus.Accepted
|
3226
|
+
const reject = filtered.find(
|
3227
|
+
(action) => action.status === ActionStatus.Rejected
|
2364
3228
|
);
|
2365
|
-
|
2366
|
-
|
2367
|
-
|
2368
|
-
|
2369
|
-
const parsedDate = ZodDate.safeParse(declaration[event2.dateOfEvent.fieldId]);
|
2370
|
-
dateOfEvent = parsedDate.success ? parsedDate.data : null;
|
2371
|
-
}
|
2372
|
-
return deepDropNulls({
|
2373
|
-
id: event2.id,
|
2374
|
-
type: event2.type,
|
2375
|
-
status: getStatusFromActions(event2.actions),
|
2376
|
-
createdAt: event2.createdAt,
|
2377
|
-
createdBy: creationAction.createdBy,
|
2378
|
-
createdAtLocation: creationAction.createdAtLocation ?? "",
|
2379
|
-
// @todo remove using empty string
|
2380
|
-
updatedAt: latestAction.createdAt,
|
2381
|
-
assignedTo: getAssignedUserFromActions(activeActions),
|
2382
|
-
updatedBy: latestAction.createdBy,
|
2383
|
-
updatedAtLocation: event2.updatedAtLocation,
|
2384
|
-
declaration,
|
2385
|
-
trackingId: event2.trackingId,
|
2386
|
-
registrationNumber,
|
2387
|
-
updatedByUserRole: getLastUpdatedByUserRoleFromActions(event2.actions),
|
2388
|
-
dateOfEvent
|
2389
|
-
});
|
2390
|
-
}
|
2391
|
-
function getCurrentEventStateWithDrafts(event2, drafts) {
|
2392
|
-
const actions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
2393
|
-
const activeDrafts = findActiveDrafts(event2, drafts).map((draft) => draft.action).flatMap((action) => {
|
2394
|
-
if (action.type === ActionType.REQUEST_CORRECTION) {
|
2395
|
-
return [
|
2396
|
-
action,
|
2397
|
-
{
|
2398
|
-
...action,
|
2399
|
-
type: ActionType.APPROVE_CORRECTION
|
2400
|
-
}
|
2401
|
-
];
|
2402
|
-
}
|
2403
|
-
return [action];
|
2404
|
-
});
|
2405
|
-
const actionWithDrafts = [...actions, ...activeDrafts].sort();
|
2406
|
-
const withDrafts = {
|
2407
|
-
...event2,
|
2408
|
-
actions: actionWithDrafts
|
3229
|
+
return {
|
3230
|
+
reject,
|
3231
|
+
accept,
|
3232
|
+
request
|
2409
3233
|
};
|
2410
|
-
return getCurrentEventState(withDrafts);
|
2411
3234
|
}
|
2412
|
-
function
|
2413
|
-
const
|
2414
|
-
|
2415
|
-
|
2416
|
-
|
3235
|
+
function getDeclarationActionCreationMetadata(actionType, actions) {
|
3236
|
+
const { accept: acceptAction, request: requestAction } = getActionRequests(
|
3237
|
+
actionType,
|
3238
|
+
actions
|
3239
|
+
);
|
3240
|
+
if (!acceptAction) {
|
3241
|
+
return null;
|
2417
3242
|
}
|
3243
|
+
const registrationNumber = acceptAction.type === ActionType.REGISTER ? acceptAction.registrationNumber : null;
|
2418
3244
|
return {
|
2419
|
-
|
2420
|
-
|
2421
|
-
|
2422
|
-
|
2423
|
-
|
3245
|
+
// When 3rd party API returns 200 OK, we assume that the request was accepted, and persist single 'accepted' action.
|
3246
|
+
createdAt: requestAction?.createdAt ?? acceptAction.createdAt,
|
3247
|
+
createdBy: requestAction?.createdBy ?? acceptAction.createdBy,
|
3248
|
+
createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
|
3249
|
+
acceptedAt: acceptAction.createdAt,
|
3250
|
+
createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
|
3251
|
+
registrationNumber
|
2424
3252
|
};
|
2425
3253
|
}
|
2426
|
-
function
|
2427
|
-
const
|
2428
|
-
|
2429
|
-
|
2430
|
-
}, {});
|
2431
|
-
return deepDropNulls(annotation);
|
2432
|
-
}
|
2433
|
-
function getActionAnnotation({
|
2434
|
-
event: event2,
|
2435
|
-
actionType,
|
2436
|
-
drafts = []
|
2437
|
-
}) {
|
2438
|
-
const activeActions = getAcceptedActions(event2);
|
2439
|
-
const action = activeActions.find(
|
2440
|
-
(activeAction) => actionType === activeAction.type
|
3254
|
+
function getDeclarationActionUpdateMetadata(actions) {
|
3255
|
+
const createAction = getOrThrow(
|
3256
|
+
actions.find((action) => action.type === ActionType.CREATE),
|
3257
|
+
`Event has no ${ActionType.CREATE} action`
|
2441
3258
|
);
|
2442
|
-
|
2443
|
-
|
2444
|
-
|
2445
|
-
|
2446
|
-
|
2447
|
-
|
2448
|
-
|
2449
|
-
|
2450
|
-
|
2451
|
-
}
|
2452
|
-
|
2453
|
-
// ../commons/src/events/defineConfig.ts
|
2454
|
-
var defineConfig = (config) => {
|
2455
|
-
const input = EventConfig.parse(config);
|
2456
|
-
return input;
|
2457
|
-
};
|
2458
|
-
|
2459
|
-
// ../commons/src/events/transactions.ts
|
2460
|
-
function generateTransactionId() {
|
2461
|
-
return getUUID();
|
2462
|
-
}
|
2463
|
-
|
2464
|
-
// ../commons/src/events/test.utils.ts
|
2465
|
-
var import_lodash2 = require("lodash");
|
2466
|
-
|
2467
|
-
// ../commons/src/conditionals/conditionals.ts
|
2468
|
-
function defineConditional(schema) {
|
2469
|
-
return schema;
|
2470
|
-
}
|
2471
|
-
function defineFormConditional(schema) {
|
2472
|
-
const schemaWithForm = {
|
2473
|
-
type: "object",
|
2474
|
-
properties: {
|
2475
|
-
$form: schema
|
3259
|
+
return [ActionType.DECLARE, ActionType.VALIDATE, ActionType.REGISTER].reduce(
|
3260
|
+
(metadata, actionType) => {
|
3261
|
+
const { accept, request } = getActionRequests(actionType, actions);
|
3262
|
+
return {
|
3263
|
+
createdAt: request?.createdAt ?? accept?.createdAt ?? metadata.createdAt,
|
3264
|
+
createdBy: request?.createdBy ?? accept?.createdBy ?? metadata.createdBy,
|
3265
|
+
createdAtLocation: request?.createdAtLocation ?? accept?.createdAtLocation ?? metadata.createdAtLocation,
|
3266
|
+
createdByRole: request?.createdByRole ?? accept?.createdByRole ?? metadata.createdByRole
|
3267
|
+
};
|
2476
3268
|
},
|
2477
|
-
|
2478
|
-
|
2479
|
-
|
2480
|
-
|
2481
|
-
|
2482
|
-
|
2483
|
-
|
2484
|
-
function and(...conditions) {
|
2485
|
-
return defineConditional({
|
2486
|
-
type: "object",
|
2487
|
-
allOf: conditions,
|
2488
|
-
required: []
|
2489
|
-
});
|
2490
|
-
}
|
2491
|
-
function or(...conditions) {
|
2492
|
-
return defineConditional({
|
2493
|
-
type: "object",
|
2494
|
-
anyOf: conditions,
|
2495
|
-
required: []
|
2496
|
-
});
|
2497
|
-
}
|
2498
|
-
function not(condition) {
|
2499
|
-
return defineConditional({
|
2500
|
-
type: "object",
|
2501
|
-
not: condition,
|
2502
|
-
required: []
|
2503
|
-
});
|
2504
|
-
}
|
2505
|
-
function never() {
|
2506
|
-
return not(alwaysTrue());
|
3269
|
+
{
|
3270
|
+
createdAt: createAction.createdAt,
|
3271
|
+
createdBy: createAction.createdBy,
|
3272
|
+
createdAtLocation: createAction.createdAtLocation,
|
3273
|
+
createdByRole: createAction.createdByRole
|
3274
|
+
}
|
3275
|
+
);
|
2507
3276
|
}
|
2508
|
-
|
2509
|
-
hasScope: (scope) => defineConditional({
|
2510
|
-
type: "object",
|
2511
|
-
properties: {
|
2512
|
-
$user: {
|
2513
|
-
type: "object",
|
2514
|
-
required: ["scope"],
|
2515
|
-
properties: {
|
2516
|
-
scope: {
|
2517
|
-
type: "array",
|
2518
|
-
contains: {
|
2519
|
-
type: "string",
|
2520
|
-
const: scope
|
2521
|
-
}
|
2522
|
-
}
|
2523
|
-
}
|
2524
|
-
}
|
2525
|
-
},
|
2526
|
-
required: ["$user"]
|
2527
|
-
})
|
2528
|
-
};
|
2529
|
-
function createEventConditionals() {
|
3277
|
+
function getLegalStatuses(actions) {
|
2530
3278
|
return {
|
2531
|
-
|
2532
|
-
|
2533
|
-
|
2534
|
-
|
2535
|
-
|
2536
|
-
|
2537
|
-
|
2538
|
-
|
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
|
-
}
|
2552
|
-
}
|
2553
|
-
},
|
2554
|
-
required: ["actions"]
|
2555
|
-
}
|
2556
|
-
},
|
2557
|
-
required: ["$event"]
|
2558
|
-
})
|
3279
|
+
[EventStatus.DECLARED]: getDeclarationActionCreationMetadata(
|
3280
|
+
ActionType.DECLARE,
|
3281
|
+
actions
|
3282
|
+
),
|
3283
|
+
[EventStatus.REGISTERED]: getDeclarationActionCreationMetadata(
|
3284
|
+
ActionType.REGISTER,
|
3285
|
+
actions
|
3286
|
+
)
|
2559
3287
|
};
|
2560
3288
|
}
|
2561
|
-
|
2562
|
-
|
3289
|
+
|
3290
|
+
// ../commons/src/events/state/index.ts
|
3291
|
+
function getStatusFromActions(actions) {
|
3292
|
+
const hasRejectedAction = actions.some(
|
3293
|
+
(a) => a.status === ActionStatus.Rejected
|
3294
|
+
);
|
3295
|
+
if (hasRejectedAction) {
|
3296
|
+
return EventStatus.REJECTED;
|
3297
|
+
}
|
3298
|
+
return actions.reduce((status, action) => {
|
3299
|
+
switch (action.type) {
|
3300
|
+
case ActionType.CREATE:
|
3301
|
+
return EventStatus.CREATED;
|
3302
|
+
case ActionType.DECLARE:
|
3303
|
+
return EventStatus.DECLARED;
|
3304
|
+
case ActionType.VALIDATE:
|
3305
|
+
return EventStatus.VALIDATED;
|
3306
|
+
case ActionType.REGISTER:
|
3307
|
+
return EventStatus.REGISTERED;
|
3308
|
+
case ActionType.REJECT:
|
3309
|
+
return EventStatus.REJECTED;
|
3310
|
+
case ActionType.ARCHIVE:
|
3311
|
+
return EventStatus.ARCHIVED;
|
3312
|
+
case ActionType.NOTIFY:
|
3313
|
+
return EventStatus.NOTIFIED;
|
3314
|
+
case ActionType.PRINT_CERTIFICATE:
|
3315
|
+
return EventStatus.CERTIFIED;
|
3316
|
+
case ActionType.ASSIGN:
|
3317
|
+
case ActionType.UNASSIGN:
|
3318
|
+
case ActionType.REQUEST_CORRECTION:
|
3319
|
+
case ActionType.APPROVE_CORRECTION:
|
3320
|
+
case ActionType.MARKED_AS_DUPLICATE:
|
3321
|
+
case ActionType.REJECT_CORRECTION:
|
3322
|
+
case ActionType.READ:
|
3323
|
+
default:
|
3324
|
+
return status;
|
3325
|
+
}
|
3326
|
+
}, EventStatus.CREATED);
|
2563
3327
|
}
|
2564
|
-
function
|
2565
|
-
|
2566
|
-
|
2567
|
-
|
2568
|
-
|
2569
|
-
|
2570
|
-
|
2571
|
-
|
2572
|
-
|
2573
|
-
|
3328
|
+
function getFlagsFromActions(actions) {
|
3329
|
+
const sortedactions = actions.sort(
|
3330
|
+
(a, b) => a.createdAt.localeCompare(b.createdAt)
|
3331
|
+
);
|
3332
|
+
const actionStatus = sortedactions.reduce(
|
3333
|
+
(actionStatuses, { type, status }) => ({
|
3334
|
+
...actionStatuses,
|
3335
|
+
[type]: status
|
3336
|
+
}),
|
3337
|
+
{}
|
3338
|
+
);
|
3339
|
+
const flags = Object.entries(actionStatus).filter(([, status]) => status !== ActionStatus.Accepted).map(([type, status]) => {
|
3340
|
+
const flag = `${type.toLowerCase()}:${status.toLowerCase()}`;
|
3341
|
+
return flag;
|
3342
|
+
});
|
3343
|
+
const isCertificatePrinted = sortedactions.reduce(
|
3344
|
+
(prev, { type }) => {
|
3345
|
+
if (type === ActionType.PRINT_CERTIFICATE) {
|
3346
|
+
return true;
|
3347
|
+
}
|
3348
|
+
if (type === ActionType.APPROVE_CORRECTION) {
|
3349
|
+
return false;
|
3350
|
+
}
|
3351
|
+
return prev;
|
2574
3352
|
},
|
2575
|
-
|
2576
|
-
|
3353
|
+
false
|
3354
|
+
);
|
3355
|
+
if (isCertificatePrinted) {
|
3356
|
+
flags.push(CustomFlags.CERTIFICATE_PRINTED);
|
3357
|
+
}
|
3358
|
+
return flags;
|
2577
3359
|
}
|
2578
|
-
function
|
2579
|
-
return
|
3360
|
+
function getAssignedUserFromActions(actions) {
|
3361
|
+
return actions.reduce((user2, action) => {
|
3362
|
+
if (action.type === ActionType.ASSIGN) {
|
3363
|
+
return action.assignedTo;
|
3364
|
+
}
|
3365
|
+
if (action.type === ActionType.UNASSIGN) {
|
3366
|
+
return null;
|
3367
|
+
}
|
3368
|
+
return user2;
|
3369
|
+
}, null);
|
2580
3370
|
}
|
2581
|
-
function
|
2582
|
-
|
2583
|
-
type
|
2584
|
-
|
2585
|
-
|
2586
|
-
|
2587
|
-
|
2588
|
-
|
2589
|
-
|
2590
|
-
|
2591
|
-
|
2592
|
-
|
2593
|
-
|
2594
|
-
|
2595
|
-
|
2596
|
-
|
2597
|
-
|
2598
|
-
|
2599
|
-
|
2600
|
-
|
2601
|
-
|
2602
|
-
})
|
2603
|
-
|
2604
|
-
|
2605
|
-
const comparedFieldId = date._fieldId;
|
2606
|
-
return defineFormConditional(
|
2607
|
-
getDateRangeToFieldReference(
|
2608
|
-
fieldId,
|
2609
|
-
comparedFieldId,
|
2610
|
-
"formatMinimum"
|
2611
|
-
)
|
2612
|
-
);
|
2613
|
-
}
|
2614
|
-
return defineFormConditional(getDateRange(date, "formatMinimum"));
|
2615
|
-
},
|
2616
|
-
now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMinimum"))
|
2617
|
-
}),
|
2618
|
-
isBefore: () => ({
|
2619
|
-
days: (days) => ({
|
2620
|
-
inPast: () => defineFormConditional(
|
2621
|
-
getDateRange(getDateFromNow(days), "formatMaximum")
|
2622
|
-
),
|
2623
|
-
inFuture: () => defineFormConditional(
|
2624
|
-
getDateRange(getDateFromNow(-days), "formatMaximum")
|
2625
|
-
)
|
2626
|
-
}),
|
2627
|
-
date: (date) => {
|
2628
|
-
if (isFieldReference(date)) {
|
2629
|
-
const comparedFieldId = date._fieldId;
|
2630
|
-
return defineFormConditional(
|
2631
|
-
getDateRangeToFieldReference(
|
2632
|
-
fieldId,
|
2633
|
-
comparedFieldId,
|
2634
|
-
"formatMaximum"
|
2635
|
-
)
|
2636
|
-
);
|
2637
|
-
}
|
2638
|
-
return defineFormConditional(getDateRange(date, "formatMaximum"));
|
2639
|
-
},
|
2640
|
-
now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMaximum"))
|
2641
|
-
}),
|
2642
|
-
isEqualTo: (value) => {
|
2643
|
-
if (isFieldReference(value)) {
|
2644
|
-
const comparedFieldId = value._fieldId;
|
2645
|
-
return defineFormConditional({
|
2646
|
-
type: "object",
|
2647
|
-
properties: {
|
2648
|
-
[fieldId]: {
|
2649
|
-
type: ["string", "boolean"],
|
2650
|
-
const: { $data: `1/${comparedFieldId}` }
|
2651
|
-
},
|
2652
|
-
[comparedFieldId]: { type: ["string", "boolean"] }
|
2653
|
-
},
|
2654
|
-
required: [fieldId, comparedFieldId]
|
2655
|
-
});
|
3371
|
+
function getAssignedUserSignatureFromActions(actions) {
|
3372
|
+
return actions.reduce((signature, action) => {
|
3373
|
+
if (action.type === ActionType.ASSIGN) {
|
3374
|
+
return action.createdBySignature || null;
|
3375
|
+
}
|
3376
|
+
if (action.type === ActionType.UNASSIGN) {
|
3377
|
+
return null;
|
3378
|
+
}
|
3379
|
+
return signature;
|
3380
|
+
}, null);
|
3381
|
+
}
|
3382
|
+
function aggregateActionDeclarations(actions) {
|
3383
|
+
const excludedActions = [
|
3384
|
+
ActionType.REQUEST_CORRECTION,
|
3385
|
+
ActionType.PRINT_CERTIFICATE
|
3386
|
+
];
|
3387
|
+
return actions.reduce((declaration, action) => {
|
3388
|
+
if (excludedActions.some((excludedAction) => excludedAction === action.type)) {
|
3389
|
+
return declaration;
|
3390
|
+
}
|
3391
|
+
if (action.type === ActionType.APPROVE_CORRECTION) {
|
3392
|
+
const requestAction = actions.find(({ id }) => id === action.requestId);
|
3393
|
+
if (!requestAction) {
|
3394
|
+
return declaration;
|
2656
3395
|
}
|
2657
|
-
return
|
2658
|
-
|
2659
|
-
|
2660
|
-
|
2661
|
-
|
2662
|
-
|
2663
|
-
|
2664
|
-
|
2665
|
-
|
2666
|
-
|
2667
|
-
|
2668
|
-
|
2669
|
-
|
2670
|
-
|
2671
|
-
|
2672
|
-
* Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
|
2673
|
-
* @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
|
2674
|
-
* @returns whether the field is falsy (undefined, false, null, empty string)
|
2675
|
-
*
|
2676
|
-
* NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
|
2677
|
-
*
|
2678
|
-
*/
|
2679
|
-
isFalsy: () => defineFormConditional({
|
2680
|
-
type: "object",
|
2681
|
-
properties: {
|
2682
|
-
[fieldId]: {
|
2683
|
-
anyOf: [
|
2684
|
-
{ const: "undefined" },
|
2685
|
-
{ const: false },
|
2686
|
-
{ const: null },
|
2687
|
-
{ const: "" }
|
2688
|
-
]
|
2689
|
-
}
|
2690
|
-
},
|
2691
|
-
anyOf: [
|
2692
|
-
{
|
2693
|
-
required: [fieldId]
|
2694
|
-
},
|
2695
|
-
{
|
2696
|
-
not: {
|
2697
|
-
required: [fieldId]
|
2698
|
-
}
|
2699
|
-
}
|
2700
|
-
]
|
2701
|
-
}),
|
2702
|
-
isUndefined: () => defineFormConditional({
|
2703
|
-
type: "object",
|
2704
|
-
properties: {
|
2705
|
-
[fieldId]: {
|
2706
|
-
type: "string",
|
2707
|
-
enum: ["undefined"]
|
2708
|
-
}
|
2709
|
-
},
|
2710
|
-
not: {
|
2711
|
-
required: [fieldId]
|
3396
|
+
return deepMerge(declaration, requestAction.declaration);
|
3397
|
+
}
|
3398
|
+
return deepMerge(declaration, action.declaration);
|
3399
|
+
}, {});
|
3400
|
+
}
|
3401
|
+
function deepDropNulls(obj) {
|
3402
|
+
if (Array.isArray(obj)) {
|
3403
|
+
return obj.map(deepDropNulls);
|
3404
|
+
}
|
3405
|
+
if (obj !== null && typeof obj === "object") {
|
3406
|
+
return Object.entries(obj).reduce((acc, [key, value]) => {
|
3407
|
+
const cleanedValue = deepDropNulls(value);
|
3408
|
+
if (cleanedValue !== null) {
|
3409
|
+
;
|
3410
|
+
acc[key] = cleanedValue;
|
2712
3411
|
}
|
2713
|
-
|
2714
|
-
|
2715
|
-
|
2716
|
-
|
2717
|
-
|
2718
|
-
|
2719
|
-
|
2720
|
-
|
2721
|
-
|
2722
|
-
|
2723
|
-
|
2724
|
-
|
2725
|
-
|
2726
|
-
|
2727
|
-
|
2728
|
-
|
2729
|
-
|
2730
|
-
|
2731
|
-
|
2732
|
-
|
2733
|
-
|
2734
|
-
|
2735
|
-
|
2736
|
-
|
2737
|
-
|
2738
|
-
|
2739
|
-
|
2740
|
-
|
2741
|
-
|
2742
|
-
|
2743
|
-
|
2744
|
-
|
2745
|
-
|
2746
|
-
|
2747
|
-
|
2748
|
-
|
2749
|
-
|
2750
|
-
|
2751
|
-
|
2752
|
-
|
2753
|
-
|
2754
|
-
|
2755
|
-
|
2756
|
-
|
3412
|
+
return acc;
|
3413
|
+
}, {});
|
3414
|
+
}
|
3415
|
+
return obj;
|
3416
|
+
}
|
3417
|
+
function isUndeclaredDraft(status) {
|
3418
|
+
return status === EventStatus.CREATED;
|
3419
|
+
}
|
3420
|
+
function getAcceptedActions(event2) {
|
3421
|
+
return event2.actions.filter(
|
3422
|
+
(a) => a.status === ActionStatus.Accepted
|
3423
|
+
);
|
3424
|
+
}
|
3425
|
+
var DEFAULT_DATE_OF_EVENT_PROPERTY = "createdAt";
|
3426
|
+
function getCurrentEventState(event2, config) {
|
3427
|
+
const creationAction = event2.actions.find(
|
3428
|
+
(action) => action.type === ActionType.CREATE
|
3429
|
+
);
|
3430
|
+
if (!creationAction) {
|
3431
|
+
throw new Error(`Event ${event2.id} has no creation action`);
|
3432
|
+
}
|
3433
|
+
const acceptedActions = getAcceptedActions(event2);
|
3434
|
+
const declarationUpdateMetadata = getDeclarationActionUpdateMetadata(
|
3435
|
+
event2.actions
|
3436
|
+
);
|
3437
|
+
const declaration = aggregateActionDeclarations(acceptedActions);
|
3438
|
+
let dateOfEvent;
|
3439
|
+
if (config.dateOfEvent) {
|
3440
|
+
const parsedDate = ZodDate.safeParse(
|
3441
|
+
declaration[config.dateOfEvent.fieldId]
|
3442
|
+
);
|
3443
|
+
if (parsedDate.success) {
|
3444
|
+
dateOfEvent = parsedDate.data;
|
3445
|
+
}
|
3446
|
+
} else {
|
3447
|
+
dateOfEvent = event2[DEFAULT_DATE_OF_EVENT_PROPERTY].split("T")[0];
|
3448
|
+
}
|
3449
|
+
return deepDropNulls({
|
3450
|
+
id: event2.id,
|
3451
|
+
type: event2.type,
|
3452
|
+
status: getStatusFromActions(event2.actions),
|
3453
|
+
legalStatuses: getLegalStatuses(event2.actions),
|
3454
|
+
createdAt: creationAction.createdAt,
|
3455
|
+
createdBy: creationAction.createdBy,
|
3456
|
+
createdAtLocation: creationAction.createdAtLocation,
|
3457
|
+
createdBySignature: creationAction.createdBySignature,
|
3458
|
+
updatedAt: declarationUpdateMetadata.createdAt,
|
3459
|
+
assignedTo: getAssignedUserFromActions(acceptedActions),
|
3460
|
+
assignedToSignature: getAssignedUserSignatureFromActions(acceptedActions),
|
3461
|
+
updatedBy: declarationUpdateMetadata.createdBy,
|
3462
|
+
updatedAtLocation: declarationUpdateMetadata.createdAtLocation,
|
3463
|
+
declaration,
|
3464
|
+
trackingId: event2.trackingId,
|
3465
|
+
updatedByUserRole: declarationUpdateMetadata.createdByRole,
|
3466
|
+
dateOfEvent,
|
3467
|
+
flags: getFlagsFromActions(event2.actions)
|
3468
|
+
});
|
3469
|
+
}
|
3470
|
+
function getCurrentEventStateWithDrafts({
|
3471
|
+
event: event2,
|
3472
|
+
drafts,
|
3473
|
+
configuration
|
3474
|
+
}) {
|
3475
|
+
const actions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
3476
|
+
const activeDrafts = findActiveDrafts(event2, drafts).map((draft) => draft.action).flatMap((action) => {
|
3477
|
+
if (action.type === ActionType.REQUEST_CORRECTION) {
|
3478
|
+
return [
|
3479
|
+
action,
|
3480
|
+
{
|
3481
|
+
...action,
|
3482
|
+
type: ActionType.APPROVE_CORRECTION
|
2757
3483
|
}
|
2758
|
-
|
2759
|
-
|
2760
|
-
|
2761
|
-
|
3484
|
+
];
|
3485
|
+
}
|
3486
|
+
return [action];
|
3487
|
+
});
|
3488
|
+
const actionWithDrafts = [...actions, ...activeDrafts].sort();
|
3489
|
+
const withDrafts = {
|
3490
|
+
...event2,
|
3491
|
+
actions: actionWithDrafts
|
3492
|
+
};
|
3493
|
+
return getCurrentEventState(withDrafts, configuration);
|
3494
|
+
}
|
3495
|
+
function applyDraftsToEventIndex(eventIndex, drafts) {
|
3496
|
+
const indexedAt = eventIndex.updatedAt;
|
3497
|
+
const activeDrafts = drafts.filter(({ createdAt }) => new Date(createdAt) > new Date(indexedAt)).map((draft) => draft.action).sort();
|
3498
|
+
if (activeDrafts.length === 0) {
|
3499
|
+
return eventIndex;
|
3500
|
+
}
|
3501
|
+
return {
|
3502
|
+
...eventIndex,
|
3503
|
+
declaration: {
|
3504
|
+
...eventIndex.declaration,
|
3505
|
+
...activeDrafts[activeDrafts.length - 1].declaration
|
3506
|
+
}
|
2762
3507
|
};
|
2763
3508
|
}
|
3509
|
+
function getAnnotationFromDrafts(drafts) {
|
3510
|
+
const actions = drafts.map((draft) => draft.action);
|
3511
|
+
const annotation = actions.reduce((ann, action) => {
|
3512
|
+
return deepMerge(ann, action.annotation ?? {});
|
3513
|
+
}, {});
|
3514
|
+
return deepDropNulls(annotation);
|
3515
|
+
}
|
3516
|
+
function getActionAnnotation({
|
3517
|
+
event: event2,
|
3518
|
+
actionType,
|
3519
|
+
drafts = []
|
3520
|
+
}) {
|
3521
|
+
const activeActions = getAcceptedActions(event2);
|
3522
|
+
const action = activeActions.find(
|
3523
|
+
(activeAction) => actionType === activeAction.type
|
3524
|
+
);
|
3525
|
+
const eventDrafts = drafts.filter((draft) => draft.eventId === event2.id);
|
3526
|
+
const sorted = [
|
3527
|
+
...action ? [action] : [],
|
3528
|
+
...eventDrafts.map((draft) => draft.action)
|
3529
|
+
].sort();
|
3530
|
+
const annotation = sorted.reduce((ann, sortedAction) => {
|
3531
|
+
return deepMerge(ann, sortedAction.annotation ?? {});
|
3532
|
+
}, {});
|
3533
|
+
return deepDropNulls(annotation);
|
3534
|
+
}
|
3535
|
+
|
3536
|
+
// ../commons/src/events/defineConfig.ts
|
3537
|
+
var defineConfig = (config) => {
|
3538
|
+
const input = EventConfig.parse(config);
|
3539
|
+
return input;
|
3540
|
+
};
|
3541
|
+
|
3542
|
+
// ../commons/src/events/transactions.ts
|
3543
|
+
function generateTransactionId() {
|
3544
|
+
return getUUID();
|
3545
|
+
}
|
3546
|
+
|
3547
|
+
// ../commons/src/events/User.ts
|
3548
|
+
var import_zod30 = require("zod");
|
3549
|
+
var User = import_zod30.z.object({
|
3550
|
+
id: import_zod30.z.string(),
|
3551
|
+
name: import_zod30.z.array(
|
3552
|
+
import_zod30.z.object({
|
3553
|
+
use: import_zod30.z.string(),
|
3554
|
+
given: import_zod30.z.array(import_zod30.z.string()),
|
3555
|
+
family: import_zod30.z.string()
|
3556
|
+
})
|
3557
|
+
),
|
3558
|
+
role: import_zod30.z.string(),
|
3559
|
+
signatureFilename: import_zod30.z.string().optional()
|
3560
|
+
});
|
3561
|
+
|
3562
|
+
// ../commons/src/events/test.utils.ts
|
3563
|
+
var import_lodash2 = require("lodash");
|
3564
|
+
var import_addDays = __toESM(require("date-fns/addDays"));
|
2764
3565
|
|
2765
3566
|
// ../commons/src/field-config/field-configuration.ts
|
2766
|
-
function
|
3567
|
+
function createFieldConfig(fieldId, options) {
|
2767
3568
|
const baseField = {
|
2768
3569
|
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" }
|
2812
|
-
})
|
3570
|
+
fieldType: "field",
|
3571
|
+
...options
|
2813
3572
|
};
|
3573
|
+
return createSearchConfig(baseField);
|
2814
3574
|
}
|
2815
3575
|
|
2816
3576
|
// ../commons/src/events/field.ts
|
2817
|
-
function field(fieldId) {
|
3577
|
+
function field(fieldId, options = {}) {
|
2818
3578
|
return {
|
2819
3579
|
/**
|
2820
3580
|
* @private Internal property used for field reference tracking.
|
2821
3581
|
*/
|
2822
3582
|
_fieldId: fieldId,
|
2823
3583
|
...createFieldConditionals(fieldId),
|
2824
|
-
...
|
3584
|
+
...createFieldConfig(fieldId, options)
|
2825
3585
|
};
|
2826
3586
|
}
|
2827
3587
|
|
2828
|
-
// ../commons/src/fixtures/
|
3588
|
+
// ../commons/src/fixtures/forms.ts
|
3589
|
+
var import_date_fns2 = require("date-fns");
|
2829
3590
|
var PRINT_CERTIFICATE_FORM = defineActionForm({
|
2830
3591
|
label: {
|
2831
3592
|
id: "v2.event.tennis-club-membership.action.certificate.form.label",
|
@@ -3521,230 +4282,766 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
|
3521
4282
|
},
|
3522
4283
|
pages: [
|
3523
4284
|
{
|
3524
|
-
id: "applicant",
|
4285
|
+
id: "applicant",
|
4286
|
+
title: {
|
4287
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.who.title",
|
4288
|
+
defaultMessage: "Who is applying for the membership?",
|
4289
|
+
description: "This is the title of the section"
|
4290
|
+
},
|
4291
|
+
fields: [
|
4292
|
+
{
|
4293
|
+
id: "applicant.firstname",
|
4294
|
+
type: FieldType.TEXT,
|
4295
|
+
required: true,
|
4296
|
+
conditionals: [],
|
4297
|
+
label: {
|
4298
|
+
defaultMessage: "Applicant's first name",
|
4299
|
+
description: "This is the label for the field",
|
4300
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.firstname.label"
|
4301
|
+
}
|
4302
|
+
},
|
4303
|
+
{
|
4304
|
+
id: "applicant.surname",
|
4305
|
+
type: FieldType.TEXT,
|
4306
|
+
required: true,
|
4307
|
+
conditionals: [],
|
4308
|
+
label: {
|
4309
|
+
defaultMessage: "Applicant's surname",
|
4310
|
+
description: "This is the label for the field",
|
4311
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.surname.label"
|
4312
|
+
}
|
4313
|
+
},
|
4314
|
+
{
|
4315
|
+
id: "applicant.email",
|
4316
|
+
type: "EMAIL",
|
4317
|
+
required: false,
|
4318
|
+
conditionals: [],
|
4319
|
+
label: {
|
4320
|
+
defaultMessage: "Applicant's email",
|
4321
|
+
description: "This is the label for the field",
|
4322
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.email.label"
|
4323
|
+
}
|
4324
|
+
},
|
4325
|
+
{
|
4326
|
+
id: "applicant.dob",
|
4327
|
+
type: FieldType.DATE,
|
4328
|
+
required: true,
|
4329
|
+
validation: [
|
4330
|
+
{
|
4331
|
+
message: {
|
4332
|
+
defaultMessage: "Please enter a valid date",
|
4333
|
+
description: "This is the error message for invalid date",
|
4334
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.dob.error"
|
4335
|
+
},
|
4336
|
+
validator: field("applicant.dob").isBefore().now()
|
4337
|
+
}
|
4338
|
+
],
|
4339
|
+
conditionals: [
|
4340
|
+
{
|
4341
|
+
type: ConditionalType.SHOW,
|
4342
|
+
conditional: field("applicant.dobUnknown").isFalsy()
|
4343
|
+
}
|
4344
|
+
],
|
4345
|
+
label: {
|
4346
|
+
defaultMessage: "Applicant's date of birth",
|
4347
|
+
description: "This is the label for the field",
|
4348
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.dob.label"
|
4349
|
+
}
|
4350
|
+
},
|
4351
|
+
{
|
4352
|
+
id: "applicant.dobUnknown",
|
4353
|
+
type: FieldType.CHECKBOX,
|
4354
|
+
required: false,
|
4355
|
+
label: {
|
4356
|
+
defaultMessage: "Exact date of birth unknown",
|
4357
|
+
description: "This is the label for the field",
|
4358
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.dobUnknown.label"
|
4359
|
+
},
|
4360
|
+
conditionals: [
|
4361
|
+
{
|
4362
|
+
type: ConditionalType.DISPLAY_ON_REVIEW,
|
4363
|
+
conditional: never()
|
4364
|
+
}
|
4365
|
+
]
|
4366
|
+
},
|
4367
|
+
{
|
4368
|
+
id: "applicant.age",
|
4369
|
+
type: FieldType.NUMBER,
|
4370
|
+
required: true,
|
4371
|
+
label: {
|
4372
|
+
defaultMessage: "Age of tennis-member",
|
4373
|
+
description: "This is the label for the field",
|
4374
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.age.label"
|
4375
|
+
},
|
4376
|
+
conditionals: [
|
4377
|
+
{
|
4378
|
+
type: ConditionalType.SHOW,
|
4379
|
+
conditional: field("applicant.dobUnknown").isEqualTo(true)
|
4380
|
+
}
|
4381
|
+
]
|
4382
|
+
},
|
4383
|
+
{
|
4384
|
+
id: "applicant.image",
|
4385
|
+
type: FieldType.FILE,
|
4386
|
+
required: false,
|
4387
|
+
label: {
|
4388
|
+
defaultMessage: "Applicant's profile picture",
|
4389
|
+
description: "This is the label for the field",
|
4390
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.image.label"
|
4391
|
+
}
|
4392
|
+
},
|
4393
|
+
{
|
4394
|
+
id: "applicant.address",
|
4395
|
+
type: "ADDRESS",
|
4396
|
+
required: true,
|
4397
|
+
conditionals: [],
|
4398
|
+
label: {
|
4399
|
+
defaultMessage: "Applicant's address",
|
4400
|
+
description: "This is the label for the field",
|
4401
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.address.label"
|
4402
|
+
}
|
4403
|
+
}
|
4404
|
+
]
|
4405
|
+
},
|
4406
|
+
{
|
4407
|
+
id: "senior-pass",
|
4408
|
+
conditional: field("applicant.dob").isBefore().date("1950-01-01"),
|
3525
4409
|
title: {
|
3526
|
-
id: "v2.event.tennis-club-membership.action.declare.form.section.
|
3527
|
-
defaultMessage: "
|
4410
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.senior-pass.title",
|
4411
|
+
defaultMessage: "Assign senior pass for applicant",
|
3528
4412
|
description: "This is the title of the section"
|
3529
4413
|
},
|
3530
4414
|
fields: [
|
3531
4415
|
{
|
3532
|
-
id: "
|
4416
|
+
id: "senior-pass.id",
|
3533
4417
|
type: FieldType.TEXT,
|
3534
4418
|
required: true,
|
4419
|
+
label: {
|
4420
|
+
defaultMessage: "Senior pass ID",
|
4421
|
+
description: "This is the label for the field",
|
4422
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.senior-pass.field.id.label"
|
4423
|
+
}
|
4424
|
+
}
|
4425
|
+
]
|
4426
|
+
},
|
4427
|
+
{
|
4428
|
+
id: "recommender",
|
4429
|
+
title: {
|
4430
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.title",
|
4431
|
+
defaultMessage: "Who is recommending the applicant?",
|
4432
|
+
description: "This is the title of the section"
|
4433
|
+
},
|
4434
|
+
fields: [
|
4435
|
+
{
|
4436
|
+
id: "recommender.none",
|
4437
|
+
type: "CHECKBOX",
|
4438
|
+
required: false,
|
3535
4439
|
conditionals: [],
|
3536
4440
|
label: {
|
3537
|
-
defaultMessage: "
|
4441
|
+
defaultMessage: "No recommender",
|
3538
4442
|
description: "This is the label for the field",
|
3539
|
-
id: "v2.event.tennis-club-membership.action.declare.form.section.
|
4443
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.none.label"
|
3540
4444
|
}
|
3541
4445
|
},
|
3542
4446
|
{
|
3543
|
-
id: "
|
4447
|
+
id: "recommender.firstname",
|
3544
4448
|
type: FieldType.TEXT,
|
3545
4449
|
required: true,
|
3546
|
-
conditionals: [
|
4450
|
+
conditionals: [
|
4451
|
+
{
|
4452
|
+
type: ConditionalType.SHOW,
|
4453
|
+
conditional: field("recommender.none").isFalsy()
|
4454
|
+
}
|
4455
|
+
],
|
3547
4456
|
label: {
|
3548
|
-
defaultMessage: "
|
4457
|
+
defaultMessage: "Recommender's first name",
|
3549
4458
|
description: "This is the label for the field",
|
3550
|
-
id: "v2.event.tennis-club-membership.action.declare.form.section.
|
4459
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.firstname.label"
|
3551
4460
|
}
|
3552
4461
|
},
|
3553
4462
|
{
|
3554
|
-
id: "
|
3555
|
-
type:
|
3556
|
-
required:
|
3557
|
-
conditionals: [
|
4463
|
+
id: "recommender.surname",
|
4464
|
+
type: FieldType.TEXT,
|
4465
|
+
required: true,
|
4466
|
+
conditionals: [
|
4467
|
+
{
|
4468
|
+
type: ConditionalType.SHOW,
|
4469
|
+
conditional: field("recommender.none").isFalsy()
|
4470
|
+
}
|
4471
|
+
],
|
3558
4472
|
label: {
|
3559
|
-
defaultMessage: "
|
4473
|
+
defaultMessage: "Recommender's surname",
|
3560
4474
|
description: "This is the label for the field",
|
3561
|
-
id: "v2.event.tennis-club-membership.action.declare.form.section.
|
4475
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.surname.label"
|
4476
|
+
}
|
4477
|
+
},
|
4478
|
+
{
|
4479
|
+
id: "recommender.id",
|
4480
|
+
type: FieldType.TEXT,
|
4481
|
+
required: true,
|
4482
|
+
conditionals: [
|
4483
|
+
{
|
4484
|
+
type: ConditionalType.SHOW,
|
4485
|
+
conditional: field("recommender.none").isFalsy()
|
4486
|
+
}
|
4487
|
+
],
|
4488
|
+
label: {
|
4489
|
+
defaultMessage: "Recommender's membership ID",
|
4490
|
+
description: "This is the label for the field",
|
4491
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.id.label"
|
3562
4492
|
}
|
4493
|
+
}
|
4494
|
+
]
|
4495
|
+
}
|
4496
|
+
]
|
4497
|
+
});
|
4498
|
+
var statusOptions = [
|
4499
|
+
{
|
4500
|
+
value: "ALL",
|
4501
|
+
label: {
|
4502
|
+
defaultMessage: "Any status",
|
4503
|
+
description: "Option for form field: status of record",
|
4504
|
+
id: "v2.advancedSearch.form.recordStatusAny"
|
4505
|
+
}
|
4506
|
+
},
|
4507
|
+
{
|
4508
|
+
value: EventStatus.CREATED,
|
4509
|
+
label: {
|
4510
|
+
defaultMessage: "Draft",
|
4511
|
+
description: "Option for form field: status of record",
|
4512
|
+
id: "v2.advancedSearch.form.recordStatusCreated"
|
4513
|
+
}
|
4514
|
+
},
|
4515
|
+
{
|
4516
|
+
value: EventStatus.NOTIFIED,
|
4517
|
+
label: {
|
4518
|
+
defaultMessage: "Notified",
|
4519
|
+
description: "Option for form field: status of record",
|
4520
|
+
id: "v2.advancedSearch.form.recordStatusNotified"
|
4521
|
+
}
|
4522
|
+
},
|
4523
|
+
{
|
4524
|
+
value: EventStatus.DECLARED,
|
4525
|
+
label: {
|
4526
|
+
defaultMessage: "Declared",
|
4527
|
+
description: "Option for form field: status of record",
|
4528
|
+
id: "v2.advancedSearch.form.recordStatusDeclared"
|
4529
|
+
}
|
4530
|
+
},
|
4531
|
+
{
|
4532
|
+
value: EventStatus.VALIDATED,
|
4533
|
+
label: {
|
4534
|
+
defaultMessage: "Validated",
|
4535
|
+
description: "Option for form field: status of record",
|
4536
|
+
id: "v2.advancedSearch.form.recordStatusValidated"
|
4537
|
+
}
|
4538
|
+
},
|
4539
|
+
{
|
4540
|
+
value: EventStatus.REGISTERED,
|
4541
|
+
label: {
|
4542
|
+
defaultMessage: "Registered",
|
4543
|
+
description: "Option for form field: status of record",
|
4544
|
+
id: "v2.advancedSearch.form.recordStatusRegistered"
|
4545
|
+
}
|
4546
|
+
},
|
4547
|
+
{
|
4548
|
+
value: EventStatus.CERTIFIED,
|
4549
|
+
label: {
|
4550
|
+
defaultMessage: "Certified",
|
4551
|
+
description: "Option for form field: status of record",
|
4552
|
+
id: "v2.advancedSearch.form.recordStatusCertified"
|
4553
|
+
}
|
4554
|
+
},
|
4555
|
+
{
|
4556
|
+
value: EventStatus.REJECTED,
|
4557
|
+
label: {
|
4558
|
+
defaultMessage: "Rejected",
|
4559
|
+
description: "Option for form field: status of record",
|
4560
|
+
id: "v2.advancedSearch.form.recordStatusRejected"
|
4561
|
+
}
|
4562
|
+
},
|
4563
|
+
{
|
4564
|
+
value: EventStatus.ARCHIVED,
|
4565
|
+
label: {
|
4566
|
+
defaultMessage: "Archived",
|
4567
|
+
description: "Option for form field: status of record",
|
4568
|
+
id: "v2.advancedSearch.form.recordStatusArchived"
|
4569
|
+
}
|
4570
|
+
}
|
4571
|
+
];
|
4572
|
+
var timePeriodOptions = [
|
4573
|
+
{
|
4574
|
+
label: {
|
4575
|
+
defaultMessage: "Last 7 days",
|
4576
|
+
description: "Label for option of time period select: last 7 days",
|
4577
|
+
id: "form.section.label.timePeriodLast7Days"
|
4578
|
+
},
|
4579
|
+
value: `${(0, import_date_fns2.format)((0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 7), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
|
4580
|
+
/* @__PURE__ */ new Date(),
|
4581
|
+
"yyyy-MM-dd"
|
4582
|
+
)}`
|
4583
|
+
},
|
4584
|
+
{
|
4585
|
+
label: {
|
4586
|
+
defaultMessage: "Last 30 days",
|
4587
|
+
description: "Label for option of time period select: last 30 days",
|
4588
|
+
id: "form.section.label.timePeriodLast30Days"
|
4589
|
+
},
|
4590
|
+
value: `${(0, import_date_fns2.format)((0, import_date_fns2.subMonths)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
|
4591
|
+
/* @__PURE__ */ new Date(),
|
4592
|
+
"yyyy-MM-dd"
|
4593
|
+
)}`
|
4594
|
+
},
|
4595
|
+
{
|
4596
|
+
label: {
|
4597
|
+
defaultMessage: "Last 90 days",
|
4598
|
+
description: "Label for option of time period select: last 90 days",
|
4599
|
+
id: "form.section.label.timePeriodLast90Days"
|
4600
|
+
},
|
4601
|
+
value: `${(0, import_date_fns2.format)((0, import_date_fns2.subQuarters)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
|
4602
|
+
/* @__PURE__ */ new Date(),
|
4603
|
+
"yyyy-MM-dd"
|
4604
|
+
)}`
|
4605
|
+
},
|
4606
|
+
{
|
4607
|
+
label: {
|
4608
|
+
defaultMessage: "Last year",
|
4609
|
+
description: "Label for option of time period select: last year",
|
4610
|
+
id: "form.section.label.timePeriodLastYear"
|
4611
|
+
},
|
4612
|
+
value: `${(0, import_date_fns2.format)((0, import_date_fns2.subYears)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
|
4613
|
+
/* @__PURE__ */ new Date(),
|
4614
|
+
"yyyy-MM-dd"
|
4615
|
+
)}`
|
4616
|
+
}
|
4617
|
+
];
|
4618
|
+
|
4619
|
+
// ../commons/src/fixtures/tennis-club-membership-event.ts
|
4620
|
+
var tennisClubMembershipEvent = defineConfig({
|
4621
|
+
id: TENNIS_CLUB_MEMBERSHIP,
|
4622
|
+
label: {
|
4623
|
+
defaultMessage: "Tennis club membership application",
|
4624
|
+
description: "This is what this event is referred as in the system",
|
4625
|
+
id: "v2.event.tennis-club-membership.label"
|
4626
|
+
},
|
4627
|
+
title: {
|
4628
|
+
defaultMessage: "{applicant.firstname} {applicant.surname}",
|
4629
|
+
description: "This is the title of the summary",
|
4630
|
+
id: "v2.event.tennis-club-membership.title"
|
4631
|
+
},
|
4632
|
+
summary: {
|
4633
|
+
fields: [
|
4634
|
+
{
|
4635
|
+
id: "applicant.firstname",
|
4636
|
+
label: {
|
4637
|
+
defaultMessage: "Applicant's first name",
|
4638
|
+
description: "This is the label for the field",
|
4639
|
+
id: "event.tennis-club-membership.summary.field.firstname.label"
|
4640
|
+
},
|
4641
|
+
value: {
|
4642
|
+
defaultMessage: "{applicant.firstname}",
|
4643
|
+
description: "This is the value to show in the summary",
|
4644
|
+
id: "event.tennis-club-membership.summary.field.firstname"
|
4645
|
+
},
|
4646
|
+
emptyValueMessage: {
|
4647
|
+
defaultMessage: "First name is not provided",
|
4648
|
+
description: "This is the message to show when the field is empty",
|
4649
|
+
id: "event.tennis-club-membership.summary.field.firstname.empty"
|
4650
|
+
}
|
4651
|
+
},
|
4652
|
+
{
|
4653
|
+
fieldId: "applicant.surname",
|
4654
|
+
label: {
|
4655
|
+
defaultMessage: "Applicant's last name",
|
4656
|
+
description: "Label for surname",
|
4657
|
+
id: "v2.event.tennis-club-membership.summary.field.surname.label"
|
4658
|
+
}
|
4659
|
+
},
|
4660
|
+
{
|
4661
|
+
fieldId: "applicant.email"
|
4662
|
+
}
|
4663
|
+
]
|
4664
|
+
},
|
4665
|
+
actions: [
|
4666
|
+
{
|
4667
|
+
type: ActionType.READ,
|
4668
|
+
label: {
|
4669
|
+
id: "v2.event.tennis-club-membership.action.read.label",
|
4670
|
+
defaultMessage: "Read",
|
4671
|
+
description: "Title of the read only page"
|
4672
|
+
},
|
4673
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
4674
|
+
},
|
4675
|
+
{
|
4676
|
+
type: ActionType.DECLARE,
|
4677
|
+
label: {
|
4678
|
+
defaultMessage: "Send an application",
|
4679
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4680
|
+
id: "event.tennis-club-membership.action.declare.label"
|
4681
|
+
},
|
4682
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
4683
|
+
},
|
4684
|
+
{
|
4685
|
+
type: ActionType.VALIDATE,
|
4686
|
+
label: {
|
4687
|
+
defaultMessage: "Validate",
|
4688
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4689
|
+
id: "event.tennis-club-membership.action.validate.label"
|
4690
|
+
},
|
4691
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
4692
|
+
},
|
4693
|
+
{
|
4694
|
+
type: ActionType.REGISTER,
|
4695
|
+
label: {
|
4696
|
+
defaultMessage: "Register",
|
4697
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4698
|
+
id: "event.tennis-club-membership.action.register.label"
|
4699
|
+
},
|
4700
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
4701
|
+
},
|
4702
|
+
{
|
4703
|
+
type: ActionType.REQUEST_CORRECTION,
|
4704
|
+
label: {
|
4705
|
+
defaultMessage: "Request correction",
|
4706
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4707
|
+
id: "event.tennis-club-membership.action.correction.request.label"
|
4708
|
+
},
|
4709
|
+
onboardingForm: [
|
4710
|
+
{
|
4711
|
+
id: "correction-requester",
|
4712
|
+
type: PageTypes.enum.FORM,
|
4713
|
+
title: {
|
4714
|
+
id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
|
4715
|
+
defaultMessage: "Correction requester",
|
4716
|
+
description: "This is the title of the section"
|
4717
|
+
},
|
4718
|
+
fields: [
|
4719
|
+
{
|
4720
|
+
id: "correction.requester.relationshop.intro",
|
4721
|
+
type: "PAGE_HEADER",
|
4722
|
+
label: {
|
4723
|
+
id: "correction.requester.relationshop.intro.label",
|
4724
|
+
defaultMessage: "Note: In the case that the child is now of legal age (18) then only they should be able to request a change to their birth record.",
|
4725
|
+
description: "The title for the corrector form"
|
4726
|
+
}
|
4727
|
+
},
|
4728
|
+
{
|
4729
|
+
id: "correction.requester.relationship",
|
4730
|
+
type: "RADIO_GROUP",
|
4731
|
+
label: {
|
4732
|
+
id: "v2.correction.corrector.title",
|
4733
|
+
defaultMessage: "Who is requesting a change to this record?",
|
4734
|
+
description: "The title for the corrector form"
|
4735
|
+
},
|
4736
|
+
defaultValue: "",
|
4737
|
+
options: [
|
4738
|
+
{
|
4739
|
+
value: "INFORMANT",
|
4740
|
+
label: {
|
4741
|
+
id: "v2.correction.corrector.informant",
|
4742
|
+
defaultMessage: "Informant",
|
4743
|
+
description: "Label for informant option in certificate correction form"
|
4744
|
+
}
|
4745
|
+
},
|
4746
|
+
{
|
4747
|
+
value: "ANOTHER_AGENT",
|
4748
|
+
label: {
|
4749
|
+
id: "v2.correction.corrector.anotherAgent",
|
4750
|
+
defaultMessage: "Another registration agent or field agent",
|
4751
|
+
description: "Label for another registration or field agent option in certificate correction form"
|
4752
|
+
}
|
4753
|
+
},
|
4754
|
+
{
|
4755
|
+
value: "REGISTRAR",
|
4756
|
+
label: {
|
4757
|
+
id: "v2.correction.corrector.me",
|
4758
|
+
defaultMessage: "Me (Registrar)",
|
4759
|
+
description: "Label for registrar option in certificate correction form"
|
4760
|
+
}
|
4761
|
+
},
|
4762
|
+
{
|
4763
|
+
value: "OTHER",
|
4764
|
+
label: {
|
4765
|
+
id: "v2.correction.corrector.others",
|
4766
|
+
defaultMessage: "Someone else",
|
4767
|
+
description: "Label for someone else option in certificate correction form"
|
4768
|
+
}
|
4769
|
+
}
|
4770
|
+
]
|
4771
|
+
}
|
4772
|
+
]
|
3563
4773
|
},
|
3564
4774
|
{
|
3565
|
-
id: "
|
3566
|
-
type:
|
3567
|
-
|
3568
|
-
|
4775
|
+
id: "identity-check",
|
4776
|
+
type: PageTypes.enum.FORM,
|
4777
|
+
title: {
|
4778
|
+
id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
|
4779
|
+
defaultMessage: "Verify their identity",
|
4780
|
+
description: "This is the title of the section"
|
4781
|
+
},
|
4782
|
+
fields: [
|
3569
4783
|
{
|
3570
|
-
|
3571
|
-
|
3572
|
-
|
3573
|
-
id: "
|
3574
|
-
|
3575
|
-
|
3576
|
-
|
3577
|
-
|
3578
|
-
conditionals: [
|
4784
|
+
id: "correction.identity-check.instructions",
|
4785
|
+
type: "PAGE_HEADER",
|
4786
|
+
label: {
|
4787
|
+
id: "correction.corrector.identity.instruction",
|
4788
|
+
defaultMessage: "Please verify the identity of the person making this request",
|
4789
|
+
description: "The title for the corrector form"
|
4790
|
+
}
|
4791
|
+
},
|
3579
4792
|
{
|
3580
|
-
|
3581
|
-
|
4793
|
+
id: "correction.identity-check.verified",
|
4794
|
+
type: "RADIO_GROUP",
|
4795
|
+
label: {
|
4796
|
+
id: "correction.corrector.identity.verified.label",
|
4797
|
+
defaultMessage: "Identity verified",
|
4798
|
+
description: "The title for the corrector form"
|
4799
|
+
},
|
4800
|
+
defaultValue: "",
|
4801
|
+
required: true,
|
4802
|
+
options: [
|
4803
|
+
{
|
4804
|
+
value: "VERIFIED",
|
4805
|
+
label: {
|
4806
|
+
id: "correction.corrector.identity.verified",
|
4807
|
+
defaultMessage: "I have verified their identity",
|
4808
|
+
description: "Label for verified option in corrector identity check page"
|
4809
|
+
}
|
4810
|
+
}
|
4811
|
+
]
|
3582
4812
|
}
|
3583
|
-
]
|
3584
|
-
|
3585
|
-
|
3586
|
-
|
3587
|
-
id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.dob.label"
|
3588
|
-
}
|
3589
|
-
},
|
4813
|
+
]
|
4814
|
+
}
|
4815
|
+
],
|
4816
|
+
additionalDetailsForm: [
|
3590
4817
|
{
|
3591
|
-
id: "
|
3592
|
-
type:
|
3593
|
-
|
3594
|
-
|
3595
|
-
defaultMessage: "
|
3596
|
-
description: "This is the
|
3597
|
-
id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.dobUnknown.label"
|
4818
|
+
id: "correction-request.supporting-documents",
|
4819
|
+
type: PageTypes.enum.FORM,
|
4820
|
+
title: {
|
4821
|
+
id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
|
4822
|
+
defaultMessage: "Upload supporting documents",
|
4823
|
+
description: "This is the title of the section"
|
3598
4824
|
},
|
3599
|
-
|
4825
|
+
fields: [
|
3600
4826
|
{
|
3601
|
-
|
3602
|
-
|
4827
|
+
id: "correction.supportingDocs.introduction",
|
4828
|
+
type: "PAGE_HEADER",
|
4829
|
+
label: {
|
4830
|
+
id: "correction.corrector.paragraph.title",
|
4831
|
+
defaultMessage: "For all record corrections at a minimum an affidavit must be provided. For material errors and omissions eg. in paternity cases, a court order must also be provided.",
|
4832
|
+
description: "The title for the corrector form"
|
4833
|
+
}
|
4834
|
+
},
|
4835
|
+
{
|
4836
|
+
id: "correction.supportingDocs",
|
4837
|
+
type: FieldType.FILE,
|
4838
|
+
label: {
|
4839
|
+
id: "correction.corrector.title",
|
4840
|
+
defaultMessage: "Upload supporting documents",
|
4841
|
+
description: "The title for the corrector form"
|
4842
|
+
}
|
4843
|
+
},
|
4844
|
+
{
|
4845
|
+
id: "correction.request.supportingDocuments",
|
4846
|
+
type: "RADIO_GROUP",
|
4847
|
+
label: {
|
4848
|
+
id: "correction.corrector.title",
|
4849
|
+
defaultMessage: "Who is requesting a change to this record?",
|
4850
|
+
description: "The title for the corrector form"
|
4851
|
+
},
|
4852
|
+
defaultValue: "",
|
4853
|
+
configuration: {
|
4854
|
+
styles: {
|
4855
|
+
size: "NORMAL"
|
4856
|
+
}
|
4857
|
+
},
|
4858
|
+
options: [
|
4859
|
+
{
|
4860
|
+
value: "ATTEST",
|
4861
|
+
label: {
|
4862
|
+
id: "correction.supportingDocuments.attest.label",
|
4863
|
+
defaultMessage: "I attest to seeing supporting documentation and have a copy filed at my office",
|
4864
|
+
description: ""
|
4865
|
+
}
|
4866
|
+
},
|
4867
|
+
{
|
4868
|
+
value: "NOT_NEEDED",
|
4869
|
+
label: {
|
4870
|
+
id: "correction.supportingDocuments.notNeeded.label",
|
4871
|
+
defaultMessage: "No supporting documents required",
|
4872
|
+
description: ""
|
4873
|
+
}
|
4874
|
+
}
|
4875
|
+
]
|
3603
4876
|
}
|
3604
4877
|
]
|
3605
4878
|
},
|
3606
4879
|
{
|
3607
|
-
id: "
|
3608
|
-
type:
|
3609
|
-
|
3610
|
-
|
3611
|
-
defaultMessage: "
|
3612
|
-
description: "This is the
|
3613
|
-
id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.age.label"
|
4880
|
+
id: "correction-request.additional-details",
|
4881
|
+
type: PageTypes.enum.FORM,
|
4882
|
+
title: {
|
4883
|
+
id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
|
4884
|
+
defaultMessage: "Reason for correction",
|
4885
|
+
description: "This is the title of the section"
|
3614
4886
|
},
|
3615
|
-
|
4887
|
+
fields: [
|
3616
4888
|
{
|
3617
|
-
|
3618
|
-
|
4889
|
+
id: "correction.request.reason",
|
4890
|
+
type: FieldType.TEXT,
|
4891
|
+
label: {
|
4892
|
+
id: "correction.reason.title",
|
4893
|
+
defaultMessage: "Reason for correction?",
|
4894
|
+
description: "The title for the corrector form"
|
4895
|
+
}
|
3619
4896
|
}
|
3620
4897
|
]
|
3621
|
-
}
|
3622
|
-
|
3623
|
-
|
3624
|
-
|
3625
|
-
|
3626
|
-
|
3627
|
-
|
3628
|
-
|
3629
|
-
|
3630
|
-
|
3631
|
-
|
4898
|
+
}
|
4899
|
+
]
|
4900
|
+
},
|
4901
|
+
{
|
4902
|
+
type: ActionType.APPROVE_CORRECTION,
|
4903
|
+
label: {
|
4904
|
+
defaultMessage: "Approve correction",
|
4905
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4906
|
+
id: "event.tennis-club-membership.action.correction.approve.label"
|
4907
|
+
}
|
4908
|
+
},
|
4909
|
+
{
|
4910
|
+
type: ActionType.PRINT_CERTIFICATE,
|
4911
|
+
label: {
|
4912
|
+
id: "v2.event.tennis-club-membership.action.collect-certificate.label",
|
4913
|
+
defaultMessage: "Print certificate",
|
4914
|
+
description: "This is shown as the action name anywhere the user can trigger the action from"
|
4915
|
+
},
|
4916
|
+
printForm: PRINT_CERTIFICATE_FORM,
|
4917
|
+
conditionals: [
|
3632
4918
|
{
|
3633
|
-
|
3634
|
-
|
3635
|
-
|
3636
|
-
|
3637
|
-
|
3638
|
-
|
3639
|
-
|
3640
|
-
|
3641
|
-
|
4919
|
+
type: "SHOW",
|
4920
|
+
conditional: defineConditional({
|
4921
|
+
type: "object",
|
4922
|
+
properties: {
|
4923
|
+
$event: {
|
4924
|
+
type: "object",
|
4925
|
+
properties: {
|
4926
|
+
actions: {
|
4927
|
+
type: "array",
|
4928
|
+
contains: {
|
4929
|
+
type: "object",
|
4930
|
+
properties: {
|
4931
|
+
type: {
|
4932
|
+
const: "REGISTER"
|
4933
|
+
},
|
4934
|
+
draft: {
|
4935
|
+
type: "boolean"
|
4936
|
+
}
|
4937
|
+
},
|
4938
|
+
required: ["type"],
|
4939
|
+
not: {
|
4940
|
+
properties: {
|
4941
|
+
draft: {
|
4942
|
+
const: true
|
4943
|
+
}
|
4944
|
+
}
|
4945
|
+
}
|
4946
|
+
}
|
4947
|
+
}
|
4948
|
+
},
|
4949
|
+
required: ["actions"]
|
4950
|
+
}
|
4951
|
+
},
|
4952
|
+
required: ["$event"]
|
4953
|
+
})
|
3642
4954
|
}
|
3643
4955
|
]
|
3644
4956
|
},
|
3645
4957
|
{
|
3646
|
-
|
3647
|
-
|
4958
|
+
type: ActionType.ARCHIVE,
|
4959
|
+
label: {
|
4960
|
+
id: "v2.event.tennis-club-membership.action.archive.label",
|
4961
|
+
defaultMessage: "Archive",
|
4962
|
+
description: "This is shown as the action name anywhere the user can trigger the action from"
|
4963
|
+
}
|
4964
|
+
},
|
4965
|
+
{
|
4966
|
+
type: ActionType.REJECT,
|
4967
|
+
label: {
|
4968
|
+
id: "v2.event.tennis-club-membership.action.reject.label",
|
4969
|
+
defaultMessage: "Reject",
|
4970
|
+
description: "This is shown as the action name anywhere the user can trigger the action from"
|
4971
|
+
}
|
4972
|
+
}
|
4973
|
+
],
|
4974
|
+
advancedSearch: [
|
4975
|
+
{
|
4976
|
+
title: {
|
4977
|
+
defaultMessage: "Registration details",
|
4978
|
+
description: "The title of Registration details accordion",
|
4979
|
+
id: "v2.advancedSearch.form.registrationDetails"
|
4980
|
+
},
|
4981
|
+
fields: [
|
4982
|
+
event("legalStatus.REGISTERED.createdAtLocation").exact(),
|
4983
|
+
event("legalStatus.REGISTERED.createdAt").range(),
|
4984
|
+
event("status", statusOptions).exact(),
|
4985
|
+
event("updatedAt", timePeriodOptions).range()
|
4986
|
+
]
|
4987
|
+
},
|
4988
|
+
{
|
3648
4989
|
title: {
|
3649
|
-
|
3650
|
-
|
3651
|
-
|
4990
|
+
defaultMessage: "Applicant's details",
|
4991
|
+
description: "Applicant details search field section title",
|
4992
|
+
id: "v2.event.tennis-club-membership.search.applicants"
|
3652
4993
|
},
|
3653
4994
|
fields: [
|
3654
|
-
|
3655
|
-
|
3656
|
-
|
3657
|
-
|
3658
|
-
label: {
|
3659
|
-
defaultMessage: "Senior pass ID",
|
3660
|
-
description: "This is the label for the field",
|
3661
|
-
id: "v2.event.tennis-club-membership.action.declare.form.section.senior-pass.field.id.label"
|
3662
|
-
}
|
3663
|
-
}
|
4995
|
+
field("applicant.firstname").fuzzy(),
|
4996
|
+
field("applicant.surname").fuzzy(),
|
4997
|
+
field("applicant.dob").range(),
|
4998
|
+
field("applicant.email").exact()
|
3664
4999
|
]
|
3665
5000
|
},
|
3666
5001
|
{
|
3667
|
-
id: "recommender",
|
3668
5002
|
title: {
|
3669
|
-
|
3670
|
-
|
3671
|
-
|
5003
|
+
defaultMessage: "Recommender's details",
|
5004
|
+
description: "Recommender details search field section title",
|
5005
|
+
id: "v2.event.tennis-club-membership.search.recommender"
|
3672
5006
|
},
|
3673
5007
|
fields: [
|
3674
|
-
|
3675
|
-
|
3676
|
-
type: "CHECKBOX",
|
3677
|
-
required: false,
|
3678
|
-
conditionals: [],
|
3679
|
-
label: {
|
3680
|
-
defaultMessage: "No recommender",
|
3681
|
-
description: "This is the label for the field",
|
3682
|
-
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.none.label"
|
3683
|
-
}
|
3684
|
-
},
|
3685
|
-
{
|
3686
|
-
id: "recommender.firstname",
|
3687
|
-
type: FieldType.TEXT,
|
3688
|
-
required: true,
|
3689
|
-
conditionals: [
|
3690
|
-
{
|
3691
|
-
type: ConditionalType.SHOW,
|
3692
|
-
conditional: field("recommender.none").isFalsy()
|
3693
|
-
}
|
3694
|
-
],
|
3695
|
-
label: {
|
3696
|
-
defaultMessage: "Recommender's first name",
|
3697
|
-
description: "This is the label for the field",
|
3698
|
-
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.firstname.label"
|
3699
|
-
}
|
3700
|
-
},
|
3701
|
-
{
|
3702
|
-
id: "recommender.surname",
|
3703
|
-
type: FieldType.TEXT,
|
3704
|
-
required: true,
|
3705
|
-
conditionals: [
|
3706
|
-
{
|
3707
|
-
type: ConditionalType.SHOW,
|
3708
|
-
conditional: field("recommender.none").isFalsy()
|
3709
|
-
}
|
3710
|
-
],
|
3711
|
-
label: {
|
3712
|
-
defaultMessage: "Recommender's surname",
|
3713
|
-
description: "This is the label for the field",
|
3714
|
-
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.surname.label"
|
3715
|
-
}
|
3716
|
-
},
|
3717
|
-
{
|
3718
|
-
id: "recommender.id",
|
3719
|
-
type: FieldType.TEXT,
|
3720
|
-
required: true,
|
3721
|
-
conditionals: [
|
3722
|
-
{
|
3723
|
-
type: ConditionalType.SHOW,
|
3724
|
-
conditional: field("recommender.none").isFalsy()
|
3725
|
-
}
|
3726
|
-
],
|
3727
|
-
label: {
|
3728
|
-
defaultMessage: "Recommender's membership ID",
|
3729
|
-
description: "This is the label for the field",
|
3730
|
-
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.id.label"
|
3731
|
-
}
|
3732
|
-
}
|
5008
|
+
field("recommender.firstname").fuzzy(),
|
5009
|
+
field("recommender.surname").fuzzy()
|
3733
5010
|
]
|
3734
5011
|
}
|
3735
|
-
]
|
5012
|
+
],
|
5013
|
+
declaration: TENNIS_CLUB_DECLARATION_FORM
|
3736
5014
|
});
|
3737
|
-
var
|
3738
|
-
|
5015
|
+
var WorkqueueFixture = defineWorkqueues([
|
5016
|
+
{
|
5017
|
+
columns: [],
|
5018
|
+
slug: "in-progress",
|
5019
|
+
name: {
|
5020
|
+
id: "workqueues.inProgress.title",
|
5021
|
+
defaultMessage: "In progress",
|
5022
|
+
description: "Title of in progress workqueue"
|
5023
|
+
},
|
5024
|
+
query: {
|
5025
|
+
type: "and",
|
5026
|
+
clauses: [{ eventType: tennisClubMembershipEvent.id }]
|
5027
|
+
},
|
5028
|
+
actions: [],
|
5029
|
+
icon: "Draft"
|
5030
|
+
}
|
5031
|
+
]);
|
5032
|
+
|
5033
|
+
// ../commons/src/fixtures/football-club-membership-event.ts
|
5034
|
+
var footballClubMembershipEvent = defineConfig({
|
5035
|
+
id: "FOOTBALL_CLUB_MEMBERSHIP",
|
3739
5036
|
label: {
|
3740
|
-
defaultMessage: "
|
5037
|
+
defaultMessage: "Football club membership application",
|
3741
5038
|
description: "This is what this event is referred as in the system",
|
3742
|
-
id: "event.
|
5039
|
+
id: "event.football-club-membership.label"
|
3743
5040
|
},
|
3744
5041
|
title: {
|
3745
5042
|
defaultMessage: "{applicant.firstname} {applicant.surname}",
|
3746
5043
|
description: "This is the title of the summary",
|
3747
|
-
id: "v2.event.
|
5044
|
+
id: "v2.event.football-club-membership.title"
|
3748
5045
|
},
|
3749
5046
|
summary: {
|
3750
5047
|
fields: [
|
@@ -3753,46 +5050,48 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3753
5050
|
label: {
|
3754
5051
|
defaultMessage: "Applicant's first name",
|
3755
5052
|
description: "This is the label for the field",
|
3756
|
-
id: "event.
|
5053
|
+
id: "event.football-club-membership.summary.field.firstname.label"
|
3757
5054
|
},
|
3758
5055
|
value: {
|
3759
5056
|
defaultMessage: "{applicant.firstname}",
|
3760
5057
|
description: "This is the value to show in the summary",
|
3761
|
-
id: "event.
|
5058
|
+
id: "event.football-club-membership.summary.field.firstname"
|
3762
5059
|
},
|
3763
5060
|
emptyValueMessage: {
|
3764
5061
|
defaultMessage: "First name is not provided",
|
3765
5062
|
description: "This is the message to show when the field is empty",
|
3766
|
-
id: "event.
|
5063
|
+
id: "event.football-club-membership.summary.field.firstname.empty"
|
3767
5064
|
}
|
3768
5065
|
},
|
3769
5066
|
{
|
3770
|
-
|
5067
|
+
fieldId: "applicant.surname",
|
3771
5068
|
label: {
|
3772
5069
|
defaultMessage: "Applicant's last name",
|
3773
|
-
description: "
|
3774
|
-
id: "event.
|
3775
|
-
},
|
3776
|
-
value: {
|
3777
|
-
defaultMessage: "{applicant.surname}",
|
3778
|
-
description: "This is the value to show in the summary",
|
3779
|
-
id: "event.tennis-club-membership.summary.field.surname"
|
3780
|
-
},
|
3781
|
-
emptyValueMessage: {
|
3782
|
-
defaultMessage: "Last name is not provided",
|
3783
|
-
description: "This is the message to show when the field is empty",
|
3784
|
-
id: "event.tennis-club-membership.summary.field.surname.empty"
|
5070
|
+
description: "Label for surname",
|
5071
|
+
id: "v2.event.football-club-membership.summary.field.surname.label"
|
3785
5072
|
}
|
5073
|
+
},
|
5074
|
+
{
|
5075
|
+
fieldId: "applicant.email"
|
3786
5076
|
}
|
3787
5077
|
]
|
3788
5078
|
},
|
3789
5079
|
actions: [
|
5080
|
+
{
|
5081
|
+
type: ActionType.READ,
|
5082
|
+
label: {
|
5083
|
+
id: "v2.event.football-club-membership.action.read.label",
|
5084
|
+
defaultMessage: "Read",
|
5085
|
+
description: "Title of the read only page"
|
5086
|
+
},
|
5087
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
5088
|
+
},
|
3790
5089
|
{
|
3791
5090
|
type: ActionType.DECLARE,
|
3792
5091
|
label: {
|
3793
5092
|
defaultMessage: "Send an application",
|
3794
5093
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
3795
|
-
id: "event.
|
5094
|
+
id: "event.football-club-membership.action.declare.label"
|
3796
5095
|
},
|
3797
5096
|
review: TENNIS_CLUB_DECLARATION_REVIEW
|
3798
5097
|
},
|
@@ -3801,7 +5100,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3801
5100
|
label: {
|
3802
5101
|
defaultMessage: "Validate",
|
3803
5102
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
3804
|
-
id: "event.
|
5103
|
+
id: "event.football-club-membership.action.validate.label"
|
3805
5104
|
},
|
3806
5105
|
review: TENNIS_CLUB_DECLARATION_REVIEW
|
3807
5106
|
},
|
@@ -3810,7 +5109,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3810
5109
|
label: {
|
3811
5110
|
defaultMessage: "Register",
|
3812
5111
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
3813
|
-
id: "event.
|
5112
|
+
id: "event.football-club-membership.action.register.label"
|
3814
5113
|
},
|
3815
5114
|
review: TENNIS_CLUB_DECLARATION_REVIEW
|
3816
5115
|
},
|
@@ -3819,14 +5118,14 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3819
5118
|
label: {
|
3820
5119
|
defaultMessage: "Request correction",
|
3821
5120
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
3822
|
-
id: "event.
|
5121
|
+
id: "event.football-club-membership.action.correction.request.label"
|
3823
5122
|
},
|
3824
5123
|
onboardingForm: [
|
3825
5124
|
{
|
3826
5125
|
id: "correction-requester",
|
3827
5126
|
type: PageTypes.enum.FORM,
|
3828
5127
|
title: {
|
3829
|
-
id: "event.
|
5128
|
+
id: "event.football-club-membership.action.requestCorrection.form.section.corrector",
|
3830
5129
|
defaultMessage: "Correction requester",
|
3831
5130
|
description: "This is the title of the section"
|
3832
5131
|
},
|
@@ -3890,7 +5189,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3890
5189
|
id: "identity-check",
|
3891
5190
|
type: PageTypes.enum.FORM,
|
3892
5191
|
title: {
|
3893
|
-
id: "event.
|
5192
|
+
id: "event.football-club-membership.action.requestCorrection.form.section.verify",
|
3894
5193
|
defaultMessage: "Verify their identity",
|
3895
5194
|
description: "This is the title of the section"
|
3896
5195
|
},
|
@@ -3933,7 +5232,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3933
5232
|
id: "correction-request.supporting-documents",
|
3934
5233
|
type: PageTypes.enum.FORM,
|
3935
5234
|
title: {
|
3936
|
-
id: "event.
|
5235
|
+
id: "event.football-club-membership.action.requestCorrection.form.section.verify",
|
3937
5236
|
defaultMessage: "Upload supporting documents",
|
3938
5237
|
description: "This is the title of the section"
|
3939
5238
|
},
|
@@ -3995,7 +5294,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3995
5294
|
id: "correction-request.additional-details",
|
3996
5295
|
type: PageTypes.enum.FORM,
|
3997
5296
|
title: {
|
3998
|
-
id: "event.
|
5297
|
+
id: "event.football-club-membership.action.requestCorrection.form.section.corrector",
|
3999
5298
|
defaultMessage: "Reason for correction",
|
4000
5299
|
description: "This is the title of the section"
|
4001
5300
|
},
|
@@ -4018,13 +5317,13 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4018
5317
|
label: {
|
4019
5318
|
defaultMessage: "Approve correction",
|
4020
5319
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4021
|
-
id: "event.
|
5320
|
+
id: "event.football-club-membership.action.correction.approve.label"
|
4022
5321
|
}
|
4023
5322
|
},
|
4024
5323
|
{
|
4025
5324
|
type: ActionType.PRINT_CERTIFICATE,
|
4026
5325
|
label: {
|
4027
|
-
id: "v2.event.
|
5326
|
+
id: "v2.event.football-club-membership.action.collect-certificate.label",
|
4028
5327
|
defaultMessage: "Print certificate",
|
4029
5328
|
description: "This is shown as the action name anywhere the user can trigger the action from"
|
4030
5329
|
},
|
@@ -4072,7 +5371,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4072
5371
|
{
|
4073
5372
|
type: ActionType.ARCHIVE,
|
4074
5373
|
label: {
|
4075
|
-
id: "v2.event.
|
5374
|
+
id: "v2.event.football-club-membership.action.archive.label",
|
4076
5375
|
defaultMessage: "Archive",
|
4077
5376
|
description: "This is shown as the action name anywhere the user can trigger the action from"
|
4078
5377
|
}
|
@@ -4080,7 +5379,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4080
5379
|
{
|
4081
5380
|
type: ActionType.REJECT,
|
4082
5381
|
label: {
|
4083
|
-
id: "v2.event.
|
5382
|
+
id: "v2.event.football-club-membership.action.reject.label",
|
4084
5383
|
defaultMessage: "Reject",
|
4085
5384
|
description: "This is shown as the action name anywhere the user can trigger the action from"
|
4086
5385
|
}
|
@@ -4089,16 +5388,104 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4089
5388
|
advancedSearch: [
|
4090
5389
|
{
|
4091
5390
|
title: {
|
4092
|
-
defaultMessage: "
|
4093
|
-
description: "
|
4094
|
-
id: "v2.
|
5391
|
+
defaultMessage: "Registration details",
|
5392
|
+
description: "The title of Registration details accordion",
|
5393
|
+
id: "v2.advancedSearch.form.registrationDetails"
|
5394
|
+
},
|
5395
|
+
fields: [
|
5396
|
+
event("legalStatus.REGISTERED.createdAtLocation").exact(),
|
5397
|
+
event("legalStatus.REGISTERED.createdAt").range(),
|
5398
|
+
event("status", statusOptions).exact(),
|
5399
|
+
event("updatedAt", timePeriodOptions).range()
|
5400
|
+
]
|
5401
|
+
},
|
5402
|
+
{
|
5403
|
+
title: {
|
5404
|
+
defaultMessage: "Applicant's details",
|
5405
|
+
description: "Applicant details search field section title",
|
5406
|
+
id: "v2.event.football-club-membership.search.applicants"
|
4095
5407
|
},
|
4096
|
-
fields: [
|
5408
|
+
fields: [
|
5409
|
+
field("applicant.firstname").fuzzy(),
|
5410
|
+
field("applicant.surname").fuzzy(),
|
5411
|
+
field("applicant.dob").range(),
|
5412
|
+
field("applicant.email").exact()
|
5413
|
+
]
|
5414
|
+
},
|
5415
|
+
{
|
5416
|
+
title: {
|
5417
|
+
defaultMessage: "Recommender's details",
|
5418
|
+
description: "Recommender details search field section title",
|
5419
|
+
id: "v2.event.football-club-membership.search.recommender"
|
5420
|
+
},
|
5421
|
+
fields: [
|
5422
|
+
field("recommender.firstname").fuzzy(),
|
5423
|
+
field("recommender.surname").fuzzy()
|
5424
|
+
]
|
4097
5425
|
}
|
4098
5426
|
],
|
4099
5427
|
declaration: TENNIS_CLUB_DECLARATION_FORM
|
4100
5428
|
});
|
4101
5429
|
|
5430
|
+
// ../commons/src/fixtures/library-membership-event.ts
|
5431
|
+
var libraryMembershipForm = defineDeclarationForm({
|
5432
|
+
label: {
|
5433
|
+
id: "v2.event.library-membership.action.declare.form.label",
|
5434
|
+
defaultMessage: "Library membership application",
|
5435
|
+
description: "This is what this form is referred as in the system"
|
5436
|
+
},
|
5437
|
+
pages: [
|
5438
|
+
{
|
5439
|
+
id: "member",
|
5440
|
+
title: {
|
5441
|
+
id: "v2.event.library-membership.action.declare.form.section.who.title",
|
5442
|
+
defaultMessage: "Who is applying for the membership?",
|
5443
|
+
description: "This is the title of the section"
|
5444
|
+
},
|
5445
|
+
fields: [
|
5446
|
+
{
|
5447
|
+
id: "member.firstname",
|
5448
|
+
type: FieldType.TEXT,
|
5449
|
+
required: true,
|
5450
|
+
conditionals: [],
|
5451
|
+
label: {
|
5452
|
+
defaultMessage: "Member's first name",
|
5453
|
+
description: "This is the label for the field",
|
5454
|
+
id: "v2.event.library-membership.action.declare.form.section.who.field.firstname.label"
|
5455
|
+
}
|
5456
|
+
},
|
5457
|
+
{
|
5458
|
+
id: "member.surname",
|
5459
|
+
type: FieldType.TEXT,
|
5460
|
+
required: true,
|
5461
|
+
conditionals: [],
|
5462
|
+
label: {
|
5463
|
+
defaultMessage: "Member's surname",
|
5464
|
+
description: "This is the label for the field",
|
5465
|
+
id: "v2.event.library-membership.action.declare.form.section.who.field.surname.label"
|
5466
|
+
}
|
5467
|
+
}
|
5468
|
+
]
|
5469
|
+
}
|
5470
|
+
]
|
5471
|
+
});
|
5472
|
+
var libraryMembershipEvent = defineConfig({
|
5473
|
+
id: "library-membership",
|
5474
|
+
label: {
|
5475
|
+
defaultMessage: "Library membership application",
|
5476
|
+
description: "This is what this event is referred as in the system",
|
5477
|
+
id: "event.library-membership.label"
|
5478
|
+
},
|
5479
|
+
title: {
|
5480
|
+
defaultMessage: "{member.firstname} {member.surname}",
|
5481
|
+
description: "This is the title of the summary",
|
5482
|
+
id: "v2.event.library-membership.title"
|
5483
|
+
},
|
5484
|
+
summary: { fields: [] },
|
5485
|
+
actions: [],
|
5486
|
+
declaration: libraryMembershipForm
|
5487
|
+
});
|
5488
|
+
|
4102
5489
|
// ../commons/src/events/test.utils.ts
|
4103
5490
|
function fieldConfigsToActionPayload(fields) {
|
4104
5491
|
return fields.reduce(
|
@@ -4146,11 +5533,11 @@ function generateActionAnnotationInput(configuration, action) {
|
|
4146
5533
|
var eventPayloadGenerator = {
|
4147
5534
|
create: (input = {}) => ({
|
4148
5535
|
transactionId: input.transactionId ?? getUUID(),
|
4149
|
-
type: input.type ??
|
5536
|
+
type: input.type ?? TENNIS_CLUB_MEMBERSHIP
|
4150
5537
|
}),
|
4151
5538
|
patch: (id, input = {}) => ({
|
4152
5539
|
transactionId: input.transactionId ?? getUUID(),
|
4153
|
-
type: input.type ??
|
5540
|
+
type: input.type ?? TENNIS_CLUB_MEMBERSHIP,
|
4154
5541
|
id
|
4155
5542
|
}),
|
4156
5543
|
draft: ({ eventId, actionType }, input = {}) => (0, import_lodash2.merge)(
|
@@ -4176,8 +5563,7 @@ var eventPayloadGenerator = {
|
|
4176
5563
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
4177
5564
|
createdBy: "@todo",
|
4178
5565
|
createdByRole: "@todo",
|
4179
|
-
createdAtLocation: "
|
4180
|
-
updatedAtLocation: "@todo"
|
5566
|
+
createdAtLocation: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c"
|
4181
5567
|
}
|
4182
5568
|
},
|
4183
5569
|
input
|
@@ -4251,9 +5637,13 @@ var eventPayloadGenerator = {
|
|
4251
5637
|
transactionId: input.transactionId ?? getUUID(),
|
4252
5638
|
declaration: {},
|
4253
5639
|
// @TODO: Check whether generator is needed?
|
4254
|
-
annotation: {
|
5640
|
+
annotation: {},
|
4255
5641
|
duplicates: [],
|
4256
|
-
eventId
|
5642
|
+
eventId,
|
5643
|
+
reason: {
|
5644
|
+
message: `${ActionType.ARCHIVE}`,
|
5645
|
+
isDuplicate: isDuplicate ?? false
|
5646
|
+
}
|
4257
5647
|
}),
|
4258
5648
|
reject: (eventId, input = {}) => ({
|
4259
5649
|
type: ActionType.REJECT,
|
@@ -4264,7 +5654,8 @@ var eventPayloadGenerator = {
|
|
4264
5654
|
ActionType.REJECT
|
4265
5655
|
),
|
4266
5656
|
duplicates: [],
|
4267
|
-
eventId
|
5657
|
+
eventId,
|
5658
|
+
reason: { message: `${ActionType.REJECT}` }
|
4268
5659
|
}),
|
4269
5660
|
register: (eventId, input = {}) => ({
|
4270
5661
|
type: ActionType.REGISTER,
|
@@ -4340,13 +5731,12 @@ function generateActionDocument({
|
|
4340
5731
|
createdBy: getUUID(),
|
4341
5732
|
createdByRole: "FIELD_AGENT",
|
4342
5733
|
id: getUUID(),
|
4343
|
-
createdAtLocation: "
|
4344
|
-
updatedAtLocation: "TODO",
|
5734
|
+
createdAtLocation: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
4345
5735
|
declaration: generateActionDeclarationInput(configuration, action),
|
4346
5736
|
annotation: {},
|
4347
|
-
...defaults,
|
4348
5737
|
status: ActionStatus.Accepted,
|
4349
|
-
transactionId: getUUID()
|
5738
|
+
transactionId: getUUID(),
|
5739
|
+
...defaults
|
4350
5740
|
};
|
4351
5741
|
switch (action) {
|
4352
5742
|
case ActionType.READ:
|
@@ -4362,9 +5752,9 @@ function generateActionDocument({
|
|
4362
5752
|
case ActionType.VALIDATE:
|
4363
5753
|
return { ...actionBase, type: action };
|
4364
5754
|
case ActionType.ARCHIVE:
|
4365
|
-
return { ...actionBase, type: action };
|
5755
|
+
return { ...actionBase, type: action, reason: { message: "Archive" } };
|
4366
5756
|
case ActionType.REJECT:
|
4367
|
-
return { ...actionBase, type: action };
|
5757
|
+
return { ...actionBase, type: action, reason: { message: "Reject" } };
|
4368
5758
|
case ActionType.CREATE:
|
4369
5759
|
return { ...actionBase, type: action };
|
4370
5760
|
case ActionType.NOTIFY:
|
@@ -4376,7 +5766,11 @@ function generateActionDocument({
|
|
4376
5766
|
case ActionType.APPROVE_CORRECTION:
|
4377
5767
|
return { ...actionBase, requestId: getUUID(), type: action };
|
4378
5768
|
case ActionType.REJECT_CORRECTION:
|
4379
|
-
return {
|
5769
|
+
return {
|
5770
|
+
...actionBase,
|
5771
|
+
requestId: getUUID(),
|
5772
|
+
type: action
|
5773
|
+
};
|
4380
5774
|
case ActionType.REGISTER:
|
4381
5775
|
return {
|
4382
5776
|
...actionBase,
|
@@ -4404,9 +5798,7 @@ function generateEventDocument({
|
|
4404
5798
|
id: getUUID(),
|
4405
5799
|
// Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
|
4406
5800
|
// @TODO: This should be fixed in the future.
|
4407
|
-
updatedAt: new Date(Date.now() - 1e3).toISOString()
|
4408
|
-
dateOfEvent: configuration.dateOfEvent,
|
4409
|
-
updatedAtLocation: getUUID()
|
5801
|
+
updatedAt: new Date(Date.now() - 1e3).toISOString()
|
4410
5802
|
};
|
4411
5803
|
}
|
4412
5804
|
function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE, declaration = {}) {
|
@@ -4428,31 +5820,128 @@ function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE, de
|
|
4428
5820
|
eventId
|
4429
5821
|
};
|
4430
5822
|
}
|
4431
|
-
|
4432
|
-
|
4433
|
-
|
4434
|
-
|
4435
|
-
|
4436
|
-
|
4437
|
-
|
4438
|
-
|
4439
|
-
|
4440
|
-
|
4441
|
-
|
4442
|
-
|
4443
|
-
|
5823
|
+
function pickRandom(rng, items) {
|
5824
|
+
return items[Math.floor(rng() * items.length)];
|
5825
|
+
}
|
5826
|
+
function getRandomDatetime(rng, start, end) {
|
5827
|
+
const range = end.getTime() - start.getTime();
|
5828
|
+
const offset = Math.floor(rng() * range);
|
5829
|
+
const randomDate = new Date(start.getTime() + offset);
|
5830
|
+
return randomDate.toISOString();
|
5831
|
+
}
|
5832
|
+
function generateRandomApplicant(rng) {
|
5833
|
+
const firstNames = [
|
5834
|
+
"Danny",
|
5835
|
+
"John",
|
5836
|
+
"Jane",
|
5837
|
+
"Emily",
|
5838
|
+
"Michael",
|
5839
|
+
"Sarah",
|
5840
|
+
"Chris",
|
5841
|
+
"Jessica"
|
5842
|
+
];
|
5843
|
+
const surnames = [
|
5844
|
+
"Doe",
|
5845
|
+
"Smith",
|
5846
|
+
"Johnson",
|
5847
|
+
"Brown",
|
5848
|
+
"Williams",
|
5849
|
+
"Jones",
|
5850
|
+
"Garcia",
|
5851
|
+
"Miller"
|
5852
|
+
];
|
5853
|
+
const randomFirstName = pickRandom(rng, firstNames);
|
5854
|
+
const randomSurname = pickRandom(rng, surnames);
|
5855
|
+
const randomDob = getRandomDatetime(
|
5856
|
+
rng,
|
5857
|
+
/* @__PURE__ */ new Date("1990-01-01"),
|
5858
|
+
/* @__PURE__ */ new Date("2010-12-31")
|
5859
|
+
).split("T")[0];
|
5860
|
+
return {
|
4444
5861
|
"recommender.none": true,
|
4445
|
-
"applicant.firstname":
|
4446
|
-
"applicant.surname":
|
4447
|
-
"applicant.dob":
|
4448
|
-
}
|
4449
|
-
|
4450
|
-
|
5862
|
+
"applicant.firstname": randomFirstName,
|
5863
|
+
"applicant.surname": randomSurname,
|
5864
|
+
"applicant.dob": randomDob
|
5865
|
+
};
|
5866
|
+
}
|
5867
|
+
function createPseudoRandomNumberGenerator(seed) {
|
5868
|
+
const MODULUS = 2 ** 32;
|
5869
|
+
const MULTIPLIER = 1664525;
|
5870
|
+
const INCREMENT = 1013904223;
|
5871
|
+
let state = seed >>> 0;
|
5872
|
+
return () => {
|
5873
|
+
state = (MULTIPLIER * state + INCREMENT) % MODULUS;
|
5874
|
+
return state / MODULUS;
|
5875
|
+
};
|
5876
|
+
}
|
5877
|
+
function generateUuid(rng) {
|
5878
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
5879
|
+
const r = Math.floor(rng() * 16);
|
5880
|
+
const v = c === "x" ? r : r & 3 | 8;
|
5881
|
+
return v.toString(16);
|
5882
|
+
});
|
5883
|
+
}
|
5884
|
+
function generateTrackingId(rng) {
|
5885
|
+
const uuid = generateUuid(rng).replace(/-/g, "");
|
5886
|
+
const trackingId = uuid.slice(0, 6).toUpperCase();
|
5887
|
+
return trackingId;
|
5888
|
+
}
|
5889
|
+
function generateRandomSignature(rng) {
|
5890
|
+
return `/random-bucket/${generateUuid(rng)}.png`;
|
5891
|
+
}
|
5892
|
+
var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
|
5893
|
+
const rng = createPseudoRandomNumberGenerator(seed);
|
5894
|
+
const createdAt = getRandomDatetime(
|
5895
|
+
rng,
|
5896
|
+
/* @__PURE__ */ new Date("2024-01-01"),
|
5897
|
+
/* @__PURE__ */ new Date("2024-12-31")
|
5898
|
+
);
|
5899
|
+
return {
|
5900
|
+
id: overrides.id ?? generateUuid(rng),
|
5901
|
+
type: overrides.type ?? TENNIS_CLUB_MEMBERSHIP,
|
5902
|
+
status: overrides.status ?? pickRandom(rng, eventStatuses),
|
5903
|
+
createdAt: overrides.createdAt ?? createdAt,
|
5904
|
+
createdBy: overrides.createdBy ?? generateUuid(rng),
|
5905
|
+
createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
|
5906
|
+
updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
|
5907
|
+
createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
|
5908
|
+
updatedAt: overrides.updatedAt ?? (0, import_addDays.default)(new Date(createdAt), 1).toISOString(),
|
5909
|
+
assignedTo: overrides.assignedTo ?? null,
|
5910
|
+
updatedBy: overrides.updatedBy ?? generateUuid(rng),
|
5911
|
+
updatedByUserRole: overrides.updatedByUserRole ?? "FIELD_AGENT",
|
5912
|
+
flags: [],
|
5913
|
+
legalStatuses: overrides.legalStatuses ?? {},
|
5914
|
+
declaration: overrides.declaration ?? generateRandomApplicant(rng),
|
5915
|
+
trackingId: overrides.trackingId ?? generateTrackingId(rng)
|
5916
|
+
};
|
5917
|
+
};
|
4451
5918
|
var generateTranslationConfig = (message) => ({
|
4452
5919
|
defaultMessage: message,
|
4453
5920
|
description: "Description for ${message}",
|
4454
5921
|
id: message
|
4455
5922
|
});
|
5923
|
+
var BearerTokenByUserType = {
|
5924
|
+
fieldAgent: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzY29wZSI6WyJyZWNvcmQuZGVjbGFyZS1iaXJ0aCIsInJlY29yZC5kZWNsYXJlLWRlYXRoIiwicmVjb3JkLmRlY2xhcmUtbWFycmlhZ2UiLCJyZWNvcmQuZGVjbGFyYXRpb24tc3VibWl0LWluY29tcGxldGUiLCJyZWNvcmQuZGVjbGFyYXRpb24tc3VibWl0LWZvci1yZXZpZXciLCJzZWFyY2guYmlydGgiLCJzZWFyY2guZGVhdGgiLCJzZWFyY2gubWFycmlhZ2UiLCJkZW1vIl0sInVzZXJUeXBlIjoidXNlciIsImlhdCI6MTc0ODUyNjQ4OCwiZXhwIjoxNzQ5MTMxMjg4LCJhdWQiOlsib3BlbmNydnM6YXV0aC11c2VyIiwib3BlbmNydnM6dXNlci1tZ250LXVzZXIiLCJvcGVuY3J2czpoZWFydGgtdXNlciIsIm9wZW5jcnZzOmdhdGV3YXktdXNlciIsIm9wZW5jcnZzOm5vdGlmaWNhdGlvbi11c2VyIiwib3BlbmNydnM6d29ya2Zsb3ctdXNlciIsIm9wZW5jcnZzOnNlYXJjaC11c2VyIiwib3BlbmNydnM6bWV0cmljcy11c2VyIiwib3BlbmNydnM6Y291bnRyeWNvbmZpZy11c2VyIiwib3BlbmNydnM6d2ViaG9va3MtdXNlciIsIm9wZW5jcnZzOmNvbmZpZy11c2VyIiwib3BlbmNydnM6ZG9jdW1lbnRzLXVzZXIiXSwiaXNzIjoib3BlbmNydnM6YXV0aC1zZXJ2aWNlIiwic3ViIjoiNjc3ZmIwODYzMGYzYWJmYTMzMDcyNzBmIn0.qLif2TmTPpqfbSUWR3TSfWf5syyCtRRJV-fDOZBtN9th-gdT0sUPZp5PB_t2QHHCLes7JLDlSA9CGNIbVvRR8a7EedXTAf0T7pwiE96PgljHSKI9jLMCYb_rhqnl8BwfsxAU3qv8EBYM9rDlcabl5iKnAOM-YLMv63CRMQxZOZ0O3Wl1Xil82dp6PqW_Lom5Qd-Esftt9BWXk5gxmqq-YegT8qU9n3hDXEsOvmIyYQvPDwmUOB-xp74CKJk_o3eBuq4TVCMYxY-tS9qkkn2A7Txhh-bzWMVNrQjQ1Yumvs8gi_F-XYTi89QbZVz8PzJ9kT8w3jshYwmAy7be9M-EQg",
|
5925
|
+
registrationAgent: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzY29wZSI6WyJyZWNvcmQucmVhZCIsInJlY29yZC5kZWNsYXJlLWJpcnRoIiwicmVjb3JkLmRlY2xhcmUtZGVhdGgiLCJyZWNvcmQuZGVjbGFyZS1tYXJyaWFnZSIsInJlY29yZC5kZWNsYXJhdGlvbi1lZGl0IiwicmVjb3JkLmRlY2xhcmF0aW9uLXN1Ym1pdC1mb3ItYXBwcm92YWwiLCJyZWNvcmQuZGVjbGFyYXRpb24tc3VibWl0LWZvci11cGRhdGVzIiwicmVjb3JkLmRlY2xhcmF0aW9uLWFyY2hpdmUiLCJyZWNvcmQuZGVjbGFyYXRpb24tcmVpbnN0YXRlIiwicmVjb3JkLnJlZ2lzdHJhdGlvbi1yZXF1ZXN0LWNvcnJlY3Rpb24iLCJyZWNvcmQuZGVjbGFyYXRpb24tcHJpbnQtc3VwcG9ydGluZy1kb2N1bWVudHMiLCJyZWNvcmQuZXhwb3J0LXJlY29yZHMiLCJyZWNvcmQucmVnaXN0cmF0aW9uLXByaW50Jmlzc3VlLWNlcnRpZmllZC1jb3BpZXMiLCJwZXJmb3JtYW5jZS5yZWFkIiwicGVyZm9ybWFuY2UucmVhZC1kYXNoYm9hcmRzIiwib3JnYW5pc2F0aW9uLnJlYWQtbG9jYXRpb25zOm15LW9mZmljZSIsInNlYXJjaC5iaXJ0aCIsInNlYXJjaC5kZWF0aCIsInNlYXJjaC5tYXJyaWFnZSIsImRlbW8iXSwidXNlclR5cGUiOiJ1c2VyIiwiaWF0IjoxNzQ4NTI2NDY4LCJleHAiOjE3NDkxMzEyNjgsImF1ZCI6WyJvcGVuY3J2czphdXRoLXVzZXIiLCJvcGVuY3J2czp1c2VyLW1nbnQtdXNlciIsIm9wZW5jcnZzOmhlYXJ0aC11c2VyIiwib3BlbmNydnM6Z2F0ZXdheS11c2VyIiwib3BlbmNydnM6bm90aWZpY2F0aW9uLXVzZXIiLCJvcGVuY3J2czp3b3JrZmxvdy11c2VyIiwib3BlbmNydnM6c2VhcmNoLXVzZXIiLCJvcGVuY3J2czptZXRyaWNzLXVzZXIiLCJvcGVuY3J2czpjb3VudHJ5Y29uZmlnLXVzZXIiLCJvcGVuY3J2czp3ZWJob29rcy11c2VyIiwib3BlbmNydnM6Y29uZmlnLXVzZXIiLCJvcGVuY3J2czpkb2N1bWVudHMtdXNlciJdLCJpc3MiOiJvcGVuY3J2czphdXRoLXNlcnZpY2UiLCJzdWIiOiI2NzdmYjA4NjMwZjNhYmZhMzMwNzI3MTgifQ.C0R3cda9tczdJyadyJzk_wjVx79yiQ4r2BZbrF5VMTol97CwqMk1cPKVv5xZR1fHW5nhYl1X_vsmTYx-p9oSmcAYVud-4Z24TrA3oZ214zCB8RW_RmmFzJSczwe-9Son-96JOpRJTz2F-F_SSmblF0cjndJ-iXCAbOn1hmQ1q45NqaV-oFaFWigvAaRoBFcEvGufQxss_NjRmG12ooENSfWQl0tYM9BmTw4JQo2xerwJcgaJTrtDgRagkuiR7zhVNjcoT64AQiSRp5KmWRhbU4ozlJ2tfy1ccD9jJkbQTf1AZT2pl1diusjstJYFuM9QPFPOyCO0umaxYfgSer_Hmg",
|
5926
|
+
localRegistrar: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzY29wZSI6WyJyZWNvcmQucmVhZCIsInJlY29yZC5kZWNsYXJlLWJpcnRoIiwicmVjb3JkLmRlY2xhcmUtZGVhdGgiLCJyZWNvcmQuZGVjbGFyZS1tYXJyaWFnZSIsInJlY29yZC5kZWNsYXJhdGlvbi1lZGl0IiwicmVjb3JkLmRlY2xhcmF0aW9uLXN1Ym1pdC1mb3ItdXBkYXRlcyIsInJlY29yZC5yZXZpZXctZHVwbGljYXRlcyIsInJlY29yZC5kZWNsYXJhdGlvbi1hcmNoaXZlIiwicmVjb3JkLmRlY2xhcmF0aW9uLXJlaW5zdGF0ZSIsInJlY29yZC5yZWdpc3RlciIsInJlY29yZC5yZWdpc3RyYXRpb24tY29ycmVjdCIsInJlY29yZC5kZWNsYXJhdGlvbi1wcmludC1zdXBwb3J0aW5nLWRvY3VtZW50cyIsInJlY29yZC5leHBvcnQtcmVjb3JkcyIsInJlY29yZC51bmFzc2lnbi1vdGhlcnMiLCJyZWNvcmQucmVnaXN0cmF0aW9uLXByaW50Jmlzc3VlLWNlcnRpZmllZC1jb3BpZXMiLCJyZWNvcmQuY29uZmlybS1yZWdpc3RyYXRpb24iLCJyZWNvcmQucmVqZWN0LXJlZ2lzdHJhdGlvbiIsInBlcmZvcm1hbmNlLnJlYWQiLCJwZXJmb3JtYW5jZS5yZWFkLWRhc2hib2FyZHMiLCJwcm9maWxlLmVsZWN0cm9uaWMtc2lnbmF0dXJlIiwib3JnYW5pc2F0aW9uLnJlYWQtbG9jYXRpb25zOm15LW9mZmljZSIsInNlYXJjaC5iaXJ0aCIsInNlYXJjaC5kZWF0aCIsInNlYXJjaC5tYXJyaWFnZSIsImRlbW8iXSwidXNlclR5cGUiOiJ1c2VyIiwiaWF0IjoxNzQ4NTI2NDIwLCJleHAiOjE3NDkxMzEyMjAsImF1ZCI6WyJvcGVuY3J2czphdXRoLXVzZXIiLCJvcGVuY3J2czp1c2VyLW1nbnQtdXNlciIsIm9wZW5jcnZzOmhlYXJ0aC11c2VyIiwib3BlbmNydnM6Z2F0ZXdheS11c2VyIiwib3BlbmNydnM6bm90aWZpY2F0aW9uLXVzZXIiLCJvcGVuY3J2czp3b3JrZmxvdy11c2VyIiwib3BlbmNydnM6c2VhcmNoLXVzZXIiLCJvcGVuY3J2czptZXRyaWNzLXVzZXIiLCJvcGVuY3J2czpjb3VudHJ5Y29uZmlnLXVzZXIiLCJvcGVuY3J2czp3ZWJob29rcy11c2VyIiwib3BlbmNydnM6Y29uZmlnLXVzZXIiLCJvcGVuY3J2czpkb2N1bWVudHMtdXNlciJdLCJpc3MiOiJvcGVuY3J2czphdXRoLXNlcnZpY2UiLCJzdWIiOiI2NzdmYjA4NjMwZjNhYmZhMzMwNzI3MjEifQ.Exwojy_1lsoPmp-kQ79SMWI0eQy8Qt7yO_ynGvb_oIVdqSwTxFkkNr9x4UxhBA-o0P6LkMZ2ELKOlSzBr3PRJ8IQnfMQ7Db8oG8HAPsY8sKqra_L6ryV088NW2e2LqAjoOX0dXRIqYMolUhF_OOuZpHW5K8nvog5SLlnJ1gKysQ1EuWBg2dcKbjkkB16v-9NGz4XHye3vcoZlalyha5OOujzbPhkmr9UGiksSIXFNbanBhkQdt-EJlLX9SXvQ4ACJWPKFb_f4gv8p84jdLiryzQux46zHPpTicZHzg0nZtoKKIH1AyFtqWfBFm4y8qWC3ht9TAk93NAXTfkS0wzxKA"
|
5927
|
+
};
|
5928
|
+
var generateWorkqueues = (slug = "all-events") => defineWorkqueues([
|
5929
|
+
{
|
5930
|
+
slug,
|
5931
|
+
name: {
|
5932
|
+
id: "workqueues.inProgress.title",
|
5933
|
+
defaultMessage: slug.charAt(0).toUpperCase() + slug.slice(1).split("-").join(" "),
|
5934
|
+
description: "Title of in progress workqueue"
|
5935
|
+
},
|
5936
|
+
query: {
|
5937
|
+
type: "and",
|
5938
|
+
clauses: [{ eventType: tennisClubMembershipEvent.id }]
|
5939
|
+
},
|
5940
|
+
actions: [],
|
5941
|
+
icon: "Draft",
|
5942
|
+
columns: []
|
5943
|
+
}
|
5944
|
+
]);
|
4456
5945
|
|
4457
5946
|
// ../commons/src/events/TemplateConfig.ts
|
4458
5947
|
function isTemplateVariable(value) {
|
@@ -4490,6 +5979,7 @@ function isFieldConfigDefaultValue(value) {
|
|
4490
5979
|
var import_lodash3 = require("lodash");
|
4491
5980
|
|
4492
5981
|
// ../commons/src/scopes.ts
|
5982
|
+
var import_zod31 = require("zod");
|
4493
5983
|
var SCOPES = {
|
4494
5984
|
// TODO v1.8 legacy scopes
|
4495
5985
|
NATLSYSADMIN: "natlsysadmin",
|
@@ -4513,6 +6003,8 @@ var SCOPES = {
|
|
4513
6003
|
*/
|
4514
6004
|
RECORD_DECLARE: "record.declare-birth",
|
4515
6005
|
// declare
|
6006
|
+
RECORD_IMPORT: "record.import",
|
6007
|
+
// declare
|
4516
6008
|
RECORD_DECLARE_BIRTH: "record.declare-birth",
|
4517
6009
|
RECORD_DECLARE_BIRTH_MY_JURISDICTION: "record.declare-birth:my-jurisdiction",
|
4518
6010
|
RECORD_DECLARE_DEATH: "record.declare-death",
|
@@ -4600,12 +6092,119 @@ var SCOPES = {
|
|
4600
6092
|
// data seeding
|
4601
6093
|
USER_DATA_SEEDING: "user.data-seeding"
|
4602
6094
|
};
|
6095
|
+
var LiteralScopes = import_zod31.z.union([
|
6096
|
+
import_zod31.z.literal(SCOPES.NATLSYSADMIN),
|
6097
|
+
import_zod31.z.literal(SCOPES.BYPASSRATELIMIT),
|
6098
|
+
import_zod31.z.literal(SCOPES.DECLARE),
|
6099
|
+
import_zod31.z.literal(SCOPES.REGISTER),
|
6100
|
+
import_zod31.z.literal(SCOPES.VALIDATE),
|
6101
|
+
import_zod31.z.literal(SCOPES.DEMO),
|
6102
|
+
import_zod31.z.literal(SCOPES.CERTIFY),
|
6103
|
+
import_zod31.z.literal(SCOPES.PERFORMANCE),
|
6104
|
+
import_zod31.z.literal(SCOPES.SYSADMIN),
|
6105
|
+
import_zod31.z.literal(SCOPES.TEAMS),
|
6106
|
+
import_zod31.z.literal(SCOPES.CONFIG),
|
6107
|
+
import_zod31.z.literal(SCOPES.WEBHOOK),
|
6108
|
+
import_zod31.z.literal(SCOPES.NATIONALID),
|
6109
|
+
import_zod31.z.literal(SCOPES.NOTIFICATION_API),
|
6110
|
+
import_zod31.z.literal(SCOPES.RECORDSEARCH),
|
6111
|
+
import_zod31.z.literal(SCOPES.RECORD_IMPORT),
|
6112
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
|
6113
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
|
6114
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_DEATH),
|
6115
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
|
6116
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
|
6117
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
|
6118
|
+
import_zod31.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
|
6119
|
+
import_zod31.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW),
|
6120
|
+
import_zod31.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS),
|
6121
|
+
import_zod31.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
|
6122
|
+
import_zod31.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
|
6123
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
|
6124
|
+
import_zod31.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
|
6125
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
|
6126
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE),
|
6127
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTER),
|
6128
|
+
import_zod31.z.literal(SCOPES.RECORD_EXPORT_RECORDS),
|
6129
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARATION_PRINT),
|
6130
|
+
import_zod31.z.literal(SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS),
|
6131
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_PRINT),
|
6132
|
+
import_zod31.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
|
6133
|
+
import_zod31.z.literal(SCOPES.RECORD_PRINT_CERTIFIED_COPIES),
|
6134
|
+
import_zod31.z.literal(SCOPES.RECORD_BULK_PRINT_CERTIFIED_COPIES),
|
6135
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES),
|
6136
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
|
6137
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
|
6138
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REVOCATION),
|
6139
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REVOKE),
|
6140
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REINSTATEMENT),
|
6141
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REINSTATE),
|
6142
|
+
import_zod31.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
|
6143
|
+
import_zod31.z.literal(SCOPES.RECORD_REJECT_REGISTRATION),
|
6144
|
+
import_zod31.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
|
6145
|
+
import_zod31.z.literal(SCOPES.SEARCH_BIRTH),
|
6146
|
+
import_zod31.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
|
6147
|
+
import_zod31.z.literal(SCOPES.SEARCH_DEATH),
|
6148
|
+
import_zod31.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
|
6149
|
+
import_zod31.z.literal(SCOPES.SEARCH_MARRIAGE),
|
6150
|
+
import_zod31.z.literal(SCOPES.RECORD_READ),
|
6151
|
+
import_zod31.z.literal(SCOPES.RECORD_READ_AUDIT),
|
6152
|
+
import_zod31.z.literal(SCOPES.RECORD_READ_COMMENTS),
|
6153
|
+
import_zod31.z.literal(SCOPES.RECORD_CREATE_COMMENTS),
|
6154
|
+
import_zod31.z.literal(SCOPES.PROFILE_UPDATE),
|
6155
|
+
import_zod31.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE),
|
6156
|
+
import_zod31.z.literal(SCOPES.PERFORMANCE_READ),
|
6157
|
+
import_zod31.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
|
6158
|
+
import_zod31.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS),
|
6159
|
+
import_zod31.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
|
6160
|
+
import_zod31.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
|
6161
|
+
import_zod31.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION),
|
6162
|
+
import_zod31.z.literal(SCOPES.USER_READ),
|
6163
|
+
import_zod31.z.literal(SCOPES.USER_READ_MY_OFFICE),
|
6164
|
+
import_zod31.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
|
6165
|
+
import_zod31.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
|
6166
|
+
import_zod31.z.literal(SCOPES.USER_CREATE),
|
6167
|
+
import_zod31.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
|
6168
|
+
import_zod31.z.literal(SCOPES.USER_UPDATE),
|
6169
|
+
import_zod31.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION),
|
6170
|
+
import_zod31.z.literal(SCOPES.CONFIG_UPDATE_ALL),
|
6171
|
+
import_zod31.z.literal(SCOPES.USER_DATA_SEEDING)
|
6172
|
+
]);
|
6173
|
+
var rawConfigurableScopeRegex = /^([a-zA-Z\.]+)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
|
6174
|
+
var rawConfigurableScope = import_zod31.z.string().regex(rawConfigurableScopeRegex);
|
6175
|
+
var CreateUserScope = import_zod31.z.object({
|
6176
|
+
type: import_zod31.z.literal("user.create"),
|
6177
|
+
options: import_zod31.z.object({
|
6178
|
+
role: import_zod31.z.array(import_zod31.z.string())
|
6179
|
+
})
|
6180
|
+
});
|
6181
|
+
var EditUserScope = import_zod31.z.object({
|
6182
|
+
type: import_zod31.z.literal("user.edit"),
|
6183
|
+
options: import_zod31.z.object({
|
6184
|
+
role: import_zod31.z.array(import_zod31.z.string())
|
6185
|
+
})
|
6186
|
+
});
|
6187
|
+
var WorkqueueScope = import_zod31.z.object({
|
6188
|
+
type: import_zod31.z.literal("workqueue"),
|
6189
|
+
options: import_zod31.z.object({
|
6190
|
+
id: import_zod31.z.array(import_zod31.z.string())
|
6191
|
+
})
|
6192
|
+
});
|
6193
|
+
var NotifyRecordScope = import_zod31.z.object({
|
6194
|
+
type: import_zod31.z.literal("record.notify"),
|
6195
|
+
options: import_zod31.z.object({
|
6196
|
+
event: import_zod31.z.array(import_zod31.z.string())
|
6197
|
+
})
|
6198
|
+
});
|
6199
|
+
var ConfigurableScopes = import_zod31.z.discriminatedUnion("type", [
|
6200
|
+
CreateUserScope,
|
6201
|
+
EditUserScope,
|
6202
|
+
WorkqueueScope,
|
6203
|
+
NotifyRecordScope
|
6204
|
+
]);
|
4603
6205
|
var scopes = Object.values(SCOPES);
|
4604
6206
|
|
4605
6207
|
// ../commons/src/events/scopes.ts
|
4606
|
-
function hasAnyOfScopes(a, b) {
|
4607
|
-
return (0, import_lodash3.intersection)(a, b).length > 0;
|
4608
|
-
}
|
4609
6208
|
var CONFIG_GET_ALLOWED_SCOPES = [
|
4610
6209
|
SCOPES.RECORD_DECLARE,
|
4611
6210
|
SCOPES.RECORD_READ,
|
@@ -4663,6 +6262,28 @@ var ACTION_ALLOWED_SCOPES = {
|
|
4663
6262
|
[ActionType.UNASSIGN]: null,
|
4664
6263
|
[ActionType.DETECT_DUPLICATE]: []
|
4665
6264
|
};
|
6265
|
+
var ACTION_ALLOWED_CONFIGURABLE_SCOPES = {
|
6266
|
+
[ActionType.READ]: [],
|
6267
|
+
[ActionType.CREATE]: ["record.notify"],
|
6268
|
+
[ActionType.NOTIFY]: ["record.notify"],
|
6269
|
+
[ActionType.DECLARE]: [],
|
6270
|
+
[ActionType.DELETE]: [],
|
6271
|
+
[ActionType.VALIDATE]: [],
|
6272
|
+
[ActionType.REGISTER]: [],
|
6273
|
+
[ActionType.PRINT_CERTIFICATE]: [],
|
6274
|
+
[ActionType.REQUEST_CORRECTION]: [],
|
6275
|
+
[ActionType.REJECT_CORRECTION]: [],
|
6276
|
+
[ActionType.APPROVE_CORRECTION]: [],
|
6277
|
+
[ActionType.MARKED_AS_DUPLICATE]: [],
|
6278
|
+
[ActionType.ARCHIVE]: [],
|
6279
|
+
[ActionType.REJECT]: [],
|
6280
|
+
[ActionType.ASSIGN]: [],
|
6281
|
+
[ActionType.UNASSIGN]: [],
|
6282
|
+
[ActionType.DETECT_DUPLICATE]: []
|
6283
|
+
};
|
6284
|
+
function hasAnyOfScopes(a, b) {
|
6285
|
+
return (0, import_lodash3.intersection)(a, b).length > 0;
|
6286
|
+
}
|
4666
6287
|
function filterUnallowedActions(actions, userScopes) {
|
4667
6288
|
const allowedActions = actions.filter((action) => {
|
4668
6289
|
const requiredScopes = ACTION_ALLOWED_SCOPES[action];
|
@@ -4680,18 +6301,64 @@ function filterUnallowedActions(actions, userScopes) {
|
|
4680
6301
|
return [ActionType.READ];
|
4681
6302
|
}
|
4682
6303
|
|
4683
|
-
// ../commons/src/
|
4684
|
-
|
6304
|
+
// ../commons/src/events/serializers/user/deserializer.ts
|
6305
|
+
var import_zod32 = require("zod");
|
6306
|
+
var UserWithPrimaryOffice = User.extend({
|
6307
|
+
primaryOfficeId: import_zod32.z.string()
|
6308
|
+
});
|
6309
|
+
function userDeserializer(serializedUserField, user2) {
|
6310
|
+
if (typeof serializedUserField === "string") {
|
6311
|
+
return serializedUserField;
|
6312
|
+
}
|
6313
|
+
if (serializedUserField.$userField === "name" || serializedUserField.$userField === "signatureFilename") {
|
6314
|
+
throw new Error(
|
6315
|
+
`Deserializer for ${serializedUserField.$userField} is not implemented yet`
|
6316
|
+
);
|
6317
|
+
}
|
6318
|
+
return user2[serializedUserField.$userField];
|
6319
|
+
}
|
6320
|
+
function deserializeQueryExpression(expression, user2) {
|
4685
6321
|
return {
|
4686
|
-
|
4687
|
-
|
4688
|
-
|
4689
|
-
|
6322
|
+
...expression,
|
6323
|
+
assignedTo: expression.assignedTo && {
|
6324
|
+
...expression.assignedTo,
|
6325
|
+
term: userDeserializer(expression.assignedTo.term, user2)
|
6326
|
+
},
|
6327
|
+
createdBy: expression.createdBy && {
|
6328
|
+
...expression.createdBy,
|
6329
|
+
term: userDeserializer(expression.createdBy.term, user2)
|
6330
|
+
},
|
6331
|
+
updatedBy: expression.updatedBy && {
|
6332
|
+
...expression.updatedBy,
|
6333
|
+
term: userDeserializer(expression.updatedBy.term, user2)
|
6334
|
+
},
|
6335
|
+
createdAtLocation: expression.createdAtLocation && (expression.createdAtLocation.type === "within" ? {
|
6336
|
+
...expression.createdAtLocation,
|
6337
|
+
location: userDeserializer(
|
6338
|
+
expression.createdAtLocation.location,
|
6339
|
+
user2
|
6340
|
+
)
|
6341
|
+
} : {
|
6342
|
+
...expression.createdAtLocation,
|
6343
|
+
term: userDeserializer(expression.createdAtLocation.term, user2)
|
6344
|
+
}),
|
6345
|
+
updatedAtLocation: expression.updatedAtLocation && (expression.updatedAtLocation.type === "within" ? {
|
6346
|
+
...expression.updatedAtLocation,
|
6347
|
+
location: userDeserializer(
|
6348
|
+
expression.updatedAtLocation.location,
|
6349
|
+
user2
|
6350
|
+
)
|
6351
|
+
} : {
|
6352
|
+
...expression.updatedAtLocation,
|
6353
|
+
term: userDeserializer(expression.updatedAtLocation.term, user2)
|
6354
|
+
})
|
4690
6355
|
};
|
4691
6356
|
}
|
4692
|
-
|
4693
|
-
|
4694
|
-
|
4695
|
-
|
6357
|
+
function deserializeQuery(query, user2) {
|
6358
|
+
return {
|
6359
|
+
...query,
|
6360
|
+
clauses: query.clauses.map(
|
6361
|
+
(clause) => deserializeQueryExpression(clause, user2)
|
6362
|
+
)
|
6363
|
+
};
|
4696
6364
|
}
|
4697
|
-
var event = Object.assign(eventFn, createEventConditionals());
|