@opencrvs/toolkit 1.8.0-rc.fec1d5d → 1.8.0-rc.fef0fdd

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.
@@ -32,6 +32,7 @@ var events_exports = {};
32
32
  __export(events_exports, {
33
33
  ACTION_ALLOWED_CONFIGURABLE_SCOPES: () => ACTION_ALLOWED_CONFIGURABLE_SCOPES,
34
34
  ACTION_ALLOWED_SCOPES: () => ACTION_ALLOWED_SCOPES,
35
+ AVAILABLE_ACTIONS_BY_EVENT_STATUS: () => AVAILABLE_ACTIONS_BY_EVENT_STATUS,
35
36
  Action: () => Action,
36
37
  ActionBase: () => ActionBase,
37
38
  ActionConditional: () => ActionConditional,
@@ -103,6 +104,7 @@ __export(events_exports, {
103
104
  EventState: () => EventState,
104
105
  EventStatus: () => EventStatus,
105
106
  Exact: () => Exact,
107
+ ExactDate: () => ExactDate,
106
108
  ExactStatus: () => ExactStatus,
107
109
  FieldConditional: () => FieldConditional,
108
110
  FieldConfig: () => FieldConfig,
@@ -139,6 +141,7 @@ __export(events_exports, {
139
141
  QueryInput: () => QueryInput,
140
142
  QueryType: () => QueryType,
141
143
  Range: () => Range,
144
+ RangeDate: () => RangeDate,
142
145
  ReadActionInput: () => ReadActionInput,
143
146
  RegisterAction: () => RegisterAction,
144
147
  RegisterActionInput: () => RegisterActionInput,
@@ -155,8 +158,10 @@ __export(events_exports, {
155
158
  SelectOption: () => SelectOption,
156
159
  ShowConditional: () => ShowConditional,
157
160
  SignatureFieldValue: () => SignatureFieldValue,
161
+ StatusChangingActions: () => StatusChangingActions,
158
162
  SummaryConfig: () => SummaryConfig,
159
163
  TENNIS_CLUB_MEMBERSHIP: () => TENNIS_CLUB_MEMBERSHIP,
164
+ TestUserRole: () => TestUserRole,
160
165
  TextValue: () => TextValue,
161
166
  TranslationConfig: () => TranslationConfig,
162
167
  UnassignActionInput: () => UnassignActionInput,
@@ -164,8 +169,10 @@ __export(events_exports, {
164
169
  UrbanAddressValue: () => UrbanAddressValue,
165
170
  User: () => User,
166
171
  ValidateActionInput: () => ValidateActionInput,
172
+ ValidationConfig: () => ValidationConfig,
167
173
  VerificationActionConfig: () => VerificationActionConfig,
168
174
  VerificationPageConfig: () => VerificationPageConfig,
175
+ WRITE_ACTION_SCOPES: () => WRITE_ACTION_SCOPES,
169
176
  Within: () => Within,
170
177
  WorkqueueActionsWithDefault: () => WorkqueueActionsWithDefault,
171
178
  WorkqueueColumn: () => WorkqueueColumn,
@@ -174,6 +181,7 @@ __export(events_exports, {
174
181
  WorkqueueColumnValue: () => WorkqueueColumnValue,
175
182
  WorkqueueConfig: () => WorkqueueConfig,
176
183
  WorkqueueConfigInput: () => WorkqueueConfigInput,
184
+ WorkqueueConfigWithoutQuery: () => WorkqueueConfigWithoutQuery,
177
185
  WorkqueueCountInput: () => WorkqueueCountInput,
178
186
  WorkqueueCountOutput: () => WorkqueueCountOutput,
179
187
  ZodDate: () => ZodDate,
@@ -209,7 +217,6 @@ __export(events_exports, {
209
217
  eventQueryDataGenerator: () => eventQueryDataGenerator,
210
218
  field: () => field,
211
219
  fieldTypes: () => fieldTypes,
212
- filterUnallowedActions: () => filterUnallowedActions,
213
220
  findActiveDrafts: () => findActiveDrafts,
214
221
  findAllFields: () => findAllFields,
215
222
  findLastAssignmentAction: () => findLastAssignmentAction,
@@ -221,8 +228,10 @@ __export(events_exports, {
221
228
  generateEventDraftDocument: () => generateEventDraftDocument,
222
229
  generateRandomName: () => generateRandomName,
223
230
  generateRandomSignature: () => generateRandomSignature,
231
+ generateRegistrationNumber: () => generateRegistrationNumber,
224
232
  generateTransactionId: () => generateTransactionId,
225
233
  generateTranslationConfig: () => generateTranslationConfig,
234
+ generateUuid: () => generateUuid,
226
235
  generateWorkqueues: () => generateWorkqueues,
227
236
  getAcceptedActions: () => getAcceptedActions,
228
237
  getActionAnnotation: () => getActionAnnotation,
@@ -565,6 +574,10 @@ var FieldReference = import_zod5.z.object({
565
574
  $$field: FieldId
566
575
  }).describe("Reference to a field by its ID");
567
576
  var ParentReference = FieldReference.optional();
577
+ var ValidationConfig = import_zod5.z.object({
578
+ validator: Conditional,
579
+ message: TranslationConfig
580
+ });
568
581
  var BaseField = import_zod5.z.object({
569
582
  id: FieldId,
570
583
  parent: ParentReference,
@@ -572,12 +585,7 @@ var BaseField = import_zod5.z.object({
572
585
  required: import_zod5.z.boolean().default(false).optional(),
573
586
  secured: import_zod5.z.boolean().default(false).optional(),
574
587
  placeholder: TranslationConfig.optional(),
575
- validation: import_zod5.z.array(
576
- import_zod5.z.object({
577
- validator: Conditional,
578
- message: TranslationConfig
579
- })
580
- ).default([]).optional(),
588
+ validation: import_zod5.z.array(ValidationConfig).default([]).optional(),
581
589
  label: TranslationConfig,
582
590
  helperText: TranslationConfig.optional(),
583
591
  hideLabel: import_zod5.z.boolean().default(false).optional()
@@ -967,6 +975,16 @@ var writeActions = ActionTypes.exclude([
967
975
  ActionType.ASSIGN,
968
976
  ActionType.UNASSIGN
969
977
  ]);
978
+ var StatusChangingActions = ActionTypes.extract([
979
+ ActionType.CREATE,
980
+ ActionType.NOTIFY,
981
+ ActionType.DECLARE,
982
+ ActionType.VALIDATE,
983
+ ActionType.REGISTER,
984
+ ActionType.REJECT,
985
+ ActionType.ARCHIVE,
986
+ ActionType.PRINT_CERTIFICATE
987
+ ]);
970
988
  var workqueueActions = ActionTypes.exclude([
971
989
  ActionType.CREATE,
972
990
  ActionType.NOTIFY,
@@ -1147,7 +1165,7 @@ var LanguageConfig = import_zod11.z.object({
1147
1165
  });
1148
1166
 
1149
1167
  // ../commons/src/events/EventConfig.ts
1150
- var import_zod18 = require("zod");
1168
+ var import_zod20 = require("zod");
1151
1169
 
1152
1170
  // ../commons/src/events/DeduplicationConfig.ts
1153
1171
  var import_zod12 = require("zod");
@@ -1286,6 +1304,9 @@ var BaseField3 = import_zod14.z.object({
1286
1304
  'conditionals' to an empty array ('[]') in the search config. This ensures they
1287
1305
  are always rendered in the advanced search form.
1288
1306
  `
1307
+ ),
1308
+ validations: import_zod14.z.array(ValidationConfig).default([]).optional().describe(
1309
+ `In advanced search, we sometimes need to override the default field validations.`
1289
1310
  )
1290
1311
  });
1291
1312
  var SearchQueryParams = import_zod14.z.object({
@@ -1321,127 +1342,560 @@ var AdvancedSearchConfig = import_zod14.z.object({
1321
1342
  var import_lodash = require("lodash");
1322
1343
 
1323
1344
  // ../commons/src/events/ActionDocument.ts
1324
- var import_zod16 = require("zod");
1345
+ var import_zod18 = require("zod");
1325
1346
  var import_zod_openapi7 = require("zod-openapi");
1326
1347
 
1327
- // ../commons/src/events/CreatedAtLocation.ts
1348
+ // ../commons/src/uuid.ts
1349
+ var import_uuid = require("uuid");
1328
1350
  var import_zod15 = require("zod");
1329
- var CreatedAtLocation = import_zod15.z.string().nullish();
1351
+ var UUID = import_zod15.z.string().uuid().brand("UUID");
1352
+ function getUUID() {
1353
+ return (0, import_uuid.v4)();
1354
+ }
1355
+
1356
+ // ../commons/src/events/CreatedAtLocation.ts
1357
+ var CreatedAtLocation = UUID.nullish();
1358
+
1359
+ // ../commons/src/authentication.ts
1360
+ var import_jwt_decode = __toESM(require("jwt-decode"));
1361
+ var import_zod17 = require("zod");
1362
+
1363
+ // ../commons/src/scopes.ts
1364
+ var import_zod16 = require("zod");
1365
+ var SCOPES = {
1366
+ // TODO v1.8 legacy scopes
1367
+ NATLSYSADMIN: "natlsysadmin",
1368
+ BYPASSRATELIMIT: "bypassratelimit",
1369
+ DECLARE: "declare",
1370
+ REGISTER: "register",
1371
+ VALIDATE: "validate",
1372
+ DEMO: "demo",
1373
+ CERTIFY: "certify",
1374
+ PERFORMANCE: "performance",
1375
+ SYSADMIN: "sysadmin",
1376
+ TEAMS: "teams",
1377
+ CONFIG: "config",
1378
+ // systems / integrations
1379
+ WEBHOOK: "webhook",
1380
+ NATIONALID: "nationalId",
1381
+ NOTIFICATION_API: "notification-api",
1382
+ RECORDSEARCH: "recordsearch",
1383
+ /**
1384
+ * @TODO This is a temporary scope to be used for V2 Events custom events declaration
1385
+ */
1386
+ RECORD_DECLARE: "record.declare-birth",
1387
+ // declare
1388
+ RECORD_IMPORT: "record.import",
1389
+ // declare
1390
+ RECORD_DECLARE_BIRTH: "record.declare-birth",
1391
+ RECORD_DECLARE_BIRTH_MY_JURISDICTION: "record.declare-birth:my-jurisdiction",
1392
+ RECORD_DECLARE_DEATH: "record.declare-death",
1393
+ RECORD_DECLARE_DEATH_MY_JURISDICTION: "record.declare-death:my-jurisdiction",
1394
+ RECORD_DECLARE_MARRIAGE: "record.declare-marriage",
1395
+ RECORD_DECLARE_MARRIAGE_MY_JURISDICTION: "record.declare-marriage:my-jurisdiction",
1396
+ RECORD_SUBMIT_INCOMPLETE: "record.declaration-submit-incomplete",
1397
+ RECORD_SUBMIT_FOR_REVIEW: "record.declaration-submit-for-review",
1398
+ RECORD_UNASSIGN_OTHERS: "record.unassign-others",
1399
+ // validate
1400
+ RECORD_SUBMIT_FOR_APPROVAL: "record.declaration-submit-for-approval",
1401
+ RECORD_SUBMIT_FOR_UPDATES: "record.declaration-submit-for-updates",
1402
+ RECORD_DECLARATION_EDIT: "record.declaration-edit",
1403
+ RECORD_REVIEW_DUPLICATES: "record.review-duplicates",
1404
+ RECORD_DECLARATION_ARCHIVE: "record.declaration-archive",
1405
+ RECORD_DECLARATION_REINSTATE: "record.declaration-reinstate",
1406
+ // register
1407
+ RECORD_REGISTER: "record.register",
1408
+ // certify
1409
+ RECORD_EXPORT_RECORDS: "record.export-records",
1410
+ RECORD_DECLARATION_PRINT: "record.declaration-print",
1411
+ RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS: "record.declaration-print-supporting-documents",
1412
+ RECORD_REGISTRATION_PRINT: "record.registration-print",
1413
+ // v1.8
1414
+ /**
1415
+ * This scope is used to **print and **issue certified copies of a record
1416
+ * after it has been registered. Previously Registrars had this permission.
1417
+ */
1418
+ RECORD_PRINT_ISSUE_CERTIFIED_COPIES: "record.registration-print&issue-certified-copies",
1419
+ RECORD_PRINT_CERTIFIED_COPIES: "record.registration-print-certified-copies",
1420
+ // v1.8
1421
+ RECORD_BULK_PRINT_CERTIFIED_COPIES: "record.registration-bulk-print-certified-copies",
1422
+ // v1.8
1423
+ RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES: "record.registration-verify-certified-copies",
1424
+ // v1.8
1425
+ // correct
1426
+ RECORD_REGISTRATION_REQUEST_CORRECTION: "record.registration-request-correction",
1427
+ RECORD_REGISTRATION_CORRECT: "record.registration-correct",
1428
+ RECORD_REGISTRATION_REQUEST_REVOCATION: "record.registration-request-revocation",
1429
+ // v1.8
1430
+ RECORD_REGISTRATION_REVOKE: "record.registration-revoke",
1431
+ // v1.8
1432
+ RECORD_REGISTRATION_REQUEST_REINSTATEMENT: "record.registration-request-reinstatement",
1433
+ // v1.8
1434
+ RECORD_REGISTRATION_REINSTATE: "record.registration-reinstate",
1435
+ // v1.8
1436
+ RECORD_CONFIRM_REGISTRATION: "record.confirm-registration",
1437
+ RECORD_REJECT_REGISTRATION: "record.reject-registration",
1438
+ // search
1439
+ SEARCH_BIRTH_MY_JURISDICTION: "search.birth:my-jurisdiction",
1440
+ SEARCH_BIRTH: "search.birth",
1441
+ SEARCH_DEATH_MY_JURISDICTION: "search.death:my-jurisdiction",
1442
+ SEARCH_DEATH: "search.death",
1443
+ SEARCH_MARRIAGE_MY_JURISDICTION: "search.marriage:my-jurisdiction",
1444
+ SEARCH_MARRIAGE: "search.marriage",
1445
+ // audit v1.8
1446
+ RECORD_READ: "record.read",
1447
+ RECORD_READ_AUDIT: "record.read-audit",
1448
+ RECORD_READ_COMMENTS: "record.read-comments",
1449
+ RECORD_CREATE_COMMENTS: "record.create-comments",
1450
+ // profile
1451
+ PROFILE_UPDATE: "profile.update",
1452
+ //v1.8
1453
+ PROFILE_ELECTRONIC_SIGNATURE: "profile.electronic-signature",
1454
+ // performance
1455
+ PERFORMANCE_READ: "performance.read",
1456
+ PERFORMANCE_READ_DASHBOARDS: "performance.read-dashboards",
1457
+ PERFORMANCE_EXPORT_VITAL_STATISTICS: "performance.vital-statistics-export",
1458
+ // organisation
1459
+ ORGANISATION_READ_LOCATIONS: "organisation.read-locations:all",
1460
+ ORGANISATION_READ_LOCATIONS_MY_OFFICE: "organisation.read-locations:my-office",
1461
+ ORGANISATION_READ_LOCATIONS_MY_JURISDICTION: "organisation.read-locations:my-jurisdiction",
1462
+ // user
1463
+ USER_READ: "user.read:all",
1464
+ USER_READ_MY_OFFICE: "user.read:my-office",
1465
+ USER_READ_MY_JURISDICTION: "user.read:my-jurisdiction",
1466
+ USER_READ_ONLY_MY_AUDIT: "user.read:only-my-audit",
1467
+ //v1.8
1468
+ USER_CREATE: "user.create:all",
1469
+ USER_CREATE_MY_JURISDICTION: "user.create:my-jurisdiction",
1470
+ USER_UPDATE: "user.update:all",
1471
+ USER_UPDATE_MY_JURISDICTION: "user.update:my-jurisdiction",
1472
+ // config
1473
+ CONFIG_UPDATE_ALL: "config.update:all",
1474
+ // data seeding
1475
+ USER_DATA_SEEDING: "user.data-seeding"
1476
+ };
1477
+ var LegacyScopes = import_zod16.z.union([
1478
+ import_zod16.z.literal(SCOPES.NATLSYSADMIN),
1479
+ import_zod16.z.literal(SCOPES.BYPASSRATELIMIT),
1480
+ import_zod16.z.literal(SCOPES.DECLARE),
1481
+ import_zod16.z.literal(SCOPES.REGISTER),
1482
+ import_zod16.z.literal(SCOPES.VALIDATE),
1483
+ import_zod16.z.literal(SCOPES.DEMO),
1484
+ import_zod16.z.literal(SCOPES.CERTIFY),
1485
+ import_zod16.z.literal(SCOPES.PERFORMANCE),
1486
+ import_zod16.z.literal(SCOPES.SYSADMIN),
1487
+ import_zod16.z.literal(SCOPES.TEAMS),
1488
+ import_zod16.z.literal(SCOPES.CONFIG)
1489
+ ]);
1490
+ var IntegrationScopes = import_zod16.z.union([
1491
+ import_zod16.z.literal(SCOPES.WEBHOOK),
1492
+ import_zod16.z.literal(SCOPES.NATIONALID),
1493
+ import_zod16.z.literal(SCOPES.NOTIFICATION_API),
1494
+ import_zod16.z.literal(SCOPES.RECORDSEARCH)
1495
+ ]);
1496
+ var DeclareScopes = import_zod16.z.union([
1497
+ import_zod16.z.literal(SCOPES.RECORD_DECLARE),
1498
+ import_zod16.z.literal(SCOPES.RECORD_IMPORT),
1499
+ import_zod16.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
1500
+ import_zod16.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
1501
+ import_zod16.z.literal(SCOPES.RECORD_DECLARE_DEATH),
1502
+ import_zod16.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
1503
+ import_zod16.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
1504
+ import_zod16.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
1505
+ import_zod16.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
1506
+ import_zod16.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW)
1507
+ ]);
1508
+ var UnassignScope = import_zod16.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS);
1509
+ var ValidateScopes = import_zod16.z.union([
1510
+ import_zod16.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
1511
+ import_zod16.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
1512
+ import_zod16.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
1513
+ import_zod16.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
1514
+ import_zod16.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
1515
+ import_zod16.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE)
1516
+ ]);
1517
+ var RegisterScope = import_zod16.z.literal(SCOPES.RECORD_REGISTER);
1518
+ var CertifyScopes = import_zod16.z.union([
1519
+ import_zod16.z.literal(SCOPES.RECORD_EXPORT_RECORDS),
1520
+ import_zod16.z.literal(SCOPES.RECORD_DECLARATION_PRINT),
1521
+ import_zod16.z.literal(SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS),
1522
+ import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_PRINT),
1523
+ import_zod16.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
1524
+ import_zod16.z.literal(SCOPES.RECORD_PRINT_CERTIFIED_COPIES),
1525
+ import_zod16.z.literal(SCOPES.RECORD_BULK_PRINT_CERTIFIED_COPIES),
1526
+ import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES)
1527
+ ]);
1528
+ var CorrectionScopes = import_zod16.z.union([
1529
+ import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
1530
+ import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
1531
+ import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REVOCATION),
1532
+ import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REVOKE),
1533
+ import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REINSTATEMENT),
1534
+ import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REINSTATE),
1535
+ import_zod16.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
1536
+ import_zod16.z.literal(SCOPES.RECORD_REJECT_REGISTRATION)
1537
+ ]);
1538
+ var SearchScopes = import_zod16.z.union([
1539
+ import_zod16.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
1540
+ import_zod16.z.literal(SCOPES.SEARCH_BIRTH),
1541
+ import_zod16.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
1542
+ import_zod16.z.literal(SCOPES.SEARCH_DEATH),
1543
+ import_zod16.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
1544
+ import_zod16.z.literal(SCOPES.SEARCH_MARRIAGE)
1545
+ ]);
1546
+ var AuditScopes = import_zod16.z.union([
1547
+ import_zod16.z.literal(SCOPES.RECORD_READ),
1548
+ import_zod16.z.literal(SCOPES.RECORD_READ_AUDIT),
1549
+ import_zod16.z.literal(SCOPES.RECORD_READ_COMMENTS),
1550
+ import_zod16.z.literal(SCOPES.RECORD_CREATE_COMMENTS)
1551
+ ]);
1552
+ var ProfileScopes = import_zod16.z.union([
1553
+ import_zod16.z.literal(SCOPES.PROFILE_UPDATE),
1554
+ import_zod16.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE)
1555
+ ]);
1556
+ var PerformanceScopes = import_zod16.z.union([
1557
+ import_zod16.z.literal(SCOPES.PERFORMANCE_READ),
1558
+ import_zod16.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
1559
+ import_zod16.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS)
1560
+ ]);
1561
+ var OrganisationScopes = import_zod16.z.union([
1562
+ import_zod16.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
1563
+ import_zod16.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
1564
+ import_zod16.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION)
1565
+ ]);
1566
+ var UserScopes = import_zod16.z.union([
1567
+ import_zod16.z.literal(SCOPES.USER_READ),
1568
+ import_zod16.z.literal(SCOPES.USER_READ_MY_OFFICE),
1569
+ import_zod16.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
1570
+ import_zod16.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
1571
+ import_zod16.z.literal(SCOPES.USER_CREATE),
1572
+ import_zod16.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
1573
+ import_zod16.z.literal(SCOPES.USER_UPDATE),
1574
+ import_zod16.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION)
1575
+ ]);
1576
+ var ConfigScope = import_zod16.z.literal(SCOPES.CONFIG_UPDATE_ALL);
1577
+ var DataSeedingScope = import_zod16.z.literal(SCOPES.USER_DATA_SEEDING);
1578
+ var LiteralScopes = import_zod16.z.union([
1579
+ LegacyScopes,
1580
+ IntegrationScopes,
1581
+ UnassignScope,
1582
+ DeclareScopes,
1583
+ ValidateScopes,
1584
+ RegisterScope,
1585
+ CertifyScopes,
1586
+ CorrectionScopes,
1587
+ SearchScopes,
1588
+ AuditScopes,
1589
+ ProfileScopes,
1590
+ PerformanceScopes,
1591
+ OrganisationScopes,
1592
+ UserScopes,
1593
+ ConfigScope,
1594
+ DataSeedingScope
1595
+ ]);
1596
+ var rawConfigurableScopeRegex = /^([a-zA-Z\.]+)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
1597
+ var rawConfigurableScope = import_zod16.z.string().regex(rawConfigurableScopeRegex);
1598
+ var CreateUserScope = import_zod16.z.object({
1599
+ type: import_zod16.z.literal("user.create"),
1600
+ options: import_zod16.z.object({
1601
+ role: import_zod16.z.array(import_zod16.z.string())
1602
+ })
1603
+ });
1604
+ var EditUserScope = import_zod16.z.object({
1605
+ type: import_zod16.z.literal("user.edit"),
1606
+ options: import_zod16.z.object({
1607
+ role: import_zod16.z.array(import_zod16.z.string())
1608
+ })
1609
+ });
1610
+ var WorkqueueScope = import_zod16.z.object({
1611
+ type: import_zod16.z.literal("workqueue"),
1612
+ options: import_zod16.z.object({
1613
+ id: import_zod16.z.array(import_zod16.z.string())
1614
+ })
1615
+ });
1616
+ var NotifyRecordScope = import_zod16.z.object({
1617
+ type: import_zod16.z.literal("record.notify"),
1618
+ options: import_zod16.z.object({
1619
+ event: import_zod16.z.array(import_zod16.z.string())
1620
+ })
1621
+ });
1622
+ var ConfigurableScopes = import_zod16.z.discriminatedUnion("type", [
1623
+ CreateUserScope,
1624
+ EditUserScope,
1625
+ WorkqueueScope,
1626
+ NotifyRecordScope
1627
+ ]);
1628
+ var scopes = Object.values(SCOPES);
1629
+ var ActionScopes = import_zod16.z.union([
1630
+ DeclareScopes,
1631
+ ValidateScopes,
1632
+ RegisterScope,
1633
+ CertifyScopes,
1634
+ CorrectionScopes
1635
+ ]);
1636
+
1637
+ // ../commons/src/authentication.ts
1638
+ var DEFAULT_ROLES_DEFINITION = [
1639
+ {
1640
+ id: "FIELD_AGENT",
1641
+ label: {
1642
+ defaultMessage: "Field Agent",
1643
+ description: "Name for user role Field Agent",
1644
+ id: "userRole.fieldAgent"
1645
+ },
1646
+ scopes: [
1647
+ // new scopes
1648
+ SCOPES.RECORD_DECLARE_BIRTH,
1649
+ SCOPES.RECORD_DECLARE_DEATH,
1650
+ SCOPES.RECORD_DECLARE_MARRIAGE,
1651
+ SCOPES.RECORD_SUBMIT_INCOMPLETE,
1652
+ SCOPES.RECORD_SUBMIT_FOR_REVIEW,
1653
+ SCOPES.SEARCH_BIRTH,
1654
+ SCOPES.SEARCH_DEATH,
1655
+ SCOPES.SEARCH_MARRIAGE
1656
+ ]
1657
+ },
1658
+ {
1659
+ id: "REGISTRATION_AGENT",
1660
+ label: {
1661
+ defaultMessage: "Registration Agent",
1662
+ description: "Name for user role Registration Agent",
1663
+ id: "userRole.registrationAgent"
1664
+ },
1665
+ scopes: [
1666
+ SCOPES.PERFORMANCE,
1667
+ SCOPES.CERTIFY,
1668
+ SCOPES.RECORD_DECLARE_BIRTH,
1669
+ SCOPES.RECORD_DECLARE_DEATH,
1670
+ SCOPES.RECORD_DECLARE_MARRIAGE,
1671
+ SCOPES.RECORD_SUBMIT_FOR_APPROVAL,
1672
+ SCOPES.RECORD_SUBMIT_FOR_UPDATES,
1673
+ SCOPES.RECORD_DECLARATION_ARCHIVE,
1674
+ SCOPES.RECORD_DECLARATION_REINSTATE,
1675
+ SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION,
1676
+ SCOPES.RECORD_REGISTRATION_PRINT,
1677
+ SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS,
1678
+ SCOPES.RECORD_EXPORT_RECORDS,
1679
+ SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES,
1680
+ SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES,
1681
+ SCOPES.RECORD_CREATE_COMMENTS,
1682
+ SCOPES.PERFORMANCE_READ,
1683
+ SCOPES.PERFORMANCE_READ_DASHBOARDS,
1684
+ SCOPES.ORGANISATION_READ_LOCATIONS,
1685
+ SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE,
1686
+ SCOPES.SEARCH_BIRTH,
1687
+ SCOPES.SEARCH_DEATH,
1688
+ SCOPES.SEARCH_MARRIAGE
1689
+ ]
1690
+ },
1691
+ {
1692
+ id: "LOCAL_REGISTRAR",
1693
+ label: {
1694
+ defaultMessage: "Local Registrar",
1695
+ description: "Name for user role Local Registrar",
1696
+ id: "userRole.localRegistrar"
1697
+ },
1698
+ scopes: [
1699
+ SCOPES.PERFORMANCE,
1700
+ SCOPES.CERTIFY,
1701
+ SCOPES.RECORD_DECLARE_BIRTH,
1702
+ SCOPES.RECORD_DECLARE_DEATH,
1703
+ SCOPES.RECORD_DECLARE_MARRIAGE,
1704
+ SCOPES.RECORD_SUBMIT_FOR_UPDATES,
1705
+ SCOPES.RECORD_REVIEW_DUPLICATES,
1706
+ SCOPES.RECORD_DECLARATION_ARCHIVE,
1707
+ SCOPES.RECORD_DECLARATION_REINSTATE,
1708
+ SCOPES.RECORD_REGISTER,
1709
+ SCOPES.RECORD_REGISTRATION_CORRECT,
1710
+ SCOPES.RECORD_REGISTRATION_PRINT,
1711
+ SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS,
1712
+ SCOPES.RECORD_EXPORT_RECORDS,
1713
+ SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES,
1714
+ SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES,
1715
+ SCOPES.RECORD_CREATE_COMMENTS,
1716
+ SCOPES.PERFORMANCE_READ,
1717
+ SCOPES.PERFORMANCE_READ_DASHBOARDS,
1718
+ SCOPES.ORGANISATION_READ_LOCATIONS,
1719
+ SCOPES.PROFILE_ELECTRONIC_SIGNATURE,
1720
+ SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE,
1721
+ SCOPES.SEARCH_BIRTH,
1722
+ SCOPES.SEARCH_DEATH,
1723
+ SCOPES.SEARCH_MARRIAGE
1724
+ ]
1725
+ },
1726
+ {
1727
+ id: "LOCAL_SYSTEM_ADMIN",
1728
+ label: {
1729
+ defaultMessage: "Local System Admin",
1730
+ description: "Name for user role Local System Admin",
1731
+ id: "userRole.localSystemAdmin"
1732
+ },
1733
+ scopes: [
1734
+ SCOPES.SYSADMIN,
1735
+ SCOPES.USER_READ_MY_OFFICE,
1736
+ SCOPES.USER_CREATE_MY_JURISDICTION,
1737
+ SCOPES.USER_UPDATE_MY_JURISDICTION,
1738
+ SCOPES.ORGANISATION_READ_LOCATIONS,
1739
+ SCOPES.PERFORMANCE_READ,
1740
+ SCOPES.PERFORMANCE_READ_DASHBOARDS,
1741
+ SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS
1742
+ // 'organisation.read-users' ?
1743
+ ]
1744
+ },
1745
+ {
1746
+ id: "NATIONAL_SYSTEM_ADMIN",
1747
+ label: {
1748
+ defaultMessage: "National System Admin",
1749
+ description: "Name for user role National System Admin",
1750
+ id: "userRole.nationalSystemAdmin"
1751
+ },
1752
+ scopes: [
1753
+ SCOPES.SYSADMIN,
1754
+ SCOPES.NATLSYSADMIN,
1755
+ SCOPES.USER_CREATE,
1756
+ SCOPES.USER_READ,
1757
+ SCOPES.USER_UPDATE,
1758
+ SCOPES.ORGANISATION_READ_LOCATIONS,
1759
+ SCOPES.PERFORMANCE_READ,
1760
+ SCOPES.PERFORMANCE_READ_DASHBOARDS,
1761
+ SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS
1762
+ // 'organisation.read-users' ?
1763
+ ]
1764
+ },
1765
+ {
1766
+ id: "PERFORMANCE_MANAGER",
1767
+ label: {
1768
+ defaultMessage: "Performance Manager",
1769
+ description: "Name for user role Performance Manager",
1770
+ id: "userRole.performanceManager"
1771
+ },
1772
+ scopes: [
1773
+ SCOPES.PERFORMANCE,
1774
+ SCOPES.PERFORMANCE_READ,
1775
+ SCOPES.PERFORMANCE_READ_DASHBOARDS,
1776
+ SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS
1777
+ ]
1778
+ }
1779
+ ];
1780
+ var TokenUserType = import_zod17.z.enum(["user", "system"]);
1781
+ var TokenWithBearer = import_zod17.z.string().regex(/^Bearer\s/);
1330
1782
 
1331
1783
  // ../commons/src/events/ActionDocument.ts
1332
- (0, import_zod_openapi7.extendZodWithOpenApi)(import_zod16.z);
1333
- var ActionUpdate = import_zod16.z.record(import_zod16.z.string(), FieldUpdateValue);
1334
- var EventState = import_zod16.z.record(import_zod16.z.string(), FieldValue);
1784
+ (0, import_zod_openapi7.extendZodWithOpenApi)(import_zod18.z);
1785
+ var ActionUpdate = import_zod18.z.record(import_zod18.z.string(), FieldUpdateValue);
1786
+ var EventState = import_zod18.z.record(import_zod18.z.string(), FieldValue);
1335
1787
  var ActionStatus = {
1336
1788
  Requested: "Requested",
1337
1789
  Accepted: "Accepted",
1338
1790
  Rejected: "Rejected"
1339
1791
  };
1340
- var ActionBase = import_zod16.z.object({
1341
- id: import_zod16.z.string(),
1342
- transactionId: import_zod16.z.string(),
1343
- createdAt: import_zod16.z.string().datetime(),
1344
- createdBy: import_zod16.z.string(),
1345
- createdByRole: import_zod16.z.string(),
1346
- createdBySignature: import_zod16.z.string().nullish().describe("Reference to signature of the user who created the action"),
1792
+ var ActionBase = import_zod18.z.object({
1793
+ id: UUID,
1794
+ transactionId: import_zod18.z.string(),
1795
+ createdByUserType: TokenUserType,
1796
+ createdAt: import_zod18.z.string().datetime(),
1797
+ createdBy: import_zod18.z.string(),
1798
+ createdByRole: import_zod18.z.string(),
1799
+ createdBySignature: import_zod18.z.string().nullish().describe("Reference to signature of the user who created the action"),
1347
1800
  createdAtLocation: CreatedAtLocation,
1348
1801
  declaration: ActionUpdate,
1349
- annotation: ActionUpdate.optional(),
1350
- status: import_zod16.z.enum([
1802
+ annotation: ActionUpdate.optional().nullable(),
1803
+ status: import_zod18.z.enum([
1351
1804
  ActionStatus.Requested,
1352
1805
  ActionStatus.Accepted,
1353
1806
  ActionStatus.Rejected
1354
1807
  ]),
1355
1808
  // If the action is an asynchronous confirmation for another action, we will save the original action id here.
1356
- originalActionId: import_zod16.z.string().optional()
1809
+ originalActionId: UUID.optional().nullable().describe(
1810
+ "Reference to the original action that was asynchronously rejected or accepted by 3rd party integration."
1811
+ )
1357
1812
  });
1358
1813
  var AssignedAction = ActionBase.merge(
1359
- import_zod16.z.object({
1360
- type: import_zod16.z.literal(ActionType.ASSIGN),
1361
- assignedTo: import_zod16.z.string()
1814
+ import_zod18.z.object({
1815
+ type: import_zod18.z.literal(ActionType.ASSIGN),
1816
+ assignedTo: import_zod18.z.string()
1362
1817
  })
1363
1818
  );
1364
1819
  var UnassignedAction = ActionBase.merge(
1365
- import_zod16.z.object({
1366
- type: import_zod16.z.literal(ActionType.UNASSIGN),
1367
- assignedTo: import_zod16.z.literal(null)
1820
+ import_zod18.z.object({
1821
+ type: import_zod18.z.literal(ActionType.UNASSIGN)
1368
1822
  })
1369
1823
  );
1370
1824
  var RegisterAction = ActionBase.merge(
1371
- import_zod16.z.object({
1372
- type: import_zod16.z.literal(ActionType.REGISTER),
1373
- registrationNumber: import_zod16.z.string().optional()
1825
+ import_zod18.z.object({
1826
+ type: import_zod18.z.literal(ActionType.REGISTER),
1827
+ registrationNumber: import_zod18.z.string().optional()
1374
1828
  })
1375
1829
  );
1376
1830
  var DeclareAction = ActionBase.merge(
1377
- import_zod16.z.object({
1378
- type: import_zod16.z.literal(ActionType.DECLARE)
1831
+ import_zod18.z.object({
1832
+ type: import_zod18.z.literal(ActionType.DECLARE)
1379
1833
  })
1380
1834
  );
1381
1835
  var ValidateAction = ActionBase.merge(
1382
- import_zod16.z.object({
1383
- type: import_zod16.z.literal(ActionType.VALIDATE)
1836
+ import_zod18.z.object({
1837
+ type: import_zod18.z.literal(ActionType.VALIDATE)
1384
1838
  })
1385
1839
  );
1386
- var RejectionReason = import_zod16.z.object({
1387
- message: import_zod16.z.string().min(1, { message: "Message cannot be empty" }).describe("Message describing reason for rejection or archiving"),
1388
- isDuplicate: import_zod16.z.boolean().optional().describe("If a declaration is duplicated")
1840
+ var RejectionReason = import_zod18.z.object({
1841
+ message: import_zod18.z.string().min(1, { message: "Message cannot be empty" }).describe("Message describing reason for rejection or archiving"),
1842
+ isDuplicate: import_zod18.z.boolean().optional().describe("If a declaration is duplicated")
1389
1843
  });
1390
1844
  var RejectAction = ActionBase.merge(
1391
- import_zod16.z.object({
1392
- type: import_zod16.z.literal(ActionType.REJECT),
1845
+ import_zod18.z.object({
1846
+ type: import_zod18.z.literal(ActionType.REJECT),
1393
1847
  reason: RejectionReason
1394
1848
  })
1395
1849
  );
1396
1850
  var MarkAsDuplicateAction = ActionBase.merge(
1397
- import_zod16.z.object({
1398
- type: import_zod16.z.literal(ActionType.MARKED_AS_DUPLICATE)
1851
+ import_zod18.z.object({
1852
+ type: import_zod18.z.literal(ActionType.MARKED_AS_DUPLICATE)
1399
1853
  })
1400
1854
  );
1401
1855
  var ArchiveAction = ActionBase.merge(
1402
- import_zod16.z.object({
1403
- type: import_zod16.z.literal(ActionType.ARCHIVE),
1856
+ import_zod18.z.object({
1857
+ type: import_zod18.z.literal(ActionType.ARCHIVE),
1404
1858
  reason: RejectionReason
1405
1859
  })
1406
1860
  );
1407
1861
  var CreatedAction = ActionBase.merge(
1408
- import_zod16.z.object({
1409
- type: import_zod16.z.literal(ActionType.CREATE)
1862
+ import_zod18.z.object({
1863
+ type: import_zod18.z.literal(ActionType.CREATE)
1410
1864
  })
1411
1865
  );
1412
1866
  var NotifiedAction = ActionBase.merge(
1413
- import_zod16.z.object({
1414
- type: import_zod16.z.literal(ActionType.NOTIFY)
1867
+ import_zod18.z.object({
1868
+ type: import_zod18.z.literal(ActionType.NOTIFY)
1415
1869
  })
1416
1870
  );
1417
1871
  var PrintCertificateAction = ActionBase.merge(
1418
- import_zod16.z.object({
1419
- type: import_zod16.z.literal(ActionType.PRINT_CERTIFICATE)
1872
+ import_zod18.z.object({
1873
+ type: import_zod18.z.literal(ActionType.PRINT_CERTIFICATE)
1420
1874
  })
1421
1875
  );
1422
1876
  var RequestedCorrectionAction = ActionBase.merge(
1423
- import_zod16.z.object({
1424
- type: import_zod16.z.literal(ActionType.REQUEST_CORRECTION)
1877
+ import_zod18.z.object({
1878
+ type: import_zod18.z.literal(ActionType.REQUEST_CORRECTION)
1425
1879
  })
1426
1880
  );
1427
1881
  var ApprovedCorrectionAction = ActionBase.merge(
1428
- import_zod16.z.object({
1429
- type: import_zod16.z.literal(ActionType.APPROVE_CORRECTION),
1430
- requestId: import_zod16.z.string()
1882
+ import_zod18.z.object({
1883
+ type: import_zod18.z.literal(ActionType.APPROVE_CORRECTION),
1884
+ requestId: import_zod18.z.string()
1431
1885
  })
1432
1886
  );
1433
1887
  var RejectedCorrectionAction = ActionBase.merge(
1434
- import_zod16.z.object({
1435
- type: import_zod16.z.literal(ActionType.REJECT_CORRECTION),
1436
- requestId: import_zod16.z.string()
1888
+ import_zod18.z.object({
1889
+ type: import_zod18.z.literal(ActionType.REJECT_CORRECTION),
1890
+ requestId: import_zod18.z.string()
1437
1891
  })
1438
1892
  );
1439
1893
  var ReadAction = ActionBase.merge(
1440
- import_zod16.z.object({
1441
- type: import_zod16.z.literal(ActionType.READ)
1894
+ import_zod18.z.object({
1895
+ type: import_zod18.z.literal(ActionType.READ)
1442
1896
  })
1443
1897
  );
1444
- var ActionDocument = import_zod16.z.discriminatedUnion("type", [
1898
+ var ActionDocument = import_zod18.z.discriminatedUnion("type", [
1445
1899
  CreatedAction.openapi({ ref: "CreatedAction" }),
1446
1900
  ValidateAction.openapi({ ref: "ValidateAction" }),
1447
1901
  RejectAction.openapi({ ref: "RejectAction" }),
@@ -1464,20 +1918,20 @@ var AsyncRejectActionDocument = ActionBase.omit({
1464
1918
  declaration: true,
1465
1919
  annotation: true
1466
1920
  }).merge(
1467
- import_zod16.z.object({
1468
- type: import_zod16.z.enum(ConfirmableActions),
1469
- status: import_zod16.z.literal(ActionStatus.Rejected)
1921
+ import_zod18.z.object({
1922
+ type: import_zod18.z.enum(ConfirmableActions),
1923
+ status: import_zod18.z.literal(ActionStatus.Rejected)
1470
1924
  })
1471
1925
  );
1472
- var Action = import_zod16.z.union([ActionDocument, AsyncRejectActionDocument]);
1473
- var ResolvedUser = import_zod16.z.object({
1474
- id: import_zod16.z.string(),
1475
- role: import_zod16.z.string(),
1476
- name: import_zod16.z.array(
1477
- import_zod16.z.object({
1478
- use: import_zod16.z.string(),
1479
- given: import_zod16.z.array(import_zod16.z.string()),
1480
- family: import_zod16.z.string()
1926
+ var Action = import_zod18.z.union([ActionDocument, AsyncRejectActionDocument]);
1927
+ var ResolvedUser = import_zod18.z.object({
1928
+ id: import_zod18.z.string(),
1929
+ role: import_zod18.z.string(),
1930
+ name: import_zod18.z.array(
1931
+ import_zod18.z.object({
1932
+ use: import_zod18.z.string(),
1933
+ given: import_zod18.z.array(import_zod18.z.string()),
1934
+ family: import_zod18.z.string()
1481
1935
  })
1482
1936
  )
1483
1937
  });
@@ -1488,7 +1942,7 @@ var import_ajv_formats = __toESM(require("ajv-formats"));
1488
1942
  var import_date_fns = require("date-fns");
1489
1943
 
1490
1944
  // ../commons/src/events/FieldTypeMapping.ts
1491
- var import_zod17 = require("zod");
1945
+ var import_zod19 = require("zod");
1492
1946
  function mapFieldTypeToZod(type, required) {
1493
1947
  let schema;
1494
1948
  switch (type) {
@@ -1548,7 +2002,7 @@ function createValidationSchema(config) {
1548
2002
  for (const field2 of config) {
1549
2003
  shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
1550
2004
  }
1551
- return import_zod17.z.object(shape);
2005
+ return import_zod19.z.object(shape);
1552
2006
  }
1553
2007
  function mapFieldTypeToEmptyValue(field2) {
1554
2008
  switch (field2.type) {
@@ -1901,12 +2355,6 @@ function getValidatorsForField(fieldId, validations) {
1901
2355
  }).filter((x) => x !== null);
1902
2356
  }
1903
2357
 
1904
- // ../commons/src/uuid.ts
1905
- var import_uuid = require("uuid");
1906
- function getUUID() {
1907
- return (0, import_uuid.v4)();
1908
- }
1909
-
1910
2358
  // ../commons/src/utils.ts
1911
2359
  function getOrThrow(x, message) {
1912
2360
  if (x === void 0 || x === null) {
@@ -2013,8 +2461,9 @@ function createEmptyDraft(eventId, draftId, actionType) {
2013
2461
  declaration: {},
2014
2462
  annotation: {},
2015
2463
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
2464
+ createdByUserType: TokenUserType.Enum.user,
2016
2465
  createdBy: "@todo",
2017
- createdAtLocation: "@todo",
2466
+ createdAtLocation: "00000000-0000-0000-0000-000000000000",
2018
2467
  status: ActionStatus.Accepted,
2019
2468
  transactionId: "@todo",
2020
2469
  createdByRole: "@todo"
@@ -2117,9 +2566,9 @@ function getEventConfigById(eventConfigs, id) {
2117
2566
 
2118
2567
  // ../commons/src/events/EventConfig.ts
2119
2568
  var import_zod_openapi8 = require("zod-openapi");
2120
- (0, import_zod_openapi8.extendZodWithOpenApi)(import_zod18.z);
2121
- var EventConfig = import_zod18.z.object({
2122
- id: import_zod18.z.string().describe(
2569
+ (0, import_zod_openapi8.extendZodWithOpenApi)(import_zod20.z);
2570
+ var EventConfig = import_zod20.z.object({
2571
+ id: import_zod20.z.string().describe(
2123
2572
  'A machine-readable identifier for the event, e.g. "birth" or "death"'
2124
2573
  ),
2125
2574
  dateOfEvent: FieldReference.optional(),
@@ -2129,10 +2578,10 @@ var EventConfig = import_zod18.z.object({
2129
2578
  ),
2130
2579
  summary: SummaryConfig,
2131
2580
  label: TranslationConfig,
2132
- actions: import_zod18.z.array(ActionConfig),
2581
+ actions: import_zod20.z.array(ActionConfig),
2133
2582
  declaration: DeclarationFormConfig,
2134
- deduplication: import_zod18.z.array(DeduplicationConfig).optional().default([]),
2135
- advancedSearch: import_zod18.z.array(AdvancedSearchConfig).optional().default([])
2583
+ deduplication: import_zod20.z.array(DeduplicationConfig).optional().default([]),
2584
+ advancedSearch: import_zod20.z.array(AdvancedSearchConfig).optional().default([])
2136
2585
  }).superRefine((event2, ctx) => {
2137
2586
  const allFields = findAllFields(event2);
2138
2587
  const fieldIds = allFields.map((field2) => field2.id);
@@ -2194,12 +2643,12 @@ var definePage = (page) => PageConfig.parse(page);
2194
2643
  var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
2195
2644
 
2196
2645
  // ../commons/src/events/WorkqueueConfig.ts
2197
- var import_zod25 = require("zod");
2646
+ var import_zod27 = require("zod");
2198
2647
 
2199
2648
  // ../commons/src/events/serializers/user/serializer.ts
2200
- var import_zod19 = require("zod");
2201
- var SerializedUserField = import_zod19.z.object({
2202
- $userField: import_zod19.z.enum([
2649
+ var import_zod21 = require("zod");
2650
+ var SerializedUserField = import_zod21.z.object({
2651
+ $userField: import_zod21.z.enum([
2203
2652
  "id",
2204
2653
  "name",
2205
2654
  "role",
@@ -2602,11 +3051,11 @@ var event = Object.assign(eventFn, {
2602
3051
  });
2603
3052
 
2604
3053
  // ../commons/src/events/WorkqueueColumnConfig.ts
2605
- var import_zod21 = require("zod");
3054
+ var import_zod23 = require("zod");
2606
3055
 
2607
3056
  // ../commons/src/events/EventMetadata.ts
2608
- var import_zod20 = require("zod");
2609
- var EventStatus = import_zod20.z.enum([
3057
+ var import_zod22 = require("zod");
3058
+ var EventStatus = import_zod22.z.enum([
2610
3059
  "CREATED",
2611
3060
  "NOTIFIED",
2612
3061
  "DECLARED",
@@ -2619,57 +3068,63 @@ var EventStatus = import_zod20.z.enum([
2619
3068
  var CustomFlags = {
2620
3069
  CERTIFICATE_PRINTED: "certificate-printed"
2621
3070
  };
2622
- var Flag = import_zod20.z.string().regex(
3071
+ var Flag = import_zod22.z.string().regex(
2623
3072
  new RegExp(
2624
3073
  `^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
2625
3074
  ActionStatus
2626
3075
  ).join("|").toLowerCase()})$`
2627
3076
  ),
2628
3077
  "Flag must be in the format ActionType:ActionStatus (lowerCase)"
2629
- ).or(import_zod20.z.nativeEnum(CustomFlags));
2630
- var ZodDate = import_zod20.z.string().date();
2631
- var ActionCreationMetadata = import_zod20.z.object({
2632
- createdAt: import_zod20.z.string().datetime().describe("The timestamp when the action request was created."),
2633
- createdBy: import_zod20.z.string().describe("ID of the user who created the action request."),
3078
+ ).or(import_zod22.z.nativeEnum(CustomFlags));
3079
+ var ZodDate = import_zod22.z.string().date();
3080
+ var ActionCreationMetadata = import_zod22.z.object({
3081
+ createdAt: import_zod22.z.string().datetime().describe("The timestamp when the action request was created."),
3082
+ createdBy: import_zod22.z.string().describe("ID of the user who created the action request."),
2634
3083
  createdAtLocation: CreatedAtLocation.describe(
2635
3084
  "Location of the user who created the action request."
2636
3085
  ),
2637
- acceptedAt: import_zod20.z.string().datetime().describe("Timestamp when the action request was accepted."),
2638
- createdByRole: import_zod20.z.string().describe("Role of the user at the time of action request creation."),
2639
- createdBySignature: import_zod20.z.string().nullish().describe("Signature of the user who created the action request.")
3086
+ createdByUserType: import_zod22.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
3087
+ acceptedAt: import_zod22.z.string().datetime().describe("Timestamp when the action request was accepted."),
3088
+ createdByRole: import_zod22.z.string().describe("Role of the user at the time of action request creation."),
3089
+ createdBySignature: import_zod22.z.string().nullish().describe("Signature of the user who created the action request.")
2640
3090
  });
2641
3091
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
2642
- registrationNumber: import_zod20.z.string().describe(
3092
+ registrationNumber: import_zod22.z.string().describe(
2643
3093
  "Registration number of the event. Always present for accepted registrations."
2644
3094
  )
2645
3095
  });
2646
- var LegalStatuses = import_zod20.z.object({
3096
+ var LegalStatuses = import_zod22.z.object({
2647
3097
  [EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
2648
3098
  [EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
2649
3099
  });
2650
- var EventMetadata = import_zod20.z.object({
2651
- id: import_zod20.z.string(),
2652
- type: import_zod20.z.string().describe("The type of event, such as birth, death, or marriage."),
3100
+ var EventMetadata = import_zod22.z.object({
3101
+ id: UUID,
3102
+ type: import_zod22.z.string().describe("The type of event, such as birth, death, or marriage."),
2653
3103
  status: EventStatus,
2654
3104
  legalStatuses: LegalStatuses.describe(
2655
3105
  "Metadata related to the legal registration of the event, such as who registered it and when."
2656
3106
  ),
2657
- createdAt: import_zod20.z.string().datetime().describe("The timestamp when the event was first created and saved."),
3107
+ createdAt: import_zod22.z.string().datetime().describe("The timestamp when the event was first created and saved."),
2658
3108
  dateOfEvent: ZodDate.nullish(),
2659
- createdBy: import_zod20.z.string().describe("ID of the user who created the event."),
2660
- updatedByUserRole: import_zod20.z.string().describe("Role of the user who last updated the declaration."),
3109
+ createdBy: import_zod22.z.string().describe("ID of the user who created the event."),
3110
+ createdByUserType: import_zod22.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
3111
+ updatedByUserRole: import_zod22.z.string().describe("Role of the user who last changed the status."),
2661
3112
  createdAtLocation: CreatedAtLocation.describe(
2662
3113
  "Location of the user who created the event."
2663
3114
  ),
2664
- createdBySignature: import_zod20.z.string().nullish().describe("Signature of the user who created the event."),
2665
- updatedAtLocation: import_zod20.z.string().nullish().describe("Location of the user who last updated the declaration."),
2666
- updatedAt: import_zod20.z.string().datetime().describe("Timestamp of the most recent declaration update."),
2667
- assignedTo: import_zod20.z.string().nullish().describe("ID of the user currently assigned to the event."),
2668
- updatedBy: import_zod20.z.string().nullish().describe("ID of the user who last updated the declaration."),
2669
- trackingId: import_zod20.z.string().describe(
3115
+ createdBySignature: import_zod22.z.string().nullish().describe("Signature of the user who created the event."),
3116
+ updatedAtLocation: UUID.nullish().describe(
3117
+ "Location of the user who last changed the status."
3118
+ ),
3119
+ updatedAt: import_zod22.z.string().datetime().describe(
3120
+ "Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
3121
+ ),
3122
+ assignedTo: import_zod22.z.string().nullish().describe("ID of the user currently assigned to the event."),
3123
+ updatedBy: import_zod22.z.string().nullish().describe("ID of the user who last changed the status."),
3124
+ trackingId: import_zod22.z.string().describe(
2670
3125
  "System-generated tracking ID used by informants or registrars to look up the event."
2671
3126
  ),
2672
- flags: import_zod20.z.array(Flag)
3127
+ flags: import_zod22.z.array(Flag)
2673
3128
  });
2674
3129
  var EventMetadataKeysArray = [
2675
3130
  "id",
@@ -2678,6 +3133,7 @@ var EventMetadataKeysArray = [
2678
3133
  "createdAt",
2679
3134
  "dateOfEvent",
2680
3135
  "createdBy",
3136
+ "createdByUserType",
2681
3137
  "updatedByUserRole",
2682
3138
  "createdAtLocation",
2683
3139
  "updatedAtLocation",
@@ -2688,7 +3144,7 @@ var EventMetadataKeysArray = [
2688
3144
  "legalStatuses",
2689
3145
  "flags"
2690
3146
  ];
2691
- var EventMetadataKeys = import_zod20.z.enum(EventMetadataKeysArray);
3147
+ var EventMetadataKeys = import_zod22.z.enum(EventMetadataKeysArray);
2692
3148
  var eventMetadataLabelMap = {
2693
3149
  "event.assignedTo": {
2694
3150
  id: "event.assignedTo.label",
@@ -2700,6 +3156,11 @@ var eventMetadataLabelMap = {
2700
3156
  defaultMessage: "Created",
2701
3157
  description: "Created At"
2702
3158
  },
3159
+ "event.createdByUserType": {
3160
+ id: "event.createdByUserType.label",
3161
+ defaultMessage: "createdByUserType",
3162
+ description: "createdByUserType:user or system"
3163
+ },
2703
3164
  "event.dateOfEvent": {
2704
3165
  id: "event.dateOfEvent.label",
2705
3166
  defaultMessage: "Date of Event",
@@ -2765,13 +3226,14 @@ var eventMetadataLabelMap = {
2765
3226
  // ../commons/src/events/WorkqueueColumnConfig.ts
2766
3227
  var WorkqueueColumnKeysArray = [
2767
3228
  ...EventMetadataKeysArray,
2768
- "title"
3229
+ "title",
3230
+ "outbox"
2769
3231
  ];
2770
- var WorkqueueColumnKeys = import_zod21.z.enum(WorkqueueColumnKeysArray);
2771
- var WorkqueueColumnValue = import_zod21.z.object({
3232
+ var WorkqueueColumnKeys = import_zod23.z.enum(WorkqueueColumnKeysArray);
3233
+ var WorkqueueColumnValue = import_zod23.z.object({
2772
3234
  $event: WorkqueueColumnKeys
2773
3235
  });
2774
- var WorkqueueColumn = import_zod21.z.object({
3236
+ var WorkqueueColumn = import_zod23.z.object({
2775
3237
  label: TranslationConfig,
2776
3238
  value: WorkqueueColumnValue
2777
3239
  });
@@ -2782,98 +3244,112 @@ function defineWorkqueuesColumns(workqueueColumns) {
2782
3244
  }
2783
3245
 
2784
3246
  // ../commons/src/events/CountryConfigQueryInput.ts
2785
- var import_zod23 = require("zod");
3247
+ var import_zod25 = require("zod");
2786
3248
 
2787
3249
  // ../commons/src/events/EventIndex.ts
2788
- var import_zod22 = require("zod");
3250
+ var import_zod24 = require("zod");
2789
3251
  var import_zod_openapi9 = require("zod-openapi");
2790
- (0, import_zod_openapi9.extendZodWithOpenApi)(import_zod22.z);
3252
+ (0, import_zod_openapi9.extendZodWithOpenApi)(import_zod24.z);
2791
3253
  var EventIndex = EventMetadata.extend({
2792
3254
  declaration: EventState
2793
3255
  }).openapi({
2794
3256
  ref: "EventIndex"
2795
3257
  });
2796
- var EventSearchIndex = import_zod22.z.record(import_zod22.z.string(), import_zod22.z.any()).and(
2797
- import_zod22.z.object({
2798
- type: import_zod22.z.string()
3258
+ var EventSearchIndex = import_zod24.z.record(import_zod24.z.string(), import_zod24.z.any()).and(
3259
+ import_zod24.z.object({
3260
+ type: import_zod24.z.string()
2799
3261
  // Ensures "type" (event-id) exists and is a string
2800
3262
  })
2801
3263
  ).openapi({
2802
3264
  ref: "EventSearchIndex"
2803
3265
  });
2804
- var Fuzzy = import_zod22.z.object({ type: import_zod22.z.literal("fuzzy"), term: import_zod22.z.string() }).openapi({
3266
+ var Fuzzy = import_zod24.z.object({ type: import_zod24.z.literal("fuzzy"), term: import_zod24.z.string() }).openapi({
2805
3267
  ref: "Fuzzy"
2806
3268
  });
2807
- var Exact = import_zod22.z.object({ type: import_zod22.z.literal("exact"), term: import_zod22.z.string() }).openapi({
3269
+ var Exact = import_zod24.z.object({ type: import_zod24.z.literal("exact"), term: import_zod24.z.string() }).openapi({
2808
3270
  ref: "Exact"
2809
3271
  });
2810
- var AnyOf = import_zod22.z.object({
2811
- type: import_zod22.z.literal("anyOf"),
2812
- terms: import_zod22.z.array(import_zod22.z.string())
2813
- }).openapi({
2814
- ref: "AnyOf"
2815
- });
2816
- var ExactStatus = import_zod22.z.object({
2817
- type: import_zod22.z.literal("exact"),
3272
+ var ExactStatus = import_zod24.z.object({
3273
+ type: import_zod24.z.literal("exact"),
2818
3274
  term: EventStatus
2819
3275
  }).openapi({
2820
3276
  ref: "ExactStatus"
2821
3277
  });
2822
- var AnyOfStatus = import_zod22.z.object({
2823
- type: import_zod22.z.literal("anyOf"),
2824
- terms: import_zod22.z.array(EventStatus)
3278
+ var AnyOf = import_zod24.z.object({
3279
+ type: import_zod24.z.literal("anyOf"),
3280
+ terms: import_zod24.z.array(import_zod24.z.string())
3281
+ }).openapi({
3282
+ ref: "AnyOf"
3283
+ });
3284
+ var AnyOfStatus = import_zod24.z.object({
3285
+ type: import_zod24.z.literal("anyOf"),
3286
+ terms: import_zod24.z.array(EventStatus)
2825
3287
  }).openapi({
2826
3288
  ref: "AnyOfStatus"
2827
3289
  });
2828
- var Range = import_zod22.z.object({
2829
- type: import_zod22.z.literal("range"),
2830
- gte: import_zod22.z.string(),
2831
- lte: import_zod22.z.string()
3290
+ var Range = import_zod24.z.object({
3291
+ type: import_zod24.z.literal("range"),
3292
+ gte: import_zod24.z.string(),
3293
+ lte: import_zod24.z.string()
2832
3294
  }).openapi({
2833
3295
  ref: "Range"
2834
3296
  });
2835
- var Not = import_zod22.z.object({ type: import_zod22.z.literal("not"), term: import_zod22.z.string() }).openapi({
3297
+ var Not = import_zod24.z.object({ type: import_zod24.z.literal("not"), term: import_zod24.z.string() }).openapi({
2836
3298
  ref: "Not"
2837
3299
  });
2838
- var Within = import_zod22.z.object({ type: import_zod22.z.literal("within"), location: import_zod22.z.string() }).openapi({
3300
+ var Within = import_zod24.z.object({ type: import_zod24.z.literal("within"), location: import_zod24.z.string() }).openapi({
2839
3301
  ref: "Within"
2840
3302
  });
2841
- var DateCondition = import_zod22.z.union([Exact, Range]).openapi({
3303
+ var RangeDate = Range.extend({
3304
+ gte: import_zod24.z.string().date().or(import_zod24.z.string().datetime()),
3305
+ lte: import_zod24.z.string().date().or(import_zod24.z.string().datetime())
3306
+ }).openapi({
3307
+ ref: "RangeDate"
3308
+ });
3309
+ var ExactDate = Exact.extend({
3310
+ term: import_zod24.z.string().date().or(import_zod24.z.string().datetime())
3311
+ }).openapi({
3312
+ ref: "ExactDate"
3313
+ });
3314
+ var DateCondition = import_zod24.z.union([ExactDate, RangeDate]).openapi({
2842
3315
  ref: "DateCondition"
2843
3316
  });
2844
- var QueryInput = import_zod22.z.lazy(
2845
- () => import_zod22.z.union([
2846
- import_zod22.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf, Not]),
2847
- import_zod22.z.record(import_zod22.z.string(), QueryInput)
3317
+ var QueryInput = import_zod24.z.lazy(
3318
+ () => import_zod24.z.union([
3319
+ import_zod24.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf, Not]),
3320
+ import_zod24.z.record(import_zod24.z.string(), QueryInput)
2848
3321
  ])
2849
3322
  ).openapi({
2850
3323
  ref: "QueryInput"
2851
3324
  });
2852
- var QueryExpression = import_zod22.z.object({
2853
- id: import_zod22.z.optional(import_zod22.z.string()),
2854
- eventType: import_zod22.z.string(),
2855
- status: import_zod22.z.optional(import_zod22.z.union([AnyOfStatus, ExactStatus])),
2856
- createdAt: import_zod22.z.optional(DateCondition),
2857
- updatedAt: import_zod22.z.optional(DateCondition),
2858
- "legalStatus.REGISTERED.createdAt": import_zod22.z.optional(DateCondition),
2859
- "legalStatus.REGISTERED.createdAtLocation": import_zod22.z.optional(
2860
- import_zod22.z.union([Within, Exact])
3325
+ var QueryExpression = import_zod24.z.object({
3326
+ id: import_zod24.z.optional(import_zod24.z.string()),
3327
+ eventType: import_zod24.z.string(),
3328
+ status: import_zod24.z.optional(import_zod24.z.union([AnyOfStatus, ExactStatus])),
3329
+ createdAt: import_zod24.z.optional(DateCondition),
3330
+ updatedAt: import_zod24.z.optional(DateCondition),
3331
+ "legalStatus.REGISTERED.createdAt": import_zod24.z.optional(DateCondition),
3332
+ "legalStatus.REGISTERED.createdAtLocation": import_zod24.z.optional(
3333
+ import_zod24.z.union([Within, Exact])
2861
3334
  ),
2862
- "legalStatus.REGISTERED.registrationNumber": import_zod22.z.optional(Exact),
2863
- createdAtLocation: import_zod22.z.optional(import_zod22.z.union([Within, Exact])),
2864
- updatedAtLocation: import_zod22.z.optional(import_zod22.z.union([Within, Exact])),
2865
- assignedTo: import_zod22.z.optional(Exact),
2866
- createdBy: import_zod22.z.optional(Exact),
2867
- updatedBy: import_zod22.z.optional(Exact),
2868
- trackingId: import_zod22.z.optional(Exact),
2869
- flags: import_zod22.z.optional(import_zod22.z.array(import_zod22.z.union([AnyOf, Not]))),
3335
+ "legalStatus.REGISTERED.registrationNumber": import_zod24.z.optional(Exact),
3336
+ createdAtLocation: import_zod24.z.optional(import_zod24.z.union([Within, Exact])),
3337
+ updatedAtLocation: import_zod24.z.optional(import_zod24.z.union([Within, Exact])),
3338
+ assignedTo: import_zod24.z.optional(Exact),
3339
+ createdByUserType: TokenUserType,
3340
+ createdBy: import_zod24.z.optional(Exact),
3341
+ updatedBy: import_zod24.z.optional(Exact),
3342
+ trackingId: import_zod24.z.optional(Exact),
3343
+ flags: import_zod24.z.optional(import_zod24.z.array(import_zod24.z.union([AnyOf, Not]))),
2870
3344
  data: QueryInput
2871
- }).partial().openapi({
3345
+ }).partial().refine((obj) => Object.values(obj).some((val) => val !== void 0), {
3346
+ message: "At least one query field must be specified."
3347
+ }).openapi({
2872
3348
  ref: "QueryExpression"
2873
3349
  });
2874
- var QueryType = import_zod22.z.object({
2875
- type: import_zod22.z.literal("and").or(import_zod22.z.literal("or")).openapi({ default: "and" }),
2876
- clauses: import_zod22.z.preprocess(
3350
+ var QueryType = import_zod24.z.object({
3351
+ type: import_zod24.z.literal("and").or(import_zod24.z.literal("or")).openapi({ default: "and" }),
3352
+ clauses: import_zod24.z.preprocess(
2877
3353
  (val) => {
2878
3354
  if (typeof val === "string") {
2879
3355
  return [JSON.parse(val)];
@@ -2883,7 +3359,7 @@ var QueryType = import_zod22.z.object({
2883
3359
  }
2884
3360
  return val;
2885
3361
  },
2886
- import_zod22.z.array(QueryExpression).nonempty("At least one clause is required.").openapi({
3362
+ import_zod24.z.array(QueryExpression).nonempty("At least one clause is required.").openapi({
2887
3363
  default: [
2888
3364
  {
2889
3365
  eventType: TENNIS_CLUB_MEMBERSHIP,
@@ -2906,50 +3382,51 @@ var QueryType = import_zod22.z.object({
2906
3382
  });
2907
3383
 
2908
3384
  // ../commons/src/events/CountryConfigQueryInput.ts
2909
- var SerializableExact = import_zod23.z.object({
2910
- type: import_zod23.z.literal("exact"),
2911
- term: import_zod23.z.union([import_zod23.z.string(), SerializedUserField])
3385
+ var SerializableExact = import_zod25.z.object({
3386
+ type: import_zod25.z.literal("exact"),
3387
+ term: import_zod25.z.union([import_zod25.z.string(), SerializedUserField])
2912
3388
  });
2913
- var SerializableWithin = import_zod23.z.object({
2914
- type: import_zod23.z.literal("within"),
2915
- location: import_zod23.z.union([import_zod23.z.string(), SerializedUserField])
3389
+ var SerializableWithin = import_zod25.z.object({
3390
+ type: import_zod25.z.literal("within"),
3391
+ location: import_zod25.z.union([import_zod25.z.string(), SerializedUserField])
2916
3392
  });
2917
- var SerializedQueryExpression = import_zod23.z.object({
2918
- eventType: import_zod23.z.string(),
2919
- status: import_zod23.z.optional(import_zod23.z.union([AnyOfStatus, ExactStatus])),
2920
- createdAt: import_zod23.z.optional(DateCondition),
2921
- updatedAt: import_zod23.z.optional(DateCondition),
2922
- createdAtLocation: import_zod23.z.optional(
2923
- import_zod23.z.union([SerializableWithin, SerializableExact])
3393
+ var SerializedQueryExpression = import_zod25.z.object({
3394
+ eventType: import_zod25.z.string(),
3395
+ status: import_zod25.z.optional(import_zod25.z.union([AnyOfStatus, ExactStatus])),
3396
+ createdAt: import_zod25.z.optional(DateCondition),
3397
+ updatedAt: import_zod25.z.optional(DateCondition),
3398
+ createdAtLocation: import_zod25.z.optional(
3399
+ import_zod25.z.union([SerializableWithin, SerializableExact])
2924
3400
  ),
2925
- updatedAtLocation: import_zod23.z.optional(
2926
- import_zod23.z.union([SerializableWithin, SerializableExact])
3401
+ updatedAtLocation: import_zod25.z.optional(
3402
+ import_zod25.z.union([SerializableWithin, SerializableExact])
2927
3403
  ),
2928
- assignedTo: import_zod23.z.optional(SerializableExact),
2929
- createdBy: import_zod23.z.optional(SerializableExact),
2930
- updatedBy: import_zod23.z.optional(SerializableExact),
2931
- trackingId: import_zod23.z.optional(Exact),
2932
- flags: import_zod23.z.optional(import_zod23.z.array(import_zod23.z.union([AnyOf, Not]))),
3404
+ assignedTo: import_zod25.z.optional(SerializableExact),
3405
+ createdBy: import_zod25.z.optional(SerializableExact),
3406
+ createdByUserType: TokenUserType,
3407
+ updatedBy: import_zod25.z.optional(SerializableExact),
3408
+ trackingId: import_zod25.z.optional(Exact),
3409
+ flags: import_zod25.z.optional(import_zod25.z.array(import_zod25.z.union([AnyOf, Not]))),
2933
3410
  data: QueryInput
2934
3411
  }).partial();
2935
- var Or2 = import_zod23.z.object({
2936
- type: import_zod23.z.literal("or"),
2937
- clauses: import_zod23.z.array(SerializedQueryExpression)
3412
+ var Or2 = import_zod25.z.object({
3413
+ type: import_zod25.z.literal("or"),
3414
+ clauses: import_zod25.z.array(SerializedQueryExpression)
2938
3415
  });
2939
- var And2 = import_zod23.z.object({
2940
- type: import_zod23.z.literal("and"),
2941
- clauses: import_zod23.z.array(SerializedQueryExpression)
3416
+ var And2 = import_zod25.z.object({
3417
+ type: import_zod25.z.literal("and"),
3418
+ clauses: import_zod25.z.array(SerializedQueryExpression)
2942
3419
  });
2943
- var CountryConfigQueryType = import_zod23.z.discriminatedUnion("type", [And2, Or2]);
2944
- var CountryConfigQueryInputType = import_zod23.z.union([
3420
+ var CountryConfigQueryType = import_zod25.z.discriminatedUnion("type", [And2, Or2]);
3421
+ var CountryConfigQueryInputType = import_zod25.z.union([
2945
3422
  SerializedQueryExpression,
2946
3423
  And2,
2947
3424
  Or2
2948
3425
  ]);
2949
3426
 
2950
3427
  // ../commons/src/icons.ts
2951
- var import_zod24 = require("zod");
2952
- var AvailableIcons = import_zod24.z.enum([
3428
+ var import_zod26 = require("zod");
3429
+ var AvailableIcons = import_zod26.z.enum([
2953
3430
  "Archived",
2954
3431
  "Assigned",
2955
3432
  "Certified",
@@ -3071,38 +3548,42 @@ var mandatoryColumns = defineWorkqueuesColumns([
3071
3548
  value: event.field("updatedAt")
3072
3549
  }
3073
3550
  ]);
3074
- var WorkqueueActionsWithDefault = import_zod25.z.enum([
3551
+ var WorkqueueActionsWithDefault = import_zod27.z.enum([
3075
3552
  ...workqueueActions.options,
3076
3553
  "DEFAULT"
3077
3554
  ]);
3078
- var WorkqueueConfig = import_zod25.z.object({
3079
- slug: import_zod25.z.string().describe("Determines the url of the workqueue."),
3555
+ var WorkqueueConfig = import_zod27.z.object({
3556
+ slug: import_zod27.z.string().describe("Determines the url of the workqueue."),
3080
3557
  name: TranslationConfig.describe(
3081
3558
  "Title of the workflow (both in navigation and on the page)"
3082
3559
  ),
3083
3560
  query: CountryConfigQueryType,
3084
- actions: import_zod25.z.array(
3085
- import_zod25.z.object({
3561
+ actions: import_zod27.z.array(
3562
+ import_zod27.z.object({
3086
3563
  type: WorkqueueActionsWithDefault,
3087
- conditionals: import_zod25.z.array(Conditional).optional()
3564
+ conditionals: import_zod27.z.array(Conditional).optional()
3088
3565
  })
3089
3566
  ),
3090
- columns: import_zod25.z.array(WorkqueueColumn).default(mandatoryColumns),
3567
+ columns: import_zod27.z.array(WorkqueueColumn).default(mandatoryColumns),
3091
3568
  icon: AvailableIcons
3092
3569
  }).describe("Configuration for workqueue.");
3093
- var WorkqueueConfigInput = import_zod25.z.object({
3094
- slug: import_zod25.z.string().describe("Determines the url of the workqueue."),
3570
+ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
3571
+ query: true,
3572
+ columns: true
3573
+ });
3574
+ var WorkqueueConfigInput = import_zod27.z.object({
3575
+ slug: import_zod27.z.string().describe("Determines the url of the workqueue."),
3095
3576
  name: TranslationConfig.describe(
3096
3577
  "Title of the workflow (both in navigation and on the page)"
3097
3578
  ),
3098
3579
  query: CountryConfigQueryInputType,
3099
- actions: import_zod25.z.array(
3100
- import_zod25.z.object({
3580
+ actions: import_zod27.z.array(
3581
+ import_zod27.z.object({
3101
3582
  type: WorkqueueActionsWithDefault,
3102
- conditionals: import_zod25.z.array(Conditional).optional()
3583
+ conditionals: import_zod27.z.array(Conditional).optional()
3103
3584
  })
3104
3585
  ),
3105
- columns: import_zod25.z.array(WorkqueueColumn).default(mandatoryColumns),
3586
+ columns: import_zod27.z.array(WorkqueueColumn).default(mandatoryColumns),
3106
3587
  icon: AvailableIcons
3107
3588
  });
3108
3589
  function defineWorkqueue(workqueueInput) {
@@ -3113,10 +3594,10 @@ function defineWorkqueue(workqueueInput) {
3113
3594
  function defineWorkqueues(workqueues) {
3114
3595
  return workqueues.map((workqueue) => defineWorkqueue(workqueue));
3115
3596
  }
3116
- var WorkqueueCountInput = import_zod25.z.array(
3117
- import_zod25.z.object({ slug: import_zod25.z.string(), query: QueryType })
3597
+ var WorkqueueCountInput = import_zod27.z.array(
3598
+ import_zod27.z.object({ slug: import_zod27.z.string(), query: QueryType })
3118
3599
  );
3119
- var WorkqueueCountOutput = import_zod25.z.record(import_zod25.z.string(), import_zod25.z.number());
3600
+ var WorkqueueCountOutput = import_zod27.z.record(import_zod27.z.string(), import_zod27.z.number());
3120
3601
 
3121
3602
  // ../commons/src/events/workqueueDefaultColumns.ts
3122
3603
  var defaultWorkqueueColumns = [
@@ -3139,115 +3620,115 @@ var defaultWorkqueueColumns = [
3139
3620
  ];
3140
3621
 
3141
3622
  // ../commons/src/events/Draft.ts
3142
- var import_zod27 = require("zod");
3623
+ var import_zod29 = require("zod");
3143
3624
 
3144
3625
  // ../commons/src/events/ActionInput.ts
3145
- var import_zod26 = require("zod");
3626
+ var import_zod28 = require("zod");
3146
3627
  var import_zod_openapi10 = require("zod-openapi");
3147
- var import_uuid3 = require("uuid");
3148
- (0, import_zod_openapi10.extendZodWithOpenApi)(import_zod26.z);
3149
- var BaseActionInput = import_zod26.z.object({
3150
- eventId: import_zod26.z.string(),
3151
- transactionId: import_zod26.z.string(),
3628
+ (0, import_zod_openapi10.extendZodWithOpenApi)(import_zod28.z);
3629
+ var BaseActionInput = import_zod28.z.object({
3630
+ eventId: UUID,
3631
+ transactionId: import_zod28.z.string(),
3152
3632
  declaration: ActionUpdate.default({}),
3153
3633
  annotation: ActionUpdate.optional(),
3154
- originalActionId: import_zod26.z.string().optional(),
3155
- keepAssignment: import_zod26.z.boolean().optional()
3634
+ originalActionId: UUID.optional(),
3635
+ // should not be part of base action.
3636
+ keepAssignment: import_zod28.z.boolean().optional()
3156
3637
  });
3157
3638
  var CreateActionInput = BaseActionInput.merge(
3158
- import_zod26.z.object({
3159
- type: import_zod26.z.literal(ActionType.CREATE).default(ActionType.CREATE),
3639
+ import_zod28.z.object({
3640
+ type: import_zod28.z.literal(ActionType.CREATE).default(ActionType.CREATE),
3160
3641
  createdAtLocation: CreatedAtLocation
3161
3642
  })
3162
3643
  );
3163
3644
  var RegisterActionInput = BaseActionInput.merge(
3164
- import_zod26.z.object({
3165
- type: import_zod26.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
3166
- registrationNumber: import_zod26.z.string().optional()
3645
+ import_zod28.z.object({
3646
+ type: import_zod28.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
3647
+ registrationNumber: import_zod28.z.string().optional()
3167
3648
  })
3168
- );
3649
+ ).strict();
3169
3650
  var ValidateActionInput = BaseActionInput.merge(
3170
- import_zod26.z.object({
3171
- type: import_zod26.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
3172
- duplicates: import_zod26.z.array(import_zod26.z.string())
3651
+ import_zod28.z.object({
3652
+ type: import_zod28.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
3653
+ duplicates: import_zod28.z.array(import_zod28.z.string())
3173
3654
  })
3174
3655
  );
3175
3656
  var NotifyActionInput = BaseActionInput.merge(
3176
- import_zod26.z.object({
3177
- type: import_zod26.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
3657
+ import_zod28.z.object({
3658
+ type: import_zod28.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
3178
3659
  })
3179
3660
  ).openapi({
3180
3661
  default: {
3181
3662
  eventId: "<event-id-here>",
3182
- transactionId: (0, import_uuid3.v4)(),
3663
+ transactionId: getUUID(),
3183
3664
  declaration: {},
3184
3665
  annotation: {},
3185
3666
  type: ActionType.NOTIFY
3186
3667
  }
3187
3668
  });
3188
3669
  var DeclareActionInput = BaseActionInput.merge(
3189
- import_zod26.z.object({
3190
- type: import_zod26.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
3670
+ import_zod28.z.object({
3671
+ type: import_zod28.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
3191
3672
  })
3192
3673
  );
3193
3674
  var PrintCertificateActionInput = BaseActionInput.merge(
3194
- import_zod26.z.object({
3195
- type: import_zod26.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
3675
+ import_zod28.z.object({
3676
+ type: import_zod28.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
3196
3677
  })
3197
3678
  );
3198
3679
  var RejectDeclarationActionInput = BaseActionInput.merge(
3199
- import_zod26.z.object({
3200
- type: import_zod26.z.literal(ActionType.REJECT).default(ActionType.REJECT),
3680
+ import_zod28.z.object({
3681
+ type: import_zod28.z.literal(ActionType.REJECT).default(ActionType.REJECT),
3201
3682
  reason: RejectionReason
3202
3683
  })
3203
3684
  );
3204
3685
  var MarkedAsDuplicateActionInput = BaseActionInput.merge(
3205
- import_zod26.z.object({
3206
- type: import_zod26.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
3686
+ import_zod28.z.object({
3687
+ type: import_zod28.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
3207
3688
  })
3208
3689
  );
3209
3690
  var ArchiveActionInput = BaseActionInput.merge(
3210
- import_zod26.z.object({
3211
- type: import_zod26.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
3691
+ import_zod28.z.object({
3692
+ type: import_zod28.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
3212
3693
  reason: RejectionReason
3213
3694
  })
3214
3695
  );
3215
3696
  var AssignActionInput = BaseActionInput.merge(
3216
- import_zod26.z.object({
3217
- type: import_zod26.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
3218
- assignedTo: import_zod26.z.string()
3697
+ import_zod28.z.object({
3698
+ type: import_zod28.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
3699
+ assignedTo: import_zod28.z.string()
3219
3700
  })
3220
3701
  );
3221
3702
  var UnassignActionInput = BaseActionInput.merge(
3222
- import_zod26.z.object({
3223
- type: import_zod26.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
3224
- assignedTo: import_zod26.z.literal(null).default(null)
3703
+ import_zod28.z.object({
3704
+ type: import_zod28.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
3705
+ assignedTo: import_zod28.z.literal(null).default(null)
3225
3706
  })
3226
3707
  );
3227
3708
  var RequestCorrectionActionInput = BaseActionInput.merge(
3228
- import_zod26.z.object({
3229
- type: import_zod26.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
3709
+ import_zod28.z.object({
3710
+ type: import_zod28.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
3230
3711
  })
3231
3712
  );
3232
3713
  var RejectCorrectionActionInput = BaseActionInput.merge(
3233
- import_zod26.z.object({
3234
- requestId: import_zod26.z.string(),
3235
- type: import_zod26.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
3714
+ import_zod28.z.object({
3715
+ requestId: import_zod28.z.string(),
3716
+ type: import_zod28.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
3236
3717
  })
3237
3718
  );
3238
3719
  var ApproveCorrectionActionInput = BaseActionInput.merge(
3239
- import_zod26.z.object({
3240
- requestId: import_zod26.z.string(),
3241
- type: import_zod26.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
3720
+ import_zod28.z.object({
3721
+ requestId: import_zod28.z.string(),
3722
+ type: import_zod28.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
3242
3723
  })
3243
3724
  );
3244
3725
  var ReadActionInput = BaseActionInput.merge(
3245
- import_zod26.z.object({
3246
- type: import_zod26.z.literal(ActionType.READ).default(ActionType.READ)
3726
+ import_zod28.z.object({
3727
+ type: import_zod28.z.literal(ActionType.READ).default(ActionType.READ)
3247
3728
  })
3248
3729
  );
3249
- var DeleteActionInput = import_zod26.z.object({ eventId: import_zod26.z.string() });
3250
- var ActionInput = import_zod26.z.discriminatedUnion("type", [
3730
+ var DeleteActionInput = import_zod28.z.object({ eventId: UUID });
3731
+ var ActionInput = import_zod28.z.discriminatedUnion("type", [
3251
3732
  CreateActionInput.openapi({ ref: "CreateActionInput" }),
3252
3733
  ValidateActionInput.openapi({ ref: "ValidateActionInput" }),
3253
3734
  RegisterActionInput.openapi({ ref: "RegisterActionInput" }),
@@ -3276,18 +3757,18 @@ var ActionInput = import_zod26.z.discriminatedUnion("type", [
3276
3757
  });
3277
3758
 
3278
3759
  // ../commons/src/events/Draft.ts
3279
- var Draft = import_zod27.z.object({
3280
- id: import_zod27.z.string(),
3281
- eventId: import_zod27.z.string(),
3282
- transactionId: import_zod27.z.string(),
3283
- createdAt: import_zod27.z.string().datetime(),
3760
+ var Draft = import_zod29.z.object({
3761
+ id: UUID,
3762
+ eventId: UUID,
3763
+ transactionId: import_zod29.z.string(),
3764
+ createdAt: import_zod29.z.string().datetime(),
3284
3765
  action: ActionBase.extend({
3285
3766
  type: ActionTypes
3286
3767
  }).omit({ id: true })
3287
3768
  });
3288
3769
  var DraftInput = BaseActionInput.extend({
3289
3770
  type: ActionTypes,
3290
- status: import_zod27.z.enum([
3771
+ status: import_zod29.z.enum([
3291
3772
  ActionStatus.Requested,
3292
3773
  ActionStatus.Accepted,
3293
3774
  ActionStatus.Rejected
@@ -3295,24 +3776,24 @@ var DraftInput = BaseActionInput.extend({
3295
3776
  });
3296
3777
 
3297
3778
  // ../commons/src/events/EventInput.ts
3298
- var import_zod28 = require("zod");
3299
- var import_uuid4 = require("uuid");
3300
- var EventInput = import_zod28.z.object({
3301
- transactionId: import_zod28.z.string(),
3302
- type: import_zod28.z.string()
3303
- }).openapi({ default: { transactionId: (0, import_uuid4.v4)(), type: "v2.birth" } });
3779
+ var import_zod30 = require("zod");
3780
+ var import_uuid8 = require("uuid");
3781
+ var EventInput = import_zod30.z.object({
3782
+ transactionId: import_zod30.z.string(),
3783
+ type: import_zod30.z.string()
3784
+ }).openapi({ default: { transactionId: (0, import_uuid8.v4)(), type: "v2.birth" } });
3304
3785
 
3305
3786
  // ../commons/src/events/EventDocument.ts
3306
- var import_zod29 = require("zod");
3787
+ var import_zod31 = require("zod");
3307
3788
  var import_zod_openapi11 = require("zod-openapi");
3308
- (0, import_zod_openapi11.extendZodWithOpenApi)(import_zod29.z);
3309
- var EventDocument = import_zod29.z.object({
3310
- id: import_zod29.z.string(),
3311
- type: import_zod29.z.string(),
3312
- createdAt: import_zod29.z.string().datetime(),
3313
- updatedAt: import_zod29.z.string().datetime(),
3314
- actions: import_zod29.z.array(Action),
3315
- trackingId: import_zod29.z.string()
3789
+ (0, import_zod_openapi11.extendZodWithOpenApi)(import_zod31.z);
3790
+ var EventDocument = import_zod31.z.object({
3791
+ id: UUID,
3792
+ type: import_zod31.z.string(),
3793
+ createdAt: import_zod31.z.string().datetime(),
3794
+ updatedAt: import_zod31.z.string().datetime(),
3795
+ actions: import_zod31.z.array(Action),
3796
+ trackingId: import_zod31.z.string()
3316
3797
  }).openapi({ ref: "EventDocument" });
3317
3798
 
3318
3799
  // ../commons/src/events/state/utils.ts
@@ -3346,6 +3827,7 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
3346
3827
  // When 3rd party API returns 200 OK, we assume that the request was accepted, and persist single 'accepted' action.
3347
3828
  createdAt: requestAction?.createdAt ?? acceptAction.createdAt,
3348
3829
  createdBy: requestAction?.createdBy ?? acceptAction.createdBy,
3830
+ createdByUserType: requestAction?.createdByUserType ?? acceptAction.createdByUserType,
3349
3831
  createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
3350
3832
  acceptedAt: acceptAction.createdAt,
3351
3833
  createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
@@ -3353,17 +3835,18 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
3353
3835
  registrationNumber
3354
3836
  };
3355
3837
  }
3356
- function getDeclarationActionUpdateMetadata(actions) {
3838
+ function getActionUpdateMetadata(actions) {
3357
3839
  const createAction = getOrThrow(
3358
3840
  actions.find((action) => action.type === ActionType.CREATE),
3359
3841
  `Event has no ${ActionType.CREATE} action`
3360
3842
  );
3361
- return [ActionType.DECLARE, ActionType.VALIDATE, ActionType.REGISTER].reduce(
3843
+ return StatusChangingActions.options.reduce(
3362
3844
  (metadata, actionType) => {
3363
3845
  const { accept, request } = getActionRequests(actionType, actions);
3364
3846
  return {
3365
3847
  createdAt: request?.createdAt ?? accept?.createdAt ?? metadata.createdAt,
3366
3848
  createdBy: request?.createdBy ?? accept?.createdBy ?? metadata.createdBy,
3849
+ createdByUserType: request?.createdByUserType ?? accept?.createdByUserType ?? metadata.createdByUserType,
3367
3850
  createdAtLocation: request?.createdAtLocation ?? accept?.createdAtLocation ?? metadata.createdAtLocation,
3368
3851
  createdByRole: request?.createdByRole ?? accept?.createdByRole ?? metadata.createdByRole
3369
3852
  };
@@ -3371,6 +3854,7 @@ function getDeclarationActionUpdateMetadata(actions) {
3371
3854
  {
3372
3855
  createdAt: createAction.createdAt,
3373
3856
  createdBy: createAction.createdBy,
3857
+ createdByUserType: createAction.createdByUserType,
3374
3858
  createdAtLocation: createAction.createdAtLocation,
3375
3859
  createdByRole: createAction.createdByRole
3376
3860
  }
@@ -3535,9 +4019,8 @@ function getCurrentEventState(event2, config) {
3535
4019
  const acceptedActions = getAcceptedActions(event2).sort(
3536
4020
  (a, b) => a.createdAt.localeCompare(b.createdAt)
3537
4021
  );
3538
- const declarationUpdateMetadata = getDeclarationActionUpdateMetadata(
3539
- event2.actions
3540
- );
4022
+ const requestActionMetadata = getActionUpdateMetadata(event2.actions);
4023
+ const acceptedActionMetadata = getActionUpdateMetadata(acceptedActions);
3541
4024
  const declaration = aggregateActionDeclarations(acceptedActions);
3542
4025
  let dateOfEvent;
3543
4026
  if (config.dateOfEvent) {
@@ -3557,16 +4040,17 @@ function getCurrentEventState(event2, config) {
3557
4040
  legalStatuses: getLegalStatuses(event2.actions),
3558
4041
  createdAt: creationAction.createdAt,
3559
4042
  createdBy: creationAction.createdBy,
4043
+ createdByUserType: creationAction.createdByUserType,
3560
4044
  createdAtLocation: creationAction.createdAtLocation,
3561
4045
  createdBySignature: creationAction.createdBySignature,
3562
- updatedAt: declarationUpdateMetadata.createdAt,
4046
+ updatedAt: acceptedActionMetadata.createdAt,
3563
4047
  assignedTo: getAssignedUserFromActions(acceptedActions),
3564
4048
  assignedToSignature: getAssignedUserSignatureFromActions(acceptedActions),
3565
- updatedBy: declarationUpdateMetadata.createdBy,
3566
- updatedAtLocation: declarationUpdateMetadata.createdAtLocation,
4049
+ updatedBy: requestActionMetadata.createdBy,
4050
+ updatedAtLocation: requestActionMetadata.createdAtLocation,
3567
4051
  declaration,
3568
4052
  trackingId: event2.trackingId,
3569
- updatedByUserRole: declarationUpdateMetadata.createdByRole,
4053
+ updatedByUserRole: requestActionMetadata.createdByRole,
3570
4054
  dateOfEvent,
3571
4055
  flags: getFlagsFromActions(event2.actions)
3572
4056
  });
@@ -3649,18 +4133,18 @@ function generateTransactionId() {
3649
4133
  }
3650
4134
 
3651
4135
  // ../commons/src/events/User.ts
3652
- var import_zod30 = require("zod");
3653
- var User = import_zod30.z.object({
3654
- id: import_zod30.z.string(),
3655
- name: import_zod30.z.array(
3656
- import_zod30.z.object({
3657
- use: import_zod30.z.string(),
3658
- given: import_zod30.z.array(import_zod30.z.string()),
3659
- family: import_zod30.z.string()
4136
+ var import_zod32 = require("zod");
4137
+ var User = import_zod32.z.object({
4138
+ id: import_zod32.z.string(),
4139
+ name: import_zod32.z.array(
4140
+ import_zod32.z.object({
4141
+ use: import_zod32.z.string(),
4142
+ given: import_zod32.z.array(import_zod32.z.string()),
4143
+ family: import_zod32.z.string()
3660
4144
  })
3661
4145
  ),
3662
- role: import_zod30.z.string(),
3663
- signatureFilename: import_zod30.z.string().optional()
4146
+ role: import_zod32.z.string(),
4147
+ signatureFilename: import_zod32.z.string().optional()
3664
4148
  });
3665
4149
 
3666
4150
  // ../commons/src/events/test.utils.ts
@@ -5651,6 +6135,14 @@ var v2BirthEvent = defineConfig({
5651
6135
  });
5652
6136
 
5653
6137
  // ../commons/src/events/test.utils.ts
6138
+ var import_zod33 = require("zod");
6139
+ var TestUserRole = import_zod33.z.enum([
6140
+ "FIELD_AGENT",
6141
+ "LOCAL_REGISTRAR",
6142
+ "LOCAL_SYSTEM_ADMIN",
6143
+ "NATIONAL_REGISTRAR",
6144
+ "REGISTRATION_AGENT"
6145
+ ]);
5654
6146
  function pickRandom(rng, items) {
5655
6147
  return items[Math.floor(rng() * items.length)];
5656
6148
  }
@@ -5823,6 +6315,7 @@ function eventPayloadGenerator(rng) {
5823
6315
  },
5824
6316
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
5825
6317
  createdBy: "@todo",
6318
+ createdByUserType: TokenUserType.Enum.user,
5826
6319
  createdByRole: "@todo",
5827
6320
  createdAtLocation: "@todo"
5828
6321
  }
@@ -6008,16 +6501,18 @@ function generateActionDocument({
6008
6501
  configuration,
6009
6502
  action,
6010
6503
  rng = () => 0.1,
6011
- defaults = {}
6504
+ defaults = {},
6505
+ user: user2 = {}
6012
6506
  }) {
6013
6507
  const actionBase = {
6014
6508
  // Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
6015
6509
  // @TODO: This should be fixed in the future.
6016
6510
  createdAt: new Date(Date.now() - 500).toISOString(),
6017
- createdBy: getUUID(),
6018
- createdByRole: "FIELD_AGENT",
6511
+ createdBy: user2.id ?? getUUID(),
6512
+ createdByUserType: TokenUserType.Enum.user,
6513
+ createdByRole: TestUserRole.Enum.FIELD_AGENT,
6019
6514
  id: getUUID(),
6020
- createdAtLocation: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
6515
+ createdAtLocation: user2.primaryOfficeId ?? "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
6021
6516
  declaration: generateActionDeclarationInput(configuration, action, rng),
6022
6517
  annotation: {},
6023
6518
  status: ActionStatus.Accepted,
@@ -6032,7 +6527,7 @@ function generateActionDocument({
6032
6527
  case ActionType.DECLARE:
6033
6528
  return { ...actionBase, type: action };
6034
6529
  case ActionType.UNASSIGN:
6035
- return { ...actionBase, type: action, assignedTo: null };
6530
+ return { ...actionBase, type: action };
6036
6531
  case ActionType.ASSIGN:
6037
6532
  return { ...actionBase, assignedTo: getUUID(), type: action };
6038
6533
  case ActionType.VALIDATE:
@@ -6071,13 +6566,14 @@ function generateActionDocument({
6071
6566
  function generateEventDocument({
6072
6567
  configuration,
6073
6568
  actions,
6074
- rng = () => 0.1
6569
+ rng = () => 0.1,
6570
+ user: user2
6075
6571
  }) {
6076
6572
  return {
6077
6573
  trackingId: getUUID(),
6078
6574
  type: configuration.id,
6079
6575
  actions: actions.map(
6080
- (action) => generateActionDocument({ configuration, action, rng })
6576
+ (action) => generateActionDocument({ configuration, action, rng, user: user2 })
6081
6577
  ),
6082
6578
  // Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
6083
6579
  // @TODO: This should be fixed in the future.
@@ -6145,7 +6641,7 @@ function createPrng(seed) {
6145
6641
  return state / MODULUS;
6146
6642
  };
6147
6643
  }
6148
- function generateUuid(rng) {
6644
+ function generateUuid(rng = () => 0.1) {
6149
6645
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
6150
6646
  const r = Math.floor(rng() * 16);
6151
6647
  const v = c === "x" ? r : r & 3 | 8;
@@ -6157,6 +6653,11 @@ function generateTrackingId(rng) {
6157
6653
  const trackingId = uuid.slice(0, 6).toUpperCase();
6158
6654
  return trackingId;
6159
6655
  }
6656
+ function generateRegistrationNumber(rng) {
6657
+ const uuid = generateUuid(rng).replace(/-/g, "");
6658
+ const registrationNumber = uuid.slice(0, 12).toUpperCase();
6659
+ return registrationNumber;
6660
+ }
6160
6661
  function generateRandomSignature(rng) {
6161
6662
  return `/random-bucket/${generateUuid(rng)}.png`;
6162
6663
  }
@@ -6172,6 +6673,7 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
6172
6673
  type: overrides.type ?? TENNIS_CLUB_MEMBERSHIP,
6173
6674
  status: overrides.status ?? pickRandom(rng, EventStatus.options),
6174
6675
  createdAt: overrides.createdAt ?? createdAt,
6676
+ createdByUserType: overrides.createdByUserType ?? "user",
6175
6677
  createdBy: overrides.createdBy ?? generateUuid(rng),
6176
6678
  createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
6177
6679
  updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
@@ -6249,234 +6751,6 @@ function isFieldConfigDefaultValue(value) {
6249
6751
 
6250
6752
  // ../commons/src/events/scopes.ts
6251
6753
  var import_lodash3 = require("lodash");
6252
-
6253
- // ../commons/src/scopes.ts
6254
- var import_zod31 = require("zod");
6255
- var SCOPES = {
6256
- // TODO v1.8 legacy scopes
6257
- NATLSYSADMIN: "natlsysadmin",
6258
- BYPASSRATELIMIT: "bypassratelimit",
6259
- DECLARE: "declare",
6260
- REGISTER: "register",
6261
- VALIDATE: "validate",
6262
- DEMO: "demo",
6263
- CERTIFY: "certify",
6264
- PERFORMANCE: "performance",
6265
- SYSADMIN: "sysadmin",
6266
- TEAMS: "teams",
6267
- CONFIG: "config",
6268
- // systems / integrations
6269
- WEBHOOK: "webhook",
6270
- NATIONALID: "nationalId",
6271
- NOTIFICATION_API: "notification-api",
6272
- RECORDSEARCH: "recordsearch",
6273
- /**
6274
- * @TODO This is a temporary scope to be used for V2 Events custom events declaration
6275
- */
6276
- RECORD_DECLARE: "record.declare-birth",
6277
- // declare
6278
- RECORD_IMPORT: "record.import",
6279
- // declare
6280
- RECORD_DECLARE_BIRTH: "record.declare-birth",
6281
- RECORD_DECLARE_BIRTH_MY_JURISDICTION: "record.declare-birth:my-jurisdiction",
6282
- RECORD_DECLARE_DEATH: "record.declare-death",
6283
- RECORD_DECLARE_DEATH_MY_JURISDICTION: "record.declare-death:my-jurisdiction",
6284
- RECORD_DECLARE_MARRIAGE: "record.declare-marriage",
6285
- RECORD_DECLARE_MARRIAGE_MY_JURISDICTION: "record.declare-marriage:my-jurisdiction",
6286
- RECORD_SUBMIT_INCOMPLETE: "record.declaration-submit-incomplete",
6287
- RECORD_SUBMIT_FOR_REVIEW: "record.declaration-submit-for-review",
6288
- RECORD_UNASSIGN_OTHERS: "record.unassign-others",
6289
- // validate
6290
- RECORD_SUBMIT_FOR_APPROVAL: "record.declaration-submit-for-approval",
6291
- RECORD_SUBMIT_FOR_UPDATES: "record.declaration-submit-for-updates",
6292
- RECORD_DECLARATION_EDIT: "record.declaration-edit",
6293
- RECORD_REVIEW_DUPLICATES: "record.review-duplicates",
6294
- RECORD_DECLARATION_ARCHIVE: "record.declaration-archive",
6295
- RECORD_DECLARATION_REINSTATE: "record.declaration-reinstate",
6296
- // register
6297
- RECORD_REGISTER: "record.register",
6298
- // certify
6299
- RECORD_EXPORT_RECORDS: "record.export-records",
6300
- RECORD_DECLARATION_PRINT: "record.declaration-print",
6301
- RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS: "record.declaration-print-supporting-documents",
6302
- RECORD_REGISTRATION_PRINT: "record.registration-print",
6303
- // v1.8
6304
- /**
6305
- * This scope is used to **print and **issue certified copies of a record
6306
- * after it has been registered. Previously Registrars had this permission.
6307
- */
6308
- RECORD_PRINT_ISSUE_CERTIFIED_COPIES: "record.registration-print&issue-certified-copies",
6309
- RECORD_PRINT_CERTIFIED_COPIES: "record.registration-print-certified-copies",
6310
- // v1.8
6311
- RECORD_BULK_PRINT_CERTIFIED_COPIES: "record.registration-bulk-print-certified-copies",
6312
- // v1.8
6313
- RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES: "record.registration-verify-certified-copies",
6314
- // v1.8
6315
- // correct
6316
- RECORD_REGISTRATION_REQUEST_CORRECTION: "record.registration-request-correction",
6317
- RECORD_REGISTRATION_CORRECT: "record.registration-correct",
6318
- RECORD_REGISTRATION_REQUEST_REVOCATION: "record.registration-request-revocation",
6319
- // v1.8
6320
- RECORD_REGISTRATION_REVOKE: "record.registration-revoke",
6321
- // v1.8
6322
- RECORD_REGISTRATION_REQUEST_REINSTATEMENT: "record.registration-request-reinstatement",
6323
- // v1.8
6324
- RECORD_REGISTRATION_REINSTATE: "record.registration-reinstate",
6325
- // v1.8
6326
- RECORD_CONFIRM_REGISTRATION: "record.confirm-registration",
6327
- RECORD_REJECT_REGISTRATION: "record.reject-registration",
6328
- // search
6329
- SEARCH_BIRTH_MY_JURISDICTION: "search.birth:my-jurisdiction",
6330
- SEARCH_BIRTH: "search.birth",
6331
- SEARCH_DEATH_MY_JURISDICTION: "search.death:my-jurisdiction",
6332
- SEARCH_DEATH: "search.death",
6333
- SEARCH_MARRIAGE_MY_JURISDICTION: "search.marriage:my-jurisdiction",
6334
- SEARCH_MARRIAGE: "search.marriage",
6335
- // audit v1.8
6336
- RECORD_READ: "record.read",
6337
- RECORD_READ_AUDIT: "record.read-audit",
6338
- RECORD_READ_COMMENTS: "record.read-comments",
6339
- RECORD_CREATE_COMMENTS: "record.create-comments",
6340
- // profile
6341
- PROFILE_UPDATE: "profile.update",
6342
- //v1.8
6343
- PROFILE_ELECTRONIC_SIGNATURE: "profile.electronic-signature",
6344
- // performance
6345
- PERFORMANCE_READ: "performance.read",
6346
- PERFORMANCE_READ_DASHBOARDS: "performance.read-dashboards",
6347
- PERFORMANCE_EXPORT_VITAL_STATISTICS: "performance.vital-statistics-export",
6348
- // organisation
6349
- ORGANISATION_READ_LOCATIONS: "organisation.read-locations:all",
6350
- ORGANISATION_READ_LOCATIONS_MY_OFFICE: "organisation.read-locations:my-office",
6351
- ORGANISATION_READ_LOCATIONS_MY_JURISDICTION: "organisation.read-locations:my-jurisdiction",
6352
- // user
6353
- USER_READ: "user.read:all",
6354
- USER_READ_MY_OFFICE: "user.read:my-office",
6355
- USER_READ_MY_JURISDICTION: "user.read:my-jurisdiction",
6356
- USER_READ_ONLY_MY_AUDIT: "user.read:only-my-audit",
6357
- //v1.8
6358
- USER_CREATE: "user.create:all",
6359
- USER_CREATE_MY_JURISDICTION: "user.create:my-jurisdiction",
6360
- USER_UPDATE: "user.update:all",
6361
- USER_UPDATE_MY_JURISDICTION: "user.update:my-jurisdiction",
6362
- // config
6363
- CONFIG_UPDATE_ALL: "config.update:all",
6364
- // data seeding
6365
- USER_DATA_SEEDING: "user.data-seeding"
6366
- };
6367
- var LiteralScopes = import_zod31.z.union([
6368
- import_zod31.z.literal(SCOPES.NATLSYSADMIN),
6369
- import_zod31.z.literal(SCOPES.BYPASSRATELIMIT),
6370
- import_zod31.z.literal(SCOPES.DECLARE),
6371
- import_zod31.z.literal(SCOPES.REGISTER),
6372
- import_zod31.z.literal(SCOPES.VALIDATE),
6373
- import_zod31.z.literal(SCOPES.DEMO),
6374
- import_zod31.z.literal(SCOPES.CERTIFY),
6375
- import_zod31.z.literal(SCOPES.PERFORMANCE),
6376
- import_zod31.z.literal(SCOPES.SYSADMIN),
6377
- import_zod31.z.literal(SCOPES.TEAMS),
6378
- import_zod31.z.literal(SCOPES.CONFIG),
6379
- import_zod31.z.literal(SCOPES.WEBHOOK),
6380
- import_zod31.z.literal(SCOPES.NATIONALID),
6381
- import_zod31.z.literal(SCOPES.NOTIFICATION_API),
6382
- import_zod31.z.literal(SCOPES.RECORDSEARCH),
6383
- import_zod31.z.literal(SCOPES.RECORD_IMPORT),
6384
- import_zod31.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
6385
- import_zod31.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
6386
- import_zod31.z.literal(SCOPES.RECORD_DECLARE_DEATH),
6387
- import_zod31.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
6388
- import_zod31.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
6389
- import_zod31.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
6390
- import_zod31.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
6391
- import_zod31.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW),
6392
- import_zod31.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS),
6393
- import_zod31.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
6394
- import_zod31.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
6395
- import_zod31.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
6396
- import_zod31.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
6397
- import_zod31.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
6398
- import_zod31.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE),
6399
- import_zod31.z.literal(SCOPES.RECORD_REGISTER),
6400
- import_zod31.z.literal(SCOPES.RECORD_EXPORT_RECORDS),
6401
- import_zod31.z.literal(SCOPES.RECORD_DECLARATION_PRINT),
6402
- import_zod31.z.literal(SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS),
6403
- import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_PRINT),
6404
- import_zod31.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
6405
- import_zod31.z.literal(SCOPES.RECORD_PRINT_CERTIFIED_COPIES),
6406
- import_zod31.z.literal(SCOPES.RECORD_BULK_PRINT_CERTIFIED_COPIES),
6407
- import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES),
6408
- import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
6409
- import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
6410
- import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REVOCATION),
6411
- import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REVOKE),
6412
- import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REINSTATEMENT),
6413
- import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REINSTATE),
6414
- import_zod31.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
6415
- import_zod31.z.literal(SCOPES.RECORD_REJECT_REGISTRATION),
6416
- import_zod31.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
6417
- import_zod31.z.literal(SCOPES.SEARCH_BIRTH),
6418
- import_zod31.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
6419
- import_zod31.z.literal(SCOPES.SEARCH_DEATH),
6420
- import_zod31.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
6421
- import_zod31.z.literal(SCOPES.SEARCH_MARRIAGE),
6422
- import_zod31.z.literal(SCOPES.RECORD_READ),
6423
- import_zod31.z.literal(SCOPES.RECORD_READ_AUDIT),
6424
- import_zod31.z.literal(SCOPES.RECORD_READ_COMMENTS),
6425
- import_zod31.z.literal(SCOPES.RECORD_CREATE_COMMENTS),
6426
- import_zod31.z.literal(SCOPES.PROFILE_UPDATE),
6427
- import_zod31.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE),
6428
- import_zod31.z.literal(SCOPES.PERFORMANCE_READ),
6429
- import_zod31.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
6430
- import_zod31.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS),
6431
- import_zod31.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
6432
- import_zod31.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
6433
- import_zod31.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION),
6434
- import_zod31.z.literal(SCOPES.USER_READ),
6435
- import_zod31.z.literal(SCOPES.USER_READ_MY_OFFICE),
6436
- import_zod31.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
6437
- import_zod31.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
6438
- import_zod31.z.literal(SCOPES.USER_CREATE),
6439
- import_zod31.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
6440
- import_zod31.z.literal(SCOPES.USER_UPDATE),
6441
- import_zod31.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION),
6442
- import_zod31.z.literal(SCOPES.CONFIG_UPDATE_ALL),
6443
- import_zod31.z.literal(SCOPES.USER_DATA_SEEDING)
6444
- ]);
6445
- var rawConfigurableScopeRegex = /^([a-zA-Z\.]+)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
6446
- var rawConfigurableScope = import_zod31.z.string().regex(rawConfigurableScopeRegex);
6447
- var CreateUserScope = import_zod31.z.object({
6448
- type: import_zod31.z.literal("user.create"),
6449
- options: import_zod31.z.object({
6450
- role: import_zod31.z.array(import_zod31.z.string())
6451
- })
6452
- });
6453
- var EditUserScope = import_zod31.z.object({
6454
- type: import_zod31.z.literal("user.edit"),
6455
- options: import_zod31.z.object({
6456
- role: import_zod31.z.array(import_zod31.z.string())
6457
- })
6458
- });
6459
- var WorkqueueScope = import_zod31.z.object({
6460
- type: import_zod31.z.literal("workqueue"),
6461
- options: import_zod31.z.object({
6462
- id: import_zod31.z.array(import_zod31.z.string())
6463
- })
6464
- });
6465
- var NotifyRecordScope = import_zod31.z.object({
6466
- type: import_zod31.z.literal("record.notify"),
6467
- options: import_zod31.z.object({
6468
- event: import_zod31.z.array(import_zod31.z.string())
6469
- })
6470
- });
6471
- var ConfigurableScopes = import_zod31.z.discriminatedUnion("type", [
6472
- CreateUserScope,
6473
- EditUserScope,
6474
- WorkqueueScope,
6475
- NotifyRecordScope
6476
- ]);
6477
- var scopes = Object.values(SCOPES);
6478
-
6479
- // ../commons/src/events/scopes.ts
6480
6754
  var CONFIG_GET_ALLOWED_SCOPES = [
6481
6755
  SCOPES.RECORD_DECLARE,
6482
6756
  SCOPES.RECORD_READ,
@@ -6553,30 +6827,20 @@ var ACTION_ALLOWED_CONFIGURABLE_SCOPES = {
6553
6827
  [ActionType.UNASSIGN]: [],
6554
6828
  [ActionType.DETECT_DUPLICATE]: []
6555
6829
  };
6830
+ var WRITE_ACTION_SCOPES = [
6831
+ ...ACTION_ALLOWED_SCOPES[ActionType.DECLARE],
6832
+ ...ACTION_ALLOWED_SCOPES[ActionType.VALIDATE],
6833
+ ...ACTION_ALLOWED_SCOPES[ActionType.REGISTER],
6834
+ ...ACTION_ALLOWED_SCOPES[ActionType.PRINT_CERTIFICATE]
6835
+ ];
6556
6836
  function hasAnyOfScopes(a, b) {
6557
6837
  return (0, import_lodash3.intersection)(a, b).length > 0;
6558
6838
  }
6559
- function filterUnallowedActions(actions, userScopes) {
6560
- const allowedActions = actions.filter((action) => {
6561
- const requiredScopes = ACTION_ALLOWED_SCOPES[action];
6562
- if (requiredScopes === null) {
6563
- return true;
6564
- }
6565
- return hasAnyOfScopes(userScopes, requiredScopes);
6566
- });
6567
- const hasOtherAllowedActions = allowedActions.some(
6568
- (action) => !isMetaAction(action)
6569
- );
6570
- if (hasOtherAllowedActions) {
6571
- return allowedActions;
6572
- }
6573
- return [ActionType.READ];
6574
- }
6575
6839
 
6576
6840
  // ../commons/src/events/serializers/user/deserializer.ts
6577
- var import_zod32 = require("zod");
6841
+ var import_zod34 = require("zod");
6578
6842
  var UserWithPrimaryOffice = User.extend({
6579
- primaryOfficeId: import_zod32.z.string()
6843
+ primaryOfficeId: import_zod34.z.string()
6580
6844
  });
6581
6845
  function userDeserializer(serializedUserField, user2) {
6582
6846
  if (typeof serializedUserField === "string") {
@@ -6596,6 +6860,7 @@ function deserializeQueryExpression(expression, user2) {
6596
6860
  ...expression.assignedTo,
6597
6861
  term: userDeserializer(expression.assignedTo.term, user2)
6598
6862
  },
6863
+ createdByUserType: expression.createdByUserType,
6599
6864
  createdBy: expression.createdBy && {
6600
6865
  ...expression.createdBy,
6601
6866
  term: userDeserializer(expression.createdBy.term, user2)
@@ -6636,3 +6901,51 @@ function deserializeQuery(query, user2) {
6636
6901
  )
6637
6902
  };
6638
6903
  }
6904
+
6905
+ // ../commons/src/events/state/availableActions.ts
6906
+ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
6907
+ [EventStatus.enum.CREATED]: [
6908
+ ActionType.READ,
6909
+ ActionType.DECLARE,
6910
+ ActionType.NOTIFY,
6911
+ ActionType.DELETE
6912
+ ],
6913
+ [EventStatus.enum.NOTIFIED]: [
6914
+ ActionType.READ,
6915
+ ActionType.DECLARE,
6916
+ ActionType.ARCHIVE,
6917
+ ActionType.REJECT
6918
+ ],
6919
+ [EventStatus.enum.DECLARED]: [
6920
+ ActionType.READ,
6921
+ ActionType.VALIDATE,
6922
+ ActionType.ARCHIVE,
6923
+ ActionType.REJECT
6924
+ ],
6925
+ [EventStatus.enum.VALIDATED]: [
6926
+ ActionType.READ,
6927
+ ActionType.REGISTER,
6928
+ ActionType.ARCHIVE,
6929
+ ActionType.REJECT
6930
+ ],
6931
+ [EventStatus.enum.REJECTED]: [
6932
+ ActionType.READ,
6933
+ ActionType.DECLARE,
6934
+ ActionType.VALIDATE
6935
+ ],
6936
+ [EventStatus.enum.REGISTERED]: [
6937
+ ActionType.READ,
6938
+ ActionType.PRINT_CERTIFICATE,
6939
+ ActionType.REQUEST_CORRECTION
6940
+ ],
6941
+ [EventStatus.enum.CERTIFIED]: [
6942
+ ActionType.READ,
6943
+ ActionType.PRINT_CERTIFICATE,
6944
+ ActionType.REQUEST_CORRECTION
6945
+ ],
6946
+ [EventStatus.enum.ARCHIVED]: [
6947
+ ActionType.READ,
6948
+ ActionType.ASSIGN,
6949
+ ActionType.UNASSIGN
6950
+ ]
6951
+ };