@opencrvs/toolkit 1.8.0-rc.fc4c805 → 1.8.0-rc.fc76588
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 +10346 -4518
- package/dist/commons/conditionals/conditionals.d.ts +8 -3
- package/dist/commons/conditionals/validate.d.ts +6 -0
- package/dist/commons/events/ActionConfig.d.ts +56387 -29043
- package/dist/commons/events/ActionDocument.d.ts +2110 -519
- package/dist/commons/events/ActionInput.d.ts +1577 -305
- package/dist/commons/events/ActionType.d.ts +4 -0
- 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 +2 -0
- package/dist/commons/events/Draft.d.ts +137 -36
- package/dist/commons/events/EventConfig.d.ts +27593 -14046
- package/dist/commons/events/EventDocument.d.ts +1374 -391
- package/dist/commons/events/EventIndex.d.ts +589 -357
- package/dist/commons/events/EventInput.d.ts +0 -13
- package/dist/commons/events/EventMetadata.d.ts +74 -80
- 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/SummaryConfig.d.ts +0 -5
- 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 +4205 -538
- 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 +149 -42
- package/dist/commons/events/transactions.d.ts +1 -1
- package/dist/commons/events/utils.d.ts +10115 -313
- package/dist/commons/events/workqueueDefaultColumns.d.ts +3 -0
- package/dist/conditionals/index.js +45 -8
- package/dist/events/index.js +2682 -1019
- 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,56 @@ __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
|
+
WorkqueueActionsWithDefault: () => WorkqueueActionsWithDefault,
|
171
|
+
WorkqueueColumn: () => WorkqueueColumn,
|
172
|
+
WorkqueueColumnKeys: () => WorkqueueColumnKeys,
|
173
|
+
WorkqueueColumnKeysArray: () => WorkqueueColumnKeysArray,
|
174
|
+
WorkqueueColumnValue: () => WorkqueueColumnValue,
|
150
175
|
WorkqueueConfig: () => WorkqueueConfig,
|
176
|
+
WorkqueueConfigInput: () => WorkqueueConfigInput,
|
177
|
+
WorkqueueCountInput: () => WorkqueueCountInput,
|
178
|
+
WorkqueueCountOutput: () => WorkqueueCountOutput,
|
151
179
|
ZodDate: () => ZodDate,
|
152
180
|
alwaysTrue: () => alwaysTrue,
|
153
181
|
and: () => and,
|
@@ -158,9 +186,11 @@ __export(events_exports, {
|
|
158
186
|
createEmptyDraft: () => createEmptyDraft,
|
159
187
|
createEventConditionals: () => createEventConditionals,
|
160
188
|
createFieldConditionals: () => createFieldConditionals,
|
189
|
+
createPrng: () => createPrng,
|
161
190
|
createValidationSchema: () => createValidationSchema,
|
162
191
|
deepDropNulls: () => deepDropNulls,
|
163
192
|
deepMerge: () => deepMerge,
|
193
|
+
defaultWorkqueueColumns: () => defaultWorkqueueColumns,
|
164
194
|
defineActionForm: () => defineActionForm,
|
165
195
|
defineConditional: () => defineConditional,
|
166
196
|
defineConfig: () => defineConfig,
|
@@ -169,12 +199,14 @@ __export(events_exports, {
|
|
169
199
|
defineFormPage: () => defineFormPage,
|
170
200
|
definePage: () => definePage,
|
171
201
|
defineWorkqueue: () => defineWorkqueue,
|
202
|
+
defineWorkqueues: () => defineWorkqueues,
|
203
|
+
defineWorkqueuesColumns: () => defineWorkqueuesColumns,
|
204
|
+
deserializeQuery: () => deserializeQuery,
|
172
205
|
errorMessages: () => errorMessages,
|
173
206
|
event: () => event,
|
174
207
|
eventMetadataLabelMap: () => eventMetadataLabelMap,
|
175
208
|
eventPayloadGenerator: () => eventPayloadGenerator,
|
176
209
|
eventQueryDataGenerator: () => eventQueryDataGenerator,
|
177
|
-
eventStatuses: () => eventStatuses,
|
178
210
|
field: () => field,
|
179
211
|
fieldTypes: () => fieldTypes,
|
180
212
|
filterUnallowedActions: () => filterUnallowedActions,
|
@@ -187,22 +219,33 @@ __export(events_exports, {
|
|
187
219
|
generateActionDocument: () => generateActionDocument,
|
188
220
|
generateEventDocument: () => generateEventDocument,
|
189
221
|
generateEventDraftDocument: () => generateEventDraftDocument,
|
222
|
+
generateRandomName: () => generateRandomName,
|
223
|
+
generateRandomSignature: () => generateRandomSignature,
|
190
224
|
generateTransactionId: () => generateTransactionId,
|
191
225
|
generateTranslationConfig: () => generateTranslationConfig,
|
226
|
+
generateWorkqueues: () => generateWorkqueues,
|
192
227
|
getAcceptedActions: () => getAcceptedActions,
|
193
228
|
getActionAnnotation: () => getActionAnnotation,
|
194
229
|
getActionAnnotationFields: () => getActionAnnotationFields,
|
195
230
|
getActionReview: () => getActionReview,
|
196
231
|
getActionReviewFields: () => getActionReviewFields,
|
197
232
|
getActionVerificationPageIds: () => getActionVerificationPageIds,
|
233
|
+
getAllUniqueFields: () => getAllUniqueFields,
|
198
234
|
getAnnotationFromDrafts: () => getAnnotationFromDrafts,
|
199
235
|
getAssignedUserFromActions: () => getAssignedUserFromActions,
|
236
|
+
getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
|
200
237
|
getCurrentEventState: () => getCurrentEventState,
|
201
238
|
getCurrentEventStateWithDrafts: () => getCurrentEventStateWithDrafts,
|
202
239
|
getDeclaration: () => getDeclaration,
|
240
|
+
getDeclarationFieldById: () => getDeclarationFieldById,
|
203
241
|
getDeclarationFields: () => getDeclarationFields,
|
204
242
|
getDeclarationPages: () => getDeclarationPages,
|
243
|
+
getEventConfigById: () => getEventConfigById,
|
205
244
|
getMixedPath: () => getMixedPath,
|
245
|
+
getRandomDate: () => getRandomDate,
|
246
|
+
getRandomDatetime: () => getRandomDatetime,
|
247
|
+
getStatusFromActions: () => getStatusFromActions,
|
248
|
+
getValidatorsForField: () => getValidatorsForField,
|
206
249
|
getVisibleVerificationPageIds: () => getVisibleVerificationPageIds,
|
207
250
|
hasAnyOfScopes: () => hasAnyOfScopes,
|
208
251
|
isAddressFieldType: () => isAddressFieldType,
|
@@ -225,12 +268,17 @@ __export(events_exports, {
|
|
225
268
|
isFieldVisible: () => isFieldVisible,
|
226
269
|
isFileFieldType: () => isFileFieldType,
|
227
270
|
isFileFieldWithOptionType: () => isFileFieldWithOptionType,
|
271
|
+
isIdFieldType: () => isIdFieldType,
|
228
272
|
isLocationFieldType: () => isLocationFieldType,
|
273
|
+
isMetaAction: () => isMetaAction,
|
274
|
+
isNameFieldType: () => isNameFieldType,
|
275
|
+
isNonInteractiveFieldType: () => isNonInteractiveFieldType,
|
229
276
|
isNumberFieldType: () => isNumberFieldType,
|
230
277
|
isOfficeFieldType: () => isOfficeFieldType,
|
231
278
|
isPageHeaderFieldType: () => isPageHeaderFieldType,
|
232
279
|
isPageVisible: () => isPageVisible,
|
233
280
|
isParagraphFieldType: () => isParagraphFieldType,
|
281
|
+
isPhoneFieldType: () => isPhoneFieldType,
|
234
282
|
isRadioGroupFieldType: () => isRadioGroupFieldType,
|
235
283
|
isSelectFieldType: () => isSelectFieldType,
|
236
284
|
isSignatureFieldType: () => isSignatureFieldType,
|
@@ -240,6 +288,7 @@ __export(events_exports, {
|
|
240
288
|
isUndeclaredDraft: () => isUndeclaredDraft,
|
241
289
|
isVerificationPage: () => isVerificationPage,
|
242
290
|
isWriteAction: () => isWriteAction,
|
291
|
+
mandatoryColumns: () => mandatoryColumns,
|
243
292
|
mapFieldTypeToEmptyValue: () => mapFieldTypeToEmptyValue,
|
244
293
|
mapFieldTypeToMockValue: () => mapFieldTypeToMockValue,
|
245
294
|
mapFieldTypeToZod: () => mapFieldTypeToZod,
|
@@ -253,18 +302,26 @@ __export(events_exports, {
|
|
253
302
|
user: () => user,
|
254
303
|
validate: () => validate,
|
255
304
|
validateFieldInput: () => validateFieldInput,
|
305
|
+
workqueueActions: () => workqueueActions,
|
256
306
|
writeActions: () => writeActions
|
257
307
|
});
|
258
308
|
module.exports = __toCommonJS(events_exports);
|
259
309
|
|
310
|
+
// ../commons/src/events/Constants.ts
|
311
|
+
var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
|
312
|
+
var BIRTH_EVENT = "v2-birth";
|
313
|
+
|
260
314
|
// ../commons/src/events/ActionConfig.ts
|
261
315
|
var import_zod9 = require("zod");
|
262
316
|
|
263
317
|
// ../commons/src/events/Conditional.ts
|
264
318
|
var import_zod = require("zod");
|
265
|
-
var
|
266
|
-
|
267
|
-
)
|
319
|
+
var import_zod_openapi = require("zod-openapi");
|
320
|
+
(0, import_zod_openapi.extendZodWithOpenApi)(import_zod.z);
|
321
|
+
var Conditional = import_zod.z.custom((val) => typeof val === "object" && val !== null).openapi({
|
322
|
+
description: "JSON schema conditional configuration",
|
323
|
+
ref: "Conditional"
|
324
|
+
});
|
268
325
|
var ConditionalType = {
|
269
326
|
SHOW: "SHOW",
|
270
327
|
ENABLE: "ENABLE",
|
@@ -301,7 +358,10 @@ var FieldConditional = import_zod.z.discriminatedUnion("type", [
|
|
301
358
|
EnableConditional,
|
302
359
|
// Field output can be shown / hidden on the review page
|
303
360
|
DisplayOnReviewConditional
|
304
|
-
])
|
361
|
+
]).openapi({
|
362
|
+
description: "Field conditional configuration",
|
363
|
+
ref: "FieldConditional"
|
364
|
+
});
|
305
365
|
|
306
366
|
// ../commons/src/events/PageConfig.ts
|
307
367
|
var import_zod6 = require("zod");
|
@@ -311,6 +371,8 @@ var import_zod5 = require("zod");
|
|
311
371
|
|
312
372
|
// ../commons/src/events/TranslationConfig.ts
|
313
373
|
var import_zod2 = require("zod");
|
374
|
+
var import_zod_openapi2 = require("zod-openapi");
|
375
|
+
(0, import_zod_openapi2.extendZodWithOpenApi)(import_zod2.z);
|
314
376
|
var TranslationConfig = import_zod2.z.object({
|
315
377
|
id: import_zod2.z.string().describe(
|
316
378
|
"The identifier of the translation referred in translation CSV files"
|
@@ -319,10 +381,16 @@ var TranslationConfig = import_zod2.z.object({
|
|
319
381
|
description: import_zod2.z.string().describe(
|
320
382
|
"Describe the translation for a translator to be able to identify it."
|
321
383
|
)
|
384
|
+
}).openapi({
|
385
|
+
description: "Translation configuration",
|
386
|
+
ref: "TranslationConfig"
|
322
387
|
});
|
323
388
|
|
324
389
|
// ../commons/src/events/FieldType.ts
|
325
390
|
var FieldType = {
|
391
|
+
NAME: "NAME",
|
392
|
+
PHONE: "PHONE",
|
393
|
+
ID: "ID",
|
326
394
|
ADDRESS: "ADDRESS",
|
327
395
|
TEXT: "TEXT",
|
328
396
|
NUMBER: "NUMBER",
|
@@ -399,6 +467,16 @@ var UrbanAddressUpdateValue = AdminStructure.extend({
|
|
399
467
|
number: import_zod3.z.string().nullish(),
|
400
468
|
zipCode: import_zod3.z.string().nullish()
|
401
469
|
});
|
470
|
+
var NameFieldValue = import_zod3.z.object({
|
471
|
+
firstname: import_zod3.z.string(),
|
472
|
+
surname: import_zod3.z.string(),
|
473
|
+
middlename: import_zod3.z.string().optional()
|
474
|
+
});
|
475
|
+
var NameFieldUpdateValue = import_zod3.z.object({
|
476
|
+
firstname: import_zod3.z.string(),
|
477
|
+
surname: import_zod3.z.string(),
|
478
|
+
middlename: import_zod3.z.string().nullish()
|
479
|
+
}).or(import_zod3.z.null()).or(import_zod3.z.undefined());
|
402
480
|
var RuralAddressUpdateValue = AdminStructure.extend({
|
403
481
|
urbanOrRural: import_zod3.z.literal(GeographicalArea.RURAL),
|
404
482
|
village: import_zod3.z.string().nullish()
|
@@ -448,6 +526,7 @@ var EmailValue = import_zod4.z.string().email();
|
|
448
526
|
var CheckboxFieldValue = import_zod4.z.boolean();
|
449
527
|
var NumberFieldValue = import_zod4.z.number();
|
450
528
|
var DataFieldValue = import_zod4.z.undefined();
|
529
|
+
var SignatureFieldValue = import_zod4.z.string();
|
451
530
|
var FieldValue = import_zod4.z.union([
|
452
531
|
TextValue,
|
453
532
|
DateValue,
|
@@ -459,7 +538,9 @@ var FieldValue = import_zod4.z.union([
|
|
459
538
|
UrbanAddressValue,
|
460
539
|
RuralAddressValue,
|
461
540
|
DataFieldValue,
|
462
|
-
GenericAddressValue
|
541
|
+
GenericAddressValue,
|
542
|
+
NameFieldValue,
|
543
|
+
NameFieldUpdateValue
|
463
544
|
]);
|
464
545
|
var FieldUpdateValue = import_zod4.z.union([
|
465
546
|
TextValue,
|
@@ -472,23 +553,20 @@ var FieldUpdateValue = import_zod4.z.union([
|
|
472
553
|
UrbanAddressUpdateValue,
|
473
554
|
RuralAddressUpdateValue,
|
474
555
|
DataFieldValue,
|
475
|
-
GenericAddressUpdateValue
|
556
|
+
GenericAddressUpdateValue,
|
557
|
+
NameFieldUpdateValue
|
476
558
|
]);
|
477
559
|
|
478
560
|
// ../commons/src/events/FieldConfig.ts
|
479
|
-
var
|
480
|
-
|
481
|
-
|
482
|
-
|
561
|
+
var import_zod_openapi3 = require("zod-openapi");
|
562
|
+
(0, import_zod_openapi3.extendZodWithOpenApi)(import_zod5.z);
|
563
|
+
var FieldId = import_zod5.z.string().describe("Unique identifier for the field");
|
564
|
+
var FieldReference = import_zod5.z.object({
|
565
|
+
$$field: FieldId
|
566
|
+
}).describe("Reference to a field by its ID");
|
567
|
+
var ParentReference = FieldReference.optional();
|
483
568
|
var BaseField = import_zod5.z.object({
|
484
569
|
id: FieldId,
|
485
|
-
defaultValue: import_zod5.z.union([
|
486
|
-
TextValue,
|
487
|
-
NonEmptyTextValue,
|
488
|
-
DateValue,
|
489
|
-
NumberFieldValue,
|
490
|
-
CheckboxFieldValue
|
491
|
-
]).optional(),
|
492
570
|
parent: ParentReference,
|
493
571
|
conditionals: import_zod5.z.array(FieldConditional).default([]).optional(),
|
494
572
|
required: import_zod5.z.boolean().default(false).optional(),
|
@@ -500,6 +578,7 @@ var BaseField = import_zod5.z.object({
|
|
500
578
|
})
|
501
579
|
).default([]).optional(),
|
502
580
|
label: TranslationConfig,
|
581
|
+
helperText: TranslationConfig.optional(),
|
503
582
|
hideLabel: import_zod5.z.boolean().default(false).optional()
|
504
583
|
});
|
505
584
|
var Divider = BaseField.extend({
|
@@ -549,6 +628,7 @@ var SignatureField = BaseField.extend({
|
|
549
628
|
signaturePromptLabel: TranslationConfig.describe(
|
550
629
|
"Title of the signature modal"
|
551
630
|
),
|
631
|
+
defaultValue: SignatureFieldValue.optional(),
|
552
632
|
configuration: import_zod5.z.object({
|
553
633
|
maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
554
634
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
@@ -608,6 +688,7 @@ var PageHeader = BaseField.extend({
|
|
608
688
|
}).describe("A read-only header component for form pages");
|
609
689
|
var File = BaseField.extend({
|
610
690
|
type: import_zod5.z.literal(FieldType.FILE),
|
691
|
+
defaultValue: FileFieldValue.optional(),
|
611
692
|
configuration: import_zod5.z.object({
|
612
693
|
maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
613
694
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
|
@@ -650,6 +731,26 @@ var Select = BaseField.extend({
|
|
650
731
|
defaultValue: TextValue.optional(),
|
651
732
|
options: import_zod5.z.array(SelectOption).describe("A list of options")
|
652
733
|
}).describe("Select input");
|
734
|
+
var NameField = BaseField.extend({
|
735
|
+
type: import_zod5.z.literal(FieldType.NAME),
|
736
|
+
defaultValue: import_zod5.z.object({
|
737
|
+
firstname: NonEmptyTextValue,
|
738
|
+
surname: NonEmptyTextValue
|
739
|
+
}).optional(),
|
740
|
+
configuration: import_zod5.z.object({
|
741
|
+
maxLength: import_zod5.z.number().optional().describe("Maximum length of the text"),
|
742
|
+
prefix: TranslationConfig.optional(),
|
743
|
+
postfix: TranslationConfig.optional()
|
744
|
+
}).optional()
|
745
|
+
}).describe("Name input field");
|
746
|
+
var PhoneField = BaseField.extend({
|
747
|
+
defaultValue: NonEmptyTextValue.optional(),
|
748
|
+
type: import_zod5.z.literal(FieldType.PHONE)
|
749
|
+
}).describe("Phone input field");
|
750
|
+
var IdField = BaseField.extend({
|
751
|
+
defaultValue: NonEmptyTextValue.optional(),
|
752
|
+
type: import_zod5.z.literal(FieldType.ID)
|
753
|
+
}).describe("ID input field");
|
653
754
|
var Checkbox = BaseField.extend({
|
654
755
|
type: import_zod5.z.literal(FieldType.CHECKBOX),
|
655
756
|
defaultValue: CheckboxFieldValue.optional()
|
@@ -681,6 +782,7 @@ var Location = BaseField.extend({
|
|
681
782
|
var FileUploadWithOptions = BaseField.extend({
|
682
783
|
type: import_zod5.z.literal(FieldType.FILE_WITH_OPTIONS),
|
683
784
|
options: import_zod5.z.array(SelectOption).describe("A list of options"),
|
785
|
+
defaultValue: FileFieldWithOptionValue.optional(),
|
684
786
|
configuration: import_zod5.z.object({
|
685
787
|
maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
686
788
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
@@ -728,6 +830,9 @@ var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
|
728
830
|
BulletList,
|
729
831
|
PageHeader,
|
730
832
|
Select,
|
833
|
+
NameField,
|
834
|
+
PhoneField,
|
835
|
+
IdField,
|
731
836
|
Checkbox,
|
732
837
|
File,
|
733
838
|
Country,
|
@@ -740,9 +845,14 @@ var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
|
740
845
|
EmailField,
|
741
846
|
FileUploadWithOptions,
|
742
847
|
DataField
|
743
|
-
])
|
848
|
+
]).openapi({
|
849
|
+
description: "Form field configuration",
|
850
|
+
ref: "FieldConfig"
|
851
|
+
});
|
744
852
|
|
745
853
|
// ../commons/src/events/PageConfig.ts
|
854
|
+
var import_zod_openapi4 = require("zod-openapi");
|
855
|
+
(0, import_zod_openapi4.extendZodWithOpenApi)(import_zod6.z);
|
746
856
|
var PageTypes = import_zod6.z.enum(["FORM", "VERIFICATION"]);
|
747
857
|
var PageConfigBase = import_zod6.z.object({
|
748
858
|
id: import_zod6.z.string().describe("Unique identifier for the page"),
|
@@ -751,6 +861,9 @@ var PageConfigBase = import_zod6.z.object({
|
|
751
861
|
conditional: Conditional.optional().describe(
|
752
862
|
"Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
|
753
863
|
)
|
864
|
+
}).openapi({
|
865
|
+
description: "Form page configuration",
|
866
|
+
ref: "FormPageConfig"
|
754
867
|
});
|
755
868
|
var FormPageConfig = PageConfigBase.extend({
|
756
869
|
type: import_zod6.z.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
|
@@ -764,7 +877,10 @@ var VerificationActionConfig = import_zod6.z.object({
|
|
764
877
|
body: TranslationConfig
|
765
878
|
})
|
766
879
|
})
|
767
|
-
}).describe("Actions available on the verification page")
|
880
|
+
}).describe("Actions available on the verification page").openapi({
|
881
|
+
description: "Verification action configuration",
|
882
|
+
ref: "VerificationActionConfig"
|
883
|
+
});
|
768
884
|
var VerificationPageConfig = FormPageConfig.extend({
|
769
885
|
type: import_zod6.z.literal(PageTypes.enum.VERIFICATION),
|
770
886
|
actions: VerificationActionConfig
|
@@ -850,6 +966,25 @@ var writeActions = ActionTypes.exclude([
|
|
850
966
|
ActionType.ASSIGN,
|
851
967
|
ActionType.UNASSIGN
|
852
968
|
]);
|
969
|
+
var workqueueActions = ActionTypes.exclude([
|
970
|
+
ActionType.CREATE,
|
971
|
+
ActionType.NOTIFY,
|
972
|
+
ActionType.DETECT_DUPLICATE,
|
973
|
+
ActionType.REJECT,
|
974
|
+
ActionType.MARKED_AS_DUPLICATE,
|
975
|
+
ActionType.ARCHIVE,
|
976
|
+
ActionType.REQUEST_CORRECTION,
|
977
|
+
ActionType.REJECT_CORRECTION,
|
978
|
+
ActionType.APPROVE_CORRECTION
|
979
|
+
]);
|
980
|
+
var META_ACTIONS = [
|
981
|
+
ActionType.ASSIGN,
|
982
|
+
ActionType.UNASSIGN,
|
983
|
+
ActionType.READ
|
984
|
+
];
|
985
|
+
function isMetaAction(actionType) {
|
986
|
+
return META_ACTIONS.includes(actionType);
|
987
|
+
}
|
853
988
|
|
854
989
|
// ../commons/src/events/FormConfig.ts
|
855
990
|
var import_zod8 = require("zod");
|
@@ -864,8 +999,8 @@ var ActionFormConfig = import_zod8.z.object({
|
|
864
999
|
var FormConfig = import_zod8.z.union([DeclarationFormConfig, ActionFormConfig]);
|
865
1000
|
|
866
1001
|
// ../commons/src/events/ActionConfig.ts
|
867
|
-
var
|
868
|
-
(0,
|
1002
|
+
var import_zod_openapi5 = require("zod-openapi");
|
1003
|
+
(0, import_zod_openapi5.extendZodWithOpenApi)(import_zod9.z);
|
869
1004
|
var ActionConditional2 = import_zod9.z.discriminatedUnion("type", [
|
870
1005
|
/** If conditional is defined, the action is shown to the user only if the condition is met */
|
871
1006
|
ShowConditional,
|
@@ -881,6 +1016,12 @@ var ActionConfigBase = import_zod9.z.object({
|
|
881
1016
|
conditionals: import_zod9.z.array(ActionConditional2).optional().default([]),
|
882
1017
|
draft: import_zod9.z.boolean().optional()
|
883
1018
|
});
|
1019
|
+
var ReadActionConfig = ActionConfigBase.merge(
|
1020
|
+
import_zod9.z.object({
|
1021
|
+
type: import_zod9.z.literal(ActionType.READ),
|
1022
|
+
review: DeclarationReviewConfig
|
1023
|
+
})
|
1024
|
+
);
|
884
1025
|
var DeclareConfig = ActionConfigBase.merge(
|
885
1026
|
import_zod9.z.object({
|
886
1027
|
type: import_zod9.z.literal(ActionType.DECLARE),
|
@@ -947,6 +1088,7 @@ var ActionConfig = import_zod9.z.discriminatedUnion("type", [
|
|
947
1088
|
* OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
|
948
1089
|
* and treat them as "models" instead of duplicating the data structure in each endpoint.
|
949
1090
|
*/
|
1091
|
+
ReadActionConfig.openapi({ ref: "ReadActionConfig" }),
|
950
1092
|
DeclareConfig.openapi({ ref: "DeclareActionConfig" }),
|
951
1093
|
ValidateConfig.openapi({ ref: "ValidateActionConfig" }),
|
952
1094
|
RejectDeclarationConfig.openapi({ ref: "RejectDeclarationActionConfig" }),
|
@@ -1004,13 +1146,13 @@ var LanguageConfig = import_zod11.z.object({
|
|
1004
1146
|
});
|
1005
1147
|
|
1006
1148
|
// ../commons/src/events/EventConfig.ts
|
1007
|
-
var
|
1149
|
+
var import_zod18 = require("zod");
|
1008
1150
|
|
1009
1151
|
// ../commons/src/events/DeduplicationConfig.ts
|
1010
1152
|
var import_zod12 = require("zod");
|
1011
|
-
var
|
1012
|
-
(0,
|
1013
|
-
var
|
1153
|
+
var import_zod_openapi6 = require("zod-openapi");
|
1154
|
+
(0, import_zod_openapi6.extendZodWithOpenApi)(import_zod12.z);
|
1155
|
+
var FieldReference2 = import_zod12.z.string();
|
1014
1156
|
var Matcher = import_zod12.z.object({
|
1015
1157
|
fieldId: import_zod12.z.string(),
|
1016
1158
|
options: import_zod12.z.object({
|
@@ -1039,7 +1181,7 @@ var DateRangeMatcher = Matcher.extend({
|
|
1039
1181
|
type: import_zod12.z.literal("dateRange"),
|
1040
1182
|
options: import_zod12.z.object({
|
1041
1183
|
days: import_zod12.z.number(),
|
1042
|
-
origin:
|
1184
|
+
origin: FieldReference2,
|
1043
1185
|
boost: import_zod12.z.number().optional().default(1)
|
1044
1186
|
})
|
1045
1187
|
});
|
@@ -1047,7 +1189,7 @@ var DateDistanceMatcher = Matcher.extend({
|
|
1047
1189
|
type: import_zod12.z.literal("dateDistance"),
|
1048
1190
|
options: import_zod12.z.object({
|
1049
1191
|
days: import_zod12.z.number(),
|
1050
|
-
origin:
|
1192
|
+
origin: FieldReference2,
|
1051
1193
|
boost: import_zod12.z.number().optional().default(1)
|
1052
1194
|
})
|
1053
1195
|
});
|
@@ -1096,8 +1238,7 @@ var Field = BaseField2.extend({
|
|
1096
1238
|
value: TranslationConfig.describe(
|
1097
1239
|
"Summary field value. Can utilise values defined in configuration and EventMetadata"
|
1098
1240
|
),
|
1099
|
-
label: TranslationConfig
|
1100
|
-
emptyValueMessage: TranslationConfig.optional()
|
1241
|
+
label: TranslationConfig
|
1101
1242
|
}).describe("Custom configured field");
|
1102
1243
|
var SummaryConfig = import_zod13.z.object({
|
1103
1244
|
fields: import_zod13.z.array(import_zod13.z.union([Field, ReferenceField])).describe("Fields rendered in summary view.")
|
@@ -1110,13 +1251,58 @@ var BaseField3 = import_zod14.z.object({
|
|
1110
1251
|
config: import_zod14.z.object({
|
1111
1252
|
type: MatchType.describe("Determines the type of field")
|
1112
1253
|
}),
|
1113
|
-
options: import_zod14.z.array(SelectOption).optional()
|
1254
|
+
options: import_zod14.z.array(SelectOption).optional(),
|
1255
|
+
searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
|
1256
|
+
`
|
1257
|
+
This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
|
1258
|
+
when rendering search parameter labels \u2014 for example, in the search results page to indicate which fields were used in the search.
|
1259
|
+
|
1260
|
+
For example, a field config like { id: "child.name.firstname", label: { defaultMessage: "First Name(s)" } } would render as "First Name(s)" by default.
|
1261
|
+
|
1262
|
+
A field config like { id: "mother.firstname", label: { defaultMessage: "First Name(s)" } } would also render as "First Name(s)" by default.
|
1263
|
+
|
1264
|
+
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)",
|
1265
|
+
which is ambiguous.
|
1266
|
+
|
1267
|
+
Now, if we treat the field ID prefix as a label (e.g., "applicant.firstname" \u2192 "Applicant"), and the field label is already
|
1268
|
+
descriptive \u2014 like { id: "applicant.firstname", label: { defaultMessage: "Applicant's First Name" } } \u2014 then the resulting
|
1269
|
+
label would be "Applicant Applicant's First Name", which is redundant and awkward.
|
1270
|
+
|
1271
|
+
By setting searchCriteriaLabelPrefix to a translation config object, we can explicitly define the desired prefix
|
1272
|
+
in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
|
1273
|
+
`
|
1274
|
+
),
|
1275
|
+
conditionals: import_zod14.z.array(FieldConditional).default([]).optional().describe(
|
1276
|
+
`
|
1277
|
+
In advanced search, we sometimes need to override the default field visibility conditionals.
|
1278
|
+
|
1279
|
+
For example, Informant fields in the declaration form may have conditional logic
|
1280
|
+
that hides them based on other field values. Since the advanced search form reuses
|
1281
|
+
the declaration form config, those same conditionals would apply by default.
|
1282
|
+
|
1283
|
+
However, in advanced search we often want to make all Informant fields searchable,
|
1284
|
+
regardless of their original visibility logic. To do this, we explicitly set their
|
1285
|
+
'conditionals' to an empty array ('[]') in the search config. This ensures they
|
1286
|
+
are always rendered in the advanced search form.
|
1287
|
+
`
|
1288
|
+
)
|
1114
1289
|
});
|
1290
|
+
var SearchQueryParams = import_zod14.z.object({
|
1291
|
+
eventType: import_zod14.z.string().optional().describe(
|
1292
|
+
"Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
|
1293
|
+
)
|
1294
|
+
}).catchall(FieldValue);
|
1115
1295
|
var FieldConfigSchema = BaseField3.extend({
|
1116
1296
|
fieldId: import_zod14.z.string(),
|
1117
1297
|
fieldType: import_zod14.z.literal("field")
|
1118
1298
|
});
|
1119
|
-
var EventFieldId = import_zod14.z.enum([
|
1299
|
+
var EventFieldId = import_zod14.z.enum([
|
1300
|
+
"trackingId",
|
1301
|
+
"status",
|
1302
|
+
"legalStatus.REGISTERED.createdAt",
|
1303
|
+
"legalStatus.REGISTERED.createdAtLocation",
|
1304
|
+
"updatedAt"
|
1305
|
+
]);
|
1120
1306
|
var EventFieldConfigSchema = BaseField3.extend({
|
1121
1307
|
fieldId: EventFieldId,
|
1122
1308
|
fieldType: import_zod14.z.literal("event")
|
@@ -1134,114 +1320,134 @@ var AdvancedSearchConfig = import_zod14.z.object({
|
|
1134
1320
|
var import_lodash = require("lodash");
|
1135
1321
|
|
1136
1322
|
// ../commons/src/events/ActionDocument.ts
|
1323
|
+
var import_zod16 = require("zod");
|
1324
|
+
var import_zod_openapi7 = require("zod-openapi");
|
1325
|
+
|
1326
|
+
// ../commons/src/uuid.ts
|
1327
|
+
var import_uuid = require("uuid");
|
1137
1328
|
var import_zod15 = require("zod");
|
1138
|
-
var
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1329
|
+
var UUID = import_zod15.z.string().uuid().brand("UUID");
|
1330
|
+
function getUUID() {
|
1331
|
+
return (0, import_uuid.v4)();
|
1332
|
+
}
|
1333
|
+
|
1334
|
+
// ../commons/src/events/CreatedAtLocation.ts
|
1335
|
+
var CreatedAtLocation = UUID.nullish();
|
1336
|
+
|
1337
|
+
// ../commons/src/events/ActionDocument.ts
|
1338
|
+
(0, import_zod_openapi7.extendZodWithOpenApi)(import_zod16.z);
|
1339
|
+
var ActionUpdate = import_zod16.z.record(import_zod16.z.string(), FieldUpdateValue);
|
1340
|
+
var EventState = import_zod16.z.record(import_zod16.z.string(), FieldValue);
|
1142
1341
|
var ActionStatus = {
|
1143
1342
|
Requested: "Requested",
|
1144
1343
|
Accepted: "Accepted",
|
1145
1344
|
Rejected: "Rejected"
|
1146
1345
|
};
|
1147
|
-
var ActionBase =
|
1148
|
-
id:
|
1149
|
-
transactionId:
|
1150
|
-
createdAt:
|
1151
|
-
createdBy:
|
1152
|
-
createdByRole:
|
1346
|
+
var ActionBase = import_zod16.z.object({
|
1347
|
+
id: UUID,
|
1348
|
+
transactionId: import_zod16.z.string(),
|
1349
|
+
createdAt: import_zod16.z.string().datetime(),
|
1350
|
+
createdBy: import_zod16.z.string(),
|
1351
|
+
createdByRole: import_zod16.z.string(),
|
1352
|
+
createdBySignature: import_zod16.z.string().nullish().describe("Reference to signature of the user who created the action"),
|
1353
|
+
createdAtLocation: CreatedAtLocation,
|
1153
1354
|
declaration: ActionUpdate,
|
1154
|
-
annotation: ActionUpdate.optional(),
|
1155
|
-
|
1156
|
-
status: import_zod15.z.enum([
|
1355
|
+
annotation: ActionUpdate.optional().nullable(),
|
1356
|
+
status: import_zod16.z.enum([
|
1157
1357
|
ActionStatus.Requested,
|
1158
1358
|
ActionStatus.Accepted,
|
1159
1359
|
ActionStatus.Rejected
|
1160
1360
|
]),
|
1161
1361
|
// If the action is an asynchronous confirmation for another action, we will save the original action id here.
|
1162
|
-
originalActionId:
|
1362
|
+
originalActionId: UUID.optional().nullable()
|
1163
1363
|
});
|
1164
1364
|
var AssignedAction = ActionBase.merge(
|
1165
|
-
|
1166
|
-
type:
|
1167
|
-
assignedTo:
|
1365
|
+
import_zod16.z.object({
|
1366
|
+
type: import_zod16.z.literal(ActionType.ASSIGN),
|
1367
|
+
assignedTo: import_zod16.z.string()
|
1168
1368
|
})
|
1169
1369
|
);
|
1170
1370
|
var UnassignedAction = ActionBase.merge(
|
1171
|
-
|
1172
|
-
type:
|
1173
|
-
assignedTo:
|
1371
|
+
import_zod16.z.object({
|
1372
|
+
type: import_zod16.z.literal(ActionType.UNASSIGN),
|
1373
|
+
assignedTo: import_zod16.z.literal(null)
|
1174
1374
|
})
|
1175
1375
|
);
|
1176
1376
|
var RegisterAction = ActionBase.merge(
|
1177
|
-
|
1178
|
-
type:
|
1179
|
-
registrationNumber:
|
1377
|
+
import_zod16.z.object({
|
1378
|
+
type: import_zod16.z.literal(ActionType.REGISTER),
|
1379
|
+
registrationNumber: import_zod16.z.string().optional()
|
1180
1380
|
})
|
1181
1381
|
);
|
1182
1382
|
var DeclareAction = ActionBase.merge(
|
1183
|
-
|
1184
|
-
type:
|
1383
|
+
import_zod16.z.object({
|
1384
|
+
type: import_zod16.z.literal(ActionType.DECLARE)
|
1185
1385
|
})
|
1186
1386
|
);
|
1187
1387
|
var ValidateAction = ActionBase.merge(
|
1188
|
-
|
1189
|
-
type:
|
1388
|
+
import_zod16.z.object({
|
1389
|
+
type: import_zod16.z.literal(ActionType.VALIDATE)
|
1190
1390
|
})
|
1191
1391
|
);
|
1392
|
+
var RejectionReason = import_zod16.z.object({
|
1393
|
+
message: import_zod16.z.string().min(1, { message: "Message cannot be empty" }).describe("Message describing reason for rejection or archiving"),
|
1394
|
+
isDuplicate: import_zod16.z.boolean().optional().describe("If a declaration is duplicated")
|
1395
|
+
});
|
1192
1396
|
var RejectAction = ActionBase.merge(
|
1193
|
-
|
1194
|
-
type:
|
1397
|
+
import_zod16.z.object({
|
1398
|
+
type: import_zod16.z.literal(ActionType.REJECT),
|
1399
|
+
reason: RejectionReason
|
1195
1400
|
})
|
1196
1401
|
);
|
1197
1402
|
var MarkAsDuplicateAction = ActionBase.merge(
|
1198
|
-
|
1199
|
-
type:
|
1403
|
+
import_zod16.z.object({
|
1404
|
+
type: import_zod16.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1200
1405
|
})
|
1201
1406
|
);
|
1202
1407
|
var ArchiveAction = ActionBase.merge(
|
1203
|
-
|
1204
|
-
type:
|
1408
|
+
import_zod16.z.object({
|
1409
|
+
type: import_zod16.z.literal(ActionType.ARCHIVE),
|
1410
|
+
reason: RejectionReason
|
1205
1411
|
})
|
1206
1412
|
);
|
1207
1413
|
var CreatedAction = ActionBase.merge(
|
1208
|
-
|
1209
|
-
type:
|
1414
|
+
import_zod16.z.object({
|
1415
|
+
type: import_zod16.z.literal(ActionType.CREATE)
|
1210
1416
|
})
|
1211
1417
|
);
|
1212
1418
|
var NotifiedAction = ActionBase.merge(
|
1213
|
-
|
1214
|
-
type:
|
1419
|
+
import_zod16.z.object({
|
1420
|
+
type: import_zod16.z.literal(ActionType.NOTIFY)
|
1215
1421
|
})
|
1216
1422
|
);
|
1217
1423
|
var PrintCertificateAction = ActionBase.merge(
|
1218
|
-
|
1219
|
-
type:
|
1424
|
+
import_zod16.z.object({
|
1425
|
+
type: import_zod16.z.literal(ActionType.PRINT_CERTIFICATE)
|
1220
1426
|
})
|
1221
1427
|
);
|
1222
1428
|
var RequestedCorrectionAction = ActionBase.merge(
|
1223
|
-
|
1224
|
-
type:
|
1429
|
+
import_zod16.z.object({
|
1430
|
+
type: import_zod16.z.literal(ActionType.REQUEST_CORRECTION)
|
1225
1431
|
})
|
1226
1432
|
);
|
1227
1433
|
var ApprovedCorrectionAction = ActionBase.merge(
|
1228
|
-
|
1229
|
-
type:
|
1230
|
-
requestId:
|
1434
|
+
import_zod16.z.object({
|
1435
|
+
type: import_zod16.z.literal(ActionType.APPROVE_CORRECTION),
|
1436
|
+
requestId: import_zod16.z.string()
|
1231
1437
|
})
|
1232
1438
|
);
|
1233
1439
|
var RejectedCorrectionAction = ActionBase.merge(
|
1234
|
-
|
1235
|
-
type:
|
1236
|
-
requestId:
|
1440
|
+
import_zod16.z.object({
|
1441
|
+
type: import_zod16.z.literal(ActionType.REJECT_CORRECTION),
|
1442
|
+
requestId: import_zod16.z.string()
|
1237
1443
|
})
|
1238
1444
|
);
|
1239
1445
|
var ReadAction = ActionBase.merge(
|
1240
|
-
|
1241
|
-
type:
|
1446
|
+
import_zod16.z.object({
|
1447
|
+
type: import_zod16.z.literal(ActionType.READ)
|
1242
1448
|
})
|
1243
1449
|
);
|
1244
|
-
var ActionDocument =
|
1450
|
+
var ActionDocument = import_zod16.z.discriminatedUnion("type", [
|
1245
1451
|
CreatedAction.openapi({ ref: "CreatedAction" }),
|
1246
1452
|
ValidateAction.openapi({ ref: "ValidateAction" }),
|
1247
1453
|
RejectAction.openapi({ ref: "RejectAction" }),
|
@@ -1264,20 +1470,20 @@ var AsyncRejectActionDocument = ActionBase.omit({
|
|
1264
1470
|
declaration: true,
|
1265
1471
|
annotation: true
|
1266
1472
|
}).merge(
|
1267
|
-
|
1268
|
-
type:
|
1269
|
-
status:
|
1473
|
+
import_zod16.z.object({
|
1474
|
+
type: import_zod16.z.enum(ConfirmableActions),
|
1475
|
+
status: import_zod16.z.literal(ActionStatus.Rejected)
|
1270
1476
|
})
|
1271
1477
|
);
|
1272
|
-
var Action =
|
1273
|
-
var ResolvedUser =
|
1274
|
-
id:
|
1275
|
-
role:
|
1276
|
-
name:
|
1277
|
-
|
1278
|
-
use:
|
1279
|
-
given:
|
1280
|
-
family:
|
1478
|
+
var Action = import_zod16.z.union([ActionDocument, AsyncRejectActionDocument]);
|
1479
|
+
var ResolvedUser = import_zod16.z.object({
|
1480
|
+
id: import_zod16.z.string(),
|
1481
|
+
role: import_zod16.z.string(),
|
1482
|
+
name: import_zod16.z.array(
|
1483
|
+
import_zod16.z.object({
|
1484
|
+
use: import_zod16.z.string(),
|
1485
|
+
given: import_zod16.z.array(import_zod16.z.string()),
|
1486
|
+
family: import_zod16.z.string()
|
1281
1487
|
})
|
1282
1488
|
)
|
1283
1489
|
});
|
@@ -1288,7 +1494,7 @@ var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
1288
1494
|
var import_date_fns = require("date-fns");
|
1289
1495
|
|
1290
1496
|
// ../commons/src/events/FieldTypeMapping.ts
|
1291
|
-
var
|
1497
|
+
var import_zod17 = require("zod");
|
1292
1498
|
function mapFieldTypeToZod(type, required) {
|
1293
1499
|
let schema;
|
1294
1500
|
switch (type) {
|
@@ -1314,7 +1520,8 @@ function mapFieldTypeToZod(type, required) {
|
|
1314
1520
|
case FieldType.ADMINISTRATIVE_AREA:
|
1315
1521
|
case FieldType.FACILITY:
|
1316
1522
|
case FieldType.OFFICE:
|
1317
|
-
case FieldType.
|
1523
|
+
case FieldType.PHONE:
|
1524
|
+
case FieldType.ID:
|
1318
1525
|
schema = required ? NonEmptyTextValue : TextValue;
|
1319
1526
|
break;
|
1320
1527
|
case FieldType.NUMBER:
|
@@ -1323,6 +1530,7 @@ function mapFieldTypeToZod(type, required) {
|
|
1323
1530
|
case FieldType.CHECKBOX:
|
1324
1531
|
schema = CheckboxFieldValue;
|
1325
1532
|
break;
|
1533
|
+
case FieldType.SIGNATURE:
|
1326
1534
|
case FieldType.FILE:
|
1327
1535
|
schema = FileFieldValue;
|
1328
1536
|
break;
|
@@ -1335,6 +1543,9 @@ function mapFieldTypeToZod(type, required) {
|
|
1335
1543
|
case FieldType.DATA:
|
1336
1544
|
schema = DataFieldValue;
|
1337
1545
|
break;
|
1546
|
+
case FieldType.NAME:
|
1547
|
+
schema = required ? NameFieldValue : NameFieldUpdateValue;
|
1548
|
+
break;
|
1338
1549
|
}
|
1339
1550
|
return required ? schema : schema.nullish();
|
1340
1551
|
}
|
@@ -1343,59 +1554,7 @@ function createValidationSchema(config) {
|
|
1343
1554
|
for (const field2 of config) {
|
1344
1555
|
shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
|
1345
1556
|
}
|
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
|
-
}
|
1557
|
+
return import_zod17.z.object(shape);
|
1399
1558
|
}
|
1400
1559
|
function mapFieldTypeToEmptyValue(field2) {
|
1401
1560
|
switch (field2.type) {
|
@@ -1408,7 +1567,6 @@ function mapFieldTypeToEmptyValue(field2) {
|
|
1408
1567
|
case FieldType.SELECT:
|
1409
1568
|
case FieldType.COUNTRY:
|
1410
1569
|
case FieldType.RADIO_GROUP:
|
1411
|
-
case FieldType.SIGNATURE:
|
1412
1570
|
case FieldType.PARAGRAPH:
|
1413
1571
|
case FieldType.ADMINISTRATIVE_AREA:
|
1414
1572
|
case FieldType.FACILITY:
|
@@ -1419,6 +1577,9 @@ function mapFieldTypeToEmptyValue(field2) {
|
|
1419
1577
|
case FieldType.CHECKBOX:
|
1420
1578
|
case FieldType.DATE_RANGE:
|
1421
1579
|
case FieldType.DATA:
|
1580
|
+
case FieldType.NAME:
|
1581
|
+
case FieldType.PHONE:
|
1582
|
+
case FieldType.ID:
|
1422
1583
|
return null;
|
1423
1584
|
case FieldType.ADDRESS:
|
1424
1585
|
return {
|
@@ -1434,6 +1595,7 @@ function mapFieldTypeToEmptyValue(field2) {
|
|
1434
1595
|
number: null,
|
1435
1596
|
zipCode: null
|
1436
1597
|
};
|
1598
|
+
case FieldType.SIGNATURE:
|
1437
1599
|
case FieldType.FILE:
|
1438
1600
|
return {
|
1439
1601
|
filename: "",
|
@@ -1462,6 +1624,15 @@ var isTextFieldType = (field2) => {
|
|
1462
1624
|
var isNumberFieldType = (field2) => {
|
1463
1625
|
return field2.config.type === FieldType.NUMBER;
|
1464
1626
|
};
|
1627
|
+
var isNameFieldType = (field2) => {
|
1628
|
+
return field2.config.type === FieldType.NAME;
|
1629
|
+
};
|
1630
|
+
var isPhoneFieldType = (field2) => {
|
1631
|
+
return field2.config.type === FieldType.PHONE;
|
1632
|
+
};
|
1633
|
+
var isIdFieldType = (field2) => {
|
1634
|
+
return field2.config.type === FieldType.ID;
|
1635
|
+
};
|
1465
1636
|
var isTextAreaFieldType = (field2) => {
|
1466
1637
|
return field2.config.type === FieldType.TEXTAREA;
|
1467
1638
|
};
|
@@ -1513,6 +1684,9 @@ var isOfficeFieldType = (field2) => {
|
|
1513
1684
|
var isDataFieldType = (field2) => {
|
1514
1685
|
return field2.config.type === FieldType.DATA;
|
1515
1686
|
};
|
1687
|
+
var isNonInteractiveFieldType = (field2) => {
|
1688
|
+
return field2.type === FieldType.DIVIDER || field2.type === FieldType.PAGE_HEADER || field2.type === FieldType.PARAGRAPH || field2.type === FieldType.BULLET_LIST || field2.type === FieldType.DATA;
|
1689
|
+
};
|
1516
1690
|
|
1517
1691
|
// ../commons/src/conditionals/validate.ts
|
1518
1692
|
var ajv = new import_ajv.default({
|
@@ -1593,6 +1767,11 @@ var errorMessages = {
|
|
1593
1767
|
defaultMessage: "Invalid input",
|
1594
1768
|
description: "Error message when generic field is invalid",
|
1595
1769
|
id: "v2.error.invalid"
|
1770
|
+
},
|
1771
|
+
unexpectedField: {
|
1772
|
+
defaultMessage: "Unexpected field",
|
1773
|
+
description: "Error message when field is not expected",
|
1774
|
+
id: "v2.error.unexpectedField"
|
1596
1775
|
}
|
1597
1776
|
};
|
1598
1777
|
function createIntlError(message) {
|
@@ -1688,11 +1867,44 @@ function runFieldValidations({
|
|
1688
1867
|
errors: [...fieldValidationResult, ...customValidationResults]
|
1689
1868
|
};
|
1690
1869
|
}
|
1691
|
-
|
1692
|
-
|
1693
|
-
|
1694
|
-
|
1695
|
-
|
1870
|
+
function getValidatorsForField(fieldId, validations) {
|
1871
|
+
return validations.map(({ validator, message }) => {
|
1872
|
+
const jsonSchema = validator;
|
1873
|
+
const $form = jsonSchema.properties.$form;
|
1874
|
+
if ($form.properties?.[fieldId]?.type === "object") {
|
1875
|
+
return {
|
1876
|
+
message,
|
1877
|
+
validator: {
|
1878
|
+
...jsonSchema,
|
1879
|
+
properties: {
|
1880
|
+
$form: {
|
1881
|
+
type: "object",
|
1882
|
+
properties: $form.properties?.[fieldId]?.properties || {},
|
1883
|
+
required: $form.properties?.[fieldId]?.required || []
|
1884
|
+
}
|
1885
|
+
}
|
1886
|
+
}
|
1887
|
+
};
|
1888
|
+
}
|
1889
|
+
if (!$form.properties?.[fieldId]) {
|
1890
|
+
return null;
|
1891
|
+
}
|
1892
|
+
return {
|
1893
|
+
message,
|
1894
|
+
validator: {
|
1895
|
+
...jsonSchema,
|
1896
|
+
properties: {
|
1897
|
+
$form: {
|
1898
|
+
type: "object",
|
1899
|
+
properties: {
|
1900
|
+
[fieldId]: $form.properties?.[fieldId]
|
1901
|
+
},
|
1902
|
+
required: $form.required?.includes(fieldId) ? [fieldId] : []
|
1903
|
+
}
|
1904
|
+
}
|
1905
|
+
}
|
1906
|
+
};
|
1907
|
+
}).filter((x) => x !== null);
|
1696
1908
|
}
|
1697
1909
|
|
1698
1910
|
// ../commons/src/utils.ts
|
@@ -1734,6 +1946,13 @@ var getActionAnnotationFields = (actionConfig) => {
|
|
1734
1946
|
function getAllAnnotationFields(config) {
|
1735
1947
|
return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
|
1736
1948
|
}
|
1949
|
+
function getAllUniqueFields(eventConfig) {
|
1950
|
+
return (0, import_lodash.uniqBy)(getDeclarationFields(eventConfig), (field2) => field2.id);
|
1951
|
+
}
|
1952
|
+
function getDeclarationFieldById(config, fieldId) {
|
1953
|
+
const field2 = getAllUniqueFields(config).find((f) => f.id === fieldId);
|
1954
|
+
return getOrThrow(field2, `Field with id ${fieldId} not found in event config`);
|
1955
|
+
}
|
1737
1956
|
var findRecordActionPages = (config, actionType) => {
|
1738
1957
|
const action = config.actions.find((a) => a.type === actionType);
|
1739
1958
|
if (action?.type === ActionType.REQUEST_CORRECTION) {
|
@@ -1795,7 +2014,7 @@ function createEmptyDraft(eventId, draftId, actionType) {
|
|
1795
2014
|
annotation: {},
|
1796
2015
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
1797
2016
|
createdBy: "@todo",
|
1798
|
-
createdAtLocation: "
|
2017
|
+
createdAtLocation: "00000000-0000-0000-0000-000000000000",
|
1799
2018
|
status: ActionStatus.Accepted,
|
1800
2019
|
transactionId: "@todo",
|
1801
2020
|
createdByRole: "@todo"
|
@@ -1839,8 +2058,9 @@ function omitHiddenAnnotationFields(actionConfig, declaration, annotation) {
|
|
1839
2058
|
);
|
1840
2059
|
}
|
1841
2060
|
function deepMerge(currentDocument, actionDocument) {
|
2061
|
+
const currentDocumentClone = (0, import_lodash.cloneDeep)(currentDocument);
|
1842
2062
|
return (0, import_lodash.mergeWith)(
|
1843
|
-
|
2063
|
+
(0, import_lodash.cloneDeep)(currentDocumentClone),
|
1844
2064
|
actionDocument,
|
1845
2065
|
(previousValue, incomingValue) => {
|
1846
2066
|
if (incomingValue === void 0) {
|
@@ -1888,25 +2108,31 @@ function getMixedPath(obj, path, defaultValue) {
|
|
1888
2108
|
const result = resolve(obj, parts);
|
1889
2109
|
return (0, import_lodash.isNil)(result) ? defaultValue : result;
|
1890
2110
|
}
|
2111
|
+
function getEventConfigById(eventConfigs, id) {
|
2112
|
+
const eventConfig = eventConfigs.find(
|
2113
|
+
(eventConfiguration) => eventConfiguration.id === id
|
2114
|
+
);
|
2115
|
+
return getOrThrow(eventConfig, `Event config for ${id} not found`);
|
2116
|
+
}
|
1891
2117
|
|
1892
2118
|
// ../commons/src/events/EventConfig.ts
|
1893
|
-
var
|
1894
|
-
(0,
|
1895
|
-
var EventConfig =
|
1896
|
-
id:
|
2119
|
+
var import_zod_openapi8 = require("zod-openapi");
|
2120
|
+
(0, import_zod_openapi8.extendZodWithOpenApi)(import_zod18.z);
|
2121
|
+
var EventConfig = import_zod18.z.object({
|
2122
|
+
id: import_zod18.z.string().describe(
|
1897
2123
|
'A machine-readable identifier for the event, e.g. "birth" or "death"'
|
1898
2124
|
),
|
1899
|
-
dateOfEvent:
|
2125
|
+
dateOfEvent: FieldReference.optional(),
|
1900
2126
|
title: TranslationConfig,
|
1901
2127
|
fallbackTitle: TranslationConfig.optional().describe(
|
1902
2128
|
"This is a fallback title if actual title resolves to empty string"
|
1903
2129
|
),
|
1904
2130
|
summary: SummaryConfig,
|
1905
2131
|
label: TranslationConfig,
|
1906
|
-
actions:
|
2132
|
+
actions: import_zod18.z.array(ActionConfig),
|
1907
2133
|
declaration: DeclarationFormConfig,
|
1908
|
-
deduplication:
|
1909
|
-
advancedSearch:
|
2134
|
+
deduplication: import_zod18.z.array(DeduplicationConfig).optional().default([]),
|
2135
|
+
advancedSearch: import_zod18.z.array(AdvancedSearchConfig).optional().default([])
|
1910
2136
|
}).superRefine((event2, ctx) => {
|
1911
2137
|
const allFields = findAllFields(event2);
|
1912
2138
|
const fieldIds = allFields.map((field2) => field2.id);
|
@@ -1940,13 +2166,13 @@ var EventConfig = import_zod17.z.object({
|
|
1940
2166
|
}
|
1941
2167
|
if (event2.dateOfEvent) {
|
1942
2168
|
const eventDateFieldId = getDeclarationFields(event2).find(
|
1943
|
-
({ id }) => id === event2.dateOfEvent
|
2169
|
+
({ id }) => id === event2.dateOfEvent?.$$field
|
1944
2170
|
);
|
1945
2171
|
if (!eventDateFieldId) {
|
1946
2172
|
ctx.addIssue({
|
1947
2173
|
code: "custom",
|
1948
2174
|
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
|
2175
|
+
Invalid date of event field ID for event ${event2.id}: ${event2.dateOfEvent.$$field}`,
|
1950
2176
|
path: ["dateOfEvent"]
|
1951
2177
|
});
|
1952
2178
|
} else if (eventDateFieldId.type !== FieldType.DATE) {
|
@@ -1968,278 +2194,87 @@ var definePage = (page) => PageConfig.parse(page);
|
|
1968
2194
|
var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
|
1969
2195
|
|
1970
2196
|
// ../commons/src/events/WorkqueueConfig.ts
|
1971
|
-
var
|
2197
|
+
var import_zod25 = require("zod");
|
1972
2198
|
|
1973
|
-
// ../commons/src/events/
|
2199
|
+
// ../commons/src/events/serializers/user/serializer.ts
|
1974
2200
|
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()
|
2201
|
+
var SerializedUserField = import_zod19.z.object({
|
2202
|
+
$userField: import_zod19.z.enum([
|
2203
|
+
"id",
|
2204
|
+
"name",
|
2205
|
+
"role",
|
2206
|
+
"signatureFilename",
|
2207
|
+
"primaryOfficeId"
|
2208
|
+
])
|
2015
2209
|
});
|
2016
|
-
|
2017
|
-
|
2018
|
-
|
2019
|
-
|
2020
|
-
|
2021
|
-
|
2022
|
-
|
2023
|
-
|
2024
|
-
|
2025
|
-
|
2026
|
-
|
2027
|
-
|
2028
|
-
|
2029
|
-
|
2030
|
-
|
2031
|
-
|
2032
|
-
|
2033
|
-
|
2034
|
-
)
|
2035
|
-
|
2210
|
+
function userSerializer(userField) {
|
2211
|
+
return {
|
2212
|
+
$userField: userField
|
2213
|
+
};
|
2214
|
+
}
|
2215
|
+
|
2216
|
+
// ../commons/src/conditionals/conditionals.ts
|
2217
|
+
function defineConditional(schema) {
|
2218
|
+
return schema;
|
2219
|
+
}
|
2220
|
+
function defineFormConditional(schema) {
|
2221
|
+
const schemaWithForm = {
|
2222
|
+
type: "object",
|
2223
|
+
properties: {
|
2224
|
+
$form: schema
|
2225
|
+
},
|
2226
|
+
required: ["$form"]
|
2227
|
+
};
|
2228
|
+
return defineConditional(schemaWithForm);
|
2229
|
+
}
|
2230
|
+
function alwaysTrue() {
|
2231
|
+
return {};
|
2232
|
+
}
|
2233
|
+
function and(...conditions) {
|
2234
|
+
return defineConditional({
|
2235
|
+
type: "object",
|
2236
|
+
allOf: conditions,
|
2237
|
+
required: []
|
2238
|
+
});
|
2239
|
+
}
|
2240
|
+
function or(...conditions) {
|
2241
|
+
return defineConditional({
|
2242
|
+
type: "object",
|
2243
|
+
anyOf: conditions,
|
2244
|
+
required: []
|
2245
|
+
});
|
2246
|
+
}
|
2247
|
+
function not(condition) {
|
2248
|
+
return defineConditional({
|
2249
|
+
type: "object",
|
2250
|
+
not: condition,
|
2251
|
+
required: []
|
2252
|
+
});
|
2253
|
+
}
|
2254
|
+
function never() {
|
2255
|
+
return not(alwaysTrue());
|
2256
|
+
}
|
2257
|
+
var user = Object.assign(userSerializer, {
|
2258
|
+
hasScope: (scope) => defineConditional({
|
2259
|
+
type: "object",
|
2260
|
+
properties: {
|
2261
|
+
$user: {
|
2262
|
+
type: "object",
|
2263
|
+
required: ["scope"],
|
2264
|
+
properties: {
|
2265
|
+
scope: {
|
2266
|
+
type: "array",
|
2267
|
+
contains: {
|
2268
|
+
type: "string",
|
2269
|
+
const: scope
|
2270
|
+
}
|
2271
|
+
}
|
2272
|
+
}
|
2273
|
+
}
|
2274
|
+
},
|
2275
|
+
required: ["$user"]
|
2276
|
+
})
|
2036
2277
|
});
|
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
|
2057
|
-
});
|
2058
|
-
var eventMetadataLabelMap = {
|
2059
|
-
"event.assignedTo": {
|
2060
|
-
id: "event.assignedTo.label",
|
2061
|
-
defaultMessage: "Assigned To",
|
2062
|
-
description: "Assigned To"
|
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]);
|
2180
|
-
|
2181
|
-
// ../commons/src/conditionals/conditionals.ts
|
2182
|
-
function defineConditional(schema) {
|
2183
|
-
return schema;
|
2184
|
-
}
|
2185
|
-
function defineFormConditional(schema) {
|
2186
|
-
const schemaWithForm = {
|
2187
|
-
type: "object",
|
2188
|
-
properties: {
|
2189
|
-
$form: schema
|
2190
|
-
},
|
2191
|
-
required: ["$form"]
|
2192
|
-
};
|
2193
|
-
return defineConditional(schemaWithForm);
|
2194
|
-
}
|
2195
|
-
function alwaysTrue() {
|
2196
|
-
return {};
|
2197
|
-
}
|
2198
|
-
function and(...conditions) {
|
2199
|
-
return defineConditional({
|
2200
|
-
type: "object",
|
2201
|
-
allOf: conditions,
|
2202
|
-
required: []
|
2203
|
-
});
|
2204
|
-
}
|
2205
|
-
function or(...conditions) {
|
2206
|
-
return defineConditional({
|
2207
|
-
type: "object",
|
2208
|
-
anyOf: conditions,
|
2209
|
-
required: []
|
2210
|
-
});
|
2211
|
-
}
|
2212
|
-
function not(condition) {
|
2213
|
-
return defineConditional({
|
2214
|
-
type: "object",
|
2215
|
-
not: condition,
|
2216
|
-
required: []
|
2217
|
-
});
|
2218
|
-
}
|
2219
|
-
function never() {
|
2220
|
-
return not(alwaysTrue());
|
2221
|
-
}
|
2222
|
-
var user = {
|
2223
|
-
hasScope: (scope) => defineConditional({
|
2224
|
-
type: "object",
|
2225
|
-
properties: {
|
2226
|
-
$user: {
|
2227
|
-
type: "object",
|
2228
|
-
required: ["scope"],
|
2229
|
-
properties: {
|
2230
|
-
scope: {
|
2231
|
-
type: "array",
|
2232
|
-
contains: {
|
2233
|
-
type: "string",
|
2234
|
-
const: scope
|
2235
|
-
}
|
2236
|
-
}
|
2237
|
-
}
|
2238
|
-
}
|
2239
|
-
},
|
2240
|
-
required: ["$user"]
|
2241
|
-
})
|
2242
|
-
};
|
2243
2278
|
function createEventConditionals() {
|
2244
2279
|
return {
|
2245
2280
|
/**
|
@@ -2290,7 +2325,7 @@ function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
|
|
2290
2325
|
};
|
2291
2326
|
}
|
2292
2327
|
function isFieldReference(value) {
|
2293
|
-
return typeof value === "object" && value !== null && "
|
2328
|
+
return typeof value === "object" && value !== null && "$$field" in value;
|
2294
2329
|
}
|
2295
2330
|
function createFieldConditionals(fieldId) {
|
2296
2331
|
const getDateRange = (date, clause) => ({
|
@@ -2305,6 +2340,10 @@ function createFieldConditionals(fieldId) {
|
|
2305
2340
|
required: [fieldId]
|
2306
2341
|
});
|
2307
2342
|
return {
|
2343
|
+
/**
|
2344
|
+
* @private Internal property used for field reference tracking.
|
2345
|
+
*/
|
2346
|
+
$$field: fieldId,
|
2308
2347
|
isAfter: () => ({
|
2309
2348
|
days: (days) => ({
|
2310
2349
|
inPast: () => defineFormConditional(
|
@@ -2316,7 +2355,7 @@ function createFieldConditionals(fieldId) {
|
|
2316
2355
|
}),
|
2317
2356
|
date: (date) => {
|
2318
2357
|
if (isFieldReference(date)) {
|
2319
|
-
const comparedFieldId = date
|
2358
|
+
const comparedFieldId = date.$$field;
|
2320
2359
|
return defineFormConditional(
|
2321
2360
|
getDateRangeToFieldReference(
|
2322
2361
|
fieldId,
|
@@ -2340,7 +2379,7 @@ function createFieldConditionals(fieldId) {
|
|
2340
2379
|
}),
|
2341
2380
|
date: (date) => {
|
2342
2381
|
if (isFieldReference(date)) {
|
2343
|
-
const comparedFieldId = date
|
2382
|
+
const comparedFieldId = date.$$field;
|
2344
2383
|
return defineFormConditional(
|
2345
2384
|
getDateRangeToFieldReference(
|
2346
2385
|
fieldId,
|
@@ -2355,13 +2394,13 @@ function createFieldConditionals(fieldId) {
|
|
2355
2394
|
}),
|
2356
2395
|
isEqualTo: (value) => {
|
2357
2396
|
if (isFieldReference(value)) {
|
2358
|
-
const comparedFieldId = value
|
2397
|
+
const comparedFieldId = value.$$field;
|
2359
2398
|
return defineFormConditional({
|
2360
2399
|
type: "object",
|
2361
2400
|
properties: {
|
2362
2401
|
[fieldId]: {
|
2363
2402
|
type: ["string", "boolean"],
|
2364
|
-
const: { $data:
|
2403
|
+
const: { $data: `/$form/${comparedFieldId}` }
|
2365
2404
|
},
|
2366
2405
|
[comparedFieldId]: { type: ["string", "boolean"] }
|
2367
2406
|
},
|
@@ -2472,18 +2511,81 @@ function createFieldConditionals(fieldId) {
|
|
2472
2511
|
},
|
2473
2512
|
required: [fieldId]
|
2474
2513
|
}),
|
2475
|
-
getId: () => ({ fieldId })
|
2514
|
+
getId: () => ({ fieldId }),
|
2515
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2516
|
+
object: (options) => defineFormConditional({
|
2517
|
+
type: "object",
|
2518
|
+
properties: {
|
2519
|
+
[fieldId]: {
|
2520
|
+
type: "object",
|
2521
|
+
properties: Object.fromEntries(
|
2522
|
+
Object.entries(options).map(([key, value]) => {
|
2523
|
+
return [key, value.properties.$form.properties[key]];
|
2524
|
+
})
|
2525
|
+
),
|
2526
|
+
required: Object.keys(options)
|
2527
|
+
}
|
2528
|
+
},
|
2529
|
+
required: [fieldId]
|
2530
|
+
})
|
2531
|
+
};
|
2532
|
+
}
|
2533
|
+
|
2534
|
+
// ../commons/src/searchConfigs.ts
|
2535
|
+
function createSearchConfig(baseField) {
|
2536
|
+
return {
|
2537
|
+
/**
|
2538
|
+
* Creates a range configuration for the specified field.
|
2539
|
+
*
|
2540
|
+
* @returns An object containing the field ID and a configuration object with a type of 'range'.
|
2541
|
+
*
|
2542
|
+
* @example event('legalStatus.REGISTERED.createdAt').range()
|
2543
|
+
* // {
|
2544
|
+
* // ...
|
2545
|
+
* // config: { type: 'range' }
|
2546
|
+
* // }
|
2547
|
+
*/
|
2548
|
+
range: () => ({
|
2549
|
+
...baseField,
|
2550
|
+
config: { type: "range" }
|
2551
|
+
}),
|
2552
|
+
/**
|
2553
|
+
* Creates a configuration for exact matching of the specified field.
|
2554
|
+
* @returns An object containing the field ID and a configuration object with a type of 'exact'.
|
2555
|
+
* @example field('dob').exact()
|
2556
|
+
* // {
|
2557
|
+
* // ...
|
2558
|
+
* // config: { type: 'exact' }
|
2559
|
+
* // }
|
2560
|
+
*/
|
2561
|
+
exact: () => ({
|
2562
|
+
...baseField,
|
2563
|
+
config: { type: "exact" }
|
2564
|
+
}),
|
2565
|
+
/**
|
2566
|
+
* Creates a configuration for fuzzy matching of the specified field.
|
2567
|
+
* @returns An object containing the field ID and a configuration object with a type of 'exact'.
|
2568
|
+
* @example field('name').fuzzy()
|
2569
|
+
* // {
|
2570
|
+
* // ...
|
2571
|
+
* // config: { type: 'fuzzy' }
|
2572
|
+
* // }
|
2573
|
+
*/
|
2574
|
+
fuzzy: () => ({
|
2575
|
+
...baseField,
|
2576
|
+
config: { type: "fuzzy" }
|
2577
|
+
})
|
2476
2578
|
};
|
2477
2579
|
}
|
2478
2580
|
|
2479
2581
|
// ../commons/src/event-config/event-configuration.ts
|
2480
2582
|
function createEventFieldConfig(fieldId, options) {
|
2481
|
-
|
2583
|
+
const baseField = {
|
2482
2584
|
fieldId,
|
2483
2585
|
options,
|
2484
|
-
config: { type: "exact" },
|
2485
2586
|
fieldType: "event"
|
2486
2587
|
};
|
2588
|
+
return createSearchConfig(baseField);
|
2487
2589
|
}
|
2488
2590
|
|
2489
2591
|
// ../commons/src/events/event.ts
|
@@ -2499,135 +2601,653 @@ var event = Object.assign(eventFn, {
|
|
2499
2601
|
}
|
2500
2602
|
});
|
2501
2603
|
|
2502
|
-
// ../commons/src/events/
|
2503
|
-
var
|
2504
|
-
|
2505
|
-
|
2506
|
-
|
2604
|
+
// ../commons/src/events/WorkqueueColumnConfig.ts
|
2605
|
+
var import_zod21 = require("zod");
|
2606
|
+
|
2607
|
+
// ../commons/src/events/EventMetadata.ts
|
2608
|
+
var import_zod20 = require("zod");
|
2609
|
+
var EventStatus = import_zod20.z.enum([
|
2610
|
+
"CREATED",
|
2611
|
+
"NOTIFIED",
|
2612
|
+
"DECLARED",
|
2613
|
+
"VALIDATED",
|
2614
|
+
"REGISTERED",
|
2615
|
+
"CERTIFIED",
|
2616
|
+
"REJECTED",
|
2617
|
+
"ARCHIVED"
|
2618
|
+
]);
|
2619
|
+
var CustomFlags = {
|
2620
|
+
CERTIFICATE_PRINTED: "certificate-printed"
|
2621
|
+
};
|
2622
|
+
var Flag = import_zod20.z.string().regex(
|
2623
|
+
new RegExp(
|
2624
|
+
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
2625
|
+
ActionStatus
|
2626
|
+
).join("|").toLowerCase()})$`
|
2507
2627
|
),
|
2508
|
-
|
2509
|
-
|
2510
|
-
|
2511
|
-
|
2512
|
-
|
2513
|
-
|
2628
|
+
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
2629
|
+
).or(import_zod20.z.nativeEnum(CustomFlags));
|
2630
|
+
var ZodDate = import_zod20.z.string().date();
|
2631
|
+
var ActionCreationMetadata = import_zod20.z.object({
|
2632
|
+
createdAt: import_zod20.z.string().datetime().describe("The timestamp when the action request was created."),
|
2633
|
+
createdBy: import_zod20.z.string().describe("ID of the user who created the action request."),
|
2634
|
+
createdAtLocation: CreatedAtLocation.describe(
|
2635
|
+
"Location of the user who created the action request."
|
2514
2636
|
),
|
2515
|
-
|
2516
|
-
|
2517
|
-
).
|
2518
|
-
{
|
2519
|
-
label: {
|
2520
|
-
id: "workqueues.dateOfEvent",
|
2521
|
-
defaultMessage: "Date of Event",
|
2522
|
-
description: "Label for workqueue column: dateOfEvent"
|
2523
|
-
},
|
2524
|
-
value: event.field("dateOfEvent")
|
2525
|
-
}
|
2526
|
-
])
|
2527
|
-
}).describe("Configuration for workqueue.");
|
2528
|
-
function defineWorkqueue(workqueues) {
|
2529
|
-
return workqueues.map((workqueue) => WorkqueueConfig.parse(workqueue));
|
2530
|
-
}
|
2531
|
-
|
2532
|
-
// ../commons/src/events/Draft.ts
|
2533
|
-
var import_zod22 = require("zod");
|
2534
|
-
|
2535
|
-
// ../commons/src/events/ActionInput.ts
|
2536
|
-
var import_zod21 = require("zod");
|
2537
|
-
var import_zod_openapi5 = require("zod-openapi");
|
2538
|
-
(0, import_zod_openapi5.extendZodWithOpenApi)(import_zod21.z);
|
2539
|
-
var BaseActionInput = import_zod21.z.object({
|
2540
|
-
eventId: import_zod21.z.string(),
|
2541
|
-
transactionId: import_zod21.z.string(),
|
2542
|
-
declaration: ActionUpdate.default({}),
|
2543
|
-
annotation: ActionUpdate.optional(),
|
2544
|
-
originalActionId: import_zod21.z.string().optional(),
|
2545
|
-
keepAssignment: import_zod21.z.boolean().optional()
|
2637
|
+
acceptedAt: import_zod20.z.string().datetime().describe("Timestamp when the action request was accepted."),
|
2638
|
+
createdByRole: import_zod20.z.string().describe("Role of the user at the time of action request creation."),
|
2639
|
+
createdBySignature: import_zod20.z.string().nullish().describe("Signature of the user who created the action request.")
|
2546
2640
|
});
|
2547
|
-
var
|
2548
|
-
|
2549
|
-
|
2550
|
-
|
2551
|
-
|
2552
|
-
|
2553
|
-
|
2554
|
-
|
2555
|
-
|
2556
|
-
|
2557
|
-
|
2558
|
-
)
|
2559
|
-
|
2560
|
-
|
2561
|
-
|
2562
|
-
|
2563
|
-
|
2564
|
-
)
|
2565
|
-
|
2566
|
-
|
2567
|
-
|
2568
|
-
|
2569
|
-
)
|
2570
|
-
|
2571
|
-
|
2572
|
-
|
2573
|
-
|
2641
|
+
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
2642
|
+
registrationNumber: import_zod20.z.string().describe(
|
2643
|
+
"Registration number of the event. Always present for accepted registrations."
|
2644
|
+
)
|
2645
|
+
});
|
2646
|
+
var LegalStatuses = import_zod20.z.object({
|
2647
|
+
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
2648
|
+
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
2649
|
+
});
|
2650
|
+
var EventMetadata = import_zod20.z.object({
|
2651
|
+
id: UUID,
|
2652
|
+
type: import_zod20.z.string().describe("The type of event, such as birth, death, or marriage."),
|
2653
|
+
status: EventStatus,
|
2654
|
+
legalStatuses: LegalStatuses.describe(
|
2655
|
+
"Metadata related to the legal registration of the event, such as who registered it and when."
|
2656
|
+
),
|
2657
|
+
createdAt: import_zod20.z.string().datetime().describe("The timestamp when the event was first created and saved."),
|
2658
|
+
dateOfEvent: ZodDate.nullish(),
|
2659
|
+
createdBy: import_zod20.z.string().describe("ID of the user who created the event."),
|
2660
|
+
updatedByUserRole: import_zod20.z.string().describe("Role of the user who last updated the declaration."),
|
2661
|
+
createdAtLocation: CreatedAtLocation.describe(
|
2662
|
+
"Location of the user who created the event."
|
2663
|
+
),
|
2664
|
+
createdBySignature: import_zod20.z.string().nullish().describe("Signature of the user who created the event."),
|
2665
|
+
updatedAtLocation: UUID.nullish().describe(
|
2666
|
+
"Location of the user who last updated the declaration."
|
2667
|
+
),
|
2668
|
+
updatedAt: import_zod20.z.string().datetime().describe("Timestamp of the most recent declaration update."),
|
2669
|
+
assignedTo: import_zod20.z.string().nullish().describe("ID of the user currently assigned to the event."),
|
2670
|
+
updatedBy: import_zod20.z.string().nullish().describe("ID of the user who last updated the declaration."),
|
2671
|
+
trackingId: import_zod20.z.string().describe(
|
2672
|
+
"System-generated tracking ID used by informants or registrars to look up the event."
|
2673
|
+
),
|
2674
|
+
flags: import_zod20.z.array(Flag)
|
2675
|
+
});
|
2676
|
+
var EventMetadataKeysArray = [
|
2677
|
+
"id",
|
2678
|
+
"type",
|
2679
|
+
"status",
|
2680
|
+
"createdAt",
|
2681
|
+
"dateOfEvent",
|
2682
|
+
"createdBy",
|
2683
|
+
"updatedByUserRole",
|
2684
|
+
"createdAtLocation",
|
2685
|
+
"updatedAtLocation",
|
2686
|
+
"updatedAt",
|
2687
|
+
"assignedTo",
|
2688
|
+
"updatedBy",
|
2689
|
+
"trackingId",
|
2690
|
+
"legalStatuses",
|
2691
|
+
"flags"
|
2692
|
+
];
|
2693
|
+
var EventMetadataKeys = import_zod20.z.enum(EventMetadataKeysArray);
|
2694
|
+
var eventMetadataLabelMap = {
|
2695
|
+
"event.assignedTo": {
|
2696
|
+
id: "event.assignedTo.label",
|
2697
|
+
defaultMessage: "Assigned To",
|
2698
|
+
description: "Assigned To"
|
2699
|
+
},
|
2700
|
+
"event.createdAt": {
|
2701
|
+
id: "event.createdAt.label",
|
2702
|
+
defaultMessage: "Created",
|
2703
|
+
description: "Created At"
|
2704
|
+
},
|
2705
|
+
"event.dateOfEvent": {
|
2706
|
+
id: "event.dateOfEvent.label",
|
2707
|
+
defaultMessage: "Date of Event",
|
2708
|
+
description: "Date of Event"
|
2709
|
+
},
|
2710
|
+
"event.createdAtLocation": {
|
2711
|
+
id: "event.createdAtLocation.label",
|
2712
|
+
defaultMessage: "Location",
|
2713
|
+
description: "Created At Location"
|
2714
|
+
},
|
2715
|
+
"event.updatedAtLocation": {
|
2716
|
+
id: "event.updatedAtLocation.label",
|
2717
|
+
defaultMessage: "Location",
|
2718
|
+
description: "Updated At Location"
|
2719
|
+
},
|
2720
|
+
"event.createdBy": {
|
2721
|
+
id: "event.createdBy.label",
|
2722
|
+
defaultMessage: "Created By",
|
2723
|
+
description: "Created By"
|
2724
|
+
},
|
2725
|
+
"event.updatedByUserRole": {
|
2726
|
+
id: "event.updatedByUserRole.label",
|
2727
|
+
defaultMessage: "Updated By Role",
|
2728
|
+
description: "Updated By Role"
|
2729
|
+
},
|
2730
|
+
"event.id": {
|
2731
|
+
id: "event.id.label",
|
2732
|
+
defaultMessage: "ID",
|
2733
|
+
description: "ID"
|
2734
|
+
},
|
2735
|
+
"event.updatedAt": {
|
2736
|
+
id: "event.modifiedAt.label",
|
2737
|
+
defaultMessage: "Updated",
|
2738
|
+
description: "Modified At"
|
2739
|
+
},
|
2740
|
+
"event.status": {
|
2741
|
+
id: "event.status.label",
|
2742
|
+
defaultMessage: "Status",
|
2743
|
+
description: "Status"
|
2744
|
+
},
|
2745
|
+
"event.type": {
|
2746
|
+
id: "event.type.label",
|
2747
|
+
defaultMessage: "Type",
|
2748
|
+
description: "Type"
|
2749
|
+
},
|
2750
|
+
"event.updatedBy": {
|
2751
|
+
id: "event.updatedBy.label",
|
2752
|
+
defaultMessage: "Updated By",
|
2753
|
+
description: "Updated By"
|
2754
|
+
},
|
2755
|
+
"event.trackingId": {
|
2756
|
+
id: "event.trackingId.label",
|
2757
|
+
defaultMessage: "Tracking ID",
|
2758
|
+
description: "Tracking ID"
|
2759
|
+
},
|
2760
|
+
"event.flags": {
|
2761
|
+
id: "event.flags.label",
|
2762
|
+
defaultMessage: "Flags",
|
2763
|
+
description: "Flags"
|
2764
|
+
}
|
2765
|
+
};
|
2766
|
+
|
2767
|
+
// ../commons/src/events/WorkqueueColumnConfig.ts
|
2768
|
+
var WorkqueueColumnKeysArray = [
|
2769
|
+
...EventMetadataKeysArray,
|
2770
|
+
"title"
|
2771
|
+
];
|
2772
|
+
var WorkqueueColumnKeys = import_zod21.z.enum(WorkqueueColumnKeysArray);
|
2773
|
+
var WorkqueueColumnValue = import_zod21.z.object({
|
2774
|
+
$event: WorkqueueColumnKeys
|
2775
|
+
});
|
2776
|
+
var WorkqueueColumn = import_zod21.z.object({
|
2777
|
+
label: TranslationConfig,
|
2778
|
+
value: WorkqueueColumnValue
|
2779
|
+
});
|
2780
|
+
function defineWorkqueuesColumns(workqueueColumns) {
|
2781
|
+
return workqueueColumns.map(
|
2782
|
+
(workqueueColumn) => WorkqueueColumn.parse(workqueueColumn)
|
2783
|
+
);
|
2784
|
+
}
|
2785
|
+
|
2786
|
+
// ../commons/src/events/CountryConfigQueryInput.ts
|
2787
|
+
var import_zod23 = require("zod");
|
2788
|
+
|
2789
|
+
// ../commons/src/events/EventIndex.ts
|
2790
|
+
var import_zod22 = require("zod");
|
2791
|
+
var import_zod_openapi9 = require("zod-openapi");
|
2792
|
+
(0, import_zod_openapi9.extendZodWithOpenApi)(import_zod22.z);
|
2793
|
+
var EventIndex = EventMetadata.extend({
|
2794
|
+
declaration: EventState
|
2795
|
+
}).openapi({
|
2796
|
+
ref: "EventIndex"
|
2797
|
+
});
|
2798
|
+
var EventSearchIndex = import_zod22.z.record(import_zod22.z.string(), import_zod22.z.any()).and(
|
2799
|
+
import_zod22.z.object({
|
2800
|
+
type: import_zod22.z.string()
|
2801
|
+
// Ensures "type" (event-id) exists and is a string
|
2802
|
+
})
|
2803
|
+
).openapi({
|
2804
|
+
ref: "EventSearchIndex"
|
2805
|
+
});
|
2806
|
+
var Fuzzy = import_zod22.z.object({ type: import_zod22.z.literal("fuzzy"), term: import_zod22.z.string() }).openapi({
|
2807
|
+
ref: "Fuzzy"
|
2808
|
+
});
|
2809
|
+
var Exact = import_zod22.z.object({ type: import_zod22.z.literal("exact"), term: import_zod22.z.string() }).openapi({
|
2810
|
+
ref: "Exact"
|
2811
|
+
});
|
2812
|
+
var AnyOf = import_zod22.z.object({
|
2813
|
+
type: import_zod22.z.literal("anyOf"),
|
2814
|
+
terms: import_zod22.z.array(import_zod22.z.string())
|
2815
|
+
}).openapi({
|
2816
|
+
ref: "AnyOf"
|
2817
|
+
});
|
2818
|
+
var ExactStatus = import_zod22.z.object({
|
2819
|
+
type: import_zod22.z.literal("exact"),
|
2820
|
+
term: EventStatus
|
2821
|
+
}).openapi({
|
2822
|
+
ref: "ExactStatus"
|
2823
|
+
});
|
2824
|
+
var AnyOfStatus = import_zod22.z.object({
|
2825
|
+
type: import_zod22.z.literal("anyOf"),
|
2826
|
+
terms: import_zod22.z.array(EventStatus)
|
2827
|
+
}).openapi({
|
2828
|
+
ref: "AnyOfStatus"
|
2829
|
+
});
|
2830
|
+
var Range = import_zod22.z.object({
|
2831
|
+
type: import_zod22.z.literal("range"),
|
2832
|
+
gte: import_zod22.z.string(),
|
2833
|
+
lte: import_zod22.z.string()
|
2834
|
+
}).openapi({
|
2835
|
+
ref: "Range"
|
2836
|
+
});
|
2837
|
+
var Not = import_zod22.z.object({ type: import_zod22.z.literal("not"), term: import_zod22.z.string() }).openapi({
|
2838
|
+
ref: "Not"
|
2839
|
+
});
|
2840
|
+
var Within = import_zod22.z.object({ type: import_zod22.z.literal("within"), location: import_zod22.z.string() }).openapi({
|
2841
|
+
ref: "Within"
|
2842
|
+
});
|
2843
|
+
var DateCondition = import_zod22.z.union([Exact, Range]).openapi({
|
2844
|
+
ref: "DateCondition"
|
2845
|
+
});
|
2846
|
+
var QueryInput = import_zod22.z.lazy(
|
2847
|
+
() => import_zod22.z.union([
|
2848
|
+
import_zod22.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf, Not]),
|
2849
|
+
import_zod22.z.record(import_zod22.z.string(), QueryInput)
|
2850
|
+
])
|
2851
|
+
).openapi({
|
2852
|
+
ref: "QueryInput"
|
2853
|
+
});
|
2854
|
+
var QueryExpression = import_zod22.z.object({
|
2855
|
+
eventType: import_zod22.z.string(),
|
2856
|
+
status: import_zod22.z.optional(import_zod22.z.union([AnyOfStatus, ExactStatus])),
|
2857
|
+
createdAt: import_zod22.z.optional(DateCondition),
|
2858
|
+
updatedAt: import_zod22.z.optional(DateCondition),
|
2859
|
+
"legalStatus.REGISTERED.createdAt": import_zod22.z.optional(DateCondition),
|
2860
|
+
"legalStatus.REGISTERED.createdAtLocation": import_zod22.z.optional(
|
2861
|
+
import_zod22.z.union([Within, Exact])
|
2862
|
+
),
|
2863
|
+
"legalStatus.REGISTERED.registrationNumber": import_zod22.z.optional(Exact),
|
2864
|
+
createdAtLocation: import_zod22.z.optional(import_zod22.z.union([Within, Exact])),
|
2865
|
+
updatedAtLocation: import_zod22.z.optional(import_zod22.z.union([Within, Exact])),
|
2866
|
+
assignedTo: import_zod22.z.optional(Exact),
|
2867
|
+
createdBy: import_zod22.z.optional(Exact),
|
2868
|
+
updatedBy: import_zod22.z.optional(Exact),
|
2869
|
+
trackingId: import_zod22.z.optional(Exact),
|
2870
|
+
flags: import_zod22.z.optional(import_zod22.z.array(import_zod22.z.union([AnyOf, Not]))),
|
2871
|
+
data: QueryInput
|
2872
|
+
}).partial().openapi({
|
2873
|
+
ref: "QueryExpression"
|
2874
|
+
});
|
2875
|
+
var QueryType = import_zod22.z.object({
|
2876
|
+
type: import_zod22.z.literal("and").or(import_zod22.z.literal("or")).openapi({ default: "and" }),
|
2877
|
+
clauses: import_zod22.z.preprocess(
|
2878
|
+
(val) => {
|
2879
|
+
if (typeof val === "string") {
|
2880
|
+
return [JSON.parse(val)];
|
2881
|
+
}
|
2882
|
+
if (Array.isArray(val)) {
|
2883
|
+
return val.map((v) => typeof v === "string" ? JSON.parse(v) : v);
|
2884
|
+
}
|
2885
|
+
return val;
|
2886
|
+
},
|
2887
|
+
import_zod22.z.array(QueryExpression).nonempty("At least one clause is required.").openapi({
|
2888
|
+
default: [
|
2889
|
+
{
|
2890
|
+
eventType: TENNIS_CLUB_MEMBERSHIP,
|
2891
|
+
status: {
|
2892
|
+
type: "anyOf",
|
2893
|
+
terms: EventStatus.options
|
2894
|
+
},
|
2895
|
+
updatedAt: {
|
2896
|
+
type: "range",
|
2897
|
+
gte: "2025-05-22",
|
2898
|
+
lte: "2025-05-29"
|
2899
|
+
},
|
2900
|
+
data: {}
|
2901
|
+
}
|
2902
|
+
]
|
2903
|
+
})
|
2904
|
+
)
|
2905
|
+
}).openapi({
|
2906
|
+
ref: "QueryType"
|
2907
|
+
});
|
2908
|
+
|
2909
|
+
// ../commons/src/events/CountryConfigQueryInput.ts
|
2910
|
+
var SerializableExact = import_zod23.z.object({
|
2911
|
+
type: import_zod23.z.literal("exact"),
|
2912
|
+
term: import_zod23.z.union([import_zod23.z.string(), SerializedUserField])
|
2913
|
+
});
|
2914
|
+
var SerializableWithin = import_zod23.z.object({
|
2915
|
+
type: import_zod23.z.literal("within"),
|
2916
|
+
location: import_zod23.z.union([import_zod23.z.string(), SerializedUserField])
|
2917
|
+
});
|
2918
|
+
var SerializedQueryExpression = import_zod23.z.object({
|
2919
|
+
eventType: import_zod23.z.string(),
|
2920
|
+
status: import_zod23.z.optional(import_zod23.z.union([AnyOfStatus, ExactStatus])),
|
2921
|
+
createdAt: import_zod23.z.optional(DateCondition),
|
2922
|
+
updatedAt: import_zod23.z.optional(DateCondition),
|
2923
|
+
createdAtLocation: import_zod23.z.optional(
|
2924
|
+
import_zod23.z.union([SerializableWithin, SerializableExact])
|
2925
|
+
),
|
2926
|
+
updatedAtLocation: import_zod23.z.optional(
|
2927
|
+
import_zod23.z.union([SerializableWithin, SerializableExact])
|
2928
|
+
),
|
2929
|
+
assignedTo: import_zod23.z.optional(SerializableExact),
|
2930
|
+
createdBy: import_zod23.z.optional(SerializableExact),
|
2931
|
+
updatedBy: import_zod23.z.optional(SerializableExact),
|
2932
|
+
trackingId: import_zod23.z.optional(Exact),
|
2933
|
+
flags: import_zod23.z.optional(import_zod23.z.array(import_zod23.z.union([AnyOf, Not]))),
|
2934
|
+
data: QueryInput
|
2935
|
+
}).partial();
|
2936
|
+
var Or2 = import_zod23.z.object({
|
2937
|
+
type: import_zod23.z.literal("or"),
|
2938
|
+
clauses: import_zod23.z.array(SerializedQueryExpression)
|
2939
|
+
});
|
2940
|
+
var And2 = import_zod23.z.object({
|
2941
|
+
type: import_zod23.z.literal("and"),
|
2942
|
+
clauses: import_zod23.z.array(SerializedQueryExpression)
|
2943
|
+
});
|
2944
|
+
var CountryConfigQueryType = import_zod23.z.discriminatedUnion("type", [And2, Or2]);
|
2945
|
+
var CountryConfigQueryInputType = import_zod23.z.union([
|
2946
|
+
SerializedQueryExpression,
|
2947
|
+
And2,
|
2948
|
+
Or2
|
2949
|
+
]);
|
2950
|
+
|
2951
|
+
// ../commons/src/icons.ts
|
2952
|
+
var import_zod24 = require("zod");
|
2953
|
+
var AvailableIcons = import_zod24.z.enum([
|
2954
|
+
"Archived",
|
2955
|
+
"Assigned",
|
2956
|
+
"Certified",
|
2957
|
+
"Close",
|
2958
|
+
"Collapse",
|
2959
|
+
"Draft",
|
2960
|
+
"DuplicateYellow",
|
2961
|
+
"Expand",
|
2962
|
+
"ExternalValidate",
|
2963
|
+
"FilledCheck",
|
2964
|
+
"InReview",
|
2965
|
+
"Offline",
|
2966
|
+
"Registered",
|
2967
|
+
"RequiresUpdates",
|
2968
|
+
"Sent",
|
2969
|
+
"Validated",
|
2970
|
+
"WaitingApproval",
|
2971
|
+
"ChartActivity",
|
2972
|
+
"Activity",
|
2973
|
+
"Archive",
|
2974
|
+
"ArchiveTray",
|
2975
|
+
"ArrowLeft",
|
2976
|
+
"ArrowRight",
|
2977
|
+
"Buildings",
|
2978
|
+
"Circle",
|
2979
|
+
"CaretDown",
|
2980
|
+
"CaretLeft",
|
2981
|
+
"CaretRight",
|
2982
|
+
"ChartBar",
|
2983
|
+
"ChartLine",
|
2984
|
+
"ChatCircle",
|
2985
|
+
"CheckSquare",
|
2986
|
+
"Compass",
|
2987
|
+
"Check",
|
2988
|
+
"Copy",
|
2989
|
+
"Database",
|
2990
|
+
"DotsThreeVertical",
|
2991
|
+
"DownloadSimple",
|
2992
|
+
"ArrowCounterClockwise",
|
2993
|
+
"MagnifyingGlassMinus",
|
2994
|
+
"MagnifyingGlassPlus",
|
2995
|
+
"Export",
|
2996
|
+
"Eye",
|
2997
|
+
"EyeSlash",
|
2998
|
+
"Envelope",
|
2999
|
+
"File",
|
3000
|
+
"FileSearch",
|
3001
|
+
"FileMinus",
|
3002
|
+
"FilePlus",
|
3003
|
+
"FileText",
|
3004
|
+
"FileX",
|
3005
|
+
"Handshake",
|
3006
|
+
"Gear",
|
3007
|
+
"GitBranch",
|
3008
|
+
"IdentificationCard",
|
3009
|
+
"List",
|
3010
|
+
"ListBullets",
|
3011
|
+
"Lock",
|
3012
|
+
"MagnifyingGlass",
|
3013
|
+
"MapPin",
|
3014
|
+
"Medal",
|
3015
|
+
"NotePencil",
|
3016
|
+
"Paperclip",
|
3017
|
+
"PaperPlaneTilt",
|
3018
|
+
"Pen",
|
3019
|
+
"Pencil",
|
3020
|
+
"PencilSimpleLine",
|
3021
|
+
"Phone",
|
3022
|
+
"Plus",
|
3023
|
+
"Printer",
|
3024
|
+
"SignOut",
|
3025
|
+
"Star",
|
3026
|
+
"Target",
|
3027
|
+
"TextT",
|
3028
|
+
"Trash",
|
3029
|
+
"UploadSimple",
|
3030
|
+
"User",
|
3031
|
+
"UserPlus",
|
3032
|
+
"Users",
|
3033
|
+
"WarningCircle",
|
3034
|
+
"X",
|
3035
|
+
"CircleWavyCheck",
|
3036
|
+
"CircleWavyQuestion",
|
3037
|
+
"ArchiveBox",
|
3038
|
+
"ArrowCircleDown",
|
3039
|
+
"FileArrowUp",
|
3040
|
+
"FileDotted",
|
3041
|
+
"Files",
|
3042
|
+
"PencilLine",
|
3043
|
+
"PencilCircle",
|
3044
|
+
"UserCircle",
|
3045
|
+
"Clock",
|
3046
|
+
"QrCode",
|
3047
|
+
"Webcam",
|
3048
|
+
"Sun",
|
3049
|
+
"DeviceTabletCamera",
|
3050
|
+
"Globe",
|
3051
|
+
"Fingerprint",
|
3052
|
+
"PushPin",
|
3053
|
+
"Timer"
|
3054
|
+
]);
|
3055
|
+
|
3056
|
+
// ../commons/src/events/WorkqueueConfig.ts
|
3057
|
+
var mandatoryColumns = defineWorkqueuesColumns([
|
3058
|
+
{
|
3059
|
+
label: {
|
3060
|
+
id: "workqueues.dateOfEvent",
|
3061
|
+
defaultMessage: "Date of Event",
|
3062
|
+
description: "Label for workqueue column: dateOfEvent"
|
3063
|
+
},
|
3064
|
+
value: event.field("dateOfEvent")
|
3065
|
+
},
|
3066
|
+
{
|
3067
|
+
label: {
|
3068
|
+
defaultMessage: "Last updated",
|
3069
|
+
description: "This is the label for the workqueue column",
|
3070
|
+
id: "workqueue.default.column.modifiedAt"
|
3071
|
+
},
|
3072
|
+
value: event.field("updatedAt")
|
3073
|
+
}
|
3074
|
+
]);
|
3075
|
+
var WorkqueueActionsWithDefault = import_zod25.z.enum([
|
3076
|
+
...workqueueActions.options,
|
3077
|
+
"DEFAULT"
|
3078
|
+
]);
|
3079
|
+
var WorkqueueConfig = import_zod25.z.object({
|
3080
|
+
slug: import_zod25.z.string().describe("Determines the url of the workqueue."),
|
3081
|
+
name: TranslationConfig.describe(
|
3082
|
+
"Title of the workflow (both in navigation and on the page)"
|
3083
|
+
),
|
3084
|
+
query: CountryConfigQueryType,
|
3085
|
+
actions: import_zod25.z.array(
|
3086
|
+
import_zod25.z.object({
|
3087
|
+
type: WorkqueueActionsWithDefault,
|
3088
|
+
conditionals: import_zod25.z.array(Conditional).optional()
|
3089
|
+
})
|
3090
|
+
),
|
3091
|
+
columns: import_zod25.z.array(WorkqueueColumn).default(mandatoryColumns),
|
3092
|
+
icon: AvailableIcons
|
3093
|
+
}).describe("Configuration for workqueue.");
|
3094
|
+
var WorkqueueConfigInput = import_zod25.z.object({
|
3095
|
+
slug: import_zod25.z.string().describe("Determines the url of the workqueue."),
|
3096
|
+
name: TranslationConfig.describe(
|
3097
|
+
"Title of the workflow (both in navigation and on the page)"
|
3098
|
+
),
|
3099
|
+
query: CountryConfigQueryInputType,
|
3100
|
+
actions: import_zod25.z.array(
|
3101
|
+
import_zod25.z.object({
|
3102
|
+
type: WorkqueueActionsWithDefault,
|
3103
|
+
conditionals: import_zod25.z.array(Conditional).optional()
|
3104
|
+
})
|
3105
|
+
),
|
3106
|
+
columns: import_zod25.z.array(WorkqueueColumn).default(mandatoryColumns),
|
3107
|
+
icon: AvailableIcons
|
3108
|
+
});
|
3109
|
+
function defineWorkqueue(workqueueInput) {
|
3110
|
+
const queryInput = workqueueInput.query;
|
3111
|
+
const query = "type" in queryInput ? queryInput : { type: "and", clauses: [queryInput] };
|
3112
|
+
return WorkqueueConfig.parse({ ...workqueueInput, query });
|
3113
|
+
}
|
3114
|
+
function defineWorkqueues(workqueues) {
|
3115
|
+
return workqueues.map((workqueue) => defineWorkqueue(workqueue));
|
3116
|
+
}
|
3117
|
+
var WorkqueueCountInput = import_zod25.z.array(
|
3118
|
+
import_zod25.z.object({ slug: import_zod25.z.string(), query: QueryType })
|
3119
|
+
);
|
3120
|
+
var WorkqueueCountOutput = import_zod25.z.record(import_zod25.z.string(), import_zod25.z.number());
|
3121
|
+
|
3122
|
+
// ../commons/src/events/workqueueDefaultColumns.ts
|
3123
|
+
var defaultWorkqueueColumns = [
|
3124
|
+
{
|
3125
|
+
label: {
|
3126
|
+
defaultMessage: "Title",
|
3127
|
+
description: "This is the label for the workqueue column",
|
3128
|
+
id: "workqueue.in-reveiw.column.title"
|
3129
|
+
},
|
3130
|
+
value: event.field("title")
|
3131
|
+
},
|
3132
|
+
{
|
3133
|
+
label: {
|
3134
|
+
defaultMessage: "Event",
|
3135
|
+
description: "This is the label for the workqueue column",
|
3136
|
+
id: "workqueue.default.column.event"
|
3137
|
+
},
|
3138
|
+
value: event.field("type")
|
3139
|
+
}
|
3140
|
+
];
|
3141
|
+
|
3142
|
+
// ../commons/src/events/Draft.ts
|
3143
|
+
var import_zod27 = require("zod");
|
3144
|
+
|
3145
|
+
// ../commons/src/events/ActionInput.ts
|
3146
|
+
var import_zod26 = require("zod");
|
3147
|
+
var import_zod_openapi10 = require("zod-openapi");
|
3148
|
+
(0, import_zod_openapi10.extendZodWithOpenApi)(import_zod26.z);
|
3149
|
+
var BaseActionInput = import_zod26.z.object({
|
3150
|
+
eventId: UUID,
|
3151
|
+
transactionId: import_zod26.z.string(),
|
3152
|
+
declaration: ActionUpdate.default({}),
|
3153
|
+
annotation: ActionUpdate.optional(),
|
3154
|
+
originalActionId: UUID.optional(),
|
3155
|
+
keepAssignment: import_zod26.z.boolean().optional()
|
3156
|
+
});
|
3157
|
+
var CreateActionInput = BaseActionInput.merge(
|
3158
|
+
import_zod26.z.object({
|
3159
|
+
type: import_zod26.z.literal(ActionType.CREATE).default(ActionType.CREATE),
|
3160
|
+
createdAtLocation: CreatedAtLocation
|
3161
|
+
})
|
3162
|
+
);
|
3163
|
+
var RegisterActionInput = BaseActionInput.merge(
|
3164
|
+
import_zod26.z.object({
|
3165
|
+
type: import_zod26.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
3166
|
+
registrationNumber: import_zod26.z.string().optional()
|
3167
|
+
})
|
3168
|
+
);
|
3169
|
+
var ValidateActionInput = BaseActionInput.merge(
|
3170
|
+
import_zod26.z.object({
|
3171
|
+
type: import_zod26.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
|
3172
|
+
duplicates: import_zod26.z.array(import_zod26.z.string())
|
3173
|
+
})
|
3174
|
+
);
|
3175
|
+
var NotifyActionInput = BaseActionInput.merge(
|
3176
|
+
import_zod26.z.object({
|
3177
|
+
type: import_zod26.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
|
3178
|
+
})
|
3179
|
+
).openapi({
|
3180
|
+
default: {
|
3181
|
+
eventId: "<event-id-here>",
|
3182
|
+
transactionId: getUUID(),
|
3183
|
+
declaration: {},
|
3184
|
+
annotation: {},
|
3185
|
+
type: ActionType.NOTIFY
|
3186
|
+
}
|
3187
|
+
});
|
3188
|
+
var DeclareActionInput = BaseActionInput.merge(
|
3189
|
+
import_zod26.z.object({
|
3190
|
+
type: import_zod26.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
3191
|
+
})
|
2574
3192
|
);
|
2575
3193
|
var PrintCertificateActionInput = BaseActionInput.merge(
|
2576
|
-
|
2577
|
-
type:
|
3194
|
+
import_zod26.z.object({
|
3195
|
+
type: import_zod26.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
|
2578
3196
|
})
|
2579
3197
|
);
|
2580
3198
|
var RejectDeclarationActionInput = BaseActionInput.merge(
|
2581
|
-
|
2582
|
-
type:
|
3199
|
+
import_zod26.z.object({
|
3200
|
+
type: import_zod26.z.literal(ActionType.REJECT).default(ActionType.REJECT),
|
3201
|
+
reason: RejectionReason
|
2583
3202
|
})
|
2584
3203
|
);
|
2585
3204
|
var MarkedAsDuplicateActionInput = BaseActionInput.merge(
|
2586
|
-
|
2587
|
-
type:
|
3205
|
+
import_zod26.z.object({
|
3206
|
+
type: import_zod26.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
|
2588
3207
|
})
|
2589
3208
|
);
|
2590
3209
|
var ArchiveActionInput = BaseActionInput.merge(
|
2591
|
-
|
2592
|
-
type:
|
3210
|
+
import_zod26.z.object({
|
3211
|
+
type: import_zod26.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
|
3212
|
+
reason: RejectionReason
|
2593
3213
|
})
|
2594
3214
|
);
|
2595
3215
|
var AssignActionInput = BaseActionInput.merge(
|
2596
|
-
|
2597
|
-
type:
|
2598
|
-
assignedTo:
|
3216
|
+
import_zod26.z.object({
|
3217
|
+
type: import_zod26.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
|
3218
|
+
assignedTo: import_zod26.z.string()
|
2599
3219
|
})
|
2600
3220
|
);
|
2601
3221
|
var UnassignActionInput = BaseActionInput.merge(
|
2602
|
-
|
2603
|
-
type:
|
2604
|
-
assignedTo:
|
3222
|
+
import_zod26.z.object({
|
3223
|
+
type: import_zod26.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
|
3224
|
+
assignedTo: import_zod26.z.literal(null).default(null)
|
2605
3225
|
})
|
2606
3226
|
);
|
2607
3227
|
var RequestCorrectionActionInput = BaseActionInput.merge(
|
2608
|
-
|
2609
|
-
type:
|
3228
|
+
import_zod26.z.object({
|
3229
|
+
type: import_zod26.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
2610
3230
|
})
|
2611
3231
|
);
|
2612
3232
|
var RejectCorrectionActionInput = BaseActionInput.merge(
|
2613
|
-
|
2614
|
-
requestId:
|
2615
|
-
type:
|
3233
|
+
import_zod26.z.object({
|
3234
|
+
requestId: import_zod26.z.string(),
|
3235
|
+
type: import_zod26.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
|
2616
3236
|
})
|
2617
3237
|
);
|
2618
3238
|
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
2619
|
-
|
2620
|
-
requestId:
|
2621
|
-
type:
|
3239
|
+
import_zod26.z.object({
|
3240
|
+
requestId: import_zod26.z.string(),
|
3241
|
+
type: import_zod26.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
2622
3242
|
})
|
2623
3243
|
);
|
2624
3244
|
var ReadActionInput = BaseActionInput.merge(
|
2625
|
-
|
2626
|
-
type:
|
3245
|
+
import_zod26.z.object({
|
3246
|
+
type: import_zod26.z.literal(ActionType.READ).default(ActionType.READ)
|
2627
3247
|
})
|
2628
3248
|
);
|
2629
|
-
var DeleteActionInput =
|
2630
|
-
var ActionInput =
|
3249
|
+
var DeleteActionInput = import_zod26.z.object({ eventId: UUID });
|
3250
|
+
var ActionInput = import_zod26.z.discriminatedUnion("type", [
|
2631
3251
|
CreateActionInput.openapi({ ref: "CreateActionInput" }),
|
2632
3252
|
ValidateActionInput.openapi({ ref: "ValidateActionInput" }),
|
2633
3253
|
RegisterActionInput.openapi({ ref: "RegisterActionInput" }),
|
@@ -2656,18 +3276,18 @@ var ActionInput = import_zod21.z.discriminatedUnion("type", [
|
|
2656
3276
|
});
|
2657
3277
|
|
2658
3278
|
// ../commons/src/events/Draft.ts
|
2659
|
-
var Draft =
|
2660
|
-
id:
|
2661
|
-
eventId:
|
2662
|
-
transactionId:
|
2663
|
-
createdAt:
|
3279
|
+
var Draft = import_zod27.z.object({
|
3280
|
+
id: UUID,
|
3281
|
+
eventId: UUID,
|
3282
|
+
transactionId: import_zod27.z.string(),
|
3283
|
+
createdAt: import_zod27.z.string().datetime(),
|
2664
3284
|
action: ActionBase.extend({
|
2665
3285
|
type: ActionTypes
|
2666
3286
|
}).omit({ id: true })
|
2667
3287
|
});
|
2668
3288
|
var DraftInput = BaseActionInput.extend({
|
2669
3289
|
type: ActionTypes,
|
2670
|
-
status:
|
3290
|
+
status: import_zod27.z.enum([
|
2671
3291
|
ActionStatus.Requested,
|
2672
3292
|
ActionStatus.Accepted,
|
2673
3293
|
ActionStatus.Rejected
|
@@ -2675,25 +3295,24 @@ var DraftInput = BaseActionInput.extend({
|
|
2675
3295
|
});
|
2676
3296
|
|
2677
3297
|
// ../commons/src/events/EventInput.ts
|
2678
|
-
var
|
2679
|
-
var
|
2680
|
-
|
2681
|
-
|
2682
|
-
|
2683
|
-
});
|
3298
|
+
var import_zod28 = require("zod");
|
3299
|
+
var import_uuid8 = require("uuid");
|
3300
|
+
var EventInput = import_zod28.z.object({
|
3301
|
+
transactionId: import_zod28.z.string(),
|
3302
|
+
type: import_zod28.z.string()
|
3303
|
+
}).openapi({ default: { transactionId: (0, import_uuid8.v4)(), type: "v2.birth" } });
|
2684
3304
|
|
2685
3305
|
// ../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()
|
3306
|
+
var import_zod29 = require("zod");
|
3307
|
+
var import_zod_openapi11 = require("zod-openapi");
|
3308
|
+
(0, import_zod_openapi11.extendZodWithOpenApi)(import_zod29.z);
|
3309
|
+
var EventDocument = import_zod29.z.object({
|
3310
|
+
id: UUID,
|
3311
|
+
type: import_zod29.z.string(),
|
3312
|
+
createdAt: import_zod29.z.string().datetime(),
|
3313
|
+
updatedAt: import_zod29.z.string().datetime(),
|
3314
|
+
actions: import_zod29.z.array(Action),
|
3315
|
+
trackingId: import_zod29.z.string()
|
2697
3316
|
}).openapi({ ref: "EventDocument" });
|
2698
3317
|
|
2699
3318
|
// ../commons/src/events/state/utils.ts
|
@@ -2730,6 +3349,7 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
|
|
2730
3349
|
createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
|
2731
3350
|
acceptedAt: acceptAction.createdAt,
|
2732
3351
|
createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
|
3352
|
+
createdBySignature: requestAction?.createdBySignature ?? acceptAction.createdBySignature,
|
2733
3353
|
registrationNumber
|
2734
3354
|
};
|
2735
3355
|
}
|
@@ -2758,11 +3378,11 @@ function getDeclarationActionUpdateMetadata(actions) {
|
|
2758
3378
|
}
|
2759
3379
|
function getLegalStatuses(actions) {
|
2760
3380
|
return {
|
2761
|
-
[EventStatus.DECLARED]: getDeclarationActionCreationMetadata(
|
3381
|
+
[EventStatus.enum.DECLARED]: getDeclarationActionCreationMetadata(
|
2762
3382
|
ActionType.DECLARE,
|
2763
3383
|
actions
|
2764
3384
|
),
|
2765
|
-
[EventStatus.REGISTERED]: getDeclarationActionCreationMetadata(
|
3385
|
+
[EventStatus.enum.REGISTERED]: getDeclarationActionCreationMetadata(
|
2766
3386
|
ActionType.REGISTER,
|
2767
3387
|
actions
|
2768
3388
|
)
|
@@ -2775,26 +3395,26 @@ function getStatusFromActions(actions) {
|
|
2775
3395
|
(a) => a.status === ActionStatus.Rejected
|
2776
3396
|
);
|
2777
3397
|
if (hasRejectedAction) {
|
2778
|
-
return EventStatus.REJECTED;
|
3398
|
+
return EventStatus.enum.REJECTED;
|
2779
3399
|
}
|
2780
3400
|
return actions.reduce((status, action) => {
|
2781
3401
|
switch (action.type) {
|
2782
3402
|
case ActionType.CREATE:
|
2783
|
-
return EventStatus.CREATED;
|
3403
|
+
return EventStatus.enum.CREATED;
|
2784
3404
|
case ActionType.DECLARE:
|
2785
|
-
return EventStatus.DECLARED;
|
3405
|
+
return EventStatus.enum.DECLARED;
|
2786
3406
|
case ActionType.VALIDATE:
|
2787
|
-
return EventStatus.VALIDATED;
|
3407
|
+
return EventStatus.enum.VALIDATED;
|
2788
3408
|
case ActionType.REGISTER:
|
2789
|
-
return EventStatus.REGISTERED;
|
3409
|
+
return EventStatus.enum.REGISTERED;
|
2790
3410
|
case ActionType.REJECT:
|
2791
|
-
return EventStatus.REJECTED;
|
3411
|
+
return EventStatus.enum.REJECTED;
|
2792
3412
|
case ActionType.ARCHIVE:
|
2793
|
-
return EventStatus.ARCHIVED;
|
3413
|
+
return EventStatus.enum.ARCHIVED;
|
2794
3414
|
case ActionType.NOTIFY:
|
2795
|
-
return EventStatus.NOTIFIED;
|
3415
|
+
return EventStatus.enum.NOTIFIED;
|
2796
3416
|
case ActionType.PRINT_CERTIFICATE:
|
2797
|
-
return EventStatus.CERTIFIED;
|
3417
|
+
return EventStatus.enum.CERTIFIED;
|
2798
3418
|
case ActionType.ASSIGN:
|
2799
3419
|
case ActionType.UNASSIGN:
|
2800
3420
|
case ActionType.REQUEST_CORRECTION:
|
@@ -2805,7 +3425,7 @@ function getStatusFromActions(actions) {
|
|
2805
3425
|
default:
|
2806
3426
|
return status;
|
2807
3427
|
}
|
2808
|
-
}, EventStatus.CREATED);
|
3428
|
+
}, EventStatus.enum.CREATED);
|
2809
3429
|
}
|
2810
3430
|
function getFlagsFromActions(actions) {
|
2811
3431
|
const sortedactions = actions.sort(
|
@@ -2850,23 +3470,34 @@ function getAssignedUserFromActions(actions) {
|
|
2850
3470
|
return user2;
|
2851
3471
|
}, null);
|
2852
3472
|
}
|
3473
|
+
function getAssignedUserSignatureFromActions(actions) {
|
3474
|
+
return actions.reduce((signature, action) => {
|
3475
|
+
if (action.type === ActionType.ASSIGN) {
|
3476
|
+
return action.createdBySignature || null;
|
3477
|
+
}
|
3478
|
+
if (action.type === ActionType.UNASSIGN) {
|
3479
|
+
return null;
|
3480
|
+
}
|
3481
|
+
return signature;
|
3482
|
+
}, null);
|
3483
|
+
}
|
2853
3484
|
function aggregateActionDeclarations(actions) {
|
2854
3485
|
const excludedActions = [
|
2855
3486
|
ActionType.REQUEST_CORRECTION,
|
2856
3487
|
ActionType.PRINT_CERTIFICATE
|
2857
3488
|
];
|
2858
|
-
return actions.reduce((
|
3489
|
+
return actions.reduce((declaration, action) => {
|
2859
3490
|
if (excludedActions.some((excludedAction) => excludedAction === action.type)) {
|
2860
|
-
return
|
3491
|
+
return declaration;
|
2861
3492
|
}
|
2862
3493
|
if (action.type === ActionType.APPROVE_CORRECTION) {
|
2863
3494
|
const requestAction = actions.find(({ id }) => id === action.requestId);
|
2864
3495
|
if (!requestAction) {
|
2865
|
-
return
|
3496
|
+
return declaration;
|
2866
3497
|
}
|
2867
|
-
return deepMerge(
|
3498
|
+
return deepMerge(declaration, requestAction.declaration);
|
2868
3499
|
}
|
2869
|
-
return deepMerge(
|
3500
|
+
return deepMerge(declaration, action.declaration);
|
2870
3501
|
}, {});
|
2871
3502
|
}
|
2872
3503
|
function deepDropNulls(obj) {
|
@@ -2886,7 +3517,7 @@ function deepDropNulls(obj) {
|
|
2886
3517
|
return obj;
|
2887
3518
|
}
|
2888
3519
|
function isUndeclaredDraft(status) {
|
2889
|
-
return status === EventStatus.CREATED;
|
3520
|
+
return status === EventStatus.enum.CREATED;
|
2890
3521
|
}
|
2891
3522
|
function getAcceptedActions(event2) {
|
2892
3523
|
return event2.actions.filter(
|
@@ -2894,7 +3525,7 @@ function getAcceptedActions(event2) {
|
|
2894
3525
|
);
|
2895
3526
|
}
|
2896
3527
|
var DEFAULT_DATE_OF_EVENT_PROPERTY = "createdAt";
|
2897
|
-
function getCurrentEventState(event2) {
|
3528
|
+
function getCurrentEventState(event2, config) {
|
2898
3529
|
const creationAction = event2.actions.find(
|
2899
3530
|
(action) => action.type === ActionType.CREATE
|
2900
3531
|
);
|
@@ -2906,9 +3537,17 @@ function getCurrentEventState(event2) {
|
|
2906
3537
|
event2.actions
|
2907
3538
|
);
|
2908
3539
|
const declaration = aggregateActionDeclarations(acceptedActions);
|
2909
|
-
|
2910
|
-
|
2911
|
-
|
3540
|
+
let dateOfEvent;
|
3541
|
+
if (config.dateOfEvent) {
|
3542
|
+
const parsedDate = ZodDate.safeParse(
|
3543
|
+
declaration[config.dateOfEvent.$$field]
|
3544
|
+
);
|
3545
|
+
if (parsedDate.success) {
|
3546
|
+
dateOfEvent = parsedDate.data;
|
3547
|
+
}
|
3548
|
+
} else {
|
3549
|
+
dateOfEvent = event2[DEFAULT_DATE_OF_EVENT_PROPERTY].split("T")[0];
|
3550
|
+
}
|
2912
3551
|
return deepDropNulls({
|
2913
3552
|
id: event2.id,
|
2914
3553
|
type: event2.type,
|
@@ -2917,19 +3556,24 @@ function getCurrentEventState(event2) {
|
|
2917
3556
|
createdAt: creationAction.createdAt,
|
2918
3557
|
createdBy: creationAction.createdBy,
|
2919
3558
|
createdAtLocation: creationAction.createdAtLocation,
|
3559
|
+
createdBySignature: creationAction.createdBySignature,
|
2920
3560
|
updatedAt: declarationUpdateMetadata.createdAt,
|
2921
3561
|
assignedTo: getAssignedUserFromActions(acceptedActions),
|
3562
|
+
assignedToSignature: getAssignedUserSignatureFromActions(acceptedActions),
|
2922
3563
|
updatedBy: declarationUpdateMetadata.createdBy,
|
2923
3564
|
updatedAtLocation: declarationUpdateMetadata.createdAtLocation,
|
2924
3565
|
declaration,
|
2925
3566
|
trackingId: event2.trackingId,
|
2926
|
-
// @TODO: unify this with rest of the code. It will trip us if updatedBy has different rules than updatedByUserRole
|
2927
3567
|
updatedByUserRole: declarationUpdateMetadata.createdByRole,
|
2928
3568
|
dateOfEvent,
|
2929
3569
|
flags: getFlagsFromActions(event2.actions)
|
2930
3570
|
});
|
2931
3571
|
}
|
2932
|
-
function getCurrentEventStateWithDrafts(
|
3572
|
+
function getCurrentEventStateWithDrafts({
|
3573
|
+
event: event2,
|
3574
|
+
drafts,
|
3575
|
+
configuration
|
3576
|
+
}) {
|
2933
3577
|
const actions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
2934
3578
|
const activeDrafts = findActiveDrafts(event2, drafts).map((draft) => draft.action).flatMap((action) => {
|
2935
3579
|
if (action.type === ActionType.REQUEST_CORRECTION) {
|
@@ -2948,7 +3592,7 @@ function getCurrentEventStateWithDrafts(event2, drafts) {
|
|
2948
3592
|
...event2,
|
2949
3593
|
actions: actionWithDrafts
|
2950
3594
|
};
|
2951
|
-
return getCurrentEventState(withDrafts);
|
3595
|
+
return getCurrentEventState(withDrafts, configuration);
|
2952
3596
|
}
|
2953
3597
|
function applyDraftsToEventIndex(eventIndex, drafts) {
|
2954
3598
|
const indexedAt = eventIndex.updatedAt;
|
@@ -3002,73 +3646,45 @@ function generateTransactionId() {
|
|
3002
3646
|
return getUUID();
|
3003
3647
|
}
|
3004
3648
|
|
3649
|
+
// ../commons/src/events/User.ts
|
3650
|
+
var import_zod30 = require("zod");
|
3651
|
+
var User = import_zod30.z.object({
|
3652
|
+
id: import_zod30.z.string(),
|
3653
|
+
name: import_zod30.z.array(
|
3654
|
+
import_zod30.z.object({
|
3655
|
+
use: import_zod30.z.string(),
|
3656
|
+
given: import_zod30.z.array(import_zod30.z.string()),
|
3657
|
+
family: import_zod30.z.string()
|
3658
|
+
})
|
3659
|
+
),
|
3660
|
+
role: import_zod30.z.string(),
|
3661
|
+
signatureFilename: import_zod30.z.string().optional()
|
3662
|
+
});
|
3663
|
+
|
3005
3664
|
// ../commons/src/events/test.utils.ts
|
3006
3665
|
var import_lodash2 = require("lodash");
|
3666
|
+
var import_addDays = __toESM(require("date-fns/addDays"));
|
3007
3667
|
|
3008
3668
|
// ../commons/src/field-config/field-configuration.ts
|
3009
|
-
function
|
3669
|
+
function createFieldConfig(fieldId, options) {
|
3010
3670
|
const baseField = {
|
3011
3671
|
fieldId,
|
3012
|
-
fieldType: "field"
|
3672
|
+
fieldType: "field",
|
3673
|
+
...options
|
3013
3674
|
};
|
3675
|
+
return createSearchConfig(baseField);
|
3676
|
+
}
|
3677
|
+
|
3678
|
+
// ../commons/src/events/field.ts
|
3679
|
+
function field(fieldId, options = {}) {
|
3014
3680
|
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
|
-
})
|
3056
|
-
};
|
3057
|
-
}
|
3058
|
-
|
3059
|
-
// ../commons/src/events/field.ts
|
3060
|
-
function field(fieldId) {
|
3061
|
-
return {
|
3062
|
-
/**
|
3063
|
-
* @private Internal property used for field reference tracking.
|
3064
|
-
*/
|
3065
|
-
_fieldId: fieldId,
|
3066
3681
|
...createFieldConditionals(fieldId),
|
3067
|
-
...
|
3682
|
+
...createFieldConfig(fieldId, options)
|
3068
3683
|
};
|
3069
3684
|
}
|
3070
3685
|
|
3071
|
-
// ../commons/src/fixtures/
|
3686
|
+
// ../commons/src/fixtures/forms.ts
|
3687
|
+
var import_date_fns2 = require("date-fns");
|
3072
3688
|
var PRINT_CERTIFICATE_FORM = defineActionForm({
|
3073
3689
|
label: {
|
3074
3690
|
id: "v2.event.tennis-club-membership.action.certificate.form.label",
|
@@ -3727,7 +4343,7 @@ var PRINT_CERTIFICATE_FORM = defineActionForm({
|
|
3727
4343
|
var TENNIS_CLUB_DECLARATION_REVIEW = {
|
3728
4344
|
title: {
|
3729
4345
|
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}}}}}",
|
4346
|
+
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
4347
|
description: "Title of the review page"
|
3732
4348
|
},
|
3733
4349
|
fields: [
|
@@ -3772,27 +4388,17 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
|
3772
4388
|
},
|
3773
4389
|
fields: [
|
3774
4390
|
{
|
3775
|
-
id: "applicant.
|
3776
|
-
type: FieldType.
|
4391
|
+
id: "applicant.name",
|
4392
|
+
type: FieldType.NAME,
|
3777
4393
|
required: true,
|
4394
|
+
hideLabel: true,
|
3778
4395
|
conditionals: [],
|
3779
4396
|
label: {
|
3780
|
-
defaultMessage: "Applicant's
|
4397
|
+
defaultMessage: "Applicant's name",
|
3781
4398
|
description: "This is the label for the field",
|
3782
4399
|
id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.firstname.label"
|
3783
4400
|
}
|
3784
4401
|
},
|
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
4402
|
{
|
3797
4403
|
id: "applicant.email",
|
3798
4404
|
type: "EMAIL",
|
@@ -3886,156 +4492,645 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
|
3886
4492
|
]
|
3887
4493
|
},
|
3888
4494
|
{
|
3889
|
-
id: "senior-pass",
|
3890
|
-
conditional: field("applicant.dob").isBefore().date("1950-01-01"),
|
4495
|
+
id: "senior-pass",
|
4496
|
+
conditional: field("applicant.dob").isBefore().date("1950-01-01"),
|
4497
|
+
title: {
|
4498
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.senior-pass.title",
|
4499
|
+
defaultMessage: "Assign senior pass for applicant",
|
4500
|
+
description: "This is the title of the section"
|
4501
|
+
},
|
4502
|
+
fields: [
|
4503
|
+
{
|
4504
|
+
id: "senior-pass.id",
|
4505
|
+
type: FieldType.TEXT,
|
4506
|
+
required: true,
|
4507
|
+
label: {
|
4508
|
+
defaultMessage: "Senior pass ID",
|
4509
|
+
description: "This is the label for the field",
|
4510
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.senior-pass.field.id.label"
|
4511
|
+
}
|
4512
|
+
}
|
4513
|
+
]
|
4514
|
+
},
|
4515
|
+
{
|
4516
|
+
id: "recommender",
|
4517
|
+
title: {
|
4518
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.title",
|
4519
|
+
defaultMessage: "Who is recommending the applicant?",
|
4520
|
+
description: "This is the title of the section"
|
4521
|
+
},
|
4522
|
+
fields: [
|
4523
|
+
{
|
4524
|
+
id: "recommender.none",
|
4525
|
+
type: "CHECKBOX",
|
4526
|
+
required: false,
|
4527
|
+
conditionals: [],
|
4528
|
+
label: {
|
4529
|
+
defaultMessage: "No recommender",
|
4530
|
+
description: "This is the label for the field",
|
4531
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.none.label"
|
4532
|
+
}
|
4533
|
+
},
|
4534
|
+
{
|
4535
|
+
id: "recommender.name",
|
4536
|
+
type: FieldType.NAME,
|
4537
|
+
hideLabel: true,
|
4538
|
+
required: true,
|
4539
|
+
conditionals: [
|
4540
|
+
{
|
4541
|
+
type: ConditionalType.SHOW,
|
4542
|
+
conditional: field("recommender.none").isFalsy()
|
4543
|
+
}
|
4544
|
+
],
|
4545
|
+
label: {
|
4546
|
+
defaultMessage: "Recommender's name",
|
4547
|
+
description: "This is the label for the field",
|
4548
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.firstname.label"
|
4549
|
+
}
|
4550
|
+
},
|
4551
|
+
{
|
4552
|
+
id: "recommender.id",
|
4553
|
+
type: FieldType.TEXT,
|
4554
|
+
required: true,
|
4555
|
+
conditionals: [
|
4556
|
+
{
|
4557
|
+
type: ConditionalType.SHOW,
|
4558
|
+
conditional: field("recommender.none").isFalsy()
|
4559
|
+
}
|
4560
|
+
],
|
4561
|
+
label: {
|
4562
|
+
defaultMessage: "Recommender's membership ID",
|
4563
|
+
description: "This is the label for the field",
|
4564
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.id.label"
|
4565
|
+
}
|
4566
|
+
}
|
4567
|
+
]
|
4568
|
+
}
|
4569
|
+
]
|
4570
|
+
});
|
4571
|
+
var statusOptions = [
|
4572
|
+
{
|
4573
|
+
value: "ALL",
|
4574
|
+
label: {
|
4575
|
+
defaultMessage: "Any status",
|
4576
|
+
description: "Option for form field: status of record",
|
4577
|
+
id: "v2.advancedSearch.form.recordStatusAny"
|
4578
|
+
}
|
4579
|
+
},
|
4580
|
+
{
|
4581
|
+
value: EventStatus.enum.CREATED,
|
4582
|
+
label: {
|
4583
|
+
defaultMessage: "Draft",
|
4584
|
+
description: "Option for form field: status of record",
|
4585
|
+
id: "v2.advancedSearch.form.recordStatusCreated"
|
4586
|
+
}
|
4587
|
+
},
|
4588
|
+
{
|
4589
|
+
value: EventStatus.enum.NOTIFIED,
|
4590
|
+
label: {
|
4591
|
+
defaultMessage: "Notified",
|
4592
|
+
description: "Option for form field: status of record",
|
4593
|
+
id: "v2.advancedSearch.form.recordStatusNotified"
|
4594
|
+
}
|
4595
|
+
},
|
4596
|
+
{
|
4597
|
+
value: EventStatus.enum.DECLARED,
|
4598
|
+
label: {
|
4599
|
+
defaultMessage: "Declared",
|
4600
|
+
description: "Option for form field: status of record",
|
4601
|
+
id: "v2.advancedSearch.form.recordStatusDeclared"
|
4602
|
+
}
|
4603
|
+
},
|
4604
|
+
{
|
4605
|
+
value: EventStatus.enum.VALIDATED,
|
4606
|
+
label: {
|
4607
|
+
defaultMessage: "Validated",
|
4608
|
+
description: "Option for form field: status of record",
|
4609
|
+
id: "v2.advancedSearch.form.recordStatusValidated"
|
4610
|
+
}
|
4611
|
+
},
|
4612
|
+
{
|
4613
|
+
value: EventStatus.enum.REGISTERED,
|
4614
|
+
label: {
|
4615
|
+
defaultMessage: "Registered",
|
4616
|
+
description: "Option for form field: status of record",
|
4617
|
+
id: "v2.advancedSearch.form.recordStatusRegistered"
|
4618
|
+
}
|
4619
|
+
},
|
4620
|
+
{
|
4621
|
+
value: EventStatus.enum.CERTIFIED,
|
4622
|
+
label: {
|
4623
|
+
defaultMessage: "Certified",
|
4624
|
+
description: "Option for form field: status of record",
|
4625
|
+
id: "v2.advancedSearch.form.recordStatusCertified"
|
4626
|
+
}
|
4627
|
+
},
|
4628
|
+
{
|
4629
|
+
value: EventStatus.enum.REJECTED,
|
4630
|
+
label: {
|
4631
|
+
defaultMessage: "Rejected",
|
4632
|
+
description: "Option for form field: status of record",
|
4633
|
+
id: "v2.advancedSearch.form.recordStatusRejected"
|
4634
|
+
}
|
4635
|
+
},
|
4636
|
+
{
|
4637
|
+
value: EventStatus.enum.ARCHIVED,
|
4638
|
+
label: {
|
4639
|
+
defaultMessage: "Archived",
|
4640
|
+
description: "Option for form field: status of record",
|
4641
|
+
id: "v2.advancedSearch.form.recordStatusArchived"
|
4642
|
+
}
|
4643
|
+
}
|
4644
|
+
];
|
4645
|
+
var timePeriodOptions = [
|
4646
|
+
{
|
4647
|
+
label: {
|
4648
|
+
defaultMessage: "Last 7 days",
|
4649
|
+
description: "Label for option of time period select: last 7 days",
|
4650
|
+
id: "form.section.label.timePeriodLast7Days"
|
4651
|
+
},
|
4652
|
+
value: `${(0, import_date_fns2.format)((0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 7), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
|
4653
|
+
/* @__PURE__ */ new Date(),
|
4654
|
+
"yyyy-MM-dd"
|
4655
|
+
)}`
|
4656
|
+
},
|
4657
|
+
{
|
4658
|
+
label: {
|
4659
|
+
defaultMessage: "Last 30 days",
|
4660
|
+
description: "Label for option of time period select: last 30 days",
|
4661
|
+
id: "form.section.label.timePeriodLast30Days"
|
4662
|
+
},
|
4663
|
+
value: `${(0, import_date_fns2.format)((0, import_date_fns2.subMonths)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
|
4664
|
+
/* @__PURE__ */ new Date(),
|
4665
|
+
"yyyy-MM-dd"
|
4666
|
+
)}`
|
4667
|
+
},
|
4668
|
+
{
|
4669
|
+
label: {
|
4670
|
+
defaultMessage: "Last 90 days",
|
4671
|
+
description: "Label for option of time period select: last 90 days",
|
4672
|
+
id: "form.section.label.timePeriodLast90Days"
|
4673
|
+
},
|
4674
|
+
value: `${(0, import_date_fns2.format)((0, import_date_fns2.subQuarters)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
|
4675
|
+
/* @__PURE__ */ new Date(),
|
4676
|
+
"yyyy-MM-dd"
|
4677
|
+
)}`
|
4678
|
+
},
|
4679
|
+
{
|
4680
|
+
label: {
|
4681
|
+
defaultMessage: "Last year",
|
4682
|
+
description: "Label for option of time period select: last year",
|
4683
|
+
id: "form.section.label.timePeriodLastYear"
|
4684
|
+
},
|
4685
|
+
value: `${(0, import_date_fns2.format)((0, import_date_fns2.subYears)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
|
4686
|
+
/* @__PURE__ */ new Date(),
|
4687
|
+
"yyyy-MM-dd"
|
4688
|
+
)}`
|
4689
|
+
}
|
4690
|
+
];
|
4691
|
+
|
4692
|
+
// ../commons/src/fixtures/tennis-club-membership-event.ts
|
4693
|
+
var tennisClubMembershipEvent = defineConfig({
|
4694
|
+
id: TENNIS_CLUB_MEMBERSHIP,
|
4695
|
+
label: {
|
4696
|
+
defaultMessage: "Tennis club membership application",
|
4697
|
+
description: "This is what this event is referred as in the system",
|
4698
|
+
id: "v2.event.tennis-club-membership.label"
|
4699
|
+
},
|
4700
|
+
title: {
|
4701
|
+
defaultMessage: "{applicant.name.firstname} {applicant.name.surname}",
|
4702
|
+
description: "This is the title of the summary",
|
4703
|
+
id: "v2.event.tennis-club-membership.title"
|
4704
|
+
},
|
4705
|
+
summary: {
|
4706
|
+
fields: [
|
4707
|
+
{
|
4708
|
+
fieldId: "applicant.name",
|
4709
|
+
label: {
|
4710
|
+
defaultMessage: "Applicant's name",
|
4711
|
+
description: "This is the label for the field",
|
4712
|
+
id: "event.tennis-club-membership.summary.field.firstname.label"
|
4713
|
+
},
|
4714
|
+
emptyValueMessage: {
|
4715
|
+
defaultMessage: "First name is not provided",
|
4716
|
+
description: "This is the message to show when the field is empty",
|
4717
|
+
id: "event.tennis-club-membership.summary.field.firstname.empty"
|
4718
|
+
}
|
4719
|
+
},
|
4720
|
+
{
|
4721
|
+
fieldId: "applicant.email"
|
4722
|
+
}
|
4723
|
+
]
|
4724
|
+
},
|
4725
|
+
actions: [
|
4726
|
+
{
|
4727
|
+
type: ActionType.READ,
|
4728
|
+
label: {
|
4729
|
+
id: "v2.event.tennis-club-membership.action.read.label",
|
4730
|
+
defaultMessage: "Read",
|
4731
|
+
description: "Title of the read only page"
|
4732
|
+
},
|
4733
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
4734
|
+
},
|
4735
|
+
{
|
4736
|
+
type: ActionType.DECLARE,
|
4737
|
+
label: {
|
4738
|
+
defaultMessage: "Send an application",
|
4739
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4740
|
+
id: "event.tennis-club-membership.action.declare.label"
|
4741
|
+
},
|
4742
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
4743
|
+
},
|
4744
|
+
{
|
4745
|
+
type: ActionType.VALIDATE,
|
4746
|
+
label: {
|
4747
|
+
defaultMessage: "Validate",
|
4748
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4749
|
+
id: "event.tennis-club-membership.action.validate.label"
|
4750
|
+
},
|
4751
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
4752
|
+
},
|
4753
|
+
{
|
4754
|
+
type: ActionType.REGISTER,
|
4755
|
+
label: {
|
4756
|
+
defaultMessage: "Register",
|
4757
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4758
|
+
id: "event.tennis-club-membership.action.register.label"
|
4759
|
+
},
|
4760
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
4761
|
+
},
|
4762
|
+
{
|
4763
|
+
type: ActionType.REQUEST_CORRECTION,
|
4764
|
+
label: {
|
4765
|
+
defaultMessage: "Request correction",
|
4766
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4767
|
+
id: "event.tennis-club-membership.action.correction.request.label"
|
4768
|
+
},
|
4769
|
+
onboardingForm: [
|
4770
|
+
{
|
4771
|
+
id: "correction-requester",
|
4772
|
+
type: PageTypes.enum.FORM,
|
4773
|
+
title: {
|
4774
|
+
id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
|
4775
|
+
defaultMessage: "Correction requester",
|
4776
|
+
description: "This is the title of the section"
|
4777
|
+
},
|
4778
|
+
fields: [
|
4779
|
+
{
|
4780
|
+
id: "correction.requester.relationshop.intro",
|
4781
|
+
type: "PAGE_HEADER",
|
4782
|
+
label: {
|
4783
|
+
id: "correction.requester.relationshop.intro.label",
|
4784
|
+
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.",
|
4785
|
+
description: "The title for the corrector form"
|
4786
|
+
}
|
4787
|
+
},
|
4788
|
+
{
|
4789
|
+
id: "correction.requester.relationship",
|
4790
|
+
type: "RADIO_GROUP",
|
4791
|
+
label: {
|
4792
|
+
id: "v2.correction.corrector.title",
|
4793
|
+
defaultMessage: "Who is requesting a change to this record?",
|
4794
|
+
description: "The title for the corrector form"
|
4795
|
+
},
|
4796
|
+
defaultValue: "",
|
4797
|
+
options: [
|
4798
|
+
{
|
4799
|
+
value: "INFORMANT",
|
4800
|
+
label: {
|
4801
|
+
id: "v2.correction.corrector.informant",
|
4802
|
+
defaultMessage: "Informant",
|
4803
|
+
description: "Label for informant option in certificate correction form"
|
4804
|
+
}
|
4805
|
+
},
|
4806
|
+
{
|
4807
|
+
value: "ANOTHER_AGENT",
|
4808
|
+
label: {
|
4809
|
+
id: "v2.correction.corrector.anotherAgent",
|
4810
|
+
defaultMessage: "Another registration agent or field agent",
|
4811
|
+
description: "Label for another registration or field agent option in certificate correction form"
|
4812
|
+
}
|
4813
|
+
},
|
4814
|
+
{
|
4815
|
+
value: "REGISTRAR",
|
4816
|
+
label: {
|
4817
|
+
id: "v2.correction.corrector.me",
|
4818
|
+
defaultMessage: "Me (Registrar)",
|
4819
|
+
description: "Label for registrar option in certificate correction form"
|
4820
|
+
}
|
4821
|
+
},
|
4822
|
+
{
|
4823
|
+
value: "OTHER",
|
4824
|
+
label: {
|
4825
|
+
id: "v2.correction.corrector.others",
|
4826
|
+
defaultMessage: "Someone else",
|
4827
|
+
description: "Label for someone else option in certificate correction form"
|
4828
|
+
}
|
4829
|
+
}
|
4830
|
+
]
|
4831
|
+
}
|
4832
|
+
]
|
4833
|
+
},
|
4834
|
+
{
|
4835
|
+
id: "identity-check",
|
4836
|
+
type: PageTypes.enum.FORM,
|
4837
|
+
title: {
|
4838
|
+
id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
|
4839
|
+
defaultMessage: "Verify their identity",
|
4840
|
+
description: "This is the title of the section"
|
4841
|
+
},
|
4842
|
+
fields: [
|
4843
|
+
{
|
4844
|
+
id: "correction.identity-check.instructions",
|
4845
|
+
type: "PAGE_HEADER",
|
4846
|
+
label: {
|
4847
|
+
id: "correction.corrector.identity.instruction",
|
4848
|
+
defaultMessage: "Please verify the identity of the person making this request",
|
4849
|
+
description: "The title for the corrector form"
|
4850
|
+
}
|
4851
|
+
},
|
4852
|
+
{
|
4853
|
+
id: "correction.identity-check.verified",
|
4854
|
+
type: "RADIO_GROUP",
|
4855
|
+
label: {
|
4856
|
+
id: "correction.corrector.identity.verified.label",
|
4857
|
+
defaultMessage: "Identity verified",
|
4858
|
+
description: "The title for the corrector form"
|
4859
|
+
},
|
4860
|
+
defaultValue: "",
|
4861
|
+
required: true,
|
4862
|
+
options: [
|
4863
|
+
{
|
4864
|
+
value: "VERIFIED",
|
4865
|
+
label: {
|
4866
|
+
id: "correction.corrector.identity.verified",
|
4867
|
+
defaultMessage: "I have verified their identity",
|
4868
|
+
description: "Label for verified option in corrector identity check page"
|
4869
|
+
}
|
4870
|
+
}
|
4871
|
+
]
|
4872
|
+
}
|
4873
|
+
]
|
4874
|
+
}
|
4875
|
+
],
|
4876
|
+
additionalDetailsForm: [
|
4877
|
+
{
|
4878
|
+
id: "correction-request.supporting-documents",
|
4879
|
+
type: PageTypes.enum.FORM,
|
4880
|
+
title: {
|
4881
|
+
id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
|
4882
|
+
defaultMessage: "Upload supporting documents",
|
4883
|
+
description: "This is the title of the section"
|
4884
|
+
},
|
4885
|
+
fields: [
|
4886
|
+
{
|
4887
|
+
id: "correction.supportingDocs.introduction",
|
4888
|
+
type: "PAGE_HEADER",
|
4889
|
+
label: {
|
4890
|
+
id: "correction.corrector.paragraph.title",
|
4891
|
+
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.",
|
4892
|
+
description: "The title for the corrector form"
|
4893
|
+
}
|
4894
|
+
},
|
4895
|
+
{
|
4896
|
+
id: "correction.supportingDocs",
|
4897
|
+
type: FieldType.FILE,
|
4898
|
+
label: {
|
4899
|
+
id: "correction.corrector.title",
|
4900
|
+
defaultMessage: "Upload supporting documents",
|
4901
|
+
description: "The title for the corrector form"
|
4902
|
+
}
|
4903
|
+
},
|
4904
|
+
{
|
4905
|
+
id: "correction.request.supportingDocuments",
|
4906
|
+
type: "RADIO_GROUP",
|
4907
|
+
label: {
|
4908
|
+
id: "correction.corrector.title",
|
4909
|
+
defaultMessage: "Who is requesting a change to this record?",
|
4910
|
+
description: "The title for the corrector form"
|
4911
|
+
},
|
4912
|
+
defaultValue: "",
|
4913
|
+
configuration: {
|
4914
|
+
styles: {
|
4915
|
+
size: "NORMAL"
|
4916
|
+
}
|
4917
|
+
},
|
4918
|
+
options: [
|
4919
|
+
{
|
4920
|
+
value: "ATTEST",
|
4921
|
+
label: {
|
4922
|
+
id: "correction.supportingDocuments.attest.label",
|
4923
|
+
defaultMessage: "I attest to seeing supporting documentation and have a copy filed at my office",
|
4924
|
+
description: ""
|
4925
|
+
}
|
4926
|
+
},
|
4927
|
+
{
|
4928
|
+
value: "NOT_NEEDED",
|
4929
|
+
label: {
|
4930
|
+
id: "correction.supportingDocuments.notNeeded.label",
|
4931
|
+
defaultMessage: "No supporting documents required",
|
4932
|
+
description: ""
|
4933
|
+
}
|
4934
|
+
}
|
4935
|
+
]
|
4936
|
+
}
|
4937
|
+
]
|
4938
|
+
},
|
4939
|
+
{
|
4940
|
+
id: "correction-request.additional-details",
|
4941
|
+
type: PageTypes.enum.FORM,
|
4942
|
+
title: {
|
4943
|
+
id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
|
4944
|
+
defaultMessage: "Reason for correction",
|
4945
|
+
description: "This is the title of the section"
|
4946
|
+
},
|
4947
|
+
fields: [
|
4948
|
+
{
|
4949
|
+
id: "correction.request.reason",
|
4950
|
+
type: FieldType.TEXT,
|
4951
|
+
label: {
|
4952
|
+
id: "correction.reason.title",
|
4953
|
+
defaultMessage: "Reason for correction?",
|
4954
|
+
description: "The title for the corrector form"
|
4955
|
+
}
|
4956
|
+
}
|
4957
|
+
]
|
4958
|
+
}
|
4959
|
+
]
|
4960
|
+
},
|
4961
|
+
{
|
4962
|
+
type: ActionType.APPROVE_CORRECTION,
|
4963
|
+
label: {
|
4964
|
+
defaultMessage: "Approve correction",
|
4965
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4966
|
+
id: "event.tennis-club-membership.action.correction.approve.label"
|
4967
|
+
}
|
4968
|
+
},
|
4969
|
+
{
|
4970
|
+
type: ActionType.PRINT_CERTIFICATE,
|
4971
|
+
label: {
|
4972
|
+
id: "v2.event.tennis-club-membership.action.collect-certificate.label",
|
4973
|
+
defaultMessage: "Print certificate",
|
4974
|
+
description: "This is shown as the action name anywhere the user can trigger the action from"
|
4975
|
+
},
|
4976
|
+
printForm: PRINT_CERTIFICATE_FORM,
|
4977
|
+
conditionals: [
|
4978
|
+
{
|
4979
|
+
type: "SHOW",
|
4980
|
+
conditional: defineConditional({
|
4981
|
+
type: "object",
|
4982
|
+
properties: {
|
4983
|
+
$event: {
|
4984
|
+
type: "object",
|
4985
|
+
properties: {
|
4986
|
+
actions: {
|
4987
|
+
type: "array",
|
4988
|
+
contains: {
|
4989
|
+
type: "object",
|
4990
|
+
properties: {
|
4991
|
+
type: {
|
4992
|
+
const: "REGISTER"
|
4993
|
+
},
|
4994
|
+
draft: {
|
4995
|
+
type: "boolean"
|
4996
|
+
}
|
4997
|
+
},
|
4998
|
+
required: ["type"],
|
4999
|
+
not: {
|
5000
|
+
properties: {
|
5001
|
+
draft: {
|
5002
|
+
const: true
|
5003
|
+
}
|
5004
|
+
}
|
5005
|
+
}
|
5006
|
+
}
|
5007
|
+
}
|
5008
|
+
},
|
5009
|
+
required: ["actions"]
|
5010
|
+
}
|
5011
|
+
},
|
5012
|
+
required: ["$event"]
|
5013
|
+
})
|
5014
|
+
}
|
5015
|
+
]
|
5016
|
+
},
|
5017
|
+
{
|
5018
|
+
type: ActionType.ARCHIVE,
|
5019
|
+
label: {
|
5020
|
+
id: "v2.event.tennis-club-membership.action.archive.label",
|
5021
|
+
defaultMessage: "Archive",
|
5022
|
+
description: "This is shown as the action name anywhere the user can trigger the action from"
|
5023
|
+
}
|
5024
|
+
},
|
5025
|
+
{
|
5026
|
+
type: ActionType.REJECT,
|
5027
|
+
label: {
|
5028
|
+
id: "v2.event.tennis-club-membership.action.reject.label",
|
5029
|
+
defaultMessage: "Reject",
|
5030
|
+
description: "This is shown as the action name anywhere the user can trigger the action from"
|
5031
|
+
}
|
5032
|
+
}
|
5033
|
+
],
|
5034
|
+
advancedSearch: [
|
5035
|
+
{
|
3891
5036
|
title: {
|
3892
|
-
|
3893
|
-
|
3894
|
-
|
5037
|
+
defaultMessage: "Registration details",
|
5038
|
+
description: "The title of Registration details accordion",
|
5039
|
+
id: "v2.advancedSearch.form.registrationDetails"
|
3895
5040
|
},
|
3896
5041
|
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
|
-
}
|
5042
|
+
event("legalStatus.REGISTERED.createdAtLocation").exact(),
|
5043
|
+
event("legalStatus.REGISTERED.createdAt").range(),
|
5044
|
+
event("status", statusOptions).exact(),
|
5045
|
+
event("updatedAt", timePeriodOptions).range()
|
3907
5046
|
]
|
3908
5047
|
},
|
3909
5048
|
{
|
3910
|
-
id: "recommender",
|
3911
5049
|
title: {
|
3912
|
-
|
3913
|
-
|
3914
|
-
|
5050
|
+
defaultMessage: "Applicant's details",
|
5051
|
+
description: "Applicant details search field section title",
|
5052
|
+
id: "v2.event.tennis-club-membership.search.applicants"
|
3915
5053
|
},
|
3916
5054
|
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
|
-
}
|
5055
|
+
field("applicant.name").fuzzy(),
|
5056
|
+
field("applicant.dob").range(),
|
5057
|
+
field("applicant.email").exact()
|
3976
5058
|
]
|
5059
|
+
},
|
5060
|
+
{
|
5061
|
+
title: {
|
5062
|
+
defaultMessage: "Recommender's details",
|
5063
|
+
description: "Recommender details search field section title",
|
5064
|
+
id: "v2.event.tennis-club-membership.search.recommender"
|
5065
|
+
},
|
5066
|
+
fields: [field("recommender.name").fuzzy()]
|
3977
5067
|
}
|
3978
|
-
]
|
5068
|
+
],
|
5069
|
+
declaration: TENNIS_CLUB_DECLARATION_FORM
|
3979
5070
|
});
|
3980
|
-
|
3981
|
-
|
5071
|
+
|
5072
|
+
// ../commons/src/fixtures/football-club-membership-event.ts
|
5073
|
+
var footballClubMembershipEvent = defineConfig({
|
5074
|
+
id: "FOOTBALL_CLUB_MEMBERSHIP",
|
3982
5075
|
label: {
|
3983
|
-
defaultMessage: "
|
5076
|
+
defaultMessage: "Football club membership application",
|
3984
5077
|
description: "This is what this event is referred as in the system",
|
3985
|
-
id: "event.
|
5078
|
+
id: "event.football-club-membership.label"
|
3986
5079
|
},
|
3987
5080
|
title: {
|
3988
|
-
defaultMessage: "{applicant.firstname} {applicant.surname}",
|
5081
|
+
defaultMessage: "{applicant.name.firstname} {applicant.name.surname}",
|
3989
5082
|
description: "This is the title of the summary",
|
3990
|
-
id: "v2.event.
|
5083
|
+
id: "v2.event.football-club-membership.title"
|
3991
5084
|
},
|
3992
5085
|
summary: {
|
3993
5086
|
fields: [
|
3994
5087
|
{
|
3995
|
-
id: "applicant.firstname",
|
5088
|
+
id: "applicant.name.firstname",
|
3996
5089
|
label: {
|
3997
5090
|
defaultMessage: "Applicant's first name",
|
3998
5091
|
description: "This is the label for the field",
|
3999
|
-
id: "event.
|
5092
|
+
id: "event.football-club-membership.summary.field.firstname.label"
|
4000
5093
|
},
|
4001
5094
|
value: {
|
4002
|
-
defaultMessage: "{applicant.firstname}",
|
5095
|
+
defaultMessage: "{applicant.name.firstname}",
|
4003
5096
|
description: "This is the value to show in the summary",
|
4004
|
-
id: "event.
|
5097
|
+
id: "event.football-club-membership.summary.field.firstname"
|
4005
5098
|
},
|
4006
5099
|
emptyValueMessage: {
|
4007
5100
|
defaultMessage: "First name is not provided",
|
4008
5101
|
description: "This is the message to show when the field is empty",
|
4009
|
-
id: "event.
|
5102
|
+
id: "event.football-club-membership.summary.field.firstname.empty"
|
4010
5103
|
}
|
4011
5104
|
},
|
4012
5105
|
{
|
4013
|
-
|
5106
|
+
fieldId: "applicant.name.surname",
|
4014
5107
|
label: {
|
4015
5108
|
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"
|
5109
|
+
description: "Label for surname",
|
5110
|
+
id: "v2.event.football-club-membership.summary.field.surname.label"
|
4028
5111
|
}
|
5112
|
+
},
|
5113
|
+
{
|
5114
|
+
fieldId: "applicant.email"
|
4029
5115
|
}
|
4030
5116
|
]
|
4031
5117
|
},
|
4032
5118
|
actions: [
|
5119
|
+
{
|
5120
|
+
type: ActionType.READ,
|
5121
|
+
label: {
|
5122
|
+
id: "v2.event.football-club-membership.action.read.label",
|
5123
|
+
defaultMessage: "Read",
|
5124
|
+
description: "Title of the read only page"
|
5125
|
+
},
|
5126
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
5127
|
+
},
|
4033
5128
|
{
|
4034
5129
|
type: ActionType.DECLARE,
|
4035
5130
|
label: {
|
4036
5131
|
defaultMessage: "Send an application",
|
4037
5132
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4038
|
-
id: "event.
|
5133
|
+
id: "event.football-club-membership.action.declare.label"
|
4039
5134
|
},
|
4040
5135
|
review: TENNIS_CLUB_DECLARATION_REVIEW
|
4041
5136
|
},
|
@@ -4044,7 +5139,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4044
5139
|
label: {
|
4045
5140
|
defaultMessage: "Validate",
|
4046
5141
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4047
|
-
id: "event.
|
5142
|
+
id: "event.football-club-membership.action.validate.label"
|
4048
5143
|
},
|
4049
5144
|
review: TENNIS_CLUB_DECLARATION_REVIEW
|
4050
5145
|
},
|
@@ -4053,7 +5148,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4053
5148
|
label: {
|
4054
5149
|
defaultMessage: "Register",
|
4055
5150
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4056
|
-
id: "event.
|
5151
|
+
id: "event.football-club-membership.action.register.label"
|
4057
5152
|
},
|
4058
5153
|
review: TENNIS_CLUB_DECLARATION_REVIEW
|
4059
5154
|
},
|
@@ -4062,14 +5157,14 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4062
5157
|
label: {
|
4063
5158
|
defaultMessage: "Request correction",
|
4064
5159
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4065
|
-
id: "event.
|
5160
|
+
id: "event.football-club-membership.action.correction.request.label"
|
4066
5161
|
},
|
4067
5162
|
onboardingForm: [
|
4068
5163
|
{
|
4069
5164
|
id: "correction-requester",
|
4070
5165
|
type: PageTypes.enum.FORM,
|
4071
5166
|
title: {
|
4072
|
-
id: "event.
|
5167
|
+
id: "event.football-club-membership.action.requestCorrection.form.section.corrector",
|
4073
5168
|
defaultMessage: "Correction requester",
|
4074
5169
|
description: "This is the title of the section"
|
4075
5170
|
},
|
@@ -4133,7 +5228,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4133
5228
|
id: "identity-check",
|
4134
5229
|
type: PageTypes.enum.FORM,
|
4135
5230
|
title: {
|
4136
|
-
id: "event.
|
5231
|
+
id: "event.football-club-membership.action.requestCorrection.form.section.verify",
|
4137
5232
|
defaultMessage: "Verify their identity",
|
4138
5233
|
description: "This is the title of the section"
|
4139
5234
|
},
|
@@ -4176,7 +5271,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4176
5271
|
id: "correction-request.supporting-documents",
|
4177
5272
|
type: PageTypes.enum.FORM,
|
4178
5273
|
title: {
|
4179
|
-
id: "event.
|
5274
|
+
id: "event.football-club-membership.action.requestCorrection.form.section.verify",
|
4180
5275
|
defaultMessage: "Upload supporting documents",
|
4181
5276
|
description: "This is the title of the section"
|
4182
5277
|
},
|
@@ -4238,7 +5333,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4238
5333
|
id: "correction-request.additional-details",
|
4239
5334
|
type: PageTypes.enum.FORM,
|
4240
5335
|
title: {
|
4241
|
-
id: "event.
|
5336
|
+
id: "event.football-club-membership.action.requestCorrection.form.section.corrector",
|
4242
5337
|
defaultMessage: "Reason for correction",
|
4243
5338
|
description: "This is the title of the section"
|
4244
5339
|
},
|
@@ -4261,13 +5356,13 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4261
5356
|
label: {
|
4262
5357
|
defaultMessage: "Approve correction",
|
4263
5358
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4264
|
-
id: "event.
|
5359
|
+
id: "event.football-club-membership.action.correction.approve.label"
|
4265
5360
|
}
|
4266
5361
|
},
|
4267
5362
|
{
|
4268
5363
|
type: ActionType.PRINT_CERTIFICATE,
|
4269
5364
|
label: {
|
4270
|
-
id: "v2.event.
|
5365
|
+
id: "v2.event.football-club-membership.action.collect-certificate.label",
|
4271
5366
|
defaultMessage: "Print certificate",
|
4272
5367
|
description: "This is shown as the action name anywhere the user can trigger the action from"
|
4273
5368
|
},
|
@@ -4315,7 +5410,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4315
5410
|
{
|
4316
5411
|
type: ActionType.ARCHIVE,
|
4317
5412
|
label: {
|
4318
|
-
id: "v2.event.
|
5413
|
+
id: "v2.event.football-club-membership.action.archive.label",
|
4319
5414
|
defaultMessage: "Archive",
|
4320
5415
|
description: "This is shown as the action name anywhere the user can trigger the action from"
|
4321
5416
|
}
|
@@ -4323,7 +5418,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4323
5418
|
{
|
4324
5419
|
type: ActionType.REJECT,
|
4325
5420
|
label: {
|
4326
|
-
id: "v2.event.
|
5421
|
+
id: "v2.event.football-club-membership.action.reject.label",
|
4327
5422
|
defaultMessage: "Reject",
|
4328
5423
|
description: "This is shown as the action name anywhere the user can trigger the action from"
|
4329
5424
|
}
|
@@ -4332,43 +5427,347 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4332
5427
|
advancedSearch: [
|
4333
5428
|
{
|
4334
5429
|
title: {
|
4335
|
-
defaultMessage: "
|
4336
|
-
description: "
|
4337
|
-
id: "v2.
|
5430
|
+
defaultMessage: "Registration details",
|
5431
|
+
description: "The title of Registration details accordion",
|
5432
|
+
id: "v2.advancedSearch.form.registrationDetails"
|
5433
|
+
},
|
5434
|
+
fields: [
|
5435
|
+
event("legalStatus.REGISTERED.createdAtLocation").exact(),
|
5436
|
+
event("legalStatus.REGISTERED.createdAt").range(),
|
5437
|
+
event("status", statusOptions).exact(),
|
5438
|
+
event("updatedAt", timePeriodOptions).range()
|
5439
|
+
]
|
5440
|
+
},
|
5441
|
+
{
|
5442
|
+
title: {
|
5443
|
+
defaultMessage: "Applicant's details",
|
5444
|
+
description: "Applicant details search field section title",
|
5445
|
+
id: "v2.event.football-club-membership.search.applicants"
|
5446
|
+
},
|
5447
|
+
fields: [
|
5448
|
+
field("applicant.name").fuzzy(),
|
5449
|
+
field("applicant.dob").range(),
|
5450
|
+
field("applicant.email").exact()
|
5451
|
+
]
|
5452
|
+
},
|
5453
|
+
{
|
5454
|
+
title: {
|
5455
|
+
defaultMessage: "Recommender's details",
|
5456
|
+
description: "Recommender details search field section title",
|
5457
|
+
id: "v2.event.football-club-membership.search.recommender"
|
4338
5458
|
},
|
4339
|
-
fields: [field("
|
5459
|
+
fields: [field("recommender.name").fuzzy()]
|
4340
5460
|
}
|
4341
5461
|
],
|
4342
5462
|
declaration: TENNIS_CLUB_DECLARATION_FORM
|
4343
5463
|
});
|
4344
5464
|
|
5465
|
+
// ../commons/src/fixtures/library-membership-event.ts
|
5466
|
+
var libraryMembershipForm = defineDeclarationForm({
|
5467
|
+
label: {
|
5468
|
+
id: "v2.event.library-membership.action.declare.form.label",
|
5469
|
+
defaultMessage: "Library membership application",
|
5470
|
+
description: "This is what this form is referred as in the system"
|
5471
|
+
},
|
5472
|
+
pages: [
|
5473
|
+
{
|
5474
|
+
id: "member",
|
5475
|
+
title: {
|
5476
|
+
id: "v2.event.library-membership.action.declare.form.section.who.title",
|
5477
|
+
defaultMessage: "Who is applying for the membership?",
|
5478
|
+
description: "This is the title of the section"
|
5479
|
+
},
|
5480
|
+
fields: [
|
5481
|
+
{
|
5482
|
+
id: "member.firstname",
|
5483
|
+
type: FieldType.TEXT,
|
5484
|
+
required: true,
|
5485
|
+
conditionals: [],
|
5486
|
+
label: {
|
5487
|
+
defaultMessage: "Member's first name",
|
5488
|
+
description: "This is the label for the field",
|
5489
|
+
id: "v2.event.library-membership.action.declare.form.section.who.field.firstname.label"
|
5490
|
+
}
|
5491
|
+
},
|
5492
|
+
{
|
5493
|
+
id: "member.surname",
|
5494
|
+
type: FieldType.TEXT,
|
5495
|
+
required: true,
|
5496
|
+
conditionals: [],
|
5497
|
+
label: {
|
5498
|
+
defaultMessage: "Member's surname",
|
5499
|
+
description: "This is the label for the field",
|
5500
|
+
id: "v2.event.library-membership.action.declare.form.section.who.field.surname.label"
|
5501
|
+
}
|
5502
|
+
}
|
5503
|
+
]
|
5504
|
+
}
|
5505
|
+
]
|
5506
|
+
});
|
5507
|
+
var libraryMembershipEvent = defineConfig({
|
5508
|
+
id: "library-membership",
|
5509
|
+
label: {
|
5510
|
+
defaultMessage: "Library membership application",
|
5511
|
+
description: "This is what this event is referred as in the system",
|
5512
|
+
id: "event.library-membership.label"
|
5513
|
+
},
|
5514
|
+
title: {
|
5515
|
+
defaultMessage: "{member.firstname} {member.surname}",
|
5516
|
+
description: "This is the title of the summary",
|
5517
|
+
id: "v2.event.library-membership.title"
|
5518
|
+
},
|
5519
|
+
summary: { fields: [] },
|
5520
|
+
actions: [],
|
5521
|
+
declaration: libraryMembershipForm
|
5522
|
+
});
|
5523
|
+
|
5524
|
+
// ../commons/src/fixtures/v2-birth-event.ts
|
5525
|
+
var child = defineFormPage({
|
5526
|
+
id: "child",
|
5527
|
+
type: PageTypes.enum.FORM,
|
5528
|
+
title: {
|
5529
|
+
defaultMessage: "Child's details",
|
5530
|
+
description: "Form section title for Child",
|
5531
|
+
id: "v2.form.birth.child.title"
|
5532
|
+
},
|
5533
|
+
fields: [
|
5534
|
+
{
|
5535
|
+
id: "child.firstNames",
|
5536
|
+
type: FieldType.TEXT,
|
5537
|
+
required: true,
|
5538
|
+
configuration: { maxLength: 32 },
|
5539
|
+
hideLabel: true,
|
5540
|
+
label: {
|
5541
|
+
defaultMessage: "Child's first name",
|
5542
|
+
description: "This is the label for the field",
|
5543
|
+
id: "v2.event.birth.action.declare.form.section.child.field.name.label"
|
5544
|
+
}
|
5545
|
+
},
|
5546
|
+
{
|
5547
|
+
id: "child.familyName",
|
5548
|
+
type: FieldType.TEXT,
|
5549
|
+
required: true,
|
5550
|
+
configuration: { maxLength: 32 },
|
5551
|
+
hideLabel: true,
|
5552
|
+
label: {
|
5553
|
+
defaultMessage: "Child's last name",
|
5554
|
+
description: "This is the label for the field",
|
5555
|
+
id: "v2.event.birth.action.declare.form.section.child.field.name.label"
|
5556
|
+
}
|
5557
|
+
},
|
5558
|
+
{
|
5559
|
+
id: "child.DoB",
|
5560
|
+
type: "DATE",
|
5561
|
+
required: true,
|
5562
|
+
label: {
|
5563
|
+
defaultMessage: "Date of birth",
|
5564
|
+
description: "This is the label for the field",
|
5565
|
+
id: "v2.event.birth.action.declare.form.section.child.field.dob.label"
|
5566
|
+
}
|
5567
|
+
}
|
5568
|
+
]
|
5569
|
+
});
|
5570
|
+
var mother = defineFormPage({
|
5571
|
+
id: "mother",
|
5572
|
+
type: PageTypes.enum.FORM,
|
5573
|
+
title: {
|
5574
|
+
defaultMessage: "Mother's details",
|
5575
|
+
description: "Form section title for mothers details",
|
5576
|
+
id: "v2.form.section.mother.title"
|
5577
|
+
},
|
5578
|
+
fields: [
|
5579
|
+
{
|
5580
|
+
id: "mother.firstNames",
|
5581
|
+
configuration: { maxLength: 32 },
|
5582
|
+
type: FieldType.TEXT,
|
5583
|
+
required: true,
|
5584
|
+
label: {
|
5585
|
+
defaultMessage: "First name(s)",
|
5586
|
+
description: "This is the label for the field",
|
5587
|
+
id: `v2.event.birth.action.declare.form.section.person.field.firstname.label`
|
5588
|
+
}
|
5589
|
+
},
|
5590
|
+
{
|
5591
|
+
id: `mother.familyName`,
|
5592
|
+
configuration: { maxLength: 32 },
|
5593
|
+
type: FieldType.TEXT,
|
5594
|
+
required: true,
|
5595
|
+
label: {
|
5596
|
+
defaultMessage: "Last name",
|
5597
|
+
description: "This is the label for the field",
|
5598
|
+
id: `v2.event.birth.action.declare.form.section.person.field.surname.label`
|
5599
|
+
}
|
5600
|
+
},
|
5601
|
+
{
|
5602
|
+
id: `mother.DoB`,
|
5603
|
+
type: "DATE",
|
5604
|
+
required: true,
|
5605
|
+
label: {
|
5606
|
+
defaultMessage: "Date of birth",
|
5607
|
+
description: "This is the label for the field",
|
5608
|
+
id: `v2.event.birth.action.declare.form.section.person.field.dob.label`
|
5609
|
+
}
|
5610
|
+
},
|
5611
|
+
{
|
5612
|
+
id: "mother.identifier",
|
5613
|
+
type: FieldType.ID,
|
5614
|
+
required: true,
|
5615
|
+
label: {
|
5616
|
+
defaultMessage: "ID Number",
|
5617
|
+
description: "This is the label for the field",
|
5618
|
+
id: `v2.event.birth.action.declare.form.section.person.field.nid.label`
|
5619
|
+
}
|
5620
|
+
}
|
5621
|
+
]
|
5622
|
+
});
|
5623
|
+
var BIRTH_DECLARATION_FORM = defineDeclarationForm({
|
5624
|
+
label: {
|
5625
|
+
defaultMessage: "Birth decalration form",
|
5626
|
+
id: "v2.event.birth.action.declare.form.label",
|
5627
|
+
description: "This is what this form is referred as in the system"
|
5628
|
+
},
|
5629
|
+
pages: [child, mother]
|
5630
|
+
});
|
5631
|
+
var v2BirthEvent = defineConfig({
|
5632
|
+
id: BIRTH_EVENT,
|
5633
|
+
title: {
|
5634
|
+
defaultMessage: "{child.name.firstname} {child.name.surname}",
|
5635
|
+
description: "This is the title of the summary",
|
5636
|
+
id: "v2.event.birth.title"
|
5637
|
+
},
|
5638
|
+
label: {
|
5639
|
+
defaultMessage: "Birth",
|
5640
|
+
description: "This is what this event is referred as in the system",
|
5641
|
+
id: "v2.event.birth.label"
|
5642
|
+
},
|
5643
|
+
summary: {
|
5644
|
+
fields: []
|
5645
|
+
},
|
5646
|
+
actions: [],
|
5647
|
+
declaration: BIRTH_DECLARATION_FORM
|
5648
|
+
});
|
5649
|
+
|
4345
5650
|
// ../commons/src/events/test.utils.ts
|
4346
|
-
function
|
5651
|
+
function pickRandom(rng, items) {
|
5652
|
+
return items[Math.floor(rng() * items.length)];
|
5653
|
+
}
|
5654
|
+
function generateRandomName(rng) {
|
5655
|
+
const firstnames = [
|
5656
|
+
"Danny",
|
5657
|
+
"John",
|
5658
|
+
"Jane",
|
5659
|
+
"Emily",
|
5660
|
+
"Michael",
|
5661
|
+
"Sarah",
|
5662
|
+
"Chris",
|
5663
|
+
"Jessica",
|
5664
|
+
"Sara",
|
5665
|
+
"Sarachella",
|
5666
|
+
"Sarandera",
|
5667
|
+
"Zara"
|
5668
|
+
];
|
5669
|
+
const surnames = [
|
5670
|
+
"Doe",
|
5671
|
+
"Smith",
|
5672
|
+
"Johnson",
|
5673
|
+
"Brown",
|
5674
|
+
"Williams",
|
5675
|
+
"Jones",
|
5676
|
+
"Garcia",
|
5677
|
+
"Miller",
|
5678
|
+
"Saranen",
|
5679
|
+
"Sarajanen",
|
5680
|
+
"Sarthua",
|
5681
|
+
"Tsarakovski",
|
5682
|
+
"Salamander",
|
5683
|
+
"Zarathustra"
|
5684
|
+
];
|
5685
|
+
return {
|
5686
|
+
firstname: pickRandom(rng, firstnames),
|
5687
|
+
surname: pickRandom(rng, surnames)
|
5688
|
+
};
|
5689
|
+
}
|
5690
|
+
function mapFieldTypeToMockValue(field2, i, rng) {
|
5691
|
+
switch (field2.type) {
|
5692
|
+
case FieldType.DIVIDER:
|
5693
|
+
case FieldType.TEXT:
|
5694
|
+
case FieldType.TEXTAREA:
|
5695
|
+
case FieldType.BULLET_LIST:
|
5696
|
+
case FieldType.PAGE_HEADER:
|
5697
|
+
case FieldType.LOCATION:
|
5698
|
+
case FieldType.SELECT:
|
5699
|
+
case FieldType.COUNTRY:
|
5700
|
+
case FieldType.RADIO_GROUP:
|
5701
|
+
case FieldType.PARAGRAPH:
|
5702
|
+
case FieldType.ADMINISTRATIVE_AREA:
|
5703
|
+
case FieldType.FACILITY:
|
5704
|
+
case FieldType.PHONE:
|
5705
|
+
case FieldType.ID:
|
5706
|
+
case FieldType.OFFICE:
|
5707
|
+
return `${field2.id}-${field2.type}-${i}`;
|
5708
|
+
case FieldType.NAME:
|
5709
|
+
return generateRandomName(rng);
|
5710
|
+
case FieldType.NUMBER:
|
5711
|
+
return 19;
|
5712
|
+
case FieldType.EMAIL:
|
5713
|
+
return "test@opencrvs.org";
|
5714
|
+
case FieldType.ADDRESS:
|
5715
|
+
return {
|
5716
|
+
country: "FAR",
|
5717
|
+
addressType: AddressType.DOMESTIC,
|
5718
|
+
province: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
5719
|
+
district: "5ef450bc-712d-48ad-93f3-8da0fa453baa",
|
5720
|
+
urbanOrRural: "URBAN",
|
5721
|
+
town: "Example Town",
|
5722
|
+
residentialArea: "Example Residential Area",
|
5723
|
+
street: "Example Street",
|
5724
|
+
number: "55",
|
5725
|
+
zipCode: "123456"
|
5726
|
+
};
|
5727
|
+
case FieldType.DATE:
|
5728
|
+
return "2021-01-01";
|
5729
|
+
case FieldType.DATE_RANGE:
|
5730
|
+
return ["2021-01-01", "2021-01-02"];
|
5731
|
+
case FieldType.CHECKBOX:
|
5732
|
+
return true;
|
5733
|
+
case FieldType.SIGNATURE:
|
5734
|
+
case FieldType.FILE:
|
5735
|
+
return {
|
5736
|
+
filename: "4f095fc4-4312-4de2-aa38-86dcc0f71044.png",
|
5737
|
+
originalFilename: "abcd.png",
|
5738
|
+
type: "image/png"
|
5739
|
+
};
|
5740
|
+
case FieldType.FILE_WITH_OPTIONS:
|
5741
|
+
case FieldType.DATA:
|
5742
|
+
return void 0;
|
5743
|
+
}
|
5744
|
+
}
|
5745
|
+
function fieldConfigsToActionPayload(fields, rng) {
|
4347
5746
|
return fields.reduce(
|
4348
5747
|
(acc, field2, i) => ({
|
4349
5748
|
...acc,
|
4350
|
-
[field2.id]: mapFieldTypeToMockValue(field2, i)
|
5749
|
+
[field2.id]: mapFieldTypeToMockValue(field2, i, rng)
|
4351
5750
|
}),
|
4352
5751
|
{}
|
4353
5752
|
);
|
4354
5753
|
}
|
4355
|
-
function generateActionDeclarationInput(configuration, action) {
|
5754
|
+
function generateActionDeclarationInput(configuration, action, rng) {
|
4356
5755
|
const parsed = DeclarationUpdateActions.safeParse(action);
|
4357
5756
|
if (parsed.success) {
|
4358
5757
|
const fields = getDeclarationFields(configuration);
|
4359
5758
|
const declarationConfig = getDeclaration(configuration);
|
4360
|
-
const declaration = fieldConfigsToActionPayload(fields);
|
5759
|
+
const declaration = fieldConfigsToActionPayload(fields, rng);
|
4361
5760
|
return omitHiddenPaginatedFields(declarationConfig, declaration);
|
4362
5761
|
}
|
4363
5762
|
console.warn(`${action} is not a declaration action. Setting data as {}.`);
|
4364
5763
|
return {};
|
4365
5764
|
}
|
4366
|
-
function generateActionAnnotationInput(configuration, action) {
|
5765
|
+
function generateActionAnnotationInput(configuration, action, rng) {
|
4367
5766
|
const actionConfig = configuration.actions.find(
|
4368
5767
|
(ac) => ac.type === action
|
4369
5768
|
);
|
4370
5769
|
const annotationFields = actionConfig ? getActionAnnotationFields(actionConfig) : [];
|
4371
|
-
const annotation = fieldConfigsToActionPayload(annotationFields);
|
5770
|
+
const annotation = fieldConfigsToActionPayload(annotationFields, rng);
|
4372
5771
|
const visibleVerificationPageIds = getVisibleVerificationPageIds(
|
4373
5772
|
findRecordActionPages(configuration, action),
|
4374
5773
|
annotation
|
@@ -4386,193 +5785,226 @@ function generateActionAnnotationInput(configuration, action) {
|
|
4386
5785
|
...visiblePageVerificationMap
|
4387
5786
|
};
|
4388
5787
|
}
|
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,
|
5788
|
+
function eventPayloadGenerator(rng) {
|
5789
|
+
return {
|
5790
|
+
create: (input = {}) => ({
|
4513
5791
|
transactionId: input.transactionId ?? getUUID(),
|
4514
|
-
|
4515
|
-
tennisClubMembershipEvent,
|
4516
|
-
ActionType.REGISTER
|
4517
|
-
),
|
4518
|
-
annotation: input.annotation ?? generateActionAnnotationInput(
|
4519
|
-
tennisClubMembershipEvent,
|
4520
|
-
ActionType.REGISTER
|
4521
|
-
),
|
4522
|
-
eventId
|
5792
|
+
type: input.type ?? TENNIS_CLUB_MEMBERSHIP
|
4523
5793
|
}),
|
4524
|
-
|
4525
|
-
type: ActionType.PRINT_CERTIFICATE,
|
5794
|
+
patch: (id, input = {}) => ({
|
4526
5795
|
transactionId: input.transactionId ?? getUUID(),
|
4527
|
-
|
4528
|
-
|
4529
|
-
tennisClubMembershipEvent,
|
4530
|
-
ActionType.PRINT_CERTIFICATE
|
4531
|
-
),
|
4532
|
-
eventId
|
5796
|
+
type: input.type ?? TENNIS_CLUB_MEMBERSHIP,
|
5797
|
+
id
|
4533
5798
|
}),
|
4534
|
-
|
4535
|
-
|
4536
|
-
|
5799
|
+
draft: ({ eventId, actionType }, input = {}) => (0, import_lodash2.merge)(
|
5800
|
+
{
|
5801
|
+
id: getUUID(),
|
5802
|
+
eventId,
|
5803
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
5804
|
+
transactionId: getUUID(),
|
5805
|
+
action: {
|
5806
|
+
transactionId: getUUID(),
|
5807
|
+
type: actionType,
|
5808
|
+
status: ActionStatus.Accepted,
|
5809
|
+
declaration: {
|
5810
|
+
"applicant.name": {
|
5811
|
+
firstname: "Max",
|
5812
|
+
surname: "McLaren"
|
5813
|
+
},
|
5814
|
+
"applicant.dob": "2020-01-02",
|
5815
|
+
"recommender.none": true
|
5816
|
+
},
|
5817
|
+
annotation: {
|
5818
|
+
"correction.requester.relationship": "ANOTHER_AGENT",
|
5819
|
+
"correction.request.reason": "Child's name was incorrect"
|
5820
|
+
},
|
5821
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
5822
|
+
createdBy: "@todo",
|
5823
|
+
createdByRole: "@todo",
|
5824
|
+
createdAtLocation: "@todo"
|
5825
|
+
}
|
5826
|
+
},
|
5827
|
+
input
|
5828
|
+
),
|
5829
|
+
actions: {
|
5830
|
+
declare: (eventId, input = {}) => ({
|
5831
|
+
type: ActionType.DECLARE,
|
5832
|
+
transactionId: input.transactionId ?? getUUID(),
|
5833
|
+
declaration: input.declaration ?? generateActionDeclarationInput(
|
5834
|
+
tennisClubMembershipEvent,
|
5835
|
+
ActionType.DECLARE,
|
5836
|
+
rng
|
5837
|
+
),
|
5838
|
+
annotation: input.annotation ?? generateActionAnnotationInput(
|
5839
|
+
tennisClubMembershipEvent,
|
5840
|
+
ActionType.DECLARE,
|
5841
|
+
rng
|
5842
|
+
),
|
5843
|
+
eventId,
|
5844
|
+
...input
|
5845
|
+
}),
|
5846
|
+
/**
|
5847
|
+
* Notify allows sending incomplete data. Think it as 'partial declare' for now.
|
5848
|
+
*/
|
5849
|
+
notify: (eventId, input = {}) => {
|
5850
|
+
let declaration = input.declaration;
|
5851
|
+
if (!declaration) {
|
5852
|
+
const partialDeclaration = (0, import_lodash2.omitBy)(
|
5853
|
+
generateActionDeclarationInput(
|
5854
|
+
tennisClubMembershipEvent,
|
5855
|
+
ActionType.DECLARE,
|
5856
|
+
rng
|
5857
|
+
),
|
5858
|
+
import_lodash2.isString
|
5859
|
+
);
|
5860
|
+
declaration = partialDeclaration;
|
5861
|
+
}
|
5862
|
+
return {
|
5863
|
+
type: ActionType.NOTIFY,
|
5864
|
+
transactionId: input.transactionId ?? getUUID(),
|
5865
|
+
declaration,
|
5866
|
+
eventId,
|
5867
|
+
keepAssignment: input.keepAssignment
|
5868
|
+
};
|
5869
|
+
},
|
5870
|
+
validate: (eventId, input = {}) => ({
|
5871
|
+
type: ActionType.VALIDATE,
|
4537
5872
|
transactionId: input.transactionId ?? getUUID(),
|
4538
5873
|
declaration: input.declaration ?? generateActionDeclarationInput(
|
4539
5874
|
tennisClubMembershipEvent,
|
4540
|
-
ActionType.
|
5875
|
+
ActionType.VALIDATE,
|
5876
|
+
rng
|
4541
5877
|
),
|
4542
5878
|
annotation: input.annotation ?? generateActionAnnotationInput(
|
4543
5879
|
tennisClubMembershipEvent,
|
4544
|
-
ActionType.
|
5880
|
+
ActionType.VALIDATE,
|
5881
|
+
rng
|
4545
5882
|
),
|
5883
|
+
duplicates: [],
|
5884
|
+
eventId,
|
5885
|
+
...input
|
5886
|
+
}),
|
5887
|
+
assign: (eventId, input = {}) => ({
|
5888
|
+
type: ActionType.ASSIGN,
|
5889
|
+
transactionId: input.transactionId ?? getUUID(),
|
5890
|
+
declaration: {},
|
5891
|
+
assignedTo: input.assignedTo ?? getUUID(),
|
5892
|
+
eventId
|
5893
|
+
}),
|
5894
|
+
unassign: (eventId, input = {}) => ({
|
5895
|
+
type: ActionType.UNASSIGN,
|
5896
|
+
transactionId: input.transactionId ?? getUUID(),
|
5897
|
+
declaration: {},
|
5898
|
+
assignedTo: null,
|
4546
5899
|
eventId
|
4547
5900
|
}),
|
4548
|
-
|
4549
|
-
type: ActionType.
|
5901
|
+
archive: (eventId, input = {}, isDuplicate) => ({
|
5902
|
+
type: ActionType.ARCHIVE,
|
5903
|
+
transactionId: input.transactionId ?? getUUID(),
|
5904
|
+
declaration: {},
|
5905
|
+
// @TODO: Check whether generator is needed?
|
5906
|
+
annotation: {},
|
5907
|
+
duplicates: [],
|
5908
|
+
eventId,
|
5909
|
+
reason: {
|
5910
|
+
message: `${ActionType.ARCHIVE}`,
|
5911
|
+
isDuplicate: isDuplicate ?? false
|
5912
|
+
},
|
5913
|
+
...input
|
5914
|
+
}),
|
5915
|
+
reject: (eventId, input = {}) => ({
|
5916
|
+
type: ActionType.REJECT,
|
4550
5917
|
transactionId: input.transactionId ?? getUUID(),
|
4551
5918
|
declaration: {},
|
4552
5919
|
annotation: input.annotation ?? generateActionAnnotationInput(
|
4553
5920
|
tennisClubMembershipEvent,
|
4554
|
-
ActionType.
|
5921
|
+
ActionType.REJECT,
|
5922
|
+
rng
|
5923
|
+
),
|
5924
|
+
duplicates: [],
|
5925
|
+
eventId,
|
5926
|
+
reason: { message: `${ActionType.REJECT}` },
|
5927
|
+
...input
|
5928
|
+
}),
|
5929
|
+
register: (eventId, input = {}) => ({
|
5930
|
+
type: ActionType.REGISTER,
|
5931
|
+
transactionId: input.transactionId ?? getUUID(),
|
5932
|
+
declaration: input.declaration ?? generateActionDeclarationInput(
|
5933
|
+
tennisClubMembershipEvent,
|
5934
|
+
ActionType.REGISTER,
|
5935
|
+
rng
|
5936
|
+
),
|
5937
|
+
annotation: input.annotation ?? generateActionAnnotationInput(
|
5938
|
+
tennisClubMembershipEvent,
|
5939
|
+
ActionType.REGISTER,
|
5940
|
+
rng
|
4555
5941
|
),
|
4556
5942
|
eventId,
|
4557
|
-
|
5943
|
+
...input
|
4558
5944
|
}),
|
4559
|
-
|
4560
|
-
type: ActionType.
|
5945
|
+
printCertificate: (eventId, input = {}) => ({
|
5946
|
+
type: ActionType.PRINT_CERTIFICATE,
|
4561
5947
|
transactionId: input.transactionId ?? getUUID(),
|
4562
5948
|
declaration: {},
|
4563
5949
|
annotation: input.annotation ?? generateActionAnnotationInput(
|
4564
5950
|
tennisClubMembershipEvent,
|
4565
|
-
ActionType.
|
5951
|
+
ActionType.PRINT_CERTIFICATE,
|
5952
|
+
rng
|
4566
5953
|
),
|
4567
5954
|
eventId,
|
4568
|
-
|
4569
|
-
})
|
5955
|
+
...input
|
5956
|
+
}),
|
5957
|
+
correction: {
|
5958
|
+
request: (eventId, input = {}) => ({
|
5959
|
+
type: ActionType.REQUEST_CORRECTION,
|
5960
|
+
transactionId: input.transactionId ?? getUUID(),
|
5961
|
+
declaration: input.declaration ?? generateActionDeclarationInput(
|
5962
|
+
tennisClubMembershipEvent,
|
5963
|
+
ActionType.REQUEST_CORRECTION,
|
5964
|
+
rng
|
5965
|
+
),
|
5966
|
+
annotation: input.annotation ?? generateActionAnnotationInput(
|
5967
|
+
tennisClubMembershipEvent,
|
5968
|
+
ActionType.REQUEST_CORRECTION,
|
5969
|
+
rng
|
5970
|
+
),
|
5971
|
+
eventId,
|
5972
|
+
keepAssignment: input.keepAssignment
|
5973
|
+
}),
|
5974
|
+
approve: (eventId, requestId, input = {}) => ({
|
5975
|
+
type: ActionType.APPROVE_CORRECTION,
|
5976
|
+
transactionId: input.transactionId ?? getUUID(),
|
5977
|
+
declaration: {},
|
5978
|
+
annotation: input.annotation ?? generateActionAnnotationInput(
|
5979
|
+
tennisClubMembershipEvent,
|
5980
|
+
ActionType.APPROVE_CORRECTION,
|
5981
|
+
rng
|
5982
|
+
),
|
5983
|
+
eventId,
|
5984
|
+
requestId,
|
5985
|
+
keepAssignment: input.keepAssignment
|
5986
|
+
}),
|
5987
|
+
reject: (eventId, requestId, input = {}) => ({
|
5988
|
+
type: ActionType.REJECT_CORRECTION,
|
5989
|
+
transactionId: input.transactionId ?? getUUID(),
|
5990
|
+
declaration: {},
|
5991
|
+
annotation: input.annotation ?? generateActionAnnotationInput(
|
5992
|
+
tennisClubMembershipEvent,
|
5993
|
+
ActionType.REJECT_CORRECTION,
|
5994
|
+
rng
|
5995
|
+
),
|
5996
|
+
eventId,
|
5997
|
+
requestId,
|
5998
|
+
keepAssignment: input.keepAssignment
|
5999
|
+
})
|
6000
|
+
}
|
4570
6001
|
}
|
4571
|
-
}
|
4572
|
-
}
|
6002
|
+
};
|
6003
|
+
}
|
4573
6004
|
function generateActionDocument({
|
4574
6005
|
configuration,
|
4575
6006
|
action,
|
6007
|
+
rng = () => 0.1,
|
4576
6008
|
defaults = {}
|
4577
6009
|
}) {
|
4578
6010
|
const actionBase = {
|
@@ -4583,7 +6015,7 @@ function generateActionDocument({
|
|
4583
6015
|
createdByRole: "FIELD_AGENT",
|
4584
6016
|
id: getUUID(),
|
4585
6017
|
createdAtLocation: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
4586
|
-
declaration: generateActionDeclarationInput(configuration, action),
|
6018
|
+
declaration: generateActionDeclarationInput(configuration, action, rng),
|
4587
6019
|
annotation: {},
|
4588
6020
|
status: ActionStatus.Accepted,
|
4589
6021
|
transactionId: getUUID(),
|
@@ -4603,9 +6035,9 @@ function generateActionDocument({
|
|
4603
6035
|
case ActionType.VALIDATE:
|
4604
6036
|
return { ...actionBase, type: action };
|
4605
6037
|
case ActionType.ARCHIVE:
|
4606
|
-
return { ...actionBase, type: action };
|
6038
|
+
return { ...actionBase, type: action, reason: { message: "Archive" } };
|
4607
6039
|
case ActionType.REJECT:
|
4608
|
-
return { ...actionBase, type: action };
|
6040
|
+
return { ...actionBase, type: action, reason: { message: "Reject" } };
|
4609
6041
|
case ActionType.CREATE:
|
4610
6042
|
return { ...actionBase, type: action };
|
4611
6043
|
case ActionType.NOTIFY:
|
@@ -4617,7 +6049,11 @@ function generateActionDocument({
|
|
4617
6049
|
case ActionType.APPROVE_CORRECTION:
|
4618
6050
|
return { ...actionBase, requestId: getUUID(), type: action };
|
4619
6051
|
case ActionType.REJECT_CORRECTION:
|
4620
|
-
return {
|
6052
|
+
return {
|
6053
|
+
...actionBase,
|
6054
|
+
requestId: getUUID(),
|
6055
|
+
type: action
|
6056
|
+
};
|
4621
6057
|
case ActionType.REGISTER:
|
4622
6058
|
return {
|
4623
6059
|
...actionBase,
|
@@ -4631,13 +6067,14 @@ function generateActionDocument({
|
|
4631
6067
|
}
|
4632
6068
|
function generateEventDocument({
|
4633
6069
|
configuration,
|
4634
|
-
actions
|
6070
|
+
actions,
|
6071
|
+
rng = () => 0.1
|
4635
6072
|
}) {
|
4636
6073
|
return {
|
4637
6074
|
trackingId: getUUID(),
|
4638
6075
|
type: configuration.id,
|
4639
6076
|
actions: actions.map(
|
4640
|
-
(action) => generateActionDocument({ configuration, action })
|
6077
|
+
(action) => generateActionDocument({ configuration, action, rng })
|
4641
6078
|
),
|
4642
6079
|
// Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
|
4643
6080
|
// @TODO: This should be fixed in the future.
|
@@ -4645,14 +6082,19 @@ function generateEventDocument({
|
|
4645
6082
|
id: getUUID(),
|
4646
6083
|
// Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
|
4647
6084
|
// @TODO: This should be fixed in the future.
|
4648
|
-
updatedAt: new Date(Date.now() - 1e3).toISOString()
|
4649
|
-
dateOfEvent: configuration.dateOfEvent
|
6085
|
+
updatedAt: new Date(Date.now() - 1e3).toISOString()
|
4650
6086
|
};
|
4651
6087
|
}
|
4652
|
-
function generateEventDraftDocument(
|
6088
|
+
function generateEventDraftDocument({
|
6089
|
+
eventId,
|
6090
|
+
actionType,
|
6091
|
+
rng = () => 0.1,
|
6092
|
+
declaration = {}
|
6093
|
+
}) {
|
4653
6094
|
const action = generateActionDocument({
|
4654
6095
|
configuration: tennisClubMembershipEvent,
|
4655
|
-
action: actionType
|
6096
|
+
action: actionType,
|
6097
|
+
rng
|
4656
6098
|
});
|
4657
6099
|
return {
|
4658
6100
|
id: getUUID(),
|
@@ -4668,82 +6110,105 @@ function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE, de
|
|
4668
6110
|
eventId
|
4669
6111
|
};
|
4670
6112
|
}
|
4671
|
-
function
|
4672
|
-
const
|
4673
|
-
|
4674
|
-
|
4675
|
-
|
4676
|
-
];
|
4677
|
-
const randomIndex = Math.floor(Math.random() * 3);
|
4678
|
-
return statuses[randomIndex];
|
6113
|
+
function getRandomDatetime(rng, start, end) {
|
6114
|
+
const range = end.getTime() - start.getTime();
|
6115
|
+
const offset = Math.floor(rng() * range);
|
6116
|
+
const randomDate = new Date(start.getTime() + offset);
|
6117
|
+
return randomDate.toISOString();
|
4679
6118
|
}
|
4680
|
-
function
|
4681
|
-
const
|
4682
|
-
|
4683
|
-
return trackingId;
|
6119
|
+
function getRandomDate(rng, start, end) {
|
6120
|
+
const datetime = getRandomDatetime(rng, new Date(start), new Date(end));
|
6121
|
+
return datetime.split("T")[0];
|
4684
6122
|
}
|
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
|
-
);
|
6123
|
+
function generateRandomApplicant(rng) {
|
6124
|
+
const { firstname, surname } = generateRandomName(rng);
|
6125
|
+
const randomDob = getRandomDate(rng, "1990-01-01", "2010-12-31");
|
4718
6126
|
return {
|
4719
6127
|
"recommender.none": true,
|
4720
|
-
"applicant.
|
4721
|
-
|
6128
|
+
"applicant.name": {
|
6129
|
+
firstname,
|
6130
|
+
surname
|
6131
|
+
},
|
4722
6132
|
"applicant.dob": randomDob
|
4723
6133
|
};
|
4724
6134
|
}
|
4725
|
-
|
4726
|
-
|
4727
|
-
|
4728
|
-
|
4729
|
-
|
4730
|
-
|
4731
|
-
|
4732
|
-
|
4733
|
-
|
4734
|
-
|
4735
|
-
|
4736
|
-
|
4737
|
-
|
4738
|
-
|
4739
|
-
|
4740
|
-
|
4741
|
-
}
|
6135
|
+
function createPrng(seed) {
|
6136
|
+
const MODULUS = 2 ** 32;
|
6137
|
+
const MULTIPLIER = 1664525;
|
6138
|
+
const INCREMENT = 1013904223;
|
6139
|
+
let state = seed >>> 0;
|
6140
|
+
return () => {
|
6141
|
+
state = (MULTIPLIER * state + INCREMENT) % MODULUS;
|
6142
|
+
return state / MODULUS;
|
6143
|
+
};
|
6144
|
+
}
|
6145
|
+
function generateUuid(rng) {
|
6146
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
6147
|
+
const r = Math.floor(rng() * 16);
|
6148
|
+
const v = c === "x" ? r : r & 3 | 8;
|
6149
|
+
return v.toString(16);
|
6150
|
+
});
|
6151
|
+
}
|
6152
|
+
function generateTrackingId(rng) {
|
6153
|
+
const uuid = generateUuid(rng).replace(/-/g, "");
|
6154
|
+
const trackingId = uuid.slice(0, 6).toUpperCase();
|
6155
|
+
return trackingId;
|
6156
|
+
}
|
6157
|
+
function generateRandomSignature(rng) {
|
6158
|
+
return `/random-bucket/${generateUuid(rng)}.png`;
|
6159
|
+
}
|
6160
|
+
var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
|
6161
|
+
const rng = createPrng(seed);
|
6162
|
+
const createdAt = getRandomDatetime(
|
6163
|
+
rng,
|
6164
|
+
/* @__PURE__ */ new Date("2024-01-01"),
|
6165
|
+
/* @__PURE__ */ new Date("2024-12-31")
|
6166
|
+
);
|
6167
|
+
return {
|
6168
|
+
id: overrides.id ?? generateUuid(rng),
|
6169
|
+
type: overrides.type ?? TENNIS_CLUB_MEMBERSHIP,
|
6170
|
+
status: overrides.status ?? pickRandom(rng, EventStatus.options),
|
6171
|
+
createdAt: overrides.createdAt ?? createdAt,
|
6172
|
+
createdBy: overrides.createdBy ?? generateUuid(rng),
|
6173
|
+
createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
|
6174
|
+
updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
|
6175
|
+
createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
|
6176
|
+
updatedAt: overrides.updatedAt ?? (0, import_addDays.default)(new Date(createdAt), 1).toISOString(),
|
6177
|
+
assignedTo: overrides.assignedTo ?? null,
|
6178
|
+
updatedBy: overrides.updatedBy ?? generateUuid(rng),
|
6179
|
+
updatedByUserRole: overrides.updatedByUserRole ?? "FIELD_AGENT",
|
6180
|
+
flags: [],
|
6181
|
+
legalStatuses: overrides.legalStatuses ?? {},
|
6182
|
+
declaration: overrides.declaration ?? generateRandomApplicant(rng),
|
6183
|
+
trackingId: overrides.trackingId ?? generateTrackingId(rng)
|
6184
|
+
};
|
6185
|
+
};
|
4742
6186
|
var generateTranslationConfig = (message) => ({
|
4743
6187
|
defaultMessage: message,
|
4744
6188
|
description: "Description for ${message}",
|
4745
6189
|
id: message
|
4746
6190
|
});
|
6191
|
+
var BearerTokenByUserType = {
|
6192
|
+
fieldAgent: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzY29wZSI6WyJyZWNvcmQuZGVjbGFyZS1iaXJ0aCIsInJlY29yZC5kZWNsYXJlLWRlYXRoIiwicmVjb3JkLmRlY2xhcmUtbWFycmlhZ2UiLCJyZWNvcmQuZGVjbGFyYXRpb24tc3VibWl0LWluY29tcGxldGUiLCJyZWNvcmQuZGVjbGFyYXRpb24tc3VibWl0LWZvci1yZXZpZXciLCJzZWFyY2guYmlydGgiLCJzZWFyY2guZGVhdGgiLCJzZWFyY2gubWFycmlhZ2UiLCJkZW1vIl0sInVzZXJUeXBlIjoidXNlciIsImlhdCI6MTc0ODUyNjQ4OCwiZXhwIjoxNzQ5MTMxMjg4LCJhdWQiOlsib3BlbmNydnM6YXV0aC11c2VyIiwib3BlbmNydnM6dXNlci1tZ250LXVzZXIiLCJvcGVuY3J2czpoZWFydGgtdXNlciIsIm9wZW5jcnZzOmdhdGV3YXktdXNlciIsIm9wZW5jcnZzOm5vdGlmaWNhdGlvbi11c2VyIiwib3BlbmNydnM6d29ya2Zsb3ctdXNlciIsIm9wZW5jcnZzOnNlYXJjaC11c2VyIiwib3BlbmNydnM6bWV0cmljcy11c2VyIiwib3BlbmNydnM6Y291bnRyeWNvbmZpZy11c2VyIiwib3BlbmNydnM6d2ViaG9va3MtdXNlciIsIm9wZW5jcnZzOmNvbmZpZy11c2VyIiwib3BlbmNydnM6ZG9jdW1lbnRzLXVzZXIiXSwiaXNzIjoib3BlbmNydnM6YXV0aC1zZXJ2aWNlIiwic3ViIjoiNjc3ZmIwODYzMGYzYWJmYTMzMDcyNzBmIn0.qLif2TmTPpqfbSUWR3TSfWf5syyCtRRJV-fDOZBtN9th-gdT0sUPZp5PB_t2QHHCLes7JLDlSA9CGNIbVvRR8a7EedXTAf0T7pwiE96PgljHSKI9jLMCYb_rhqnl8BwfsxAU3qv8EBYM9rDlcabl5iKnAOM-YLMv63CRMQxZOZ0O3Wl1Xil82dp6PqW_Lom5Qd-Esftt9BWXk5gxmqq-YegT8qU9n3hDXEsOvmIyYQvPDwmUOB-xp74CKJk_o3eBuq4TVCMYxY-tS9qkkn2A7Txhh-bzWMVNrQjQ1Yumvs8gi_F-XYTi89QbZVz8PzJ9kT8w3jshYwmAy7be9M-EQg",
|
6193
|
+
registrationAgent: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzY29wZSI6WyJyZWNvcmQucmVhZCIsInJlY29yZC5kZWNsYXJlLWJpcnRoIiwicmVjb3JkLmRlY2xhcmUtZGVhdGgiLCJyZWNvcmQuZGVjbGFyZS1tYXJyaWFnZSIsInJlY29yZC5kZWNsYXJhdGlvbi1lZGl0IiwicmVjb3JkLmRlY2xhcmF0aW9uLXN1Ym1pdC1mb3ItYXBwcm92YWwiLCJyZWNvcmQuZGVjbGFyYXRpb24tc3VibWl0LWZvci11cGRhdGVzIiwicmVjb3JkLmRlY2xhcmF0aW9uLWFyY2hpdmUiLCJyZWNvcmQuZGVjbGFyYXRpb24tcmVpbnN0YXRlIiwicmVjb3JkLnJlZ2lzdHJhdGlvbi1yZXF1ZXN0LWNvcnJlY3Rpb24iLCJyZWNvcmQuZGVjbGFyYXRpb24tcHJpbnQtc3VwcG9ydGluZy1kb2N1bWVudHMiLCJyZWNvcmQuZXhwb3J0LXJlY29yZHMiLCJyZWNvcmQucmVnaXN0cmF0aW9uLXByaW50Jmlzc3VlLWNlcnRpZmllZC1jb3BpZXMiLCJwZXJmb3JtYW5jZS5yZWFkIiwicGVyZm9ybWFuY2UucmVhZC1kYXNoYm9hcmRzIiwib3JnYW5pc2F0aW9uLnJlYWQtbG9jYXRpb25zOm15LW9mZmljZSIsInNlYXJjaC5iaXJ0aCIsInNlYXJjaC5kZWF0aCIsInNlYXJjaC5tYXJyaWFnZSIsImRlbW8iXSwidXNlclR5cGUiOiJ1c2VyIiwiaWF0IjoxNzQ4NTI2NDY4LCJleHAiOjE3NDkxMzEyNjgsImF1ZCI6WyJvcGVuY3J2czphdXRoLXVzZXIiLCJvcGVuY3J2czp1c2VyLW1nbnQtdXNlciIsIm9wZW5jcnZzOmhlYXJ0aC11c2VyIiwib3BlbmNydnM6Z2F0ZXdheS11c2VyIiwib3BlbmNydnM6bm90aWZpY2F0aW9uLXVzZXIiLCJvcGVuY3J2czp3b3JrZmxvdy11c2VyIiwib3BlbmNydnM6c2VhcmNoLXVzZXIiLCJvcGVuY3J2czptZXRyaWNzLXVzZXIiLCJvcGVuY3J2czpjb3VudHJ5Y29uZmlnLXVzZXIiLCJvcGVuY3J2czp3ZWJob29rcy11c2VyIiwib3BlbmNydnM6Y29uZmlnLXVzZXIiLCJvcGVuY3J2czpkb2N1bWVudHMtdXNlciJdLCJpc3MiOiJvcGVuY3J2czphdXRoLXNlcnZpY2UiLCJzdWIiOiI2NzdmYjA4NjMwZjNhYmZhMzMwNzI3MTgifQ.C0R3cda9tczdJyadyJzk_wjVx79yiQ4r2BZbrF5VMTol97CwqMk1cPKVv5xZR1fHW5nhYl1X_vsmTYx-p9oSmcAYVud-4Z24TrA3oZ214zCB8RW_RmmFzJSczwe-9Son-96JOpRJTz2F-F_SSmblF0cjndJ-iXCAbOn1hmQ1q45NqaV-oFaFWigvAaRoBFcEvGufQxss_NjRmG12ooENSfWQl0tYM9BmTw4JQo2xerwJcgaJTrtDgRagkuiR7zhVNjcoT64AQiSRp5KmWRhbU4ozlJ2tfy1ccD9jJkbQTf1AZT2pl1diusjstJYFuM9QPFPOyCO0umaxYfgSer_Hmg",
|
6194
|
+
localRegistrar: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzY29wZSI6WyJyZWNvcmQucmVhZCIsInJlY29yZC5kZWNsYXJlLWJpcnRoIiwicmVjb3JkLmRlY2xhcmUtZGVhdGgiLCJyZWNvcmQuZGVjbGFyZS1tYXJyaWFnZSIsInJlY29yZC5kZWNsYXJhdGlvbi1lZGl0IiwicmVjb3JkLmRlY2xhcmF0aW9uLXN1Ym1pdC1mb3ItdXBkYXRlcyIsInJlY29yZC5yZXZpZXctZHVwbGljYXRlcyIsInJlY29yZC5kZWNsYXJhdGlvbi1hcmNoaXZlIiwicmVjb3JkLmRlY2xhcmF0aW9uLXJlaW5zdGF0ZSIsInJlY29yZC5yZWdpc3RlciIsInJlY29yZC5yZWdpc3RyYXRpb24tY29ycmVjdCIsInJlY29yZC5kZWNsYXJhdGlvbi1wcmludC1zdXBwb3J0aW5nLWRvY3VtZW50cyIsInJlY29yZC5leHBvcnQtcmVjb3JkcyIsInJlY29yZC51bmFzc2lnbi1vdGhlcnMiLCJyZWNvcmQucmVnaXN0cmF0aW9uLXByaW50Jmlzc3VlLWNlcnRpZmllZC1jb3BpZXMiLCJyZWNvcmQuY29uZmlybS1yZWdpc3RyYXRpb24iLCJyZWNvcmQucmVqZWN0LXJlZ2lzdHJhdGlvbiIsInBlcmZvcm1hbmNlLnJlYWQiLCJwZXJmb3JtYW5jZS5yZWFkLWRhc2hib2FyZHMiLCJwcm9maWxlLmVsZWN0cm9uaWMtc2lnbmF0dXJlIiwib3JnYW5pc2F0aW9uLnJlYWQtbG9jYXRpb25zOm15LW9mZmljZSIsInNlYXJjaC5iaXJ0aCIsInNlYXJjaC5kZWF0aCIsInNlYXJjaC5tYXJyaWFnZSIsImRlbW8iXSwidXNlclR5cGUiOiJ1c2VyIiwiaWF0IjoxNzQ4NTI2NDIwLCJleHAiOjE3NDkxMzEyMjAsImF1ZCI6WyJvcGVuY3J2czphdXRoLXVzZXIiLCJvcGVuY3J2czp1c2VyLW1nbnQtdXNlciIsIm9wZW5jcnZzOmhlYXJ0aC11c2VyIiwib3BlbmNydnM6Z2F0ZXdheS11c2VyIiwib3BlbmNydnM6bm90aWZpY2F0aW9uLXVzZXIiLCJvcGVuY3J2czp3b3JrZmxvdy11c2VyIiwib3BlbmNydnM6c2VhcmNoLXVzZXIiLCJvcGVuY3J2czptZXRyaWNzLXVzZXIiLCJvcGVuY3J2czpjb3VudHJ5Y29uZmlnLXVzZXIiLCJvcGVuY3J2czp3ZWJob29rcy11c2VyIiwib3BlbmNydnM6Y29uZmlnLXVzZXIiLCJvcGVuY3J2czpkb2N1bWVudHMtdXNlciJdLCJpc3MiOiJvcGVuY3J2czphdXRoLXNlcnZpY2UiLCJzdWIiOiI2NzdmYjA4NjMwZjNhYmZhMzMwNzI3MjEifQ.Exwojy_1lsoPmp-kQ79SMWI0eQy8Qt7yO_ynGvb_oIVdqSwTxFkkNr9x4UxhBA-o0P6LkMZ2ELKOlSzBr3PRJ8IQnfMQ7Db8oG8HAPsY8sKqra_L6ryV088NW2e2LqAjoOX0dXRIqYMolUhF_OOuZpHW5K8nvog5SLlnJ1gKysQ1EuWBg2dcKbjkkB16v-9NGz4XHye3vcoZlalyha5OOujzbPhkmr9UGiksSIXFNbanBhkQdt-EJlLX9SXvQ4ACJWPKFb_f4gv8p84jdLiryzQux46zHPpTicZHzg0nZtoKKIH1AyFtqWfBFm4y8qWC3ht9TAk93NAXTfkS0wzxKA"
|
6195
|
+
};
|
6196
|
+
var generateWorkqueues = (slug = "all-events") => defineWorkqueues([
|
6197
|
+
{
|
6198
|
+
slug,
|
6199
|
+
name: {
|
6200
|
+
id: "workqueues.inProgress.title",
|
6201
|
+
defaultMessage: slug.charAt(0).toUpperCase() + slug.slice(1).split("-").join(" "),
|
6202
|
+
description: "Title of in progress workqueue"
|
6203
|
+
},
|
6204
|
+
query: {
|
6205
|
+
type: "and",
|
6206
|
+
clauses: [{ eventType: tennisClubMembershipEvent.id }]
|
6207
|
+
},
|
6208
|
+
actions: [],
|
6209
|
+
icon: "Draft"
|
6210
|
+
}
|
6211
|
+
]);
|
4747
6212
|
|
4748
6213
|
// ../commons/src/events/TemplateConfig.ts
|
4749
6214
|
function isTemplateVariable(value) {
|
@@ -4756,7 +6221,9 @@ function isFieldValueWithoutTemplates(value) {
|
|
4756
6221
|
if (isTemplateVariable(value)) {
|
4757
6222
|
return false;
|
4758
6223
|
}
|
4759
|
-
if (typeof value === "object" &&
|
6224
|
+
if (typeof value === "object" && // @todo remove ts-ignore
|
6225
|
+
//@ts-ignore
|
6226
|
+
Object.values(value).some((val) => isTemplateVariable(val))) {
|
4760
6227
|
return false;
|
4761
6228
|
}
|
4762
6229
|
return true;
|
@@ -4781,6 +6248,7 @@ function isFieldConfigDefaultValue(value) {
|
|
4781
6248
|
var import_lodash3 = require("lodash");
|
4782
6249
|
|
4783
6250
|
// ../commons/src/scopes.ts
|
6251
|
+
var import_zod31 = require("zod");
|
4784
6252
|
var SCOPES = {
|
4785
6253
|
// TODO v1.8 legacy scopes
|
4786
6254
|
NATLSYSADMIN: "natlsysadmin",
|
@@ -4804,6 +6272,8 @@ var SCOPES = {
|
|
4804
6272
|
*/
|
4805
6273
|
RECORD_DECLARE: "record.declare-birth",
|
4806
6274
|
// declare
|
6275
|
+
RECORD_IMPORT: "record.import",
|
6276
|
+
// declare
|
4807
6277
|
RECORD_DECLARE_BIRTH: "record.declare-birth",
|
4808
6278
|
RECORD_DECLARE_BIRTH_MY_JURISDICTION: "record.declare-birth:my-jurisdiction",
|
4809
6279
|
RECORD_DECLARE_DEATH: "record.declare-death",
|
@@ -4891,12 +6361,119 @@ var SCOPES = {
|
|
4891
6361
|
// data seeding
|
4892
6362
|
USER_DATA_SEEDING: "user.data-seeding"
|
4893
6363
|
};
|
6364
|
+
var LiteralScopes = import_zod31.z.union([
|
6365
|
+
import_zod31.z.literal(SCOPES.NATLSYSADMIN),
|
6366
|
+
import_zod31.z.literal(SCOPES.BYPASSRATELIMIT),
|
6367
|
+
import_zod31.z.literal(SCOPES.DECLARE),
|
6368
|
+
import_zod31.z.literal(SCOPES.REGISTER),
|
6369
|
+
import_zod31.z.literal(SCOPES.VALIDATE),
|
6370
|
+
import_zod31.z.literal(SCOPES.DEMO),
|
6371
|
+
import_zod31.z.literal(SCOPES.CERTIFY),
|
6372
|
+
import_zod31.z.literal(SCOPES.PERFORMANCE),
|
6373
|
+
import_zod31.z.literal(SCOPES.SYSADMIN),
|
6374
|
+
import_zod31.z.literal(SCOPES.TEAMS),
|
6375
|
+
import_zod31.z.literal(SCOPES.CONFIG),
|
6376
|
+
import_zod31.z.literal(SCOPES.WEBHOOK),
|
6377
|
+
import_zod31.z.literal(SCOPES.NATIONALID),
|
6378
|
+
import_zod31.z.literal(SCOPES.NOTIFICATION_API),
|
6379
|
+
import_zod31.z.literal(SCOPES.RECORDSEARCH),
|
6380
|
+
import_zod31.z.literal(SCOPES.RECORD_IMPORT),
|
6381
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
|
6382
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
|
6383
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_DEATH),
|
6384
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
|
6385
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
|
6386
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
|
6387
|
+
import_zod31.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
|
6388
|
+
import_zod31.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW),
|
6389
|
+
import_zod31.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS),
|
6390
|
+
import_zod31.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
|
6391
|
+
import_zod31.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
|
6392
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
|
6393
|
+
import_zod31.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
|
6394
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
|
6395
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE),
|
6396
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTER),
|
6397
|
+
import_zod31.z.literal(SCOPES.RECORD_EXPORT_RECORDS),
|
6398
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARATION_PRINT),
|
6399
|
+
import_zod31.z.literal(SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS),
|
6400
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_PRINT),
|
6401
|
+
import_zod31.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
|
6402
|
+
import_zod31.z.literal(SCOPES.RECORD_PRINT_CERTIFIED_COPIES),
|
6403
|
+
import_zod31.z.literal(SCOPES.RECORD_BULK_PRINT_CERTIFIED_COPIES),
|
6404
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES),
|
6405
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
|
6406
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
|
6407
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REVOCATION),
|
6408
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REVOKE),
|
6409
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REINSTATEMENT),
|
6410
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REINSTATE),
|
6411
|
+
import_zod31.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
|
6412
|
+
import_zod31.z.literal(SCOPES.RECORD_REJECT_REGISTRATION),
|
6413
|
+
import_zod31.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
|
6414
|
+
import_zod31.z.literal(SCOPES.SEARCH_BIRTH),
|
6415
|
+
import_zod31.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
|
6416
|
+
import_zod31.z.literal(SCOPES.SEARCH_DEATH),
|
6417
|
+
import_zod31.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
|
6418
|
+
import_zod31.z.literal(SCOPES.SEARCH_MARRIAGE),
|
6419
|
+
import_zod31.z.literal(SCOPES.RECORD_READ),
|
6420
|
+
import_zod31.z.literal(SCOPES.RECORD_READ_AUDIT),
|
6421
|
+
import_zod31.z.literal(SCOPES.RECORD_READ_COMMENTS),
|
6422
|
+
import_zod31.z.literal(SCOPES.RECORD_CREATE_COMMENTS),
|
6423
|
+
import_zod31.z.literal(SCOPES.PROFILE_UPDATE),
|
6424
|
+
import_zod31.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE),
|
6425
|
+
import_zod31.z.literal(SCOPES.PERFORMANCE_READ),
|
6426
|
+
import_zod31.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
|
6427
|
+
import_zod31.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS),
|
6428
|
+
import_zod31.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
|
6429
|
+
import_zod31.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
|
6430
|
+
import_zod31.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION),
|
6431
|
+
import_zod31.z.literal(SCOPES.USER_READ),
|
6432
|
+
import_zod31.z.literal(SCOPES.USER_READ_MY_OFFICE),
|
6433
|
+
import_zod31.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
|
6434
|
+
import_zod31.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
|
6435
|
+
import_zod31.z.literal(SCOPES.USER_CREATE),
|
6436
|
+
import_zod31.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
|
6437
|
+
import_zod31.z.literal(SCOPES.USER_UPDATE),
|
6438
|
+
import_zod31.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION),
|
6439
|
+
import_zod31.z.literal(SCOPES.CONFIG_UPDATE_ALL),
|
6440
|
+
import_zod31.z.literal(SCOPES.USER_DATA_SEEDING)
|
6441
|
+
]);
|
6442
|
+
var rawConfigurableScopeRegex = /^([a-zA-Z\.]+)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
|
6443
|
+
var rawConfigurableScope = import_zod31.z.string().regex(rawConfigurableScopeRegex);
|
6444
|
+
var CreateUserScope = import_zod31.z.object({
|
6445
|
+
type: import_zod31.z.literal("user.create"),
|
6446
|
+
options: import_zod31.z.object({
|
6447
|
+
role: import_zod31.z.array(import_zod31.z.string())
|
6448
|
+
})
|
6449
|
+
});
|
6450
|
+
var EditUserScope = import_zod31.z.object({
|
6451
|
+
type: import_zod31.z.literal("user.edit"),
|
6452
|
+
options: import_zod31.z.object({
|
6453
|
+
role: import_zod31.z.array(import_zod31.z.string())
|
6454
|
+
})
|
6455
|
+
});
|
6456
|
+
var WorkqueueScope = import_zod31.z.object({
|
6457
|
+
type: import_zod31.z.literal("workqueue"),
|
6458
|
+
options: import_zod31.z.object({
|
6459
|
+
id: import_zod31.z.array(import_zod31.z.string())
|
6460
|
+
})
|
6461
|
+
});
|
6462
|
+
var NotifyRecordScope = import_zod31.z.object({
|
6463
|
+
type: import_zod31.z.literal("record.notify"),
|
6464
|
+
options: import_zod31.z.object({
|
6465
|
+
event: import_zod31.z.array(import_zod31.z.string())
|
6466
|
+
})
|
6467
|
+
});
|
6468
|
+
var ConfigurableScopes = import_zod31.z.discriminatedUnion("type", [
|
6469
|
+
CreateUserScope,
|
6470
|
+
EditUserScope,
|
6471
|
+
WorkqueueScope,
|
6472
|
+
NotifyRecordScope
|
6473
|
+
]);
|
4894
6474
|
var scopes = Object.values(SCOPES);
|
4895
6475
|
|
4896
6476
|
// ../commons/src/events/scopes.ts
|
4897
|
-
function hasAnyOfScopes(a, b) {
|
4898
|
-
return (0, import_lodash3.intersection)(a, b).length > 0;
|
4899
|
-
}
|
4900
6477
|
var CONFIG_GET_ALLOWED_SCOPES = [
|
4901
6478
|
SCOPES.RECORD_DECLARE,
|
4902
6479
|
SCOPES.RECORD_READ,
|
@@ -4954,6 +6531,28 @@ var ACTION_ALLOWED_SCOPES = {
|
|
4954
6531
|
[ActionType.UNASSIGN]: null,
|
4955
6532
|
[ActionType.DETECT_DUPLICATE]: []
|
4956
6533
|
};
|
6534
|
+
var ACTION_ALLOWED_CONFIGURABLE_SCOPES = {
|
6535
|
+
[ActionType.READ]: [],
|
6536
|
+
[ActionType.CREATE]: ["record.notify"],
|
6537
|
+
[ActionType.NOTIFY]: ["record.notify"],
|
6538
|
+
[ActionType.DECLARE]: [],
|
6539
|
+
[ActionType.DELETE]: [],
|
6540
|
+
[ActionType.VALIDATE]: [],
|
6541
|
+
[ActionType.REGISTER]: [],
|
6542
|
+
[ActionType.PRINT_CERTIFICATE]: [],
|
6543
|
+
[ActionType.REQUEST_CORRECTION]: [],
|
6544
|
+
[ActionType.REJECT_CORRECTION]: [],
|
6545
|
+
[ActionType.APPROVE_CORRECTION]: [],
|
6546
|
+
[ActionType.MARKED_AS_DUPLICATE]: [],
|
6547
|
+
[ActionType.ARCHIVE]: [],
|
6548
|
+
[ActionType.REJECT]: [],
|
6549
|
+
[ActionType.ASSIGN]: [],
|
6550
|
+
[ActionType.UNASSIGN]: [],
|
6551
|
+
[ActionType.DETECT_DUPLICATE]: []
|
6552
|
+
};
|
6553
|
+
function hasAnyOfScopes(a, b) {
|
6554
|
+
return (0, import_lodash3.intersection)(a, b).length > 0;
|
6555
|
+
}
|
4957
6556
|
function filterUnallowedActions(actions, userScopes) {
|
4958
6557
|
const allowedActions = actions.filter((action) => {
|
4959
6558
|
const requiredScopes = ACTION_ALLOWED_SCOPES[action];
|
@@ -4963,10 +6562,74 @@ function filterUnallowedActions(actions, userScopes) {
|
|
4963
6562
|
return hasAnyOfScopes(userScopes, requiredScopes);
|
4964
6563
|
});
|
4965
6564
|
const hasOtherAllowedActions = allowedActions.some(
|
4966
|
-
(action) => action
|
6565
|
+
(action) => !isMetaAction(action)
|
4967
6566
|
);
|
4968
6567
|
if (hasOtherAllowedActions) {
|
4969
6568
|
return allowedActions;
|
4970
6569
|
}
|
4971
6570
|
return [ActionType.READ];
|
4972
6571
|
}
|
6572
|
+
|
6573
|
+
// ../commons/src/events/serializers/user/deserializer.ts
|
6574
|
+
var import_zod32 = require("zod");
|
6575
|
+
var UserWithPrimaryOffice = User.extend({
|
6576
|
+
primaryOfficeId: import_zod32.z.string()
|
6577
|
+
});
|
6578
|
+
function userDeserializer(serializedUserField, user2) {
|
6579
|
+
if (typeof serializedUserField === "string") {
|
6580
|
+
return serializedUserField;
|
6581
|
+
}
|
6582
|
+
if (serializedUserField.$userField === "name" || serializedUserField.$userField === "signatureFilename") {
|
6583
|
+
throw new Error(
|
6584
|
+
`Deserializer for ${serializedUserField.$userField} is not implemented yet`
|
6585
|
+
);
|
6586
|
+
}
|
6587
|
+
return user2[serializedUserField.$userField];
|
6588
|
+
}
|
6589
|
+
function deserializeQueryExpression(expression, user2) {
|
6590
|
+
return {
|
6591
|
+
...expression,
|
6592
|
+
assignedTo: expression.assignedTo && {
|
6593
|
+
...expression.assignedTo,
|
6594
|
+
term: userDeserializer(expression.assignedTo.term, user2)
|
6595
|
+
},
|
6596
|
+
createdBy: expression.createdBy && {
|
6597
|
+
...expression.createdBy,
|
6598
|
+
term: userDeserializer(expression.createdBy.term, user2)
|
6599
|
+
},
|
6600
|
+
updatedBy: expression.updatedBy && {
|
6601
|
+
...expression.updatedBy,
|
6602
|
+
term: userDeserializer(expression.updatedBy.term, user2)
|
6603
|
+
},
|
6604
|
+
createdAtLocation: expression.createdAtLocation && (expression.createdAtLocation.type === "within" ? {
|
6605
|
+
...expression.createdAtLocation,
|
6606
|
+
location: userDeserializer(
|
6607
|
+
expression.createdAtLocation.location,
|
6608
|
+
user2
|
6609
|
+
)
|
6610
|
+
} : {
|
6611
|
+
...expression.createdAtLocation,
|
6612
|
+
term: userDeserializer(expression.createdAtLocation.term, user2)
|
6613
|
+
}),
|
6614
|
+
updatedAtLocation: expression.updatedAtLocation && (expression.updatedAtLocation.type === "within" ? {
|
6615
|
+
...expression.updatedAtLocation,
|
6616
|
+
location: userDeserializer(
|
6617
|
+
expression.updatedAtLocation.location,
|
6618
|
+
user2
|
6619
|
+
)
|
6620
|
+
} : {
|
6621
|
+
...expression.updatedAtLocation,
|
6622
|
+
term: userDeserializer(expression.updatedAtLocation.term, user2)
|
6623
|
+
})
|
6624
|
+
};
|
6625
|
+
}
|
6626
|
+
function deserializeQuery(query, user2) {
|
6627
|
+
return {
|
6628
|
+
...query,
|
6629
|
+
clauses: query.clauses.map(
|
6630
|
+
(clause) => deserializeQueryExpression(clause, user2)
|
6631
|
+
// SAFETY: This cast should be safe because `query.clauses` has already been validated as non-empty by the Zod schema.
|
6632
|
+
// Without the cast, TypeScript cannot infer the tuple type required by the target interface.
|
6633
|
+
)
|
6634
|
+
};
|
6635
|
+
}
|