@opencrvs/toolkit 2.2.0-rc.045257f → 2.2.0-rc.19ec10b
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 +16 -5
- package/dist/authentication/index.d.ts +1 -1
- package/dist/authentication/index.js +4 -8
- package/dist/cli.js +927 -356
- package/dist/commons/api/router.d.ts +17 -4
- package/dist/commons/application-config/index.d.ts +1 -1
- package/dist/commons/conditionals/conditionals.d.ts +55 -4
- package/dist/commons/conditionals/validate.d.ts +1 -1
- 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/Draft.d.ts +34 -1
- package/dist/commons/events/EventConfig.d.ts +446 -0
- package/dist/commons/events/EventDocument.d.ts +2 -0
- package/dist/commons/events/EventIndex.d.ts +1 -0
- package/dist/commons/events/EventInput.d.ts +1 -0
- package/dist/commons/events/EventMetadata.d.ts +1 -0
- package/dist/commons/events/FieldTypeMapping.d.ts +19 -19
- package/dist/commons/events/PlainDate.d.ts +5 -0
- package/dist/commons/events/defineConfig.d.ts +7 -2
- package/dist/commons/events/event.d.ts +20 -1
- package/dist/commons/events/field.d.ts +37 -0
- package/dist/commons/events/locations.d.ts +1 -1
- package/dist/commons/events/scopes.d.ts +2 -1
- package/dist/commons/events/state/index.d.ts +1 -0
- package/dist/commons/events/test.utils.d.ts +59 -6
- package/dist/commons/events/utils.d.ts +28 -2
- 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 +13 -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 +8 -0
- package/dist/environment/derived-variables.d.ts.map +1 -1
- package/dist/environment/derived-variables.js +9 -0
- 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 +104 -23
- package/dist/events/index.js +1627 -1100
- 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 +602 -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/resolve-versioned-event-config.d.ts +56 -0
- package/dist/migrations/resolve-versioned-event-config.d.ts.map +1 -0
- package/dist/migrations/resolve-versioned-event-config.js +353 -0
- 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 +707 -119
- package/dist/roles/index.d.ts +2 -0
- package/dist/roles/index.d.ts.map +1 -0
- package/dist/roles/index.js +730 -0
- package/dist/scopes/index.d.ts +0 -10
- package/dist/scopes/index.js +3 -7
- package/dist/templates/charts-values/dependencies/values.yaml +5 -2
- package/dist/templates/charts-values/opencrvs-services/values.yaml +2 -5
- package/dist/verify/endpoints.d.ts +11 -0
- package/dist/verify/endpoints.d.ts.map +1 -1
- package/dist/verify/endpoints.js +21 -27
- package/opencrvs-toolkit-2.2.0-rc.19ec10b.tgz +0 -0
- package/package.json +4 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/tsconfig.json +3 -5
- 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.045257f.tgz +0 -0
|
@@ -46,11 +46,11 @@ var import_compile = require("zod/compile");
|
|
|
46
46
|
// ../commons/src/events/AuditLog.ts
|
|
47
47
|
var z9 = __toESM(require("zod/v4"));
|
|
48
48
|
|
|
49
|
-
// ../commons/src/authentication.ts
|
|
49
|
+
// ../commons/src/users/authentication.ts
|
|
50
50
|
var import_jwt_decode = __toESM(require("jwt-decode"));
|
|
51
51
|
var z8 = __toESM(require("zod/v4"));
|
|
52
52
|
|
|
53
|
-
// ../commons/src/scopes.ts
|
|
53
|
+
// ../commons/src/users/scopes.ts
|
|
54
54
|
var z7 = __toESM(require("zod/v4"));
|
|
55
55
|
var qs = __toESM(require("qs"));
|
|
56
56
|
|
|
@@ -136,7 +136,9 @@ var ActionTypes = z2.enum([
|
|
|
136
136
|
"CUSTOM"
|
|
137
137
|
]);
|
|
138
138
|
var ClientSpecificAction = {
|
|
139
|
-
REVIEW_CORRECTION_REQUEST: "REVIEW_CORRECTION_REQUEST"
|
|
139
|
+
REVIEW_CORRECTION_REQUEST: "REVIEW_CORRECTION_REQUEST",
|
|
140
|
+
/** Opens the user's declare or notify draft of the event in its own flow */
|
|
141
|
+
CONTINUE_DRAFT: "CONTINUE_DRAFT"
|
|
140
142
|
};
|
|
141
143
|
var declarationActionValues = [
|
|
142
144
|
ActionTypes.enum.DECLARE,
|
|
@@ -328,7 +330,7 @@ var EventStatus = z6.enum([
|
|
|
328
330
|
"ARCHIVED"
|
|
329
331
|
]);
|
|
330
332
|
|
|
331
|
-
// ../commons/src/scopes.ts
|
|
333
|
+
// ../commons/src/users/scopes.ts
|
|
332
334
|
var JurisdictionFilter = z7.enum(["administrativeArea", "location", "all"]).describe(
|
|
333
335
|
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
334
336
|
);
|
|
@@ -601,7 +603,7 @@ var DEFAULT_SCOPE_OPTIONS = {
|
|
|
601
603
|
registeredIn: JurisdictionFilter.enum.all
|
|
602
604
|
};
|
|
603
605
|
|
|
604
|
-
// ../commons/src/authentication.ts
|
|
606
|
+
// ../commons/src/users/authentication.ts
|
|
605
607
|
var TokenUserType = z8.enum(["user", "system"]);
|
|
606
608
|
var TokenWithBearer = z8.string().regex(/^Bearer\s/);
|
|
607
609
|
|
|
@@ -1106,6 +1108,26 @@ var CustomFieldValue = z12.unknown().brand("CustomFieldValue");
|
|
|
1106
1108
|
// ../commons/src/events/PlainDate.ts
|
|
1107
1109
|
var import_zod = require("zod");
|
|
1108
1110
|
var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date in the format YYYY-MM-DD");
|
|
1111
|
+
var dateFormats = /* @__PURE__ */ new Map();
|
|
1112
|
+
function getDateFormat(timeZone) {
|
|
1113
|
+
let format2 = dateFormats.get(timeZone);
|
|
1114
|
+
if (!format2) {
|
|
1115
|
+
format2 = new Intl.DateTimeFormat("en-US", {
|
|
1116
|
+
timeZone,
|
|
1117
|
+
year: "numeric",
|
|
1118
|
+
month: "2-digit",
|
|
1119
|
+
day: "2-digit"
|
|
1120
|
+
});
|
|
1121
|
+
dateFormats.set(timeZone, format2);
|
|
1122
|
+
}
|
|
1123
|
+
return format2;
|
|
1124
|
+
}
|
|
1125
|
+
function toPlainDateInTimeZone(date, timeZone) {
|
|
1126
|
+
const parts = Object.fromEntries(
|
|
1127
|
+
getDateFormat(timeZone).formatToParts(date).map(({ type, value }) => [type, value])
|
|
1128
|
+
);
|
|
1129
|
+
return `${parts.year}-${parts.month}-${parts.day}`;
|
|
1130
|
+
}
|
|
1109
1131
|
|
|
1110
1132
|
// ../commons/src/events/FieldValue.ts
|
|
1111
1133
|
var TextValue = z14.string();
|
|
@@ -1542,6 +1564,9 @@ var LegalStatuses = z17.object({
|
|
|
1542
1564
|
var EventMetadata = z17.object({
|
|
1543
1565
|
id: UUID,
|
|
1544
1566
|
type: z17.string().describe("The type of event, such as birth, death, or marriage."),
|
|
1567
|
+
configVersionId: z17.string().describe(
|
|
1568
|
+
"Id of the event configuration version the record was created under. Records created before versioning have 'initial'."
|
|
1569
|
+
),
|
|
1545
1570
|
status: EventStatus,
|
|
1546
1571
|
legalStatuses: LegalStatuses.describe(
|
|
1547
1572
|
"Metadata related to the legal registration of the event, such as who registered it and when."
|
|
@@ -3097,7 +3122,7 @@ var ActionConfig = z25.discriminatedUnion("type", [
|
|
|
3097
3122
|
}),
|
|
3098
3123
|
NotifyConfig.meta({
|
|
3099
3124
|
id: "NotifyActionConfig",
|
|
3100
|
-
description: "Configuration for the notify action
|
|
3125
|
+
description: "Configuration for the notify action: the notification form and its review page. An event without a NOTIFY action cannot be notified."
|
|
3101
3126
|
}),
|
|
3102
3127
|
DeclareConfig.meta({
|
|
3103
3128
|
id: "DeclareActionConfig",
|
|
@@ -3365,7 +3390,7 @@ var ReferenceField = BaseField2.extend({
|
|
|
3365
3390
|
var Field = BaseField2.extend({
|
|
3366
3391
|
id: z29.string().describe("Identifier of the summary field."),
|
|
3367
3392
|
value: TranslationConfig.describe(
|
|
3368
|
-
'Field value template supports variables from configuration (e.g. "{informant.phoneNo} {informant.email}") and EventMetadata (e.g. "{event.legalStatuses.REGISTERED.acceptedAt, date, ::dd MMMM yyyy}").'
|
|
3393
|
+
'Field value template supports variables from configuration (e.g. "{informant.phoneNo} {informant.email}") and EventMetadata (e.g. "{event.legalStatuses.REGISTERED.acceptedAt, date, ::dd MMMM yyyy}"). "{event.configVersionLabel}" gives the label of the configuration version that the record was created under.'
|
|
3369
3394
|
),
|
|
3370
3395
|
label: TranslationConfig
|
|
3371
3396
|
}).describe("Custom field defined for the summary view.");
|
|
@@ -3460,7 +3485,10 @@ var SearchQueryParams = z30.object({
|
|
|
3460
3485
|
}).catchall(FieldValue);
|
|
3461
3486
|
var FieldConfigSchema = BaseField3.extend({
|
|
3462
3487
|
fieldId: z30.string(),
|
|
3463
|
-
fieldType: z30.literal("field")
|
|
3488
|
+
fieldType: z30.literal("field"),
|
|
3489
|
+
defaultValue: z30.union([z30.boolean(), z30.string(), z30.number()]).optional().describe(
|
|
3490
|
+
`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.`
|
|
3491
|
+
)
|
|
3464
3492
|
});
|
|
3465
3493
|
var EventFieldIdInput = z30.enum([
|
|
3466
3494
|
"trackingId",
|
|
@@ -3509,32 +3537,20 @@ var AdvancedSearchConfig = z30.object({
|
|
|
3509
3537
|
description: "Configuration of one advanced search tab. Each tab has a title and a list of searchable fields \u2014 either declaration fields (via `field()`) or event metadata (via `event()`)."
|
|
3510
3538
|
});
|
|
3511
3539
|
|
|
3512
|
-
// ../commons/src/events/utils.ts
|
|
3513
|
-
var import_lodash4 = require("lodash");
|
|
3514
|
-
|
|
3515
|
-
// ../commons/src/conditionals/validate.ts
|
|
3516
|
-
var import__ = __toESM(require("ajv/dist/2019"));
|
|
3517
|
-
var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
3518
|
-
var z34 = __toESM(require("zod/v4"));
|
|
3519
|
-
var import_date_fns2 = require("date-fns");
|
|
3520
|
-
|
|
3521
|
-
// ../commons/src/events/FieldTypeMapping.ts
|
|
3522
|
-
var z32 = __toESM(require("zod/v4"));
|
|
3523
|
-
|
|
3524
|
-
// ../commons/src/events/DynamicFieldValue.ts
|
|
3525
|
-
var z31 = __toESM(require("zod/v4"));
|
|
3526
|
-
|
|
3527
|
-
// ../commons/src/events/state/index.ts
|
|
3528
|
-
var import_lodash3 = require("lodash");
|
|
3529
|
-
|
|
3530
3540
|
// ../commons/src/utils.ts
|
|
3531
|
-
var
|
|
3541
|
+
var z31 = __toESM(require("zod/v4"));
|
|
3532
3542
|
var _ = __toESM(require("lodash"));
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3543
|
+
function getOrThrow(x, message) {
|
|
3544
|
+
if (x === void 0 || x === null) {
|
|
3545
|
+
throw new Error(message);
|
|
3546
|
+
}
|
|
3547
|
+
return x;
|
|
3548
|
+
}
|
|
3549
|
+
var FullNameV1 = z31.array(
|
|
3550
|
+
z31.object({
|
|
3551
|
+
use: z31.string(),
|
|
3552
|
+
family: z31.string(),
|
|
3553
|
+
given: z31.array(z31.string())
|
|
3538
3554
|
})
|
|
3539
3555
|
);
|
|
3540
3556
|
function omitKeyDeep(obj, keyToRemove) {
|
|
@@ -3553,58 +3569,14 @@ function omitKeyDeep(obj, keyToRemove) {
|
|
|
3553
3569
|
return newObj;
|
|
3554
3570
|
}
|
|
3555
3571
|
|
|
3556
|
-
// ../commons/src/events/
|
|
3557
|
-
var
|
|
3558
|
-
var updateActions = new Set(
|
|
3559
|
-
ActionTypes.extract([
|
|
3560
|
-
ActionType.CREATE,
|
|
3561
|
-
ActionType.NOTIFY,
|
|
3562
|
-
ActionType.EDIT,
|
|
3563
|
-
ActionType.DECLARE,
|
|
3564
|
-
ActionType.REGISTER,
|
|
3565
|
-
ActionType.REJECT,
|
|
3566
|
-
ActionType.ARCHIVE,
|
|
3567
|
-
ActionType.UNARCHIVE,
|
|
3568
|
-
ActionType.PRINT_CERTIFICATE,
|
|
3569
|
-
ActionType.REQUEST_CORRECTION,
|
|
3570
|
-
ActionType.APPROVE_CORRECTION,
|
|
3571
|
-
ActionType.REJECT_CORRECTION,
|
|
3572
|
-
ActionType.REVOKE_REGISTRATION,
|
|
3573
|
-
ActionType.REINSTATE_REGISTRATION,
|
|
3574
|
-
ActionType.CUSTOM
|
|
3575
|
-
]).options
|
|
3576
|
-
);
|
|
3572
|
+
// ../commons/src/events/utils.ts
|
|
3573
|
+
var import_lodash4 = require("lodash");
|
|
3577
3574
|
|
|
3578
|
-
// ../commons/src/
|
|
3579
|
-
var
|
|
3580
|
-
var
|
|
3581
|
-
var
|
|
3582
|
-
|
|
3583
|
-
flag: InherentFlags.CORRECTION_REQUESTED,
|
|
3584
|
-
setOn: [ActionType.REQUEST_CORRECTION],
|
|
3585
|
-
resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
|
|
3586
|
-
},
|
|
3587
|
-
{
|
|
3588
|
-
flag: InherentFlags.REJECTED,
|
|
3589
|
-
setOn: [ActionType.REJECT],
|
|
3590
|
-
resetOn: [
|
|
3591
|
-
ActionType.NOTIFY,
|
|
3592
|
-
ActionType.DECLARE,
|
|
3593
|
-
ActionType.EDIT,
|
|
3594
|
-
ActionType.REGISTER
|
|
3595
|
-
]
|
|
3596
|
-
},
|
|
3597
|
-
{
|
|
3598
|
-
flag: InherentFlags.POTENTIAL_DUPLICATE,
|
|
3599
|
-
setOn: [ActionType.DUPLICATE_DETECTED],
|
|
3600
|
-
resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
|
|
3601
|
-
},
|
|
3602
|
-
{
|
|
3603
|
-
flag: InherentFlags.EDIT_IN_PROGRESS,
|
|
3604
|
-
setOn: [ActionType.EDIT],
|
|
3605
|
-
resetOnAnyOtherAction: true
|
|
3606
|
-
}
|
|
3607
|
-
];
|
|
3575
|
+
// ../commons/src/conditionals/validate.ts
|
|
3576
|
+
var import__ = __toESM(require("ajv/dist/2019"));
|
|
3577
|
+
var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
3578
|
+
var z34 = __toESM(require("zod/v4"));
|
|
3579
|
+
var import_date_fns2 = require("date-fns");
|
|
3608
3580
|
|
|
3609
3581
|
// ../commons/src/conditionals/conditionals.ts
|
|
3610
3582
|
var objectHash = __toESM(require("object-hash"));
|
|
@@ -3728,6 +3700,9 @@ var user = Object.assign(userSerializer, {
|
|
|
3728
3700
|
function isFieldReference(value) {
|
|
3729
3701
|
return typeof value === "object" && value !== null && "$$field" in value;
|
|
3730
3702
|
}
|
|
3703
|
+
function isActionDateReference(value) {
|
|
3704
|
+
return typeof value === "object" && value !== null && "$action" in value;
|
|
3705
|
+
}
|
|
3731
3706
|
function getDateRangeToFieldReference(field3, comparedField, clause) {
|
|
3732
3707
|
return {
|
|
3733
3708
|
type: "object",
|
|
@@ -3915,7 +3890,9 @@ function createFieldConditionals(fieldId) {
|
|
|
3915
3890
|
},
|
|
3916
3891
|
fromNow: () => {
|
|
3917
3892
|
return defineFormConditional(getDayRange(this, days, "after"));
|
|
3918
|
-
}
|
|
3893
|
+
},
|
|
3894
|
+
beforeAction: (action) => defineFormConditional(getDayRange(this, -days, "after", action)),
|
|
3895
|
+
afterAction: (action) => defineFormConditional(getDayRange(this, days, "after", action))
|
|
3919
3896
|
}),
|
|
3920
3897
|
date: (date) => {
|
|
3921
3898
|
if (isFieldReference(date)) {
|
|
@@ -3956,7 +3933,9 @@ function createFieldConditionals(fieldId) {
|
|
|
3956
3933
|
},
|
|
3957
3934
|
fromNow: () => {
|
|
3958
3935
|
return defineFormConditional(getDayRange(this, -days, "before"));
|
|
3959
|
-
}
|
|
3936
|
+
},
|
|
3937
|
+
beforeAction: (action) => defineFormConditional(getDayRange(this, -days, "before", action)),
|
|
3938
|
+
afterAction: (action) => defineFormConditional(getDayRange(this, days, "before", action))
|
|
3960
3939
|
}),
|
|
3961
3940
|
date: (date) => {
|
|
3962
3941
|
if (isFieldReference(date)) {
|
|
@@ -4240,6 +4219,206 @@ function createFieldConditionals(fieldId) {
|
|
|
4240
4219
|
};
|
|
4241
4220
|
}
|
|
4242
4221
|
|
|
4222
|
+
// ../commons/src/events/FieldTypeMapping.ts
|
|
4223
|
+
var z33 = __toESM(require("zod/v4"));
|
|
4224
|
+
|
|
4225
|
+
// ../commons/src/events/DynamicFieldValue.ts
|
|
4226
|
+
var z32 = __toESM(require("zod/v4"));
|
|
4227
|
+
function getDynamicNameValue(field3) {
|
|
4228
|
+
const nameConfiguration = field3.configuration?.name;
|
|
4229
|
+
const firstnameRequired = nameConfiguration?.firstname?.required ?? field3.required;
|
|
4230
|
+
const surnameRequired = nameConfiguration?.surname?.required ?? field3.required;
|
|
4231
|
+
return z32.object({
|
|
4232
|
+
firstname: firstnameRequired ? NonEmptyTextValue : TextValue,
|
|
4233
|
+
surname: surnameRequired ? NonEmptyTextValue : TextValue,
|
|
4234
|
+
middlename: nameConfiguration?.middlename?.required ? NonEmptyTextValue : TextValue.optional()
|
|
4235
|
+
});
|
|
4236
|
+
}
|
|
4237
|
+
function getDynamicAddressFieldValue(field3) {
|
|
4238
|
+
const schema = field3.required ? AddressFieldValue : AddressFieldUpdateValue;
|
|
4239
|
+
const configIds = field3.configuration?.streetAddressForm?.map((a) => a.id) ?? [];
|
|
4240
|
+
return schema.refine((arg) => {
|
|
4241
|
+
if (!arg) {
|
|
4242
|
+
return true;
|
|
4243
|
+
}
|
|
4244
|
+
const submittedKeys = Object.keys(arg.streetLevelDetails ?? {});
|
|
4245
|
+
const invalidKeys = submittedKeys.filter((k) => !configIds.includes(k));
|
|
4246
|
+
if (invalidKeys.length) {
|
|
4247
|
+
console.log(
|
|
4248
|
+
"Invalid streetLevelDetails: unknown keys",
|
|
4249
|
+
JSON.stringify(invalidKeys, null, 2)
|
|
4250
|
+
);
|
|
4251
|
+
return false;
|
|
4252
|
+
}
|
|
4253
|
+
return true;
|
|
4254
|
+
});
|
|
4255
|
+
}
|
|
4256
|
+
|
|
4257
|
+
// ../commons/src/events/FieldTypeMapping.ts
|
|
4258
|
+
function mapFieldTypeToZod(field3, actionType) {
|
|
4259
|
+
let schema;
|
|
4260
|
+
switch (field3.type) {
|
|
4261
|
+
case FieldType.FIELD_GROUP: {
|
|
4262
|
+
schema = z33.object(
|
|
4263
|
+
field3.fields.reduce((acc, subfield) => {
|
|
4264
|
+
acc[subfield.id] = mapFieldTypeToZod(subfield, actionType);
|
|
4265
|
+
return acc;
|
|
4266
|
+
}, {})
|
|
4267
|
+
);
|
|
4268
|
+
break;
|
|
4269
|
+
}
|
|
4270
|
+
case FieldType.DATE:
|
|
4271
|
+
schema = PlainDate;
|
|
4272
|
+
break;
|
|
4273
|
+
case FieldType.AGE:
|
|
4274
|
+
schema = AgeValue;
|
|
4275
|
+
break;
|
|
4276
|
+
case FieldType.TIME:
|
|
4277
|
+
schema = TimeValue;
|
|
4278
|
+
break;
|
|
4279
|
+
case FieldType.EMAIL:
|
|
4280
|
+
schema = EmailValue;
|
|
4281
|
+
break;
|
|
4282
|
+
case FieldType.DATE_RANGE:
|
|
4283
|
+
schema = DateRangeFieldValue;
|
|
4284
|
+
break;
|
|
4285
|
+
case FieldType.SELECT_DATE_RANGE:
|
|
4286
|
+
schema = SelectDateRangeValue;
|
|
4287
|
+
break;
|
|
4288
|
+
case FieldType.TEXT:
|
|
4289
|
+
case FieldType.TEXTAREA:
|
|
4290
|
+
case FieldType.DIVIDER:
|
|
4291
|
+
case FieldType.BULLET_LIST:
|
|
4292
|
+
case FieldType.PAGE_HEADER:
|
|
4293
|
+
case FieldType.LOCATION:
|
|
4294
|
+
case FieldType.SELECT:
|
|
4295
|
+
case FieldType.COUNTRY:
|
|
4296
|
+
case FieldType.RADIO_GROUP:
|
|
4297
|
+
case FieldType.PARAGRAPH:
|
|
4298
|
+
case FieldType.HEADING:
|
|
4299
|
+
case FieldType.IMAGE_VIEW:
|
|
4300
|
+
case FieldType.ADMINISTRATIVE_AREA:
|
|
4301
|
+
case FieldType.FACILITY:
|
|
4302
|
+
case FieldType.OFFICE:
|
|
4303
|
+
case FieldType.PHONE:
|
|
4304
|
+
case FieldType.LINK_BUTTON:
|
|
4305
|
+
case FieldType.VERIFICATION_STATUS:
|
|
4306
|
+
case FieldType.ID:
|
|
4307
|
+
case FieldType.LOADER:
|
|
4308
|
+
case FieldType.ALPHA_HIDDEN:
|
|
4309
|
+
case FieldType.USER_ROLE:
|
|
4310
|
+
schema = field3.required ? NonEmptyTextValue : TextValue;
|
|
4311
|
+
break;
|
|
4312
|
+
case FieldType.NUMBER:
|
|
4313
|
+
schema = NumberFieldValue;
|
|
4314
|
+
break;
|
|
4315
|
+
case FieldType.NUMBER_WITH_UNIT:
|
|
4316
|
+
schema = field3.required ? NumberWithUnitFieldValue : NumberWithUnitFieldUpdateValue;
|
|
4317
|
+
break;
|
|
4318
|
+
case FieldType.CHECKBOX:
|
|
4319
|
+
schema = CheckboxFieldValue;
|
|
4320
|
+
break;
|
|
4321
|
+
case FieldType.SIGNATURE:
|
|
4322
|
+
case FieldType.FILE:
|
|
4323
|
+
schema = FileFieldValue;
|
|
4324
|
+
break;
|
|
4325
|
+
case FieldType.FILE_WITH_OPTIONS:
|
|
4326
|
+
schema = field3.required ? FileFieldWithOptionValue.min(1) : FileFieldWithOptionValue;
|
|
4327
|
+
break;
|
|
4328
|
+
case FieldType.ADDRESS:
|
|
4329
|
+
schema = getDynamicAddressFieldValue(field3);
|
|
4330
|
+
break;
|
|
4331
|
+
case FieldType.DATA:
|
|
4332
|
+
schema = DataFieldValue;
|
|
4333
|
+
break;
|
|
4334
|
+
case FieldType.NAME:
|
|
4335
|
+
schema = actionType === ActionType.NOTIFY ? NameFieldUpdateValue : getDynamicNameValue(field3);
|
|
4336
|
+
break;
|
|
4337
|
+
case FieldType.BUTTON:
|
|
4338
|
+
schema = ButtonFieldValue;
|
|
4339
|
+
break;
|
|
4340
|
+
case FieldType.ALPHA_PRINT_BUTTON:
|
|
4341
|
+
schema = TextValue;
|
|
4342
|
+
break;
|
|
4343
|
+
case FieldType.AUTOCOMPLETE:
|
|
4344
|
+
schema = AutocompleteValue;
|
|
4345
|
+
break;
|
|
4346
|
+
case FieldType.HTTP:
|
|
4347
|
+
case FieldType.SEARCH:
|
|
4348
|
+
schema = HttpFieldUpdateValue;
|
|
4349
|
+
break;
|
|
4350
|
+
case FieldType.QUERY_PARAM_READER:
|
|
4351
|
+
schema = QueryParamReaderFieldUpdateValue;
|
|
4352
|
+
break;
|
|
4353
|
+
case FieldType.QR_READER:
|
|
4354
|
+
schema = QrReaderFieldValue;
|
|
4355
|
+
break;
|
|
4356
|
+
case FieldType.ID_READER:
|
|
4357
|
+
schema = IdReaderFieldValue;
|
|
4358
|
+
break;
|
|
4359
|
+
case FieldType._EXPERIMENTAL_CUSTOM:
|
|
4360
|
+
schema = CustomFieldValue;
|
|
4361
|
+
break;
|
|
4362
|
+
}
|
|
4363
|
+
return field3.required ? schema : schema.nullish();
|
|
4364
|
+
}
|
|
4365
|
+
|
|
4366
|
+
// ../commons/src/events/state/index.ts
|
|
4367
|
+
var import_lodash3 = require("lodash");
|
|
4368
|
+
|
|
4369
|
+
// ../commons/src/events/state/utils.ts
|
|
4370
|
+
var import_lodash = require("lodash");
|
|
4371
|
+
var updateActions = new Set(
|
|
4372
|
+
ActionTypes.extract([
|
|
4373
|
+
ActionType.CREATE,
|
|
4374
|
+
ActionType.NOTIFY,
|
|
4375
|
+
ActionType.EDIT,
|
|
4376
|
+
ActionType.DECLARE,
|
|
4377
|
+
ActionType.REGISTER,
|
|
4378
|
+
ActionType.REJECT,
|
|
4379
|
+
ActionType.ARCHIVE,
|
|
4380
|
+
ActionType.UNARCHIVE,
|
|
4381
|
+
ActionType.PRINT_CERTIFICATE,
|
|
4382
|
+
ActionType.REQUEST_CORRECTION,
|
|
4383
|
+
ActionType.APPROVE_CORRECTION,
|
|
4384
|
+
ActionType.REJECT_CORRECTION,
|
|
4385
|
+
ActionType.REVOKE_REGISTRATION,
|
|
4386
|
+
ActionType.REINSTATE_REGISTRATION,
|
|
4387
|
+
ActionType.CUSTOM
|
|
4388
|
+
]).options
|
|
4389
|
+
);
|
|
4390
|
+
|
|
4391
|
+
// ../commons/src/events/state/flags.ts
|
|
4392
|
+
var import_lodash2 = require("lodash");
|
|
4393
|
+
var import_date_fns = require("date-fns");
|
|
4394
|
+
var INHERENT_FLAG_RULES = [
|
|
4395
|
+
{
|
|
4396
|
+
flag: InherentFlags.CORRECTION_REQUESTED,
|
|
4397
|
+
setOn: [ActionType.REQUEST_CORRECTION],
|
|
4398
|
+
resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
|
|
4399
|
+
},
|
|
4400
|
+
{
|
|
4401
|
+
flag: InherentFlags.REJECTED,
|
|
4402
|
+
setOn: [ActionType.REJECT],
|
|
4403
|
+
resetOn: [
|
|
4404
|
+
ActionType.NOTIFY,
|
|
4405
|
+
ActionType.DECLARE,
|
|
4406
|
+
ActionType.EDIT,
|
|
4407
|
+
ActionType.REGISTER
|
|
4408
|
+
]
|
|
4409
|
+
},
|
|
4410
|
+
{
|
|
4411
|
+
flag: InherentFlags.POTENTIAL_DUPLICATE,
|
|
4412
|
+
setOn: [ActionType.DUPLICATE_DETECTED],
|
|
4413
|
+
resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
|
|
4414
|
+
},
|
|
4415
|
+
{
|
|
4416
|
+
flag: InherentFlags.EDIT_IN_PROGRESS,
|
|
4417
|
+
setOn: [ActionType.EDIT],
|
|
4418
|
+
resetOnAnyOtherAction: true
|
|
4419
|
+
}
|
|
4420
|
+
];
|
|
4421
|
+
|
|
4243
4422
|
// ../commons/src/conditionals/validate.ts
|
|
4244
4423
|
var ajv = new import__.default({
|
|
4245
4424
|
$data: true,
|
|
@@ -4273,6 +4452,15 @@ function resolveDataPath(rootData, dataPath, instancePath) {
|
|
|
4273
4452
|
}
|
|
4274
4453
|
return current;
|
|
4275
4454
|
}
|
|
4455
|
+
function resolveActionDate(event2, { match, occurrence }) {
|
|
4456
|
+
const dates = (event2?.actions ?? []).filter(({ status: status2 }) => status2 === ActionStatus.Accepted).filter(
|
|
4457
|
+
(action) => match.some(
|
|
4458
|
+
({ type, customActionType }) => action.type === type && (!customActionType || "customActionType" in action && action.customActionType === customActionType)
|
|
4459
|
+
)
|
|
4460
|
+
).map(({ createdAt }) => createdAt).sort();
|
|
4461
|
+
const date = occurrence === "first" ? dates[0] : dates[dates.length - 1];
|
|
4462
|
+
return date && (0, import_date_fns2.formatISO)((0, import_date_fns2.parseISO)(date), { representation: "date" });
|
|
4463
|
+
}
|
|
4276
4464
|
function todayISO() {
|
|
4277
4465
|
return (0, import_date_fns2.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
|
|
4278
4466
|
}
|
|
@@ -4294,7 +4482,9 @@ function buildClientFunctionContext(input) {
|
|
|
4294
4482
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
4295
4483
|
$online: isOnline(),
|
|
4296
4484
|
$user: input.validatorContext?.user,
|
|
4297
|
-
$event: input.validatorContext?.event?.document
|
|
4485
|
+
$event: input.validatorContext?.event?.document ? getEventWithCompleteAcceptedActions(
|
|
4486
|
+
input.validatorContext.event.document
|
|
4487
|
+
) : void 0,
|
|
4298
4488
|
$leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
|
|
4299
4489
|
user: input.systemVariables?.user,
|
|
4300
4490
|
$window: input.systemVariables?.$window,
|
|
@@ -4324,6 +4514,10 @@ ajv.addKeyword({
|
|
|
4324
4514
|
return false;
|
|
4325
4515
|
}
|
|
4326
4516
|
let referenceDate = schema.referenceDate;
|
|
4517
|
+
if (isActionDateReference(referenceDate)) {
|
|
4518
|
+
const rootData = dataContext.rootData;
|
|
4519
|
+
referenceDate = resolveActionDate(rootData.$event, referenceDate.$action);
|
|
4520
|
+
}
|
|
4327
4521
|
if (referenceDate && typeof referenceDate === "object" && "$data" in referenceDate) {
|
|
4328
4522
|
referenceDate = resolveDataPath(
|
|
4329
4523
|
dataContext.rootData,
|
|
@@ -4398,7 +4592,7 @@ function getDeclarationPages(configuration) {
|
|
|
4398
4592
|
function getDeclarationFields(configuration) {
|
|
4399
4593
|
return getDeclarationPages(configuration).flatMap(({ fields }) => fields);
|
|
4400
4594
|
}
|
|
4401
|
-
function
|
|
4595
|
+
function findNotificationForm(configuration) {
|
|
4402
4596
|
const notifyAction = configuration.actions.find(
|
|
4403
4597
|
(action) => action.type === ActionType.NOTIFY
|
|
4404
4598
|
);
|
|
@@ -4418,15 +4612,108 @@ var getActionAnnotationFields = (actionConfig) => {
|
|
|
4418
4612
|
function getAllAnnotationFields(config) {
|
|
4419
4613
|
return (0, import_lodash4.flattenDeep)(config.actions.map(getActionAnnotationFields));
|
|
4420
4614
|
}
|
|
4615
|
+
function deepMerge(currentDocument, actionDocument) {
|
|
4616
|
+
return (0, import_lodash4.mergeWith)(
|
|
4617
|
+
(0, import_lodash4.cloneDeep)(currentDocument),
|
|
4618
|
+
actionDocument,
|
|
4619
|
+
(previousValue, incomingValue) => {
|
|
4620
|
+
if (incomingValue === void 0) {
|
|
4621
|
+
return previousValue;
|
|
4622
|
+
}
|
|
4623
|
+
if ((0, import_lodash4.isArray)(incomingValue)) {
|
|
4624
|
+
return incomingValue;
|
|
4625
|
+
}
|
|
4626
|
+
if ((0, import_lodash4.isObject)(previousValue) && (0, import_lodash4.isObject)(incomingValue)) {
|
|
4627
|
+
return void 0;
|
|
4628
|
+
}
|
|
4629
|
+
return incomingValue;
|
|
4630
|
+
}
|
|
4631
|
+
);
|
|
4632
|
+
}
|
|
4421
4633
|
var findAllFields = (config) => {
|
|
4422
4634
|
return (0, import_lodash4.flattenDeep)([
|
|
4423
4635
|
...getDeclarationFields(config),
|
|
4424
|
-
...
|
|
4425
|
-
({ fields }) => fields
|
|
4426
|
-
) ?? [],
|
|
4636
|
+
...findNotificationForm(config)?.pages.flatMap(({ fields }) => fields) ?? [],
|
|
4427
4637
|
...getAllAnnotationFields(config)
|
|
4428
4638
|
]);
|
|
4429
4639
|
};
|
|
4640
|
+
function isAcceptedAction(a) {
|
|
4641
|
+
return a.status === ActionStatus.Accepted;
|
|
4642
|
+
}
|
|
4643
|
+
function getCompleteActionAnnotation(event2, action) {
|
|
4644
|
+
if (action.originalActionId) {
|
|
4645
|
+
const originalAction = event2.actions.find(
|
|
4646
|
+
({ id }) => id === action.originalActionId
|
|
4647
|
+
);
|
|
4648
|
+
if (originalAction?.status === ActionStatus.Requested) {
|
|
4649
|
+
return deepMerge(originalAction.annotation ?? {}, action.annotation ?? {});
|
|
4650
|
+
}
|
|
4651
|
+
}
|
|
4652
|
+
return action.annotation ?? {};
|
|
4653
|
+
}
|
|
4654
|
+
function getCompleteActionContent(event2, action) {
|
|
4655
|
+
const currentContent = "content" in action ? action.content : void 0;
|
|
4656
|
+
if (!action.originalActionId) {
|
|
4657
|
+
return currentContent;
|
|
4658
|
+
}
|
|
4659
|
+
const originalAction = event2.actions.find(
|
|
4660
|
+
({ id }) => id === action.originalActionId
|
|
4661
|
+
);
|
|
4662
|
+
if (originalAction && "content" in originalAction && originalAction.content) {
|
|
4663
|
+
return {
|
|
4664
|
+
...originalAction.content,
|
|
4665
|
+
...currentContent ?? {}
|
|
4666
|
+
};
|
|
4667
|
+
}
|
|
4668
|
+
return currentContent;
|
|
4669
|
+
}
|
|
4670
|
+
function getCompleteActionDeclaration(declaration, event2, action) {
|
|
4671
|
+
if (action.originalActionId) {
|
|
4672
|
+
const originalAction = event2.actions.find(
|
|
4673
|
+
({ id }) => id === action.originalActionId
|
|
4674
|
+
);
|
|
4675
|
+
if (originalAction?.status === ActionStatus.Requested) {
|
|
4676
|
+
return deepMerge(
|
|
4677
|
+
deepMerge(declaration, originalAction.declaration),
|
|
4678
|
+
action.declaration
|
|
4679
|
+
);
|
|
4680
|
+
}
|
|
4681
|
+
}
|
|
4682
|
+
return deepMerge(declaration, action.declaration);
|
|
4683
|
+
}
|
|
4684
|
+
function completeAcceptedAction(event2, action) {
|
|
4685
|
+
return {
|
|
4686
|
+
...action,
|
|
4687
|
+
declaration: getCompleteActionDeclaration({}, event2, action),
|
|
4688
|
+
annotation: getCompleteActionAnnotation(event2, action)
|
|
4689
|
+
};
|
|
4690
|
+
}
|
|
4691
|
+
function getEventWithCompleteAcceptedActions(event2) {
|
|
4692
|
+
return {
|
|
4693
|
+
...event2,
|
|
4694
|
+
actions: event2.actions.map((action) => {
|
|
4695
|
+
if (!isAcceptedAction(action) || !action.originalActionId) {
|
|
4696
|
+
return action;
|
|
4697
|
+
}
|
|
4698
|
+
const requestedAction = event2.actions.find(
|
|
4699
|
+
({ id }) => id === action.originalActionId
|
|
4700
|
+
);
|
|
4701
|
+
if (requestedAction?.status !== ActionStatus.Requested) {
|
|
4702
|
+
return action;
|
|
4703
|
+
}
|
|
4704
|
+
const content = getCompleteActionContent(event2, action);
|
|
4705
|
+
return {
|
|
4706
|
+
...completeAcceptedAction(event2, action),
|
|
4707
|
+
// Who requested the action, as getActionUpdateMetadata resolves it.
|
|
4708
|
+
createdBy: requestedAction.createdBy,
|
|
4709
|
+
createdByRole: requestedAction.createdByRole,
|
|
4710
|
+
createdByUserType: requestedAction.createdByUserType,
|
|
4711
|
+
createdAtLocation: requestedAction.createdAtLocation,
|
|
4712
|
+
...content ? { content } : {}
|
|
4713
|
+
};
|
|
4714
|
+
})
|
|
4715
|
+
};
|
|
4716
|
+
}
|
|
4430
4717
|
var EXCLUDED_ACTIONS = [
|
|
4431
4718
|
ActionType.REQUEST_CORRECTION,
|
|
4432
4719
|
ActionType.PRINT_CERTIFICATE,
|
|
@@ -4434,6 +4721,20 @@ var EXCLUDED_ACTIONS = [
|
|
|
4434
4721
|
];
|
|
4435
4722
|
|
|
4436
4723
|
// ../commons/src/events/eventConfigValidation.ts
|
|
4724
|
+
var SEARCH_DEFAULT_VALUE_FIELD_TYPES = [
|
|
4725
|
+
FieldType.TEXT,
|
|
4726
|
+
FieldType.TEXTAREA,
|
|
4727
|
+
FieldType.EMAIL,
|
|
4728
|
+
FieldType.PHONE,
|
|
4729
|
+
FieldType.ID,
|
|
4730
|
+
FieldType.SELECT,
|
|
4731
|
+
FieldType.RADIO_GROUP,
|
|
4732
|
+
FieldType.COUNTRY,
|
|
4733
|
+
FieldType.LOCATION,
|
|
4734
|
+
FieldType.ADMINISTRATIVE_AREA,
|
|
4735
|
+
FieldType.NUMBER,
|
|
4736
|
+
FieldType.DATE
|
|
4737
|
+
];
|
|
4437
4738
|
function validateAdvancedSearchConfig(event2, ctx) {
|
|
4438
4739
|
const allFields = findAllFields(event2);
|
|
4439
4740
|
const fieldIds = allFields.map((field3) => field3.id);
|
|
@@ -4465,6 +4766,56 @@ function validateAdvancedSearchConfig(event2, ctx) {
|
|
|
4465
4766
|
path: ["advancedSearch"]
|
|
4466
4767
|
});
|
|
4467
4768
|
}
|
|
4769
|
+
event2.advancedSearch.forEach((section, sectionIndex) => {
|
|
4770
|
+
section.fields.forEach((searchField, fieldIndex) => {
|
|
4771
|
+
if (searchField.fieldType !== "field" || searchField.defaultValue === void 0) {
|
|
4772
|
+
return;
|
|
4773
|
+
}
|
|
4774
|
+
const path = [
|
|
4775
|
+
"advancedSearch",
|
|
4776
|
+
sectionIndex,
|
|
4777
|
+
"fields",
|
|
4778
|
+
fieldIndex,
|
|
4779
|
+
"defaultValue"
|
|
4780
|
+
];
|
|
4781
|
+
if (searchField.config.searchFields && searchField.config.searchFields.length > 0) {
|
|
4782
|
+
ctx.addIssue({
|
|
4783
|
+
code: "custom",
|
|
4784
|
+
message: `Advanced search field ${searchField.fieldId} searches across several form fields, so it does not support a defaultValue.`,
|
|
4785
|
+
path
|
|
4786
|
+
});
|
|
4787
|
+
return;
|
|
4788
|
+
}
|
|
4789
|
+
if (typeof searchField.defaultValue === "boolean") {
|
|
4790
|
+
return;
|
|
4791
|
+
}
|
|
4792
|
+
const formField = allFields.find(({ id }) => id === searchField.fieldId);
|
|
4793
|
+
if (!formField) {
|
|
4794
|
+
return;
|
|
4795
|
+
}
|
|
4796
|
+
if (!SEARCH_DEFAULT_VALUE_FIELD_TYPES.some(
|
|
4797
|
+
(type) => type === formField.type
|
|
4798
|
+
)) {
|
|
4799
|
+
ctx.addIssue({
|
|
4800
|
+
code: "custom",
|
|
4801
|
+
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(", ")}.`,
|
|
4802
|
+
path
|
|
4803
|
+
});
|
|
4804
|
+
} else if (formField.type === FieldType.DATE && searchField.config.type === "range") {
|
|
4805
|
+
ctx.addIssue({
|
|
4806
|
+
code: "custom",
|
|
4807
|
+
message: `Advanced search field ${searchField.fieldId} is searched as a date range, so its defaultValue can only be true or false.`,
|
|
4808
|
+
path
|
|
4809
|
+
});
|
|
4810
|
+
} else if (!mapFieldTypeToZod(formField).safeParse(searchField.defaultValue).success) {
|
|
4811
|
+
ctx.addIssue({
|
|
4812
|
+
code: "custom",
|
|
4813
|
+
message: `Advanced search field ${searchField.fieldId} has defaultValue "${searchField.defaultValue}", which is not a valid ${formField.type} value.`,
|
|
4814
|
+
path
|
|
4815
|
+
});
|
|
4816
|
+
}
|
|
4817
|
+
});
|
|
4818
|
+
});
|
|
4468
4819
|
}
|
|
4469
4820
|
function validateDateOfEvent(event2, ctx) {
|
|
4470
4821
|
if (event2.dateOfEvent && isFieldReference(event2.dateOfEvent)) {
|
|
@@ -4637,10 +4988,16 @@ function validateNotificationForm(event2, ctx) {
|
|
|
4637
4988
|
var EventFieldReference = z35.object({ $$event: EventMetadataDateFieldIdInput }).describe(
|
|
4638
4989
|
"Reference to a field defined in the event metadata, using the field id."
|
|
4639
4990
|
);
|
|
4640
|
-
var
|
|
4991
|
+
var eventLevelFields = {
|
|
4641
4992
|
id: z35.string().describe(
|
|
4642
4993
|
'Machine-readable identifier of the event (e.g. "birth", "death").'
|
|
4643
4994
|
),
|
|
4995
|
+
label: TranslationConfig.describe("Human-readable label for the event type."),
|
|
4996
|
+
advancedSearch: z35.array(AdvancedSearchConfig).optional().default([]).describe(
|
|
4997
|
+
"Configuration of fields available in the advanced search feature."
|
|
4998
|
+
)
|
|
4999
|
+
};
|
|
5000
|
+
var versionFields = {
|
|
4644
5001
|
dateOfEvent: FieldReference.or(EventFieldReference).optional().describe(
|
|
4645
5002
|
"Reference to the field capturing the date of the event (e.g. date of birth). Defaults to the event creation date if unspecified."
|
|
4646
5003
|
),
|
|
@@ -4656,18 +5013,12 @@ var _EventConfigBase = z35.object({
|
|
|
4656
5013
|
summary: SummaryConfig.describe(
|
|
4657
5014
|
"Summary information displayed in the event overview."
|
|
4658
5015
|
),
|
|
4659
|
-
label: TranslationConfig.describe(
|
|
4660
|
-
"Human-readable label for the event type."
|
|
4661
|
-
),
|
|
4662
5016
|
actions: z35.array(ActionConfig).describe(
|
|
4663
5017
|
"Configuration of core and custom actions associated with the event."
|
|
4664
5018
|
),
|
|
4665
5019
|
actionOrder: z35.array(z35.string()).optional().describe(
|
|
4666
5020
|
"Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
|
|
4667
5021
|
),
|
|
4668
|
-
advancedSearch: z35.array(AdvancedSearchConfig).optional().default([]).describe(
|
|
4669
|
-
"Configuration of fields available in the advanced search feature."
|
|
4670
|
-
),
|
|
4671
5022
|
flags: z35.array(FlagConfig).optional().default([]).describe(
|
|
4672
5023
|
"Configuration of custom flags associated with the actions of this event type."
|
|
4673
5024
|
),
|
|
@@ -4677,8 +5028,9 @@ var _EventConfigBase = z35.object({
|
|
|
4677
5028
|
icon: z35.partialRecord(AvailableIcons, Conditional).optional().describe(
|
|
4678
5029
|
'Maps an icon name to a conditional. The icon of the first entry (in definition order) whose conditional matches the event is used when rendering it (e.g. in the "iconWithName"/"iconWithNameEvent" workqueue columns). Falls back to the default status-based icon when unset or when no conditional matches.'
|
|
4679
5030
|
)
|
|
4680
|
-
}
|
|
4681
|
-
var
|
|
5031
|
+
};
|
|
5032
|
+
var _EventConfigBase = z35.object({ ...eventLevelFields, ...versionFields });
|
|
5033
|
+
function validateEventConfig(event2, ctx) {
|
|
4682
5034
|
if (!validateExactlyOneDeclareAction(event2, ctx)) {
|
|
4683
5035
|
return;
|
|
4684
5036
|
}
|
|
@@ -4688,10 +5040,143 @@ var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
|
|
|
4688
5040
|
validatePlaceOfEvent(event2, ctx);
|
|
4689
5041
|
validateActionFlags(event2, ctx);
|
|
4690
5042
|
validateActionOrder(event2, ctx);
|
|
4691
|
-
}
|
|
5043
|
+
}
|
|
5044
|
+
var EventConfig2 = _EventConfigBase.superRefine(validateEventConfig).meta({
|
|
4692
5045
|
id: "EventConfig",
|
|
4693
5046
|
description: "Configuration defining an event type registered in OpenCRVS (for example birth or death)."
|
|
4694
5047
|
});
|
|
5048
|
+
var INITIAL_EVENT_CONFIG_VERSION_ID = "initial";
|
|
5049
|
+
var DEFAULT_EFFECTIVE_FROM = "0001-01-01";
|
|
5050
|
+
var _EventConfigVersion = z35.object({
|
|
5051
|
+
id: z35.string().describe(
|
|
5052
|
+
'Identifier of the version, unique within the event (e.g. "birth-v2").'
|
|
5053
|
+
),
|
|
5054
|
+
label: TranslationConfig.describe(
|
|
5055
|
+
'Name of the version, which the UI shows wherever it names the version. For example, "{event.configVersionLabel}" in the event summary.'
|
|
5056
|
+
),
|
|
5057
|
+
effectiveFrom: z35.iso.date().default(DEFAULT_EFFECTIVE_FROM).describe(
|
|
5058
|
+
`Date (YYYY-MM-DD) from which this version is effective. A version without one is effective from the beginning of time ('${DEFAULT_EFFECTIVE_FROM}').`
|
|
5059
|
+
),
|
|
5060
|
+
...versionFields
|
|
5061
|
+
});
|
|
5062
|
+
var resolvedConfigs = /* @__PURE__ */ new WeakMap();
|
|
5063
|
+
function toEventConfig(config, version) {
|
|
5064
|
+
let resolvedVersions = resolvedConfigs.get(config);
|
|
5065
|
+
if (!resolvedVersions) {
|
|
5066
|
+
resolvedVersions = /* @__PURE__ */ new WeakMap();
|
|
5067
|
+
resolvedConfigs.set(config, resolvedVersions);
|
|
5068
|
+
}
|
|
5069
|
+
const cached = resolvedVersions.get(version);
|
|
5070
|
+
if (cached) {
|
|
5071
|
+
return cached;
|
|
5072
|
+
}
|
|
5073
|
+
const {
|
|
5074
|
+
id: _id,
|
|
5075
|
+
label: _label,
|
|
5076
|
+
effectiveFrom: _effectiveFrom,
|
|
5077
|
+
...fields
|
|
5078
|
+
} = version;
|
|
5079
|
+
const resolved = {
|
|
5080
|
+
...fields,
|
|
5081
|
+
id: config.id,
|
|
5082
|
+
label: config.label,
|
|
5083
|
+
advancedSearch: config.advancedSearch
|
|
5084
|
+
};
|
|
5085
|
+
resolvedVersions.set(version, resolved);
|
|
5086
|
+
return resolved;
|
|
5087
|
+
}
|
|
5088
|
+
function byEffectiveFrom(a, b) {
|
|
5089
|
+
return a.effectiveFrom.localeCompare(b.effectiveFrom);
|
|
5090
|
+
}
|
|
5091
|
+
function getVersionsInEffectOn(config, date) {
|
|
5092
|
+
return config.versions.filter(({ effectiveFrom }) => effectiveFrom <= date).sort(byEffectiveFrom);
|
|
5093
|
+
}
|
|
5094
|
+
function findVersionInEffectOn(config, date) {
|
|
5095
|
+
return getVersionsInEffectOn(config, date).at(-1);
|
|
5096
|
+
}
|
|
5097
|
+
function resolveEventConfigOnDate(config, date) {
|
|
5098
|
+
return toEventConfig(
|
|
5099
|
+
config,
|
|
5100
|
+
getOrThrow(
|
|
5101
|
+
findVersionInEffectOn(config, date),
|
|
5102
|
+
`Event '${config.id}' has no version in effect on ${date}`
|
|
5103
|
+
)
|
|
5104
|
+
);
|
|
5105
|
+
}
|
|
5106
|
+
function resolveEventConfigInTimeZone(config, timeZone, now2 = /* @__PURE__ */ new Date()) {
|
|
5107
|
+
return resolveEventConfigOnDate(config, toPlainDateInTimeZone(now2, timeZone));
|
|
5108
|
+
}
|
|
5109
|
+
function resolveEventConfig(config) {
|
|
5110
|
+
return resolveEventConfigInTimeZone(config, "UTC");
|
|
5111
|
+
}
|
|
5112
|
+
function validateVersionList(config, ctx) {
|
|
5113
|
+
const ids = /* @__PURE__ */ new Set();
|
|
5114
|
+
const versionIdByEffectiveFrom = /* @__PURE__ */ new Map();
|
|
5115
|
+
config.versions.forEach((version, index) => {
|
|
5116
|
+
if (ids.has(version.id)) {
|
|
5117
|
+
ctx.addIssue({
|
|
5118
|
+
code: "custom",
|
|
5119
|
+
message: `Event '${config.id}' has more than one version with id '${version.id}'. Each version must have a different id.`,
|
|
5120
|
+
path: ["versions", index, "id"]
|
|
5121
|
+
});
|
|
5122
|
+
}
|
|
5123
|
+
ids.add(version.id);
|
|
5124
|
+
const sameEffectiveFromId = versionIdByEffectiveFrom.get(
|
|
5125
|
+
version.effectiveFrom
|
|
5126
|
+
);
|
|
5127
|
+
if (sameEffectiveFromId !== void 0) {
|
|
5128
|
+
const versionIds = `'${sameEffectiveFromId}', '${version.id}'`;
|
|
5129
|
+
ctx.addIssue({
|
|
5130
|
+
code: "custom",
|
|
5131
|
+
message: version.effectiveFrom !== DEFAULT_EFFECTIVE_FROM ? `Event '${config.id}' has more than one version with \`effectiveFrom\` '${version.effectiveFrom}' (${versionIds}). Each version must have a different \`effectiveFrom\`.` : `Event '${config.id}' has more than one version without \`effectiveFrom\` (${versionIds}). At most one version may omit it.`,
|
|
5132
|
+
path: ["versions", index, "effectiveFrom"]
|
|
5133
|
+
});
|
|
5134
|
+
} else {
|
|
5135
|
+
versionIdByEffectiveFrom.set(version.effectiveFrom, version.id);
|
|
5136
|
+
}
|
|
5137
|
+
});
|
|
5138
|
+
}
|
|
5139
|
+
function validateEachVersion(ctx, events, validate2) {
|
|
5140
|
+
const reported = /* @__PURE__ */ new Set();
|
|
5141
|
+
events.forEach((event2, index) => {
|
|
5142
|
+
const addIssue = (issue) => {
|
|
5143
|
+
if (typeof issue === "string") {
|
|
5144
|
+
ctx.addIssue({
|
|
5145
|
+
code: "custom",
|
|
5146
|
+
message: issue,
|
|
5147
|
+
path: ["versions", index]
|
|
5148
|
+
});
|
|
5149
|
+
return;
|
|
5150
|
+
}
|
|
5151
|
+
const [field3] = issue.path ?? [];
|
|
5152
|
+
const isEventLevel = typeof field3 === "string" && field3 in eventLevelFields;
|
|
5153
|
+
const path = isEventLevel ? issue.path ?? [] : ["versions", index, ...issue.path ?? []];
|
|
5154
|
+
const key = JSON.stringify([path, issue.message]);
|
|
5155
|
+
if (reported.has(key)) {
|
|
5156
|
+
return;
|
|
5157
|
+
}
|
|
5158
|
+
reported.add(key);
|
|
5159
|
+
ctx.addIssue({ ...issue, path });
|
|
5160
|
+
};
|
|
5161
|
+
validate2(event2, { value: event2, addIssue });
|
|
5162
|
+
});
|
|
5163
|
+
}
|
|
5164
|
+
var VersionedEventConfig2 = z35.object({
|
|
5165
|
+
...eventLevelFields,
|
|
5166
|
+
versions: z35.array(_EventConfigVersion).min(1).describe(
|
|
5167
|
+
`Versions of the event configuration, each effective from its \`effectiveFrom\`. An event configured without versions has a single version, with id '${INITIAL_EVENT_CONFIG_VERSION_ID}' and \`effectiveFrom\` '${DEFAULT_EFFECTIVE_FROM}'.`
|
|
5168
|
+
)
|
|
5169
|
+
}).superRefine((config, ctx) => {
|
|
5170
|
+
validateVersionList(config, ctx);
|
|
5171
|
+
validateEachVersion(
|
|
5172
|
+
ctx,
|
|
5173
|
+
config.versions.map((version) => toEventConfig(config, version)),
|
|
5174
|
+
validateEventConfig
|
|
5175
|
+
);
|
|
5176
|
+
}).meta({
|
|
5177
|
+
id: "VersionedEventConfig",
|
|
5178
|
+
description: "Configuration of an event type registered in OpenCRVS (for example birth or death), with every version of it."
|
|
5179
|
+
});
|
|
4695
5180
|
|
|
4696
5181
|
// ../commons/src/events/EventConfigInput.ts
|
|
4697
5182
|
var defineDeclarationForm = (form) => DeclarationFormConfig.parse(form);
|
|
@@ -4788,9 +5273,20 @@ function createEventFieldConfig(fieldId) {
|
|
|
4788
5273
|
function eventFn(fieldId) {
|
|
4789
5274
|
return createEventFieldConfig(fieldId);
|
|
4790
5275
|
}
|
|
5276
|
+
function actionDateReference(match, occurrence) {
|
|
5277
|
+
return {
|
|
5278
|
+
$action: {
|
|
5279
|
+
match: match.map((m) => typeof m === "string" ? { type: m } : m),
|
|
5280
|
+
occurrence
|
|
5281
|
+
}
|
|
5282
|
+
};
|
|
5283
|
+
}
|
|
4791
5284
|
var event = Object.assign(eventFn, {
|
|
4792
5285
|
/**
|
|
4793
|
-
* Checks if the event contains a specific action type.
|
|
5286
|
+
* Checks if the event contains a specific accepted action type.
|
|
5287
|
+
* Only Accepted actions are matched: a confirmable action is stored as a
|
|
5288
|
+
* Requested and an Accepted action, and a pending or rejected request must
|
|
5289
|
+
* not count as the action having happened.
|
|
4794
5290
|
* Can be used directly as a conditional or chained with additional methods.
|
|
4795
5291
|
* @param action - The action type to check for.
|
|
4796
5292
|
*/
|
|
@@ -4808,9 +5304,12 @@ var event = Object.assign(eventFn, {
|
|
|
4808
5304
|
properties: {
|
|
4809
5305
|
type: {
|
|
4810
5306
|
const: action
|
|
5307
|
+
},
|
|
5308
|
+
status: {
|
|
5309
|
+
const: ActionStatus.Accepted
|
|
4811
5310
|
}
|
|
4812
5311
|
},
|
|
4813
|
-
required: ["type"]
|
|
5312
|
+
required: ["type", "status"]
|
|
4814
5313
|
}
|
|
4815
5314
|
}
|
|
4816
5315
|
},
|
|
@@ -4821,9 +5320,10 @@ var event = Object.assign(eventFn, {
|
|
|
4821
5320
|
});
|
|
4822
5321
|
const buildActionConstraints = (additionalFields) => {
|
|
4823
5322
|
const actionProperties = {
|
|
4824
|
-
type: { const: action }
|
|
5323
|
+
type: { const: action },
|
|
5324
|
+
status: { const: ActionStatus.Accepted }
|
|
4825
5325
|
};
|
|
4826
|
-
const requiredFields = ["type"];
|
|
5326
|
+
const requiredFields = ["type", "status"];
|
|
4827
5327
|
if (additionalFields) {
|
|
4828
5328
|
Object.entries(additionalFields).forEach(([key, value]) => {
|
|
4829
5329
|
actionProperties[key] = { const: value };
|
|
@@ -4897,6 +5397,16 @@ var event = Object.assign(eventFn, {
|
|
|
4897
5397
|
$event: field3
|
|
4898
5398
|
};
|
|
4899
5399
|
},
|
|
5400
|
+
/**
|
|
5401
|
+
* References the date of the first action matching any of the given types,
|
|
5402
|
+
* e.g. `field('child.dob').isAfter().days(30).beforeAction(event.firstAction(ActionType.DECLARE))`.
|
|
5403
|
+
* Until a matching action exists, the comparison uses $now.
|
|
5404
|
+
*/
|
|
5405
|
+
firstAction: (first, ...rest) => actionDateReference([first, ...rest], "first"),
|
|
5406
|
+
/**
|
|
5407
|
+
* Like {@link event.firstAction}, but references the most recent matching action.
|
|
5408
|
+
*/
|
|
5409
|
+
lastAction: (first, ...rest) => actionDateReference([first, ...rest], "last"),
|
|
4900
5410
|
/**
|
|
4901
5411
|
* Checks if the event currently has the given status.
|
|
4902
5412
|
* @param eventStatus - The status to check for.
|
|
@@ -5283,17 +5793,19 @@ var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
|
|
|
5283
5793
|
/*
|
|
5284
5794
|
* A draft can name a file that no action references. Such a file stays until
|
|
5285
5795
|
* the record is deleted or the record's next action sweeps its prefix.
|
|
5286
|
-
*
|
|
5287
|
-
*
|
|
5288
|
-
* which is about to be declared or registered.
|
|
5796
|
+
* Drafts are therefore saved only on a created record, which can still be deleted.
|
|
5797
|
+
* The server refuses them on any other record.
|
|
5289
5798
|
*/
|
|
5290
|
-
type: z40.
|
|
5799
|
+
type: z40.enum([ActionTypes.enum.DECLARE, ActionTypes.enum.NOTIFY]),
|
|
5291
5800
|
status: z40.enum([
|
|
5292
5801
|
ActionStatus.Requested,
|
|
5293
5802
|
ActionStatus.Accepted,
|
|
5294
5803
|
ActionStatus.Rejected
|
|
5295
5804
|
])
|
|
5296
5805
|
});
|
|
5806
|
+
var RemoteDraft = Draft.extend({
|
|
5807
|
+
action: Draft.shape.action.extend({ type: DraftInput.shape.type })
|
|
5808
|
+
});
|
|
5297
5809
|
|
|
5298
5810
|
// ../commons/src/events/EventInput.ts
|
|
5299
5811
|
var z41 = __toESM(require("zod/v4"));
|
|
@@ -5303,6 +5815,9 @@ var EventInput = z41.object({
|
|
|
5303
5815
|
type: z41.string(),
|
|
5304
5816
|
createdAtLocation: UUID.nullish().describe(
|
|
5305
5817
|
"Location where the event occurred. Required for system users."
|
|
5818
|
+
),
|
|
5819
|
+
configVersionId: z41.string().optional().describe(
|
|
5820
|
+
"Id of the event configuration version the client created the record under, e.g. while offline. Must be configured and not take effect in the future. Defaults to the version in effect when the server receives the record."
|
|
5306
5821
|
)
|
|
5307
5822
|
}).meta({ default: { transactionId: (0, import_uuid11.v4)(), type: "birth" } });
|
|
5308
5823
|
|
|
@@ -5318,6 +5833,9 @@ var EventDocument = z42.object({
|
|
|
5318
5833
|
actions: z42.array(Action).describe("Ordered list of actions associated with the event."),
|
|
5319
5834
|
trackingId: z42.string().describe(
|
|
5320
5835
|
"System-generated tracking identifier used to look up the event."
|
|
5836
|
+
),
|
|
5837
|
+
configVersionId: z42.string().describe(
|
|
5838
|
+
"Id of the event configuration version the record was created under. Every action on the record uses that version. Records created before versioning have 'initial'."
|
|
5321
5839
|
)
|
|
5322
5840
|
}).meta({ id: "EventDocument" });
|
|
5323
5841
|
var EventDocumentOnlyLastAction = EventDocument.extend({
|
|
@@ -5337,16 +5855,69 @@ function moveDeclarationToDeclareAction({
|
|
|
5337
5855
|
}
|
|
5338
5856
|
return {
|
|
5339
5857
|
...config,
|
|
5340
|
-
actions: config.actions.map(
|
|
5341
|
-
(action
|
|
5342
|
-
|
|
5858
|
+
actions: config.actions.map((action) => {
|
|
5859
|
+
if (action.type !== ActionType.DECLARE) {
|
|
5860
|
+
return action;
|
|
5861
|
+
}
|
|
5862
|
+
const declarationOfAction = action.declaration ?? declaration;
|
|
5863
|
+
if (!declarationOfAction) {
|
|
5864
|
+
throw new Error(`Event '${config.id}' does not define \`declaration\`.`);
|
|
5865
|
+
}
|
|
5866
|
+
return { ...action, declaration: declarationOfAction };
|
|
5867
|
+
})
|
|
5868
|
+
};
|
|
5869
|
+
}
|
|
5870
|
+
var VERSIONED_EVENT_FIELDS = [
|
|
5871
|
+
"id",
|
|
5872
|
+
"label",
|
|
5873
|
+
"advancedSearch",
|
|
5874
|
+
"versions"
|
|
5875
|
+
];
|
|
5876
|
+
function validateNoVersionFieldsAtTopLevel(config, ctx) {
|
|
5877
|
+
Object.keys(config).filter((key) => !VERSIONED_EVENT_FIELDS.includes(key)).forEach((key) => {
|
|
5878
|
+
ctx.addIssue({
|
|
5879
|
+
code: "custom",
|
|
5880
|
+
message: `Event '${config.id}' defines \`versions\`, so \`${key}\` must be defined on each version, not at the top level.`,
|
|
5881
|
+
path: [key]
|
|
5882
|
+
});
|
|
5883
|
+
});
|
|
5884
|
+
}
|
|
5885
|
+
function toVersionedInput(config) {
|
|
5886
|
+
if ("versions" in config) {
|
|
5887
|
+
return config;
|
|
5888
|
+
}
|
|
5889
|
+
const { id, label, advancedSearch, ...version } = moveDeclarationToDeclareAction(config);
|
|
5890
|
+
return {
|
|
5891
|
+
id,
|
|
5892
|
+
label,
|
|
5893
|
+
advancedSearch,
|
|
5894
|
+
versions: [{ ...version, id: INITIAL_EVENT_CONFIG_VERSION_ID, label }]
|
|
5343
5895
|
};
|
|
5344
5896
|
}
|
|
5897
|
+
var WESTERNMOST_TIME_ZONE = "Etc/GMT+12";
|
|
5898
|
+
function validateVersionInEffectToday(config, ctx) {
|
|
5899
|
+
const today = toPlainDateInTimeZone(/* @__PURE__ */ new Date(), WESTERNMOST_TIME_ZONE);
|
|
5900
|
+
const isAnyVersionInEffect = config.versions.some(
|
|
5901
|
+
({ effectiveFrom }) => effectiveFrom <= today
|
|
5902
|
+
);
|
|
5903
|
+
if (!isAnyVersionInEffect) {
|
|
5904
|
+
ctx.addIssue({
|
|
5905
|
+
code: "custom",
|
|
5906
|
+
message: `Event '${config.id}' has no version in effect today (${today}, UTC\u221212, the last time zone to begin the day). At least one version must omit \`effectiveFrom\` or take effect on or before that date.`,
|
|
5907
|
+
path: ["versions"]
|
|
5908
|
+
});
|
|
5909
|
+
}
|
|
5910
|
+
}
|
|
5345
5911
|
var EventConfigDefinition = z43.custom().superRefine((config, ctx) => {
|
|
5346
|
-
if (
|
|
5347
|
-
|
|
5912
|
+
if ("versions" in config) {
|
|
5913
|
+
validateNoVersionFieldsAtTopLevel(config, ctx);
|
|
5914
|
+
return;
|
|
5915
|
+
}
|
|
5916
|
+
const eventCtx = { ...ctx, value: config };
|
|
5917
|
+
if (validateExactlyOneDeclareAction(config, eventCtx)) {
|
|
5918
|
+
validateDeclarationGivenExactlyOnce(config, eventCtx);
|
|
5348
5919
|
}
|
|
5349
|
-
}).transform(
|
|
5920
|
+
}).transform(toVersionedInput).pipe(VersionedEventConfig2).superRefine(validateVersionInEffectToday);
|
|
5350
5921
|
var defineConfig = (config) => EventConfigDefinition.parse(config);
|
|
5351
5922
|
|
|
5352
5923
|
// ../commons/src/events/toNotificationForm.ts
|
|
@@ -6629,7 +7200,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
|
|
6629
7200
|
});
|
|
6630
7201
|
|
|
6631
7202
|
// ../commons/src/fixtures/tennis-club-membership-event.ts
|
|
6632
|
-
var
|
|
7203
|
+
var versionedTennisClubMembershipEvent = defineConfig({
|
|
6633
7204
|
id: TENNIS_CLUB_MEMBERSHIP,
|
|
6634
7205
|
declaration: TENNIS_CLUB_DECLARATION_FORM,
|
|
6635
7206
|
label: {
|
|
@@ -6986,9 +7557,12 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
6986
7557
|
}
|
|
6987
7558
|
]
|
|
6988
7559
|
});
|
|
7560
|
+
var tennisClubMembershipEvent = resolveEventConfig(
|
|
7561
|
+
versionedTennisClubMembershipEvent
|
|
7562
|
+
);
|
|
6989
7563
|
|
|
6990
7564
|
// ../commons/src/fixtures/football-club-membership-event.ts
|
|
6991
|
-
var
|
|
7565
|
+
var versionedFootballClubMembershipEvent = defineConfig({
|
|
6992
7566
|
id: "FOOTBALL_CLUB_MEMBERSHIP",
|
|
6993
7567
|
label: {
|
|
6994
7568
|
defaultMessage: "Football club membership application",
|
|
@@ -7311,6 +7885,9 @@ var footballClubMembershipEvent = defineConfig({
|
|
|
7311
7885
|
],
|
|
7312
7886
|
declaration: TENNIS_CLUB_DECLARATION_FORM
|
|
7313
7887
|
});
|
|
7888
|
+
var footballClubMembershipEvent = resolveEventConfig(
|
|
7889
|
+
versionedFootballClubMembershipEvent
|
|
7890
|
+
);
|
|
7314
7891
|
|
|
7315
7892
|
// ../commons/src/fixtures/library-membership-event.ts
|
|
7316
7893
|
var libraryMembershipForm = defineDeclarationForm({
|
|
@@ -7354,7 +7931,7 @@ var libraryMembershipForm = defineDeclarationForm({
|
|
|
7354
7931
|
}
|
|
7355
7932
|
]
|
|
7356
7933
|
});
|
|
7357
|
-
var
|
|
7934
|
+
var versionedLibraryMembershipEvent = defineConfig({
|
|
7358
7935
|
id: "library-membership",
|
|
7359
7936
|
label: {
|
|
7360
7937
|
defaultMessage: "Library membership application",
|
|
@@ -7387,6 +7964,9 @@ var libraryMembershipEvent = defineConfig({
|
|
|
7387
7964
|
],
|
|
7388
7965
|
declaration: libraryMembershipForm
|
|
7389
7966
|
});
|
|
7967
|
+
var libraryMembershipEvent = resolveEventConfig(
|
|
7968
|
+
versionedLibraryMembershipEvent
|
|
7969
|
+
);
|
|
7390
7970
|
|
|
7391
7971
|
// ../commons/src/fixtures/child-onboarding-event.ts
|
|
7392
7972
|
function generateTranslationConfig(message) {
|
|
@@ -7600,7 +8180,7 @@ var CHILD_ONBOARDING_DECLARATION_FORM = defineDeclarationForm({
|
|
|
7600
8180
|
label: generateTranslationConfig("Birth decalration form"),
|
|
7601
8181
|
pages: [child, mother]
|
|
7602
8182
|
});
|
|
7603
|
-
var
|
|
8183
|
+
var versionedChildOnboardingEvent = defineConfig({
|
|
7604
8184
|
id: CHILD_ONBOARDING_EVENT,
|
|
7605
8185
|
title: generateTranslationConfig(
|
|
7606
8186
|
"{child.name.firstname} {child.name.surname}"
|
|
@@ -7628,6 +8208,9 @@ var ChildOnboardingEvent = defineConfig({
|
|
|
7628
8208
|
],
|
|
7629
8209
|
advancedSearch: []
|
|
7630
8210
|
});
|
|
8211
|
+
var ChildOnboardingEvent = resolveEventConfig(
|
|
8212
|
+
versionedChildOnboardingEvent
|
|
8213
|
+
);
|
|
7631
8214
|
|
|
7632
8215
|
// ../commons/src/fixtures/digital-identity-issuance-event.ts
|
|
7633
8216
|
var PRINT_DIGITAL_ID_CERTIFICATE_FORM = defineActionForm({
|
|
@@ -7816,7 +8399,7 @@ var digitalIdentityForm = defineDeclarationForm({
|
|
|
7816
8399
|
}
|
|
7817
8400
|
]
|
|
7818
8401
|
});
|
|
7819
|
-
var
|
|
8402
|
+
var versionedDigitalIdentityEvent = defineConfig({
|
|
7820
8403
|
id: "digital-identity",
|
|
7821
8404
|
label: {
|
|
7822
8405
|
defaultMessage: "Digital identity issuance",
|
|
@@ -7858,6 +8441,9 @@ var digitalIdentityEvent = defineConfig({
|
|
|
7858
8441
|
],
|
|
7859
8442
|
declaration: digitalIdentityForm
|
|
7860
8443
|
});
|
|
8444
|
+
var digitalIdentityEvent = resolveEventConfig(
|
|
8445
|
+
versionedDigitalIdentityEvent
|
|
8446
|
+
);
|
|
7861
8447
|
|
|
7862
8448
|
// ../commons/src/events/test.utils.ts
|
|
7863
8449
|
var z45 = __toESM(require("zod/v4"));
|
|
@@ -8324,6 +8910,8 @@ var ACTION_SCOPE_MAP = {
|
|
|
8324
8910
|
"record.correct"
|
|
8325
8911
|
],
|
|
8326
8912
|
[ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: ["record.correct"],
|
|
8913
|
+
// Not granted by a scope: the client checks the draft's own action instead
|
|
8914
|
+
[ClientSpecificAction.CONTINUE_DRAFT]: [],
|
|
8327
8915
|
[ActionType.REJECT_CORRECTION]: ["record.correct"],
|
|
8328
8916
|
[ActionType.APPROVE_CORRECTION]: ["record.correct"],
|
|
8329
8917
|
[ActionType.REVOKE_REGISTRATION]: ["record.revoke-registration"],
|