@opencrvs/toolkit 1.8.0-rc.f7e4aad → 1.8.0-rc.f807e0d
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 +1822 -10136
- package/dist/commons/conditionals/conditionals.d.ts +1 -12
- package/dist/commons/conditionals/validate.d.ts +8 -0
- package/dist/commons/events/ActionConfig.d.ts +15960 -3820
- package/dist/commons/events/ActionDocument.d.ts +1951 -904
- package/dist/commons/events/ActionInput.d.ts +1680 -780
- package/dist/commons/events/ActionType.d.ts +0 -2
- package/dist/commons/events/AdvancedSearchConfig.d.ts +113 -68
- package/dist/commons/events/CompositeFieldValue.d.ts +9 -9
- package/dist/commons/events/CountryConfigQueryInput.d.ts +1215 -813
- package/dist/commons/events/Draft.d.ts +144 -72
- package/dist/commons/events/EventConfig.d.ts +6459 -1250
- package/dist/commons/events/EventDocument.d.ts +1236 -588
- package/dist/commons/events/EventIndex.d.ts +609 -268
- package/dist/commons/events/EventMetadata.d.ts +9 -7
- package/dist/commons/events/FieldConfig.d.ts +1635 -67
- package/dist/commons/events/FieldType.d.ts +7 -1
- package/dist/commons/events/FieldTypeMapping.d.ts +57 -25
- package/dist/commons/events/FieldValue.d.ts +45 -16
- package/dist/commons/events/FormConfig.d.ts +6488 -1370
- package/dist/commons/events/PageConfig.d.ts +1380 -70
- package/dist/commons/events/User.d.ts +9 -3
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +7 -7
- package/dist/commons/events/WorkqueueConfig.d.ts +2459 -1519
- package/dist/commons/events/defineConfig.d.ts +971 -58
- package/dist/commons/events/event.d.ts +19 -19
- package/dist/commons/events/field.d.ts +17 -1
- package/dist/commons/events/test.utils.d.ts +45 -20
- package/dist/commons/events/utils.d.ts +3323 -267
- package/dist/conditionals/index.js +23 -39
- package/dist/events/index.js +1208 -928
- package/dist/scopes/index.d.ts +92 -6
- package/dist/scopes/index.js +38 -9
- package/package.json +6 -4
- package/tsconfig.json +1 -1
- package/dist/commons/conditionals/conditionals.test.d.ts +0 -2
- package/dist/commons/conditionals/validate-address.test.d.ts +0 -2
- package/dist/commons/conditionals/validate.test.d.ts +0 -2
- package/dist/commons/events/utils.test.d.ts +0 -2
package/dist/events/index.js
CHANGED
@@ -40,6 +40,7 @@ __export(events_exports, {
|
|
40
40
|
ActionConfigBase: () => ActionConfigBase,
|
41
41
|
ActionCreationMetadata: () => ActionCreationMetadata,
|
42
42
|
ActionDocument: () => ActionDocument,
|
43
|
+
ActionFlag: () => ActionFlag,
|
43
44
|
ActionFormConfig: () => ActionFormConfig,
|
44
45
|
ActionInput: () => ActionInput,
|
45
46
|
ActionStatus: () => ActionStatus,
|
@@ -51,6 +52,7 @@ __export(events_exports, {
|
|
51
52
|
AddressType: () => AddressType,
|
52
53
|
AdministrativeAreas: () => AdministrativeAreas,
|
53
54
|
AdvancedSearchConfig: () => AdvancedSearchConfig,
|
55
|
+
AnyFileField: () => AnyFileField,
|
54
56
|
AnyOf: () => AnyOf,
|
55
57
|
AnyOfStatus: () => AnyOfStatus,
|
56
58
|
ApproveCorrectionActionInput: () => ApproveCorrectionActionInput,
|
@@ -74,6 +76,7 @@ __export(events_exports, {
|
|
74
76
|
DataEntry: () => DataEntry,
|
75
77
|
DataFieldValue: () => DataFieldValue,
|
76
78
|
DateCondition: () => DateCondition,
|
79
|
+
DateRangeField: () => DateRangeField,
|
77
80
|
DateRangeFieldValue: () => DateRangeFieldValue,
|
78
81
|
DateValue: () => DateValue,
|
79
82
|
DatetimeValue: () => DatetimeValue,
|
@@ -95,6 +98,7 @@ __export(events_exports, {
|
|
95
98
|
EventDocument: () => EventDocument,
|
96
99
|
EventFieldConfigSchema: () => EventFieldConfigSchema,
|
97
100
|
EventFieldId: () => EventFieldId,
|
101
|
+
EventFieldIdInput: () => EventFieldIdInput,
|
98
102
|
EventIndex: () => EventIndex,
|
99
103
|
EventInput: () => EventInput,
|
100
104
|
EventMetadata: () => EventMetadata,
|
@@ -106,6 +110,7 @@ __export(events_exports, {
|
|
106
110
|
Exact: () => Exact,
|
107
111
|
ExactDate: () => ExactDate,
|
108
112
|
ExactStatus: () => ExactStatus,
|
113
|
+
ExactUserType: () => ExactUserType,
|
109
114
|
FieldConditional: () => FieldConditional,
|
110
115
|
FieldConfig: () => FieldConfig,
|
111
116
|
FieldConfigSchema: () => FieldConfigSchema,
|
@@ -113,6 +118,7 @@ __export(events_exports, {
|
|
113
118
|
FieldType: () => FieldType,
|
114
119
|
FieldUpdateValue: () => FieldUpdateValue,
|
115
120
|
FieldValue: () => FieldValue,
|
121
|
+
FileFieldType: () => FileFieldType,
|
116
122
|
FileFieldValue: () => FileFieldValue,
|
117
123
|
FileFieldValueWithOption: () => FileFieldValueWithOption,
|
118
124
|
FileFieldWithOptionValue: () => FileFieldWithOptionValue,
|
@@ -127,8 +133,10 @@ __export(events_exports, {
|
|
127
133
|
InherentFlags: () => InherentFlags,
|
128
134
|
LanguageConfig: () => LanguageConfig,
|
129
135
|
LegalStatuses: () => LegalStatuses,
|
136
|
+
METADATA_FIELD_PREFIX: () => METADATA_FIELD_PREFIX,
|
130
137
|
MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
|
131
138
|
MimeType: () => MimeType,
|
139
|
+
NameConfig: () => NameConfig,
|
132
140
|
NameFieldUpdateValue: () => NameFieldUpdateValue,
|
133
141
|
NameFieldValue: () => NameFieldValue,
|
134
142
|
NonEmptyTextValue: () => NonEmptyTextValue,
|
@@ -141,7 +149,6 @@ __export(events_exports, {
|
|
141
149
|
QueryInput: () => QueryInput,
|
142
150
|
QueryType: () => QueryType,
|
143
151
|
Range: () => Range,
|
144
|
-
RangeDate: () => RangeDate,
|
145
152
|
ReadActionInput: () => ReadActionInput,
|
146
153
|
RegisterAction: () => RegisterAction,
|
147
154
|
RegisterActionInput: () => RegisterActionInput,
|
@@ -155,13 +162,18 @@ __export(events_exports, {
|
|
155
162
|
RuralAddressValue: () => RuralAddressValue,
|
156
163
|
SearchField: () => SearchField,
|
157
164
|
SearchQueryParams: () => SearchQueryParams,
|
165
|
+
SearchScopeAccessLevels: () => SearchScopeAccessLevels,
|
166
|
+
SelectDateRangeField: () => SelectDateRangeField,
|
167
|
+
SelectDateRangeOption: () => SelectDateRangeOption,
|
168
|
+
SelectDateRangeValue: () => SelectDateRangeValue,
|
158
169
|
SelectOption: () => SelectOption,
|
159
170
|
ShowConditional: () => ShowConditional,
|
160
171
|
SignatureFieldValue: () => SignatureFieldValue,
|
161
|
-
StatusChangingActions: () => StatusChangingActions,
|
162
172
|
SummaryConfig: () => SummaryConfig,
|
163
173
|
TENNIS_CLUB_MEMBERSHIP: () => TENNIS_CLUB_MEMBERSHIP,
|
174
|
+
TEST_SYSTEM_IANA_TIMEZONE: () => TEST_SYSTEM_IANA_TIMEZONE,
|
164
175
|
TestUserRole: () => TestUserRole,
|
176
|
+
TextField: () => TextField,
|
165
177
|
TextValue: () => TextValue,
|
166
178
|
TranslationConfig: () => TranslationConfig,
|
167
179
|
UnassignActionInput: () => UnassignActionInput,
|
@@ -188,14 +200,15 @@ __export(events_exports, {
|
|
188
200
|
alwaysTrue: () => alwaysTrue,
|
189
201
|
and: () => and,
|
190
202
|
annotationActions: () => annotationActions,
|
191
|
-
|
203
|
+
applyDeclarationToEventIndex: () => applyDeclarationToEventIndex,
|
204
|
+
applyDraftToEventIndex: () => applyDraftToEventIndex,
|
192
205
|
areConditionsMet: () => areConditionsMet,
|
193
206
|
compositeFieldTypes: () => compositeFieldTypes,
|
194
207
|
createEmptyDraft: () => createEmptyDraft,
|
195
|
-
createEventConditionals: () => createEventConditionals,
|
196
208
|
createFieldConditionals: () => createFieldConditionals,
|
197
209
|
createPrng: () => createPrng,
|
198
210
|
createValidationSchema: () => createValidationSchema,
|
211
|
+
dangerouslyGetCurrentEventStateWithDrafts: () => dangerouslyGetCurrentEventStateWithDrafts,
|
199
212
|
deepDropNulls: () => deepDropNulls,
|
200
213
|
deepMerge: () => deepMerge,
|
201
214
|
defaultWorkqueueColumns: () => defaultWorkqueueColumns,
|
@@ -217,7 +230,7 @@ __export(events_exports, {
|
|
217
230
|
eventQueryDataGenerator: () => eventQueryDataGenerator,
|
218
231
|
field: () => field,
|
219
232
|
fieldTypes: () => fieldTypes,
|
220
|
-
|
233
|
+
findActiveDraftForEvent: () => findActiveDraftForEvent,
|
221
234
|
findAllFields: () => findAllFields,
|
222
235
|
findLastAssignmentAction: () => findLastAssignmentAction,
|
223
236
|
findRecordActionPages: () => findRecordActionPages,
|
@@ -243,14 +256,15 @@ __export(events_exports, {
|
|
243
256
|
getAnnotationFromDrafts: () => getAnnotationFromDrafts,
|
244
257
|
getAssignedUserFromActions: () => getAssignedUserFromActions,
|
245
258
|
getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
|
259
|
+
getAvailableActionsForEvent: () => getAvailableActionsForEvent,
|
246
260
|
getCurrentEventState: () => getCurrentEventState,
|
247
|
-
getCurrentEventStateWithDrafts: () => getCurrentEventStateWithDrafts,
|
248
261
|
getDeclaration: () => getDeclaration,
|
249
262
|
getDeclarationFieldById: () => getDeclarationFieldById,
|
250
263
|
getDeclarationFields: () => getDeclarationFields,
|
251
264
|
getDeclarationPages: () => getDeclarationPages,
|
252
265
|
getEventConfigById: () => getEventConfigById,
|
253
266
|
getMixedPath: () => getMixedPath,
|
267
|
+
getPrintCertificatePages: () => getPrintCertificatePages,
|
254
268
|
getRandomDate: () => getRandomDate,
|
255
269
|
getRandomDatetime: () => getRandomDatetime,
|
256
270
|
getStatusFromActions: () => getStatusFromActions,
|
@@ -289,6 +303,7 @@ __export(events_exports, {
|
|
289
303
|
isParagraphFieldType: () => isParagraphFieldType,
|
290
304
|
isPhoneFieldType: () => isPhoneFieldType,
|
291
305
|
isRadioGroupFieldType: () => isRadioGroupFieldType,
|
306
|
+
isSelectDateRangeFieldType: () => isSelectDateRangeFieldType,
|
292
307
|
isSelectFieldType: () => isSelectFieldType,
|
293
308
|
isSignatureFieldType: () => isSignatureFieldType,
|
294
309
|
isTemplateVariable: () => isTemplateVariable,
|
@@ -301,13 +316,17 @@ __export(events_exports, {
|
|
301
316
|
mapFieldTypeToEmptyValue: () => mapFieldTypeToEmptyValue,
|
302
317
|
mapFieldTypeToMockValue: () => mapFieldTypeToMockValue,
|
303
318
|
mapFieldTypeToZod: () => mapFieldTypeToZod,
|
319
|
+
mergeDrafts: () => mergeDrafts,
|
304
320
|
never: () => never,
|
305
321
|
not: () => not,
|
306
322
|
omitHiddenAnnotationFields: () => omitHiddenAnnotationFields,
|
307
323
|
omitHiddenFields: () => omitHiddenFields,
|
308
324
|
omitHiddenPaginatedFields: () => omitHiddenPaginatedFields,
|
309
325
|
or: () => or,
|
326
|
+
resolveDateOfEvent: () => resolveDateOfEvent,
|
310
327
|
runFieldValidations: () => runFieldValidations,
|
328
|
+
runStructuralValidations: () => runStructuralValidations,
|
329
|
+
timePeriodToDateRange: () => timePeriodToDateRange,
|
311
330
|
user: () => user,
|
312
331
|
validate: () => validate,
|
313
332
|
validateFieldInput: () => validateFieldInput,
|
@@ -321,7 +340,7 @@ var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
|
|
321
340
|
var BIRTH_EVENT = "v2-birth";
|
322
341
|
|
323
342
|
// ../commons/src/events/ActionConfig.ts
|
324
|
-
var
|
343
|
+
var import_zod11 = require("zod");
|
325
344
|
|
326
345
|
// ../commons/src/events/Conditional.ts
|
327
346
|
var import_zod = require("zod");
|
@@ -373,10 +392,10 @@ var FieldConditional = import_zod.z.discriminatedUnion("type", [
|
|
373
392
|
});
|
374
393
|
|
375
394
|
// ../commons/src/events/PageConfig.ts
|
376
|
-
var
|
395
|
+
var import_zod8 = require("zod");
|
377
396
|
|
378
397
|
// ../commons/src/events/FieldConfig.ts
|
379
|
-
var
|
398
|
+
var import_zod7 = require("zod");
|
380
399
|
|
381
400
|
// ../commons/src/events/TranslationConfig.ts
|
382
401
|
var import_zod2 = require("zod");
|
@@ -396,6 +415,7 @@ var TranslationConfig = import_zod2.z.object({
|
|
396
415
|
});
|
397
416
|
|
398
417
|
// ../commons/src/events/FieldType.ts
|
418
|
+
var import_zod3 = require("zod");
|
399
419
|
var FieldType = {
|
400
420
|
NAME: "NAME",
|
401
421
|
PHONE: "PHONE",
|
@@ -407,6 +427,9 @@ var FieldType = {
|
|
407
427
|
EMAIL: "EMAIL",
|
408
428
|
DATE: "DATE",
|
409
429
|
DATE_RANGE: "DATE_RANGE",
|
430
|
+
// // Internal use, only for search functionality
|
431
|
+
SELECT_DATE_RANGE: "SELECT_DATE_RANGE",
|
432
|
+
// Internal use, only for search functionality
|
410
433
|
PARAGRAPH: "PARAGRAPH",
|
411
434
|
PAGE_HEADER: "PAGE_HEADER",
|
412
435
|
RADIO_GROUP: "RADIO_GROUP",
|
@@ -424,6 +447,11 @@ var FieldType = {
|
|
424
447
|
SIGNATURE: "SIGNATURE",
|
425
448
|
DATA: "DATA"
|
426
449
|
};
|
450
|
+
var FileFieldType = import_zod3.z.enum([
|
451
|
+
FieldType.FILE,
|
452
|
+
FieldType.FILE_WITH_OPTIONS,
|
453
|
+
FieldType.SIGNATURE
|
454
|
+
]);
|
427
455
|
var fieldTypes = Object.values(FieldType);
|
428
456
|
var compositeFieldTypes = [
|
429
457
|
FieldType.DATE_RANGE,
|
@@ -433,10 +461,24 @@ var compositeFieldTypes = [
|
|
433
461
|
];
|
434
462
|
|
435
463
|
// ../commons/src/events/FieldValue.ts
|
464
|
+
var import_zod6 = require("zod");
|
465
|
+
|
466
|
+
// ../commons/src/documents.ts
|
436
467
|
var import_zod4 = require("zod");
|
468
|
+
var import_zod_openapi3 = require("zod-openapi");
|
469
|
+
(0, import_zod_openapi3.extendZodWithOpenApi)(import_zod4.z);
|
470
|
+
var FullDocumentUrl = import_zod4.z.string().brand("FullDocumentUrl").describe(
|
471
|
+
"A full url with protocol, host, bucket name, starting from the root of the S3 server, https://minio/bucket-name/document-id.jpg"
|
472
|
+
);
|
473
|
+
var FullDocumentPath = import_zod4.z.string().transform((val) => val.startsWith("/") ? val : `/${val}`).openapi({ effectType: "input", type: "string" }).describe(
|
474
|
+
"A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
|
475
|
+
);
|
476
|
+
var DocumentPath = import_zod4.z.string().brand("DocumentPath").describe(
|
477
|
+
"A full identifier starting from the root of the S3 bucket, e.g. /document-id.jpg or /directory/document-id.jpg but never /bucket-name/document-id.jpg"
|
478
|
+
);
|
437
479
|
|
438
480
|
// ../commons/src/events/CompositeFieldValue.ts
|
439
|
-
var
|
481
|
+
var import_zod5 = require("zod");
|
440
482
|
var GeographicalArea = {
|
441
483
|
URBAN: "URBAN",
|
442
484
|
RURAL: "RURAL"
|
@@ -445,101 +487,113 @@ var AddressType = {
|
|
445
487
|
DOMESTIC: "DOMESTIC",
|
446
488
|
INTERNATIONAL: "INTERNATIONAL"
|
447
489
|
};
|
448
|
-
var FileFieldValue =
|
449
|
-
|
450
|
-
originalFilename:
|
451
|
-
type:
|
490
|
+
var FileFieldValue = import_zod5.z.object({
|
491
|
+
path: FullDocumentPath,
|
492
|
+
originalFilename: import_zod5.z.string(),
|
493
|
+
type: import_zod5.z.string()
|
452
494
|
});
|
453
|
-
var AdminStructure =
|
454
|
-
country:
|
455
|
-
addressType:
|
456
|
-
province:
|
457
|
-
district:
|
495
|
+
var AdminStructure = import_zod5.z.object({
|
496
|
+
country: import_zod5.z.string(),
|
497
|
+
addressType: import_zod5.z.literal(AddressType.DOMESTIC),
|
498
|
+
province: import_zod5.z.string(),
|
499
|
+
district: import_zod5.z.string()
|
458
500
|
});
|
459
501
|
var UrbanAddressValue = AdminStructure.extend({
|
460
|
-
urbanOrRural:
|
461
|
-
town:
|
462
|
-
residentialArea:
|
463
|
-
street:
|
464
|
-
number:
|
465
|
-
zipCode:
|
502
|
+
urbanOrRural: import_zod5.z.literal(GeographicalArea.URBAN),
|
503
|
+
town: import_zod5.z.string().optional(),
|
504
|
+
residentialArea: import_zod5.z.string().optional(),
|
505
|
+
street: import_zod5.z.string().optional(),
|
506
|
+
number: import_zod5.z.string().optional(),
|
507
|
+
zipCode: import_zod5.z.string().optional()
|
466
508
|
});
|
467
509
|
var RuralAddressValue = AdminStructure.extend({
|
468
|
-
urbanOrRural:
|
469
|
-
village:
|
510
|
+
urbanOrRural: import_zod5.z.literal(GeographicalArea.RURAL),
|
511
|
+
village: import_zod5.z.string().optional()
|
470
512
|
});
|
471
513
|
var UrbanAddressUpdateValue = AdminStructure.extend({
|
472
|
-
urbanOrRural:
|
473
|
-
town:
|
474
|
-
residentialArea:
|
475
|
-
street:
|
476
|
-
number:
|
477
|
-
zipCode:
|
514
|
+
urbanOrRural: import_zod5.z.literal(GeographicalArea.URBAN),
|
515
|
+
town: import_zod5.z.string().nullish(),
|
516
|
+
residentialArea: import_zod5.z.string().nullish(),
|
517
|
+
street: import_zod5.z.string().nullish(),
|
518
|
+
number: import_zod5.z.string().nullish(),
|
519
|
+
zipCode: import_zod5.z.string().nullish()
|
478
520
|
});
|
479
|
-
var NameFieldValue =
|
480
|
-
firstname:
|
481
|
-
surname:
|
482
|
-
middlename:
|
521
|
+
var NameFieldValue = import_zod5.z.object({
|
522
|
+
firstname: import_zod5.z.string(),
|
523
|
+
surname: import_zod5.z.string(),
|
524
|
+
middlename: import_zod5.z.string().optional()
|
483
525
|
});
|
484
|
-
var NameFieldUpdateValue =
|
485
|
-
firstname:
|
486
|
-
surname:
|
487
|
-
middlename:
|
488
|
-
}).or(
|
526
|
+
var NameFieldUpdateValue = import_zod5.z.object({
|
527
|
+
firstname: import_zod5.z.string(),
|
528
|
+
surname: import_zod5.z.string(),
|
529
|
+
middlename: import_zod5.z.string().nullish()
|
530
|
+
}).or(import_zod5.z.null()).or(import_zod5.z.undefined());
|
489
531
|
var RuralAddressUpdateValue = AdminStructure.extend({
|
490
|
-
urbanOrRural:
|
491
|
-
village:
|
532
|
+
urbanOrRural: import_zod5.z.literal(GeographicalArea.RURAL),
|
533
|
+
village: import_zod5.z.string().nullish()
|
492
534
|
});
|
493
|
-
var GenericAddressValue =
|
494
|
-
country:
|
495
|
-
addressType:
|
496
|
-
state:
|
497
|
-
district2:
|
498
|
-
cityOrTown:
|
499
|
-
addressLine1:
|
500
|
-
addressLine2:
|
501
|
-
addressLine3:
|
502
|
-
postcodeOrZip:
|
535
|
+
var GenericAddressValue = import_zod5.z.object({
|
536
|
+
country: import_zod5.z.string(),
|
537
|
+
addressType: import_zod5.z.literal(AddressType.INTERNATIONAL),
|
538
|
+
state: import_zod5.z.string(),
|
539
|
+
district2: import_zod5.z.string(),
|
540
|
+
cityOrTown: import_zod5.z.string().optional(),
|
541
|
+
addressLine1: import_zod5.z.string().optional(),
|
542
|
+
addressLine2: import_zod5.z.string().optional(),
|
543
|
+
addressLine3: import_zod5.z.string().optional(),
|
544
|
+
postcodeOrZip: import_zod5.z.string().optional()
|
503
545
|
});
|
504
|
-
var AddressFieldValue =
|
505
|
-
var GenericAddressUpdateValue =
|
506
|
-
country:
|
507
|
-
addressType:
|
508
|
-
state:
|
509
|
-
district2:
|
510
|
-
cityOrTown:
|
511
|
-
addressLine1:
|
512
|
-
addressLine2:
|
513
|
-
addressLine3:
|
514
|
-
postcodeOrZip:
|
546
|
+
var AddressFieldValue = import_zod5.z.discriminatedUnion("urbanOrRural", [UrbanAddressValue, RuralAddressValue]).or(GenericAddressValue);
|
547
|
+
var GenericAddressUpdateValue = import_zod5.z.object({
|
548
|
+
country: import_zod5.z.string(),
|
549
|
+
addressType: import_zod5.z.literal(AddressType.INTERNATIONAL),
|
550
|
+
state: import_zod5.z.string(),
|
551
|
+
district2: import_zod5.z.string(),
|
552
|
+
cityOrTown: import_zod5.z.string().nullish(),
|
553
|
+
addressLine1: import_zod5.z.string().nullish(),
|
554
|
+
addressLine2: import_zod5.z.string().nullish(),
|
555
|
+
addressLine3: import_zod5.z.string().nullish(),
|
556
|
+
postcodeOrZip: import_zod5.z.string().nullish()
|
515
557
|
});
|
516
|
-
var AddressFieldUpdateValue =
|
558
|
+
var AddressFieldUpdateValue = import_zod5.z.discriminatedUnion("urbanOrRural", [
|
517
559
|
UrbanAddressUpdateValue,
|
518
560
|
RuralAddressUpdateValue
|
519
561
|
]).or(GenericAddressUpdateValue);
|
520
|
-
var FileFieldValueWithOption =
|
521
|
-
|
522
|
-
originalFilename:
|
523
|
-
type:
|
524
|
-
option:
|
562
|
+
var FileFieldValueWithOption = import_zod5.z.object({
|
563
|
+
path: FullDocumentPath,
|
564
|
+
originalFilename: import_zod5.z.string(),
|
565
|
+
type: import_zod5.z.string(),
|
566
|
+
option: import_zod5.z.string()
|
525
567
|
});
|
526
|
-
var FileFieldWithOptionValue =
|
568
|
+
var FileFieldWithOptionValue = import_zod5.z.array(FileFieldValueWithOption);
|
527
569
|
|
528
570
|
// ../commons/src/events/FieldValue.ts
|
529
|
-
var TextValue =
|
571
|
+
var TextValue = import_zod6.z.string();
|
530
572
|
var NonEmptyTextValue = TextValue.min(1);
|
531
|
-
var DateValue =
|
532
|
-
var DatetimeValue =
|
533
|
-
var
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
var
|
573
|
+
var DateValue = import_zod6.z.string().date().describe("Date in the format YYYY-MM-DD");
|
574
|
+
var DatetimeValue = import_zod6.z.string().datetime();
|
575
|
+
var SelectDateRangeValue = import_zod6.z.enum([
|
576
|
+
"last7Days",
|
577
|
+
"last30Days",
|
578
|
+
"last90Days",
|
579
|
+
"last365Days"
|
580
|
+
]);
|
581
|
+
var DateRangeFieldValue = import_zod6.z.object({
|
582
|
+
start: DateValue,
|
583
|
+
end: DateValue
|
584
|
+
}).or(DateValue).describe(
|
585
|
+
"Date range with start and end dates in the format YYYY-MM-DD. Inclusive start, exclusive end."
|
586
|
+
);
|
587
|
+
var EmailValue = import_zod6.z.string().email();
|
588
|
+
var CheckboxFieldValue = import_zod6.z.boolean();
|
589
|
+
var NumberFieldValue = import_zod6.z.number();
|
590
|
+
var DataFieldValue = import_zod6.z.undefined();
|
591
|
+
var SignatureFieldValue = import_zod6.z.string();
|
592
|
+
var FieldValue = import_zod6.z.union([
|
540
593
|
TextValue,
|
541
594
|
DateValue,
|
542
595
|
DateRangeFieldValue,
|
596
|
+
SelectDateRangeValue,
|
543
597
|
CheckboxFieldValue,
|
544
598
|
NumberFieldValue,
|
545
599
|
FileFieldValue,
|
@@ -551,10 +605,11 @@ var FieldValue = import_zod4.z.union([
|
|
551
605
|
NameFieldValue,
|
552
606
|
NameFieldUpdateValue
|
553
607
|
]);
|
554
|
-
var FieldUpdateValue =
|
608
|
+
var FieldUpdateValue = import_zod6.z.union([
|
555
609
|
TextValue,
|
556
610
|
DateValue,
|
557
611
|
DateRangeFieldValue,
|
612
|
+
SelectDateRangeValue,
|
558
613
|
CheckboxFieldValue,
|
559
614
|
NumberFieldValue,
|
560
615
|
FileFieldValue,
|
@@ -567,63 +622,64 @@ var FieldUpdateValue = import_zod4.z.union([
|
|
567
622
|
]);
|
568
623
|
|
569
624
|
// ../commons/src/events/FieldConfig.ts
|
570
|
-
var
|
571
|
-
(0,
|
572
|
-
var FieldId =
|
573
|
-
var FieldReference =
|
625
|
+
var import_zod_openapi4 = require("zod-openapi");
|
626
|
+
(0, import_zod_openapi4.extendZodWithOpenApi)(import_zod7.z);
|
627
|
+
var FieldId = import_zod7.z.string().describe("Unique identifier for the field");
|
628
|
+
var FieldReference = import_zod7.z.object({
|
574
629
|
$$field: FieldId
|
575
630
|
}).describe("Reference to a field by its ID");
|
576
631
|
var ParentReference = FieldReference.optional();
|
577
|
-
var ValidationConfig =
|
632
|
+
var ValidationConfig = import_zod7.z.object({
|
578
633
|
validator: Conditional,
|
579
634
|
message: TranslationConfig
|
580
635
|
});
|
581
|
-
var BaseField =
|
636
|
+
var BaseField = import_zod7.z.object({
|
582
637
|
id: FieldId,
|
583
638
|
parent: ParentReference,
|
584
|
-
conditionals:
|
585
|
-
required:
|
639
|
+
conditionals: import_zod7.z.array(FieldConditional).default([]).optional(),
|
640
|
+
required: import_zod7.z.boolean().default(false).optional(),
|
641
|
+
secured: import_zod7.z.boolean().default(false).optional(),
|
586
642
|
placeholder: TranslationConfig.optional(),
|
587
|
-
validation:
|
643
|
+
validation: import_zod7.z.array(ValidationConfig).default([]).optional(),
|
588
644
|
label: TranslationConfig,
|
589
645
|
helperText: TranslationConfig.optional(),
|
590
|
-
hideLabel:
|
646
|
+
hideLabel: import_zod7.z.boolean().default(false).optional()
|
591
647
|
});
|
592
648
|
var Divider = BaseField.extend({
|
593
|
-
type:
|
649
|
+
type: import_zod7.z.literal(FieldType.DIVIDER)
|
594
650
|
});
|
595
651
|
var TextField = BaseField.extend({
|
596
|
-
type:
|
652
|
+
type: import_zod7.z.literal(FieldType.TEXT),
|
597
653
|
defaultValue: NonEmptyTextValue.optional(),
|
598
|
-
configuration:
|
599
|
-
maxLength:
|
600
|
-
type:
|
654
|
+
configuration: import_zod7.z.object({
|
655
|
+
maxLength: import_zod7.z.number().optional().describe("Maximum length of the text"),
|
656
|
+
type: import_zod7.z.enum(["text", "password"]).optional(),
|
601
657
|
prefix: TranslationConfig.optional(),
|
602
658
|
postfix: TranslationConfig.optional()
|
603
659
|
}).default({ type: "text" }).optional()
|
604
660
|
}).describe("Text input");
|
605
661
|
var NumberField = BaseField.extend({
|
606
|
-
type:
|
662
|
+
type: import_zod7.z.literal(FieldType.NUMBER),
|
607
663
|
defaultValue: NumberFieldValue.optional(),
|
608
|
-
configuration:
|
609
|
-
min:
|
610
|
-
max:
|
664
|
+
configuration: import_zod7.z.object({
|
665
|
+
min: import_zod7.z.number().optional().describe("Minimum value"),
|
666
|
+
max: import_zod7.z.number().optional().describe("Maximum value"),
|
611
667
|
prefix: TranslationConfig.optional(),
|
612
668
|
postfix: TranslationConfig.optional()
|
613
669
|
}).optional()
|
614
670
|
}).describe("Number input");
|
615
671
|
var TextAreaField = BaseField.extend({
|
616
|
-
type:
|
672
|
+
type: import_zod7.z.literal(FieldType.TEXTAREA),
|
617
673
|
defaultValue: NonEmptyTextValue.optional(),
|
618
|
-
configuration:
|
619
|
-
maxLength:
|
620
|
-
rows:
|
621
|
-
cols:
|
674
|
+
configuration: import_zod7.z.object({
|
675
|
+
maxLength: import_zod7.z.number().optional().describe("Maximum length of the text"),
|
676
|
+
rows: import_zod7.z.number().optional().describe("Number of visible text lines"),
|
677
|
+
cols: import_zod7.z.number().optional().describe("Number of visible columns"),
|
622
678
|
prefix: TranslationConfig.optional(),
|
623
679
|
postfix: TranslationConfig.optional()
|
624
680
|
}).default({ rows: 4 }).optional()
|
625
681
|
}).describe("Multiline text input");
|
626
|
-
var ImageMimeType =
|
682
|
+
var ImageMimeType = import_zod7.z.enum([
|
627
683
|
"image/png",
|
628
684
|
"image/jpg",
|
629
685
|
"image/jpeg",
|
@@ -632,46 +688,44 @@ var ImageMimeType = import_zod5.z.enum([
|
|
632
688
|
var MimeType = ImageMimeType;
|
633
689
|
var DEFAULT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;
|
634
690
|
var SignatureField = BaseField.extend({
|
635
|
-
type:
|
691
|
+
type: import_zod7.z.literal(FieldType.SIGNATURE),
|
636
692
|
signaturePromptLabel: TranslationConfig.describe(
|
637
693
|
"Title of the signature modal"
|
638
694
|
),
|
639
695
|
defaultValue: SignatureFieldValue.optional(),
|
640
|
-
configuration:
|
641
|
-
maxFileSize:
|
696
|
+
configuration: import_zod7.z.object({
|
697
|
+
maxFileSize: import_zod7.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
642
698
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
643
699
|
}).default({
|
644
700
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
645
701
|
})
|
646
702
|
}).describe("Signature input field");
|
647
703
|
var EmailField = BaseField.extend({
|
648
|
-
type:
|
649
|
-
configuration:
|
650
|
-
maxLength:
|
704
|
+
type: import_zod7.z.literal(FieldType.EMAIL),
|
705
|
+
configuration: import_zod7.z.object({
|
706
|
+
maxLength: import_zod7.z.number().optional().describe("Maximum length of the text")
|
651
707
|
}).default({ maxLength: 10 }).optional(),
|
652
708
|
defaultValue: NonEmptyTextValue.optional()
|
653
709
|
});
|
654
710
|
var DateField = BaseField.extend({
|
655
|
-
type:
|
711
|
+
type: import_zod7.z.literal(FieldType.DATE),
|
656
712
|
defaultValue: DateValue.optional(),
|
657
|
-
configuration:
|
713
|
+
configuration: import_zod7.z.object({
|
658
714
|
notice: TranslationConfig.describe(
|
659
715
|
"Text to display above the date input"
|
660
716
|
).optional()
|
661
717
|
}).optional()
|
662
|
-
}).describe("A single date input (
|
718
|
+
}).describe("A single date input (yyyy-MM-dd)");
|
663
719
|
var DateRangeField = BaseField.extend({
|
664
|
-
type:
|
720
|
+
type: import_zod7.z.literal(FieldType.DATE_RANGE),
|
665
721
|
defaultValue: DateRangeFieldValue.optional(),
|
666
|
-
configuration:
|
722
|
+
configuration: import_zod7.z.object({
|
667
723
|
notice: TranslationConfig.describe(
|
668
724
|
"Text to display above the date input"
|
669
725
|
).optional()
|
670
726
|
}).optional()
|
671
|
-
}).describe(
|
672
|
-
|
673
|
-
);
|
674
|
-
var HtmlFontVariant = import_zod5.z.enum([
|
727
|
+
}).describe("A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })");
|
728
|
+
var HtmlFontVariant = import_zod7.z.enum([
|
675
729
|
"reg12",
|
676
730
|
"reg14",
|
677
731
|
"reg16",
|
@@ -682,26 +736,26 @@ var HtmlFontVariant = import_zod5.z.enum([
|
|
682
736
|
"h1"
|
683
737
|
]);
|
684
738
|
var Paragraph = BaseField.extend({
|
685
|
-
type:
|
739
|
+
type: import_zod7.z.literal(FieldType.PARAGRAPH),
|
686
740
|
defaultValue: NonEmptyTextValue.optional(),
|
687
|
-
configuration:
|
688
|
-
styles:
|
741
|
+
configuration: import_zod7.z.object({
|
742
|
+
styles: import_zod7.z.object({
|
689
743
|
fontVariant: HtmlFontVariant.optional()
|
690
744
|
}).optional()
|
691
745
|
}).default({})
|
692
746
|
}).describe("A read-only HTML <p> paragraph");
|
693
747
|
var PageHeader = BaseField.extend({
|
694
|
-
type:
|
748
|
+
type: import_zod7.z.literal(FieldType.PAGE_HEADER),
|
695
749
|
defaultValue: NonEmptyTextValue.optional()
|
696
750
|
}).describe("A read-only header component for form pages");
|
697
751
|
var File = BaseField.extend({
|
698
|
-
type:
|
752
|
+
type: import_zod7.z.literal(FieldType.FILE),
|
699
753
|
defaultValue: FileFieldValue.optional(),
|
700
|
-
configuration:
|
701
|
-
maxFileSize:
|
754
|
+
configuration: import_zod7.z.object({
|
755
|
+
maxFileSize: import_zod7.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
702
756
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
|
703
|
-
style:
|
704
|
-
width:
|
757
|
+
style: import_zod7.z.object({
|
758
|
+
width: import_zod7.z.enum(["full", "auto"]).optional().describe(
|
705
759
|
"Whether the file upload button should take the full width of the container or not"
|
706
760
|
)
|
707
761
|
}).optional(),
|
@@ -710,129 +764,183 @@ var File = BaseField.extend({
|
|
710
764
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
711
765
|
})
|
712
766
|
}).describe("File upload");
|
713
|
-
var SelectOption =
|
714
|
-
value:
|
767
|
+
var SelectOption = import_zod7.z.object({
|
768
|
+
value: import_zod7.z.string().describe("The value of the option"),
|
715
769
|
label: TranslationConfig.describe("The label of the option")
|
716
770
|
});
|
717
771
|
var RadioGroup = BaseField.extend({
|
718
|
-
type:
|
772
|
+
type: import_zod7.z.literal(FieldType.RADIO_GROUP),
|
719
773
|
defaultValue: TextValue.optional(),
|
720
|
-
options:
|
721
|
-
configuration:
|
722
|
-
styles:
|
723
|
-
size:
|
774
|
+
options: import_zod7.z.array(SelectOption).describe("A list of options"),
|
775
|
+
configuration: import_zod7.z.object({
|
776
|
+
styles: import_zod7.z.object({
|
777
|
+
size: import_zod7.z.enum(["NORMAL", "LARGE"]).optional()
|
724
778
|
}).optional()
|
725
779
|
}).optional()
|
726
780
|
}).describe("Grouped radio options");
|
727
781
|
var BulletList = BaseField.extend({
|
728
|
-
type:
|
782
|
+
type: import_zod7.z.literal(FieldType.BULLET_LIST),
|
729
783
|
defaultValue: TextValue.optional(),
|
730
|
-
items:
|
731
|
-
configuration:
|
732
|
-
styles:
|
784
|
+
items: import_zod7.z.array(TranslationConfig).describe("A list of items"),
|
785
|
+
configuration: import_zod7.z.object({
|
786
|
+
styles: import_zod7.z.object({
|
733
787
|
fontVariant: HtmlFontVariant.optional()
|
734
788
|
}).optional()
|
735
789
|
}).default({})
|
736
790
|
}).describe("A list of bullet points");
|
737
791
|
var Select = BaseField.extend({
|
738
|
-
type:
|
792
|
+
type: import_zod7.z.literal(FieldType.SELECT),
|
739
793
|
defaultValue: TextValue.optional(),
|
740
|
-
options:
|
794
|
+
options: import_zod7.z.array(SelectOption).describe("A list of options")
|
741
795
|
}).describe("Select input");
|
796
|
+
var SelectDateRangeOption = import_zod7.z.object({
|
797
|
+
value: SelectDateRangeValue.describe("The value of the option"),
|
798
|
+
label: TranslationConfig.describe("The label of the option")
|
799
|
+
});
|
800
|
+
var SelectDateRangeField = BaseField.extend({
|
801
|
+
type: import_zod7.z.literal(FieldType.SELECT_DATE_RANGE),
|
802
|
+
defaultValue: SelectDateRangeValue.optional(),
|
803
|
+
options: import_zod7.z.array(SelectDateRangeOption).describe("A list of options")
|
804
|
+
}).describe("Select input with date range options");
|
805
|
+
var NameConfig = import_zod7.z.object({
|
806
|
+
firstname: import_zod7.z.object({ required: import_zod7.z.boolean(), label: TranslationConfig.optional() }).optional(),
|
807
|
+
middlename: import_zod7.z.object({ required: import_zod7.z.boolean(), label: TranslationConfig.optional() }).optional(),
|
808
|
+
surname: import_zod7.z.object({ required: import_zod7.z.boolean(), label: TranslationConfig.optional() }).optional()
|
809
|
+
});
|
742
810
|
var NameField = BaseField.extend({
|
743
|
-
type:
|
744
|
-
defaultValue:
|
745
|
-
firstname: NonEmptyTextValue,
|
746
|
-
|
811
|
+
type: import_zod7.z.literal(FieldType.NAME),
|
812
|
+
defaultValue: import_zod7.z.object({
|
813
|
+
firstname: NonEmptyTextValue.optional(),
|
814
|
+
middlename: NonEmptyTextValue.optional(),
|
815
|
+
surname: NonEmptyTextValue.optional()
|
747
816
|
}).optional(),
|
748
|
-
configuration:
|
749
|
-
|
817
|
+
configuration: import_zod7.z.object({
|
818
|
+
name: NameConfig.default({
|
819
|
+
firstname: { required: true },
|
820
|
+
surname: { required: true }
|
821
|
+
}).optional(),
|
822
|
+
order: import_zod7.z.array(import_zod7.z.enum(["firstname", "middlename", "surname"])).optional(),
|
823
|
+
maxLength: import_zod7.z.number().optional().describe("Maximum length of the text"),
|
750
824
|
prefix: TranslationConfig.optional(),
|
751
825
|
postfix: TranslationConfig.optional()
|
826
|
+
}).default({
|
827
|
+
name: {
|
828
|
+
firstname: { required: true },
|
829
|
+
surname: { required: true }
|
830
|
+
}
|
752
831
|
}).optional()
|
753
832
|
}).describe("Name input field");
|
754
833
|
var PhoneField = BaseField.extend({
|
755
834
|
defaultValue: NonEmptyTextValue.optional(),
|
756
|
-
type:
|
835
|
+
type: import_zod7.z.literal(FieldType.PHONE)
|
757
836
|
}).describe("Phone input field");
|
758
837
|
var IdField = BaseField.extend({
|
759
838
|
defaultValue: NonEmptyTextValue.optional(),
|
760
|
-
type:
|
839
|
+
type: import_zod7.z.literal(FieldType.ID)
|
761
840
|
}).describe("ID input field");
|
762
841
|
var Checkbox = BaseField.extend({
|
763
|
-
type:
|
842
|
+
type: import_zod7.z.literal(FieldType.CHECKBOX),
|
764
843
|
defaultValue: CheckboxFieldValue.optional()
|
765
844
|
}).describe("Boolean checkbox field");
|
766
845
|
var Country = BaseField.extend({
|
767
|
-
type:
|
846
|
+
type: import_zod7.z.literal(FieldType.COUNTRY),
|
768
847
|
defaultValue: NonEmptyTextValue.optional()
|
769
848
|
}).describe("Country select field");
|
770
|
-
var AdministrativeAreas =
|
849
|
+
var AdministrativeAreas = import_zod7.z.enum([
|
771
850
|
"ADMIN_STRUCTURE",
|
772
851
|
"HEALTH_FACILITY",
|
773
852
|
"CRVS_OFFICE"
|
774
853
|
]);
|
775
|
-
var AdministrativeAreaConfiguration =
|
776
|
-
partOf:
|
777
|
-
$declaration:
|
854
|
+
var AdministrativeAreaConfiguration = import_zod7.z.object({
|
855
|
+
partOf: import_zod7.z.object({
|
856
|
+
$declaration: import_zod7.z.string()
|
778
857
|
}).optional().describe("Parent location"),
|
779
858
|
type: AdministrativeAreas
|
780
859
|
}).describe("Administrative area options");
|
781
860
|
var AdministrativeArea = BaseField.extend({
|
782
|
-
type:
|
861
|
+
type: import_zod7.z.literal(FieldType.ADMINISTRATIVE_AREA),
|
783
862
|
defaultValue: NonEmptyTextValue.optional(),
|
784
863
|
configuration: AdministrativeAreaConfiguration
|
785
864
|
}).describe("Administrative area input field e.g. facility, office");
|
786
865
|
var Location = BaseField.extend({
|
787
|
-
type:
|
788
|
-
defaultValue: NonEmptyTextValue.optional()
|
866
|
+
type: import_zod7.z.literal(FieldType.LOCATION),
|
867
|
+
defaultValue: NonEmptyTextValue.optional(),
|
868
|
+
configuration: import_zod7.z.object({
|
869
|
+
searchableResource: import_zod7.z.array(import_zod7.z.enum(["locations", "facilities", "offices"])).optional()
|
870
|
+
}).optional()
|
789
871
|
}).describe("Input field for a location");
|
790
872
|
var FileUploadWithOptions = BaseField.extend({
|
791
|
-
type:
|
792
|
-
options:
|
873
|
+
type: import_zod7.z.literal(FieldType.FILE_WITH_OPTIONS),
|
874
|
+
options: import_zod7.z.array(SelectOption).describe("A list of options"),
|
793
875
|
defaultValue: FileFieldWithOptionValue.optional(),
|
794
|
-
configuration:
|
795
|
-
maxFileSize:
|
876
|
+
configuration: import_zod7.z.object({
|
877
|
+
maxFileSize: import_zod7.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
796
878
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
797
879
|
}).default({
|
798
880
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
799
881
|
})
|
800
882
|
});
|
801
883
|
var Facility = BaseField.extend({
|
802
|
-
type:
|
884
|
+
type: import_zod7.z.literal(FieldType.FACILITY),
|
803
885
|
defaultValue: NonEmptyTextValue.optional()
|
804
886
|
}).describe("Input field for a facility");
|
805
887
|
var Office = BaseField.extend({
|
806
|
-
type:
|
888
|
+
type: import_zod7.z.literal(FieldType.OFFICE),
|
807
889
|
defaultValue: NonEmptyTextValue.optional()
|
808
890
|
}).describe("Input field for an office");
|
809
891
|
var Address = BaseField.extend({
|
810
|
-
type:
|
892
|
+
type: import_zod7.z.literal(FieldType.ADDRESS),
|
893
|
+
configuration: import_zod7.z.object({
|
894
|
+
lineSeparator: import_zod7.z.string().optional(),
|
895
|
+
fields: import_zod7.z.array(
|
896
|
+
import_zod7.z.enum([
|
897
|
+
"number",
|
898
|
+
"country",
|
899
|
+
"province",
|
900
|
+
"addressType",
|
901
|
+
"district",
|
902
|
+
"urbanOrRural",
|
903
|
+
"town",
|
904
|
+
"residentialArea",
|
905
|
+
"street",
|
906
|
+
"zipCode",
|
907
|
+
"village",
|
908
|
+
"state",
|
909
|
+
"district2",
|
910
|
+
"cityOrTown",
|
911
|
+
"addressLine1",
|
912
|
+
"addressLine2",
|
913
|
+
"addressLine3",
|
914
|
+
"postcodeOrZip"
|
915
|
+
])
|
916
|
+
).optional()
|
917
|
+
}).optional(),
|
811
918
|
defaultValue: AddressFieldValue.optional()
|
812
919
|
}).describe("Address input field \u2013 a combination of location and text fields");
|
813
|
-
var DataEntry =
|
814
|
-
|
920
|
+
var DataEntry = import_zod7.z.union([
|
921
|
+
import_zod7.z.object({
|
815
922
|
label: TranslationConfig,
|
816
|
-
value: TranslationConfig.or(
|
923
|
+
value: TranslationConfig.or(import_zod7.z.string())
|
817
924
|
}),
|
818
|
-
|
819
|
-
fieldId:
|
925
|
+
import_zod7.z.object({
|
926
|
+
fieldId: import_zod7.z.string()
|
820
927
|
})
|
821
928
|
]);
|
822
929
|
var DataField = BaseField.extend({
|
823
|
-
type:
|
824
|
-
configuration:
|
930
|
+
type: import_zod7.z.literal(FieldType.DATA),
|
931
|
+
configuration: import_zod7.z.object({
|
825
932
|
subtitle: TranslationConfig.optional(),
|
826
|
-
data:
|
933
|
+
data: import_zod7.z.array(DataEntry)
|
827
934
|
})
|
828
935
|
}).describe("Data field for displaying read-only data");
|
829
|
-
var FieldConfig =
|
936
|
+
var FieldConfig = import_zod7.z.discriminatedUnion("type", [
|
830
937
|
Address,
|
831
938
|
TextField,
|
832
939
|
NumberField,
|
833
940
|
TextAreaField,
|
834
941
|
DateField,
|
835
942
|
DateRangeField,
|
943
|
+
SelectDateRangeField,
|
836
944
|
Paragraph,
|
837
945
|
RadioGroup,
|
838
946
|
BulletList,
|
@@ -857,15 +965,20 @@ var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
|
857
965
|
description: "Form field configuration",
|
858
966
|
ref: "FieldConfig"
|
859
967
|
});
|
968
|
+
var AnyFileField = import_zod7.z.discriminatedUnion("type", [
|
969
|
+
SignatureField,
|
970
|
+
File,
|
971
|
+
FileUploadWithOptions
|
972
|
+
]);
|
860
973
|
|
861
974
|
// ../commons/src/events/PageConfig.ts
|
862
|
-
var
|
863
|
-
(0,
|
864
|
-
var PageTypes =
|
865
|
-
var PageConfigBase =
|
866
|
-
id:
|
975
|
+
var import_zod_openapi5 = require("zod-openapi");
|
976
|
+
(0, import_zod_openapi5.extendZodWithOpenApi)(import_zod8.z);
|
977
|
+
var PageTypes = import_zod8.z.enum(["FORM", "VERIFICATION"]);
|
978
|
+
var PageConfigBase = import_zod8.z.object({
|
979
|
+
id: import_zod8.z.string().describe("Unique identifier for the page"),
|
867
980
|
title: TranslationConfig.describe("Header title of the page"),
|
868
|
-
fields:
|
981
|
+
fields: import_zod8.z.array(FieldConfig).describe("Fields to be rendered on the page"),
|
869
982
|
conditional: Conditional.optional().describe(
|
870
983
|
"Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
|
871
984
|
)
|
@@ -874,13 +987,13 @@ var PageConfigBase = import_zod6.z.object({
|
|
874
987
|
ref: "FormPageConfig"
|
875
988
|
});
|
876
989
|
var FormPageConfig = PageConfigBase.extend({
|
877
|
-
type:
|
990
|
+
type: import_zod8.z.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
|
878
991
|
});
|
879
|
-
var VerificationActionConfig =
|
880
|
-
verify:
|
881
|
-
cancel:
|
992
|
+
var VerificationActionConfig = import_zod8.z.object({
|
993
|
+
verify: import_zod8.z.object({ label: TranslationConfig }),
|
994
|
+
cancel: import_zod8.z.object({
|
882
995
|
label: TranslationConfig,
|
883
|
-
confirmation:
|
996
|
+
confirmation: import_zod8.z.object({
|
884
997
|
title: TranslationConfig,
|
885
998
|
body: TranslationConfig
|
886
999
|
})
|
@@ -890,16 +1003,16 @@ var VerificationActionConfig = import_zod6.z.object({
|
|
890
1003
|
ref: "VerificationActionConfig"
|
891
1004
|
});
|
892
1005
|
var VerificationPageConfig = FormPageConfig.extend({
|
893
|
-
type:
|
1006
|
+
type: import_zod8.z.literal(PageTypes.enum.VERIFICATION),
|
894
1007
|
actions: VerificationActionConfig
|
895
1008
|
});
|
896
|
-
var PageConfig =
|
1009
|
+
var PageConfig = import_zod8.z.discriminatedUnion("type", [
|
897
1010
|
FormPageConfig,
|
898
1011
|
VerificationPageConfig
|
899
1012
|
]);
|
900
1013
|
|
901
1014
|
// ../commons/src/events/ActionType.ts
|
902
|
-
var
|
1015
|
+
var import_zod9 = require("zod");
|
903
1016
|
var ActionType = {
|
904
1017
|
// Pre-declaration actions
|
905
1018
|
DELETE: "DELETE",
|
@@ -935,7 +1048,7 @@ var ConfirmableActions = [
|
|
935
1048
|
ActionType.ARCHIVE,
|
936
1049
|
ActionType.PRINT_CERTIFICATE
|
937
1050
|
];
|
938
|
-
var ActionTypes =
|
1051
|
+
var ActionTypes = import_zod9.z.enum([
|
939
1052
|
"DELETE",
|
940
1053
|
"CREATE",
|
941
1054
|
"NOTIFY",
|
@@ -974,16 +1087,6 @@ var writeActions = ActionTypes.exclude([
|
|
974
1087
|
ActionType.ASSIGN,
|
975
1088
|
ActionType.UNASSIGN
|
976
1089
|
]);
|
977
|
-
var StatusChangingActions = ActionTypes.extract([
|
978
|
-
ActionType.CREATE,
|
979
|
-
ActionType.NOTIFY,
|
980
|
-
ActionType.DECLARE,
|
981
|
-
ActionType.VALIDATE,
|
982
|
-
ActionType.REGISTER,
|
983
|
-
ActionType.REJECT,
|
984
|
-
ActionType.ARCHIVE,
|
985
|
-
ActionType.PRINT_CERTIFICATE
|
986
|
-
]);
|
987
1090
|
var workqueueActions = ActionTypes.exclude([
|
988
1091
|
ActionType.CREATE,
|
989
1092
|
ActionType.NOTIFY,
|
@@ -1005,103 +1108,103 @@ function isMetaAction(actionType) {
|
|
1005
1108
|
}
|
1006
1109
|
|
1007
1110
|
// ../commons/src/events/FormConfig.ts
|
1008
|
-
var
|
1009
|
-
var DeclarationFormConfig =
|
1111
|
+
var import_zod10 = require("zod");
|
1112
|
+
var DeclarationFormConfig = import_zod10.z.object({
|
1010
1113
|
label: TranslationConfig.describe("Human readable description of the form"),
|
1011
|
-
pages:
|
1114
|
+
pages: import_zod10.z.array(FormPageConfig)
|
1012
1115
|
}).describe("Configuration for a declaration form");
|
1013
|
-
var ActionFormConfig =
|
1116
|
+
var ActionFormConfig = import_zod10.z.object({
|
1014
1117
|
label: TranslationConfig.describe("Human readable description of the form"),
|
1015
|
-
pages:
|
1118
|
+
pages: import_zod10.z.array(PageConfig)
|
1016
1119
|
});
|
1017
|
-
var FormConfig =
|
1120
|
+
var FormConfig = import_zod10.z.union([DeclarationFormConfig, ActionFormConfig]);
|
1018
1121
|
|
1019
1122
|
// ../commons/src/events/ActionConfig.ts
|
1020
|
-
var
|
1021
|
-
(0,
|
1022
|
-
var ActionConditional2 =
|
1123
|
+
var import_zod_openapi6 = require("zod-openapi");
|
1124
|
+
(0, import_zod_openapi6.extendZodWithOpenApi)(import_zod11.z);
|
1125
|
+
var ActionConditional2 = import_zod11.z.discriminatedUnion("type", [
|
1023
1126
|
/** If conditional is defined, the action is shown to the user only if the condition is met */
|
1024
1127
|
ShowConditional,
|
1025
1128
|
/** If conditional is defined, the action is enabled only if the condition is met */
|
1026
1129
|
EnableConditional
|
1027
1130
|
]);
|
1028
|
-
var DeclarationReviewConfig =
|
1131
|
+
var DeclarationReviewConfig = import_zod11.z.object({
|
1029
1132
|
title: TranslationConfig.describe("Title of the review page"),
|
1030
|
-
fields:
|
1133
|
+
fields: import_zod11.z.array(FieldConfig).describe("Fields to be rendered on the review page for annotations.")
|
1031
1134
|
}).describe("Configuration for **declaration** review page.");
|
1032
|
-
var ActionConfigBase =
|
1135
|
+
var ActionConfigBase = import_zod11.z.object({
|
1033
1136
|
label: TranslationConfig,
|
1034
|
-
conditionals:
|
1035
|
-
draft:
|
1137
|
+
conditionals: import_zod11.z.array(ActionConditional2).optional().default([]),
|
1138
|
+
draft: import_zod11.z.boolean().optional()
|
1036
1139
|
});
|
1037
1140
|
var ReadActionConfig = ActionConfigBase.merge(
|
1038
|
-
|
1039
|
-
type:
|
1141
|
+
import_zod11.z.object({
|
1142
|
+
type: import_zod11.z.literal(ActionType.READ),
|
1040
1143
|
review: DeclarationReviewConfig
|
1041
1144
|
})
|
1042
1145
|
);
|
1043
1146
|
var DeclareConfig = ActionConfigBase.merge(
|
1044
|
-
|
1045
|
-
type:
|
1147
|
+
import_zod11.z.object({
|
1148
|
+
type: import_zod11.z.literal(ActionType.DECLARE),
|
1046
1149
|
review: DeclarationReviewConfig
|
1047
1150
|
})
|
1048
1151
|
);
|
1049
1152
|
var ValidateConfig = ActionConfigBase.merge(
|
1050
|
-
|
1051
|
-
type:
|
1153
|
+
import_zod11.z.object({
|
1154
|
+
type: import_zod11.z.literal(ActionType.VALIDATE),
|
1052
1155
|
review: DeclarationReviewConfig
|
1053
1156
|
})
|
1054
1157
|
);
|
1055
1158
|
var RegisterConfig = ActionConfigBase.merge(
|
1056
|
-
|
1057
|
-
type:
|
1159
|
+
import_zod11.z.object({
|
1160
|
+
type: import_zod11.z.literal(ActionType.REGISTER),
|
1058
1161
|
review: DeclarationReviewConfig
|
1059
1162
|
})
|
1060
1163
|
);
|
1061
1164
|
var RejectDeclarationConfig = ActionConfigBase.merge(
|
1062
|
-
|
1063
|
-
type:
|
1165
|
+
import_zod11.z.object({
|
1166
|
+
type: import_zod11.z.literal(ActionType.REJECT)
|
1064
1167
|
})
|
1065
1168
|
);
|
1066
1169
|
var MarkedAsDuplicateConfig = ActionConfigBase.merge(
|
1067
|
-
|
1068
|
-
type:
|
1170
|
+
import_zod11.z.object({
|
1171
|
+
type: import_zod11.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1069
1172
|
})
|
1070
1173
|
);
|
1071
1174
|
var ArchiveConfig = ActionConfigBase.merge(
|
1072
|
-
|
1073
|
-
type:
|
1175
|
+
import_zod11.z.object({
|
1176
|
+
type: import_zod11.z.literal(ActionType.ARCHIVE)
|
1074
1177
|
})
|
1075
1178
|
);
|
1076
1179
|
var DeleteConfig = ActionConfigBase.merge(
|
1077
|
-
|
1078
|
-
type:
|
1180
|
+
import_zod11.z.object({
|
1181
|
+
type: import_zod11.z.literal(ActionType.DELETE)
|
1079
1182
|
})
|
1080
1183
|
);
|
1081
1184
|
var PrintCertificateActionConfig = ActionConfigBase.merge(
|
1082
|
-
|
1083
|
-
type:
|
1185
|
+
import_zod11.z.object({
|
1186
|
+
type: import_zod11.z.literal(ActionType.PRINT_CERTIFICATE),
|
1084
1187
|
printForm: ActionFormConfig
|
1085
1188
|
})
|
1086
1189
|
);
|
1087
1190
|
var RequestCorrectionConfig = ActionConfigBase.merge(
|
1088
|
-
|
1089
|
-
type:
|
1090
|
-
onboardingForm:
|
1091
|
-
additionalDetailsForm:
|
1191
|
+
import_zod11.z.object({
|
1192
|
+
type: import_zod11.z.literal(ActionType.REQUEST_CORRECTION),
|
1193
|
+
onboardingForm: import_zod11.z.array(PageConfig),
|
1194
|
+
additionalDetailsForm: import_zod11.z.array(PageConfig)
|
1092
1195
|
})
|
1093
1196
|
);
|
1094
1197
|
var RejectCorrectionConfig = ActionConfigBase.merge(
|
1095
|
-
|
1096
|
-
type:
|
1198
|
+
import_zod11.z.object({
|
1199
|
+
type: import_zod11.z.literal(ActionType.REJECT_CORRECTION)
|
1097
1200
|
})
|
1098
1201
|
);
|
1099
1202
|
var ApproveCorrectionConfig = ActionConfigBase.merge(
|
1100
|
-
|
1101
|
-
type:
|
1203
|
+
import_zod11.z.object({
|
1204
|
+
type: import_zod11.z.literal(ActionType.APPROVE_CORRECTION)
|
1102
1205
|
})
|
1103
1206
|
);
|
1104
|
-
var ActionConfig =
|
1207
|
+
var ActionConfig = import_zod11.z.discriminatedUnion("type", [
|
1105
1208
|
/*
|
1106
1209
|
* OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
|
1107
1210
|
* and treat them as "models" instead of duplicating the data structure in each endpoint.
|
@@ -1121,108 +1224,108 @@ var ActionConfig = import_zod9.z.discriminatedUnion("type", [
|
|
1121
1224
|
RejectCorrectionConfig.openapi({ ref: "RejectCorrectionActionConfig" }),
|
1122
1225
|
ApproveCorrectionConfig.openapi({ ref: "ApproveCorrectionActionConfig" })
|
1123
1226
|
]).openapi({ ref: "ActionConfig" });
|
1124
|
-
var DeclarationActionConfig =
|
1227
|
+
var DeclarationActionConfig = import_zod11.z.discriminatedUnion("type", [
|
1125
1228
|
DeclareConfig,
|
1126
1229
|
ValidateConfig,
|
1127
1230
|
RegisterConfig
|
1128
1231
|
]);
|
1129
1232
|
|
1130
1233
|
// ../commons/src/events/offline/CertificateConfig.ts
|
1131
|
-
var
|
1132
|
-
var FontFamily =
|
1133
|
-
normal:
|
1134
|
-
bold:
|
1135
|
-
italics:
|
1136
|
-
bolditalics:
|
1234
|
+
var import_zod12 = require("zod");
|
1235
|
+
var FontFamily = import_zod12.z.object({
|
1236
|
+
normal: import_zod12.z.string(),
|
1237
|
+
bold: import_zod12.z.string(),
|
1238
|
+
italics: import_zod12.z.string(),
|
1239
|
+
bolditalics: import_zod12.z.string()
|
1137
1240
|
});
|
1138
|
-
var CertificateConfig =
|
1139
|
-
id:
|
1140
|
-
event:
|
1241
|
+
var CertificateConfig = import_zod12.z.object({
|
1242
|
+
id: import_zod12.z.string(),
|
1243
|
+
event: import_zod12.z.string(),
|
1141
1244
|
label: TranslationConfig,
|
1142
|
-
isDefault:
|
1143
|
-
fee:
|
1144
|
-
onTime:
|
1145
|
-
late:
|
1146
|
-
delayed:
|
1245
|
+
isDefault: import_zod12.z.boolean(),
|
1246
|
+
fee: import_zod12.z.object({
|
1247
|
+
onTime: import_zod12.z.number(),
|
1248
|
+
late: import_zod12.z.number(),
|
1249
|
+
delayed: import_zod12.z.number()
|
1147
1250
|
}),
|
1148
|
-
svgUrl:
|
1149
|
-
fonts:
|
1251
|
+
svgUrl: import_zod12.z.string(),
|
1252
|
+
fonts: import_zod12.z.record(FontFamily).optional()
|
1150
1253
|
});
|
1151
1254
|
var CertificateTemplateConfig = CertificateConfig.extend({
|
1152
|
-
hash:
|
1153
|
-
svg:
|
1255
|
+
hash: import_zod12.z.string().optional(),
|
1256
|
+
svg: import_zod12.z.string()
|
1154
1257
|
});
|
1155
1258
|
|
1156
1259
|
// ../commons/src/events/offline/LanguageConfig.ts
|
1157
|
-
var
|
1158
|
-
var LanguageConfig =
|
1159
|
-
lang:
|
1260
|
+
var import_zod13 = require("zod");
|
1261
|
+
var LanguageConfig = import_zod13.z.object({
|
1262
|
+
lang: import_zod13.z.string(),
|
1160
1263
|
/**
|
1161
1264
|
* client.csv contents
|
1162
1265
|
*/
|
1163
|
-
messages:
|
1266
|
+
messages: import_zod13.z.record(import_zod13.z.string())
|
1164
1267
|
});
|
1165
1268
|
|
1166
1269
|
// ../commons/src/events/EventConfig.ts
|
1167
|
-
var
|
1270
|
+
var import_zod22 = require("zod");
|
1168
1271
|
|
1169
1272
|
// ../commons/src/events/DeduplicationConfig.ts
|
1170
|
-
var
|
1171
|
-
var
|
1172
|
-
(0,
|
1173
|
-
var FieldReference2 =
|
1174
|
-
var Matcher =
|
1175
|
-
fieldId:
|
1176
|
-
options:
|
1177
|
-
boost:
|
1273
|
+
var import_zod14 = require("zod");
|
1274
|
+
var import_zod_openapi7 = require("zod-openapi");
|
1275
|
+
(0, import_zod_openapi7.extendZodWithOpenApi)(import_zod14.z);
|
1276
|
+
var FieldReference2 = import_zod14.z.string();
|
1277
|
+
var Matcher = import_zod14.z.object({
|
1278
|
+
fieldId: import_zod14.z.string(),
|
1279
|
+
options: import_zod14.z.object({
|
1280
|
+
boost: import_zod14.z.number().optional()
|
1178
1281
|
}).optional().default({})
|
1179
1282
|
});
|
1180
1283
|
var FuzzyMatcher = Matcher.extend({
|
1181
|
-
type:
|
1182
|
-
options:
|
1284
|
+
type: import_zod14.z.literal("fuzzy"),
|
1285
|
+
options: import_zod14.z.object({
|
1183
1286
|
/**
|
1184
1287
|
* Names of length 3 or less characters = 0 edits allowed
|
1185
1288
|
* Names of length 4 - 6 characters = 1 edit allowed
|
1186
1289
|
* Names of length >7 characters = 2 edits allowed
|
1187
1290
|
*/
|
1188
|
-
fuzziness:
|
1189
|
-
boost:
|
1291
|
+
fuzziness: import_zod14.z.union([import_zod14.z.string(), import_zod14.z.number()]).optional().default("AUTO:4,7"),
|
1292
|
+
boost: import_zod14.z.number().optional().default(1)
|
1190
1293
|
}).optional().default({})
|
1191
1294
|
});
|
1192
1295
|
var StrictMatcher = Matcher.extend({
|
1193
|
-
type:
|
1194
|
-
options:
|
1195
|
-
boost:
|
1296
|
+
type: import_zod14.z.literal("strict"),
|
1297
|
+
options: import_zod14.z.object({
|
1298
|
+
boost: import_zod14.z.number().optional().default(1)
|
1196
1299
|
}).optional().default({})
|
1197
1300
|
});
|
1198
1301
|
var DateRangeMatcher = Matcher.extend({
|
1199
|
-
type:
|
1200
|
-
options:
|
1201
|
-
days:
|
1302
|
+
type: import_zod14.z.literal("dateRange"),
|
1303
|
+
options: import_zod14.z.object({
|
1304
|
+
days: import_zod14.z.number(),
|
1202
1305
|
origin: FieldReference2,
|
1203
|
-
boost:
|
1306
|
+
boost: import_zod14.z.number().optional().default(1)
|
1204
1307
|
})
|
1205
1308
|
});
|
1206
1309
|
var DateDistanceMatcher = Matcher.extend({
|
1207
|
-
type:
|
1208
|
-
options:
|
1209
|
-
days:
|
1310
|
+
type: import_zod14.z.literal("dateDistance"),
|
1311
|
+
options: import_zod14.z.object({
|
1312
|
+
days: import_zod14.z.number(),
|
1210
1313
|
origin: FieldReference2,
|
1211
|
-
boost:
|
1314
|
+
boost: import_zod14.z.number().optional().default(1)
|
1212
1315
|
})
|
1213
1316
|
});
|
1214
|
-
var And =
|
1215
|
-
type:
|
1317
|
+
var And = import_zod14.z.object({
|
1318
|
+
type: import_zod14.z.literal("and"),
|
1216
1319
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
1217
|
-
clauses:
|
1320
|
+
clauses: import_zod14.z.lazy(() => Clause.array())
|
1218
1321
|
});
|
1219
|
-
var Or =
|
1220
|
-
type:
|
1322
|
+
var Or = import_zod14.z.object({
|
1323
|
+
type: import_zod14.z.literal("or"),
|
1221
1324
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
1222
|
-
clauses:
|
1325
|
+
clauses: import_zod14.z.lazy(() => Clause.array())
|
1223
1326
|
});
|
1224
|
-
var Clause =
|
1225
|
-
() =>
|
1327
|
+
var Clause = import_zod14.z.lazy(
|
1328
|
+
() => import_zod14.z.discriminatedUnion("type", [
|
1226
1329
|
And,
|
1227
1330
|
Or,
|
1228
1331
|
FuzzyMatcher,
|
@@ -1233,43 +1336,43 @@ var Clause = import_zod12.z.lazy(
|
|
1233
1336
|
).openapi({
|
1234
1337
|
ref: "Clause"
|
1235
1338
|
});
|
1236
|
-
var DeduplicationConfig =
|
1237
|
-
id:
|
1339
|
+
var DeduplicationConfig = import_zod14.z.object({
|
1340
|
+
id: import_zod14.z.string(),
|
1238
1341
|
label: TranslationConfig,
|
1239
1342
|
query: Clause
|
1240
1343
|
});
|
1241
1344
|
|
1242
1345
|
// ../commons/src/events/SummaryConfig.ts
|
1243
|
-
var
|
1244
|
-
var BaseField2 =
|
1346
|
+
var import_zod15 = require("zod");
|
1347
|
+
var BaseField2 = import_zod15.z.object({
|
1245
1348
|
emptyValueMessage: TranslationConfig.optional(),
|
1246
|
-
conditionals:
|
1349
|
+
conditionals: import_zod15.z.array(ShowConditional).default([]).optional()
|
1247
1350
|
});
|
1248
1351
|
var ReferenceField = BaseField2.extend({
|
1249
|
-
fieldId:
|
1352
|
+
fieldId: import_zod15.z.string(),
|
1250
1353
|
label: TranslationConfig.optional().describe(
|
1251
1354
|
"By default, the configured field's label is used. This can be overridden by providing a custom label."
|
1252
1355
|
)
|
1253
1356
|
}).describe("Field directly referencing event data with field id");
|
1254
1357
|
var Field = BaseField2.extend({
|
1255
|
-
id:
|
1358
|
+
id: import_zod15.z.string().describe("Id of summary field"),
|
1256
1359
|
value: TranslationConfig.describe(
|
1257
1360
|
"Summary field value. Can utilise values defined in configuration and EventMetadata"
|
1258
1361
|
),
|
1259
1362
|
label: TranslationConfig
|
1260
1363
|
}).describe("Custom configured field");
|
1261
|
-
var SummaryConfig =
|
1262
|
-
fields:
|
1364
|
+
var SummaryConfig = import_zod15.z.object({
|
1365
|
+
fields: import_zod15.z.array(import_zod15.z.union([Field, ReferenceField])).describe("Fields rendered in summary view.")
|
1263
1366
|
}).describe("Configuration for summary in event.");
|
1264
1367
|
|
1265
1368
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
1266
|
-
var
|
1267
|
-
var MatchType =
|
1268
|
-
var BaseField3 =
|
1269
|
-
config:
|
1369
|
+
var import_zod16 = require("zod");
|
1370
|
+
var MatchType = import_zod16.z.enum(["fuzzy", "exact", "range", "within"]);
|
1371
|
+
var BaseField3 = import_zod16.z.object({
|
1372
|
+
config: import_zod16.z.object({
|
1270
1373
|
type: MatchType.describe("Determines the type of field")
|
1271
1374
|
}),
|
1272
|
-
options:
|
1375
|
+
options: import_zod16.z.array(SelectOption).optional(),
|
1273
1376
|
searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
|
1274
1377
|
`
|
1275
1378
|
This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
|
@@ -1290,7 +1393,7 @@ var BaseField3 = import_zod14.z.object({
|
|
1290
1393
|
in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
|
1291
1394
|
`
|
1292
1395
|
),
|
1293
|
-
conditionals:
|
1396
|
+
conditionals: import_zod16.z.array(FieldConditional).default([]).optional().describe(
|
1294
1397
|
`
|
1295
1398
|
In advanced search, we sometimes need to override the default field visibility conditionals.
|
1296
1399
|
|
@@ -1304,50 +1407,58 @@ var BaseField3 = import_zod14.z.object({
|
|
1304
1407
|
are always rendered in the advanced search form.
|
1305
1408
|
`
|
1306
1409
|
),
|
1307
|
-
validations:
|
1410
|
+
validations: import_zod16.z.array(ValidationConfig).default([]).optional().describe(
|
1308
1411
|
`In advanced search, we sometimes need to override the default field validations.`
|
1309
1412
|
)
|
1310
1413
|
});
|
1311
|
-
var SearchQueryParams =
|
1312
|
-
eventType:
|
1414
|
+
var SearchQueryParams = import_zod16.z.object({
|
1415
|
+
eventType: import_zod16.z.string().optional().describe(
|
1313
1416
|
"Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
|
1314
1417
|
)
|
1315
1418
|
}).catchall(FieldValue);
|
1316
1419
|
var FieldConfigSchema = BaseField3.extend({
|
1317
|
-
fieldId:
|
1318
|
-
fieldType:
|
1420
|
+
fieldId: import_zod16.z.string(),
|
1421
|
+
fieldType: import_zod16.z.literal("field")
|
1319
1422
|
});
|
1320
|
-
var
|
1423
|
+
var EventFieldIdInput = import_zod16.z.enum([
|
1321
1424
|
"trackingId",
|
1322
1425
|
"status",
|
1323
|
-
"
|
1324
|
-
"
|
1426
|
+
"legalStatuses.REGISTERED.acceptedAt",
|
1427
|
+
"legalStatuses.REGISTERED.createdAtLocation",
|
1325
1428
|
"updatedAt"
|
1326
1429
|
]);
|
1430
|
+
var METADATA_FIELD_PREFIX = "event.";
|
1431
|
+
var EventFieldId = import_zod16.z.enum([
|
1432
|
+
`${METADATA_FIELD_PREFIX}trackingId`,
|
1433
|
+
`${METADATA_FIELD_PREFIX}status`,
|
1434
|
+
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
|
1435
|
+
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.createdAtLocation`,
|
1436
|
+
`${METADATA_FIELD_PREFIX}updatedAt`
|
1437
|
+
]);
|
1327
1438
|
var EventFieldConfigSchema = BaseField3.extend({
|
1328
1439
|
fieldId: EventFieldId,
|
1329
|
-
fieldType:
|
1440
|
+
fieldType: import_zod16.z.literal("event")
|
1330
1441
|
});
|
1331
|
-
var SearchField =
|
1442
|
+
var SearchField = import_zod16.z.discriminatedUnion("fieldType", [
|
1332
1443
|
FieldConfigSchema,
|
1333
1444
|
EventFieldConfigSchema
|
1334
1445
|
]);
|
1335
|
-
var AdvancedSearchConfig =
|
1446
|
+
var AdvancedSearchConfig = import_zod16.z.object({
|
1336
1447
|
title: TranslationConfig.describe("Advanced search tab title"),
|
1337
|
-
fields:
|
1448
|
+
fields: import_zod16.z.array(SearchField).describe("Advanced search fields.")
|
1338
1449
|
});
|
1339
1450
|
|
1340
1451
|
// ../commons/src/events/utils.ts
|
1341
1452
|
var import_lodash = require("lodash");
|
1342
1453
|
|
1343
1454
|
// ../commons/src/events/ActionDocument.ts
|
1344
|
-
var
|
1345
|
-
var
|
1455
|
+
var import_zod20 = require("zod");
|
1456
|
+
var import_zod_openapi8 = require("zod-openapi");
|
1346
1457
|
|
1347
1458
|
// ../commons/src/uuid.ts
|
1348
1459
|
var import_uuid = require("uuid");
|
1349
|
-
var
|
1350
|
-
var UUID =
|
1460
|
+
var import_zod17 = require("zod");
|
1461
|
+
var UUID = import_zod17.z.string().uuid().brand("UUID");
|
1351
1462
|
function getUUID() {
|
1352
1463
|
return (0, import_uuid.v4)();
|
1353
1464
|
}
|
@@ -1357,10 +1468,10 @@ var CreatedAtLocation = UUID.nullish();
|
|
1357
1468
|
|
1358
1469
|
// ../commons/src/authentication.ts
|
1359
1470
|
var import_jwt_decode = __toESM(require("jwt-decode"));
|
1360
|
-
var
|
1471
|
+
var import_zod19 = require("zod");
|
1361
1472
|
|
1362
1473
|
// ../commons/src/scopes.ts
|
1363
|
-
var
|
1474
|
+
var import_zod18 = require("zod");
|
1364
1475
|
var SCOPES = {
|
1365
1476
|
// TODO v1.8 legacy scopes
|
1366
1477
|
NATLSYSADMIN: "natlsysadmin",
|
@@ -1473,108 +1584,108 @@ var SCOPES = {
|
|
1473
1584
|
// data seeding
|
1474
1585
|
USER_DATA_SEEDING: "user.data-seeding"
|
1475
1586
|
};
|
1476
|
-
var LegacyScopes =
|
1477
|
-
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1486
|
-
|
1487
|
-
|
1587
|
+
var LegacyScopes = import_zod18.z.union([
|
1588
|
+
import_zod18.z.literal(SCOPES.NATLSYSADMIN),
|
1589
|
+
import_zod18.z.literal(SCOPES.BYPASSRATELIMIT),
|
1590
|
+
import_zod18.z.literal(SCOPES.DECLARE),
|
1591
|
+
import_zod18.z.literal(SCOPES.REGISTER),
|
1592
|
+
import_zod18.z.literal(SCOPES.VALIDATE),
|
1593
|
+
import_zod18.z.literal(SCOPES.DEMO),
|
1594
|
+
import_zod18.z.literal(SCOPES.CERTIFY),
|
1595
|
+
import_zod18.z.literal(SCOPES.PERFORMANCE),
|
1596
|
+
import_zod18.z.literal(SCOPES.SYSADMIN),
|
1597
|
+
import_zod18.z.literal(SCOPES.TEAMS),
|
1598
|
+
import_zod18.z.literal(SCOPES.CONFIG)
|
1488
1599
|
]);
|
1489
|
-
var IntegrationScopes =
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1600
|
+
var IntegrationScopes = import_zod18.z.union([
|
1601
|
+
import_zod18.z.literal(SCOPES.WEBHOOK),
|
1602
|
+
import_zod18.z.literal(SCOPES.NATIONALID),
|
1603
|
+
import_zod18.z.literal(SCOPES.NOTIFICATION_API),
|
1604
|
+
import_zod18.z.literal(SCOPES.RECORDSEARCH)
|
1494
1605
|
]);
|
1495
|
-
var DeclareScopes =
|
1496
|
-
|
1497
|
-
|
1498
|
-
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1606
|
+
var DeclareScopes = import_zod18.z.union([
|
1607
|
+
import_zod18.z.literal(SCOPES.RECORD_DECLARE),
|
1608
|
+
import_zod18.z.literal(SCOPES.RECORD_IMPORT),
|
1609
|
+
import_zod18.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
|
1610
|
+
import_zod18.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
|
1611
|
+
import_zod18.z.literal(SCOPES.RECORD_DECLARE_DEATH),
|
1612
|
+
import_zod18.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
|
1613
|
+
import_zod18.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
|
1614
|
+
import_zod18.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
|
1615
|
+
import_zod18.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
|
1616
|
+
import_zod18.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW)
|
1506
1617
|
]);
|
1507
|
-
var UnassignScope =
|
1508
|
-
var ValidateScopes =
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1514
|
-
|
1618
|
+
var UnassignScope = import_zod18.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS);
|
1619
|
+
var ValidateScopes = import_zod18.z.union([
|
1620
|
+
import_zod18.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
|
1621
|
+
import_zod18.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
|
1622
|
+
import_zod18.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
|
1623
|
+
import_zod18.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
|
1624
|
+
import_zod18.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
|
1625
|
+
import_zod18.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE)
|
1515
1626
|
]);
|
1516
|
-
var RegisterScope =
|
1517
|
-
var CertifyScopes =
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1627
|
+
var RegisterScope = import_zod18.z.literal(SCOPES.RECORD_REGISTER);
|
1628
|
+
var CertifyScopes = import_zod18.z.union([
|
1629
|
+
import_zod18.z.literal(SCOPES.RECORD_EXPORT_RECORDS),
|
1630
|
+
import_zod18.z.literal(SCOPES.RECORD_DECLARATION_PRINT),
|
1631
|
+
import_zod18.z.literal(SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS),
|
1632
|
+
import_zod18.z.literal(SCOPES.RECORD_REGISTRATION_PRINT),
|
1633
|
+
import_zod18.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
|
1634
|
+
import_zod18.z.literal(SCOPES.RECORD_PRINT_CERTIFIED_COPIES),
|
1635
|
+
import_zod18.z.literal(SCOPES.RECORD_BULK_PRINT_CERTIFIED_COPIES),
|
1636
|
+
import_zod18.z.literal(SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES)
|
1526
1637
|
]);
|
1527
|
-
var CorrectionScopes =
|
1528
|
-
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1534
|
-
|
1535
|
-
|
1638
|
+
var CorrectionScopes = import_zod18.z.union([
|
1639
|
+
import_zod18.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
|
1640
|
+
import_zod18.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
|
1641
|
+
import_zod18.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REVOCATION),
|
1642
|
+
import_zod18.z.literal(SCOPES.RECORD_REGISTRATION_REVOKE),
|
1643
|
+
import_zod18.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REINSTATEMENT),
|
1644
|
+
import_zod18.z.literal(SCOPES.RECORD_REGISTRATION_REINSTATE),
|
1645
|
+
import_zod18.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
|
1646
|
+
import_zod18.z.literal(SCOPES.RECORD_REJECT_REGISTRATION)
|
1536
1647
|
]);
|
1537
|
-
var SearchScopes =
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1648
|
+
var SearchScopes = import_zod18.z.union([
|
1649
|
+
import_zod18.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
|
1650
|
+
import_zod18.z.literal(SCOPES.SEARCH_BIRTH),
|
1651
|
+
import_zod18.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
|
1652
|
+
import_zod18.z.literal(SCOPES.SEARCH_DEATH),
|
1653
|
+
import_zod18.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
|
1654
|
+
import_zod18.z.literal(SCOPES.SEARCH_MARRIAGE)
|
1544
1655
|
]);
|
1545
|
-
var AuditScopes =
|
1546
|
-
|
1547
|
-
|
1548
|
-
|
1549
|
-
|
1656
|
+
var AuditScopes = import_zod18.z.union([
|
1657
|
+
import_zod18.z.literal(SCOPES.RECORD_READ),
|
1658
|
+
import_zod18.z.literal(SCOPES.RECORD_READ_AUDIT),
|
1659
|
+
import_zod18.z.literal(SCOPES.RECORD_READ_COMMENTS),
|
1660
|
+
import_zod18.z.literal(SCOPES.RECORD_CREATE_COMMENTS)
|
1550
1661
|
]);
|
1551
|
-
var ProfileScopes =
|
1552
|
-
|
1553
|
-
|
1662
|
+
var ProfileScopes = import_zod18.z.union([
|
1663
|
+
import_zod18.z.literal(SCOPES.PROFILE_UPDATE),
|
1664
|
+
import_zod18.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE)
|
1554
1665
|
]);
|
1555
|
-
var PerformanceScopes =
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1666
|
+
var PerformanceScopes = import_zod18.z.union([
|
1667
|
+
import_zod18.z.literal(SCOPES.PERFORMANCE_READ),
|
1668
|
+
import_zod18.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
|
1669
|
+
import_zod18.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS)
|
1559
1670
|
]);
|
1560
|
-
var OrganisationScopes =
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1671
|
+
var OrganisationScopes = import_zod18.z.union([
|
1672
|
+
import_zod18.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
|
1673
|
+
import_zod18.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
|
1674
|
+
import_zod18.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION)
|
1564
1675
|
]);
|
1565
|
-
var UserScopes =
|
1566
|
-
|
1567
|
-
|
1568
|
-
|
1569
|
-
|
1570
|
-
|
1571
|
-
|
1572
|
-
|
1573
|
-
|
1676
|
+
var UserScopes = import_zod18.z.union([
|
1677
|
+
import_zod18.z.literal(SCOPES.USER_READ),
|
1678
|
+
import_zod18.z.literal(SCOPES.USER_READ_MY_OFFICE),
|
1679
|
+
import_zod18.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
|
1680
|
+
import_zod18.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
|
1681
|
+
import_zod18.z.literal(SCOPES.USER_CREATE),
|
1682
|
+
import_zod18.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
|
1683
|
+
import_zod18.z.literal(SCOPES.USER_UPDATE),
|
1684
|
+
import_zod18.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION)
|
1574
1685
|
]);
|
1575
|
-
var ConfigScope =
|
1576
|
-
var DataSeedingScope =
|
1577
|
-
var LiteralScopes =
|
1686
|
+
var ConfigScope = import_zod18.z.literal(SCOPES.CONFIG_UPDATE_ALL);
|
1687
|
+
var DataSeedingScope = import_zod18.z.literal(SCOPES.USER_DATA_SEEDING);
|
1688
|
+
var LiteralScopes = import_zod18.z.union([
|
1578
1689
|
LegacyScopes,
|
1579
1690
|
IntegrationScopes,
|
1580
1691
|
UnassignScope,
|
@@ -1593,39 +1704,47 @@ var LiteralScopes = import_zod16.z.union([
|
|
1593
1704
|
DataSeedingScope
|
1594
1705
|
]);
|
1595
1706
|
var rawConfigurableScopeRegex = /^([a-zA-Z\.]+)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
|
1596
|
-
var rawConfigurableScope =
|
1597
|
-
var CreateUserScope =
|
1598
|
-
type:
|
1599
|
-
options:
|
1600
|
-
role:
|
1707
|
+
var rawConfigurableScope = import_zod18.z.string().regex(rawConfigurableScopeRegex);
|
1708
|
+
var CreateUserScope = import_zod18.z.object({
|
1709
|
+
type: import_zod18.z.literal("user.create"),
|
1710
|
+
options: import_zod18.z.object({
|
1711
|
+
role: import_zod18.z.array(import_zod18.z.string())
|
1601
1712
|
})
|
1602
1713
|
});
|
1603
|
-
var EditUserScope =
|
1604
|
-
type:
|
1605
|
-
options:
|
1606
|
-
role:
|
1714
|
+
var EditUserScope = import_zod18.z.object({
|
1715
|
+
type: import_zod18.z.literal("user.edit"),
|
1716
|
+
options: import_zod18.z.object({
|
1717
|
+
role: import_zod18.z.array(import_zod18.z.string())
|
1607
1718
|
})
|
1608
1719
|
});
|
1609
|
-
var WorkqueueScope =
|
1610
|
-
type:
|
1611
|
-
options:
|
1612
|
-
id:
|
1720
|
+
var WorkqueueScope = import_zod18.z.object({
|
1721
|
+
type: import_zod18.z.literal("workqueue"),
|
1722
|
+
options: import_zod18.z.object({
|
1723
|
+
id: import_zod18.z.array(import_zod18.z.string())
|
1613
1724
|
})
|
1614
1725
|
});
|
1615
|
-
var NotifyRecordScope =
|
1616
|
-
type:
|
1617
|
-
options:
|
1618
|
-
event:
|
1726
|
+
var NotifyRecordScope = import_zod18.z.object({
|
1727
|
+
type: import_zod18.z.literal("record.notify"),
|
1728
|
+
options: import_zod18.z.object({
|
1729
|
+
event: import_zod18.z.array(import_zod18.z.string())
|
1619
1730
|
})
|
1620
1731
|
});
|
1621
|
-
var
|
1732
|
+
var SearchScope = import_zod18.z.object({
|
1733
|
+
type: import_zod18.z.literal("search"),
|
1734
|
+
options: import_zod18.z.object({
|
1735
|
+
event: import_zod18.z.array(import_zod18.z.string()).length(1),
|
1736
|
+
access: import_zod18.z.array(import_zod18.z.enum(["my-jurisdiction", "all"])).length(1)
|
1737
|
+
})
|
1738
|
+
});
|
1739
|
+
var ConfigurableRawScopes = import_zod18.z.discriminatedUnion("type", [
|
1740
|
+
SearchScope,
|
1622
1741
|
CreateUserScope,
|
1623
1742
|
EditUserScope,
|
1624
1743
|
WorkqueueScope,
|
1625
1744
|
NotifyRecordScope
|
1626
1745
|
]);
|
1627
1746
|
var scopes = Object.values(SCOPES);
|
1628
|
-
var ActionScopes =
|
1747
|
+
var ActionScopes = import_zod18.z.union([
|
1629
1748
|
DeclareScopes,
|
1630
1749
|
ValidateScopes,
|
1631
1750
|
RegisterScope,
|
@@ -1776,30 +1895,30 @@ var DEFAULT_ROLES_DEFINITION = [
|
|
1776
1895
|
]
|
1777
1896
|
}
|
1778
1897
|
];
|
1779
|
-
var TokenUserType =
|
1780
|
-
var TokenWithBearer =
|
1898
|
+
var TokenUserType = import_zod19.z.enum(["user", "system"]);
|
1899
|
+
var TokenWithBearer = import_zod19.z.string().regex(/^Bearer\s/);
|
1781
1900
|
|
1782
1901
|
// ../commons/src/events/ActionDocument.ts
|
1783
|
-
(0,
|
1784
|
-
var ActionUpdate =
|
1785
|
-
var EventState =
|
1902
|
+
(0, import_zod_openapi8.extendZodWithOpenApi)(import_zod20.z);
|
1903
|
+
var ActionUpdate = import_zod20.z.record(import_zod20.z.string(), FieldUpdateValue);
|
1904
|
+
var EventState = import_zod20.z.record(import_zod20.z.string(), FieldValue);
|
1786
1905
|
var ActionStatus = {
|
1787
1906
|
Requested: "Requested",
|
1788
1907
|
Accepted: "Accepted",
|
1789
1908
|
Rejected: "Rejected"
|
1790
1909
|
};
|
1791
|
-
var ActionBase =
|
1910
|
+
var ActionBase = import_zod20.z.object({
|
1792
1911
|
id: UUID,
|
1793
|
-
transactionId:
|
1912
|
+
transactionId: import_zod20.z.string(),
|
1794
1913
|
createdByUserType: TokenUserType,
|
1795
|
-
createdAt:
|
1796
|
-
createdBy:
|
1797
|
-
createdByRole:
|
1798
|
-
createdBySignature:
|
1914
|
+
createdAt: import_zod20.z.string().datetime(),
|
1915
|
+
createdBy: import_zod20.z.string(),
|
1916
|
+
createdByRole: import_zod20.z.string(),
|
1917
|
+
createdBySignature: import_zod20.z.string().nullish().describe("Reference to signature of the user who created the action"),
|
1799
1918
|
createdAtLocation: CreatedAtLocation,
|
1800
1919
|
declaration: ActionUpdate,
|
1801
1920
|
annotation: ActionUpdate.optional().nullable(),
|
1802
|
-
status:
|
1921
|
+
status: import_zod20.z.enum([
|
1803
1922
|
ActionStatus.Requested,
|
1804
1923
|
ActionStatus.Accepted,
|
1805
1924
|
ActionStatus.Rejected
|
@@ -1810,91 +1929,91 @@ var ActionBase = import_zod18.z.object({
|
|
1810
1929
|
)
|
1811
1930
|
});
|
1812
1931
|
var AssignedAction = ActionBase.merge(
|
1813
|
-
|
1814
|
-
type:
|
1815
|
-
assignedTo:
|
1932
|
+
import_zod20.z.object({
|
1933
|
+
type: import_zod20.z.literal(ActionType.ASSIGN),
|
1934
|
+
assignedTo: import_zod20.z.string()
|
1816
1935
|
})
|
1817
1936
|
);
|
1818
1937
|
var UnassignedAction = ActionBase.merge(
|
1819
|
-
|
1820
|
-
type:
|
1938
|
+
import_zod20.z.object({
|
1939
|
+
type: import_zod20.z.literal(ActionType.UNASSIGN)
|
1821
1940
|
})
|
1822
1941
|
);
|
1823
1942
|
var RegisterAction = ActionBase.merge(
|
1824
|
-
|
1825
|
-
type:
|
1826
|
-
registrationNumber:
|
1943
|
+
import_zod20.z.object({
|
1944
|
+
type: import_zod20.z.literal(ActionType.REGISTER),
|
1945
|
+
registrationNumber: import_zod20.z.string().optional()
|
1827
1946
|
})
|
1828
1947
|
);
|
1829
1948
|
var DeclareAction = ActionBase.merge(
|
1830
|
-
|
1831
|
-
type:
|
1949
|
+
import_zod20.z.object({
|
1950
|
+
type: import_zod20.z.literal(ActionType.DECLARE)
|
1832
1951
|
})
|
1833
1952
|
);
|
1834
1953
|
var ValidateAction = ActionBase.merge(
|
1835
|
-
|
1836
|
-
type:
|
1954
|
+
import_zod20.z.object({
|
1955
|
+
type: import_zod20.z.literal(ActionType.VALIDATE)
|
1837
1956
|
})
|
1838
1957
|
);
|
1839
|
-
var RejectionReason =
|
1840
|
-
message:
|
1841
|
-
isDuplicate:
|
1958
|
+
var RejectionReason = import_zod20.z.object({
|
1959
|
+
message: import_zod20.z.string().min(1, { message: "Message cannot be empty" }).describe("Message describing reason for rejection or archiving"),
|
1960
|
+
isDuplicate: import_zod20.z.boolean().optional().describe("If a declaration is duplicated")
|
1842
1961
|
});
|
1843
1962
|
var RejectAction = ActionBase.merge(
|
1844
|
-
|
1845
|
-
type:
|
1963
|
+
import_zod20.z.object({
|
1964
|
+
type: import_zod20.z.literal(ActionType.REJECT),
|
1846
1965
|
reason: RejectionReason
|
1847
1966
|
})
|
1848
1967
|
);
|
1849
1968
|
var MarkAsDuplicateAction = ActionBase.merge(
|
1850
|
-
|
1851
|
-
type:
|
1969
|
+
import_zod20.z.object({
|
1970
|
+
type: import_zod20.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1852
1971
|
})
|
1853
1972
|
);
|
1854
1973
|
var ArchiveAction = ActionBase.merge(
|
1855
|
-
|
1856
|
-
type:
|
1974
|
+
import_zod20.z.object({
|
1975
|
+
type: import_zod20.z.literal(ActionType.ARCHIVE),
|
1857
1976
|
reason: RejectionReason
|
1858
1977
|
})
|
1859
1978
|
);
|
1860
1979
|
var CreatedAction = ActionBase.merge(
|
1861
|
-
|
1862
|
-
type:
|
1980
|
+
import_zod20.z.object({
|
1981
|
+
type: import_zod20.z.literal(ActionType.CREATE)
|
1863
1982
|
})
|
1864
1983
|
);
|
1865
1984
|
var NotifiedAction = ActionBase.merge(
|
1866
|
-
|
1867
|
-
type:
|
1985
|
+
import_zod20.z.object({
|
1986
|
+
type: import_zod20.z.literal(ActionType.NOTIFY)
|
1868
1987
|
})
|
1869
1988
|
);
|
1870
1989
|
var PrintCertificateAction = ActionBase.merge(
|
1871
|
-
|
1872
|
-
type:
|
1990
|
+
import_zod20.z.object({
|
1991
|
+
type: import_zod20.z.literal(ActionType.PRINT_CERTIFICATE)
|
1873
1992
|
})
|
1874
1993
|
);
|
1875
1994
|
var RequestedCorrectionAction = ActionBase.merge(
|
1876
|
-
|
1877
|
-
type:
|
1995
|
+
import_zod20.z.object({
|
1996
|
+
type: import_zod20.z.literal(ActionType.REQUEST_CORRECTION)
|
1878
1997
|
})
|
1879
1998
|
);
|
1880
1999
|
var ApprovedCorrectionAction = ActionBase.merge(
|
1881
|
-
|
1882
|
-
type:
|
1883
|
-
requestId:
|
2000
|
+
import_zod20.z.object({
|
2001
|
+
type: import_zod20.z.literal(ActionType.APPROVE_CORRECTION),
|
2002
|
+
requestId: import_zod20.z.string()
|
1884
2003
|
})
|
1885
2004
|
);
|
1886
2005
|
var RejectedCorrectionAction = ActionBase.merge(
|
1887
|
-
|
1888
|
-
type:
|
1889
|
-
requestId:
|
2006
|
+
import_zod20.z.object({
|
2007
|
+
type: import_zod20.z.literal(ActionType.REJECT_CORRECTION),
|
2008
|
+
requestId: import_zod20.z.string()
|
1890
2009
|
})
|
1891
2010
|
);
|
1892
2011
|
var ReadAction = ActionBase.merge(
|
1893
|
-
|
1894
|
-
type:
|
2012
|
+
import_zod20.z.object({
|
2013
|
+
type: import_zod20.z.literal(ActionType.READ)
|
1895
2014
|
})
|
1896
2015
|
);
|
1897
|
-
var ActionDocument =
|
2016
|
+
var ActionDocument = import_zod20.z.discriminatedUnion("type", [
|
1898
2017
|
CreatedAction.openapi({ ref: "CreatedAction" }),
|
1899
2018
|
ValidateAction.openapi({ ref: "ValidateAction" }),
|
1900
2019
|
RejectAction.openapi({ ref: "RejectAction" }),
|
@@ -1917,22 +2036,23 @@ var AsyncRejectActionDocument = ActionBase.omit({
|
|
1917
2036
|
declaration: true,
|
1918
2037
|
annotation: true
|
1919
2038
|
}).merge(
|
1920
|
-
|
1921
|
-
type:
|
1922
|
-
status:
|
2039
|
+
import_zod20.z.object({
|
2040
|
+
type: import_zod20.z.enum(ConfirmableActions),
|
2041
|
+
status: import_zod20.z.literal(ActionStatus.Rejected)
|
1923
2042
|
})
|
1924
2043
|
);
|
1925
|
-
var Action =
|
1926
|
-
var ResolvedUser =
|
1927
|
-
id:
|
1928
|
-
role:
|
1929
|
-
name:
|
1930
|
-
|
1931
|
-
use:
|
1932
|
-
given:
|
1933
|
-
family:
|
2044
|
+
var Action = import_zod20.z.union([ActionDocument, AsyncRejectActionDocument]);
|
2045
|
+
var ResolvedUser = import_zod20.z.object({
|
2046
|
+
id: import_zod20.z.string(),
|
2047
|
+
role: import_zod20.z.string(),
|
2048
|
+
name: import_zod20.z.array(
|
2049
|
+
import_zod20.z.object({
|
2050
|
+
use: import_zod20.z.string(),
|
2051
|
+
given: import_zod20.z.array(import_zod20.z.string()),
|
2052
|
+
family: import_zod20.z.string()
|
1934
2053
|
})
|
1935
|
-
)
|
2054
|
+
),
|
2055
|
+
primaryOfficeId: import_zod20.z.string()
|
1936
2056
|
});
|
1937
2057
|
|
1938
2058
|
// ../commons/src/conditionals/validate.ts
|
@@ -1941,7 +2061,7 @@ var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
1941
2061
|
var import_date_fns = require("date-fns");
|
1942
2062
|
|
1943
2063
|
// ../commons/src/events/FieldTypeMapping.ts
|
1944
|
-
var
|
2064
|
+
var import_zod21 = require("zod");
|
1945
2065
|
function mapFieldTypeToZod(type, required) {
|
1946
2066
|
let schema;
|
1947
2067
|
switch (type) {
|
@@ -1954,6 +2074,9 @@ function mapFieldTypeToZod(type, required) {
|
|
1954
2074
|
case FieldType.DATE_RANGE:
|
1955
2075
|
schema = DateRangeFieldValue;
|
1956
2076
|
break;
|
2077
|
+
case FieldType.SELECT_DATE_RANGE:
|
2078
|
+
schema = SelectDateRangeValue;
|
2079
|
+
break;
|
1957
2080
|
case FieldType.TEXT:
|
1958
2081
|
case FieldType.TEXTAREA:
|
1959
2082
|
case FieldType.DIVIDER:
|
@@ -2001,7 +2124,7 @@ function createValidationSchema(config) {
|
|
2001
2124
|
for (const field2 of config) {
|
2002
2125
|
shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
|
2003
2126
|
}
|
2004
|
-
return
|
2127
|
+
return import_zod21.z.object(shape);
|
2005
2128
|
}
|
2006
2129
|
function mapFieldTypeToEmptyValue(field2) {
|
2007
2130
|
switch (field2.type) {
|
@@ -2023,6 +2146,7 @@ function mapFieldTypeToEmptyValue(field2) {
|
|
2023
2146
|
case FieldType.DATE:
|
2024
2147
|
case FieldType.CHECKBOX:
|
2025
2148
|
case FieldType.DATE_RANGE:
|
2149
|
+
case FieldType.SELECT_DATE_RANGE:
|
2026
2150
|
case FieldType.DATA:
|
2027
2151
|
case FieldType.NAME:
|
2028
2152
|
case FieldType.PHONE:
|
@@ -2045,7 +2169,7 @@ function mapFieldTypeToEmptyValue(field2) {
|
|
2045
2169
|
case FieldType.SIGNATURE:
|
2046
2170
|
case FieldType.FILE:
|
2047
2171
|
return {
|
2048
|
-
|
2172
|
+
path: "",
|
2049
2173
|
originalFilename: "",
|
2050
2174
|
type: ""
|
2051
2175
|
};
|
@@ -2062,6 +2186,9 @@ var isDateFieldType = (field2) => {
|
|
2062
2186
|
var isDateRangeFieldType = (field2) => {
|
2063
2187
|
return field2.config.type === FieldType.DATE_RANGE;
|
2064
2188
|
};
|
2189
|
+
var isSelectDateRangeFieldType = (field2) => {
|
2190
|
+
return field2.config.type === FieldType.SELECT_DATE_RANGE;
|
2191
|
+
};
|
2065
2192
|
var isPageHeaderFieldType = (field2) => {
|
2066
2193
|
return field2.config.type === FieldType.PAGE_HEADER;
|
2067
2194
|
};
|
@@ -2165,7 +2292,9 @@ ajv.addKeyword({
|
|
2165
2292
|
}
|
2166
2293
|
});
|
2167
2294
|
function validate(schema, data) {
|
2168
|
-
|
2295
|
+
const validator = ajv.getSchema(schema.$id) || ajv.compile(schema);
|
2296
|
+
const result = validator(data);
|
2297
|
+
return result;
|
2169
2298
|
}
|
2170
2299
|
function isConditionMet(conditional, values) {
|
2171
2300
|
return validate(conditional, {
|
@@ -2229,7 +2358,7 @@ var errorMessages = {
|
|
2229
2358
|
id: "v2.error.invalidEmail"
|
2230
2359
|
},
|
2231
2360
|
requiredField: {
|
2232
|
-
defaultMessage: "Required
|
2361
|
+
defaultMessage: "Required",
|
2233
2362
|
description: "Error message when required field is missing",
|
2234
2363
|
id: "v2.error.required"
|
2235
2364
|
},
|
@@ -2311,6 +2440,23 @@ function validateFieldInput({
|
|
2311
2440
|
);
|
2312
2441
|
return rawError.error?.issues.map((issue) => issue.message) ?? [];
|
2313
2442
|
}
|
2443
|
+
function runStructuralValidations({
|
2444
|
+
field: field2,
|
2445
|
+
values
|
2446
|
+
}) {
|
2447
|
+
if (!isFieldVisible(field2, values) || isFieldEmptyAndNotRequired(field2, values)) {
|
2448
|
+
return {
|
2449
|
+
errors: []
|
2450
|
+
};
|
2451
|
+
}
|
2452
|
+
const fieldValidationResult = validateFieldInput({
|
2453
|
+
field: field2,
|
2454
|
+
value: values[field2.id]
|
2455
|
+
});
|
2456
|
+
return {
|
2457
|
+
errors: fieldValidationResult
|
2458
|
+
};
|
2459
|
+
}
|
2314
2460
|
function runFieldValidations({
|
2315
2461
|
field: field2,
|
2316
2462
|
values
|
@@ -2363,6 +2509,7 @@ function getValidatorsForField(fieldId, validations) {
|
|
2363
2509
|
message,
|
2364
2510
|
validator: {
|
2365
2511
|
...jsonSchema,
|
2512
|
+
$id: jsonSchema.$id + "." + fieldId,
|
2366
2513
|
properties: {
|
2367
2514
|
$form: {
|
2368
2515
|
type: "object",
|
@@ -2389,6 +2536,7 @@ function joinValues(values, separator = " ") {
|
|
2389
2536
|
}
|
2390
2537
|
|
2391
2538
|
// ../commons/src/events/utils.ts
|
2539
|
+
var import_date_fns2 = require("date-fns");
|
2392
2540
|
function isDeclarationActionConfig(action) {
|
2393
2541
|
return DeclarationActions.safeParse(action.type).success;
|
2394
2542
|
}
|
@@ -2401,6 +2549,15 @@ function getDeclarationPages(configuration) {
|
|
2401
2549
|
function getDeclaration(configuration) {
|
2402
2550
|
return configuration.declaration;
|
2403
2551
|
}
|
2552
|
+
function getPrintCertificatePages(configuration) {
|
2553
|
+
const action = configuration.actions.find(
|
2554
|
+
(a) => a.type === ActionType.PRINT_CERTIFICATE
|
2555
|
+
);
|
2556
|
+
return getOrThrow(
|
2557
|
+
action?.printForm.pages,
|
2558
|
+
`${ActionType.PRINT_CERTIFICATE} action does not have print form set.`
|
2559
|
+
);
|
2560
|
+
}
|
2404
2561
|
var getActionAnnotationFields = (actionConfig) => {
|
2405
2562
|
if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
|
2406
2563
|
return [
|
@@ -2470,10 +2627,16 @@ function omitHiddenPaginatedFields(formConfig, declaration) {
|
|
2470
2627
|
const visiblePagesFormFields = formConfig.pages.filter((p) => isPageVisible(p, declaration)).flatMap((p) => p.fields);
|
2471
2628
|
return omitHiddenFields(visiblePagesFormFields, declaration);
|
2472
2629
|
}
|
2473
|
-
function
|
2474
|
-
const actions =
|
2630
|
+
function findActiveDraftForEvent(event2, draft) {
|
2631
|
+
const actions = (0, import_lodash.orderBy)(
|
2632
|
+
event2.actions.filter(({ type }) => type !== ActionType.READ),
|
2633
|
+
["createdAt"],
|
2634
|
+
["asc"]
|
2635
|
+
);
|
2475
2636
|
const lastAction = actions[actions.length - 1];
|
2476
|
-
|
2637
|
+
const isDraftActive = draft.createdAt >= lastAction.createdAt;
|
2638
|
+
const isDraftForEvent = event2.id === draft.eventId;
|
2639
|
+
return isDraftActive && isDraftForEvent ? draft : void 0;
|
2477
2640
|
}
|
2478
2641
|
function createEmptyDraft(eventId, draftId, actionType) {
|
2479
2642
|
return {
|
@@ -2588,12 +2751,56 @@ function getEventConfigById(eventConfigs, id) {
|
|
2588
2751
|
);
|
2589
2752
|
return getOrThrow(eventConfig, `Event config for ${id} not found`);
|
2590
2753
|
}
|
2754
|
+
function timePeriodToDateRange(value) {
|
2755
|
+
let startDate;
|
2756
|
+
switch (value) {
|
2757
|
+
case "last7Days":
|
2758
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 7);
|
2759
|
+
break;
|
2760
|
+
case "last30Days":
|
2761
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 30);
|
2762
|
+
break;
|
2763
|
+
case "last90Days":
|
2764
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 90);
|
2765
|
+
break;
|
2766
|
+
case "last365Days":
|
2767
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 365);
|
2768
|
+
break;
|
2769
|
+
}
|
2770
|
+
return {
|
2771
|
+
startDate: startDate.toISOString(),
|
2772
|
+
endDate: (/* @__PURE__ */ new Date()).toISOString()
|
2773
|
+
};
|
2774
|
+
}
|
2775
|
+
function mergeDrafts(currentDraft, incomingDraft) {
|
2776
|
+
if (currentDraft.eventId !== incomingDraft.eventId) {
|
2777
|
+
throw new Error(
|
2778
|
+
`Cannot merge drafts for different events: ${currentDraft.eventId} and ${incomingDraft.eventId}`
|
2779
|
+
);
|
2780
|
+
}
|
2781
|
+
return {
|
2782
|
+
...currentDraft,
|
2783
|
+
...incomingDraft,
|
2784
|
+
action: {
|
2785
|
+
...currentDraft.action,
|
2786
|
+
...incomingDraft.action,
|
2787
|
+
declaration: deepMerge(
|
2788
|
+
currentDraft.action.declaration,
|
2789
|
+
incomingDraft.action.declaration
|
2790
|
+
),
|
2791
|
+
annotation: deepMerge(
|
2792
|
+
currentDraft.action.annotation ?? {},
|
2793
|
+
incomingDraft.action.annotation ?? {}
|
2794
|
+
)
|
2795
|
+
}
|
2796
|
+
};
|
2797
|
+
}
|
2591
2798
|
|
2592
2799
|
// ../commons/src/events/EventConfig.ts
|
2593
|
-
var
|
2594
|
-
(0,
|
2595
|
-
var EventConfig =
|
2596
|
-
id:
|
2800
|
+
var import_zod_openapi9 = require("zod-openapi");
|
2801
|
+
(0, import_zod_openapi9.extendZodWithOpenApi)(import_zod22.z);
|
2802
|
+
var EventConfig = import_zod22.z.object({
|
2803
|
+
id: import_zod22.z.string().describe(
|
2597
2804
|
'A machine-readable identifier for the event, e.g. "birth" or "death"'
|
2598
2805
|
),
|
2599
2806
|
dateOfEvent: FieldReference.optional(),
|
@@ -2603,10 +2810,10 @@ var EventConfig = import_zod20.z.object({
|
|
2603
2810
|
),
|
2604
2811
|
summary: SummaryConfig,
|
2605
2812
|
label: TranslationConfig,
|
2606
|
-
actions:
|
2813
|
+
actions: import_zod22.z.array(ActionConfig),
|
2607
2814
|
declaration: DeclarationFormConfig,
|
2608
|
-
deduplication:
|
2609
|
-
advancedSearch:
|
2815
|
+
deduplication: import_zod22.z.array(DeduplicationConfig).optional().default([]),
|
2816
|
+
advancedSearch: import_zod22.z.array(AdvancedSearchConfig).optional().default([])
|
2610
2817
|
}).superRefine((event2, ctx) => {
|
2611
2818
|
const allFields = findAllFields(event2);
|
2612
2819
|
const fieldIds = allFields.map((field2) => field2.id);
|
@@ -2668,16 +2875,20 @@ var definePage = (page) => PageConfig.parse(page);
|
|
2668
2875
|
var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
|
2669
2876
|
|
2670
2877
|
// ../commons/src/events/WorkqueueConfig.ts
|
2671
|
-
var
|
2878
|
+
var import_zod29 = require("zod");
|
2879
|
+
|
2880
|
+
// ../commons/src/conditionals/conditionals.ts
|
2881
|
+
var objectHash = __toESM(require("object-hash"));
|
2672
2882
|
|
2673
2883
|
// ../commons/src/events/serializers/user/serializer.ts
|
2674
|
-
var
|
2675
|
-
var SerializedUserField =
|
2676
|
-
$userField:
|
2884
|
+
var import_zod23 = require("zod");
|
2885
|
+
var SerializedUserField = import_zod23.z.object({
|
2886
|
+
$userField: import_zod23.z.enum([
|
2677
2887
|
"id",
|
2678
2888
|
"name",
|
2679
2889
|
"role",
|
2680
|
-
"
|
2890
|
+
"signature",
|
2891
|
+
"avatar",
|
2681
2892
|
"primaryOfficeId"
|
2682
2893
|
])
|
2683
2894
|
});
|
@@ -2689,7 +2900,10 @@ function userSerializer(userField) {
|
|
2689
2900
|
|
2690
2901
|
// ../commons/src/conditionals/conditionals.ts
|
2691
2902
|
function defineConditional(schema) {
|
2692
|
-
return
|
2903
|
+
return {
|
2904
|
+
$id: `https://opencrvs.org/conditionals/${objectHash.sha1(schema)}`,
|
2905
|
+
...schema
|
2906
|
+
};
|
2693
2907
|
}
|
2694
2908
|
function defineFormConditional(schema) {
|
2695
2909
|
const schemaWithForm = {
|
@@ -2749,38 +2963,6 @@ var user = Object.assign(userSerializer, {
|
|
2749
2963
|
required: ["$user"]
|
2750
2964
|
})
|
2751
2965
|
});
|
2752
|
-
function createEventConditionals() {
|
2753
|
-
return {
|
2754
|
-
/**
|
2755
|
-
* Checks if the event contains a specific action type.
|
2756
|
-
* @param action - The action type to check for.
|
2757
|
-
*/
|
2758
|
-
hasAction: (action) => defineConditional({
|
2759
|
-
type: "object",
|
2760
|
-
properties: {
|
2761
|
-
$event: {
|
2762
|
-
type: "object",
|
2763
|
-
properties: {
|
2764
|
-
actions: {
|
2765
|
-
type: "array",
|
2766
|
-
contains: {
|
2767
|
-
type: "object",
|
2768
|
-
properties: {
|
2769
|
-
type: {
|
2770
|
-
const: action
|
2771
|
-
}
|
2772
|
-
},
|
2773
|
-
required: ["type"]
|
2774
|
-
}
|
2775
|
-
}
|
2776
|
-
},
|
2777
|
-
required: ["actions"]
|
2778
|
-
}
|
2779
|
-
},
|
2780
|
-
required: ["$event"]
|
2781
|
-
})
|
2782
|
-
};
|
2783
|
-
}
|
2784
2966
|
function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
|
2785
2967
|
return {
|
2786
2968
|
type: "object",
|
@@ -2956,11 +3138,11 @@ function createFieldConditionals(fieldId) {
|
|
2956
3138
|
properties: {
|
2957
3139
|
[fieldId]: {
|
2958
3140
|
type: "string",
|
2959
|
-
|
2960
|
-
|
3141
|
+
minLength: 1,
|
3142
|
+
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'.-]*)*$",
|
3143
|
+
description: "Name must contain only letters, numbers, and allowed special characters ('.-). No double spaces."
|
2961
3144
|
}
|
2962
|
-
}
|
2963
|
-
required: [fieldId]
|
3145
|
+
}
|
2964
3146
|
}),
|
2965
3147
|
/**
|
2966
3148
|
* Checks if the field value matches a given regular expression pattern.
|
@@ -3016,7 +3198,7 @@ function createSearchConfig(baseField) {
|
|
3016
3198
|
*
|
3017
3199
|
* @returns An object containing the field ID and a configuration object with a type of 'range'.
|
3018
3200
|
*
|
3019
|
-
* @example event('
|
3201
|
+
* @example event('legalStatuses.REGISTERED.acceptedAt').range()
|
3020
3202
|
* // {
|
3021
3203
|
* // ...
|
3022
3204
|
* // config: { type: 'range' }
|
@@ -3051,26 +3233,65 @@ function createSearchConfig(baseField) {
|
|
3051
3233
|
fuzzy: () => ({
|
3052
3234
|
...baseField,
|
3053
3235
|
config: { type: "fuzzy" }
|
3236
|
+
}),
|
3237
|
+
/**
|
3238
|
+
* Creates a configuration for matching locations and the child locations
|
3239
|
+
* @returns An object containing the field ID and a configuration object with a type of 'within'.
|
3240
|
+
* @example field('createdAtLocation').within()
|
3241
|
+
* // {
|
3242
|
+
* // ...
|
3243
|
+
* // config: { type: 'within' }
|
3244
|
+
* // }
|
3245
|
+
*/
|
3246
|
+
within: () => ({
|
3247
|
+
...baseField,
|
3248
|
+
config: { type: "within" }
|
3054
3249
|
})
|
3055
3250
|
};
|
3056
3251
|
}
|
3057
3252
|
|
3058
3253
|
// ../commons/src/event-config/event-configuration.ts
|
3059
|
-
function createEventFieldConfig(fieldId
|
3254
|
+
function createEventFieldConfig(fieldId) {
|
3060
3255
|
const baseField = {
|
3061
|
-
fieldId
|
3062
|
-
options,
|
3256
|
+
fieldId: `${METADATA_FIELD_PREFIX}${fieldId}`,
|
3063
3257
|
fieldType: "event"
|
3064
3258
|
};
|
3065
3259
|
return createSearchConfig(baseField);
|
3066
3260
|
}
|
3067
3261
|
|
3068
3262
|
// ../commons/src/events/event.ts
|
3069
|
-
function eventFn(fieldId
|
3070
|
-
return createEventFieldConfig(fieldId
|
3263
|
+
function eventFn(fieldId) {
|
3264
|
+
return createEventFieldConfig(fieldId);
|
3071
3265
|
}
|
3072
3266
|
var event = Object.assign(eventFn, {
|
3073
|
-
|
3267
|
+
/**
|
3268
|
+
* Checks if the event contains a specific action type.
|
3269
|
+
* @param action - The action type to check for.
|
3270
|
+
*/
|
3271
|
+
hasAction: (action) => defineConditional({
|
3272
|
+
type: "object",
|
3273
|
+
properties: {
|
3274
|
+
$event: {
|
3275
|
+
type: "object",
|
3276
|
+
properties: {
|
3277
|
+
actions: {
|
3278
|
+
type: "array",
|
3279
|
+
contains: {
|
3280
|
+
type: "object",
|
3281
|
+
properties: {
|
3282
|
+
type: {
|
3283
|
+
const: action
|
3284
|
+
}
|
3285
|
+
},
|
3286
|
+
required: ["type"]
|
3287
|
+
}
|
3288
|
+
}
|
3289
|
+
},
|
3290
|
+
required: ["actions"]
|
3291
|
+
}
|
3292
|
+
},
|
3293
|
+
required: ["$event"]
|
3294
|
+
}),
|
3074
3295
|
field(field2) {
|
3075
3296
|
return {
|
3076
3297
|
$event: field2
|
@@ -3079,83 +3300,82 @@ var event = Object.assign(eventFn, {
|
|
3079
3300
|
});
|
3080
3301
|
|
3081
3302
|
// ../commons/src/events/WorkqueueColumnConfig.ts
|
3082
|
-
var
|
3303
|
+
var import_zod25 = require("zod");
|
3083
3304
|
|
3084
3305
|
// ../commons/src/events/EventMetadata.ts
|
3085
|
-
var
|
3086
|
-
var EventStatus =
|
3306
|
+
var import_zod24 = require("zod");
|
3307
|
+
var EventStatus = import_zod24.z.enum([
|
3087
3308
|
"CREATED",
|
3088
3309
|
"NOTIFIED",
|
3089
3310
|
"DECLARED",
|
3090
3311
|
"VALIDATED",
|
3091
3312
|
"REGISTERED",
|
3092
|
-
"CERTIFIED",
|
3093
|
-
"REJECTED",
|
3094
3313
|
"ARCHIVED"
|
3095
3314
|
]);
|
3096
3315
|
var InherentFlags = {
|
3097
|
-
|
3316
|
+
PENDING_CERTIFICATION: "pending-certification",
|
3098
3317
|
INCOMPLETE: "incomplete",
|
3099
3318
|
REJECTED: "rejected",
|
3100
3319
|
CORRECTION_REQUESTED: "correction-requested"
|
3101
3320
|
};
|
3102
|
-
var
|
3321
|
+
var ActionFlag = import_zod24.z.string().regex(
|
3103
3322
|
new RegExp(
|
3104
3323
|
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
3105
3324
|
ActionStatus
|
3106
3325
|
).join("|").toLowerCase()})$`
|
3107
3326
|
),
|
3108
3327
|
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
3109
|
-
)
|
3110
|
-
var
|
3111
|
-
var
|
3112
|
-
|
3113
|
-
|
3328
|
+
);
|
3329
|
+
var Flag = ActionFlag.or(import_zod24.z.nativeEnum(InherentFlags));
|
3330
|
+
var ZodDate = import_zod24.z.string().date();
|
3331
|
+
var ActionCreationMetadata = import_zod24.z.object({
|
3332
|
+
createdAt: import_zod24.z.string().datetime().describe("The timestamp when the action request was created."),
|
3333
|
+
createdBy: import_zod24.z.string().describe("ID of the user who created the action request."),
|
3114
3334
|
createdAtLocation: CreatedAtLocation.describe(
|
3115
3335
|
"Location of the user who created the action request."
|
3116
3336
|
),
|
3117
|
-
createdByUserType:
|
3118
|
-
acceptedAt:
|
3119
|
-
createdByRole:
|
3120
|
-
createdBySignature:
|
3337
|
+
createdByUserType: import_zod24.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
3338
|
+
acceptedAt: import_zod24.z.string().datetime().describe("Timestamp when the action request was accepted."),
|
3339
|
+
createdByRole: import_zod24.z.string().describe("Role of the user at the time of action request creation."),
|
3340
|
+
createdBySignature: import_zod24.z.string().nullish().describe("Signature of the user who created the action request.")
|
3121
3341
|
});
|
3122
3342
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
3123
|
-
registrationNumber:
|
3343
|
+
registrationNumber: import_zod24.z.string().describe(
|
3124
3344
|
"Registration number of the event. Always present for accepted registrations."
|
3125
3345
|
)
|
3126
3346
|
});
|
3127
|
-
var LegalStatuses =
|
3347
|
+
var LegalStatuses = import_zod24.z.object({
|
3128
3348
|
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
3129
3349
|
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
3130
3350
|
});
|
3131
|
-
var EventMetadata =
|
3351
|
+
var EventMetadata = import_zod24.z.object({
|
3132
3352
|
id: UUID,
|
3133
|
-
type:
|
3353
|
+
type: import_zod24.z.string().describe("The type of event, such as birth, death, or marriage."),
|
3134
3354
|
status: EventStatus,
|
3135
3355
|
legalStatuses: LegalStatuses.describe(
|
3136
3356
|
"Metadata related to the legal registration of the event, such as who registered it and when."
|
3137
3357
|
),
|
3138
|
-
createdAt:
|
3358
|
+
createdAt: import_zod24.z.string().datetime().describe("The timestamp when the event was first created and saved."),
|
3139
3359
|
dateOfEvent: ZodDate.nullish(),
|
3140
|
-
createdBy:
|
3141
|
-
createdByUserType:
|
3142
|
-
updatedByUserRole:
|
3360
|
+
createdBy: import_zod24.z.string().describe("ID of the user who created the event."),
|
3361
|
+
createdByUserType: import_zod24.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
3362
|
+
updatedByUserRole: import_zod24.z.string().describe("Role of the user who last changed the status."),
|
3143
3363
|
createdAtLocation: CreatedAtLocation.describe(
|
3144
3364
|
"Location of the user who created the event."
|
3145
3365
|
),
|
3146
|
-
createdBySignature:
|
3366
|
+
createdBySignature: import_zod24.z.string().nullish().describe("Signature of the user who created the event."),
|
3147
3367
|
updatedAtLocation: UUID.nullish().describe(
|
3148
3368
|
"Location of the user who last changed the status."
|
3149
3369
|
),
|
3150
|
-
updatedAt:
|
3370
|
+
updatedAt: import_zod24.z.string().datetime().describe(
|
3151
3371
|
"Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
|
3152
3372
|
),
|
3153
|
-
assignedTo:
|
3154
|
-
updatedBy:
|
3155
|
-
trackingId:
|
3373
|
+
assignedTo: import_zod24.z.string().nullish().describe("ID of the user currently assigned to the event."),
|
3374
|
+
updatedBy: import_zod24.z.string().nullish().describe("ID of the user who last changed the status."),
|
3375
|
+
trackingId: import_zod24.z.string().describe(
|
3156
3376
|
"System-generated tracking ID used by informants or registrars to look up the event."
|
3157
3377
|
),
|
3158
|
-
flags:
|
3378
|
+
flags: import_zod24.z.array(Flag)
|
3159
3379
|
});
|
3160
3380
|
var EventMetadataKeysArray = [
|
3161
3381
|
"id",
|
@@ -3175,7 +3395,7 @@ var EventMetadataKeysArray = [
|
|
3175
3395
|
"legalStatuses",
|
3176
3396
|
"flags"
|
3177
3397
|
];
|
3178
|
-
var EventMetadataKeys =
|
3398
|
+
var EventMetadataKeys = import_zod24.z.enum(EventMetadataKeysArray);
|
3179
3399
|
var eventMetadataLabelMap = {
|
3180
3400
|
"event.assignedTo": {
|
3181
3401
|
id: "event.assignedTo.label",
|
@@ -3260,11 +3480,11 @@ var WorkqueueColumnKeysArray = [
|
|
3260
3480
|
"title",
|
3261
3481
|
"outbox"
|
3262
3482
|
];
|
3263
|
-
var WorkqueueColumnKeys =
|
3264
|
-
var WorkqueueColumnValue =
|
3483
|
+
var WorkqueueColumnKeys = import_zod25.z.enum(WorkqueueColumnKeysArray);
|
3484
|
+
var WorkqueueColumnValue = import_zod25.z.object({
|
3265
3485
|
$event: WorkqueueColumnKeys
|
3266
3486
|
});
|
3267
|
-
var WorkqueueColumn =
|
3487
|
+
var WorkqueueColumn = import_zod25.z.object({
|
3268
3488
|
label: TranslationConfig,
|
3269
3489
|
value: WorkqueueColumnValue
|
3270
3490
|
});
|
@@ -3275,115 +3495,130 @@ function defineWorkqueuesColumns(workqueueColumns) {
|
|
3275
3495
|
}
|
3276
3496
|
|
3277
3497
|
// ../commons/src/events/CountryConfigQueryInput.ts
|
3278
|
-
var
|
3498
|
+
var import_zod27 = require("zod");
|
3279
3499
|
|
3280
3500
|
// ../commons/src/events/EventIndex.ts
|
3281
|
-
var
|
3282
|
-
var
|
3283
|
-
(0,
|
3501
|
+
var import_zod26 = require("zod");
|
3502
|
+
var import_zod_openapi10 = require("zod-openapi");
|
3503
|
+
(0, import_zod_openapi10.extendZodWithOpenApi)(import_zod26.z);
|
3284
3504
|
var EventIndex = EventMetadata.extend({
|
3285
3505
|
declaration: EventState
|
3286
3506
|
}).openapi({
|
3287
3507
|
ref: "EventIndex"
|
3288
3508
|
});
|
3289
|
-
var EventSearchIndex =
|
3290
|
-
|
3291
|
-
type:
|
3509
|
+
var EventSearchIndex = import_zod26.z.record(import_zod26.z.string(), import_zod26.z.any()).and(
|
3510
|
+
import_zod26.z.object({
|
3511
|
+
type: import_zod26.z.string()
|
3292
3512
|
// Ensures "type" (event-id) exists and is a string
|
3293
3513
|
})
|
3294
3514
|
).openapi({
|
3295
3515
|
ref: "EventSearchIndex"
|
3296
3516
|
});
|
3297
|
-
var Fuzzy =
|
3517
|
+
var Fuzzy = import_zod26.z.object({ type: import_zod26.z.literal("fuzzy"), term: import_zod26.z.string() }).openapi({
|
3298
3518
|
ref: "Fuzzy"
|
3299
3519
|
});
|
3300
|
-
var Exact =
|
3520
|
+
var Exact = import_zod26.z.object({ type: import_zod26.z.literal("exact"), term: import_zod26.z.string() }).openapi({
|
3301
3521
|
ref: "Exact"
|
3302
3522
|
});
|
3303
|
-
var ExactStatus =
|
3304
|
-
type:
|
3523
|
+
var ExactStatus = import_zod26.z.object({
|
3524
|
+
type: import_zod26.z.literal("exact"),
|
3305
3525
|
term: EventStatus
|
3306
3526
|
}).openapi({
|
3307
3527
|
ref: "ExactStatus"
|
3308
3528
|
});
|
3309
|
-
var
|
3310
|
-
type:
|
3311
|
-
|
3529
|
+
var ExactUserType = import_zod26.z.object({
|
3530
|
+
type: import_zod26.z.literal("exact"),
|
3531
|
+
term: TokenUserType
|
3532
|
+
}).openapi({
|
3533
|
+
ref: "ExactUserType"
|
3534
|
+
});
|
3535
|
+
var AnyOf = import_zod26.z.object({
|
3536
|
+
type: import_zod26.z.literal("anyOf"),
|
3537
|
+
terms: import_zod26.z.array(import_zod26.z.string())
|
3312
3538
|
}).openapi({
|
3313
3539
|
ref: "AnyOf"
|
3314
3540
|
});
|
3315
|
-
var AnyOfStatus =
|
3316
|
-
type:
|
3317
|
-
terms:
|
3541
|
+
var AnyOfStatus = import_zod26.z.object({
|
3542
|
+
type: import_zod26.z.literal("anyOf"),
|
3543
|
+
terms: import_zod26.z.array(EventStatus)
|
3318
3544
|
}).openapi({
|
3319
3545
|
ref: "AnyOfStatus"
|
3320
3546
|
});
|
3321
|
-
var Range =
|
3322
|
-
type:
|
3323
|
-
gte:
|
3324
|
-
lte:
|
3547
|
+
var Range = import_zod26.z.object({
|
3548
|
+
type: import_zod26.z.literal("range"),
|
3549
|
+
gte: import_zod26.z.string(),
|
3550
|
+
lte: import_zod26.z.string()
|
3325
3551
|
}).openapi({
|
3326
3552
|
ref: "Range"
|
3327
3553
|
});
|
3328
|
-
var ContainsFlags =
|
3329
|
-
anyOf:
|
3330
|
-
noneOf:
|
3554
|
+
var ContainsFlags = import_zod26.z.object({
|
3555
|
+
anyOf: import_zod26.z.array(Flag).optional(),
|
3556
|
+
noneOf: import_zod26.z.array(Flag).optional()
|
3331
3557
|
}).openapi({
|
3332
3558
|
ref: "ContainsFlags"
|
3333
3559
|
});
|
3334
|
-
var Within =
|
3560
|
+
var Within = import_zod26.z.object({ type: import_zod26.z.literal("within"), location: import_zod26.z.string() }).openapi({
|
3335
3561
|
ref: "Within"
|
3336
3562
|
});
|
3337
|
-
var RangeDate =
|
3338
|
-
|
3339
|
-
|
3340
|
-
|
3341
|
-
|
3342
|
-
});
|
3563
|
+
var RangeDate = import_zod26.z.object({
|
3564
|
+
type: import_zod26.z.literal("range"),
|
3565
|
+
gte: import_zod26.z.string().date().or(import_zod26.z.string().datetime()),
|
3566
|
+
lte: import_zod26.z.string().date().or(import_zod26.z.string().datetime())
|
3567
|
+
}).openapi({ ref: "RangeDate" });
|
3343
3568
|
var ExactDate = Exact.extend({
|
3344
|
-
term:
|
3569
|
+
term: import_zod26.z.string().date().or(import_zod26.z.string().datetime())
|
3345
3570
|
}).openapi({
|
3346
3571
|
ref: "ExactDate"
|
3347
3572
|
});
|
3348
|
-
var
|
3573
|
+
var TimePeriod = import_zod26.z.object({
|
3574
|
+
type: import_zod26.z.literal("timePeriod"),
|
3575
|
+
term: SelectDateRangeValue
|
3576
|
+
}).openapi({
|
3577
|
+
ref: "TimePeriod"
|
3578
|
+
});
|
3579
|
+
var DateCondition = import_zod26.z.union([ExactDate, RangeDate, TimePeriod]).openapi({
|
3349
3580
|
ref: "DateCondition"
|
3350
3581
|
});
|
3351
|
-
var QueryInput =
|
3352
|
-
() =>
|
3353
|
-
|
3354
|
-
|
3582
|
+
var QueryInput = import_zod26.z.lazy(
|
3583
|
+
() => import_zod26.z.union([
|
3584
|
+
import_zod26.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf]),
|
3585
|
+
import_zod26.z.record(import_zod26.z.string(), QueryInput)
|
3355
3586
|
])
|
3356
3587
|
).openapi({
|
3357
3588
|
ref: "QueryInput"
|
3358
3589
|
});
|
3359
|
-
var QueryExpression =
|
3360
|
-
id:
|
3361
|
-
eventType:
|
3362
|
-
status:
|
3363
|
-
createdAt:
|
3364
|
-
updatedAt:
|
3365
|
-
"
|
3366
|
-
"
|
3367
|
-
|
3590
|
+
var QueryExpression = import_zod26.z.object({
|
3591
|
+
id: import_zod26.z.optional(import_zod26.z.string()),
|
3592
|
+
eventType: import_zod26.z.string(),
|
3593
|
+
status: import_zod26.z.optional(import_zod26.z.union([AnyOfStatus, ExactStatus])),
|
3594
|
+
createdAt: import_zod26.z.optional(DateCondition),
|
3595
|
+
updatedAt: import_zod26.z.optional(DateCondition),
|
3596
|
+
"legalStatuses.REGISTERED.acceptedAt": import_zod26.z.optional(DateCondition),
|
3597
|
+
"legalStatuses.DECLARED.createdAtLocation": import_zod26.z.optional(
|
3598
|
+
import_zod26.z.union([Within, Exact])
|
3368
3599
|
),
|
3369
|
-
"
|
3370
|
-
|
3371
|
-
|
3372
|
-
|
3373
|
-
|
3374
|
-
|
3375
|
-
|
3376
|
-
|
3377
|
-
|
3600
|
+
"legalStatuses.REGISTERED.createdAtLocation": import_zod26.z.optional(
|
3601
|
+
import_zod26.z.union([Within, Exact])
|
3602
|
+
),
|
3603
|
+
"legalStatuses.REGISTERED.registrationNumber": import_zod26.z.optional(Exact),
|
3604
|
+
createdAtLocation: import_zod26.z.optional(import_zod26.z.union([Within, Exact])),
|
3605
|
+
updatedAtLocation: import_zod26.z.optional(import_zod26.z.union([Within, Exact])),
|
3606
|
+
assignedTo: import_zod26.z.optional(Exact),
|
3607
|
+
createdByUserType: import_zod26.z.optional(ExactUserType),
|
3608
|
+
createdBy: import_zod26.z.optional(Exact),
|
3609
|
+
updatedBy: import_zod26.z.optional(Exact),
|
3610
|
+
trackingId: import_zod26.z.optional(Exact),
|
3611
|
+
flags: import_zod26.z.optional(ContainsFlags),
|
3612
|
+
// @todo: The type for this comes out as "any"
|
3378
3613
|
data: QueryInput
|
3379
3614
|
}).partial().refine((obj) => Object.values(obj).some((val) => val !== void 0), {
|
3380
3615
|
message: "At least one query field must be specified."
|
3381
3616
|
}).openapi({
|
3382
3617
|
ref: "QueryExpression"
|
3383
3618
|
});
|
3384
|
-
var QueryType =
|
3385
|
-
type:
|
3386
|
-
clauses:
|
3619
|
+
var QueryType = import_zod26.z.object({
|
3620
|
+
type: import_zod26.z.literal("and").or(import_zod26.z.literal("or")).openapi({ default: "and" }),
|
3621
|
+
clauses: import_zod26.z.preprocess(
|
3387
3622
|
(val) => {
|
3388
3623
|
if (typeof val === "string") {
|
3389
3624
|
return [JSON.parse(val)];
|
@@ -3393,7 +3628,7 @@ var QueryType = import_zod24.z.object({
|
|
3393
3628
|
}
|
3394
3629
|
return val;
|
3395
3630
|
},
|
3396
|
-
|
3631
|
+
import_zod26.z.array(QueryExpression).nonempty("At least one clause is required.").openapi({
|
3397
3632
|
default: [
|
3398
3633
|
{
|
3399
3634
|
eventType: TENNIS_CLUB_MEMBERSHIP,
|
@@ -3414,58 +3649,62 @@ var QueryType = import_zod24.z.object({
|
|
3414
3649
|
}).openapi({
|
3415
3650
|
ref: "QueryType"
|
3416
3651
|
});
|
3652
|
+
var SearchScopeAccessLevels = {
|
3653
|
+
MY_JURISDICTION: "my-jurisdiction",
|
3654
|
+
ALL: "all"
|
3655
|
+
};
|
3417
3656
|
|
3418
3657
|
// ../commons/src/events/CountryConfigQueryInput.ts
|
3419
|
-
var SerializableExact =
|
3420
|
-
type:
|
3421
|
-
term:
|
3658
|
+
var SerializableExact = import_zod27.z.object({
|
3659
|
+
type: import_zod27.z.literal("exact"),
|
3660
|
+
term: import_zod27.z.union([import_zod27.z.string(), SerializedUserField])
|
3422
3661
|
});
|
3423
|
-
var SerializableWithin =
|
3424
|
-
type:
|
3425
|
-
location:
|
3662
|
+
var SerializableWithin = import_zod27.z.object({
|
3663
|
+
type: import_zod27.z.literal("within"),
|
3664
|
+
location: import_zod27.z.union([import_zod27.z.string(), SerializedUserField])
|
3426
3665
|
});
|
3427
|
-
var SerializedQueryExpression =
|
3428
|
-
eventType:
|
3429
|
-
status:
|
3430
|
-
createdAt:
|
3431
|
-
updatedAt:
|
3432
|
-
"
|
3433
|
-
"
|
3434
|
-
|
3666
|
+
var SerializedQueryExpression = import_zod27.z.object({
|
3667
|
+
eventType: import_zod27.z.string(),
|
3668
|
+
status: import_zod27.z.optional(import_zod27.z.union([AnyOfStatus, ExactStatus])),
|
3669
|
+
createdAt: import_zod27.z.optional(DateCondition),
|
3670
|
+
updatedAt: import_zod27.z.optional(DateCondition),
|
3671
|
+
"legalStatuses.REGISTERED.createdAt": import_zod27.z.optional(DateCondition),
|
3672
|
+
"legalStatuses.REGISTERED.createdAtLocation": import_zod27.z.optional(
|
3673
|
+
import_zod27.z.union([Within, Exact])
|
3435
3674
|
),
|
3436
|
-
"
|
3437
|
-
createdAtLocation:
|
3438
|
-
|
3675
|
+
"legalStatuses.REGISTERED.registrationNumber": import_zod27.z.optional(Exact),
|
3676
|
+
createdAtLocation: import_zod27.z.optional(
|
3677
|
+
import_zod27.z.union([SerializableWithin, SerializableExact])
|
3439
3678
|
),
|
3440
|
-
updatedAtLocation:
|
3441
|
-
|
3679
|
+
updatedAtLocation: import_zod27.z.optional(
|
3680
|
+
import_zod27.z.union([SerializableWithin, SerializableExact])
|
3442
3681
|
),
|
3443
|
-
assignedTo:
|
3444
|
-
createdBy:
|
3445
|
-
createdByUserType:
|
3446
|
-
updatedBy:
|
3447
|
-
trackingId:
|
3448
|
-
flags:
|
3682
|
+
assignedTo: import_zod27.z.optional(SerializableExact),
|
3683
|
+
createdBy: import_zod27.z.optional(SerializableExact),
|
3684
|
+
createdByUserType: ExactUserType,
|
3685
|
+
updatedBy: import_zod27.z.optional(SerializableExact),
|
3686
|
+
trackingId: import_zod27.z.optional(Exact),
|
3687
|
+
flags: import_zod27.z.optional(ContainsFlags),
|
3449
3688
|
data: QueryInput
|
3450
3689
|
}).partial();
|
3451
|
-
var Or2 =
|
3452
|
-
type:
|
3453
|
-
clauses:
|
3690
|
+
var Or2 = import_zod27.z.object({
|
3691
|
+
type: import_zod27.z.literal("or"),
|
3692
|
+
clauses: import_zod27.z.array(SerializedQueryExpression)
|
3454
3693
|
});
|
3455
|
-
var And2 =
|
3456
|
-
type:
|
3457
|
-
clauses:
|
3694
|
+
var And2 = import_zod27.z.object({
|
3695
|
+
type: import_zod27.z.literal("and"),
|
3696
|
+
clauses: import_zod27.z.array(SerializedQueryExpression)
|
3458
3697
|
});
|
3459
|
-
var CountryConfigQueryType =
|
3460
|
-
var CountryConfigQueryInputType =
|
3698
|
+
var CountryConfigQueryType = import_zod27.z.discriminatedUnion("type", [And2, Or2]);
|
3699
|
+
var CountryConfigQueryInputType = import_zod27.z.union([
|
3461
3700
|
SerializedQueryExpression,
|
3462
3701
|
And2,
|
3463
3702
|
Or2
|
3464
3703
|
]);
|
3465
3704
|
|
3466
3705
|
// ../commons/src/icons.ts
|
3467
|
-
var
|
3468
|
-
var AvailableIcons =
|
3706
|
+
var import_zod28 = require("zod");
|
3707
|
+
var AvailableIcons = import_zod28.z.enum([
|
3469
3708
|
"Archived",
|
3470
3709
|
"Assigned",
|
3471
3710
|
"Certified",
|
@@ -3586,43 +3825,45 @@ var mandatoryColumns = defineWorkqueuesColumns([
|
|
3586
3825
|
value: event.field("updatedAt")
|
3587
3826
|
}
|
3588
3827
|
]);
|
3589
|
-
var WorkqueueActionsWithDefault =
|
3828
|
+
var WorkqueueActionsWithDefault = import_zod29.z.enum([
|
3590
3829
|
...workqueueActions.options,
|
3591
3830
|
"DEFAULT"
|
3592
3831
|
]);
|
3593
|
-
var WorkqueueConfig =
|
3594
|
-
slug:
|
3832
|
+
var WorkqueueConfig = import_zod29.z.object({
|
3833
|
+
slug: import_zod29.z.string().describe("Determines the url of the workqueue."),
|
3595
3834
|
name: TranslationConfig.describe(
|
3596
3835
|
"Title of the workflow (both in navigation and on the page)"
|
3597
3836
|
),
|
3598
3837
|
query: CountryConfigQueryType,
|
3599
|
-
actions:
|
3600
|
-
|
3838
|
+
actions: import_zod29.z.array(
|
3839
|
+
import_zod29.z.object({
|
3601
3840
|
type: WorkqueueActionsWithDefault,
|
3602
|
-
conditionals:
|
3841
|
+
conditionals: import_zod29.z.array(Conditional).optional()
|
3603
3842
|
})
|
3604
3843
|
),
|
3605
|
-
columns:
|
3606
|
-
icon: AvailableIcons
|
3844
|
+
columns: import_zod29.z.array(WorkqueueColumn).default(mandatoryColumns),
|
3845
|
+
icon: AvailableIcons,
|
3846
|
+
emptyMessage: TranslationConfig.optional()
|
3607
3847
|
}).describe("Configuration for workqueue.");
|
3608
3848
|
var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
|
3609
3849
|
query: true,
|
3610
3850
|
columns: true
|
3611
3851
|
});
|
3612
|
-
var WorkqueueConfigInput =
|
3613
|
-
slug:
|
3852
|
+
var WorkqueueConfigInput = import_zod29.z.object({
|
3853
|
+
slug: import_zod29.z.string().describe("Determines the url of the workqueue."),
|
3614
3854
|
name: TranslationConfig.describe(
|
3615
3855
|
"Title of the workflow (both in navigation and on the page)"
|
3616
3856
|
),
|
3617
3857
|
query: CountryConfigQueryInputType,
|
3618
|
-
actions:
|
3619
|
-
|
3858
|
+
actions: import_zod29.z.array(
|
3859
|
+
import_zod29.z.object({
|
3620
3860
|
type: WorkqueueActionsWithDefault,
|
3621
|
-
conditionals:
|
3861
|
+
conditionals: import_zod29.z.array(Conditional).optional()
|
3622
3862
|
})
|
3623
3863
|
),
|
3624
|
-
columns:
|
3625
|
-
icon: AvailableIcons
|
3864
|
+
columns: import_zod29.z.array(WorkqueueColumn).default(mandatoryColumns),
|
3865
|
+
icon: AvailableIcons,
|
3866
|
+
emptyMessage: TranslationConfig.optional()
|
3626
3867
|
});
|
3627
3868
|
function defineWorkqueue(workqueueInput) {
|
3628
3869
|
const queryInput = workqueueInput.query;
|
@@ -3632,10 +3873,10 @@ function defineWorkqueue(workqueueInput) {
|
|
3632
3873
|
function defineWorkqueues(workqueues) {
|
3633
3874
|
return workqueues.map((workqueue) => defineWorkqueue(workqueue));
|
3634
3875
|
}
|
3635
|
-
var WorkqueueCountInput =
|
3636
|
-
|
3876
|
+
var WorkqueueCountInput = import_zod29.z.array(
|
3877
|
+
import_zod29.z.object({ slug: import_zod29.z.string(), query: QueryType })
|
3637
3878
|
);
|
3638
|
-
var WorkqueueCountOutput =
|
3879
|
+
var WorkqueueCountOutput = import_zod29.z.record(import_zod29.z.string(), import_zod29.z.number());
|
3639
3880
|
|
3640
3881
|
// ../commons/src/events/workqueueDefaultColumns.ts
|
3641
3882
|
var defaultWorkqueueColumns = [
|
@@ -3658,42 +3899,42 @@ var defaultWorkqueueColumns = [
|
|
3658
3899
|
];
|
3659
3900
|
|
3660
3901
|
// ../commons/src/events/Draft.ts
|
3661
|
-
var
|
3902
|
+
var import_zod31 = require("zod");
|
3662
3903
|
|
3663
3904
|
// ../commons/src/events/ActionInput.ts
|
3664
|
-
var
|
3665
|
-
var
|
3666
|
-
(0,
|
3667
|
-
var BaseActionInput =
|
3905
|
+
var import_zod30 = require("zod");
|
3906
|
+
var import_zod_openapi11 = require("zod-openapi");
|
3907
|
+
(0, import_zod_openapi11.extendZodWithOpenApi)(import_zod30.z);
|
3908
|
+
var BaseActionInput = import_zod30.z.object({
|
3668
3909
|
eventId: UUID,
|
3669
|
-
transactionId:
|
3910
|
+
transactionId: import_zod30.z.string(),
|
3670
3911
|
declaration: ActionUpdate.default({}),
|
3671
3912
|
annotation: ActionUpdate.optional(),
|
3672
3913
|
originalActionId: UUID.optional(),
|
3673
3914
|
// should not be part of base action.
|
3674
|
-
keepAssignment:
|
3915
|
+
keepAssignment: import_zod30.z.boolean().optional()
|
3675
3916
|
});
|
3676
3917
|
var CreateActionInput = BaseActionInput.merge(
|
3677
|
-
|
3678
|
-
type:
|
3918
|
+
import_zod30.z.object({
|
3919
|
+
type: import_zod30.z.literal(ActionType.CREATE).default(ActionType.CREATE),
|
3679
3920
|
createdAtLocation: CreatedAtLocation
|
3680
3921
|
})
|
3681
3922
|
);
|
3682
3923
|
var RegisterActionInput = BaseActionInput.merge(
|
3683
|
-
|
3684
|
-
type:
|
3685
|
-
registrationNumber:
|
3924
|
+
import_zod30.z.object({
|
3925
|
+
type: import_zod30.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
3926
|
+
registrationNumber: import_zod30.z.string().optional()
|
3686
3927
|
})
|
3687
3928
|
).strict();
|
3688
3929
|
var ValidateActionInput = BaseActionInput.merge(
|
3689
|
-
|
3690
|
-
type:
|
3691
|
-
duplicates:
|
3930
|
+
import_zod30.z.object({
|
3931
|
+
type: import_zod30.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
|
3932
|
+
duplicates: import_zod30.z.array(import_zod30.z.string())
|
3692
3933
|
})
|
3693
3934
|
);
|
3694
3935
|
var NotifyActionInput = BaseActionInput.merge(
|
3695
|
-
|
3696
|
-
type:
|
3936
|
+
import_zod30.z.object({
|
3937
|
+
type: import_zod30.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
|
3697
3938
|
})
|
3698
3939
|
).openapi({
|
3699
3940
|
default: {
|
@@ -3705,68 +3946,68 @@ var NotifyActionInput = BaseActionInput.merge(
|
|
3705
3946
|
}
|
3706
3947
|
});
|
3707
3948
|
var DeclareActionInput = BaseActionInput.merge(
|
3708
|
-
|
3709
|
-
type:
|
3949
|
+
import_zod30.z.object({
|
3950
|
+
type: import_zod30.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
3710
3951
|
})
|
3711
3952
|
);
|
3712
3953
|
var PrintCertificateActionInput = BaseActionInput.merge(
|
3713
|
-
|
3714
|
-
type:
|
3954
|
+
import_zod30.z.object({
|
3955
|
+
type: import_zod30.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
|
3715
3956
|
})
|
3716
3957
|
);
|
3717
3958
|
var RejectDeclarationActionInput = BaseActionInput.merge(
|
3718
|
-
|
3719
|
-
type:
|
3959
|
+
import_zod30.z.object({
|
3960
|
+
type: import_zod30.z.literal(ActionType.REJECT).default(ActionType.REJECT),
|
3720
3961
|
reason: RejectionReason
|
3721
3962
|
})
|
3722
3963
|
);
|
3723
3964
|
var MarkedAsDuplicateActionInput = BaseActionInput.merge(
|
3724
|
-
|
3725
|
-
type:
|
3965
|
+
import_zod30.z.object({
|
3966
|
+
type: import_zod30.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
|
3726
3967
|
})
|
3727
3968
|
);
|
3728
3969
|
var ArchiveActionInput = BaseActionInput.merge(
|
3729
|
-
|
3730
|
-
type:
|
3970
|
+
import_zod30.z.object({
|
3971
|
+
type: import_zod30.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
|
3731
3972
|
reason: RejectionReason
|
3732
3973
|
})
|
3733
3974
|
);
|
3734
3975
|
var AssignActionInput = BaseActionInput.merge(
|
3735
|
-
|
3736
|
-
type:
|
3737
|
-
assignedTo:
|
3976
|
+
import_zod30.z.object({
|
3977
|
+
type: import_zod30.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
|
3978
|
+
assignedTo: import_zod30.z.string()
|
3738
3979
|
})
|
3739
3980
|
);
|
3740
3981
|
var UnassignActionInput = BaseActionInput.merge(
|
3741
|
-
|
3742
|
-
type:
|
3743
|
-
assignedTo:
|
3982
|
+
import_zod30.z.object({
|
3983
|
+
type: import_zod30.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
|
3984
|
+
assignedTo: import_zod30.z.literal(null).default(null)
|
3744
3985
|
})
|
3745
3986
|
);
|
3746
3987
|
var RequestCorrectionActionInput = BaseActionInput.merge(
|
3747
|
-
|
3748
|
-
type:
|
3988
|
+
import_zod30.z.object({
|
3989
|
+
type: import_zod30.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
3749
3990
|
})
|
3750
3991
|
);
|
3751
3992
|
var RejectCorrectionActionInput = BaseActionInput.merge(
|
3752
|
-
|
3753
|
-
requestId:
|
3754
|
-
type:
|
3993
|
+
import_zod30.z.object({
|
3994
|
+
requestId: import_zod30.z.string(),
|
3995
|
+
type: import_zod30.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
|
3755
3996
|
})
|
3756
3997
|
);
|
3757
3998
|
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
3758
|
-
|
3759
|
-
requestId:
|
3760
|
-
type:
|
3999
|
+
import_zod30.z.object({
|
4000
|
+
requestId: import_zod30.z.string(),
|
4001
|
+
type: import_zod30.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
3761
4002
|
})
|
3762
4003
|
);
|
3763
4004
|
var ReadActionInput = BaseActionInput.merge(
|
3764
|
-
|
3765
|
-
type:
|
4005
|
+
import_zod30.z.object({
|
4006
|
+
type: import_zod30.z.literal(ActionType.READ).default(ActionType.READ)
|
3766
4007
|
})
|
3767
4008
|
);
|
3768
|
-
var DeleteActionInput =
|
3769
|
-
var ActionInput =
|
4009
|
+
var DeleteActionInput = import_zod30.z.object({ eventId: UUID });
|
4010
|
+
var ActionInput = import_zod30.z.discriminatedUnion("type", [
|
3770
4011
|
CreateActionInput.openapi({ ref: "CreateActionInput" }),
|
3771
4012
|
ValidateActionInput.openapi({ ref: "ValidateActionInput" }),
|
3772
4013
|
RegisterActionInput.openapi({ ref: "RegisterActionInput" }),
|
@@ -3795,18 +4036,18 @@ var ActionInput = import_zod28.z.discriminatedUnion("type", [
|
|
3795
4036
|
});
|
3796
4037
|
|
3797
4038
|
// ../commons/src/events/Draft.ts
|
3798
|
-
var Draft =
|
4039
|
+
var Draft = import_zod31.z.object({
|
3799
4040
|
id: UUID,
|
3800
4041
|
eventId: UUID,
|
3801
|
-
transactionId:
|
3802
|
-
createdAt:
|
4042
|
+
transactionId: import_zod31.z.string(),
|
4043
|
+
createdAt: import_zod31.z.string().datetime(),
|
3803
4044
|
action: ActionBase.extend({
|
3804
|
-
type: ActionTypes
|
4045
|
+
type: ActionTypes.exclude([ActionTypes.Enum.DELETE])
|
3805
4046
|
}).omit({ id: true })
|
3806
4047
|
});
|
3807
4048
|
var DraftInput = BaseActionInput.extend({
|
3808
|
-
type: ActionTypes,
|
3809
|
-
status:
|
4049
|
+
type: ActionTypes.exclude([ActionTypes.Enum.DELETE]),
|
4050
|
+
status: import_zod31.z.enum([
|
3810
4051
|
ActionStatus.Requested,
|
3811
4052
|
ActionStatus.Accepted,
|
3812
4053
|
ActionStatus.Rejected
|
@@ -3814,27 +4055,31 @@ var DraftInput = BaseActionInput.extend({
|
|
3814
4055
|
});
|
3815
4056
|
|
3816
4057
|
// ../commons/src/events/EventInput.ts
|
3817
|
-
var
|
4058
|
+
var import_zod32 = require("zod");
|
3818
4059
|
var import_uuid8 = require("uuid");
|
3819
|
-
var EventInput =
|
3820
|
-
transactionId:
|
3821
|
-
type:
|
4060
|
+
var EventInput = import_zod32.z.object({
|
4061
|
+
transactionId: import_zod32.z.string(),
|
4062
|
+
type: import_zod32.z.string()
|
3822
4063
|
}).openapi({ default: { transactionId: (0, import_uuid8.v4)(), type: "v2.birth" } });
|
3823
4064
|
|
3824
4065
|
// ../commons/src/events/EventDocument.ts
|
3825
|
-
var
|
3826
|
-
var
|
3827
|
-
(0,
|
3828
|
-
var EventDocument =
|
4066
|
+
var import_zod33 = require("zod");
|
4067
|
+
var import_zod_openapi12 = require("zod-openapi");
|
4068
|
+
(0, import_zod_openapi12.extendZodWithOpenApi)(import_zod33.z);
|
4069
|
+
var EventDocument = import_zod33.z.object({
|
3829
4070
|
id: UUID,
|
3830
|
-
type:
|
3831
|
-
createdAt:
|
3832
|
-
updatedAt:
|
3833
|
-
actions:
|
3834
|
-
trackingId:
|
4071
|
+
type: import_zod33.z.string(),
|
4072
|
+
createdAt: import_zod33.z.string().datetime(),
|
4073
|
+
updatedAt: import_zod33.z.string().datetime(),
|
4074
|
+
actions: import_zod33.z.array(Action),
|
4075
|
+
trackingId: import_zod33.z.string()
|
3835
4076
|
}).openapi({ ref: "EventDocument" });
|
3836
4077
|
|
4078
|
+
// ../commons/src/events/state/index.ts
|
4079
|
+
var import_lodash3 = require("lodash");
|
4080
|
+
|
3837
4081
|
// ../commons/src/events/state/utils.ts
|
4082
|
+
var import_lodash2 = require("lodash");
|
3838
4083
|
function getActionRequests(actionType, actions) {
|
3839
4084
|
const filtered = actions.filter((action) => action.type === actionType);
|
3840
4085
|
const accept = filtered.find(
|
@@ -3873,29 +4118,38 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
|
|
3873
4118
|
registrationNumber
|
3874
4119
|
};
|
3875
4120
|
}
|
4121
|
+
var updateActions = ActionTypes.extract([
|
4122
|
+
ActionType.CREATE,
|
4123
|
+
ActionType.NOTIFY,
|
4124
|
+
ActionType.DECLARE,
|
4125
|
+
ActionType.VALIDATE,
|
4126
|
+
ActionType.REGISTER,
|
4127
|
+
ActionType.REJECT,
|
4128
|
+
ActionType.ARCHIVE,
|
4129
|
+
ActionType.PRINT_CERTIFICATE,
|
4130
|
+
ActionType.REQUEST_CORRECTION
|
4131
|
+
]);
|
3876
4132
|
function getActionUpdateMetadata(actions) {
|
3877
4133
|
const createAction = getOrThrow(
|
3878
4134
|
actions.find((action) => action.type === ActionType.CREATE),
|
3879
4135
|
`Event has no ${ActionType.CREATE} action`
|
3880
4136
|
);
|
3881
|
-
|
3882
|
-
|
3883
|
-
|
3884
|
-
|
3885
|
-
|
3886
|
-
|
3887
|
-
|
3888
|
-
|
3889
|
-
|
3890
|
-
|
4137
|
+
const metadataFields = [
|
4138
|
+
"createdAt",
|
4139
|
+
"createdBy",
|
4140
|
+
"createdByUserType",
|
4141
|
+
"createdAtLocation",
|
4142
|
+
"createdByRole"
|
4143
|
+
];
|
4144
|
+
return actions.filter(({ type }) => updateActions.safeParse(type).success).filter(({ status }) => status === ActionStatus.Accepted).reduce(
|
4145
|
+
(_, action) => {
|
4146
|
+
if (action.originalActionId) {
|
4147
|
+
const originalAction = actions.find(({ id }) => id === action.originalActionId) ?? action;
|
4148
|
+
return (0, import_lodash2.pick)(originalAction, metadataFields);
|
4149
|
+
}
|
4150
|
+
return (0, import_lodash2.pick)(action, metadataFields);
|
3891
4151
|
},
|
3892
|
-
|
3893
|
-
createdAt: createAction.createdAt,
|
3894
|
-
createdBy: createAction.createdBy,
|
3895
|
-
createdByUserType: createAction.createdByUserType,
|
3896
|
-
createdAtLocation: createAction.createdAtLocation,
|
3897
|
-
createdByRole: createAction.createdByRole
|
3898
|
-
}
|
4152
|
+
(0, import_lodash2.pick)(createAction, metadataFields)
|
3899
4153
|
);
|
3900
4154
|
}
|
3901
4155
|
function getLegalStatuses(actions) {
|
@@ -3912,16 +4166,19 @@ function getLegalStatuses(actions) {
|
|
3912
4166
|
}
|
3913
4167
|
|
3914
4168
|
// ../commons/src/events/state/flags.ts
|
3915
|
-
function
|
4169
|
+
function isPendingCertification(actions) {
|
4170
|
+
if (getStatusFromActions(actions) !== EventStatus.enum.REGISTERED) {
|
4171
|
+
return false;
|
4172
|
+
}
|
3916
4173
|
return actions.reduce((prev, { type }) => {
|
3917
4174
|
if (type === ActionType.PRINT_CERTIFICATE) {
|
3918
|
-
return
|
4175
|
+
return false;
|
3919
4176
|
}
|
3920
4177
|
if (type === ActionType.APPROVE_CORRECTION) {
|
3921
|
-
return
|
4178
|
+
return true;
|
3922
4179
|
}
|
3923
4180
|
return prev;
|
3924
|
-
},
|
4181
|
+
}, true);
|
3925
4182
|
}
|
3926
4183
|
function isCorrectionRequested(actions) {
|
3927
4184
|
return actions.reduce((prev, { type }) => {
|
@@ -3941,7 +4198,7 @@ function isDeclarationIncomplete(actions) {
|
|
3941
4198
|
return getStatusFromActions(actions) === EventStatus.enum.NOTIFIED;
|
3942
4199
|
}
|
3943
4200
|
function isRejected(actions) {
|
3944
|
-
return
|
4201
|
+
return actions.at(-1)?.type === ActionType.REJECT;
|
3945
4202
|
}
|
3946
4203
|
function getFlagsFromActions(actions) {
|
3947
4204
|
const sortedActions = actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
@@ -3956,8 +4213,8 @@ function getFlagsFromActions(actions) {
|
|
3956
4213
|
const flag = joinValues([type, status], ":").toLowerCase();
|
3957
4214
|
return flag;
|
3958
4215
|
});
|
3959
|
-
if (
|
3960
|
-
flags.push(InherentFlags.
|
4216
|
+
if (isPendingCertification(sortedActions)) {
|
4217
|
+
flags.push(InherentFlags.PENDING_CERTIFICATION);
|
3961
4218
|
}
|
3962
4219
|
if (isCorrectionRequested(sortedActions)) {
|
3963
4220
|
flags.push(InherentFlags.CORRECTION_REQUESTED);
|
@@ -3983,16 +4240,14 @@ function getStatusFromActions(actions) {
|
|
3983
4240
|
return EventStatus.enum.VALIDATED;
|
3984
4241
|
case ActionType.REGISTER:
|
3985
4242
|
return EventStatus.enum.REGISTERED;
|
3986
|
-
case ActionType.REJECT:
|
3987
|
-
return EventStatus.enum.REJECTED;
|
3988
4243
|
case ActionType.ARCHIVE:
|
3989
4244
|
return EventStatus.enum.ARCHIVED;
|
3990
4245
|
case ActionType.NOTIFY:
|
3991
4246
|
return EventStatus.enum.NOTIFIED;
|
3992
4247
|
case ActionType.PRINT_CERTIFICATE:
|
3993
|
-
return EventStatus.enum.CERTIFIED;
|
3994
4248
|
case ActionType.ASSIGN:
|
3995
4249
|
case ActionType.UNASSIGN:
|
4250
|
+
case ActionType.REJECT:
|
3996
4251
|
case ActionType.REQUEST_CORRECTION:
|
3997
4252
|
case ActionType.APPROVE_CORRECTION:
|
3998
4253
|
case ActionType.MARKED_AS_DUPLICATE:
|
@@ -4069,6 +4324,13 @@ function getAcceptedActions(event2) {
|
|
4069
4324
|
);
|
4070
4325
|
}
|
4071
4326
|
var DEFAULT_DATE_OF_EVENT_PROPERTY = "createdAt";
|
4327
|
+
function resolveDateOfEvent(eventMetadata, declaration, config) {
|
4328
|
+
if (!config.dateOfEvent) {
|
4329
|
+
return eventMetadata[DEFAULT_DATE_OF_EVENT_PROPERTY].split("T")[0];
|
4330
|
+
}
|
4331
|
+
const parsedDate = ZodDate.safeParse(declaration[config.dateOfEvent.$$field]);
|
4332
|
+
return parsedDate.success ? parsedDate.data : void 0;
|
4333
|
+
}
|
4072
4334
|
function getCurrentEventState(event2, config) {
|
4073
4335
|
const creationAction = event2.actions.find(
|
4074
4336
|
(action) => action.type === ActionType.CREATE
|
@@ -4082,17 +4344,6 @@ function getCurrentEventState(event2, config) {
|
|
4082
4344
|
const requestActionMetadata = getActionUpdateMetadata(event2.actions);
|
4083
4345
|
const acceptedActionMetadata = getActionUpdateMetadata(acceptedActions);
|
4084
4346
|
const declaration = aggregateActionDeclarations(acceptedActions);
|
4085
|
-
let dateOfEvent;
|
4086
|
-
if (config.dateOfEvent) {
|
4087
|
-
const parsedDate = ZodDate.safeParse(
|
4088
|
-
declaration[config.dateOfEvent.$$field]
|
4089
|
-
);
|
4090
|
-
if (parsedDate.success) {
|
4091
|
-
dateOfEvent = parsedDate.data;
|
4092
|
-
}
|
4093
|
-
} else {
|
4094
|
-
dateOfEvent = event2[DEFAULT_DATE_OF_EVENT_PROPERTY].split("T")[0];
|
4095
|
-
}
|
4096
4347
|
return deepDropNulls({
|
4097
4348
|
id: event2.id,
|
4098
4349
|
type: event2.type,
|
@@ -4111,49 +4362,63 @@ function getCurrentEventState(event2, config) {
|
|
4111
4362
|
declaration,
|
4112
4363
|
trackingId: event2.trackingId,
|
4113
4364
|
updatedByUserRole: requestActionMetadata.createdByRole,
|
4114
|
-
dateOfEvent,
|
4365
|
+
dateOfEvent: resolveDateOfEvent(event2, declaration, config),
|
4115
4366
|
flags: getFlagsFromActions(event2.actions)
|
4116
4367
|
});
|
4117
4368
|
}
|
4118
|
-
function
|
4369
|
+
function dangerouslyGetCurrentEventStateWithDrafts({
|
4119
4370
|
event: event2,
|
4120
|
-
|
4371
|
+
draft,
|
4121
4372
|
configuration
|
4122
4373
|
}) {
|
4123
4374
|
const actions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
4124
|
-
const
|
4125
|
-
|
4126
|
-
|
4127
|
-
|
4128
|
-
|
4129
|
-
|
4130
|
-
|
4131
|
-
|
4132
|
-
|
4133
|
-
|
4134
|
-
|
4135
|
-
|
4136
|
-
|
4137
|
-
|
4375
|
+
const draftActions = draft.action.type === ActionType.REQUEST_CORRECTION ? (
|
4376
|
+
/*
|
4377
|
+
* If the action encountered is "REQUEST_CORRECTION", we want to pretend like it was approved
|
4378
|
+
* so previews etc are shown correctly
|
4379
|
+
*/
|
4380
|
+
[
|
4381
|
+
draft.action,
|
4382
|
+
{
|
4383
|
+
id: getUUID(),
|
4384
|
+
...draft.action,
|
4385
|
+
type: ActionType.APPROVE_CORRECTION
|
4386
|
+
}
|
4387
|
+
]
|
4388
|
+
) : [{ ...draft.action, id: getUUID() }];
|
4389
|
+
const actionsWithDraft = (0, import_lodash3.orderBy)(
|
4390
|
+
[...actions, ...draftActions],
|
4391
|
+
["createdAt"],
|
4392
|
+
"asc"
|
4393
|
+
);
|
4394
|
+
const eventWithDraft = {
|
4138
4395
|
...event2,
|
4139
|
-
actions:
|
4396
|
+
actions: actionsWithDraft
|
4140
4397
|
};
|
4141
|
-
return getCurrentEventState(
|
4398
|
+
return getCurrentEventState(eventWithDraft, configuration);
|
4142
4399
|
}
|
4143
|
-
function
|
4144
|
-
const
|
4145
|
-
const activeDrafts = drafts.filter(({ createdAt }) => new Date(createdAt) > new Date(indexedAt)).map((draft) => draft.action).sort();
|
4146
|
-
if (activeDrafts.length === 0) {
|
4147
|
-
return eventIndex;
|
4148
|
-
}
|
4400
|
+
function applyDeclarationToEventIndex(eventIndex, declaration, eventConfiguration) {
|
4401
|
+
const updatedDeclaration = deepMerge(eventIndex.declaration, declaration);
|
4149
4402
|
return {
|
4150
4403
|
...eventIndex,
|
4151
|
-
|
4152
|
-
|
4153
|
-
|
4154
|
-
|
4404
|
+
dateOfEvent: resolveDateOfEvent(
|
4405
|
+
eventIndex,
|
4406
|
+
updatedDeclaration,
|
4407
|
+
eventConfiguration
|
4408
|
+
),
|
4409
|
+
declaration: updatedDeclaration
|
4155
4410
|
};
|
4156
4411
|
}
|
4412
|
+
function applyDraftToEventIndex(eventIndex, draft, eventConfiguration) {
|
4413
|
+
return applyDeclarationToEventIndex(
|
4414
|
+
{
|
4415
|
+
...eventIndex,
|
4416
|
+
updatedAt: draft.createdAt
|
4417
|
+
},
|
4418
|
+
draft.action.declaration,
|
4419
|
+
eventConfiguration
|
4420
|
+
);
|
4421
|
+
}
|
4157
4422
|
function getAnnotationFromDrafts(drafts) {
|
4158
4423
|
const actions = drafts.map((draft) => draft.action);
|
4159
4424
|
const annotation = actions.reduce((ann, action) => {
|
@@ -4164,18 +4429,17 @@ function getAnnotationFromDrafts(drafts) {
|
|
4164
4429
|
function getActionAnnotation({
|
4165
4430
|
event: event2,
|
4166
4431
|
actionType,
|
4167
|
-
|
4432
|
+
draft
|
4168
4433
|
}) {
|
4169
4434
|
const activeActions = getAcceptedActions(event2);
|
4170
|
-
const action = activeActions.
|
4171
|
-
|
4435
|
+
const action = (0, import_lodash3.findLast)(activeActions, (a) => a.type === actionType);
|
4436
|
+
const matchingDraft = draft?.action.type === actionType ? draft : void 0;
|
4437
|
+
const sortedActions = (0, import_lodash3.orderBy)(
|
4438
|
+
[action, matchingDraft?.action].filter((a) => a !== void 0),
|
4439
|
+
"createdAt",
|
4440
|
+
"asc"
|
4172
4441
|
);
|
4173
|
-
const
|
4174
|
-
const sorted = [
|
4175
|
-
...action ? [action] : [],
|
4176
|
-
...eventDrafts.map((draft) => draft.action)
|
4177
|
-
].sort();
|
4178
|
-
const annotation = sorted.reduce((ann, sortedAction) => {
|
4442
|
+
const annotation = sortedActions.reduce((ann, sortedAction) => {
|
4179
4443
|
return deepMerge(ann, sortedAction.annotation ?? {});
|
4180
4444
|
}, {});
|
4181
4445
|
return deepDropNulls(annotation);
|
@@ -4193,23 +4457,25 @@ function generateTransactionId() {
|
|
4193
4457
|
}
|
4194
4458
|
|
4195
4459
|
// ../commons/src/events/User.ts
|
4196
|
-
var
|
4197
|
-
var User =
|
4198
|
-
id:
|
4199
|
-
name:
|
4200
|
-
|
4201
|
-
use:
|
4202
|
-
given:
|
4203
|
-
family:
|
4460
|
+
var import_zod34 = require("zod");
|
4461
|
+
var User = import_zod34.z.object({
|
4462
|
+
id: import_zod34.z.string(),
|
4463
|
+
name: import_zod34.z.array(
|
4464
|
+
import_zod34.z.object({
|
4465
|
+
use: import_zod34.z.string(),
|
4466
|
+
given: import_zod34.z.array(import_zod34.z.string()),
|
4467
|
+
family: import_zod34.z.string()
|
4204
4468
|
})
|
4205
4469
|
),
|
4206
|
-
role:
|
4207
|
-
|
4470
|
+
role: import_zod34.z.string(),
|
4471
|
+
avatar: FullDocumentPath.optional(),
|
4472
|
+
signature: FullDocumentPath.optional(),
|
4473
|
+
primaryOfficeId: import_zod34.z.string()
|
4208
4474
|
});
|
4209
4475
|
|
4210
4476
|
// ../commons/src/events/test.utils.ts
|
4211
|
-
var
|
4212
|
-
var
|
4477
|
+
var import_lodash4 = require("lodash");
|
4478
|
+
var import_date_fns4 = require("date-fns");
|
4213
4479
|
|
4214
4480
|
// ../commons/src/field-config/field-configuration.ts
|
4215
4481
|
function createFieldConfig(fieldId, options) {
|
@@ -4230,7 +4496,7 @@ function field(fieldId, options = {}) {
|
|
4230
4496
|
}
|
4231
4497
|
|
4232
4498
|
// ../commons/src/fixtures/forms.ts
|
4233
|
-
var
|
4499
|
+
var import_date_fns3 = require("date-fns");
|
4234
4500
|
var PRINT_CERTIFICATE_FORM = defineActionForm({
|
4235
4501
|
label: {
|
4236
4502
|
id: "v2.event.tennis-club-membership.action.certificate.form.label",
|
@@ -4943,7 +5209,27 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
|
4943
5209
|
defaultMessage: "Applicant's name",
|
4944
5210
|
description: "This is the label for the field",
|
4945
5211
|
id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.firstname.label"
|
4946
|
-
}
|
5212
|
+
},
|
5213
|
+
configuration: {
|
5214
|
+
name: {
|
5215
|
+
firstname: { required: true },
|
5216
|
+
middlename: { required: false },
|
5217
|
+
surname: { required: true }
|
5218
|
+
}
|
5219
|
+
},
|
5220
|
+
validation: [
|
5221
|
+
{
|
5222
|
+
validator: field("applicant.name").object({
|
5223
|
+
firstname: field("firstname").isValidEnglishName(),
|
5224
|
+
surname: field("surname").isValidEnglishName()
|
5225
|
+
}),
|
5226
|
+
message: {
|
5227
|
+
defaultMessage: "Input contains invalid characters. Please use only letters (a-z, A-Z), numbers (0-9), hyphens (-), apostrophes(') and underscores (_)",
|
5228
|
+
description: "This is the error message for invalid name",
|
5229
|
+
id: "v2.error.invalidName"
|
5230
|
+
}
|
5231
|
+
}
|
5232
|
+
]
|
4947
5233
|
},
|
4948
5234
|
{
|
4949
5235
|
id: "applicant.email",
|
@@ -5028,6 +5314,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
|
5028
5314
|
id: "applicant.address",
|
5029
5315
|
type: "ADDRESS",
|
5030
5316
|
required: true,
|
5317
|
+
secured: true,
|
5031
5318
|
conditionals: [],
|
5032
5319
|
label: {
|
5033
5320
|
defaultMessage: "Applicant's address",
|
@@ -5163,22 +5450,6 @@ var statusOptions = [
|
|
5163
5450
|
id: "v2.advancedSearch.form.recordStatusRegistered"
|
5164
5451
|
}
|
5165
5452
|
},
|
5166
|
-
{
|
5167
|
-
value: EventStatus.enum.CERTIFIED,
|
5168
|
-
label: {
|
5169
|
-
defaultMessage: "Certified",
|
5170
|
-
description: "Option for form field: status of record",
|
5171
|
-
id: "v2.advancedSearch.form.recordStatusCertified"
|
5172
|
-
}
|
5173
|
-
},
|
5174
|
-
{
|
5175
|
-
value: EventStatus.enum.REJECTED,
|
5176
|
-
label: {
|
5177
|
-
defaultMessage: "Rejected",
|
5178
|
-
description: "Option for form field: status of record",
|
5179
|
-
id: "v2.advancedSearch.form.recordStatusRejected"
|
5180
|
-
}
|
5181
|
-
},
|
5182
5453
|
{
|
5183
5454
|
value: EventStatus.enum.ARCHIVED,
|
5184
5455
|
label: {
|
@@ -5195,7 +5466,7 @@ var timePeriodOptions = [
|
|
5195
5466
|
description: "Label for option of time period select: last 7 days",
|
5196
5467
|
id: "form.section.label.timePeriodLast7Days"
|
5197
5468
|
},
|
5198
|
-
value: `${(0,
|
5469
|
+
value: `${(0, import_date_fns3.format)((0, import_date_fns3.subDays)(/* @__PURE__ */ new Date(), 7), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
|
5199
5470
|
/* @__PURE__ */ new Date(),
|
5200
5471
|
"yyyy-MM-dd"
|
5201
5472
|
)}`
|
@@ -5206,7 +5477,7 @@ var timePeriodOptions = [
|
|
5206
5477
|
description: "Label for option of time period select: last 30 days",
|
5207
5478
|
id: "form.section.label.timePeriodLast30Days"
|
5208
5479
|
},
|
5209
|
-
value: `${(0,
|
5480
|
+
value: `${(0, import_date_fns3.format)((0, import_date_fns3.subMonths)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
|
5210
5481
|
/* @__PURE__ */ new Date(),
|
5211
5482
|
"yyyy-MM-dd"
|
5212
5483
|
)}`
|
@@ -5217,7 +5488,7 @@ var timePeriodOptions = [
|
|
5217
5488
|
description: "Label for option of time period select: last 90 days",
|
5218
5489
|
id: "form.section.label.timePeriodLast90Days"
|
5219
5490
|
},
|
5220
|
-
value: `${(0,
|
5491
|
+
value: `${(0, import_date_fns3.format)((0, import_date_fns3.subQuarters)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
|
5221
5492
|
/* @__PURE__ */ new Date(),
|
5222
5493
|
"yyyy-MM-dd"
|
5223
5494
|
)}`
|
@@ -5228,7 +5499,7 @@ var timePeriodOptions = [
|
|
5228
5499
|
description: "Label for option of time period select: last year",
|
5229
5500
|
id: "form.section.label.timePeriodLastYear"
|
5230
5501
|
},
|
5231
|
-
value: `${(0,
|
5502
|
+
value: `${(0, import_date_fns3.format)((0, import_date_fns3.subYears)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
|
5232
5503
|
/* @__PURE__ */ new Date(),
|
5233
5504
|
"yyyy-MM-dd"
|
5234
5505
|
)}`
|
@@ -5585,10 +5856,10 @@ var tennisClubMembershipEvent = defineConfig({
|
|
5585
5856
|
id: "v2.advancedSearch.form.registrationDetails"
|
5586
5857
|
},
|
5587
5858
|
fields: [
|
5588
|
-
event("
|
5589
|
-
event("
|
5590
|
-
event("status"
|
5591
|
-
event("updatedAt"
|
5859
|
+
event("legalStatuses.REGISTERED.createdAtLocation").exact(),
|
5860
|
+
event("legalStatuses.REGISTERED.acceptedAt").range(),
|
5861
|
+
event("status").exact(),
|
5862
|
+
event("updatedAt").range()
|
5592
5863
|
]
|
5593
5864
|
},
|
5594
5865
|
{
|
@@ -5978,10 +6249,10 @@ var footballClubMembershipEvent = defineConfig({
|
|
5978
6249
|
id: "v2.advancedSearch.form.registrationDetails"
|
5979
6250
|
},
|
5980
6251
|
fields: [
|
5981
|
-
event("
|
5982
|
-
event("
|
5983
|
-
event("status"
|
5984
|
-
event("updatedAt"
|
6252
|
+
event("legalStatuses.REGISTERED.createdAtLocation").exact(),
|
6253
|
+
event("legalStatuses.REGISTERED.acceptedAt").range(),
|
6254
|
+
event("status").exact(),
|
6255
|
+
event("updatedAt").range()
|
5985
6256
|
]
|
5986
6257
|
},
|
5987
6258
|
{
|
@@ -6194,8 +6465,9 @@ var v2BirthEvent = defineConfig({
|
|
6194
6465
|
});
|
6195
6466
|
|
6196
6467
|
// ../commons/src/events/test.utils.ts
|
6197
|
-
var
|
6198
|
-
var
|
6468
|
+
var import_zod35 = require("zod");
|
6469
|
+
var TEST_SYSTEM_IANA_TIMEZONE = "Asia/Dhaka";
|
6470
|
+
var TestUserRole = import_zod35.z.enum([
|
6199
6471
|
"FIELD_AGENT",
|
6200
6472
|
"LOCAL_REGISTRAR",
|
6201
6473
|
"LOCAL_SYSTEM_ADMIN",
|
@@ -6280,14 +6552,18 @@ function mapFieldTypeToMockValue(field2, i, rng) {
|
|
6280
6552
|
};
|
6281
6553
|
case FieldType.DATE:
|
6282
6554
|
return "2021-01-01";
|
6555
|
+
case FieldType.SELECT_DATE_RANGE:
|
6283
6556
|
case FieldType.DATE_RANGE:
|
6284
|
-
return
|
6557
|
+
return {
|
6558
|
+
start: "2021-01-01",
|
6559
|
+
end: "2021-01-31"
|
6560
|
+
};
|
6285
6561
|
case FieldType.CHECKBOX:
|
6286
6562
|
return true;
|
6287
6563
|
case FieldType.SIGNATURE:
|
6288
6564
|
case FieldType.FILE:
|
6289
6565
|
return {
|
6290
|
-
|
6566
|
+
path: "/ocrvs/4f095fc4-4312-4de2-aa38-86dcc0f71044.png",
|
6291
6567
|
originalFilename: "abcd.png",
|
6292
6568
|
type: "image/png"
|
6293
6569
|
};
|
@@ -6350,7 +6626,11 @@ function eventPayloadGenerator(rng) {
|
|
6350
6626
|
type: input.type ?? TENNIS_CLUB_MEMBERSHIP,
|
6351
6627
|
id
|
6352
6628
|
}),
|
6353
|
-
draft: ({
|
6629
|
+
draft: ({
|
6630
|
+
eventId,
|
6631
|
+
actionType,
|
6632
|
+
annotation
|
6633
|
+
}, input = {}) => (0, import_lodash4.merge)(
|
6354
6634
|
{
|
6355
6635
|
id: getUUID(),
|
6356
6636
|
eventId,
|
@@ -6370,7 +6650,8 @@ function eventPayloadGenerator(rng) {
|
|
6370
6650
|
},
|
6371
6651
|
annotation: {
|
6372
6652
|
"correction.requester.relationship": "ANOTHER_AGENT",
|
6373
|
-
"correction.request.reason": "Child's name was incorrect"
|
6653
|
+
"correction.request.reason": "Child's name was incorrect",
|
6654
|
+
...annotation
|
6374
6655
|
},
|
6375
6656
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
6376
6657
|
createdBy: "@todo",
|
@@ -6404,13 +6685,13 @@ function eventPayloadGenerator(rng) {
|
|
6404
6685
|
notify: (eventId, input = {}) => {
|
6405
6686
|
let declaration = input.declaration;
|
6406
6687
|
if (!declaration) {
|
6407
|
-
const partialDeclaration = (0,
|
6688
|
+
const partialDeclaration = (0, import_lodash4.omitBy)(
|
6408
6689
|
generateActionDeclarationInput(
|
6409
6690
|
tennisClubMembershipEvent,
|
6410
6691
|
ActionType.DECLARE,
|
6411
6692
|
rng
|
6412
6693
|
),
|
6413
|
-
|
6694
|
+
import_lodash4.isString
|
6414
6695
|
);
|
6415
6696
|
declaration = partialDeclaration;
|
6416
6697
|
}
|
@@ -6457,7 +6738,6 @@ function eventPayloadGenerator(rng) {
|
|
6457
6738
|
type: ActionType.ARCHIVE,
|
6458
6739
|
transactionId: input.transactionId ?? getUUID(),
|
6459
6740
|
declaration: {},
|
6460
|
-
// @TODO: Check whether generator is needed?
|
6461
6741
|
annotation: {},
|
6462
6742
|
duplicates: [],
|
6463
6743
|
eventId,
|
@@ -6662,7 +6942,8 @@ function generateEventDraftDocument({
|
|
6662
6942
|
declaration: {
|
6663
6943
|
...action.declaration,
|
6664
6944
|
...declaration
|
6665
|
-
}
|
6945
|
+
},
|
6946
|
+
annotation: action.annotation
|
6666
6947
|
},
|
6667
6948
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
6668
6949
|
eventId
|
@@ -6737,7 +7018,7 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
|
|
6737
7018
|
createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
|
6738
7019
|
updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
|
6739
7020
|
createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
|
6740
|
-
updatedAt: overrides.updatedAt ?? (0,
|
7021
|
+
updatedAt: overrides.updatedAt ?? (0, import_date_fns4.addDays)(new Date(createdAt), 1).toISOString(),
|
6741
7022
|
assignedTo: overrides.assignedTo ?? null,
|
6742
7023
|
updatedBy: overrides.updatedBy ?? generateUuid(rng),
|
6743
7024
|
updatedByUserRole: overrides.updatedByUserRole ?? "FIELD_AGENT",
|
@@ -6769,7 +7050,12 @@ var generateWorkqueues = (slug = "all-events") => defineWorkqueues([
|
|
6769
7050
|
type: "and",
|
6770
7051
|
clauses: [{ eventType: tennisClubMembershipEvent.id }]
|
6771
7052
|
},
|
6772
|
-
actions: [
|
7053
|
+
actions: [
|
7054
|
+
{
|
7055
|
+
type: "DEFAULT",
|
7056
|
+
conditionals: []
|
7057
|
+
}
|
7058
|
+
],
|
6773
7059
|
icon: "Draft"
|
6774
7060
|
}
|
6775
7061
|
]);
|
@@ -6785,9 +7071,7 @@ function isFieldValueWithoutTemplates(value) {
|
|
6785
7071
|
if (isTemplateVariable(value)) {
|
6786
7072
|
return false;
|
6787
7073
|
}
|
6788
|
-
if (typeof value === "object" &&
|
6789
|
-
//@ts-ignore
|
6790
|
-
Object.values(value).some((val) => isTemplateVariable(val))) {
|
7074
|
+
if (typeof value === "object" && value !== null && Object.values(value).some((val) => isTemplateVariable(val))) {
|
6791
7075
|
return false;
|
6792
7076
|
}
|
6793
7077
|
return true;
|
@@ -6809,7 +7093,7 @@ function isFieldConfigDefaultValue(value) {
|
|
6809
7093
|
}
|
6810
7094
|
|
6811
7095
|
// ../commons/src/events/scopes.ts
|
6812
|
-
var
|
7096
|
+
var import_lodash5 = require("lodash");
|
6813
7097
|
var CONFIG_GET_ALLOWED_SCOPES = [
|
6814
7098
|
SCOPES.RECORD_DECLARE,
|
6815
7099
|
SCOPES.RECORD_READ,
|
@@ -6893,19 +7177,15 @@ var WRITE_ACTION_SCOPES = [
|
|
6893
7177
|
...ACTION_ALLOWED_SCOPES[ActionType.PRINT_CERTIFICATE]
|
6894
7178
|
];
|
6895
7179
|
function hasAnyOfScopes(a, b) {
|
6896
|
-
return (0,
|
7180
|
+
return (0, import_lodash5.intersection)(a, b).length > 0;
|
6897
7181
|
}
|
6898
7182
|
|
6899
7183
|
// ../commons/src/events/serializers/user/deserializer.ts
|
6900
|
-
var import_zod34 = require("zod");
|
6901
|
-
var UserWithPrimaryOffice = User.extend({
|
6902
|
-
primaryOfficeId: import_zod34.z.string()
|
6903
|
-
});
|
6904
7184
|
function userDeserializer(serializedUserField, user2) {
|
6905
7185
|
if (typeof serializedUserField === "string") {
|
6906
7186
|
return serializedUserField;
|
6907
7187
|
}
|
6908
|
-
if (serializedUserField.$userField === "name" || serializedUserField.$userField === "
|
7188
|
+
if (serializedUserField.$userField === "name" || serializedUserField.$userField === "signature" || serializedUserField.$userField === "avatar") {
|
6909
7189
|
throw new Error(
|
6910
7190
|
`Deserializer for ${serializedUserField.$userField} is not implemented yet`
|
6911
7191
|
);
|
@@ -6987,24 +7267,24 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
6987
7267
|
ActionType.ARCHIVE,
|
6988
7268
|
ActionType.REJECT
|
6989
7269
|
],
|
6990
|
-
[EventStatus.enum.REJECTED]: [
|
6991
|
-
ActionType.READ,
|
6992
|
-
ActionType.DECLARE,
|
6993
|
-
ActionType.VALIDATE
|
6994
|
-
],
|
6995
7270
|
[EventStatus.enum.REGISTERED]: [
|
6996
7271
|
ActionType.READ,
|
6997
7272
|
ActionType.PRINT_CERTIFICATE,
|
6998
7273
|
ActionType.REQUEST_CORRECTION
|
6999
7274
|
],
|
7000
|
-
[EventStatus.enum.CERTIFIED]: [
|
7001
|
-
ActionType.READ,
|
7002
|
-
ActionType.PRINT_CERTIFICATE,
|
7003
|
-
ActionType.REQUEST_CORRECTION
|
7004
|
-
],
|
7005
7275
|
[EventStatus.enum.ARCHIVED]: [
|
7006
7276
|
ActionType.READ,
|
7007
7277
|
ActionType.ASSIGN,
|
7008
7278
|
ActionType.UNASSIGN
|
7009
7279
|
]
|
7010
7280
|
};
|
7281
|
+
var getAvailableActionsForEvent = (event2) => {
|
7282
|
+
if (event2.flags.includes(InherentFlags.REJECTED)) {
|
7283
|
+
return [
|
7284
|
+
ActionType.READ,
|
7285
|
+
event2.status === EventStatus.Enum.VALIDATED ? ActionType.VALIDATE : ActionType.DECLARE,
|
7286
|
+
ActionType.ARCHIVE
|
7287
|
+
];
|
7288
|
+
}
|
7289
|
+
return AVAILABLE_ACTIONS_BY_EVENT_STATUS[event2.status];
|
7290
|
+
};
|