@opencrvs/toolkit 1.8.0-rc.fd1df48 → 1.8.0-rc.fd49b3a
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 +1806 -922
- package/dist/commons/conditionals/conditionals.d.ts +0 -12
- package/dist/commons/events/ActionConfig.d.ts +7830 -2014
- package/dist/commons/events/ActionDocument.d.ts +1948 -904
- package/dist/commons/events/ActionInput.d.ts +1680 -780
- package/dist/commons/events/AdvancedSearchConfig.d.ts +82 -33
- package/dist/commons/events/CompositeFieldValue.d.ts +9 -9
- package/dist/commons/events/CountryConfigQueryInput.d.ts +1086 -684
- package/dist/commons/events/Draft.d.ts +142 -70
- package/dist/commons/events/EventConfig.d.ts +3649 -935
- package/dist/commons/events/EventDocument.d.ts +1236 -588
- package/dist/commons/events/EventIndex.d.ts +339 -120
- package/dist/commons/events/FieldConfig.d.ts +455 -30
- package/dist/commons/events/FieldType.d.ts +2 -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 +3005 -557
- package/dist/commons/events/PageConfig.d.ts +646 -38
- package/dist/commons/events/User.d.ts +6 -3
- package/dist/commons/events/WorkqueueConfig.d.ts +1990 -1174
- package/dist/commons/events/defineConfig.d.ts +498 -34
- package/dist/commons/events/event.d.ts +10 -18
- package/dist/commons/events/field.d.ts +13 -1
- package/dist/commons/events/test.utils.d.ts +43 -19
- package/dist/commons/events/utils.d.ts +2543 -77
- package/dist/conditionals/index.js +2 -34
- package/dist/events/index.js +963 -801
- package/dist/scopes/index.d.ts +92 -6
- package/dist/scopes/index.js +38 -9
- package/package.json +3 -3
package/dist/events/index.js
CHANGED
@@ -74,6 +74,7 @@ __export(events_exports, {
|
|
74
74
|
DataEntry: () => DataEntry,
|
75
75
|
DataFieldValue: () => DataFieldValue,
|
76
76
|
DateCondition: () => DateCondition,
|
77
|
+
DateRangeField: () => DateRangeField,
|
77
78
|
DateRangeFieldValue: () => DateRangeFieldValue,
|
78
79
|
DateValue: () => DateValue,
|
79
80
|
DatetimeValue: () => DatetimeValue,
|
@@ -106,6 +107,7 @@ __export(events_exports, {
|
|
106
107
|
Exact: () => Exact,
|
107
108
|
ExactDate: () => ExactDate,
|
108
109
|
ExactStatus: () => ExactStatus,
|
110
|
+
ExactUserType: () => ExactUserType,
|
109
111
|
FieldConditional: () => FieldConditional,
|
110
112
|
FieldConfig: () => FieldConfig,
|
111
113
|
FieldConfigSchema: () => FieldConfigSchema,
|
@@ -141,7 +143,6 @@ __export(events_exports, {
|
|
141
143
|
QueryInput: () => QueryInput,
|
142
144
|
QueryType: () => QueryType,
|
143
145
|
Range: () => Range,
|
144
|
-
RangeDate: () => RangeDate,
|
145
146
|
ReadActionInput: () => ReadActionInput,
|
146
147
|
RegisterAction: () => RegisterAction,
|
147
148
|
RegisterActionInput: () => RegisterActionInput,
|
@@ -155,11 +156,16 @@ __export(events_exports, {
|
|
155
156
|
RuralAddressValue: () => RuralAddressValue,
|
156
157
|
SearchField: () => SearchField,
|
157
158
|
SearchQueryParams: () => SearchQueryParams,
|
159
|
+
SearchScopeAccessLevels: () => SearchScopeAccessLevels,
|
160
|
+
SelectDateRangeField: () => SelectDateRangeField,
|
161
|
+
SelectDateRangeOption: () => SelectDateRangeOption,
|
162
|
+
SelectDateRangeValue: () => SelectDateRangeValue,
|
158
163
|
SelectOption: () => SelectOption,
|
159
164
|
ShowConditional: () => ShowConditional,
|
160
165
|
SignatureFieldValue: () => SignatureFieldValue,
|
161
166
|
SummaryConfig: () => SummaryConfig,
|
162
167
|
TENNIS_CLUB_MEMBERSHIP: () => TENNIS_CLUB_MEMBERSHIP,
|
168
|
+
TEST_SYSTEM_IANA_TIMEZONE: () => TEST_SYSTEM_IANA_TIMEZONE,
|
163
169
|
TestUserRole: () => TestUserRole,
|
164
170
|
TextValue: () => TextValue,
|
165
171
|
TranslationConfig: () => TranslationConfig,
|
@@ -187,11 +193,11 @@ __export(events_exports, {
|
|
187
193
|
alwaysTrue: () => alwaysTrue,
|
188
194
|
and: () => and,
|
189
195
|
annotationActions: () => annotationActions,
|
196
|
+
applyDeclarationToEventIndex: () => applyDeclarationToEventIndex,
|
190
197
|
applyDraftsToEventIndex: () => applyDraftsToEventIndex,
|
191
198
|
areConditionsMet: () => areConditionsMet,
|
192
199
|
compositeFieldTypes: () => compositeFieldTypes,
|
193
200
|
createEmptyDraft: () => createEmptyDraft,
|
194
|
-
createEventConditionals: () => createEventConditionals,
|
195
201
|
createFieldConditionals: () => createFieldConditionals,
|
196
202
|
createPrng: () => createPrng,
|
197
203
|
createValidationSchema: () => createValidationSchema,
|
@@ -250,6 +256,7 @@ __export(events_exports, {
|
|
250
256
|
getDeclarationPages: () => getDeclarationPages,
|
251
257
|
getEventConfigById: () => getEventConfigById,
|
252
258
|
getMixedPath: () => getMixedPath,
|
259
|
+
getPrintCertificatePages: () => getPrintCertificatePages,
|
253
260
|
getRandomDate: () => getRandomDate,
|
254
261
|
getRandomDatetime: () => getRandomDatetime,
|
255
262
|
getStatusFromActions: () => getStatusFromActions,
|
@@ -288,6 +295,7 @@ __export(events_exports, {
|
|
288
295
|
isParagraphFieldType: () => isParagraphFieldType,
|
289
296
|
isPhoneFieldType: () => isPhoneFieldType,
|
290
297
|
isRadioGroupFieldType: () => isRadioGroupFieldType,
|
298
|
+
isSelectDateRangeFieldType: () => isSelectDateRangeFieldType,
|
291
299
|
isSelectFieldType: () => isSelectFieldType,
|
292
300
|
isSignatureFieldType: () => isSignatureFieldType,
|
293
301
|
isTemplateVariable: () => isTemplateVariable,
|
@@ -306,7 +314,9 @@ __export(events_exports, {
|
|
306
314
|
omitHiddenFields: () => omitHiddenFields,
|
307
315
|
omitHiddenPaginatedFields: () => omitHiddenPaginatedFields,
|
308
316
|
or: () => or,
|
317
|
+
resolveDateOfEvent: () => resolveDateOfEvent,
|
309
318
|
runFieldValidations: () => runFieldValidations,
|
319
|
+
timePeriodToDateRange: () => timePeriodToDateRange,
|
310
320
|
user: () => user,
|
311
321
|
validate: () => validate,
|
312
322
|
validateFieldInput: () => validateFieldInput,
|
@@ -320,7 +330,7 @@ var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
|
|
320
330
|
var BIRTH_EVENT = "v2-birth";
|
321
331
|
|
322
332
|
// ../commons/src/events/ActionConfig.ts
|
323
|
-
var
|
333
|
+
var import_zod10 = require("zod");
|
324
334
|
|
325
335
|
// ../commons/src/events/Conditional.ts
|
326
336
|
var import_zod = require("zod");
|
@@ -372,10 +382,10 @@ var FieldConditional = import_zod.z.discriminatedUnion("type", [
|
|
372
382
|
});
|
373
383
|
|
374
384
|
// ../commons/src/events/PageConfig.ts
|
375
|
-
var
|
385
|
+
var import_zod7 = require("zod");
|
376
386
|
|
377
387
|
// ../commons/src/events/FieldConfig.ts
|
378
|
-
var
|
388
|
+
var import_zod6 = require("zod");
|
379
389
|
|
380
390
|
// ../commons/src/events/TranslationConfig.ts
|
381
391
|
var import_zod2 = require("zod");
|
@@ -406,6 +416,9 @@ var FieldType = {
|
|
406
416
|
EMAIL: "EMAIL",
|
407
417
|
DATE: "DATE",
|
408
418
|
DATE_RANGE: "DATE_RANGE",
|
419
|
+
// // Internal use, only for search functionality
|
420
|
+
SELECT_DATE_RANGE: "SELECT_DATE_RANGE",
|
421
|
+
// Internal use, only for search functionality
|
409
422
|
PARAGRAPH: "PARAGRAPH",
|
410
423
|
PAGE_HEADER: "PAGE_HEADER",
|
411
424
|
RADIO_GROUP: "RADIO_GROUP",
|
@@ -432,10 +445,24 @@ var compositeFieldTypes = [
|
|
432
445
|
];
|
433
446
|
|
434
447
|
// ../commons/src/events/FieldValue.ts
|
435
|
-
var
|
448
|
+
var import_zod5 = require("zod");
|
436
449
|
|
437
|
-
// ../commons/src/
|
450
|
+
// ../commons/src/documents.ts
|
438
451
|
var import_zod3 = require("zod");
|
452
|
+
var import_zod_openapi3 = require("zod-openapi");
|
453
|
+
(0, import_zod_openapi3.extendZodWithOpenApi)(import_zod3.z);
|
454
|
+
var FullDocumentURL = import_zod3.z.string().brand("FullDocumentURL").describe(
|
455
|
+
"A full url with protocol, host, bucket name, starting from the root of the S3 server, https://minio/bucket-name/document-id.jpg"
|
456
|
+
);
|
457
|
+
var FullDocumentPath = import_zod3.z.string().transform((val) => val.startsWith("/") ? val : `/${val}`).openapi({ effectType: "input", type: "string" }).describe(
|
458
|
+
"A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
|
459
|
+
);
|
460
|
+
var DocumentPath = import_zod3.z.string().brand("DocumentPath").describe(
|
461
|
+
"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"
|
462
|
+
);
|
463
|
+
|
464
|
+
// ../commons/src/events/CompositeFieldValue.ts
|
465
|
+
var import_zod4 = require("zod");
|
439
466
|
var GeographicalArea = {
|
440
467
|
URBAN: "URBAN",
|
441
468
|
RURAL: "RURAL"
|
@@ -444,101 +471,113 @@ var AddressType = {
|
|
444
471
|
DOMESTIC: "DOMESTIC",
|
445
472
|
INTERNATIONAL: "INTERNATIONAL"
|
446
473
|
};
|
447
|
-
var FileFieldValue =
|
448
|
-
|
449
|
-
originalFilename:
|
450
|
-
type:
|
474
|
+
var FileFieldValue = import_zod4.z.object({
|
475
|
+
path: FullDocumentPath,
|
476
|
+
originalFilename: import_zod4.z.string(),
|
477
|
+
type: import_zod4.z.string()
|
451
478
|
});
|
452
|
-
var AdminStructure =
|
453
|
-
country:
|
454
|
-
addressType:
|
455
|
-
province:
|
456
|
-
district:
|
479
|
+
var AdminStructure = import_zod4.z.object({
|
480
|
+
country: import_zod4.z.string(),
|
481
|
+
addressType: import_zod4.z.literal(AddressType.DOMESTIC),
|
482
|
+
province: import_zod4.z.string(),
|
483
|
+
district: import_zod4.z.string()
|
457
484
|
});
|
458
485
|
var UrbanAddressValue = AdminStructure.extend({
|
459
|
-
urbanOrRural:
|
460
|
-
town:
|
461
|
-
residentialArea:
|
462
|
-
street:
|
463
|
-
number:
|
464
|
-
zipCode:
|
486
|
+
urbanOrRural: import_zod4.z.literal(GeographicalArea.URBAN),
|
487
|
+
town: import_zod4.z.string().optional(),
|
488
|
+
residentialArea: import_zod4.z.string().optional(),
|
489
|
+
street: import_zod4.z.string().optional(),
|
490
|
+
number: import_zod4.z.string().optional(),
|
491
|
+
zipCode: import_zod4.z.string().optional()
|
465
492
|
});
|
466
493
|
var RuralAddressValue = AdminStructure.extend({
|
467
|
-
urbanOrRural:
|
468
|
-
village:
|
494
|
+
urbanOrRural: import_zod4.z.literal(GeographicalArea.RURAL),
|
495
|
+
village: import_zod4.z.string().optional()
|
469
496
|
});
|
470
497
|
var UrbanAddressUpdateValue = AdminStructure.extend({
|
471
|
-
urbanOrRural:
|
472
|
-
town:
|
473
|
-
residentialArea:
|
474
|
-
street:
|
475
|
-
number:
|
476
|
-
zipCode:
|
498
|
+
urbanOrRural: import_zod4.z.literal(GeographicalArea.URBAN),
|
499
|
+
town: import_zod4.z.string().nullish(),
|
500
|
+
residentialArea: import_zod4.z.string().nullish(),
|
501
|
+
street: import_zod4.z.string().nullish(),
|
502
|
+
number: import_zod4.z.string().nullish(),
|
503
|
+
zipCode: import_zod4.z.string().nullish()
|
477
504
|
});
|
478
|
-
var NameFieldValue =
|
479
|
-
firstname:
|
480
|
-
surname:
|
481
|
-
middlename:
|
505
|
+
var NameFieldValue = import_zod4.z.object({
|
506
|
+
firstname: import_zod4.z.string(),
|
507
|
+
surname: import_zod4.z.string(),
|
508
|
+
middlename: import_zod4.z.string().optional()
|
482
509
|
});
|
483
|
-
var NameFieldUpdateValue =
|
484
|
-
firstname:
|
485
|
-
surname:
|
486
|
-
middlename:
|
487
|
-
}).or(
|
510
|
+
var NameFieldUpdateValue = import_zod4.z.object({
|
511
|
+
firstname: import_zod4.z.string().nullish(),
|
512
|
+
surname: import_zod4.z.string().nullish(),
|
513
|
+
middlename: import_zod4.z.string().nullish()
|
514
|
+
}).or(import_zod4.z.null()).or(import_zod4.z.undefined());
|
488
515
|
var RuralAddressUpdateValue = AdminStructure.extend({
|
489
|
-
urbanOrRural:
|
490
|
-
village:
|
516
|
+
urbanOrRural: import_zod4.z.literal(GeographicalArea.RURAL),
|
517
|
+
village: import_zod4.z.string().nullish()
|
491
518
|
});
|
492
|
-
var GenericAddressValue =
|
493
|
-
country:
|
494
|
-
addressType:
|
495
|
-
state:
|
496
|
-
district2:
|
497
|
-
cityOrTown:
|
498
|
-
addressLine1:
|
499
|
-
addressLine2:
|
500
|
-
addressLine3:
|
501
|
-
postcodeOrZip:
|
519
|
+
var GenericAddressValue = import_zod4.z.object({
|
520
|
+
country: import_zod4.z.string(),
|
521
|
+
addressType: import_zod4.z.literal(AddressType.INTERNATIONAL),
|
522
|
+
state: import_zod4.z.string(),
|
523
|
+
district2: import_zod4.z.string(),
|
524
|
+
cityOrTown: import_zod4.z.string().optional(),
|
525
|
+
addressLine1: import_zod4.z.string().optional(),
|
526
|
+
addressLine2: import_zod4.z.string().optional(),
|
527
|
+
addressLine3: import_zod4.z.string().optional(),
|
528
|
+
postcodeOrZip: import_zod4.z.string().optional()
|
502
529
|
});
|
503
|
-
var AddressFieldValue =
|
504
|
-
var GenericAddressUpdateValue =
|
505
|
-
country:
|
506
|
-
addressType:
|
507
|
-
state:
|
508
|
-
district2:
|
509
|
-
cityOrTown:
|
510
|
-
addressLine1:
|
511
|
-
addressLine2:
|
512
|
-
addressLine3:
|
513
|
-
postcodeOrZip:
|
530
|
+
var AddressFieldValue = import_zod4.z.discriminatedUnion("urbanOrRural", [UrbanAddressValue, RuralAddressValue]).or(GenericAddressValue);
|
531
|
+
var GenericAddressUpdateValue = import_zod4.z.object({
|
532
|
+
country: import_zod4.z.string(),
|
533
|
+
addressType: import_zod4.z.literal(AddressType.INTERNATIONAL),
|
534
|
+
state: import_zod4.z.string(),
|
535
|
+
district2: import_zod4.z.string(),
|
536
|
+
cityOrTown: import_zod4.z.string().nullish(),
|
537
|
+
addressLine1: import_zod4.z.string().nullish(),
|
538
|
+
addressLine2: import_zod4.z.string().nullish(),
|
539
|
+
addressLine3: import_zod4.z.string().nullish(),
|
540
|
+
postcodeOrZip: import_zod4.z.string().nullish()
|
514
541
|
});
|
515
|
-
var AddressFieldUpdateValue =
|
542
|
+
var AddressFieldUpdateValue = import_zod4.z.discriminatedUnion("urbanOrRural", [
|
516
543
|
UrbanAddressUpdateValue,
|
517
544
|
RuralAddressUpdateValue
|
518
545
|
]).or(GenericAddressUpdateValue);
|
519
|
-
var FileFieldValueWithOption =
|
520
|
-
|
521
|
-
originalFilename:
|
522
|
-
type:
|
523
|
-
option:
|
546
|
+
var FileFieldValueWithOption = import_zod4.z.object({
|
547
|
+
path: FullDocumentPath,
|
548
|
+
originalFilename: import_zod4.z.string(),
|
549
|
+
type: import_zod4.z.string(),
|
550
|
+
option: import_zod4.z.string()
|
524
551
|
});
|
525
|
-
var FileFieldWithOptionValue =
|
552
|
+
var FileFieldWithOptionValue = import_zod4.z.array(FileFieldValueWithOption);
|
526
553
|
|
527
554
|
// ../commons/src/events/FieldValue.ts
|
528
|
-
var TextValue =
|
555
|
+
var TextValue = import_zod5.z.string();
|
529
556
|
var NonEmptyTextValue = TextValue.min(1);
|
530
|
-
var DateValue =
|
531
|
-
var DatetimeValue =
|
532
|
-
var
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
var
|
557
|
+
var DateValue = import_zod5.z.string().date().describe("Date in the format YYYY-MM-DD");
|
558
|
+
var DatetimeValue = import_zod5.z.string().datetime();
|
559
|
+
var SelectDateRangeValue = import_zod5.z.enum([
|
560
|
+
"last7Days",
|
561
|
+
"last30Days",
|
562
|
+
"last90Days",
|
563
|
+
"last365Days"
|
564
|
+
]);
|
565
|
+
var DateRangeFieldValue = import_zod5.z.object({
|
566
|
+
start: DateValue,
|
567
|
+
end: DateValue
|
568
|
+
}).or(DateValue).describe(
|
569
|
+
"Date range with start and end dates in the format YYYY-MM-DD. Inclusive start, exclusive end."
|
570
|
+
);
|
571
|
+
var EmailValue = import_zod5.z.string().email();
|
572
|
+
var CheckboxFieldValue = import_zod5.z.boolean();
|
573
|
+
var NumberFieldValue = import_zod5.z.number();
|
574
|
+
var DataFieldValue = import_zod5.z.undefined();
|
575
|
+
var SignatureFieldValue = import_zod5.z.string();
|
576
|
+
var FieldValue = import_zod5.z.union([
|
539
577
|
TextValue,
|
540
578
|
DateValue,
|
541
579
|
DateRangeFieldValue,
|
580
|
+
SelectDateRangeValue,
|
542
581
|
CheckboxFieldValue,
|
543
582
|
NumberFieldValue,
|
544
583
|
FileFieldValue,
|
@@ -550,10 +589,11 @@ var FieldValue = import_zod4.z.union([
|
|
550
589
|
NameFieldValue,
|
551
590
|
NameFieldUpdateValue
|
552
591
|
]);
|
553
|
-
var FieldUpdateValue =
|
592
|
+
var FieldUpdateValue = import_zod5.z.union([
|
554
593
|
TextValue,
|
555
594
|
DateValue,
|
556
595
|
DateRangeFieldValue,
|
596
|
+
SelectDateRangeValue,
|
557
597
|
CheckboxFieldValue,
|
558
598
|
NumberFieldValue,
|
559
599
|
FileFieldValue,
|
@@ -566,64 +606,64 @@ var FieldUpdateValue = import_zod4.z.union([
|
|
566
606
|
]);
|
567
607
|
|
568
608
|
// ../commons/src/events/FieldConfig.ts
|
569
|
-
var
|
570
|
-
(0,
|
571
|
-
var FieldId =
|
572
|
-
var FieldReference =
|
609
|
+
var import_zod_openapi4 = require("zod-openapi");
|
610
|
+
(0, import_zod_openapi4.extendZodWithOpenApi)(import_zod6.z);
|
611
|
+
var FieldId = import_zod6.z.string().describe("Unique identifier for the field");
|
612
|
+
var FieldReference = import_zod6.z.object({
|
573
613
|
$$field: FieldId
|
574
614
|
}).describe("Reference to a field by its ID");
|
575
615
|
var ParentReference = FieldReference.optional();
|
576
|
-
var ValidationConfig =
|
616
|
+
var ValidationConfig = import_zod6.z.object({
|
577
617
|
validator: Conditional,
|
578
618
|
message: TranslationConfig
|
579
619
|
});
|
580
|
-
var BaseField =
|
620
|
+
var BaseField = import_zod6.z.object({
|
581
621
|
id: FieldId,
|
582
622
|
parent: ParentReference,
|
583
|
-
conditionals:
|
584
|
-
required:
|
585
|
-
secured:
|
623
|
+
conditionals: import_zod6.z.array(FieldConditional).default([]).optional(),
|
624
|
+
required: import_zod6.z.boolean().default(false).optional(),
|
625
|
+
secured: import_zod6.z.boolean().default(false).optional(),
|
586
626
|
placeholder: TranslationConfig.optional(),
|
587
|
-
validation:
|
627
|
+
validation: import_zod6.z.array(ValidationConfig).default([]).optional(),
|
588
628
|
label: TranslationConfig,
|
589
629
|
helperText: TranslationConfig.optional(),
|
590
|
-
hideLabel:
|
630
|
+
hideLabel: import_zod6.z.boolean().default(false).optional()
|
591
631
|
});
|
592
632
|
var Divider = BaseField.extend({
|
593
|
-
type:
|
633
|
+
type: import_zod6.z.literal(FieldType.DIVIDER)
|
594
634
|
});
|
595
635
|
var TextField = BaseField.extend({
|
596
|
-
type:
|
636
|
+
type: import_zod6.z.literal(FieldType.TEXT),
|
597
637
|
defaultValue: NonEmptyTextValue.optional(),
|
598
|
-
configuration:
|
599
|
-
maxLength:
|
600
|
-
type:
|
638
|
+
configuration: import_zod6.z.object({
|
639
|
+
maxLength: import_zod6.z.number().optional().describe("Maximum length of the text"),
|
640
|
+
type: import_zod6.z.enum(["text", "password"]).optional(),
|
601
641
|
prefix: TranslationConfig.optional(),
|
602
642
|
postfix: TranslationConfig.optional()
|
603
643
|
}).default({ type: "text" }).optional()
|
604
644
|
}).describe("Text input");
|
605
645
|
var NumberField = BaseField.extend({
|
606
|
-
type:
|
646
|
+
type: import_zod6.z.literal(FieldType.NUMBER),
|
607
647
|
defaultValue: NumberFieldValue.optional(),
|
608
|
-
configuration:
|
609
|
-
min:
|
610
|
-
max:
|
648
|
+
configuration: import_zod6.z.object({
|
649
|
+
min: import_zod6.z.number().optional().describe("Minimum value"),
|
650
|
+
max: import_zod6.z.number().optional().describe("Maximum value"),
|
611
651
|
prefix: TranslationConfig.optional(),
|
612
652
|
postfix: TranslationConfig.optional()
|
613
653
|
}).optional()
|
614
654
|
}).describe("Number input");
|
615
655
|
var TextAreaField = BaseField.extend({
|
616
|
-
type:
|
656
|
+
type: import_zod6.z.literal(FieldType.TEXTAREA),
|
617
657
|
defaultValue: NonEmptyTextValue.optional(),
|
618
|
-
configuration:
|
619
|
-
maxLength:
|
620
|
-
rows:
|
621
|
-
cols:
|
658
|
+
configuration: import_zod6.z.object({
|
659
|
+
maxLength: import_zod6.z.number().optional().describe("Maximum length of the text"),
|
660
|
+
rows: import_zod6.z.number().optional().describe("Number of visible text lines"),
|
661
|
+
cols: import_zod6.z.number().optional().describe("Number of visible columns"),
|
622
662
|
prefix: TranslationConfig.optional(),
|
623
663
|
postfix: TranslationConfig.optional()
|
624
664
|
}).default({ rows: 4 }).optional()
|
625
665
|
}).describe("Multiline text input");
|
626
|
-
var ImageMimeType =
|
666
|
+
var ImageMimeType = import_zod6.z.enum([
|
627
667
|
"image/png",
|
628
668
|
"image/jpg",
|
629
669
|
"image/jpeg",
|
@@ -632,46 +672,44 @@ var ImageMimeType = import_zod5.z.enum([
|
|
632
672
|
var MimeType = ImageMimeType;
|
633
673
|
var DEFAULT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;
|
634
674
|
var SignatureField = BaseField.extend({
|
635
|
-
type:
|
675
|
+
type: import_zod6.z.literal(FieldType.SIGNATURE),
|
636
676
|
signaturePromptLabel: TranslationConfig.describe(
|
637
677
|
"Title of the signature modal"
|
638
678
|
),
|
639
679
|
defaultValue: SignatureFieldValue.optional(),
|
640
|
-
configuration:
|
641
|
-
maxFileSize:
|
680
|
+
configuration: import_zod6.z.object({
|
681
|
+
maxFileSize: import_zod6.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
642
682
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
643
683
|
}).default({
|
644
684
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
645
685
|
})
|
646
686
|
}).describe("Signature input field");
|
647
687
|
var EmailField = BaseField.extend({
|
648
|
-
type:
|
649
|
-
configuration:
|
650
|
-
maxLength:
|
688
|
+
type: import_zod6.z.literal(FieldType.EMAIL),
|
689
|
+
configuration: import_zod6.z.object({
|
690
|
+
maxLength: import_zod6.z.number().optional().describe("Maximum length of the text")
|
651
691
|
}).default({ maxLength: 10 }).optional(),
|
652
692
|
defaultValue: NonEmptyTextValue.optional()
|
653
693
|
});
|
654
694
|
var DateField = BaseField.extend({
|
655
|
-
type:
|
695
|
+
type: import_zod6.z.literal(FieldType.DATE),
|
656
696
|
defaultValue: DateValue.optional(),
|
657
|
-
configuration:
|
697
|
+
configuration: import_zod6.z.object({
|
658
698
|
notice: TranslationConfig.describe(
|
659
699
|
"Text to display above the date input"
|
660
700
|
).optional()
|
661
701
|
}).optional()
|
662
|
-
}).describe("A single date input (
|
702
|
+
}).describe("A single date input (yyyy-MM-dd)");
|
663
703
|
var DateRangeField = BaseField.extend({
|
664
|
-
type:
|
704
|
+
type: import_zod6.z.literal(FieldType.DATE_RANGE),
|
665
705
|
defaultValue: DateRangeFieldValue.optional(),
|
666
|
-
configuration:
|
706
|
+
configuration: import_zod6.z.object({
|
667
707
|
notice: TranslationConfig.describe(
|
668
708
|
"Text to display above the date input"
|
669
709
|
).optional()
|
670
710
|
}).optional()
|
671
|
-
}).describe(
|
672
|
-
|
673
|
-
);
|
674
|
-
var HtmlFontVariant = import_zod5.z.enum([
|
711
|
+
}).describe("A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })");
|
712
|
+
var HtmlFontVariant = import_zod6.z.enum([
|
675
713
|
"reg12",
|
676
714
|
"reg14",
|
677
715
|
"reg16",
|
@@ -682,26 +720,26 @@ var HtmlFontVariant = import_zod5.z.enum([
|
|
682
720
|
"h1"
|
683
721
|
]);
|
684
722
|
var Paragraph = BaseField.extend({
|
685
|
-
type:
|
723
|
+
type: import_zod6.z.literal(FieldType.PARAGRAPH),
|
686
724
|
defaultValue: NonEmptyTextValue.optional(),
|
687
|
-
configuration:
|
688
|
-
styles:
|
725
|
+
configuration: import_zod6.z.object({
|
726
|
+
styles: import_zod6.z.object({
|
689
727
|
fontVariant: HtmlFontVariant.optional()
|
690
728
|
}).optional()
|
691
729
|
}).default({})
|
692
730
|
}).describe("A read-only HTML <p> paragraph");
|
693
731
|
var PageHeader = BaseField.extend({
|
694
|
-
type:
|
732
|
+
type: import_zod6.z.literal(FieldType.PAGE_HEADER),
|
695
733
|
defaultValue: NonEmptyTextValue.optional()
|
696
734
|
}).describe("A read-only header component for form pages");
|
697
735
|
var File = BaseField.extend({
|
698
|
-
type:
|
736
|
+
type: import_zod6.z.literal(FieldType.FILE),
|
699
737
|
defaultValue: FileFieldValue.optional(),
|
700
|
-
configuration:
|
701
|
-
maxFileSize:
|
738
|
+
configuration: import_zod6.z.object({
|
739
|
+
maxFileSize: import_zod6.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
702
740
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
|
703
|
-
style:
|
704
|
-
width:
|
741
|
+
style: import_zod6.z.object({
|
742
|
+
width: import_zod6.z.enum(["full", "auto"]).optional().describe(
|
705
743
|
"Whether the file upload button should take the full width of the container or not"
|
706
744
|
)
|
707
745
|
}).optional(),
|
@@ -710,129 +748,147 @@ var File = BaseField.extend({
|
|
710
748
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
711
749
|
})
|
712
750
|
}).describe("File upload");
|
713
|
-
var SelectOption =
|
714
|
-
value:
|
751
|
+
var SelectOption = import_zod6.z.object({
|
752
|
+
value: import_zod6.z.string().describe("The value of the option"),
|
715
753
|
label: TranslationConfig.describe("The label of the option")
|
716
754
|
});
|
717
755
|
var RadioGroup = BaseField.extend({
|
718
|
-
type:
|
756
|
+
type: import_zod6.z.literal(FieldType.RADIO_GROUP),
|
719
757
|
defaultValue: TextValue.optional(),
|
720
|
-
options:
|
721
|
-
configuration:
|
722
|
-
styles:
|
723
|
-
size:
|
758
|
+
options: import_zod6.z.array(SelectOption).describe("A list of options"),
|
759
|
+
configuration: import_zod6.z.object({
|
760
|
+
styles: import_zod6.z.object({
|
761
|
+
size: import_zod6.z.enum(["NORMAL", "LARGE"]).optional()
|
724
762
|
}).optional()
|
725
763
|
}).optional()
|
726
764
|
}).describe("Grouped radio options");
|
727
765
|
var BulletList = BaseField.extend({
|
728
|
-
type:
|
766
|
+
type: import_zod6.z.literal(FieldType.BULLET_LIST),
|
729
767
|
defaultValue: TextValue.optional(),
|
730
|
-
items:
|
731
|
-
configuration:
|
732
|
-
styles:
|
768
|
+
items: import_zod6.z.array(TranslationConfig).describe("A list of items"),
|
769
|
+
configuration: import_zod6.z.object({
|
770
|
+
styles: import_zod6.z.object({
|
733
771
|
fontVariant: HtmlFontVariant.optional()
|
734
772
|
}).optional()
|
735
773
|
}).default({})
|
736
774
|
}).describe("A list of bullet points");
|
737
775
|
var Select = BaseField.extend({
|
738
|
-
type:
|
776
|
+
type: import_zod6.z.literal(FieldType.SELECT),
|
739
777
|
defaultValue: TextValue.optional(),
|
740
|
-
options:
|
778
|
+
options: import_zod6.z.array(SelectOption).describe("A list of options")
|
741
779
|
}).describe("Select input");
|
780
|
+
var SelectDateRangeOption = import_zod6.z.object({
|
781
|
+
value: SelectDateRangeValue.describe("The value of the option"),
|
782
|
+
label: TranslationConfig.describe("The label of the option")
|
783
|
+
});
|
784
|
+
var SelectDateRangeField = BaseField.extend({
|
785
|
+
type: import_zod6.z.literal(FieldType.SELECT_DATE_RANGE),
|
786
|
+
defaultValue: SelectDateRangeValue.optional(),
|
787
|
+
options: import_zod6.z.array(SelectDateRangeOption).describe("A list of options")
|
788
|
+
}).describe("Select input with date range options");
|
742
789
|
var NameField = BaseField.extend({
|
743
|
-
type:
|
744
|
-
defaultValue:
|
790
|
+
type: import_zod6.z.literal(FieldType.NAME),
|
791
|
+
defaultValue: import_zod6.z.object({
|
745
792
|
firstname: NonEmptyTextValue,
|
746
793
|
surname: NonEmptyTextValue
|
747
794
|
}).optional(),
|
748
|
-
configuration:
|
749
|
-
maxLength:
|
795
|
+
configuration: import_zod6.z.object({
|
796
|
+
maxLength: import_zod6.z.number().optional().describe("Maximum length of the text"),
|
750
797
|
prefix: TranslationConfig.optional(),
|
751
|
-
postfix: TranslationConfig.optional()
|
798
|
+
postfix: TranslationConfig.optional(),
|
799
|
+
includeMiddlename: import_zod6.z.boolean().default(false).optional().describe("To make middle name visible in Name form field"),
|
800
|
+
searchMode: import_zod6.z.boolean().optional()
|
752
801
|
}).optional()
|
753
802
|
}).describe("Name input field");
|
754
803
|
var PhoneField = BaseField.extend({
|
755
804
|
defaultValue: NonEmptyTextValue.optional(),
|
756
|
-
type:
|
805
|
+
type: import_zod6.z.literal(FieldType.PHONE)
|
757
806
|
}).describe("Phone input field");
|
758
807
|
var IdField = BaseField.extend({
|
759
808
|
defaultValue: NonEmptyTextValue.optional(),
|
760
|
-
type:
|
809
|
+
type: import_zod6.z.literal(FieldType.ID)
|
761
810
|
}).describe("ID input field");
|
762
811
|
var Checkbox = BaseField.extend({
|
763
|
-
type:
|
812
|
+
type: import_zod6.z.literal(FieldType.CHECKBOX),
|
764
813
|
defaultValue: CheckboxFieldValue.optional()
|
765
814
|
}).describe("Boolean checkbox field");
|
766
815
|
var Country = BaseField.extend({
|
767
|
-
type:
|
816
|
+
type: import_zod6.z.literal(FieldType.COUNTRY),
|
768
817
|
defaultValue: NonEmptyTextValue.optional()
|
769
818
|
}).describe("Country select field");
|
770
|
-
var AdministrativeAreas =
|
819
|
+
var AdministrativeAreas = import_zod6.z.enum([
|
771
820
|
"ADMIN_STRUCTURE",
|
772
821
|
"HEALTH_FACILITY",
|
773
822
|
"CRVS_OFFICE"
|
774
823
|
]);
|
775
|
-
var AdministrativeAreaConfiguration =
|
776
|
-
partOf:
|
777
|
-
$declaration:
|
824
|
+
var AdministrativeAreaConfiguration = import_zod6.z.object({
|
825
|
+
partOf: import_zod6.z.object({
|
826
|
+
$declaration: import_zod6.z.string()
|
778
827
|
}).optional().describe("Parent location"),
|
779
828
|
type: AdministrativeAreas
|
780
829
|
}).describe("Administrative area options");
|
781
830
|
var AdministrativeArea = BaseField.extend({
|
782
|
-
type:
|
831
|
+
type: import_zod6.z.literal(FieldType.ADMINISTRATIVE_AREA),
|
783
832
|
defaultValue: NonEmptyTextValue.optional(),
|
784
833
|
configuration: AdministrativeAreaConfiguration
|
785
834
|
}).describe("Administrative area input field e.g. facility, office");
|
786
835
|
var Location = BaseField.extend({
|
787
|
-
type:
|
788
|
-
defaultValue: NonEmptyTextValue.optional()
|
836
|
+
type: import_zod6.z.literal(FieldType.LOCATION),
|
837
|
+
defaultValue: NonEmptyTextValue.optional(),
|
838
|
+
configuration: import_zod6.z.object({
|
839
|
+
searchableResource: import_zod6.z.array(import_zod6.z.enum(["locations", "facilities", "offices"])).optional()
|
840
|
+
}).optional()
|
789
841
|
}).describe("Input field for a location");
|
790
842
|
var FileUploadWithOptions = BaseField.extend({
|
791
|
-
type:
|
792
|
-
options:
|
843
|
+
type: import_zod6.z.literal(FieldType.FILE_WITH_OPTIONS),
|
844
|
+
options: import_zod6.z.array(SelectOption).describe("A list of options"),
|
793
845
|
defaultValue: FileFieldWithOptionValue.optional(),
|
794
|
-
configuration:
|
795
|
-
maxFileSize:
|
846
|
+
configuration: import_zod6.z.object({
|
847
|
+
maxFileSize: import_zod6.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
796
848
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
797
849
|
}).default({
|
798
850
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
799
851
|
})
|
800
852
|
});
|
801
853
|
var Facility = BaseField.extend({
|
802
|
-
type:
|
854
|
+
type: import_zod6.z.literal(FieldType.FACILITY),
|
803
855
|
defaultValue: NonEmptyTextValue.optional()
|
804
856
|
}).describe("Input field for a facility");
|
805
857
|
var Office = BaseField.extend({
|
806
|
-
type:
|
858
|
+
type: import_zod6.z.literal(FieldType.OFFICE),
|
807
859
|
defaultValue: NonEmptyTextValue.optional()
|
808
860
|
}).describe("Input field for an office");
|
809
861
|
var Address = BaseField.extend({
|
810
|
-
type:
|
811
|
-
defaultValue: AddressFieldValue.optional()
|
862
|
+
type: import_zod6.z.literal(FieldType.ADDRESS),
|
863
|
+
defaultValue: AddressFieldValue.optional(),
|
864
|
+
configuration: import_zod6.z.object({
|
865
|
+
searchMode: import_zod6.z.boolean().optional()
|
866
|
+
}).optional()
|
812
867
|
}).describe("Address input field \u2013 a combination of location and text fields");
|
813
|
-
var DataEntry =
|
814
|
-
|
868
|
+
var DataEntry = import_zod6.z.union([
|
869
|
+
import_zod6.z.object({
|
815
870
|
label: TranslationConfig,
|
816
|
-
value: TranslationConfig.or(
|
871
|
+
value: TranslationConfig.or(import_zod6.z.string())
|
817
872
|
}),
|
818
|
-
|
819
|
-
fieldId:
|
873
|
+
import_zod6.z.object({
|
874
|
+
fieldId: import_zod6.z.string()
|
820
875
|
})
|
821
876
|
]);
|
822
877
|
var DataField = BaseField.extend({
|
823
|
-
type:
|
824
|
-
configuration:
|
878
|
+
type: import_zod6.z.literal(FieldType.DATA),
|
879
|
+
configuration: import_zod6.z.object({
|
825
880
|
subtitle: TranslationConfig.optional(),
|
826
|
-
data:
|
881
|
+
data: import_zod6.z.array(DataEntry)
|
827
882
|
})
|
828
883
|
}).describe("Data field for displaying read-only data");
|
829
|
-
var FieldConfig =
|
884
|
+
var FieldConfig = import_zod6.z.discriminatedUnion("type", [
|
830
885
|
Address,
|
831
886
|
TextField,
|
832
887
|
NumberField,
|
833
888
|
TextAreaField,
|
834
889
|
DateField,
|
835
890
|
DateRangeField,
|
891
|
+
SelectDateRangeField,
|
836
892
|
Paragraph,
|
837
893
|
RadioGroup,
|
838
894
|
BulletList,
|
@@ -859,13 +915,13 @@ var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
|
859
915
|
});
|
860
916
|
|
861
917
|
// ../commons/src/events/PageConfig.ts
|
862
|
-
var
|
863
|
-
(0,
|
864
|
-
var PageTypes =
|
865
|
-
var PageConfigBase =
|
866
|
-
id:
|
918
|
+
var import_zod_openapi5 = require("zod-openapi");
|
919
|
+
(0, import_zod_openapi5.extendZodWithOpenApi)(import_zod7.z);
|
920
|
+
var PageTypes = import_zod7.z.enum(["FORM", "VERIFICATION"]);
|
921
|
+
var PageConfigBase = import_zod7.z.object({
|
922
|
+
id: import_zod7.z.string().describe("Unique identifier for the page"),
|
867
923
|
title: TranslationConfig.describe("Header title of the page"),
|
868
|
-
fields:
|
924
|
+
fields: import_zod7.z.array(FieldConfig).describe("Fields to be rendered on the page"),
|
869
925
|
conditional: Conditional.optional().describe(
|
870
926
|
"Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
|
871
927
|
)
|
@@ -874,13 +930,13 @@ var PageConfigBase = import_zod6.z.object({
|
|
874
930
|
ref: "FormPageConfig"
|
875
931
|
});
|
876
932
|
var FormPageConfig = PageConfigBase.extend({
|
877
|
-
type:
|
933
|
+
type: import_zod7.z.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
|
878
934
|
});
|
879
|
-
var VerificationActionConfig =
|
880
|
-
verify:
|
881
|
-
cancel:
|
935
|
+
var VerificationActionConfig = import_zod7.z.object({
|
936
|
+
verify: import_zod7.z.object({ label: TranslationConfig }),
|
937
|
+
cancel: import_zod7.z.object({
|
882
938
|
label: TranslationConfig,
|
883
|
-
confirmation:
|
939
|
+
confirmation: import_zod7.z.object({
|
884
940
|
title: TranslationConfig,
|
885
941
|
body: TranslationConfig
|
886
942
|
})
|
@@ -890,16 +946,16 @@ var VerificationActionConfig = import_zod6.z.object({
|
|
890
946
|
ref: "VerificationActionConfig"
|
891
947
|
});
|
892
948
|
var VerificationPageConfig = FormPageConfig.extend({
|
893
|
-
type:
|
949
|
+
type: import_zod7.z.literal(PageTypes.enum.VERIFICATION),
|
894
950
|
actions: VerificationActionConfig
|
895
951
|
});
|
896
|
-
var PageConfig =
|
952
|
+
var PageConfig = import_zod7.z.discriminatedUnion("type", [
|
897
953
|
FormPageConfig,
|
898
954
|
VerificationPageConfig
|
899
955
|
]);
|
900
956
|
|
901
957
|
// ../commons/src/events/ActionType.ts
|
902
|
-
var
|
958
|
+
var import_zod8 = require("zod");
|
903
959
|
var ActionType = {
|
904
960
|
// Pre-declaration actions
|
905
961
|
DELETE: "DELETE",
|
@@ -935,7 +991,7 @@ var ConfirmableActions = [
|
|
935
991
|
ActionType.ARCHIVE,
|
936
992
|
ActionType.PRINT_CERTIFICATE
|
937
993
|
];
|
938
|
-
var ActionTypes =
|
994
|
+
var ActionTypes = import_zod8.z.enum([
|
939
995
|
"DELETE",
|
940
996
|
"CREATE",
|
941
997
|
"NOTIFY",
|
@@ -995,103 +1051,103 @@ function isMetaAction(actionType) {
|
|
995
1051
|
}
|
996
1052
|
|
997
1053
|
// ../commons/src/events/FormConfig.ts
|
998
|
-
var
|
999
|
-
var DeclarationFormConfig =
|
1054
|
+
var import_zod9 = require("zod");
|
1055
|
+
var DeclarationFormConfig = import_zod9.z.object({
|
1000
1056
|
label: TranslationConfig.describe("Human readable description of the form"),
|
1001
|
-
pages:
|
1057
|
+
pages: import_zod9.z.array(FormPageConfig)
|
1002
1058
|
}).describe("Configuration for a declaration form");
|
1003
|
-
var ActionFormConfig =
|
1059
|
+
var ActionFormConfig = import_zod9.z.object({
|
1004
1060
|
label: TranslationConfig.describe("Human readable description of the form"),
|
1005
|
-
pages:
|
1061
|
+
pages: import_zod9.z.array(PageConfig)
|
1006
1062
|
});
|
1007
|
-
var FormConfig =
|
1063
|
+
var FormConfig = import_zod9.z.union([DeclarationFormConfig, ActionFormConfig]);
|
1008
1064
|
|
1009
1065
|
// ../commons/src/events/ActionConfig.ts
|
1010
|
-
var
|
1011
|
-
(0,
|
1012
|
-
var ActionConditional2 =
|
1066
|
+
var import_zod_openapi6 = require("zod-openapi");
|
1067
|
+
(0, import_zod_openapi6.extendZodWithOpenApi)(import_zod10.z);
|
1068
|
+
var ActionConditional2 = import_zod10.z.discriminatedUnion("type", [
|
1013
1069
|
/** If conditional is defined, the action is shown to the user only if the condition is met */
|
1014
1070
|
ShowConditional,
|
1015
1071
|
/** If conditional is defined, the action is enabled only if the condition is met */
|
1016
1072
|
EnableConditional
|
1017
1073
|
]);
|
1018
|
-
var DeclarationReviewConfig =
|
1074
|
+
var DeclarationReviewConfig = import_zod10.z.object({
|
1019
1075
|
title: TranslationConfig.describe("Title of the review page"),
|
1020
|
-
fields:
|
1076
|
+
fields: import_zod10.z.array(FieldConfig).describe("Fields to be rendered on the review page for annotations.")
|
1021
1077
|
}).describe("Configuration for **declaration** review page.");
|
1022
|
-
var ActionConfigBase =
|
1078
|
+
var ActionConfigBase = import_zod10.z.object({
|
1023
1079
|
label: TranslationConfig,
|
1024
|
-
conditionals:
|
1025
|
-
draft:
|
1080
|
+
conditionals: import_zod10.z.array(ActionConditional2).optional().default([]),
|
1081
|
+
draft: import_zod10.z.boolean().optional()
|
1026
1082
|
});
|
1027
1083
|
var ReadActionConfig = ActionConfigBase.merge(
|
1028
|
-
|
1029
|
-
type:
|
1084
|
+
import_zod10.z.object({
|
1085
|
+
type: import_zod10.z.literal(ActionType.READ),
|
1030
1086
|
review: DeclarationReviewConfig
|
1031
1087
|
})
|
1032
1088
|
);
|
1033
1089
|
var DeclareConfig = ActionConfigBase.merge(
|
1034
|
-
|
1035
|
-
type:
|
1090
|
+
import_zod10.z.object({
|
1091
|
+
type: import_zod10.z.literal(ActionType.DECLARE),
|
1036
1092
|
review: DeclarationReviewConfig
|
1037
1093
|
})
|
1038
1094
|
);
|
1039
1095
|
var ValidateConfig = ActionConfigBase.merge(
|
1040
|
-
|
1041
|
-
type:
|
1096
|
+
import_zod10.z.object({
|
1097
|
+
type: import_zod10.z.literal(ActionType.VALIDATE),
|
1042
1098
|
review: DeclarationReviewConfig
|
1043
1099
|
})
|
1044
1100
|
);
|
1045
1101
|
var RegisterConfig = ActionConfigBase.merge(
|
1046
|
-
|
1047
|
-
type:
|
1102
|
+
import_zod10.z.object({
|
1103
|
+
type: import_zod10.z.literal(ActionType.REGISTER),
|
1048
1104
|
review: DeclarationReviewConfig
|
1049
1105
|
})
|
1050
1106
|
);
|
1051
1107
|
var RejectDeclarationConfig = ActionConfigBase.merge(
|
1052
|
-
|
1053
|
-
type:
|
1108
|
+
import_zod10.z.object({
|
1109
|
+
type: import_zod10.z.literal(ActionType.REJECT)
|
1054
1110
|
})
|
1055
1111
|
);
|
1056
1112
|
var MarkedAsDuplicateConfig = ActionConfigBase.merge(
|
1057
|
-
|
1058
|
-
type:
|
1113
|
+
import_zod10.z.object({
|
1114
|
+
type: import_zod10.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1059
1115
|
})
|
1060
1116
|
);
|
1061
1117
|
var ArchiveConfig = ActionConfigBase.merge(
|
1062
|
-
|
1063
|
-
type:
|
1118
|
+
import_zod10.z.object({
|
1119
|
+
type: import_zod10.z.literal(ActionType.ARCHIVE)
|
1064
1120
|
})
|
1065
1121
|
);
|
1066
1122
|
var DeleteConfig = ActionConfigBase.merge(
|
1067
|
-
|
1068
|
-
type:
|
1123
|
+
import_zod10.z.object({
|
1124
|
+
type: import_zod10.z.literal(ActionType.DELETE)
|
1069
1125
|
})
|
1070
1126
|
);
|
1071
1127
|
var PrintCertificateActionConfig = ActionConfigBase.merge(
|
1072
|
-
|
1073
|
-
type:
|
1128
|
+
import_zod10.z.object({
|
1129
|
+
type: import_zod10.z.literal(ActionType.PRINT_CERTIFICATE),
|
1074
1130
|
printForm: ActionFormConfig
|
1075
1131
|
})
|
1076
1132
|
);
|
1077
1133
|
var RequestCorrectionConfig = ActionConfigBase.merge(
|
1078
|
-
|
1079
|
-
type:
|
1080
|
-
onboardingForm:
|
1081
|
-
additionalDetailsForm:
|
1134
|
+
import_zod10.z.object({
|
1135
|
+
type: import_zod10.z.literal(ActionType.REQUEST_CORRECTION),
|
1136
|
+
onboardingForm: import_zod10.z.array(PageConfig),
|
1137
|
+
additionalDetailsForm: import_zod10.z.array(PageConfig)
|
1082
1138
|
})
|
1083
1139
|
);
|
1084
1140
|
var RejectCorrectionConfig = ActionConfigBase.merge(
|
1085
|
-
|
1086
|
-
type:
|
1141
|
+
import_zod10.z.object({
|
1142
|
+
type: import_zod10.z.literal(ActionType.REJECT_CORRECTION)
|
1087
1143
|
})
|
1088
1144
|
);
|
1089
1145
|
var ApproveCorrectionConfig = ActionConfigBase.merge(
|
1090
|
-
|
1091
|
-
type:
|
1146
|
+
import_zod10.z.object({
|
1147
|
+
type: import_zod10.z.literal(ActionType.APPROVE_CORRECTION)
|
1092
1148
|
})
|
1093
1149
|
);
|
1094
|
-
var ActionConfig =
|
1150
|
+
var ActionConfig = import_zod10.z.discriminatedUnion("type", [
|
1095
1151
|
/*
|
1096
1152
|
* OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
|
1097
1153
|
* and treat them as "models" instead of duplicating the data structure in each endpoint.
|
@@ -1111,108 +1167,108 @@ var ActionConfig = import_zod9.z.discriminatedUnion("type", [
|
|
1111
1167
|
RejectCorrectionConfig.openapi({ ref: "RejectCorrectionActionConfig" }),
|
1112
1168
|
ApproveCorrectionConfig.openapi({ ref: "ApproveCorrectionActionConfig" })
|
1113
1169
|
]).openapi({ ref: "ActionConfig" });
|
1114
|
-
var DeclarationActionConfig =
|
1170
|
+
var DeclarationActionConfig = import_zod10.z.discriminatedUnion("type", [
|
1115
1171
|
DeclareConfig,
|
1116
1172
|
ValidateConfig,
|
1117
1173
|
RegisterConfig
|
1118
1174
|
]);
|
1119
1175
|
|
1120
1176
|
// ../commons/src/events/offline/CertificateConfig.ts
|
1121
|
-
var
|
1122
|
-
var FontFamily =
|
1123
|
-
normal:
|
1124
|
-
bold:
|
1125
|
-
italics:
|
1126
|
-
bolditalics:
|
1177
|
+
var import_zod11 = require("zod");
|
1178
|
+
var FontFamily = import_zod11.z.object({
|
1179
|
+
normal: import_zod11.z.string(),
|
1180
|
+
bold: import_zod11.z.string(),
|
1181
|
+
italics: import_zod11.z.string(),
|
1182
|
+
bolditalics: import_zod11.z.string()
|
1127
1183
|
});
|
1128
|
-
var CertificateConfig =
|
1129
|
-
id:
|
1130
|
-
event:
|
1184
|
+
var CertificateConfig = import_zod11.z.object({
|
1185
|
+
id: import_zod11.z.string(),
|
1186
|
+
event: import_zod11.z.string(),
|
1131
1187
|
label: TranslationConfig,
|
1132
|
-
isDefault:
|
1133
|
-
fee:
|
1134
|
-
onTime:
|
1135
|
-
late:
|
1136
|
-
delayed:
|
1188
|
+
isDefault: import_zod11.z.boolean(),
|
1189
|
+
fee: import_zod11.z.object({
|
1190
|
+
onTime: import_zod11.z.number(),
|
1191
|
+
late: import_zod11.z.number(),
|
1192
|
+
delayed: import_zod11.z.number()
|
1137
1193
|
}),
|
1138
|
-
svgUrl:
|
1139
|
-
fonts:
|
1194
|
+
svgUrl: import_zod11.z.string(),
|
1195
|
+
fonts: import_zod11.z.record(FontFamily).optional()
|
1140
1196
|
});
|
1141
1197
|
var CertificateTemplateConfig = CertificateConfig.extend({
|
1142
|
-
hash:
|
1143
|
-
svg:
|
1198
|
+
hash: import_zod11.z.string().optional(),
|
1199
|
+
svg: import_zod11.z.string()
|
1144
1200
|
});
|
1145
1201
|
|
1146
1202
|
// ../commons/src/events/offline/LanguageConfig.ts
|
1147
|
-
var
|
1148
|
-
var LanguageConfig =
|
1149
|
-
lang:
|
1203
|
+
var import_zod12 = require("zod");
|
1204
|
+
var LanguageConfig = import_zod12.z.object({
|
1205
|
+
lang: import_zod12.z.string(),
|
1150
1206
|
/**
|
1151
1207
|
* client.csv contents
|
1152
1208
|
*/
|
1153
|
-
messages:
|
1209
|
+
messages: import_zod12.z.record(import_zod12.z.string())
|
1154
1210
|
});
|
1155
1211
|
|
1156
1212
|
// ../commons/src/events/EventConfig.ts
|
1157
|
-
var
|
1213
|
+
var import_zod21 = require("zod");
|
1158
1214
|
|
1159
1215
|
// ../commons/src/events/DeduplicationConfig.ts
|
1160
|
-
var
|
1161
|
-
var
|
1162
|
-
(0,
|
1163
|
-
var FieldReference2 =
|
1164
|
-
var Matcher =
|
1165
|
-
fieldId:
|
1166
|
-
options:
|
1167
|
-
boost:
|
1216
|
+
var import_zod13 = require("zod");
|
1217
|
+
var import_zod_openapi7 = require("zod-openapi");
|
1218
|
+
(0, import_zod_openapi7.extendZodWithOpenApi)(import_zod13.z);
|
1219
|
+
var FieldReference2 = import_zod13.z.string();
|
1220
|
+
var Matcher = import_zod13.z.object({
|
1221
|
+
fieldId: import_zod13.z.string(),
|
1222
|
+
options: import_zod13.z.object({
|
1223
|
+
boost: import_zod13.z.number().optional()
|
1168
1224
|
}).optional().default({})
|
1169
1225
|
});
|
1170
1226
|
var FuzzyMatcher = Matcher.extend({
|
1171
|
-
type:
|
1172
|
-
options:
|
1227
|
+
type: import_zod13.z.literal("fuzzy"),
|
1228
|
+
options: import_zod13.z.object({
|
1173
1229
|
/**
|
1174
1230
|
* Names of length 3 or less characters = 0 edits allowed
|
1175
1231
|
* Names of length 4 - 6 characters = 1 edit allowed
|
1176
1232
|
* Names of length >7 characters = 2 edits allowed
|
1177
1233
|
*/
|
1178
|
-
fuzziness:
|
1179
|
-
boost:
|
1234
|
+
fuzziness: import_zod13.z.union([import_zod13.z.string(), import_zod13.z.number()]).optional().default("AUTO:4,7"),
|
1235
|
+
boost: import_zod13.z.number().optional().default(1)
|
1180
1236
|
}).optional().default({})
|
1181
1237
|
});
|
1182
1238
|
var StrictMatcher = Matcher.extend({
|
1183
|
-
type:
|
1184
|
-
options:
|
1185
|
-
boost:
|
1239
|
+
type: import_zod13.z.literal("strict"),
|
1240
|
+
options: import_zod13.z.object({
|
1241
|
+
boost: import_zod13.z.number().optional().default(1)
|
1186
1242
|
}).optional().default({})
|
1187
1243
|
});
|
1188
1244
|
var DateRangeMatcher = Matcher.extend({
|
1189
|
-
type:
|
1190
|
-
options:
|
1191
|
-
days:
|
1245
|
+
type: import_zod13.z.literal("dateRange"),
|
1246
|
+
options: import_zod13.z.object({
|
1247
|
+
days: import_zod13.z.number(),
|
1192
1248
|
origin: FieldReference2,
|
1193
|
-
boost:
|
1249
|
+
boost: import_zod13.z.number().optional().default(1)
|
1194
1250
|
})
|
1195
1251
|
});
|
1196
1252
|
var DateDistanceMatcher = Matcher.extend({
|
1197
|
-
type:
|
1198
|
-
options:
|
1199
|
-
days:
|
1253
|
+
type: import_zod13.z.literal("dateDistance"),
|
1254
|
+
options: import_zod13.z.object({
|
1255
|
+
days: import_zod13.z.number(),
|
1200
1256
|
origin: FieldReference2,
|
1201
|
-
boost:
|
1257
|
+
boost: import_zod13.z.number().optional().default(1)
|
1202
1258
|
})
|
1203
1259
|
});
|
1204
|
-
var And =
|
1205
|
-
type:
|
1260
|
+
var And = import_zod13.z.object({
|
1261
|
+
type: import_zod13.z.literal("and"),
|
1206
1262
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
1207
|
-
clauses:
|
1263
|
+
clauses: import_zod13.z.lazy(() => Clause.array())
|
1208
1264
|
});
|
1209
|
-
var Or =
|
1210
|
-
type:
|
1265
|
+
var Or = import_zod13.z.object({
|
1266
|
+
type: import_zod13.z.literal("or"),
|
1211
1267
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
1212
|
-
clauses:
|
1268
|
+
clauses: import_zod13.z.lazy(() => Clause.array())
|
1213
1269
|
});
|
1214
|
-
var Clause =
|
1215
|
-
() =>
|
1270
|
+
var Clause = import_zod13.z.lazy(
|
1271
|
+
() => import_zod13.z.discriminatedUnion("type", [
|
1216
1272
|
And,
|
1217
1273
|
Or,
|
1218
1274
|
FuzzyMatcher,
|
@@ -1223,43 +1279,43 @@ var Clause = import_zod12.z.lazy(
|
|
1223
1279
|
).openapi({
|
1224
1280
|
ref: "Clause"
|
1225
1281
|
});
|
1226
|
-
var DeduplicationConfig =
|
1227
|
-
id:
|
1282
|
+
var DeduplicationConfig = import_zod13.z.object({
|
1283
|
+
id: import_zod13.z.string(),
|
1228
1284
|
label: TranslationConfig,
|
1229
1285
|
query: Clause
|
1230
1286
|
});
|
1231
1287
|
|
1232
1288
|
// ../commons/src/events/SummaryConfig.ts
|
1233
|
-
var
|
1234
|
-
var BaseField2 =
|
1289
|
+
var import_zod14 = require("zod");
|
1290
|
+
var BaseField2 = import_zod14.z.object({
|
1235
1291
|
emptyValueMessage: TranslationConfig.optional(),
|
1236
|
-
conditionals:
|
1292
|
+
conditionals: import_zod14.z.array(ShowConditional).default([]).optional()
|
1237
1293
|
});
|
1238
1294
|
var ReferenceField = BaseField2.extend({
|
1239
|
-
fieldId:
|
1295
|
+
fieldId: import_zod14.z.string(),
|
1240
1296
|
label: TranslationConfig.optional().describe(
|
1241
1297
|
"By default, the configured field's label is used. This can be overridden by providing a custom label."
|
1242
1298
|
)
|
1243
1299
|
}).describe("Field directly referencing event data with field id");
|
1244
1300
|
var Field = BaseField2.extend({
|
1245
|
-
id:
|
1301
|
+
id: import_zod14.z.string().describe("Id of summary field"),
|
1246
1302
|
value: TranslationConfig.describe(
|
1247
1303
|
"Summary field value. Can utilise values defined in configuration and EventMetadata"
|
1248
1304
|
),
|
1249
1305
|
label: TranslationConfig
|
1250
1306
|
}).describe("Custom configured field");
|
1251
|
-
var SummaryConfig =
|
1252
|
-
fields:
|
1307
|
+
var SummaryConfig = import_zod14.z.object({
|
1308
|
+
fields: import_zod14.z.array(import_zod14.z.union([Field, ReferenceField])).describe("Fields rendered in summary view.")
|
1253
1309
|
}).describe("Configuration for summary in event.");
|
1254
1310
|
|
1255
1311
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
1256
|
-
var
|
1257
|
-
var MatchType =
|
1258
|
-
var BaseField3 =
|
1259
|
-
config:
|
1312
|
+
var import_zod15 = require("zod");
|
1313
|
+
var MatchType = import_zod15.z.enum(["fuzzy", "exact", "range"]);
|
1314
|
+
var BaseField3 = import_zod15.z.object({
|
1315
|
+
config: import_zod15.z.object({
|
1260
1316
|
type: MatchType.describe("Determines the type of field")
|
1261
1317
|
}),
|
1262
|
-
options:
|
1318
|
+
options: import_zod15.z.array(SelectOption).optional(),
|
1263
1319
|
searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
|
1264
1320
|
`
|
1265
1321
|
This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
|
@@ -1280,7 +1336,7 @@ var BaseField3 = import_zod14.z.object({
|
|
1280
1336
|
in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
|
1281
1337
|
`
|
1282
1338
|
),
|
1283
|
-
conditionals:
|
1339
|
+
conditionals: import_zod15.z.array(FieldConditional).default([]).optional().describe(
|
1284
1340
|
`
|
1285
1341
|
In advanced search, we sometimes need to override the default field visibility conditionals.
|
1286
1342
|
|
@@ -1294,50 +1350,60 @@ var BaseField3 = import_zod14.z.object({
|
|
1294
1350
|
are always rendered in the advanced search form.
|
1295
1351
|
`
|
1296
1352
|
),
|
1297
|
-
validations:
|
1353
|
+
validations: import_zod15.z.array(ValidationConfig).default([]).optional().describe(
|
1298
1354
|
`In advanced search, we sometimes need to override the default field validations.`
|
1299
1355
|
)
|
1300
1356
|
});
|
1301
|
-
var SearchQueryParams =
|
1302
|
-
eventType:
|
1357
|
+
var SearchQueryParams = import_zod15.z.object({
|
1358
|
+
eventType: import_zod15.z.string().optional().describe(
|
1303
1359
|
"Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
|
1304
1360
|
)
|
1305
1361
|
}).catchall(FieldValue);
|
1306
1362
|
var FieldConfigSchema = BaseField3.extend({
|
1307
|
-
fieldId:
|
1308
|
-
fieldType:
|
1363
|
+
fieldId: import_zod15.z.string(),
|
1364
|
+
fieldType: import_zod15.z.literal("field"),
|
1365
|
+
alternateFieldIds: import_zod15.z.array(import_zod15.z.string()).optional().describe(
|
1366
|
+
`Sometimes there might be need to search a value against multiple field of same FormField type. For example
|
1367
|
+
search Country, Province, District against child.address.private and child.address.other. In such case, we
|
1368
|
+
add a one field as fieldId, and accomodate others in alternateFieldIds`
|
1369
|
+
),
|
1370
|
+
excludeInSearchQuery: import_zod15.z.boolean().default(false).optional().describe(`Sometimes there will be search fields which are used to
|
1371
|
+
conditionally display another search field, but its not needed in search query. For example, child.placeOfBirth
|
1372
|
+
is select field, which has 3 options, FACILITY, PRIVATE_HOME, OTHER. Upon selecting any of the option, pops up another field
|
1373
|
+
related to the selected option, whose value is required in the search query. But child.placeOfBirth itself is not needed in the query.
|
1374
|
+
In such case, populate this field (excludeInSearchQuery) with boolean true`)
|
1309
1375
|
});
|
1310
|
-
var EventFieldId =
|
1376
|
+
var EventFieldId = import_zod15.z.enum([
|
1311
1377
|
"trackingId",
|
1312
1378
|
"status",
|
1313
|
-
"
|
1314
|
-
"
|
1379
|
+
"legalStatuses.REGISTERED.acceptedAt",
|
1380
|
+
"legalStatuses.REGISTERED.createdAtLocation",
|
1315
1381
|
"updatedAt"
|
1316
1382
|
]);
|
1317
1383
|
var EventFieldConfigSchema = BaseField3.extend({
|
1318
1384
|
fieldId: EventFieldId,
|
1319
|
-
fieldType:
|
1385
|
+
fieldType: import_zod15.z.literal("event")
|
1320
1386
|
});
|
1321
|
-
var SearchField =
|
1387
|
+
var SearchField = import_zod15.z.discriminatedUnion("fieldType", [
|
1322
1388
|
FieldConfigSchema,
|
1323
1389
|
EventFieldConfigSchema
|
1324
1390
|
]);
|
1325
|
-
var AdvancedSearchConfig =
|
1391
|
+
var AdvancedSearchConfig = import_zod15.z.object({
|
1326
1392
|
title: TranslationConfig.describe("Advanced search tab title"),
|
1327
|
-
fields:
|
1393
|
+
fields: import_zod15.z.array(SearchField).describe("Advanced search fields.")
|
1328
1394
|
});
|
1329
1395
|
|
1330
1396
|
// ../commons/src/events/utils.ts
|
1331
1397
|
var import_lodash = require("lodash");
|
1332
1398
|
|
1333
1399
|
// ../commons/src/events/ActionDocument.ts
|
1334
|
-
var
|
1335
|
-
var
|
1400
|
+
var import_zod19 = require("zod");
|
1401
|
+
var import_zod_openapi8 = require("zod-openapi");
|
1336
1402
|
|
1337
1403
|
// ../commons/src/uuid.ts
|
1338
1404
|
var import_uuid = require("uuid");
|
1339
|
-
var
|
1340
|
-
var UUID =
|
1405
|
+
var import_zod16 = require("zod");
|
1406
|
+
var UUID = import_zod16.z.string().uuid().brand("UUID");
|
1341
1407
|
function getUUID() {
|
1342
1408
|
return (0, import_uuid.v4)();
|
1343
1409
|
}
|
@@ -1347,10 +1413,10 @@ var CreatedAtLocation = UUID.nullish();
|
|
1347
1413
|
|
1348
1414
|
// ../commons/src/authentication.ts
|
1349
1415
|
var import_jwt_decode = __toESM(require("jwt-decode"));
|
1350
|
-
var
|
1416
|
+
var import_zod18 = require("zod");
|
1351
1417
|
|
1352
1418
|
// ../commons/src/scopes.ts
|
1353
|
-
var
|
1419
|
+
var import_zod17 = require("zod");
|
1354
1420
|
var SCOPES = {
|
1355
1421
|
// TODO v1.8 legacy scopes
|
1356
1422
|
NATLSYSADMIN: "natlsysadmin",
|
@@ -1463,108 +1529,108 @@ var SCOPES = {
|
|
1463
1529
|
// data seeding
|
1464
1530
|
USER_DATA_SEEDING: "user.data-seeding"
|
1465
1531
|
};
|
1466
|
-
var LegacyScopes =
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1475
|
-
|
1476
|
-
|
1477
|
-
|
1532
|
+
var LegacyScopes = import_zod17.z.union([
|
1533
|
+
import_zod17.z.literal(SCOPES.NATLSYSADMIN),
|
1534
|
+
import_zod17.z.literal(SCOPES.BYPASSRATELIMIT),
|
1535
|
+
import_zod17.z.literal(SCOPES.DECLARE),
|
1536
|
+
import_zod17.z.literal(SCOPES.REGISTER),
|
1537
|
+
import_zod17.z.literal(SCOPES.VALIDATE),
|
1538
|
+
import_zod17.z.literal(SCOPES.DEMO),
|
1539
|
+
import_zod17.z.literal(SCOPES.CERTIFY),
|
1540
|
+
import_zod17.z.literal(SCOPES.PERFORMANCE),
|
1541
|
+
import_zod17.z.literal(SCOPES.SYSADMIN),
|
1542
|
+
import_zod17.z.literal(SCOPES.TEAMS),
|
1543
|
+
import_zod17.z.literal(SCOPES.CONFIG)
|
1478
1544
|
]);
|
1479
|
-
var IntegrationScopes =
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1545
|
+
var IntegrationScopes = import_zod17.z.union([
|
1546
|
+
import_zod17.z.literal(SCOPES.WEBHOOK),
|
1547
|
+
import_zod17.z.literal(SCOPES.NATIONALID),
|
1548
|
+
import_zod17.z.literal(SCOPES.NOTIFICATION_API),
|
1549
|
+
import_zod17.z.literal(SCOPES.RECORDSEARCH)
|
1484
1550
|
]);
|
1485
|
-
var DeclareScopes =
|
1486
|
-
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1495
|
-
|
1551
|
+
var DeclareScopes = import_zod17.z.union([
|
1552
|
+
import_zod17.z.literal(SCOPES.RECORD_DECLARE),
|
1553
|
+
import_zod17.z.literal(SCOPES.RECORD_IMPORT),
|
1554
|
+
import_zod17.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
|
1555
|
+
import_zod17.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
|
1556
|
+
import_zod17.z.literal(SCOPES.RECORD_DECLARE_DEATH),
|
1557
|
+
import_zod17.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
|
1558
|
+
import_zod17.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
|
1559
|
+
import_zod17.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
|
1560
|
+
import_zod17.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
|
1561
|
+
import_zod17.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW)
|
1496
1562
|
]);
|
1497
|
-
var UnassignScope =
|
1498
|
-
var ValidateScopes =
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1563
|
+
var UnassignScope = import_zod17.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS);
|
1564
|
+
var ValidateScopes = import_zod17.z.union([
|
1565
|
+
import_zod17.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
|
1566
|
+
import_zod17.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
|
1567
|
+
import_zod17.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
|
1568
|
+
import_zod17.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
|
1569
|
+
import_zod17.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
|
1570
|
+
import_zod17.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE)
|
1505
1571
|
]);
|
1506
|
-
var RegisterScope =
|
1507
|
-
var CertifyScopes =
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1514
|
-
|
1515
|
-
|
1572
|
+
var RegisterScope = import_zod17.z.literal(SCOPES.RECORD_REGISTER);
|
1573
|
+
var CertifyScopes = import_zod17.z.union([
|
1574
|
+
import_zod17.z.literal(SCOPES.RECORD_EXPORT_RECORDS),
|
1575
|
+
import_zod17.z.literal(SCOPES.RECORD_DECLARATION_PRINT),
|
1576
|
+
import_zod17.z.literal(SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS),
|
1577
|
+
import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_PRINT),
|
1578
|
+
import_zod17.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
|
1579
|
+
import_zod17.z.literal(SCOPES.RECORD_PRINT_CERTIFIED_COPIES),
|
1580
|
+
import_zod17.z.literal(SCOPES.RECORD_BULK_PRINT_CERTIFIED_COPIES),
|
1581
|
+
import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES)
|
1516
1582
|
]);
|
1517
|
-
var CorrectionScopes =
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1583
|
+
var CorrectionScopes = import_zod17.z.union([
|
1584
|
+
import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
|
1585
|
+
import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
|
1586
|
+
import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REVOCATION),
|
1587
|
+
import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_REVOKE),
|
1588
|
+
import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REINSTATEMENT),
|
1589
|
+
import_zod17.z.literal(SCOPES.RECORD_REGISTRATION_REINSTATE),
|
1590
|
+
import_zod17.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
|
1591
|
+
import_zod17.z.literal(SCOPES.RECORD_REJECT_REGISTRATION)
|
1526
1592
|
]);
|
1527
|
-
var SearchScopes =
|
1528
|
-
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1593
|
+
var SearchScopes = import_zod17.z.union([
|
1594
|
+
import_zod17.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
|
1595
|
+
import_zod17.z.literal(SCOPES.SEARCH_BIRTH),
|
1596
|
+
import_zod17.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
|
1597
|
+
import_zod17.z.literal(SCOPES.SEARCH_DEATH),
|
1598
|
+
import_zod17.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
|
1599
|
+
import_zod17.z.literal(SCOPES.SEARCH_MARRIAGE)
|
1534
1600
|
]);
|
1535
|
-
var AuditScopes =
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1601
|
+
var AuditScopes = import_zod17.z.union([
|
1602
|
+
import_zod17.z.literal(SCOPES.RECORD_READ),
|
1603
|
+
import_zod17.z.literal(SCOPES.RECORD_READ_AUDIT),
|
1604
|
+
import_zod17.z.literal(SCOPES.RECORD_READ_COMMENTS),
|
1605
|
+
import_zod17.z.literal(SCOPES.RECORD_CREATE_COMMENTS)
|
1540
1606
|
]);
|
1541
|
-
var ProfileScopes =
|
1542
|
-
|
1543
|
-
|
1607
|
+
var ProfileScopes = import_zod17.z.union([
|
1608
|
+
import_zod17.z.literal(SCOPES.PROFILE_UPDATE),
|
1609
|
+
import_zod17.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE)
|
1544
1610
|
]);
|
1545
|
-
var PerformanceScopes =
|
1546
|
-
|
1547
|
-
|
1548
|
-
|
1611
|
+
var PerformanceScopes = import_zod17.z.union([
|
1612
|
+
import_zod17.z.literal(SCOPES.PERFORMANCE_READ),
|
1613
|
+
import_zod17.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
|
1614
|
+
import_zod17.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS)
|
1549
1615
|
]);
|
1550
|
-
var OrganisationScopes =
|
1551
|
-
|
1552
|
-
|
1553
|
-
|
1616
|
+
var OrganisationScopes = import_zod17.z.union([
|
1617
|
+
import_zod17.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
|
1618
|
+
import_zod17.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
|
1619
|
+
import_zod17.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION)
|
1554
1620
|
]);
|
1555
|
-
var UserScopes =
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1621
|
+
var UserScopes = import_zod17.z.union([
|
1622
|
+
import_zod17.z.literal(SCOPES.USER_READ),
|
1623
|
+
import_zod17.z.literal(SCOPES.USER_READ_MY_OFFICE),
|
1624
|
+
import_zod17.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
|
1625
|
+
import_zod17.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
|
1626
|
+
import_zod17.z.literal(SCOPES.USER_CREATE),
|
1627
|
+
import_zod17.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
|
1628
|
+
import_zod17.z.literal(SCOPES.USER_UPDATE),
|
1629
|
+
import_zod17.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION)
|
1564
1630
|
]);
|
1565
|
-
var ConfigScope =
|
1566
|
-
var DataSeedingScope =
|
1567
|
-
var LiteralScopes =
|
1631
|
+
var ConfigScope = import_zod17.z.literal(SCOPES.CONFIG_UPDATE_ALL);
|
1632
|
+
var DataSeedingScope = import_zod17.z.literal(SCOPES.USER_DATA_SEEDING);
|
1633
|
+
var LiteralScopes = import_zod17.z.union([
|
1568
1634
|
LegacyScopes,
|
1569
1635
|
IntegrationScopes,
|
1570
1636
|
UnassignScope,
|
@@ -1583,39 +1649,47 @@ var LiteralScopes = import_zod16.z.union([
|
|
1583
1649
|
DataSeedingScope
|
1584
1650
|
]);
|
1585
1651
|
var rawConfigurableScopeRegex = /^([a-zA-Z\.]+)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
|
1586
|
-
var rawConfigurableScope =
|
1587
|
-
var CreateUserScope =
|
1588
|
-
type:
|
1589
|
-
options:
|
1590
|
-
role:
|
1652
|
+
var rawConfigurableScope = import_zod17.z.string().regex(rawConfigurableScopeRegex);
|
1653
|
+
var CreateUserScope = import_zod17.z.object({
|
1654
|
+
type: import_zod17.z.literal("user.create"),
|
1655
|
+
options: import_zod17.z.object({
|
1656
|
+
role: import_zod17.z.array(import_zod17.z.string())
|
1657
|
+
})
|
1658
|
+
});
|
1659
|
+
var EditUserScope = import_zod17.z.object({
|
1660
|
+
type: import_zod17.z.literal("user.edit"),
|
1661
|
+
options: import_zod17.z.object({
|
1662
|
+
role: import_zod17.z.array(import_zod17.z.string())
|
1591
1663
|
})
|
1592
1664
|
});
|
1593
|
-
var
|
1594
|
-
type:
|
1595
|
-
options:
|
1596
|
-
|
1665
|
+
var WorkqueueScope = import_zod17.z.object({
|
1666
|
+
type: import_zod17.z.literal("workqueue"),
|
1667
|
+
options: import_zod17.z.object({
|
1668
|
+
id: import_zod17.z.array(import_zod17.z.string())
|
1597
1669
|
})
|
1598
1670
|
});
|
1599
|
-
var
|
1600
|
-
type:
|
1601
|
-
options:
|
1602
|
-
|
1671
|
+
var NotifyRecordScope = import_zod17.z.object({
|
1672
|
+
type: import_zod17.z.literal("record.notify"),
|
1673
|
+
options: import_zod17.z.object({
|
1674
|
+
event: import_zod17.z.array(import_zod17.z.string())
|
1603
1675
|
})
|
1604
1676
|
});
|
1605
|
-
var
|
1606
|
-
type:
|
1607
|
-
options:
|
1608
|
-
event:
|
1677
|
+
var SearchScope = import_zod17.z.object({
|
1678
|
+
type: import_zod17.z.literal("search"),
|
1679
|
+
options: import_zod17.z.object({
|
1680
|
+
event: import_zod17.z.array(import_zod17.z.string()).length(1),
|
1681
|
+
access: import_zod17.z.array(import_zod17.z.enum(["my-jurisdiction", "all"])).length(1)
|
1609
1682
|
})
|
1610
1683
|
});
|
1611
|
-
var
|
1684
|
+
var ConfigurableRawScopes = import_zod17.z.discriminatedUnion("type", [
|
1685
|
+
SearchScope,
|
1612
1686
|
CreateUserScope,
|
1613
1687
|
EditUserScope,
|
1614
1688
|
WorkqueueScope,
|
1615
1689
|
NotifyRecordScope
|
1616
1690
|
]);
|
1617
1691
|
var scopes = Object.values(SCOPES);
|
1618
|
-
var ActionScopes =
|
1692
|
+
var ActionScopes = import_zod17.z.union([
|
1619
1693
|
DeclareScopes,
|
1620
1694
|
ValidateScopes,
|
1621
1695
|
RegisterScope,
|
@@ -1766,30 +1840,30 @@ var DEFAULT_ROLES_DEFINITION = [
|
|
1766
1840
|
]
|
1767
1841
|
}
|
1768
1842
|
];
|
1769
|
-
var TokenUserType =
|
1770
|
-
var TokenWithBearer =
|
1843
|
+
var TokenUserType = import_zod18.z.enum(["user", "system"]);
|
1844
|
+
var TokenWithBearer = import_zod18.z.string().regex(/^Bearer\s/);
|
1771
1845
|
|
1772
1846
|
// ../commons/src/events/ActionDocument.ts
|
1773
|
-
(0,
|
1774
|
-
var ActionUpdate =
|
1775
|
-
var EventState =
|
1847
|
+
(0, import_zod_openapi8.extendZodWithOpenApi)(import_zod19.z);
|
1848
|
+
var ActionUpdate = import_zod19.z.record(import_zod19.z.string(), FieldUpdateValue);
|
1849
|
+
var EventState = import_zod19.z.record(import_zod19.z.string(), FieldValue);
|
1776
1850
|
var ActionStatus = {
|
1777
1851
|
Requested: "Requested",
|
1778
1852
|
Accepted: "Accepted",
|
1779
1853
|
Rejected: "Rejected"
|
1780
1854
|
};
|
1781
|
-
var ActionBase =
|
1855
|
+
var ActionBase = import_zod19.z.object({
|
1782
1856
|
id: UUID,
|
1783
|
-
transactionId:
|
1857
|
+
transactionId: import_zod19.z.string(),
|
1784
1858
|
createdByUserType: TokenUserType,
|
1785
|
-
createdAt:
|
1786
|
-
createdBy:
|
1787
|
-
createdByRole:
|
1788
|
-
createdBySignature:
|
1859
|
+
createdAt: import_zod19.z.string().datetime(),
|
1860
|
+
createdBy: import_zod19.z.string(),
|
1861
|
+
createdByRole: import_zod19.z.string(),
|
1862
|
+
createdBySignature: import_zod19.z.string().nullish().describe("Reference to signature of the user who created the action"),
|
1789
1863
|
createdAtLocation: CreatedAtLocation,
|
1790
1864
|
declaration: ActionUpdate,
|
1791
1865
|
annotation: ActionUpdate.optional().nullable(),
|
1792
|
-
status:
|
1866
|
+
status: import_zod19.z.enum([
|
1793
1867
|
ActionStatus.Requested,
|
1794
1868
|
ActionStatus.Accepted,
|
1795
1869
|
ActionStatus.Rejected
|
@@ -1800,91 +1874,91 @@ var ActionBase = import_zod18.z.object({
|
|
1800
1874
|
)
|
1801
1875
|
});
|
1802
1876
|
var AssignedAction = ActionBase.merge(
|
1803
|
-
|
1804
|
-
type:
|
1805
|
-
assignedTo:
|
1877
|
+
import_zod19.z.object({
|
1878
|
+
type: import_zod19.z.literal(ActionType.ASSIGN),
|
1879
|
+
assignedTo: import_zod19.z.string()
|
1806
1880
|
})
|
1807
1881
|
);
|
1808
1882
|
var UnassignedAction = ActionBase.merge(
|
1809
|
-
|
1810
|
-
type:
|
1883
|
+
import_zod19.z.object({
|
1884
|
+
type: import_zod19.z.literal(ActionType.UNASSIGN)
|
1811
1885
|
})
|
1812
1886
|
);
|
1813
1887
|
var RegisterAction = ActionBase.merge(
|
1814
|
-
|
1815
|
-
type:
|
1816
|
-
registrationNumber:
|
1888
|
+
import_zod19.z.object({
|
1889
|
+
type: import_zod19.z.literal(ActionType.REGISTER),
|
1890
|
+
registrationNumber: import_zod19.z.string().optional()
|
1817
1891
|
})
|
1818
1892
|
);
|
1819
1893
|
var DeclareAction = ActionBase.merge(
|
1820
|
-
|
1821
|
-
type:
|
1894
|
+
import_zod19.z.object({
|
1895
|
+
type: import_zod19.z.literal(ActionType.DECLARE)
|
1822
1896
|
})
|
1823
1897
|
);
|
1824
1898
|
var ValidateAction = ActionBase.merge(
|
1825
|
-
|
1826
|
-
type:
|
1899
|
+
import_zod19.z.object({
|
1900
|
+
type: import_zod19.z.literal(ActionType.VALIDATE)
|
1827
1901
|
})
|
1828
1902
|
);
|
1829
|
-
var RejectionReason =
|
1830
|
-
message:
|
1831
|
-
isDuplicate:
|
1903
|
+
var RejectionReason = import_zod19.z.object({
|
1904
|
+
message: import_zod19.z.string().min(1, { message: "Message cannot be empty" }).describe("Message describing reason for rejection or archiving"),
|
1905
|
+
isDuplicate: import_zod19.z.boolean().optional().describe("If a declaration is duplicated")
|
1832
1906
|
});
|
1833
1907
|
var RejectAction = ActionBase.merge(
|
1834
|
-
|
1835
|
-
type:
|
1908
|
+
import_zod19.z.object({
|
1909
|
+
type: import_zod19.z.literal(ActionType.REJECT),
|
1836
1910
|
reason: RejectionReason
|
1837
1911
|
})
|
1838
1912
|
);
|
1839
1913
|
var MarkAsDuplicateAction = ActionBase.merge(
|
1840
|
-
|
1841
|
-
type:
|
1914
|
+
import_zod19.z.object({
|
1915
|
+
type: import_zod19.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1842
1916
|
})
|
1843
1917
|
);
|
1844
1918
|
var ArchiveAction = ActionBase.merge(
|
1845
|
-
|
1846
|
-
type:
|
1919
|
+
import_zod19.z.object({
|
1920
|
+
type: import_zod19.z.literal(ActionType.ARCHIVE),
|
1847
1921
|
reason: RejectionReason
|
1848
1922
|
})
|
1849
1923
|
);
|
1850
1924
|
var CreatedAction = ActionBase.merge(
|
1851
|
-
|
1852
|
-
type:
|
1925
|
+
import_zod19.z.object({
|
1926
|
+
type: import_zod19.z.literal(ActionType.CREATE)
|
1853
1927
|
})
|
1854
1928
|
);
|
1855
1929
|
var NotifiedAction = ActionBase.merge(
|
1856
|
-
|
1857
|
-
type:
|
1930
|
+
import_zod19.z.object({
|
1931
|
+
type: import_zod19.z.literal(ActionType.NOTIFY)
|
1858
1932
|
})
|
1859
1933
|
);
|
1860
1934
|
var PrintCertificateAction = ActionBase.merge(
|
1861
|
-
|
1862
|
-
type:
|
1935
|
+
import_zod19.z.object({
|
1936
|
+
type: import_zod19.z.literal(ActionType.PRINT_CERTIFICATE)
|
1863
1937
|
})
|
1864
1938
|
);
|
1865
1939
|
var RequestedCorrectionAction = ActionBase.merge(
|
1866
|
-
|
1867
|
-
type:
|
1940
|
+
import_zod19.z.object({
|
1941
|
+
type: import_zod19.z.literal(ActionType.REQUEST_CORRECTION)
|
1868
1942
|
})
|
1869
1943
|
);
|
1870
1944
|
var ApprovedCorrectionAction = ActionBase.merge(
|
1871
|
-
|
1872
|
-
type:
|
1873
|
-
requestId:
|
1945
|
+
import_zod19.z.object({
|
1946
|
+
type: import_zod19.z.literal(ActionType.APPROVE_CORRECTION),
|
1947
|
+
requestId: import_zod19.z.string()
|
1874
1948
|
})
|
1875
1949
|
);
|
1876
1950
|
var RejectedCorrectionAction = ActionBase.merge(
|
1877
|
-
|
1878
|
-
type:
|
1879
|
-
requestId:
|
1951
|
+
import_zod19.z.object({
|
1952
|
+
type: import_zod19.z.literal(ActionType.REJECT_CORRECTION),
|
1953
|
+
requestId: import_zod19.z.string()
|
1880
1954
|
})
|
1881
1955
|
);
|
1882
1956
|
var ReadAction = ActionBase.merge(
|
1883
|
-
|
1884
|
-
type:
|
1957
|
+
import_zod19.z.object({
|
1958
|
+
type: import_zod19.z.literal(ActionType.READ)
|
1885
1959
|
})
|
1886
1960
|
);
|
1887
|
-
var ActionDocument =
|
1961
|
+
var ActionDocument = import_zod19.z.discriminatedUnion("type", [
|
1888
1962
|
CreatedAction.openapi({ ref: "CreatedAction" }),
|
1889
1963
|
ValidateAction.openapi({ ref: "ValidateAction" }),
|
1890
1964
|
RejectAction.openapi({ ref: "RejectAction" }),
|
@@ -1907,20 +1981,20 @@ var AsyncRejectActionDocument = ActionBase.omit({
|
|
1907
1981
|
declaration: true,
|
1908
1982
|
annotation: true
|
1909
1983
|
}).merge(
|
1910
|
-
|
1911
|
-
type:
|
1912
|
-
status:
|
1984
|
+
import_zod19.z.object({
|
1985
|
+
type: import_zod19.z.enum(ConfirmableActions),
|
1986
|
+
status: import_zod19.z.literal(ActionStatus.Rejected)
|
1913
1987
|
})
|
1914
1988
|
);
|
1915
|
-
var Action =
|
1916
|
-
var ResolvedUser =
|
1917
|
-
id:
|
1918
|
-
role:
|
1919
|
-
name:
|
1920
|
-
|
1921
|
-
use:
|
1922
|
-
given:
|
1923
|
-
family:
|
1989
|
+
var Action = import_zod19.z.union([ActionDocument, AsyncRejectActionDocument]);
|
1990
|
+
var ResolvedUser = import_zod19.z.object({
|
1991
|
+
id: import_zod19.z.string(),
|
1992
|
+
role: import_zod19.z.string(),
|
1993
|
+
name: import_zod19.z.array(
|
1994
|
+
import_zod19.z.object({
|
1995
|
+
use: import_zod19.z.string(),
|
1996
|
+
given: import_zod19.z.array(import_zod19.z.string()),
|
1997
|
+
family: import_zod19.z.string()
|
1924
1998
|
})
|
1925
1999
|
)
|
1926
2000
|
});
|
@@ -1931,7 +2005,7 @@ var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
1931
2005
|
var import_date_fns = require("date-fns");
|
1932
2006
|
|
1933
2007
|
// ../commons/src/events/FieldTypeMapping.ts
|
1934
|
-
var
|
2008
|
+
var import_zod20 = require("zod");
|
1935
2009
|
function mapFieldTypeToZod(type, required) {
|
1936
2010
|
let schema;
|
1937
2011
|
switch (type) {
|
@@ -1944,6 +2018,9 @@ function mapFieldTypeToZod(type, required) {
|
|
1944
2018
|
case FieldType.DATE_RANGE:
|
1945
2019
|
schema = DateRangeFieldValue;
|
1946
2020
|
break;
|
2021
|
+
case FieldType.SELECT_DATE_RANGE:
|
2022
|
+
schema = SelectDateRangeValue;
|
2023
|
+
break;
|
1947
2024
|
case FieldType.TEXT:
|
1948
2025
|
case FieldType.TEXTAREA:
|
1949
2026
|
case FieldType.DIVIDER:
|
@@ -1991,7 +2068,7 @@ function createValidationSchema(config) {
|
|
1991
2068
|
for (const field2 of config) {
|
1992
2069
|
shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
|
1993
2070
|
}
|
1994
|
-
return
|
2071
|
+
return import_zod20.z.object(shape);
|
1995
2072
|
}
|
1996
2073
|
function mapFieldTypeToEmptyValue(field2) {
|
1997
2074
|
switch (field2.type) {
|
@@ -2013,6 +2090,7 @@ function mapFieldTypeToEmptyValue(field2) {
|
|
2013
2090
|
case FieldType.DATE:
|
2014
2091
|
case FieldType.CHECKBOX:
|
2015
2092
|
case FieldType.DATE_RANGE:
|
2093
|
+
case FieldType.SELECT_DATE_RANGE:
|
2016
2094
|
case FieldType.DATA:
|
2017
2095
|
case FieldType.NAME:
|
2018
2096
|
case FieldType.PHONE:
|
@@ -2035,7 +2113,7 @@ function mapFieldTypeToEmptyValue(field2) {
|
|
2035
2113
|
case FieldType.SIGNATURE:
|
2036
2114
|
case FieldType.FILE:
|
2037
2115
|
return {
|
2038
|
-
|
2116
|
+
path: "",
|
2039
2117
|
originalFilename: "",
|
2040
2118
|
type: ""
|
2041
2119
|
};
|
@@ -2052,6 +2130,9 @@ var isDateFieldType = (field2) => {
|
|
2052
2130
|
var isDateRangeFieldType = (field2) => {
|
2053
2131
|
return field2.config.type === FieldType.DATE_RANGE;
|
2054
2132
|
};
|
2133
|
+
var isSelectDateRangeFieldType = (field2) => {
|
2134
|
+
return field2.config.type === FieldType.SELECT_DATE_RANGE;
|
2135
|
+
};
|
2055
2136
|
var isPageHeaderFieldType = (field2) => {
|
2056
2137
|
return field2.config.type === FieldType.PAGE_HEADER;
|
2057
2138
|
};
|
@@ -2379,6 +2460,7 @@ function joinValues(values, separator = " ") {
|
|
2379
2460
|
}
|
2380
2461
|
|
2381
2462
|
// ../commons/src/events/utils.ts
|
2463
|
+
var import_date_fns2 = require("date-fns");
|
2382
2464
|
function isDeclarationActionConfig(action) {
|
2383
2465
|
return DeclarationActions.safeParse(action.type).success;
|
2384
2466
|
}
|
@@ -2391,6 +2473,15 @@ function getDeclarationPages(configuration) {
|
|
2391
2473
|
function getDeclaration(configuration) {
|
2392
2474
|
return configuration.declaration;
|
2393
2475
|
}
|
2476
|
+
function getPrintCertificatePages(configuration) {
|
2477
|
+
const action = configuration.actions.find(
|
2478
|
+
(a) => a.type === ActionType.PRINT_CERTIFICATE
|
2479
|
+
);
|
2480
|
+
return getOrThrow(
|
2481
|
+
action?.printForm.pages,
|
2482
|
+
`${ActionType.PRINT_CERTIFICATE} action does not have print form set.`
|
2483
|
+
);
|
2484
|
+
}
|
2394
2485
|
var getActionAnnotationFields = (actionConfig) => {
|
2395
2486
|
if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
|
2396
2487
|
return [
|
@@ -2578,12 +2669,33 @@ function getEventConfigById(eventConfigs, id) {
|
|
2578
2669
|
);
|
2579
2670
|
return getOrThrow(eventConfig, `Event config for ${id} not found`);
|
2580
2671
|
}
|
2672
|
+
function timePeriodToDateRange(value) {
|
2673
|
+
let startDate;
|
2674
|
+
switch (value) {
|
2675
|
+
case "last7Days":
|
2676
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 6);
|
2677
|
+
break;
|
2678
|
+
case "last30Days":
|
2679
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 29);
|
2680
|
+
break;
|
2681
|
+
case "last90Days":
|
2682
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 89);
|
2683
|
+
break;
|
2684
|
+
case "last365Days":
|
2685
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 364);
|
2686
|
+
break;
|
2687
|
+
}
|
2688
|
+
return {
|
2689
|
+
startDate: startDate.toISOString(),
|
2690
|
+
endDate: (/* @__PURE__ */ new Date()).toISOString()
|
2691
|
+
};
|
2692
|
+
}
|
2581
2693
|
|
2582
2694
|
// ../commons/src/events/EventConfig.ts
|
2583
|
-
var
|
2584
|
-
(0,
|
2585
|
-
var EventConfig =
|
2586
|
-
id:
|
2695
|
+
var import_zod_openapi9 = require("zod-openapi");
|
2696
|
+
(0, import_zod_openapi9.extendZodWithOpenApi)(import_zod21.z);
|
2697
|
+
var EventConfig = import_zod21.z.object({
|
2698
|
+
id: import_zod21.z.string().describe(
|
2587
2699
|
'A machine-readable identifier for the event, e.g. "birth" or "death"'
|
2588
2700
|
),
|
2589
2701
|
dateOfEvent: FieldReference.optional(),
|
@@ -2593,10 +2705,10 @@ var EventConfig = import_zod20.z.object({
|
|
2593
2705
|
),
|
2594
2706
|
summary: SummaryConfig,
|
2595
2707
|
label: TranslationConfig,
|
2596
|
-
actions:
|
2708
|
+
actions: import_zod21.z.array(ActionConfig),
|
2597
2709
|
declaration: DeclarationFormConfig,
|
2598
|
-
deduplication:
|
2599
|
-
advancedSearch:
|
2710
|
+
deduplication: import_zod21.z.array(DeduplicationConfig).optional().default([]),
|
2711
|
+
advancedSearch: import_zod21.z.array(AdvancedSearchConfig).optional().default([])
|
2600
2712
|
}).superRefine((event2, ctx) => {
|
2601
2713
|
const allFields = findAllFields(event2);
|
2602
2714
|
const fieldIds = allFields.map((field2) => field2.id);
|
@@ -2628,6 +2740,28 @@ var EventConfig = import_zod20.z.object({
|
|
2628
2740
|
path: ["advancedSearch"]
|
2629
2741
|
});
|
2630
2742
|
}
|
2743
|
+
event2.advancedSearch.forEach((section, sectionIndex) => {
|
2744
|
+
section.fields.forEach((field2, fieldIndex) => {
|
2745
|
+
if ("alternateFieldIds" in field2 && Array.isArray(field2.alternateFieldIds)) {
|
2746
|
+
const invalidAltIds = field2.alternateFieldIds.filter(
|
2747
|
+
(id) => !fieldIds.includes(id)
|
2748
|
+
);
|
2749
|
+
if (invalidAltIds.length > 0) {
|
2750
|
+
ctx.addIssue({
|
2751
|
+
code: "custom",
|
2752
|
+
message: `Invalid alternateFieldIds: ${invalidAltIds.join(", ")}`,
|
2753
|
+
path: [
|
2754
|
+
"advancedSearch",
|
2755
|
+
sectionIndex,
|
2756
|
+
"fields",
|
2757
|
+
fieldIndex,
|
2758
|
+
"alternateFieldIds"
|
2759
|
+
]
|
2760
|
+
});
|
2761
|
+
}
|
2762
|
+
}
|
2763
|
+
});
|
2764
|
+
});
|
2631
2765
|
if (event2.dateOfEvent) {
|
2632
2766
|
const eventDateFieldId = getDeclarationFields(event2).find(
|
2633
2767
|
({ id }) => id === event2.dateOfEvent?.$$field
|
@@ -2658,16 +2792,17 @@ var definePage = (page) => PageConfig.parse(page);
|
|
2658
2792
|
var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
|
2659
2793
|
|
2660
2794
|
// ../commons/src/events/WorkqueueConfig.ts
|
2661
|
-
var
|
2795
|
+
var import_zod28 = require("zod");
|
2662
2796
|
|
2663
2797
|
// ../commons/src/events/serializers/user/serializer.ts
|
2664
|
-
var
|
2665
|
-
var SerializedUserField =
|
2666
|
-
$userField:
|
2798
|
+
var import_zod22 = require("zod");
|
2799
|
+
var SerializedUserField = import_zod22.z.object({
|
2800
|
+
$userField: import_zod22.z.enum([
|
2667
2801
|
"id",
|
2668
2802
|
"name",
|
2669
2803
|
"role",
|
2670
|
-
"
|
2804
|
+
"signature",
|
2805
|
+
"avatar",
|
2671
2806
|
"primaryOfficeId"
|
2672
2807
|
])
|
2673
2808
|
});
|
@@ -2739,38 +2874,6 @@ var user = Object.assign(userSerializer, {
|
|
2739
2874
|
required: ["$user"]
|
2740
2875
|
})
|
2741
2876
|
});
|
2742
|
-
function createEventConditionals() {
|
2743
|
-
return {
|
2744
|
-
/**
|
2745
|
-
* Checks if the event contains a specific action type.
|
2746
|
-
* @param action - The action type to check for.
|
2747
|
-
*/
|
2748
|
-
hasAction: (action) => defineConditional({
|
2749
|
-
type: "object",
|
2750
|
-
properties: {
|
2751
|
-
$event: {
|
2752
|
-
type: "object",
|
2753
|
-
properties: {
|
2754
|
-
actions: {
|
2755
|
-
type: "array",
|
2756
|
-
contains: {
|
2757
|
-
type: "object",
|
2758
|
-
properties: {
|
2759
|
-
type: {
|
2760
|
-
const: action
|
2761
|
-
}
|
2762
|
-
},
|
2763
|
-
required: ["type"]
|
2764
|
-
}
|
2765
|
-
}
|
2766
|
-
},
|
2767
|
-
required: ["actions"]
|
2768
|
-
}
|
2769
|
-
},
|
2770
|
-
required: ["$event"]
|
2771
|
-
})
|
2772
|
-
};
|
2773
|
-
}
|
2774
2877
|
function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
|
2775
2878
|
return {
|
2776
2879
|
type: "object",
|
@@ -3006,7 +3109,7 @@ function createSearchConfig(baseField) {
|
|
3006
3109
|
*
|
3007
3110
|
* @returns An object containing the field ID and a configuration object with a type of 'range'.
|
3008
3111
|
*
|
3009
|
-
* @example event('
|
3112
|
+
* @example event('legalStatuses.REGISTERED.acceptedAt').range()
|
3010
3113
|
* // {
|
3011
3114
|
* // ...
|
3012
3115
|
* // config: { type: 'range' }
|
@@ -3046,21 +3149,47 @@ function createSearchConfig(baseField) {
|
|
3046
3149
|
}
|
3047
3150
|
|
3048
3151
|
// ../commons/src/event-config/event-configuration.ts
|
3049
|
-
function createEventFieldConfig(fieldId
|
3152
|
+
function createEventFieldConfig(fieldId) {
|
3050
3153
|
const baseField = {
|
3051
3154
|
fieldId,
|
3052
|
-
options,
|
3053
3155
|
fieldType: "event"
|
3054
3156
|
};
|
3055
3157
|
return createSearchConfig(baseField);
|
3056
3158
|
}
|
3057
3159
|
|
3058
3160
|
// ../commons/src/events/event.ts
|
3059
|
-
function eventFn(fieldId
|
3060
|
-
return createEventFieldConfig(fieldId
|
3161
|
+
function eventFn(fieldId) {
|
3162
|
+
return createEventFieldConfig(fieldId);
|
3061
3163
|
}
|
3062
3164
|
var event = Object.assign(eventFn, {
|
3063
|
-
|
3165
|
+
/**
|
3166
|
+
* Checks if the event contains a specific action type.
|
3167
|
+
* @param action - The action type to check for.
|
3168
|
+
*/
|
3169
|
+
hasAction: (action) => defineConditional({
|
3170
|
+
type: "object",
|
3171
|
+
properties: {
|
3172
|
+
$event: {
|
3173
|
+
type: "object",
|
3174
|
+
properties: {
|
3175
|
+
actions: {
|
3176
|
+
type: "array",
|
3177
|
+
contains: {
|
3178
|
+
type: "object",
|
3179
|
+
properties: {
|
3180
|
+
type: {
|
3181
|
+
const: action
|
3182
|
+
}
|
3183
|
+
},
|
3184
|
+
required: ["type"]
|
3185
|
+
}
|
3186
|
+
}
|
3187
|
+
},
|
3188
|
+
required: ["actions"]
|
3189
|
+
}
|
3190
|
+
},
|
3191
|
+
required: ["$event"]
|
3192
|
+
}),
|
3064
3193
|
field(field2) {
|
3065
3194
|
return {
|
3066
3195
|
$event: field2
|
@@ -3069,11 +3198,11 @@ var event = Object.assign(eventFn, {
|
|
3069
3198
|
});
|
3070
3199
|
|
3071
3200
|
// ../commons/src/events/WorkqueueColumnConfig.ts
|
3072
|
-
var
|
3201
|
+
var import_zod24 = require("zod");
|
3073
3202
|
|
3074
3203
|
// ../commons/src/events/EventMetadata.ts
|
3075
|
-
var
|
3076
|
-
var EventStatus =
|
3204
|
+
var import_zod23 = require("zod");
|
3205
|
+
var EventStatus = import_zod23.z.enum([
|
3077
3206
|
"CREATED",
|
3078
3207
|
"NOTIFIED",
|
3079
3208
|
"DECLARED",
|
@@ -3089,63 +3218,63 @@ var InherentFlags = {
|
|
3089
3218
|
REJECTED: "rejected",
|
3090
3219
|
CORRECTION_REQUESTED: "correction-requested"
|
3091
3220
|
};
|
3092
|
-
var Flag =
|
3221
|
+
var Flag = import_zod23.z.string().regex(
|
3093
3222
|
new RegExp(
|
3094
3223
|
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
3095
3224
|
ActionStatus
|
3096
3225
|
).join("|").toLowerCase()})$`
|
3097
3226
|
),
|
3098
3227
|
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
3099
|
-
).or(
|
3100
|
-
var ZodDate =
|
3101
|
-
var ActionCreationMetadata =
|
3102
|
-
createdAt:
|
3103
|
-
createdBy:
|
3228
|
+
).or(import_zod23.z.nativeEnum(InherentFlags));
|
3229
|
+
var ZodDate = import_zod23.z.string().date();
|
3230
|
+
var ActionCreationMetadata = import_zod23.z.object({
|
3231
|
+
createdAt: import_zod23.z.string().datetime().describe("The timestamp when the action request was created."),
|
3232
|
+
createdBy: import_zod23.z.string().describe("ID of the user who created the action request."),
|
3104
3233
|
createdAtLocation: CreatedAtLocation.describe(
|
3105
3234
|
"Location of the user who created the action request."
|
3106
3235
|
),
|
3107
|
-
createdByUserType:
|
3108
|
-
acceptedAt:
|
3109
|
-
createdByRole:
|
3110
|
-
createdBySignature:
|
3236
|
+
createdByUserType: import_zod23.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
3237
|
+
acceptedAt: import_zod23.z.string().datetime().describe("Timestamp when the action request was accepted."),
|
3238
|
+
createdByRole: import_zod23.z.string().describe("Role of the user at the time of action request creation."),
|
3239
|
+
createdBySignature: import_zod23.z.string().nullish().describe("Signature of the user who created the action request.")
|
3111
3240
|
});
|
3112
3241
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
3113
|
-
registrationNumber:
|
3242
|
+
registrationNumber: import_zod23.z.string().describe(
|
3114
3243
|
"Registration number of the event. Always present for accepted registrations."
|
3115
3244
|
)
|
3116
3245
|
});
|
3117
|
-
var LegalStatuses =
|
3246
|
+
var LegalStatuses = import_zod23.z.object({
|
3118
3247
|
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
3119
3248
|
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
3120
3249
|
});
|
3121
|
-
var EventMetadata =
|
3250
|
+
var EventMetadata = import_zod23.z.object({
|
3122
3251
|
id: UUID,
|
3123
|
-
type:
|
3252
|
+
type: import_zod23.z.string().describe("The type of event, such as birth, death, or marriage."),
|
3124
3253
|
status: EventStatus,
|
3125
3254
|
legalStatuses: LegalStatuses.describe(
|
3126
3255
|
"Metadata related to the legal registration of the event, such as who registered it and when."
|
3127
3256
|
),
|
3128
|
-
createdAt:
|
3257
|
+
createdAt: import_zod23.z.string().datetime().describe("The timestamp when the event was first created and saved."),
|
3129
3258
|
dateOfEvent: ZodDate.nullish(),
|
3130
|
-
createdBy:
|
3131
|
-
createdByUserType:
|
3132
|
-
updatedByUserRole:
|
3259
|
+
createdBy: import_zod23.z.string().describe("ID of the user who created the event."),
|
3260
|
+
createdByUserType: import_zod23.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
3261
|
+
updatedByUserRole: import_zod23.z.string().describe("Role of the user who last changed the status."),
|
3133
3262
|
createdAtLocation: CreatedAtLocation.describe(
|
3134
3263
|
"Location of the user who created the event."
|
3135
3264
|
),
|
3136
|
-
createdBySignature:
|
3265
|
+
createdBySignature: import_zod23.z.string().nullish().describe("Signature of the user who created the event."),
|
3137
3266
|
updatedAtLocation: UUID.nullish().describe(
|
3138
3267
|
"Location of the user who last changed the status."
|
3139
3268
|
),
|
3140
|
-
updatedAt:
|
3269
|
+
updatedAt: import_zod23.z.string().datetime().describe(
|
3141
3270
|
"Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
|
3142
3271
|
),
|
3143
|
-
assignedTo:
|
3144
|
-
updatedBy:
|
3145
|
-
trackingId:
|
3272
|
+
assignedTo: import_zod23.z.string().nullish().describe("ID of the user currently assigned to the event."),
|
3273
|
+
updatedBy: import_zod23.z.string().nullish().describe("ID of the user who last changed the status."),
|
3274
|
+
trackingId: import_zod23.z.string().describe(
|
3146
3275
|
"System-generated tracking ID used by informants or registrars to look up the event."
|
3147
3276
|
),
|
3148
|
-
flags:
|
3277
|
+
flags: import_zod23.z.array(Flag)
|
3149
3278
|
});
|
3150
3279
|
var EventMetadataKeysArray = [
|
3151
3280
|
"id",
|
@@ -3165,7 +3294,7 @@ var EventMetadataKeysArray = [
|
|
3165
3294
|
"legalStatuses",
|
3166
3295
|
"flags"
|
3167
3296
|
];
|
3168
|
-
var EventMetadataKeys =
|
3297
|
+
var EventMetadataKeys = import_zod23.z.enum(EventMetadataKeysArray);
|
3169
3298
|
var eventMetadataLabelMap = {
|
3170
3299
|
"event.assignedTo": {
|
3171
3300
|
id: "event.assignedTo.label",
|
@@ -3250,11 +3379,11 @@ var WorkqueueColumnKeysArray = [
|
|
3250
3379
|
"title",
|
3251
3380
|
"outbox"
|
3252
3381
|
];
|
3253
|
-
var WorkqueueColumnKeys =
|
3254
|
-
var WorkqueueColumnValue =
|
3382
|
+
var WorkqueueColumnKeys = import_zod24.z.enum(WorkqueueColumnKeysArray);
|
3383
|
+
var WorkqueueColumnValue = import_zod24.z.object({
|
3255
3384
|
$event: WorkqueueColumnKeys
|
3256
3385
|
});
|
3257
|
-
var WorkqueueColumn =
|
3386
|
+
var WorkqueueColumn = import_zod24.z.object({
|
3258
3387
|
label: TranslationConfig,
|
3259
3388
|
value: WorkqueueColumnValue
|
3260
3389
|
});
|
@@ -3265,115 +3394,127 @@ function defineWorkqueuesColumns(workqueueColumns) {
|
|
3265
3394
|
}
|
3266
3395
|
|
3267
3396
|
// ../commons/src/events/CountryConfigQueryInput.ts
|
3268
|
-
var
|
3397
|
+
var import_zod26 = require("zod");
|
3269
3398
|
|
3270
3399
|
// ../commons/src/events/EventIndex.ts
|
3271
|
-
var
|
3272
|
-
var
|
3273
|
-
(0,
|
3400
|
+
var import_zod25 = require("zod");
|
3401
|
+
var import_zod_openapi10 = require("zod-openapi");
|
3402
|
+
(0, import_zod_openapi10.extendZodWithOpenApi)(import_zod25.z);
|
3274
3403
|
var EventIndex = EventMetadata.extend({
|
3275
3404
|
declaration: EventState
|
3276
3405
|
}).openapi({
|
3277
3406
|
ref: "EventIndex"
|
3278
3407
|
});
|
3279
|
-
var EventSearchIndex =
|
3280
|
-
|
3281
|
-
type:
|
3408
|
+
var EventSearchIndex = import_zod25.z.record(import_zod25.z.string(), import_zod25.z.any()).and(
|
3409
|
+
import_zod25.z.object({
|
3410
|
+
type: import_zod25.z.string()
|
3282
3411
|
// Ensures "type" (event-id) exists and is a string
|
3283
3412
|
})
|
3284
3413
|
).openapi({
|
3285
3414
|
ref: "EventSearchIndex"
|
3286
3415
|
});
|
3287
|
-
var Fuzzy =
|
3416
|
+
var Fuzzy = import_zod25.z.object({ type: import_zod25.z.literal("fuzzy"), term: import_zod25.z.string() }).openapi({
|
3288
3417
|
ref: "Fuzzy"
|
3289
3418
|
});
|
3290
|
-
var Exact =
|
3419
|
+
var Exact = import_zod25.z.object({ type: import_zod25.z.literal("exact"), term: import_zod25.z.string() }).openapi({
|
3291
3420
|
ref: "Exact"
|
3292
3421
|
});
|
3293
|
-
var ExactStatus =
|
3294
|
-
type:
|
3422
|
+
var ExactStatus = import_zod25.z.object({
|
3423
|
+
type: import_zod25.z.literal("exact"),
|
3295
3424
|
term: EventStatus
|
3296
3425
|
}).openapi({
|
3297
3426
|
ref: "ExactStatus"
|
3298
3427
|
});
|
3299
|
-
var
|
3300
|
-
type:
|
3301
|
-
|
3428
|
+
var ExactUserType = import_zod25.z.object({
|
3429
|
+
type: import_zod25.z.literal("exact"),
|
3430
|
+
term: TokenUserType
|
3431
|
+
}).openapi({
|
3432
|
+
ref: "ExactUserType"
|
3433
|
+
});
|
3434
|
+
var AnyOf = import_zod25.z.object({
|
3435
|
+
type: import_zod25.z.literal("anyOf"),
|
3436
|
+
terms: import_zod25.z.array(import_zod25.z.string())
|
3302
3437
|
}).openapi({
|
3303
3438
|
ref: "AnyOf"
|
3304
3439
|
});
|
3305
|
-
var AnyOfStatus =
|
3306
|
-
type:
|
3307
|
-
terms:
|
3440
|
+
var AnyOfStatus = import_zod25.z.object({
|
3441
|
+
type: import_zod25.z.literal("anyOf"),
|
3442
|
+
terms: import_zod25.z.array(EventStatus)
|
3308
3443
|
}).openapi({
|
3309
3444
|
ref: "AnyOfStatus"
|
3310
3445
|
});
|
3311
|
-
var Range =
|
3312
|
-
type:
|
3313
|
-
gte:
|
3314
|
-
lte:
|
3446
|
+
var Range = import_zod25.z.object({
|
3447
|
+
type: import_zod25.z.literal("range"),
|
3448
|
+
gte: import_zod25.z.string(),
|
3449
|
+
lte: import_zod25.z.string()
|
3315
3450
|
}).openapi({
|
3316
3451
|
ref: "Range"
|
3317
3452
|
});
|
3318
|
-
var ContainsFlags =
|
3319
|
-
anyOf:
|
3320
|
-
noneOf:
|
3453
|
+
var ContainsFlags = import_zod25.z.object({
|
3454
|
+
anyOf: import_zod25.z.array(Flag).optional(),
|
3455
|
+
noneOf: import_zod25.z.array(Flag).optional()
|
3321
3456
|
}).openapi({
|
3322
3457
|
ref: "ContainsFlags"
|
3323
3458
|
});
|
3324
|
-
var Within =
|
3459
|
+
var Within = import_zod25.z.object({ type: import_zod25.z.literal("within"), location: import_zod25.z.string() }).openapi({
|
3325
3460
|
ref: "Within"
|
3326
3461
|
});
|
3327
|
-
var RangeDate =
|
3328
|
-
|
3329
|
-
|
3330
|
-
|
3331
|
-
|
3332
|
-
});
|
3462
|
+
var RangeDate = import_zod25.z.object({
|
3463
|
+
type: import_zod25.z.literal("range"),
|
3464
|
+
gte: import_zod25.z.string().date().or(import_zod25.z.string().datetime()),
|
3465
|
+
lte: import_zod25.z.string().date().or(import_zod25.z.string().datetime())
|
3466
|
+
}).openapi({ ref: "RangeDate" });
|
3333
3467
|
var ExactDate = Exact.extend({
|
3334
|
-
term:
|
3468
|
+
term: import_zod25.z.string().date().or(import_zod25.z.string().datetime())
|
3335
3469
|
}).openapi({
|
3336
3470
|
ref: "ExactDate"
|
3337
3471
|
});
|
3338
|
-
var
|
3472
|
+
var TimePeriod = import_zod25.z.object({
|
3473
|
+
type: import_zod25.z.literal("timePeriod"),
|
3474
|
+
term: SelectDateRangeValue
|
3475
|
+
}).openapi({
|
3476
|
+
ref: "TimePeriod"
|
3477
|
+
});
|
3478
|
+
var DateCondition = import_zod25.z.union([ExactDate, RangeDate, TimePeriod]).openapi({
|
3339
3479
|
ref: "DateCondition"
|
3340
3480
|
});
|
3341
|
-
var QueryInput =
|
3342
|
-
() =>
|
3343
|
-
|
3344
|
-
|
3481
|
+
var QueryInput = import_zod25.z.lazy(
|
3482
|
+
() => import_zod25.z.union([
|
3483
|
+
import_zod25.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf]),
|
3484
|
+
import_zod25.z.record(import_zod25.z.string(), QueryInput)
|
3345
3485
|
])
|
3346
3486
|
).openapi({
|
3347
3487
|
ref: "QueryInput"
|
3348
3488
|
});
|
3349
|
-
var QueryExpression =
|
3350
|
-
id:
|
3351
|
-
eventType:
|
3352
|
-
status:
|
3353
|
-
createdAt:
|
3354
|
-
updatedAt:
|
3355
|
-
"
|
3356
|
-
"
|
3357
|
-
|
3489
|
+
var QueryExpression = import_zod25.z.object({
|
3490
|
+
id: import_zod25.z.optional(import_zod25.z.string()),
|
3491
|
+
eventType: import_zod25.z.string(),
|
3492
|
+
status: import_zod25.z.optional(import_zod25.z.union([AnyOfStatus, ExactStatus])),
|
3493
|
+
createdAt: import_zod25.z.optional(DateCondition),
|
3494
|
+
updatedAt: import_zod25.z.optional(DateCondition),
|
3495
|
+
"legalStatuses.REGISTERED.acceptedAt": import_zod25.z.optional(DateCondition),
|
3496
|
+
"legalStatuses.REGISTERED.createdAtLocation": import_zod25.z.optional(
|
3497
|
+
import_zod25.z.union([Within, Exact])
|
3358
3498
|
),
|
3359
|
-
"
|
3360
|
-
createdAtLocation:
|
3361
|
-
updatedAtLocation:
|
3362
|
-
assignedTo:
|
3363
|
-
createdByUserType:
|
3364
|
-
createdBy:
|
3365
|
-
updatedBy:
|
3366
|
-
trackingId:
|
3367
|
-
flags:
|
3499
|
+
"legalStatuses.REGISTERED.registrationNumber": import_zod25.z.optional(Exact),
|
3500
|
+
createdAtLocation: import_zod25.z.optional(import_zod25.z.union([Within, Exact])),
|
3501
|
+
updatedAtLocation: import_zod25.z.optional(import_zod25.z.union([Within, Exact])),
|
3502
|
+
assignedTo: import_zod25.z.optional(Exact),
|
3503
|
+
createdByUserType: import_zod25.z.optional(ExactUserType),
|
3504
|
+
createdBy: import_zod25.z.optional(Exact),
|
3505
|
+
updatedBy: import_zod25.z.optional(Exact),
|
3506
|
+
trackingId: import_zod25.z.optional(Exact),
|
3507
|
+
flags: import_zod25.z.optional(ContainsFlags),
|
3508
|
+
// @todo: The type for this comes out as "any"
|
3368
3509
|
data: QueryInput
|
3369
3510
|
}).partial().refine((obj) => Object.values(obj).some((val) => val !== void 0), {
|
3370
3511
|
message: "At least one query field must be specified."
|
3371
3512
|
}).openapi({
|
3372
3513
|
ref: "QueryExpression"
|
3373
3514
|
});
|
3374
|
-
var QueryType =
|
3375
|
-
type:
|
3376
|
-
clauses:
|
3515
|
+
var QueryType = import_zod25.z.object({
|
3516
|
+
type: import_zod25.z.literal("and").or(import_zod25.z.literal("or")).openapi({ default: "and" }),
|
3517
|
+
clauses: import_zod25.z.preprocess(
|
3377
3518
|
(val) => {
|
3378
3519
|
if (typeof val === "string") {
|
3379
3520
|
return [JSON.parse(val)];
|
@@ -3383,7 +3524,7 @@ var QueryType = import_zod24.z.object({
|
|
3383
3524
|
}
|
3384
3525
|
return val;
|
3385
3526
|
},
|
3386
|
-
|
3527
|
+
import_zod25.z.array(QueryExpression).nonempty("At least one clause is required.").openapi({
|
3387
3528
|
default: [
|
3388
3529
|
{
|
3389
3530
|
eventType: TENNIS_CLUB_MEMBERSHIP,
|
@@ -3404,58 +3545,62 @@ var QueryType = import_zod24.z.object({
|
|
3404
3545
|
}).openapi({
|
3405
3546
|
ref: "QueryType"
|
3406
3547
|
});
|
3548
|
+
var SearchScopeAccessLevels = {
|
3549
|
+
MY_JURISDICTION: "my-jurisdiction",
|
3550
|
+
ALL: "all"
|
3551
|
+
};
|
3407
3552
|
|
3408
3553
|
// ../commons/src/events/CountryConfigQueryInput.ts
|
3409
|
-
var SerializableExact =
|
3410
|
-
type:
|
3411
|
-
term:
|
3554
|
+
var SerializableExact = import_zod26.z.object({
|
3555
|
+
type: import_zod26.z.literal("exact"),
|
3556
|
+
term: import_zod26.z.union([import_zod26.z.string(), SerializedUserField])
|
3412
3557
|
});
|
3413
|
-
var SerializableWithin =
|
3414
|
-
type:
|
3415
|
-
location:
|
3558
|
+
var SerializableWithin = import_zod26.z.object({
|
3559
|
+
type: import_zod26.z.literal("within"),
|
3560
|
+
location: import_zod26.z.union([import_zod26.z.string(), SerializedUserField])
|
3416
3561
|
});
|
3417
|
-
var SerializedQueryExpression =
|
3418
|
-
eventType:
|
3419
|
-
status:
|
3420
|
-
createdAt:
|
3421
|
-
updatedAt:
|
3422
|
-
"
|
3423
|
-
"
|
3424
|
-
|
3562
|
+
var SerializedQueryExpression = import_zod26.z.object({
|
3563
|
+
eventType: import_zod26.z.string(),
|
3564
|
+
status: import_zod26.z.optional(import_zod26.z.union([AnyOfStatus, ExactStatus])),
|
3565
|
+
createdAt: import_zod26.z.optional(DateCondition),
|
3566
|
+
updatedAt: import_zod26.z.optional(DateCondition),
|
3567
|
+
"legalStatuses.REGISTERED.createdAt": import_zod26.z.optional(DateCondition),
|
3568
|
+
"legalStatuses.REGISTERED.createdAtLocation": import_zod26.z.optional(
|
3569
|
+
import_zod26.z.union([Within, Exact])
|
3425
3570
|
),
|
3426
|
-
"
|
3427
|
-
createdAtLocation:
|
3428
|
-
|
3571
|
+
"legalStatuses.REGISTERED.registrationNumber": import_zod26.z.optional(Exact),
|
3572
|
+
createdAtLocation: import_zod26.z.optional(
|
3573
|
+
import_zod26.z.union([SerializableWithin, SerializableExact])
|
3429
3574
|
),
|
3430
|
-
updatedAtLocation:
|
3431
|
-
|
3575
|
+
updatedAtLocation: import_zod26.z.optional(
|
3576
|
+
import_zod26.z.union([SerializableWithin, SerializableExact])
|
3432
3577
|
),
|
3433
|
-
assignedTo:
|
3434
|
-
createdBy:
|
3435
|
-
createdByUserType:
|
3436
|
-
updatedBy:
|
3437
|
-
trackingId:
|
3438
|
-
flags:
|
3578
|
+
assignedTo: import_zod26.z.optional(SerializableExact),
|
3579
|
+
createdBy: import_zod26.z.optional(SerializableExact),
|
3580
|
+
createdByUserType: ExactUserType,
|
3581
|
+
updatedBy: import_zod26.z.optional(SerializableExact),
|
3582
|
+
trackingId: import_zod26.z.optional(Exact),
|
3583
|
+
flags: import_zod26.z.optional(ContainsFlags),
|
3439
3584
|
data: QueryInput
|
3440
3585
|
}).partial();
|
3441
|
-
var Or2 =
|
3442
|
-
type:
|
3443
|
-
clauses:
|
3586
|
+
var Or2 = import_zod26.z.object({
|
3587
|
+
type: import_zod26.z.literal("or"),
|
3588
|
+
clauses: import_zod26.z.array(SerializedQueryExpression)
|
3444
3589
|
});
|
3445
|
-
var And2 =
|
3446
|
-
type:
|
3447
|
-
clauses:
|
3590
|
+
var And2 = import_zod26.z.object({
|
3591
|
+
type: import_zod26.z.literal("and"),
|
3592
|
+
clauses: import_zod26.z.array(SerializedQueryExpression)
|
3448
3593
|
});
|
3449
|
-
var CountryConfigQueryType =
|
3450
|
-
var CountryConfigQueryInputType =
|
3594
|
+
var CountryConfigQueryType = import_zod26.z.discriminatedUnion("type", [And2, Or2]);
|
3595
|
+
var CountryConfigQueryInputType = import_zod26.z.union([
|
3451
3596
|
SerializedQueryExpression,
|
3452
3597
|
And2,
|
3453
3598
|
Or2
|
3454
3599
|
]);
|
3455
3600
|
|
3456
3601
|
// ../commons/src/icons.ts
|
3457
|
-
var
|
3458
|
-
var AvailableIcons =
|
3602
|
+
var import_zod27 = require("zod");
|
3603
|
+
var AvailableIcons = import_zod27.z.enum([
|
3459
3604
|
"Archived",
|
3460
3605
|
"Assigned",
|
3461
3606
|
"Certified",
|
@@ -3576,42 +3721,42 @@ var mandatoryColumns = defineWorkqueuesColumns([
|
|
3576
3721
|
value: event.field("updatedAt")
|
3577
3722
|
}
|
3578
3723
|
]);
|
3579
|
-
var WorkqueueActionsWithDefault =
|
3724
|
+
var WorkqueueActionsWithDefault = import_zod28.z.enum([
|
3580
3725
|
...workqueueActions.options,
|
3581
3726
|
"DEFAULT"
|
3582
3727
|
]);
|
3583
|
-
var WorkqueueConfig =
|
3584
|
-
slug:
|
3728
|
+
var WorkqueueConfig = import_zod28.z.object({
|
3729
|
+
slug: import_zod28.z.string().describe("Determines the url of the workqueue."),
|
3585
3730
|
name: TranslationConfig.describe(
|
3586
3731
|
"Title of the workflow (both in navigation and on the page)"
|
3587
3732
|
),
|
3588
3733
|
query: CountryConfigQueryType,
|
3589
|
-
actions:
|
3590
|
-
|
3734
|
+
actions: import_zod28.z.array(
|
3735
|
+
import_zod28.z.object({
|
3591
3736
|
type: WorkqueueActionsWithDefault,
|
3592
|
-
conditionals:
|
3737
|
+
conditionals: import_zod28.z.array(Conditional).optional()
|
3593
3738
|
})
|
3594
3739
|
),
|
3595
|
-
columns:
|
3740
|
+
columns: import_zod28.z.array(WorkqueueColumn).default(mandatoryColumns),
|
3596
3741
|
icon: AvailableIcons
|
3597
3742
|
}).describe("Configuration for workqueue.");
|
3598
3743
|
var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
|
3599
3744
|
query: true,
|
3600
3745
|
columns: true
|
3601
3746
|
});
|
3602
|
-
var WorkqueueConfigInput =
|
3603
|
-
slug:
|
3747
|
+
var WorkqueueConfigInput = import_zod28.z.object({
|
3748
|
+
slug: import_zod28.z.string().describe("Determines the url of the workqueue."),
|
3604
3749
|
name: TranslationConfig.describe(
|
3605
3750
|
"Title of the workflow (both in navigation and on the page)"
|
3606
3751
|
),
|
3607
3752
|
query: CountryConfigQueryInputType,
|
3608
|
-
actions:
|
3609
|
-
|
3753
|
+
actions: import_zod28.z.array(
|
3754
|
+
import_zod28.z.object({
|
3610
3755
|
type: WorkqueueActionsWithDefault,
|
3611
|
-
conditionals:
|
3756
|
+
conditionals: import_zod28.z.array(Conditional).optional()
|
3612
3757
|
})
|
3613
3758
|
),
|
3614
|
-
columns:
|
3759
|
+
columns: import_zod28.z.array(WorkqueueColumn).default(mandatoryColumns),
|
3615
3760
|
icon: AvailableIcons
|
3616
3761
|
});
|
3617
3762
|
function defineWorkqueue(workqueueInput) {
|
@@ -3622,10 +3767,10 @@ function defineWorkqueue(workqueueInput) {
|
|
3622
3767
|
function defineWorkqueues(workqueues) {
|
3623
3768
|
return workqueues.map((workqueue) => defineWorkqueue(workqueue));
|
3624
3769
|
}
|
3625
|
-
var WorkqueueCountInput =
|
3626
|
-
|
3770
|
+
var WorkqueueCountInput = import_zod28.z.array(
|
3771
|
+
import_zod28.z.object({ slug: import_zod28.z.string(), query: QueryType })
|
3627
3772
|
);
|
3628
|
-
var WorkqueueCountOutput =
|
3773
|
+
var WorkqueueCountOutput = import_zod28.z.record(import_zod28.z.string(), import_zod28.z.number());
|
3629
3774
|
|
3630
3775
|
// ../commons/src/events/workqueueDefaultColumns.ts
|
3631
3776
|
var defaultWorkqueueColumns = [
|
@@ -3648,42 +3793,42 @@ var defaultWorkqueueColumns = [
|
|
3648
3793
|
];
|
3649
3794
|
|
3650
3795
|
// ../commons/src/events/Draft.ts
|
3651
|
-
var
|
3796
|
+
var import_zod30 = require("zod");
|
3652
3797
|
|
3653
3798
|
// ../commons/src/events/ActionInput.ts
|
3654
|
-
var
|
3655
|
-
var
|
3656
|
-
(0,
|
3657
|
-
var BaseActionInput =
|
3799
|
+
var import_zod29 = require("zod");
|
3800
|
+
var import_zod_openapi11 = require("zod-openapi");
|
3801
|
+
(0, import_zod_openapi11.extendZodWithOpenApi)(import_zod29.z);
|
3802
|
+
var BaseActionInput = import_zod29.z.object({
|
3658
3803
|
eventId: UUID,
|
3659
|
-
transactionId:
|
3804
|
+
transactionId: import_zod29.z.string(),
|
3660
3805
|
declaration: ActionUpdate.default({}),
|
3661
3806
|
annotation: ActionUpdate.optional(),
|
3662
3807
|
originalActionId: UUID.optional(),
|
3663
3808
|
// should not be part of base action.
|
3664
|
-
keepAssignment:
|
3809
|
+
keepAssignment: import_zod29.z.boolean().optional()
|
3665
3810
|
});
|
3666
3811
|
var CreateActionInput = BaseActionInput.merge(
|
3667
|
-
|
3668
|
-
type:
|
3812
|
+
import_zod29.z.object({
|
3813
|
+
type: import_zod29.z.literal(ActionType.CREATE).default(ActionType.CREATE),
|
3669
3814
|
createdAtLocation: CreatedAtLocation
|
3670
3815
|
})
|
3671
3816
|
);
|
3672
3817
|
var RegisterActionInput = BaseActionInput.merge(
|
3673
|
-
|
3674
|
-
type:
|
3675
|
-
registrationNumber:
|
3818
|
+
import_zod29.z.object({
|
3819
|
+
type: import_zod29.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
3820
|
+
registrationNumber: import_zod29.z.string().optional()
|
3676
3821
|
})
|
3677
3822
|
).strict();
|
3678
3823
|
var ValidateActionInput = BaseActionInput.merge(
|
3679
|
-
|
3680
|
-
type:
|
3681
|
-
duplicates:
|
3824
|
+
import_zod29.z.object({
|
3825
|
+
type: import_zod29.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
|
3826
|
+
duplicates: import_zod29.z.array(import_zod29.z.string())
|
3682
3827
|
})
|
3683
3828
|
);
|
3684
3829
|
var NotifyActionInput = BaseActionInput.merge(
|
3685
|
-
|
3686
|
-
type:
|
3830
|
+
import_zod29.z.object({
|
3831
|
+
type: import_zod29.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
|
3687
3832
|
})
|
3688
3833
|
).openapi({
|
3689
3834
|
default: {
|
@@ -3695,68 +3840,68 @@ var NotifyActionInput = BaseActionInput.merge(
|
|
3695
3840
|
}
|
3696
3841
|
});
|
3697
3842
|
var DeclareActionInput = BaseActionInput.merge(
|
3698
|
-
|
3699
|
-
type:
|
3843
|
+
import_zod29.z.object({
|
3844
|
+
type: import_zod29.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
3700
3845
|
})
|
3701
3846
|
);
|
3702
3847
|
var PrintCertificateActionInput = BaseActionInput.merge(
|
3703
|
-
|
3704
|
-
type:
|
3848
|
+
import_zod29.z.object({
|
3849
|
+
type: import_zod29.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
|
3705
3850
|
})
|
3706
3851
|
);
|
3707
3852
|
var RejectDeclarationActionInput = BaseActionInput.merge(
|
3708
|
-
|
3709
|
-
type:
|
3853
|
+
import_zod29.z.object({
|
3854
|
+
type: import_zod29.z.literal(ActionType.REJECT).default(ActionType.REJECT),
|
3710
3855
|
reason: RejectionReason
|
3711
3856
|
})
|
3712
3857
|
);
|
3713
3858
|
var MarkedAsDuplicateActionInput = BaseActionInput.merge(
|
3714
|
-
|
3715
|
-
type:
|
3859
|
+
import_zod29.z.object({
|
3860
|
+
type: import_zod29.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
|
3716
3861
|
})
|
3717
3862
|
);
|
3718
3863
|
var ArchiveActionInput = BaseActionInput.merge(
|
3719
|
-
|
3720
|
-
type:
|
3864
|
+
import_zod29.z.object({
|
3865
|
+
type: import_zod29.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
|
3721
3866
|
reason: RejectionReason
|
3722
3867
|
})
|
3723
3868
|
);
|
3724
3869
|
var AssignActionInput = BaseActionInput.merge(
|
3725
|
-
|
3726
|
-
type:
|
3727
|
-
assignedTo:
|
3870
|
+
import_zod29.z.object({
|
3871
|
+
type: import_zod29.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
|
3872
|
+
assignedTo: import_zod29.z.string()
|
3728
3873
|
})
|
3729
3874
|
);
|
3730
3875
|
var UnassignActionInput = BaseActionInput.merge(
|
3731
|
-
|
3732
|
-
type:
|
3733
|
-
assignedTo:
|
3876
|
+
import_zod29.z.object({
|
3877
|
+
type: import_zod29.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
|
3878
|
+
assignedTo: import_zod29.z.literal(null).default(null)
|
3734
3879
|
})
|
3735
3880
|
);
|
3736
3881
|
var RequestCorrectionActionInput = BaseActionInput.merge(
|
3737
|
-
|
3738
|
-
type:
|
3882
|
+
import_zod29.z.object({
|
3883
|
+
type: import_zod29.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
3739
3884
|
})
|
3740
3885
|
);
|
3741
3886
|
var RejectCorrectionActionInput = BaseActionInput.merge(
|
3742
|
-
|
3743
|
-
requestId:
|
3744
|
-
type:
|
3887
|
+
import_zod29.z.object({
|
3888
|
+
requestId: import_zod29.z.string(),
|
3889
|
+
type: import_zod29.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
|
3745
3890
|
})
|
3746
3891
|
);
|
3747
3892
|
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
3748
|
-
|
3749
|
-
requestId:
|
3750
|
-
type:
|
3893
|
+
import_zod29.z.object({
|
3894
|
+
requestId: import_zod29.z.string(),
|
3895
|
+
type: import_zod29.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
3751
3896
|
})
|
3752
3897
|
);
|
3753
3898
|
var ReadActionInput = BaseActionInput.merge(
|
3754
|
-
|
3755
|
-
type:
|
3899
|
+
import_zod29.z.object({
|
3900
|
+
type: import_zod29.z.literal(ActionType.READ).default(ActionType.READ)
|
3756
3901
|
})
|
3757
3902
|
);
|
3758
|
-
var DeleteActionInput =
|
3759
|
-
var ActionInput =
|
3903
|
+
var DeleteActionInput = import_zod29.z.object({ eventId: UUID });
|
3904
|
+
var ActionInput = import_zod29.z.discriminatedUnion("type", [
|
3760
3905
|
CreateActionInput.openapi({ ref: "CreateActionInput" }),
|
3761
3906
|
ValidateActionInput.openapi({ ref: "ValidateActionInput" }),
|
3762
3907
|
RegisterActionInput.openapi({ ref: "RegisterActionInput" }),
|
@@ -3785,18 +3930,18 @@ var ActionInput = import_zod28.z.discriminatedUnion("type", [
|
|
3785
3930
|
});
|
3786
3931
|
|
3787
3932
|
// ../commons/src/events/Draft.ts
|
3788
|
-
var Draft =
|
3933
|
+
var Draft = import_zod30.z.object({
|
3789
3934
|
id: UUID,
|
3790
3935
|
eventId: UUID,
|
3791
|
-
transactionId:
|
3792
|
-
createdAt:
|
3936
|
+
transactionId: import_zod30.z.string(),
|
3937
|
+
createdAt: import_zod30.z.string().datetime(),
|
3793
3938
|
action: ActionBase.extend({
|
3794
3939
|
type: ActionTypes
|
3795
3940
|
}).omit({ id: true })
|
3796
3941
|
});
|
3797
3942
|
var DraftInput = BaseActionInput.extend({
|
3798
3943
|
type: ActionTypes,
|
3799
|
-
status:
|
3944
|
+
status: import_zod30.z.enum([
|
3800
3945
|
ActionStatus.Requested,
|
3801
3946
|
ActionStatus.Accepted,
|
3802
3947
|
ActionStatus.Rejected
|
@@ -3804,24 +3949,24 @@ var DraftInput = BaseActionInput.extend({
|
|
3804
3949
|
});
|
3805
3950
|
|
3806
3951
|
// ../commons/src/events/EventInput.ts
|
3807
|
-
var
|
3952
|
+
var import_zod31 = require("zod");
|
3808
3953
|
var import_uuid8 = require("uuid");
|
3809
|
-
var EventInput =
|
3810
|
-
transactionId:
|
3811
|
-
type:
|
3954
|
+
var EventInput = import_zod31.z.object({
|
3955
|
+
transactionId: import_zod31.z.string(),
|
3956
|
+
type: import_zod31.z.string()
|
3812
3957
|
}).openapi({ default: { transactionId: (0, import_uuid8.v4)(), type: "v2.birth" } });
|
3813
3958
|
|
3814
3959
|
// ../commons/src/events/EventDocument.ts
|
3815
|
-
var
|
3816
|
-
var
|
3817
|
-
(0,
|
3818
|
-
var EventDocument =
|
3960
|
+
var import_zod32 = require("zod");
|
3961
|
+
var import_zod_openapi12 = require("zod-openapi");
|
3962
|
+
(0, import_zod_openapi12.extendZodWithOpenApi)(import_zod32.z);
|
3963
|
+
var EventDocument = import_zod32.z.object({
|
3819
3964
|
id: UUID,
|
3820
|
-
type:
|
3821
|
-
createdAt:
|
3822
|
-
updatedAt:
|
3823
|
-
actions:
|
3824
|
-
trackingId:
|
3965
|
+
type: import_zod32.z.string(),
|
3966
|
+
createdAt: import_zod32.z.string().datetime(),
|
3967
|
+
updatedAt: import_zod32.z.string().datetime(),
|
3968
|
+
actions: import_zod32.z.array(Action),
|
3969
|
+
trackingId: import_zod32.z.string()
|
3825
3970
|
}).openapi({ ref: "EventDocument" });
|
3826
3971
|
|
3827
3972
|
// ../commons/src/events/state/utils.ts
|
@@ -4069,6 +4214,13 @@ function getAcceptedActions(event2) {
|
|
4069
4214
|
);
|
4070
4215
|
}
|
4071
4216
|
var DEFAULT_DATE_OF_EVENT_PROPERTY = "createdAt";
|
4217
|
+
function resolveDateOfEvent(eventMetadata, declaration, config) {
|
4218
|
+
if (!config.dateOfEvent) {
|
4219
|
+
return eventMetadata[DEFAULT_DATE_OF_EVENT_PROPERTY].split("T")[0];
|
4220
|
+
}
|
4221
|
+
const parsedDate = ZodDate.safeParse(declaration[config.dateOfEvent.$$field]);
|
4222
|
+
return parsedDate.success ? parsedDate.data : void 0;
|
4223
|
+
}
|
4072
4224
|
function getCurrentEventState(event2, config) {
|
4073
4225
|
const creationAction = event2.actions.find(
|
4074
4226
|
(action) => action.type === ActionType.CREATE
|
@@ -4082,17 +4234,6 @@ function getCurrentEventState(event2, config) {
|
|
4082
4234
|
const requestActionMetadata = getActionUpdateMetadata(event2.actions);
|
4083
4235
|
const acceptedActionMetadata = getActionUpdateMetadata(acceptedActions);
|
4084
4236
|
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
4237
|
return deepDropNulls({
|
4097
4238
|
id: event2.id,
|
4098
4239
|
type: event2.type,
|
@@ -4111,7 +4252,7 @@ function getCurrentEventState(event2, config) {
|
|
4111
4252
|
declaration,
|
4112
4253
|
trackingId: event2.trackingId,
|
4113
4254
|
updatedByUserRole: requestActionMetadata.createdByRole,
|
4114
|
-
dateOfEvent,
|
4255
|
+
dateOfEvent: resolveDateOfEvent(event2, declaration, config),
|
4115
4256
|
flags: getFlagsFromActions(event2.actions)
|
4116
4257
|
});
|
4117
4258
|
}
|
@@ -4140,19 +4281,29 @@ function getCurrentEventStateWithDrafts({
|
|
4140
4281
|
};
|
4141
4282
|
return getCurrentEventState(withDrafts, configuration);
|
4142
4283
|
}
|
4143
|
-
function
|
4284
|
+
function applyDeclarationToEventIndex(eventIndex, declaration, eventConfiguration) {
|
4285
|
+
const updatedDeclaration = deepMerge(eventIndex.declaration, declaration);
|
4286
|
+
return {
|
4287
|
+
...eventIndex,
|
4288
|
+
dateOfEvent: resolveDateOfEvent(
|
4289
|
+
eventIndex,
|
4290
|
+
updatedDeclaration,
|
4291
|
+
eventConfiguration
|
4292
|
+
),
|
4293
|
+
declaration: updatedDeclaration
|
4294
|
+
};
|
4295
|
+
}
|
4296
|
+
function applyDraftsToEventIndex(eventIndex, drafts, eventConfiguration) {
|
4144
4297
|
const indexedAt = eventIndex.updatedAt;
|
4145
4298
|
const activeDrafts = drafts.filter(({ createdAt }) => new Date(createdAt) > new Date(indexedAt)).map((draft) => draft.action).sort();
|
4146
4299
|
if (activeDrafts.length === 0) {
|
4147
4300
|
return eventIndex;
|
4148
4301
|
}
|
4149
|
-
return
|
4150
|
-
|
4151
|
-
declaration
|
4152
|
-
|
4153
|
-
|
4154
|
-
}
|
4155
|
-
};
|
4302
|
+
return applyDeclarationToEventIndex(
|
4303
|
+
eventIndex,
|
4304
|
+
activeDrafts[activeDrafts.length - 1].declaration,
|
4305
|
+
eventConfiguration
|
4306
|
+
);
|
4156
4307
|
}
|
4157
4308
|
function getAnnotationFromDrafts(drafts) {
|
4158
4309
|
const actions = drafts.map((draft) => draft.action);
|
@@ -4193,23 +4344,24 @@ function generateTransactionId() {
|
|
4193
4344
|
}
|
4194
4345
|
|
4195
4346
|
// ../commons/src/events/User.ts
|
4196
|
-
var
|
4197
|
-
var User =
|
4198
|
-
id:
|
4199
|
-
name:
|
4200
|
-
|
4201
|
-
use:
|
4202
|
-
given:
|
4203
|
-
family:
|
4347
|
+
var import_zod33 = require("zod");
|
4348
|
+
var User = import_zod33.z.object({
|
4349
|
+
id: import_zod33.z.string(),
|
4350
|
+
name: import_zod33.z.array(
|
4351
|
+
import_zod33.z.object({
|
4352
|
+
use: import_zod33.z.string(),
|
4353
|
+
given: import_zod33.z.array(import_zod33.z.string()),
|
4354
|
+
family: import_zod33.z.string()
|
4204
4355
|
})
|
4205
4356
|
),
|
4206
|
-
role:
|
4207
|
-
|
4357
|
+
role: import_zod33.z.string(),
|
4358
|
+
avatar: FullDocumentPath.optional(),
|
4359
|
+
signature: FullDocumentPath.optional()
|
4208
4360
|
});
|
4209
4361
|
|
4210
4362
|
// ../commons/src/events/test.utils.ts
|
4211
4363
|
var import_lodash3 = require("lodash");
|
4212
|
-
var
|
4364
|
+
var import_date_fns4 = require("date-fns");
|
4213
4365
|
|
4214
4366
|
// ../commons/src/field-config/field-configuration.ts
|
4215
4367
|
function createFieldConfig(fieldId, options) {
|
@@ -4230,7 +4382,7 @@ function field(fieldId, options = {}) {
|
|
4230
4382
|
}
|
4231
4383
|
|
4232
4384
|
// ../commons/src/fixtures/forms.ts
|
4233
|
-
var
|
4385
|
+
var import_date_fns3 = require("date-fns");
|
4234
4386
|
var PRINT_CERTIFICATE_FORM = defineActionForm({
|
4235
4387
|
label: {
|
4236
4388
|
id: "v2.event.tennis-club-membership.action.certificate.form.label",
|
@@ -5196,7 +5348,7 @@ var timePeriodOptions = [
|
|
5196
5348
|
description: "Label for option of time period select: last 7 days",
|
5197
5349
|
id: "form.section.label.timePeriodLast7Days"
|
5198
5350
|
},
|
5199
|
-
value: `${(0,
|
5351
|
+
value: `${(0, import_date_fns3.format)((0, import_date_fns3.subDays)(/* @__PURE__ */ new Date(), 7), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
|
5200
5352
|
/* @__PURE__ */ new Date(),
|
5201
5353
|
"yyyy-MM-dd"
|
5202
5354
|
)}`
|
@@ -5207,7 +5359,7 @@ var timePeriodOptions = [
|
|
5207
5359
|
description: "Label for option of time period select: last 30 days",
|
5208
5360
|
id: "form.section.label.timePeriodLast30Days"
|
5209
5361
|
},
|
5210
|
-
value: `${(0,
|
5362
|
+
value: `${(0, import_date_fns3.format)((0, import_date_fns3.subMonths)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
|
5211
5363
|
/* @__PURE__ */ new Date(),
|
5212
5364
|
"yyyy-MM-dd"
|
5213
5365
|
)}`
|
@@ -5218,7 +5370,7 @@ var timePeriodOptions = [
|
|
5218
5370
|
description: "Label for option of time period select: last 90 days",
|
5219
5371
|
id: "form.section.label.timePeriodLast90Days"
|
5220
5372
|
},
|
5221
|
-
value: `${(0,
|
5373
|
+
value: `${(0, import_date_fns3.format)((0, import_date_fns3.subQuarters)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
|
5222
5374
|
/* @__PURE__ */ new Date(),
|
5223
5375
|
"yyyy-MM-dd"
|
5224
5376
|
)}`
|
@@ -5229,7 +5381,7 @@ var timePeriodOptions = [
|
|
5229
5381
|
description: "Label for option of time period select: last year",
|
5230
5382
|
id: "form.section.label.timePeriodLastYear"
|
5231
5383
|
},
|
5232
|
-
value: `${(0,
|
5384
|
+
value: `${(0, import_date_fns3.format)((0, import_date_fns3.subYears)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
|
5233
5385
|
/* @__PURE__ */ new Date(),
|
5234
5386
|
"yyyy-MM-dd"
|
5235
5387
|
)}`
|
@@ -5586,10 +5738,10 @@ var tennisClubMembershipEvent = defineConfig({
|
|
5586
5738
|
id: "v2.advancedSearch.form.registrationDetails"
|
5587
5739
|
},
|
5588
5740
|
fields: [
|
5589
|
-
event("
|
5590
|
-
event("
|
5591
|
-
event("status"
|
5592
|
-
event("updatedAt"
|
5741
|
+
event("legalStatuses.REGISTERED.createdAtLocation").exact(),
|
5742
|
+
event("legalStatuses.REGISTERED.acceptedAt").range(),
|
5743
|
+
event("status").exact(),
|
5744
|
+
event("updatedAt").range()
|
5593
5745
|
]
|
5594
5746
|
},
|
5595
5747
|
{
|
@@ -5979,10 +6131,10 @@ var footballClubMembershipEvent = defineConfig({
|
|
5979
6131
|
id: "v2.advancedSearch.form.registrationDetails"
|
5980
6132
|
},
|
5981
6133
|
fields: [
|
5982
|
-
event("
|
5983
|
-
event("
|
5984
|
-
event("status"
|
5985
|
-
event("updatedAt"
|
6134
|
+
event("legalStatuses.REGISTERED.createdAtLocation").exact(),
|
6135
|
+
event("legalStatuses.REGISTERED.acceptedAt").range(),
|
6136
|
+
event("status").exact(),
|
6137
|
+
event("updatedAt").range()
|
5986
6138
|
]
|
5987
6139
|
},
|
5988
6140
|
{
|
@@ -6195,8 +6347,9 @@ var v2BirthEvent = defineConfig({
|
|
6195
6347
|
});
|
6196
6348
|
|
6197
6349
|
// ../commons/src/events/test.utils.ts
|
6198
|
-
var
|
6199
|
-
var
|
6350
|
+
var import_zod34 = require("zod");
|
6351
|
+
var TEST_SYSTEM_IANA_TIMEZONE = "Asia/Dhaka";
|
6352
|
+
var TestUserRole = import_zod34.z.enum([
|
6200
6353
|
"FIELD_AGENT",
|
6201
6354
|
"LOCAL_REGISTRAR",
|
6202
6355
|
"LOCAL_SYSTEM_ADMIN",
|
@@ -6281,14 +6434,18 @@ function mapFieldTypeToMockValue(field2, i, rng) {
|
|
6281
6434
|
};
|
6282
6435
|
case FieldType.DATE:
|
6283
6436
|
return "2021-01-01";
|
6437
|
+
case FieldType.SELECT_DATE_RANGE:
|
6284
6438
|
case FieldType.DATE_RANGE:
|
6285
|
-
return
|
6439
|
+
return {
|
6440
|
+
start: "2021-01-01",
|
6441
|
+
end: "2021-01-31"
|
6442
|
+
};
|
6286
6443
|
case FieldType.CHECKBOX:
|
6287
6444
|
return true;
|
6288
6445
|
case FieldType.SIGNATURE:
|
6289
6446
|
case FieldType.FILE:
|
6290
6447
|
return {
|
6291
|
-
|
6448
|
+
path: "/ocrvs/4f095fc4-4312-4de2-aa38-86dcc0f71044.png",
|
6292
6449
|
originalFilename: "abcd.png",
|
6293
6450
|
type: "image/png"
|
6294
6451
|
};
|
@@ -6351,7 +6508,11 @@ function eventPayloadGenerator(rng) {
|
|
6351
6508
|
type: input.type ?? TENNIS_CLUB_MEMBERSHIP,
|
6352
6509
|
id
|
6353
6510
|
}),
|
6354
|
-
draft: ({
|
6511
|
+
draft: ({
|
6512
|
+
eventId,
|
6513
|
+
actionType,
|
6514
|
+
annotation
|
6515
|
+
}, input = {}) => (0, import_lodash3.merge)(
|
6355
6516
|
{
|
6356
6517
|
id: getUUID(),
|
6357
6518
|
eventId,
|
@@ -6371,7 +6532,8 @@ function eventPayloadGenerator(rng) {
|
|
6371
6532
|
},
|
6372
6533
|
annotation: {
|
6373
6534
|
"correction.requester.relationship": "ANOTHER_AGENT",
|
6374
|
-
"correction.request.reason": "Child's name was incorrect"
|
6535
|
+
"correction.request.reason": "Child's name was incorrect",
|
6536
|
+
...annotation
|
6375
6537
|
},
|
6376
6538
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
6377
6539
|
createdBy: "@todo",
|
@@ -6738,7 +6900,7 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
|
|
6738
6900
|
createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
|
6739
6901
|
updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
|
6740
6902
|
createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
|
6741
|
-
updatedAt: overrides.updatedAt ?? (0,
|
6903
|
+
updatedAt: overrides.updatedAt ?? (0, import_date_fns4.addDays)(new Date(createdAt), 1).toISOString(),
|
6742
6904
|
assignedTo: overrides.assignedTo ?? null,
|
6743
6905
|
updatedBy: overrides.updatedBy ?? generateUuid(rng),
|
6744
6906
|
updatedByUserRole: overrides.updatedByUserRole ?? "FIELD_AGENT",
|
@@ -6898,15 +7060,15 @@ function hasAnyOfScopes(a, b) {
|
|
6898
7060
|
}
|
6899
7061
|
|
6900
7062
|
// ../commons/src/events/serializers/user/deserializer.ts
|
6901
|
-
var
|
7063
|
+
var import_zod35 = require("zod");
|
6902
7064
|
var UserWithPrimaryOffice = User.extend({
|
6903
|
-
primaryOfficeId:
|
7065
|
+
primaryOfficeId: import_zod35.z.string()
|
6904
7066
|
});
|
6905
7067
|
function userDeserializer(serializedUserField, user2) {
|
6906
7068
|
if (typeof serializedUserField === "string") {
|
6907
7069
|
return serializedUserField;
|
6908
7070
|
}
|
6909
|
-
if (serializedUserField.$userField === "name" || serializedUserField.$userField === "
|
7071
|
+
if (serializedUserField.$userField === "name" || serializedUserField.$userField === "signature" || serializedUserField.$userField === "avatar") {
|
6910
7072
|
throw new Error(
|
6911
7073
|
`Deserializer for ${serializedUserField.$userField} is not implemented yet`
|
6912
7074
|
);
|