@opencrvs/toolkit 1.8.0-rc.fbe4a79 → 1.8.0-rc.fbec3ce
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 +10237 -4315
- package/dist/commons/conditionals/conditionals.d.ts +8 -3
- package/dist/commons/conditionals/validate.d.ts +1 -0
- package/dist/commons/events/ActionConfig.d.ts +56387 -29043
- package/dist/commons/events/ActionDocument.d.ts +1900 -309
- package/dist/commons/events/ActionInput.d.ts +1455 -183
- package/dist/commons/events/AdvancedSearchConfig.d.ts +675 -12
- package/dist/commons/events/CompositeFieldValue.d.ts +28 -0
- package/dist/commons/events/Constants.d.ts +3 -0
- package/dist/commons/events/CountryConfigQueryInput.d.ts +2982 -0
- package/dist/commons/events/CreatedAtLocation.d.ts +3 -0
- package/dist/commons/events/Draft.d.ts +122 -21
- package/dist/commons/events/EventConfig.d.ts +27963 -14411
- package/dist/commons/events/EventDocument.d.ts +1228 -245
- package/dist/commons/events/EventIndex.d.ts +585 -353
- package/dist/commons/events/EventInput.d.ts +0 -13
- package/dist/commons/events/EventMetadata.d.ts +70 -76
- package/dist/commons/events/FieldConfig.d.ts +2500 -1111
- package/dist/commons/events/FieldType.d.ts +4 -1
- package/dist/commons/events/FieldTypeMapping.d.ts +94 -52
- package/dist/commons/events/FieldValue.d.ts +43 -5
- package/dist/commons/events/FormConfig.d.ts +18485 -9821
- package/dist/commons/events/PageConfig.d.ts +3600 -1472
- 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 +4189 -524
- package/dist/commons/events/defineConfig.d.ts +2639 -635
- package/dist/commons/events/event.d.ts +37 -10
- package/dist/commons/events/field.d.ts +26 -17
- 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 +144 -34
- package/dist/commons/events/utils.d.ts +10110 -309
- package/dist/commons/events/workqueueDefaultColumns.d.ts +3 -0
- package/dist/conditionals/index.js +45 -8
- package/dist/events/index.js +2618 -973
- 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,6 +30,7 @@ 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,
|
@@ -49,11 +50,15 @@ __export(events_exports, {
|
|
49
50
|
AddressType: () => AddressType,
|
50
51
|
AdministrativeAreas: () => AdministrativeAreas,
|
51
52
|
AdvancedSearchConfig: () => AdvancedSearchConfig,
|
53
|
+
AnyOf: () => AnyOf,
|
54
|
+
AnyOfStatus: () => AnyOfStatus,
|
52
55
|
ApproveCorrectionActionInput: () => ApproveCorrectionActionInput,
|
53
56
|
ArchiveActionInput: () => ArchiveActionInput,
|
54
57
|
AssignActionInput: () => AssignActionInput,
|
55
58
|
AsyncRejectActionDocument: () => AsyncRejectActionDocument,
|
59
|
+
BIRTH_EVENT: () => BIRTH_EVENT,
|
56
60
|
BaseActionInput: () => BaseActionInput,
|
61
|
+
BearerTokenByUserType: () => BearerTokenByUserType,
|
57
62
|
CONFIG_GET_ALLOWED_SCOPES: () => CONFIG_GET_ALLOWED_SCOPES,
|
58
63
|
CONFIG_SEARCH_ALLOWED_SCOPES: () => CONFIG_SEARCH_ALLOWED_SCOPES,
|
59
64
|
CertificateConfig: () => CertificateConfig,
|
@@ -67,6 +72,7 @@ __export(events_exports, {
|
|
67
72
|
DEFAULT_DATE_OF_EVENT_PROPERTY: () => DEFAULT_DATE_OF_EVENT_PROPERTY,
|
68
73
|
DataEntry: () => DataEntry,
|
69
74
|
DataFieldValue: () => DataFieldValue,
|
75
|
+
DateCondition: () => DateCondition,
|
70
76
|
DateRangeFieldValue: () => DateRangeFieldValue,
|
71
77
|
DateValue: () => DateValue,
|
72
78
|
DatetimeValue: () => DatetimeValue,
|
@@ -92,14 +98,16 @@ __export(events_exports, {
|
|
92
98
|
EventInput: () => EventInput,
|
93
99
|
EventMetadata: () => EventMetadata,
|
94
100
|
EventMetadataKeys: () => EventMetadataKeys,
|
95
|
-
|
101
|
+
EventMetadataKeysArray: () => EventMetadataKeysArray,
|
96
102
|
EventSearchIndex: () => EventSearchIndex,
|
97
103
|
EventState: () => EventState,
|
98
104
|
EventStatus: () => EventStatus,
|
99
|
-
|
105
|
+
Exact: () => Exact,
|
106
|
+
ExactStatus: () => ExactStatus,
|
100
107
|
FieldConditional: () => FieldConditional,
|
101
108
|
FieldConfig: () => FieldConfig,
|
102
109
|
FieldConfigSchema: () => FieldConfigSchema,
|
110
|
+
FieldReference: () => FieldReference,
|
103
111
|
FieldType: () => FieldType,
|
104
112
|
FieldUpdateValue: () => FieldUpdateValue,
|
105
113
|
FieldValue: () => FieldValue,
|
@@ -109,6 +117,7 @@ __export(events_exports, {
|
|
109
117
|
Flag: () => Flag,
|
110
118
|
FormConfig: () => FormConfig,
|
111
119
|
FormPageConfig: () => FormPageConfig,
|
120
|
+
Fuzzy: () => Fuzzy,
|
112
121
|
GenericAddressUpdateValue: () => GenericAddressUpdateValue,
|
113
122
|
GenericAddressValue: () => GenericAddressValue,
|
114
123
|
GeographicalArea: () => GeographicalArea,
|
@@ -117,37 +126,55 @@ __export(events_exports, {
|
|
117
126
|
LegalStatuses: () => LegalStatuses,
|
118
127
|
MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
|
119
128
|
MimeType: () => MimeType,
|
129
|
+
NameFieldUpdateValue: () => NameFieldUpdateValue,
|
130
|
+
NameFieldValue: () => NameFieldValue,
|
120
131
|
NonEmptyTextValue: () => NonEmptyTextValue,
|
132
|
+
Not: () => Not,
|
121
133
|
NotifyActionInput: () => NotifyActionInput,
|
122
134
|
NumberFieldValue: () => NumberFieldValue,
|
123
135
|
PageConfig: () => PageConfig,
|
124
136
|
PageTypes: () => PageTypes,
|
125
137
|
PrintCertificateActionInput: () => PrintCertificateActionInput,
|
138
|
+
QueryExpression: () => QueryExpression,
|
126
139
|
QueryInput: () => QueryInput,
|
127
140
|
QueryType: () => QueryType,
|
141
|
+
Range: () => Range,
|
128
142
|
ReadActionInput: () => ReadActionInput,
|
129
143
|
RegisterAction: () => RegisterAction,
|
130
144
|
RegisterActionInput: () => RegisterActionInput,
|
131
145
|
RegistrationCreationMetadata: () => RegistrationCreationMetadata,
|
132
146
|
RejectCorrectionActionInput: () => RejectCorrectionActionInput,
|
133
147
|
RejectDeclarationActionInput: () => RejectDeclarationActionInput,
|
148
|
+
RejectionReason: () => RejectionReason,
|
134
149
|
RequestCorrectionActionInput: () => RequestCorrectionActionInput,
|
135
150
|
ResolvedUser: () => ResolvedUser,
|
136
151
|
RuralAddressUpdateValue: () => RuralAddressUpdateValue,
|
137
152
|
RuralAddressValue: () => RuralAddressValue,
|
138
153
|
SearchField: () => SearchField,
|
154
|
+
SearchQueryParams: () => SearchQueryParams,
|
139
155
|
SelectOption: () => SelectOption,
|
140
156
|
ShowConditional: () => ShowConditional,
|
157
|
+
SignatureFieldValue: () => SignatureFieldValue,
|
141
158
|
SummaryConfig: () => SummaryConfig,
|
159
|
+
TENNIS_CLUB_MEMBERSHIP: () => TENNIS_CLUB_MEMBERSHIP,
|
142
160
|
TextValue: () => TextValue,
|
143
161
|
TranslationConfig: () => TranslationConfig,
|
144
162
|
UnassignActionInput: () => UnassignActionInput,
|
145
163
|
UrbanAddressUpdateValue: () => UrbanAddressUpdateValue,
|
146
164
|
UrbanAddressValue: () => UrbanAddressValue,
|
165
|
+
User: () => User,
|
147
166
|
ValidateActionInput: () => ValidateActionInput,
|
148
167
|
VerificationActionConfig: () => VerificationActionConfig,
|
149
168
|
VerificationPageConfig: () => VerificationPageConfig,
|
169
|
+
Within: () => Within,
|
170
|
+
WorkqueueColumn: () => WorkqueueColumn,
|
171
|
+
WorkqueueColumnKeys: () => WorkqueueColumnKeys,
|
172
|
+
WorkqueueColumnKeysArray: () => WorkqueueColumnKeysArray,
|
173
|
+
WorkqueueColumnValue: () => WorkqueueColumnValue,
|
150
174
|
WorkqueueConfig: () => WorkqueueConfig,
|
175
|
+
WorkqueueConfigInput: () => WorkqueueConfigInput,
|
176
|
+
WorkqueueCountInput: () => WorkqueueCountInput,
|
177
|
+
WorkqueueCountOutput: () => WorkqueueCountOutput,
|
151
178
|
ZodDate: () => ZodDate,
|
152
179
|
alwaysTrue: () => alwaysTrue,
|
153
180
|
and: () => and,
|
@@ -158,9 +185,11 @@ __export(events_exports, {
|
|
158
185
|
createEmptyDraft: () => createEmptyDraft,
|
159
186
|
createEventConditionals: () => createEventConditionals,
|
160
187
|
createFieldConditionals: () => createFieldConditionals,
|
188
|
+
createPrng: () => createPrng,
|
161
189
|
createValidationSchema: () => createValidationSchema,
|
162
190
|
deepDropNulls: () => deepDropNulls,
|
163
191
|
deepMerge: () => deepMerge,
|
192
|
+
defaultWorkqueueColumns: () => defaultWorkqueueColumns,
|
164
193
|
defineActionForm: () => defineActionForm,
|
165
194
|
defineConditional: () => defineConditional,
|
166
195
|
defineConfig: () => defineConfig,
|
@@ -169,12 +198,14 @@ __export(events_exports, {
|
|
169
198
|
defineFormPage: () => defineFormPage,
|
170
199
|
definePage: () => definePage,
|
171
200
|
defineWorkqueue: () => defineWorkqueue,
|
201
|
+
defineWorkqueues: () => defineWorkqueues,
|
202
|
+
defineWorkqueuesColumns: () => defineWorkqueuesColumns,
|
203
|
+
deserializeQuery: () => deserializeQuery,
|
172
204
|
errorMessages: () => errorMessages,
|
173
205
|
event: () => event,
|
174
206
|
eventMetadataLabelMap: () => eventMetadataLabelMap,
|
175
207
|
eventPayloadGenerator: () => eventPayloadGenerator,
|
176
208
|
eventQueryDataGenerator: () => eventQueryDataGenerator,
|
177
|
-
eventStatuses: () => eventStatuses,
|
178
209
|
field: () => field,
|
179
210
|
fieldTypes: () => fieldTypes,
|
180
211
|
filterUnallowedActions: () => filterUnallowedActions,
|
@@ -187,22 +218,33 @@ __export(events_exports, {
|
|
187
218
|
generateActionDocument: () => generateActionDocument,
|
188
219
|
generateEventDocument: () => generateEventDocument,
|
189
220
|
generateEventDraftDocument: () => generateEventDraftDocument,
|
221
|
+
generateRandomName: () => generateRandomName,
|
222
|
+
generateRandomSignature: () => generateRandomSignature,
|
190
223
|
generateTransactionId: () => generateTransactionId,
|
191
224
|
generateTranslationConfig: () => generateTranslationConfig,
|
225
|
+
generateWorkqueues: () => generateWorkqueues,
|
192
226
|
getAcceptedActions: () => getAcceptedActions,
|
193
227
|
getActionAnnotation: () => getActionAnnotation,
|
194
228
|
getActionAnnotationFields: () => getActionAnnotationFields,
|
195
229
|
getActionReview: () => getActionReview,
|
196
230
|
getActionReviewFields: () => getActionReviewFields,
|
197
231
|
getActionVerificationPageIds: () => getActionVerificationPageIds,
|
232
|
+
getAllUniqueFields: () => getAllUniqueFields,
|
198
233
|
getAnnotationFromDrafts: () => getAnnotationFromDrafts,
|
199
234
|
getAssignedUserFromActions: () => getAssignedUserFromActions,
|
235
|
+
getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
|
200
236
|
getCurrentEventState: () => getCurrentEventState,
|
201
237
|
getCurrentEventStateWithDrafts: () => getCurrentEventStateWithDrafts,
|
202
238
|
getDeclaration: () => getDeclaration,
|
239
|
+
getDeclarationFieldById: () => getDeclarationFieldById,
|
203
240
|
getDeclarationFields: () => getDeclarationFields,
|
204
241
|
getDeclarationPages: () => getDeclarationPages,
|
242
|
+
getEventConfigById: () => getEventConfigById,
|
205
243
|
getMixedPath: () => getMixedPath,
|
244
|
+
getRandomDate: () => getRandomDate,
|
245
|
+
getRandomDatetime: () => getRandomDatetime,
|
246
|
+
getStatusFromActions: () => getStatusFromActions,
|
247
|
+
getValidatorsForField: () => getValidatorsForField,
|
206
248
|
getVisibleVerificationPageIds: () => getVisibleVerificationPageIds,
|
207
249
|
hasAnyOfScopes: () => hasAnyOfScopes,
|
208
250
|
isAddressFieldType: () => isAddressFieldType,
|
@@ -225,12 +267,16 @@ __export(events_exports, {
|
|
225
267
|
isFieldVisible: () => isFieldVisible,
|
226
268
|
isFileFieldType: () => isFileFieldType,
|
227
269
|
isFileFieldWithOptionType: () => isFileFieldWithOptionType,
|
270
|
+
isIdFieldType: () => isIdFieldType,
|
228
271
|
isLocationFieldType: () => isLocationFieldType,
|
272
|
+
isNameFieldType: () => isNameFieldType,
|
273
|
+
isNonInteractiveFieldType: () => isNonInteractiveFieldType,
|
229
274
|
isNumberFieldType: () => isNumberFieldType,
|
230
275
|
isOfficeFieldType: () => isOfficeFieldType,
|
231
276
|
isPageHeaderFieldType: () => isPageHeaderFieldType,
|
232
277
|
isPageVisible: () => isPageVisible,
|
233
278
|
isParagraphFieldType: () => isParagraphFieldType,
|
279
|
+
isPhoneFieldType: () => isPhoneFieldType,
|
234
280
|
isRadioGroupFieldType: () => isRadioGroupFieldType,
|
235
281
|
isSelectFieldType: () => isSelectFieldType,
|
236
282
|
isSignatureFieldType: () => isSignatureFieldType,
|
@@ -240,6 +286,7 @@ __export(events_exports, {
|
|
240
286
|
isUndeclaredDraft: () => isUndeclaredDraft,
|
241
287
|
isVerificationPage: () => isVerificationPage,
|
242
288
|
isWriteAction: () => isWriteAction,
|
289
|
+
mandatoryColumns: () => mandatoryColumns,
|
243
290
|
mapFieldTypeToEmptyValue: () => mapFieldTypeToEmptyValue,
|
244
291
|
mapFieldTypeToMockValue: () => mapFieldTypeToMockValue,
|
245
292
|
mapFieldTypeToZod: () => mapFieldTypeToZod,
|
@@ -257,14 +304,21 @@ __export(events_exports, {
|
|
257
304
|
});
|
258
305
|
module.exports = __toCommonJS(events_exports);
|
259
306
|
|
307
|
+
// ../commons/src/events/Constants.ts
|
308
|
+
var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
|
309
|
+
var BIRTH_EVENT = "v2-birth";
|
310
|
+
|
260
311
|
// ../commons/src/events/ActionConfig.ts
|
261
312
|
var import_zod9 = require("zod");
|
262
313
|
|
263
314
|
// ../commons/src/events/Conditional.ts
|
264
315
|
var import_zod = require("zod");
|
265
|
-
var
|
266
|
-
|
267
|
-
)
|
316
|
+
var import_zod_openapi = require("zod-openapi");
|
317
|
+
(0, import_zod_openapi.extendZodWithOpenApi)(import_zod.z);
|
318
|
+
var Conditional = import_zod.z.custom((val) => typeof val === "object" && val !== null).openapi({
|
319
|
+
description: "JSON schema conditional configuration",
|
320
|
+
ref: "Conditional"
|
321
|
+
});
|
268
322
|
var ConditionalType = {
|
269
323
|
SHOW: "SHOW",
|
270
324
|
ENABLE: "ENABLE",
|
@@ -301,7 +355,10 @@ var FieldConditional = import_zod.z.discriminatedUnion("type", [
|
|
301
355
|
EnableConditional,
|
302
356
|
// Field output can be shown / hidden on the review page
|
303
357
|
DisplayOnReviewConditional
|
304
|
-
])
|
358
|
+
]).openapi({
|
359
|
+
description: "Field conditional configuration",
|
360
|
+
ref: "FieldConditional"
|
361
|
+
});
|
305
362
|
|
306
363
|
// ../commons/src/events/PageConfig.ts
|
307
364
|
var import_zod6 = require("zod");
|
@@ -311,6 +368,8 @@ var import_zod5 = require("zod");
|
|
311
368
|
|
312
369
|
// ../commons/src/events/TranslationConfig.ts
|
313
370
|
var import_zod2 = require("zod");
|
371
|
+
var import_zod_openapi2 = require("zod-openapi");
|
372
|
+
(0, import_zod_openapi2.extendZodWithOpenApi)(import_zod2.z);
|
314
373
|
var TranslationConfig = import_zod2.z.object({
|
315
374
|
id: import_zod2.z.string().describe(
|
316
375
|
"The identifier of the translation referred in translation CSV files"
|
@@ -319,10 +378,16 @@ var TranslationConfig = import_zod2.z.object({
|
|
319
378
|
description: import_zod2.z.string().describe(
|
320
379
|
"Describe the translation for a translator to be able to identify it."
|
321
380
|
)
|
381
|
+
}).openapi({
|
382
|
+
description: "Translation configuration",
|
383
|
+
ref: "TranslationConfig"
|
322
384
|
});
|
323
385
|
|
324
386
|
// ../commons/src/events/FieldType.ts
|
325
387
|
var FieldType = {
|
388
|
+
NAME: "NAME",
|
389
|
+
PHONE: "PHONE",
|
390
|
+
ID: "ID",
|
326
391
|
ADDRESS: "ADDRESS",
|
327
392
|
TEXT: "TEXT",
|
328
393
|
NUMBER: "NUMBER",
|
@@ -399,6 +464,16 @@ var UrbanAddressUpdateValue = AdminStructure.extend({
|
|
399
464
|
number: import_zod3.z.string().nullish(),
|
400
465
|
zipCode: import_zod3.z.string().nullish()
|
401
466
|
});
|
467
|
+
var NameFieldValue = import_zod3.z.object({
|
468
|
+
firstname: import_zod3.z.string(),
|
469
|
+
surname: import_zod3.z.string(),
|
470
|
+
middlename: import_zod3.z.string().optional()
|
471
|
+
}).or(import_zod3.z.undefined());
|
472
|
+
var NameFieldUpdateValue = import_zod3.z.object({
|
473
|
+
firstname: import_zod3.z.string(),
|
474
|
+
surname: import_zod3.z.string(),
|
475
|
+
middlename: import_zod3.z.string().nullish()
|
476
|
+
}).or(import_zod3.z.null()).or(import_zod3.z.undefined());
|
402
477
|
var RuralAddressUpdateValue = AdminStructure.extend({
|
403
478
|
urbanOrRural: import_zod3.z.literal(GeographicalArea.RURAL),
|
404
479
|
village: import_zod3.z.string().nullish()
|
@@ -448,6 +523,7 @@ var EmailValue = import_zod4.z.string().email();
|
|
448
523
|
var CheckboxFieldValue = import_zod4.z.boolean();
|
449
524
|
var NumberFieldValue = import_zod4.z.number();
|
450
525
|
var DataFieldValue = import_zod4.z.undefined();
|
526
|
+
var SignatureFieldValue = import_zod4.z.string();
|
451
527
|
var FieldValue = import_zod4.z.union([
|
452
528
|
TextValue,
|
453
529
|
DateValue,
|
@@ -459,7 +535,9 @@ var FieldValue = import_zod4.z.union([
|
|
459
535
|
UrbanAddressValue,
|
460
536
|
RuralAddressValue,
|
461
537
|
DataFieldValue,
|
462
|
-
GenericAddressValue
|
538
|
+
GenericAddressValue,
|
539
|
+
NameFieldValue,
|
540
|
+
NameFieldUpdateValue
|
463
541
|
]);
|
464
542
|
var FieldUpdateValue = import_zod4.z.union([
|
465
543
|
TextValue,
|
@@ -472,23 +550,20 @@ var FieldUpdateValue = import_zod4.z.union([
|
|
472
550
|
UrbanAddressUpdateValue,
|
473
551
|
RuralAddressUpdateValue,
|
474
552
|
DataFieldValue,
|
475
|
-
GenericAddressUpdateValue
|
553
|
+
GenericAddressUpdateValue,
|
554
|
+
NameFieldUpdateValue
|
476
555
|
]);
|
477
556
|
|
478
557
|
// ../commons/src/events/FieldConfig.ts
|
479
|
-
var
|
480
|
-
|
481
|
-
|
482
|
-
|
558
|
+
var import_zod_openapi3 = require("zod-openapi");
|
559
|
+
(0, import_zod_openapi3.extendZodWithOpenApi)(import_zod5.z);
|
560
|
+
var FieldId = import_zod5.z.string().describe("Unique identifier for the field");
|
561
|
+
var FieldReference = import_zod5.z.object({
|
562
|
+
$$field: FieldId
|
563
|
+
}).describe("Reference to a field by its ID");
|
564
|
+
var ParentReference = FieldReference.optional();
|
483
565
|
var BaseField = import_zod5.z.object({
|
484
566
|
id: FieldId,
|
485
|
-
defaultValue: import_zod5.z.union([
|
486
|
-
TextValue,
|
487
|
-
NonEmptyTextValue,
|
488
|
-
DateValue,
|
489
|
-
NumberFieldValue,
|
490
|
-
CheckboxFieldValue
|
491
|
-
]).optional(),
|
492
567
|
parent: ParentReference,
|
493
568
|
conditionals: import_zod5.z.array(FieldConditional).default([]).optional(),
|
494
569
|
required: import_zod5.z.boolean().default(false).optional(),
|
@@ -500,6 +575,7 @@ var BaseField = import_zod5.z.object({
|
|
500
575
|
})
|
501
576
|
).default([]).optional(),
|
502
577
|
label: TranslationConfig,
|
578
|
+
helperText: TranslationConfig.optional(),
|
503
579
|
hideLabel: import_zod5.z.boolean().default(false).optional()
|
504
580
|
});
|
505
581
|
var Divider = BaseField.extend({
|
@@ -549,6 +625,7 @@ var SignatureField = BaseField.extend({
|
|
549
625
|
signaturePromptLabel: TranslationConfig.describe(
|
550
626
|
"Title of the signature modal"
|
551
627
|
),
|
628
|
+
defaultValue: SignatureFieldValue.optional(),
|
552
629
|
configuration: import_zod5.z.object({
|
553
630
|
maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
554
631
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
@@ -608,6 +685,7 @@ var PageHeader = BaseField.extend({
|
|
608
685
|
}).describe("A read-only header component for form pages");
|
609
686
|
var File = BaseField.extend({
|
610
687
|
type: import_zod5.z.literal(FieldType.FILE),
|
688
|
+
defaultValue: FileFieldValue.optional(),
|
611
689
|
configuration: import_zod5.z.object({
|
612
690
|
maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
613
691
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
|
@@ -650,6 +728,26 @@ var Select = BaseField.extend({
|
|
650
728
|
defaultValue: TextValue.optional(),
|
651
729
|
options: import_zod5.z.array(SelectOption).describe("A list of options")
|
652
730
|
}).describe("Select input");
|
731
|
+
var NameField = BaseField.extend({
|
732
|
+
type: import_zod5.z.literal(FieldType.NAME),
|
733
|
+
defaultValue: import_zod5.z.object({
|
734
|
+
firstname: NonEmptyTextValue,
|
735
|
+
surname: NonEmptyTextValue
|
736
|
+
}).optional(),
|
737
|
+
configuration: import_zod5.z.object({
|
738
|
+
maxLength: import_zod5.z.number().optional().describe("Maximum length of the text"),
|
739
|
+
prefix: TranslationConfig.optional(),
|
740
|
+
postfix: TranslationConfig.optional()
|
741
|
+
}).optional()
|
742
|
+
}).describe("Name input field");
|
743
|
+
var PhoneField = BaseField.extend({
|
744
|
+
defaultValue: NonEmptyTextValue.optional(),
|
745
|
+
type: import_zod5.z.literal(FieldType.PHONE)
|
746
|
+
}).describe("Phone input field");
|
747
|
+
var IdField = BaseField.extend({
|
748
|
+
defaultValue: NonEmptyTextValue.optional(),
|
749
|
+
type: import_zod5.z.literal(FieldType.ID)
|
750
|
+
}).describe("ID input field");
|
653
751
|
var Checkbox = BaseField.extend({
|
654
752
|
type: import_zod5.z.literal(FieldType.CHECKBOX),
|
655
753
|
defaultValue: CheckboxFieldValue.optional()
|
@@ -681,6 +779,7 @@ var Location = BaseField.extend({
|
|
681
779
|
var FileUploadWithOptions = BaseField.extend({
|
682
780
|
type: import_zod5.z.literal(FieldType.FILE_WITH_OPTIONS),
|
683
781
|
options: import_zod5.z.array(SelectOption).describe("A list of options"),
|
782
|
+
defaultValue: FileFieldWithOptionValue.optional(),
|
684
783
|
configuration: import_zod5.z.object({
|
685
784
|
maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
686
785
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
@@ -728,6 +827,9 @@ var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
|
728
827
|
BulletList,
|
729
828
|
PageHeader,
|
730
829
|
Select,
|
830
|
+
NameField,
|
831
|
+
PhoneField,
|
832
|
+
IdField,
|
731
833
|
Checkbox,
|
732
834
|
File,
|
733
835
|
Country,
|
@@ -740,9 +842,14 @@ var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
|
740
842
|
EmailField,
|
741
843
|
FileUploadWithOptions,
|
742
844
|
DataField
|
743
|
-
])
|
845
|
+
]).openapi({
|
846
|
+
description: "Form field configuration",
|
847
|
+
ref: "FieldConfig"
|
848
|
+
});
|
744
849
|
|
745
850
|
// ../commons/src/events/PageConfig.ts
|
851
|
+
var import_zod_openapi4 = require("zod-openapi");
|
852
|
+
(0, import_zod_openapi4.extendZodWithOpenApi)(import_zod6.z);
|
746
853
|
var PageTypes = import_zod6.z.enum(["FORM", "VERIFICATION"]);
|
747
854
|
var PageConfigBase = import_zod6.z.object({
|
748
855
|
id: import_zod6.z.string().describe("Unique identifier for the page"),
|
@@ -751,6 +858,9 @@ var PageConfigBase = import_zod6.z.object({
|
|
751
858
|
conditional: Conditional.optional().describe(
|
752
859
|
"Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
|
753
860
|
)
|
861
|
+
}).openapi({
|
862
|
+
description: "Form page configuration",
|
863
|
+
ref: "FormPageConfig"
|
754
864
|
});
|
755
865
|
var FormPageConfig = PageConfigBase.extend({
|
756
866
|
type: import_zod6.z.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
|
@@ -764,7 +874,10 @@ var VerificationActionConfig = import_zod6.z.object({
|
|
764
874
|
body: TranslationConfig
|
765
875
|
})
|
766
876
|
})
|
767
|
-
}).describe("Actions available on the verification page")
|
877
|
+
}).describe("Actions available on the verification page").openapi({
|
878
|
+
description: "Verification action configuration",
|
879
|
+
ref: "VerificationActionConfig"
|
880
|
+
});
|
768
881
|
var VerificationPageConfig = FormPageConfig.extend({
|
769
882
|
type: import_zod6.z.literal(PageTypes.enum.VERIFICATION),
|
770
883
|
actions: VerificationActionConfig
|
@@ -864,8 +977,8 @@ var ActionFormConfig = import_zod8.z.object({
|
|
864
977
|
var FormConfig = import_zod8.z.union([DeclarationFormConfig, ActionFormConfig]);
|
865
978
|
|
866
979
|
// ../commons/src/events/ActionConfig.ts
|
867
|
-
var
|
868
|
-
(0,
|
980
|
+
var import_zod_openapi5 = require("zod-openapi");
|
981
|
+
(0, import_zod_openapi5.extendZodWithOpenApi)(import_zod9.z);
|
869
982
|
var ActionConditional2 = import_zod9.z.discriminatedUnion("type", [
|
870
983
|
/** If conditional is defined, the action is shown to the user only if the condition is met */
|
871
984
|
ShowConditional,
|
@@ -881,6 +994,12 @@ var ActionConfigBase = import_zod9.z.object({
|
|
881
994
|
conditionals: import_zod9.z.array(ActionConditional2).optional().default([]),
|
882
995
|
draft: import_zod9.z.boolean().optional()
|
883
996
|
});
|
997
|
+
var ReadActionConfig = ActionConfigBase.merge(
|
998
|
+
import_zod9.z.object({
|
999
|
+
type: import_zod9.z.literal(ActionType.READ),
|
1000
|
+
review: DeclarationReviewConfig
|
1001
|
+
})
|
1002
|
+
);
|
884
1003
|
var DeclareConfig = ActionConfigBase.merge(
|
885
1004
|
import_zod9.z.object({
|
886
1005
|
type: import_zod9.z.literal(ActionType.DECLARE),
|
@@ -947,6 +1066,7 @@ var ActionConfig = import_zod9.z.discriminatedUnion("type", [
|
|
947
1066
|
* OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
|
948
1067
|
* and treat them as "models" instead of duplicating the data structure in each endpoint.
|
949
1068
|
*/
|
1069
|
+
ReadActionConfig.openapi({ ref: "ReadActionConfig" }),
|
950
1070
|
DeclareConfig.openapi({ ref: "DeclareActionConfig" }),
|
951
1071
|
ValidateConfig.openapi({ ref: "ValidateActionConfig" }),
|
952
1072
|
RejectDeclarationConfig.openapi({ ref: "RejectDeclarationActionConfig" }),
|
@@ -1004,13 +1124,13 @@ var LanguageConfig = import_zod11.z.object({
|
|
1004
1124
|
});
|
1005
1125
|
|
1006
1126
|
// ../commons/src/events/EventConfig.ts
|
1007
|
-
var
|
1127
|
+
var import_zod18 = require("zod");
|
1008
1128
|
|
1009
1129
|
// ../commons/src/events/DeduplicationConfig.ts
|
1010
1130
|
var import_zod12 = require("zod");
|
1011
|
-
var
|
1012
|
-
(0,
|
1013
|
-
var
|
1131
|
+
var import_zod_openapi6 = require("zod-openapi");
|
1132
|
+
(0, import_zod_openapi6.extendZodWithOpenApi)(import_zod12.z);
|
1133
|
+
var FieldReference2 = import_zod12.z.string();
|
1014
1134
|
var Matcher = import_zod12.z.object({
|
1015
1135
|
fieldId: import_zod12.z.string(),
|
1016
1136
|
options: import_zod12.z.object({
|
@@ -1039,7 +1159,7 @@ var DateRangeMatcher = Matcher.extend({
|
|
1039
1159
|
type: import_zod12.z.literal("dateRange"),
|
1040
1160
|
options: import_zod12.z.object({
|
1041
1161
|
days: import_zod12.z.number(),
|
1042
|
-
origin:
|
1162
|
+
origin: FieldReference2,
|
1043
1163
|
boost: import_zod12.z.number().optional().default(1)
|
1044
1164
|
})
|
1045
1165
|
});
|
@@ -1047,7 +1167,7 @@ var DateDistanceMatcher = Matcher.extend({
|
|
1047
1167
|
type: import_zod12.z.literal("dateDistance"),
|
1048
1168
|
options: import_zod12.z.object({
|
1049
1169
|
days: import_zod12.z.number(),
|
1050
|
-
origin:
|
1170
|
+
origin: FieldReference2,
|
1051
1171
|
boost: import_zod12.z.number().optional().default(1)
|
1052
1172
|
})
|
1053
1173
|
});
|
@@ -1110,13 +1230,58 @@ var BaseField3 = import_zod14.z.object({
|
|
1110
1230
|
config: import_zod14.z.object({
|
1111
1231
|
type: MatchType.describe("Determines the type of field")
|
1112
1232
|
}),
|
1113
|
-
options: import_zod14.z.array(SelectOption).optional()
|
1233
|
+
options: import_zod14.z.array(SelectOption).optional(),
|
1234
|
+
searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
|
1235
|
+
`
|
1236
|
+
This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
|
1237
|
+
when rendering search parameter labels \u2014 for example, in the search results page to indicate which fields were used in the search.
|
1238
|
+
|
1239
|
+
For example, a field config like { id: "child.name.firstname", label: { defaultMessage: "First Name(s)" } } would render as "First Name(s)" by default.
|
1240
|
+
|
1241
|
+
A field config like { id: "mother.firstname", label: { defaultMessage: "First Name(s)" } } would also render as "First Name(s)" by default.
|
1242
|
+
|
1243
|
+
So, if both child.name.firstname and mother.firstname are used in a search, the resulting search criteria labels would be "First Name(s)", "First Name(s)",
|
1244
|
+
which is ambiguous.
|
1245
|
+
|
1246
|
+
Now, if we treat the field ID prefix as a label (e.g., "applicant.firstname" \u2192 "Applicant"), and the field label is already
|
1247
|
+
descriptive \u2014 like { id: "applicant.firstname", label: { defaultMessage: "Applicant's First Name" } } \u2014 then the resulting
|
1248
|
+
label would be "Applicant Applicant's First Name", which is redundant and awkward.
|
1249
|
+
|
1250
|
+
By setting searchCriteriaLabelPrefix to a translation config object, we can explicitly define the desired prefix
|
1251
|
+
in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
|
1252
|
+
`
|
1253
|
+
),
|
1254
|
+
conditionals: import_zod14.z.array(FieldConditional).default([]).optional().describe(
|
1255
|
+
`
|
1256
|
+
In advanced search, we sometimes need to override the default field visibility conditionals.
|
1257
|
+
|
1258
|
+
For example, Informant fields in the declaration form may have conditional logic
|
1259
|
+
that hides them based on other field values. Since the advanced search form reuses
|
1260
|
+
the declaration form config, those same conditionals would apply by default.
|
1261
|
+
|
1262
|
+
However, in advanced search we often want to make all Informant fields searchable,
|
1263
|
+
regardless of their original visibility logic. To do this, we explicitly set their
|
1264
|
+
'conditionals' to an empty array ('[]') in the search config. This ensures they
|
1265
|
+
are always rendered in the advanced search form.
|
1266
|
+
`
|
1267
|
+
)
|
1114
1268
|
});
|
1269
|
+
var SearchQueryParams = import_zod14.z.object({
|
1270
|
+
eventType: import_zod14.z.string().optional().describe(
|
1271
|
+
"Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
|
1272
|
+
)
|
1273
|
+
}).catchall(FieldValue);
|
1115
1274
|
var FieldConfigSchema = BaseField3.extend({
|
1116
1275
|
fieldId: import_zod14.z.string(),
|
1117
1276
|
fieldType: import_zod14.z.literal("field")
|
1118
1277
|
});
|
1119
|
-
var EventFieldId = import_zod14.z.enum([
|
1278
|
+
var EventFieldId = import_zod14.z.enum([
|
1279
|
+
"trackingId",
|
1280
|
+
"status",
|
1281
|
+
"legalStatus.REGISTERED.createdAt",
|
1282
|
+
"legalStatus.REGISTERED.createdAtLocation",
|
1283
|
+
"updatedAt"
|
1284
|
+
]);
|
1120
1285
|
var EventFieldConfigSchema = BaseField3.extend({
|
1121
1286
|
fieldId: EventFieldId,
|
1122
1287
|
fieldType: import_zod14.z.literal("event")
|
@@ -1134,114 +1299,127 @@ var AdvancedSearchConfig = import_zod14.z.object({
|
|
1134
1299
|
var import_lodash = require("lodash");
|
1135
1300
|
|
1136
1301
|
// ../commons/src/events/ActionDocument.ts
|
1302
|
+
var import_zod16 = require("zod");
|
1303
|
+
var import_zod_openapi7 = require("zod-openapi");
|
1304
|
+
|
1305
|
+
// ../commons/src/events/CreatedAtLocation.ts
|
1137
1306
|
var import_zod15 = require("zod");
|
1138
|
-
var
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1307
|
+
var CreatedAtLocation = import_zod15.z.string().nullish();
|
1308
|
+
|
1309
|
+
// ../commons/src/events/ActionDocument.ts
|
1310
|
+
(0, import_zod_openapi7.extendZodWithOpenApi)(import_zod16.z);
|
1311
|
+
var ActionUpdate = import_zod16.z.record(import_zod16.z.string(), FieldUpdateValue);
|
1312
|
+
var EventState = import_zod16.z.record(import_zod16.z.string(), FieldValue);
|
1142
1313
|
var ActionStatus = {
|
1143
1314
|
Requested: "Requested",
|
1144
1315
|
Accepted: "Accepted",
|
1145
1316
|
Rejected: "Rejected"
|
1146
1317
|
};
|
1147
|
-
var ActionBase =
|
1148
|
-
id:
|
1149
|
-
transactionId:
|
1150
|
-
createdAt:
|
1151
|
-
createdBy:
|
1152
|
-
createdByRole:
|
1318
|
+
var ActionBase = import_zod16.z.object({
|
1319
|
+
id: import_zod16.z.string(),
|
1320
|
+
transactionId: import_zod16.z.string(),
|
1321
|
+
createdAt: import_zod16.z.string().datetime(),
|
1322
|
+
createdBy: import_zod16.z.string(),
|
1323
|
+
createdByRole: import_zod16.z.string(),
|
1324
|
+
createdBySignature: import_zod16.z.string().nullish().describe("Reference to signature of the user who created the action"),
|
1325
|
+
createdAtLocation: CreatedAtLocation,
|
1153
1326
|
declaration: ActionUpdate,
|
1154
1327
|
annotation: ActionUpdate.optional(),
|
1155
|
-
|
1156
|
-
status: import_zod15.z.enum([
|
1328
|
+
status: import_zod16.z.enum([
|
1157
1329
|
ActionStatus.Requested,
|
1158
1330
|
ActionStatus.Accepted,
|
1159
1331
|
ActionStatus.Rejected
|
1160
1332
|
]),
|
1161
1333
|
// If the action is an asynchronous confirmation for another action, we will save the original action id here.
|
1162
|
-
originalActionId:
|
1334
|
+
originalActionId: import_zod16.z.string().optional()
|
1163
1335
|
});
|
1164
1336
|
var AssignedAction = ActionBase.merge(
|
1165
|
-
|
1166
|
-
type:
|
1167
|
-
assignedTo:
|
1337
|
+
import_zod16.z.object({
|
1338
|
+
type: import_zod16.z.literal(ActionType.ASSIGN),
|
1339
|
+
assignedTo: import_zod16.z.string()
|
1168
1340
|
})
|
1169
1341
|
);
|
1170
1342
|
var UnassignedAction = ActionBase.merge(
|
1171
|
-
|
1172
|
-
type:
|
1173
|
-
assignedTo:
|
1343
|
+
import_zod16.z.object({
|
1344
|
+
type: import_zod16.z.literal(ActionType.UNASSIGN),
|
1345
|
+
assignedTo: import_zod16.z.literal(null)
|
1174
1346
|
})
|
1175
1347
|
);
|
1176
1348
|
var RegisterAction = ActionBase.merge(
|
1177
|
-
|
1178
|
-
type:
|
1179
|
-
registrationNumber:
|
1349
|
+
import_zod16.z.object({
|
1350
|
+
type: import_zod16.z.literal(ActionType.REGISTER),
|
1351
|
+
registrationNumber: import_zod16.z.string().optional()
|
1180
1352
|
})
|
1181
1353
|
);
|
1182
1354
|
var DeclareAction = ActionBase.merge(
|
1183
|
-
|
1184
|
-
type:
|
1355
|
+
import_zod16.z.object({
|
1356
|
+
type: import_zod16.z.literal(ActionType.DECLARE)
|
1185
1357
|
})
|
1186
1358
|
);
|
1187
1359
|
var ValidateAction = ActionBase.merge(
|
1188
|
-
|
1189
|
-
type:
|
1360
|
+
import_zod16.z.object({
|
1361
|
+
type: import_zod16.z.literal(ActionType.VALIDATE)
|
1190
1362
|
})
|
1191
1363
|
);
|
1364
|
+
var RejectionReason = import_zod16.z.object({
|
1365
|
+
message: import_zod16.z.string().min(1, { message: "Message cannot be empty" }).describe("Message describing reason for rejection or archiving"),
|
1366
|
+
isDuplicate: import_zod16.z.boolean().optional().describe("If a declaration is duplicated")
|
1367
|
+
});
|
1192
1368
|
var RejectAction = ActionBase.merge(
|
1193
|
-
|
1194
|
-
type:
|
1369
|
+
import_zod16.z.object({
|
1370
|
+
type: import_zod16.z.literal(ActionType.REJECT),
|
1371
|
+
reason: RejectionReason
|
1195
1372
|
})
|
1196
1373
|
);
|
1197
1374
|
var MarkAsDuplicateAction = ActionBase.merge(
|
1198
|
-
|
1199
|
-
type:
|
1375
|
+
import_zod16.z.object({
|
1376
|
+
type: import_zod16.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1200
1377
|
})
|
1201
1378
|
);
|
1202
1379
|
var ArchiveAction = ActionBase.merge(
|
1203
|
-
|
1204
|
-
type:
|
1380
|
+
import_zod16.z.object({
|
1381
|
+
type: import_zod16.z.literal(ActionType.ARCHIVE),
|
1382
|
+
reason: RejectionReason
|
1205
1383
|
})
|
1206
1384
|
);
|
1207
1385
|
var CreatedAction = ActionBase.merge(
|
1208
|
-
|
1209
|
-
type:
|
1386
|
+
import_zod16.z.object({
|
1387
|
+
type: import_zod16.z.literal(ActionType.CREATE)
|
1210
1388
|
})
|
1211
1389
|
);
|
1212
1390
|
var NotifiedAction = ActionBase.merge(
|
1213
|
-
|
1214
|
-
type:
|
1391
|
+
import_zod16.z.object({
|
1392
|
+
type: import_zod16.z.literal(ActionType.NOTIFY)
|
1215
1393
|
})
|
1216
1394
|
);
|
1217
1395
|
var PrintCertificateAction = ActionBase.merge(
|
1218
|
-
|
1219
|
-
type:
|
1396
|
+
import_zod16.z.object({
|
1397
|
+
type: import_zod16.z.literal(ActionType.PRINT_CERTIFICATE)
|
1220
1398
|
})
|
1221
1399
|
);
|
1222
1400
|
var RequestedCorrectionAction = ActionBase.merge(
|
1223
|
-
|
1224
|
-
type:
|
1401
|
+
import_zod16.z.object({
|
1402
|
+
type: import_zod16.z.literal(ActionType.REQUEST_CORRECTION)
|
1225
1403
|
})
|
1226
1404
|
);
|
1227
1405
|
var ApprovedCorrectionAction = ActionBase.merge(
|
1228
|
-
|
1229
|
-
type:
|
1230
|
-
requestId:
|
1406
|
+
import_zod16.z.object({
|
1407
|
+
type: import_zod16.z.literal(ActionType.APPROVE_CORRECTION),
|
1408
|
+
requestId: import_zod16.z.string()
|
1231
1409
|
})
|
1232
1410
|
);
|
1233
1411
|
var RejectedCorrectionAction = ActionBase.merge(
|
1234
|
-
|
1235
|
-
type:
|
1236
|
-
requestId:
|
1412
|
+
import_zod16.z.object({
|
1413
|
+
type: import_zod16.z.literal(ActionType.REJECT_CORRECTION),
|
1414
|
+
requestId: import_zod16.z.string()
|
1237
1415
|
})
|
1238
1416
|
);
|
1239
1417
|
var ReadAction = ActionBase.merge(
|
1240
|
-
|
1241
|
-
type:
|
1418
|
+
import_zod16.z.object({
|
1419
|
+
type: import_zod16.z.literal(ActionType.READ)
|
1242
1420
|
})
|
1243
1421
|
);
|
1244
|
-
var ActionDocument =
|
1422
|
+
var ActionDocument = import_zod16.z.discriminatedUnion("type", [
|
1245
1423
|
CreatedAction.openapi({ ref: "CreatedAction" }),
|
1246
1424
|
ValidateAction.openapi({ ref: "ValidateAction" }),
|
1247
1425
|
RejectAction.openapi({ ref: "RejectAction" }),
|
@@ -1264,20 +1442,20 @@ var AsyncRejectActionDocument = ActionBase.omit({
|
|
1264
1442
|
declaration: true,
|
1265
1443
|
annotation: true
|
1266
1444
|
}).merge(
|
1267
|
-
|
1268
|
-
type:
|
1269
|
-
status:
|
1445
|
+
import_zod16.z.object({
|
1446
|
+
type: import_zod16.z.enum(ConfirmableActions),
|
1447
|
+
status: import_zod16.z.literal(ActionStatus.Rejected)
|
1270
1448
|
})
|
1271
1449
|
);
|
1272
|
-
var Action =
|
1273
|
-
var ResolvedUser =
|
1274
|
-
id:
|
1275
|
-
role:
|
1276
|
-
name:
|
1277
|
-
|
1278
|
-
use:
|
1279
|
-
given:
|
1280
|
-
family:
|
1450
|
+
var Action = import_zod16.z.union([ActionDocument, AsyncRejectActionDocument]);
|
1451
|
+
var ResolvedUser = import_zod16.z.object({
|
1452
|
+
id: import_zod16.z.string(),
|
1453
|
+
role: import_zod16.z.string(),
|
1454
|
+
name: import_zod16.z.array(
|
1455
|
+
import_zod16.z.object({
|
1456
|
+
use: import_zod16.z.string(),
|
1457
|
+
given: import_zod16.z.array(import_zod16.z.string()),
|
1458
|
+
family: import_zod16.z.string()
|
1281
1459
|
})
|
1282
1460
|
)
|
1283
1461
|
});
|
@@ -1288,7 +1466,7 @@ var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
1288
1466
|
var import_date_fns = require("date-fns");
|
1289
1467
|
|
1290
1468
|
// ../commons/src/events/FieldTypeMapping.ts
|
1291
|
-
var
|
1469
|
+
var import_zod17 = require("zod");
|
1292
1470
|
function mapFieldTypeToZod(type, required) {
|
1293
1471
|
let schema;
|
1294
1472
|
switch (type) {
|
@@ -1314,7 +1492,8 @@ function mapFieldTypeToZod(type, required) {
|
|
1314
1492
|
case FieldType.ADMINISTRATIVE_AREA:
|
1315
1493
|
case FieldType.FACILITY:
|
1316
1494
|
case FieldType.OFFICE:
|
1317
|
-
case FieldType.
|
1495
|
+
case FieldType.PHONE:
|
1496
|
+
case FieldType.ID:
|
1318
1497
|
schema = required ? NonEmptyTextValue : TextValue;
|
1319
1498
|
break;
|
1320
1499
|
case FieldType.NUMBER:
|
@@ -1323,6 +1502,7 @@ function mapFieldTypeToZod(type, required) {
|
|
1323
1502
|
case FieldType.CHECKBOX:
|
1324
1503
|
schema = CheckboxFieldValue;
|
1325
1504
|
break;
|
1505
|
+
case FieldType.SIGNATURE:
|
1326
1506
|
case FieldType.FILE:
|
1327
1507
|
schema = FileFieldValue;
|
1328
1508
|
break;
|
@@ -1335,6 +1515,9 @@ function mapFieldTypeToZod(type, required) {
|
|
1335
1515
|
case FieldType.DATA:
|
1336
1516
|
schema = DataFieldValue;
|
1337
1517
|
break;
|
1518
|
+
case FieldType.NAME:
|
1519
|
+
schema = required ? NameFieldValue : NameFieldUpdateValue;
|
1520
|
+
break;
|
1338
1521
|
}
|
1339
1522
|
return required ? schema : schema.nullish();
|
1340
1523
|
}
|
@@ -1343,59 +1526,7 @@ function createValidationSchema(config) {
|
|
1343
1526
|
for (const field2 of config) {
|
1344
1527
|
shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
|
1345
1528
|
}
|
1346
|
-
return
|
1347
|
-
}
|
1348
|
-
function mapFieldTypeToMockValue(field2, i) {
|
1349
|
-
switch (field2.type) {
|
1350
|
-
case FieldType.DIVIDER:
|
1351
|
-
case FieldType.TEXT:
|
1352
|
-
case FieldType.TEXTAREA:
|
1353
|
-
case FieldType.BULLET_LIST:
|
1354
|
-
case FieldType.PAGE_HEADER:
|
1355
|
-
case FieldType.LOCATION:
|
1356
|
-
case FieldType.SELECT:
|
1357
|
-
case FieldType.COUNTRY:
|
1358
|
-
case FieldType.RADIO_GROUP:
|
1359
|
-
case FieldType.SIGNATURE:
|
1360
|
-
case FieldType.PARAGRAPH:
|
1361
|
-
case FieldType.ADMINISTRATIVE_AREA:
|
1362
|
-
case FieldType.FACILITY:
|
1363
|
-
case FieldType.OFFICE:
|
1364
|
-
return `${field2.id}-${field2.type}-${i}`;
|
1365
|
-
case FieldType.NUMBER:
|
1366
|
-
return 19;
|
1367
|
-
case FieldType.EMAIL:
|
1368
|
-
return "test@opencrvs.org";
|
1369
|
-
case FieldType.ADDRESS:
|
1370
|
-
return {
|
1371
|
-
country: "FAR",
|
1372
|
-
addressType: AddressType.DOMESTIC,
|
1373
|
-
province: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
1374
|
-
district: "5ef450bc-712d-48ad-93f3-8da0fa453baa",
|
1375
|
-
urbanOrRural: "URBAN",
|
1376
|
-
town: "Example Town",
|
1377
|
-
residentialArea: "Example Residential Area",
|
1378
|
-
street: "Example Street",
|
1379
|
-
number: "55",
|
1380
|
-
zipCode: "123456"
|
1381
|
-
};
|
1382
|
-
case FieldType.DATE:
|
1383
|
-
return "2021-01-01";
|
1384
|
-
case FieldType.DATE_RANGE:
|
1385
|
-
return ["2021-01-01", "2021-01-02"];
|
1386
|
-
case FieldType.CHECKBOX:
|
1387
|
-
return true;
|
1388
|
-
case FieldType.FILE:
|
1389
|
-
return {
|
1390
|
-
filename: "4f095fc4-4312-4de2-aa38-86dcc0f71044.png",
|
1391
|
-
originalFilename: "abcd.png",
|
1392
|
-
type: "image/png"
|
1393
|
-
};
|
1394
|
-
case FieldType.FILE_WITH_OPTIONS:
|
1395
|
-
return null;
|
1396
|
-
case FieldType.DATA:
|
1397
|
-
return {};
|
1398
|
-
}
|
1529
|
+
return import_zod17.z.object(shape);
|
1399
1530
|
}
|
1400
1531
|
function mapFieldTypeToEmptyValue(field2) {
|
1401
1532
|
switch (field2.type) {
|
@@ -1408,7 +1539,6 @@ function mapFieldTypeToEmptyValue(field2) {
|
|
1408
1539
|
case FieldType.SELECT:
|
1409
1540
|
case FieldType.COUNTRY:
|
1410
1541
|
case FieldType.RADIO_GROUP:
|
1411
|
-
case FieldType.SIGNATURE:
|
1412
1542
|
case FieldType.PARAGRAPH:
|
1413
1543
|
case FieldType.ADMINISTRATIVE_AREA:
|
1414
1544
|
case FieldType.FACILITY:
|
@@ -1419,6 +1549,9 @@ function mapFieldTypeToEmptyValue(field2) {
|
|
1419
1549
|
case FieldType.CHECKBOX:
|
1420
1550
|
case FieldType.DATE_RANGE:
|
1421
1551
|
case FieldType.DATA:
|
1552
|
+
case FieldType.NAME:
|
1553
|
+
case FieldType.PHONE:
|
1554
|
+
case FieldType.ID:
|
1422
1555
|
return null;
|
1423
1556
|
case FieldType.ADDRESS:
|
1424
1557
|
return {
|
@@ -1434,6 +1567,7 @@ function mapFieldTypeToEmptyValue(field2) {
|
|
1434
1567
|
number: null,
|
1435
1568
|
zipCode: null
|
1436
1569
|
};
|
1570
|
+
case FieldType.SIGNATURE:
|
1437
1571
|
case FieldType.FILE:
|
1438
1572
|
return {
|
1439
1573
|
filename: "",
|
@@ -1462,6 +1596,15 @@ var isTextFieldType = (field2) => {
|
|
1462
1596
|
var isNumberFieldType = (field2) => {
|
1463
1597
|
return field2.config.type === FieldType.NUMBER;
|
1464
1598
|
};
|
1599
|
+
var isNameFieldType = (field2) => {
|
1600
|
+
return field2.config.type === FieldType.NAME;
|
1601
|
+
};
|
1602
|
+
var isPhoneFieldType = (field2) => {
|
1603
|
+
return field2.config.type === FieldType.PHONE;
|
1604
|
+
};
|
1605
|
+
var isIdFieldType = (field2) => {
|
1606
|
+
return field2.config.type === FieldType.ID;
|
1607
|
+
};
|
1465
1608
|
var isTextAreaFieldType = (field2) => {
|
1466
1609
|
return field2.config.type === FieldType.TEXTAREA;
|
1467
1610
|
};
|
@@ -1513,6 +1656,9 @@ var isOfficeFieldType = (field2) => {
|
|
1513
1656
|
var isDataFieldType = (field2) => {
|
1514
1657
|
return field2.config.type === FieldType.DATA;
|
1515
1658
|
};
|
1659
|
+
var isNonInteractiveFieldType = (field2) => {
|
1660
|
+
return field2.type === FieldType.DIVIDER || field2.type === FieldType.PAGE_HEADER || field2.type === FieldType.PARAGRAPH || field2.type === FieldType.BULLET_LIST || field2.type === FieldType.DATA;
|
1661
|
+
};
|
1516
1662
|
|
1517
1663
|
// ../commons/src/conditionals/validate.ts
|
1518
1664
|
var ajv = new import_ajv.default({
|
@@ -1688,6 +1834,45 @@ function runFieldValidations({
|
|
1688
1834
|
errors: [...fieldValidationResult, ...customValidationResults]
|
1689
1835
|
};
|
1690
1836
|
}
|
1837
|
+
function getValidatorsForField(fieldId, validations) {
|
1838
|
+
return validations.map(({ validator, message }) => {
|
1839
|
+
const jsonSchema = validator;
|
1840
|
+
const $form = jsonSchema.properties.$form;
|
1841
|
+
if ($form.properties?.[fieldId]?.type === "object") {
|
1842
|
+
return {
|
1843
|
+
message,
|
1844
|
+
validator: {
|
1845
|
+
...jsonSchema,
|
1846
|
+
properties: {
|
1847
|
+
$form: {
|
1848
|
+
type: "object",
|
1849
|
+
properties: $form.properties?.[fieldId]?.properties || {},
|
1850
|
+
required: $form.properties?.[fieldId]?.required || []
|
1851
|
+
}
|
1852
|
+
}
|
1853
|
+
}
|
1854
|
+
};
|
1855
|
+
}
|
1856
|
+
if (!$form.properties?.[fieldId]) {
|
1857
|
+
return null;
|
1858
|
+
}
|
1859
|
+
return {
|
1860
|
+
message,
|
1861
|
+
validator: {
|
1862
|
+
...jsonSchema,
|
1863
|
+
properties: {
|
1864
|
+
$form: {
|
1865
|
+
type: "object",
|
1866
|
+
properties: {
|
1867
|
+
[fieldId]: $form.properties?.[fieldId]
|
1868
|
+
},
|
1869
|
+
required: $form.required?.includes(fieldId) ? [fieldId] : []
|
1870
|
+
}
|
1871
|
+
}
|
1872
|
+
}
|
1873
|
+
};
|
1874
|
+
}).filter((x) => x !== null);
|
1875
|
+
}
|
1691
1876
|
|
1692
1877
|
// ../commons/src/uuid.ts
|
1693
1878
|
var import_uuid = require("uuid");
|
@@ -1734,6 +1919,13 @@ var getActionAnnotationFields = (actionConfig) => {
|
|
1734
1919
|
function getAllAnnotationFields(config) {
|
1735
1920
|
return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
|
1736
1921
|
}
|
1922
|
+
function getAllUniqueFields(eventConfig) {
|
1923
|
+
return (0, import_lodash.uniqBy)(getDeclarationFields(eventConfig), (field2) => field2.id);
|
1924
|
+
}
|
1925
|
+
function getDeclarationFieldById(config, fieldId) {
|
1926
|
+
const field2 = getAllUniqueFields(config).find((f) => f.id === fieldId);
|
1927
|
+
return getOrThrow(field2, `Field with id ${fieldId} not found in event config`);
|
1928
|
+
}
|
1737
1929
|
var findRecordActionPages = (config, actionType) => {
|
1738
1930
|
const action = config.actions.find((a) => a.type === actionType);
|
1739
1931
|
if (action?.type === ActionType.REQUEST_CORRECTION) {
|
@@ -1839,8 +2031,9 @@ function omitHiddenAnnotationFields(actionConfig, declaration, annotation) {
|
|
1839
2031
|
);
|
1840
2032
|
}
|
1841
2033
|
function deepMerge(currentDocument, actionDocument) {
|
2034
|
+
const currentDocumentClone = (0, import_lodash.cloneDeep)(currentDocument);
|
1842
2035
|
return (0, import_lodash.mergeWith)(
|
1843
|
-
|
2036
|
+
(0, import_lodash.cloneDeep)(currentDocumentClone),
|
1844
2037
|
actionDocument,
|
1845
2038
|
(previousValue, incomingValue) => {
|
1846
2039
|
if (incomingValue === void 0) {
|
@@ -1888,25 +2081,31 @@ function getMixedPath(obj, path, defaultValue) {
|
|
1888
2081
|
const result = resolve(obj, parts);
|
1889
2082
|
return (0, import_lodash.isNil)(result) ? defaultValue : result;
|
1890
2083
|
}
|
2084
|
+
function getEventConfigById(eventConfigs, id) {
|
2085
|
+
const eventConfig = eventConfigs.find(
|
2086
|
+
(eventConfiguration) => eventConfiguration.id === id
|
2087
|
+
);
|
2088
|
+
return getOrThrow(eventConfig, `Event config for ${id} not found`);
|
2089
|
+
}
|
1891
2090
|
|
1892
2091
|
// ../commons/src/events/EventConfig.ts
|
1893
|
-
var
|
1894
|
-
(0,
|
1895
|
-
var EventConfig =
|
1896
|
-
id:
|
2092
|
+
var import_zod_openapi8 = require("zod-openapi");
|
2093
|
+
(0, import_zod_openapi8.extendZodWithOpenApi)(import_zod18.z);
|
2094
|
+
var EventConfig = import_zod18.z.object({
|
2095
|
+
id: import_zod18.z.string().describe(
|
1897
2096
|
'A machine-readable identifier for the event, e.g. "birth" or "death"'
|
1898
2097
|
),
|
1899
|
-
dateOfEvent:
|
2098
|
+
dateOfEvent: FieldReference.optional(),
|
1900
2099
|
title: TranslationConfig,
|
1901
2100
|
fallbackTitle: TranslationConfig.optional().describe(
|
1902
2101
|
"This is a fallback title if actual title resolves to empty string"
|
1903
2102
|
),
|
1904
2103
|
summary: SummaryConfig,
|
1905
2104
|
label: TranslationConfig,
|
1906
|
-
actions:
|
2105
|
+
actions: import_zod18.z.array(ActionConfig),
|
1907
2106
|
declaration: DeclarationFormConfig,
|
1908
|
-
deduplication:
|
1909
|
-
advancedSearch:
|
2107
|
+
deduplication: import_zod18.z.array(DeduplicationConfig).optional().default([]),
|
2108
|
+
advancedSearch: import_zod18.z.array(AdvancedSearchConfig).optional().default([])
|
1910
2109
|
}).superRefine((event2, ctx) => {
|
1911
2110
|
const allFields = findAllFields(event2);
|
1912
2111
|
const fieldIds = allFields.map((field2) => field2.id);
|
@@ -1940,13 +2139,13 @@ var EventConfig = import_zod17.z.object({
|
|
1940
2139
|
}
|
1941
2140
|
if (event2.dateOfEvent) {
|
1942
2141
|
const eventDateFieldId = getDeclarationFields(event2).find(
|
1943
|
-
({ id }) => id === event2.dateOfEvent
|
2142
|
+
({ id }) => id === event2.dateOfEvent?.$$field
|
1944
2143
|
);
|
1945
2144
|
if (!eventDateFieldId) {
|
1946
2145
|
ctx.addIssue({
|
1947
2146
|
code: "custom",
|
1948
2147
|
message: `Date of event field id must match a field id in fields array.
|
1949
|
-
Invalid date of event field ID for event ${event2.id}: ${event2.dateOfEvent
|
2148
|
+
Invalid date of event field ID for event ${event2.id}: ${event2.dateOfEvent.$$field}`,
|
1950
2149
|
path: ["dateOfEvent"]
|
1951
2150
|
});
|
1952
2151
|
} else if (eventDateFieldId.type !== FieldType.DATE) {
|
@@ -1968,215 +2167,24 @@ var definePage = (page) => PageConfig.parse(page);
|
|
1968
2167
|
var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
|
1969
2168
|
|
1970
2169
|
// ../commons/src/events/WorkqueueConfig.ts
|
1971
|
-
var
|
2170
|
+
var import_zod25 = require("zod");
|
1972
2171
|
|
1973
|
-
// ../commons/src/events/
|
2172
|
+
// ../commons/src/events/serializers/user/serializer.ts
|
1974
2173
|
var import_zod19 = require("zod");
|
1975
|
-
|
1976
|
-
|
1977
|
-
|
1978
|
-
|
1979
|
-
|
1980
|
-
|
1981
|
-
|
1982
|
-
|
1983
|
-
REGISTERED: "REGISTERED",
|
1984
|
-
CERTIFIED: "CERTIFIED",
|
1985
|
-
REJECTED: "REJECTED",
|
1986
|
-
ARCHIVED: "ARCHIVED"
|
1987
|
-
};
|
1988
|
-
var CustomFlags = {
|
1989
|
-
CERTIFICATE_PRINTED: "certificate-printed"
|
1990
|
-
};
|
1991
|
-
var Flag = import_zod18.z.string().regex(
|
1992
|
-
new RegExp(
|
1993
|
-
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(ActionStatus).join("|").toLowerCase()})$`
|
1994
|
-
),
|
1995
|
-
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
1996
|
-
).or(import_zod18.z.nativeEnum(CustomFlags));
|
1997
|
-
var eventStatuses = Object.values(EventStatus);
|
1998
|
-
var EventStatuses = import_zod18.z.nativeEnum(EventStatus);
|
1999
|
-
var ZodDate = import_zod18.z.string().date();
|
2000
|
-
var ActionCreationMetadata = import_zod18.z.object({
|
2001
|
-
createdAt: import_zod18.z.string().datetime().describe("The timestamp when the action request was created."),
|
2002
|
-
createdBy: import_zod18.z.string().describe("ID of the user who created the action request."),
|
2003
|
-
createdAtLocation: import_zod18.z.string().describe("Location of the user who created the action request."),
|
2004
|
-
acceptedAt: import_zod18.z.string().datetime().describe("Timestamp when the action request was accepted."),
|
2005
|
-
createdByRole: import_zod18.z.string().describe("Role of the user at the time of action request creation.")
|
2006
|
-
});
|
2007
|
-
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
2008
|
-
registrationNumber: import_zod18.z.string().describe(
|
2009
|
-
"Registration number of the event. Always present for accepted registrations."
|
2010
|
-
)
|
2011
|
-
});
|
2012
|
-
var LegalStatuses = import_zod18.z.object({
|
2013
|
-
[EventStatus.DECLARED]: ActionCreationMetadata.nullish(),
|
2014
|
-
[EventStatus.REGISTERED]: RegistrationCreationMetadata.nullish()
|
2015
|
-
});
|
2016
|
-
var EventMetadata = import_zod18.z.object({
|
2017
|
-
id: import_zod18.z.string(),
|
2018
|
-
type: import_zod18.z.string().describe("The type of event, such as birth, death, or marriage."),
|
2019
|
-
status: EventStatuses,
|
2020
|
-
legalStatuses: LegalStatuses.describe(
|
2021
|
-
"Metadata related to the legal registration of the event, such as who registered it and when."
|
2022
|
-
),
|
2023
|
-
createdAt: import_zod18.z.string().datetime().describe("The timestamp when the event was first created and saved."),
|
2024
|
-
dateOfEvent: ZodDate.nullish(),
|
2025
|
-
createdBy: import_zod18.z.string().describe("ID of the user who created the event."),
|
2026
|
-
updatedByUserRole: import_zod18.z.string().describe("Role of the user who last updated the declaration."),
|
2027
|
-
createdAtLocation: import_zod18.z.string().describe("Location of the user who created the event."),
|
2028
|
-
updatedAtLocation: import_zod18.z.string().nullish().describe("Location of the user who last updated the declaration."),
|
2029
|
-
updatedAt: import_zod18.z.string().datetime().describe("Timestamp of the most recent declaration update."),
|
2030
|
-
assignedTo: import_zod18.z.string().nullish().describe("ID of the user currently assigned to the event."),
|
2031
|
-
updatedBy: import_zod18.z.string().nullish().describe("ID of the user who last updated the declaration."),
|
2032
|
-
trackingId: import_zod18.z.string().describe(
|
2033
|
-
"System-generated tracking ID used by informants or registrars to look up the event."
|
2034
|
-
),
|
2035
|
-
flags: import_zod18.z.array(Flag)
|
2036
|
-
});
|
2037
|
-
var EventMetadataKeys = import_zod18.z.enum([
|
2038
|
-
"id",
|
2039
|
-
"type",
|
2040
|
-
"status",
|
2041
|
-
"createdAt",
|
2042
|
-
"dateOfEvent",
|
2043
|
-
"createdBy",
|
2044
|
-
"updatedByUserRole",
|
2045
|
-
"createdAtLocation",
|
2046
|
-
"updatedAtLocation",
|
2047
|
-
"updatedAt",
|
2048
|
-
"assignedTo",
|
2049
|
-
"updatedBy",
|
2050
|
-
"trackingId",
|
2051
|
-
"legalStatuses",
|
2052
|
-
"flags"
|
2053
|
-
]);
|
2054
|
-
var EventMetadataParameter = import_zod18.z.object({
|
2055
|
-
// @TODO: Reconcile with the event metadata definition. How could we derive one from the other?
|
2056
|
-
$event: EventMetadataKeys
|
2174
|
+
var SerializedUserField = import_zod19.z.object({
|
2175
|
+
$userField: import_zod19.z.enum([
|
2176
|
+
"id",
|
2177
|
+
"name",
|
2178
|
+
"role",
|
2179
|
+
"signatureFilename",
|
2180
|
+
"primaryOfficeId"
|
2181
|
+
])
|
2057
2182
|
});
|
2058
|
-
|
2059
|
-
|
2060
|
-
|
2061
|
-
|
2062
|
-
|
2063
|
-
},
|
2064
|
-
"event.createdAt": {
|
2065
|
-
id: "event.createdAt.label",
|
2066
|
-
defaultMessage: "Created",
|
2067
|
-
description: "Created At"
|
2068
|
-
},
|
2069
|
-
"event.dateOfEvent": {
|
2070
|
-
id: "event.dateOfEvent.label",
|
2071
|
-
defaultMessage: "Date of Event",
|
2072
|
-
description: "Date of Event"
|
2073
|
-
},
|
2074
|
-
"event.createdAtLocation": {
|
2075
|
-
id: "event.createdAtLocation.label",
|
2076
|
-
defaultMessage: "Location",
|
2077
|
-
description: "Created At Location"
|
2078
|
-
},
|
2079
|
-
"event.updatedAtLocation": {
|
2080
|
-
id: "event.updatedAtLocation.label",
|
2081
|
-
defaultMessage: "Location",
|
2082
|
-
description: "Updated At Location"
|
2083
|
-
},
|
2084
|
-
"event.createdBy": {
|
2085
|
-
id: "event.createdBy.label",
|
2086
|
-
defaultMessage: "Created By",
|
2087
|
-
description: "Created By"
|
2088
|
-
},
|
2089
|
-
"event.updatedByUserRole": {
|
2090
|
-
id: "event.updatedByUserRole.label",
|
2091
|
-
defaultMessage: "Updated By Role",
|
2092
|
-
description: "Updated By Role"
|
2093
|
-
},
|
2094
|
-
"event.id": {
|
2095
|
-
id: "event.id.label",
|
2096
|
-
defaultMessage: "ID",
|
2097
|
-
description: "ID"
|
2098
|
-
},
|
2099
|
-
"event.updatedAt": {
|
2100
|
-
id: "event.modifiedAt.label",
|
2101
|
-
defaultMessage: "Updated",
|
2102
|
-
description: "Modified At"
|
2103
|
-
},
|
2104
|
-
"event.status": {
|
2105
|
-
id: "event.status.label",
|
2106
|
-
defaultMessage: "Status",
|
2107
|
-
description: "Status"
|
2108
|
-
},
|
2109
|
-
"event.type": {
|
2110
|
-
id: "event.type.label",
|
2111
|
-
defaultMessage: "Type",
|
2112
|
-
description: "Type"
|
2113
|
-
},
|
2114
|
-
"event.updatedBy": {
|
2115
|
-
id: "event.updatedBy.label",
|
2116
|
-
defaultMessage: "Updated By",
|
2117
|
-
description: "Updated By"
|
2118
|
-
},
|
2119
|
-
"event.trackingId": {
|
2120
|
-
id: "event.trackingId.label",
|
2121
|
-
defaultMessage: "Tracking ID",
|
2122
|
-
description: "Tracking ID"
|
2123
|
-
},
|
2124
|
-
"event.flags": {
|
2125
|
-
id: "event.flags.label",
|
2126
|
-
defaultMessage: "Flags",
|
2127
|
-
description: "Flags"
|
2128
|
-
}
|
2129
|
-
};
|
2130
|
-
|
2131
|
-
// ../commons/src/events/EventIndex.ts
|
2132
|
-
var EventIndex = EventMetadata.extend({
|
2133
|
-
declaration: EventState
|
2134
|
-
});
|
2135
|
-
var EventSearchIndex = import_zod19.z.record(import_zod19.z.string(), import_zod19.z.any()).and(
|
2136
|
-
import_zod19.z.object({
|
2137
|
-
type: import_zod19.z.string()
|
2138
|
-
// Ensures "type" (event-id) exists and is a string
|
2139
|
-
})
|
2140
|
-
);
|
2141
|
-
var Fuzzy = import_zod19.z.object({ type: import_zod19.z.literal("fuzzy"), term: import_zod19.z.string() });
|
2142
|
-
var Exact = import_zod19.z.object({ type: import_zod19.z.literal("exact"), term: import_zod19.z.string() });
|
2143
|
-
var AnyOf = import_zod19.z.object({
|
2144
|
-
type: import_zod19.z.literal("anyOf"),
|
2145
|
-
terms: import_zod19.z.array(import_zod19.z.string())
|
2146
|
-
});
|
2147
|
-
var Range = import_zod19.z.object({
|
2148
|
-
type: import_zod19.z.literal("range"),
|
2149
|
-
gte: import_zod19.z.string(),
|
2150
|
-
lte: import_zod19.z.string()
|
2151
|
-
});
|
2152
|
-
var Not = import_zod19.z.object({ type: import_zod19.z.literal("not"), term: import_zod19.z.string() });
|
2153
|
-
var Within = import_zod19.z.object({ type: import_zod19.z.literal("within"), location: import_zod19.z.string() });
|
2154
|
-
var DateCondition = import_zod19.z.union([Exact, Range]);
|
2155
|
-
var QueryInput = import_zod19.z.lazy(
|
2156
|
-
() => import_zod19.z.union([
|
2157
|
-
import_zod19.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf, Not]),
|
2158
|
-
import_zod19.z.record(import_zod19.z.string(), QueryInput)
|
2159
|
-
])
|
2160
|
-
);
|
2161
|
-
var QueryExpression = import_zod19.z.object({
|
2162
|
-
type: import_zod19.z.literal("and"),
|
2163
|
-
eventType: import_zod19.z.string(),
|
2164
|
-
status: import_zod19.z.optional(import_zod19.z.union([AnyOf, Exact])),
|
2165
|
-
createdAt: import_zod19.z.optional(DateCondition),
|
2166
|
-
updatedAt: import_zod19.z.optional(DateCondition),
|
2167
|
-
createAtLocation: import_zod19.z.optional(import_zod19.z.union([Within, Exact])),
|
2168
|
-
updatedAtLocation: import_zod19.z.optional(import_zod19.z.union([Within, Exact])),
|
2169
|
-
createdBy: import_zod19.z.optional(Exact),
|
2170
|
-
updatedBy: import_zod19.z.optional(Exact),
|
2171
|
-
trackingId: import_zod19.z.optional(Exact),
|
2172
|
-
flags: import_zod19.z.optional(import_zod19.z.array(import_zod19.z.union([AnyOf, Not]))),
|
2173
|
-
data: QueryInput
|
2174
|
-
}).partial();
|
2175
|
-
var Or2 = import_zod19.z.object({
|
2176
|
-
type: import_zod19.z.literal("or"),
|
2177
|
-
clauses: import_zod19.z.array(QueryExpression)
|
2178
|
-
});
|
2179
|
-
var QueryType = import_zod19.z.discriminatedUnion("type", [QueryExpression, Or2]);
|
2183
|
+
function userSerializer(userField) {
|
2184
|
+
return {
|
2185
|
+
$userField: userField
|
2186
|
+
};
|
2187
|
+
}
|
2180
2188
|
|
2181
2189
|
// ../commons/src/conditionals/conditionals.ts
|
2182
2190
|
function defineConditional(schema) {
|
@@ -2219,7 +2227,7 @@ function not(condition) {
|
|
2219
2227
|
function never() {
|
2220
2228
|
return not(alwaysTrue());
|
2221
2229
|
}
|
2222
|
-
var user = {
|
2230
|
+
var user = Object.assign(userSerializer, {
|
2223
2231
|
hasScope: (scope) => defineConditional({
|
2224
2232
|
type: "object",
|
2225
2233
|
properties: {
|
@@ -2239,7 +2247,7 @@ var user = {
|
|
2239
2247
|
},
|
2240
2248
|
required: ["$user"]
|
2241
2249
|
})
|
2242
|
-
};
|
2250
|
+
});
|
2243
2251
|
function createEventConditionals() {
|
2244
2252
|
return {
|
2245
2253
|
/**
|
@@ -2290,7 +2298,7 @@ function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
|
|
2290
2298
|
};
|
2291
2299
|
}
|
2292
2300
|
function isFieldReference(value) {
|
2293
|
-
return typeof value === "object" && value !== null && "
|
2301
|
+
return typeof value === "object" && value !== null && "$$field" in value;
|
2294
2302
|
}
|
2295
2303
|
function createFieldConditionals(fieldId) {
|
2296
2304
|
const getDateRange = (date, clause) => ({
|
@@ -2305,6 +2313,10 @@ function createFieldConditionals(fieldId) {
|
|
2305
2313
|
required: [fieldId]
|
2306
2314
|
});
|
2307
2315
|
return {
|
2316
|
+
/**
|
2317
|
+
* @private Internal property used for field reference tracking.
|
2318
|
+
*/
|
2319
|
+
$$field: fieldId,
|
2308
2320
|
isAfter: () => ({
|
2309
2321
|
days: (days) => ({
|
2310
2322
|
inPast: () => defineFormConditional(
|
@@ -2316,7 +2328,7 @@ function createFieldConditionals(fieldId) {
|
|
2316
2328
|
}),
|
2317
2329
|
date: (date) => {
|
2318
2330
|
if (isFieldReference(date)) {
|
2319
|
-
const comparedFieldId = date
|
2331
|
+
const comparedFieldId = date.$$field;
|
2320
2332
|
return defineFormConditional(
|
2321
2333
|
getDateRangeToFieldReference(
|
2322
2334
|
fieldId,
|
@@ -2340,7 +2352,7 @@ function createFieldConditionals(fieldId) {
|
|
2340
2352
|
}),
|
2341
2353
|
date: (date) => {
|
2342
2354
|
if (isFieldReference(date)) {
|
2343
|
-
const comparedFieldId = date
|
2355
|
+
const comparedFieldId = date.$$field;
|
2344
2356
|
return defineFormConditional(
|
2345
2357
|
getDateRangeToFieldReference(
|
2346
2358
|
fieldId,
|
@@ -2355,13 +2367,13 @@ function createFieldConditionals(fieldId) {
|
|
2355
2367
|
}),
|
2356
2368
|
isEqualTo: (value) => {
|
2357
2369
|
if (isFieldReference(value)) {
|
2358
|
-
const comparedFieldId = value
|
2370
|
+
const comparedFieldId = value.$$field;
|
2359
2371
|
return defineFormConditional({
|
2360
2372
|
type: "object",
|
2361
2373
|
properties: {
|
2362
2374
|
[fieldId]: {
|
2363
2375
|
type: ["string", "boolean"],
|
2364
|
-
const: { $data:
|
2376
|
+
const: { $data: `/$form/${comparedFieldId}` }
|
2365
2377
|
},
|
2366
2378
|
[comparedFieldId]: { type: ["string", "boolean"] }
|
2367
2379
|
},
|
@@ -2472,18 +2484,81 @@ function createFieldConditionals(fieldId) {
|
|
2472
2484
|
},
|
2473
2485
|
required: [fieldId]
|
2474
2486
|
}),
|
2475
|
-
getId: () => ({ fieldId })
|
2487
|
+
getId: () => ({ fieldId }),
|
2488
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2489
|
+
object: (options) => defineFormConditional({
|
2490
|
+
type: "object",
|
2491
|
+
properties: {
|
2492
|
+
[fieldId]: {
|
2493
|
+
type: "object",
|
2494
|
+
properties: Object.fromEntries(
|
2495
|
+
Object.entries(options).map(([key, value]) => {
|
2496
|
+
return [key, value.properties.$form.properties[key]];
|
2497
|
+
})
|
2498
|
+
),
|
2499
|
+
required: Object.keys(options)
|
2500
|
+
}
|
2501
|
+
},
|
2502
|
+
required: [fieldId]
|
2503
|
+
})
|
2504
|
+
};
|
2505
|
+
}
|
2506
|
+
|
2507
|
+
// ../commons/src/searchConfigs.ts
|
2508
|
+
function createSearchConfig(baseField) {
|
2509
|
+
return {
|
2510
|
+
/**
|
2511
|
+
* Creates a range configuration for the specified field.
|
2512
|
+
*
|
2513
|
+
* @returns An object containing the field ID and a configuration object with a type of 'range'.
|
2514
|
+
*
|
2515
|
+
* @example event('legalStatus.REGISTERED.createdAt').range()
|
2516
|
+
* // {
|
2517
|
+
* // ...
|
2518
|
+
* // config: { type: 'range' }
|
2519
|
+
* // }
|
2520
|
+
*/
|
2521
|
+
range: () => ({
|
2522
|
+
...baseField,
|
2523
|
+
config: { type: "range" }
|
2524
|
+
}),
|
2525
|
+
/**
|
2526
|
+
* Creates a configuration for exact matching of the specified field.
|
2527
|
+
* @returns An object containing the field ID and a configuration object with a type of 'exact'.
|
2528
|
+
* @example field('dob').exact()
|
2529
|
+
* // {
|
2530
|
+
* // ...
|
2531
|
+
* // config: { type: 'exact' }
|
2532
|
+
* // }
|
2533
|
+
*/
|
2534
|
+
exact: () => ({
|
2535
|
+
...baseField,
|
2536
|
+
config: { type: "exact" }
|
2537
|
+
}),
|
2538
|
+
/**
|
2539
|
+
* Creates a configuration for fuzzy matching of the specified field.
|
2540
|
+
* @returns An object containing the field ID and a configuration object with a type of 'exact'.
|
2541
|
+
* @example field('name').fuzzy()
|
2542
|
+
* // {
|
2543
|
+
* // ...
|
2544
|
+
* // config: { type: 'fuzzy' }
|
2545
|
+
* // }
|
2546
|
+
*/
|
2547
|
+
fuzzy: () => ({
|
2548
|
+
...baseField,
|
2549
|
+
config: { type: "fuzzy" }
|
2550
|
+
})
|
2476
2551
|
};
|
2477
2552
|
}
|
2478
2553
|
|
2479
2554
|
// ../commons/src/event-config/event-configuration.ts
|
2480
2555
|
function createEventFieldConfig(fieldId, options) {
|
2481
|
-
|
2556
|
+
const baseField = {
|
2482
2557
|
fieldId,
|
2483
2558
|
options,
|
2484
|
-
config: { type: "exact" },
|
2485
2559
|
fieldType: "event"
|
2486
2560
|
};
|
2561
|
+
return createSearchConfig(baseField);
|
2487
2562
|
}
|
2488
2563
|
|
2489
2564
|
// ../commons/src/events/event.ts
|
@@ -2499,135 +2574,648 @@ var event = Object.assign(eventFn, {
|
|
2499
2574
|
}
|
2500
2575
|
});
|
2501
2576
|
|
2502
|
-
// ../commons/src/events/
|
2503
|
-
var
|
2504
|
-
|
2505
|
-
|
2506
|
-
|
2577
|
+
// ../commons/src/events/WorkqueueColumnConfig.ts
|
2578
|
+
var import_zod21 = require("zod");
|
2579
|
+
|
2580
|
+
// ../commons/src/events/EventMetadata.ts
|
2581
|
+
var import_zod20 = require("zod");
|
2582
|
+
var EventStatus = import_zod20.z.enum([
|
2583
|
+
"CREATED",
|
2584
|
+
"NOTIFIED",
|
2585
|
+
"DECLARED",
|
2586
|
+
"VALIDATED",
|
2587
|
+
"REGISTERED",
|
2588
|
+
"CERTIFIED",
|
2589
|
+
"REJECTED",
|
2590
|
+
"ARCHIVED"
|
2591
|
+
]);
|
2592
|
+
var CustomFlags = {
|
2593
|
+
CERTIFICATE_PRINTED: "certificate-printed"
|
2594
|
+
};
|
2595
|
+
var Flag = import_zod20.z.string().regex(
|
2596
|
+
new RegExp(
|
2597
|
+
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
2598
|
+
ActionStatus
|
2599
|
+
).join("|").toLowerCase()})$`
|
2507
2600
|
),
|
2508
|
-
|
2509
|
-
|
2510
|
-
|
2511
|
-
|
2512
|
-
|
2513
|
-
|
2601
|
+
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
2602
|
+
).or(import_zod20.z.nativeEnum(CustomFlags));
|
2603
|
+
var ZodDate = import_zod20.z.string().date();
|
2604
|
+
var ActionCreationMetadata = import_zod20.z.object({
|
2605
|
+
createdAt: import_zod20.z.string().datetime().describe("The timestamp when the action request was created."),
|
2606
|
+
createdBy: import_zod20.z.string().describe("ID of the user who created the action request."),
|
2607
|
+
createdAtLocation: CreatedAtLocation.describe(
|
2608
|
+
"Location of the user who created the action request."
|
2514
2609
|
),
|
2515
|
-
|
2516
|
-
|
2517
|
-
).
|
2518
|
-
|
2519
|
-
|
2520
|
-
|
2521
|
-
|
2522
|
-
|
2523
|
-
|
2524
|
-
|
2525
|
-
|
2526
|
-
])
|
2527
|
-
})
|
2528
|
-
|
2529
|
-
|
2610
|
+
acceptedAt: import_zod20.z.string().datetime().describe("Timestamp when the action request was accepted."),
|
2611
|
+
createdByRole: import_zod20.z.string().describe("Role of the user at the time of action request creation."),
|
2612
|
+
createdBySignature: import_zod20.z.string().nullish().describe("Signature of the user who created the action request.")
|
2613
|
+
});
|
2614
|
+
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
2615
|
+
registrationNumber: import_zod20.z.string().describe(
|
2616
|
+
"Registration number of the event. Always present for accepted registrations."
|
2617
|
+
)
|
2618
|
+
});
|
2619
|
+
var LegalStatuses = import_zod20.z.object({
|
2620
|
+
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
2621
|
+
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
2622
|
+
});
|
2623
|
+
var EventMetadata = import_zod20.z.object({
|
2624
|
+
id: import_zod20.z.string(),
|
2625
|
+
type: import_zod20.z.string().describe("The type of event, such as birth, death, or marriage."),
|
2626
|
+
status: EventStatus,
|
2627
|
+
legalStatuses: LegalStatuses.describe(
|
2628
|
+
"Metadata related to the legal registration of the event, such as who registered it and when."
|
2629
|
+
),
|
2630
|
+
createdAt: import_zod20.z.string().datetime().describe("The timestamp when the event was first created and saved."),
|
2631
|
+
dateOfEvent: ZodDate.nullish(),
|
2632
|
+
createdBy: import_zod20.z.string().describe("ID of the user who created the event."),
|
2633
|
+
updatedByUserRole: import_zod20.z.string().describe("Role of the user who last updated the declaration."),
|
2634
|
+
createdAtLocation: CreatedAtLocation.describe(
|
2635
|
+
"Location of the user who created the event."
|
2636
|
+
),
|
2637
|
+
createdBySignature: import_zod20.z.string().nullish().describe("Signature of the user who created the event."),
|
2638
|
+
updatedAtLocation: import_zod20.z.string().nullish().describe("Location of the user who last updated the declaration."),
|
2639
|
+
updatedAt: import_zod20.z.string().datetime().describe("Timestamp of the most recent declaration update."),
|
2640
|
+
assignedTo: import_zod20.z.string().nullish().describe("ID of the user currently assigned to the event."),
|
2641
|
+
updatedBy: import_zod20.z.string().nullish().describe("ID of the user who last updated the declaration."),
|
2642
|
+
trackingId: import_zod20.z.string().describe(
|
2643
|
+
"System-generated tracking ID used by informants or registrars to look up the event."
|
2644
|
+
),
|
2645
|
+
flags: import_zod20.z.array(Flag)
|
2646
|
+
});
|
2647
|
+
var EventMetadataKeysArray = [
|
2648
|
+
"id",
|
2649
|
+
"type",
|
2650
|
+
"status",
|
2651
|
+
"createdAt",
|
2652
|
+
"dateOfEvent",
|
2653
|
+
"createdBy",
|
2654
|
+
"updatedByUserRole",
|
2655
|
+
"createdAtLocation",
|
2656
|
+
"updatedAtLocation",
|
2657
|
+
"updatedAt",
|
2658
|
+
"assignedTo",
|
2659
|
+
"updatedBy",
|
2660
|
+
"trackingId",
|
2661
|
+
"legalStatuses",
|
2662
|
+
"flags"
|
2663
|
+
];
|
2664
|
+
var EventMetadataKeys = import_zod20.z.enum(EventMetadataKeysArray);
|
2665
|
+
var eventMetadataLabelMap = {
|
2666
|
+
"event.assignedTo": {
|
2667
|
+
id: "event.assignedTo.label",
|
2668
|
+
defaultMessage: "Assigned To",
|
2669
|
+
description: "Assigned To"
|
2670
|
+
},
|
2671
|
+
"event.createdAt": {
|
2672
|
+
id: "event.createdAt.label",
|
2673
|
+
defaultMessage: "Created",
|
2674
|
+
description: "Created At"
|
2675
|
+
},
|
2676
|
+
"event.dateOfEvent": {
|
2677
|
+
id: "event.dateOfEvent.label",
|
2678
|
+
defaultMessage: "Date of Event",
|
2679
|
+
description: "Date of Event"
|
2680
|
+
},
|
2681
|
+
"event.createdAtLocation": {
|
2682
|
+
id: "event.createdAtLocation.label",
|
2683
|
+
defaultMessage: "Location",
|
2684
|
+
description: "Created At Location"
|
2685
|
+
},
|
2686
|
+
"event.updatedAtLocation": {
|
2687
|
+
id: "event.updatedAtLocation.label",
|
2688
|
+
defaultMessage: "Location",
|
2689
|
+
description: "Updated At Location"
|
2690
|
+
},
|
2691
|
+
"event.createdBy": {
|
2692
|
+
id: "event.createdBy.label",
|
2693
|
+
defaultMessage: "Created By",
|
2694
|
+
description: "Created By"
|
2695
|
+
},
|
2696
|
+
"event.updatedByUserRole": {
|
2697
|
+
id: "event.updatedByUserRole.label",
|
2698
|
+
defaultMessage: "Updated By Role",
|
2699
|
+
description: "Updated By Role"
|
2700
|
+
},
|
2701
|
+
"event.id": {
|
2702
|
+
id: "event.id.label",
|
2703
|
+
defaultMessage: "ID",
|
2704
|
+
description: "ID"
|
2705
|
+
},
|
2706
|
+
"event.updatedAt": {
|
2707
|
+
id: "event.modifiedAt.label",
|
2708
|
+
defaultMessage: "Updated",
|
2709
|
+
description: "Modified At"
|
2710
|
+
},
|
2711
|
+
"event.status": {
|
2712
|
+
id: "event.status.label",
|
2713
|
+
defaultMessage: "Status",
|
2714
|
+
description: "Status"
|
2715
|
+
},
|
2716
|
+
"event.type": {
|
2717
|
+
id: "event.type.label",
|
2718
|
+
defaultMessage: "Type",
|
2719
|
+
description: "Type"
|
2720
|
+
},
|
2721
|
+
"event.updatedBy": {
|
2722
|
+
id: "event.updatedBy.label",
|
2723
|
+
defaultMessage: "Updated By",
|
2724
|
+
description: "Updated By"
|
2725
|
+
},
|
2726
|
+
"event.trackingId": {
|
2727
|
+
id: "event.trackingId.label",
|
2728
|
+
defaultMessage: "Tracking ID",
|
2729
|
+
description: "Tracking ID"
|
2730
|
+
},
|
2731
|
+
"event.flags": {
|
2732
|
+
id: "event.flags.label",
|
2733
|
+
defaultMessage: "Flags",
|
2734
|
+
description: "Flags"
|
2735
|
+
}
|
2736
|
+
};
|
2737
|
+
|
2738
|
+
// ../commons/src/events/WorkqueueColumnConfig.ts
|
2739
|
+
var WorkqueueColumnKeysArray = [
|
2740
|
+
...EventMetadataKeysArray,
|
2741
|
+
"title"
|
2742
|
+
];
|
2743
|
+
var WorkqueueColumnKeys = import_zod21.z.enum(WorkqueueColumnKeysArray);
|
2744
|
+
var WorkqueueColumnValue = import_zod21.z.object({
|
2745
|
+
$event: WorkqueueColumnKeys
|
2746
|
+
});
|
2747
|
+
var WorkqueueColumn = import_zod21.z.object({
|
2748
|
+
label: TranslationConfig,
|
2749
|
+
value: WorkqueueColumnValue
|
2750
|
+
});
|
2751
|
+
function defineWorkqueuesColumns(workqueueColumns) {
|
2752
|
+
return workqueueColumns.map(
|
2753
|
+
(workqueueColumn) => WorkqueueColumn.parse(workqueueColumn)
|
2754
|
+
);
|
2530
2755
|
}
|
2531
2756
|
|
2532
|
-
// ../commons/src/events/
|
2533
|
-
var
|
2757
|
+
// ../commons/src/events/CountryConfigQueryInput.ts
|
2758
|
+
var import_zod23 = require("zod");
|
2534
2759
|
|
2535
|
-
// ../commons/src/events/
|
2536
|
-
var
|
2537
|
-
var
|
2538
|
-
(0,
|
2539
|
-
var
|
2540
|
-
|
2541
|
-
|
2542
|
-
|
2543
|
-
annotation: ActionUpdate.optional(),
|
2544
|
-
originalActionId: import_zod21.z.string().optional(),
|
2545
|
-
keepAssignment: import_zod21.z.boolean().optional()
|
2760
|
+
// ../commons/src/events/EventIndex.ts
|
2761
|
+
var import_zod22 = require("zod");
|
2762
|
+
var import_zod_openapi9 = require("zod-openapi");
|
2763
|
+
(0, import_zod_openapi9.extendZodWithOpenApi)(import_zod22.z);
|
2764
|
+
var EventIndex = EventMetadata.extend({
|
2765
|
+
declaration: EventState
|
2766
|
+
}).openapi({
|
2767
|
+
ref: "EventIndex"
|
2546
2768
|
});
|
2547
|
-
var
|
2548
|
-
|
2549
|
-
type:
|
2550
|
-
|
2551
|
-
})
|
2552
|
-
);
|
2553
|
-
var RegisterActionInput = BaseActionInput.merge(
|
2554
|
-
import_zod21.z.object({
|
2555
|
-
type: import_zod21.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
2556
|
-
registrationNumber: import_zod21.z.string().optional()
|
2557
|
-
})
|
2558
|
-
);
|
2559
|
-
var ValidateActionInput = BaseActionInput.merge(
|
2560
|
-
import_zod21.z.object({
|
2561
|
-
type: import_zod21.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
|
2562
|
-
duplicates: import_zod21.z.array(import_zod21.z.string())
|
2563
|
-
})
|
2564
|
-
);
|
2565
|
-
var NotifyActionInput = BaseActionInput.merge(
|
2566
|
-
import_zod21.z.object({
|
2567
|
-
type: import_zod21.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
|
2568
|
-
})
|
2569
|
-
);
|
2570
|
-
var DeclareActionInput = BaseActionInput.merge(
|
2571
|
-
import_zod21.z.object({
|
2572
|
-
type: import_zod21.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
2573
|
-
})
|
2574
|
-
);
|
2575
|
-
var PrintCertificateActionInput = BaseActionInput.merge(
|
2576
|
-
import_zod21.z.object({
|
2577
|
-
type: import_zod21.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
|
2578
|
-
})
|
2579
|
-
);
|
2580
|
-
var RejectDeclarationActionInput = BaseActionInput.merge(
|
2581
|
-
import_zod21.z.object({
|
2582
|
-
type: import_zod21.z.literal(ActionType.REJECT).default(ActionType.REJECT)
|
2583
|
-
})
|
2584
|
-
);
|
2585
|
-
var MarkedAsDuplicateActionInput = BaseActionInput.merge(
|
2586
|
-
import_zod21.z.object({
|
2587
|
-
type: import_zod21.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
|
2588
|
-
})
|
2589
|
-
);
|
2590
|
-
var ArchiveActionInput = BaseActionInput.merge(
|
2591
|
-
import_zod21.z.object({
|
2592
|
-
type: import_zod21.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE)
|
2593
|
-
})
|
2594
|
-
);
|
2595
|
-
var AssignActionInput = BaseActionInput.merge(
|
2596
|
-
import_zod21.z.object({
|
2597
|
-
type: import_zod21.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
|
2598
|
-
assignedTo: import_zod21.z.string()
|
2599
|
-
})
|
2600
|
-
);
|
2601
|
-
var UnassignActionInput = BaseActionInput.merge(
|
2602
|
-
import_zod21.z.object({
|
2603
|
-
type: import_zod21.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
|
2604
|
-
assignedTo: import_zod21.z.literal(null).default(null)
|
2605
|
-
})
|
2606
|
-
);
|
2607
|
-
var RequestCorrectionActionInput = BaseActionInput.merge(
|
2608
|
-
import_zod21.z.object({
|
2609
|
-
type: import_zod21.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
2610
|
-
})
|
2611
|
-
);
|
2612
|
-
var RejectCorrectionActionInput = BaseActionInput.merge(
|
2613
|
-
import_zod21.z.object({
|
2614
|
-
requestId: import_zod21.z.string(),
|
2615
|
-
type: import_zod21.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
|
2616
|
-
})
|
2617
|
-
);
|
2618
|
-
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
2619
|
-
import_zod21.z.object({
|
2620
|
-
requestId: import_zod21.z.string(),
|
2621
|
-
type: import_zod21.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
2622
|
-
})
|
2623
|
-
);
|
2624
|
-
var ReadActionInput = BaseActionInput.merge(
|
2625
|
-
import_zod21.z.object({
|
2626
|
-
type: import_zod21.z.literal(ActionType.READ).default(ActionType.READ)
|
2769
|
+
var EventSearchIndex = import_zod22.z.record(import_zod22.z.string(), import_zod22.z.any()).and(
|
2770
|
+
import_zod22.z.object({
|
2771
|
+
type: import_zod22.z.string()
|
2772
|
+
// Ensures "type" (event-id) exists and is a string
|
2627
2773
|
})
|
2628
|
-
)
|
2629
|
-
|
2630
|
-
|
2774
|
+
).openapi({
|
2775
|
+
ref: "EventSearchIndex"
|
2776
|
+
});
|
2777
|
+
var Fuzzy = import_zod22.z.object({ type: import_zod22.z.literal("fuzzy"), term: import_zod22.z.string() }).openapi({
|
2778
|
+
ref: "Fuzzy"
|
2779
|
+
});
|
2780
|
+
var Exact = import_zod22.z.object({ type: import_zod22.z.literal("exact"), term: import_zod22.z.string() }).openapi({
|
2781
|
+
ref: "Exact"
|
2782
|
+
});
|
2783
|
+
var AnyOf = import_zod22.z.object({
|
2784
|
+
type: import_zod22.z.literal("anyOf"),
|
2785
|
+
terms: import_zod22.z.array(import_zod22.z.string())
|
2786
|
+
}).openapi({
|
2787
|
+
ref: "AnyOf"
|
2788
|
+
});
|
2789
|
+
var ExactStatus = import_zod22.z.object({
|
2790
|
+
type: import_zod22.z.literal("exact"),
|
2791
|
+
term: EventStatus
|
2792
|
+
}).openapi({
|
2793
|
+
ref: "ExactStatus"
|
2794
|
+
});
|
2795
|
+
var AnyOfStatus = import_zod22.z.object({
|
2796
|
+
type: import_zod22.z.literal("anyOf"),
|
2797
|
+
terms: import_zod22.z.array(EventStatus)
|
2798
|
+
}).openapi({
|
2799
|
+
ref: "AnyOfStatus"
|
2800
|
+
});
|
2801
|
+
var Range = import_zod22.z.object({
|
2802
|
+
type: import_zod22.z.literal("range"),
|
2803
|
+
gte: import_zod22.z.string(),
|
2804
|
+
lte: import_zod22.z.string()
|
2805
|
+
}).openapi({
|
2806
|
+
ref: "Range"
|
2807
|
+
});
|
2808
|
+
var Not = import_zod22.z.object({ type: import_zod22.z.literal("not"), term: import_zod22.z.string() }).openapi({
|
2809
|
+
ref: "Not"
|
2810
|
+
});
|
2811
|
+
var Within = import_zod22.z.object({ type: import_zod22.z.literal("within"), location: import_zod22.z.string() }).openapi({
|
2812
|
+
ref: "Within"
|
2813
|
+
});
|
2814
|
+
var DateCondition = import_zod22.z.union([Exact, Range]).openapi({
|
2815
|
+
ref: "DateCondition"
|
2816
|
+
});
|
2817
|
+
var QueryInput = import_zod22.z.lazy(
|
2818
|
+
() => import_zod22.z.union([
|
2819
|
+
import_zod22.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf, Not]),
|
2820
|
+
import_zod22.z.record(import_zod22.z.string(), QueryInput)
|
2821
|
+
])
|
2822
|
+
).openapi({
|
2823
|
+
ref: "QueryInput"
|
2824
|
+
});
|
2825
|
+
var QueryExpression = import_zod22.z.object({
|
2826
|
+
eventType: import_zod22.z.string(),
|
2827
|
+
status: import_zod22.z.optional(import_zod22.z.union([AnyOfStatus, ExactStatus])),
|
2828
|
+
createdAt: import_zod22.z.optional(DateCondition),
|
2829
|
+
updatedAt: import_zod22.z.optional(DateCondition),
|
2830
|
+
"legalStatus.REGISTERED.createdAt": import_zod22.z.optional(DateCondition),
|
2831
|
+
"legalStatus.REGISTERED.createdAtLocation": import_zod22.z.optional(
|
2832
|
+
import_zod22.z.union([Within, Exact])
|
2833
|
+
),
|
2834
|
+
"legalStatus.REGISTERED.registrationNumber": import_zod22.z.optional(Exact),
|
2835
|
+
createdAtLocation: import_zod22.z.optional(import_zod22.z.union([Within, Exact])),
|
2836
|
+
updatedAtLocation: import_zod22.z.optional(import_zod22.z.union([Within, Exact])),
|
2837
|
+
assignedTo: import_zod22.z.optional(Exact),
|
2838
|
+
createdBy: import_zod22.z.optional(Exact),
|
2839
|
+
updatedBy: import_zod22.z.optional(Exact),
|
2840
|
+
trackingId: import_zod22.z.optional(Exact),
|
2841
|
+
flags: import_zod22.z.optional(import_zod22.z.array(import_zod22.z.union([AnyOf, Not]))),
|
2842
|
+
data: QueryInput
|
2843
|
+
}).partial().openapi({
|
2844
|
+
ref: "QueryExpression"
|
2845
|
+
});
|
2846
|
+
var QueryType = import_zod22.z.object({
|
2847
|
+
type: import_zod22.z.literal("and").or(import_zod22.z.literal("or")).openapi({ default: "and" }),
|
2848
|
+
clauses: import_zod22.z.preprocess(
|
2849
|
+
(val) => {
|
2850
|
+
if (typeof val === "string") {
|
2851
|
+
return [JSON.parse(val)];
|
2852
|
+
}
|
2853
|
+
if (Array.isArray(val)) {
|
2854
|
+
return val.map((v) => typeof v === "string" ? JSON.parse(v) : v);
|
2855
|
+
}
|
2856
|
+
return val;
|
2857
|
+
},
|
2858
|
+
import_zod22.z.array(QueryExpression).nonempty("At least one clause is required.").openapi({
|
2859
|
+
default: [
|
2860
|
+
{
|
2861
|
+
eventType: TENNIS_CLUB_MEMBERSHIP,
|
2862
|
+
status: {
|
2863
|
+
type: "anyOf",
|
2864
|
+
terms: EventStatus.options
|
2865
|
+
},
|
2866
|
+
updatedAt: {
|
2867
|
+
type: "range",
|
2868
|
+
gte: "2025-05-22",
|
2869
|
+
lte: "2025-05-29"
|
2870
|
+
},
|
2871
|
+
data: {}
|
2872
|
+
}
|
2873
|
+
]
|
2874
|
+
})
|
2875
|
+
)
|
2876
|
+
}).openapi({
|
2877
|
+
ref: "QueryType"
|
2878
|
+
});
|
2879
|
+
|
2880
|
+
// ../commons/src/events/CountryConfigQueryInput.ts
|
2881
|
+
var SerializableExact = import_zod23.z.object({
|
2882
|
+
type: import_zod23.z.literal("exact"),
|
2883
|
+
term: import_zod23.z.union([import_zod23.z.string(), SerializedUserField])
|
2884
|
+
});
|
2885
|
+
var SerializableWithin = import_zod23.z.object({
|
2886
|
+
type: import_zod23.z.literal("within"),
|
2887
|
+
location: import_zod23.z.union([import_zod23.z.string(), SerializedUserField])
|
2888
|
+
});
|
2889
|
+
var SerializedQueryExpression = import_zod23.z.object({
|
2890
|
+
eventType: import_zod23.z.string(),
|
2891
|
+
status: import_zod23.z.optional(import_zod23.z.union([AnyOfStatus, ExactStatus])),
|
2892
|
+
createdAt: import_zod23.z.optional(DateCondition),
|
2893
|
+
updatedAt: import_zod23.z.optional(DateCondition),
|
2894
|
+
createdAtLocation: import_zod23.z.optional(
|
2895
|
+
import_zod23.z.union([SerializableWithin, SerializableExact])
|
2896
|
+
),
|
2897
|
+
updatedAtLocation: import_zod23.z.optional(
|
2898
|
+
import_zod23.z.union([SerializableWithin, SerializableExact])
|
2899
|
+
),
|
2900
|
+
assignedTo: import_zod23.z.optional(SerializableExact),
|
2901
|
+
createdBy: import_zod23.z.optional(SerializableExact),
|
2902
|
+
updatedBy: import_zod23.z.optional(SerializableExact),
|
2903
|
+
trackingId: import_zod23.z.optional(Exact),
|
2904
|
+
flags: import_zod23.z.optional(import_zod23.z.array(import_zod23.z.union([AnyOf, Not]))),
|
2905
|
+
data: QueryInput
|
2906
|
+
}).partial();
|
2907
|
+
var Or2 = import_zod23.z.object({
|
2908
|
+
type: import_zod23.z.literal("or"),
|
2909
|
+
clauses: import_zod23.z.array(SerializedQueryExpression)
|
2910
|
+
});
|
2911
|
+
var And2 = import_zod23.z.object({
|
2912
|
+
type: import_zod23.z.literal("and"),
|
2913
|
+
clauses: import_zod23.z.array(SerializedQueryExpression)
|
2914
|
+
});
|
2915
|
+
var CountryConfigQueryType = import_zod23.z.discriminatedUnion("type", [And2, Or2]);
|
2916
|
+
var CountryConfigQueryInputType = import_zod23.z.union([
|
2917
|
+
SerializedQueryExpression,
|
2918
|
+
And2,
|
2919
|
+
Or2
|
2920
|
+
]);
|
2921
|
+
|
2922
|
+
// ../commons/src/icons.ts
|
2923
|
+
var import_zod24 = require("zod");
|
2924
|
+
var AvailableIcons = import_zod24.z.enum([
|
2925
|
+
"Archived",
|
2926
|
+
"Assigned",
|
2927
|
+
"Certified",
|
2928
|
+
"Close",
|
2929
|
+
"Collapse",
|
2930
|
+
"Draft",
|
2931
|
+
"DuplicateYellow",
|
2932
|
+
"Expand",
|
2933
|
+
"ExternalValidate",
|
2934
|
+
"FilledCheck",
|
2935
|
+
"InReview",
|
2936
|
+
"Offline",
|
2937
|
+
"Registered",
|
2938
|
+
"RequiresUpdates",
|
2939
|
+
"Sent",
|
2940
|
+
"Validated",
|
2941
|
+
"WaitingApproval",
|
2942
|
+
"ChartActivity",
|
2943
|
+
"Activity",
|
2944
|
+
"Archive",
|
2945
|
+
"ArchiveTray",
|
2946
|
+
"ArrowLeft",
|
2947
|
+
"ArrowRight",
|
2948
|
+
"Buildings",
|
2949
|
+
"Circle",
|
2950
|
+
"CaretDown",
|
2951
|
+
"CaretLeft",
|
2952
|
+
"CaretRight",
|
2953
|
+
"ChartBar",
|
2954
|
+
"ChartLine",
|
2955
|
+
"ChatCircle",
|
2956
|
+
"CheckSquare",
|
2957
|
+
"Compass",
|
2958
|
+
"Check",
|
2959
|
+
"Copy",
|
2960
|
+
"Database",
|
2961
|
+
"DotsThreeVertical",
|
2962
|
+
"DownloadSimple",
|
2963
|
+
"ArrowCounterClockwise",
|
2964
|
+
"MagnifyingGlassMinus",
|
2965
|
+
"MagnifyingGlassPlus",
|
2966
|
+
"Export",
|
2967
|
+
"Eye",
|
2968
|
+
"EyeSlash",
|
2969
|
+
"Envelope",
|
2970
|
+
"File",
|
2971
|
+
"FileSearch",
|
2972
|
+
"FileMinus",
|
2973
|
+
"FilePlus",
|
2974
|
+
"FileText",
|
2975
|
+
"FileX",
|
2976
|
+
"Handshake",
|
2977
|
+
"Gear",
|
2978
|
+
"GitBranch",
|
2979
|
+
"IdentificationCard",
|
2980
|
+
"List",
|
2981
|
+
"ListBullets",
|
2982
|
+
"Lock",
|
2983
|
+
"MagnifyingGlass",
|
2984
|
+
"MapPin",
|
2985
|
+
"Medal",
|
2986
|
+
"NotePencil",
|
2987
|
+
"Paperclip",
|
2988
|
+
"PaperPlaneTilt",
|
2989
|
+
"Pen",
|
2990
|
+
"Pencil",
|
2991
|
+
"PencilSimpleLine",
|
2992
|
+
"Phone",
|
2993
|
+
"Plus",
|
2994
|
+
"Printer",
|
2995
|
+
"SignOut",
|
2996
|
+
"Star",
|
2997
|
+
"Target",
|
2998
|
+
"TextT",
|
2999
|
+
"Trash",
|
3000
|
+
"UploadSimple",
|
3001
|
+
"User",
|
3002
|
+
"UserPlus",
|
3003
|
+
"Users",
|
3004
|
+
"WarningCircle",
|
3005
|
+
"X",
|
3006
|
+
"CircleWavyCheck",
|
3007
|
+
"CircleWavyQuestion",
|
3008
|
+
"ArchiveBox",
|
3009
|
+
"ArrowCircleDown",
|
3010
|
+
"FileArrowUp",
|
3011
|
+
"FileDotted",
|
3012
|
+
"Files",
|
3013
|
+
"PencilLine",
|
3014
|
+
"PencilCircle",
|
3015
|
+
"UserCircle",
|
3016
|
+
"Clock",
|
3017
|
+
"QrCode",
|
3018
|
+
"Webcam",
|
3019
|
+
"Sun",
|
3020
|
+
"DeviceTabletCamera",
|
3021
|
+
"Globe",
|
3022
|
+
"Fingerprint",
|
3023
|
+
"PushPin",
|
3024
|
+
"Timer"
|
3025
|
+
]);
|
3026
|
+
|
3027
|
+
// ../commons/src/events/WorkqueueConfig.ts
|
3028
|
+
var mandatoryColumns = defineWorkqueuesColumns([
|
3029
|
+
{
|
3030
|
+
label: {
|
3031
|
+
id: "workqueues.dateOfEvent",
|
3032
|
+
defaultMessage: "Date of Event",
|
3033
|
+
description: "Label for workqueue column: dateOfEvent"
|
3034
|
+
},
|
3035
|
+
value: event.field("dateOfEvent")
|
3036
|
+
},
|
3037
|
+
{
|
3038
|
+
label: {
|
3039
|
+
defaultMessage: "Last updated",
|
3040
|
+
description: "This is the label for the workqueue column",
|
3041
|
+
id: "workqueue.default.column.modifiedAt"
|
3042
|
+
},
|
3043
|
+
value: event.field("updatedAt")
|
3044
|
+
}
|
3045
|
+
]);
|
3046
|
+
var WorkqueueConfig = import_zod25.z.object({
|
3047
|
+
slug: import_zod25.z.string().describe("Determines the url of the workqueue."),
|
3048
|
+
name: TranslationConfig.describe(
|
3049
|
+
"Title of the workflow (both in navigation and on the page)"
|
3050
|
+
),
|
3051
|
+
query: CountryConfigQueryType,
|
3052
|
+
actions: import_zod25.z.array(
|
3053
|
+
import_zod25.z.object({
|
3054
|
+
type: import_zod25.z.string(),
|
3055
|
+
conditionals: import_zod25.z.array(Conditional).optional()
|
3056
|
+
})
|
3057
|
+
),
|
3058
|
+
columns: import_zod25.z.array(WorkqueueColumn).default(mandatoryColumns),
|
3059
|
+
icon: AvailableIcons
|
3060
|
+
}).describe("Configuration for workqueue.");
|
3061
|
+
var WorkqueueConfigInput = import_zod25.z.object({
|
3062
|
+
slug: import_zod25.z.string().describe("Determines the url of the workqueue."),
|
3063
|
+
name: TranslationConfig.describe(
|
3064
|
+
"Title of the workflow (both in navigation and on the page)"
|
3065
|
+
),
|
3066
|
+
query: CountryConfigQueryInputType,
|
3067
|
+
actions: import_zod25.z.array(
|
3068
|
+
import_zod25.z.object({
|
3069
|
+
type: import_zod25.z.string(),
|
3070
|
+
conditionals: import_zod25.z.array(Conditional).optional()
|
3071
|
+
})
|
3072
|
+
),
|
3073
|
+
columns: import_zod25.z.array(WorkqueueColumn).default(mandatoryColumns),
|
3074
|
+
icon: AvailableIcons
|
3075
|
+
});
|
3076
|
+
function defineWorkqueue(workqueueInput) {
|
3077
|
+
const queryInput = workqueueInput.query;
|
3078
|
+
const query = "type" in queryInput ? queryInput : { type: "and", clauses: [queryInput] };
|
3079
|
+
return WorkqueueConfig.parse({ ...workqueueInput, query });
|
3080
|
+
}
|
3081
|
+
function defineWorkqueues(workqueues) {
|
3082
|
+
return workqueues.map((workqueue) => defineWorkqueue(workqueue));
|
3083
|
+
}
|
3084
|
+
var WorkqueueCountInput = import_zod25.z.array(
|
3085
|
+
import_zod25.z.object({ slug: import_zod25.z.string(), query: QueryType })
|
3086
|
+
);
|
3087
|
+
var WorkqueueCountOutput = import_zod25.z.record(import_zod25.z.string(), import_zod25.z.number());
|
3088
|
+
|
3089
|
+
// ../commons/src/events/workqueueDefaultColumns.ts
|
3090
|
+
var defaultWorkqueueColumns = [
|
3091
|
+
{
|
3092
|
+
label: {
|
3093
|
+
defaultMessage: "Title",
|
3094
|
+
description: "This is the label for the workqueue column",
|
3095
|
+
id: "workqueue.in-reveiw.column.title"
|
3096
|
+
},
|
3097
|
+
value: event.field("title")
|
3098
|
+
},
|
3099
|
+
{
|
3100
|
+
label: {
|
3101
|
+
defaultMessage: "Event",
|
3102
|
+
description: "This is the label for the workqueue column",
|
3103
|
+
id: "workqueue.default.column.event"
|
3104
|
+
},
|
3105
|
+
value: event.field("type")
|
3106
|
+
}
|
3107
|
+
];
|
3108
|
+
|
3109
|
+
// ../commons/src/events/Draft.ts
|
3110
|
+
var import_zod27 = require("zod");
|
3111
|
+
|
3112
|
+
// ../commons/src/events/ActionInput.ts
|
3113
|
+
var import_zod26 = require("zod");
|
3114
|
+
var import_zod_openapi10 = require("zod-openapi");
|
3115
|
+
var import_uuid3 = require("uuid");
|
3116
|
+
(0, import_zod_openapi10.extendZodWithOpenApi)(import_zod26.z);
|
3117
|
+
var BaseActionInput = import_zod26.z.object({
|
3118
|
+
eventId: import_zod26.z.string(),
|
3119
|
+
transactionId: import_zod26.z.string(),
|
3120
|
+
declaration: ActionUpdate.default({}),
|
3121
|
+
annotation: ActionUpdate.optional(),
|
3122
|
+
originalActionId: import_zod26.z.string().optional(),
|
3123
|
+
keepAssignment: import_zod26.z.boolean().optional()
|
3124
|
+
});
|
3125
|
+
var CreateActionInput = BaseActionInput.merge(
|
3126
|
+
import_zod26.z.object({
|
3127
|
+
type: import_zod26.z.literal(ActionType.CREATE).default(ActionType.CREATE),
|
3128
|
+
createdAtLocation: CreatedAtLocation
|
3129
|
+
})
|
3130
|
+
);
|
3131
|
+
var RegisterActionInput = BaseActionInput.merge(
|
3132
|
+
import_zod26.z.object({
|
3133
|
+
type: import_zod26.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
3134
|
+
registrationNumber: import_zod26.z.string().optional()
|
3135
|
+
})
|
3136
|
+
);
|
3137
|
+
var ValidateActionInput = BaseActionInput.merge(
|
3138
|
+
import_zod26.z.object({
|
3139
|
+
type: import_zod26.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
|
3140
|
+
duplicates: import_zod26.z.array(import_zod26.z.string())
|
3141
|
+
})
|
3142
|
+
);
|
3143
|
+
var NotifyActionInput = BaseActionInput.merge(
|
3144
|
+
import_zod26.z.object({
|
3145
|
+
type: import_zod26.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
|
3146
|
+
})
|
3147
|
+
).openapi({
|
3148
|
+
default: {
|
3149
|
+
eventId: "<event-id-here>",
|
3150
|
+
transactionId: (0, import_uuid3.v4)(),
|
3151
|
+
declaration: {},
|
3152
|
+
annotation: {},
|
3153
|
+
type: ActionType.NOTIFY
|
3154
|
+
}
|
3155
|
+
});
|
3156
|
+
var DeclareActionInput = BaseActionInput.merge(
|
3157
|
+
import_zod26.z.object({
|
3158
|
+
type: import_zod26.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
3159
|
+
})
|
3160
|
+
);
|
3161
|
+
var PrintCertificateActionInput = BaseActionInput.merge(
|
3162
|
+
import_zod26.z.object({
|
3163
|
+
type: import_zod26.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
|
3164
|
+
})
|
3165
|
+
);
|
3166
|
+
var RejectDeclarationActionInput = BaseActionInput.merge(
|
3167
|
+
import_zod26.z.object({
|
3168
|
+
type: import_zod26.z.literal(ActionType.REJECT).default(ActionType.REJECT),
|
3169
|
+
reason: RejectionReason
|
3170
|
+
})
|
3171
|
+
);
|
3172
|
+
var MarkedAsDuplicateActionInput = BaseActionInput.merge(
|
3173
|
+
import_zod26.z.object({
|
3174
|
+
type: import_zod26.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
|
3175
|
+
})
|
3176
|
+
);
|
3177
|
+
var ArchiveActionInput = BaseActionInput.merge(
|
3178
|
+
import_zod26.z.object({
|
3179
|
+
type: import_zod26.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
|
3180
|
+
reason: RejectionReason
|
3181
|
+
})
|
3182
|
+
);
|
3183
|
+
var AssignActionInput = BaseActionInput.merge(
|
3184
|
+
import_zod26.z.object({
|
3185
|
+
type: import_zod26.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
|
3186
|
+
assignedTo: import_zod26.z.string()
|
3187
|
+
})
|
3188
|
+
);
|
3189
|
+
var UnassignActionInput = BaseActionInput.merge(
|
3190
|
+
import_zod26.z.object({
|
3191
|
+
type: import_zod26.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
|
3192
|
+
assignedTo: import_zod26.z.literal(null).default(null)
|
3193
|
+
})
|
3194
|
+
);
|
3195
|
+
var RequestCorrectionActionInput = BaseActionInput.merge(
|
3196
|
+
import_zod26.z.object({
|
3197
|
+
type: import_zod26.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
3198
|
+
})
|
3199
|
+
);
|
3200
|
+
var RejectCorrectionActionInput = BaseActionInput.merge(
|
3201
|
+
import_zod26.z.object({
|
3202
|
+
requestId: import_zod26.z.string(),
|
3203
|
+
type: import_zod26.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
|
3204
|
+
})
|
3205
|
+
);
|
3206
|
+
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
3207
|
+
import_zod26.z.object({
|
3208
|
+
requestId: import_zod26.z.string(),
|
3209
|
+
type: import_zod26.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
3210
|
+
})
|
3211
|
+
);
|
3212
|
+
var ReadActionInput = BaseActionInput.merge(
|
3213
|
+
import_zod26.z.object({
|
3214
|
+
type: import_zod26.z.literal(ActionType.READ).default(ActionType.READ)
|
3215
|
+
})
|
3216
|
+
);
|
3217
|
+
var DeleteActionInput = import_zod26.z.object({ eventId: import_zod26.z.string() });
|
3218
|
+
var ActionInput = import_zod26.z.discriminatedUnion("type", [
|
2631
3219
|
CreateActionInput.openapi({ ref: "CreateActionInput" }),
|
2632
3220
|
ValidateActionInput.openapi({ ref: "ValidateActionInput" }),
|
2633
3221
|
RegisterActionInput.openapi({ ref: "RegisterActionInput" }),
|
@@ -2656,18 +3244,18 @@ var ActionInput = import_zod21.z.discriminatedUnion("type", [
|
|
2656
3244
|
});
|
2657
3245
|
|
2658
3246
|
// ../commons/src/events/Draft.ts
|
2659
|
-
var Draft =
|
2660
|
-
id:
|
2661
|
-
eventId:
|
2662
|
-
transactionId:
|
2663
|
-
createdAt:
|
3247
|
+
var Draft = import_zod27.z.object({
|
3248
|
+
id: import_zod27.z.string(),
|
3249
|
+
eventId: import_zod27.z.string(),
|
3250
|
+
transactionId: import_zod27.z.string(),
|
3251
|
+
createdAt: import_zod27.z.string().datetime(),
|
2664
3252
|
action: ActionBase.extend({
|
2665
3253
|
type: ActionTypes
|
2666
3254
|
}).omit({ id: true })
|
2667
3255
|
});
|
2668
3256
|
var DraftInput = BaseActionInput.extend({
|
2669
3257
|
type: ActionTypes,
|
2670
|
-
status:
|
3258
|
+
status: import_zod27.z.enum([
|
2671
3259
|
ActionStatus.Requested,
|
2672
3260
|
ActionStatus.Accepted,
|
2673
3261
|
ActionStatus.Rejected
|
@@ -2675,25 +3263,24 @@ var DraftInput = BaseActionInput.extend({
|
|
2675
3263
|
});
|
2676
3264
|
|
2677
3265
|
// ../commons/src/events/EventInput.ts
|
2678
|
-
var
|
2679
|
-
var
|
2680
|
-
|
2681
|
-
|
2682
|
-
|
2683
|
-
});
|
3266
|
+
var import_zod28 = require("zod");
|
3267
|
+
var import_uuid4 = require("uuid");
|
3268
|
+
var EventInput = import_zod28.z.object({
|
3269
|
+
transactionId: import_zod28.z.string(),
|
3270
|
+
type: import_zod28.z.string()
|
3271
|
+
}).openapi({ default: { transactionId: (0, import_uuid4.v4)(), type: "v2.birth" } });
|
2684
3272
|
|
2685
3273
|
// ../commons/src/events/EventDocument.ts
|
2686
|
-
var
|
2687
|
-
var
|
2688
|
-
(0,
|
2689
|
-
var EventDocument =
|
2690
|
-
id:
|
2691
|
-
type:
|
2692
|
-
|
2693
|
-
|
2694
|
-
|
2695
|
-
|
2696
|
-
trackingId: import_zod24.z.string()
|
3274
|
+
var import_zod29 = require("zod");
|
3275
|
+
var import_zod_openapi11 = require("zod-openapi");
|
3276
|
+
(0, import_zod_openapi11.extendZodWithOpenApi)(import_zod29.z);
|
3277
|
+
var EventDocument = import_zod29.z.object({
|
3278
|
+
id: import_zod29.z.string(),
|
3279
|
+
type: import_zod29.z.string(),
|
3280
|
+
createdAt: import_zod29.z.string().datetime(),
|
3281
|
+
updatedAt: import_zod29.z.string().datetime(),
|
3282
|
+
actions: import_zod29.z.array(Action),
|
3283
|
+
trackingId: import_zod29.z.string()
|
2697
3284
|
}).openapi({ ref: "EventDocument" });
|
2698
3285
|
|
2699
3286
|
// ../commons/src/events/state/utils.ts
|
@@ -2730,6 +3317,7 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
|
|
2730
3317
|
createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
|
2731
3318
|
acceptedAt: acceptAction.createdAt,
|
2732
3319
|
createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
|
3320
|
+
createdBySignature: requestAction?.createdBySignature ?? acceptAction.createdBySignature,
|
2733
3321
|
registrationNumber
|
2734
3322
|
};
|
2735
3323
|
}
|
@@ -2758,11 +3346,11 @@ function getDeclarationActionUpdateMetadata(actions) {
|
|
2758
3346
|
}
|
2759
3347
|
function getLegalStatuses(actions) {
|
2760
3348
|
return {
|
2761
|
-
[EventStatus.DECLARED]: getDeclarationActionCreationMetadata(
|
3349
|
+
[EventStatus.enum.DECLARED]: getDeclarationActionCreationMetadata(
|
2762
3350
|
ActionType.DECLARE,
|
2763
3351
|
actions
|
2764
3352
|
),
|
2765
|
-
[EventStatus.REGISTERED]: getDeclarationActionCreationMetadata(
|
3353
|
+
[EventStatus.enum.REGISTERED]: getDeclarationActionCreationMetadata(
|
2766
3354
|
ActionType.REGISTER,
|
2767
3355
|
actions
|
2768
3356
|
)
|
@@ -2775,26 +3363,26 @@ function getStatusFromActions(actions) {
|
|
2775
3363
|
(a) => a.status === ActionStatus.Rejected
|
2776
3364
|
);
|
2777
3365
|
if (hasRejectedAction) {
|
2778
|
-
return EventStatus.REJECTED;
|
3366
|
+
return EventStatus.enum.REJECTED;
|
2779
3367
|
}
|
2780
3368
|
return actions.reduce((status, action) => {
|
2781
3369
|
switch (action.type) {
|
2782
3370
|
case ActionType.CREATE:
|
2783
|
-
return EventStatus.CREATED;
|
3371
|
+
return EventStatus.enum.CREATED;
|
2784
3372
|
case ActionType.DECLARE:
|
2785
|
-
return EventStatus.DECLARED;
|
3373
|
+
return EventStatus.enum.DECLARED;
|
2786
3374
|
case ActionType.VALIDATE:
|
2787
|
-
return EventStatus.VALIDATED;
|
3375
|
+
return EventStatus.enum.VALIDATED;
|
2788
3376
|
case ActionType.REGISTER:
|
2789
|
-
return EventStatus.REGISTERED;
|
3377
|
+
return EventStatus.enum.REGISTERED;
|
2790
3378
|
case ActionType.REJECT:
|
2791
|
-
return EventStatus.REJECTED;
|
3379
|
+
return EventStatus.enum.REJECTED;
|
2792
3380
|
case ActionType.ARCHIVE:
|
2793
|
-
return EventStatus.ARCHIVED;
|
3381
|
+
return EventStatus.enum.ARCHIVED;
|
2794
3382
|
case ActionType.NOTIFY:
|
2795
|
-
return EventStatus.NOTIFIED;
|
3383
|
+
return EventStatus.enum.NOTIFIED;
|
2796
3384
|
case ActionType.PRINT_CERTIFICATE:
|
2797
|
-
return EventStatus.CERTIFIED;
|
3385
|
+
return EventStatus.enum.CERTIFIED;
|
2798
3386
|
case ActionType.ASSIGN:
|
2799
3387
|
case ActionType.UNASSIGN:
|
2800
3388
|
case ActionType.REQUEST_CORRECTION:
|
@@ -2805,7 +3393,7 @@ function getStatusFromActions(actions) {
|
|
2805
3393
|
default:
|
2806
3394
|
return status;
|
2807
3395
|
}
|
2808
|
-
}, EventStatus.CREATED);
|
3396
|
+
}, EventStatus.enum.CREATED);
|
2809
3397
|
}
|
2810
3398
|
function getFlagsFromActions(actions) {
|
2811
3399
|
const sortedactions = actions.sort(
|
@@ -2850,23 +3438,34 @@ function getAssignedUserFromActions(actions) {
|
|
2850
3438
|
return user2;
|
2851
3439
|
}, null);
|
2852
3440
|
}
|
3441
|
+
function getAssignedUserSignatureFromActions(actions) {
|
3442
|
+
return actions.reduce((signature, action) => {
|
3443
|
+
if (action.type === ActionType.ASSIGN) {
|
3444
|
+
return action.createdBySignature || null;
|
3445
|
+
}
|
3446
|
+
if (action.type === ActionType.UNASSIGN) {
|
3447
|
+
return null;
|
3448
|
+
}
|
3449
|
+
return signature;
|
3450
|
+
}, null);
|
3451
|
+
}
|
2853
3452
|
function aggregateActionDeclarations(actions) {
|
2854
3453
|
const excludedActions = [
|
2855
3454
|
ActionType.REQUEST_CORRECTION,
|
2856
3455
|
ActionType.PRINT_CERTIFICATE
|
2857
3456
|
];
|
2858
|
-
return actions.reduce((
|
3457
|
+
return actions.reduce((declaration, action) => {
|
2859
3458
|
if (excludedActions.some((excludedAction) => excludedAction === action.type)) {
|
2860
|
-
return
|
3459
|
+
return declaration;
|
2861
3460
|
}
|
2862
3461
|
if (action.type === ActionType.APPROVE_CORRECTION) {
|
2863
3462
|
const requestAction = actions.find(({ id }) => id === action.requestId);
|
2864
3463
|
if (!requestAction) {
|
2865
|
-
return
|
3464
|
+
return declaration;
|
2866
3465
|
}
|
2867
|
-
return deepMerge(
|
3466
|
+
return deepMerge(declaration, requestAction.declaration);
|
2868
3467
|
}
|
2869
|
-
return deepMerge(
|
3468
|
+
return deepMerge(declaration, action.declaration);
|
2870
3469
|
}, {});
|
2871
3470
|
}
|
2872
3471
|
function deepDropNulls(obj) {
|
@@ -2886,7 +3485,7 @@ function deepDropNulls(obj) {
|
|
2886
3485
|
return obj;
|
2887
3486
|
}
|
2888
3487
|
function isUndeclaredDraft(status) {
|
2889
|
-
return status === EventStatus.CREATED;
|
3488
|
+
return status === EventStatus.enum.CREATED;
|
2890
3489
|
}
|
2891
3490
|
function getAcceptedActions(event2) {
|
2892
3491
|
return event2.actions.filter(
|
@@ -2894,7 +3493,7 @@ function getAcceptedActions(event2) {
|
|
2894
3493
|
);
|
2895
3494
|
}
|
2896
3495
|
var DEFAULT_DATE_OF_EVENT_PROPERTY = "createdAt";
|
2897
|
-
function getCurrentEventState(event2) {
|
3496
|
+
function getCurrentEventState(event2, config) {
|
2898
3497
|
const creationAction = event2.actions.find(
|
2899
3498
|
(action) => action.type === ActionType.CREATE
|
2900
3499
|
);
|
@@ -2906,9 +3505,17 @@ function getCurrentEventState(event2) {
|
|
2906
3505
|
event2.actions
|
2907
3506
|
);
|
2908
3507
|
const declaration = aggregateActionDeclarations(acceptedActions);
|
2909
|
-
|
2910
|
-
|
2911
|
-
|
3508
|
+
let dateOfEvent;
|
3509
|
+
if (config.dateOfEvent) {
|
3510
|
+
const parsedDate = ZodDate.safeParse(
|
3511
|
+
declaration[config.dateOfEvent.$$field]
|
3512
|
+
);
|
3513
|
+
if (parsedDate.success) {
|
3514
|
+
dateOfEvent = parsedDate.data;
|
3515
|
+
}
|
3516
|
+
} else {
|
3517
|
+
dateOfEvent = event2[DEFAULT_DATE_OF_EVENT_PROPERTY].split("T")[0];
|
3518
|
+
}
|
2912
3519
|
return deepDropNulls({
|
2913
3520
|
id: event2.id,
|
2914
3521
|
type: event2.type,
|
@@ -2917,19 +3524,24 @@ function getCurrentEventState(event2) {
|
|
2917
3524
|
createdAt: creationAction.createdAt,
|
2918
3525
|
createdBy: creationAction.createdBy,
|
2919
3526
|
createdAtLocation: creationAction.createdAtLocation,
|
3527
|
+
createdBySignature: creationAction.createdBySignature,
|
2920
3528
|
updatedAt: declarationUpdateMetadata.createdAt,
|
2921
3529
|
assignedTo: getAssignedUserFromActions(acceptedActions),
|
3530
|
+
assignedToSignature: getAssignedUserSignatureFromActions(acceptedActions),
|
2922
3531
|
updatedBy: declarationUpdateMetadata.createdBy,
|
2923
3532
|
updatedAtLocation: declarationUpdateMetadata.createdAtLocation,
|
2924
3533
|
declaration,
|
2925
3534
|
trackingId: event2.trackingId,
|
2926
|
-
// @TODO: unify this with rest of the code. It will trip us if updatedBy has different rules than updatedByUserRole
|
2927
3535
|
updatedByUserRole: declarationUpdateMetadata.createdByRole,
|
2928
3536
|
dateOfEvent,
|
2929
3537
|
flags: getFlagsFromActions(event2.actions)
|
2930
3538
|
});
|
2931
3539
|
}
|
2932
|
-
function getCurrentEventStateWithDrafts(
|
3540
|
+
function getCurrentEventStateWithDrafts({
|
3541
|
+
event: event2,
|
3542
|
+
drafts,
|
3543
|
+
configuration
|
3544
|
+
}) {
|
2933
3545
|
const actions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
2934
3546
|
const activeDrafts = findActiveDrafts(event2, drafts).map((draft) => draft.action).flatMap((action) => {
|
2935
3547
|
if (action.type === ActionType.REQUEST_CORRECTION) {
|
@@ -2948,7 +3560,7 @@ function getCurrentEventStateWithDrafts(event2, drafts) {
|
|
2948
3560
|
...event2,
|
2949
3561
|
actions: actionWithDrafts
|
2950
3562
|
};
|
2951
|
-
return getCurrentEventState(withDrafts);
|
3563
|
+
return getCurrentEventState(withDrafts, configuration);
|
2952
3564
|
}
|
2953
3565
|
function applyDraftsToEventIndex(eventIndex, drafts) {
|
2954
3566
|
const indexedAt = eventIndex.updatedAt;
|
@@ -3002,73 +3614,45 @@ function generateTransactionId() {
|
|
3002
3614
|
return getUUID();
|
3003
3615
|
}
|
3004
3616
|
|
3617
|
+
// ../commons/src/events/User.ts
|
3618
|
+
var import_zod30 = require("zod");
|
3619
|
+
var User = import_zod30.z.object({
|
3620
|
+
id: import_zod30.z.string(),
|
3621
|
+
name: import_zod30.z.array(
|
3622
|
+
import_zod30.z.object({
|
3623
|
+
use: import_zod30.z.string(),
|
3624
|
+
given: import_zod30.z.array(import_zod30.z.string()),
|
3625
|
+
family: import_zod30.z.string()
|
3626
|
+
})
|
3627
|
+
),
|
3628
|
+
role: import_zod30.z.string(),
|
3629
|
+
signatureFilename: import_zod30.z.string().optional()
|
3630
|
+
});
|
3631
|
+
|
3005
3632
|
// ../commons/src/events/test.utils.ts
|
3006
3633
|
var import_lodash2 = require("lodash");
|
3634
|
+
var import_addDays = __toESM(require("date-fns/addDays"));
|
3007
3635
|
|
3008
3636
|
// ../commons/src/field-config/field-configuration.ts
|
3009
|
-
function
|
3637
|
+
function createFieldConfig(fieldId, options) {
|
3010
3638
|
const baseField = {
|
3011
3639
|
fieldId,
|
3012
|
-
fieldType: "field"
|
3013
|
-
|
3014
|
-
return {
|
3015
|
-
/**
|
3016
|
-
* Creates a range configuration for the specified field.
|
3017
|
-
*
|
3018
|
-
* @returns An object containing the field ID and a configuration object with a type of 'range'.
|
3019
|
-
*
|
3020
|
-
* @example field('age').range()
|
3021
|
-
* // {
|
3022
|
-
* // fieldId: 'age',
|
3023
|
-
* // config: { type: 'range' }
|
3024
|
-
* // }
|
3025
|
-
*/
|
3026
|
-
range: () => ({
|
3027
|
-
...baseField,
|
3028
|
-
config: { type: "range" }
|
3029
|
-
}),
|
3030
|
-
/**
|
3031
|
-
* Creates a configuration for exact matching of the specified field.
|
3032
|
-
* @returns An object containing the field ID and a configuration object with a type of 'exact'.
|
3033
|
-
* @example field('dob').exact()
|
3034
|
-
* // {
|
3035
|
-
* // fieldId: 'dob',
|
3036
|
-
* // config: { type: 'exact' }
|
3037
|
-
* // }
|
3038
|
-
*/
|
3039
|
-
exact: () => ({
|
3040
|
-
...baseField,
|
3041
|
-
config: { type: "exact" }
|
3042
|
-
}),
|
3043
|
-
/**
|
3044
|
-
* Creates a configuration for fuzzy matching of the specified field.
|
3045
|
-
* @returns An object containing the field ID and a configuration object with a type of 'exact'.
|
3046
|
-
* @example field('name').fuzzy()
|
3047
|
-
* // {
|
3048
|
-
* // fieldId: 'name',
|
3049
|
-
* // config: { type: 'fuzzy' }
|
3050
|
-
* // }
|
3051
|
-
*/
|
3052
|
-
fuzzy: () => ({
|
3053
|
-
...baseField,
|
3054
|
-
config: { type: "fuzzy" }
|
3055
|
-
})
|
3640
|
+
fieldType: "field",
|
3641
|
+
...options
|
3056
3642
|
};
|
3643
|
+
return createSearchConfig(baseField);
|
3057
3644
|
}
|
3058
3645
|
|
3059
3646
|
// ../commons/src/events/field.ts
|
3060
|
-
function field(fieldId) {
|
3647
|
+
function field(fieldId, options = {}) {
|
3061
3648
|
return {
|
3062
|
-
/**
|
3063
|
-
* @private Internal property used for field reference tracking.
|
3064
|
-
*/
|
3065
|
-
_fieldId: fieldId,
|
3066
3649
|
...createFieldConditionals(fieldId),
|
3067
|
-
...
|
3650
|
+
...createFieldConfig(fieldId, options)
|
3068
3651
|
};
|
3069
3652
|
}
|
3070
3653
|
|
3071
|
-
// ../commons/src/fixtures/
|
3654
|
+
// ../commons/src/fixtures/forms.ts
|
3655
|
+
var import_date_fns2 = require("date-fns");
|
3072
3656
|
var PRINT_CERTIFICATE_FORM = defineActionForm({
|
3073
3657
|
label: {
|
3074
3658
|
id: "v2.event.tennis-club-membership.action.certificate.form.label",
|
@@ -3727,7 +4311,7 @@ var PRINT_CERTIFICATE_FORM = defineActionForm({
|
|
3727
4311
|
var TENNIS_CLUB_DECLARATION_REVIEW = {
|
3728
4312
|
title: {
|
3729
4313
|
id: "v2.event.tennis-club-membership.action.declare.form.review.title",
|
3730
|
-
defaultMessage: "{applicant.firstname, select, __EMPTY__ {Member declaration} other {{applicant.surname, select, __EMPTY__ {Member declaration} other {Member declaration for {applicant.firstname} {applicant.surname}}}}}",
|
4314
|
+
defaultMessage: "{applicant.name.firstname, select, __EMPTY__ {Member declaration} other {{applicant.name.surname, select, __EMPTY__ {Member declaration} other {Member declaration for {applicant.name.firstname} {applicant.name.surname}}}}}",
|
3731
4315
|
description: "Title of the review page"
|
3732
4316
|
},
|
3733
4317
|
fields: [
|
@@ -3772,27 +4356,17 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
|
3772
4356
|
},
|
3773
4357
|
fields: [
|
3774
4358
|
{
|
3775
|
-
id: "applicant.
|
3776
|
-
type: FieldType.
|
4359
|
+
id: "applicant.name",
|
4360
|
+
type: FieldType.NAME,
|
3777
4361
|
required: true,
|
4362
|
+
hideLabel: true,
|
3778
4363
|
conditionals: [],
|
3779
4364
|
label: {
|
3780
|
-
defaultMessage: "Applicant's
|
4365
|
+
defaultMessage: "Applicant's name",
|
3781
4366
|
description: "This is the label for the field",
|
3782
4367
|
id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.firstname.label"
|
3783
4368
|
}
|
3784
4369
|
},
|
3785
|
-
{
|
3786
|
-
id: "applicant.surname",
|
3787
|
-
type: FieldType.TEXT,
|
3788
|
-
required: true,
|
3789
|
-
conditionals: [],
|
3790
|
-
label: {
|
3791
|
-
defaultMessage: "Applicant's surname",
|
3792
|
-
description: "This is the label for the field",
|
3793
|
-
id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.surname.label"
|
3794
|
-
}
|
3795
|
-
},
|
3796
4370
|
{
|
3797
4371
|
id: "applicant.email",
|
3798
4372
|
type: "EMAIL",
|
@@ -3886,156 +4460,658 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
|
3886
4460
|
]
|
3887
4461
|
},
|
3888
4462
|
{
|
3889
|
-
id: "senior-pass",
|
3890
|
-
conditional: field("applicant.dob").isBefore().date("1950-01-01"),
|
4463
|
+
id: "senior-pass",
|
4464
|
+
conditional: field("applicant.dob").isBefore().date("1950-01-01"),
|
4465
|
+
title: {
|
4466
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.senior-pass.title",
|
4467
|
+
defaultMessage: "Assign senior pass for applicant",
|
4468
|
+
description: "This is the title of the section"
|
4469
|
+
},
|
4470
|
+
fields: [
|
4471
|
+
{
|
4472
|
+
id: "senior-pass.id",
|
4473
|
+
type: FieldType.TEXT,
|
4474
|
+
required: true,
|
4475
|
+
label: {
|
4476
|
+
defaultMessage: "Senior pass ID",
|
4477
|
+
description: "This is the label for the field",
|
4478
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.senior-pass.field.id.label"
|
4479
|
+
}
|
4480
|
+
}
|
4481
|
+
]
|
4482
|
+
},
|
4483
|
+
{
|
4484
|
+
id: "recommender",
|
4485
|
+
title: {
|
4486
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.title",
|
4487
|
+
defaultMessage: "Who is recommending the applicant?",
|
4488
|
+
description: "This is the title of the section"
|
4489
|
+
},
|
4490
|
+
fields: [
|
4491
|
+
{
|
4492
|
+
id: "recommender.none",
|
4493
|
+
type: "CHECKBOX",
|
4494
|
+
required: false,
|
4495
|
+
conditionals: [],
|
4496
|
+
label: {
|
4497
|
+
defaultMessage: "No recommender",
|
4498
|
+
description: "This is the label for the field",
|
4499
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.none.label"
|
4500
|
+
}
|
4501
|
+
},
|
4502
|
+
{
|
4503
|
+
id: "recommender.name",
|
4504
|
+
type: FieldType.NAME,
|
4505
|
+
hideLabel: true,
|
4506
|
+
required: true,
|
4507
|
+
conditionals: [
|
4508
|
+
{
|
4509
|
+
type: ConditionalType.SHOW,
|
4510
|
+
conditional: field("recommender.none").isFalsy()
|
4511
|
+
}
|
4512
|
+
],
|
4513
|
+
label: {
|
4514
|
+
defaultMessage: "Recommender's name",
|
4515
|
+
description: "This is the label for the field",
|
4516
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.firstname.label"
|
4517
|
+
}
|
4518
|
+
},
|
4519
|
+
{
|
4520
|
+
id: "recommender.id",
|
4521
|
+
type: FieldType.TEXT,
|
4522
|
+
required: true,
|
4523
|
+
conditionals: [
|
4524
|
+
{
|
4525
|
+
type: ConditionalType.SHOW,
|
4526
|
+
conditional: field("recommender.none").isFalsy()
|
4527
|
+
}
|
4528
|
+
],
|
4529
|
+
label: {
|
4530
|
+
defaultMessage: "Recommender's membership ID",
|
4531
|
+
description: "This is the label for the field",
|
4532
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.id.label"
|
4533
|
+
}
|
4534
|
+
}
|
4535
|
+
]
|
4536
|
+
}
|
4537
|
+
]
|
4538
|
+
});
|
4539
|
+
var statusOptions = [
|
4540
|
+
{
|
4541
|
+
value: "ALL",
|
4542
|
+
label: {
|
4543
|
+
defaultMessage: "Any status",
|
4544
|
+
description: "Option for form field: status of record",
|
4545
|
+
id: "v2.advancedSearch.form.recordStatusAny"
|
4546
|
+
}
|
4547
|
+
},
|
4548
|
+
{
|
4549
|
+
value: EventStatus.enum.CREATED,
|
4550
|
+
label: {
|
4551
|
+
defaultMessage: "Draft",
|
4552
|
+
description: "Option for form field: status of record",
|
4553
|
+
id: "v2.advancedSearch.form.recordStatusCreated"
|
4554
|
+
}
|
4555
|
+
},
|
4556
|
+
{
|
4557
|
+
value: EventStatus.enum.NOTIFIED,
|
4558
|
+
label: {
|
4559
|
+
defaultMessage: "Notified",
|
4560
|
+
description: "Option for form field: status of record",
|
4561
|
+
id: "v2.advancedSearch.form.recordStatusNotified"
|
4562
|
+
}
|
4563
|
+
},
|
4564
|
+
{
|
4565
|
+
value: EventStatus.enum.DECLARED,
|
4566
|
+
label: {
|
4567
|
+
defaultMessage: "Declared",
|
4568
|
+
description: "Option for form field: status of record",
|
4569
|
+
id: "v2.advancedSearch.form.recordStatusDeclared"
|
4570
|
+
}
|
4571
|
+
},
|
4572
|
+
{
|
4573
|
+
value: EventStatus.enum.VALIDATED,
|
4574
|
+
label: {
|
4575
|
+
defaultMessage: "Validated",
|
4576
|
+
description: "Option for form field: status of record",
|
4577
|
+
id: "v2.advancedSearch.form.recordStatusValidated"
|
4578
|
+
}
|
4579
|
+
},
|
4580
|
+
{
|
4581
|
+
value: EventStatus.enum.REGISTERED,
|
4582
|
+
label: {
|
4583
|
+
defaultMessage: "Registered",
|
4584
|
+
description: "Option for form field: status of record",
|
4585
|
+
id: "v2.advancedSearch.form.recordStatusRegistered"
|
4586
|
+
}
|
4587
|
+
},
|
4588
|
+
{
|
4589
|
+
value: EventStatus.enum.CERTIFIED,
|
4590
|
+
label: {
|
4591
|
+
defaultMessage: "Certified",
|
4592
|
+
description: "Option for form field: status of record",
|
4593
|
+
id: "v2.advancedSearch.form.recordStatusCertified"
|
4594
|
+
}
|
4595
|
+
},
|
4596
|
+
{
|
4597
|
+
value: EventStatus.enum.REJECTED,
|
4598
|
+
label: {
|
4599
|
+
defaultMessage: "Rejected",
|
4600
|
+
description: "Option for form field: status of record",
|
4601
|
+
id: "v2.advancedSearch.form.recordStatusRejected"
|
4602
|
+
}
|
4603
|
+
},
|
4604
|
+
{
|
4605
|
+
value: EventStatus.enum.ARCHIVED,
|
4606
|
+
label: {
|
4607
|
+
defaultMessage: "Archived",
|
4608
|
+
description: "Option for form field: status of record",
|
4609
|
+
id: "v2.advancedSearch.form.recordStatusArchived"
|
4610
|
+
}
|
4611
|
+
}
|
4612
|
+
];
|
4613
|
+
var timePeriodOptions = [
|
4614
|
+
{
|
4615
|
+
label: {
|
4616
|
+
defaultMessage: "Last 7 days",
|
4617
|
+
description: "Label for option of time period select: last 7 days",
|
4618
|
+
id: "form.section.label.timePeriodLast7Days"
|
4619
|
+
},
|
4620
|
+
value: `${(0, import_date_fns2.format)((0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 7), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
|
4621
|
+
/* @__PURE__ */ new Date(),
|
4622
|
+
"yyyy-MM-dd"
|
4623
|
+
)}`
|
4624
|
+
},
|
4625
|
+
{
|
4626
|
+
label: {
|
4627
|
+
defaultMessage: "Last 30 days",
|
4628
|
+
description: "Label for option of time period select: last 30 days",
|
4629
|
+
id: "form.section.label.timePeriodLast30Days"
|
4630
|
+
},
|
4631
|
+
value: `${(0, import_date_fns2.format)((0, import_date_fns2.subMonths)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
|
4632
|
+
/* @__PURE__ */ new Date(),
|
4633
|
+
"yyyy-MM-dd"
|
4634
|
+
)}`
|
4635
|
+
},
|
4636
|
+
{
|
4637
|
+
label: {
|
4638
|
+
defaultMessage: "Last 90 days",
|
4639
|
+
description: "Label for option of time period select: last 90 days",
|
4640
|
+
id: "form.section.label.timePeriodLast90Days"
|
4641
|
+
},
|
4642
|
+
value: `${(0, import_date_fns2.format)((0, import_date_fns2.subQuarters)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
|
4643
|
+
/* @__PURE__ */ new Date(),
|
4644
|
+
"yyyy-MM-dd"
|
4645
|
+
)}`
|
4646
|
+
},
|
4647
|
+
{
|
4648
|
+
label: {
|
4649
|
+
defaultMessage: "Last year",
|
4650
|
+
description: "Label for option of time period select: last year",
|
4651
|
+
id: "form.section.label.timePeriodLastYear"
|
4652
|
+
},
|
4653
|
+
value: `${(0, import_date_fns2.format)((0, import_date_fns2.subYears)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
|
4654
|
+
/* @__PURE__ */ new Date(),
|
4655
|
+
"yyyy-MM-dd"
|
4656
|
+
)}`
|
4657
|
+
}
|
4658
|
+
];
|
4659
|
+
|
4660
|
+
// ../commons/src/fixtures/tennis-club-membership-event.ts
|
4661
|
+
var tennisClubMembershipEvent = defineConfig({
|
4662
|
+
id: TENNIS_CLUB_MEMBERSHIP,
|
4663
|
+
label: {
|
4664
|
+
defaultMessage: "Tennis club membership application",
|
4665
|
+
description: "This is what this event is referred as in the system",
|
4666
|
+
id: "v2.event.tennis-club-membership.label"
|
4667
|
+
},
|
4668
|
+
title: {
|
4669
|
+
defaultMessage: "{applicant.name.firstname} {applicant.name.surname}",
|
4670
|
+
description: "This is the title of the summary",
|
4671
|
+
id: "v2.event.tennis-club-membership.title"
|
4672
|
+
},
|
4673
|
+
summary: {
|
4674
|
+
fields: [
|
4675
|
+
{
|
4676
|
+
id: "applicant.name.firstname",
|
4677
|
+
label: {
|
4678
|
+
defaultMessage: "Applicant's first name",
|
4679
|
+
description: "This is the label for the field",
|
4680
|
+
id: "event.tennis-club-membership.summary.field.firstname.label"
|
4681
|
+
},
|
4682
|
+
value: {
|
4683
|
+
defaultMessage: "{applicant.name.firstname}",
|
4684
|
+
description: "This is the value to show in the summary",
|
4685
|
+
id: "event.tennis-club-membership.summary.field.firstname"
|
4686
|
+
},
|
4687
|
+
emptyValueMessage: {
|
4688
|
+
defaultMessage: "First name is not provided",
|
4689
|
+
description: "This is the message to show when the field is empty",
|
4690
|
+
id: "event.tennis-club-membership.summary.field.firstname.empty"
|
4691
|
+
}
|
4692
|
+
},
|
4693
|
+
{
|
4694
|
+
fieldId: "applicant.name.surname",
|
4695
|
+
label: {
|
4696
|
+
defaultMessage: "Applicant's last name",
|
4697
|
+
description: "Label for surname",
|
4698
|
+
id: "v2.event.tennis-club-membership.summary.field.surname.label"
|
4699
|
+
}
|
4700
|
+
},
|
4701
|
+
{
|
4702
|
+
fieldId: "applicant.email"
|
4703
|
+
}
|
4704
|
+
]
|
4705
|
+
},
|
4706
|
+
actions: [
|
4707
|
+
{
|
4708
|
+
type: ActionType.READ,
|
4709
|
+
label: {
|
4710
|
+
id: "v2.event.tennis-club-membership.action.read.label",
|
4711
|
+
defaultMessage: "Read",
|
4712
|
+
description: "Title of the read only page"
|
4713
|
+
},
|
4714
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
4715
|
+
},
|
4716
|
+
{
|
4717
|
+
type: ActionType.DECLARE,
|
4718
|
+
label: {
|
4719
|
+
defaultMessage: "Send an application",
|
4720
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4721
|
+
id: "event.tennis-club-membership.action.declare.label"
|
4722
|
+
},
|
4723
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
4724
|
+
},
|
4725
|
+
{
|
4726
|
+
type: ActionType.VALIDATE,
|
4727
|
+
label: {
|
4728
|
+
defaultMessage: "Validate",
|
4729
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4730
|
+
id: "event.tennis-club-membership.action.validate.label"
|
4731
|
+
},
|
4732
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
4733
|
+
},
|
4734
|
+
{
|
4735
|
+
type: ActionType.REGISTER,
|
4736
|
+
label: {
|
4737
|
+
defaultMessage: "Register",
|
4738
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4739
|
+
id: "event.tennis-club-membership.action.register.label"
|
4740
|
+
},
|
4741
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
4742
|
+
},
|
4743
|
+
{
|
4744
|
+
type: ActionType.REQUEST_CORRECTION,
|
4745
|
+
label: {
|
4746
|
+
defaultMessage: "Request correction",
|
4747
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4748
|
+
id: "event.tennis-club-membership.action.correction.request.label"
|
4749
|
+
},
|
4750
|
+
onboardingForm: [
|
4751
|
+
{
|
4752
|
+
id: "correction-requester",
|
4753
|
+
type: PageTypes.enum.FORM,
|
4754
|
+
title: {
|
4755
|
+
id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
|
4756
|
+
defaultMessage: "Correction requester",
|
4757
|
+
description: "This is the title of the section"
|
4758
|
+
},
|
4759
|
+
fields: [
|
4760
|
+
{
|
4761
|
+
id: "correction.requester.relationshop.intro",
|
4762
|
+
type: "PAGE_HEADER",
|
4763
|
+
label: {
|
4764
|
+
id: "correction.requester.relationshop.intro.label",
|
4765
|
+
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.",
|
4766
|
+
description: "The title for the corrector form"
|
4767
|
+
}
|
4768
|
+
},
|
4769
|
+
{
|
4770
|
+
id: "correction.requester.relationship",
|
4771
|
+
type: "RADIO_GROUP",
|
4772
|
+
label: {
|
4773
|
+
id: "v2.correction.corrector.title",
|
4774
|
+
defaultMessage: "Who is requesting a change to this record?",
|
4775
|
+
description: "The title for the corrector form"
|
4776
|
+
},
|
4777
|
+
defaultValue: "",
|
4778
|
+
options: [
|
4779
|
+
{
|
4780
|
+
value: "INFORMANT",
|
4781
|
+
label: {
|
4782
|
+
id: "v2.correction.corrector.informant",
|
4783
|
+
defaultMessage: "Informant",
|
4784
|
+
description: "Label for informant option in certificate correction form"
|
4785
|
+
}
|
4786
|
+
},
|
4787
|
+
{
|
4788
|
+
value: "ANOTHER_AGENT",
|
4789
|
+
label: {
|
4790
|
+
id: "v2.correction.corrector.anotherAgent",
|
4791
|
+
defaultMessage: "Another registration agent or field agent",
|
4792
|
+
description: "Label for another registration or field agent option in certificate correction form"
|
4793
|
+
}
|
4794
|
+
},
|
4795
|
+
{
|
4796
|
+
value: "REGISTRAR",
|
4797
|
+
label: {
|
4798
|
+
id: "v2.correction.corrector.me",
|
4799
|
+
defaultMessage: "Me (Registrar)",
|
4800
|
+
description: "Label for registrar option in certificate correction form"
|
4801
|
+
}
|
4802
|
+
},
|
4803
|
+
{
|
4804
|
+
value: "OTHER",
|
4805
|
+
label: {
|
4806
|
+
id: "v2.correction.corrector.others",
|
4807
|
+
defaultMessage: "Someone else",
|
4808
|
+
description: "Label for someone else option in certificate correction form"
|
4809
|
+
}
|
4810
|
+
}
|
4811
|
+
]
|
4812
|
+
}
|
4813
|
+
]
|
4814
|
+
},
|
4815
|
+
{
|
4816
|
+
id: "identity-check",
|
4817
|
+
type: PageTypes.enum.FORM,
|
4818
|
+
title: {
|
4819
|
+
id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
|
4820
|
+
defaultMessage: "Verify their identity",
|
4821
|
+
description: "This is the title of the section"
|
4822
|
+
},
|
4823
|
+
fields: [
|
4824
|
+
{
|
4825
|
+
id: "correction.identity-check.instructions",
|
4826
|
+
type: "PAGE_HEADER",
|
4827
|
+
label: {
|
4828
|
+
id: "correction.corrector.identity.instruction",
|
4829
|
+
defaultMessage: "Please verify the identity of the person making this request",
|
4830
|
+
description: "The title for the corrector form"
|
4831
|
+
}
|
4832
|
+
},
|
4833
|
+
{
|
4834
|
+
id: "correction.identity-check.verified",
|
4835
|
+
type: "RADIO_GROUP",
|
4836
|
+
label: {
|
4837
|
+
id: "correction.corrector.identity.verified.label",
|
4838
|
+
defaultMessage: "Identity verified",
|
4839
|
+
description: "The title for the corrector form"
|
4840
|
+
},
|
4841
|
+
defaultValue: "",
|
4842
|
+
required: true,
|
4843
|
+
options: [
|
4844
|
+
{
|
4845
|
+
value: "VERIFIED",
|
4846
|
+
label: {
|
4847
|
+
id: "correction.corrector.identity.verified",
|
4848
|
+
defaultMessage: "I have verified their identity",
|
4849
|
+
description: "Label for verified option in corrector identity check page"
|
4850
|
+
}
|
4851
|
+
}
|
4852
|
+
]
|
4853
|
+
}
|
4854
|
+
]
|
4855
|
+
}
|
4856
|
+
],
|
4857
|
+
additionalDetailsForm: [
|
4858
|
+
{
|
4859
|
+
id: "correction-request.supporting-documents",
|
4860
|
+
type: PageTypes.enum.FORM,
|
4861
|
+
title: {
|
4862
|
+
id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
|
4863
|
+
defaultMessage: "Upload supporting documents",
|
4864
|
+
description: "This is the title of the section"
|
4865
|
+
},
|
4866
|
+
fields: [
|
4867
|
+
{
|
4868
|
+
id: "correction.supportingDocs.introduction",
|
4869
|
+
type: "PAGE_HEADER",
|
4870
|
+
label: {
|
4871
|
+
id: "correction.corrector.paragraph.title",
|
4872
|
+
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.",
|
4873
|
+
description: "The title for the corrector form"
|
4874
|
+
}
|
4875
|
+
},
|
4876
|
+
{
|
4877
|
+
id: "correction.supportingDocs",
|
4878
|
+
type: FieldType.FILE,
|
4879
|
+
label: {
|
4880
|
+
id: "correction.corrector.title",
|
4881
|
+
defaultMessage: "Upload supporting documents",
|
4882
|
+
description: "The title for the corrector form"
|
4883
|
+
}
|
4884
|
+
},
|
4885
|
+
{
|
4886
|
+
id: "correction.request.supportingDocuments",
|
4887
|
+
type: "RADIO_GROUP",
|
4888
|
+
label: {
|
4889
|
+
id: "correction.corrector.title",
|
4890
|
+
defaultMessage: "Who is requesting a change to this record?",
|
4891
|
+
description: "The title for the corrector form"
|
4892
|
+
},
|
4893
|
+
defaultValue: "",
|
4894
|
+
configuration: {
|
4895
|
+
styles: {
|
4896
|
+
size: "NORMAL"
|
4897
|
+
}
|
4898
|
+
},
|
4899
|
+
options: [
|
4900
|
+
{
|
4901
|
+
value: "ATTEST",
|
4902
|
+
label: {
|
4903
|
+
id: "correction.supportingDocuments.attest.label",
|
4904
|
+
defaultMessage: "I attest to seeing supporting documentation and have a copy filed at my office",
|
4905
|
+
description: ""
|
4906
|
+
}
|
4907
|
+
},
|
4908
|
+
{
|
4909
|
+
value: "NOT_NEEDED",
|
4910
|
+
label: {
|
4911
|
+
id: "correction.supportingDocuments.notNeeded.label",
|
4912
|
+
defaultMessage: "No supporting documents required",
|
4913
|
+
description: ""
|
4914
|
+
}
|
4915
|
+
}
|
4916
|
+
]
|
4917
|
+
}
|
4918
|
+
]
|
4919
|
+
},
|
4920
|
+
{
|
4921
|
+
id: "correction-request.additional-details",
|
4922
|
+
type: PageTypes.enum.FORM,
|
4923
|
+
title: {
|
4924
|
+
id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
|
4925
|
+
defaultMessage: "Reason for correction",
|
4926
|
+
description: "This is the title of the section"
|
4927
|
+
},
|
4928
|
+
fields: [
|
4929
|
+
{
|
4930
|
+
id: "correction.request.reason",
|
4931
|
+
type: FieldType.TEXT,
|
4932
|
+
label: {
|
4933
|
+
id: "correction.reason.title",
|
4934
|
+
defaultMessage: "Reason for correction?",
|
4935
|
+
description: "The title for the corrector form"
|
4936
|
+
}
|
4937
|
+
}
|
4938
|
+
]
|
4939
|
+
}
|
4940
|
+
]
|
4941
|
+
},
|
4942
|
+
{
|
4943
|
+
type: ActionType.APPROVE_CORRECTION,
|
4944
|
+
label: {
|
4945
|
+
defaultMessage: "Approve correction",
|
4946
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4947
|
+
id: "event.tennis-club-membership.action.correction.approve.label"
|
4948
|
+
}
|
4949
|
+
},
|
4950
|
+
{
|
4951
|
+
type: ActionType.PRINT_CERTIFICATE,
|
4952
|
+
label: {
|
4953
|
+
id: "v2.event.tennis-club-membership.action.collect-certificate.label",
|
4954
|
+
defaultMessage: "Print certificate",
|
4955
|
+
description: "This is shown as the action name anywhere the user can trigger the action from"
|
4956
|
+
},
|
4957
|
+
printForm: PRINT_CERTIFICATE_FORM,
|
4958
|
+
conditionals: [
|
4959
|
+
{
|
4960
|
+
type: "SHOW",
|
4961
|
+
conditional: defineConditional({
|
4962
|
+
type: "object",
|
4963
|
+
properties: {
|
4964
|
+
$event: {
|
4965
|
+
type: "object",
|
4966
|
+
properties: {
|
4967
|
+
actions: {
|
4968
|
+
type: "array",
|
4969
|
+
contains: {
|
4970
|
+
type: "object",
|
4971
|
+
properties: {
|
4972
|
+
type: {
|
4973
|
+
const: "REGISTER"
|
4974
|
+
},
|
4975
|
+
draft: {
|
4976
|
+
type: "boolean"
|
4977
|
+
}
|
4978
|
+
},
|
4979
|
+
required: ["type"],
|
4980
|
+
not: {
|
4981
|
+
properties: {
|
4982
|
+
draft: {
|
4983
|
+
const: true
|
4984
|
+
}
|
4985
|
+
}
|
4986
|
+
}
|
4987
|
+
}
|
4988
|
+
}
|
4989
|
+
},
|
4990
|
+
required: ["actions"]
|
4991
|
+
}
|
4992
|
+
},
|
4993
|
+
required: ["$event"]
|
4994
|
+
})
|
4995
|
+
}
|
4996
|
+
]
|
4997
|
+
},
|
4998
|
+
{
|
4999
|
+
type: ActionType.ARCHIVE,
|
5000
|
+
label: {
|
5001
|
+
id: "v2.event.tennis-club-membership.action.archive.label",
|
5002
|
+
defaultMessage: "Archive",
|
5003
|
+
description: "This is shown as the action name anywhere the user can trigger the action from"
|
5004
|
+
}
|
5005
|
+
},
|
5006
|
+
{
|
5007
|
+
type: ActionType.REJECT,
|
5008
|
+
label: {
|
5009
|
+
id: "v2.event.tennis-club-membership.action.reject.label",
|
5010
|
+
defaultMessage: "Reject",
|
5011
|
+
description: "This is shown as the action name anywhere the user can trigger the action from"
|
5012
|
+
}
|
5013
|
+
}
|
5014
|
+
],
|
5015
|
+
advancedSearch: [
|
5016
|
+
{
|
3891
5017
|
title: {
|
3892
|
-
|
3893
|
-
|
3894
|
-
|
5018
|
+
defaultMessage: "Registration details",
|
5019
|
+
description: "The title of Registration details accordion",
|
5020
|
+
id: "v2.advancedSearch.form.registrationDetails"
|
3895
5021
|
},
|
3896
5022
|
fields: [
|
3897
|
-
|
3898
|
-
|
3899
|
-
|
3900
|
-
|
3901
|
-
label: {
|
3902
|
-
defaultMessage: "Senior pass ID",
|
3903
|
-
description: "This is the label for the field",
|
3904
|
-
id: "v2.event.tennis-club-membership.action.declare.form.section.senior-pass.field.id.label"
|
3905
|
-
}
|
3906
|
-
}
|
5023
|
+
event("legalStatus.REGISTERED.createdAtLocation").exact(),
|
5024
|
+
event("legalStatus.REGISTERED.createdAt").range(),
|
5025
|
+
event("status", statusOptions).exact(),
|
5026
|
+
event("updatedAt", timePeriodOptions).range()
|
3907
5027
|
]
|
3908
5028
|
},
|
3909
5029
|
{
|
3910
|
-
id: "recommender",
|
3911
5030
|
title: {
|
3912
|
-
|
3913
|
-
|
3914
|
-
|
5031
|
+
defaultMessage: "Applicant's details",
|
5032
|
+
description: "Applicant details search field section title",
|
5033
|
+
id: "v2.event.tennis-club-membership.search.applicants"
|
3915
5034
|
},
|
3916
5035
|
fields: [
|
3917
|
-
|
3918
|
-
|
3919
|
-
|
3920
|
-
required: false,
|
3921
|
-
conditionals: [],
|
3922
|
-
label: {
|
3923
|
-
defaultMessage: "No recommender",
|
3924
|
-
description: "This is the label for the field",
|
3925
|
-
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.none.label"
|
3926
|
-
}
|
3927
|
-
},
|
3928
|
-
{
|
3929
|
-
id: "recommender.firstname",
|
3930
|
-
type: FieldType.TEXT,
|
3931
|
-
required: true,
|
3932
|
-
conditionals: [
|
3933
|
-
{
|
3934
|
-
type: ConditionalType.SHOW,
|
3935
|
-
conditional: field("recommender.none").isFalsy()
|
3936
|
-
}
|
3937
|
-
],
|
3938
|
-
label: {
|
3939
|
-
defaultMessage: "Recommender's first name",
|
3940
|
-
description: "This is the label for the field",
|
3941
|
-
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.firstname.label"
|
3942
|
-
}
|
3943
|
-
},
|
3944
|
-
{
|
3945
|
-
id: "recommender.surname",
|
3946
|
-
type: FieldType.TEXT,
|
3947
|
-
required: true,
|
3948
|
-
conditionals: [
|
3949
|
-
{
|
3950
|
-
type: ConditionalType.SHOW,
|
3951
|
-
conditional: field("recommender.none").isFalsy()
|
3952
|
-
}
|
3953
|
-
],
|
3954
|
-
label: {
|
3955
|
-
defaultMessage: "Recommender's surname",
|
3956
|
-
description: "This is the label for the field",
|
3957
|
-
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.surname.label"
|
3958
|
-
}
|
3959
|
-
},
|
3960
|
-
{
|
3961
|
-
id: "recommender.id",
|
3962
|
-
type: FieldType.TEXT,
|
3963
|
-
required: true,
|
3964
|
-
conditionals: [
|
3965
|
-
{
|
3966
|
-
type: ConditionalType.SHOW,
|
3967
|
-
conditional: field("recommender.none").isFalsy()
|
3968
|
-
}
|
3969
|
-
],
|
3970
|
-
label: {
|
3971
|
-
defaultMessage: "Recommender's membership ID",
|
3972
|
-
description: "This is the label for the field",
|
3973
|
-
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.id.label"
|
3974
|
-
}
|
3975
|
-
}
|
5036
|
+
field("applicant.name").fuzzy(),
|
5037
|
+
field("applicant.dob").range(),
|
5038
|
+
field("applicant.email").exact()
|
3976
5039
|
]
|
5040
|
+
},
|
5041
|
+
{
|
5042
|
+
title: {
|
5043
|
+
defaultMessage: "Recommender's details",
|
5044
|
+
description: "Recommender details search field section title",
|
5045
|
+
id: "v2.event.tennis-club-membership.search.recommender"
|
5046
|
+
},
|
5047
|
+
fields: [field("recommender.name").fuzzy()]
|
3977
5048
|
}
|
3978
|
-
]
|
5049
|
+
],
|
5050
|
+
declaration: TENNIS_CLUB_DECLARATION_FORM
|
3979
5051
|
});
|
3980
|
-
|
3981
|
-
|
5052
|
+
|
5053
|
+
// ../commons/src/fixtures/football-club-membership-event.ts
|
5054
|
+
var footballClubMembershipEvent = defineConfig({
|
5055
|
+
id: "FOOTBALL_CLUB_MEMBERSHIP",
|
3982
5056
|
label: {
|
3983
|
-
defaultMessage: "
|
5057
|
+
defaultMessage: "Football club membership application",
|
3984
5058
|
description: "This is what this event is referred as in the system",
|
3985
|
-
id: "event.
|
5059
|
+
id: "event.football-club-membership.label"
|
3986
5060
|
},
|
3987
5061
|
title: {
|
3988
|
-
defaultMessage: "{applicant.firstname} {applicant.surname}",
|
5062
|
+
defaultMessage: "{applicant.name.firstname} {applicant.name.surname}",
|
3989
5063
|
description: "This is the title of the summary",
|
3990
|
-
id: "v2.event.
|
5064
|
+
id: "v2.event.football-club-membership.title"
|
3991
5065
|
},
|
3992
5066
|
summary: {
|
3993
5067
|
fields: [
|
3994
5068
|
{
|
3995
|
-
id: "applicant.firstname",
|
5069
|
+
id: "applicant.name.firstname",
|
3996
5070
|
label: {
|
3997
5071
|
defaultMessage: "Applicant's first name",
|
3998
5072
|
description: "This is the label for the field",
|
3999
|
-
id: "event.
|
5073
|
+
id: "event.football-club-membership.summary.field.firstname.label"
|
4000
5074
|
},
|
4001
5075
|
value: {
|
4002
|
-
defaultMessage: "{applicant.firstname}",
|
5076
|
+
defaultMessage: "{applicant.name.firstname}",
|
4003
5077
|
description: "This is the value to show in the summary",
|
4004
|
-
id: "event.
|
5078
|
+
id: "event.football-club-membership.summary.field.firstname"
|
4005
5079
|
},
|
4006
5080
|
emptyValueMessage: {
|
4007
5081
|
defaultMessage: "First name is not provided",
|
4008
5082
|
description: "This is the message to show when the field is empty",
|
4009
|
-
id: "event.
|
5083
|
+
id: "event.football-club-membership.summary.field.firstname.empty"
|
4010
5084
|
}
|
4011
5085
|
},
|
4012
5086
|
{
|
4013
|
-
|
5087
|
+
fieldId: "applicant.name.surname",
|
4014
5088
|
label: {
|
4015
5089
|
defaultMessage: "Applicant's last name",
|
4016
|
-
description: "
|
4017
|
-
id: "event.
|
4018
|
-
},
|
4019
|
-
value: {
|
4020
|
-
defaultMessage: "{applicant.surname}",
|
4021
|
-
description: "This is the value to show in the summary",
|
4022
|
-
id: "event.tennis-club-membership.summary.field.surname"
|
4023
|
-
},
|
4024
|
-
emptyValueMessage: {
|
4025
|
-
defaultMessage: "Last name is not provided",
|
4026
|
-
description: "This is the message to show when the field is empty",
|
4027
|
-
id: "event.tennis-club-membership.summary.field.surname.empty"
|
5090
|
+
description: "Label for surname",
|
5091
|
+
id: "v2.event.football-club-membership.summary.field.surname.label"
|
4028
5092
|
}
|
5093
|
+
},
|
5094
|
+
{
|
5095
|
+
fieldId: "applicant.email"
|
4029
5096
|
}
|
4030
5097
|
]
|
4031
5098
|
},
|
4032
5099
|
actions: [
|
5100
|
+
{
|
5101
|
+
type: ActionType.READ,
|
5102
|
+
label: {
|
5103
|
+
id: "v2.event.football-club-membership.action.read.label",
|
5104
|
+
defaultMessage: "Read",
|
5105
|
+
description: "Title of the read only page"
|
5106
|
+
},
|
5107
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
5108
|
+
},
|
4033
5109
|
{
|
4034
5110
|
type: ActionType.DECLARE,
|
4035
5111
|
label: {
|
4036
5112
|
defaultMessage: "Send an application",
|
4037
5113
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4038
|
-
id: "event.
|
5114
|
+
id: "event.football-club-membership.action.declare.label"
|
4039
5115
|
},
|
4040
5116
|
review: TENNIS_CLUB_DECLARATION_REVIEW
|
4041
5117
|
},
|
@@ -4044,7 +5120,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4044
5120
|
label: {
|
4045
5121
|
defaultMessage: "Validate",
|
4046
5122
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4047
|
-
id: "event.
|
5123
|
+
id: "event.football-club-membership.action.validate.label"
|
4048
5124
|
},
|
4049
5125
|
review: TENNIS_CLUB_DECLARATION_REVIEW
|
4050
5126
|
},
|
@@ -4053,7 +5129,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4053
5129
|
label: {
|
4054
5130
|
defaultMessage: "Register",
|
4055
5131
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4056
|
-
id: "event.
|
5132
|
+
id: "event.football-club-membership.action.register.label"
|
4057
5133
|
},
|
4058
5134
|
review: TENNIS_CLUB_DECLARATION_REVIEW
|
4059
5135
|
},
|
@@ -4062,14 +5138,14 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4062
5138
|
label: {
|
4063
5139
|
defaultMessage: "Request correction",
|
4064
5140
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4065
|
-
id: "event.
|
5141
|
+
id: "event.football-club-membership.action.correction.request.label"
|
4066
5142
|
},
|
4067
5143
|
onboardingForm: [
|
4068
5144
|
{
|
4069
5145
|
id: "correction-requester",
|
4070
5146
|
type: PageTypes.enum.FORM,
|
4071
5147
|
title: {
|
4072
|
-
id: "event.
|
5148
|
+
id: "event.football-club-membership.action.requestCorrection.form.section.corrector",
|
4073
5149
|
defaultMessage: "Correction requester",
|
4074
5150
|
description: "This is the title of the section"
|
4075
5151
|
},
|
@@ -4133,7 +5209,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4133
5209
|
id: "identity-check",
|
4134
5210
|
type: PageTypes.enum.FORM,
|
4135
5211
|
title: {
|
4136
|
-
id: "event.
|
5212
|
+
id: "event.football-club-membership.action.requestCorrection.form.section.verify",
|
4137
5213
|
defaultMessage: "Verify their identity",
|
4138
5214
|
description: "This is the title of the section"
|
4139
5215
|
},
|
@@ -4176,7 +5252,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4176
5252
|
id: "correction-request.supporting-documents",
|
4177
5253
|
type: PageTypes.enum.FORM,
|
4178
5254
|
title: {
|
4179
|
-
id: "event.
|
5255
|
+
id: "event.football-club-membership.action.requestCorrection.form.section.verify",
|
4180
5256
|
defaultMessage: "Upload supporting documents",
|
4181
5257
|
description: "This is the title of the section"
|
4182
5258
|
},
|
@@ -4238,7 +5314,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4238
5314
|
id: "correction-request.additional-details",
|
4239
5315
|
type: PageTypes.enum.FORM,
|
4240
5316
|
title: {
|
4241
|
-
id: "event.
|
5317
|
+
id: "event.football-club-membership.action.requestCorrection.form.section.corrector",
|
4242
5318
|
defaultMessage: "Reason for correction",
|
4243
5319
|
description: "This is the title of the section"
|
4244
5320
|
},
|
@@ -4261,13 +5337,13 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4261
5337
|
label: {
|
4262
5338
|
defaultMessage: "Approve correction",
|
4263
5339
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4264
|
-
id: "event.
|
5340
|
+
id: "event.football-club-membership.action.correction.approve.label"
|
4265
5341
|
}
|
4266
5342
|
},
|
4267
5343
|
{
|
4268
5344
|
type: ActionType.PRINT_CERTIFICATE,
|
4269
5345
|
label: {
|
4270
|
-
id: "v2.event.
|
5346
|
+
id: "v2.event.football-club-membership.action.collect-certificate.label",
|
4271
5347
|
defaultMessage: "Print certificate",
|
4272
5348
|
description: "This is shown as the action name anywhere the user can trigger the action from"
|
4273
5349
|
},
|
@@ -4315,7 +5391,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4315
5391
|
{
|
4316
5392
|
type: ActionType.ARCHIVE,
|
4317
5393
|
label: {
|
4318
|
-
id: "v2.event.
|
5394
|
+
id: "v2.event.football-club-membership.action.archive.label",
|
4319
5395
|
defaultMessage: "Archive",
|
4320
5396
|
description: "This is shown as the action name anywhere the user can trigger the action from"
|
4321
5397
|
}
|
@@ -4323,7 +5399,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4323
5399
|
{
|
4324
5400
|
type: ActionType.REJECT,
|
4325
5401
|
label: {
|
4326
|
-
id: "v2.event.
|
5402
|
+
id: "v2.event.football-club-membership.action.reject.label",
|
4327
5403
|
defaultMessage: "Reject",
|
4328
5404
|
description: "This is shown as the action name anywhere the user can trigger the action from"
|
4329
5405
|
}
|
@@ -4332,43 +5408,347 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4332
5408
|
advancedSearch: [
|
4333
5409
|
{
|
4334
5410
|
title: {
|
4335
|
-
defaultMessage: "
|
4336
|
-
description: "
|
4337
|
-
id: "v2.
|
5411
|
+
defaultMessage: "Registration details",
|
5412
|
+
description: "The title of Registration details accordion",
|
5413
|
+
id: "v2.advancedSearch.form.registrationDetails"
|
5414
|
+
},
|
5415
|
+
fields: [
|
5416
|
+
event("legalStatus.REGISTERED.createdAtLocation").exact(),
|
5417
|
+
event("legalStatus.REGISTERED.createdAt").range(),
|
5418
|
+
event("status", statusOptions).exact(),
|
5419
|
+
event("updatedAt", timePeriodOptions).range()
|
5420
|
+
]
|
5421
|
+
},
|
5422
|
+
{
|
5423
|
+
title: {
|
5424
|
+
defaultMessage: "Applicant's details",
|
5425
|
+
description: "Applicant details search field section title",
|
5426
|
+
id: "v2.event.football-club-membership.search.applicants"
|
5427
|
+
},
|
5428
|
+
fields: [
|
5429
|
+
field("applicant.name").fuzzy(),
|
5430
|
+
field("applicant.dob").range(),
|
5431
|
+
field("applicant.email").exact()
|
5432
|
+
]
|
5433
|
+
},
|
5434
|
+
{
|
5435
|
+
title: {
|
5436
|
+
defaultMessage: "Recommender's details",
|
5437
|
+
description: "Recommender details search field section title",
|
5438
|
+
id: "v2.event.football-club-membership.search.recommender"
|
4338
5439
|
},
|
4339
|
-
fields: [field("
|
5440
|
+
fields: [field("recommender.name").fuzzy()]
|
4340
5441
|
}
|
4341
5442
|
],
|
4342
5443
|
declaration: TENNIS_CLUB_DECLARATION_FORM
|
4343
5444
|
});
|
4344
5445
|
|
5446
|
+
// ../commons/src/fixtures/library-membership-event.ts
|
5447
|
+
var libraryMembershipForm = defineDeclarationForm({
|
5448
|
+
label: {
|
5449
|
+
id: "v2.event.library-membership.action.declare.form.label",
|
5450
|
+
defaultMessage: "Library membership application",
|
5451
|
+
description: "This is what this form is referred as in the system"
|
5452
|
+
},
|
5453
|
+
pages: [
|
5454
|
+
{
|
5455
|
+
id: "member",
|
5456
|
+
title: {
|
5457
|
+
id: "v2.event.library-membership.action.declare.form.section.who.title",
|
5458
|
+
defaultMessage: "Who is applying for the membership?",
|
5459
|
+
description: "This is the title of the section"
|
5460
|
+
},
|
5461
|
+
fields: [
|
5462
|
+
{
|
5463
|
+
id: "member.firstname",
|
5464
|
+
type: FieldType.TEXT,
|
5465
|
+
required: true,
|
5466
|
+
conditionals: [],
|
5467
|
+
label: {
|
5468
|
+
defaultMessage: "Member's first name",
|
5469
|
+
description: "This is the label for the field",
|
5470
|
+
id: "v2.event.library-membership.action.declare.form.section.who.field.firstname.label"
|
5471
|
+
}
|
5472
|
+
},
|
5473
|
+
{
|
5474
|
+
id: "member.surname",
|
5475
|
+
type: FieldType.TEXT,
|
5476
|
+
required: true,
|
5477
|
+
conditionals: [],
|
5478
|
+
label: {
|
5479
|
+
defaultMessage: "Member's surname",
|
5480
|
+
description: "This is the label for the field",
|
5481
|
+
id: "v2.event.library-membership.action.declare.form.section.who.field.surname.label"
|
5482
|
+
}
|
5483
|
+
}
|
5484
|
+
]
|
5485
|
+
}
|
5486
|
+
]
|
5487
|
+
});
|
5488
|
+
var libraryMembershipEvent = defineConfig({
|
5489
|
+
id: "library-membership",
|
5490
|
+
label: {
|
5491
|
+
defaultMessage: "Library membership application",
|
5492
|
+
description: "This is what this event is referred as in the system",
|
5493
|
+
id: "event.library-membership.label"
|
5494
|
+
},
|
5495
|
+
title: {
|
5496
|
+
defaultMessage: "{member.firstname} {member.surname}",
|
5497
|
+
description: "This is the title of the summary",
|
5498
|
+
id: "v2.event.library-membership.title"
|
5499
|
+
},
|
5500
|
+
summary: { fields: [] },
|
5501
|
+
actions: [],
|
5502
|
+
declaration: libraryMembershipForm
|
5503
|
+
});
|
5504
|
+
|
5505
|
+
// ../commons/src/fixtures/v2-birth-event.ts
|
5506
|
+
var child = defineFormPage({
|
5507
|
+
id: "child",
|
5508
|
+
type: PageTypes.enum.FORM,
|
5509
|
+
title: {
|
5510
|
+
defaultMessage: "Child's details",
|
5511
|
+
description: "Form section title for Child",
|
5512
|
+
id: "v2.form.birth.child.title"
|
5513
|
+
},
|
5514
|
+
fields: [
|
5515
|
+
{
|
5516
|
+
id: "child.firstNames",
|
5517
|
+
type: FieldType.TEXT,
|
5518
|
+
required: true,
|
5519
|
+
configuration: { maxLength: 32 },
|
5520
|
+
hideLabel: true,
|
5521
|
+
label: {
|
5522
|
+
defaultMessage: "Child's first name",
|
5523
|
+
description: "This is the label for the field",
|
5524
|
+
id: "v2.event.birth.action.declare.form.section.child.field.name.label"
|
5525
|
+
}
|
5526
|
+
},
|
5527
|
+
{
|
5528
|
+
id: "child.familyName",
|
5529
|
+
type: FieldType.TEXT,
|
5530
|
+
required: true,
|
5531
|
+
configuration: { maxLength: 32 },
|
5532
|
+
hideLabel: true,
|
5533
|
+
label: {
|
5534
|
+
defaultMessage: "Child's last name",
|
5535
|
+
description: "This is the label for the field",
|
5536
|
+
id: "v2.event.birth.action.declare.form.section.child.field.name.label"
|
5537
|
+
}
|
5538
|
+
},
|
5539
|
+
{
|
5540
|
+
id: "child.DoB",
|
5541
|
+
type: "DATE",
|
5542
|
+
required: true,
|
5543
|
+
label: {
|
5544
|
+
defaultMessage: "Date of birth",
|
5545
|
+
description: "This is the label for the field",
|
5546
|
+
id: "v2.event.birth.action.declare.form.section.child.field.dob.label"
|
5547
|
+
}
|
5548
|
+
}
|
5549
|
+
]
|
5550
|
+
});
|
5551
|
+
var mother = defineFormPage({
|
5552
|
+
id: "mother",
|
5553
|
+
type: PageTypes.enum.FORM,
|
5554
|
+
title: {
|
5555
|
+
defaultMessage: "Mother's details",
|
5556
|
+
description: "Form section title for mothers details",
|
5557
|
+
id: "v2.form.section.mother.title"
|
5558
|
+
},
|
5559
|
+
fields: [
|
5560
|
+
{
|
5561
|
+
id: "mother.firstNames",
|
5562
|
+
configuration: { maxLength: 32 },
|
5563
|
+
type: FieldType.TEXT,
|
5564
|
+
required: true,
|
5565
|
+
label: {
|
5566
|
+
defaultMessage: "First name(s)",
|
5567
|
+
description: "This is the label for the field",
|
5568
|
+
id: `v2.event.birth.action.declare.form.section.person.field.firstname.label`
|
5569
|
+
}
|
5570
|
+
},
|
5571
|
+
{
|
5572
|
+
id: `mother.familyName`,
|
5573
|
+
configuration: { maxLength: 32 },
|
5574
|
+
type: FieldType.TEXT,
|
5575
|
+
required: true,
|
5576
|
+
label: {
|
5577
|
+
defaultMessage: "Last name",
|
5578
|
+
description: "This is the label for the field",
|
5579
|
+
id: `v2.event.birth.action.declare.form.section.person.field.surname.label`
|
5580
|
+
}
|
5581
|
+
},
|
5582
|
+
{
|
5583
|
+
id: `mother.DoB`,
|
5584
|
+
type: "DATE",
|
5585
|
+
required: true,
|
5586
|
+
label: {
|
5587
|
+
defaultMessage: "Date of birth",
|
5588
|
+
description: "This is the label for the field",
|
5589
|
+
id: `v2.event.birth.action.declare.form.section.person.field.dob.label`
|
5590
|
+
}
|
5591
|
+
},
|
5592
|
+
{
|
5593
|
+
id: "mother.identifier",
|
5594
|
+
type: FieldType.ID,
|
5595
|
+
required: true,
|
5596
|
+
label: {
|
5597
|
+
defaultMessage: "ID Number",
|
5598
|
+
description: "This is the label for the field",
|
5599
|
+
id: `v2.event.birth.action.declare.form.section.person.field.nid.label`
|
5600
|
+
}
|
5601
|
+
}
|
5602
|
+
]
|
5603
|
+
});
|
5604
|
+
var BIRTH_DECLARATION_FORM = defineDeclarationForm({
|
5605
|
+
label: {
|
5606
|
+
defaultMessage: "Birth decalration form",
|
5607
|
+
id: "v2.event.birth.action.declare.form.label",
|
5608
|
+
description: "This is what this form is referred as in the system"
|
5609
|
+
},
|
5610
|
+
pages: [child, mother]
|
5611
|
+
});
|
5612
|
+
var v2BirthEvent = defineConfig({
|
5613
|
+
id: BIRTH_EVENT,
|
5614
|
+
title: {
|
5615
|
+
defaultMessage: "{child.name.firstname} {child.name.surname}",
|
5616
|
+
description: "This is the title of the summary",
|
5617
|
+
id: "v2.event.birth.title"
|
5618
|
+
},
|
5619
|
+
label: {
|
5620
|
+
defaultMessage: "Birth",
|
5621
|
+
description: "This is what this event is referred as in the system",
|
5622
|
+
id: "v2.event.birth.label"
|
5623
|
+
},
|
5624
|
+
summary: {
|
5625
|
+
fields: []
|
5626
|
+
},
|
5627
|
+
actions: [],
|
5628
|
+
declaration: BIRTH_DECLARATION_FORM
|
5629
|
+
});
|
5630
|
+
|
4345
5631
|
// ../commons/src/events/test.utils.ts
|
4346
|
-
function
|
5632
|
+
function pickRandom(rng, items) {
|
5633
|
+
return items[Math.floor(rng() * items.length)];
|
5634
|
+
}
|
5635
|
+
function generateRandomName(rng) {
|
5636
|
+
const firstnames = [
|
5637
|
+
"Danny",
|
5638
|
+
"John",
|
5639
|
+
"Jane",
|
5640
|
+
"Emily",
|
5641
|
+
"Michael",
|
5642
|
+
"Sarah",
|
5643
|
+
"Chris",
|
5644
|
+
"Jessica",
|
5645
|
+
"Sara",
|
5646
|
+
"Sarachella",
|
5647
|
+
"Sarandera",
|
5648
|
+
"Zara"
|
5649
|
+
];
|
5650
|
+
const surnames = [
|
5651
|
+
"Doe",
|
5652
|
+
"Smith",
|
5653
|
+
"Johnson",
|
5654
|
+
"Brown",
|
5655
|
+
"Williams",
|
5656
|
+
"Jones",
|
5657
|
+
"Garcia",
|
5658
|
+
"Miller",
|
5659
|
+
"Saranen",
|
5660
|
+
"Sarajanen",
|
5661
|
+
"Sarthua",
|
5662
|
+
"Tsarakovski",
|
5663
|
+
"Salamander",
|
5664
|
+
"Zarathustra"
|
5665
|
+
];
|
5666
|
+
return {
|
5667
|
+
firstname: pickRandom(rng, firstnames),
|
5668
|
+
surname: pickRandom(rng, surnames)
|
5669
|
+
};
|
5670
|
+
}
|
5671
|
+
function mapFieldTypeToMockValue(field2, i, rng) {
|
5672
|
+
switch (field2.type) {
|
5673
|
+
case FieldType.DIVIDER:
|
5674
|
+
case FieldType.TEXT:
|
5675
|
+
case FieldType.TEXTAREA:
|
5676
|
+
case FieldType.BULLET_LIST:
|
5677
|
+
case FieldType.PAGE_HEADER:
|
5678
|
+
case FieldType.LOCATION:
|
5679
|
+
case FieldType.SELECT:
|
5680
|
+
case FieldType.COUNTRY:
|
5681
|
+
case FieldType.RADIO_GROUP:
|
5682
|
+
case FieldType.PARAGRAPH:
|
5683
|
+
case FieldType.ADMINISTRATIVE_AREA:
|
5684
|
+
case FieldType.FACILITY:
|
5685
|
+
case FieldType.PHONE:
|
5686
|
+
case FieldType.ID:
|
5687
|
+
case FieldType.OFFICE:
|
5688
|
+
return `${field2.id}-${field2.type}-${i}`;
|
5689
|
+
case FieldType.NAME:
|
5690
|
+
return generateRandomName(rng);
|
5691
|
+
case FieldType.NUMBER:
|
5692
|
+
return 19;
|
5693
|
+
case FieldType.EMAIL:
|
5694
|
+
return "test@opencrvs.org";
|
5695
|
+
case FieldType.ADDRESS:
|
5696
|
+
return {
|
5697
|
+
country: "FAR",
|
5698
|
+
addressType: AddressType.DOMESTIC,
|
5699
|
+
province: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
5700
|
+
district: "5ef450bc-712d-48ad-93f3-8da0fa453baa",
|
5701
|
+
urbanOrRural: "URBAN",
|
5702
|
+
town: "Example Town",
|
5703
|
+
residentialArea: "Example Residential Area",
|
5704
|
+
street: "Example Street",
|
5705
|
+
number: "55",
|
5706
|
+
zipCode: "123456"
|
5707
|
+
};
|
5708
|
+
case FieldType.DATE:
|
5709
|
+
return "2021-01-01";
|
5710
|
+
case FieldType.DATE_RANGE:
|
5711
|
+
return ["2021-01-01", "2021-01-02"];
|
5712
|
+
case FieldType.CHECKBOX:
|
5713
|
+
return true;
|
5714
|
+
case FieldType.SIGNATURE:
|
5715
|
+
case FieldType.FILE:
|
5716
|
+
return {
|
5717
|
+
filename: "4f095fc4-4312-4de2-aa38-86dcc0f71044.png",
|
5718
|
+
originalFilename: "abcd.png",
|
5719
|
+
type: "image/png"
|
5720
|
+
};
|
5721
|
+
case FieldType.FILE_WITH_OPTIONS:
|
5722
|
+
case FieldType.DATA:
|
5723
|
+
return void 0;
|
5724
|
+
}
|
5725
|
+
}
|
5726
|
+
function fieldConfigsToActionPayload(fields, rng) {
|
4347
5727
|
return fields.reduce(
|
4348
5728
|
(acc, field2, i) => ({
|
4349
5729
|
...acc,
|
4350
|
-
[field2.id]: mapFieldTypeToMockValue(field2, i)
|
5730
|
+
[field2.id]: mapFieldTypeToMockValue(field2, i, rng)
|
4351
5731
|
}),
|
4352
5732
|
{}
|
4353
5733
|
);
|
4354
5734
|
}
|
4355
|
-
function generateActionDeclarationInput(configuration, action) {
|
5735
|
+
function generateActionDeclarationInput(configuration, action, rng) {
|
4356
5736
|
const parsed = DeclarationUpdateActions.safeParse(action);
|
4357
5737
|
if (parsed.success) {
|
4358
5738
|
const fields = getDeclarationFields(configuration);
|
4359
5739
|
const declarationConfig = getDeclaration(configuration);
|
4360
|
-
const declaration = fieldConfigsToActionPayload(fields);
|
5740
|
+
const declaration = fieldConfigsToActionPayload(fields, rng);
|
4361
5741
|
return omitHiddenPaginatedFields(declarationConfig, declaration);
|
4362
5742
|
}
|
4363
5743
|
console.warn(`${action} is not a declaration action. Setting data as {}.`);
|
4364
5744
|
return {};
|
4365
5745
|
}
|
4366
|
-
function generateActionAnnotationInput(configuration, action) {
|
5746
|
+
function generateActionAnnotationInput(configuration, action, rng) {
|
4367
5747
|
const actionConfig = configuration.actions.find(
|
4368
5748
|
(ac) => ac.type === action
|
4369
5749
|
);
|
4370
5750
|
const annotationFields = actionConfig ? getActionAnnotationFields(actionConfig) : [];
|
4371
|
-
const annotation = fieldConfigsToActionPayload(annotationFields);
|
5751
|
+
const annotation = fieldConfigsToActionPayload(annotationFields, rng);
|
4372
5752
|
const visibleVerificationPageIds = getVisibleVerificationPageIds(
|
4373
5753
|
findRecordActionPages(configuration, action),
|
4374
5754
|
annotation
|
@@ -4386,193 +5766,226 @@ function generateActionAnnotationInput(configuration, action) {
|
|
4386
5766
|
...visiblePageVerificationMap
|
4387
5767
|
};
|
4388
5768
|
}
|
4389
|
-
|
4390
|
-
|
4391
|
-
|
4392
|
-
type: input.type ?? "TENNIS_CLUB_MEMBERSHIP"
|
4393
|
-
}),
|
4394
|
-
patch: (id, input = {}) => ({
|
4395
|
-
transactionId: input.transactionId ?? getUUID(),
|
4396
|
-
type: input.type ?? "TENNIS_CLUB_MEMBERSHIP",
|
4397
|
-
id
|
4398
|
-
}),
|
4399
|
-
draft: ({ eventId, actionType }, input = {}) => (0, import_lodash2.merge)(
|
4400
|
-
{
|
4401
|
-
id: getUUID(),
|
4402
|
-
eventId,
|
4403
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
4404
|
-
transactionId: getUUID(),
|
4405
|
-
action: {
|
4406
|
-
transactionId: getUUID(),
|
4407
|
-
type: actionType,
|
4408
|
-
status: ActionStatus.Accepted,
|
4409
|
-
declaration: {
|
4410
|
-
"applicant.firstname": "Max",
|
4411
|
-
"applicant.surname": "McLaren",
|
4412
|
-
"applicant.dob": "2020-01-02",
|
4413
|
-
"recommender.none": true
|
4414
|
-
},
|
4415
|
-
annotation: {
|
4416
|
-
"correction.requester.relationship": "ANOTHER_AGENT",
|
4417
|
-
"correction.request.reason": "Child's name was incorrect"
|
4418
|
-
},
|
4419
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
4420
|
-
createdBy: "@todo",
|
4421
|
-
createdByRole: "@todo",
|
4422
|
-
createdAtLocation: "@todo"
|
4423
|
-
}
|
4424
|
-
},
|
4425
|
-
input
|
4426
|
-
),
|
4427
|
-
actions: {
|
4428
|
-
declare: (eventId, input = {}) => ({
|
4429
|
-
type: ActionType.DECLARE,
|
4430
|
-
transactionId: input.transactionId ?? getUUID(),
|
4431
|
-
declaration: input.declaration ?? generateActionDeclarationInput(
|
4432
|
-
tennisClubMembershipEvent,
|
4433
|
-
ActionType.DECLARE
|
4434
|
-
),
|
4435
|
-
annotation: input.annotation ?? generateActionAnnotationInput(
|
4436
|
-
tennisClubMembershipEvent,
|
4437
|
-
ActionType.DECLARE
|
4438
|
-
),
|
4439
|
-
eventId
|
4440
|
-
}),
|
4441
|
-
/**
|
4442
|
-
* Notify allows sending incomplete data. Think it as 'partial declare' for now.
|
4443
|
-
*/
|
4444
|
-
notify: (eventId, input = {}) => {
|
4445
|
-
let declaration = input.declaration;
|
4446
|
-
if (!declaration) {
|
4447
|
-
const partialDeclaration = (0, import_lodash2.omitBy)(
|
4448
|
-
generateActionDeclarationInput(
|
4449
|
-
tennisClubMembershipEvent,
|
4450
|
-
ActionType.DECLARE
|
4451
|
-
),
|
4452
|
-
import_lodash2.isString
|
4453
|
-
);
|
4454
|
-
declaration = partialDeclaration;
|
4455
|
-
}
|
4456
|
-
return {
|
4457
|
-
type: ActionType.NOTIFY,
|
4458
|
-
transactionId: input.transactionId ?? getUUID(),
|
4459
|
-
declaration,
|
4460
|
-
eventId
|
4461
|
-
};
|
4462
|
-
},
|
4463
|
-
validate: (eventId, input = {}) => ({
|
4464
|
-
type: ActionType.VALIDATE,
|
4465
|
-
transactionId: input.transactionId ?? getUUID(),
|
4466
|
-
declaration: input.declaration ?? generateActionDeclarationInput(
|
4467
|
-
tennisClubMembershipEvent,
|
4468
|
-
ActionType.VALIDATE
|
4469
|
-
),
|
4470
|
-
annotation: input.annotation ?? generateActionAnnotationInput(
|
4471
|
-
tennisClubMembershipEvent,
|
4472
|
-
ActionType.VALIDATE
|
4473
|
-
),
|
4474
|
-
duplicates: [],
|
4475
|
-
eventId
|
4476
|
-
}),
|
4477
|
-
assign: (eventId, input = {}) => ({
|
4478
|
-
type: ActionType.ASSIGN,
|
4479
|
-
transactionId: input.transactionId ?? getUUID(),
|
4480
|
-
declaration: {},
|
4481
|
-
assignedTo: input.assignedTo ?? getUUID(),
|
4482
|
-
eventId
|
4483
|
-
}),
|
4484
|
-
unassign: (eventId, input = {}) => ({
|
4485
|
-
type: ActionType.UNASSIGN,
|
4486
|
-
transactionId: input.transactionId ?? getUUID(),
|
4487
|
-
declaration: {},
|
4488
|
-
assignedTo: null,
|
4489
|
-
eventId
|
4490
|
-
}),
|
4491
|
-
archive: (eventId, input = {}, isDuplicate) => ({
|
4492
|
-
type: ActionType.ARCHIVE,
|
4493
|
-
transactionId: input.transactionId ?? getUUID(),
|
4494
|
-
declaration: {},
|
4495
|
-
// @TODO: Check whether generator is needed?
|
4496
|
-
annotation: { isDuplicate: isDuplicate ?? false },
|
4497
|
-
duplicates: [],
|
4498
|
-
eventId
|
4499
|
-
}),
|
4500
|
-
reject: (eventId, input = {}) => ({
|
4501
|
-
type: ActionType.REJECT,
|
4502
|
-
transactionId: input.transactionId ?? getUUID(),
|
4503
|
-
declaration: {},
|
4504
|
-
annotation: input.annotation ?? generateActionAnnotationInput(
|
4505
|
-
tennisClubMembershipEvent,
|
4506
|
-
ActionType.REJECT
|
4507
|
-
),
|
4508
|
-
duplicates: [],
|
4509
|
-
eventId
|
4510
|
-
}),
|
4511
|
-
register: (eventId, input = {}) => ({
|
4512
|
-
type: ActionType.REGISTER,
|
5769
|
+
function eventPayloadGenerator(rng) {
|
5770
|
+
return {
|
5771
|
+
create: (input = {}) => ({
|
4513
5772
|
transactionId: input.transactionId ?? getUUID(),
|
4514
|
-
|
4515
|
-
tennisClubMembershipEvent,
|
4516
|
-
ActionType.REGISTER
|
4517
|
-
),
|
4518
|
-
annotation: input.annotation ?? generateActionAnnotationInput(
|
4519
|
-
tennisClubMembershipEvent,
|
4520
|
-
ActionType.REGISTER
|
4521
|
-
),
|
4522
|
-
eventId
|
5773
|
+
type: input.type ?? TENNIS_CLUB_MEMBERSHIP
|
4523
5774
|
}),
|
4524
|
-
|
4525
|
-
type: ActionType.PRINT_CERTIFICATE,
|
5775
|
+
patch: (id, input = {}) => ({
|
4526
5776
|
transactionId: input.transactionId ?? getUUID(),
|
4527
|
-
|
4528
|
-
|
4529
|
-
tennisClubMembershipEvent,
|
4530
|
-
ActionType.PRINT_CERTIFICATE
|
4531
|
-
),
|
4532
|
-
eventId
|
5777
|
+
type: input.type ?? TENNIS_CLUB_MEMBERSHIP,
|
5778
|
+
id
|
4533
5779
|
}),
|
4534
|
-
|
4535
|
-
|
4536
|
-
|
5780
|
+
draft: ({ eventId, actionType }, input = {}) => (0, import_lodash2.merge)(
|
5781
|
+
{
|
5782
|
+
id: getUUID(),
|
5783
|
+
eventId,
|
5784
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
5785
|
+
transactionId: getUUID(),
|
5786
|
+
action: {
|
5787
|
+
transactionId: getUUID(),
|
5788
|
+
type: actionType,
|
5789
|
+
status: ActionStatus.Accepted,
|
5790
|
+
declaration: {
|
5791
|
+
"applicant.name": {
|
5792
|
+
firstname: "Max",
|
5793
|
+
surname: "McLaren"
|
5794
|
+
},
|
5795
|
+
"applicant.dob": "2020-01-02",
|
5796
|
+
"recommender.none": true
|
5797
|
+
},
|
5798
|
+
annotation: {
|
5799
|
+
"correction.requester.relationship": "ANOTHER_AGENT",
|
5800
|
+
"correction.request.reason": "Child's name was incorrect"
|
5801
|
+
},
|
5802
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
5803
|
+
createdBy: "@todo",
|
5804
|
+
createdByRole: "@todo",
|
5805
|
+
createdAtLocation: "@todo"
|
5806
|
+
}
|
5807
|
+
},
|
5808
|
+
input
|
5809
|
+
),
|
5810
|
+
actions: {
|
5811
|
+
declare: (eventId, input = {}) => ({
|
5812
|
+
type: ActionType.DECLARE,
|
5813
|
+
transactionId: input.transactionId ?? getUUID(),
|
5814
|
+
declaration: input.declaration ?? generateActionDeclarationInput(
|
5815
|
+
tennisClubMembershipEvent,
|
5816
|
+
ActionType.DECLARE,
|
5817
|
+
rng
|
5818
|
+
),
|
5819
|
+
annotation: input.annotation ?? generateActionAnnotationInput(
|
5820
|
+
tennisClubMembershipEvent,
|
5821
|
+
ActionType.DECLARE,
|
5822
|
+
rng
|
5823
|
+
),
|
5824
|
+
eventId,
|
5825
|
+
...input
|
5826
|
+
}),
|
5827
|
+
/**
|
5828
|
+
* Notify allows sending incomplete data. Think it as 'partial declare' for now.
|
5829
|
+
*/
|
5830
|
+
notify: (eventId, input = {}) => {
|
5831
|
+
let declaration = input.declaration;
|
5832
|
+
if (!declaration) {
|
5833
|
+
const partialDeclaration = (0, import_lodash2.omitBy)(
|
5834
|
+
generateActionDeclarationInput(
|
5835
|
+
tennisClubMembershipEvent,
|
5836
|
+
ActionType.DECLARE,
|
5837
|
+
rng
|
5838
|
+
),
|
5839
|
+
import_lodash2.isString
|
5840
|
+
);
|
5841
|
+
declaration = partialDeclaration;
|
5842
|
+
}
|
5843
|
+
return {
|
5844
|
+
type: ActionType.NOTIFY,
|
5845
|
+
transactionId: input.transactionId ?? getUUID(),
|
5846
|
+
declaration,
|
5847
|
+
eventId,
|
5848
|
+
keepAssignment: input.keepAssignment
|
5849
|
+
};
|
5850
|
+
},
|
5851
|
+
validate: (eventId, input = {}) => ({
|
5852
|
+
type: ActionType.VALIDATE,
|
4537
5853
|
transactionId: input.transactionId ?? getUUID(),
|
4538
5854
|
declaration: input.declaration ?? generateActionDeclarationInput(
|
4539
5855
|
tennisClubMembershipEvent,
|
4540
|
-
ActionType.
|
5856
|
+
ActionType.VALIDATE,
|
5857
|
+
rng
|
4541
5858
|
),
|
4542
5859
|
annotation: input.annotation ?? generateActionAnnotationInput(
|
4543
5860
|
tennisClubMembershipEvent,
|
4544
|
-
ActionType.
|
5861
|
+
ActionType.VALIDATE,
|
5862
|
+
rng
|
4545
5863
|
),
|
5864
|
+
duplicates: [],
|
5865
|
+
eventId,
|
5866
|
+
...input
|
5867
|
+
}),
|
5868
|
+
assign: (eventId, input = {}) => ({
|
5869
|
+
type: ActionType.ASSIGN,
|
5870
|
+
transactionId: input.transactionId ?? getUUID(),
|
5871
|
+
declaration: {},
|
5872
|
+
assignedTo: input.assignedTo ?? getUUID(),
|
5873
|
+
eventId
|
5874
|
+
}),
|
5875
|
+
unassign: (eventId, input = {}) => ({
|
5876
|
+
type: ActionType.UNASSIGN,
|
5877
|
+
transactionId: input.transactionId ?? getUUID(),
|
5878
|
+
declaration: {},
|
5879
|
+
assignedTo: null,
|
4546
5880
|
eventId
|
4547
5881
|
}),
|
4548
|
-
|
4549
|
-
type: ActionType.
|
5882
|
+
archive: (eventId, input = {}, isDuplicate) => ({
|
5883
|
+
type: ActionType.ARCHIVE,
|
5884
|
+
transactionId: input.transactionId ?? getUUID(),
|
5885
|
+
declaration: {},
|
5886
|
+
// @TODO: Check whether generator is needed?
|
5887
|
+
annotation: {},
|
5888
|
+
duplicates: [],
|
5889
|
+
eventId,
|
5890
|
+
reason: {
|
5891
|
+
message: `${ActionType.ARCHIVE}`,
|
5892
|
+
isDuplicate: isDuplicate ?? false
|
5893
|
+
},
|
5894
|
+
...input
|
5895
|
+
}),
|
5896
|
+
reject: (eventId, input = {}) => ({
|
5897
|
+
type: ActionType.REJECT,
|
4550
5898
|
transactionId: input.transactionId ?? getUUID(),
|
4551
5899
|
declaration: {},
|
4552
5900
|
annotation: input.annotation ?? generateActionAnnotationInput(
|
4553
5901
|
tennisClubMembershipEvent,
|
4554
|
-
ActionType.
|
5902
|
+
ActionType.REJECT,
|
5903
|
+
rng
|
5904
|
+
),
|
5905
|
+
duplicates: [],
|
5906
|
+
eventId,
|
5907
|
+
reason: { message: `${ActionType.REJECT}` },
|
5908
|
+
...input
|
5909
|
+
}),
|
5910
|
+
register: (eventId, input = {}) => ({
|
5911
|
+
type: ActionType.REGISTER,
|
5912
|
+
transactionId: input.transactionId ?? getUUID(),
|
5913
|
+
declaration: input.declaration ?? generateActionDeclarationInput(
|
5914
|
+
tennisClubMembershipEvent,
|
5915
|
+
ActionType.REGISTER,
|
5916
|
+
rng
|
5917
|
+
),
|
5918
|
+
annotation: input.annotation ?? generateActionAnnotationInput(
|
5919
|
+
tennisClubMembershipEvent,
|
5920
|
+
ActionType.REGISTER,
|
5921
|
+
rng
|
4555
5922
|
),
|
4556
5923
|
eventId,
|
4557
|
-
|
5924
|
+
...input
|
4558
5925
|
}),
|
4559
|
-
|
4560
|
-
type: ActionType.
|
5926
|
+
printCertificate: (eventId, input = {}) => ({
|
5927
|
+
type: ActionType.PRINT_CERTIFICATE,
|
4561
5928
|
transactionId: input.transactionId ?? getUUID(),
|
4562
5929
|
declaration: {},
|
4563
5930
|
annotation: input.annotation ?? generateActionAnnotationInput(
|
4564
5931
|
tennisClubMembershipEvent,
|
4565
|
-
ActionType.
|
5932
|
+
ActionType.PRINT_CERTIFICATE,
|
5933
|
+
rng
|
4566
5934
|
),
|
4567
5935
|
eventId,
|
4568
|
-
|
4569
|
-
})
|
5936
|
+
...input
|
5937
|
+
}),
|
5938
|
+
correction: {
|
5939
|
+
request: (eventId, input = {}) => ({
|
5940
|
+
type: ActionType.REQUEST_CORRECTION,
|
5941
|
+
transactionId: input.transactionId ?? getUUID(),
|
5942
|
+
declaration: input.declaration ?? generateActionDeclarationInput(
|
5943
|
+
tennisClubMembershipEvent,
|
5944
|
+
ActionType.REQUEST_CORRECTION,
|
5945
|
+
rng
|
5946
|
+
),
|
5947
|
+
annotation: input.annotation ?? generateActionAnnotationInput(
|
5948
|
+
tennisClubMembershipEvent,
|
5949
|
+
ActionType.REQUEST_CORRECTION,
|
5950
|
+
rng
|
5951
|
+
),
|
5952
|
+
eventId,
|
5953
|
+
keepAssignment: input.keepAssignment
|
5954
|
+
}),
|
5955
|
+
approve: (eventId, requestId, input = {}) => ({
|
5956
|
+
type: ActionType.APPROVE_CORRECTION,
|
5957
|
+
transactionId: input.transactionId ?? getUUID(),
|
5958
|
+
declaration: {},
|
5959
|
+
annotation: input.annotation ?? generateActionAnnotationInput(
|
5960
|
+
tennisClubMembershipEvent,
|
5961
|
+
ActionType.APPROVE_CORRECTION,
|
5962
|
+
rng
|
5963
|
+
),
|
5964
|
+
eventId,
|
5965
|
+
requestId,
|
5966
|
+
keepAssignment: input.keepAssignment
|
5967
|
+
}),
|
5968
|
+
reject: (eventId, requestId, input = {}) => ({
|
5969
|
+
type: ActionType.REJECT_CORRECTION,
|
5970
|
+
transactionId: input.transactionId ?? getUUID(),
|
5971
|
+
declaration: {},
|
5972
|
+
annotation: input.annotation ?? generateActionAnnotationInput(
|
5973
|
+
tennisClubMembershipEvent,
|
5974
|
+
ActionType.REJECT_CORRECTION,
|
5975
|
+
rng
|
5976
|
+
),
|
5977
|
+
eventId,
|
5978
|
+
requestId,
|
5979
|
+
keepAssignment: input.keepAssignment
|
5980
|
+
})
|
5981
|
+
}
|
4570
5982
|
}
|
4571
|
-
}
|
4572
|
-
}
|
5983
|
+
};
|
5984
|
+
}
|
4573
5985
|
function generateActionDocument({
|
4574
5986
|
configuration,
|
4575
5987
|
action,
|
5988
|
+
rng = () => 0.1,
|
4576
5989
|
defaults = {}
|
4577
5990
|
}) {
|
4578
5991
|
const actionBase = {
|
@@ -4583,7 +5996,7 @@ function generateActionDocument({
|
|
4583
5996
|
createdByRole: "FIELD_AGENT",
|
4584
5997
|
id: getUUID(),
|
4585
5998
|
createdAtLocation: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
4586
|
-
declaration: generateActionDeclarationInput(configuration, action),
|
5999
|
+
declaration: generateActionDeclarationInput(configuration, action, rng),
|
4587
6000
|
annotation: {},
|
4588
6001
|
status: ActionStatus.Accepted,
|
4589
6002
|
transactionId: getUUID(),
|
@@ -4603,9 +6016,9 @@ function generateActionDocument({
|
|
4603
6016
|
case ActionType.VALIDATE:
|
4604
6017
|
return { ...actionBase, type: action };
|
4605
6018
|
case ActionType.ARCHIVE:
|
4606
|
-
return { ...actionBase, type: action };
|
6019
|
+
return { ...actionBase, type: action, reason: { message: "Archive" } };
|
4607
6020
|
case ActionType.REJECT:
|
4608
|
-
return { ...actionBase, type: action };
|
6021
|
+
return { ...actionBase, type: action, reason: { message: "Reject" } };
|
4609
6022
|
case ActionType.CREATE:
|
4610
6023
|
return { ...actionBase, type: action };
|
4611
6024
|
case ActionType.NOTIFY:
|
@@ -4617,7 +6030,11 @@ function generateActionDocument({
|
|
4617
6030
|
case ActionType.APPROVE_CORRECTION:
|
4618
6031
|
return { ...actionBase, requestId: getUUID(), type: action };
|
4619
6032
|
case ActionType.REJECT_CORRECTION:
|
4620
|
-
return {
|
6033
|
+
return {
|
6034
|
+
...actionBase,
|
6035
|
+
requestId: getUUID(),
|
6036
|
+
type: action
|
6037
|
+
};
|
4621
6038
|
case ActionType.REGISTER:
|
4622
6039
|
return {
|
4623
6040
|
...actionBase,
|
@@ -4631,13 +6048,14 @@ function generateActionDocument({
|
|
4631
6048
|
}
|
4632
6049
|
function generateEventDocument({
|
4633
6050
|
configuration,
|
4634
|
-
actions
|
6051
|
+
actions,
|
6052
|
+
rng = () => 0.1
|
4635
6053
|
}) {
|
4636
6054
|
return {
|
4637
6055
|
trackingId: getUUID(),
|
4638
6056
|
type: configuration.id,
|
4639
6057
|
actions: actions.map(
|
4640
|
-
(action) => generateActionDocument({ configuration, action })
|
6058
|
+
(action) => generateActionDocument({ configuration, action, rng })
|
4641
6059
|
),
|
4642
6060
|
// Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
|
4643
6061
|
// @TODO: This should be fixed in the future.
|
@@ -4645,14 +6063,19 @@ function generateEventDocument({
|
|
4645
6063
|
id: getUUID(),
|
4646
6064
|
// Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
|
4647
6065
|
// @TODO: This should be fixed in the future.
|
4648
|
-
updatedAt: new Date(Date.now() - 1e3).toISOString()
|
4649
|
-
dateOfEvent: configuration.dateOfEvent
|
6066
|
+
updatedAt: new Date(Date.now() - 1e3).toISOString()
|
4650
6067
|
};
|
4651
6068
|
}
|
4652
|
-
function generateEventDraftDocument(
|
6069
|
+
function generateEventDraftDocument({
|
6070
|
+
eventId,
|
6071
|
+
actionType,
|
6072
|
+
rng = () => 0.1,
|
6073
|
+
declaration = {}
|
6074
|
+
}) {
|
4653
6075
|
const action = generateActionDocument({
|
4654
6076
|
configuration: tennisClubMembershipEvent,
|
4655
|
-
action: actionType
|
6077
|
+
action: actionType,
|
6078
|
+
rng
|
4656
6079
|
});
|
4657
6080
|
return {
|
4658
6081
|
id: getUUID(),
|
@@ -4668,82 +6091,106 @@ function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE, de
|
|
4668
6091
|
eventId
|
4669
6092
|
};
|
4670
6093
|
}
|
4671
|
-
function
|
4672
|
-
const
|
4673
|
-
|
4674
|
-
|
4675
|
-
|
4676
|
-
];
|
4677
|
-
const randomIndex = Math.floor(Math.random() * 3);
|
4678
|
-
return statuses[randomIndex];
|
6094
|
+
function getRandomDatetime(rng, start, end) {
|
6095
|
+
const range = end.getTime() - start.getTime();
|
6096
|
+
const offset = Math.floor(rng() * range);
|
6097
|
+
const randomDate = new Date(start.getTime() + offset);
|
6098
|
+
return randomDate.toISOString();
|
4679
6099
|
}
|
4680
|
-
function
|
4681
|
-
const
|
4682
|
-
|
4683
|
-
return trackingId;
|
6100
|
+
function getRandomDate(rng, start, end) {
|
6101
|
+
const datetime = getRandomDatetime(rng, new Date(start), new Date(end));
|
6102
|
+
return datetime.split("T")[0];
|
4684
6103
|
}
|
4685
|
-
function
|
4686
|
-
const
|
4687
|
-
|
4688
|
-
"John",
|
4689
|
-
"Jane",
|
4690
|
-
"Emily",
|
4691
|
-
"Michael",
|
4692
|
-
"Sarah",
|
4693
|
-
"Chris",
|
4694
|
-
"Jessica"
|
4695
|
-
];
|
4696
|
-
const surnames = [
|
4697
|
-
"Doe",
|
4698
|
-
"Smith",
|
4699
|
-
"Johnson",
|
4700
|
-
"Brown",
|
4701
|
-
"Williams",
|
4702
|
-
"Jones",
|
4703
|
-
"Garcia",
|
4704
|
-
"Miller"
|
4705
|
-
];
|
4706
|
-
function getRandomDate(start, end) {
|
4707
|
-
const randomDate = new Date(
|
4708
|
-
start.getTime() + Math.random() * (end.getTime() - start.getTime())
|
4709
|
-
);
|
4710
|
-
return randomDate.toISOString().split("T")[0];
|
4711
|
-
}
|
4712
|
-
const randomFirstName = firstNames[Math.floor(Math.random() * firstNames.length)];
|
4713
|
-
const randomSurname = surnames[Math.floor(Math.random() * surnames.length)];
|
4714
|
-
const randomDob = getRandomDate(
|
4715
|
-
/* @__PURE__ */ new Date("1990-01-01"),
|
4716
|
-
/* @__PURE__ */ new Date("2010-12-31")
|
4717
|
-
);
|
6104
|
+
function generateRandomApplicant(rng) {
|
6105
|
+
const { firstname, surname } = generateRandomName(rng);
|
6106
|
+
const randomDob = getRandomDate(rng, "1990-01-01", "2010-12-31");
|
4718
6107
|
return {
|
4719
6108
|
"recommender.none": true,
|
4720
|
-
"applicant.
|
4721
|
-
|
6109
|
+
"applicant.name": {
|
6110
|
+
firstname,
|
6111
|
+
surname
|
6112
|
+
},
|
4722
6113
|
"applicant.dob": randomDob
|
4723
6114
|
};
|
4724
6115
|
}
|
4725
|
-
|
4726
|
-
|
4727
|
-
|
4728
|
-
|
4729
|
-
|
4730
|
-
|
4731
|
-
|
4732
|
-
|
4733
|
-
|
4734
|
-
|
4735
|
-
|
4736
|
-
|
4737
|
-
|
4738
|
-
|
4739
|
-
|
4740
|
-
|
4741
|
-
}
|
6116
|
+
function createPrng(seed) {
|
6117
|
+
const MODULUS = 2 ** 32;
|
6118
|
+
const MULTIPLIER = 1664525;
|
6119
|
+
const INCREMENT = 1013904223;
|
6120
|
+
let state = seed >>> 0;
|
6121
|
+
return () => {
|
6122
|
+
state = (MULTIPLIER * state + INCREMENT) % MODULUS;
|
6123
|
+
return state / MODULUS;
|
6124
|
+
};
|
6125
|
+
}
|
6126
|
+
function generateUuid(rng) {
|
6127
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
6128
|
+
const r = Math.floor(rng() * 16);
|
6129
|
+
const v = c === "x" ? r : r & 3 | 8;
|
6130
|
+
return v.toString(16);
|
6131
|
+
});
|
6132
|
+
}
|
6133
|
+
function generateTrackingId(rng) {
|
6134
|
+
const uuid = generateUuid(rng).replace(/-/g, "");
|
6135
|
+
const trackingId = uuid.slice(0, 6).toUpperCase();
|
6136
|
+
return trackingId;
|
6137
|
+
}
|
6138
|
+
function generateRandomSignature(rng) {
|
6139
|
+
return `/random-bucket/${generateUuid(rng)}.png`;
|
6140
|
+
}
|
6141
|
+
var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
|
6142
|
+
const rng = createPrng(seed);
|
6143
|
+
const createdAt = getRandomDatetime(
|
6144
|
+
rng,
|
6145
|
+
/* @__PURE__ */ new Date("2024-01-01"),
|
6146
|
+
/* @__PURE__ */ new Date("2024-12-31")
|
6147
|
+
);
|
6148
|
+
return {
|
6149
|
+
id: overrides.id ?? generateUuid(rng),
|
6150
|
+
type: overrides.type ?? TENNIS_CLUB_MEMBERSHIP,
|
6151
|
+
status: overrides.status ?? pickRandom(rng, EventStatus.options),
|
6152
|
+
createdAt: overrides.createdAt ?? createdAt,
|
6153
|
+
createdBy: overrides.createdBy ?? generateUuid(rng),
|
6154
|
+
createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
|
6155
|
+
updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
|
6156
|
+
createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
|
6157
|
+
updatedAt: overrides.updatedAt ?? (0, import_addDays.default)(new Date(createdAt), 1).toISOString(),
|
6158
|
+
assignedTo: overrides.assignedTo ?? null,
|
6159
|
+
updatedBy: overrides.updatedBy ?? generateUuid(rng),
|
6160
|
+
updatedByUserRole: overrides.updatedByUserRole ?? "FIELD_AGENT",
|
6161
|
+
flags: [],
|
6162
|
+
legalStatuses: overrides.legalStatuses ?? {},
|
6163
|
+
declaration: overrides.declaration ?? generateRandomApplicant(rng),
|
6164
|
+
trackingId: overrides.trackingId ?? generateTrackingId(rng)
|
6165
|
+
};
|
6166
|
+
};
|
4742
6167
|
var generateTranslationConfig = (message) => ({
|
4743
6168
|
defaultMessage: message,
|
4744
6169
|
description: "Description for ${message}",
|
4745
6170
|
id: message
|
4746
6171
|
});
|
6172
|
+
var BearerTokenByUserType = {
|
6173
|
+
fieldAgent: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzY29wZSI6WyJyZWNvcmQuZGVjbGFyZS1iaXJ0aCIsInJlY29yZC5kZWNsYXJlLWRlYXRoIiwicmVjb3JkLmRlY2xhcmUtbWFycmlhZ2UiLCJyZWNvcmQuZGVjbGFyYXRpb24tc3VibWl0LWluY29tcGxldGUiLCJyZWNvcmQuZGVjbGFyYXRpb24tc3VibWl0LWZvci1yZXZpZXciLCJzZWFyY2guYmlydGgiLCJzZWFyY2guZGVhdGgiLCJzZWFyY2gubWFycmlhZ2UiLCJkZW1vIl0sInVzZXJUeXBlIjoidXNlciIsImlhdCI6MTc0ODUyNjQ4OCwiZXhwIjoxNzQ5MTMxMjg4LCJhdWQiOlsib3BlbmNydnM6YXV0aC11c2VyIiwib3BlbmNydnM6dXNlci1tZ250LXVzZXIiLCJvcGVuY3J2czpoZWFydGgtdXNlciIsIm9wZW5jcnZzOmdhdGV3YXktdXNlciIsIm9wZW5jcnZzOm5vdGlmaWNhdGlvbi11c2VyIiwib3BlbmNydnM6d29ya2Zsb3ctdXNlciIsIm9wZW5jcnZzOnNlYXJjaC11c2VyIiwib3BlbmNydnM6bWV0cmljcy11c2VyIiwib3BlbmNydnM6Y291bnRyeWNvbmZpZy11c2VyIiwib3BlbmNydnM6d2ViaG9va3MtdXNlciIsIm9wZW5jcnZzOmNvbmZpZy11c2VyIiwib3BlbmNydnM6ZG9jdW1lbnRzLXVzZXIiXSwiaXNzIjoib3BlbmNydnM6YXV0aC1zZXJ2aWNlIiwic3ViIjoiNjc3ZmIwODYzMGYzYWJmYTMzMDcyNzBmIn0.qLif2TmTPpqfbSUWR3TSfWf5syyCtRRJV-fDOZBtN9th-gdT0sUPZp5PB_t2QHHCLes7JLDlSA9CGNIbVvRR8a7EedXTAf0T7pwiE96PgljHSKI9jLMCYb_rhqnl8BwfsxAU3qv8EBYM9rDlcabl5iKnAOM-YLMv63CRMQxZOZ0O3Wl1Xil82dp6PqW_Lom5Qd-Esftt9BWXk5gxmqq-YegT8qU9n3hDXEsOvmIyYQvPDwmUOB-xp74CKJk_o3eBuq4TVCMYxY-tS9qkkn2A7Txhh-bzWMVNrQjQ1Yumvs8gi_F-XYTi89QbZVz8PzJ9kT8w3jshYwmAy7be9M-EQg",
|
6174
|
+
registrationAgent: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzY29wZSI6WyJyZWNvcmQucmVhZCIsInJlY29yZC5kZWNsYXJlLWJpcnRoIiwicmVjb3JkLmRlY2xhcmUtZGVhdGgiLCJyZWNvcmQuZGVjbGFyZS1tYXJyaWFnZSIsInJlY29yZC5kZWNsYXJhdGlvbi1lZGl0IiwicmVjb3JkLmRlY2xhcmF0aW9uLXN1Ym1pdC1mb3ItYXBwcm92YWwiLCJyZWNvcmQuZGVjbGFyYXRpb24tc3VibWl0LWZvci11cGRhdGVzIiwicmVjb3JkLmRlY2xhcmF0aW9uLWFyY2hpdmUiLCJyZWNvcmQuZGVjbGFyYXRpb24tcmVpbnN0YXRlIiwicmVjb3JkLnJlZ2lzdHJhdGlvbi1yZXF1ZXN0LWNvcnJlY3Rpb24iLCJyZWNvcmQuZGVjbGFyYXRpb24tcHJpbnQtc3VwcG9ydGluZy1kb2N1bWVudHMiLCJyZWNvcmQuZXhwb3J0LXJlY29yZHMiLCJyZWNvcmQucmVnaXN0cmF0aW9uLXByaW50Jmlzc3VlLWNlcnRpZmllZC1jb3BpZXMiLCJwZXJmb3JtYW5jZS5yZWFkIiwicGVyZm9ybWFuY2UucmVhZC1kYXNoYm9hcmRzIiwib3JnYW5pc2F0aW9uLnJlYWQtbG9jYXRpb25zOm15LW9mZmljZSIsInNlYXJjaC5iaXJ0aCIsInNlYXJjaC5kZWF0aCIsInNlYXJjaC5tYXJyaWFnZSIsImRlbW8iXSwidXNlclR5cGUiOiJ1c2VyIiwiaWF0IjoxNzQ4NTI2NDY4LCJleHAiOjE3NDkxMzEyNjgsImF1ZCI6WyJvcGVuY3J2czphdXRoLXVzZXIiLCJvcGVuY3J2czp1c2VyLW1nbnQtdXNlciIsIm9wZW5jcnZzOmhlYXJ0aC11c2VyIiwib3BlbmNydnM6Z2F0ZXdheS11c2VyIiwib3BlbmNydnM6bm90aWZpY2F0aW9uLXVzZXIiLCJvcGVuY3J2czp3b3JrZmxvdy11c2VyIiwib3BlbmNydnM6c2VhcmNoLXVzZXIiLCJvcGVuY3J2czptZXRyaWNzLXVzZXIiLCJvcGVuY3J2czpjb3VudHJ5Y29uZmlnLXVzZXIiLCJvcGVuY3J2czp3ZWJob29rcy11c2VyIiwib3BlbmNydnM6Y29uZmlnLXVzZXIiLCJvcGVuY3J2czpkb2N1bWVudHMtdXNlciJdLCJpc3MiOiJvcGVuY3J2czphdXRoLXNlcnZpY2UiLCJzdWIiOiI2NzdmYjA4NjMwZjNhYmZhMzMwNzI3MTgifQ.C0R3cda9tczdJyadyJzk_wjVx79yiQ4r2BZbrF5VMTol97CwqMk1cPKVv5xZR1fHW5nhYl1X_vsmTYx-p9oSmcAYVud-4Z24TrA3oZ214zCB8RW_RmmFzJSczwe-9Son-96JOpRJTz2F-F_SSmblF0cjndJ-iXCAbOn1hmQ1q45NqaV-oFaFWigvAaRoBFcEvGufQxss_NjRmG12ooENSfWQl0tYM9BmTw4JQo2xerwJcgaJTrtDgRagkuiR7zhVNjcoT64AQiSRp5KmWRhbU4ozlJ2tfy1ccD9jJkbQTf1AZT2pl1diusjstJYFuM9QPFPOyCO0umaxYfgSer_Hmg",
|
6175
|
+
localRegistrar: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzY29wZSI6WyJyZWNvcmQucmVhZCIsInJlY29yZC5kZWNsYXJlLWJpcnRoIiwicmVjb3JkLmRlY2xhcmUtZGVhdGgiLCJyZWNvcmQuZGVjbGFyZS1tYXJyaWFnZSIsInJlY29yZC5kZWNsYXJhdGlvbi1lZGl0IiwicmVjb3JkLmRlY2xhcmF0aW9uLXN1Ym1pdC1mb3ItdXBkYXRlcyIsInJlY29yZC5yZXZpZXctZHVwbGljYXRlcyIsInJlY29yZC5kZWNsYXJhdGlvbi1hcmNoaXZlIiwicmVjb3JkLmRlY2xhcmF0aW9uLXJlaW5zdGF0ZSIsInJlY29yZC5yZWdpc3RlciIsInJlY29yZC5yZWdpc3RyYXRpb24tY29ycmVjdCIsInJlY29yZC5kZWNsYXJhdGlvbi1wcmludC1zdXBwb3J0aW5nLWRvY3VtZW50cyIsInJlY29yZC5leHBvcnQtcmVjb3JkcyIsInJlY29yZC51bmFzc2lnbi1vdGhlcnMiLCJyZWNvcmQucmVnaXN0cmF0aW9uLXByaW50Jmlzc3VlLWNlcnRpZmllZC1jb3BpZXMiLCJyZWNvcmQuY29uZmlybS1yZWdpc3RyYXRpb24iLCJyZWNvcmQucmVqZWN0LXJlZ2lzdHJhdGlvbiIsInBlcmZvcm1hbmNlLnJlYWQiLCJwZXJmb3JtYW5jZS5yZWFkLWRhc2hib2FyZHMiLCJwcm9maWxlLmVsZWN0cm9uaWMtc2lnbmF0dXJlIiwib3JnYW5pc2F0aW9uLnJlYWQtbG9jYXRpb25zOm15LW9mZmljZSIsInNlYXJjaC5iaXJ0aCIsInNlYXJjaC5kZWF0aCIsInNlYXJjaC5tYXJyaWFnZSIsImRlbW8iXSwidXNlclR5cGUiOiJ1c2VyIiwiaWF0IjoxNzQ4NTI2NDIwLCJleHAiOjE3NDkxMzEyMjAsImF1ZCI6WyJvcGVuY3J2czphdXRoLXVzZXIiLCJvcGVuY3J2czp1c2VyLW1nbnQtdXNlciIsIm9wZW5jcnZzOmhlYXJ0aC11c2VyIiwib3BlbmNydnM6Z2F0ZXdheS11c2VyIiwib3BlbmNydnM6bm90aWZpY2F0aW9uLXVzZXIiLCJvcGVuY3J2czp3b3JrZmxvdy11c2VyIiwib3BlbmNydnM6c2VhcmNoLXVzZXIiLCJvcGVuY3J2czptZXRyaWNzLXVzZXIiLCJvcGVuY3J2czpjb3VudHJ5Y29uZmlnLXVzZXIiLCJvcGVuY3J2czp3ZWJob29rcy11c2VyIiwib3BlbmNydnM6Y29uZmlnLXVzZXIiLCJvcGVuY3J2czpkb2N1bWVudHMtdXNlciJdLCJpc3MiOiJvcGVuY3J2czphdXRoLXNlcnZpY2UiLCJzdWIiOiI2NzdmYjA4NjMwZjNhYmZhMzMwNzI3MjEifQ.Exwojy_1lsoPmp-kQ79SMWI0eQy8Qt7yO_ynGvb_oIVdqSwTxFkkNr9x4UxhBA-o0P6LkMZ2ELKOlSzBr3PRJ8IQnfMQ7Db8oG8HAPsY8sKqra_L6ryV088NW2e2LqAjoOX0dXRIqYMolUhF_OOuZpHW5K8nvog5SLlnJ1gKysQ1EuWBg2dcKbjkkB16v-9NGz4XHye3vcoZlalyha5OOujzbPhkmr9UGiksSIXFNbanBhkQdt-EJlLX9SXvQ4ACJWPKFb_f4gv8p84jdLiryzQux46zHPpTicZHzg0nZtoKKIH1AyFtqWfBFm4y8qWC3ht9TAk93NAXTfkS0wzxKA"
|
6176
|
+
};
|
6177
|
+
var generateWorkqueues = (slug = "all-events") => defineWorkqueues([
|
6178
|
+
{
|
6179
|
+
slug,
|
6180
|
+
name: {
|
6181
|
+
id: "workqueues.inProgress.title",
|
6182
|
+
defaultMessage: slug.charAt(0).toUpperCase() + slug.slice(1).split("-").join(" "),
|
6183
|
+
description: "Title of in progress workqueue"
|
6184
|
+
},
|
6185
|
+
query: {
|
6186
|
+
type: "and",
|
6187
|
+
clauses: [{ eventType: tennisClubMembershipEvent.id }]
|
6188
|
+
},
|
6189
|
+
actions: [],
|
6190
|
+
icon: "Draft",
|
6191
|
+
columns: []
|
6192
|
+
}
|
6193
|
+
]);
|
4747
6194
|
|
4748
6195
|
// ../commons/src/events/TemplateConfig.ts
|
4749
6196
|
function isTemplateVariable(value) {
|
@@ -4756,7 +6203,9 @@ function isFieldValueWithoutTemplates(value) {
|
|
4756
6203
|
if (isTemplateVariable(value)) {
|
4757
6204
|
return false;
|
4758
6205
|
}
|
4759
|
-
if (typeof value === "object" &&
|
6206
|
+
if (typeof value === "object" && // @todo remove ts-ignore
|
6207
|
+
//@ts-ignore
|
6208
|
+
Object.values(value).some((val) => isTemplateVariable(val))) {
|
4760
6209
|
return false;
|
4761
6210
|
}
|
4762
6211
|
return true;
|
@@ -4781,6 +6230,7 @@ function isFieldConfigDefaultValue(value) {
|
|
4781
6230
|
var import_lodash3 = require("lodash");
|
4782
6231
|
|
4783
6232
|
// ../commons/src/scopes.ts
|
6233
|
+
var import_zod31 = require("zod");
|
4784
6234
|
var SCOPES = {
|
4785
6235
|
// TODO v1.8 legacy scopes
|
4786
6236
|
NATLSYSADMIN: "natlsysadmin",
|
@@ -4804,6 +6254,8 @@ var SCOPES = {
|
|
4804
6254
|
*/
|
4805
6255
|
RECORD_DECLARE: "record.declare-birth",
|
4806
6256
|
// declare
|
6257
|
+
RECORD_IMPORT: "record.import",
|
6258
|
+
// declare
|
4807
6259
|
RECORD_DECLARE_BIRTH: "record.declare-birth",
|
4808
6260
|
RECORD_DECLARE_BIRTH_MY_JURISDICTION: "record.declare-birth:my-jurisdiction",
|
4809
6261
|
RECORD_DECLARE_DEATH: "record.declare-death",
|
@@ -4891,12 +6343,119 @@ var SCOPES = {
|
|
4891
6343
|
// data seeding
|
4892
6344
|
USER_DATA_SEEDING: "user.data-seeding"
|
4893
6345
|
};
|
6346
|
+
var LiteralScopes = import_zod31.z.union([
|
6347
|
+
import_zod31.z.literal(SCOPES.NATLSYSADMIN),
|
6348
|
+
import_zod31.z.literal(SCOPES.BYPASSRATELIMIT),
|
6349
|
+
import_zod31.z.literal(SCOPES.DECLARE),
|
6350
|
+
import_zod31.z.literal(SCOPES.REGISTER),
|
6351
|
+
import_zod31.z.literal(SCOPES.VALIDATE),
|
6352
|
+
import_zod31.z.literal(SCOPES.DEMO),
|
6353
|
+
import_zod31.z.literal(SCOPES.CERTIFY),
|
6354
|
+
import_zod31.z.literal(SCOPES.PERFORMANCE),
|
6355
|
+
import_zod31.z.literal(SCOPES.SYSADMIN),
|
6356
|
+
import_zod31.z.literal(SCOPES.TEAMS),
|
6357
|
+
import_zod31.z.literal(SCOPES.CONFIG),
|
6358
|
+
import_zod31.z.literal(SCOPES.WEBHOOK),
|
6359
|
+
import_zod31.z.literal(SCOPES.NATIONALID),
|
6360
|
+
import_zod31.z.literal(SCOPES.NOTIFICATION_API),
|
6361
|
+
import_zod31.z.literal(SCOPES.RECORDSEARCH),
|
6362
|
+
import_zod31.z.literal(SCOPES.RECORD_IMPORT),
|
6363
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
|
6364
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
|
6365
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_DEATH),
|
6366
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
|
6367
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
|
6368
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
|
6369
|
+
import_zod31.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
|
6370
|
+
import_zod31.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW),
|
6371
|
+
import_zod31.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS),
|
6372
|
+
import_zod31.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
|
6373
|
+
import_zod31.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
|
6374
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
|
6375
|
+
import_zod31.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
|
6376
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
|
6377
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE),
|
6378
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTER),
|
6379
|
+
import_zod31.z.literal(SCOPES.RECORD_EXPORT_RECORDS),
|
6380
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARATION_PRINT),
|
6381
|
+
import_zod31.z.literal(SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS),
|
6382
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_PRINT),
|
6383
|
+
import_zod31.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
|
6384
|
+
import_zod31.z.literal(SCOPES.RECORD_PRINT_CERTIFIED_COPIES),
|
6385
|
+
import_zod31.z.literal(SCOPES.RECORD_BULK_PRINT_CERTIFIED_COPIES),
|
6386
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES),
|
6387
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
|
6388
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
|
6389
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REVOCATION),
|
6390
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REVOKE),
|
6391
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REINSTATEMENT),
|
6392
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REINSTATE),
|
6393
|
+
import_zod31.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
|
6394
|
+
import_zod31.z.literal(SCOPES.RECORD_REJECT_REGISTRATION),
|
6395
|
+
import_zod31.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
|
6396
|
+
import_zod31.z.literal(SCOPES.SEARCH_BIRTH),
|
6397
|
+
import_zod31.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
|
6398
|
+
import_zod31.z.literal(SCOPES.SEARCH_DEATH),
|
6399
|
+
import_zod31.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
|
6400
|
+
import_zod31.z.literal(SCOPES.SEARCH_MARRIAGE),
|
6401
|
+
import_zod31.z.literal(SCOPES.RECORD_READ),
|
6402
|
+
import_zod31.z.literal(SCOPES.RECORD_READ_AUDIT),
|
6403
|
+
import_zod31.z.literal(SCOPES.RECORD_READ_COMMENTS),
|
6404
|
+
import_zod31.z.literal(SCOPES.RECORD_CREATE_COMMENTS),
|
6405
|
+
import_zod31.z.literal(SCOPES.PROFILE_UPDATE),
|
6406
|
+
import_zod31.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE),
|
6407
|
+
import_zod31.z.literal(SCOPES.PERFORMANCE_READ),
|
6408
|
+
import_zod31.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
|
6409
|
+
import_zod31.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS),
|
6410
|
+
import_zod31.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
|
6411
|
+
import_zod31.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
|
6412
|
+
import_zod31.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION),
|
6413
|
+
import_zod31.z.literal(SCOPES.USER_READ),
|
6414
|
+
import_zod31.z.literal(SCOPES.USER_READ_MY_OFFICE),
|
6415
|
+
import_zod31.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
|
6416
|
+
import_zod31.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
|
6417
|
+
import_zod31.z.literal(SCOPES.USER_CREATE),
|
6418
|
+
import_zod31.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
|
6419
|
+
import_zod31.z.literal(SCOPES.USER_UPDATE),
|
6420
|
+
import_zod31.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION),
|
6421
|
+
import_zod31.z.literal(SCOPES.CONFIG_UPDATE_ALL),
|
6422
|
+
import_zod31.z.literal(SCOPES.USER_DATA_SEEDING)
|
6423
|
+
]);
|
6424
|
+
var rawConfigurableScopeRegex = /^([a-zA-Z\.]+)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
|
6425
|
+
var rawConfigurableScope = import_zod31.z.string().regex(rawConfigurableScopeRegex);
|
6426
|
+
var CreateUserScope = import_zod31.z.object({
|
6427
|
+
type: import_zod31.z.literal("user.create"),
|
6428
|
+
options: import_zod31.z.object({
|
6429
|
+
role: import_zod31.z.array(import_zod31.z.string())
|
6430
|
+
})
|
6431
|
+
});
|
6432
|
+
var EditUserScope = import_zod31.z.object({
|
6433
|
+
type: import_zod31.z.literal("user.edit"),
|
6434
|
+
options: import_zod31.z.object({
|
6435
|
+
role: import_zod31.z.array(import_zod31.z.string())
|
6436
|
+
})
|
6437
|
+
});
|
6438
|
+
var WorkqueueScope = import_zod31.z.object({
|
6439
|
+
type: import_zod31.z.literal("workqueue"),
|
6440
|
+
options: import_zod31.z.object({
|
6441
|
+
id: import_zod31.z.array(import_zod31.z.string())
|
6442
|
+
})
|
6443
|
+
});
|
6444
|
+
var NotifyRecordScope = import_zod31.z.object({
|
6445
|
+
type: import_zod31.z.literal("record.notify"),
|
6446
|
+
options: import_zod31.z.object({
|
6447
|
+
event: import_zod31.z.array(import_zod31.z.string())
|
6448
|
+
})
|
6449
|
+
});
|
6450
|
+
var ConfigurableScopes = import_zod31.z.discriminatedUnion("type", [
|
6451
|
+
CreateUserScope,
|
6452
|
+
EditUserScope,
|
6453
|
+
WorkqueueScope,
|
6454
|
+
NotifyRecordScope
|
6455
|
+
]);
|
4894
6456
|
var scopes = Object.values(SCOPES);
|
4895
6457
|
|
4896
6458
|
// ../commons/src/events/scopes.ts
|
4897
|
-
function hasAnyOfScopes(a, b) {
|
4898
|
-
return (0, import_lodash3.intersection)(a, b).length > 0;
|
4899
|
-
}
|
4900
6459
|
var CONFIG_GET_ALLOWED_SCOPES = [
|
4901
6460
|
SCOPES.RECORD_DECLARE,
|
4902
6461
|
SCOPES.RECORD_READ,
|
@@ -4954,6 +6513,28 @@ var ACTION_ALLOWED_SCOPES = {
|
|
4954
6513
|
[ActionType.UNASSIGN]: null,
|
4955
6514
|
[ActionType.DETECT_DUPLICATE]: []
|
4956
6515
|
};
|
6516
|
+
var ACTION_ALLOWED_CONFIGURABLE_SCOPES = {
|
6517
|
+
[ActionType.READ]: [],
|
6518
|
+
[ActionType.CREATE]: ["record.notify"],
|
6519
|
+
[ActionType.NOTIFY]: ["record.notify"],
|
6520
|
+
[ActionType.DECLARE]: [],
|
6521
|
+
[ActionType.DELETE]: [],
|
6522
|
+
[ActionType.VALIDATE]: [],
|
6523
|
+
[ActionType.REGISTER]: [],
|
6524
|
+
[ActionType.PRINT_CERTIFICATE]: [],
|
6525
|
+
[ActionType.REQUEST_CORRECTION]: [],
|
6526
|
+
[ActionType.REJECT_CORRECTION]: [],
|
6527
|
+
[ActionType.APPROVE_CORRECTION]: [],
|
6528
|
+
[ActionType.MARKED_AS_DUPLICATE]: [],
|
6529
|
+
[ActionType.ARCHIVE]: [],
|
6530
|
+
[ActionType.REJECT]: [],
|
6531
|
+
[ActionType.ASSIGN]: [],
|
6532
|
+
[ActionType.UNASSIGN]: [],
|
6533
|
+
[ActionType.DETECT_DUPLICATE]: []
|
6534
|
+
};
|
6535
|
+
function hasAnyOfScopes(a, b) {
|
6536
|
+
return (0, import_lodash3.intersection)(a, b).length > 0;
|
6537
|
+
}
|
4957
6538
|
function filterUnallowedActions(actions, userScopes) {
|
4958
6539
|
const allowedActions = actions.filter((action) => {
|
4959
6540
|
const requiredScopes = ACTION_ALLOWED_SCOPES[action];
|
@@ -4970,3 +6551,67 @@ function filterUnallowedActions(actions, userScopes) {
|
|
4970
6551
|
}
|
4971
6552
|
return [ActionType.READ];
|
4972
6553
|
}
|
6554
|
+
|
6555
|
+
// ../commons/src/events/serializers/user/deserializer.ts
|
6556
|
+
var import_zod32 = require("zod");
|
6557
|
+
var UserWithPrimaryOffice = User.extend({
|
6558
|
+
primaryOfficeId: import_zod32.z.string()
|
6559
|
+
});
|
6560
|
+
function userDeserializer(serializedUserField, user2) {
|
6561
|
+
if (typeof serializedUserField === "string") {
|
6562
|
+
return serializedUserField;
|
6563
|
+
}
|
6564
|
+
if (serializedUserField.$userField === "name" || serializedUserField.$userField === "signatureFilename") {
|
6565
|
+
throw new Error(
|
6566
|
+
`Deserializer for ${serializedUserField.$userField} is not implemented yet`
|
6567
|
+
);
|
6568
|
+
}
|
6569
|
+
return user2[serializedUserField.$userField];
|
6570
|
+
}
|
6571
|
+
function deserializeQueryExpression(expression, user2) {
|
6572
|
+
return {
|
6573
|
+
...expression,
|
6574
|
+
assignedTo: expression.assignedTo && {
|
6575
|
+
...expression.assignedTo,
|
6576
|
+
term: userDeserializer(expression.assignedTo.term, user2)
|
6577
|
+
},
|
6578
|
+
createdBy: expression.createdBy && {
|
6579
|
+
...expression.createdBy,
|
6580
|
+
term: userDeserializer(expression.createdBy.term, user2)
|
6581
|
+
},
|
6582
|
+
updatedBy: expression.updatedBy && {
|
6583
|
+
...expression.updatedBy,
|
6584
|
+
term: userDeserializer(expression.updatedBy.term, user2)
|
6585
|
+
},
|
6586
|
+
createdAtLocation: expression.createdAtLocation && (expression.createdAtLocation.type === "within" ? {
|
6587
|
+
...expression.createdAtLocation,
|
6588
|
+
location: userDeserializer(
|
6589
|
+
expression.createdAtLocation.location,
|
6590
|
+
user2
|
6591
|
+
)
|
6592
|
+
} : {
|
6593
|
+
...expression.createdAtLocation,
|
6594
|
+
term: userDeserializer(expression.createdAtLocation.term, user2)
|
6595
|
+
}),
|
6596
|
+
updatedAtLocation: expression.updatedAtLocation && (expression.updatedAtLocation.type === "within" ? {
|
6597
|
+
...expression.updatedAtLocation,
|
6598
|
+
location: userDeserializer(
|
6599
|
+
expression.updatedAtLocation.location,
|
6600
|
+
user2
|
6601
|
+
)
|
6602
|
+
} : {
|
6603
|
+
...expression.updatedAtLocation,
|
6604
|
+
term: userDeserializer(expression.updatedAtLocation.term, user2)
|
6605
|
+
})
|
6606
|
+
};
|
6607
|
+
}
|
6608
|
+
function deserializeQuery(query, user2) {
|
6609
|
+
return {
|
6610
|
+
...query,
|
6611
|
+
clauses: query.clauses.map(
|
6612
|
+
(clause) => deserializeQueryExpression(clause, user2)
|
6613
|
+
// SAFETY: This cast should be safe because `query.clauses` has already been validated as non-empty by the Zod schema.
|
6614
|
+
// Without the cast, TypeScript cannot infer the tuple type required by the target interface.
|
6615
|
+
)
|
6616
|
+
};
|
6617
|
+
}
|