@opencrvs/toolkit 1.8.0-rc.f7a451a → 1.8.0-rc.f7bcb31
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 +4206 -8342
- package/dist/commons/conditionals/conditionals.d.ts +7 -11
- package/dist/commons/conditionals/validate.d.ts +6 -4
- package/dist/commons/events/ActionConfig.d.ts +1727 -97087
- package/dist/commons/events/ActionDocument.d.ts +211 -542
- package/dist/commons/events/ActionInput.d.ts +240 -248
- package/dist/commons/events/AdvancedSearchConfig.d.ts +22 -957
- package/dist/commons/events/CompositeFieldValue.d.ts +0 -3
- package/dist/commons/events/Draft.d.ts +20 -33
- package/dist/commons/events/EventConfig.d.ts +1350 -46327
- package/dist/commons/events/EventDocument.d.ts +156 -324
- package/dist/commons/events/EventIndex.d.ts +13 -1821
- package/dist/commons/events/EventMetadata.d.ts +11 -277
- package/dist/commons/events/FieldConfig.d.ts +754 -4280
- package/dist/commons/events/FieldType.d.ts +3 -3
- package/dist/commons/events/FieldTypeMapping.d.ts +4 -11
- package/dist/commons/events/FieldValue.d.ts +4 -7
- package/dist/commons/events/FormConfig.d.ts +441 -43593
- package/dist/commons/events/PageConfig.d.ts +208 -10864
- package/dist/commons/events/SummaryConfig.d.ts +39 -95
- package/dist/commons/events/User.d.ts +2 -31
- package/dist/commons/events/WorkqueueConfig.d.ts +20 -5341
- package/dist/commons/events/defineConfig.d.ts +35 -7218
- package/dist/commons/events/index.d.ts +0 -6
- package/dist/commons/events/test.utils.d.ts +46 -10
- package/dist/commons/events/utils.d.ts +67 -3665
- package/dist/conditionals/index.js +35 -55
- package/dist/events/index.js +1075 -2461
- package/dist/scopes/index.d.ts +4 -91
- package/dist/scopes/index.js +21 -39
- package/package.json +2 -3
- package/dist/commons/events/CountryConfigQueryInput.d.ts +0 -3008
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +0 -42
- package/dist/commons/events/event.d.ts +0 -54
- package/dist/commons/events/field.d.ts +0 -82
- package/dist/commons/events/scopes.d.ts +0 -45
- package/dist/commons/events/serializer.d.ts +0 -2
- package/dist/commons/events/workqueueDefaultColumns.d.ts +0 -3
package/dist/events/index.js
CHANGED
@@ -30,14 +30,11 @@ 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,
|
34
|
-
ACTION_ALLOWED_SCOPES: () => ACTION_ALLOWED_SCOPES,
|
35
33
|
Action: () => Action,
|
36
34
|
ActionBase: () => ActionBase,
|
37
35
|
ActionConditional: () => ActionConditional,
|
38
36
|
ActionConfig: () => ActionConfig,
|
39
37
|
ActionConfigBase: () => ActionConfigBase,
|
40
|
-
ActionCreationMetadata: () => ActionCreationMetadata,
|
41
38
|
ActionDocument: () => ActionDocument,
|
42
39
|
ActionFormConfig: () => ActionFormConfig,
|
43
40
|
ActionInput: () => ActionInput,
|
@@ -55,8 +52,6 @@ __export(events_exports, {
|
|
55
52
|
AssignActionInput: () => AssignActionInput,
|
56
53
|
AsyncRejectActionDocument: () => AsyncRejectActionDocument,
|
57
54
|
BaseActionInput: () => BaseActionInput,
|
58
|
-
CONFIG_GET_ALLOWED_SCOPES: () => CONFIG_GET_ALLOWED_SCOPES,
|
59
|
-
CONFIG_SEARCH_ALLOWED_SCOPES: () => CONFIG_SEARCH_ALLOWED_SCOPES,
|
60
55
|
CertificateConfig: () => CertificateConfig,
|
61
56
|
CertificateTemplateConfig: () => CertificateTemplateConfig,
|
62
57
|
CheckboxFieldValue: () => CheckboxFieldValue,
|
@@ -64,13 +59,9 @@ __export(events_exports, {
|
|
64
59
|
Conditional: () => Conditional,
|
65
60
|
ConditionalType: () => ConditionalType,
|
66
61
|
ConfirmableActions: () => ConfirmableActions,
|
67
|
-
CustomFlags: () => CustomFlags,
|
68
|
-
DEFAULT_DATE_OF_EVENT_PROPERTY: () => DEFAULT_DATE_OF_EVENT_PROPERTY,
|
69
62
|
DataEntry: () => DataEntry,
|
70
63
|
DataFieldValue: () => DataFieldValue,
|
71
|
-
DateRangeFieldValue: () => DateRangeFieldValue,
|
72
64
|
DateValue: () => DateValue,
|
73
|
-
DatetimeValue: () => DatetimeValue,
|
74
65
|
DeclarationActionConfig: () => DeclarationActionConfig,
|
75
66
|
DeclarationActions: () => DeclarationActions,
|
76
67
|
DeclarationFormConfig: () => DeclarationFormConfig,
|
@@ -78,7 +69,6 @@ __export(events_exports, {
|
|
78
69
|
DeclarationUpdateActions: () => DeclarationUpdateActions,
|
79
70
|
DeclareActionInput: () => DeclareActionInput,
|
80
71
|
DeduplicationConfig: () => DeduplicationConfig,
|
81
|
-
DeleteActionInput: () => DeleteActionInput,
|
82
72
|
DisplayOnReviewConditional: () => DisplayOnReviewConditional,
|
83
73
|
Draft: () => Draft,
|
84
74
|
DraftInput: () => DraftInput,
|
@@ -87,28 +77,20 @@ __export(events_exports, {
|
|
87
77
|
EnableConditional: () => EnableConditional,
|
88
78
|
EventConfig: () => EventConfig,
|
89
79
|
EventDocument: () => EventDocument,
|
90
|
-
EventFieldConfigSchema: () => EventFieldConfigSchema,
|
91
|
-
EventFieldId: () => EventFieldId,
|
92
80
|
EventIndex: () => EventIndex,
|
93
81
|
EventInput: () => EventInput,
|
94
82
|
EventMetadata: () => EventMetadata,
|
95
|
-
EventMetadataKeys: () => EventMetadataKeys,
|
96
|
-
EventMetadataParameter: () => EventMetadataParameter,
|
97
83
|
EventSearchIndex: () => EventSearchIndex,
|
98
|
-
EventState: () => EventState,
|
99
84
|
EventStatus: () => EventStatus,
|
100
|
-
EventStatusEnum: () => EventStatusEnum,
|
101
85
|
EventStatuses: () => EventStatuses,
|
102
86
|
FieldConditional: () => FieldConditional,
|
103
87
|
FieldConfig: () => FieldConfig,
|
104
|
-
FieldConfigSchema: () => FieldConfigSchema,
|
105
88
|
FieldType: () => FieldType,
|
106
89
|
FieldUpdateValue: () => FieldUpdateValue,
|
107
90
|
FieldValue: () => FieldValue,
|
108
91
|
FileFieldValue: () => FileFieldValue,
|
109
92
|
FileFieldValueWithOption: () => FileFieldValueWithOption,
|
110
93
|
FileFieldWithOptionValue: () => FileFieldWithOptionValue,
|
111
|
-
Flag: () => Flag,
|
112
94
|
FormConfig: () => FormConfig,
|
113
95
|
FormPageConfig: () => FormPageConfig,
|
114
96
|
GenericAddressUpdateValue: () => GenericAddressUpdateValue,
|
@@ -116,31 +98,23 @@ __export(events_exports, {
|
|
116
98
|
GeographicalArea: () => GeographicalArea,
|
117
99
|
ImageMimeType: () => ImageMimeType,
|
118
100
|
LanguageConfig: () => LanguageConfig,
|
119
|
-
LegalStatuses: () => LegalStatuses,
|
120
101
|
MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
|
121
102
|
MimeType: () => MimeType,
|
122
|
-
NonEmptyTextValue: () => NonEmptyTextValue,
|
123
103
|
NotifyActionInput: () => NotifyActionInput,
|
124
104
|
NumberFieldValue: () => NumberFieldValue,
|
125
105
|
PageConfig: () => PageConfig,
|
126
106
|
PageTypes: () => PageTypes,
|
127
107
|
PrintCertificateActionInput: () => PrintCertificateActionInput,
|
128
|
-
QueryExpression: () => QueryExpression,
|
129
|
-
QueryInput: () => QueryInput2,
|
130
|
-
QueryType: () => QueryType,
|
131
108
|
ReadActionInput: () => ReadActionInput,
|
132
109
|
RegisterAction: () => RegisterAction,
|
133
110
|
RegisterActionInput: () => RegisterActionInput,
|
134
|
-
RegistrationCreationMetadata: () => RegistrationCreationMetadata,
|
135
111
|
RejectCorrectionActionInput: () => RejectCorrectionActionInput,
|
136
112
|
RejectDeclarationActionInput: () => RejectDeclarationActionInput,
|
137
113
|
RequestCorrectionActionInput: () => RequestCorrectionActionInput,
|
114
|
+
RequiredTextValue: () => RequiredTextValue,
|
138
115
|
ResolvedUser: () => ResolvedUser,
|
139
116
|
RuralAddressUpdateValue: () => RuralAddressUpdateValue,
|
140
117
|
RuralAddressValue: () => RuralAddressValue,
|
141
|
-
SearchField: () => SearchField,
|
142
|
-
SearchQueryParams: () => SearchQueryParams,
|
143
|
-
SelectOption: () => SelectOption,
|
144
118
|
ShowConditional: () => ShowConditional,
|
145
119
|
SummaryConfig: () => SummaryConfig,
|
146
120
|
TextValue: () => TextValue,
|
@@ -148,30 +122,19 @@ __export(events_exports, {
|
|
148
122
|
UnassignActionInput: () => UnassignActionInput,
|
149
123
|
UrbanAddressUpdateValue: () => UrbanAddressUpdateValue,
|
150
124
|
UrbanAddressValue: () => UrbanAddressValue,
|
151
|
-
User: () => User,
|
152
125
|
ValidateActionInput: () => ValidateActionInput,
|
153
126
|
VerificationActionConfig: () => VerificationActionConfig,
|
154
127
|
VerificationPageConfig: () => VerificationPageConfig,
|
155
|
-
WorkqueueColumn: () => WorkqueueColumn,
|
156
128
|
WorkqueueConfig: () => WorkqueueConfig,
|
157
|
-
WorkqueueConfigInput: () => WorkqueueConfigInput,
|
158
|
-
WorkqueueCountInput: () => WorkqueueCountInput,
|
159
|
-
WorkqueueCountOutput: () => WorkqueueCountOutput,
|
160
|
-
ZodDate: () => ZodDate,
|
161
129
|
alwaysTrue: () => alwaysTrue,
|
162
130
|
and: () => and,
|
163
131
|
annotationActions: () => annotationActions,
|
164
132
|
applyDraftsToEventIndex: () => applyDraftsToEventIndex,
|
165
|
-
areConditionsMet: () => areConditionsMet,
|
166
133
|
compositeFieldTypes: () => compositeFieldTypes,
|
167
134
|
createEmptyDraft: () => createEmptyDraft,
|
168
|
-
createEventConditionals: () => createEventConditionals,
|
169
|
-
createFieldConditionals: () => createFieldConditionals,
|
170
135
|
createValidationSchema: () => createValidationSchema,
|
171
136
|
deepDropNulls: () => deepDropNulls,
|
172
137
|
deepMerge: () => deepMerge,
|
173
|
-
defaultThirdColumn: () => defaultThirdColumn,
|
174
|
-
defaultWorkqueueColumns: () => defaultWorkqueueColumns,
|
175
138
|
defineActionForm: () => defineActionForm,
|
176
139
|
defineConditional: () => defineConditional,
|
177
140
|
defineConfig: () => defineConfig,
|
@@ -179,10 +142,6 @@ __export(events_exports, {
|
|
179
142
|
defineFormConditional: () => defineFormConditional,
|
180
143
|
defineFormPage: () => defineFormPage,
|
181
144
|
definePage: () => definePage,
|
182
|
-
defineWorkqueue: () => defineWorkqueue,
|
183
|
-
defineWorkqueues: () => defineWorkqueues,
|
184
|
-
defineWorkqueuesColumns: () => defineWorkqueuesColumns,
|
185
|
-
deserializeQuery: () => deserializeQuery,
|
186
145
|
errorMessages: () => errorMessages,
|
187
146
|
event: () => event,
|
188
147
|
eventMetadataLabelMap: () => eventMetadataLabelMap,
|
@@ -191,7 +150,6 @@ __export(events_exports, {
|
|
191
150
|
eventStatuses: () => eventStatuses,
|
192
151
|
field: () => field,
|
193
152
|
fieldTypes: () => fieldTypes,
|
194
|
-
filterUnallowedActions: () => filterUnallowedActions,
|
195
153
|
findActiveDrafts: () => findActiveDrafts,
|
196
154
|
findAllFields: () => findAllFields,
|
197
155
|
findLastAssignmentAction: () => findLastAssignmentAction,
|
@@ -203,33 +161,26 @@ __export(events_exports, {
|
|
203
161
|
generateEventDraftDocument: () => generateEventDraftDocument,
|
204
162
|
generateTransactionId: () => generateTransactionId,
|
205
163
|
generateTranslationConfig: () => generateTranslationConfig,
|
206
|
-
generateWorkqueues: () => generateWorkqueues,
|
207
164
|
getAcceptedActions: () => getAcceptedActions,
|
208
165
|
getActionAnnotation: () => getActionAnnotation,
|
209
166
|
getActionAnnotationFields: () => getActionAnnotationFields,
|
210
167
|
getActionReview: () => getActionReview,
|
211
168
|
getActionReviewFields: () => getActionReviewFields,
|
212
|
-
|
169
|
+
getAllAnnotationFields: () => getAllAnnotationFields,
|
213
170
|
getAnnotationFromDrafts: () => getAnnotationFromDrafts,
|
214
|
-
getAssignedUserFromActions: () => getAssignedUserFromActions,
|
215
171
|
getCurrentEventState: () => getCurrentEventState,
|
216
172
|
getCurrentEventStateWithDrafts: () => getCurrentEventStateWithDrafts,
|
217
173
|
getDeclaration: () => getDeclaration,
|
218
174
|
getDeclarationFields: () => getDeclarationFields,
|
219
175
|
getDeclarationPages: () => getDeclarationPages,
|
220
|
-
|
221
|
-
getStatusFromActions: () => getStatusFromActions,
|
222
|
-
getVisibleVerificationPageIds: () => getVisibleVerificationPageIds,
|
223
|
-
hasAnyOfScopes: () => hasAnyOfScopes,
|
176
|
+
getFieldValidationErrors: () => getFieldValidationErrors,
|
224
177
|
isAddressFieldType: () => isAddressFieldType,
|
225
178
|
isAdministrativeAreaFieldType: () => isAdministrativeAreaFieldType,
|
226
179
|
isBulletListFieldType: () => isBulletListFieldType,
|
227
180
|
isCheckboxFieldType: () => isCheckboxFieldType,
|
228
|
-
isConditionMet: () => isConditionMet,
|
229
181
|
isCountryFieldType: () => isCountryFieldType,
|
230
182
|
isDataFieldType: () => isDataFieldType,
|
231
183
|
isDateFieldType: () => isDateFieldType,
|
232
|
-
isDateRangeFieldType: () => isDateRangeFieldType,
|
233
184
|
isDividerFieldType: () => isDividerFieldType,
|
234
185
|
isEmailFieldType: () => isEmailFieldType,
|
235
186
|
isFacilityFieldType: () => isFacilityFieldType,
|
@@ -261,14 +212,13 @@ __export(events_exports, {
|
|
261
212
|
mapFieldTypeToZod: () => mapFieldTypeToZod,
|
262
213
|
never: () => never,
|
263
214
|
not: () => not,
|
264
|
-
omitHiddenAnnotationFields: () => omitHiddenAnnotationFields,
|
265
215
|
omitHiddenFields: () => omitHiddenFields,
|
266
216
|
omitHiddenPaginatedFields: () => omitHiddenPaginatedFields,
|
267
217
|
or: () => or,
|
268
|
-
runFieldValidations: () => runFieldValidations,
|
269
218
|
user: () => user,
|
270
219
|
validate: () => validate,
|
271
220
|
validateFieldInput: () => validateFieldInput,
|
221
|
+
validateWorkqueueConfig: () => validateWorkqueueConfig,
|
272
222
|
writeActions: () => writeActions
|
273
223
|
});
|
274
224
|
module.exports = __toCommonJS(events_exports);
|
@@ -278,12 +228,9 @@ var import_zod9 = require("zod");
|
|
278
228
|
|
279
229
|
// ../commons/src/events/Conditional.ts
|
280
230
|
var import_zod = require("zod");
|
281
|
-
var
|
282
|
-
(
|
283
|
-
|
284
|
-
description: "JSON schema conditional configuration",
|
285
|
-
ref: "Conditional"
|
286
|
-
});
|
231
|
+
var Conditional = import_zod.z.custom(
|
232
|
+
(val) => typeof val === "object" && val !== null
|
233
|
+
);
|
287
234
|
var ConditionalType = {
|
288
235
|
SHOW: "SHOW",
|
289
236
|
ENABLE: "ENABLE",
|
@@ -320,10 +267,7 @@ var FieldConditional = import_zod.z.discriminatedUnion("type", [
|
|
320
267
|
EnableConditional,
|
321
268
|
// Field output can be shown / hidden on the review page
|
322
269
|
DisplayOnReviewConditional
|
323
|
-
])
|
324
|
-
description: "Field conditional configuration",
|
325
|
-
ref: "FieldConditional"
|
326
|
-
});
|
270
|
+
]);
|
327
271
|
|
328
272
|
// ../commons/src/events/PageConfig.ts
|
329
273
|
var import_zod6 = require("zod");
|
@@ -333,8 +277,6 @@ var import_zod5 = require("zod");
|
|
333
277
|
|
334
278
|
// ../commons/src/events/TranslationConfig.ts
|
335
279
|
var import_zod2 = require("zod");
|
336
|
-
var import_zod_openapi2 = require("zod-openapi");
|
337
|
-
(0, import_zod_openapi2.extendZodWithOpenApi)(import_zod2.z);
|
338
280
|
var TranslationConfig = import_zod2.z.object({
|
339
281
|
id: import_zod2.z.string().describe(
|
340
282
|
"The identifier of the translation referred in translation CSV files"
|
@@ -343,9 +285,6 @@ var TranslationConfig = import_zod2.z.object({
|
|
343
285
|
description: import_zod2.z.string().describe(
|
344
286
|
"Describe the translation for a translator to be able to identify it."
|
345
287
|
)
|
346
|
-
}).openapi({
|
347
|
-
description: "Translation configuration",
|
348
|
-
ref: "TranslationConfig"
|
349
288
|
});
|
350
289
|
|
351
290
|
// ../commons/src/events/FieldType.ts
|
@@ -356,12 +295,12 @@ var FieldType = {
|
|
356
295
|
TEXTAREA: "TEXTAREA",
|
357
296
|
EMAIL: "EMAIL",
|
358
297
|
DATE: "DATE",
|
359
|
-
DATE_RANGE: "DATE_RANGE",
|
360
298
|
PARAGRAPH: "PARAGRAPH",
|
361
299
|
PAGE_HEADER: "PAGE_HEADER",
|
362
300
|
RADIO_GROUP: "RADIO_GROUP",
|
363
301
|
FILE: "FILE",
|
364
302
|
FILE_WITH_OPTIONS: "FILE_WITH_OPTIONS",
|
303
|
+
HIDDEN: "HIDDEN",
|
365
304
|
BULLET_LIST: "BULLET_LIST",
|
366
305
|
CHECKBOX: "CHECKBOX",
|
367
306
|
SELECT: "SELECT",
|
@@ -376,7 +315,6 @@ var FieldType = {
|
|
376
315
|
};
|
377
316
|
var fieldTypes = Object.values(FieldType);
|
378
317
|
var compositeFieldTypes = [
|
379
|
-
FieldType.DATE_RANGE,
|
380
318
|
FieldType.ADDRESS,
|
381
319
|
FieldType.FILE_WITH_OPTIONS,
|
382
320
|
FieldType.FILE
|
@@ -467,10 +405,8 @@ var FileFieldWithOptionValue = import_zod3.z.array(FileFieldValueWithOption);
|
|
467
405
|
|
468
406
|
// ../commons/src/events/FieldValue.ts
|
469
407
|
var TextValue = import_zod4.z.string();
|
470
|
-
var
|
408
|
+
var RequiredTextValue = TextValue.min(1);
|
471
409
|
var DateValue = import_zod4.z.string().date().describe("Date in the format YYYY-MM-DD");
|
472
|
-
var DatetimeValue = import_zod4.z.string().datetime();
|
473
|
-
var DateRangeFieldValue = DateValue.or(import_zod4.z.tuple([DateValue, DateValue]));
|
474
410
|
var EmailValue = import_zod4.z.string().email();
|
475
411
|
var CheckboxFieldValue = import_zod4.z.boolean();
|
476
412
|
var NumberFieldValue = import_zod4.z.number();
|
@@ -478,7 +414,6 @@ var DataFieldValue = import_zod4.z.undefined();
|
|
478
414
|
var FieldValue = import_zod4.z.union([
|
479
415
|
TextValue,
|
480
416
|
DateValue,
|
481
|
-
DateRangeFieldValue,
|
482
417
|
CheckboxFieldValue,
|
483
418
|
NumberFieldValue,
|
484
419
|
FileFieldValue,
|
@@ -491,7 +426,6 @@ var FieldValue = import_zod4.z.union([
|
|
491
426
|
var FieldUpdateValue = import_zod4.z.union([
|
492
427
|
TextValue,
|
493
428
|
DateValue,
|
494
|
-
DateRangeFieldValue,
|
495
429
|
CheckboxFieldValue,
|
496
430
|
NumberFieldValue,
|
497
431
|
FileFieldValue,
|
@@ -503,24 +437,28 @@ var FieldUpdateValue = import_zod4.z.union([
|
|
503
437
|
]);
|
504
438
|
|
505
439
|
// ../commons/src/events/FieldConfig.ts
|
506
|
-
var import_zod_openapi3 = require("zod-openapi");
|
507
|
-
(0, import_zod_openapi3.extendZodWithOpenApi)(import_zod5.z);
|
508
440
|
var FieldId = import_zod5.z.string();
|
509
|
-
var
|
510
|
-
|
511
|
-
|
441
|
+
var DependencyExpression = import_zod5.z.object({
|
442
|
+
dependsOn: import_zod5.z.array(FieldId).default([]),
|
443
|
+
expression: import_zod5.z.string()
|
444
|
+
});
|
512
445
|
var BaseField = import_zod5.z.object({
|
513
446
|
id: FieldId,
|
514
447
|
defaultValue: import_zod5.z.union([
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
448
|
+
// These are the currently supported default values types
|
449
|
+
import_zod5.z.union([
|
450
|
+
TextValue,
|
451
|
+
RequiredTextValue,
|
452
|
+
DateValue,
|
453
|
+
NumberFieldValue,
|
454
|
+
CheckboxFieldValue
|
455
|
+
]),
|
456
|
+
DependencyExpression
|
520
457
|
]).optional(),
|
521
|
-
parent: ParentReference,
|
522
458
|
conditionals: import_zod5.z.array(FieldConditional).default([]).optional(),
|
523
459
|
required: import_zod5.z.boolean().default(false).optional(),
|
460
|
+
disabled: import_zod5.z.boolean().default(false).optional(),
|
461
|
+
hidden: import_zod5.z.boolean().default(false).optional(),
|
524
462
|
placeholder: TranslationConfig.optional(),
|
525
463
|
validation: import_zod5.z.array(
|
526
464
|
import_zod5.z.object({
|
@@ -528,8 +466,8 @@ var BaseField = import_zod5.z.object({
|
|
528
466
|
message: TranslationConfig
|
529
467
|
})
|
530
468
|
).default([]).optional(),
|
469
|
+
dependsOn: import_zod5.z.array(FieldId).default([]).optional(),
|
531
470
|
label: TranslationConfig,
|
532
|
-
helperText: TranslationConfig.optional(),
|
533
471
|
hideLabel: import_zod5.z.boolean().default(false).optional()
|
534
472
|
});
|
535
473
|
var Divider = BaseField.extend({
|
@@ -537,7 +475,7 @@ var Divider = BaseField.extend({
|
|
537
475
|
});
|
538
476
|
var TextField = BaseField.extend({
|
539
477
|
type: import_zod5.z.literal(FieldType.TEXT),
|
540
|
-
defaultValue:
|
478
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional(),
|
541
479
|
configuration: import_zod5.z.object({
|
542
480
|
maxLength: import_zod5.z.number().optional().describe("Maximum length of the text"),
|
543
481
|
type: import_zod5.z.enum(["text", "password"]).optional(),
|
@@ -547,7 +485,7 @@ var TextField = BaseField.extend({
|
|
547
485
|
}).describe("Text input");
|
548
486
|
var NumberField = BaseField.extend({
|
549
487
|
type: import_zod5.z.literal(FieldType.NUMBER),
|
550
|
-
defaultValue: NumberFieldValue.optional(),
|
488
|
+
defaultValue: import_zod5.z.union([NumberFieldValue, DependencyExpression]).optional(),
|
551
489
|
configuration: import_zod5.z.object({
|
552
490
|
min: import_zod5.z.number().optional().describe("Minimum value"),
|
553
491
|
max: import_zod5.z.number().optional().describe("Maximum value"),
|
@@ -557,7 +495,7 @@ var NumberField = BaseField.extend({
|
|
557
495
|
}).describe("Number input");
|
558
496
|
var TextAreaField = BaseField.extend({
|
559
497
|
type: import_zod5.z.literal(FieldType.TEXTAREA),
|
560
|
-
defaultValue:
|
498
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional(),
|
561
499
|
configuration: import_zod5.z.object({
|
562
500
|
maxLength: import_zod5.z.number().optional().describe("Maximum length of the text"),
|
563
501
|
rows: import_zod5.z.number().optional().describe("Number of visible text lines"),
|
@@ -591,28 +529,17 @@ var EmailField = BaseField.extend({
|
|
591
529
|
configuration: import_zod5.z.object({
|
592
530
|
maxLength: import_zod5.z.number().optional().describe("Maximum length of the text")
|
593
531
|
}).default({ maxLength: 10 }).optional(),
|
594
|
-
defaultValue:
|
532
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
595
533
|
});
|
596
534
|
var DateField = BaseField.extend({
|
597
535
|
type: import_zod5.z.literal(FieldType.DATE),
|
598
|
-
defaultValue: DateValue.optional(),
|
536
|
+
defaultValue: import_zod5.z.union([DateValue, DependencyExpression]).optional(),
|
599
537
|
configuration: import_zod5.z.object({
|
600
538
|
notice: TranslationConfig.describe(
|
601
539
|
"Text to display above the date input"
|
602
540
|
).optional()
|
603
541
|
}).optional()
|
604
542
|
}).describe("A single date input (dd-mm-YYYY)");
|
605
|
-
var DateRangeField = BaseField.extend({
|
606
|
-
type: import_zod5.z.literal(FieldType.DATE_RANGE),
|
607
|
-
defaultValue: DateRangeFieldValue.optional(),
|
608
|
-
configuration: import_zod5.z.object({
|
609
|
-
notice: TranslationConfig.describe(
|
610
|
-
"Text to display above the date input"
|
611
|
-
).optional()
|
612
|
-
}).optional()
|
613
|
-
}).describe(
|
614
|
-
"A date range input ({ rangeStart: dd-mm-YYYY, rangeEnd: dd-mm-YYYY })"
|
615
|
-
);
|
616
543
|
var HtmlFontVariant = import_zod5.z.enum([
|
617
544
|
"reg12",
|
618
545
|
"reg14",
|
@@ -625,7 +552,7 @@ var HtmlFontVariant = import_zod5.z.enum([
|
|
625
552
|
]);
|
626
553
|
var Paragraph = BaseField.extend({
|
627
554
|
type: import_zod5.z.literal(FieldType.PARAGRAPH),
|
628
|
-
defaultValue:
|
555
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional(),
|
629
556
|
configuration: import_zod5.z.object({
|
630
557
|
styles: import_zod5.z.object({
|
631
558
|
fontVariant: HtmlFontVariant.optional()
|
@@ -634,7 +561,7 @@ var Paragraph = BaseField.extend({
|
|
634
561
|
}).describe("A read-only HTML <p> paragraph");
|
635
562
|
var PageHeader = BaseField.extend({
|
636
563
|
type: import_zod5.z.literal(FieldType.PAGE_HEADER),
|
637
|
-
defaultValue:
|
564
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
638
565
|
}).describe("A read-only header component for form pages");
|
639
566
|
var File = BaseField.extend({
|
640
567
|
type: import_zod5.z.literal(FieldType.FILE),
|
@@ -645,8 +572,7 @@ var File = BaseField.extend({
|
|
645
572
|
width: import_zod5.z.enum(["full", "auto"]).optional().describe(
|
646
573
|
"Whether the file upload button should take the full width of the container or not"
|
647
574
|
)
|
648
|
-
}).optional()
|
649
|
-
fileName: TranslationConfig.optional()
|
575
|
+
}).optional()
|
650
576
|
}).default({
|
651
577
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
652
578
|
})
|
@@ -657,7 +583,7 @@ var SelectOption = import_zod5.z.object({
|
|
657
583
|
});
|
658
584
|
var RadioGroup = BaseField.extend({
|
659
585
|
type: import_zod5.z.literal(FieldType.RADIO_GROUP),
|
660
|
-
defaultValue: TextValue.optional(),
|
586
|
+
defaultValue: import_zod5.z.union([TextValue, DependencyExpression]).optional(),
|
661
587
|
options: import_zod5.z.array(SelectOption).describe("A list of options"),
|
662
588
|
configuration: import_zod5.z.object({
|
663
589
|
styles: import_zod5.z.object({
|
@@ -667,7 +593,7 @@ var RadioGroup = BaseField.extend({
|
|
667
593
|
}).describe("Grouped radio options");
|
668
594
|
var BulletList = BaseField.extend({
|
669
595
|
type: import_zod5.z.literal(FieldType.BULLET_LIST),
|
670
|
-
defaultValue:
|
596
|
+
defaultValue: import_zod5.z.string().optional(),
|
671
597
|
items: import_zod5.z.array(TranslationConfig).describe("A list of items"),
|
672
598
|
configuration: import_zod5.z.object({
|
673
599
|
styles: import_zod5.z.object({
|
@@ -677,16 +603,16 @@ var BulletList = BaseField.extend({
|
|
677
603
|
}).describe("A list of bullet points");
|
678
604
|
var Select = BaseField.extend({
|
679
605
|
type: import_zod5.z.literal(FieldType.SELECT),
|
680
|
-
defaultValue: TextValue.optional(),
|
606
|
+
defaultValue: import_zod5.z.union([TextValue, DependencyExpression]).optional(),
|
681
607
|
options: import_zod5.z.array(SelectOption).describe("A list of options")
|
682
608
|
}).describe("Select input");
|
683
609
|
var Checkbox = BaseField.extend({
|
684
610
|
type: import_zod5.z.literal(FieldType.CHECKBOX),
|
685
|
-
defaultValue: CheckboxFieldValue.optional()
|
611
|
+
defaultValue: import_zod5.z.union([CheckboxFieldValue, DependencyExpression]).optional()
|
686
612
|
}).describe("Boolean checkbox field");
|
687
613
|
var Country = BaseField.extend({
|
688
614
|
type: import_zod5.z.literal(FieldType.COUNTRY),
|
689
|
-
defaultValue:
|
615
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
690
616
|
}).describe("Country select field");
|
691
617
|
var AdministrativeAreas = import_zod5.z.enum([
|
692
618
|
"ADMIN_STRUCTURE",
|
@@ -701,12 +627,12 @@ var AdministrativeAreaConfiguration = import_zod5.z.object({
|
|
701
627
|
}).describe("Administrative area options");
|
702
628
|
var AdministrativeArea = BaseField.extend({
|
703
629
|
type: import_zod5.z.literal(FieldType.ADMINISTRATIVE_AREA),
|
704
|
-
defaultValue:
|
630
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional(),
|
705
631
|
configuration: AdministrativeAreaConfiguration
|
706
632
|
}).describe("Administrative area input field e.g. facility, office");
|
707
633
|
var Location = BaseField.extend({
|
708
634
|
type: import_zod5.z.literal(FieldType.LOCATION),
|
709
|
-
defaultValue:
|
635
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
710
636
|
}).describe("Input field for a location");
|
711
637
|
var FileUploadWithOptions = BaseField.extend({
|
712
638
|
type: import_zod5.z.literal(FieldType.FILE_WITH_OPTIONS),
|
@@ -720,11 +646,11 @@ var FileUploadWithOptions = BaseField.extend({
|
|
720
646
|
});
|
721
647
|
var Facility = BaseField.extend({
|
722
648
|
type: import_zod5.z.literal(FieldType.FACILITY),
|
723
|
-
defaultValue:
|
649
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
724
650
|
}).describe("Input field for a facility");
|
725
651
|
var Office = BaseField.extend({
|
726
652
|
type: import_zod5.z.literal(FieldType.OFFICE),
|
727
|
-
defaultValue:
|
653
|
+
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
728
654
|
}).describe("Input field for an office");
|
729
655
|
var Address = BaseField.extend({
|
730
656
|
type: import_zod5.z.literal(FieldType.ADDRESS),
|
@@ -733,7 +659,7 @@ var Address = BaseField.extend({
|
|
733
659
|
var DataEntry = import_zod5.z.union([
|
734
660
|
import_zod5.z.object({
|
735
661
|
label: TranslationConfig,
|
736
|
-
value:
|
662
|
+
value: import_zod5.z.string()
|
737
663
|
}),
|
738
664
|
import_zod5.z.object({
|
739
665
|
fieldId: import_zod5.z.string()
|
@@ -752,7 +678,6 @@ var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
|
752
678
|
NumberField,
|
753
679
|
TextAreaField,
|
754
680
|
DateField,
|
755
|
-
DateRangeField,
|
756
681
|
Paragraph,
|
757
682
|
RadioGroup,
|
758
683
|
BulletList,
|
@@ -770,14 +695,10 @@ var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
|
770
695
|
EmailField,
|
771
696
|
FileUploadWithOptions,
|
772
697
|
DataField
|
773
|
-
|
774
|
-
|
775
|
-
ref: "FieldConfig"
|
776
|
-
});
|
698
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
699
|
+
]);
|
777
700
|
|
778
701
|
// ../commons/src/events/PageConfig.ts
|
779
|
-
var import_zod_openapi4 = require("zod-openapi");
|
780
|
-
(0, import_zod_openapi4.extendZodWithOpenApi)(import_zod6.z);
|
781
702
|
var PageTypes = import_zod6.z.enum(["FORM", "VERIFICATION"]);
|
782
703
|
var PageConfigBase = import_zod6.z.object({
|
783
704
|
id: import_zod6.z.string().describe("Unique identifier for the page"),
|
@@ -786,9 +707,6 @@ var PageConfigBase = import_zod6.z.object({
|
|
786
707
|
conditional: Conditional.optional().describe(
|
787
708
|
"Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
|
788
709
|
)
|
789
|
-
}).openapi({
|
790
|
-
description: "Form page configuration",
|
791
|
-
ref: "FormPageConfig"
|
792
710
|
});
|
793
711
|
var FormPageConfig = PageConfigBase.extend({
|
794
712
|
type: import_zod6.z.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
|
@@ -802,10 +720,7 @@ var VerificationActionConfig = import_zod6.z.object({
|
|
802
720
|
body: TranslationConfig
|
803
721
|
})
|
804
722
|
})
|
805
|
-
}).describe("Actions available on the verification page")
|
806
|
-
description: "Verification action configuration",
|
807
|
-
ref: "VerificationActionConfig"
|
808
|
-
});
|
723
|
+
}).describe("Actions available on the verification page");
|
809
724
|
var VerificationPageConfig = FormPageConfig.extend({
|
810
725
|
type: import_zod6.z.literal(PageTypes.enum.VERIFICATION),
|
811
726
|
actions: VerificationActionConfig
|
@@ -905,8 +820,6 @@ var ActionFormConfig = import_zod8.z.object({
|
|
905
820
|
var FormConfig = import_zod8.z.union([DeclarationFormConfig, ActionFormConfig]);
|
906
821
|
|
907
822
|
// ../commons/src/events/ActionConfig.ts
|
908
|
-
var import_zod_openapi5 = require("zod-openapi");
|
909
|
-
(0, import_zod_openapi5.extendZodWithOpenApi)(import_zod9.z);
|
910
823
|
var ActionConditional2 = import_zod9.z.discriminatedUnion("type", [
|
911
824
|
/** If conditional is defined, the action is shown to the user only if the condition is met */
|
912
825
|
ShowConditional,
|
@@ -984,24 +897,18 @@ var ApproveCorrectionConfig = ActionConfigBase.merge(
|
|
984
897
|
})
|
985
898
|
);
|
986
899
|
var ActionConfig = import_zod9.z.discriminatedUnion("type", [
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
ref: "PrintCertificateActionConfig"
|
1000
|
-
}),
|
1001
|
-
RequestCorrectionConfig.openapi({ ref: "RequestCorrectionActionConfig" }),
|
1002
|
-
RejectCorrectionConfig.openapi({ ref: "RejectCorrectionActionConfig" }),
|
1003
|
-
ApproveCorrectionConfig.openapi({ ref: "ApproveCorrectionActionConfig" })
|
1004
|
-
]).openapi({ ref: "ActionConfig" });
|
900
|
+
DeclareConfig,
|
901
|
+
ValidateConfig,
|
902
|
+
RejectDeclarationConfig,
|
903
|
+
MarkedAsDuplicateConfig,
|
904
|
+
ArchiveConfig,
|
905
|
+
RegisterConfig,
|
906
|
+
DeleteConfig,
|
907
|
+
PrintCertificateActionConfig,
|
908
|
+
RequestCorrectionConfig,
|
909
|
+
RejectCorrectionConfig,
|
910
|
+
ApproveCorrectionConfig
|
911
|
+
]);
|
1005
912
|
var DeclarationActionConfig = import_zod9.z.discriminatedUnion("type", [
|
1006
913
|
DeclareConfig,
|
1007
914
|
ValidateConfig,
|
@@ -1045,12 +952,10 @@ var LanguageConfig = import_zod11.z.object({
|
|
1045
952
|
});
|
1046
953
|
|
1047
954
|
// ../commons/src/events/EventConfig.ts
|
1048
|
-
var
|
955
|
+
var import_zod20 = require("zod");
|
1049
956
|
|
1050
957
|
// ../commons/src/events/DeduplicationConfig.ts
|
1051
958
|
var import_zod12 = require("zod");
|
1052
|
-
var import_zod_openapi6 = require("zod-openapi");
|
1053
|
-
(0, import_zod_openapi6.extendZodWithOpenApi)(import_zod12.z);
|
1054
959
|
var FieldReference = import_zod12.z.string();
|
1055
960
|
var Matcher = import_zod12.z.object({
|
1056
961
|
fieldId: import_zod12.z.string(),
|
@@ -1111,9 +1016,7 @@ var Clause = import_zod12.z.lazy(
|
|
1111
1016
|
DateRangeMatcher,
|
1112
1017
|
DateDistanceMatcher
|
1113
1018
|
])
|
1114
|
-
)
|
1115
|
-
ref: "Clause"
|
1116
|
-
});
|
1019
|
+
);
|
1117
1020
|
var DeduplicationConfig = import_zod12.z.object({
|
1118
1021
|
id: import_zod12.z.string(),
|
1119
1022
|
label: TranslationConfig,
|
@@ -1122,259 +1025,272 @@ var DeduplicationConfig = import_zod12.z.object({
|
|
1122
1025
|
|
1123
1026
|
// ../commons/src/events/SummaryConfig.ts
|
1124
1027
|
var import_zod13 = require("zod");
|
1125
|
-
var
|
1126
|
-
emptyValueMessage: TranslationConfig.optional(),
|
1127
|
-
conditionals: import_zod13.z.array(ShowConditional).default([]).optional()
|
1128
|
-
});
|
1129
|
-
var ReferenceField = BaseField2.extend({
|
1130
|
-
fieldId: import_zod13.z.string(),
|
1131
|
-
label: TranslationConfig.optional().describe(
|
1132
|
-
"By default, the configured field's label is used. This can be overridden by providing a custom label."
|
1133
|
-
)
|
1134
|
-
}).describe("Field directly referencing event data with field id");
|
1135
|
-
var Field = BaseField2.extend({
|
1028
|
+
var Field = import_zod13.z.object({
|
1136
1029
|
id: import_zod13.z.string().describe("Id of summary field"),
|
1137
1030
|
value: TranslationConfig.describe(
|
1138
1031
|
"Summary field value. Can utilise values defined in configuration and EventMetadata"
|
1139
1032
|
),
|
1140
1033
|
label: TranslationConfig,
|
1141
1034
|
emptyValueMessage: TranslationConfig.optional()
|
1142
|
-
})
|
1035
|
+
});
|
1036
|
+
var Title = import_zod13.z.object({
|
1037
|
+
id: import_zod13.z.string(),
|
1038
|
+
label: TranslationConfig.describe("Title content"),
|
1039
|
+
emptyValueMessage: TranslationConfig.optional()
|
1040
|
+
});
|
1143
1041
|
var SummaryConfig = import_zod13.z.object({
|
1144
|
-
|
1042
|
+
title: Title.describe("Title of summary view."),
|
1043
|
+
fields: import_zod13.z.array(Field).describe("Fields rendered in summary view.")
|
1145
1044
|
}).describe("Configuration for summary in event.");
|
1146
1045
|
|
1147
|
-
// ../commons/src/events/
|
1148
|
-
var
|
1149
|
-
var MatchType = import_zod14.z.enum(["fuzzy", "exact", "range"]);
|
1150
|
-
var BaseField3 = import_zod14.z.object({
|
1151
|
-
config: import_zod14.z.object({
|
1152
|
-
type: MatchType.describe("Determines the type of field")
|
1153
|
-
}),
|
1154
|
-
options: import_zod14.z.array(SelectOption).optional(),
|
1155
|
-
searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
|
1156
|
-
`
|
1157
|
-
This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
|
1158
|
-
when rendering search parameter labels \u2014 for example, in the search results page to indicate which fields were used in the search.
|
1159
|
-
|
1160
|
-
For example, a field config like { id: "child.firstname", label: { defaultMessage: "First Name(s)" } } would render as "First Name(s)" by default.
|
1161
|
-
|
1162
|
-
A field config like { id: "mother.firstname", label: { defaultMessage: "First Name(s)" } } would also render as "First Name(s)" by default.
|
1046
|
+
// ../commons/src/events/WorkqueueConfig.ts
|
1047
|
+
var import_zod15 = require("zod");
|
1163
1048
|
|
1164
|
-
|
1165
|
-
|
1049
|
+
// ../commons/src/events/EventMetadata.ts
|
1050
|
+
var import_zod14 = require("zod");
|
1051
|
+
var EventStatus = {
|
1052
|
+
CREATED: "CREATED",
|
1053
|
+
NOTIFIED: "NOTIFIED",
|
1054
|
+
DECLARED: "DECLARED",
|
1055
|
+
VALIDATED: "VALIDATED",
|
1056
|
+
REGISTERED: "REGISTERED",
|
1057
|
+
CERTIFIED: "CERTIFIED",
|
1058
|
+
REJECTED: "REJECTED",
|
1059
|
+
ARCHIVED: "ARCHIVED"
|
1060
|
+
};
|
1061
|
+
var eventStatuses = Object.values(EventStatus);
|
1062
|
+
var EventStatuses = import_zod14.z.nativeEnum(EventStatus);
|
1063
|
+
var EventMetadata = import_zod14.z.object({
|
1064
|
+
id: import_zod14.z.string(),
|
1065
|
+
type: import_zod14.z.string(),
|
1066
|
+
status: EventStatuses,
|
1067
|
+
createdAt: import_zod14.z.string().datetime(),
|
1068
|
+
createdBy: import_zod14.z.string(),
|
1069
|
+
createdAtLocation: import_zod14.z.string(),
|
1070
|
+
modifiedAt: import_zod14.z.string().datetime(),
|
1071
|
+
assignedTo: import_zod14.z.string().nullish(),
|
1072
|
+
updatedBy: import_zod14.z.string(),
|
1073
|
+
trackingId: import_zod14.z.string(),
|
1074
|
+
registrationNumber: import_zod14.z.string().nullish()
|
1075
|
+
});
|
1076
|
+
var eventMetadataLabelMap = {
|
1077
|
+
"event.assignedTo": {
|
1078
|
+
id: "event.assignedTo.label",
|
1079
|
+
defaultMessage: "Assigned To",
|
1080
|
+
description: "Assigned To"
|
1081
|
+
},
|
1082
|
+
"event.createdAt": {
|
1083
|
+
id: "event.createdAt.label",
|
1084
|
+
defaultMessage: "Created",
|
1085
|
+
description: "Created At"
|
1086
|
+
},
|
1087
|
+
"event.createdAtLocation": {
|
1088
|
+
id: "event.createdAtLocation.label",
|
1089
|
+
defaultMessage: "Location",
|
1090
|
+
description: "Created At Location"
|
1091
|
+
},
|
1092
|
+
"event.createdBy": {
|
1093
|
+
id: "event.createdBy.label",
|
1094
|
+
defaultMessage: "Created By",
|
1095
|
+
description: "Created By"
|
1096
|
+
},
|
1097
|
+
"event.id": {
|
1098
|
+
id: "event.id.label",
|
1099
|
+
defaultMessage: "ID",
|
1100
|
+
description: "ID"
|
1101
|
+
},
|
1102
|
+
"event.modifiedAt": {
|
1103
|
+
id: "event.modifiedAt.label",
|
1104
|
+
defaultMessage: "Updated",
|
1105
|
+
description: "Modified At"
|
1106
|
+
},
|
1107
|
+
"event.status": {
|
1108
|
+
id: "event.status.label",
|
1109
|
+
defaultMessage: "Status",
|
1110
|
+
description: "Status"
|
1111
|
+
},
|
1112
|
+
"event.type": {
|
1113
|
+
id: "event.type.label",
|
1114
|
+
defaultMessage: "Type",
|
1115
|
+
description: "Type"
|
1116
|
+
},
|
1117
|
+
"event.updatedBy": {
|
1118
|
+
id: "event.updatedBy.label",
|
1119
|
+
defaultMessage: "Updated By",
|
1120
|
+
description: "Updated By"
|
1121
|
+
},
|
1122
|
+
"event.trackingId": {
|
1123
|
+
id: "event.trackingId.label",
|
1124
|
+
defaultMessage: "Tracking ID",
|
1125
|
+
description: "Tracking ID"
|
1126
|
+
},
|
1127
|
+
"event.registrationNumber": {
|
1128
|
+
id: "event.registrationNumber.label",
|
1129
|
+
defaultMessage: "Registration Number",
|
1130
|
+
description: "Registration Number"
|
1131
|
+
}
|
1132
|
+
};
|
1166
1133
|
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1134
|
+
// ../commons/src/events/WorkqueueConfig.ts
|
1135
|
+
var WorkqueueConfig = import_zod15.z.object({
|
1136
|
+
id: import_zod15.z.string().describe("Unique identifier for workqueue."),
|
1137
|
+
filters: import_zod15.z.array(
|
1138
|
+
import_zod15.z.object({
|
1139
|
+
status: import_zod15.z.array(EventStatuses).describe("Defines which statusese are included in the workqueue.")
|
1140
|
+
})
|
1141
|
+
).describe("Filters to be applied to workqueue.")
|
1142
|
+
}).describe("Configuration for workqueue.");
|
1170
1143
|
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
),
|
1175
|
-
conditionals: import_zod14.z.array(FieldConditional).default([]).optional().describe(
|
1176
|
-
`
|
1177
|
-
In advanced search, we sometimes need to override the default field visibility conditionals.
|
1178
|
-
|
1179
|
-
For example, Informant fields in the declaration form may have conditional logic
|
1180
|
-
that hides them based on other field values. Since the advanced search form reuses
|
1181
|
-
the declaration form config, those same conditionals would apply by default.
|
1182
|
-
|
1183
|
-
However, in advanced search we often want to make all Informant fields searchable,
|
1184
|
-
regardless of their original visibility logic. To do this, we explicitly set their
|
1185
|
-
'conditionals' to an empty array ('[]') in the search config. This ensures they
|
1186
|
-
are always rendered in the advanced search form.
|
1187
|
-
`
|
1188
|
-
)
|
1189
|
-
});
|
1190
|
-
var SearchQueryParams = import_zod14.z.object({
|
1191
|
-
eventType: import_zod14.z.string().optional().describe(
|
1192
|
-
"Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
|
1193
|
-
)
|
1194
|
-
}).catchall(FieldValue);
|
1195
|
-
var FieldConfigSchema = BaseField3.extend({
|
1196
|
-
fieldId: import_zod14.z.string(),
|
1197
|
-
fieldType: import_zod14.z.literal("field")
|
1198
|
-
});
|
1199
|
-
var EventFieldId = import_zod14.z.enum([
|
1200
|
-
"trackingId",
|
1201
|
-
"status",
|
1202
|
-
"legalStatus.REGISTERED.createdAt",
|
1203
|
-
"legalStatus.REGISTERED.createdAtLocation",
|
1204
|
-
"updatedAt"
|
1205
|
-
]);
|
1206
|
-
var EventFieldConfigSchema = BaseField3.extend({
|
1207
|
-
fieldId: EventFieldId,
|
1208
|
-
fieldType: import_zod14.z.literal("event")
|
1209
|
-
});
|
1210
|
-
var SearchField = import_zod14.z.discriminatedUnion("fieldType", [
|
1211
|
-
FieldConfigSchema,
|
1212
|
-
EventFieldConfigSchema
|
1213
|
-
]);
|
1214
|
-
var AdvancedSearchConfig = import_zod14.z.object({
|
1144
|
+
// ../commons/src/events/AdvancedSearchConfig.ts
|
1145
|
+
var import_zod16 = require("zod");
|
1146
|
+
var AdvancedSearchConfig = import_zod16.z.object({
|
1215
1147
|
title: TranslationConfig.describe("Advanced search tab title"),
|
1216
|
-
fields:
|
1148
|
+
fields: import_zod16.z.array(
|
1149
|
+
import_zod16.z.object({
|
1150
|
+
fieldId: import_zod16.z.string(),
|
1151
|
+
config: import_zod16.z.object({
|
1152
|
+
type: import_zod16.z.enum(["FUZZY", "EXACT", "RANGE"]).describe("Determines the type of field")
|
1153
|
+
}).optional().describe("Configuration options for the field")
|
1154
|
+
})
|
1155
|
+
).optional().default([]).describe("Advanced search fields.")
|
1217
1156
|
});
|
1218
1157
|
|
1219
1158
|
// ../commons/src/events/utils.ts
|
1220
1159
|
var import_lodash = require("lodash");
|
1221
1160
|
|
1222
|
-
// ../commons/src/
|
1223
|
-
var
|
1224
|
-
|
1225
|
-
|
1226
|
-
var
|
1227
|
-
var
|
1228
|
-
|
1229
|
-
|
1230
|
-
Accepted: "Accepted",
|
1231
|
-
Rejected: "Rejected"
|
1232
|
-
};
|
1233
|
-
var ActionBase = import_zod15.z.object({
|
1234
|
-
id: import_zod15.z.string(),
|
1235
|
-
transactionId: import_zod15.z.string(),
|
1236
|
-
createdAt: import_zod15.z.string().datetime(),
|
1237
|
-
createdBy: import_zod15.z.string(),
|
1238
|
-
createdByRole: import_zod15.z.string(),
|
1239
|
-
declaration: ActionUpdate,
|
1240
|
-
annotation: ActionUpdate.optional(),
|
1241
|
-
createdAtLocation: import_zod15.z.string(),
|
1242
|
-
status: import_zod15.z.enum([
|
1243
|
-
ActionStatus.Requested,
|
1244
|
-
ActionStatus.Accepted,
|
1245
|
-
ActionStatus.Rejected
|
1246
|
-
]),
|
1247
|
-
// If the action is an asynchronous confirmation for another action, we will save the original action id here.
|
1248
|
-
originalActionId: import_zod15.z.string().optional()
|
1161
|
+
// ../commons/src/workqueues/WorkqueueConfig.ts
|
1162
|
+
var import_zod18 = require("zod");
|
1163
|
+
|
1164
|
+
// ../commons/src/workqueues/defaultColumns.ts
|
1165
|
+
var import_zod17 = require("zod");
|
1166
|
+
var WorkQueueColumnConfig = import_zod17.z.object({
|
1167
|
+
id: import_zod17.z.string(),
|
1168
|
+
label: TranslationConfig
|
1249
1169
|
});
|
1250
|
-
var
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
}
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
})
|
1287
|
-
);
|
1288
|
-
var ArchiveAction = ActionBase.merge(
|
1289
|
-
import_zod15.z.object({
|
1290
|
-
type: import_zod15.z.literal(ActionType.ARCHIVE)
|
1291
|
-
})
|
1292
|
-
);
|
1293
|
-
var CreatedAction = ActionBase.merge(
|
1294
|
-
import_zod15.z.object({
|
1295
|
-
type: import_zod15.z.literal(ActionType.CREATE)
|
1296
|
-
})
|
1297
|
-
);
|
1298
|
-
var NotifiedAction = ActionBase.merge(
|
1299
|
-
import_zod15.z.object({
|
1300
|
-
type: import_zod15.z.literal(ActionType.NOTIFY)
|
1301
|
-
})
|
1302
|
-
);
|
1303
|
-
var PrintCertificateAction = ActionBase.merge(
|
1304
|
-
import_zod15.z.object({
|
1305
|
-
type: import_zod15.z.literal(ActionType.PRINT_CERTIFICATE)
|
1306
|
-
})
|
1307
|
-
);
|
1308
|
-
var RequestedCorrectionAction = ActionBase.merge(
|
1309
|
-
import_zod15.z.object({
|
1310
|
-
type: import_zod15.z.literal(ActionType.REQUEST_CORRECTION)
|
1311
|
-
})
|
1312
|
-
);
|
1313
|
-
var ApprovedCorrectionAction = ActionBase.merge(
|
1314
|
-
import_zod15.z.object({
|
1315
|
-
type: import_zod15.z.literal(ActionType.APPROVE_CORRECTION),
|
1316
|
-
requestId: import_zod15.z.string()
|
1317
|
-
})
|
1318
|
-
);
|
1319
|
-
var RejectedCorrectionAction = ActionBase.merge(
|
1320
|
-
import_zod15.z.object({
|
1321
|
-
type: import_zod15.z.literal(ActionType.REJECT_CORRECTION),
|
1322
|
-
requestId: import_zod15.z.string()
|
1323
|
-
})
|
1324
|
-
);
|
1325
|
-
var ReadAction = ActionBase.merge(
|
1326
|
-
import_zod15.z.object({
|
1327
|
-
type: import_zod15.z.literal(ActionType.READ)
|
1328
|
-
})
|
1170
|
+
var defaultColumns = {
|
1171
|
+
event: {
|
1172
|
+
id: "event",
|
1173
|
+
label: {
|
1174
|
+
defaultMessage: "Event",
|
1175
|
+
description: "This is the label for the workqueue column",
|
1176
|
+
id: "workqueue.default.column.event"
|
1177
|
+
}
|
1178
|
+
},
|
1179
|
+
status: {
|
1180
|
+
id: "status",
|
1181
|
+
label: {
|
1182
|
+
defaultMessage: "Status",
|
1183
|
+
description: "This is the label for the workqueue column",
|
1184
|
+
id: "workqueue.default.column.status"
|
1185
|
+
}
|
1186
|
+
},
|
1187
|
+
createdAt: {
|
1188
|
+
id: "createdAt",
|
1189
|
+
label: {
|
1190
|
+
defaultMessage: "Created",
|
1191
|
+
description: "This is the label for the workqueue column",
|
1192
|
+
id: "workqueue.default.column.createdAt"
|
1193
|
+
}
|
1194
|
+
},
|
1195
|
+
modifiedAt: {
|
1196
|
+
id: "modifiedAt",
|
1197
|
+
label: {
|
1198
|
+
defaultMessage: "Modified",
|
1199
|
+
description: "This is the label for the workqueue column",
|
1200
|
+
id: "workqueue.default.column.modifiedAt"
|
1201
|
+
}
|
1202
|
+
}
|
1203
|
+
};
|
1204
|
+
var DefaultColumnKeys = import_zod17.z.enum(
|
1205
|
+
Object.keys(defaultColumns)
|
1329
1206
|
);
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
RegisterAction.openapi({ ref: "RegisterAction" }),
|
1338
|
-
DeclareAction.openapi({ ref: "DeclareAction" }),
|
1339
|
-
AssignedAction.openapi({ ref: "AssignedAction" }),
|
1340
|
-
RequestedCorrectionAction.openapi({ ref: "RequestedCorrectionAction" }),
|
1341
|
-
ApprovedCorrectionAction.openapi({ ref: "ApprovedCorrectionAction" }),
|
1342
|
-
RejectedCorrectionAction.openapi({ ref: "RejectedCorrectionAction" }),
|
1343
|
-
UnassignedAction.openapi({ ref: "UnassignedAction" }),
|
1344
|
-
PrintCertificateAction.openapi({ ref: "PrintCertificateAction" }),
|
1345
|
-
ReadAction.openapi({ ref: "ReadAction" })
|
1346
|
-
]).openapi({
|
1347
|
-
ref: "ActionDocument"
|
1207
|
+
|
1208
|
+
// ../commons/src/workqueues/WorkqueueConfig.ts
|
1209
|
+
var rootWorkqueueConfig = import_zod18.z.object({
|
1210
|
+
id: import_zod18.z.string(),
|
1211
|
+
title: TranslationConfig,
|
1212
|
+
columns: import_zod18.z.array(WorkQueueColumnConfig),
|
1213
|
+
defaultColumns: import_zod18.z.array(DefaultColumnKeys)
|
1348
1214
|
});
|
1349
|
-
var
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
}
|
1368
|
-
|
1215
|
+
var defineWorkqueue = (config) => rootWorkqueueConfig.parse(config);
|
1216
|
+
|
1217
|
+
// ../commons/src/workqueues/all.ts
|
1218
|
+
var allWorkqueue = defineWorkqueue({
|
1219
|
+
id: "all",
|
1220
|
+
title: {
|
1221
|
+
defaultMessage: "All events",
|
1222
|
+
description: "This is the label for the workqueue",
|
1223
|
+
id: "workqueue.all.label"
|
1224
|
+
},
|
1225
|
+
columns: [
|
1226
|
+
{
|
1227
|
+
id: "title",
|
1228
|
+
label: {
|
1229
|
+
defaultMessage: "Title",
|
1230
|
+
description: "This is the label for the workqueue column",
|
1231
|
+
id: "workqueue.all.column.title"
|
1232
|
+
}
|
1233
|
+
}
|
1234
|
+
],
|
1235
|
+
defaultColumns: ["event", "status", "createdAt", "modifiedAt"]
|
1236
|
+
});
|
1237
|
+
|
1238
|
+
// ../commons/src/workqueues/readyForReview.ts
|
1239
|
+
var inReviewWorkqueue = defineWorkqueue({
|
1240
|
+
id: "ready-for-review",
|
1241
|
+
title: {
|
1242
|
+
defaultMessage: "Ready for review",
|
1243
|
+
description: "Label for in review workqueue",
|
1244
|
+
id: "event.workqueue.in-review.label"
|
1245
|
+
},
|
1246
|
+
columns: [
|
1247
|
+
{
|
1248
|
+
id: "title",
|
1249
|
+
label: {
|
1250
|
+
defaultMessage: "Title",
|
1251
|
+
description: "This is the label for the workqueue column",
|
1252
|
+
id: "workqueue.in-reveiw.column.title"
|
1253
|
+
}
|
1254
|
+
}
|
1255
|
+
],
|
1256
|
+
defaultColumns: ["event", "createdAt", "modifiedAt"]
|
1257
|
+
});
|
1258
|
+
|
1259
|
+
// ../commons/src/workqueues/readyToPrint.ts
|
1260
|
+
var registeredWorkqueue = defineWorkqueue({
|
1261
|
+
id: "registered",
|
1262
|
+
title: {
|
1263
|
+
defaultMessage: "Ready to print",
|
1264
|
+
description: "Label for registered workqueue",
|
1265
|
+
id: "event.workqueue.registered.label"
|
1266
|
+
},
|
1267
|
+
columns: [
|
1268
|
+
{
|
1269
|
+
id: "title",
|
1270
|
+
label: {
|
1271
|
+
defaultMessage: "Title",
|
1272
|
+
description: "This is the label for the workqueue column",
|
1273
|
+
id: "workqueue.registered.column.title"
|
1274
|
+
}
|
1275
|
+
}
|
1276
|
+
],
|
1277
|
+
defaultColumns: ["event", "createdAt", "modifiedAt"]
|
1369
1278
|
});
|
1370
1279
|
|
1280
|
+
// ../commons/src/workqueues/index.ts
|
1281
|
+
var workqueues = {
|
1282
|
+
all: allWorkqueue,
|
1283
|
+
registered: registeredWorkqueue,
|
1284
|
+
inReview: inReviewWorkqueue
|
1285
|
+
};
|
1286
|
+
|
1371
1287
|
// ../commons/src/conditionals/validate.ts
|
1372
1288
|
var import_ajv = __toESM(require("ajv"));
|
1373
1289
|
var import_ajv_formats = __toESM(require("ajv-formats"));
|
1374
1290
|
var import_date_fns = require("date-fns");
|
1375
1291
|
|
1376
1292
|
// ../commons/src/events/FieldTypeMapping.ts
|
1377
|
-
var
|
1293
|
+
var import_zod19 = require("zod");
|
1378
1294
|
function mapFieldTypeToZod(type, required) {
|
1379
1295
|
let schema;
|
1380
1296
|
switch (type) {
|
@@ -1384,9 +1300,6 @@ function mapFieldTypeToZod(type, required) {
|
|
1384
1300
|
case FieldType.EMAIL:
|
1385
1301
|
schema = EmailValue;
|
1386
1302
|
break;
|
1387
|
-
case FieldType.DATE_RANGE:
|
1388
|
-
schema = DateRangeFieldValue;
|
1389
|
-
break;
|
1390
1303
|
case FieldType.TEXT:
|
1391
1304
|
case FieldType.TEXTAREA:
|
1392
1305
|
case FieldType.DIVIDER:
|
@@ -1401,7 +1314,8 @@ function mapFieldTypeToZod(type, required) {
|
|
1401
1314
|
case FieldType.FACILITY:
|
1402
1315
|
case FieldType.OFFICE:
|
1403
1316
|
case FieldType.SIGNATURE:
|
1404
|
-
|
1317
|
+
case FieldType.HIDDEN:
|
1318
|
+
schema = required ? RequiredTextValue : TextValue;
|
1405
1319
|
break;
|
1406
1320
|
case FieldType.NUMBER:
|
1407
1321
|
schema = NumberFieldValue;
|
@@ -1429,7 +1343,7 @@ function createValidationSchema(config) {
|
|
1429
1343
|
for (const field2 of config) {
|
1430
1344
|
shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
|
1431
1345
|
}
|
1432
|
-
return
|
1346
|
+
return import_zod19.z.object(shape);
|
1433
1347
|
}
|
1434
1348
|
function mapFieldTypeToMockValue(field2, i) {
|
1435
1349
|
switch (field2.type) {
|
@@ -1467,8 +1381,6 @@ function mapFieldTypeToMockValue(field2, i) {
|
|
1467
1381
|
};
|
1468
1382
|
case FieldType.DATE:
|
1469
1383
|
return "2021-01-01";
|
1470
|
-
case FieldType.DATE_RANGE:
|
1471
|
-
return ["2021-01-01", "2021-01-02"];
|
1472
1384
|
case FieldType.CHECKBOX:
|
1473
1385
|
return true;
|
1474
1386
|
case FieldType.FILE:
|
@@ -1503,7 +1415,6 @@ function mapFieldTypeToEmptyValue(field2) {
|
|
1503
1415
|
case FieldType.EMAIL:
|
1504
1416
|
case FieldType.DATE:
|
1505
1417
|
case FieldType.CHECKBOX:
|
1506
|
-
case FieldType.DATE_RANGE:
|
1507
1418
|
case FieldType.DATA:
|
1508
1419
|
return null;
|
1509
1420
|
case FieldType.ADDRESS:
|
@@ -1536,9 +1447,6 @@ var isParagraphFieldType = (field2) => {
|
|
1536
1447
|
var isDateFieldType = (field2) => {
|
1537
1448
|
return field2.config.type === FieldType.DATE;
|
1538
1449
|
};
|
1539
|
-
var isDateRangeFieldType = (field2) => {
|
1540
|
-
return field2.config.type === FieldType.DATE_RANGE;
|
1541
|
-
};
|
1542
1450
|
var isPageHeaderFieldType = (field2) => {
|
1543
1451
|
return field2.config.type === FieldType.PAGE_HEADER;
|
1544
1452
|
};
|
@@ -1609,23 +1517,12 @@ var ajv = new import_ajv.default({
|
|
1609
1517
|
function validate(schema, data) {
|
1610
1518
|
return ajv.validate(schema, data);
|
1611
1519
|
}
|
1612
|
-
function isConditionMet(conditional, values) {
|
1613
|
-
return validate(conditional, {
|
1614
|
-
$form: values,
|
1615
|
-
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" })
|
1616
|
-
});
|
1617
|
-
}
|
1618
1520
|
function getConditionalActionsForField(field2, values) {
|
1619
1521
|
if (!field2.conditionals) {
|
1620
1522
|
return [];
|
1621
1523
|
}
|
1622
1524
|
return field2.conditionals.filter((conditional) => validate(conditional.conditional, values)).map((conditional) => conditional.type);
|
1623
1525
|
}
|
1624
|
-
function areConditionsMet(conditions, values) {
|
1625
|
-
return conditions.every(
|
1626
|
-
(condition) => isConditionMet(condition.conditional, values)
|
1627
|
-
);
|
1628
|
-
}
|
1629
1526
|
function isFieldConditionMet(field2, form, conditionalType) {
|
1630
1527
|
const hasRule = (field2.conditionals ?? []).some(
|
1631
1528
|
(conditional) => conditional.type === conditionalType
|
@@ -1644,10 +1541,6 @@ function isFieldConditionMet(field2, form, conditionalType) {
|
|
1644
1541
|
function isFieldVisible(field2, form) {
|
1645
1542
|
return isFieldConditionMet(field2, form, ConditionalType.SHOW);
|
1646
1543
|
}
|
1647
|
-
function isFieldEmptyAndNotRequired(field2, form) {
|
1648
|
-
const fieldValue = form[field2.id];
|
1649
|
-
return !field2.required && (fieldValue === void 0 || fieldValue === "");
|
1650
|
-
}
|
1651
1544
|
function isFieldEnabled(field2, form) {
|
1652
1545
|
return isFieldConditionMet(field2, form, ConditionalType.ENABLE);
|
1653
1546
|
}
|
@@ -1752,11 +1645,6 @@ function runFieldValidations({
|
|
1752
1645
|
field: field2,
|
1753
1646
|
values
|
1754
1647
|
}) {
|
1755
|
-
if (!isFieldVisible(field2, values) || isFieldEmptyAndNotRequired(field2, values)) {
|
1756
|
-
return {
|
1757
|
-
errors: []
|
1758
|
-
};
|
1759
|
-
}
|
1760
1648
|
const conditionalParameters = {
|
1761
1649
|
$form: values,
|
1762
1650
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" })
|
@@ -1774,13 +1662,39 @@ function runFieldValidations({
|
|
1774
1662
|
errors: [...fieldValidationResult, ...customValidationResults]
|
1775
1663
|
};
|
1776
1664
|
}
|
1777
|
-
|
1778
|
-
|
1779
|
-
|
1665
|
+
function getFieldValidationErrors({
|
1666
|
+
field: field2,
|
1667
|
+
values
|
1668
|
+
}) {
|
1669
|
+
if (!isFieldVisible(field2, values) || !isFieldEnabled(field2, values)) {
|
1670
|
+
if (values[field2.id]) {
|
1671
|
+
return {
|
1672
|
+
errors: [
|
1673
|
+
{
|
1674
|
+
message: errorMessages.hiddenField
|
1675
|
+
}
|
1676
|
+
]
|
1677
|
+
};
|
1678
|
+
}
|
1679
|
+
return {
|
1680
|
+
errors: []
|
1681
|
+
};
|
1682
|
+
}
|
1683
|
+
return runFieldValidations({
|
1684
|
+
field: field2,
|
1685
|
+
values
|
1686
|
+
});
|
1687
|
+
}
|
1688
|
+
|
1689
|
+
// ../commons/src/uuid.ts
|
1690
|
+
var import_uuid = require("uuid");
|
1780
1691
|
function getUUID() {
|
1781
1692
|
return (0, import_uuid.v4)();
|
1782
1693
|
}
|
1783
1694
|
|
1695
|
+
// ../commons/src/events/utils.ts
|
1696
|
+
var import_date_fns2 = require("date-fns");
|
1697
|
+
|
1784
1698
|
// ../commons/src/utils.ts
|
1785
1699
|
function getOrThrow(x, message) {
|
1786
1700
|
if (x === void 0 || x === null) {
|
@@ -1817,9 +1731,15 @@ var getActionAnnotationFields = (actionConfig) => {
|
|
1817
1731
|
}
|
1818
1732
|
return [];
|
1819
1733
|
};
|
1820
|
-
|
1734
|
+
var getAllAnnotationFields = (config) => {
|
1821
1735
|
return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
|
1822
|
-
}
|
1736
|
+
};
|
1737
|
+
var findAllFields = (config) => {
|
1738
|
+
return (0, import_lodash.flattenDeep)([
|
1739
|
+
...getDeclarationFields(config),
|
1740
|
+
...getAllAnnotationFields(config)
|
1741
|
+
]);
|
1742
|
+
};
|
1823
1743
|
var findRecordActionPages = (config, actionType) => {
|
1824
1744
|
const action = config.actions.find((a) => a.type === actionType);
|
1825
1745
|
if (action?.type === ActionType.REQUEST_CORRECTION) {
|
@@ -1842,22 +1762,34 @@ function getActionReview(configuration, actionType) {
|
|
1842
1762
|
function getActionReviewFields(configuration, actionType) {
|
1843
1763
|
return getActionReview(configuration, actionType).fields;
|
1844
1764
|
}
|
1765
|
+
function validateWorkqueueConfig(workqueueConfigs) {
|
1766
|
+
workqueueConfigs.map((workqueue) => {
|
1767
|
+
const rootWorkqueue = Object.values(workqueues).find(
|
1768
|
+
(wq) => wq.id === workqueue.id
|
1769
|
+
);
|
1770
|
+
if (!rootWorkqueue) {
|
1771
|
+
throw new Error(
|
1772
|
+
`Invalid workqueue configuration: workqueue not found with id: ${workqueue.id}`
|
1773
|
+
);
|
1774
|
+
}
|
1775
|
+
});
|
1776
|
+
}
|
1845
1777
|
function isPageVisible(page, formValues) {
|
1846
1778
|
if (!page.conditional) {
|
1847
1779
|
return true;
|
1848
1780
|
}
|
1849
|
-
return
|
1781
|
+
return validate(page.conditional, {
|
1782
|
+
$form: formValues,
|
1783
|
+
$now: (0, import_date_fns2.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" })
|
1784
|
+
});
|
1850
1785
|
}
|
1851
|
-
function omitHiddenFields(fields, values
|
1786
|
+
function omitHiddenFields(fields, values) {
|
1852
1787
|
return (0, import_lodash.omitBy)(values, (_, fieldId) => {
|
1853
|
-
|
1854
|
-
|
1855
|
-
}
|
1856
|
-
const fieldConfigs = fields.filter((f) => f.id === fieldId);
|
1857
|
-
if (!fieldConfigs.length) {
|
1788
|
+
const field2 = fields.find((f) => f.id === fieldId);
|
1789
|
+
if (!field2) {
|
1858
1790
|
return true;
|
1859
1791
|
}
|
1860
|
-
return
|
1792
|
+
return !isFieldVisible(field2, values);
|
1861
1793
|
});
|
1862
1794
|
}
|
1863
1795
|
function omitHiddenPaginatedFields(formConfig, declaration) {
|
@@ -1881,49 +1813,13 @@ function createEmptyDraft(eventId, draftId, actionType) {
|
|
1881
1813
|
annotation: {},
|
1882
1814
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
1883
1815
|
createdBy: "@todo",
|
1884
|
-
createdAtLocation: "@todo"
|
1885
|
-
status: ActionStatus.Accepted,
|
1886
|
-
transactionId: "@todo",
|
1887
|
-
createdByRole: "@todo"
|
1816
|
+
createdAtLocation: "@todo"
|
1888
1817
|
}
|
1889
1818
|
};
|
1890
1819
|
}
|
1891
1820
|
function isVerificationPage(page) {
|
1892
1821
|
return page.type === PageTypes.enum.VERIFICATION;
|
1893
1822
|
}
|
1894
|
-
function getVisibleVerificationPageIds(pages, annotation) {
|
1895
|
-
return pages.filter((page) => isVerificationPage(page)).filter((page) => isPageVisible(page, annotation)).map((page) => page.id);
|
1896
|
-
}
|
1897
|
-
function getActionVerificationPageIds(actionConfig, annotation) {
|
1898
|
-
if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
|
1899
|
-
return [
|
1900
|
-
...getVisibleVerificationPageIds(actionConfig.onboardingForm, annotation),
|
1901
|
-
...getVisibleVerificationPageIds(
|
1902
|
-
actionConfig.additionalDetailsForm,
|
1903
|
-
annotation
|
1904
|
-
)
|
1905
|
-
];
|
1906
|
-
}
|
1907
|
-
if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
|
1908
|
-
return getVisibleVerificationPageIds(
|
1909
|
-
actionConfig.printForm.pages,
|
1910
|
-
annotation
|
1911
|
-
);
|
1912
|
-
}
|
1913
|
-
return [];
|
1914
|
-
}
|
1915
|
-
function omitHiddenAnnotationFields(actionConfig, declaration, annotation) {
|
1916
|
-
const annotationFields = getActionAnnotationFields(actionConfig);
|
1917
|
-
const visibleVerificationPageIds = getActionVerificationPageIds(
|
1918
|
-
actionConfig,
|
1919
|
-
annotation
|
1920
|
-
);
|
1921
|
-
return omitHiddenFields(
|
1922
|
-
annotationFields,
|
1923
|
-
{ ...declaration, ...annotation },
|
1924
|
-
visibleVerificationPageIds
|
1925
|
-
);
|
1926
|
-
}
|
1927
1823
|
function deepMerge(currentDocument, actionDocument) {
|
1928
1824
|
return (0, import_lodash.mergeWith)(
|
1929
1825
|
currentDocument,
|
@@ -1950,49 +1846,19 @@ function findLastAssignmentAction(actions) {
|
|
1950
1846
|
function isWriteAction(actionType) {
|
1951
1847
|
return writeActions.safeParse(actionType).success;
|
1952
1848
|
}
|
1953
|
-
var findAllFields = (config) => {
|
1954
|
-
return (0, import_lodash.flattenDeep)([
|
1955
|
-
...getDeclarationFields(config),
|
1956
|
-
...getAllAnnotationFields(config)
|
1957
|
-
]);
|
1958
|
-
};
|
1959
|
-
function getMixedPath(obj, path, defaultValue) {
|
1960
|
-
const parts = path.split(".");
|
1961
|
-
const resolve = (current, segments) => {
|
1962
|
-
if (current == null || segments.length === 0) {
|
1963
|
-
return current;
|
1964
|
-
}
|
1965
|
-
for (let i = segments.length; i > 0; i--) {
|
1966
|
-
const compoundKey = segments.slice(0, i).join(".");
|
1967
|
-
if ((0, import_lodash.has)(current, compoundKey)) {
|
1968
|
-
const next = (0, import_lodash.get)(current, compoundKey);
|
1969
|
-
return resolve(next, segments.slice(i));
|
1970
|
-
}
|
1971
|
-
}
|
1972
|
-
return void 0;
|
1973
|
-
};
|
1974
|
-
const result = resolve(obj, parts);
|
1975
|
-
return (0, import_lodash.isNil)(result) ? defaultValue : result;
|
1976
|
-
}
|
1977
1849
|
|
1978
1850
|
// ../commons/src/events/EventConfig.ts
|
1979
|
-
var
|
1980
|
-
|
1981
|
-
var EventConfig = import_zod17.z.object({
|
1982
|
-
id: import_zod17.z.string().describe(
|
1851
|
+
var EventConfig = import_zod20.z.object({
|
1852
|
+
id: import_zod20.z.string().describe(
|
1983
1853
|
'A machine-readable identifier for the event, e.g. "birth" or "death"'
|
1984
1854
|
),
|
1985
|
-
dateOfEvent: import_zod17.z.object({ fieldId: import_zod17.z.string() }).optional(),
|
1986
|
-
title: TranslationConfig,
|
1987
|
-
fallbackTitle: TranslationConfig.optional().describe(
|
1988
|
-
"This is a fallback title if actual title resolves to empty string"
|
1989
|
-
),
|
1990
1855
|
summary: SummaryConfig,
|
1991
1856
|
label: TranslationConfig,
|
1992
|
-
actions:
|
1857
|
+
actions: import_zod20.z.array(ActionConfig),
|
1993
1858
|
declaration: DeclarationFormConfig,
|
1994
|
-
|
1995
|
-
|
1859
|
+
workqueues: import_zod20.z.array(WorkqueueConfig),
|
1860
|
+
deduplication: import_zod20.z.array(DeduplicationConfig).optional().default([]),
|
1861
|
+
advancedSearch: import_zod20.z.array(AdvancedSearchConfig).optional().default([])
|
1996
1862
|
}).superRefine((event2, ctx) => {
|
1997
1863
|
const allFields = findAllFields(event2);
|
1998
1864
|
const fieldIds = allFields.map((field2) => field2.id);
|
@@ -2008,43 +1874,16 @@ var EventConfig = import_zod17.z.object({
|
|
2008
1874
|
});
|
2009
1875
|
}
|
2010
1876
|
const invalidFields = event2.advancedSearch.flatMap(
|
2011
|
-
(section) => (
|
2012
|
-
// Check if the fieldId is not in the fieldIds array
|
2013
|
-
// and also not in the metadataFields array
|
2014
|
-
section.fields.filter(
|
2015
|
-
(field2) => !(fieldIds.includes(field2.fieldId) || EventFieldId.options.includes(field2.fieldId))
|
2016
|
-
)
|
2017
|
-
)
|
1877
|
+
(section) => section.fields.filter((field2) => !fieldIds.includes(field2.fieldId))
|
2018
1878
|
);
|
2019
1879
|
if (invalidFields.length > 0) {
|
2020
1880
|
ctx.addIssue({
|
2021
1881
|
code: "custom",
|
2022
|
-
message: `Advanced search id must match a field id
|
1882
|
+
message: `Advanced search id must match a field id in fields array.
|
2023
1883
|
Invalid AdvancedSearch field IDs for event ${event2.id}: ${invalidFields.map((f) => f.fieldId).join(", ")}`,
|
2024
1884
|
path: ["advancedSearch"]
|
2025
1885
|
});
|
2026
1886
|
}
|
2027
|
-
if (event2.dateOfEvent) {
|
2028
|
-
const eventDateFieldId = getDeclarationFields(event2).find(
|
2029
|
-
({ id }) => id === event2.dateOfEvent?.fieldId
|
2030
|
-
);
|
2031
|
-
if (!eventDateFieldId) {
|
2032
|
-
ctx.addIssue({
|
2033
|
-
code: "custom",
|
2034
|
-
message: `Date of event field id must match a field id in fields array.
|
2035
|
-
Invalid date of event field ID for event ${event2.id}: ${event2.dateOfEvent.fieldId}`,
|
2036
|
-
path: ["dateOfEvent"]
|
2037
|
-
});
|
2038
|
-
} else if (eventDateFieldId.type !== FieldType.DATE) {
|
2039
|
-
ctx.addIssue({
|
2040
|
-
code: "custom",
|
2041
|
-
message: `Field specified for date of event is of type: ${eventDateFieldId.type}, but it needs to be of type: ${FieldType.DATE}`,
|
2042
|
-
path: ["dateOfEvent.fieldType"]
|
2043
|
-
});
|
2044
|
-
}
|
2045
|
-
}
|
2046
|
-
}).openapi({
|
2047
|
-
ref: "EventConfig"
|
2048
1887
|
});
|
2049
1888
|
|
2050
1889
|
// ../commons/src/events/EventConfigInput.ts
|
@@ -2053,48 +1892,521 @@ var defineActionForm = (actionForm) => ActionFormConfig.parse(actionForm);
|
|
2053
1892
|
var definePage = (page) => PageConfig.parse(page);
|
2054
1893
|
var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
|
2055
1894
|
|
2056
|
-
// ../commons/src/events/
|
1895
|
+
// ../commons/src/events/Draft.ts
|
1896
|
+
var import_zod23 = require("zod");
|
1897
|
+
|
1898
|
+
// ../commons/src/events/ActionDocument.ts
|
1899
|
+
var import_zod21 = require("zod");
|
1900
|
+
var ActionUpdate = import_zod21.z.record(import_zod21.z.string(), FieldUpdateValue);
|
1901
|
+
var ActionStatus = {
|
1902
|
+
Requested: "Requested",
|
1903
|
+
Accepted: "Accepted",
|
1904
|
+
Rejected: "Rejected"
|
1905
|
+
};
|
1906
|
+
var ActionBase = import_zod21.z.object({
|
1907
|
+
id: import_zod21.z.string(),
|
1908
|
+
createdAt: import_zod21.z.string().datetime(),
|
1909
|
+
createdBy: import_zod21.z.string(),
|
1910
|
+
declaration: ActionUpdate,
|
1911
|
+
annotation: ActionUpdate.optional(),
|
1912
|
+
createdAtLocation: import_zod21.z.string(),
|
1913
|
+
status: import_zod21.z.enum([
|
1914
|
+
ActionStatus.Requested,
|
1915
|
+
ActionStatus.Accepted,
|
1916
|
+
ActionStatus.Rejected
|
1917
|
+
]),
|
1918
|
+
// If the action is an asynchronous confirmation for another action, we will save the original action id here.
|
1919
|
+
originalActionId: import_zod21.z.string().optional()
|
1920
|
+
});
|
1921
|
+
var AssignedAction = ActionBase.merge(
|
1922
|
+
import_zod21.z.object({
|
1923
|
+
type: import_zod21.z.literal(ActionType.ASSIGN),
|
1924
|
+
assignedTo: import_zod21.z.string()
|
1925
|
+
})
|
1926
|
+
);
|
1927
|
+
var UnassignedAction = ActionBase.merge(
|
1928
|
+
import_zod21.z.object({
|
1929
|
+
type: import_zod21.z.literal(ActionType.UNASSIGN),
|
1930
|
+
assignedTo: import_zod21.z.literal(null).default(null)
|
1931
|
+
})
|
1932
|
+
);
|
1933
|
+
var RegisterAction = ActionBase.merge(
|
1934
|
+
import_zod21.z.object({
|
1935
|
+
type: import_zod21.z.literal(ActionType.REGISTER),
|
1936
|
+
registrationNumber: import_zod21.z.string().optional()
|
1937
|
+
})
|
1938
|
+
);
|
1939
|
+
var DeclareAction = ActionBase.merge(
|
1940
|
+
import_zod21.z.object({
|
1941
|
+
type: import_zod21.z.literal(ActionType.DECLARE)
|
1942
|
+
})
|
1943
|
+
);
|
1944
|
+
var ValidateAction = ActionBase.merge(
|
1945
|
+
import_zod21.z.object({
|
1946
|
+
type: import_zod21.z.literal(ActionType.VALIDATE)
|
1947
|
+
})
|
1948
|
+
);
|
1949
|
+
var RejectAction = ActionBase.merge(
|
1950
|
+
import_zod21.z.object({
|
1951
|
+
type: import_zod21.z.literal(ActionType.REJECT)
|
1952
|
+
})
|
1953
|
+
);
|
1954
|
+
var MarkAsDuplicateAction = ActionBase.merge(
|
1955
|
+
import_zod21.z.object({
|
1956
|
+
type: import_zod21.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1957
|
+
})
|
1958
|
+
);
|
1959
|
+
var ArchiveAction = ActionBase.merge(
|
1960
|
+
import_zod21.z.object({
|
1961
|
+
type: import_zod21.z.literal(ActionType.ARCHIVE)
|
1962
|
+
})
|
1963
|
+
);
|
1964
|
+
var CreatedAction = ActionBase.merge(
|
1965
|
+
import_zod21.z.object({
|
1966
|
+
type: import_zod21.z.literal(ActionType.CREATE)
|
1967
|
+
})
|
1968
|
+
);
|
1969
|
+
var NotifiedAction = ActionBase.merge(
|
1970
|
+
import_zod21.z.object({
|
1971
|
+
type: import_zod21.z.literal(ActionType.NOTIFY)
|
1972
|
+
})
|
1973
|
+
);
|
1974
|
+
var PrintCertificateAction = ActionBase.merge(
|
1975
|
+
import_zod21.z.object({
|
1976
|
+
type: import_zod21.z.literal(ActionType.PRINT_CERTIFICATE)
|
1977
|
+
})
|
1978
|
+
);
|
1979
|
+
var RequestedCorrectionAction = ActionBase.merge(
|
1980
|
+
import_zod21.z.object({
|
1981
|
+
type: import_zod21.z.literal(ActionType.REQUEST_CORRECTION)
|
1982
|
+
})
|
1983
|
+
);
|
1984
|
+
var ApprovedCorrectionAction = ActionBase.merge(
|
1985
|
+
import_zod21.z.object({
|
1986
|
+
type: import_zod21.z.literal(ActionType.APPROVE_CORRECTION),
|
1987
|
+
requestId: import_zod21.z.string()
|
1988
|
+
})
|
1989
|
+
);
|
1990
|
+
var RejectedCorrectionAction = ActionBase.merge(
|
1991
|
+
import_zod21.z.object({
|
1992
|
+
type: import_zod21.z.literal(ActionType.REJECT_CORRECTION),
|
1993
|
+
requestId: import_zod21.z.string()
|
1994
|
+
})
|
1995
|
+
);
|
1996
|
+
var ReadAction = ActionBase.merge(
|
1997
|
+
import_zod21.z.object({
|
1998
|
+
type: import_zod21.z.literal(ActionType.READ)
|
1999
|
+
})
|
2000
|
+
);
|
2001
|
+
var ActionDocument = import_zod21.z.discriminatedUnion("type", [
|
2002
|
+
CreatedAction,
|
2003
|
+
ValidateAction,
|
2004
|
+
RejectAction,
|
2005
|
+
MarkAsDuplicateAction,
|
2006
|
+
ArchiveAction,
|
2007
|
+
NotifiedAction,
|
2008
|
+
RegisterAction,
|
2009
|
+
DeclareAction,
|
2010
|
+
AssignedAction,
|
2011
|
+
RequestedCorrectionAction,
|
2012
|
+
ApprovedCorrectionAction,
|
2013
|
+
RejectedCorrectionAction,
|
2014
|
+
UnassignedAction,
|
2015
|
+
PrintCertificateAction,
|
2016
|
+
ReadAction
|
2017
|
+
]);
|
2018
|
+
var AsyncRejectActionDocument = ActionBase.omit({
|
2019
|
+
declaration: true,
|
2020
|
+
annotation: true,
|
2021
|
+
createdBy: true,
|
2022
|
+
createdAtLocation: true
|
2023
|
+
}).merge(
|
2024
|
+
import_zod21.z.object({
|
2025
|
+
type: import_zod21.z.enum(ConfirmableActions),
|
2026
|
+
status: import_zod21.z.literal(ActionStatus.Rejected)
|
2027
|
+
})
|
2028
|
+
);
|
2029
|
+
var Action = import_zod21.z.union([ActionDocument, AsyncRejectActionDocument]);
|
2030
|
+
var ResolvedUser = import_zod21.z.object({
|
2031
|
+
id: import_zod21.z.string(),
|
2032
|
+
role: import_zod21.z.string(),
|
2033
|
+
name: import_zod21.z.array(
|
2034
|
+
import_zod21.z.object({
|
2035
|
+
use: import_zod21.z.string(),
|
2036
|
+
given: import_zod21.z.array(import_zod21.z.string()),
|
2037
|
+
family: import_zod21.z.string()
|
2038
|
+
})
|
2039
|
+
)
|
2040
|
+
});
|
2041
|
+
|
2042
|
+
// ../commons/src/events/ActionInput.ts
|
2043
|
+
var import_zod22 = require("zod");
|
2044
|
+
var BaseActionInput = import_zod22.z.object({
|
2045
|
+
eventId: import_zod22.z.string(),
|
2046
|
+
transactionId: import_zod22.z.string(),
|
2047
|
+
declaration: ActionUpdate.default({}),
|
2048
|
+
annotation: ActionUpdate.optional(),
|
2049
|
+
originalActionId: import_zod22.z.string().optional(),
|
2050
|
+
keepAssignment: import_zod22.z.boolean().optional()
|
2051
|
+
});
|
2052
|
+
var CreateActionInput = BaseActionInput.merge(
|
2053
|
+
import_zod22.z.object({
|
2054
|
+
type: import_zod22.z.literal(ActionType.CREATE).default(ActionType.CREATE),
|
2055
|
+
createdAtLocation: import_zod22.z.string()
|
2056
|
+
})
|
2057
|
+
);
|
2058
|
+
var RegisterActionInput = BaseActionInput.merge(
|
2059
|
+
import_zod22.z.object({
|
2060
|
+
type: import_zod22.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
2061
|
+
registrationNumber: import_zod22.z.string().optional()
|
2062
|
+
})
|
2063
|
+
);
|
2064
|
+
var ValidateActionInput = BaseActionInput.merge(
|
2065
|
+
import_zod22.z.object({
|
2066
|
+
type: import_zod22.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
|
2067
|
+
duplicates: import_zod22.z.array(import_zod22.z.string())
|
2068
|
+
})
|
2069
|
+
);
|
2070
|
+
var NotifyActionInput = BaseActionInput.merge(
|
2071
|
+
import_zod22.z.object({
|
2072
|
+
type: import_zod22.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
|
2073
|
+
})
|
2074
|
+
);
|
2075
|
+
var DeclareActionInput = BaseActionInput.merge(
|
2076
|
+
import_zod22.z.object({
|
2077
|
+
type: import_zod22.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
2078
|
+
})
|
2079
|
+
);
|
2080
|
+
var PrintCertificateActionInput = BaseActionInput.merge(
|
2081
|
+
import_zod22.z.object({
|
2082
|
+
type: import_zod22.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
|
2083
|
+
})
|
2084
|
+
);
|
2085
|
+
var RejectDeclarationActionInput = BaseActionInput.merge(
|
2086
|
+
import_zod22.z.object({
|
2087
|
+
type: import_zod22.z.literal(ActionType.REJECT).default(ActionType.REJECT)
|
2088
|
+
})
|
2089
|
+
);
|
2090
|
+
var MarkedAsDuplicateActionInput = BaseActionInput.merge(
|
2091
|
+
import_zod22.z.object({
|
2092
|
+
type: import_zod22.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
|
2093
|
+
})
|
2094
|
+
);
|
2095
|
+
var ArchiveActionInput = BaseActionInput.merge(
|
2096
|
+
import_zod22.z.object({
|
2097
|
+
type: import_zod22.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE)
|
2098
|
+
})
|
2099
|
+
);
|
2100
|
+
var AssignActionInput = BaseActionInput.merge(
|
2101
|
+
import_zod22.z.object({
|
2102
|
+
type: import_zod22.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
|
2103
|
+
assignedTo: import_zod22.z.string()
|
2104
|
+
})
|
2105
|
+
);
|
2106
|
+
var UnassignActionInput = BaseActionInput.merge(
|
2107
|
+
import_zod22.z.object({
|
2108
|
+
type: import_zod22.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
|
2109
|
+
assignedTo: import_zod22.z.literal(null).default(null)
|
2110
|
+
})
|
2111
|
+
);
|
2112
|
+
var RequestCorrectionActionInput = BaseActionInput.merge(
|
2113
|
+
import_zod22.z.object({
|
2114
|
+
type: import_zod22.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
2115
|
+
})
|
2116
|
+
);
|
2117
|
+
var RejectCorrectionActionInput = BaseActionInput.merge(
|
2118
|
+
import_zod22.z.object({
|
2119
|
+
requestId: import_zod22.z.string(),
|
2120
|
+
type: import_zod22.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
|
2121
|
+
})
|
2122
|
+
);
|
2123
|
+
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
2124
|
+
import_zod22.z.object({
|
2125
|
+
requestId: import_zod22.z.string(),
|
2126
|
+
type: import_zod22.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
2127
|
+
})
|
2128
|
+
);
|
2129
|
+
var ReadActionInput = BaseActionInput.merge(
|
2130
|
+
import_zod22.z.object({
|
2131
|
+
type: import_zod22.z.literal(ActionType.READ).default(ActionType.READ)
|
2132
|
+
})
|
2133
|
+
);
|
2134
|
+
var ActionInput = import_zod22.z.discriminatedUnion("type", [
|
2135
|
+
CreateActionInput,
|
2136
|
+
ValidateActionInput,
|
2137
|
+
RegisterActionInput,
|
2138
|
+
NotifyActionInput,
|
2139
|
+
DeclareActionInput,
|
2140
|
+
RejectDeclarationActionInput,
|
2141
|
+
MarkedAsDuplicateActionInput,
|
2142
|
+
ArchiveActionInput,
|
2143
|
+
AssignActionInput,
|
2144
|
+
UnassignActionInput,
|
2145
|
+
PrintCertificateActionInput,
|
2146
|
+
RequestCorrectionActionInput,
|
2147
|
+
RejectCorrectionActionInput,
|
2148
|
+
ApproveCorrectionActionInput,
|
2149
|
+
ReadActionInput
|
2150
|
+
]);
|
2151
|
+
|
2152
|
+
// ../commons/src/events/Draft.ts
|
2153
|
+
var Draft = import_zod23.z.object({
|
2154
|
+
id: import_zod23.z.string(),
|
2155
|
+
eventId: import_zod23.z.string(),
|
2156
|
+
transactionId: import_zod23.z.string(),
|
2157
|
+
createdAt: import_zod23.z.string().datetime(),
|
2158
|
+
action: ActionBase.extend({
|
2159
|
+
type: ActionTypes
|
2160
|
+
}).omit({ id: true })
|
2161
|
+
});
|
2162
|
+
var DraftInput = BaseActionInput.extend({
|
2163
|
+
type: ActionTypes
|
2164
|
+
});
|
2165
|
+
|
2166
|
+
// ../commons/src/events/EventInput.ts
|
2057
2167
|
var import_zod24 = require("zod");
|
2168
|
+
var EventInput = import_zod24.z.object({
|
2169
|
+
transactionId: import_zod24.z.string(),
|
2170
|
+
type: import_zod24.z.string()
|
2171
|
+
});
|
2058
2172
|
|
2059
|
-
// ../commons/src/events/
|
2060
|
-
var
|
2061
|
-
var
|
2062
|
-
|
2063
|
-
|
2064
|
-
|
2065
|
-
|
2066
|
-
|
2067
|
-
|
2068
|
-
])
|
2173
|
+
// ../commons/src/events/EventDocument.ts
|
2174
|
+
var import_zod25 = require("zod");
|
2175
|
+
var EventDocument = import_zod25.z.object({
|
2176
|
+
id: import_zod25.z.string(),
|
2177
|
+
type: import_zod25.z.string(),
|
2178
|
+
createdAt: import_zod25.z.string().datetime(),
|
2179
|
+
updatedAt: import_zod25.z.string().datetime(),
|
2180
|
+
actions: import_zod25.z.array(Action),
|
2181
|
+
trackingId: import_zod25.z.string()
|
2069
2182
|
});
|
2070
|
-
function userSerializer(userField) {
|
2071
|
-
return {
|
2072
|
-
$userField: userField
|
2073
|
-
};
|
2074
|
-
}
|
2075
2183
|
|
2076
|
-
// ../commons/src/
|
2077
|
-
|
2078
|
-
|
2079
|
-
|
2080
|
-
|
2081
|
-
|
2082
|
-
|
2083
|
-
|
2084
|
-
|
2085
|
-
|
2086
|
-
|
2087
|
-
|
2088
|
-
|
2089
|
-
|
2090
|
-
|
2091
|
-
|
2184
|
+
// ../commons/src/events/EventIndex.ts
|
2185
|
+
var import_zod26 = require("zod");
|
2186
|
+
var EventIndex = EventMetadata.extend({
|
2187
|
+
declaration: import_zod26.z.record(import_zod26.z.string(), import_zod26.z.any())
|
2188
|
+
});
|
2189
|
+
var EventSearchIndex = import_zod26.z.record(import_zod26.z.string(), import_zod26.z.any()).and(
|
2190
|
+
import_zod26.z.object({
|
2191
|
+
type: import_zod26.z.string()
|
2192
|
+
// Ensures "type" (event-id) exists and is a string
|
2193
|
+
})
|
2194
|
+
);
|
2195
|
+
|
2196
|
+
// ../commons/src/events/state/index.ts
|
2197
|
+
function getStatusFromActions(actions) {
|
2198
|
+
const hasRejectedAction = actions.some(
|
2199
|
+
(a) => a.status === ActionStatus.Rejected
|
2200
|
+
);
|
2201
|
+
if (hasRejectedAction) {
|
2202
|
+
return EventStatus.REJECTED;
|
2203
|
+
}
|
2204
|
+
return actions.reduce((status, action) => {
|
2205
|
+
if (action.type === ActionType.CREATE) {
|
2206
|
+
return EventStatus.CREATED;
|
2207
|
+
}
|
2208
|
+
if (action.type === ActionType.DECLARE) {
|
2209
|
+
return EventStatus.DECLARED;
|
2210
|
+
}
|
2211
|
+
if (action.type === ActionType.VALIDATE) {
|
2212
|
+
return EventStatus.VALIDATED;
|
2213
|
+
}
|
2214
|
+
if (action.type === ActionType.REGISTER) {
|
2215
|
+
return EventStatus.REGISTERED;
|
2216
|
+
}
|
2217
|
+
if (action.type === ActionType.REJECT) {
|
2218
|
+
return EventStatus.REJECTED;
|
2219
|
+
}
|
2220
|
+
if (action.type === ActionType.ARCHIVE) {
|
2221
|
+
return EventStatus.ARCHIVED;
|
2222
|
+
}
|
2223
|
+
if (action.type === ActionType.NOTIFY) {
|
2224
|
+
return EventStatus.NOTIFIED;
|
2225
|
+
}
|
2226
|
+
return status;
|
2227
|
+
}, EventStatus.CREATED);
|
2092
2228
|
}
|
2093
|
-
function
|
2094
|
-
return
|
2095
|
-
type
|
2096
|
-
|
2097
|
-
|
2229
|
+
function getAssignedUserFromActions(actions) {
|
2230
|
+
return actions.reduce((user2, action) => {
|
2231
|
+
if (action.type === ActionType.ASSIGN) {
|
2232
|
+
return action.assignedTo;
|
2233
|
+
}
|
2234
|
+
if (action.type === ActionType.UNASSIGN) {
|
2235
|
+
return null;
|
2236
|
+
}
|
2237
|
+
return user2;
|
2238
|
+
}, null);
|
2239
|
+
}
|
2240
|
+
function aggregateActionDeclarations(actions) {
|
2241
|
+
const excludedActions = [
|
2242
|
+
ActionType.REQUEST_CORRECTION,
|
2243
|
+
ActionType.PRINT_CERTIFICATE
|
2244
|
+
];
|
2245
|
+
return actions.reduce((status, action) => {
|
2246
|
+
if (excludedActions.some((excludedAction) => excludedAction === action.type)) {
|
2247
|
+
return status;
|
2248
|
+
}
|
2249
|
+
if (action.type === ActionType.APPROVE_CORRECTION) {
|
2250
|
+
const requestAction = actions.find(({ id }) => id === action.requestId);
|
2251
|
+
if (!requestAction) {
|
2252
|
+
return status;
|
2253
|
+
}
|
2254
|
+
return deepMerge(status, requestAction.declaration);
|
2255
|
+
}
|
2256
|
+
return deepMerge(status, action.declaration);
|
2257
|
+
}, {});
|
2258
|
+
}
|
2259
|
+
function deepDropNulls(obj) {
|
2260
|
+
if (Array.isArray(obj)) {
|
2261
|
+
return obj.map(deepDropNulls);
|
2262
|
+
}
|
2263
|
+
if (obj !== null && typeof obj === "object") {
|
2264
|
+
return Object.entries(obj).reduce((acc, [key, value]) => {
|
2265
|
+
const cleanedValue = deepDropNulls(value);
|
2266
|
+
if (cleanedValue !== null) {
|
2267
|
+
;
|
2268
|
+
acc[key] = cleanedValue;
|
2269
|
+
}
|
2270
|
+
return acc;
|
2271
|
+
}, {});
|
2272
|
+
}
|
2273
|
+
return obj;
|
2274
|
+
}
|
2275
|
+
function isUndeclaredDraft(status) {
|
2276
|
+
return status === EventStatus.CREATED;
|
2277
|
+
}
|
2278
|
+
function getAcceptedActions(event2) {
|
2279
|
+
return event2.actions.filter(
|
2280
|
+
(a) => a.status === ActionStatus.Accepted
|
2281
|
+
);
|
2282
|
+
}
|
2283
|
+
function getCurrentEventState(event2) {
|
2284
|
+
const creationAction = event2.actions.find(
|
2285
|
+
(action) => action.type === ActionType.CREATE
|
2286
|
+
);
|
2287
|
+
if (!creationAction) {
|
2288
|
+
throw new Error(`Event ${event2.id} has no creation action`);
|
2289
|
+
}
|
2290
|
+
const activeActions = getAcceptedActions(event2);
|
2291
|
+
const latestAction = activeActions[activeActions.length - 1];
|
2292
|
+
const registrationAction = activeActions.find(
|
2293
|
+
(a) => a.type === ActionType.REGISTER && a.status === ActionStatus.Accepted
|
2294
|
+
);
|
2295
|
+
const registrationNumber = registrationAction?.registrationNumber ?? null;
|
2296
|
+
return deepDropNulls({
|
2297
|
+
id: event2.id,
|
2298
|
+
type: event2.type,
|
2299
|
+
status: getStatusFromActions(event2.actions),
|
2300
|
+
createdAt: event2.createdAt,
|
2301
|
+
createdBy: creationAction.createdBy,
|
2302
|
+
createdAtLocation: creationAction.createdAtLocation,
|
2303
|
+
modifiedAt: latestAction.createdAt,
|
2304
|
+
assignedTo: getAssignedUserFromActions(activeActions),
|
2305
|
+
updatedBy: latestAction.createdBy,
|
2306
|
+
declaration: aggregateActionDeclarations(activeActions),
|
2307
|
+
trackingId: event2.trackingId,
|
2308
|
+
registrationNumber
|
2309
|
+
});
|
2310
|
+
}
|
2311
|
+
function getCurrentEventStateWithDrafts(event2, drafts) {
|
2312
|
+
const actions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
2313
|
+
const activeDrafts = findActiveDrafts(event2, drafts).map((draft) => draft.action).flatMap((action) => {
|
2314
|
+
if (action.type === ActionType.REQUEST_CORRECTION) {
|
2315
|
+
return [
|
2316
|
+
action,
|
2317
|
+
{
|
2318
|
+
...action,
|
2319
|
+
type: ActionType.APPROVE_CORRECTION
|
2320
|
+
}
|
2321
|
+
];
|
2322
|
+
}
|
2323
|
+
return [action];
|
2324
|
+
});
|
2325
|
+
const actionWithDrafts = [...actions, ...activeDrafts].sort();
|
2326
|
+
const withDrafts = {
|
2327
|
+
...event2,
|
2328
|
+
actions: actionWithDrafts
|
2329
|
+
};
|
2330
|
+
return getCurrentEventState(withDrafts);
|
2331
|
+
}
|
2332
|
+
function applyDraftsToEventIndex(eventIndex, drafts) {
|
2333
|
+
const indexedAt = eventIndex.modifiedAt;
|
2334
|
+
const activeDrafts = drafts.filter(({ createdAt }) => new Date(createdAt) > new Date(indexedAt)).map((draft) => draft.action).sort();
|
2335
|
+
if (activeDrafts.length === 0) {
|
2336
|
+
return eventIndex;
|
2337
|
+
}
|
2338
|
+
return {
|
2339
|
+
...eventIndex,
|
2340
|
+
declaration: {
|
2341
|
+
...eventIndex.declaration,
|
2342
|
+
...activeDrafts[activeDrafts.length - 1].declaration
|
2343
|
+
}
|
2344
|
+
};
|
2345
|
+
}
|
2346
|
+
function getAnnotationFromDrafts(drafts) {
|
2347
|
+
const actions = drafts.map((draft) => draft.action);
|
2348
|
+
const annotation = actions.reduce((ann, action) => {
|
2349
|
+
return deepMerge(ann, action.annotation ?? {});
|
2350
|
+
}, {});
|
2351
|
+
return deepDropNulls(annotation);
|
2352
|
+
}
|
2353
|
+
function getActionAnnotation({
|
2354
|
+
event: event2,
|
2355
|
+
actionType,
|
2356
|
+
drafts
|
2357
|
+
}) {
|
2358
|
+
const activeActions = getAcceptedActions(event2);
|
2359
|
+
const action = activeActions.find(
|
2360
|
+
(activeAction) => actionType === activeAction.type
|
2361
|
+
);
|
2362
|
+
const eventDrafts = drafts.filter((draft) => draft.eventId === event2.id);
|
2363
|
+
const sorted = [
|
2364
|
+
...action ? [action] : [],
|
2365
|
+
...eventDrafts.map((draft) => draft.action)
|
2366
|
+
].sort();
|
2367
|
+
const annotation = sorted.reduce((ann, sortedAction) => {
|
2368
|
+
return deepMerge(ann, sortedAction.annotation ?? {});
|
2369
|
+
}, {});
|
2370
|
+
return deepDropNulls(annotation);
|
2371
|
+
}
|
2372
|
+
|
2373
|
+
// ../commons/src/events/defineConfig.ts
|
2374
|
+
var defineConfig = (config) => {
|
2375
|
+
validateWorkqueueConfig(config.workqueues);
|
2376
|
+
const input = EventConfig.parse(config);
|
2377
|
+
return input;
|
2378
|
+
};
|
2379
|
+
|
2380
|
+
// ../commons/src/events/transactions.ts
|
2381
|
+
function generateTransactionId() {
|
2382
|
+
return getUUID();
|
2383
|
+
}
|
2384
|
+
|
2385
|
+
// ../commons/src/events/test.utils.ts
|
2386
|
+
var import_lodash2 = require("lodash");
|
2387
|
+
|
2388
|
+
// ../commons/src/conditionals/conditionals.ts
|
2389
|
+
function defineConditional(schema) {
|
2390
|
+
return schema;
|
2391
|
+
}
|
2392
|
+
function defineFormConditional(schema) {
|
2393
|
+
const schemaWithForm = {
|
2394
|
+
type: "object",
|
2395
|
+
properties: {
|
2396
|
+
$form: schema
|
2397
|
+
},
|
2398
|
+
required: ["$form"]
|
2399
|
+
};
|
2400
|
+
return defineConditional(schemaWithForm);
|
2401
|
+
}
|
2402
|
+
function alwaysTrue() {
|
2403
|
+
return {};
|
2404
|
+
}
|
2405
|
+
function and(...conditions) {
|
2406
|
+
return defineConditional({
|
2407
|
+
type: "object",
|
2408
|
+
allOf: conditions,
|
2409
|
+
required: []
|
2098
2410
|
});
|
2099
2411
|
}
|
2100
2412
|
function or(...conditions) {
|
@@ -2114,7 +2426,7 @@ function not(condition) {
|
|
2114
2426
|
function never() {
|
2115
2427
|
return not(alwaysTrue());
|
2116
2428
|
}
|
2117
|
-
var user =
|
2429
|
+
var user = {
|
2118
2430
|
hasScope: (scope) => defineConditional({
|
2119
2431
|
type: "object",
|
2120
2432
|
properties: {
|
@@ -2134,39 +2446,33 @@ var user = Object.assign(userSerializer, {
|
|
2134
2446
|
},
|
2135
2447
|
required: ["$user"]
|
2136
2448
|
})
|
2137
|
-
}
|
2138
|
-
|
2139
|
-
|
2140
|
-
|
2141
|
-
|
2142
|
-
|
2143
|
-
|
2144
|
-
|
2145
|
-
|
2146
|
-
|
2147
|
-
|
2148
|
-
|
2149
|
-
|
2150
|
-
|
2151
|
-
|
2152
|
-
|
2153
|
-
|
2154
|
-
|
2155
|
-
type: {
|
2156
|
-
const: action
|
2157
|
-
}
|
2158
|
-
},
|
2159
|
-
required: ["type"]
|
2160
|
-
}
|
2449
|
+
};
|
2450
|
+
var event = {
|
2451
|
+
hasAction: (action) => defineConditional({
|
2452
|
+
type: "object",
|
2453
|
+
properties: {
|
2454
|
+
$event: {
|
2455
|
+
type: "object",
|
2456
|
+
properties: {
|
2457
|
+
actions: {
|
2458
|
+
type: "array",
|
2459
|
+
contains: {
|
2460
|
+
type: "object",
|
2461
|
+
properties: {
|
2462
|
+
type: {
|
2463
|
+
const: action
|
2464
|
+
}
|
2465
|
+
},
|
2466
|
+
required: ["type"]
|
2161
2467
|
}
|
2162
|
-
}
|
2163
|
-
|
2164
|
-
|
2165
|
-
}
|
2166
|
-
|
2167
|
-
|
2168
|
-
}
|
2169
|
-
}
|
2468
|
+
}
|
2469
|
+
},
|
2470
|
+
required: ["actions"]
|
2471
|
+
}
|
2472
|
+
},
|
2473
|
+
required: ["$event"]
|
2474
|
+
})
|
2475
|
+
};
|
2170
2476
|
function getDateFromNow(days) {
|
2171
2477
|
return new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
|
2172
2478
|
}
|
@@ -2187,7 +2493,7 @@ function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
|
|
2187
2493
|
function isFieldReference(value) {
|
2188
2494
|
return typeof value === "object" && value !== null && "_fieldId" in value;
|
2189
2495
|
}
|
2190
|
-
function
|
2496
|
+
function field(fieldId) {
|
2191
2497
|
const getDateRange = (date, clause) => ({
|
2192
2498
|
type: "object",
|
2193
2499
|
properties: {
|
@@ -2200,6 +2506,10 @@ function createFieldConditionals(fieldId) {
|
|
2200
2506
|
required: [fieldId]
|
2201
2507
|
});
|
2202
2508
|
return {
|
2509
|
+
/**
|
2510
|
+
* @private Internal property used for field reference tracking.
|
2511
|
+
*/
|
2512
|
+
_fieldId: fieldId,
|
2203
2513
|
isAfter: () => ({
|
2204
2514
|
days: (days) => ({
|
2205
2515
|
inPast: () => defineFormConditional(
|
@@ -2272,1215 +2582,105 @@ function createFieldConditionals(fieldId) {
|
|
2272
2582
|
{ type: "boolean", const: value }
|
2273
2583
|
],
|
2274
2584
|
const: value
|
2275
|
-
}
|
2276
|
-
},
|
2277
|
-
required: [fieldId]
|
2278
|
-
});
|
2279
|
-
},
|
2280
|
-
/**
|
2281
|
-
* Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
|
2282
|
-
* @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
|
2283
|
-
* @returns whether the field is falsy (undefined, false, null, empty string)
|
2284
|
-
*
|
2285
|
-
* NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
|
2286
|
-
*
|
2287
|
-
*/
|
2288
|
-
isFalsy: () => defineFormConditional({
|
2289
|
-
type: "object",
|
2290
|
-
properties: {
|
2291
|
-
[fieldId]: {
|
2292
|
-
anyOf: [
|
2293
|
-
{ const: "undefined" },
|
2294
|
-
{ const: false },
|
2295
|
-
{ const: null },
|
2296
|
-
{ const: "" }
|
2297
|
-
]
|
2298
|
-
}
|
2299
|
-
},
|
2300
|
-
anyOf: [
|
2301
|
-
{
|
2302
|
-
required: [fieldId]
|
2303
|
-
},
|
2304
|
-
{
|
2305
|
-
not: {
|
2306
|
-
required: [fieldId]
|
2307
|
-
}
|
2308
|
-
}
|
2309
|
-
]
|
2310
|
-
}),
|
2311
|
-
isUndefined: () => defineFormConditional({
|
2312
|
-
type: "object",
|
2313
|
-
properties: {
|
2314
|
-
[fieldId]: {
|
2315
|
-
type: "string",
|
2316
|
-
enum: ["undefined"]
|
2317
|
-
}
|
2318
|
-
},
|
2319
|
-
not: {
|
2320
|
-
required: [fieldId]
|
2321
|
-
}
|
2322
|
-
}),
|
2323
|
-
inArray: (values) => defineFormConditional({
|
2324
|
-
type: "object",
|
2325
|
-
properties: {
|
2326
|
-
[fieldId]: {
|
2327
|
-
type: "string",
|
2328
|
-
enum: values
|
2329
|
-
}
|
2330
|
-
},
|
2331
|
-
required: [fieldId]
|
2332
|
-
}),
|
2333
|
-
isValidEnglishName: () => defineFormConditional({
|
2334
|
-
type: "object",
|
2335
|
-
properties: {
|
2336
|
-
[fieldId]: {
|
2337
|
-
type: "string",
|
2338
|
-
pattern: "^[\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*( [\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*)*$",
|
2339
|
-
description: "Name must contain only letters, numbers, and allowed special characters ('._-). No double spaces."
|
2340
|
-
}
|
2341
|
-
},
|
2342
|
-
required: [fieldId]
|
2343
|
-
}),
|
2344
|
-
/**
|
2345
|
-
* Checks if the field value matches a given regular expression pattern.
|
2346
|
-
* @param pattern - The regular expression pattern to match the field value against.
|
2347
|
-
* @returns A JSONSchema conditional that validates the field value against the pattern.
|
2348
|
-
*/
|
2349
|
-
matches: (pattern) => defineFormConditional({
|
2350
|
-
type: "object",
|
2351
|
-
properties: {
|
2352
|
-
[fieldId]: {
|
2353
|
-
type: "string",
|
2354
|
-
pattern
|
2355
|
-
}
|
2356
|
-
},
|
2357
|
-
required: [fieldId]
|
2358
|
-
}),
|
2359
|
-
isBetween: (min, max) => defineFormConditional({
|
2360
|
-
type: "object",
|
2361
|
-
properties: {
|
2362
|
-
[fieldId]: {
|
2363
|
-
type: "number",
|
2364
|
-
minimum: min,
|
2365
|
-
maximum: max
|
2366
|
-
}
|
2367
|
-
},
|
2368
|
-
required: [fieldId]
|
2369
|
-
}),
|
2370
|
-
getId: () => ({ fieldId })
|
2371
|
-
};
|
2372
|
-
}
|
2373
|
-
|
2374
|
-
// ../commons/src/searchConfigs.ts
|
2375
|
-
function createSearchConfig(baseField) {
|
2376
|
-
return {
|
2377
|
-
/**
|
2378
|
-
* Creates a range configuration for the specified field.
|
2379
|
-
*
|
2380
|
-
* @returns An object containing the field ID and a configuration object with a type of 'range'.
|
2381
|
-
*
|
2382
|
-
* @example event('legalStatus.REGISTERED.createdAt').range()
|
2383
|
-
* // {
|
2384
|
-
* // ...
|
2385
|
-
* // config: { type: 'range' }
|
2386
|
-
* // }
|
2387
|
-
*/
|
2388
|
-
range: () => ({
|
2389
|
-
...baseField,
|
2390
|
-
config: { type: "range" }
|
2391
|
-
}),
|
2392
|
-
/**
|
2393
|
-
* Creates a configuration for exact matching of the specified field.
|
2394
|
-
* @returns An object containing the field ID and a configuration object with a type of 'exact'.
|
2395
|
-
* @example field('dob').exact()
|
2396
|
-
* // {
|
2397
|
-
* // ...
|
2398
|
-
* // config: { type: 'exact' }
|
2399
|
-
* // }
|
2400
|
-
*/
|
2401
|
-
exact: () => ({
|
2402
|
-
...baseField,
|
2403
|
-
config: { type: "exact" }
|
2404
|
-
}),
|
2405
|
-
/**
|
2406
|
-
* Creates a configuration for fuzzy matching of the specified field.
|
2407
|
-
* @returns An object containing the field ID and a configuration object with a type of 'exact'.
|
2408
|
-
* @example field('name').fuzzy()
|
2409
|
-
* // {
|
2410
|
-
* // ...
|
2411
|
-
* // config: { type: 'fuzzy' }
|
2412
|
-
* // }
|
2413
|
-
*/
|
2414
|
-
fuzzy: () => ({
|
2415
|
-
...baseField,
|
2416
|
-
config: { type: "fuzzy" }
|
2417
|
-
})
|
2418
|
-
};
|
2419
|
-
}
|
2420
|
-
|
2421
|
-
// ../commons/src/event-config/event-configuration.ts
|
2422
|
-
function createEventFieldConfig(fieldId, options) {
|
2423
|
-
const baseField = {
|
2424
|
-
fieldId,
|
2425
|
-
options,
|
2426
|
-
fieldType: "event"
|
2427
|
-
};
|
2428
|
-
return createSearchConfig(baseField);
|
2429
|
-
}
|
2430
|
-
|
2431
|
-
// ../commons/src/events/event.ts
|
2432
|
-
function eventFn(fieldId, options) {
|
2433
|
-
return createEventFieldConfig(fieldId, options);
|
2434
|
-
}
|
2435
|
-
var event = Object.assign(eventFn, {
|
2436
|
-
...createEventConditionals(),
|
2437
|
-
field(field2) {
|
2438
|
-
return {
|
2439
|
-
$event: field2
|
2440
|
-
};
|
2441
|
-
}
|
2442
|
-
});
|
2443
|
-
|
2444
|
-
// ../commons/src/events/WorkqueueColumnConfig.ts
|
2445
|
-
var import_zod20 = require("zod");
|
2446
|
-
|
2447
|
-
// ../commons/src/events/EventMetadata.ts
|
2448
|
-
var import_zod19 = require("zod");
|
2449
|
-
var EventStatus = {
|
2450
|
-
CREATED: "CREATED",
|
2451
|
-
NOTIFIED: "NOTIFIED",
|
2452
|
-
DECLARED: "DECLARED",
|
2453
|
-
VALIDATED: "VALIDATED",
|
2454
|
-
REGISTERED: "REGISTERED",
|
2455
|
-
CERTIFIED: "CERTIFIED",
|
2456
|
-
REJECTED: "REJECTED",
|
2457
|
-
ARCHIVED: "ARCHIVED"
|
2458
|
-
};
|
2459
|
-
var eventStatusValues = [
|
2460
|
-
EventStatus.CREATED,
|
2461
|
-
EventStatus.NOTIFIED,
|
2462
|
-
EventStatus.DECLARED,
|
2463
|
-
EventStatus.VALIDATED,
|
2464
|
-
EventStatus.REGISTERED,
|
2465
|
-
EventStatus.CERTIFIED,
|
2466
|
-
EventStatus.REJECTED,
|
2467
|
-
EventStatus.ARCHIVED
|
2468
|
-
];
|
2469
|
-
var EventStatusEnum = import_zod19.z.enum(eventStatusValues);
|
2470
|
-
var CustomFlags = {
|
2471
|
-
CERTIFICATE_PRINTED: "certificate-printed"
|
2472
|
-
};
|
2473
|
-
var Flag = import_zod19.z.string().regex(
|
2474
|
-
new RegExp(
|
2475
|
-
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(ActionStatus).join("|").toLowerCase()})$`
|
2476
|
-
),
|
2477
|
-
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
2478
|
-
).or(import_zod19.z.nativeEnum(CustomFlags));
|
2479
|
-
var eventStatuses = Object.values(EventStatus);
|
2480
|
-
var EventStatuses = import_zod19.z.nativeEnum(EventStatus);
|
2481
|
-
var ZodDate = import_zod19.z.string().date();
|
2482
|
-
var ActionCreationMetadata = import_zod19.z.object({
|
2483
|
-
createdAt: import_zod19.z.string().datetime().describe("The timestamp when the action request was created."),
|
2484
|
-
createdBy: import_zod19.z.string().describe("ID of the user who created the action request."),
|
2485
|
-
createdAtLocation: import_zod19.z.string().describe("Location of the user who created the action request."),
|
2486
|
-
acceptedAt: import_zod19.z.string().datetime().describe("Timestamp when the action request was accepted."),
|
2487
|
-
createdByRole: import_zod19.z.string().describe("Role of the user at the time of action request creation.")
|
2488
|
-
});
|
2489
|
-
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
2490
|
-
registrationNumber: import_zod19.z.string().describe(
|
2491
|
-
"Registration number of the event. Always present for accepted registrations."
|
2492
|
-
)
|
2493
|
-
});
|
2494
|
-
var LegalStatuses = import_zod19.z.object({
|
2495
|
-
[EventStatus.DECLARED]: ActionCreationMetadata.nullish(),
|
2496
|
-
[EventStatus.REGISTERED]: RegistrationCreationMetadata.nullish()
|
2497
|
-
});
|
2498
|
-
var EventMetadata = import_zod19.z.object({
|
2499
|
-
id: import_zod19.z.string(),
|
2500
|
-
title: import_zod19.z.string(),
|
2501
|
-
type: import_zod19.z.string().describe("The type of event, such as birth, death, or marriage."),
|
2502
|
-
status: EventStatuses,
|
2503
|
-
legalStatuses: LegalStatuses.describe(
|
2504
|
-
"Metadata related to the legal registration of the event, such as who registered it and when."
|
2505
|
-
),
|
2506
|
-
createdAt: import_zod19.z.string().datetime().describe("The timestamp when the event was first created and saved."),
|
2507
|
-
dateOfEvent: ZodDate.nullish(),
|
2508
|
-
createdBy: import_zod19.z.string().describe("ID of the user who created the event."),
|
2509
|
-
updatedByUserRole: import_zod19.z.string().describe("Role of the user who last updated the declaration."),
|
2510
|
-
createdAtLocation: import_zod19.z.string().describe("Location of the user who created the event."),
|
2511
|
-
updatedAtLocation: import_zod19.z.string().nullish().describe("Location of the user who last updated the declaration."),
|
2512
|
-
updatedAt: import_zod19.z.string().datetime().describe("Timestamp of the most recent declaration update."),
|
2513
|
-
assignedTo: import_zod19.z.string().nullish().describe("ID of the user currently assigned to the event."),
|
2514
|
-
updatedBy: import_zod19.z.string().nullish().describe("ID of the user who last updated the declaration."),
|
2515
|
-
trackingId: import_zod19.z.string().describe(
|
2516
|
-
"System-generated tracking ID used by informants or registrars to look up the event."
|
2517
|
-
),
|
2518
|
-
flags: import_zod19.z.array(Flag)
|
2519
|
-
});
|
2520
|
-
var EventMetadataKeys = import_zod19.z.enum([
|
2521
|
-
"id",
|
2522
|
-
"title",
|
2523
|
-
"type",
|
2524
|
-
"status",
|
2525
|
-
"createdAt",
|
2526
|
-
"dateOfEvent",
|
2527
|
-
"createdBy",
|
2528
|
-
"updatedByUserRole",
|
2529
|
-
"createdAtLocation",
|
2530
|
-
"updatedAtLocation",
|
2531
|
-
"updatedAt",
|
2532
|
-
"assignedTo",
|
2533
|
-
"updatedBy",
|
2534
|
-
"trackingId",
|
2535
|
-
"legalStatuses",
|
2536
|
-
"flags"
|
2537
|
-
]);
|
2538
|
-
var EventMetadataParameter = import_zod19.z.object({
|
2539
|
-
// @TODO: Reconcile with the event metadata definition. How could we derive one from the other?
|
2540
|
-
$event: EventMetadataKeys
|
2541
|
-
});
|
2542
|
-
var eventMetadataLabelMap = {
|
2543
|
-
"event.assignedTo": {
|
2544
|
-
id: "event.assignedTo.label",
|
2545
|
-
defaultMessage: "Assigned To",
|
2546
|
-
description: "Assigned To"
|
2547
|
-
},
|
2548
|
-
"event.title": {
|
2549
|
-
id: "event.title.label",
|
2550
|
-
defaultMessage: "Title",
|
2551
|
-
description: "Title"
|
2552
|
-
},
|
2553
|
-
"event.createdAt": {
|
2554
|
-
id: "event.createdAt.label",
|
2555
|
-
defaultMessage: "Created",
|
2556
|
-
description: "Created At"
|
2557
|
-
},
|
2558
|
-
"event.dateOfEvent": {
|
2559
|
-
id: "event.dateOfEvent.label",
|
2560
|
-
defaultMessage: "Date of Event",
|
2561
|
-
description: "Date of Event"
|
2562
|
-
},
|
2563
|
-
"event.createdAtLocation": {
|
2564
|
-
id: "event.createdAtLocation.label",
|
2565
|
-
defaultMessage: "Location",
|
2566
|
-
description: "Created At Location"
|
2567
|
-
},
|
2568
|
-
"event.updatedAtLocation": {
|
2569
|
-
id: "event.updatedAtLocation.label",
|
2570
|
-
defaultMessage: "Location",
|
2571
|
-
description: "Updated At Location"
|
2572
|
-
},
|
2573
|
-
"event.createdBy": {
|
2574
|
-
id: "event.createdBy.label",
|
2575
|
-
defaultMessage: "Created By",
|
2576
|
-
description: "Created By"
|
2577
|
-
},
|
2578
|
-
"event.updatedByUserRole": {
|
2579
|
-
id: "event.updatedByUserRole.label",
|
2580
|
-
defaultMessage: "Updated By Role",
|
2581
|
-
description: "Updated By Role"
|
2582
|
-
},
|
2583
|
-
"event.id": {
|
2584
|
-
id: "event.id.label",
|
2585
|
-
defaultMessage: "ID",
|
2586
|
-
description: "ID"
|
2587
|
-
},
|
2588
|
-
"event.updatedAt": {
|
2589
|
-
id: "event.modifiedAt.label",
|
2590
|
-
defaultMessage: "Updated",
|
2591
|
-
description: "Modified At"
|
2592
|
-
},
|
2593
|
-
"event.status": {
|
2594
|
-
id: "event.status.label",
|
2595
|
-
defaultMessage: "Status",
|
2596
|
-
description: "Status"
|
2597
|
-
},
|
2598
|
-
"event.type": {
|
2599
|
-
id: "event.type.label",
|
2600
|
-
defaultMessage: "Type",
|
2601
|
-
description: "Type"
|
2602
|
-
},
|
2603
|
-
"event.updatedBy": {
|
2604
|
-
id: "event.updatedBy.label",
|
2605
|
-
defaultMessage: "Updated By",
|
2606
|
-
description: "Updated By"
|
2607
|
-
},
|
2608
|
-
"event.trackingId": {
|
2609
|
-
id: "event.trackingId.label",
|
2610
|
-
defaultMessage: "Tracking ID",
|
2611
|
-
description: "Tracking ID"
|
2612
|
-
},
|
2613
|
-
"event.flags": {
|
2614
|
-
id: "event.flags.label",
|
2615
|
-
defaultMessage: "Flags",
|
2616
|
-
description: "Flags"
|
2617
|
-
}
|
2618
|
-
};
|
2619
|
-
|
2620
|
-
// ../commons/src/events/WorkqueueColumnConfig.ts
|
2621
|
-
var WorkqueueColumn = import_zod20.z.object({
|
2622
|
-
label: TranslationConfig,
|
2623
|
-
value: EventMetadataParameter
|
2624
|
-
});
|
2625
|
-
function defineWorkqueuesColumns(workqueueColumns) {
|
2626
|
-
return workqueueColumns.map(
|
2627
|
-
(workqueueColumn) => WorkqueueColumn.parse(workqueueColumn)
|
2628
|
-
);
|
2629
|
-
}
|
2630
|
-
|
2631
|
-
// ../commons/src/events/CountryConfigQueryInput.ts
|
2632
|
-
var import_zod21 = require("zod");
|
2633
|
-
var Fuzzy = import_zod21.z.object({ type: import_zod21.z.literal("fuzzy"), term: import_zod21.z.string() });
|
2634
|
-
var Exact = import_zod21.z.object({ type: import_zod21.z.literal("exact"), term: import_zod21.z.string() });
|
2635
|
-
var AnyOf = import_zod21.z.object({
|
2636
|
-
type: import_zod21.z.literal("anyOf"),
|
2637
|
-
terms: import_zod21.z.array(import_zod21.z.string())
|
2638
|
-
});
|
2639
|
-
var AnyOfStatus = import_zod21.z.object({
|
2640
|
-
type: import_zod21.z.literal("anyOf"),
|
2641
|
-
terms: import_zod21.z.array(EventStatusEnum)
|
2642
|
-
});
|
2643
|
-
var SerializableExact = import_zod21.z.object({
|
2644
|
-
type: import_zod21.z.literal("exact"),
|
2645
|
-
term: import_zod21.z.union([import_zod21.z.string(), SerializedUserField])
|
2646
|
-
});
|
2647
|
-
var ExactStatus = import_zod21.z.object({
|
2648
|
-
type: import_zod21.z.literal("exact"),
|
2649
|
-
term: EventStatusEnum
|
2650
|
-
});
|
2651
|
-
var Range = import_zod21.z.object({
|
2652
|
-
type: import_zod21.z.literal("range"),
|
2653
|
-
gte: import_zod21.z.string(),
|
2654
|
-
lte: import_zod21.z.string()
|
2655
|
-
});
|
2656
|
-
var Not = import_zod21.z.object({ type: import_zod21.z.literal("not"), term: import_zod21.z.string() });
|
2657
|
-
var Within = import_zod21.z.object({ type: import_zod21.z.literal("within"), location: import_zod21.z.string() });
|
2658
|
-
var SerializableWithin = import_zod21.z.object({
|
2659
|
-
type: import_zod21.z.literal("within"),
|
2660
|
-
location: import_zod21.z.union([import_zod21.z.string(), SerializedUserField])
|
2661
|
-
});
|
2662
|
-
var DateCondition = import_zod21.z.union([Exact, Range]);
|
2663
|
-
var QueryInput = import_zod21.z.lazy(
|
2664
|
-
() => import_zod21.z.union([
|
2665
|
-
import_zod21.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf, Not]),
|
2666
|
-
import_zod21.z.record(import_zod21.z.string(), QueryInput)
|
2667
|
-
])
|
2668
|
-
);
|
2669
|
-
var SerializedQueryExpression = import_zod21.z.object({
|
2670
|
-
title: import_zod21.z.string(),
|
2671
|
-
eventType: import_zod21.z.string(),
|
2672
|
-
status: import_zod21.z.optional(import_zod21.z.union([AnyOfStatus, ExactStatus])),
|
2673
|
-
createdAt: import_zod21.z.optional(DateCondition),
|
2674
|
-
updatedAt: import_zod21.z.optional(DateCondition),
|
2675
|
-
createdAtLocation: import_zod21.z.optional(
|
2676
|
-
import_zod21.z.union([SerializableWithin, SerializableExact])
|
2677
|
-
),
|
2678
|
-
updatedAtLocation: import_zod21.z.optional(
|
2679
|
-
import_zod21.z.union([SerializableWithin, SerializableExact])
|
2680
|
-
),
|
2681
|
-
assignedTo: import_zod21.z.optional(SerializableExact),
|
2682
|
-
createdBy: import_zod21.z.optional(SerializableExact),
|
2683
|
-
updatedBy: import_zod21.z.optional(SerializableExact),
|
2684
|
-
trackingId: import_zod21.z.optional(Exact),
|
2685
|
-
flags: import_zod21.z.optional(import_zod21.z.array(import_zod21.z.union([AnyOf, Not]))),
|
2686
|
-
data: QueryInput
|
2687
|
-
}).partial();
|
2688
|
-
var Or2 = import_zod21.z.object({
|
2689
|
-
type: import_zod21.z.literal("or"),
|
2690
|
-
clauses: import_zod21.z.array(SerializedQueryExpression)
|
2691
|
-
});
|
2692
|
-
var And2 = import_zod21.z.object({
|
2693
|
-
type: import_zod21.z.literal("and"),
|
2694
|
-
clauses: import_zod21.z.array(SerializedQueryExpression)
|
2695
|
-
});
|
2696
|
-
var CountryConfigQueryType = import_zod21.z.discriminatedUnion("type", [And2, Or2]);
|
2697
|
-
var CountryConfigQueryInputType = import_zod21.z.union([
|
2698
|
-
SerializedQueryExpression,
|
2699
|
-
And2,
|
2700
|
-
Or2
|
2701
|
-
]);
|
2702
|
-
|
2703
|
-
// ../commons/src/icons.ts
|
2704
|
-
var import_zod22 = require("zod");
|
2705
|
-
var AvailableIcons = import_zod22.z.enum([
|
2706
|
-
"Archived",
|
2707
|
-
"Assigned",
|
2708
|
-
"Certified",
|
2709
|
-
"Close",
|
2710
|
-
"Collapse",
|
2711
|
-
"Draft",
|
2712
|
-
"DuplicateYellow",
|
2713
|
-
"Expand",
|
2714
|
-
"ExternalValidate",
|
2715
|
-
"FilledCheck",
|
2716
|
-
"InReview",
|
2717
|
-
"Offline",
|
2718
|
-
"Registered",
|
2719
|
-
"RequiresUpdates",
|
2720
|
-
"Sent",
|
2721
|
-
"Validated",
|
2722
|
-
"WaitingApproval",
|
2723
|
-
"ChartActivity",
|
2724
|
-
"Activity",
|
2725
|
-
"Archive",
|
2726
|
-
"ArchiveTray",
|
2727
|
-
"ArrowLeft",
|
2728
|
-
"ArrowRight",
|
2729
|
-
"Buildings",
|
2730
|
-
"Circle",
|
2731
|
-
"CaretDown",
|
2732
|
-
"CaretLeft",
|
2733
|
-
"CaretRight",
|
2734
|
-
"ChartBar",
|
2735
|
-
"ChartLine",
|
2736
|
-
"ChatCircle",
|
2737
|
-
"CheckSquare",
|
2738
|
-
"Compass",
|
2739
|
-
"Check",
|
2740
|
-
"Copy",
|
2741
|
-
"Database",
|
2742
|
-
"DotsThreeVertical",
|
2743
|
-
"DownloadSimple",
|
2744
|
-
"ArrowCounterClockwise",
|
2745
|
-
"MagnifyingGlassMinus",
|
2746
|
-
"MagnifyingGlassPlus",
|
2747
|
-
"Export",
|
2748
|
-
"Eye",
|
2749
|
-
"EyeSlash",
|
2750
|
-
"Envelope",
|
2751
|
-
"File",
|
2752
|
-
"FileSearch",
|
2753
|
-
"FileMinus",
|
2754
|
-
"FilePlus",
|
2755
|
-
"FileText",
|
2756
|
-
"FileX",
|
2757
|
-
"Handshake",
|
2758
|
-
"Gear",
|
2759
|
-
"GitBranch",
|
2760
|
-
"IdentificationCard",
|
2761
|
-
"List",
|
2762
|
-
"ListBullets",
|
2763
|
-
"Lock",
|
2764
|
-
"MagnifyingGlass",
|
2765
|
-
"MapPin",
|
2766
|
-
"Medal",
|
2767
|
-
"NotePencil",
|
2768
|
-
"Paperclip",
|
2769
|
-
"PaperPlaneTilt",
|
2770
|
-
"Pen",
|
2771
|
-
"Pencil",
|
2772
|
-
"PencilSimpleLine",
|
2773
|
-
"Phone",
|
2774
|
-
"Plus",
|
2775
|
-
"Printer",
|
2776
|
-
"SignOut",
|
2777
|
-
"Star",
|
2778
|
-
"Target",
|
2779
|
-
"TextT",
|
2780
|
-
"Trash",
|
2781
|
-
"UploadSimple",
|
2782
|
-
"User",
|
2783
|
-
"UserPlus",
|
2784
|
-
"Users",
|
2785
|
-
"WarningCircle",
|
2786
|
-
"X",
|
2787
|
-
"CircleWavyCheck",
|
2788
|
-
"CircleWavyQuestion",
|
2789
|
-
"ArchiveBox",
|
2790
|
-
"ArrowCircleDown",
|
2791
|
-
"FileArrowUp",
|
2792
|
-
"FileDotted",
|
2793
|
-
"Files",
|
2794
|
-
"PencilLine",
|
2795
|
-
"PencilCircle",
|
2796
|
-
"UserCircle",
|
2797
|
-
"Clock",
|
2798
|
-
"QrCode",
|
2799
|
-
"Webcam",
|
2800
|
-
"Sun",
|
2801
|
-
"DeviceTabletCamera",
|
2802
|
-
"Globe",
|
2803
|
-
"Fingerprint",
|
2804
|
-
"PushPin",
|
2805
|
-
"Timer"
|
2806
|
-
]);
|
2807
|
-
|
2808
|
-
// ../commons/src/events/EventIndex.ts
|
2809
|
-
var import_zod23 = require("zod");
|
2810
|
-
var EventIndex = EventMetadata.extend({
|
2811
|
-
declaration: EventState
|
2812
|
-
});
|
2813
|
-
var EventSearchIndex = import_zod23.z.record(import_zod23.z.string(), import_zod23.z.any()).and(
|
2814
|
-
import_zod23.z.object({
|
2815
|
-
type: import_zod23.z.string()
|
2816
|
-
// Ensures "type" (event-id) exists and is a string
|
2817
|
-
})
|
2818
|
-
);
|
2819
|
-
var Fuzzy2 = import_zod23.z.object({ type: import_zod23.z.literal("fuzzy"), term: import_zod23.z.string() });
|
2820
|
-
var Exact2 = import_zod23.z.object({ type: import_zod23.z.literal("exact"), term: import_zod23.z.string() });
|
2821
|
-
var AnyOf2 = import_zod23.z.object({
|
2822
|
-
type: import_zod23.z.literal("anyOf"),
|
2823
|
-
terms: import_zod23.z.array(import_zod23.z.string())
|
2824
|
-
});
|
2825
|
-
var ExactStatus2 = import_zod23.z.object({
|
2826
|
-
type: import_zod23.z.literal("exact"),
|
2827
|
-
term: EventStatusEnum
|
2828
|
-
});
|
2829
|
-
var AnyOfStatus2 = import_zod23.z.object({
|
2830
|
-
type: import_zod23.z.literal("anyOf"),
|
2831
|
-
terms: import_zod23.z.array(EventStatusEnum)
|
2832
|
-
});
|
2833
|
-
var Range2 = import_zod23.z.object({
|
2834
|
-
type: import_zod23.z.literal("range"),
|
2835
|
-
gte: import_zod23.z.string(),
|
2836
|
-
lte: import_zod23.z.string()
|
2837
|
-
});
|
2838
|
-
var Not2 = import_zod23.z.object({ type: import_zod23.z.literal("not"), term: import_zod23.z.string() });
|
2839
|
-
var Within2 = import_zod23.z.object({ type: import_zod23.z.literal("within"), location: import_zod23.z.string() });
|
2840
|
-
var DateCondition2 = import_zod23.z.union([Exact2, Range2]);
|
2841
|
-
var QueryInput2 = import_zod23.z.lazy(
|
2842
|
-
() => import_zod23.z.union([
|
2843
|
-
import_zod23.z.discriminatedUnion("type", [Fuzzy2, Exact2, Range2, Within2, AnyOf2, Not2]),
|
2844
|
-
import_zod23.z.record(import_zod23.z.string(), QueryInput2)
|
2845
|
-
])
|
2846
|
-
);
|
2847
|
-
var QueryExpression = import_zod23.z.object({
|
2848
|
-
title: import_zod23.z.string(),
|
2849
|
-
eventType: import_zod23.z.string(),
|
2850
|
-
status: import_zod23.z.optional(import_zod23.z.union([AnyOfStatus2, ExactStatus2])),
|
2851
|
-
createdAt: import_zod23.z.optional(DateCondition2),
|
2852
|
-
updatedAt: import_zod23.z.optional(DateCondition2),
|
2853
|
-
"legalStatus.REGISTERED.createdAt": import_zod23.z.optional(DateCondition2),
|
2854
|
-
"legalStatus.REGISTERED.createdAtLocation": import_zod23.z.optional(
|
2855
|
-
import_zod23.z.union([Within2, Exact2])
|
2856
|
-
),
|
2857
|
-
createdAtLocation: import_zod23.z.optional(import_zod23.z.union([Within2, Exact2])),
|
2858
|
-
updatedAtLocation: import_zod23.z.optional(import_zod23.z.union([Within2, Exact2])),
|
2859
|
-
assignedTo: import_zod23.z.optional(Exact2),
|
2860
|
-
createdBy: import_zod23.z.optional(Exact2),
|
2861
|
-
updatedBy: import_zod23.z.optional(Exact2),
|
2862
|
-
trackingId: import_zod23.z.optional(Exact2),
|
2863
|
-
flags: import_zod23.z.optional(import_zod23.z.array(import_zod23.z.union([AnyOf2, Not2]))),
|
2864
|
-
data: QueryInput2
|
2865
|
-
}).partial();
|
2866
|
-
var Or3 = import_zod23.z.object({
|
2867
|
-
type: import_zod23.z.literal("or"),
|
2868
|
-
clauses: import_zod23.z.array(QueryExpression)
|
2869
|
-
});
|
2870
|
-
var And3 = import_zod23.z.object({
|
2871
|
-
type: import_zod23.z.literal("and"),
|
2872
|
-
clauses: import_zod23.z.array(QueryExpression)
|
2873
|
-
});
|
2874
|
-
var QueryType = import_zod23.z.discriminatedUnion("type", [Or3, And3]);
|
2875
|
-
|
2876
|
-
// ../commons/src/events/WorkqueueConfig.ts
|
2877
|
-
var defaultThirdColumn = defineWorkqueuesColumns([
|
2878
|
-
{
|
2879
|
-
label: {
|
2880
|
-
id: "workqueues.dateOfEvent",
|
2881
|
-
defaultMessage: "Date of Event",
|
2882
|
-
description: "Label for workqueue column: dateOfEvent"
|
2883
|
-
},
|
2884
|
-
value: event.field("dateOfEvent")
|
2885
|
-
}
|
2886
|
-
]);
|
2887
|
-
var WorkqueueConfig = import_zod24.z.object({
|
2888
|
-
slug: import_zod24.z.string().describe("Determines the url of the workqueue."),
|
2889
|
-
name: TranslationConfig.describe(
|
2890
|
-
"Title of the workflow (both in navigation and on the page)"
|
2891
|
-
),
|
2892
|
-
query: CountryConfigQueryType,
|
2893
|
-
actions: import_zod24.z.array(
|
2894
|
-
import_zod24.z.object({
|
2895
|
-
type: import_zod24.z.string(),
|
2896
|
-
conditionals: import_zod24.z.array(Conditional).optional()
|
2897
|
-
})
|
2898
|
-
),
|
2899
|
-
columns: import_zod24.z.array(WorkqueueColumn).default(defaultThirdColumn),
|
2900
|
-
icon: AvailableIcons
|
2901
|
-
}).describe("Configuration for workqueue.");
|
2902
|
-
var WorkqueueConfigInput = import_zod24.z.object({
|
2903
|
-
slug: import_zod24.z.string().describe("Determines the url of the workqueue."),
|
2904
|
-
name: TranslationConfig.describe(
|
2905
|
-
"Title of the workflow (both in navigation and on the page)"
|
2906
|
-
),
|
2907
|
-
query: CountryConfigQueryInputType,
|
2908
|
-
actions: import_zod24.z.array(
|
2909
|
-
import_zod24.z.object({
|
2910
|
-
type: import_zod24.z.string(),
|
2911
|
-
conditionals: import_zod24.z.array(Conditional).optional()
|
2912
|
-
})
|
2913
|
-
),
|
2914
|
-
columns: import_zod24.z.array(WorkqueueColumn).default(defaultThirdColumn),
|
2915
|
-
icon: AvailableIcons
|
2916
|
-
});
|
2917
|
-
function defineWorkqueue(workqueueInput) {
|
2918
|
-
const queryInput = workqueueInput.query;
|
2919
|
-
const query = "type" in queryInput ? queryInput : { type: "and", clauses: [queryInput] };
|
2920
|
-
return WorkqueueConfig.parse({ ...workqueueInput, query });
|
2921
|
-
}
|
2922
|
-
function defineWorkqueues(workqueues) {
|
2923
|
-
return workqueues.map((workqueue) => defineWorkqueue(workqueue));
|
2924
|
-
}
|
2925
|
-
var WorkqueueCountInput = import_zod24.z.array(
|
2926
|
-
import_zod24.z.object({ slug: import_zod24.z.string(), query: QueryType })
|
2927
|
-
);
|
2928
|
-
var WorkqueueCountOutput = import_zod24.z.record(import_zod24.z.string(), import_zod24.z.number());
|
2929
|
-
|
2930
|
-
// ../commons/src/events/workqueueDefaultColumns.ts
|
2931
|
-
var defaultWorkqueueColumns = [
|
2932
|
-
{
|
2933
|
-
label: {
|
2934
|
-
defaultMessage: "Title",
|
2935
|
-
description: "This is the label for the workqueue column",
|
2936
|
-
id: "workqueue.in-reveiw.column.title"
|
2937
|
-
},
|
2938
|
-
value: event.field("title")
|
2939
|
-
},
|
2940
|
-
{
|
2941
|
-
label: {
|
2942
|
-
defaultMessage: "Event",
|
2943
|
-
description: "This is the label for the workqueue column",
|
2944
|
-
id: "workqueue.default.column.event"
|
2945
|
-
},
|
2946
|
-
value: event.field("type")
|
2947
|
-
},
|
2948
|
-
{
|
2949
|
-
label: {
|
2950
|
-
defaultMessage: "Last updated",
|
2951
|
-
description: "This is the label for the workqueue column",
|
2952
|
-
id: "workqueue.default.column.modifiedAt"
|
2953
|
-
},
|
2954
|
-
value: event.field("updatedAt")
|
2955
|
-
}
|
2956
|
-
];
|
2957
|
-
|
2958
|
-
// ../commons/src/events/Draft.ts
|
2959
|
-
var import_zod26 = require("zod");
|
2960
|
-
|
2961
|
-
// ../commons/src/events/ActionInput.ts
|
2962
|
-
var import_zod25 = require("zod");
|
2963
|
-
var import_zod_openapi9 = require("zod-openapi");
|
2964
|
-
(0, import_zod_openapi9.extendZodWithOpenApi)(import_zod25.z);
|
2965
|
-
var BaseActionInput = import_zod25.z.object({
|
2966
|
-
eventId: import_zod25.z.string(),
|
2967
|
-
transactionId: import_zod25.z.string(),
|
2968
|
-
declaration: ActionUpdate.default({}),
|
2969
|
-
annotation: ActionUpdate.optional(),
|
2970
|
-
originalActionId: import_zod25.z.string().optional(),
|
2971
|
-
keepAssignment: import_zod25.z.boolean().optional()
|
2972
|
-
});
|
2973
|
-
var CreateActionInput = BaseActionInput.merge(
|
2974
|
-
import_zod25.z.object({
|
2975
|
-
type: import_zod25.z.literal(ActionType.CREATE).default(ActionType.CREATE),
|
2976
|
-
createdAtLocation: import_zod25.z.string()
|
2977
|
-
})
|
2978
|
-
);
|
2979
|
-
var RegisterActionInput = BaseActionInput.merge(
|
2980
|
-
import_zod25.z.object({
|
2981
|
-
type: import_zod25.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
2982
|
-
registrationNumber: import_zod25.z.string().optional()
|
2983
|
-
})
|
2984
|
-
);
|
2985
|
-
var ValidateActionInput = BaseActionInput.merge(
|
2986
|
-
import_zod25.z.object({
|
2987
|
-
type: import_zod25.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
|
2988
|
-
duplicates: import_zod25.z.array(import_zod25.z.string())
|
2989
|
-
})
|
2990
|
-
);
|
2991
|
-
var NotifyActionInput = BaseActionInput.merge(
|
2992
|
-
import_zod25.z.object({
|
2993
|
-
type: import_zod25.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
|
2994
|
-
})
|
2995
|
-
);
|
2996
|
-
var DeclareActionInput = BaseActionInput.merge(
|
2997
|
-
import_zod25.z.object({
|
2998
|
-
type: import_zod25.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
2999
|
-
})
|
3000
|
-
);
|
3001
|
-
var PrintCertificateActionInput = BaseActionInput.merge(
|
3002
|
-
import_zod25.z.object({
|
3003
|
-
type: import_zod25.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
|
3004
|
-
})
|
3005
|
-
);
|
3006
|
-
var RejectDeclarationActionInput = BaseActionInput.merge(
|
3007
|
-
import_zod25.z.object({
|
3008
|
-
type: import_zod25.z.literal(ActionType.REJECT).default(ActionType.REJECT)
|
3009
|
-
})
|
3010
|
-
);
|
3011
|
-
var MarkedAsDuplicateActionInput = BaseActionInput.merge(
|
3012
|
-
import_zod25.z.object({
|
3013
|
-
type: import_zod25.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
|
3014
|
-
})
|
3015
|
-
);
|
3016
|
-
var ArchiveActionInput = BaseActionInput.merge(
|
3017
|
-
import_zod25.z.object({
|
3018
|
-
type: import_zod25.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE)
|
3019
|
-
})
|
3020
|
-
);
|
3021
|
-
var AssignActionInput = BaseActionInput.merge(
|
3022
|
-
import_zod25.z.object({
|
3023
|
-
type: import_zod25.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
|
3024
|
-
assignedTo: import_zod25.z.string()
|
3025
|
-
})
|
3026
|
-
);
|
3027
|
-
var UnassignActionInput = BaseActionInput.merge(
|
3028
|
-
import_zod25.z.object({
|
3029
|
-
type: import_zod25.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
|
3030
|
-
assignedTo: import_zod25.z.literal(null).default(null)
|
3031
|
-
})
|
3032
|
-
);
|
3033
|
-
var RequestCorrectionActionInput = BaseActionInput.merge(
|
3034
|
-
import_zod25.z.object({
|
3035
|
-
type: import_zod25.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
3036
|
-
})
|
3037
|
-
);
|
3038
|
-
var RejectCorrectionActionInput = BaseActionInput.merge(
|
3039
|
-
import_zod25.z.object({
|
3040
|
-
requestId: import_zod25.z.string(),
|
3041
|
-
type: import_zod25.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
|
3042
|
-
})
|
3043
|
-
);
|
3044
|
-
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
3045
|
-
import_zod25.z.object({
|
3046
|
-
requestId: import_zod25.z.string(),
|
3047
|
-
type: import_zod25.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
3048
|
-
})
|
3049
|
-
);
|
3050
|
-
var ReadActionInput = BaseActionInput.merge(
|
3051
|
-
import_zod25.z.object({
|
3052
|
-
type: import_zod25.z.literal(ActionType.READ).default(ActionType.READ)
|
3053
|
-
})
|
3054
|
-
);
|
3055
|
-
var DeleteActionInput = import_zod25.z.object({ eventId: import_zod25.z.string() });
|
3056
|
-
var ActionInput = import_zod25.z.discriminatedUnion("type", [
|
3057
|
-
CreateActionInput.openapi({ ref: "CreateActionInput" }),
|
3058
|
-
ValidateActionInput.openapi({ ref: "ValidateActionInput" }),
|
3059
|
-
RegisterActionInput.openapi({ ref: "RegisterActionInput" }),
|
3060
|
-
NotifyActionInput.openapi({ ref: "NotifyActionInput" }),
|
3061
|
-
DeclareActionInput.openapi({ ref: "DeclareActionInput" }),
|
3062
|
-
RejectDeclarationActionInput.openapi({
|
3063
|
-
ref: "RejectDeclarationActionInput"
|
3064
|
-
}),
|
3065
|
-
MarkedAsDuplicateActionInput.openapi({
|
3066
|
-
ref: "MarkedAsDuplicateActionInput"
|
3067
|
-
}),
|
3068
|
-
ArchiveActionInput.openapi({ ref: "ArchiveActionInput" }),
|
3069
|
-
AssignActionInput.openapi({ ref: "AssignActionInput" }),
|
3070
|
-
UnassignActionInput.openapi({ ref: "UnassignActionInput" }),
|
3071
|
-
PrintCertificateActionInput.openapi({ ref: "PrintCertificateActionInput" }),
|
3072
|
-
RequestCorrectionActionInput.openapi({
|
3073
|
-
ref: "RequestCorrectionActionInput"
|
3074
|
-
}),
|
3075
|
-
RejectCorrectionActionInput.openapi({ ref: "RejectCorrectionActionInput" }),
|
3076
|
-
ApproveCorrectionActionInput.openapi({
|
3077
|
-
ref: "ApproveCorrectionActionInput"
|
3078
|
-
}),
|
3079
|
-
ReadActionInput.openapi({ ref: "ReadActionInput" })
|
3080
|
-
]).openapi({
|
3081
|
-
ref: "ActionInput"
|
3082
|
-
});
|
3083
|
-
|
3084
|
-
// ../commons/src/events/Draft.ts
|
3085
|
-
var Draft = import_zod26.z.object({
|
3086
|
-
id: import_zod26.z.string(),
|
3087
|
-
eventId: import_zod26.z.string(),
|
3088
|
-
transactionId: import_zod26.z.string(),
|
3089
|
-
createdAt: import_zod26.z.string().datetime(),
|
3090
|
-
action: ActionBase.extend({
|
3091
|
-
type: ActionTypes
|
3092
|
-
}).omit({ id: true })
|
3093
|
-
});
|
3094
|
-
var DraftInput = BaseActionInput.extend({
|
3095
|
-
type: ActionTypes,
|
3096
|
-
status: import_zod26.z.enum([
|
3097
|
-
ActionStatus.Requested,
|
3098
|
-
ActionStatus.Accepted,
|
3099
|
-
ActionStatus.Rejected
|
3100
|
-
])
|
3101
|
-
});
|
3102
|
-
|
3103
|
-
// ../commons/src/events/EventInput.ts
|
3104
|
-
var import_zod27 = require("zod");
|
3105
|
-
var EventInput = import_zod27.z.object({
|
3106
|
-
transactionId: import_zod27.z.string(),
|
3107
|
-
type: import_zod27.z.string()
|
3108
|
-
});
|
3109
|
-
|
3110
|
-
// ../commons/src/events/EventDocument.ts
|
3111
|
-
var import_zod28 = require("zod");
|
3112
|
-
var import_zod_openapi10 = require("zod-openapi");
|
3113
|
-
(0, import_zod_openapi10.extendZodWithOpenApi)(import_zod28.z);
|
3114
|
-
var EventDocument = import_zod28.z.object({
|
3115
|
-
id: import_zod28.z.string(),
|
3116
|
-
type: import_zod28.z.string(),
|
3117
|
-
createdAt: import_zod28.z.string().datetime(),
|
3118
|
-
updatedAt: import_zod28.z.string().datetime(),
|
3119
|
-
actions: import_zod28.z.array(Action),
|
3120
|
-
trackingId: import_zod28.z.string()
|
3121
|
-
}).openapi({ ref: "EventDocument" });
|
3122
|
-
|
3123
|
-
// ../commons/src/events/state/utils.ts
|
3124
|
-
function getActionRequests(actionType, actions) {
|
3125
|
-
const filtered = actions.filter((action) => action.type === actionType);
|
3126
|
-
const accept = filtered.find(
|
3127
|
-
(action) => action.status === ActionStatus.Accepted
|
3128
|
-
);
|
3129
|
-
const request = filtered.find(
|
3130
|
-
(action) => action.status === ActionStatus.Requested
|
3131
|
-
);
|
3132
|
-
const reject = filtered.find(
|
3133
|
-
(action) => action.status === ActionStatus.Rejected
|
3134
|
-
);
|
3135
|
-
return {
|
3136
|
-
reject,
|
3137
|
-
accept,
|
3138
|
-
request
|
3139
|
-
};
|
3140
|
-
}
|
3141
|
-
function getDeclarationActionCreationMetadata(actionType, actions) {
|
3142
|
-
const { accept: acceptAction, request: requestAction } = getActionRequests(
|
3143
|
-
actionType,
|
3144
|
-
actions
|
3145
|
-
);
|
3146
|
-
if (!acceptAction) {
|
3147
|
-
return null;
|
3148
|
-
}
|
3149
|
-
const registrationNumber = acceptAction.type === ActionType.REGISTER ? acceptAction.registrationNumber : null;
|
3150
|
-
return {
|
3151
|
-
// When 3rd party API returns 200 OK, we assume that the request was accepted, and persist single 'accepted' action.
|
3152
|
-
createdAt: requestAction?.createdAt ?? acceptAction.createdAt,
|
3153
|
-
createdBy: requestAction?.createdBy ?? acceptAction.createdBy,
|
3154
|
-
createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
|
3155
|
-
acceptedAt: acceptAction.createdAt,
|
3156
|
-
createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
|
3157
|
-
registrationNumber
|
3158
|
-
};
|
3159
|
-
}
|
3160
|
-
function getDeclarationActionUpdateMetadata(actions) {
|
3161
|
-
const createAction = getOrThrow(
|
3162
|
-
actions.find((action) => action.type === ActionType.CREATE),
|
3163
|
-
`Event has no ${ActionType.CREATE} action`
|
3164
|
-
);
|
3165
|
-
return [ActionType.DECLARE, ActionType.VALIDATE, ActionType.REGISTER].reduce(
|
3166
|
-
(metadata, actionType) => {
|
3167
|
-
const { accept, request } = getActionRequests(actionType, actions);
|
3168
|
-
return {
|
3169
|
-
createdAt: request?.createdAt ?? accept?.createdAt ?? metadata.createdAt,
|
3170
|
-
createdBy: request?.createdBy ?? accept?.createdBy ?? metadata.createdBy,
|
3171
|
-
createdAtLocation: request?.createdAtLocation ?? accept?.createdAtLocation ?? metadata.createdAtLocation,
|
3172
|
-
createdByRole: request?.createdByRole ?? accept?.createdByRole ?? metadata.createdByRole
|
3173
|
-
};
|
3174
|
-
},
|
3175
|
-
{
|
3176
|
-
createdAt: createAction.createdAt,
|
3177
|
-
createdBy: createAction.createdBy,
|
3178
|
-
createdAtLocation: createAction.createdAtLocation,
|
3179
|
-
createdByRole: createAction.createdByRole
|
3180
|
-
}
|
3181
|
-
);
|
3182
|
-
}
|
3183
|
-
function getLegalStatuses(actions) {
|
3184
|
-
return {
|
3185
|
-
[EventStatus.DECLARED]: getDeclarationActionCreationMetadata(
|
3186
|
-
ActionType.DECLARE,
|
3187
|
-
actions
|
3188
|
-
),
|
3189
|
-
[EventStatus.REGISTERED]: getDeclarationActionCreationMetadata(
|
3190
|
-
ActionType.REGISTER,
|
3191
|
-
actions
|
3192
|
-
)
|
3193
|
-
};
|
3194
|
-
}
|
3195
|
-
|
3196
|
-
// ../commons/src/events/state/index.ts
|
3197
|
-
function getStatusFromActions(actions) {
|
3198
|
-
const hasRejectedAction = actions.some(
|
3199
|
-
(a) => a.status === ActionStatus.Rejected
|
3200
|
-
);
|
3201
|
-
if (hasRejectedAction) {
|
3202
|
-
return EventStatus.REJECTED;
|
3203
|
-
}
|
3204
|
-
return actions.reduce((status, action) => {
|
3205
|
-
switch (action.type) {
|
3206
|
-
case ActionType.CREATE:
|
3207
|
-
return EventStatus.CREATED;
|
3208
|
-
case ActionType.DECLARE:
|
3209
|
-
return EventStatus.DECLARED;
|
3210
|
-
case ActionType.VALIDATE:
|
3211
|
-
return EventStatus.VALIDATED;
|
3212
|
-
case ActionType.REGISTER:
|
3213
|
-
return EventStatus.REGISTERED;
|
3214
|
-
case ActionType.REJECT:
|
3215
|
-
return EventStatus.REJECTED;
|
3216
|
-
case ActionType.ARCHIVE:
|
3217
|
-
return EventStatus.ARCHIVED;
|
3218
|
-
case ActionType.NOTIFY:
|
3219
|
-
return EventStatus.NOTIFIED;
|
3220
|
-
case ActionType.PRINT_CERTIFICATE:
|
3221
|
-
return EventStatus.CERTIFIED;
|
3222
|
-
case ActionType.ASSIGN:
|
3223
|
-
case ActionType.UNASSIGN:
|
3224
|
-
case ActionType.REQUEST_CORRECTION:
|
3225
|
-
case ActionType.APPROVE_CORRECTION:
|
3226
|
-
case ActionType.MARKED_AS_DUPLICATE:
|
3227
|
-
case ActionType.REJECT_CORRECTION:
|
3228
|
-
case ActionType.READ:
|
3229
|
-
default:
|
3230
|
-
return status;
|
3231
|
-
}
|
3232
|
-
}, EventStatus.CREATED);
|
3233
|
-
}
|
3234
|
-
function getFlagsFromActions(actions) {
|
3235
|
-
const sortedactions = actions.sort(
|
3236
|
-
(a, b) => a.createdAt.localeCompare(b.createdAt)
|
3237
|
-
);
|
3238
|
-
const actionStatus = sortedactions.reduce(
|
3239
|
-
(actionStatuses, { type, status }) => ({
|
3240
|
-
...actionStatuses,
|
3241
|
-
[type]: status
|
3242
|
-
}),
|
3243
|
-
{}
|
3244
|
-
);
|
3245
|
-
const flags = Object.entries(actionStatus).filter(([, status]) => status !== ActionStatus.Accepted).map(([type, status]) => {
|
3246
|
-
const flag = `${type.toLowerCase()}:${status.toLowerCase()}`;
|
3247
|
-
return flag;
|
3248
|
-
});
|
3249
|
-
const isCertificatePrinted = sortedactions.reduce(
|
3250
|
-
(prev, { type }) => {
|
3251
|
-
if (type === ActionType.PRINT_CERTIFICATE) {
|
3252
|
-
return true;
|
3253
|
-
}
|
3254
|
-
if (type === ActionType.APPROVE_CORRECTION) {
|
3255
|
-
return false;
|
3256
|
-
}
|
3257
|
-
return prev;
|
3258
|
-
},
|
3259
|
-
false
|
3260
|
-
);
|
3261
|
-
if (isCertificatePrinted) {
|
3262
|
-
flags.push(CustomFlags.CERTIFICATE_PRINTED);
|
3263
|
-
}
|
3264
|
-
return flags;
|
3265
|
-
}
|
3266
|
-
function getAssignedUserFromActions(actions) {
|
3267
|
-
return actions.reduce((user2, action) => {
|
3268
|
-
if (action.type === ActionType.ASSIGN) {
|
3269
|
-
return action.assignedTo;
|
3270
|
-
}
|
3271
|
-
if (action.type === ActionType.UNASSIGN) {
|
3272
|
-
return null;
|
3273
|
-
}
|
3274
|
-
return user2;
|
3275
|
-
}, null);
|
3276
|
-
}
|
3277
|
-
function aggregateActionDeclarations(actions) {
|
3278
|
-
const excludedActions = [
|
3279
|
-
ActionType.REQUEST_CORRECTION,
|
3280
|
-
ActionType.PRINT_CERTIFICATE
|
3281
|
-
];
|
3282
|
-
return actions.reduce((declaration, action) => {
|
3283
|
-
if (excludedActions.some((excludedAction) => excludedAction === action.type)) {
|
3284
|
-
return declaration;
|
3285
|
-
}
|
3286
|
-
if (action.type === ActionType.APPROVE_CORRECTION) {
|
3287
|
-
const requestAction = actions.find(({ id }) => id === action.requestId);
|
3288
|
-
if (!requestAction) {
|
3289
|
-
return declaration;
|
3290
|
-
}
|
3291
|
-
return deepMerge(declaration, requestAction.declaration);
|
3292
|
-
}
|
3293
|
-
return deepMerge(declaration, action.declaration);
|
3294
|
-
}, {});
|
3295
|
-
}
|
3296
|
-
function deepDropNulls(obj) {
|
3297
|
-
if (Array.isArray(obj)) {
|
3298
|
-
return obj.map(deepDropNulls);
|
3299
|
-
}
|
3300
|
-
if (obj !== null && typeof obj === "object") {
|
3301
|
-
return Object.entries(obj).reduce((acc, [key, value]) => {
|
3302
|
-
const cleanedValue = deepDropNulls(value);
|
3303
|
-
if (cleanedValue !== null) {
|
3304
|
-
;
|
3305
|
-
acc[key] = cleanedValue;
|
3306
|
-
}
|
3307
|
-
return acc;
|
3308
|
-
}, {});
|
3309
|
-
}
|
3310
|
-
return obj;
|
3311
|
-
}
|
3312
|
-
function isUndeclaredDraft(status) {
|
3313
|
-
return status === EventStatus.CREATED;
|
3314
|
-
}
|
3315
|
-
function getAcceptedActions(event2) {
|
3316
|
-
return event2.actions.filter(
|
3317
|
-
(a) => a.status === ActionStatus.Accepted
|
3318
|
-
);
|
3319
|
-
}
|
3320
|
-
var DEFAULT_DATE_OF_EVENT_PROPERTY = "createdAt";
|
3321
|
-
function getCurrentEventState(event2, config) {
|
3322
|
-
const creationAction = event2.actions.find(
|
3323
|
-
(action) => action.type === ActionType.CREATE
|
3324
|
-
);
|
3325
|
-
if (!creationAction) {
|
3326
|
-
throw new Error(`Event ${event2.id} has no creation action`);
|
3327
|
-
}
|
3328
|
-
const acceptedActions = getAcceptedActions(event2);
|
3329
|
-
const declarationUpdateMetadata = getDeclarationActionUpdateMetadata(
|
3330
|
-
event2.actions
|
3331
|
-
);
|
3332
|
-
const declaration = aggregateActionDeclarations(acceptedActions);
|
3333
|
-
let dateOfEvent;
|
3334
|
-
if (config && config.dateOfEvent) {
|
3335
|
-
const parsedDate = ZodDate.safeParse(
|
3336
|
-
declaration[config.dateOfEvent.fieldId]
|
3337
|
-
);
|
3338
|
-
if (parsedDate.success) {
|
3339
|
-
dateOfEvent = parsedDate.data;
|
3340
|
-
}
|
3341
|
-
} else {
|
3342
|
-
dateOfEvent = event2[DEFAULT_DATE_OF_EVENT_PROPERTY].split("T")[0];
|
3343
|
-
}
|
3344
|
-
return deepDropNulls({
|
3345
|
-
id: event2.id,
|
3346
|
-
type: event2.type,
|
3347
|
-
title: "ToDo",
|
3348
|
-
status: getStatusFromActions(event2.actions),
|
3349
|
-
legalStatuses: getLegalStatuses(event2.actions),
|
3350
|
-
createdAt: creationAction.createdAt,
|
3351
|
-
createdBy: creationAction.createdBy,
|
3352
|
-
createdAtLocation: creationAction.createdAtLocation,
|
3353
|
-
updatedAt: declarationUpdateMetadata.createdAt,
|
3354
|
-
assignedTo: getAssignedUserFromActions(acceptedActions),
|
3355
|
-
updatedBy: declarationUpdateMetadata.createdBy,
|
3356
|
-
updatedAtLocation: declarationUpdateMetadata.createdAtLocation,
|
3357
|
-
declaration,
|
3358
|
-
trackingId: event2.trackingId,
|
3359
|
-
// @TODO: unify this with rest of the code. It will trip us if updatedBy has different rules than updatedByUserRole
|
3360
|
-
updatedByUserRole: declarationUpdateMetadata.createdByRole,
|
3361
|
-
dateOfEvent,
|
3362
|
-
flags: getFlagsFromActions(event2.actions)
|
3363
|
-
});
|
3364
|
-
}
|
3365
|
-
function getCurrentEventStateWithDrafts({
|
3366
|
-
event: event2,
|
3367
|
-
drafts,
|
3368
|
-
configuration
|
3369
|
-
}) {
|
3370
|
-
const actions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
3371
|
-
const activeDrafts = findActiveDrafts(event2, drafts).map((draft) => draft.action).flatMap((action) => {
|
3372
|
-
if (action.type === ActionType.REQUEST_CORRECTION) {
|
3373
|
-
return [
|
3374
|
-
action,
|
3375
|
-
{
|
3376
|
-
...action,
|
3377
|
-
type: ActionType.APPROVE_CORRECTION
|
3378
|
-
}
|
3379
|
-
];
|
3380
|
-
}
|
3381
|
-
return [action];
|
3382
|
-
});
|
3383
|
-
const actionWithDrafts = [...actions, ...activeDrafts].sort();
|
3384
|
-
const withDrafts = {
|
3385
|
-
...event2,
|
3386
|
-
actions: actionWithDrafts
|
3387
|
-
};
|
3388
|
-
return getCurrentEventState(withDrafts, configuration);
|
3389
|
-
}
|
3390
|
-
function applyDraftsToEventIndex(eventIndex, drafts) {
|
3391
|
-
const indexedAt = eventIndex.updatedAt;
|
3392
|
-
const activeDrafts = drafts.filter(({ createdAt }) => new Date(createdAt) > new Date(indexedAt)).map((draft) => draft.action).sort();
|
3393
|
-
if (activeDrafts.length === 0) {
|
3394
|
-
return eventIndex;
|
3395
|
-
}
|
3396
|
-
return {
|
3397
|
-
...eventIndex,
|
3398
|
-
declaration: {
|
3399
|
-
...eventIndex.declaration,
|
3400
|
-
...activeDrafts[activeDrafts.length - 1].declaration
|
3401
|
-
}
|
3402
|
-
};
|
3403
|
-
}
|
3404
|
-
function getAnnotationFromDrafts(drafts) {
|
3405
|
-
const actions = drafts.map((draft) => draft.action);
|
3406
|
-
const annotation = actions.reduce((ann, action) => {
|
3407
|
-
return deepMerge(ann, action.annotation ?? {});
|
3408
|
-
}, {});
|
3409
|
-
return deepDropNulls(annotation);
|
3410
|
-
}
|
3411
|
-
function getActionAnnotation({
|
3412
|
-
event: event2,
|
3413
|
-
actionType,
|
3414
|
-
drafts = []
|
3415
|
-
}) {
|
3416
|
-
const activeActions = getAcceptedActions(event2);
|
3417
|
-
const action = activeActions.find(
|
3418
|
-
(activeAction) => actionType === activeAction.type
|
3419
|
-
);
|
3420
|
-
const eventDrafts = drafts.filter((draft) => draft.eventId === event2.id);
|
3421
|
-
const sorted = [
|
3422
|
-
...action ? [action] : [],
|
3423
|
-
...eventDrafts.map((draft) => draft.action)
|
3424
|
-
].sort();
|
3425
|
-
const annotation = sorted.reduce((ann, sortedAction) => {
|
3426
|
-
return deepMerge(ann, sortedAction.annotation ?? {});
|
3427
|
-
}, {});
|
3428
|
-
return deepDropNulls(annotation);
|
3429
|
-
}
|
3430
|
-
|
3431
|
-
// ../commons/src/events/defineConfig.ts
|
3432
|
-
var defineConfig = (config) => {
|
3433
|
-
const input = EventConfig.parse(config);
|
3434
|
-
return input;
|
3435
|
-
};
|
3436
|
-
|
3437
|
-
// ../commons/src/events/transactions.ts
|
3438
|
-
function generateTransactionId() {
|
3439
|
-
return getUUID();
|
3440
|
-
}
|
3441
|
-
|
3442
|
-
// ../commons/src/events/User.ts
|
3443
|
-
var import_zod29 = require("zod");
|
3444
|
-
var User = import_zod29.z.object({
|
3445
|
-
id: import_zod29.z.string(),
|
3446
|
-
name: import_zod29.z.array(
|
3447
|
-
import_zod29.z.object({
|
3448
|
-
use: import_zod29.z.string(),
|
3449
|
-
given: import_zod29.z.array(import_zod29.z.string()),
|
3450
|
-
family: import_zod29.z.string()
|
3451
|
-
})
|
3452
|
-
),
|
3453
|
-
role: import_zod29.z.string(),
|
3454
|
-
signatureFilename: import_zod29.z.string().optional()
|
3455
|
-
});
|
3456
|
-
|
3457
|
-
// ../commons/src/events/test.utils.ts
|
3458
|
-
var import_lodash2 = require("lodash");
|
3459
|
-
|
3460
|
-
// ../commons/src/field-config/field-configuration.ts
|
3461
|
-
function createFieldConfig(fieldId, options) {
|
3462
|
-
const baseField = {
|
3463
|
-
fieldId,
|
3464
|
-
fieldType: "field",
|
3465
|
-
...options
|
3466
|
-
};
|
3467
|
-
return createSearchConfig(baseField);
|
3468
|
-
}
|
3469
|
-
|
3470
|
-
// ../commons/src/events/field.ts
|
3471
|
-
function field(fieldId, options = {}) {
|
3472
|
-
return {
|
2585
|
+
}
|
2586
|
+
},
|
2587
|
+
required: [fieldId]
|
2588
|
+
});
|
2589
|
+
},
|
3473
2590
|
/**
|
3474
|
-
*
|
2591
|
+
* Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
|
2592
|
+
* @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
|
2593
|
+
* @returns whether the field is falsy (undefined, false, null, empty string)
|
2594
|
+
*
|
2595
|
+
* NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
|
2596
|
+
*
|
3475
2597
|
*/
|
3476
|
-
|
3477
|
-
|
3478
|
-
|
2598
|
+
isFalsy: () => defineFormConditional({
|
2599
|
+
type: "object",
|
2600
|
+
properties: {
|
2601
|
+
[fieldId]: {
|
2602
|
+
anyOf: [
|
2603
|
+
{ const: "undefined" },
|
2604
|
+
{ const: false },
|
2605
|
+
{ const: null },
|
2606
|
+
{ const: "" }
|
2607
|
+
]
|
2608
|
+
}
|
2609
|
+
},
|
2610
|
+
anyOf: [
|
2611
|
+
{
|
2612
|
+
required: [fieldId]
|
2613
|
+
},
|
2614
|
+
{
|
2615
|
+
not: {
|
2616
|
+
required: [fieldId]
|
2617
|
+
}
|
2618
|
+
}
|
2619
|
+
]
|
2620
|
+
}),
|
2621
|
+
isUndefined: () => defineFormConditional({
|
2622
|
+
type: "object",
|
2623
|
+
properties: {
|
2624
|
+
[fieldId]: {
|
2625
|
+
type: "string",
|
2626
|
+
enum: ["undefined"]
|
2627
|
+
}
|
2628
|
+
},
|
2629
|
+
not: {
|
2630
|
+
required: [fieldId]
|
2631
|
+
}
|
2632
|
+
}),
|
2633
|
+
inArray: (values) => defineFormConditional({
|
2634
|
+
type: "object",
|
2635
|
+
properties: {
|
2636
|
+
[fieldId]: {
|
2637
|
+
type: "string",
|
2638
|
+
enum: values
|
2639
|
+
}
|
2640
|
+
},
|
2641
|
+
required: [fieldId]
|
2642
|
+
}),
|
2643
|
+
isValidEnglishName: () => defineFormConditional({
|
2644
|
+
type: "object",
|
2645
|
+
properties: {
|
2646
|
+
[fieldId]: {
|
2647
|
+
type: "string",
|
2648
|
+
pattern: "^[\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*( [\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*)*$",
|
2649
|
+
description: "Name must contain only letters, numbers, and allowed special characters ('._-). No double spaces."
|
2650
|
+
}
|
2651
|
+
},
|
2652
|
+
required: [fieldId]
|
2653
|
+
}),
|
2654
|
+
/**
|
2655
|
+
* Checks if the field value matches a given regular expression pattern.
|
2656
|
+
* @param pattern - The regular expression pattern to match the field value against.
|
2657
|
+
* @returns A JSONSchema conditional that validates the field value against the pattern.
|
2658
|
+
*/
|
2659
|
+
matches: (pattern) => defineFormConditional({
|
2660
|
+
type: "object",
|
2661
|
+
properties: {
|
2662
|
+
[fieldId]: {
|
2663
|
+
type: "string",
|
2664
|
+
pattern
|
2665
|
+
}
|
2666
|
+
},
|
2667
|
+
required: [fieldId]
|
2668
|
+
}),
|
2669
|
+
isBetween: (min, max) => defineFormConditional({
|
2670
|
+
type: "object",
|
2671
|
+
properties: {
|
2672
|
+
[fieldId]: {
|
2673
|
+
type: "number",
|
2674
|
+
minimum: min,
|
2675
|
+
maximum: max
|
2676
|
+
}
|
2677
|
+
},
|
2678
|
+
required: [fieldId]
|
2679
|
+
})
|
3479
2680
|
};
|
3480
2681
|
}
|
3481
2682
|
|
3482
2683
|
// ../commons/src/fixtures/tennis-club-membership-event.ts
|
3483
|
-
var import_date_fns2 = require("date-fns");
|
3484
2684
|
var PRINT_CERTIFICATE_FORM = defineActionForm({
|
3485
2685
|
label: {
|
3486
2686
|
id: "v2.event.tennis-club-membership.action.certificate.form.label",
|
@@ -4389,139 +3589,27 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
|
4389
3589
|
}
|
4390
3590
|
]
|
4391
3591
|
});
|
4392
|
-
var statusOptions = [
|
4393
|
-
{
|
4394
|
-
value: "ALL",
|
4395
|
-
label: {
|
4396
|
-
defaultMessage: "Any status",
|
4397
|
-
description: "Option for form field: status of record",
|
4398
|
-
id: "v2.advancedSearch.form.recordStatusAny"
|
4399
|
-
}
|
4400
|
-
},
|
4401
|
-
{
|
4402
|
-
value: EventStatus.CREATED,
|
4403
|
-
label: {
|
4404
|
-
defaultMessage: "Draft",
|
4405
|
-
description: "Option for form field: status of record",
|
4406
|
-
id: "v2.advancedSearch.form.recordStatusCreated"
|
4407
|
-
}
|
4408
|
-
},
|
4409
|
-
{
|
4410
|
-
value: EventStatus.NOTIFIED,
|
4411
|
-
label: {
|
4412
|
-
defaultMessage: "Notified",
|
4413
|
-
description: "Option for form field: status of record",
|
4414
|
-
id: "v2.advancedSearch.form.recordStatusNotified"
|
4415
|
-
}
|
4416
|
-
},
|
4417
|
-
{
|
4418
|
-
value: EventStatus.DECLARED,
|
4419
|
-
label: {
|
4420
|
-
defaultMessage: "Declared",
|
4421
|
-
description: "Option for form field: status of record",
|
4422
|
-
id: "v2.advancedSearch.form.recordStatusDeclared"
|
4423
|
-
}
|
4424
|
-
},
|
4425
|
-
{
|
4426
|
-
value: EventStatus.VALIDATED,
|
4427
|
-
label: {
|
4428
|
-
defaultMessage: "Validated",
|
4429
|
-
description: "Option for form field: status of record",
|
4430
|
-
id: "v2.advancedSearch.form.recordStatusValidated"
|
4431
|
-
}
|
4432
|
-
},
|
4433
|
-
{
|
4434
|
-
value: EventStatus.REGISTERED,
|
4435
|
-
label: {
|
4436
|
-
defaultMessage: "Registered",
|
4437
|
-
description: "Option for form field: status of record",
|
4438
|
-
id: "v2.advancedSearch.form.recordStatusRegistered"
|
4439
|
-
}
|
4440
|
-
},
|
4441
|
-
{
|
4442
|
-
value: EventStatus.CERTIFIED,
|
4443
|
-
label: {
|
4444
|
-
defaultMessage: "Certified",
|
4445
|
-
description: "Option for form field: status of record",
|
4446
|
-
id: "v2.advancedSearch.form.recordStatusCertified"
|
4447
|
-
}
|
4448
|
-
},
|
4449
|
-
{
|
4450
|
-
value: EventStatus.REJECTED,
|
4451
|
-
label: {
|
4452
|
-
defaultMessage: "Rejected",
|
4453
|
-
description: "Option for form field: status of record",
|
4454
|
-
id: "v2.advancedSearch.form.recordStatusRejected"
|
4455
|
-
}
|
4456
|
-
},
|
4457
|
-
{
|
4458
|
-
value: EventStatus.ARCHIVED,
|
4459
|
-
label: {
|
4460
|
-
defaultMessage: "Archived",
|
4461
|
-
description: "Option for form field: status of record",
|
4462
|
-
id: "v2.advancedSearch.form.recordStatusArchived"
|
4463
|
-
}
|
4464
|
-
}
|
4465
|
-
];
|
4466
|
-
var timePeriodOptions = [
|
4467
|
-
{
|
4468
|
-
label: {
|
4469
|
-
defaultMessage: "Last 7 days",
|
4470
|
-
description: "Label for option of time period select: last 7 days",
|
4471
|
-
id: "form.section.label.timePeriodLast7Days"
|
4472
|
-
},
|
4473
|
-
value: `${(0, import_date_fns2.format)((0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 7), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
|
4474
|
-
/* @__PURE__ */ new Date(),
|
4475
|
-
"yyyy-MM-dd"
|
4476
|
-
)}`
|
4477
|
-
},
|
4478
|
-
{
|
4479
|
-
label: {
|
4480
|
-
defaultMessage: "Last 30 days",
|
4481
|
-
description: "Label for option of time period select: last 30 days",
|
4482
|
-
id: "form.section.label.timePeriodLast30Days"
|
4483
|
-
},
|
4484
|
-
value: `${(0, import_date_fns2.format)((0, import_date_fns2.subMonths)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
|
4485
|
-
/* @__PURE__ */ new Date(),
|
4486
|
-
"yyyy-MM-dd"
|
4487
|
-
)}`
|
4488
|
-
},
|
4489
|
-
{
|
4490
|
-
label: {
|
4491
|
-
defaultMessage: "Last 90 days",
|
4492
|
-
description: "Label for option of time period select: last 90 days",
|
4493
|
-
id: "form.section.label.timePeriodLast90Days"
|
4494
|
-
},
|
4495
|
-
value: `${(0, import_date_fns2.format)((0, import_date_fns2.subQuarters)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
|
4496
|
-
/* @__PURE__ */ new Date(),
|
4497
|
-
"yyyy-MM-dd"
|
4498
|
-
)}`
|
4499
|
-
},
|
4500
|
-
{
|
4501
|
-
label: {
|
4502
|
-
defaultMessage: "Last year",
|
4503
|
-
description: "Label for option of time period select: last year",
|
4504
|
-
id: "form.section.label.timePeriodLastYear"
|
4505
|
-
},
|
4506
|
-
value: `${(0, import_date_fns2.format)((0, import_date_fns2.subYears)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
|
4507
|
-
/* @__PURE__ */ new Date(),
|
4508
|
-
"yyyy-MM-dd"
|
4509
|
-
)}`
|
4510
|
-
}
|
4511
|
-
];
|
4512
3592
|
var tennisClubMembershipEvent = defineConfig({
|
4513
|
-
id: "
|
3593
|
+
id: "TENNIS_CLUB_MEMBERSHIP",
|
4514
3594
|
label: {
|
4515
3595
|
defaultMessage: "Tennis club membership application",
|
4516
3596
|
description: "This is what this event is referred as in the system",
|
4517
3597
|
id: "event.tennis-club-membership.label"
|
4518
3598
|
},
|
4519
|
-
title: {
|
4520
|
-
defaultMessage: "{applicant.firstname} {applicant.surname}",
|
4521
|
-
description: "This is the title of the summary",
|
4522
|
-
id: "v2.event.tennis-club-membership.title"
|
4523
|
-
},
|
4524
3599
|
summary: {
|
3600
|
+
title: {
|
3601
|
+
id: "event.tennis-club-membership.summary.title",
|
3602
|
+
label: {
|
3603
|
+
defaultMessage: "{applicant.firstname} {applicant.surname}",
|
3604
|
+
description: "This is the title of the summary",
|
3605
|
+
id: "v2.event.tennis-club-membership.summary.title"
|
3606
|
+
},
|
3607
|
+
emptyValueMessage: {
|
3608
|
+
defaultMessage: "Membership application",
|
3609
|
+
description: "This is the message shown when the applicant name is missing",
|
3610
|
+
id: "event.tennis-club-membership.summary.title.empty"
|
3611
|
+
}
|
3612
|
+
},
|
4525
3613
|
fields: [
|
4526
3614
|
{
|
4527
3615
|
id: "applicant.firstname",
|
@@ -4542,18 +3630,47 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4542
3630
|
}
|
4543
3631
|
},
|
4544
3632
|
{
|
4545
|
-
|
3633
|
+
id: "applicant.surname",
|
4546
3634
|
label: {
|
4547
3635
|
defaultMessage: "Applicant's last name",
|
4548
|
-
description: "
|
4549
|
-
id: "
|
3636
|
+
description: "This is the label for the field",
|
3637
|
+
id: "event.tennis-club-membership.summary.field.surname.label"
|
3638
|
+
},
|
3639
|
+
value: {
|
3640
|
+
defaultMessage: "{applicant.surname}",
|
3641
|
+
description: "This is the value to show in the summary",
|
3642
|
+
id: "event.tennis-club-membership.summary.field.surname"
|
3643
|
+
},
|
3644
|
+
emptyValueMessage: {
|
3645
|
+
defaultMessage: "Last name is not provided",
|
3646
|
+
description: "This is the message to show when the field is empty",
|
3647
|
+
id: "event.tennis-club-membership.summary.field.surname.empty"
|
4550
3648
|
}
|
4551
|
-
},
|
4552
|
-
{
|
4553
|
-
fieldId: "applicant.email"
|
4554
3649
|
}
|
4555
3650
|
]
|
4556
3651
|
},
|
3652
|
+
workqueues: [
|
3653
|
+
{
|
3654
|
+
id: "all",
|
3655
|
+
filters: []
|
3656
|
+
},
|
3657
|
+
{
|
3658
|
+
id: "ready-for-review",
|
3659
|
+
filters: [
|
3660
|
+
{
|
3661
|
+
status: ["DECLARED"]
|
3662
|
+
}
|
3663
|
+
]
|
3664
|
+
},
|
3665
|
+
{
|
3666
|
+
id: "registered",
|
3667
|
+
filters: [
|
3668
|
+
{
|
3669
|
+
status: ["REGISTERED"]
|
3670
|
+
}
|
3671
|
+
]
|
3672
|
+
}
|
3673
|
+
],
|
4557
3674
|
actions: [
|
4558
3675
|
{
|
4559
3676
|
type: ActionType.DECLARE,
|
@@ -4857,61 +3974,19 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4857
3974
|
advancedSearch: [
|
4858
3975
|
{
|
4859
3976
|
title: {
|
4860
|
-
defaultMessage: "
|
4861
|
-
description: "
|
4862
|
-
id: "v2.
|
4863
|
-
},
|
4864
|
-
fields: [
|
4865
|
-
event("legalStatus.REGISTERED.createdAtLocation").exact(),
|
4866
|
-
event("legalStatus.REGISTERED.createdAt").range(),
|
4867
|
-
event("status", statusOptions).exact(),
|
4868
|
-
event("updatedAt", timePeriodOptions).range()
|
4869
|
-
]
|
4870
|
-
},
|
4871
|
-
{
|
4872
|
-
title: {
|
4873
|
-
defaultMessage: "Applicant's details",
|
4874
|
-
description: "Applicant details search field section title",
|
4875
|
-
id: "v2.event.tennis-club-membership.search.applicants"
|
4876
|
-
},
|
4877
|
-
fields: [
|
4878
|
-
field("applicant.firstname").fuzzy(),
|
4879
|
-
field("applicant.surname").fuzzy(),
|
4880
|
-
field("applicant.dob").range(),
|
4881
|
-
field("applicant.email").exact()
|
4882
|
-
]
|
4883
|
-
},
|
4884
|
-
{
|
4885
|
-
title: {
|
4886
|
-
defaultMessage: "Recommender's details",
|
4887
|
-
description: "Recommender details search field section title",
|
4888
|
-
id: "v2.event.tennis-club-membership.search.recommender"
|
3977
|
+
defaultMessage: "Tennis club registration search",
|
3978
|
+
description: "This is what this event is referred as in the system",
|
3979
|
+
id: "v2.event.tennis-club-membership.search"
|
4889
3980
|
},
|
4890
3981
|
fields: [
|
4891
|
-
|
4892
|
-
|
3982
|
+
{
|
3983
|
+
fieldId: "applicant.dob"
|
3984
|
+
}
|
4893
3985
|
]
|
4894
3986
|
}
|
4895
3987
|
],
|
4896
3988
|
declaration: TENNIS_CLUB_DECLARATION_FORM
|
4897
3989
|
});
|
4898
|
-
var WorkqueueFixture = defineWorkqueues([
|
4899
|
-
{
|
4900
|
-
columns: [],
|
4901
|
-
slug: "in-progress",
|
4902
|
-
name: {
|
4903
|
-
id: "workqueues.inProgress.title",
|
4904
|
-
defaultMessage: "In progress",
|
4905
|
-
description: "Title of in progress workqueue"
|
4906
|
-
},
|
4907
|
-
query: {
|
4908
|
-
type: "and",
|
4909
|
-
clauses: [{ eventType: tennisClubMembershipEvent.id }]
|
4910
|
-
},
|
4911
|
-
actions: [],
|
4912
|
-
icon: "Draft"
|
4913
|
-
}
|
4914
|
-
]);
|
4915
3990
|
|
4916
3991
|
// ../commons/src/events/test.utils.ts
|
4917
3992
|
function fieldConfigsToActionPayload(fields) {
|
@@ -4940,10 +4015,10 @@ function generateActionAnnotationInput(configuration, action) {
|
|
4940
4015
|
);
|
4941
4016
|
const annotationFields = actionConfig ? getActionAnnotationFields(actionConfig) : [];
|
4942
4017
|
const annotation = fieldConfigsToActionPayload(annotationFields);
|
4943
|
-
const visibleVerificationPageIds =
|
4944
|
-
|
4945
|
-
|
4946
|
-
);
|
4018
|
+
const visibleVerificationPageIds = findRecordActionPages(
|
4019
|
+
configuration,
|
4020
|
+
action
|
4021
|
+
).filter((page) => isVerificationPage(page)).filter((page) => isPageVisible(page, annotation)).map((page) => page.id);
|
4947
4022
|
const visiblePageVerificationMap = visibleVerificationPageIds.reduce(
|
4948
4023
|
(acc, pageId) => ({
|
4949
4024
|
...acc,
|
@@ -4960,11 +4035,11 @@ function generateActionAnnotationInput(configuration, action) {
|
|
4960
4035
|
var eventPayloadGenerator = {
|
4961
4036
|
create: (input = {}) => ({
|
4962
4037
|
transactionId: input.transactionId ?? getUUID(),
|
4963
|
-
type: input.type ?? "
|
4038
|
+
type: input.type ?? "TENNIS_CLUB_MEMBERSHIP"
|
4964
4039
|
}),
|
4965
4040
|
patch: (id, input = {}) => ({
|
4966
4041
|
transactionId: input.transactionId ?? getUUID(),
|
4967
|
-
type: input.type ?? "
|
4042
|
+
type: input.type ?? "TENNIS_CLUB_MEMBERSHIP",
|
4968
4043
|
id
|
4969
4044
|
}),
|
4970
4045
|
draft: ({ eventId, actionType }, input = {}) => (0, import_lodash2.merge)(
|
@@ -4974,7 +4049,6 @@ var eventPayloadGenerator = {
|
|
4974
4049
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
4975
4050
|
transactionId: getUUID(),
|
4976
4051
|
action: {
|
4977
|
-
transactionId: getUUID(),
|
4978
4052
|
type: actionType,
|
4979
4053
|
status: ActionStatus.Accepted,
|
4980
4054
|
declaration: {
|
@@ -4989,7 +4063,6 @@ var eventPayloadGenerator = {
|
|
4989
4063
|
},
|
4990
4064
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
4991
4065
|
createdBy: "@todo",
|
4992
|
-
createdByRole: "@todo",
|
4993
4066
|
createdAtLocation: "@todo"
|
4994
4067
|
}
|
4995
4068
|
},
|
@@ -5151,14 +4224,12 @@ function generateActionDocument({
|
|
5151
4224
|
// @TODO: This should be fixed in the future.
|
5152
4225
|
createdAt: new Date(Date.now() - 500).toISOString(),
|
5153
4226
|
createdBy: getUUID(),
|
5154
|
-
createdByRole: "FIELD_AGENT",
|
5155
4227
|
id: getUUID(),
|
5156
|
-
createdAtLocation: "
|
4228
|
+
createdAtLocation: "TODO",
|
5157
4229
|
declaration: generateActionDeclarationInput(configuration, action),
|
5158
4230
|
annotation: {},
|
5159
|
-
|
5160
|
-
|
5161
|
-
...defaults
|
4231
|
+
...defaults,
|
4232
|
+
status: ActionStatus.Accepted
|
5162
4233
|
};
|
5163
4234
|
switch (action) {
|
5164
4235
|
case ActionType.READ:
|
@@ -5238,100 +4309,29 @@ function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE, de
|
|
5238
4309
|
eventId
|
5239
4310
|
};
|
5240
4311
|
}
|
5241
|
-
function getEventStatus() {
|
5242
|
-
const statuses = [
|
5243
|
-
EventStatus.CREATED,
|
5244
|
-
EventStatus.REGISTERED,
|
5245
|
-
EventStatus.DECLARED
|
5246
|
-
];
|
5247
|
-
const randomIndex = Math.floor(Math.random() * 3);
|
5248
|
-
return statuses[randomIndex];
|
5249
|
-
}
|
5250
|
-
function getTrackingId() {
|
5251
|
-
const uuid = getUUID().replace(/-/g, "");
|
5252
|
-
const trackingId = uuid.slice(0, 6).toUpperCase();
|
5253
|
-
return trackingId;
|
5254
|
-
}
|
5255
|
-
function getRandomApplicant() {
|
5256
|
-
const firstNames = [
|
5257
|
-
"Danny",
|
5258
|
-
"John",
|
5259
|
-
"Jane",
|
5260
|
-
"Emily",
|
5261
|
-
"Michael",
|
5262
|
-
"Sarah",
|
5263
|
-
"Chris",
|
5264
|
-
"Jessica"
|
5265
|
-
];
|
5266
|
-
const surnames = [
|
5267
|
-
"Doe",
|
5268
|
-
"Smith",
|
5269
|
-
"Johnson",
|
5270
|
-
"Brown",
|
5271
|
-
"Williams",
|
5272
|
-
"Jones",
|
5273
|
-
"Garcia",
|
5274
|
-
"Miller"
|
5275
|
-
];
|
5276
|
-
function getRandomDate(start, end) {
|
5277
|
-
const randomDate = new Date(
|
5278
|
-
start.getTime() + Math.random() * (end.getTime() - start.getTime())
|
5279
|
-
);
|
5280
|
-
return randomDate.toISOString().split("T")[0];
|
5281
|
-
}
|
5282
|
-
const randomFirstName = firstNames[Math.floor(Math.random() * firstNames.length)];
|
5283
|
-
const randomSurname = surnames[Math.floor(Math.random() * surnames.length)];
|
5284
|
-
const randomDob = getRandomDate(
|
5285
|
-
/* @__PURE__ */ new Date("1990-01-01"),
|
5286
|
-
/* @__PURE__ */ new Date("2010-12-31")
|
5287
|
-
);
|
5288
|
-
return {
|
5289
|
-
"recommender.none": true,
|
5290
|
-
"applicant.firstname": randomFirstName,
|
5291
|
-
"applicant.surname": randomSurname,
|
5292
|
-
"applicant.dob": randomDob
|
5293
|
-
};
|
5294
|
-
}
|
5295
4312
|
var eventQueryDataGenerator = (overrides = {}) => ({
|
5296
4313
|
id: overrides.id ?? getUUID(),
|
5297
|
-
title: overrides.title ?? "Danny Doe",
|
5298
4314
|
type: overrides.type ?? "tennis-club-membership",
|
5299
|
-
status: overrides.status ??
|
4315
|
+
status: overrides.status ?? "REGISTERED",
|
5300
4316
|
createdAt: overrides.createdAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
5301
4317
|
createdBy: overrides.createdBy ?? getUUID(),
|
5302
4318
|
createdAtLocation: overrides.createdAtLocation ?? getUUID(),
|
5303
|
-
|
5304
|
-
updatedAt: overrides.updatedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
4319
|
+
modifiedAt: overrides.modifiedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
5305
4320
|
assignedTo: overrides.assignedTo ?? null,
|
5306
4321
|
updatedBy: overrides.updatedBy ?? getUUID(),
|
5307
|
-
|
5308
|
-
|
5309
|
-
|
5310
|
-
|
5311
|
-
|
4322
|
+
declaration: overrides.declaration ?? {
|
4323
|
+
"recommender.none": true,
|
4324
|
+
"applicant.firstname": "Danny",
|
4325
|
+
"applicant.surname": "Doe",
|
4326
|
+
"applicant.dob": "1999-11-11"
|
4327
|
+
},
|
4328
|
+
trackingId: overrides.trackingId ?? "M3F8YQ"
|
5312
4329
|
});
|
5313
4330
|
var generateTranslationConfig = (message) => ({
|
5314
4331
|
defaultMessage: message,
|
5315
4332
|
description: "Description for ${message}",
|
5316
4333
|
id: message
|
5317
4334
|
});
|
5318
|
-
var generateWorkqueues = (slug = "all-events") => defineWorkqueues([
|
5319
|
-
{
|
5320
|
-
slug,
|
5321
|
-
name: {
|
5322
|
-
id: "workqueues.inProgress.title",
|
5323
|
-
defaultMessage: slug.charAt(0).toUpperCase() + slug.slice(1).split("-").join(" "),
|
5324
|
-
description: "Title of in progress workqueue"
|
5325
|
-
},
|
5326
|
-
query: {
|
5327
|
-
type: "and",
|
5328
|
-
clauses: [{ eventType: tennisClubMembershipEvent.id }]
|
5329
|
-
},
|
5330
|
-
actions: [],
|
5331
|
-
icon: "Draft",
|
5332
|
-
columns: []
|
5333
|
-
}
|
5334
|
-
]);
|
5335
4335
|
|
5336
4336
|
// ../commons/src/events/TemplateConfig.ts
|
5337
4337
|
function isTemplateVariable(value) {
|
@@ -5364,389 +4364,3 @@ function isFieldConfigDefaultValue(value) {
|
|
5364
4364
|
}
|
5365
4365
|
return false;
|
5366
4366
|
}
|
5367
|
-
|
5368
|
-
// ../commons/src/events/scopes.ts
|
5369
|
-
var import_lodash3 = require("lodash");
|
5370
|
-
|
5371
|
-
// ../commons/src/scopes.ts
|
5372
|
-
var import_zod30 = require("zod");
|
5373
|
-
var SCOPES = {
|
5374
|
-
// TODO v1.8 legacy scopes
|
5375
|
-
NATLSYSADMIN: "natlsysadmin",
|
5376
|
-
BYPASSRATELIMIT: "bypassratelimit",
|
5377
|
-
DECLARE: "declare",
|
5378
|
-
REGISTER: "register",
|
5379
|
-
VALIDATE: "validate",
|
5380
|
-
DEMO: "demo",
|
5381
|
-
CERTIFY: "certify",
|
5382
|
-
PERFORMANCE: "performance",
|
5383
|
-
SYSADMIN: "sysadmin",
|
5384
|
-
TEAMS: "teams",
|
5385
|
-
CONFIG: "config",
|
5386
|
-
// systems / integrations
|
5387
|
-
WEBHOOK: "webhook",
|
5388
|
-
NATIONALID: "nationalId",
|
5389
|
-
NOTIFICATION_API: "notification-api",
|
5390
|
-
RECORDSEARCH: "recordsearch",
|
5391
|
-
/**
|
5392
|
-
* @TODO This is a temporary scope to be used for V2 Events custom events declaration
|
5393
|
-
*/
|
5394
|
-
RECORD_DECLARE: "record.declare-birth",
|
5395
|
-
// declare
|
5396
|
-
RECORD_DECLARE_BIRTH: "record.declare-birth",
|
5397
|
-
RECORD_DECLARE_BIRTH_MY_JURISDICTION: "record.declare-birth:my-jurisdiction",
|
5398
|
-
RECORD_DECLARE_DEATH: "record.declare-death",
|
5399
|
-
RECORD_DECLARE_DEATH_MY_JURISDICTION: "record.declare-death:my-jurisdiction",
|
5400
|
-
RECORD_DECLARE_MARRIAGE: "record.declare-marriage",
|
5401
|
-
RECORD_DECLARE_MARRIAGE_MY_JURISDICTION: "record.declare-marriage:my-jurisdiction",
|
5402
|
-
RECORD_SUBMIT_INCOMPLETE: "record.declaration-submit-incomplete",
|
5403
|
-
RECORD_SUBMIT_FOR_REVIEW: "record.declaration-submit-for-review",
|
5404
|
-
RECORD_UNASSIGN_OTHERS: "record.unassign-others",
|
5405
|
-
// validate
|
5406
|
-
RECORD_SUBMIT_FOR_APPROVAL: "record.declaration-submit-for-approval",
|
5407
|
-
RECORD_SUBMIT_FOR_UPDATES: "record.declaration-submit-for-updates",
|
5408
|
-
RECORD_DECLARATION_EDIT: "record.declaration-edit",
|
5409
|
-
RECORD_REVIEW_DUPLICATES: "record.review-duplicates",
|
5410
|
-
RECORD_DECLARATION_ARCHIVE: "record.declaration-archive",
|
5411
|
-
RECORD_DECLARATION_REINSTATE: "record.declaration-reinstate",
|
5412
|
-
// register
|
5413
|
-
RECORD_REGISTER: "record.register",
|
5414
|
-
// certify
|
5415
|
-
RECORD_EXPORT_RECORDS: "record.export-records",
|
5416
|
-
RECORD_DECLARATION_PRINT: "record.declaration-print",
|
5417
|
-
RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS: "record.declaration-print-supporting-documents",
|
5418
|
-
RECORD_REGISTRATION_PRINT: "record.registration-print",
|
5419
|
-
// v1.8
|
5420
|
-
/**
|
5421
|
-
* This scope is used to **print and **issue certified copies of a record
|
5422
|
-
* after it has been registered. Previously Registrars had this permission.
|
5423
|
-
*/
|
5424
|
-
RECORD_PRINT_ISSUE_CERTIFIED_COPIES: "record.registration-print&issue-certified-copies",
|
5425
|
-
RECORD_PRINT_CERTIFIED_COPIES: "record.registration-print-certified-copies",
|
5426
|
-
// v1.8
|
5427
|
-
RECORD_BULK_PRINT_CERTIFIED_COPIES: "record.registration-bulk-print-certified-copies",
|
5428
|
-
// v1.8
|
5429
|
-
RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES: "record.registration-verify-certified-copies",
|
5430
|
-
// v1.8
|
5431
|
-
// correct
|
5432
|
-
RECORD_REGISTRATION_REQUEST_CORRECTION: "record.registration-request-correction",
|
5433
|
-
RECORD_REGISTRATION_CORRECT: "record.registration-correct",
|
5434
|
-
RECORD_REGISTRATION_REQUEST_REVOCATION: "record.registration-request-revocation",
|
5435
|
-
// v1.8
|
5436
|
-
RECORD_REGISTRATION_REVOKE: "record.registration-revoke",
|
5437
|
-
// v1.8
|
5438
|
-
RECORD_REGISTRATION_REQUEST_REINSTATEMENT: "record.registration-request-reinstatement",
|
5439
|
-
// v1.8
|
5440
|
-
RECORD_REGISTRATION_REINSTATE: "record.registration-reinstate",
|
5441
|
-
// v1.8
|
5442
|
-
RECORD_CONFIRM_REGISTRATION: "record.confirm-registration",
|
5443
|
-
RECORD_REJECT_REGISTRATION: "record.reject-registration",
|
5444
|
-
// search
|
5445
|
-
SEARCH_BIRTH_MY_JURISDICTION: "search.birth:my-jurisdiction",
|
5446
|
-
SEARCH_BIRTH: "search.birth",
|
5447
|
-
SEARCH_DEATH_MY_JURISDICTION: "search.death:my-jurisdiction",
|
5448
|
-
SEARCH_DEATH: "search.death",
|
5449
|
-
SEARCH_MARRIAGE_MY_JURISDICTION: "search.marriage:my-jurisdiction",
|
5450
|
-
SEARCH_MARRIAGE: "search.marriage",
|
5451
|
-
// audit v1.8
|
5452
|
-
RECORD_READ: "record.read",
|
5453
|
-
RECORD_READ_AUDIT: "record.read-audit",
|
5454
|
-
RECORD_READ_COMMENTS: "record.read-comments",
|
5455
|
-
RECORD_CREATE_COMMENTS: "record.create-comments",
|
5456
|
-
// profile
|
5457
|
-
PROFILE_UPDATE: "profile.update",
|
5458
|
-
//v1.8
|
5459
|
-
PROFILE_ELECTRONIC_SIGNATURE: "profile.electronic-signature",
|
5460
|
-
// performance
|
5461
|
-
PERFORMANCE_READ: "performance.read",
|
5462
|
-
PERFORMANCE_READ_DASHBOARDS: "performance.read-dashboards",
|
5463
|
-
PERFORMANCE_EXPORT_VITAL_STATISTICS: "performance.vital-statistics-export",
|
5464
|
-
// organisation
|
5465
|
-
ORGANISATION_READ_LOCATIONS: "organisation.read-locations:all",
|
5466
|
-
ORGANISATION_READ_LOCATIONS_MY_OFFICE: "organisation.read-locations:my-office",
|
5467
|
-
ORGANISATION_READ_LOCATIONS_MY_JURISDICTION: "organisation.read-locations:my-jurisdiction",
|
5468
|
-
// user
|
5469
|
-
USER_READ: "user.read:all",
|
5470
|
-
USER_READ_MY_OFFICE: "user.read:my-office",
|
5471
|
-
USER_READ_MY_JURISDICTION: "user.read:my-jurisdiction",
|
5472
|
-
USER_READ_ONLY_MY_AUDIT: "user.read:only-my-audit",
|
5473
|
-
//v1.8
|
5474
|
-
USER_CREATE: "user.create:all",
|
5475
|
-
USER_CREATE_MY_JURISDICTION: "user.create:my-jurisdiction",
|
5476
|
-
USER_UPDATE: "user.update:all",
|
5477
|
-
USER_UPDATE_MY_JURISDICTION: "user.update:my-jurisdiction",
|
5478
|
-
// config
|
5479
|
-
CONFIG_UPDATE_ALL: "config.update:all",
|
5480
|
-
// data seeding
|
5481
|
-
USER_DATA_SEEDING: "user.data-seeding"
|
5482
|
-
};
|
5483
|
-
var LiteralScopes = import_zod30.z.union([
|
5484
|
-
import_zod30.z.literal(SCOPES.NATLSYSADMIN),
|
5485
|
-
import_zod30.z.literal(SCOPES.BYPASSRATELIMIT),
|
5486
|
-
import_zod30.z.literal(SCOPES.DECLARE),
|
5487
|
-
import_zod30.z.literal(SCOPES.REGISTER),
|
5488
|
-
import_zod30.z.literal(SCOPES.VALIDATE),
|
5489
|
-
import_zod30.z.literal(SCOPES.DEMO),
|
5490
|
-
import_zod30.z.literal(SCOPES.CERTIFY),
|
5491
|
-
import_zod30.z.literal(SCOPES.PERFORMANCE),
|
5492
|
-
import_zod30.z.literal(SCOPES.SYSADMIN),
|
5493
|
-
import_zod30.z.literal(SCOPES.TEAMS),
|
5494
|
-
import_zod30.z.literal(SCOPES.CONFIG),
|
5495
|
-
import_zod30.z.literal(SCOPES.WEBHOOK),
|
5496
|
-
import_zod30.z.literal(SCOPES.NATIONALID),
|
5497
|
-
import_zod30.z.literal(SCOPES.NOTIFICATION_API),
|
5498
|
-
import_zod30.z.literal(SCOPES.RECORDSEARCH),
|
5499
|
-
import_zod30.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
|
5500
|
-
import_zod30.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
|
5501
|
-
import_zod30.z.literal(SCOPES.RECORD_DECLARE_DEATH),
|
5502
|
-
import_zod30.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
|
5503
|
-
import_zod30.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
|
5504
|
-
import_zod30.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
|
5505
|
-
import_zod30.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
|
5506
|
-
import_zod30.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW),
|
5507
|
-
import_zod30.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS),
|
5508
|
-
import_zod30.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
|
5509
|
-
import_zod30.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
|
5510
|
-
import_zod30.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
|
5511
|
-
import_zod30.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
|
5512
|
-
import_zod30.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
|
5513
|
-
import_zod30.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE),
|
5514
|
-
import_zod30.z.literal(SCOPES.RECORD_REGISTER),
|
5515
|
-
import_zod30.z.literal(SCOPES.RECORD_EXPORT_RECORDS),
|
5516
|
-
import_zod30.z.literal(SCOPES.RECORD_DECLARATION_PRINT),
|
5517
|
-
import_zod30.z.literal(SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS),
|
5518
|
-
import_zod30.z.literal(SCOPES.RECORD_REGISTRATION_PRINT),
|
5519
|
-
import_zod30.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
|
5520
|
-
import_zod30.z.literal(SCOPES.RECORD_PRINT_CERTIFIED_COPIES),
|
5521
|
-
import_zod30.z.literal(SCOPES.RECORD_BULK_PRINT_CERTIFIED_COPIES),
|
5522
|
-
import_zod30.z.literal(SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES),
|
5523
|
-
import_zod30.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
|
5524
|
-
import_zod30.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
|
5525
|
-
import_zod30.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REVOCATION),
|
5526
|
-
import_zod30.z.literal(SCOPES.RECORD_REGISTRATION_REVOKE),
|
5527
|
-
import_zod30.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REINSTATEMENT),
|
5528
|
-
import_zod30.z.literal(SCOPES.RECORD_REGISTRATION_REINSTATE),
|
5529
|
-
import_zod30.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
|
5530
|
-
import_zod30.z.literal(SCOPES.RECORD_REJECT_REGISTRATION),
|
5531
|
-
import_zod30.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
|
5532
|
-
import_zod30.z.literal(SCOPES.SEARCH_BIRTH),
|
5533
|
-
import_zod30.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
|
5534
|
-
import_zod30.z.literal(SCOPES.SEARCH_DEATH),
|
5535
|
-
import_zod30.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
|
5536
|
-
import_zod30.z.literal(SCOPES.SEARCH_MARRIAGE),
|
5537
|
-
import_zod30.z.literal(SCOPES.RECORD_READ),
|
5538
|
-
import_zod30.z.literal(SCOPES.RECORD_READ_AUDIT),
|
5539
|
-
import_zod30.z.literal(SCOPES.RECORD_READ_COMMENTS),
|
5540
|
-
import_zod30.z.literal(SCOPES.RECORD_CREATE_COMMENTS),
|
5541
|
-
import_zod30.z.literal(SCOPES.PROFILE_UPDATE),
|
5542
|
-
import_zod30.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE),
|
5543
|
-
import_zod30.z.literal(SCOPES.PERFORMANCE_READ),
|
5544
|
-
import_zod30.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
|
5545
|
-
import_zod30.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS),
|
5546
|
-
import_zod30.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
|
5547
|
-
import_zod30.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
|
5548
|
-
import_zod30.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION),
|
5549
|
-
import_zod30.z.literal(SCOPES.USER_READ),
|
5550
|
-
import_zod30.z.literal(SCOPES.USER_READ_MY_OFFICE),
|
5551
|
-
import_zod30.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
|
5552
|
-
import_zod30.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
|
5553
|
-
import_zod30.z.literal(SCOPES.USER_CREATE),
|
5554
|
-
import_zod30.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
|
5555
|
-
import_zod30.z.literal(SCOPES.USER_UPDATE),
|
5556
|
-
import_zod30.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION),
|
5557
|
-
import_zod30.z.literal(SCOPES.CONFIG_UPDATE_ALL),
|
5558
|
-
import_zod30.z.literal(SCOPES.USER_DATA_SEEDING)
|
5559
|
-
]);
|
5560
|
-
var rawConfigurableScopeRegex = /^([a-zA-Z\.]+)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
|
5561
|
-
var rawConfigurableScope = import_zod30.z.string().regex(rawConfigurableScopeRegex);
|
5562
|
-
var CreateUserScope = import_zod30.z.object({
|
5563
|
-
type: import_zod30.z.literal("user.create"),
|
5564
|
-
options: import_zod30.z.object({
|
5565
|
-
role: import_zod30.z.array(import_zod30.z.string())
|
5566
|
-
})
|
5567
|
-
});
|
5568
|
-
var EditUserScope = import_zod30.z.object({
|
5569
|
-
type: import_zod30.z.literal("user.edit"),
|
5570
|
-
options: import_zod30.z.object({
|
5571
|
-
role: import_zod30.z.array(import_zod30.z.string())
|
5572
|
-
})
|
5573
|
-
});
|
5574
|
-
var WorkqueueScope = import_zod30.z.object({
|
5575
|
-
type: import_zod30.z.literal("workqueue"),
|
5576
|
-
options: import_zod30.z.object({
|
5577
|
-
id: import_zod30.z.array(import_zod30.z.string())
|
5578
|
-
})
|
5579
|
-
});
|
5580
|
-
var NotifyRecordScope = import_zod30.z.object({
|
5581
|
-
type: import_zod30.z.literal("record.notify"),
|
5582
|
-
options: import_zod30.z.object({
|
5583
|
-
event: import_zod30.z.array(import_zod30.z.string())
|
5584
|
-
})
|
5585
|
-
});
|
5586
|
-
var ConfigurableScopes = import_zod30.z.discriminatedUnion("type", [
|
5587
|
-
CreateUserScope,
|
5588
|
-
EditUserScope,
|
5589
|
-
WorkqueueScope,
|
5590
|
-
NotifyRecordScope
|
5591
|
-
]);
|
5592
|
-
var scopes = Object.values(SCOPES);
|
5593
|
-
|
5594
|
-
// ../commons/src/events/scopes.ts
|
5595
|
-
var CONFIG_GET_ALLOWED_SCOPES = [
|
5596
|
-
SCOPES.RECORD_DECLARE,
|
5597
|
-
SCOPES.RECORD_READ,
|
5598
|
-
SCOPES.RECORD_SUBMIT_INCOMPLETE,
|
5599
|
-
SCOPES.RECORD_SUBMIT_FOR_REVIEW,
|
5600
|
-
SCOPES.RECORD_REGISTER,
|
5601
|
-
SCOPES.RECORD_EXPORT_RECORDS,
|
5602
|
-
SCOPES.CONFIG,
|
5603
|
-
SCOPES.CONFIG_UPDATE_ALL
|
5604
|
-
];
|
5605
|
-
var CONFIG_SEARCH_ALLOWED_SCOPES = [
|
5606
|
-
SCOPES.SEARCH_BIRTH,
|
5607
|
-
SCOPES.SEARCH_DEATH,
|
5608
|
-
SCOPES.SEARCH_MARRIAGE,
|
5609
|
-
SCOPES.SEARCH_BIRTH_MY_JURISDICTION,
|
5610
|
-
SCOPES.SEARCH_DEATH_MY_JURISDICTION,
|
5611
|
-
SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION
|
5612
|
-
];
|
5613
|
-
var ACTION_ALLOWED_SCOPES = {
|
5614
|
-
[ActionType.READ]: [
|
5615
|
-
SCOPES.RECORD_DECLARE,
|
5616
|
-
SCOPES.RECORD_READ,
|
5617
|
-
SCOPES.RECORD_SUBMIT_INCOMPLETE,
|
5618
|
-
SCOPES.RECORD_SUBMIT_FOR_REVIEW,
|
5619
|
-
SCOPES.RECORD_REGISTER,
|
5620
|
-
SCOPES.RECORD_EXPORT_RECORDS
|
5621
|
-
],
|
5622
|
-
[ActionType.CREATE]: [
|
5623
|
-
SCOPES.RECORD_DECLARE,
|
5624
|
-
SCOPES.RECORD_SUBMIT_INCOMPLETE,
|
5625
|
-
SCOPES.RECORD_SUBMIT_FOR_REVIEW
|
5626
|
-
],
|
5627
|
-
[ActionType.NOTIFY]: [SCOPES.RECORD_SUBMIT_INCOMPLETE],
|
5628
|
-
[ActionType.DECLARE]: [
|
5629
|
-
SCOPES.RECORD_DECLARE,
|
5630
|
-
SCOPES.RECORD_SUBMIT_FOR_APPROVAL,
|
5631
|
-
SCOPES.RECORD_REGISTER
|
5632
|
-
],
|
5633
|
-
[ActionType.DELETE]: [SCOPES.RECORD_DECLARE],
|
5634
|
-
[ActionType.VALIDATE]: [
|
5635
|
-
SCOPES.RECORD_SUBMIT_FOR_APPROVAL,
|
5636
|
-
SCOPES.RECORD_REGISTER
|
5637
|
-
],
|
5638
|
-
[ActionType.REGISTER]: [SCOPES.RECORD_REGISTER],
|
5639
|
-
[ActionType.PRINT_CERTIFICATE]: [SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES],
|
5640
|
-
[ActionType.REQUEST_CORRECTION]: [
|
5641
|
-
SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION
|
5642
|
-
],
|
5643
|
-
[ActionType.REJECT_CORRECTION]: [SCOPES.RECORD_REGISTRATION_CORRECT],
|
5644
|
-
[ActionType.APPROVE_CORRECTION]: [SCOPES.RECORD_REGISTRATION_CORRECT],
|
5645
|
-
[ActionType.MARKED_AS_DUPLICATE]: [SCOPES.RECORD_DECLARATION_ARCHIVE],
|
5646
|
-
[ActionType.ARCHIVE]: [SCOPES.RECORD_DECLARATION_ARCHIVE],
|
5647
|
-
[ActionType.REJECT]: [SCOPES.RECORD_SUBMIT_FOR_UPDATES],
|
5648
|
-
[ActionType.ASSIGN]: null,
|
5649
|
-
[ActionType.UNASSIGN]: null,
|
5650
|
-
[ActionType.DETECT_DUPLICATE]: []
|
5651
|
-
};
|
5652
|
-
var ACTION_ALLOWED_CONFIGURABLE_SCOPES = {
|
5653
|
-
[ActionType.READ]: [],
|
5654
|
-
[ActionType.CREATE]: ["record.notify"],
|
5655
|
-
[ActionType.NOTIFY]: ["record.notify"],
|
5656
|
-
[ActionType.DECLARE]: [],
|
5657
|
-
[ActionType.DELETE]: [],
|
5658
|
-
[ActionType.VALIDATE]: [],
|
5659
|
-
[ActionType.REGISTER]: [],
|
5660
|
-
[ActionType.PRINT_CERTIFICATE]: [],
|
5661
|
-
[ActionType.REQUEST_CORRECTION]: [],
|
5662
|
-
[ActionType.REJECT_CORRECTION]: [],
|
5663
|
-
[ActionType.APPROVE_CORRECTION]: [],
|
5664
|
-
[ActionType.MARKED_AS_DUPLICATE]: [],
|
5665
|
-
[ActionType.ARCHIVE]: [],
|
5666
|
-
[ActionType.REJECT]: [],
|
5667
|
-
[ActionType.ASSIGN]: [],
|
5668
|
-
[ActionType.UNASSIGN]: [],
|
5669
|
-
[ActionType.DETECT_DUPLICATE]: []
|
5670
|
-
};
|
5671
|
-
function hasAnyOfScopes(a, b) {
|
5672
|
-
return (0, import_lodash3.intersection)(a, b).length > 0;
|
5673
|
-
}
|
5674
|
-
function filterUnallowedActions(actions, userScopes) {
|
5675
|
-
const allowedActions = actions.filter((action) => {
|
5676
|
-
const requiredScopes = ACTION_ALLOWED_SCOPES[action];
|
5677
|
-
if (requiredScopes === null) {
|
5678
|
-
return true;
|
5679
|
-
}
|
5680
|
-
return hasAnyOfScopes(userScopes, requiredScopes);
|
5681
|
-
});
|
5682
|
-
const hasOtherAllowedActions = allowedActions.some(
|
5683
|
-
(action) => action !== ActionType.READ && action !== ActionType.ASSIGN && action !== ActionType.UNASSIGN
|
5684
|
-
);
|
5685
|
-
if (hasOtherAllowedActions) {
|
5686
|
-
return allowedActions;
|
5687
|
-
}
|
5688
|
-
return [ActionType.READ];
|
5689
|
-
}
|
5690
|
-
|
5691
|
-
// ../commons/src/events/serializers/user/deserializer.ts
|
5692
|
-
var import_zod31 = require("zod");
|
5693
|
-
var UserWithPrimaryOffice = User.extend({
|
5694
|
-
primaryOfficeId: import_zod31.z.string()
|
5695
|
-
});
|
5696
|
-
function userDeserializer(serializedUserField, user2) {
|
5697
|
-
if (typeof serializedUserField === "string") {
|
5698
|
-
return serializedUserField;
|
5699
|
-
}
|
5700
|
-
if (serializedUserField.$userField === "id") {
|
5701
|
-
return user2[serializedUserField.$userField];
|
5702
|
-
}
|
5703
|
-
if (serializedUserField.$userField === "primaryOfficeId") {
|
5704
|
-
return user2[serializedUserField.$userField];
|
5705
|
-
}
|
5706
|
-
return "ToDo";
|
5707
|
-
}
|
5708
|
-
function deserializeQueryExpression(expression, user2) {
|
5709
|
-
return {
|
5710
|
-
...expression,
|
5711
|
-
assignedTo: expression.assignedTo && {
|
5712
|
-
...expression.assignedTo,
|
5713
|
-
term: userDeserializer(expression.assignedTo.term, user2)
|
5714
|
-
},
|
5715
|
-
createdBy: expression.createdBy && {
|
5716
|
-
...expression.createdBy,
|
5717
|
-
term: userDeserializer(expression.createdBy.term, user2)
|
5718
|
-
},
|
5719
|
-
updatedBy: expression.updatedBy && {
|
5720
|
-
...expression.updatedBy,
|
5721
|
-
term: userDeserializer(expression.updatedBy.term, user2)
|
5722
|
-
},
|
5723
|
-
createdAtLocation: expression.createdAtLocation && (expression.createdAtLocation.type === "within" ? {
|
5724
|
-
...expression.createdAtLocation,
|
5725
|
-
location: userDeserializer(
|
5726
|
-
expression.createdAtLocation.location,
|
5727
|
-
user2
|
5728
|
-
)
|
5729
|
-
} : {
|
5730
|
-
...expression.createdAtLocation,
|
5731
|
-
term: userDeserializer(expression.createdAtLocation.term, user2)
|
5732
|
-
}),
|
5733
|
-
updatedAtLocation: expression.updatedAtLocation && (expression.updatedAtLocation.type === "within" ? {
|
5734
|
-
...expression.updatedAtLocation,
|
5735
|
-
location: userDeserializer(
|
5736
|
-
expression.updatedAtLocation.location,
|
5737
|
-
user2
|
5738
|
-
)
|
5739
|
-
} : {
|
5740
|
-
...expression.updatedAtLocation,
|
5741
|
-
term: userDeserializer(expression.updatedAtLocation.term, user2)
|
5742
|
-
})
|
5743
|
-
};
|
5744
|
-
}
|
5745
|
-
function deserializeQuery(query, user2) {
|
5746
|
-
return {
|
5747
|
-
...query,
|
5748
|
-
clauses: query.clauses.map(
|
5749
|
-
(clause) => deserializeQueryExpression(clause, user2)
|
5750
|
-
)
|
5751
|
-
};
|
5752
|
-
}
|