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