@opencrvs/toolkit 2.1.0 → 2.2.0-rc.9042a13
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 +2 -2
- package/create-countryconfig/package.json +1 -1
- package/dist/application-config/index.js +29 -2
- package/dist/authentication/index.js +14 -1
- package/dist/cli.js +294 -1967
- package/dist/commons/api/router.d.ts +1370 -73
- package/dist/commons/conditionals/conditionals.d.ts +3 -3
- package/dist/commons/events/ActionConfig.d.ts +133 -0
- package/dist/commons/events/ActionDocument.d.ts +88 -0
- package/dist/commons/events/ActionInput.d.ts +52 -0
- package/dist/commons/events/ActionType.d.ts +11 -1
- package/dist/commons/events/AdvancedSearchConfig.d.ts +12 -0
- package/dist/commons/events/AuditLog.d.ts +4 -0
- package/dist/commons/events/CountryConfigQueryInput.d.ts +132 -0
- package/dist/commons/events/Draft.d.ts +2 -0
- package/dist/commons/events/EventConfig.d.ts +26 -6
- package/dist/commons/events/EventDocument.d.ts +88 -0
- package/dist/commons/events/EventIndex.d.ts +20 -0
- package/dist/commons/events/EventMetadata.d.ts +23 -0
- package/dist/commons/events/EventStatus.d.ts +1 -0
- package/dist/commons/events/FieldConfig.d.ts +10 -0
- package/dist/commons/events/WorkqueueConfig.d.ts +154 -10
- package/dist/commons/events/eventConfigValidation.d.ts +17 -1
- package/dist/commons/events/scopes.d.ts +2 -0
- package/dist/commons/events/state/index.d.ts +10 -2
- package/dist/commons/events/state/utils.d.ts +11 -1
- package/dist/commons/events/test.utils.d.ts +28 -1
- package/dist/commons/events/utils.d.ts +43 -15
- package/dist/conditionals/index.js +14 -1
- package/dist/environment/derived-variables.d.ts +18 -0
- package/dist/environment/derived-variables.d.ts.map +1 -1
- package/dist/environment/derived-variables.js +22 -1
- package/dist/environment/setup-environment.d.ts.map +1 -1
- package/dist/environment/setup-environment.js +29 -10
- package/dist/events/index.js +293 -66
- package/dist/migrations/add-translations.d.ts +15 -0
- package/dist/migrations/add-translations.d.ts.map +1 -0
- package/dist/migrations/{v2.1/add-translations.js → add-translations.js} +16 -14
- package/dist/migrations/v2.1/index.js +35 -2155
- package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts +3 -0
- package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts.map +1 -1
- package/dist/migrations/v2.1/upgrade-tilt.d.ts +3 -0
- package/dist/migrations/v2.1/upgrade-tilt.d.ts.map +1 -1
- package/dist/migrations/v2.2/index.d.ts +6 -0
- package/dist/migrations/v2.2/index.d.ts.map +1 -0
- package/dist/migrations/v2.2/index.js +456 -0
- package/dist/migrations/v2.2/read-declaration-through-helper.d.ts +39 -0
- package/dist/migrations/v2.2/read-declaration-through-helper.d.ts.map +1 -0
- package/dist/migrations/v2.2/read-declaration-through-helper.js +257 -0
- package/dist/notification/index.js +271 -86
- package/dist/scopes/index.d.ts +29 -6
- package/dist/scopes/index.js +14 -1
- package/dist/templates/charts-values/traefik/values.yaml +2 -3
- package/opencrvs-toolkit-2.2.0-rc.9042a13.tgz +0 -0
- package/package.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/dist/migrations/v2.1/add-translations.d.ts +0 -9
- package/dist/migrations/v2.1/add-translations.d.ts.map +0 -1
- package/opencrvs-toolkit-2.1.0.tgz +0 -0
|
@@ -38,7 +38,7 @@ __export(notification_exports, {
|
|
|
38
38
|
triggerUserEventNotification: () => triggerUserEventNotification
|
|
39
39
|
});
|
|
40
40
|
module.exports = __toCommonJS(notification_exports);
|
|
41
|
-
var
|
|
41
|
+
var z48 = __toESM(require("zod/v4"));
|
|
42
42
|
|
|
43
43
|
// ../commons/src/events/AuditLog.ts
|
|
44
44
|
var z9 = __toESM(require("zod/v4"));
|
|
@@ -83,6 +83,8 @@ var ActionType = {
|
|
|
83
83
|
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
|
84
84
|
REJECT_CORRECTION: "REJECT_CORRECTION",
|
|
85
85
|
APPROVE_CORRECTION: "APPROVE_CORRECTION",
|
|
86
|
+
REVOKE_REGISTRATION: "REVOKE_REGISTRATION",
|
|
87
|
+
REINSTATE_REGISTRATION: "REINSTATE_REGISTRATION",
|
|
86
88
|
// General actions
|
|
87
89
|
READ: "READ",
|
|
88
90
|
ASSIGN: "ASSIGN",
|
|
@@ -102,6 +104,8 @@ var ConfirmableActions = [
|
|
|
102
104
|
ActionType.REQUEST_CORRECTION,
|
|
103
105
|
ActionType.APPROVE_CORRECTION,
|
|
104
106
|
ActionType.REJECT_CORRECTION,
|
|
107
|
+
ActionType.REVOKE_REGISTRATION,
|
|
108
|
+
ActionType.REINSTATE_REGISTRATION,
|
|
105
109
|
ActionType.CUSTOM
|
|
106
110
|
];
|
|
107
111
|
var ActionTypes = z2.enum([
|
|
@@ -121,6 +125,8 @@ var ActionTypes = z2.enum([
|
|
|
121
125
|
"REQUEST_CORRECTION",
|
|
122
126
|
"REJECT_CORRECTION",
|
|
123
127
|
"APPROVE_CORRECTION",
|
|
128
|
+
"REVOKE_REGISTRATION",
|
|
129
|
+
"REINSTATE_REGISTRATION",
|
|
124
130
|
"READ",
|
|
125
131
|
"ASSIGN",
|
|
126
132
|
"UNASSIGN",
|
|
@@ -162,7 +168,9 @@ var WorkqueueActionType = ActionTypes.extract([
|
|
|
162
168
|
ActionType.ARCHIVE,
|
|
163
169
|
ActionType.UNARCHIVE,
|
|
164
170
|
ActionType.PRINT_CERTIFICATE,
|
|
165
|
-
ActionType.REQUEST_CORRECTION
|
|
171
|
+
ActionType.REQUEST_CORRECTION,
|
|
172
|
+
ActionType.REVOKE_REGISTRATION,
|
|
173
|
+
ActionType.REINSTATE_REGISTRATION
|
|
166
174
|
]);
|
|
167
175
|
var META_ACTIONS = [
|
|
168
176
|
ActionType.ASSIGN,
|
|
@@ -314,6 +322,7 @@ var EventStatus = z6.enum([
|
|
|
314
322
|
"NOTIFIED",
|
|
315
323
|
"DECLARED",
|
|
316
324
|
"REGISTERED",
|
|
325
|
+
"REVOKED",
|
|
317
326
|
"ARCHIVED"
|
|
318
327
|
]);
|
|
319
328
|
|
|
@@ -337,6 +346,8 @@ var RecordScopeTypeV2 = z7.enum([
|
|
|
337
346
|
"record.print-certified-copies",
|
|
338
347
|
"record.request-correction",
|
|
339
348
|
"record.correct",
|
|
349
|
+
"record.revoke-registration",
|
|
350
|
+
"record.reinstate-registration",
|
|
340
351
|
"record.unassign-others",
|
|
341
352
|
"record.custom-action",
|
|
342
353
|
"record.action.accept",
|
|
@@ -463,6 +474,8 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
|
463
474
|
"record.read",
|
|
464
475
|
"record.request-correction",
|
|
465
476
|
"record.correct",
|
|
477
|
+
"record.revoke-registration",
|
|
478
|
+
"record.reinstate-registration",
|
|
466
479
|
"record.unassign-others",
|
|
467
480
|
"record.review-duplicates"
|
|
468
481
|
]);
|
|
@@ -648,6 +661,8 @@ var EventActionEntrySchema = AuditLogEntryBase.extend({
|
|
|
648
661
|
"event.actions.correction.request.request",
|
|
649
662
|
"event.actions.correction.approve.request",
|
|
650
663
|
"event.actions.correction.reject.request",
|
|
664
|
+
"event.actions.revoke_registration.request",
|
|
665
|
+
"event.actions.reinstate_registration.request",
|
|
651
666
|
"event.actions.mark_as_duplicate.request",
|
|
652
667
|
"event.actions.mark_as_not_duplicate.request"
|
|
653
668
|
]),
|
|
@@ -1391,6 +1406,16 @@ var UnarchiveAction = ActionBase.extend(
|
|
|
1391
1406
|
type: z16.literal(ActionType.UNARCHIVE)
|
|
1392
1407
|
}).shape
|
|
1393
1408
|
);
|
|
1409
|
+
var RevokeRegistrationAction = ActionBase.extend(
|
|
1410
|
+
z16.object({
|
|
1411
|
+
type: z16.literal(ActionType.REVOKE_REGISTRATION)
|
|
1412
|
+
}).shape
|
|
1413
|
+
);
|
|
1414
|
+
var ReinstateRegistrationAction = ActionBase.extend(
|
|
1415
|
+
z16.object({
|
|
1416
|
+
type: z16.literal(ActionType.REINSTATE_REGISTRATION)
|
|
1417
|
+
}).shape
|
|
1418
|
+
);
|
|
1394
1419
|
var CreatedAction = ActionBase.extend(
|
|
1395
1420
|
z16.object({
|
|
1396
1421
|
type: z16.literal(ActionType.CREATE)
|
|
@@ -1459,6 +1484,8 @@ var ActionDocument = z16.discriminatedUnion("type", [
|
|
|
1459
1484
|
MarkAsDuplicateAction.meta({ id: "MarkAsDuplicateAction" }),
|
|
1460
1485
|
ArchiveAction.meta({ id: "ArchiveAction" }),
|
|
1461
1486
|
UnarchiveAction.meta({ id: "UnarchiveAction" }),
|
|
1487
|
+
RevokeRegistrationAction.meta({ id: "RevokeRegistrationAction" }),
|
|
1488
|
+
ReinstateRegistrationAction.meta({ id: "ReinstateRegistrationAction" }),
|
|
1462
1489
|
NotifiedAction.meta({ id: "NotifiedAction" }),
|
|
1463
1490
|
RegisterAction.meta({ id: "RegisterAction" }),
|
|
1464
1491
|
DeclareAction.meta({ id: "DeclareAction" }),
|
|
@@ -1507,7 +1534,8 @@ var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
|
1507
1534
|
var LegalStatuses = z17.object({
|
|
1508
1535
|
[EventStatus.enum.NOTIFIED]: ActionCreationMetadata.nullish(),
|
|
1509
1536
|
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
|
1510
|
-
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
|
1537
|
+
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish(),
|
|
1538
|
+
[EventStatus.enum.REVOKED]: ActionCreationMetadata.nullish()
|
|
1511
1539
|
});
|
|
1512
1540
|
var EventMetadata = z17.object({
|
|
1513
1541
|
id: UUID,
|
|
@@ -1676,6 +1704,7 @@ var QueryExpression = import_v4.z.object({
|
|
|
1676
1704
|
"legalStatuses.REGISTERED.createdAtLocation": import_v4.z.optional(Within).nullable(),
|
|
1677
1705
|
"legalStatuses.REGISTERED.createdByRole": import_v4.z.optional(AnyOf),
|
|
1678
1706
|
"legalStatuses.REGISTERED.registrationNumber": import_v4.z.optional(Exact),
|
|
1707
|
+
"legalStatuses.REVOKED.createdAtLocation": import_v4.z.optional(Within).nullable(),
|
|
1679
1708
|
createdAtLocation: import_v4.z.optional(import_v4.z.union([Within, Exact])),
|
|
1680
1709
|
updatedAtLocation: import_v4.z.optional(import_v4.z.union([Within, Exact])),
|
|
1681
1710
|
assignedTo: import_v4.z.optional(Exact),
|
|
@@ -2925,6 +2954,9 @@ var DeleteConfig = ActionConfigBase.extend(
|
|
|
2925
2954
|
var DeclareConfig = DeclarationActionBase.extend(
|
|
2926
2955
|
z25.object({
|
|
2927
2956
|
type: z25.literal(ActionType.DECLARE),
|
|
2957
|
+
declaration: DeclarationFormConfig.describe(
|
|
2958
|
+
"Configuration of the form used to gather event data."
|
|
2959
|
+
),
|
|
2928
2960
|
review: DeclarationReviewConfig.describe(
|
|
2929
2961
|
"Configuration of the review page fields."
|
|
2930
2962
|
),
|
|
@@ -2953,6 +2985,18 @@ var UnarchiveConfig = ActionConfigBase.extend(
|
|
|
2953
2985
|
type: z25.literal(ActionType.UNARCHIVE)
|
|
2954
2986
|
}).shape
|
|
2955
2987
|
);
|
|
2988
|
+
var RevokeRegistrationConfig = ActionConfigBase.extend(
|
|
2989
|
+
z25.object({
|
|
2990
|
+
type: z25.literal(ActionType.REVOKE_REGISTRATION),
|
|
2991
|
+
form: actionConfirmationForm
|
|
2992
|
+
}).shape
|
|
2993
|
+
);
|
|
2994
|
+
var ReinstateRegistrationConfig = ActionConfigBase.extend(
|
|
2995
|
+
z25.object({
|
|
2996
|
+
type: z25.literal(ActionType.REINSTATE_REGISTRATION),
|
|
2997
|
+
form: actionConfirmationForm
|
|
2998
|
+
}).shape
|
|
2999
|
+
);
|
|
2956
3000
|
var EditActionConfig = ActionConfigBase.extend(
|
|
2957
3001
|
z25.object({
|
|
2958
3002
|
type: z25.literal(ActionType.EDIT),
|
|
@@ -3093,6 +3137,14 @@ var ActionConfig = z25.discriminatedUnion("type", [
|
|
|
3093
3137
|
id: "UnarchiveActionConfig",
|
|
3094
3138
|
description: "Configuration for unarchiving a record."
|
|
3095
3139
|
}),
|
|
3140
|
+
RevokeRegistrationConfig.meta({
|
|
3141
|
+
id: "RevokeRegistrationActionConfig",
|
|
3142
|
+
description: "Configuration for revoking a registered record."
|
|
3143
|
+
}),
|
|
3144
|
+
ReinstateRegistrationConfig.meta({
|
|
3145
|
+
id: "ReinstateRegistrationActionConfig",
|
|
3146
|
+
description: "Configuration for reinstating a revoked record back to registered."
|
|
3147
|
+
}),
|
|
3096
3148
|
CustomActionConfig.meta({
|
|
3097
3149
|
id: "CustomActionConfig",
|
|
3098
3150
|
description: "Configuration for a country-defined custom action. An event may include any number of these."
|
|
@@ -3503,6 +3555,8 @@ var updateActions = new Set(
|
|
|
3503
3555
|
ActionType.REQUEST_CORRECTION,
|
|
3504
3556
|
ActionType.APPROVE_CORRECTION,
|
|
3505
3557
|
ActionType.REJECT_CORRECTION,
|
|
3558
|
+
ActionType.REVOKE_REGISTRATION,
|
|
3559
|
+
ActionType.REINSTATE_REGISTRATION,
|
|
3506
3560
|
ActionType.CUSTOM
|
|
3507
3561
|
]).options
|
|
3508
3562
|
);
|
|
@@ -4322,8 +4376,22 @@ function isOnline() {
|
|
|
4322
4376
|
|
|
4323
4377
|
// ../commons/src/events/utils.ts
|
|
4324
4378
|
var import_date_fns3 = require("date-fns");
|
|
4379
|
+
function getDeclaration(configuration) {
|
|
4380
|
+
const declareAction = configuration.actions.find(
|
|
4381
|
+
(action) => action.type === ActionType.DECLARE
|
|
4382
|
+
);
|
|
4383
|
+
if (!declareAction) {
|
|
4384
|
+
throw new Error(
|
|
4385
|
+
`Event '${configuration.id}' has no ${ActionType.DECLARE} action to read the declaration from`
|
|
4386
|
+
);
|
|
4387
|
+
}
|
|
4388
|
+
return declareAction.declaration;
|
|
4389
|
+
}
|
|
4390
|
+
function getDeclarationPages(configuration) {
|
|
4391
|
+
return getDeclaration(configuration).pages;
|
|
4392
|
+
}
|
|
4325
4393
|
function getDeclarationFields(configuration) {
|
|
4326
|
-
return configuration.
|
|
4394
|
+
return getDeclarationPages(configuration).flatMap(({ fields }) => fields);
|
|
4327
4395
|
}
|
|
4328
4396
|
var getActionAnnotationFields = (actionConfig) => {
|
|
4329
4397
|
if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
|
|
@@ -4469,6 +4537,43 @@ function validateActionOrder(event2, ctx) {
|
|
|
4469
4537
|
}
|
|
4470
4538
|
}
|
|
4471
4539
|
}
|
|
4540
|
+
function validateExactlyOneDeclareAction(event2, ctx) {
|
|
4541
|
+
const declareActionCount = event2.actions.filter(
|
|
4542
|
+
(action) => action.type === ActionType.DECLARE
|
|
4543
|
+
).length;
|
|
4544
|
+
if (declareActionCount !== 1) {
|
|
4545
|
+
ctx.addIssue({
|
|
4546
|
+
code: "custom",
|
|
4547
|
+
message: `Event must have exactly one ${ActionType.DECLARE} action. Found ${declareActionCount} for event ${event2.id}`,
|
|
4548
|
+
path: ["actions"]
|
|
4549
|
+
});
|
|
4550
|
+
return false;
|
|
4551
|
+
}
|
|
4552
|
+
return true;
|
|
4553
|
+
}
|
|
4554
|
+
function validateDeclarationGivenExactlyOnce(config, ctx) {
|
|
4555
|
+
const declareActionIndex = config.actions.findIndex(
|
|
4556
|
+
(action) => action.type === ActionType.DECLARE
|
|
4557
|
+
);
|
|
4558
|
+
const declareAction = config.actions[declareActionIndex];
|
|
4559
|
+
const onDeclareAction = declareAction.type === ActionType.DECLARE && !!declareAction.declaration;
|
|
4560
|
+
const onTopLevel = !!config.declaration;
|
|
4561
|
+
const declareActionPath = `actions[${declareActionIndex}].declaration`;
|
|
4562
|
+
if (onTopLevel && onDeclareAction) {
|
|
4563
|
+
ctx.addIssue({
|
|
4564
|
+
code: "custom",
|
|
4565
|
+
message: `Event '${config.id}' defines \`declaration\` both at the top level and on the ${ActionType.DECLARE} action (\`${declareActionPath}\`). Define it in only one of these places.`,
|
|
4566
|
+
path: ["declaration"]
|
|
4567
|
+
});
|
|
4568
|
+
}
|
|
4569
|
+
if (!onTopLevel && !onDeclareAction) {
|
|
4570
|
+
ctx.addIssue({
|
|
4571
|
+
code: "custom",
|
|
4572
|
+
message: `Event '${config.id}' does not define \`declaration\`. Define it either at the top level or on the ${ActionType.DECLARE} action (\`${declareActionPath}\`).`,
|
|
4573
|
+
path: ["declaration"]
|
|
4574
|
+
});
|
|
4575
|
+
}
|
|
4576
|
+
}
|
|
4472
4577
|
|
|
4473
4578
|
// ../commons/src/events/EventConfig.ts
|
|
4474
4579
|
var EventFieldReference = z35.object({ $$event: EventMetadataDateFieldIdInput }).describe(
|
|
@@ -4493,16 +4598,15 @@ var _EventConfigBase = z35.object({
|
|
|
4493
4598
|
summary: SummaryConfig.describe(
|
|
4494
4599
|
"Summary information displayed in the event overview."
|
|
4495
4600
|
),
|
|
4496
|
-
label: TranslationConfig.describe(
|
|
4601
|
+
label: TranslationConfig.describe(
|
|
4602
|
+
"Human-readable label for the event type."
|
|
4603
|
+
),
|
|
4497
4604
|
actions: z35.array(ActionConfig).describe(
|
|
4498
4605
|
"Configuration of core and custom actions associated with the event."
|
|
4499
4606
|
),
|
|
4500
4607
|
actionOrder: z35.array(z35.string()).optional().describe(
|
|
4501
4608
|
"Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
|
|
4502
4609
|
),
|
|
4503
|
-
declaration: DeclarationFormConfig.describe(
|
|
4504
|
-
"Configuration of the form used to gather event data."
|
|
4505
|
-
),
|
|
4506
4610
|
advancedSearch: z35.array(AdvancedSearchConfig).optional().default([]).describe(
|
|
4507
4611
|
"Configuration of fields available in the advanced search feature."
|
|
4508
4612
|
),
|
|
@@ -4517,6 +4621,9 @@ var _EventConfigBase = z35.object({
|
|
|
4517
4621
|
)
|
|
4518
4622
|
});
|
|
4519
4623
|
var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
|
|
4624
|
+
if (!validateExactlyOneDeclareAction(event2, ctx)) {
|
|
4625
|
+
return;
|
|
4626
|
+
}
|
|
4520
4627
|
validateAdvancedSearchConfig(event2, ctx);
|
|
4521
4628
|
validateDateOfEvent(event2, ctx);
|
|
4522
4629
|
validatePlaceOfEvent(event2, ctx);
|
|
@@ -4788,6 +4895,7 @@ var SerializedQueryExpression = z37.object({
|
|
|
4788
4895
|
"legalStatuses.REGISTERED.createdAtLocation": z37.optional(SerializableWithin),
|
|
4789
4896
|
"legalStatuses.REGISTERED.createdByRole": z37.optional(AnyOf),
|
|
4790
4897
|
"legalStatuses.REGISTERED.registrationNumber": z37.optional(Exact),
|
|
4898
|
+
"legalStatuses.REVOKED.createdAtLocation": z37.optional(SerializableWithin),
|
|
4791
4899
|
createdAtLocation: z37.optional(
|
|
4792
4900
|
z37.union([SerializableWithin, SerializableExact])
|
|
4793
4901
|
),
|
|
@@ -4999,6 +5107,16 @@ var UnarchiveActionInput = BaseActionInput.extend(
|
|
|
4999
5107
|
type: z39.literal(ActionType.UNARCHIVE).default(ActionType.UNARCHIVE)
|
|
5000
5108
|
}).shape
|
|
5001
5109
|
);
|
|
5110
|
+
var RevokeRegistrationActionInput = BaseActionInput.extend(
|
|
5111
|
+
z39.object({
|
|
5112
|
+
type: z39.literal(ActionType.REVOKE_REGISTRATION).default(ActionType.REVOKE_REGISTRATION)
|
|
5113
|
+
}).shape
|
|
5114
|
+
);
|
|
5115
|
+
var ReinstateRegistrationActionInput = BaseActionInput.extend(
|
|
5116
|
+
z39.object({
|
|
5117
|
+
type: z39.literal(ActionType.REINSTATE_REGISTRATION).default(ActionType.REINSTATE_REGISTRATION)
|
|
5118
|
+
}).shape
|
|
5119
|
+
);
|
|
5002
5120
|
var AssignActionInput = BaseActionInput.extend(
|
|
5003
5121
|
z39.object({
|
|
5004
5122
|
type: z39.literal(ActionType.ASSIGN),
|
|
@@ -5061,6 +5179,12 @@ var ActionInput = z39.discriminatedUnion("type", [
|
|
|
5061
5179
|
}),
|
|
5062
5180
|
ArchiveActionInput.meta({ id: "ArchiveActionInput" }),
|
|
5063
5181
|
UnarchiveActionInput.meta({ id: "UnarchiveActionInput" }),
|
|
5182
|
+
RevokeRegistrationActionInput.meta({
|
|
5183
|
+
id: "RevokeRegistrationActionInput"
|
|
5184
|
+
}),
|
|
5185
|
+
ReinstateRegistrationActionInput.meta({
|
|
5186
|
+
id: "ReinstateRegistrationActionInput"
|
|
5187
|
+
}),
|
|
5064
5188
|
AssignActionInput.meta({ id: "AssignActionInput" }),
|
|
5065
5189
|
UnassignActionInput.meta({ id: "UnassignActionInput" }),
|
|
5066
5190
|
PrintCertificateActionInput.meta({ id: "PrintCertificateActionInput" }),
|
|
@@ -5136,10 +5260,29 @@ var EventDocumentOnlyLastAction = EventDocument.extend({
|
|
|
5136
5260
|
}).brand("EventDocumentOnlyLastAction");
|
|
5137
5261
|
|
|
5138
5262
|
// ../commons/src/events/defineConfig.ts
|
|
5139
|
-
var
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5263
|
+
var z43 = __toESM(require("zod/v4"));
|
|
5264
|
+
function moveDeclarationToDeclareAction({
|
|
5265
|
+
declaration,
|
|
5266
|
+
...config
|
|
5267
|
+
}) {
|
|
5268
|
+
if (declaration) {
|
|
5269
|
+
console.warn(
|
|
5270
|
+
`Event '${config.id}' defines \`declaration\` at the top level, which is deprecated and will be removed in a future release. Define it on the ${ActionType.DECLARE} action instead.`
|
|
5271
|
+
);
|
|
5272
|
+
}
|
|
5273
|
+
return {
|
|
5274
|
+
...config,
|
|
5275
|
+
actions: config.actions.map(
|
|
5276
|
+
(action) => action.type === ActionType.DECLARE && declaration ? { ...action, declaration } : action
|
|
5277
|
+
)
|
|
5278
|
+
};
|
|
5279
|
+
}
|
|
5280
|
+
var EventConfigDefinition = z43.custom().superRefine((config, ctx) => {
|
|
5281
|
+
if (validateExactlyOneDeclareAction(config, ctx)) {
|
|
5282
|
+
validateDeclarationGivenExactlyOnce(config, ctx);
|
|
5283
|
+
}
|
|
5284
|
+
}).transform(moveDeclarationToDeclareAction).pipe(EventConfig);
|
|
5285
|
+
var defineConfig = (config) => EventConfigDefinition.parse(config);
|
|
5143
5286
|
|
|
5144
5287
|
// ../commons/src/events/test.utils.ts
|
|
5145
5288
|
var import_lodash5 = require("lodash");
|
|
@@ -7125,7 +7268,24 @@ var libraryMembershipEvent = defineConfig({
|
|
|
7125
7268
|
id: "event.library-membership.title"
|
|
7126
7269
|
},
|
|
7127
7270
|
summary: { fields: [] },
|
|
7128
|
-
actions: [
|
|
7271
|
+
actions: [
|
|
7272
|
+
{
|
|
7273
|
+
type: ActionType.DECLARE,
|
|
7274
|
+
label: {
|
|
7275
|
+
defaultMessage: "Declare",
|
|
7276
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
|
7277
|
+
id: "event.library-membership.action.declare.label"
|
|
7278
|
+
},
|
|
7279
|
+
review: {
|
|
7280
|
+
title: {
|
|
7281
|
+
defaultMessage: "Library membership application",
|
|
7282
|
+
description: "Title of the review page",
|
|
7283
|
+
id: "event.library-membership.action.declare.form.review.title"
|
|
7284
|
+
},
|
|
7285
|
+
fields: []
|
|
7286
|
+
}
|
|
7287
|
+
}
|
|
7288
|
+
],
|
|
7129
7289
|
declaration: libraryMembershipForm
|
|
7130
7290
|
});
|
|
7131
7291
|
|
|
@@ -7571,6 +7731,22 @@ var digitalIdentityEvent = defineConfig({
|
|
|
7571
7731
|
},
|
|
7572
7732
|
summary: { fields: [] },
|
|
7573
7733
|
actions: [
|
|
7734
|
+
{
|
|
7735
|
+
type: ActionType.DECLARE,
|
|
7736
|
+
label: {
|
|
7737
|
+
defaultMessage: "Declare",
|
|
7738
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
|
7739
|
+
id: "event.digital-identity.action.declare.label"
|
|
7740
|
+
},
|
|
7741
|
+
review: {
|
|
7742
|
+
title: {
|
|
7743
|
+
defaultMessage: "Digital identity issuance",
|
|
7744
|
+
description: "Title of the review page",
|
|
7745
|
+
id: "event.digital-identity.action.declare.form.review.title"
|
|
7746
|
+
},
|
|
7747
|
+
fields: []
|
|
7748
|
+
}
|
|
7749
|
+
},
|
|
7574
7750
|
{
|
|
7575
7751
|
type: ActionType.PRINT_CERTIFICATE,
|
|
7576
7752
|
label: {
|
|
@@ -7585,39 +7761,39 @@ var digitalIdentityEvent = defineConfig({
|
|
|
7585
7761
|
});
|
|
7586
7762
|
|
|
7587
7763
|
// ../commons/src/events/test.utils.ts
|
|
7588
|
-
var
|
|
7764
|
+
var z45 = __toESM(require("zod/v4"));
|
|
7589
7765
|
|
|
7590
7766
|
// ../commons/src/events/locations.ts
|
|
7591
|
-
var
|
|
7592
|
-
var LocationTypeV1 =
|
|
7767
|
+
var z44 = __toESM(require("zod/v4"));
|
|
7768
|
+
var LocationTypeV1 = z44.enum([
|
|
7593
7769
|
"ADMIN_STRUCTURE",
|
|
7594
7770
|
"CRVS_OFFICE",
|
|
7595
7771
|
"HEALTH_FACILITY"
|
|
7596
7772
|
]);
|
|
7597
|
-
var LocationStatus =
|
|
7598
|
-
var LocationVersion =
|
|
7773
|
+
var LocationStatus = z44.enum(["active", "inactive"]);
|
|
7774
|
+
var LocationVersion = z44.object({
|
|
7599
7775
|
versionId: UUID,
|
|
7600
|
-
effectiveFrom:
|
|
7601
|
-
name:
|
|
7602
|
-
externalId:
|
|
7776
|
+
effectiveFrom: z44.iso.date(),
|
|
7777
|
+
name: z44.string(),
|
|
7778
|
+
externalId: z44.string().nullish(),
|
|
7603
7779
|
status: LocationStatus
|
|
7604
7780
|
});
|
|
7605
|
-
var AdministrativeArea =
|
|
7781
|
+
var AdministrativeArea = z44.object({
|
|
7606
7782
|
id: UUID,
|
|
7607
|
-
name:
|
|
7608
|
-
externalId:
|
|
7783
|
+
name: z44.string(),
|
|
7784
|
+
externalId: z44.string().nullish(),
|
|
7609
7785
|
parentId: UUID.nullable(),
|
|
7610
7786
|
status: LocationStatus,
|
|
7611
|
-
versions:
|
|
7787
|
+
versions: z44.array(LocationVersion)
|
|
7612
7788
|
});
|
|
7613
|
-
var Location =
|
|
7789
|
+
var Location = z44.object({
|
|
7614
7790
|
id: UUID,
|
|
7615
|
-
name:
|
|
7616
|
-
externalId:
|
|
7791
|
+
name: z44.string(),
|
|
7792
|
+
externalId: z44.string().nullish(),
|
|
7617
7793
|
administrativeAreaId: UUID.nullable(),
|
|
7618
|
-
locationType:
|
|
7794
|
+
locationType: z44.string().nullable(),
|
|
7619
7795
|
status: LocationStatus,
|
|
7620
|
-
versions:
|
|
7796
|
+
versions: z44.array(LocationVersion)
|
|
7621
7797
|
});
|
|
7622
7798
|
var ClientAdministrativeArea = AdministrativeArea.omit({
|
|
7623
7799
|
name: true,
|
|
@@ -7658,22 +7834,22 @@ function validateUniqueIds(versions, ctx) {
|
|
|
7658
7834
|
ctx.addIssue("versions must not repeat a versionId");
|
|
7659
7835
|
}
|
|
7660
7836
|
}
|
|
7661
|
-
var SeededLocationVersions =
|
|
7837
|
+
var SeededLocationVersions = z44.array(LocationVersion).min(1).superRefine((versions, ctx) => {
|
|
7662
7838
|
validateAscendingDates(versions, ctx);
|
|
7663
7839
|
validateUniqueIds(versions, ctx);
|
|
7664
7840
|
});
|
|
7665
|
-
var SetLocationPayload =
|
|
7841
|
+
var SetLocationPayload = z44.object({
|
|
7666
7842
|
id: UUID,
|
|
7667
|
-
name:
|
|
7668
|
-
externalId:
|
|
7843
|
+
name: z44.string(),
|
|
7844
|
+
externalId: z44.string().nullish(),
|
|
7669
7845
|
administrativeAreaId: UUID.nullable(),
|
|
7670
|
-
locationType:
|
|
7846
|
+
locationType: z44.string().nullable(),
|
|
7671
7847
|
versions: SeededLocationVersions.optional()
|
|
7672
7848
|
});
|
|
7673
|
-
var SetAdministrativeAreaPayload =
|
|
7849
|
+
var SetAdministrativeAreaPayload = z44.object({
|
|
7674
7850
|
id: UUID,
|
|
7675
|
-
name:
|
|
7676
|
-
externalId:
|
|
7851
|
+
name: z44.string(),
|
|
7852
|
+
externalId: z44.string().nullish(),
|
|
7677
7853
|
parentId: UUID.nullable(),
|
|
7678
7854
|
versions: SeededLocationVersions.optional()
|
|
7679
7855
|
});
|
|
@@ -8021,7 +8197,7 @@ var V2_DEFAULT_MOCK_CLIENT_ADMINISTRATIVE_AREAS_MAP = new Map(
|
|
|
8021
8197
|
);
|
|
8022
8198
|
|
|
8023
8199
|
// ../commons/src/events/test.utils.ts
|
|
8024
|
-
var TestUserRole =
|
|
8200
|
+
var TestUserRole = z45.enum([
|
|
8025
8201
|
"FIELD_AGENT",
|
|
8026
8202
|
"LOCAL_REGISTRAR",
|
|
8027
8203
|
"LOCAL_SYSTEM_ADMIN",
|
|
@@ -8051,6 +8227,8 @@ var ACTION_SCOPE_MAP = {
|
|
|
8051
8227
|
[ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: ["record.correct"],
|
|
8052
8228
|
[ActionType.REJECT_CORRECTION]: ["record.correct"],
|
|
8053
8229
|
[ActionType.APPROVE_CORRECTION]: ["record.correct"],
|
|
8230
|
+
[ActionType.REVOKE_REGISTRATION]: ["record.revoke-registration"],
|
|
8231
|
+
[ActionType.REINSTATE_REGISTRATION]: ["record.reinstate-registration"],
|
|
8054
8232
|
[ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
|
|
8055
8233
|
[ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
|
|
8056
8234
|
[ActionType.ARCHIVE]: ["record.archive"],
|
|
@@ -8097,7 +8275,12 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
|
8097
8275
|
ActionType.APPROVE_CORRECTION,
|
|
8098
8276
|
ActionType.REJECT_CORRECTION,
|
|
8099
8277
|
ActionType.CUSTOM,
|
|
8100
|
-
ClientSpecificAction.REVIEW_CORRECTION_REQUEST
|
|
8278
|
+
ClientSpecificAction.REVIEW_CORRECTION_REQUEST,
|
|
8279
|
+
ActionType.REVOKE_REGISTRATION
|
|
8280
|
+
],
|
|
8281
|
+
[EventStatus.enum.REVOKED]: [
|
|
8282
|
+
ActionType.READ,
|
|
8283
|
+
ActionType.REINSTATE_REGISTRATION
|
|
8101
8284
|
],
|
|
8102
8285
|
[EventStatus.enum.ARCHIVED]: [
|
|
8103
8286
|
ActionType.READ,
|
|
@@ -8111,6 +8294,8 @@ var ACTION_FILTERS = {
|
|
|
8111
8294
|
[ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8112
8295
|
[ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8113
8296
|
[ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8297
|
+
[ActionType.REVOKE_REGISTRATION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8298
|
+
[ActionType.REINSTATE_REGISTRATION]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8114
8299
|
[ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8115
8300
|
[ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8116
8301
|
[ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
@@ -8133,55 +8318,55 @@ var REJECTED_ACTIONS = [
|
|
|
8133
8318
|
var import_lodash7 = require("lodash");
|
|
8134
8319
|
|
|
8135
8320
|
// ../commons/src/events/locationPayloads.ts
|
|
8136
|
-
var
|
|
8137
|
-
var CreateLocationPayload =
|
|
8321
|
+
var z46 = __toESM(require("zod/v4"));
|
|
8322
|
+
var CreateLocationPayload = z46.object({
|
|
8138
8323
|
id: UUID.optional(),
|
|
8139
8324
|
versionId: UUID.optional(),
|
|
8140
|
-
name:
|
|
8141
|
-
externalId:
|
|
8325
|
+
name: z46.string(),
|
|
8326
|
+
externalId: z46.string().nullish(),
|
|
8142
8327
|
administrativeAreaId: UUID.nullable(),
|
|
8143
|
-
locationType:
|
|
8144
|
-
effectiveFrom:
|
|
8328
|
+
locationType: z46.string().nullable(),
|
|
8329
|
+
effectiveFrom: z46.iso.date().optional(),
|
|
8145
8330
|
status: LocationStatus.default("active")
|
|
8146
8331
|
});
|
|
8147
|
-
var UpdateLocationPayload =
|
|
8332
|
+
var UpdateLocationPayload = z46.strictObject({
|
|
8148
8333
|
id: UUID,
|
|
8149
8334
|
versionId: UUID.optional(),
|
|
8150
|
-
name:
|
|
8151
|
-
externalId:
|
|
8335
|
+
name: z46.string(),
|
|
8336
|
+
externalId: z46.string().nullish(),
|
|
8152
8337
|
status: LocationStatus,
|
|
8153
|
-
effectiveFrom:
|
|
8338
|
+
effectiveFrom: z46.iso.date().optional(),
|
|
8154
8339
|
lastVersionId: UUID
|
|
8155
8340
|
});
|
|
8156
|
-
var WithdrawLocationVersionPayload =
|
|
8341
|
+
var WithdrawLocationVersionPayload = z46.object({
|
|
8157
8342
|
id: UUID,
|
|
8158
8343
|
versionId: UUID
|
|
8159
8344
|
});
|
|
8160
|
-
var CreateAdministrativeAreaPayload =
|
|
8345
|
+
var CreateAdministrativeAreaPayload = z46.object({
|
|
8161
8346
|
id: UUID.optional(),
|
|
8162
8347
|
versionId: UUID.optional(),
|
|
8163
|
-
name:
|
|
8164
|
-
externalId:
|
|
8348
|
+
name: z46.string(),
|
|
8349
|
+
externalId: z46.string().nullish(),
|
|
8165
8350
|
parentId: UUID.nullable(),
|
|
8166
|
-
effectiveFrom:
|
|
8351
|
+
effectiveFrom: z46.iso.date().optional(),
|
|
8167
8352
|
status: LocationStatus.default("active")
|
|
8168
8353
|
});
|
|
8169
|
-
var UpdateAdministrativeAreaPayload =
|
|
8354
|
+
var UpdateAdministrativeAreaPayload = z46.strictObject({
|
|
8170
8355
|
id: UUID,
|
|
8171
8356
|
versionId: UUID.optional(),
|
|
8172
|
-
name:
|
|
8173
|
-
externalId:
|
|
8357
|
+
name: z46.string(),
|
|
8358
|
+
externalId: z46.string().nullish(),
|
|
8174
8359
|
status: LocationStatus,
|
|
8175
|
-
effectiveFrom:
|
|
8360
|
+
effectiveFrom: z46.iso.date().optional(),
|
|
8176
8361
|
lastVersionId: UUID
|
|
8177
8362
|
});
|
|
8178
|
-
var WithdrawAdministrativeAreaVersionPayload =
|
|
8363
|
+
var WithdrawAdministrativeAreaVersionPayload = z46.object({
|
|
8179
8364
|
id: UUID,
|
|
8180
8365
|
versionId: UUID
|
|
8181
8366
|
});
|
|
8182
8367
|
|
|
8183
8368
|
// ../commons/src/notification/UserNotifications.ts
|
|
8184
|
-
var
|
|
8369
|
+
var z47 = __toESM(require("zod/v4"));
|
|
8185
8370
|
var TriggerEvent = {
|
|
8186
8371
|
USER_CREATED: "user-created",
|
|
8187
8372
|
USER_UPDATED: "user-updated",
|
|
@@ -8196,60 +8381,60 @@ var TriggerEvent = {
|
|
|
8196
8381
|
CHANGE_PHONE_NUMBER: "change-phone-number",
|
|
8197
8382
|
CHANGE_EMAIL_ADDRESS: "change-email-address"
|
|
8198
8383
|
};
|
|
8199
|
-
var Recipient =
|
|
8384
|
+
var Recipient = z47.object({
|
|
8200
8385
|
name: NameFieldValue.optional(),
|
|
8201
|
-
mobile:
|
|
8202
|
-
email:
|
|
8203
|
-
bcc:
|
|
8386
|
+
mobile: z47.string().optional(),
|
|
8387
|
+
email: z47.string().optional(),
|
|
8388
|
+
bcc: z47.array(z47.string()).optional()
|
|
8204
8389
|
});
|
|
8205
|
-
var BasePayload =
|
|
8390
|
+
var BasePayload = z47.object({
|
|
8206
8391
|
recipient: Recipient
|
|
8207
8392
|
});
|
|
8208
8393
|
var TriggerPayload = {
|
|
8209
8394
|
[TriggerEvent.USER_CREATED]: BasePayload.extend({
|
|
8210
|
-
username:
|
|
8211
|
-
temporaryPassword:
|
|
8395
|
+
username: z47.string(),
|
|
8396
|
+
temporaryPassword: z47.string()
|
|
8212
8397
|
}),
|
|
8213
8398
|
[TriggerEvent.USER_UPDATED]: BasePayload.extend({
|
|
8214
|
-
oldUsername:
|
|
8215
|
-
newUsername:
|
|
8399
|
+
oldUsername: z47.string(),
|
|
8400
|
+
newUsername: z47.string()
|
|
8216
8401
|
}),
|
|
8217
8402
|
[TriggerEvent.USERNAME_REMINDER]: BasePayload.extend({
|
|
8218
|
-
username:
|
|
8403
|
+
username: z47.string()
|
|
8219
8404
|
}),
|
|
8220
8405
|
[TriggerEvent.RESET_PASSWORD]: BasePayload.extend({
|
|
8221
|
-
code:
|
|
8406
|
+
code: z47.string()
|
|
8222
8407
|
}),
|
|
8223
8408
|
[TriggerEvent.RESET_PASSWORD_BY_ADMIN]: BasePayload.extend({
|
|
8224
|
-
temporaryPassword:
|
|
8225
|
-
admin:
|
|
8226
|
-
id:
|
|
8409
|
+
temporaryPassword: z47.string(),
|
|
8410
|
+
admin: z47.object({
|
|
8411
|
+
id: z47.string(),
|
|
8227
8412
|
name: NameFieldValue,
|
|
8228
|
-
role:
|
|
8413
|
+
role: z47.string()
|
|
8229
8414
|
})
|
|
8230
8415
|
}),
|
|
8231
8416
|
[TriggerEvent.PASSWORD_RESET_LINK]: BasePayload.extend({
|
|
8232
|
-
token:
|
|
8417
|
+
token: z47.string()
|
|
8233
8418
|
}),
|
|
8234
8419
|
[TriggerEvent.USERNAME_REMINDER_LINK]: BasePayload.extend({
|
|
8235
|
-
token:
|
|
8420
|
+
token: z47.string()
|
|
8236
8421
|
}),
|
|
8237
8422
|
[TriggerEvent.RESEND_INVITE]: BasePayload.extend({
|
|
8238
|
-
username:
|
|
8239
|
-
temporaryPassword:
|
|
8423
|
+
username: z47.string(),
|
|
8424
|
+
temporaryPassword: z47.string()
|
|
8240
8425
|
}),
|
|
8241
8426
|
[TriggerEvent.TWO_FA]: BasePayload.extend({
|
|
8242
|
-
code:
|
|
8427
|
+
code: z47.string()
|
|
8243
8428
|
}),
|
|
8244
8429
|
[TriggerEvent.ALL_USER_NOTIFICATION]: BasePayload.extend({
|
|
8245
|
-
subject:
|
|
8246
|
-
body:
|
|
8430
|
+
subject: z47.string(),
|
|
8431
|
+
body: z47.string()
|
|
8247
8432
|
}),
|
|
8248
8433
|
[TriggerEvent.CHANGE_PHONE_NUMBER]: BasePayload.extend({
|
|
8249
|
-
code:
|
|
8434
|
+
code: z47.string()
|
|
8250
8435
|
}),
|
|
8251
8436
|
[TriggerEvent.CHANGE_EMAIL_ADDRESS]: BasePayload.extend({
|
|
8252
|
-
code:
|
|
8437
|
+
code: z47.string()
|
|
8253
8438
|
})
|
|
8254
8439
|
};
|
|
8255
8440
|
function parseUserEventTrigger(event2, body) {
|
|
@@ -8352,7 +8537,7 @@ async function triggerUserEventNotification({
|
|
|
8352
8537
|
}
|
|
8353
8538
|
|
|
8354
8539
|
// src/notification/index.ts
|
|
8355
|
-
|
|
8540
|
+
z48.globalRegistry.clear();
|
|
8356
8541
|
// Annotate the CommonJS export names for ESM import in node:
|
|
8357
8542
|
0 && (module.exports = {
|
|
8358
8543
|
BasePayload,
|