@opencrvs/toolkit 2.2.0-rc.3af310b → 2.2.0-rc.5bf5dfc
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/build.sh +7 -2
- package/dist/application-config/index.js +9 -9
- package/dist/authentication/index.d.ts +2 -1
- package/dist/authentication/index.js +20 -12
- package/dist/cli.js +633 -333
- package/dist/commons/api/router.d.ts +249 -249
- package/dist/commons/application-config/index.d.ts +2 -2
- package/dist/commons/conditionals/conditionals.d.ts +4 -4
- package/dist/commons/conditionals/index.d.ts +1 -0
- package/dist/commons/conditionals/validate.d.ts +6 -1
- package/dist/commons/events/ActionConfig.d.ts +2 -2
- package/dist/commons/events/ActionDocument.d.ts +1 -0
- package/dist/commons/events/ActionInput.d.ts +4 -4
- package/dist/commons/events/ActionStatus.d.ts +2 -2
- package/dist/commons/events/ActionType.d.ts +2 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +3 -0
- package/dist/commons/events/CompositeFieldValue.d.ts +5 -1
- package/dist/commons/events/Draft.d.ts +34 -1
- package/dist/commons/events/EventConfig.d.ts +1 -10
- package/dist/commons/events/EventIndex.d.ts +2 -2
- package/dist/commons/events/FieldConfig.d.ts +1 -1
- package/dist/commons/events/FieldTypeMapping.d.ts +17 -17
- package/dist/commons/events/Flag.d.ts +1 -1
- package/dist/commons/events/PlainDate.d.ts +1 -0
- package/dist/commons/events/eventConfigValidation.d.ts +1 -1
- package/dist/commons/events/field.d.ts +5 -0
- package/dist/commons/events/index.d.ts +3 -0
- package/dist/commons/events/locations.d.ts +1 -1
- package/dist/commons/events/scopes.d.ts +2 -1
- package/dist/commons/events/test.utils.d.ts +5 -6
- package/dist/commons/events/toNotificationForm.d.ts +17 -0
- package/dist/commons/events/utils.d.ts +26 -5
- package/dist/commons/users/Role.d.ts +23 -0
- package/dist/commons/users/User.d.ts +263 -0
- package/dist/commons/users/authentication.d.ts +67 -0
- package/dist/commons/users/index.d.ts +5 -0
- package/dist/commons/users/roleValidations.d.ts +15 -0
- package/dist/commons/users/scopes.d.ts +1402 -0
- package/dist/commons/users/userReferences.d.ts +176 -0
- package/dist/conditionals/index.js +5 -5
- package/dist/environment/custom-types.d.ts +1 -0
- package/dist/environment/custom-types.d.ts.map +1 -1
- package/dist/environment/derived-variables.d.ts +6 -4
- package/dist/environment/derived-variables.d.ts.map +1 -1
- package/dist/environment/derived-variables.js +6 -4
- package/dist/environment/questions.d.ts +42 -9
- package/dist/environment/questions.d.ts.map +1 -1
- package/dist/environment/questions.js +70 -47
- package/dist/environment/registry.d.ts +15 -0
- package/dist/environment/registry.d.ts.map +1 -0
- package/dist/environment/registry.js +112 -0
- package/dist/environment/setup-environment.d.ts.map +1 -1
- package/dist/environment/setup-environment.js +85 -29
- package/dist/events/index.js +214 -152
- package/dist/migrations/add-notify-config.d.ts +40 -0
- package/dist/migrations/add-notify-config.d.ts.map +1 -0
- package/dist/migrations/add-notify-config.js +249 -0
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +345 -143
- package/dist/migrations/move-declaration-to-declare-action.d.ts.map +1 -1
- package/dist/migrations/move-declaration-to-declare-action.js +27 -144
- package/dist/migrations/read-declaration-through-helper.d.ts.map +1 -1
- package/dist/migrations/read-declaration-through-helper.js +3 -61
- package/dist/migrations/utils.d.ts +61 -0
- package/dist/migrations/utils.d.ts.map +1 -0
- package/dist/migrations/utils.js +218 -0
- package/dist/notification/index.js +282 -90
- package/dist/roles/index.d.ts +2 -0
- package/dist/roles/index.d.ts.map +1 -0
- package/dist/roles/index.js +719 -0
- package/dist/scopes/index.d.ts +54 -61
- package/dist/scopes/index.js +15 -11
- package/dist/templates/charts-values/opencrvs-services/values.yaml +3 -4
- package/opencrvs-toolkit-2.2.0-rc.5bf5dfc.tgz +0 -0
- package/package.json +5 -3
- package/tsconfig.build.tsbuildinfo +1 -1
- package/tsconfig.json +3 -5
- package/dist/commons/events/notificationFormFallback.d.ts +0 -10
- package/dist/environment/dockerhub.d.ts +0 -15
- package/dist/environment/dockerhub.d.ts.map +0 -1
- package/dist/environment/dockerhub.js +0 -104
- package/opencrvs-toolkit-2.2.0-rc.3af310b.tgz +0 -0
package/dist/events/index.js
CHANGED
|
@@ -208,6 +208,7 @@ __export(events_exports, {
|
|
|
208
208
|
RejectCorrectionActionInput: () => RejectCorrectionActionInput,
|
|
209
209
|
RejectDeclarationActionInput: () => RejectDeclarationActionInput,
|
|
210
210
|
RejectedCorrectionAction: () => RejectedCorrectionAction,
|
|
211
|
+
RemoteDraft: () => RemoteDraft,
|
|
211
212
|
RequestCorrectionActionInput: () => RequestCorrectionActionInput,
|
|
212
213
|
RevokeRegistrationActionInput: () => RevokeRegistrationActionInput,
|
|
213
214
|
SearchQuery: () => SearchQuery,
|
|
@@ -339,6 +340,7 @@ __export(events_exports, {
|
|
|
339
340
|
getActionAnnotation: () => getActionAnnotation,
|
|
340
341
|
getActionAnnotationFields: () => getActionAnnotationFields,
|
|
341
342
|
getActionConfig: () => getActionConfig,
|
|
343
|
+
getActionForm: () => getActionForm,
|
|
342
344
|
getActionFormFields: () => getActionFormFields,
|
|
343
345
|
getActionReview: () => getActionReview,
|
|
344
346
|
getActionReviewFields: () => getActionReviewFields,
|
|
@@ -379,10 +381,12 @@ __export(events_exports, {
|
|
|
379
381
|
hasAnyOfScopes: () => hasAnyOfScopes,
|
|
380
382
|
isActionAvailable: () => isActionAvailable,
|
|
381
383
|
isActionConfigType: () => isActionConfigType,
|
|
384
|
+
isActionDocument: () => isActionDocument,
|
|
382
385
|
isActionEnabled: () => isActionEnabled,
|
|
383
386
|
isActionInScope: () => isActionInScope,
|
|
384
387
|
isActionVisible: () => isActionVisible,
|
|
385
388
|
isAddressFieldType: () => isAddressFieldType,
|
|
389
|
+
isAddressFieldValue: () => isAddressFieldValue,
|
|
386
390
|
isAdministrativeAreaFieldType: () => isAdministrativeAreaFieldType,
|
|
387
391
|
isAgeFieldType: () => isAgeFieldType,
|
|
388
392
|
isAutocompleteFieldType: () => isAutocompleteFieldType,
|
|
@@ -397,6 +401,7 @@ __export(events_exports, {
|
|
|
397
401
|
isDateFieldType: () => isDateFieldType,
|
|
398
402
|
isDateRangeFieldType: () => isDateRangeFieldType,
|
|
399
403
|
isDividerFieldType: () => isDividerFieldType,
|
|
404
|
+
isDomesticAddressFieldValue: () => isDomesticAddressFieldValue,
|
|
400
405
|
isEmailFieldType: () => isEmailFieldType,
|
|
401
406
|
isEventFieldReference: () => isEventFieldReference,
|
|
402
407
|
isFacilityFieldType: () => isFacilityFieldType,
|
|
@@ -410,7 +415,9 @@ __export(events_exports, {
|
|
|
410
415
|
isFieldValueWithoutTemplates: () => isFieldValueWithoutTemplates,
|
|
411
416
|
isFieldVisible: () => isFieldVisible,
|
|
412
417
|
isFileFieldType: () => isFileFieldType,
|
|
418
|
+
isFileFieldValue: () => isFileFieldValue,
|
|
413
419
|
isFileFieldWithOptionType: () => isFileFieldWithOptionType,
|
|
420
|
+
isFileFieldWithOptionValue: () => isFileFieldWithOptionValue,
|
|
414
421
|
isHeadingFieldType: () => isHeadingFieldType,
|
|
415
422
|
isHiddenFieldType: () => isHiddenFieldType,
|
|
416
423
|
isHttpFieldType: () => isHttpFieldType,
|
|
@@ -431,6 +438,7 @@ __export(events_exports, {
|
|
|
431
438
|
isPageVisible: () => isPageVisible,
|
|
432
439
|
isParagraphFieldType: () => isParagraphFieldType,
|
|
433
440
|
isPhoneFieldType: () => isPhoneFieldType,
|
|
441
|
+
isPlainDate: () => isPlainDate,
|
|
434
442
|
isPotentialDuplicate: () => isPotentialDuplicate,
|
|
435
443
|
isPrintButtonFieldType: () => isPrintButtonFieldType,
|
|
436
444
|
isQrReaderFieldType: () => isQrReaderFieldType,
|
|
@@ -479,6 +487,8 @@ __export(events_exports, {
|
|
|
479
487
|
timePeriodToDateRange: () => timePeriodToDateRange,
|
|
480
488
|
toClientAdministrativeArea: () => toClientAdministrativeArea,
|
|
481
489
|
toClientLocation: () => toClientLocation,
|
|
490
|
+
toNotificationForm: () => toNotificationForm,
|
|
491
|
+
toNotificationReview: () => toNotificationReview,
|
|
482
492
|
toPlainDate: () => toPlainDate,
|
|
483
493
|
todayISO: () => todayISO,
|
|
484
494
|
user: () => user,
|
|
@@ -492,14 +502,17 @@ __export(events_exports, {
|
|
|
492
502
|
});
|
|
493
503
|
module.exports = __toCommonJS(events_exports);
|
|
494
504
|
|
|
505
|
+
// ../commons/src/events/index.ts
|
|
506
|
+
var import_compile = require("zod/compile");
|
|
507
|
+
|
|
495
508
|
// ../commons/src/events/AuditLog.ts
|
|
496
509
|
var z9 = __toESM(require("zod/v4"));
|
|
497
510
|
|
|
498
|
-
// ../commons/src/authentication.ts
|
|
511
|
+
// ../commons/src/users/authentication.ts
|
|
499
512
|
var import_jwt_decode = __toESM(require("jwt-decode"));
|
|
500
513
|
var z8 = __toESM(require("zod/v4"));
|
|
501
514
|
|
|
502
|
-
// ../commons/src/scopes.ts
|
|
515
|
+
// ../commons/src/users/scopes.ts
|
|
503
516
|
var z7 = __toESM(require("zod/v4"));
|
|
504
517
|
var qs = __toESM(require("qs"));
|
|
505
518
|
|
|
@@ -510,6 +523,12 @@ var UUID = z.uuid().brand("UUID");
|
|
|
510
523
|
function getUUID() {
|
|
511
524
|
return (0, import_uuid.v4)();
|
|
512
525
|
}
|
|
526
|
+
function isUUID(id) {
|
|
527
|
+
return UUID.validate(id);
|
|
528
|
+
}
|
|
529
|
+
function maybeUuid(value) {
|
|
530
|
+
return isUUID(value) ? value : void 0;
|
|
531
|
+
}
|
|
513
532
|
|
|
514
533
|
// ../commons/src/events/ActionType.ts
|
|
515
534
|
var z2 = __toESM(require("zod/v4"));
|
|
@@ -585,7 +604,9 @@ var ActionTypes = z2.enum([
|
|
|
585
604
|
"CUSTOM"
|
|
586
605
|
]);
|
|
587
606
|
var ClientSpecificAction = {
|
|
588
|
-
REVIEW_CORRECTION_REQUEST: "REVIEW_CORRECTION_REQUEST"
|
|
607
|
+
REVIEW_CORRECTION_REQUEST: "REVIEW_CORRECTION_REQUEST",
|
|
608
|
+
/** Opens the user's declare or notify draft of the event in its own flow */
|
|
609
|
+
CONTINUE_DRAFT: "CONTINUE_DRAFT"
|
|
589
610
|
};
|
|
590
611
|
var declarationActionValues = [
|
|
591
612
|
ActionTypes.enum.DECLARE,
|
|
@@ -641,7 +662,7 @@ var ActionStatus = {
|
|
|
641
662
|
};
|
|
642
663
|
|
|
643
664
|
// ../commons/src/events/Flag.ts
|
|
644
|
-
var z5 = __toESM(require("zod
|
|
665
|
+
var z5 = __toESM(require("zod"));
|
|
645
666
|
|
|
646
667
|
// ../commons/src/events/TranslationConfig.ts
|
|
647
668
|
var z3 = __toESM(require("zod/v4"));
|
|
@@ -737,7 +758,7 @@ var CustomFlag = z5.string().refine((val) => !Object.values(InherentFlags).inclu
|
|
|
737
758
|
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
738
759
|
InherentFlags
|
|
739
760
|
).join(", ")}`
|
|
740
|
-
}).refine((val) => !ActionFlag.
|
|
761
|
+
}).refine((val) => !ActionFlag.validate(val), {
|
|
741
762
|
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
742
763
|
}).describe("Custom flag identifier defined by the country config.");
|
|
743
764
|
var Flag = ActionFlag.or(z5.enum(InherentFlags)).or(CustomFlag);
|
|
@@ -780,7 +801,7 @@ var EventStatus = z6.enum([
|
|
|
780
801
|
"ARCHIVED"
|
|
781
802
|
]);
|
|
782
803
|
|
|
783
|
-
// ../commons/src/scopes.ts
|
|
804
|
+
// ../commons/src/users/scopes.ts
|
|
784
805
|
var JurisdictionFilter = z7.enum(["administrativeArea", "location", "all"]).describe(
|
|
785
806
|
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
786
807
|
);
|
|
@@ -1112,7 +1133,7 @@ function getAcceptedScopesByType({
|
|
|
1112
1133
|
}).filter((scope) => scope !== null);
|
|
1113
1134
|
}
|
|
1114
1135
|
|
|
1115
|
-
// ../commons/src/authentication.ts
|
|
1136
|
+
// ../commons/src/users/authentication.ts
|
|
1116
1137
|
var TokenUserType = z8.enum(["user", "system"]);
|
|
1117
1138
|
var TokenWithBearer = z8.string().regex(/^Bearer\s/);
|
|
1118
1139
|
|
|
@@ -1510,7 +1531,7 @@ var z14 = __toESM(require("zod/v4"));
|
|
|
1510
1531
|
// ../commons/src/documents.ts
|
|
1511
1532
|
var z11 = __toESM(require("zod/v4"));
|
|
1512
1533
|
var FullDocumentUrl = z11.string().brand("FullDocumentUrl").describe(
|
|
1513
|
-
"A full url with protocol, host, bucket name, starting from the root of the S3 server, https://
|
|
1534
|
+
"A full url with protocol, host, bucket name, starting from the root of the S3 server, https://s3.opencrvs.com/bucket-name/document-id.jpg"
|
|
1514
1535
|
);
|
|
1515
1536
|
var FullDocumentPath = z11.string().overwrite((val) => val.startsWith("/") ? val : `/${val}`).meta({ effectType: "input", type: "string" }).describe(
|
|
1516
1537
|
"A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
|
|
@@ -1520,7 +1541,7 @@ var DocumentPath = z11.string().brand("DocumentPath").describe(
|
|
|
1520
1541
|
);
|
|
1521
1542
|
|
|
1522
1543
|
// ../commons/src/events/CompositeFieldValue.ts
|
|
1523
|
-
var z12 = __toESM(require("zod
|
|
1544
|
+
var z12 = __toESM(require("zod"));
|
|
1524
1545
|
var GeographicalArea = {
|
|
1525
1546
|
URBAN: "URBAN",
|
|
1526
1547
|
RURAL: "RURAL"
|
|
@@ -1534,6 +1555,9 @@ var FileFieldValue = z12.object({
|
|
|
1534
1555
|
originalFilename: z12.string(),
|
|
1535
1556
|
type: z12.string()
|
|
1536
1557
|
});
|
|
1558
|
+
function isFileFieldValue(value) {
|
|
1559
|
+
return FileFieldValue.validate(value);
|
|
1560
|
+
}
|
|
1537
1561
|
var NameFieldValue = z12.object({
|
|
1538
1562
|
firstname: z12.string(),
|
|
1539
1563
|
surname: z12.string(),
|
|
@@ -1558,6 +1582,9 @@ var DomesticAddressFieldValue = BaseAddressFieldValue.extend({
|
|
|
1558
1582
|
addressType: z12.literal(AddressType.DOMESTIC),
|
|
1559
1583
|
administrativeArea: z12.string().uuid()
|
|
1560
1584
|
});
|
|
1585
|
+
function isDomesticAddressFieldValue(value) {
|
|
1586
|
+
return DomesticAddressFieldValue.validate(value);
|
|
1587
|
+
}
|
|
1561
1588
|
var InternationalAddressFieldValue = BaseAddressFieldValue.extend({
|
|
1562
1589
|
addressType: z12.literal(AddressType.INTERNATIONAL)
|
|
1563
1590
|
});
|
|
@@ -1565,6 +1592,9 @@ var AddressFieldValue = z12.discriminatedUnion("addressType", [
|
|
|
1565
1592
|
DomesticAddressFieldValue,
|
|
1566
1593
|
InternationalAddressFieldValue
|
|
1567
1594
|
]);
|
|
1595
|
+
function isAddressFieldValue(value) {
|
|
1596
|
+
return AddressFieldValue.validate(value);
|
|
1597
|
+
}
|
|
1568
1598
|
var DomesticAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend({
|
|
1569
1599
|
addressType: z12.literal(AddressType.DOMESTIC),
|
|
1570
1600
|
administrativeArea: z12.string().uuid().nullish()
|
|
@@ -1586,6 +1616,9 @@ var FileFieldValueWithOption = z12.object({
|
|
|
1586
1616
|
option: z12.string()
|
|
1587
1617
|
});
|
|
1588
1618
|
var FileFieldWithOptionValue = z12.array(FileFieldValueWithOption);
|
|
1619
|
+
function isFileFieldWithOptionValue(value) {
|
|
1620
|
+
return FileFieldWithOptionValue.validate(value);
|
|
1621
|
+
}
|
|
1589
1622
|
var HttpFieldValue = z12.object({
|
|
1590
1623
|
loading: z12.boolean(),
|
|
1591
1624
|
error: z12.object({ statusCode: z12.number(), message: z12.string() }).nullish(),
|
|
@@ -1621,6 +1654,7 @@ var CustomFieldValue = z12.unknown().brand("CustomFieldValue");
|
|
|
1621
1654
|
// ../commons/src/events/PlainDate.ts
|
|
1622
1655
|
var import_zod = require("zod");
|
|
1623
1656
|
var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date in the format YYYY-MM-DD");
|
|
1657
|
+
var isPlainDate = (date) => PlainDate.validate(date);
|
|
1624
1658
|
function toPlainDate(dateTime) {
|
|
1625
1659
|
return dateTime.split("T")[0];
|
|
1626
1660
|
}
|
|
@@ -1736,7 +1770,7 @@ function safeUnion(schemas) {
|
|
|
1736
1770
|
);
|
|
1737
1771
|
return z14.any().superRefine((val, ctx) => {
|
|
1738
1772
|
for (const schema of sortedSchemas) {
|
|
1739
|
-
if (schema.
|
|
1773
|
+
if (schema.validate(val)) {
|
|
1740
1774
|
return;
|
|
1741
1775
|
}
|
|
1742
1776
|
}
|
|
@@ -2025,6 +2059,7 @@ var ActionDocument = z16.discriminatedUnion("type", [
|
|
|
2025
2059
|
]).meta({
|
|
2026
2060
|
id: "ActionDocument"
|
|
2027
2061
|
});
|
|
2062
|
+
var isActionDocument = (a) => ActionDocument.validate(a);
|
|
2028
2063
|
var AsyncRejectActionDocument = ActionBase.omit({
|
|
2029
2064
|
declaration: true,
|
|
2030
2065
|
annotation: true
|
|
@@ -3517,11 +3552,11 @@ var ReadActionConfig = ActionConfigBase.extend(
|
|
|
3517
3552
|
var NotifyConfig = ActionConfigBase.extend(
|
|
3518
3553
|
z25.object({
|
|
3519
3554
|
type: z25.literal(ActionType.NOTIFY),
|
|
3520
|
-
notificationForm: DeclarationFormConfig.
|
|
3521
|
-
"Notification form configuration. Its fields must be a subset of the declaration form fields, with matching types. The values submitted on the notification form pre-fill the declaration.
|
|
3555
|
+
notificationForm: DeclarationFormConfig.describe(
|
|
3556
|
+
"Notification form configuration. Its fields must be a subset of the declaration form fields, with matching types. The values submitted on the notification form pre-fill the declaration."
|
|
3522
3557
|
),
|
|
3523
3558
|
review: DeclarationReviewConfig.describe(
|
|
3524
|
-
"Review page configuration for the notify action. Values of its fields are stored as the NOTIFY action annotation.
|
|
3559
|
+
"Review page configuration for the notify action. Values of its fields are stored as the NOTIFY action annotation."
|
|
3525
3560
|
),
|
|
3526
3561
|
form: actionConfirmationForm
|
|
3527
3562
|
}).shape
|
|
@@ -4067,7 +4102,10 @@ var SearchQueryParams = z30.object({
|
|
|
4067
4102
|
}).catchall(FieldValue);
|
|
4068
4103
|
var FieldConfigSchema = BaseField3.extend({
|
|
4069
4104
|
fieldId: z30.string(),
|
|
4070
|
-
fieldType: z30.literal("field")
|
|
4105
|
+
fieldType: z30.literal("field"),
|
|
4106
|
+
defaultValue: z30.union([z30.boolean(), z30.string(), z30.number()]).optional().describe(
|
|
4107
|
+
`Value the field opens with in advanced search. Omitted or true uses the declaration form's defaultValue, false opens the field empty, and any other value opens it with that value. Only text, number and date fields take a value; every other field type, and date fields searched as a range, only accept true or false.`
|
|
4108
|
+
)
|
|
4071
4109
|
});
|
|
4072
4110
|
var EventFieldIdInput = z30.enum([
|
|
4073
4111
|
"trackingId",
|
|
@@ -5547,35 +5585,24 @@ function resolveDateOfEvent(eventIndex, declaration, config) {
|
|
|
5547
5585
|
if (!config.dateOfEvent) {
|
|
5548
5586
|
return extractDateString(eventIndex[DEFAULT_DATE_OF_EVENT_PROPERTY]);
|
|
5549
5587
|
}
|
|
5550
|
-
|
|
5551
|
-
|
|
5588
|
+
if (isFieldReference(config.dateOfEvent)) {
|
|
5589
|
+
const fieldDate = declaration[config.dateOfEvent.$$field];
|
|
5590
|
+
return ZodDate.validate(fieldDate) ? extractDateString(fieldDate) : void 0;
|
|
5591
|
+
}
|
|
5592
|
+
const eventDate = getMixedPath(
|
|
5593
|
+
eventIndex,
|
|
5594
|
+
config.dateOfEvent.$$event
|
|
5552
5595
|
);
|
|
5553
|
-
return
|
|
5596
|
+
return ZodDateTime.validate(eventDate) ? extractDateString(eventDate) : void 0;
|
|
5554
5597
|
}
|
|
5555
5598
|
var DEFAULT_PLACE_OF_EVENT_PROPERTY = "createdAtLocation";
|
|
5556
|
-
function getParsedUUID(value, oldValue) {
|
|
5557
|
-
const parsed = UUID.safeParse(value);
|
|
5558
|
-
return parsed.success ? parsed.data : oldValue;
|
|
5559
|
-
}
|
|
5560
5599
|
function resolvePlaceOfEvent(eventMetadata, declaration, config) {
|
|
5561
|
-
let placeOfEvent =
|
|
5600
|
+
let placeOfEvent = maybeUuid(
|
|
5562
5601
|
eventMetadata[DEFAULT_PLACE_OF_EVENT_PROPERTY]
|
|
5563
5602
|
);
|
|
5564
5603
|
if (config.placeOfEvent) {
|
|
5565
|
-
const addressFieldValue =
|
|
5566
|
-
|
|
5567
|
-
);
|
|
5568
|
-
if (addressFieldValue.success && addressFieldValue.data.addressType === AddressType.DOMESTIC && addressFieldValue.data.administrativeArea) {
|
|
5569
|
-
placeOfEvent = getParsedUUID(
|
|
5570
|
-
addressFieldValue.data.administrativeArea,
|
|
5571
|
-
placeOfEvent
|
|
5572
|
-
);
|
|
5573
|
-
} else {
|
|
5574
|
-
placeOfEvent = getParsedUUID(
|
|
5575
|
-
declaration[config.placeOfEvent.$$field],
|
|
5576
|
-
placeOfEvent
|
|
5577
|
-
);
|
|
5578
|
-
}
|
|
5604
|
+
const addressFieldValue = declaration[config.placeOfEvent.$$field];
|
|
5605
|
+
placeOfEvent = isDomesticAddressFieldValue(addressFieldValue) ? maybeUuid(addressFieldValue.administrativeArea) ?? placeOfEvent : maybeUuid(declaration[config.placeOfEvent.$$field]) ?? placeOfEvent;
|
|
5579
5606
|
}
|
|
5580
5607
|
return placeOfEvent;
|
|
5581
5608
|
}
|
|
@@ -5860,7 +5887,7 @@ function precompileActionSchemas(eventConfigurations) {
|
|
|
5860
5887
|
}
|
|
5861
5888
|
}
|
|
5862
5889
|
function isAgeValue(value) {
|
|
5863
|
-
return
|
|
5890
|
+
return AgeValue.validate(value);
|
|
5864
5891
|
}
|
|
5865
5892
|
function mergeWithBaseFormState(values, context) {
|
|
5866
5893
|
return { ...context.baseFormState, ...values };
|
|
@@ -5890,15 +5917,13 @@ function validate(schema, data) {
|
|
|
5890
5917
|
return [key, value];
|
|
5891
5918
|
}
|
|
5892
5919
|
const age = value.age;
|
|
5893
|
-
const
|
|
5920
|
+
const asOf = data.$form[value.asOfDateRef];
|
|
5921
|
+
const asOfDate = isPlainDate(asOf) ? asOf : PlainDate.parse(data.$now);
|
|
5894
5922
|
return [
|
|
5895
5923
|
key,
|
|
5896
5924
|
{
|
|
5897
5925
|
age,
|
|
5898
|
-
dob: ageToDate(
|
|
5899
|
-
age,
|
|
5900
|
-
maybeAsOfDate.success ? maybeAsOfDate.data : PlainDate.parse(data.$now)
|
|
5901
|
-
)
|
|
5926
|
+
dob: ageToDate(age, asOfDate)
|
|
5902
5927
|
}
|
|
5903
5928
|
];
|
|
5904
5929
|
});
|
|
@@ -6061,6 +6086,11 @@ var errorMessages = {
|
|
|
6061
6086
|
description: "Error message when field is not expected",
|
|
6062
6087
|
id: "error.unexpectedField"
|
|
6063
6088
|
},
|
|
6089
|
+
notInNotifyForm: {
|
|
6090
|
+
defaultMessage: "Field is not part of the notify form. Notify-only data belongs in annotation",
|
|
6091
|
+
description: "Error message when a notify declaration contains a field outside the notify form",
|
|
6092
|
+
id: "error.notInNotifyForm"
|
|
6093
|
+
},
|
|
6064
6094
|
correctionNotAllowed: {
|
|
6065
6095
|
defaultMessage: "Correction not allowed for field",
|
|
6066
6096
|
description: "Error message when correction is not allowed for field",
|
|
@@ -6274,34 +6304,6 @@ function areCertificateConditionsMet(conditions, values) {
|
|
|
6274
6304
|
});
|
|
6275
6305
|
}
|
|
6276
6306
|
|
|
6277
|
-
// ../commons/src/events/notificationFormFallback.ts
|
|
6278
|
-
function toOptionalField(field3) {
|
|
6279
|
-
const { validation: _validation, ...rest } = field3;
|
|
6280
|
-
if (rest.type === FieldType.FIELD_GROUP && "fields" in rest) {
|
|
6281
|
-
return {
|
|
6282
|
-
...rest,
|
|
6283
|
-
required: false,
|
|
6284
|
-
fields: rest.fields.map(toOptionalField)
|
|
6285
|
-
};
|
|
6286
|
-
}
|
|
6287
|
-
return { ...rest, required: false };
|
|
6288
|
-
}
|
|
6289
|
-
function deriveNotificationForm(declaration) {
|
|
6290
|
-
return {
|
|
6291
|
-
...declaration,
|
|
6292
|
-
pages: declaration.pages.map((page) => ({
|
|
6293
|
-
...page,
|
|
6294
|
-
fields: page.fields.map(toOptionalField)
|
|
6295
|
-
}))
|
|
6296
|
-
};
|
|
6297
|
-
}
|
|
6298
|
-
function generateNotifyReview(declareReview) {
|
|
6299
|
-
return {
|
|
6300
|
-
...declareReview,
|
|
6301
|
-
fields: declareReview.fields.map(toOptionalField)
|
|
6302
|
-
};
|
|
6303
|
-
}
|
|
6304
|
-
|
|
6305
6307
|
// ../commons/src/events/utils.ts
|
|
6306
6308
|
var import_date_fns3 = require("date-fns");
|
|
6307
6309
|
function ageToDate(age, asOfDate) {
|
|
@@ -6325,31 +6327,29 @@ function getDeclarationPages(configuration) {
|
|
|
6325
6327
|
function getDeclarationFields(configuration) {
|
|
6326
6328
|
return getDeclarationPages(configuration).flatMap(({ fields }) => fields);
|
|
6327
6329
|
}
|
|
6328
|
-
function
|
|
6330
|
+
function findNotificationForm(configuration) {
|
|
6329
6331
|
const notifyAction = configuration.actions.find(
|
|
6330
6332
|
(action) => action.type === ActionType.NOTIFY
|
|
6331
6333
|
);
|
|
6332
6334
|
return notifyAction?.type === ActionType.NOTIFY ? notifyAction.notificationForm : void 0;
|
|
6333
6335
|
}
|
|
6334
|
-
var derivedNotificationForms = /* @__PURE__ */ new WeakMap();
|
|
6335
6336
|
function getNotificationForm(configuration) {
|
|
6336
|
-
const
|
|
6337
|
-
if (
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
if (cached) {
|
|
6342
|
-
return cached;
|
|
6337
|
+
const notificationForm = findNotificationForm(configuration);
|
|
6338
|
+
if (!notificationForm) {
|
|
6339
|
+
throw new Error(
|
|
6340
|
+
`Event '${configuration.id}' has no ${ActionType.NOTIFY} action.`
|
|
6341
|
+
);
|
|
6343
6342
|
}
|
|
6344
|
-
|
|
6345
|
-
derivedNotificationForms.set(configuration, derived);
|
|
6346
|
-
return derived;
|
|
6343
|
+
return notificationForm;
|
|
6347
6344
|
}
|
|
6348
6345
|
function getNotificationFields(configuration) {
|
|
6349
6346
|
return getNotificationForm(configuration).pages.flatMap(
|
|
6350
6347
|
({ fields }) => fields
|
|
6351
6348
|
);
|
|
6352
6349
|
}
|
|
6350
|
+
function getActionForm(configuration, actionType) {
|
|
6351
|
+
return actionType === ActionType.NOTIFY ? getNotificationForm(configuration) : getDeclaration(configuration);
|
|
6352
|
+
}
|
|
6353
6353
|
function isActionConfigType(type) {
|
|
6354
6354
|
return actionConfigTypes.has(type);
|
|
6355
6355
|
}
|
|
@@ -6605,15 +6605,12 @@ function flattenFieldReference(ref) {
|
|
|
6605
6605
|
return [ref.$$field, ...ref.$$subfield];
|
|
6606
6606
|
}
|
|
6607
6607
|
function isWriteAction(actionType) {
|
|
6608
|
-
return writeActions.
|
|
6608
|
+
return writeActions.validate(actionType);
|
|
6609
6609
|
}
|
|
6610
6610
|
var findAllFields = (config) => {
|
|
6611
6611
|
return (0, import_lodash4.flattenDeep)([
|
|
6612
6612
|
...getDeclarationFields(config),
|
|
6613
|
-
|
|
6614
|
-
...getConfiguredNotificationForm(config)?.pages.flatMap(
|
|
6615
|
-
({ fields }) => fields
|
|
6616
|
-
) ?? [],
|
|
6613
|
+
...findNotificationForm(config)?.pages.flatMap(({ fields }) => fields) ?? [],
|
|
6617
6614
|
...getAllAnnotationFields(config)
|
|
6618
6615
|
]);
|
|
6619
6616
|
};
|
|
@@ -6853,6 +6850,20 @@ function dropSecuredDeclarationFields(eventConfig, eventIndex, validatorContext)
|
|
|
6853
6850
|
}
|
|
6854
6851
|
|
|
6855
6852
|
// ../commons/src/events/eventConfigValidation.ts
|
|
6853
|
+
var SEARCH_DEFAULT_VALUE_FIELD_TYPES = [
|
|
6854
|
+
FieldType.TEXT,
|
|
6855
|
+
FieldType.TEXTAREA,
|
|
6856
|
+
FieldType.EMAIL,
|
|
6857
|
+
FieldType.PHONE,
|
|
6858
|
+
FieldType.ID,
|
|
6859
|
+
FieldType.SELECT,
|
|
6860
|
+
FieldType.RADIO_GROUP,
|
|
6861
|
+
FieldType.COUNTRY,
|
|
6862
|
+
FieldType.LOCATION,
|
|
6863
|
+
FieldType.ADMINISTRATIVE_AREA,
|
|
6864
|
+
FieldType.NUMBER,
|
|
6865
|
+
FieldType.DATE
|
|
6866
|
+
];
|
|
6856
6867
|
function validateAdvancedSearchConfig(event2, ctx) {
|
|
6857
6868
|
const allFields = findAllFields(event2);
|
|
6858
6869
|
const fieldIds = allFields.map((field3) => field3.id);
|
|
@@ -6884,6 +6895,56 @@ function validateAdvancedSearchConfig(event2, ctx) {
|
|
|
6884
6895
|
path: ["advancedSearch"]
|
|
6885
6896
|
});
|
|
6886
6897
|
}
|
|
6898
|
+
event2.advancedSearch.forEach((section, sectionIndex) => {
|
|
6899
|
+
section.fields.forEach((searchField, fieldIndex) => {
|
|
6900
|
+
if (searchField.fieldType !== "field" || searchField.defaultValue === void 0) {
|
|
6901
|
+
return;
|
|
6902
|
+
}
|
|
6903
|
+
const path = [
|
|
6904
|
+
"advancedSearch",
|
|
6905
|
+
sectionIndex,
|
|
6906
|
+
"fields",
|
|
6907
|
+
fieldIndex,
|
|
6908
|
+
"defaultValue"
|
|
6909
|
+
];
|
|
6910
|
+
if (searchField.config.searchFields && searchField.config.searchFields.length > 0) {
|
|
6911
|
+
ctx.addIssue({
|
|
6912
|
+
code: "custom",
|
|
6913
|
+
message: `Advanced search field ${searchField.fieldId} searches across several form fields, so it does not support a defaultValue.`,
|
|
6914
|
+
path
|
|
6915
|
+
});
|
|
6916
|
+
return;
|
|
6917
|
+
}
|
|
6918
|
+
if (typeof searchField.defaultValue === "boolean") {
|
|
6919
|
+
return;
|
|
6920
|
+
}
|
|
6921
|
+
const formField = allFields.find(({ id }) => id === searchField.fieldId);
|
|
6922
|
+
if (!formField) {
|
|
6923
|
+
return;
|
|
6924
|
+
}
|
|
6925
|
+
if (!SEARCH_DEFAULT_VALUE_FIELD_TYPES.some(
|
|
6926
|
+
(type) => type === formField.type
|
|
6927
|
+
)) {
|
|
6928
|
+
ctx.addIssue({
|
|
6929
|
+
code: "custom",
|
|
6930
|
+
message: `Advanced search field ${searchField.fieldId} is a ${formField.type} field, which does not support a defaultValue value, only true or false. Field types that support a defaultValue value: ${SEARCH_DEFAULT_VALUE_FIELD_TYPES.join(", ")}.`,
|
|
6931
|
+
path
|
|
6932
|
+
});
|
|
6933
|
+
} else if (formField.type === FieldType.DATE && searchField.config.type === "range") {
|
|
6934
|
+
ctx.addIssue({
|
|
6935
|
+
code: "custom",
|
|
6936
|
+
message: `Advanced search field ${searchField.fieldId} is searched as a date range, so its defaultValue can only be true or false.`,
|
|
6937
|
+
path
|
|
6938
|
+
});
|
|
6939
|
+
} else if (!mapFieldTypeToZod(formField).safeParse(searchField.defaultValue).success) {
|
|
6940
|
+
ctx.addIssue({
|
|
6941
|
+
code: "custom",
|
|
6942
|
+
message: `Advanced search field ${searchField.fieldId} has defaultValue "${searchField.defaultValue}", which is not a valid ${formField.type} value.`,
|
|
6943
|
+
path
|
|
6944
|
+
});
|
|
6945
|
+
}
|
|
6946
|
+
});
|
|
6947
|
+
});
|
|
6887
6948
|
}
|
|
6888
6949
|
function validateDateOfEvent(event2, ctx) {
|
|
6889
6950
|
if (event2.dateOfEvent && isFieldReference(event2.dateOfEvent)) {
|
|
@@ -7008,9 +7069,11 @@ function validateDeclarationGivenExactlyOnce(config, ctx) {
|
|
|
7008
7069
|
}
|
|
7009
7070
|
}
|
|
7010
7071
|
function validateNotificationForm(event2, ctx) {
|
|
7011
|
-
const declarationFields =
|
|
7072
|
+
const declarationFields = getDeclarationPages(event2).flatMap(
|
|
7073
|
+
(page) => page.fields.map((field3) => ({ field: field3, pageId: page.id }))
|
|
7074
|
+
);
|
|
7012
7075
|
event2.actions.forEach((action, actionIndex) => {
|
|
7013
|
-
if (action.type !== ActionType.NOTIFY
|
|
7076
|
+
if (action.type !== ActionType.NOTIFY) {
|
|
7014
7077
|
return;
|
|
7015
7078
|
}
|
|
7016
7079
|
action.notificationForm.pages.forEach((page, pageIndex) => {
|
|
@@ -7025,7 +7088,7 @@ function validateNotificationForm(event2, ctx) {
|
|
|
7025
7088
|
fieldIndex
|
|
7026
7089
|
];
|
|
7027
7090
|
const matchingFields = declarationFields.filter(
|
|
7028
|
-
(
|
|
7091
|
+
(declarationField) => declarationField.field.id === field3.id
|
|
7029
7092
|
);
|
|
7030
7093
|
if (matchingFields.length === 0) {
|
|
7031
7094
|
ctx.addIssue({
|
|
@@ -7035,10 +7098,13 @@ function validateNotificationForm(event2, ctx) {
|
|
|
7035
7098
|
});
|
|
7036
7099
|
return;
|
|
7037
7100
|
}
|
|
7038
|
-
if (!matchingFields.some(
|
|
7101
|
+
if (!matchingFields.some(
|
|
7102
|
+
(declarationField) => declarationField.field.type === field3.type
|
|
7103
|
+
)) {
|
|
7104
|
+
const [declarationField] = matchingFields;
|
|
7039
7105
|
ctx.addIssue({
|
|
7040
7106
|
code: "custom",
|
|
7041
|
-
message: `Notification form field '${field3.id}' is of type ${field3.type}, but the declaration form field with the same id in event '${event2.id}' is of type ${
|
|
7107
|
+
message: `Notification form field '${field3.id}' on page '${page.id}' is of type ${field3.type}, but the declaration form field with the same id in event '${event2.id}' (${ActionType.DECLARE} declaration, page '${declarationField.pageId}') is of type ${declarationField.field.type}.`,
|
|
7042
7108
|
path
|
|
7043
7109
|
});
|
|
7044
7110
|
}
|
|
@@ -7178,7 +7244,7 @@ function createSearchConfig(baseField) {
|
|
|
7178
7244
|
|
|
7179
7245
|
// ../commons/src/event-config/event-configuration.ts
|
|
7180
7246
|
function isNonSearchableEventMetadataTimeFieldId(fieldId) {
|
|
7181
|
-
return !EventFieldIdInput.
|
|
7247
|
+
return !EventFieldIdInput.validate(fieldId);
|
|
7182
7248
|
}
|
|
7183
7249
|
function createEventFieldConfig(fieldId) {
|
|
7184
7250
|
const baseField = {
|
|
@@ -7530,6 +7596,12 @@ var RegisterActionInput = BaseActionInput.extend(
|
|
|
7530
7596
|
var NotifyActionInput = BaseActionInput.extend(
|
|
7531
7597
|
z39.object({
|
|
7532
7598
|
type: z39.literal(ActionType.NOTIFY).default(ActionType.NOTIFY),
|
|
7599
|
+
declaration: BaseActionInput.shape.declaration.describe(
|
|
7600
|
+
"Values for fields of the notification form, keyed by field id. Fields outside the notification form are rejected. Only these values become part of the record declaration, so any id that needs to be searchable must be a declaration field."
|
|
7601
|
+
),
|
|
7602
|
+
annotation: BaseActionInput.shape.annotation.describe(
|
|
7603
|
+
"Values for notify-only fields (NOTIFY review and form fields), keyed by field id. These are stored on the NOTIFY action, not in the record declaration."
|
|
7604
|
+
),
|
|
7533
7605
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
7534
7606
|
createdAtLocation: UUID.nullish().describe(
|
|
7535
7607
|
"A valid office location ID. This is required for system users performing actions. The provided location must be a leaf-location, i.e. it must not have any children locations."
|
|
@@ -7713,17 +7785,19 @@ var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
|
|
|
7713
7785
|
/*
|
|
7714
7786
|
* A draft can name a file that no action references. Such a file stays until
|
|
7715
7787
|
* the record is deleted or the record's next action sweeps its prefix.
|
|
7716
|
-
*
|
|
7717
|
-
*
|
|
7718
|
-
* which is about to be declared or registered.
|
|
7788
|
+
* Drafts are therefore saved only on a created record, which can still be deleted.
|
|
7789
|
+
* The server refuses them on any other record.
|
|
7719
7790
|
*/
|
|
7720
|
-
type: z40.
|
|
7791
|
+
type: z40.enum([ActionTypes.enum.DECLARE, ActionTypes.enum.NOTIFY]),
|
|
7721
7792
|
status: z40.enum([
|
|
7722
7793
|
ActionStatus.Requested,
|
|
7723
7794
|
ActionStatus.Accepted,
|
|
7724
7795
|
ActionStatus.Rejected
|
|
7725
7796
|
])
|
|
7726
7797
|
});
|
|
7798
|
+
var RemoteDraft = Draft.extend({
|
|
7799
|
+
action: Draft.shape.action.extend({ type: DraftInput.shape.type })
|
|
7800
|
+
});
|
|
7727
7801
|
|
|
7728
7802
|
// ../commons/src/events/EventInput.ts
|
|
7729
7803
|
var z41 = __toESM(require("zod/v4"));
|
|
@@ -7772,57 +7846,44 @@ function moveDeclarationToDeclareAction({
|
|
|
7772
7846
|
)
|
|
7773
7847
|
};
|
|
7774
7848
|
}
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
(
|
|
7778
|
-
);
|
|
7779
|
-
const notifyAction = config.actions.find(
|
|
7780
|
-
(action) => action.type === ActionType.NOTIFY
|
|
7781
|
-
);
|
|
7782
|
-
if (!notifyAction?.notificationForm) {
|
|
7783
|
-
console.warn(
|
|
7784
|
-
`Event '${config.id}' has no ${ActionType.NOTIFY} form. Using the ${ActionType.DECLARE} form with all fields optional. Configure \`actions[${ActionType.NOTIFY}].notificationForm\`. This fallback will be removed in a future release.`
|
|
7785
|
-
);
|
|
7786
|
-
}
|
|
7787
|
-
if (notifyAction?.review) {
|
|
7788
|
-
return config;
|
|
7789
|
-
}
|
|
7790
|
-
if (!declareAction?.declaration) {
|
|
7791
|
-
throw new Error(
|
|
7792
|
-
`Event '${config.id}' has no ${ActionType.DECLARE} form. Configure \`actions[${ActionType.DECLARE}].declaration\`.`
|
|
7793
|
-
);
|
|
7849
|
+
var EventConfigDefinition = z43.custom().superRefine((config, ctx) => {
|
|
7850
|
+
if (validateExactlyOneDeclareAction(config, ctx)) {
|
|
7851
|
+
validateDeclarationGivenExactlyOnce(config, ctx);
|
|
7794
7852
|
}
|
|
7795
|
-
|
|
7796
|
-
|
|
7853
|
+
}).transform(moveDeclarationToDeclareAction).pipe(EventConfig);
|
|
7854
|
+
var defineConfig = (config) => EventConfigDefinition.parse(config);
|
|
7855
|
+
|
|
7856
|
+
// ../commons/src/events/toNotificationForm.ts
|
|
7857
|
+
function toOptionalField(field3) {
|
|
7858
|
+
const { validation: _validation, ...rest } = field3;
|
|
7859
|
+
if (rest.type === FieldType.FIELD_GROUP && "fields" in rest) {
|
|
7797
7860
|
return {
|
|
7798
|
-
...
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
)
|
|
7861
|
+
...rest,
|
|
7862
|
+
required: false,
|
|
7863
|
+
fields: rest.fields.map(toOptionalField)
|
|
7802
7864
|
};
|
|
7803
7865
|
}
|
|
7804
|
-
|
|
7805
|
-
|
|
7806
|
-
|
|
7807
|
-
|
|
7808
|
-
|
|
7809
|
-
|
|
7810
|
-
|
|
7811
|
-
|
|
7866
|
+
return { ...rest, required: false };
|
|
7867
|
+
}
|
|
7868
|
+
function toNotificationForm(declaration) {
|
|
7869
|
+
return {
|
|
7870
|
+
...declaration,
|
|
7871
|
+
pages: declaration.pages.map((page) => ({
|
|
7872
|
+
...page,
|
|
7873
|
+
fields: page.fields.map(
|
|
7874
|
+
toOptionalField
|
|
7875
|
+
)
|
|
7876
|
+
}))
|
|
7812
7877
|
};
|
|
7878
|
+
}
|
|
7879
|
+
function toNotificationReview(review) {
|
|
7813
7880
|
return {
|
|
7814
|
-
...
|
|
7815
|
-
|
|
7816
|
-
|
|
7881
|
+
...review,
|
|
7882
|
+
fields: review.fields.map(
|
|
7883
|
+
toOptionalField
|
|
7817
7884
|
)
|
|
7818
7885
|
};
|
|
7819
7886
|
}
|
|
7820
|
-
var EventConfigDefinition = z43.custom().superRefine((config, ctx) => {
|
|
7821
|
-
if (validateExactlyOneDeclareAction(config, ctx)) {
|
|
7822
|
-
validateDeclarationGivenExactlyOnce(config, ctx);
|
|
7823
|
-
}
|
|
7824
|
-
}).transform(moveDeclarationToDeclareAction).transform(generateNotificationFormFallback).pipe(EventConfig);
|
|
7825
|
-
var defineConfig = (config) => EventConfigDefinition.parse(config);
|
|
7826
7887
|
|
|
7827
7888
|
// ../commons/src/events/transactions.ts
|
|
7828
7889
|
function generateTransactionId() {
|
|
@@ -9139,6 +9200,8 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
9139
9200
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
|
9140
9201
|
id: "event.tennis-club-membership.action.notify.label"
|
|
9141
9202
|
},
|
|
9203
|
+
notificationForm: toNotificationForm(TENNIS_CLUB_DECLARATION_FORM),
|
|
9204
|
+
review: toNotificationReview(TENNIS_CLUB_DECLARATION_REVIEW),
|
|
9142
9205
|
flags: [
|
|
9143
9206
|
{
|
|
9144
9207
|
id: "health-worker-notified",
|
|
@@ -10606,8 +10669,8 @@ function userCanAccessEventWithScopes(event2, scopes, user2, customActionType) {
|
|
|
10606
10669
|
}
|
|
10607
10670
|
function getAdministrativeAreaHierarchy(administrativeAreaId, administrativeAreas) {
|
|
10608
10671
|
const collectedLocations = [];
|
|
10609
|
-
const
|
|
10610
|
-
let current =
|
|
10672
|
+
const maybeAdministrativeAreaId = maybeUuid(administrativeAreaId);
|
|
10673
|
+
let current = maybeAdministrativeAreaId ? administrativeAreas.get(maybeAdministrativeAreaId) : null;
|
|
10611
10674
|
while (current) {
|
|
10612
10675
|
collectedLocations.push(current);
|
|
10613
10676
|
if (!current.parentId) {
|
|
@@ -11207,11 +11270,10 @@ function fieldConfigsToActionPayload(fields, rng, administrativeHierarchy) {
|
|
|
11207
11270
|
);
|
|
11208
11271
|
}
|
|
11209
11272
|
function generateActionDeclarationInput(configuration, action, rng, overrides, administrativeHierarchy) {
|
|
11210
|
-
const parsed = DeclarationUpdateActions.safeParse(action);
|
|
11211
11273
|
if ((0, import_lodash5.isEmpty)(overrides) && typeof overrides === "object") {
|
|
11212
11274
|
return {};
|
|
11213
11275
|
}
|
|
11214
|
-
if (
|
|
11276
|
+
if (DeclarationUpdateActions.validate(action)) {
|
|
11215
11277
|
const fields = getDeclarationFields(configuration);
|
|
11216
11278
|
const declarationConfig = getDeclaration(configuration);
|
|
11217
11279
|
const declaration = fieldConfigsToActionPayload(
|
|
@@ -11715,6 +11777,7 @@ function generateEventDraftDocument({
|
|
|
11715
11777
|
transactionId: getUUID(),
|
|
11716
11778
|
action: {
|
|
11717
11779
|
...action,
|
|
11780
|
+
type: actionType,
|
|
11718
11781
|
declaration: {
|
|
11719
11782
|
...action.declaration,
|
|
11720
11783
|
...declaration
|
|
@@ -11850,8 +11913,7 @@ function withDeclaration(configuration, declaration) {
|
|
|
11850
11913
|
return { ...action, declaration };
|
|
11851
11914
|
}
|
|
11852
11915
|
if (action.type === ActionType.NOTIFY) {
|
|
11853
|
-
|
|
11854
|
-
return notifyAction;
|
|
11916
|
+
return { ...action, notificationForm: toNotificationForm(declaration) };
|
|
11855
11917
|
}
|
|
11856
11918
|
return action;
|
|
11857
11919
|
})
|
|
@@ -11918,7 +11980,7 @@ function isTemplateVariable(value) {
|
|
|
11918
11980
|
return typeof value === "string" && value.startsWith("$");
|
|
11919
11981
|
}
|
|
11920
11982
|
function isFieldValue(value) {
|
|
11921
|
-
return FieldValue.
|
|
11983
|
+
return FieldValue.validate(value);
|
|
11922
11984
|
}
|
|
11923
11985
|
function isFieldValueWithoutTemplates(value) {
|
|
11924
11986
|
if (isTemplateVariable(value)) {
|
|
@@ -11961,6 +12023,8 @@ var ACTION_SCOPE_MAP = {
|
|
|
11961
12023
|
"record.correct"
|
|
11962
12024
|
],
|
|
11963
12025
|
[ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: ["record.correct"],
|
|
12026
|
+
// Not granted by a scope: the client checks the draft's own action instead
|
|
12027
|
+
[ClientSpecificAction.CONTINUE_DRAFT]: [],
|
|
11964
12028
|
[ActionType.REJECT_CORRECTION]: ["record.correct"],
|
|
11965
12029
|
[ActionType.APPROVE_CORRECTION]: ["record.correct"],
|
|
11966
12030
|
[ActionType.REVOKE_REGISTRATION]: ["record.revoke-registration"],
|
|
@@ -12270,13 +12334,11 @@ function getFilePathsFromEvent(event2) {
|
|
|
12270
12334
|
...declarationValues,
|
|
12271
12335
|
...annotationValues
|
|
12272
12336
|
].flatMap((value) => {
|
|
12273
|
-
|
|
12274
|
-
|
|
12275
|
-
return [fileParsed.data.path];
|
|
12337
|
+
if (isFileFieldValue(value)) {
|
|
12338
|
+
return [value.path];
|
|
12276
12339
|
}
|
|
12277
|
-
|
|
12278
|
-
|
|
12279
|
-
return fileOptionParsed.data.map((val) => val.path);
|
|
12340
|
+
if (isFileFieldWithOptionValue(value)) {
|
|
12341
|
+
return value.map((val) => val.path);
|
|
12280
12342
|
}
|
|
12281
12343
|
return [];
|
|
12282
12344
|
});
|