@opencrvs/toolkit 1.8.0-rc.fde984c → 1.8.0-rc.fe4d9d5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commons/api/router.d.ts +4652 -128
- package/dist/commons/conditionals/validate.d.ts +5 -0
- package/dist/commons/events/ActionDocument.d.ts +105 -0
- package/dist/commons/events/ActionType.d.ts +6 -0
- package/dist/commons/events/CountryConfigQueryInput.d.ts +254 -168
- package/dist/commons/events/Draft.d.ts +5 -0
- package/dist/commons/events/EventDocument.d.ts +80 -0
- package/dist/commons/events/EventIndex.d.ts +596 -160
- package/dist/commons/events/EventMetadata.d.ts +35 -2
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +11 -11
- package/dist/commons/events/WorkqueueConfig.d.ts +1959 -470
- package/dist/commons/events/index.d.ts +1 -0
- package/dist/commons/events/scopes.d.ts +1 -2
- package/dist/commons/events/test.utils.d.ts +13 -0
- package/dist/commons/events/utils.d.ts +1 -0
- package/dist/events/index.js +870 -539
- package/dist/scopes/index.d.ts +4 -1
- package/dist/scopes/index.js +67 -17
- package/package.json +1 -1
package/dist/events/index.js
CHANGED
@@ -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,
|
@@ -166,13 +171,16 @@ __export(events_exports, {
|
|
166
171
|
ValidateActionInput: () => ValidateActionInput,
|
167
172
|
VerificationActionConfig: () => VerificationActionConfig,
|
168
173
|
VerificationPageConfig: () => VerificationPageConfig,
|
174
|
+
WRITE_ACTION_SCOPES: () => WRITE_ACTION_SCOPES,
|
169
175
|
Within: () => Within,
|
176
|
+
WorkqueueActionsWithDefault: () => WorkqueueActionsWithDefault,
|
170
177
|
WorkqueueColumn: () => WorkqueueColumn,
|
171
178
|
WorkqueueColumnKeys: () => WorkqueueColumnKeys,
|
172
179
|
WorkqueueColumnKeysArray: () => WorkqueueColumnKeysArray,
|
173
180
|
WorkqueueColumnValue: () => WorkqueueColumnValue,
|
174
181
|
WorkqueueConfig: () => WorkqueueConfig,
|
175
182
|
WorkqueueConfigInput: () => WorkqueueConfigInput,
|
183
|
+
WorkqueueConfigWithoutQuery: () => WorkqueueConfigWithoutQuery,
|
176
184
|
WorkqueueCountInput: () => WorkqueueCountInput,
|
177
185
|
WorkqueueCountOutput: () => WorkqueueCountOutput,
|
178
186
|
ZodDate: () => ZodDate,
|
@@ -208,7 +216,6 @@ __export(events_exports, {
|
|
208
216
|
eventQueryDataGenerator: () => eventQueryDataGenerator,
|
209
217
|
field: () => field,
|
210
218
|
fieldTypes: () => fieldTypes,
|
211
|
-
filterUnallowedActions: () => filterUnallowedActions,
|
212
219
|
findActiveDrafts: () => findActiveDrafts,
|
213
220
|
findAllFields: () => findAllFields,
|
214
221
|
findLastAssignmentAction: () => findLastAssignmentAction,
|
@@ -269,6 +276,7 @@ __export(events_exports, {
|
|
269
276
|
isFileFieldWithOptionType: () => isFileFieldWithOptionType,
|
270
277
|
isIdFieldType: () => isIdFieldType,
|
271
278
|
isLocationFieldType: () => isLocationFieldType,
|
279
|
+
isMetaAction: () => isMetaAction,
|
272
280
|
isNameFieldType: () => isNameFieldType,
|
273
281
|
isNonInteractiveFieldType: () => isNonInteractiveFieldType,
|
274
282
|
isNumberFieldType: () => isNumberFieldType,
|
@@ -300,6 +308,7 @@ __export(events_exports, {
|
|
300
308
|
user: () => user,
|
301
309
|
validate: () => validate,
|
302
310
|
validateFieldInput: () => validateFieldInput,
|
311
|
+
workqueueActions: () => workqueueActions,
|
303
312
|
writeActions: () => writeActions
|
304
313
|
});
|
305
314
|
module.exports = __toCommonJS(events_exports);
|
@@ -963,6 +972,35 @@ var writeActions = ActionTypes.exclude([
|
|
963
972
|
ActionType.ASSIGN,
|
964
973
|
ActionType.UNASSIGN
|
965
974
|
]);
|
975
|
+
var StatusChangingActions = ActionTypes.extract([
|
976
|
+
ActionType.CREATE,
|
977
|
+
ActionType.NOTIFY,
|
978
|
+
ActionType.DECLARE,
|
979
|
+
ActionType.VALIDATE,
|
980
|
+
ActionType.REGISTER,
|
981
|
+
ActionType.REJECT,
|
982
|
+
ActionType.ARCHIVE,
|
983
|
+
ActionType.PRINT_CERTIFICATE
|
984
|
+
]);
|
985
|
+
var workqueueActions = ActionTypes.exclude([
|
986
|
+
ActionType.CREATE,
|
987
|
+
ActionType.NOTIFY,
|
988
|
+
ActionType.DETECT_DUPLICATE,
|
989
|
+
ActionType.REJECT,
|
990
|
+
ActionType.MARKED_AS_DUPLICATE,
|
991
|
+
ActionType.ARCHIVE,
|
992
|
+
ActionType.REQUEST_CORRECTION,
|
993
|
+
ActionType.REJECT_CORRECTION,
|
994
|
+
ActionType.APPROVE_CORRECTION
|
995
|
+
]);
|
996
|
+
var META_ACTIONS = [
|
997
|
+
ActionType.ASSIGN,
|
998
|
+
ActionType.UNASSIGN,
|
999
|
+
ActionType.READ
|
1000
|
+
];
|
1001
|
+
function isMetaAction(actionType) {
|
1002
|
+
return META_ACTIONS.includes(actionType);
|
1003
|
+
}
|
966
1004
|
|
967
1005
|
// ../commons/src/events/FormConfig.ts
|
968
1006
|
var import_zod8 = require("zod");
|
@@ -1124,7 +1162,7 @@ var LanguageConfig = import_zod11.z.object({
|
|
1124
1162
|
});
|
1125
1163
|
|
1126
1164
|
// ../commons/src/events/EventConfig.ts
|
1127
|
-
var
|
1165
|
+
var import_zod20 = require("zod");
|
1128
1166
|
|
1129
1167
|
// ../commons/src/events/DeduplicationConfig.ts
|
1130
1168
|
var import_zod12 = require("zod");
|
@@ -1298,127 +1336,552 @@ var AdvancedSearchConfig = import_zod14.z.object({
|
|
1298
1336
|
var import_lodash = require("lodash");
|
1299
1337
|
|
1300
1338
|
// ../commons/src/events/ActionDocument.ts
|
1301
|
-
var
|
1339
|
+
var import_zod18 = require("zod");
|
1302
1340
|
var import_zod_openapi7 = require("zod-openapi");
|
1303
1341
|
|
1304
1342
|
// ../commons/src/events/CreatedAtLocation.ts
|
1305
1343
|
var import_zod15 = require("zod");
|
1306
1344
|
var CreatedAtLocation = import_zod15.z.string().nullish();
|
1307
1345
|
|
1346
|
+
// ../commons/src/authentication.ts
|
1347
|
+
var import_jwt_decode = __toESM(require("jwt-decode"));
|
1348
|
+
var import_zod17 = require("zod");
|
1349
|
+
|
1350
|
+
// ../commons/src/scopes.ts
|
1351
|
+
var import_zod16 = require("zod");
|
1352
|
+
var SCOPES = {
|
1353
|
+
// TODO v1.8 legacy scopes
|
1354
|
+
NATLSYSADMIN: "natlsysadmin",
|
1355
|
+
BYPASSRATELIMIT: "bypassratelimit",
|
1356
|
+
DECLARE: "declare",
|
1357
|
+
REGISTER: "register",
|
1358
|
+
VALIDATE: "validate",
|
1359
|
+
DEMO: "demo",
|
1360
|
+
CERTIFY: "certify",
|
1361
|
+
PERFORMANCE: "performance",
|
1362
|
+
SYSADMIN: "sysadmin",
|
1363
|
+
TEAMS: "teams",
|
1364
|
+
CONFIG: "config",
|
1365
|
+
// systems / integrations
|
1366
|
+
WEBHOOK: "webhook",
|
1367
|
+
NATIONALID: "nationalId",
|
1368
|
+
NOTIFICATION_API: "notification-api",
|
1369
|
+
RECORDSEARCH: "recordsearch",
|
1370
|
+
/**
|
1371
|
+
* @TODO This is a temporary scope to be used for V2 Events custom events declaration
|
1372
|
+
*/
|
1373
|
+
RECORD_DECLARE: "record.declare-birth",
|
1374
|
+
// declare
|
1375
|
+
RECORD_IMPORT: "record.import",
|
1376
|
+
// declare
|
1377
|
+
RECORD_DECLARE_BIRTH: "record.declare-birth",
|
1378
|
+
RECORD_DECLARE_BIRTH_MY_JURISDICTION: "record.declare-birth:my-jurisdiction",
|
1379
|
+
RECORD_DECLARE_DEATH: "record.declare-death",
|
1380
|
+
RECORD_DECLARE_DEATH_MY_JURISDICTION: "record.declare-death:my-jurisdiction",
|
1381
|
+
RECORD_DECLARE_MARRIAGE: "record.declare-marriage",
|
1382
|
+
RECORD_DECLARE_MARRIAGE_MY_JURISDICTION: "record.declare-marriage:my-jurisdiction",
|
1383
|
+
RECORD_SUBMIT_INCOMPLETE: "record.declaration-submit-incomplete",
|
1384
|
+
RECORD_SUBMIT_FOR_REVIEW: "record.declaration-submit-for-review",
|
1385
|
+
RECORD_UNASSIGN_OTHERS: "record.unassign-others",
|
1386
|
+
// validate
|
1387
|
+
RECORD_SUBMIT_FOR_APPROVAL: "record.declaration-submit-for-approval",
|
1388
|
+
RECORD_SUBMIT_FOR_UPDATES: "record.declaration-submit-for-updates",
|
1389
|
+
RECORD_DECLARATION_EDIT: "record.declaration-edit",
|
1390
|
+
RECORD_REVIEW_DUPLICATES: "record.review-duplicates",
|
1391
|
+
RECORD_DECLARATION_ARCHIVE: "record.declaration-archive",
|
1392
|
+
RECORD_DECLARATION_REINSTATE: "record.declaration-reinstate",
|
1393
|
+
// register
|
1394
|
+
RECORD_REGISTER: "record.register",
|
1395
|
+
// certify
|
1396
|
+
RECORD_EXPORT_RECORDS: "record.export-records",
|
1397
|
+
RECORD_DECLARATION_PRINT: "record.declaration-print",
|
1398
|
+
RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS: "record.declaration-print-supporting-documents",
|
1399
|
+
RECORD_REGISTRATION_PRINT: "record.registration-print",
|
1400
|
+
// v1.8
|
1401
|
+
/**
|
1402
|
+
* This scope is used to **print and **issue certified copies of a record
|
1403
|
+
* after it has been registered. Previously Registrars had this permission.
|
1404
|
+
*/
|
1405
|
+
RECORD_PRINT_ISSUE_CERTIFIED_COPIES: "record.registration-print&issue-certified-copies",
|
1406
|
+
RECORD_PRINT_CERTIFIED_COPIES: "record.registration-print-certified-copies",
|
1407
|
+
// v1.8
|
1408
|
+
RECORD_BULK_PRINT_CERTIFIED_COPIES: "record.registration-bulk-print-certified-copies",
|
1409
|
+
// v1.8
|
1410
|
+
RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES: "record.registration-verify-certified-copies",
|
1411
|
+
// v1.8
|
1412
|
+
// correct
|
1413
|
+
RECORD_REGISTRATION_REQUEST_CORRECTION: "record.registration-request-correction",
|
1414
|
+
RECORD_REGISTRATION_CORRECT: "record.registration-correct",
|
1415
|
+
RECORD_REGISTRATION_REQUEST_REVOCATION: "record.registration-request-revocation",
|
1416
|
+
// v1.8
|
1417
|
+
RECORD_REGISTRATION_REVOKE: "record.registration-revoke",
|
1418
|
+
// v1.8
|
1419
|
+
RECORD_REGISTRATION_REQUEST_REINSTATEMENT: "record.registration-request-reinstatement",
|
1420
|
+
// v1.8
|
1421
|
+
RECORD_REGISTRATION_REINSTATE: "record.registration-reinstate",
|
1422
|
+
// v1.8
|
1423
|
+
RECORD_CONFIRM_REGISTRATION: "record.confirm-registration",
|
1424
|
+
RECORD_REJECT_REGISTRATION: "record.reject-registration",
|
1425
|
+
// search
|
1426
|
+
SEARCH_BIRTH_MY_JURISDICTION: "search.birth:my-jurisdiction",
|
1427
|
+
SEARCH_BIRTH: "search.birth",
|
1428
|
+
SEARCH_DEATH_MY_JURISDICTION: "search.death:my-jurisdiction",
|
1429
|
+
SEARCH_DEATH: "search.death",
|
1430
|
+
SEARCH_MARRIAGE_MY_JURISDICTION: "search.marriage:my-jurisdiction",
|
1431
|
+
SEARCH_MARRIAGE: "search.marriage",
|
1432
|
+
// audit v1.8
|
1433
|
+
RECORD_READ: "record.read",
|
1434
|
+
RECORD_READ_AUDIT: "record.read-audit",
|
1435
|
+
RECORD_READ_COMMENTS: "record.read-comments",
|
1436
|
+
RECORD_CREATE_COMMENTS: "record.create-comments",
|
1437
|
+
// profile
|
1438
|
+
PROFILE_UPDATE: "profile.update",
|
1439
|
+
//v1.8
|
1440
|
+
PROFILE_ELECTRONIC_SIGNATURE: "profile.electronic-signature",
|
1441
|
+
// performance
|
1442
|
+
PERFORMANCE_READ: "performance.read",
|
1443
|
+
PERFORMANCE_READ_DASHBOARDS: "performance.read-dashboards",
|
1444
|
+
PERFORMANCE_EXPORT_VITAL_STATISTICS: "performance.vital-statistics-export",
|
1445
|
+
// organisation
|
1446
|
+
ORGANISATION_READ_LOCATIONS: "organisation.read-locations:all",
|
1447
|
+
ORGANISATION_READ_LOCATIONS_MY_OFFICE: "organisation.read-locations:my-office",
|
1448
|
+
ORGANISATION_READ_LOCATIONS_MY_JURISDICTION: "organisation.read-locations:my-jurisdiction",
|
1449
|
+
// user
|
1450
|
+
USER_READ: "user.read:all",
|
1451
|
+
USER_READ_MY_OFFICE: "user.read:my-office",
|
1452
|
+
USER_READ_MY_JURISDICTION: "user.read:my-jurisdiction",
|
1453
|
+
USER_READ_ONLY_MY_AUDIT: "user.read:only-my-audit",
|
1454
|
+
//v1.8
|
1455
|
+
USER_CREATE: "user.create:all",
|
1456
|
+
USER_CREATE_MY_JURISDICTION: "user.create:my-jurisdiction",
|
1457
|
+
USER_UPDATE: "user.update:all",
|
1458
|
+
USER_UPDATE_MY_JURISDICTION: "user.update:my-jurisdiction",
|
1459
|
+
// config
|
1460
|
+
CONFIG_UPDATE_ALL: "config.update:all",
|
1461
|
+
// data seeding
|
1462
|
+
USER_DATA_SEEDING: "user.data-seeding"
|
1463
|
+
};
|
1464
|
+
var LegacyScopes = import_zod16.z.union([
|
1465
|
+
import_zod16.z.literal(SCOPES.NATLSYSADMIN),
|
1466
|
+
import_zod16.z.literal(SCOPES.BYPASSRATELIMIT),
|
1467
|
+
import_zod16.z.literal(SCOPES.DECLARE),
|
1468
|
+
import_zod16.z.literal(SCOPES.REGISTER),
|
1469
|
+
import_zod16.z.literal(SCOPES.VALIDATE),
|
1470
|
+
import_zod16.z.literal(SCOPES.DEMO),
|
1471
|
+
import_zod16.z.literal(SCOPES.CERTIFY),
|
1472
|
+
import_zod16.z.literal(SCOPES.PERFORMANCE),
|
1473
|
+
import_zod16.z.literal(SCOPES.SYSADMIN),
|
1474
|
+
import_zod16.z.literal(SCOPES.TEAMS),
|
1475
|
+
import_zod16.z.literal(SCOPES.CONFIG)
|
1476
|
+
]);
|
1477
|
+
var IntegrationScopes = import_zod16.z.union([
|
1478
|
+
import_zod16.z.literal(SCOPES.WEBHOOK),
|
1479
|
+
import_zod16.z.literal(SCOPES.NATIONALID),
|
1480
|
+
import_zod16.z.literal(SCOPES.NOTIFICATION_API),
|
1481
|
+
import_zod16.z.literal(SCOPES.RECORDSEARCH)
|
1482
|
+
]);
|
1483
|
+
var DeclareScopes = import_zod16.z.union([
|
1484
|
+
import_zod16.z.literal(SCOPES.RECORD_DECLARE),
|
1485
|
+
import_zod16.z.literal(SCOPES.RECORD_IMPORT),
|
1486
|
+
import_zod16.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
|
1487
|
+
import_zod16.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
|
1488
|
+
import_zod16.z.literal(SCOPES.RECORD_DECLARE_DEATH),
|
1489
|
+
import_zod16.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
|
1490
|
+
import_zod16.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
|
1491
|
+
import_zod16.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
|
1492
|
+
import_zod16.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
|
1493
|
+
import_zod16.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW)
|
1494
|
+
]);
|
1495
|
+
var UnassignScope = import_zod16.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS);
|
1496
|
+
var ValidateScopes = import_zod16.z.union([
|
1497
|
+
import_zod16.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
|
1498
|
+
import_zod16.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
|
1499
|
+
import_zod16.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
|
1500
|
+
import_zod16.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
|
1501
|
+
import_zod16.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
|
1502
|
+
import_zod16.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE)
|
1503
|
+
]);
|
1504
|
+
var RegisterScope = import_zod16.z.literal(SCOPES.RECORD_REGISTER);
|
1505
|
+
var CertifyScopes = import_zod16.z.union([
|
1506
|
+
import_zod16.z.literal(SCOPES.RECORD_EXPORT_RECORDS),
|
1507
|
+
import_zod16.z.literal(SCOPES.RECORD_DECLARATION_PRINT),
|
1508
|
+
import_zod16.z.literal(SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS),
|
1509
|
+
import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_PRINT),
|
1510
|
+
import_zod16.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
|
1511
|
+
import_zod16.z.literal(SCOPES.RECORD_PRINT_CERTIFIED_COPIES),
|
1512
|
+
import_zod16.z.literal(SCOPES.RECORD_BULK_PRINT_CERTIFIED_COPIES),
|
1513
|
+
import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES)
|
1514
|
+
]);
|
1515
|
+
var CorrectionScopes = import_zod16.z.union([
|
1516
|
+
import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
|
1517
|
+
import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
|
1518
|
+
import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REVOCATION),
|
1519
|
+
import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REVOKE),
|
1520
|
+
import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REINSTATEMENT),
|
1521
|
+
import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REINSTATE),
|
1522
|
+
import_zod16.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
|
1523
|
+
import_zod16.z.literal(SCOPES.RECORD_REJECT_REGISTRATION)
|
1524
|
+
]);
|
1525
|
+
var SearchScopes = import_zod16.z.union([
|
1526
|
+
import_zod16.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
|
1527
|
+
import_zod16.z.literal(SCOPES.SEARCH_BIRTH),
|
1528
|
+
import_zod16.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
|
1529
|
+
import_zod16.z.literal(SCOPES.SEARCH_DEATH),
|
1530
|
+
import_zod16.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
|
1531
|
+
import_zod16.z.literal(SCOPES.SEARCH_MARRIAGE)
|
1532
|
+
]);
|
1533
|
+
var AuditScopes = import_zod16.z.union([
|
1534
|
+
import_zod16.z.literal(SCOPES.RECORD_READ),
|
1535
|
+
import_zod16.z.literal(SCOPES.RECORD_READ_AUDIT),
|
1536
|
+
import_zod16.z.literal(SCOPES.RECORD_READ_COMMENTS),
|
1537
|
+
import_zod16.z.literal(SCOPES.RECORD_CREATE_COMMENTS)
|
1538
|
+
]);
|
1539
|
+
var ProfileScopes = import_zod16.z.union([
|
1540
|
+
import_zod16.z.literal(SCOPES.PROFILE_UPDATE),
|
1541
|
+
import_zod16.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE)
|
1542
|
+
]);
|
1543
|
+
var PerformanceScopes = import_zod16.z.union([
|
1544
|
+
import_zod16.z.literal(SCOPES.PERFORMANCE_READ),
|
1545
|
+
import_zod16.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
|
1546
|
+
import_zod16.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS)
|
1547
|
+
]);
|
1548
|
+
var OrganisationScopes = import_zod16.z.union([
|
1549
|
+
import_zod16.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
|
1550
|
+
import_zod16.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
|
1551
|
+
import_zod16.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION)
|
1552
|
+
]);
|
1553
|
+
var UserScopes = import_zod16.z.union([
|
1554
|
+
import_zod16.z.literal(SCOPES.USER_READ),
|
1555
|
+
import_zod16.z.literal(SCOPES.USER_READ_MY_OFFICE),
|
1556
|
+
import_zod16.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
|
1557
|
+
import_zod16.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
|
1558
|
+
import_zod16.z.literal(SCOPES.USER_CREATE),
|
1559
|
+
import_zod16.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
|
1560
|
+
import_zod16.z.literal(SCOPES.USER_UPDATE),
|
1561
|
+
import_zod16.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION)
|
1562
|
+
]);
|
1563
|
+
var ConfigScope = import_zod16.z.literal(SCOPES.CONFIG_UPDATE_ALL);
|
1564
|
+
var DataSeedingScope = import_zod16.z.literal(SCOPES.USER_DATA_SEEDING);
|
1565
|
+
var LiteralScopes = import_zod16.z.union([
|
1566
|
+
LegacyScopes,
|
1567
|
+
IntegrationScopes,
|
1568
|
+
UnassignScope,
|
1569
|
+
DeclareScopes,
|
1570
|
+
ValidateScopes,
|
1571
|
+
RegisterScope,
|
1572
|
+
CertifyScopes,
|
1573
|
+
CorrectionScopes,
|
1574
|
+
SearchScopes,
|
1575
|
+
AuditScopes,
|
1576
|
+
ProfileScopes,
|
1577
|
+
PerformanceScopes,
|
1578
|
+
OrganisationScopes,
|
1579
|
+
UserScopes,
|
1580
|
+
ConfigScope,
|
1581
|
+
DataSeedingScope
|
1582
|
+
]);
|
1583
|
+
var rawConfigurableScopeRegex = /^([a-zA-Z\.]+)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
|
1584
|
+
var rawConfigurableScope = import_zod16.z.string().regex(rawConfigurableScopeRegex);
|
1585
|
+
var CreateUserScope = import_zod16.z.object({
|
1586
|
+
type: import_zod16.z.literal("user.create"),
|
1587
|
+
options: import_zod16.z.object({
|
1588
|
+
role: import_zod16.z.array(import_zod16.z.string())
|
1589
|
+
})
|
1590
|
+
});
|
1591
|
+
var EditUserScope = import_zod16.z.object({
|
1592
|
+
type: import_zod16.z.literal("user.edit"),
|
1593
|
+
options: import_zod16.z.object({
|
1594
|
+
role: import_zod16.z.array(import_zod16.z.string())
|
1595
|
+
})
|
1596
|
+
});
|
1597
|
+
var WorkqueueScope = import_zod16.z.object({
|
1598
|
+
type: import_zod16.z.literal("workqueue"),
|
1599
|
+
options: import_zod16.z.object({
|
1600
|
+
id: import_zod16.z.array(import_zod16.z.string())
|
1601
|
+
})
|
1602
|
+
});
|
1603
|
+
var NotifyRecordScope = import_zod16.z.object({
|
1604
|
+
type: import_zod16.z.literal("record.notify"),
|
1605
|
+
options: import_zod16.z.object({
|
1606
|
+
event: import_zod16.z.array(import_zod16.z.string())
|
1607
|
+
})
|
1608
|
+
});
|
1609
|
+
var ConfigurableScopes = import_zod16.z.discriminatedUnion("type", [
|
1610
|
+
CreateUserScope,
|
1611
|
+
EditUserScope,
|
1612
|
+
WorkqueueScope,
|
1613
|
+
NotifyRecordScope
|
1614
|
+
]);
|
1615
|
+
var scopes = Object.values(SCOPES);
|
1616
|
+
var ActionScopes = import_zod16.z.union([
|
1617
|
+
DeclareScopes,
|
1618
|
+
ValidateScopes,
|
1619
|
+
RegisterScope,
|
1620
|
+
CertifyScopes,
|
1621
|
+
CorrectionScopes
|
1622
|
+
]);
|
1623
|
+
|
1624
|
+
// ../commons/src/authentication.ts
|
1625
|
+
var DEFAULT_ROLES_DEFINITION = [
|
1626
|
+
{
|
1627
|
+
id: "FIELD_AGENT",
|
1628
|
+
label: {
|
1629
|
+
defaultMessage: "Field Agent",
|
1630
|
+
description: "Name for user role Field Agent",
|
1631
|
+
id: "userRole.fieldAgent"
|
1632
|
+
},
|
1633
|
+
scopes: [
|
1634
|
+
// new scopes
|
1635
|
+
SCOPES.RECORD_DECLARE_BIRTH,
|
1636
|
+
SCOPES.RECORD_DECLARE_DEATH,
|
1637
|
+
SCOPES.RECORD_DECLARE_MARRIAGE,
|
1638
|
+
SCOPES.RECORD_SUBMIT_INCOMPLETE,
|
1639
|
+
SCOPES.RECORD_SUBMIT_FOR_REVIEW,
|
1640
|
+
SCOPES.SEARCH_BIRTH,
|
1641
|
+
SCOPES.SEARCH_DEATH,
|
1642
|
+
SCOPES.SEARCH_MARRIAGE
|
1643
|
+
]
|
1644
|
+
},
|
1645
|
+
{
|
1646
|
+
id: "REGISTRATION_AGENT",
|
1647
|
+
label: {
|
1648
|
+
defaultMessage: "Registration Agent",
|
1649
|
+
description: "Name for user role Registration Agent",
|
1650
|
+
id: "userRole.registrationAgent"
|
1651
|
+
},
|
1652
|
+
scopes: [
|
1653
|
+
SCOPES.PERFORMANCE,
|
1654
|
+
SCOPES.CERTIFY,
|
1655
|
+
SCOPES.RECORD_DECLARE_BIRTH,
|
1656
|
+
SCOPES.RECORD_DECLARE_DEATH,
|
1657
|
+
SCOPES.RECORD_DECLARE_MARRIAGE,
|
1658
|
+
SCOPES.RECORD_SUBMIT_FOR_APPROVAL,
|
1659
|
+
SCOPES.RECORD_SUBMIT_FOR_UPDATES,
|
1660
|
+
SCOPES.RECORD_DECLARATION_ARCHIVE,
|
1661
|
+
SCOPES.RECORD_DECLARATION_REINSTATE,
|
1662
|
+
SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION,
|
1663
|
+
SCOPES.RECORD_REGISTRATION_PRINT,
|
1664
|
+
SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS,
|
1665
|
+
SCOPES.RECORD_EXPORT_RECORDS,
|
1666
|
+
SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES,
|
1667
|
+
SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES,
|
1668
|
+
SCOPES.RECORD_CREATE_COMMENTS,
|
1669
|
+
SCOPES.PERFORMANCE_READ,
|
1670
|
+
SCOPES.PERFORMANCE_READ_DASHBOARDS,
|
1671
|
+
SCOPES.ORGANISATION_READ_LOCATIONS,
|
1672
|
+
SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE,
|
1673
|
+
SCOPES.SEARCH_BIRTH,
|
1674
|
+
SCOPES.SEARCH_DEATH,
|
1675
|
+
SCOPES.SEARCH_MARRIAGE
|
1676
|
+
]
|
1677
|
+
},
|
1678
|
+
{
|
1679
|
+
id: "LOCAL_REGISTRAR",
|
1680
|
+
label: {
|
1681
|
+
defaultMessage: "Local Registrar",
|
1682
|
+
description: "Name for user role Local Registrar",
|
1683
|
+
id: "userRole.localRegistrar"
|
1684
|
+
},
|
1685
|
+
scopes: [
|
1686
|
+
SCOPES.PERFORMANCE,
|
1687
|
+
SCOPES.CERTIFY,
|
1688
|
+
SCOPES.RECORD_DECLARE_BIRTH,
|
1689
|
+
SCOPES.RECORD_DECLARE_DEATH,
|
1690
|
+
SCOPES.RECORD_DECLARE_MARRIAGE,
|
1691
|
+
SCOPES.RECORD_SUBMIT_FOR_UPDATES,
|
1692
|
+
SCOPES.RECORD_REVIEW_DUPLICATES,
|
1693
|
+
SCOPES.RECORD_DECLARATION_ARCHIVE,
|
1694
|
+
SCOPES.RECORD_DECLARATION_REINSTATE,
|
1695
|
+
SCOPES.RECORD_REGISTER,
|
1696
|
+
SCOPES.RECORD_REGISTRATION_CORRECT,
|
1697
|
+
SCOPES.RECORD_REGISTRATION_PRINT,
|
1698
|
+
SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS,
|
1699
|
+
SCOPES.RECORD_EXPORT_RECORDS,
|
1700
|
+
SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES,
|
1701
|
+
SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES,
|
1702
|
+
SCOPES.RECORD_CREATE_COMMENTS,
|
1703
|
+
SCOPES.PERFORMANCE_READ,
|
1704
|
+
SCOPES.PERFORMANCE_READ_DASHBOARDS,
|
1705
|
+
SCOPES.ORGANISATION_READ_LOCATIONS,
|
1706
|
+
SCOPES.PROFILE_ELECTRONIC_SIGNATURE,
|
1707
|
+
SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE,
|
1708
|
+
SCOPES.SEARCH_BIRTH,
|
1709
|
+
SCOPES.SEARCH_DEATH,
|
1710
|
+
SCOPES.SEARCH_MARRIAGE
|
1711
|
+
]
|
1712
|
+
},
|
1713
|
+
{
|
1714
|
+
id: "LOCAL_SYSTEM_ADMIN",
|
1715
|
+
label: {
|
1716
|
+
defaultMessage: "Local System Admin",
|
1717
|
+
description: "Name for user role Local System Admin",
|
1718
|
+
id: "userRole.localSystemAdmin"
|
1719
|
+
},
|
1720
|
+
scopes: [
|
1721
|
+
SCOPES.SYSADMIN,
|
1722
|
+
SCOPES.USER_READ_MY_OFFICE,
|
1723
|
+
SCOPES.USER_CREATE_MY_JURISDICTION,
|
1724
|
+
SCOPES.USER_UPDATE_MY_JURISDICTION,
|
1725
|
+
SCOPES.ORGANISATION_READ_LOCATIONS,
|
1726
|
+
SCOPES.PERFORMANCE_READ,
|
1727
|
+
SCOPES.PERFORMANCE_READ_DASHBOARDS,
|
1728
|
+
SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS
|
1729
|
+
// 'organisation.read-users' ?
|
1730
|
+
]
|
1731
|
+
},
|
1732
|
+
{
|
1733
|
+
id: "NATIONAL_SYSTEM_ADMIN",
|
1734
|
+
label: {
|
1735
|
+
defaultMessage: "National System Admin",
|
1736
|
+
description: "Name for user role National System Admin",
|
1737
|
+
id: "userRole.nationalSystemAdmin"
|
1738
|
+
},
|
1739
|
+
scopes: [
|
1740
|
+
SCOPES.SYSADMIN,
|
1741
|
+
SCOPES.NATLSYSADMIN,
|
1742
|
+
SCOPES.USER_CREATE,
|
1743
|
+
SCOPES.USER_READ,
|
1744
|
+
SCOPES.USER_UPDATE,
|
1745
|
+
SCOPES.ORGANISATION_READ_LOCATIONS,
|
1746
|
+
SCOPES.PERFORMANCE_READ,
|
1747
|
+
SCOPES.PERFORMANCE_READ_DASHBOARDS,
|
1748
|
+
SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS
|
1749
|
+
// 'organisation.read-users' ?
|
1750
|
+
]
|
1751
|
+
},
|
1752
|
+
{
|
1753
|
+
id: "PERFORMANCE_MANAGER",
|
1754
|
+
label: {
|
1755
|
+
defaultMessage: "Performance Manager",
|
1756
|
+
description: "Name for user role Performance Manager",
|
1757
|
+
id: "userRole.performanceManager"
|
1758
|
+
},
|
1759
|
+
scopes: [
|
1760
|
+
SCOPES.PERFORMANCE,
|
1761
|
+
SCOPES.PERFORMANCE_READ,
|
1762
|
+
SCOPES.PERFORMANCE_READ_DASHBOARDS,
|
1763
|
+
SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS
|
1764
|
+
]
|
1765
|
+
}
|
1766
|
+
];
|
1767
|
+
var TokenUserType = import_zod17.z.enum(["user", "system"]);
|
1768
|
+
var TokenWithBearer = import_zod17.z.string().regex(/^Bearer\s/);
|
1769
|
+
|
1308
1770
|
// ../commons/src/events/ActionDocument.ts
|
1309
|
-
(0, import_zod_openapi7.extendZodWithOpenApi)(
|
1310
|
-
var ActionUpdate =
|
1311
|
-
var EventState =
|
1771
|
+
(0, import_zod_openapi7.extendZodWithOpenApi)(import_zod18.z);
|
1772
|
+
var ActionUpdate = import_zod18.z.record(import_zod18.z.string(), FieldUpdateValue);
|
1773
|
+
var EventState = import_zod18.z.record(import_zod18.z.string(), FieldValue);
|
1312
1774
|
var ActionStatus = {
|
1313
1775
|
Requested: "Requested",
|
1314
1776
|
Accepted: "Accepted",
|
1315
1777
|
Rejected: "Rejected"
|
1316
1778
|
};
|
1317
|
-
var ActionBase =
|
1318
|
-
id:
|
1319
|
-
transactionId:
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1779
|
+
var ActionBase = import_zod18.z.object({
|
1780
|
+
id: import_zod18.z.string(),
|
1781
|
+
transactionId: import_zod18.z.string(),
|
1782
|
+
createdByUserType: TokenUserType,
|
1783
|
+
createdAt: import_zod18.z.string().datetime(),
|
1784
|
+
createdBy: import_zod18.z.string(),
|
1785
|
+
createdByRole: import_zod18.z.string(),
|
1786
|
+
createdBySignature: import_zod18.z.string().nullish().describe("Reference to signature of the user who created the action"),
|
1324
1787
|
createdAtLocation: CreatedAtLocation,
|
1325
1788
|
declaration: ActionUpdate,
|
1326
1789
|
annotation: ActionUpdate.optional(),
|
1327
|
-
status:
|
1790
|
+
status: import_zod18.z.enum([
|
1328
1791
|
ActionStatus.Requested,
|
1329
1792
|
ActionStatus.Accepted,
|
1330
1793
|
ActionStatus.Rejected
|
1331
1794
|
]),
|
1332
1795
|
// If the action is an asynchronous confirmation for another action, we will save the original action id here.
|
1333
|
-
originalActionId:
|
1796
|
+
originalActionId: import_zod18.z.string().optional()
|
1334
1797
|
});
|
1335
1798
|
var AssignedAction = ActionBase.merge(
|
1336
|
-
|
1337
|
-
type:
|
1338
|
-
assignedTo:
|
1799
|
+
import_zod18.z.object({
|
1800
|
+
type: import_zod18.z.literal(ActionType.ASSIGN),
|
1801
|
+
assignedTo: import_zod18.z.string()
|
1339
1802
|
})
|
1340
1803
|
);
|
1341
1804
|
var UnassignedAction = ActionBase.merge(
|
1342
|
-
|
1343
|
-
type:
|
1344
|
-
assignedTo:
|
1805
|
+
import_zod18.z.object({
|
1806
|
+
type: import_zod18.z.literal(ActionType.UNASSIGN),
|
1807
|
+
assignedTo: import_zod18.z.literal(null)
|
1345
1808
|
})
|
1346
1809
|
);
|
1347
1810
|
var RegisterAction = ActionBase.merge(
|
1348
|
-
|
1349
|
-
type:
|
1350
|
-
registrationNumber:
|
1811
|
+
import_zod18.z.object({
|
1812
|
+
type: import_zod18.z.literal(ActionType.REGISTER),
|
1813
|
+
registrationNumber: import_zod18.z.string().optional()
|
1351
1814
|
})
|
1352
1815
|
);
|
1353
1816
|
var DeclareAction = ActionBase.merge(
|
1354
|
-
|
1355
|
-
type:
|
1817
|
+
import_zod18.z.object({
|
1818
|
+
type: import_zod18.z.literal(ActionType.DECLARE)
|
1356
1819
|
})
|
1357
1820
|
);
|
1358
1821
|
var ValidateAction = ActionBase.merge(
|
1359
|
-
|
1360
|
-
type:
|
1822
|
+
import_zod18.z.object({
|
1823
|
+
type: import_zod18.z.literal(ActionType.VALIDATE)
|
1361
1824
|
})
|
1362
1825
|
);
|
1363
|
-
var RejectionReason =
|
1364
|
-
message:
|
1365
|
-
isDuplicate:
|
1826
|
+
var RejectionReason = import_zod18.z.object({
|
1827
|
+
message: import_zod18.z.string().min(1, { message: "Message cannot be empty" }).describe("Message describing reason for rejection or archiving"),
|
1828
|
+
isDuplicate: import_zod18.z.boolean().optional().describe("If a declaration is duplicated")
|
1366
1829
|
});
|
1367
1830
|
var RejectAction = ActionBase.merge(
|
1368
|
-
|
1369
|
-
type:
|
1831
|
+
import_zod18.z.object({
|
1832
|
+
type: import_zod18.z.literal(ActionType.REJECT),
|
1370
1833
|
reason: RejectionReason
|
1371
1834
|
})
|
1372
1835
|
);
|
1373
1836
|
var MarkAsDuplicateAction = ActionBase.merge(
|
1374
|
-
|
1375
|
-
type:
|
1837
|
+
import_zod18.z.object({
|
1838
|
+
type: import_zod18.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1376
1839
|
})
|
1377
1840
|
);
|
1378
1841
|
var ArchiveAction = ActionBase.merge(
|
1379
|
-
|
1380
|
-
type:
|
1842
|
+
import_zod18.z.object({
|
1843
|
+
type: import_zod18.z.literal(ActionType.ARCHIVE),
|
1381
1844
|
reason: RejectionReason
|
1382
1845
|
})
|
1383
1846
|
);
|
1384
1847
|
var CreatedAction = ActionBase.merge(
|
1385
|
-
|
1386
|
-
type:
|
1848
|
+
import_zod18.z.object({
|
1849
|
+
type: import_zod18.z.literal(ActionType.CREATE)
|
1387
1850
|
})
|
1388
1851
|
);
|
1389
1852
|
var NotifiedAction = ActionBase.merge(
|
1390
|
-
|
1391
|
-
type:
|
1853
|
+
import_zod18.z.object({
|
1854
|
+
type: import_zod18.z.literal(ActionType.NOTIFY)
|
1392
1855
|
})
|
1393
1856
|
);
|
1394
1857
|
var PrintCertificateAction = ActionBase.merge(
|
1395
|
-
|
1396
|
-
type:
|
1858
|
+
import_zod18.z.object({
|
1859
|
+
type: import_zod18.z.literal(ActionType.PRINT_CERTIFICATE)
|
1397
1860
|
})
|
1398
1861
|
);
|
1399
1862
|
var RequestedCorrectionAction = ActionBase.merge(
|
1400
|
-
|
1401
|
-
type:
|
1863
|
+
import_zod18.z.object({
|
1864
|
+
type: import_zod18.z.literal(ActionType.REQUEST_CORRECTION)
|
1402
1865
|
})
|
1403
1866
|
);
|
1404
1867
|
var ApprovedCorrectionAction = ActionBase.merge(
|
1405
|
-
|
1406
|
-
type:
|
1407
|
-
requestId:
|
1868
|
+
import_zod18.z.object({
|
1869
|
+
type: import_zod18.z.literal(ActionType.APPROVE_CORRECTION),
|
1870
|
+
requestId: import_zod18.z.string()
|
1408
1871
|
})
|
1409
1872
|
);
|
1410
1873
|
var RejectedCorrectionAction = ActionBase.merge(
|
1411
|
-
|
1412
|
-
type:
|
1413
|
-
requestId:
|
1874
|
+
import_zod18.z.object({
|
1875
|
+
type: import_zod18.z.literal(ActionType.REJECT_CORRECTION),
|
1876
|
+
requestId: import_zod18.z.string()
|
1414
1877
|
})
|
1415
1878
|
);
|
1416
1879
|
var ReadAction = ActionBase.merge(
|
1417
|
-
|
1418
|
-
type:
|
1880
|
+
import_zod18.z.object({
|
1881
|
+
type: import_zod18.z.literal(ActionType.READ)
|
1419
1882
|
})
|
1420
1883
|
);
|
1421
|
-
var ActionDocument =
|
1884
|
+
var ActionDocument = import_zod18.z.discriminatedUnion("type", [
|
1422
1885
|
CreatedAction.openapi({ ref: "CreatedAction" }),
|
1423
1886
|
ValidateAction.openapi({ ref: "ValidateAction" }),
|
1424
1887
|
RejectAction.openapi({ ref: "RejectAction" }),
|
@@ -1441,20 +1904,20 @@ var AsyncRejectActionDocument = ActionBase.omit({
|
|
1441
1904
|
declaration: true,
|
1442
1905
|
annotation: true
|
1443
1906
|
}).merge(
|
1444
|
-
|
1445
|
-
type:
|
1446
|
-
status:
|
1907
|
+
import_zod18.z.object({
|
1908
|
+
type: import_zod18.z.enum(ConfirmableActions),
|
1909
|
+
status: import_zod18.z.literal(ActionStatus.Rejected)
|
1447
1910
|
})
|
1448
1911
|
);
|
1449
|
-
var Action =
|
1450
|
-
var ResolvedUser =
|
1451
|
-
id:
|
1452
|
-
role:
|
1453
|
-
name:
|
1454
|
-
|
1455
|
-
use:
|
1456
|
-
given:
|
1457
|
-
family:
|
1912
|
+
var Action = import_zod18.z.union([ActionDocument, AsyncRejectActionDocument]);
|
1913
|
+
var ResolvedUser = import_zod18.z.object({
|
1914
|
+
id: import_zod18.z.string(),
|
1915
|
+
role: import_zod18.z.string(),
|
1916
|
+
name: import_zod18.z.array(
|
1917
|
+
import_zod18.z.object({
|
1918
|
+
use: import_zod18.z.string(),
|
1919
|
+
given: import_zod18.z.array(import_zod18.z.string()),
|
1920
|
+
family: import_zod18.z.string()
|
1458
1921
|
})
|
1459
1922
|
)
|
1460
1923
|
});
|
@@ -1465,7 +1928,7 @@ var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
1465
1928
|
var import_date_fns = require("date-fns");
|
1466
1929
|
|
1467
1930
|
// ../commons/src/events/FieldTypeMapping.ts
|
1468
|
-
var
|
1931
|
+
var import_zod19 = require("zod");
|
1469
1932
|
function mapFieldTypeToZod(type, required) {
|
1470
1933
|
let schema;
|
1471
1934
|
switch (type) {
|
@@ -1525,7 +1988,7 @@ function createValidationSchema(config) {
|
|
1525
1988
|
for (const field2 of config) {
|
1526
1989
|
shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
|
1527
1990
|
}
|
1528
|
-
return
|
1991
|
+
return import_zod19.z.object(shape);
|
1529
1992
|
}
|
1530
1993
|
function mapFieldTypeToEmptyValue(field2) {
|
1531
1994
|
switch (field2.type) {
|
@@ -1738,6 +2201,11 @@ var errorMessages = {
|
|
1738
2201
|
defaultMessage: "Invalid input",
|
1739
2202
|
description: "Error message when generic field is invalid",
|
1740
2203
|
id: "v2.error.invalid"
|
2204
|
+
},
|
2205
|
+
unexpectedField: {
|
2206
|
+
defaultMessage: "Unexpected field",
|
2207
|
+
description: "Error message when field is not expected",
|
2208
|
+
id: "v2.error.unexpectedField"
|
1741
2209
|
}
|
1742
2210
|
};
|
1743
2211
|
function createIntlError(message) {
|
@@ -1985,6 +2453,7 @@ function createEmptyDraft(eventId, draftId, actionType) {
|
|
1985
2453
|
declaration: {},
|
1986
2454
|
annotation: {},
|
1987
2455
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
2456
|
+
createdByUserType: TokenUserType.Enum.user,
|
1988
2457
|
createdBy: "@todo",
|
1989
2458
|
createdAtLocation: "@todo",
|
1990
2459
|
status: ActionStatus.Accepted,
|
@@ -2089,9 +2558,9 @@ function getEventConfigById(eventConfigs, id) {
|
|
2089
2558
|
|
2090
2559
|
// ../commons/src/events/EventConfig.ts
|
2091
2560
|
var import_zod_openapi8 = require("zod-openapi");
|
2092
|
-
(0, import_zod_openapi8.extendZodWithOpenApi)(
|
2093
|
-
var EventConfig =
|
2094
|
-
id:
|
2561
|
+
(0, import_zod_openapi8.extendZodWithOpenApi)(import_zod20.z);
|
2562
|
+
var EventConfig = import_zod20.z.object({
|
2563
|
+
id: import_zod20.z.string().describe(
|
2095
2564
|
'A machine-readable identifier for the event, e.g. "birth" or "death"'
|
2096
2565
|
),
|
2097
2566
|
dateOfEvent: FieldReference.optional(),
|
@@ -2101,10 +2570,10 @@ var EventConfig = import_zod18.z.object({
|
|
2101
2570
|
),
|
2102
2571
|
summary: SummaryConfig,
|
2103
2572
|
label: TranslationConfig,
|
2104
|
-
actions:
|
2573
|
+
actions: import_zod20.z.array(ActionConfig),
|
2105
2574
|
declaration: DeclarationFormConfig,
|
2106
|
-
deduplication:
|
2107
|
-
advancedSearch:
|
2575
|
+
deduplication: import_zod20.z.array(DeduplicationConfig).optional().default([]),
|
2576
|
+
advancedSearch: import_zod20.z.array(AdvancedSearchConfig).optional().default([])
|
2108
2577
|
}).superRefine((event2, ctx) => {
|
2109
2578
|
const allFields = findAllFields(event2);
|
2110
2579
|
const fieldIds = allFields.map((field2) => field2.id);
|
@@ -2166,12 +2635,12 @@ var definePage = (page) => PageConfig.parse(page);
|
|
2166
2635
|
var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
|
2167
2636
|
|
2168
2637
|
// ../commons/src/events/WorkqueueConfig.ts
|
2169
|
-
var
|
2638
|
+
var import_zod27 = require("zod");
|
2170
2639
|
|
2171
2640
|
// ../commons/src/events/serializers/user/serializer.ts
|
2172
|
-
var
|
2173
|
-
var SerializedUserField =
|
2174
|
-
$userField:
|
2641
|
+
var import_zod21 = require("zod");
|
2642
|
+
var SerializedUserField = import_zod21.z.object({
|
2643
|
+
$userField: import_zod21.z.enum([
|
2175
2644
|
"id",
|
2176
2645
|
"name",
|
2177
2646
|
"role",
|
@@ -2574,11 +3043,11 @@ var event = Object.assign(eventFn, {
|
|
2574
3043
|
});
|
2575
3044
|
|
2576
3045
|
// ../commons/src/events/WorkqueueColumnConfig.ts
|
2577
|
-
var
|
3046
|
+
var import_zod23 = require("zod");
|
2578
3047
|
|
2579
3048
|
// ../commons/src/events/EventMetadata.ts
|
2580
|
-
var
|
2581
|
-
var EventStatus =
|
3049
|
+
var import_zod22 = require("zod");
|
3050
|
+
var EventStatus = import_zod22.z.enum([
|
2582
3051
|
"CREATED",
|
2583
3052
|
"NOTIFIED",
|
2584
3053
|
"DECLARED",
|
@@ -2591,57 +3060,61 @@ var EventStatus = import_zod20.z.enum([
|
|
2591
3060
|
var CustomFlags = {
|
2592
3061
|
CERTIFICATE_PRINTED: "certificate-printed"
|
2593
3062
|
};
|
2594
|
-
var Flag =
|
3063
|
+
var Flag = import_zod22.z.string().regex(
|
2595
3064
|
new RegExp(
|
2596
3065
|
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
2597
3066
|
ActionStatus
|
2598
3067
|
).join("|").toLowerCase()})$`
|
2599
3068
|
),
|
2600
3069
|
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
2601
|
-
).or(
|
2602
|
-
var ZodDate =
|
2603
|
-
var ActionCreationMetadata =
|
2604
|
-
createdAt:
|
2605
|
-
createdBy:
|
3070
|
+
).or(import_zod22.z.nativeEnum(CustomFlags));
|
3071
|
+
var ZodDate = import_zod22.z.string().date();
|
3072
|
+
var ActionCreationMetadata = import_zod22.z.object({
|
3073
|
+
createdAt: import_zod22.z.string().datetime().describe("The timestamp when the action request was created."),
|
3074
|
+
createdBy: import_zod22.z.string().describe("ID of the user who created the action request."),
|
2606
3075
|
createdAtLocation: CreatedAtLocation.describe(
|
2607
3076
|
"Location of the user who created the action request."
|
2608
3077
|
),
|
2609
|
-
|
2610
|
-
|
2611
|
-
|
3078
|
+
createdByUserType: import_zod22.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
3079
|
+
acceptedAt: import_zod22.z.string().datetime().describe("Timestamp when the action request was accepted."),
|
3080
|
+
createdByRole: import_zod22.z.string().describe("Role of the user at the time of action request creation."),
|
3081
|
+
createdBySignature: import_zod22.z.string().nullish().describe("Signature of the user who created the action request.")
|
2612
3082
|
});
|
2613
3083
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
2614
|
-
registrationNumber:
|
3084
|
+
registrationNumber: import_zod22.z.string().describe(
|
2615
3085
|
"Registration number of the event. Always present for accepted registrations."
|
2616
3086
|
)
|
2617
3087
|
});
|
2618
|
-
var LegalStatuses =
|
3088
|
+
var LegalStatuses = import_zod22.z.object({
|
2619
3089
|
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
2620
3090
|
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
2621
3091
|
});
|
2622
|
-
var EventMetadata =
|
2623
|
-
id:
|
2624
|
-
type:
|
3092
|
+
var EventMetadata = import_zod22.z.object({
|
3093
|
+
id: import_zod22.z.string(),
|
3094
|
+
type: import_zod22.z.string().describe("The type of event, such as birth, death, or marriage."),
|
2625
3095
|
status: EventStatus,
|
2626
3096
|
legalStatuses: LegalStatuses.describe(
|
2627
3097
|
"Metadata related to the legal registration of the event, such as who registered it and when."
|
2628
3098
|
),
|
2629
|
-
createdAt:
|
3099
|
+
createdAt: import_zod22.z.string().datetime().describe("The timestamp when the event was first created and saved."),
|
2630
3100
|
dateOfEvent: ZodDate.nullish(),
|
2631
|
-
createdBy:
|
2632
|
-
|
3101
|
+
createdBy: import_zod22.z.string().describe("ID of the user who created the event."),
|
3102
|
+
createdByUserType: import_zod22.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
3103
|
+
updatedByUserRole: import_zod22.z.string().describe("Role of the user who last changed the status."),
|
2633
3104
|
createdAtLocation: CreatedAtLocation.describe(
|
2634
3105
|
"Location of the user who created the event."
|
2635
3106
|
),
|
2636
|
-
createdBySignature:
|
2637
|
-
updatedAtLocation:
|
2638
|
-
updatedAt:
|
2639
|
-
|
2640
|
-
|
2641
|
-
|
3107
|
+
createdBySignature: import_zod22.z.string().nullish().describe("Signature of the user who created the event."),
|
3108
|
+
updatedAtLocation: import_zod22.z.string().nullish().describe("Location of the user who last changed the status."),
|
3109
|
+
updatedAt: import_zod22.z.string().datetime().describe(
|
3110
|
+
"Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
|
3111
|
+
),
|
3112
|
+
assignedTo: import_zod22.z.string().nullish().describe("ID of the user currently assigned to the event."),
|
3113
|
+
updatedBy: import_zod22.z.string().nullish().describe("ID of the user who last changed the status."),
|
3114
|
+
trackingId: import_zod22.z.string().describe(
|
2642
3115
|
"System-generated tracking ID used by informants or registrars to look up the event."
|
2643
3116
|
),
|
2644
|
-
flags:
|
3117
|
+
flags: import_zod22.z.array(Flag)
|
2645
3118
|
});
|
2646
3119
|
var EventMetadataKeysArray = [
|
2647
3120
|
"id",
|
@@ -2650,6 +3123,7 @@ var EventMetadataKeysArray = [
|
|
2650
3123
|
"createdAt",
|
2651
3124
|
"dateOfEvent",
|
2652
3125
|
"createdBy",
|
3126
|
+
"createdByUserType",
|
2653
3127
|
"updatedByUserRole",
|
2654
3128
|
"createdAtLocation",
|
2655
3129
|
"updatedAtLocation",
|
@@ -2660,7 +3134,7 @@ var EventMetadataKeysArray = [
|
|
2660
3134
|
"legalStatuses",
|
2661
3135
|
"flags"
|
2662
3136
|
];
|
2663
|
-
var EventMetadataKeys =
|
3137
|
+
var EventMetadataKeys = import_zod22.z.enum(EventMetadataKeysArray);
|
2664
3138
|
var eventMetadataLabelMap = {
|
2665
3139
|
"event.assignedTo": {
|
2666
3140
|
id: "event.assignedTo.label",
|
@@ -2672,6 +3146,11 @@ var eventMetadataLabelMap = {
|
|
2672
3146
|
defaultMessage: "Created",
|
2673
3147
|
description: "Created At"
|
2674
3148
|
},
|
3149
|
+
"event.createdByUserType": {
|
3150
|
+
id: "event.createdByUserType.label",
|
3151
|
+
defaultMessage: "createdByUserType",
|
3152
|
+
description: "createdByUserType:user or system"
|
3153
|
+
},
|
2675
3154
|
"event.dateOfEvent": {
|
2676
3155
|
id: "event.dateOfEvent.label",
|
2677
3156
|
defaultMessage: "Date of Event",
|
@@ -2737,13 +3216,14 @@ var eventMetadataLabelMap = {
|
|
2737
3216
|
// ../commons/src/events/WorkqueueColumnConfig.ts
|
2738
3217
|
var WorkqueueColumnKeysArray = [
|
2739
3218
|
...EventMetadataKeysArray,
|
2740
|
-
"title"
|
3219
|
+
"title",
|
3220
|
+
"outbox"
|
2741
3221
|
];
|
2742
|
-
var WorkqueueColumnKeys =
|
2743
|
-
var WorkqueueColumnValue =
|
3222
|
+
var WorkqueueColumnKeys = import_zod23.z.enum(WorkqueueColumnKeysArray);
|
3223
|
+
var WorkqueueColumnValue = import_zod23.z.object({
|
2744
3224
|
$event: WorkqueueColumnKeys
|
2745
3225
|
});
|
2746
|
-
var WorkqueueColumn =
|
3226
|
+
var WorkqueueColumn = import_zod23.z.object({
|
2747
3227
|
label: TranslationConfig,
|
2748
3228
|
value: WorkqueueColumnValue
|
2749
3229
|
});
|
@@ -2754,97 +3234,112 @@ function defineWorkqueuesColumns(workqueueColumns) {
|
|
2754
3234
|
}
|
2755
3235
|
|
2756
3236
|
// ../commons/src/events/CountryConfigQueryInput.ts
|
2757
|
-
var
|
3237
|
+
var import_zod25 = require("zod");
|
2758
3238
|
|
2759
3239
|
// ../commons/src/events/EventIndex.ts
|
2760
|
-
var
|
3240
|
+
var import_zod24 = require("zod");
|
2761
3241
|
var import_zod_openapi9 = require("zod-openapi");
|
2762
|
-
(0, import_zod_openapi9.extendZodWithOpenApi)(
|
3242
|
+
(0, import_zod_openapi9.extendZodWithOpenApi)(import_zod24.z);
|
2763
3243
|
var EventIndex = EventMetadata.extend({
|
2764
3244
|
declaration: EventState
|
2765
3245
|
}).openapi({
|
2766
3246
|
ref: "EventIndex"
|
2767
3247
|
});
|
2768
|
-
var EventSearchIndex =
|
2769
|
-
|
2770
|
-
type:
|
3248
|
+
var EventSearchIndex = import_zod24.z.record(import_zod24.z.string(), import_zod24.z.any()).and(
|
3249
|
+
import_zod24.z.object({
|
3250
|
+
type: import_zod24.z.string()
|
2771
3251
|
// Ensures "type" (event-id) exists and is a string
|
2772
3252
|
})
|
2773
3253
|
).openapi({
|
2774
3254
|
ref: "EventSearchIndex"
|
2775
3255
|
});
|
2776
|
-
var Fuzzy =
|
3256
|
+
var Fuzzy = import_zod24.z.object({ type: import_zod24.z.literal("fuzzy"), term: import_zod24.z.string() }).openapi({
|
2777
3257
|
ref: "Fuzzy"
|
2778
3258
|
});
|
2779
|
-
var Exact =
|
3259
|
+
var Exact = import_zod24.z.object({ type: import_zod24.z.literal("exact"), term: import_zod24.z.string() }).openapi({
|
2780
3260
|
ref: "Exact"
|
2781
3261
|
});
|
2782
|
-
var
|
2783
|
-
type:
|
2784
|
-
terms: import_zod22.z.array(import_zod22.z.string())
|
2785
|
-
}).openapi({
|
2786
|
-
ref: "AnyOf"
|
2787
|
-
});
|
2788
|
-
var ExactStatus = import_zod22.z.object({
|
2789
|
-
type: import_zod22.z.literal("exact"),
|
3262
|
+
var ExactStatus = import_zod24.z.object({
|
3263
|
+
type: import_zod24.z.literal("exact"),
|
2790
3264
|
term: EventStatus
|
2791
3265
|
}).openapi({
|
2792
3266
|
ref: "ExactStatus"
|
2793
3267
|
});
|
2794
|
-
var
|
2795
|
-
type:
|
2796
|
-
terms:
|
3268
|
+
var AnyOf = import_zod24.z.object({
|
3269
|
+
type: import_zod24.z.literal("anyOf"),
|
3270
|
+
terms: import_zod24.z.array(import_zod24.z.string())
|
3271
|
+
}).openapi({
|
3272
|
+
ref: "AnyOf"
|
3273
|
+
});
|
3274
|
+
var AnyOfStatus = import_zod24.z.object({
|
3275
|
+
type: import_zod24.z.literal("anyOf"),
|
3276
|
+
terms: import_zod24.z.array(EventStatus)
|
2797
3277
|
}).openapi({
|
2798
3278
|
ref: "AnyOfStatus"
|
2799
3279
|
});
|
2800
|
-
var Range =
|
2801
|
-
type:
|
2802
|
-
gte:
|
2803
|
-
lte:
|
3280
|
+
var Range = import_zod24.z.object({
|
3281
|
+
type: import_zod24.z.literal("range"),
|
3282
|
+
gte: import_zod24.z.string(),
|
3283
|
+
lte: import_zod24.z.string()
|
2804
3284
|
}).openapi({
|
2805
3285
|
ref: "Range"
|
2806
3286
|
});
|
2807
|
-
var Not =
|
3287
|
+
var Not = import_zod24.z.object({ type: import_zod24.z.literal("not"), term: import_zod24.z.string() }).openapi({
|
2808
3288
|
ref: "Not"
|
2809
3289
|
});
|
2810
|
-
var Within =
|
3290
|
+
var Within = import_zod24.z.object({ type: import_zod24.z.literal("within"), location: import_zod24.z.string() }).openapi({
|
2811
3291
|
ref: "Within"
|
2812
3292
|
});
|
2813
|
-
var
|
3293
|
+
var RangeDate = Range.extend({
|
3294
|
+
gte: import_zod24.z.string().date().or(import_zod24.z.string().datetime()),
|
3295
|
+
lte: import_zod24.z.string().date().or(import_zod24.z.string().datetime())
|
3296
|
+
}).openapi({
|
3297
|
+
ref: "RangeDate"
|
3298
|
+
});
|
3299
|
+
var ExactDate = Exact.extend({
|
3300
|
+
term: import_zod24.z.string().date().or(import_zod24.z.string().datetime())
|
3301
|
+
}).openapi({
|
3302
|
+
ref: "ExactDate"
|
3303
|
+
});
|
3304
|
+
var DateCondition = import_zod24.z.union([ExactDate, RangeDate]).openapi({
|
2814
3305
|
ref: "DateCondition"
|
2815
3306
|
});
|
2816
|
-
var QueryInput =
|
2817
|
-
() =>
|
2818
|
-
|
2819
|
-
|
3307
|
+
var QueryInput = import_zod24.z.lazy(
|
3308
|
+
() => import_zod24.z.union([
|
3309
|
+
import_zod24.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf, Not]),
|
3310
|
+
import_zod24.z.record(import_zod24.z.string(), QueryInput)
|
2820
3311
|
])
|
2821
3312
|
).openapi({
|
2822
3313
|
ref: "QueryInput"
|
2823
3314
|
});
|
2824
|
-
var QueryExpression =
|
2825
|
-
|
2826
|
-
|
2827
|
-
|
2828
|
-
|
2829
|
-
|
2830
|
-
"legalStatus.REGISTERED.
|
2831
|
-
|
3315
|
+
var QueryExpression = import_zod24.z.object({
|
3316
|
+
id: import_zod24.z.optional(import_zod24.z.string()),
|
3317
|
+
eventType: import_zod24.z.string(),
|
3318
|
+
status: import_zod24.z.optional(import_zod24.z.union([AnyOfStatus, ExactStatus])),
|
3319
|
+
createdAt: import_zod24.z.optional(DateCondition),
|
3320
|
+
updatedAt: import_zod24.z.optional(DateCondition),
|
3321
|
+
"legalStatus.REGISTERED.createdAt": import_zod24.z.optional(DateCondition),
|
3322
|
+
"legalStatus.REGISTERED.createdAtLocation": import_zod24.z.optional(
|
3323
|
+
import_zod24.z.union([Within, Exact])
|
2832
3324
|
),
|
2833
|
-
"legalStatus.REGISTERED.registrationNumber":
|
2834
|
-
createdAtLocation:
|
2835
|
-
updatedAtLocation:
|
2836
|
-
assignedTo:
|
2837
|
-
|
2838
|
-
|
2839
|
-
|
2840
|
-
|
3325
|
+
"legalStatus.REGISTERED.registrationNumber": import_zod24.z.optional(Exact),
|
3326
|
+
createdAtLocation: import_zod24.z.optional(import_zod24.z.union([Within, Exact])),
|
3327
|
+
updatedAtLocation: import_zod24.z.optional(import_zod24.z.union([Within, Exact])),
|
3328
|
+
assignedTo: import_zod24.z.optional(Exact),
|
3329
|
+
createdByUserType: TokenUserType,
|
3330
|
+
createdBy: import_zod24.z.optional(Exact),
|
3331
|
+
updatedBy: import_zod24.z.optional(Exact),
|
3332
|
+
trackingId: import_zod24.z.optional(Exact),
|
3333
|
+
flags: import_zod24.z.optional(import_zod24.z.array(import_zod24.z.union([AnyOf, Not]))),
|
2841
3334
|
data: QueryInput
|
2842
|
-
}).partial().
|
3335
|
+
}).partial().refine((obj) => Object.values(obj).some((val) => val !== void 0), {
|
3336
|
+
message: "At least one query field must be specified."
|
3337
|
+
}).openapi({
|
2843
3338
|
ref: "QueryExpression"
|
2844
3339
|
});
|
2845
|
-
var QueryType =
|
2846
|
-
type:
|
2847
|
-
clauses:
|
3340
|
+
var QueryType = import_zod24.z.object({
|
3341
|
+
type: import_zod24.z.literal("and").or(import_zod24.z.literal("or")).openapi({ default: "and" }),
|
3342
|
+
clauses: import_zod24.z.preprocess(
|
2848
3343
|
(val) => {
|
2849
3344
|
if (typeof val === "string") {
|
2850
3345
|
return [JSON.parse(val)];
|
@@ -2854,7 +3349,7 @@ var QueryType = import_zod22.z.object({
|
|
2854
3349
|
}
|
2855
3350
|
return val;
|
2856
3351
|
},
|
2857
|
-
|
3352
|
+
import_zod24.z.array(QueryExpression).nonempty("At least one clause is required.").openapi({
|
2858
3353
|
default: [
|
2859
3354
|
{
|
2860
3355
|
eventType: TENNIS_CLUB_MEMBERSHIP,
|
@@ -2877,50 +3372,51 @@ var QueryType = import_zod22.z.object({
|
|
2877
3372
|
});
|
2878
3373
|
|
2879
3374
|
// ../commons/src/events/CountryConfigQueryInput.ts
|
2880
|
-
var SerializableExact =
|
2881
|
-
type:
|
2882
|
-
term:
|
3375
|
+
var SerializableExact = import_zod25.z.object({
|
3376
|
+
type: import_zod25.z.literal("exact"),
|
3377
|
+
term: import_zod25.z.union([import_zod25.z.string(), SerializedUserField])
|
2883
3378
|
});
|
2884
|
-
var SerializableWithin =
|
2885
|
-
type:
|
2886
|
-
location:
|
3379
|
+
var SerializableWithin = import_zod25.z.object({
|
3380
|
+
type: import_zod25.z.literal("within"),
|
3381
|
+
location: import_zod25.z.union([import_zod25.z.string(), SerializedUserField])
|
2887
3382
|
});
|
2888
|
-
var SerializedQueryExpression =
|
2889
|
-
eventType:
|
2890
|
-
status:
|
2891
|
-
createdAt:
|
2892
|
-
updatedAt:
|
2893
|
-
createdAtLocation:
|
2894
|
-
|
3383
|
+
var SerializedQueryExpression = import_zod25.z.object({
|
3384
|
+
eventType: import_zod25.z.string(),
|
3385
|
+
status: import_zod25.z.optional(import_zod25.z.union([AnyOfStatus, ExactStatus])),
|
3386
|
+
createdAt: import_zod25.z.optional(DateCondition),
|
3387
|
+
updatedAt: import_zod25.z.optional(DateCondition),
|
3388
|
+
createdAtLocation: import_zod25.z.optional(
|
3389
|
+
import_zod25.z.union([SerializableWithin, SerializableExact])
|
2895
3390
|
),
|
2896
|
-
updatedAtLocation:
|
2897
|
-
|
3391
|
+
updatedAtLocation: import_zod25.z.optional(
|
3392
|
+
import_zod25.z.union([SerializableWithin, SerializableExact])
|
2898
3393
|
),
|
2899
|
-
assignedTo:
|
2900
|
-
createdBy:
|
2901
|
-
|
2902
|
-
|
2903
|
-
|
3394
|
+
assignedTo: import_zod25.z.optional(SerializableExact),
|
3395
|
+
createdBy: import_zod25.z.optional(SerializableExact),
|
3396
|
+
createdByUserType: TokenUserType,
|
3397
|
+
updatedBy: import_zod25.z.optional(SerializableExact),
|
3398
|
+
trackingId: import_zod25.z.optional(Exact),
|
3399
|
+
flags: import_zod25.z.optional(import_zod25.z.array(import_zod25.z.union([AnyOf, Not]))),
|
2904
3400
|
data: QueryInput
|
2905
3401
|
}).partial();
|
2906
|
-
var Or2 =
|
2907
|
-
type:
|
2908
|
-
clauses:
|
3402
|
+
var Or2 = import_zod25.z.object({
|
3403
|
+
type: import_zod25.z.literal("or"),
|
3404
|
+
clauses: import_zod25.z.array(SerializedQueryExpression)
|
2909
3405
|
});
|
2910
|
-
var And2 =
|
2911
|
-
type:
|
2912
|
-
clauses:
|
3406
|
+
var And2 = import_zod25.z.object({
|
3407
|
+
type: import_zod25.z.literal("and"),
|
3408
|
+
clauses: import_zod25.z.array(SerializedQueryExpression)
|
2913
3409
|
});
|
2914
|
-
var CountryConfigQueryType =
|
2915
|
-
var CountryConfigQueryInputType =
|
3410
|
+
var CountryConfigQueryType = import_zod25.z.discriminatedUnion("type", [And2, Or2]);
|
3411
|
+
var CountryConfigQueryInputType = import_zod25.z.union([
|
2916
3412
|
SerializedQueryExpression,
|
2917
3413
|
And2,
|
2918
3414
|
Or2
|
2919
3415
|
]);
|
2920
3416
|
|
2921
3417
|
// ../commons/src/icons.ts
|
2922
|
-
var
|
2923
|
-
var AvailableIcons =
|
3418
|
+
var import_zod26 = require("zod");
|
3419
|
+
var AvailableIcons = import_zod26.z.enum([
|
2924
3420
|
"Archived",
|
2925
3421
|
"Assigned",
|
2926
3422
|
"Certified",
|
@@ -3042,34 +3538,42 @@ var mandatoryColumns = defineWorkqueuesColumns([
|
|
3042
3538
|
value: event.field("updatedAt")
|
3043
3539
|
}
|
3044
3540
|
]);
|
3045
|
-
var
|
3046
|
-
|
3541
|
+
var WorkqueueActionsWithDefault = import_zod27.z.enum([
|
3542
|
+
...workqueueActions.options,
|
3543
|
+
"DEFAULT"
|
3544
|
+
]);
|
3545
|
+
var WorkqueueConfig = import_zod27.z.object({
|
3546
|
+
slug: import_zod27.z.string().describe("Determines the url of the workqueue."),
|
3047
3547
|
name: TranslationConfig.describe(
|
3048
3548
|
"Title of the workflow (both in navigation and on the page)"
|
3049
3549
|
),
|
3050
3550
|
query: CountryConfigQueryType,
|
3051
|
-
actions:
|
3052
|
-
|
3053
|
-
type:
|
3054
|
-
conditionals:
|
3551
|
+
actions: import_zod27.z.array(
|
3552
|
+
import_zod27.z.object({
|
3553
|
+
type: WorkqueueActionsWithDefault,
|
3554
|
+
conditionals: import_zod27.z.array(Conditional).optional()
|
3055
3555
|
})
|
3056
3556
|
),
|
3057
|
-
columns:
|
3557
|
+
columns: import_zod27.z.array(WorkqueueColumn).default(mandatoryColumns),
|
3058
3558
|
icon: AvailableIcons
|
3059
3559
|
}).describe("Configuration for workqueue.");
|
3060
|
-
var
|
3061
|
-
|
3560
|
+
var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
|
3561
|
+
query: true,
|
3562
|
+
columns: true
|
3563
|
+
});
|
3564
|
+
var WorkqueueConfigInput = import_zod27.z.object({
|
3565
|
+
slug: import_zod27.z.string().describe("Determines the url of the workqueue."),
|
3062
3566
|
name: TranslationConfig.describe(
|
3063
3567
|
"Title of the workflow (both in navigation and on the page)"
|
3064
3568
|
),
|
3065
3569
|
query: CountryConfigQueryInputType,
|
3066
|
-
actions:
|
3067
|
-
|
3068
|
-
type:
|
3069
|
-
conditionals:
|
3570
|
+
actions: import_zod27.z.array(
|
3571
|
+
import_zod27.z.object({
|
3572
|
+
type: WorkqueueActionsWithDefault,
|
3573
|
+
conditionals: import_zod27.z.array(Conditional).optional()
|
3070
3574
|
})
|
3071
3575
|
),
|
3072
|
-
columns:
|
3576
|
+
columns: import_zod27.z.array(WorkqueueColumn).default(mandatoryColumns),
|
3073
3577
|
icon: AvailableIcons
|
3074
3578
|
});
|
3075
3579
|
function defineWorkqueue(workqueueInput) {
|
@@ -3080,10 +3584,10 @@ function defineWorkqueue(workqueueInput) {
|
|
3080
3584
|
function defineWorkqueues(workqueues) {
|
3081
3585
|
return workqueues.map((workqueue) => defineWorkqueue(workqueue));
|
3082
3586
|
}
|
3083
|
-
var WorkqueueCountInput =
|
3084
|
-
|
3587
|
+
var WorkqueueCountInput = import_zod27.z.array(
|
3588
|
+
import_zod27.z.object({ slug: import_zod27.z.string(), query: QueryType })
|
3085
3589
|
);
|
3086
|
-
var WorkqueueCountOutput =
|
3590
|
+
var WorkqueueCountOutput = import_zod27.z.record(import_zod27.z.string(), import_zod27.z.number());
|
3087
3591
|
|
3088
3592
|
// ../commons/src/events/workqueueDefaultColumns.ts
|
3089
3593
|
var defaultWorkqueueColumns = [
|
@@ -3106,42 +3610,42 @@ var defaultWorkqueueColumns = [
|
|
3106
3610
|
];
|
3107
3611
|
|
3108
3612
|
// ../commons/src/events/Draft.ts
|
3109
|
-
var
|
3613
|
+
var import_zod29 = require("zod");
|
3110
3614
|
|
3111
3615
|
// ../commons/src/events/ActionInput.ts
|
3112
|
-
var
|
3616
|
+
var import_zod28 = require("zod");
|
3113
3617
|
var import_zod_openapi10 = require("zod-openapi");
|
3114
3618
|
var import_uuid3 = require("uuid");
|
3115
|
-
(0, import_zod_openapi10.extendZodWithOpenApi)(
|
3116
|
-
var BaseActionInput =
|
3117
|
-
eventId:
|
3118
|
-
transactionId:
|
3619
|
+
(0, import_zod_openapi10.extendZodWithOpenApi)(import_zod28.z);
|
3620
|
+
var BaseActionInput = import_zod28.z.object({
|
3621
|
+
eventId: import_zod28.z.string(),
|
3622
|
+
transactionId: import_zod28.z.string(),
|
3119
3623
|
declaration: ActionUpdate.default({}),
|
3120
3624
|
annotation: ActionUpdate.optional(),
|
3121
|
-
originalActionId:
|
3122
|
-
keepAssignment:
|
3625
|
+
originalActionId: import_zod28.z.string().optional(),
|
3626
|
+
keepAssignment: import_zod28.z.boolean().optional()
|
3123
3627
|
});
|
3124
3628
|
var CreateActionInput = BaseActionInput.merge(
|
3125
|
-
|
3126
|
-
type:
|
3629
|
+
import_zod28.z.object({
|
3630
|
+
type: import_zod28.z.literal(ActionType.CREATE).default(ActionType.CREATE),
|
3127
3631
|
createdAtLocation: CreatedAtLocation
|
3128
3632
|
})
|
3129
3633
|
);
|
3130
3634
|
var RegisterActionInput = BaseActionInput.merge(
|
3131
|
-
|
3132
|
-
type:
|
3133
|
-
registrationNumber:
|
3635
|
+
import_zod28.z.object({
|
3636
|
+
type: import_zod28.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
3637
|
+
registrationNumber: import_zod28.z.string().optional()
|
3134
3638
|
})
|
3135
3639
|
);
|
3136
3640
|
var ValidateActionInput = BaseActionInput.merge(
|
3137
|
-
|
3138
|
-
type:
|
3139
|
-
duplicates:
|
3641
|
+
import_zod28.z.object({
|
3642
|
+
type: import_zod28.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
|
3643
|
+
duplicates: import_zod28.z.array(import_zod28.z.string())
|
3140
3644
|
})
|
3141
3645
|
);
|
3142
3646
|
var NotifyActionInput = BaseActionInput.merge(
|
3143
|
-
|
3144
|
-
type:
|
3647
|
+
import_zod28.z.object({
|
3648
|
+
type: import_zod28.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
|
3145
3649
|
})
|
3146
3650
|
).openapi({
|
3147
3651
|
default: {
|
@@ -3153,68 +3657,68 @@ var NotifyActionInput = BaseActionInput.merge(
|
|
3153
3657
|
}
|
3154
3658
|
});
|
3155
3659
|
var DeclareActionInput = BaseActionInput.merge(
|
3156
|
-
|
3157
|
-
type:
|
3660
|
+
import_zod28.z.object({
|
3661
|
+
type: import_zod28.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
3158
3662
|
})
|
3159
3663
|
);
|
3160
3664
|
var PrintCertificateActionInput = BaseActionInput.merge(
|
3161
|
-
|
3162
|
-
type:
|
3665
|
+
import_zod28.z.object({
|
3666
|
+
type: import_zod28.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
|
3163
3667
|
})
|
3164
3668
|
);
|
3165
3669
|
var RejectDeclarationActionInput = BaseActionInput.merge(
|
3166
|
-
|
3167
|
-
type:
|
3670
|
+
import_zod28.z.object({
|
3671
|
+
type: import_zod28.z.literal(ActionType.REJECT).default(ActionType.REJECT),
|
3168
3672
|
reason: RejectionReason
|
3169
3673
|
})
|
3170
3674
|
);
|
3171
3675
|
var MarkedAsDuplicateActionInput = BaseActionInput.merge(
|
3172
|
-
|
3173
|
-
type:
|
3676
|
+
import_zod28.z.object({
|
3677
|
+
type: import_zod28.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
|
3174
3678
|
})
|
3175
3679
|
);
|
3176
3680
|
var ArchiveActionInput = BaseActionInput.merge(
|
3177
|
-
|
3178
|
-
type:
|
3681
|
+
import_zod28.z.object({
|
3682
|
+
type: import_zod28.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
|
3179
3683
|
reason: RejectionReason
|
3180
3684
|
})
|
3181
3685
|
);
|
3182
3686
|
var AssignActionInput = BaseActionInput.merge(
|
3183
|
-
|
3184
|
-
type:
|
3185
|
-
assignedTo:
|
3687
|
+
import_zod28.z.object({
|
3688
|
+
type: import_zod28.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
|
3689
|
+
assignedTo: import_zod28.z.string()
|
3186
3690
|
})
|
3187
3691
|
);
|
3188
3692
|
var UnassignActionInput = BaseActionInput.merge(
|
3189
|
-
|
3190
|
-
type:
|
3191
|
-
assignedTo:
|
3693
|
+
import_zod28.z.object({
|
3694
|
+
type: import_zod28.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
|
3695
|
+
assignedTo: import_zod28.z.literal(null).default(null)
|
3192
3696
|
})
|
3193
3697
|
);
|
3194
3698
|
var RequestCorrectionActionInput = BaseActionInput.merge(
|
3195
|
-
|
3196
|
-
type:
|
3699
|
+
import_zod28.z.object({
|
3700
|
+
type: import_zod28.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
3197
3701
|
})
|
3198
3702
|
);
|
3199
3703
|
var RejectCorrectionActionInput = BaseActionInput.merge(
|
3200
|
-
|
3201
|
-
requestId:
|
3202
|
-
type:
|
3704
|
+
import_zod28.z.object({
|
3705
|
+
requestId: import_zod28.z.string(),
|
3706
|
+
type: import_zod28.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
|
3203
3707
|
})
|
3204
3708
|
);
|
3205
3709
|
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
3206
|
-
|
3207
|
-
requestId:
|
3208
|
-
type:
|
3710
|
+
import_zod28.z.object({
|
3711
|
+
requestId: import_zod28.z.string(),
|
3712
|
+
type: import_zod28.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
3209
3713
|
})
|
3210
3714
|
);
|
3211
3715
|
var ReadActionInput = BaseActionInput.merge(
|
3212
|
-
|
3213
|
-
type:
|
3716
|
+
import_zod28.z.object({
|
3717
|
+
type: import_zod28.z.literal(ActionType.READ).default(ActionType.READ)
|
3214
3718
|
})
|
3215
3719
|
);
|
3216
|
-
var DeleteActionInput =
|
3217
|
-
var ActionInput =
|
3720
|
+
var DeleteActionInput = import_zod28.z.object({ eventId: import_zod28.z.string() });
|
3721
|
+
var ActionInput = import_zod28.z.discriminatedUnion("type", [
|
3218
3722
|
CreateActionInput.openapi({ ref: "CreateActionInput" }),
|
3219
3723
|
ValidateActionInput.openapi({ ref: "ValidateActionInput" }),
|
3220
3724
|
RegisterActionInput.openapi({ ref: "RegisterActionInput" }),
|
@@ -3243,18 +3747,18 @@ var ActionInput = import_zod26.z.discriminatedUnion("type", [
|
|
3243
3747
|
});
|
3244
3748
|
|
3245
3749
|
// ../commons/src/events/Draft.ts
|
3246
|
-
var Draft =
|
3247
|
-
id:
|
3248
|
-
eventId:
|
3249
|
-
transactionId:
|
3250
|
-
createdAt:
|
3750
|
+
var Draft = import_zod29.z.object({
|
3751
|
+
id: import_zod29.z.string(),
|
3752
|
+
eventId: import_zod29.z.string(),
|
3753
|
+
transactionId: import_zod29.z.string(),
|
3754
|
+
createdAt: import_zod29.z.string().datetime(),
|
3251
3755
|
action: ActionBase.extend({
|
3252
3756
|
type: ActionTypes
|
3253
3757
|
}).omit({ id: true })
|
3254
3758
|
});
|
3255
3759
|
var DraftInput = BaseActionInput.extend({
|
3256
3760
|
type: ActionTypes,
|
3257
|
-
status:
|
3761
|
+
status: import_zod29.z.enum([
|
3258
3762
|
ActionStatus.Requested,
|
3259
3763
|
ActionStatus.Accepted,
|
3260
3764
|
ActionStatus.Rejected
|
@@ -3262,24 +3766,24 @@ var DraftInput = BaseActionInput.extend({
|
|
3262
3766
|
});
|
3263
3767
|
|
3264
3768
|
// ../commons/src/events/EventInput.ts
|
3265
|
-
var
|
3769
|
+
var import_zod30 = require("zod");
|
3266
3770
|
var import_uuid4 = require("uuid");
|
3267
|
-
var EventInput =
|
3268
|
-
transactionId:
|
3269
|
-
type:
|
3771
|
+
var EventInput = import_zod30.z.object({
|
3772
|
+
transactionId: import_zod30.z.string(),
|
3773
|
+
type: import_zod30.z.string()
|
3270
3774
|
}).openapi({ default: { transactionId: (0, import_uuid4.v4)(), type: "v2.birth" } });
|
3271
3775
|
|
3272
3776
|
// ../commons/src/events/EventDocument.ts
|
3273
|
-
var
|
3777
|
+
var import_zod31 = require("zod");
|
3274
3778
|
var import_zod_openapi11 = require("zod-openapi");
|
3275
|
-
(0, import_zod_openapi11.extendZodWithOpenApi)(
|
3276
|
-
var EventDocument =
|
3277
|
-
id:
|
3278
|
-
type:
|
3279
|
-
createdAt:
|
3280
|
-
updatedAt:
|
3281
|
-
actions:
|
3282
|
-
trackingId:
|
3779
|
+
(0, import_zod_openapi11.extendZodWithOpenApi)(import_zod31.z);
|
3780
|
+
var EventDocument = import_zod31.z.object({
|
3781
|
+
id: import_zod31.z.string(),
|
3782
|
+
type: import_zod31.z.string(),
|
3783
|
+
createdAt: import_zod31.z.string().datetime(),
|
3784
|
+
updatedAt: import_zod31.z.string().datetime(),
|
3785
|
+
actions: import_zod31.z.array(Action),
|
3786
|
+
trackingId: import_zod31.z.string()
|
3283
3787
|
}).openapi({ ref: "EventDocument" });
|
3284
3788
|
|
3285
3789
|
// ../commons/src/events/state/utils.ts
|
@@ -3313,6 +3817,7 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
|
|
3313
3817
|
// When 3rd party API returns 200 OK, we assume that the request was accepted, and persist single 'accepted' action.
|
3314
3818
|
createdAt: requestAction?.createdAt ?? acceptAction.createdAt,
|
3315
3819
|
createdBy: requestAction?.createdBy ?? acceptAction.createdBy,
|
3820
|
+
createdByUserType: requestAction?.createdByUserType ?? acceptAction.createdByUserType,
|
3316
3821
|
createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
|
3317
3822
|
acceptedAt: acceptAction.createdAt,
|
3318
3823
|
createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
|
@@ -3320,17 +3825,18 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
|
|
3320
3825
|
registrationNumber
|
3321
3826
|
};
|
3322
3827
|
}
|
3323
|
-
function
|
3828
|
+
function getActionUpdateMetadata(actions) {
|
3324
3829
|
const createAction = getOrThrow(
|
3325
3830
|
actions.find((action) => action.type === ActionType.CREATE),
|
3326
3831
|
`Event has no ${ActionType.CREATE} action`
|
3327
3832
|
);
|
3328
|
-
return
|
3833
|
+
return StatusChangingActions.options.reduce(
|
3329
3834
|
(metadata, actionType) => {
|
3330
3835
|
const { accept, request } = getActionRequests(actionType, actions);
|
3331
3836
|
return {
|
3332
3837
|
createdAt: request?.createdAt ?? accept?.createdAt ?? metadata.createdAt,
|
3333
3838
|
createdBy: request?.createdBy ?? accept?.createdBy ?? metadata.createdBy,
|
3839
|
+
createdByUserType: request?.createdByUserType ?? accept?.createdByUserType ?? metadata.createdByUserType,
|
3334
3840
|
createdAtLocation: request?.createdAtLocation ?? accept?.createdAtLocation ?? metadata.createdAtLocation,
|
3335
3841
|
createdByRole: request?.createdByRole ?? accept?.createdByRole ?? metadata.createdByRole
|
3336
3842
|
};
|
@@ -3338,6 +3844,7 @@ function getDeclarationActionUpdateMetadata(actions) {
|
|
3338
3844
|
{
|
3339
3845
|
createdAt: createAction.createdAt,
|
3340
3846
|
createdBy: createAction.createdBy,
|
3847
|
+
createdByUserType: createAction.createdByUserType,
|
3341
3848
|
createdAtLocation: createAction.createdAtLocation,
|
3342
3849
|
createdByRole: createAction.createdByRole
|
3343
3850
|
}
|
@@ -3499,10 +4006,11 @@ function getCurrentEventState(event2, config) {
|
|
3499
4006
|
if (!creationAction) {
|
3500
4007
|
throw new Error(`Event ${event2.id} has no creation action`);
|
3501
4008
|
}
|
3502
|
-
const acceptedActions = getAcceptedActions(event2)
|
3503
|
-
|
3504
|
-
event2.actions
|
4009
|
+
const acceptedActions = getAcceptedActions(event2).sort(
|
4010
|
+
(a, b) => a.createdAt.localeCompare(b.createdAt)
|
3505
4011
|
);
|
4012
|
+
const requestActionMetadata = getActionUpdateMetadata(event2.actions);
|
4013
|
+
const acceptedActionMetadata = getActionUpdateMetadata(acceptedActions);
|
3506
4014
|
const declaration = aggregateActionDeclarations(acceptedActions);
|
3507
4015
|
let dateOfEvent;
|
3508
4016
|
if (config.dateOfEvent) {
|
@@ -3522,16 +4030,17 @@ function getCurrentEventState(event2, config) {
|
|
3522
4030
|
legalStatuses: getLegalStatuses(event2.actions),
|
3523
4031
|
createdAt: creationAction.createdAt,
|
3524
4032
|
createdBy: creationAction.createdBy,
|
4033
|
+
createdByUserType: creationAction.createdByUserType,
|
3525
4034
|
createdAtLocation: creationAction.createdAtLocation,
|
3526
4035
|
createdBySignature: creationAction.createdBySignature,
|
3527
|
-
updatedAt:
|
4036
|
+
updatedAt: acceptedActionMetadata.createdAt,
|
3528
4037
|
assignedTo: getAssignedUserFromActions(acceptedActions),
|
3529
4038
|
assignedToSignature: getAssignedUserSignatureFromActions(acceptedActions),
|
3530
|
-
updatedBy:
|
3531
|
-
updatedAtLocation:
|
4039
|
+
updatedBy: requestActionMetadata.createdBy,
|
4040
|
+
updatedAtLocation: requestActionMetadata.createdAtLocation,
|
3532
4041
|
declaration,
|
3533
4042
|
trackingId: event2.trackingId,
|
3534
|
-
updatedByUserRole:
|
4043
|
+
updatedByUserRole: requestActionMetadata.createdByRole,
|
3535
4044
|
dateOfEvent,
|
3536
4045
|
flags: getFlagsFromActions(event2.actions)
|
3537
4046
|
});
|
@@ -3614,18 +4123,18 @@ function generateTransactionId() {
|
|
3614
4123
|
}
|
3615
4124
|
|
3616
4125
|
// ../commons/src/events/User.ts
|
3617
|
-
var
|
3618
|
-
var User =
|
3619
|
-
id:
|
3620
|
-
name:
|
3621
|
-
|
3622
|
-
use:
|
3623
|
-
given:
|
3624
|
-
family:
|
4126
|
+
var import_zod32 = require("zod");
|
4127
|
+
var User = import_zod32.z.object({
|
4128
|
+
id: import_zod32.z.string(),
|
4129
|
+
name: import_zod32.z.array(
|
4130
|
+
import_zod32.z.object({
|
4131
|
+
use: import_zod32.z.string(),
|
4132
|
+
given: import_zod32.z.array(import_zod32.z.string()),
|
4133
|
+
family: import_zod32.z.string()
|
3625
4134
|
})
|
3626
4135
|
),
|
3627
|
-
role:
|
3628
|
-
signatureFilename:
|
4136
|
+
role: import_zod32.z.string(),
|
4137
|
+
signatureFilename: import_zod32.z.string().optional()
|
3629
4138
|
});
|
3630
4139
|
|
3631
4140
|
// ../commons/src/events/test.utils.ts
|
@@ -5615,6 +6124,14 @@ var v2BirthEvent = defineConfig({
|
|
5615
6124
|
});
|
5616
6125
|
|
5617
6126
|
// ../commons/src/events/test.utils.ts
|
6127
|
+
var import_zod33 = require("zod");
|
6128
|
+
var TestUserRole = import_zod33.z.enum([
|
6129
|
+
"FIELD_AGENT",
|
6130
|
+
"LOCAL_REGISTRAR",
|
6131
|
+
"LOCAL_SYSTEM_ADMIN",
|
6132
|
+
"NATIONAL_REGISTRAR",
|
6133
|
+
"REGISTRATION_AGENT"
|
6134
|
+
]);
|
5618
6135
|
function pickRandom(rng, items) {
|
5619
6136
|
return items[Math.floor(rng() * items.length)];
|
5620
6137
|
}
|
@@ -5787,6 +6304,7 @@ function eventPayloadGenerator(rng) {
|
|
5787
6304
|
},
|
5788
6305
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
5789
6306
|
createdBy: "@todo",
|
6307
|
+
createdByUserType: TokenUserType.Enum.user,
|
5790
6308
|
createdByRole: "@todo",
|
5791
6309
|
createdAtLocation: "@todo"
|
5792
6310
|
}
|
@@ -5979,7 +6497,8 @@ function generateActionDocument({
|
|
5979
6497
|
// @TODO: This should be fixed in the future.
|
5980
6498
|
createdAt: new Date(Date.now() - 500).toISOString(),
|
5981
6499
|
createdBy: getUUID(),
|
5982
|
-
|
6500
|
+
createdByUserType: TokenUserType.Enum.user,
|
6501
|
+
createdByRole: TestUserRole.Enum.FIELD_AGENT,
|
5983
6502
|
id: getUUID(),
|
5984
6503
|
createdAtLocation: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
5985
6504
|
declaration: generateActionDeclarationInput(configuration, action, rng),
|
@@ -6136,6 +6655,7 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
|
|
6136
6655
|
type: overrides.type ?? TENNIS_CLUB_MEMBERSHIP,
|
6137
6656
|
status: overrides.status ?? pickRandom(rng, EventStatus.options),
|
6138
6657
|
createdAt: overrides.createdAt ?? createdAt,
|
6658
|
+
createdByUserType: overrides.createdByUserType ?? "user",
|
6139
6659
|
createdBy: overrides.createdBy ?? generateUuid(rng),
|
6140
6660
|
createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
|
6141
6661
|
updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
|
@@ -6213,234 +6733,6 @@ function isFieldConfigDefaultValue(value) {
|
|
6213
6733
|
|
6214
6734
|
// ../commons/src/events/scopes.ts
|
6215
6735
|
var import_lodash3 = require("lodash");
|
6216
|
-
|
6217
|
-
// ../commons/src/scopes.ts
|
6218
|
-
var import_zod31 = require("zod");
|
6219
|
-
var SCOPES = {
|
6220
|
-
// TODO v1.8 legacy scopes
|
6221
|
-
NATLSYSADMIN: "natlsysadmin",
|
6222
|
-
BYPASSRATELIMIT: "bypassratelimit",
|
6223
|
-
DECLARE: "declare",
|
6224
|
-
REGISTER: "register",
|
6225
|
-
VALIDATE: "validate",
|
6226
|
-
DEMO: "demo",
|
6227
|
-
CERTIFY: "certify",
|
6228
|
-
PERFORMANCE: "performance",
|
6229
|
-
SYSADMIN: "sysadmin",
|
6230
|
-
TEAMS: "teams",
|
6231
|
-
CONFIG: "config",
|
6232
|
-
// systems / integrations
|
6233
|
-
WEBHOOK: "webhook",
|
6234
|
-
NATIONALID: "nationalId",
|
6235
|
-
NOTIFICATION_API: "notification-api",
|
6236
|
-
RECORDSEARCH: "recordsearch",
|
6237
|
-
/**
|
6238
|
-
* @TODO This is a temporary scope to be used for V2 Events custom events declaration
|
6239
|
-
*/
|
6240
|
-
RECORD_DECLARE: "record.declare-birth",
|
6241
|
-
// declare
|
6242
|
-
RECORD_IMPORT: "record.import",
|
6243
|
-
// declare
|
6244
|
-
RECORD_DECLARE_BIRTH: "record.declare-birth",
|
6245
|
-
RECORD_DECLARE_BIRTH_MY_JURISDICTION: "record.declare-birth:my-jurisdiction",
|
6246
|
-
RECORD_DECLARE_DEATH: "record.declare-death",
|
6247
|
-
RECORD_DECLARE_DEATH_MY_JURISDICTION: "record.declare-death:my-jurisdiction",
|
6248
|
-
RECORD_DECLARE_MARRIAGE: "record.declare-marriage",
|
6249
|
-
RECORD_DECLARE_MARRIAGE_MY_JURISDICTION: "record.declare-marriage:my-jurisdiction",
|
6250
|
-
RECORD_SUBMIT_INCOMPLETE: "record.declaration-submit-incomplete",
|
6251
|
-
RECORD_SUBMIT_FOR_REVIEW: "record.declaration-submit-for-review",
|
6252
|
-
RECORD_UNASSIGN_OTHERS: "record.unassign-others",
|
6253
|
-
// validate
|
6254
|
-
RECORD_SUBMIT_FOR_APPROVAL: "record.declaration-submit-for-approval",
|
6255
|
-
RECORD_SUBMIT_FOR_UPDATES: "record.declaration-submit-for-updates",
|
6256
|
-
RECORD_DECLARATION_EDIT: "record.declaration-edit",
|
6257
|
-
RECORD_REVIEW_DUPLICATES: "record.review-duplicates",
|
6258
|
-
RECORD_DECLARATION_ARCHIVE: "record.declaration-archive",
|
6259
|
-
RECORD_DECLARATION_REINSTATE: "record.declaration-reinstate",
|
6260
|
-
// register
|
6261
|
-
RECORD_REGISTER: "record.register",
|
6262
|
-
// certify
|
6263
|
-
RECORD_EXPORT_RECORDS: "record.export-records",
|
6264
|
-
RECORD_DECLARATION_PRINT: "record.declaration-print",
|
6265
|
-
RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS: "record.declaration-print-supporting-documents",
|
6266
|
-
RECORD_REGISTRATION_PRINT: "record.registration-print",
|
6267
|
-
// v1.8
|
6268
|
-
/**
|
6269
|
-
* This scope is used to **print and **issue certified copies of a record
|
6270
|
-
* after it has been registered. Previously Registrars had this permission.
|
6271
|
-
*/
|
6272
|
-
RECORD_PRINT_ISSUE_CERTIFIED_COPIES: "record.registration-print&issue-certified-copies",
|
6273
|
-
RECORD_PRINT_CERTIFIED_COPIES: "record.registration-print-certified-copies",
|
6274
|
-
// v1.8
|
6275
|
-
RECORD_BULK_PRINT_CERTIFIED_COPIES: "record.registration-bulk-print-certified-copies",
|
6276
|
-
// v1.8
|
6277
|
-
RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES: "record.registration-verify-certified-copies",
|
6278
|
-
// v1.8
|
6279
|
-
// correct
|
6280
|
-
RECORD_REGISTRATION_REQUEST_CORRECTION: "record.registration-request-correction",
|
6281
|
-
RECORD_REGISTRATION_CORRECT: "record.registration-correct",
|
6282
|
-
RECORD_REGISTRATION_REQUEST_REVOCATION: "record.registration-request-revocation",
|
6283
|
-
// v1.8
|
6284
|
-
RECORD_REGISTRATION_REVOKE: "record.registration-revoke",
|
6285
|
-
// v1.8
|
6286
|
-
RECORD_REGISTRATION_REQUEST_REINSTATEMENT: "record.registration-request-reinstatement",
|
6287
|
-
// v1.8
|
6288
|
-
RECORD_REGISTRATION_REINSTATE: "record.registration-reinstate",
|
6289
|
-
// v1.8
|
6290
|
-
RECORD_CONFIRM_REGISTRATION: "record.confirm-registration",
|
6291
|
-
RECORD_REJECT_REGISTRATION: "record.reject-registration",
|
6292
|
-
// search
|
6293
|
-
SEARCH_BIRTH_MY_JURISDICTION: "search.birth:my-jurisdiction",
|
6294
|
-
SEARCH_BIRTH: "search.birth",
|
6295
|
-
SEARCH_DEATH_MY_JURISDICTION: "search.death:my-jurisdiction",
|
6296
|
-
SEARCH_DEATH: "search.death",
|
6297
|
-
SEARCH_MARRIAGE_MY_JURISDICTION: "search.marriage:my-jurisdiction",
|
6298
|
-
SEARCH_MARRIAGE: "search.marriage",
|
6299
|
-
// audit v1.8
|
6300
|
-
RECORD_READ: "record.read",
|
6301
|
-
RECORD_READ_AUDIT: "record.read-audit",
|
6302
|
-
RECORD_READ_COMMENTS: "record.read-comments",
|
6303
|
-
RECORD_CREATE_COMMENTS: "record.create-comments",
|
6304
|
-
// profile
|
6305
|
-
PROFILE_UPDATE: "profile.update",
|
6306
|
-
//v1.8
|
6307
|
-
PROFILE_ELECTRONIC_SIGNATURE: "profile.electronic-signature",
|
6308
|
-
// performance
|
6309
|
-
PERFORMANCE_READ: "performance.read",
|
6310
|
-
PERFORMANCE_READ_DASHBOARDS: "performance.read-dashboards",
|
6311
|
-
PERFORMANCE_EXPORT_VITAL_STATISTICS: "performance.vital-statistics-export",
|
6312
|
-
// organisation
|
6313
|
-
ORGANISATION_READ_LOCATIONS: "organisation.read-locations:all",
|
6314
|
-
ORGANISATION_READ_LOCATIONS_MY_OFFICE: "organisation.read-locations:my-office",
|
6315
|
-
ORGANISATION_READ_LOCATIONS_MY_JURISDICTION: "organisation.read-locations:my-jurisdiction",
|
6316
|
-
// user
|
6317
|
-
USER_READ: "user.read:all",
|
6318
|
-
USER_READ_MY_OFFICE: "user.read:my-office",
|
6319
|
-
USER_READ_MY_JURISDICTION: "user.read:my-jurisdiction",
|
6320
|
-
USER_READ_ONLY_MY_AUDIT: "user.read:only-my-audit",
|
6321
|
-
//v1.8
|
6322
|
-
USER_CREATE: "user.create:all",
|
6323
|
-
USER_CREATE_MY_JURISDICTION: "user.create:my-jurisdiction",
|
6324
|
-
USER_UPDATE: "user.update:all",
|
6325
|
-
USER_UPDATE_MY_JURISDICTION: "user.update:my-jurisdiction",
|
6326
|
-
// config
|
6327
|
-
CONFIG_UPDATE_ALL: "config.update:all",
|
6328
|
-
// data seeding
|
6329
|
-
USER_DATA_SEEDING: "user.data-seeding"
|
6330
|
-
};
|
6331
|
-
var LiteralScopes = import_zod31.z.union([
|
6332
|
-
import_zod31.z.literal(SCOPES.NATLSYSADMIN),
|
6333
|
-
import_zod31.z.literal(SCOPES.BYPASSRATELIMIT),
|
6334
|
-
import_zod31.z.literal(SCOPES.DECLARE),
|
6335
|
-
import_zod31.z.literal(SCOPES.REGISTER),
|
6336
|
-
import_zod31.z.literal(SCOPES.VALIDATE),
|
6337
|
-
import_zod31.z.literal(SCOPES.DEMO),
|
6338
|
-
import_zod31.z.literal(SCOPES.CERTIFY),
|
6339
|
-
import_zod31.z.literal(SCOPES.PERFORMANCE),
|
6340
|
-
import_zod31.z.literal(SCOPES.SYSADMIN),
|
6341
|
-
import_zod31.z.literal(SCOPES.TEAMS),
|
6342
|
-
import_zod31.z.literal(SCOPES.CONFIG),
|
6343
|
-
import_zod31.z.literal(SCOPES.WEBHOOK),
|
6344
|
-
import_zod31.z.literal(SCOPES.NATIONALID),
|
6345
|
-
import_zod31.z.literal(SCOPES.NOTIFICATION_API),
|
6346
|
-
import_zod31.z.literal(SCOPES.RECORDSEARCH),
|
6347
|
-
import_zod31.z.literal(SCOPES.RECORD_IMPORT),
|
6348
|
-
import_zod31.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
|
6349
|
-
import_zod31.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
|
6350
|
-
import_zod31.z.literal(SCOPES.RECORD_DECLARE_DEATH),
|
6351
|
-
import_zod31.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
|
6352
|
-
import_zod31.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
|
6353
|
-
import_zod31.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
|
6354
|
-
import_zod31.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
|
6355
|
-
import_zod31.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW),
|
6356
|
-
import_zod31.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS),
|
6357
|
-
import_zod31.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
|
6358
|
-
import_zod31.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
|
6359
|
-
import_zod31.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
|
6360
|
-
import_zod31.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
|
6361
|
-
import_zod31.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
|
6362
|
-
import_zod31.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE),
|
6363
|
-
import_zod31.z.literal(SCOPES.RECORD_REGISTER),
|
6364
|
-
import_zod31.z.literal(SCOPES.RECORD_EXPORT_RECORDS),
|
6365
|
-
import_zod31.z.literal(SCOPES.RECORD_DECLARATION_PRINT),
|
6366
|
-
import_zod31.z.literal(SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS),
|
6367
|
-
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_PRINT),
|
6368
|
-
import_zod31.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
|
6369
|
-
import_zod31.z.literal(SCOPES.RECORD_PRINT_CERTIFIED_COPIES),
|
6370
|
-
import_zod31.z.literal(SCOPES.RECORD_BULK_PRINT_CERTIFIED_COPIES),
|
6371
|
-
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES),
|
6372
|
-
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
|
6373
|
-
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
|
6374
|
-
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REVOCATION),
|
6375
|
-
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REVOKE),
|
6376
|
-
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REINSTATEMENT),
|
6377
|
-
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REINSTATE),
|
6378
|
-
import_zod31.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
|
6379
|
-
import_zod31.z.literal(SCOPES.RECORD_REJECT_REGISTRATION),
|
6380
|
-
import_zod31.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
|
6381
|
-
import_zod31.z.literal(SCOPES.SEARCH_BIRTH),
|
6382
|
-
import_zod31.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
|
6383
|
-
import_zod31.z.literal(SCOPES.SEARCH_DEATH),
|
6384
|
-
import_zod31.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
|
6385
|
-
import_zod31.z.literal(SCOPES.SEARCH_MARRIAGE),
|
6386
|
-
import_zod31.z.literal(SCOPES.RECORD_READ),
|
6387
|
-
import_zod31.z.literal(SCOPES.RECORD_READ_AUDIT),
|
6388
|
-
import_zod31.z.literal(SCOPES.RECORD_READ_COMMENTS),
|
6389
|
-
import_zod31.z.literal(SCOPES.RECORD_CREATE_COMMENTS),
|
6390
|
-
import_zod31.z.literal(SCOPES.PROFILE_UPDATE),
|
6391
|
-
import_zod31.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE),
|
6392
|
-
import_zod31.z.literal(SCOPES.PERFORMANCE_READ),
|
6393
|
-
import_zod31.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
|
6394
|
-
import_zod31.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS),
|
6395
|
-
import_zod31.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
|
6396
|
-
import_zod31.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
|
6397
|
-
import_zod31.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION),
|
6398
|
-
import_zod31.z.literal(SCOPES.USER_READ),
|
6399
|
-
import_zod31.z.literal(SCOPES.USER_READ_MY_OFFICE),
|
6400
|
-
import_zod31.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
|
6401
|
-
import_zod31.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
|
6402
|
-
import_zod31.z.literal(SCOPES.USER_CREATE),
|
6403
|
-
import_zod31.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
|
6404
|
-
import_zod31.z.literal(SCOPES.USER_UPDATE),
|
6405
|
-
import_zod31.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION),
|
6406
|
-
import_zod31.z.literal(SCOPES.CONFIG_UPDATE_ALL),
|
6407
|
-
import_zod31.z.literal(SCOPES.USER_DATA_SEEDING)
|
6408
|
-
]);
|
6409
|
-
var rawConfigurableScopeRegex = /^([a-zA-Z\.]+)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
|
6410
|
-
var rawConfigurableScope = import_zod31.z.string().regex(rawConfigurableScopeRegex);
|
6411
|
-
var CreateUserScope = import_zod31.z.object({
|
6412
|
-
type: import_zod31.z.literal("user.create"),
|
6413
|
-
options: import_zod31.z.object({
|
6414
|
-
role: import_zod31.z.array(import_zod31.z.string())
|
6415
|
-
})
|
6416
|
-
});
|
6417
|
-
var EditUserScope = import_zod31.z.object({
|
6418
|
-
type: import_zod31.z.literal("user.edit"),
|
6419
|
-
options: import_zod31.z.object({
|
6420
|
-
role: import_zod31.z.array(import_zod31.z.string())
|
6421
|
-
})
|
6422
|
-
});
|
6423
|
-
var WorkqueueScope = import_zod31.z.object({
|
6424
|
-
type: import_zod31.z.literal("workqueue"),
|
6425
|
-
options: import_zod31.z.object({
|
6426
|
-
id: import_zod31.z.array(import_zod31.z.string())
|
6427
|
-
})
|
6428
|
-
});
|
6429
|
-
var NotifyRecordScope = import_zod31.z.object({
|
6430
|
-
type: import_zod31.z.literal("record.notify"),
|
6431
|
-
options: import_zod31.z.object({
|
6432
|
-
event: import_zod31.z.array(import_zod31.z.string())
|
6433
|
-
})
|
6434
|
-
});
|
6435
|
-
var ConfigurableScopes = import_zod31.z.discriminatedUnion("type", [
|
6436
|
-
CreateUserScope,
|
6437
|
-
EditUserScope,
|
6438
|
-
WorkqueueScope,
|
6439
|
-
NotifyRecordScope
|
6440
|
-
]);
|
6441
|
-
var scopes = Object.values(SCOPES);
|
6442
|
-
|
6443
|
-
// ../commons/src/events/scopes.ts
|
6444
6736
|
var CONFIG_GET_ALLOWED_SCOPES = [
|
6445
6737
|
SCOPES.RECORD_DECLARE,
|
6446
6738
|
SCOPES.RECORD_READ,
|
@@ -6517,30 +6809,20 @@ var ACTION_ALLOWED_CONFIGURABLE_SCOPES = {
|
|
6517
6809
|
[ActionType.UNASSIGN]: [],
|
6518
6810
|
[ActionType.DETECT_DUPLICATE]: []
|
6519
6811
|
};
|
6812
|
+
var WRITE_ACTION_SCOPES = [
|
6813
|
+
...ACTION_ALLOWED_SCOPES[ActionType.DECLARE],
|
6814
|
+
...ACTION_ALLOWED_SCOPES[ActionType.VALIDATE],
|
6815
|
+
...ACTION_ALLOWED_SCOPES[ActionType.REGISTER],
|
6816
|
+
...ACTION_ALLOWED_SCOPES[ActionType.PRINT_CERTIFICATE]
|
6817
|
+
];
|
6520
6818
|
function hasAnyOfScopes(a, b) {
|
6521
6819
|
return (0, import_lodash3.intersection)(a, b).length > 0;
|
6522
6820
|
}
|
6523
|
-
function filterUnallowedActions(actions, userScopes) {
|
6524
|
-
const allowedActions = actions.filter((action) => {
|
6525
|
-
const requiredScopes = ACTION_ALLOWED_SCOPES[action];
|
6526
|
-
if (requiredScopes === null) {
|
6527
|
-
return true;
|
6528
|
-
}
|
6529
|
-
return hasAnyOfScopes(userScopes, requiredScopes);
|
6530
|
-
});
|
6531
|
-
const hasOtherAllowedActions = allowedActions.some(
|
6532
|
-
(action) => action !== ActionType.READ && action !== ActionType.ASSIGN && action !== ActionType.UNASSIGN
|
6533
|
-
);
|
6534
|
-
if (hasOtherAllowedActions) {
|
6535
|
-
return allowedActions;
|
6536
|
-
}
|
6537
|
-
return [ActionType.READ];
|
6538
|
-
}
|
6539
6821
|
|
6540
6822
|
// ../commons/src/events/serializers/user/deserializer.ts
|
6541
|
-
var
|
6823
|
+
var import_zod34 = require("zod");
|
6542
6824
|
var UserWithPrimaryOffice = User.extend({
|
6543
|
-
primaryOfficeId:
|
6825
|
+
primaryOfficeId: import_zod34.z.string()
|
6544
6826
|
});
|
6545
6827
|
function userDeserializer(serializedUserField, user2) {
|
6546
6828
|
if (typeof serializedUserField === "string") {
|
@@ -6560,6 +6842,7 @@ function deserializeQueryExpression(expression, user2) {
|
|
6560
6842
|
...expression.assignedTo,
|
6561
6843
|
term: userDeserializer(expression.assignedTo.term, user2)
|
6562
6844
|
},
|
6845
|
+
createdByUserType: expression.createdByUserType,
|
6563
6846
|
createdBy: expression.createdBy && {
|
6564
6847
|
...expression.createdBy,
|
6565
6848
|
term: userDeserializer(expression.createdBy.term, user2)
|
@@ -6600,3 +6883,51 @@ function deserializeQuery(query, user2) {
|
|
6600
6883
|
)
|
6601
6884
|
};
|
6602
6885
|
}
|
6886
|
+
|
6887
|
+
// ../commons/src/events/state/availableActions.ts
|
6888
|
+
var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
6889
|
+
[EventStatus.enum.CREATED]: [
|
6890
|
+
ActionType.READ,
|
6891
|
+
ActionType.DECLARE,
|
6892
|
+
ActionType.NOTIFY,
|
6893
|
+
ActionType.DELETE
|
6894
|
+
],
|
6895
|
+
[EventStatus.enum.NOTIFIED]: [
|
6896
|
+
ActionType.READ,
|
6897
|
+
ActionType.DECLARE,
|
6898
|
+
ActionType.ARCHIVE,
|
6899
|
+
ActionType.REJECT
|
6900
|
+
],
|
6901
|
+
[EventStatus.enum.DECLARED]: [
|
6902
|
+
ActionType.READ,
|
6903
|
+
ActionType.VALIDATE,
|
6904
|
+
ActionType.ARCHIVE,
|
6905
|
+
ActionType.REJECT
|
6906
|
+
],
|
6907
|
+
[EventStatus.enum.VALIDATED]: [
|
6908
|
+
ActionType.READ,
|
6909
|
+
ActionType.REGISTER,
|
6910
|
+
ActionType.ARCHIVE,
|
6911
|
+
ActionType.REJECT
|
6912
|
+
],
|
6913
|
+
[EventStatus.enum.REJECTED]: [
|
6914
|
+
ActionType.READ,
|
6915
|
+
ActionType.DECLARE,
|
6916
|
+
ActionType.VALIDATE
|
6917
|
+
],
|
6918
|
+
[EventStatus.enum.REGISTERED]: [
|
6919
|
+
ActionType.READ,
|
6920
|
+
ActionType.PRINT_CERTIFICATE,
|
6921
|
+
ActionType.REQUEST_CORRECTION
|
6922
|
+
],
|
6923
|
+
[EventStatus.enum.CERTIFIED]: [
|
6924
|
+
ActionType.READ,
|
6925
|
+
ActionType.PRINT_CERTIFICATE,
|
6926
|
+
ActionType.REQUEST_CORRECTION
|
6927
|
+
],
|
6928
|
+
[EventStatus.enum.ARCHIVED]: [
|
6929
|
+
ActionType.READ,
|
6930
|
+
ActionType.ASSIGN,
|
6931
|
+
ActionType.UNASSIGN
|
6932
|
+
]
|
6933
|
+
};
|