@opencrvs/toolkit 1.8.0-rc.f8aa0c5 → 1.8.0-rc.f8be155
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 +9861 -5350
- package/dist/commons/events/ActionConfig.d.ts +0 -2856
- package/dist/commons/events/ActionDocument.d.ts +706 -805
- package/dist/commons/events/ActionInput.d.ts +602 -602
- package/dist/commons/events/AdvancedSearchConfig.d.ts +18 -222
- package/dist/commons/events/CompositeFieldValue.d.ts +6 -6
- package/dist/commons/events/CountryConfigQueryInput.d.ts +412 -1160
- package/dist/commons/events/Draft.d.ts +54 -59
- package/dist/commons/events/EventConfig.d.ts +0 -1564
- package/dist/commons/events/EventDocument.d.ts +441 -516
- package/dist/commons/events/EventIndex.d.ts +210 -630
- package/dist/commons/events/EventMetadata.d.ts +7 -49
- package/dist/commons/events/FieldConfig.d.ts +0 -198
- package/dist/commons/events/FieldTypeMapping.d.ts +16 -16
- package/dist/commons/events/FieldValue.d.ts +12 -12
- package/dist/commons/events/FormConfig.d.ts +0 -1200
- package/dist/commons/events/PageConfig.d.ts +0 -288
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +11 -11
- package/dist/commons/events/WorkqueueConfig.d.ts +750 -3247
- package/dist/commons/events/defineConfig.d.ts +0 -316
- package/dist/commons/events/field.d.ts +0 -5
- package/dist/commons/events/index.d.ts +0 -1
- package/dist/commons/events/scopes.d.ts +2 -1
- package/dist/commons/events/test.utils.d.ts +15 -37
- package/dist/commons/events/utils.d.ts +9 -466
- package/dist/conditionals/index.js +17 -20
- package/dist/events/index.js +654 -1053
- package/dist/scopes/index.d.ts +7 -96
- package/dist/scopes/index.js +26 -105
- package/package.json +3 -3
package/dist/events/index.js
CHANGED
@@ -32,7 +32,6 @@ 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,
|
36
35
|
Action: () => Action,
|
37
36
|
ActionBase: () => ActionBase,
|
38
37
|
ActionConditional: () => ActionConditional,
|
@@ -69,7 +68,7 @@ __export(events_exports, {
|
|
69
68
|
Conditional: () => Conditional,
|
70
69
|
ConditionalType: () => ConditionalType,
|
71
70
|
ConfirmableActions: () => ConfirmableActions,
|
72
|
-
|
71
|
+
CustomFlags: () => CustomFlags,
|
73
72
|
DEFAULT_DATE_OF_EVENT_PROPERTY: () => DEFAULT_DATE_OF_EVENT_PROPERTY,
|
74
73
|
DataEntry: () => DataEntry,
|
75
74
|
DataFieldValue: () => DataFieldValue,
|
@@ -104,7 +103,6 @@ __export(events_exports, {
|
|
104
103
|
EventState: () => EventState,
|
105
104
|
EventStatus: () => EventStatus,
|
106
105
|
Exact: () => Exact,
|
107
|
-
ExactDate: () => ExactDate,
|
108
106
|
ExactStatus: () => ExactStatus,
|
109
107
|
FieldConditional: () => FieldConditional,
|
110
108
|
FieldConfig: () => FieldConfig,
|
@@ -124,7 +122,6 @@ __export(events_exports, {
|
|
124
122
|
GenericAddressValue: () => GenericAddressValue,
|
125
123
|
GeographicalArea: () => GeographicalArea,
|
126
124
|
ImageMimeType: () => ImageMimeType,
|
127
|
-
InherentFlags: () => InherentFlags,
|
128
125
|
LanguageConfig: () => LanguageConfig,
|
129
126
|
LegalStatuses: () => LegalStatuses,
|
130
127
|
MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
|
@@ -132,6 +129,7 @@ __export(events_exports, {
|
|
132
129
|
NameFieldUpdateValue: () => NameFieldUpdateValue,
|
133
130
|
NameFieldValue: () => NameFieldValue,
|
134
131
|
NonEmptyTextValue: () => NonEmptyTextValue,
|
132
|
+
Not: () => Not,
|
135
133
|
NotifyActionInput: () => NotifyActionInput,
|
136
134
|
NumberFieldValue: () => NumberFieldValue,
|
137
135
|
PageConfig: () => PageConfig,
|
@@ -141,7 +139,6 @@ __export(events_exports, {
|
|
141
139
|
QueryInput: () => QueryInput,
|
142
140
|
QueryType: () => QueryType,
|
143
141
|
Range: () => Range,
|
144
|
-
RangeDate: () => RangeDate,
|
145
142
|
ReadActionInput: () => ReadActionInput,
|
146
143
|
RegisterAction: () => RegisterAction,
|
147
144
|
RegisterActionInput: () => RegisterActionInput,
|
@@ -155,13 +152,11 @@ __export(events_exports, {
|
|
155
152
|
RuralAddressValue: () => RuralAddressValue,
|
156
153
|
SearchField: () => SearchField,
|
157
154
|
SearchQueryParams: () => SearchQueryParams,
|
158
|
-
SearchScopeAccessLevels: () => SearchScopeAccessLevels,
|
159
155
|
SelectOption: () => SelectOption,
|
160
156
|
ShowConditional: () => ShowConditional,
|
161
157
|
SignatureFieldValue: () => SignatureFieldValue,
|
162
158
|
SummaryConfig: () => SummaryConfig,
|
163
159
|
TENNIS_CLUB_MEMBERSHIP: () => TENNIS_CLUB_MEMBERSHIP,
|
164
|
-
TestUserRole: () => TestUserRole,
|
165
160
|
TextValue: () => TextValue,
|
166
161
|
TranslationConfig: () => TranslationConfig,
|
167
162
|
UnassignActionInput: () => UnassignActionInput,
|
@@ -169,10 +164,8 @@ __export(events_exports, {
|
|
169
164
|
UrbanAddressValue: () => UrbanAddressValue,
|
170
165
|
User: () => User,
|
171
166
|
ValidateActionInput: () => ValidateActionInput,
|
172
|
-
ValidationConfig: () => ValidationConfig,
|
173
167
|
VerificationActionConfig: () => VerificationActionConfig,
|
174
168
|
VerificationPageConfig: () => VerificationPageConfig,
|
175
|
-
WRITE_ACTION_SCOPES: () => WRITE_ACTION_SCOPES,
|
176
169
|
Within: () => Within,
|
177
170
|
WorkqueueActionsWithDefault: () => WorkqueueActionsWithDefault,
|
178
171
|
WorkqueueColumn: () => WorkqueueColumn,
|
@@ -181,14 +174,12 @@ __export(events_exports, {
|
|
181
174
|
WorkqueueColumnValue: () => WorkqueueColumnValue,
|
182
175
|
WorkqueueConfig: () => WorkqueueConfig,
|
183
176
|
WorkqueueConfigInput: () => WorkqueueConfigInput,
|
184
|
-
WorkqueueConfigWithoutQuery: () => WorkqueueConfigWithoutQuery,
|
185
177
|
WorkqueueCountInput: () => WorkqueueCountInput,
|
186
178
|
WorkqueueCountOutput: () => WorkqueueCountOutput,
|
187
179
|
ZodDate: () => ZodDate,
|
188
180
|
alwaysTrue: () => alwaysTrue,
|
189
181
|
and: () => and,
|
190
182
|
annotationActions: () => annotationActions,
|
191
|
-
applyDeclarationToEventIndex: () => applyDeclarationToEventIndex,
|
192
183
|
applyDraftsToEventIndex: () => applyDraftsToEventIndex,
|
193
184
|
areConditionsMet: () => areConditionsMet,
|
194
185
|
compositeFieldTypes: () => compositeFieldTypes,
|
@@ -218,6 +209,7 @@ __export(events_exports, {
|
|
218
209
|
eventQueryDataGenerator: () => eventQueryDataGenerator,
|
219
210
|
field: () => field,
|
220
211
|
fieldTypes: () => fieldTypes,
|
212
|
+
filterUnallowedActions: () => filterUnallowedActions,
|
221
213
|
findActiveDrafts: () => findActiveDrafts,
|
222
214
|
findAllFields: () => findAllFields,
|
223
215
|
findLastAssignmentAction: () => findLastAssignmentAction,
|
@@ -229,10 +221,8 @@ __export(events_exports, {
|
|
229
221
|
generateEventDraftDocument: () => generateEventDraftDocument,
|
230
222
|
generateRandomName: () => generateRandomName,
|
231
223
|
generateRandomSignature: () => generateRandomSignature,
|
232
|
-
generateRegistrationNumber: () => generateRegistrationNumber,
|
233
224
|
generateTransactionId: () => generateTransactionId,
|
234
225
|
generateTranslationConfig: () => generateTranslationConfig,
|
235
|
-
generateUuid: () => generateUuid,
|
236
226
|
generateWorkqueues: () => generateWorkqueues,
|
237
227
|
getAcceptedActions: () => getAcceptedActions,
|
238
228
|
getActionAnnotation: () => getActionAnnotation,
|
@@ -308,7 +298,6 @@ __export(events_exports, {
|
|
308
298
|
omitHiddenFields: () => omitHiddenFields,
|
309
299
|
omitHiddenPaginatedFields: () => omitHiddenPaginatedFields,
|
310
300
|
or: () => or,
|
311
|
-
resolveDateOfEvent: () => resolveDateOfEvent,
|
312
301
|
runFieldValidations: () => runFieldValidations,
|
313
302
|
user: () => user,
|
314
303
|
validate: () => validate,
|
@@ -484,8 +473,8 @@ var NameFieldValue = import_zod3.z.object({
|
|
484
473
|
middlename: import_zod3.z.string().optional()
|
485
474
|
});
|
486
475
|
var NameFieldUpdateValue = import_zod3.z.object({
|
487
|
-
firstname: import_zod3.z.string()
|
488
|
-
surname: import_zod3.z.string()
|
476
|
+
firstname: import_zod3.z.string(),
|
477
|
+
surname: import_zod3.z.string(),
|
489
478
|
middlename: import_zod3.z.string().nullish()
|
490
479
|
}).or(import_zod3.z.null()).or(import_zod3.z.undefined());
|
491
480
|
var RuralAddressUpdateValue = AdminStructure.extend({
|
@@ -576,18 +565,18 @@ var FieldReference = import_zod5.z.object({
|
|
576
565
|
$$field: FieldId
|
577
566
|
}).describe("Reference to a field by its ID");
|
578
567
|
var ParentReference = FieldReference.optional();
|
579
|
-
var ValidationConfig = import_zod5.z.object({
|
580
|
-
validator: Conditional,
|
581
|
-
message: TranslationConfig
|
582
|
-
});
|
583
568
|
var BaseField = import_zod5.z.object({
|
584
569
|
id: FieldId,
|
585
570
|
parent: ParentReference,
|
586
571
|
conditionals: import_zod5.z.array(FieldConditional).default([]).optional(),
|
587
572
|
required: import_zod5.z.boolean().default(false).optional(),
|
588
|
-
secured: import_zod5.z.boolean().default(false).optional(),
|
589
573
|
placeholder: TranslationConfig.optional(),
|
590
|
-
validation: import_zod5.z.array(
|
574
|
+
validation: import_zod5.z.array(
|
575
|
+
import_zod5.z.object({
|
576
|
+
validator: Conditional,
|
577
|
+
message: TranslationConfig
|
578
|
+
})
|
579
|
+
).default([]).optional(),
|
591
580
|
label: TranslationConfig,
|
592
581
|
helperText: TranslationConfig.optional(),
|
593
582
|
hideLabel: import_zod5.z.boolean().default(false).optional()
|
@@ -751,9 +740,7 @@ var NameField = BaseField.extend({
|
|
751
740
|
configuration: import_zod5.z.object({
|
752
741
|
maxLength: import_zod5.z.number().optional().describe("Maximum length of the text"),
|
753
742
|
prefix: TranslationConfig.optional(),
|
754
|
-
postfix: TranslationConfig.optional()
|
755
|
-
includeMiddlename: import_zod5.z.boolean().default(false).optional().describe("To make middle name visible in Name form field"),
|
756
|
-
searchMode: import_zod5.z.boolean().optional()
|
743
|
+
postfix: TranslationConfig.optional()
|
757
744
|
}).optional()
|
758
745
|
}).describe("Name input field");
|
759
746
|
var PhoneField = BaseField.extend({
|
@@ -1159,7 +1146,7 @@ var LanguageConfig = import_zod11.z.object({
|
|
1159
1146
|
});
|
1160
1147
|
|
1161
1148
|
// ../commons/src/events/EventConfig.ts
|
1162
|
-
var
|
1149
|
+
var import_zod18 = require("zod");
|
1163
1150
|
|
1164
1151
|
// ../commons/src/events/DeduplicationConfig.ts
|
1165
1152
|
var import_zod12 = require("zod");
|
@@ -1298,9 +1285,6 @@ var BaseField3 = import_zod14.z.object({
|
|
1298
1285
|
'conditionals' to an empty array ('[]') in the search config. This ensures they
|
1299
1286
|
are always rendered in the advanced search form.
|
1300
1287
|
`
|
1301
|
-
),
|
1302
|
-
validations: import_zod14.z.array(ValidationConfig).default([]).optional().describe(
|
1303
|
-
`In advanced search, we sometimes need to override the default field validations.`
|
1304
1288
|
)
|
1305
1289
|
});
|
1306
1290
|
var SearchQueryParams = import_zod14.z.object({
|
@@ -1336,7 +1320,7 @@ var AdvancedSearchConfig = import_zod14.z.object({
|
|
1336
1320
|
var import_lodash = require("lodash");
|
1337
1321
|
|
1338
1322
|
// ../commons/src/events/ActionDocument.ts
|
1339
|
-
var
|
1323
|
+
var import_zod16 = require("zod");
|
1340
1324
|
var import_zod_openapi7 = require("zod-openapi");
|
1341
1325
|
|
1342
1326
|
// ../commons/src/uuid.ts
|
@@ -1350,554 +1334,120 @@ function getUUID() {
|
|
1350
1334
|
// ../commons/src/events/CreatedAtLocation.ts
|
1351
1335
|
var CreatedAtLocation = UUID.nullish();
|
1352
1336
|
|
1353
|
-
// ../commons/src/authentication.ts
|
1354
|
-
var import_jwt_decode = __toESM(require("jwt-decode"));
|
1355
|
-
var import_zod17 = require("zod");
|
1356
|
-
|
1357
|
-
// ../commons/src/scopes.ts
|
1358
|
-
var import_zod16 = require("zod");
|
1359
|
-
var SCOPES = {
|
1360
|
-
// TODO v1.8 legacy scopes
|
1361
|
-
NATLSYSADMIN: "natlsysadmin",
|
1362
|
-
BYPASSRATELIMIT: "bypassratelimit",
|
1363
|
-
DECLARE: "declare",
|
1364
|
-
REGISTER: "register",
|
1365
|
-
VALIDATE: "validate",
|
1366
|
-
DEMO: "demo",
|
1367
|
-
CERTIFY: "certify",
|
1368
|
-
PERFORMANCE: "performance",
|
1369
|
-
SYSADMIN: "sysadmin",
|
1370
|
-
TEAMS: "teams",
|
1371
|
-
CONFIG: "config",
|
1372
|
-
// systems / integrations
|
1373
|
-
WEBHOOK: "webhook",
|
1374
|
-
NATIONALID: "nationalId",
|
1375
|
-
NOTIFICATION_API: "notification-api",
|
1376
|
-
RECORDSEARCH: "recordsearch",
|
1377
|
-
/**
|
1378
|
-
* @TODO This is a temporary scope to be used for V2 Events custom events declaration
|
1379
|
-
*/
|
1380
|
-
RECORD_DECLARE: "record.declare-birth",
|
1381
|
-
// declare
|
1382
|
-
RECORD_IMPORT: "record.import",
|
1383
|
-
// declare
|
1384
|
-
RECORD_DECLARE_BIRTH: "record.declare-birth",
|
1385
|
-
RECORD_DECLARE_BIRTH_MY_JURISDICTION: "record.declare-birth:my-jurisdiction",
|
1386
|
-
RECORD_DECLARE_DEATH: "record.declare-death",
|
1387
|
-
RECORD_DECLARE_DEATH_MY_JURISDICTION: "record.declare-death:my-jurisdiction",
|
1388
|
-
RECORD_DECLARE_MARRIAGE: "record.declare-marriage",
|
1389
|
-
RECORD_DECLARE_MARRIAGE_MY_JURISDICTION: "record.declare-marriage:my-jurisdiction",
|
1390
|
-
RECORD_SUBMIT_INCOMPLETE: "record.declaration-submit-incomplete",
|
1391
|
-
RECORD_SUBMIT_FOR_REVIEW: "record.declaration-submit-for-review",
|
1392
|
-
RECORD_UNASSIGN_OTHERS: "record.unassign-others",
|
1393
|
-
// validate
|
1394
|
-
RECORD_SUBMIT_FOR_APPROVAL: "record.declaration-submit-for-approval",
|
1395
|
-
RECORD_SUBMIT_FOR_UPDATES: "record.declaration-submit-for-updates",
|
1396
|
-
RECORD_DECLARATION_EDIT: "record.declaration-edit",
|
1397
|
-
RECORD_REVIEW_DUPLICATES: "record.review-duplicates",
|
1398
|
-
RECORD_DECLARATION_ARCHIVE: "record.declaration-archive",
|
1399
|
-
RECORD_DECLARATION_REINSTATE: "record.declaration-reinstate",
|
1400
|
-
// register
|
1401
|
-
RECORD_REGISTER: "record.register",
|
1402
|
-
// certify
|
1403
|
-
RECORD_EXPORT_RECORDS: "record.export-records",
|
1404
|
-
RECORD_DECLARATION_PRINT: "record.declaration-print",
|
1405
|
-
RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS: "record.declaration-print-supporting-documents",
|
1406
|
-
RECORD_REGISTRATION_PRINT: "record.registration-print",
|
1407
|
-
// v1.8
|
1408
|
-
/**
|
1409
|
-
* This scope is used to **print and **issue certified copies of a record
|
1410
|
-
* after it has been registered. Previously Registrars had this permission.
|
1411
|
-
*/
|
1412
|
-
RECORD_PRINT_ISSUE_CERTIFIED_COPIES: "record.registration-print&issue-certified-copies",
|
1413
|
-
RECORD_PRINT_CERTIFIED_COPIES: "record.registration-print-certified-copies",
|
1414
|
-
// v1.8
|
1415
|
-
RECORD_BULK_PRINT_CERTIFIED_COPIES: "record.registration-bulk-print-certified-copies",
|
1416
|
-
// v1.8
|
1417
|
-
RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES: "record.registration-verify-certified-copies",
|
1418
|
-
// v1.8
|
1419
|
-
// correct
|
1420
|
-
RECORD_REGISTRATION_REQUEST_CORRECTION: "record.registration-request-correction",
|
1421
|
-
RECORD_REGISTRATION_CORRECT: "record.registration-correct",
|
1422
|
-
RECORD_REGISTRATION_REQUEST_REVOCATION: "record.registration-request-revocation",
|
1423
|
-
// v1.8
|
1424
|
-
RECORD_REGISTRATION_REVOKE: "record.registration-revoke",
|
1425
|
-
// v1.8
|
1426
|
-
RECORD_REGISTRATION_REQUEST_REINSTATEMENT: "record.registration-request-reinstatement",
|
1427
|
-
// v1.8
|
1428
|
-
RECORD_REGISTRATION_REINSTATE: "record.registration-reinstate",
|
1429
|
-
// v1.8
|
1430
|
-
RECORD_CONFIRM_REGISTRATION: "record.confirm-registration",
|
1431
|
-
RECORD_REJECT_REGISTRATION: "record.reject-registration",
|
1432
|
-
// search
|
1433
|
-
SEARCH_BIRTH_MY_JURISDICTION: "search.birth:my-jurisdiction",
|
1434
|
-
SEARCH_BIRTH: "search.birth",
|
1435
|
-
SEARCH_DEATH_MY_JURISDICTION: "search.death:my-jurisdiction",
|
1436
|
-
SEARCH_DEATH: "search.death",
|
1437
|
-
SEARCH_MARRIAGE_MY_JURISDICTION: "search.marriage:my-jurisdiction",
|
1438
|
-
SEARCH_MARRIAGE: "search.marriage",
|
1439
|
-
// audit v1.8
|
1440
|
-
RECORD_READ: "record.read",
|
1441
|
-
RECORD_READ_AUDIT: "record.read-audit",
|
1442
|
-
RECORD_READ_COMMENTS: "record.read-comments",
|
1443
|
-
RECORD_CREATE_COMMENTS: "record.create-comments",
|
1444
|
-
// profile
|
1445
|
-
PROFILE_UPDATE: "profile.update",
|
1446
|
-
//v1.8
|
1447
|
-
PROFILE_ELECTRONIC_SIGNATURE: "profile.electronic-signature",
|
1448
|
-
// performance
|
1449
|
-
PERFORMANCE_READ: "performance.read",
|
1450
|
-
PERFORMANCE_READ_DASHBOARDS: "performance.read-dashboards",
|
1451
|
-
PERFORMANCE_EXPORT_VITAL_STATISTICS: "performance.vital-statistics-export",
|
1452
|
-
// organisation
|
1453
|
-
ORGANISATION_READ_LOCATIONS: "organisation.read-locations:all",
|
1454
|
-
ORGANISATION_READ_LOCATIONS_MY_OFFICE: "organisation.read-locations:my-office",
|
1455
|
-
ORGANISATION_READ_LOCATIONS_MY_JURISDICTION: "organisation.read-locations:my-jurisdiction",
|
1456
|
-
// user
|
1457
|
-
USER_READ: "user.read:all",
|
1458
|
-
USER_READ_MY_OFFICE: "user.read:my-office",
|
1459
|
-
USER_READ_MY_JURISDICTION: "user.read:my-jurisdiction",
|
1460
|
-
USER_READ_ONLY_MY_AUDIT: "user.read:only-my-audit",
|
1461
|
-
//v1.8
|
1462
|
-
USER_CREATE: "user.create:all",
|
1463
|
-
USER_CREATE_MY_JURISDICTION: "user.create:my-jurisdiction",
|
1464
|
-
USER_UPDATE: "user.update:all",
|
1465
|
-
USER_UPDATE_MY_JURISDICTION: "user.update:my-jurisdiction",
|
1466
|
-
// config
|
1467
|
-
CONFIG_UPDATE_ALL: "config.update:all",
|
1468
|
-
// data seeding
|
1469
|
-
USER_DATA_SEEDING: "user.data-seeding"
|
1470
|
-
};
|
1471
|
-
var LegacyScopes = import_zod16.z.union([
|
1472
|
-
import_zod16.z.literal(SCOPES.NATLSYSADMIN),
|
1473
|
-
import_zod16.z.literal(SCOPES.BYPASSRATELIMIT),
|
1474
|
-
import_zod16.z.literal(SCOPES.DECLARE),
|
1475
|
-
import_zod16.z.literal(SCOPES.REGISTER),
|
1476
|
-
import_zod16.z.literal(SCOPES.VALIDATE),
|
1477
|
-
import_zod16.z.literal(SCOPES.DEMO),
|
1478
|
-
import_zod16.z.literal(SCOPES.CERTIFY),
|
1479
|
-
import_zod16.z.literal(SCOPES.PERFORMANCE),
|
1480
|
-
import_zod16.z.literal(SCOPES.SYSADMIN),
|
1481
|
-
import_zod16.z.literal(SCOPES.TEAMS),
|
1482
|
-
import_zod16.z.literal(SCOPES.CONFIG)
|
1483
|
-
]);
|
1484
|
-
var IntegrationScopes = import_zod16.z.union([
|
1485
|
-
import_zod16.z.literal(SCOPES.WEBHOOK),
|
1486
|
-
import_zod16.z.literal(SCOPES.NATIONALID),
|
1487
|
-
import_zod16.z.literal(SCOPES.NOTIFICATION_API),
|
1488
|
-
import_zod16.z.literal(SCOPES.RECORDSEARCH)
|
1489
|
-
]);
|
1490
|
-
var DeclareScopes = import_zod16.z.union([
|
1491
|
-
import_zod16.z.literal(SCOPES.RECORD_DECLARE),
|
1492
|
-
import_zod16.z.literal(SCOPES.RECORD_IMPORT),
|
1493
|
-
import_zod16.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
|
1494
|
-
import_zod16.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
|
1495
|
-
import_zod16.z.literal(SCOPES.RECORD_DECLARE_DEATH),
|
1496
|
-
import_zod16.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
|
1497
|
-
import_zod16.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
|
1498
|
-
import_zod16.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
|
1499
|
-
import_zod16.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
|
1500
|
-
import_zod16.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW)
|
1501
|
-
]);
|
1502
|
-
var UnassignScope = import_zod16.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS);
|
1503
|
-
var ValidateScopes = import_zod16.z.union([
|
1504
|
-
import_zod16.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
|
1505
|
-
import_zod16.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
|
1506
|
-
import_zod16.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
|
1507
|
-
import_zod16.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
|
1508
|
-
import_zod16.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
|
1509
|
-
import_zod16.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE)
|
1510
|
-
]);
|
1511
|
-
var RegisterScope = import_zod16.z.literal(SCOPES.RECORD_REGISTER);
|
1512
|
-
var CertifyScopes = import_zod16.z.union([
|
1513
|
-
import_zod16.z.literal(SCOPES.RECORD_EXPORT_RECORDS),
|
1514
|
-
import_zod16.z.literal(SCOPES.RECORD_DECLARATION_PRINT),
|
1515
|
-
import_zod16.z.literal(SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS),
|
1516
|
-
import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_PRINT),
|
1517
|
-
import_zod16.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
|
1518
|
-
import_zod16.z.literal(SCOPES.RECORD_PRINT_CERTIFIED_COPIES),
|
1519
|
-
import_zod16.z.literal(SCOPES.RECORD_BULK_PRINT_CERTIFIED_COPIES),
|
1520
|
-
import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES)
|
1521
|
-
]);
|
1522
|
-
var CorrectionScopes = import_zod16.z.union([
|
1523
|
-
import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
|
1524
|
-
import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
|
1525
|
-
import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REVOCATION),
|
1526
|
-
import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REVOKE),
|
1527
|
-
import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REINSTATEMENT),
|
1528
|
-
import_zod16.z.literal(SCOPES.RECORD_REGISTRATION_REINSTATE),
|
1529
|
-
import_zod16.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
|
1530
|
-
import_zod16.z.literal(SCOPES.RECORD_REJECT_REGISTRATION)
|
1531
|
-
]);
|
1532
|
-
var SearchScopes = import_zod16.z.union([
|
1533
|
-
import_zod16.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
|
1534
|
-
import_zod16.z.literal(SCOPES.SEARCH_BIRTH),
|
1535
|
-
import_zod16.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
|
1536
|
-
import_zod16.z.literal(SCOPES.SEARCH_DEATH),
|
1537
|
-
import_zod16.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
|
1538
|
-
import_zod16.z.literal(SCOPES.SEARCH_MARRIAGE)
|
1539
|
-
]);
|
1540
|
-
var AuditScopes = import_zod16.z.union([
|
1541
|
-
import_zod16.z.literal(SCOPES.RECORD_READ),
|
1542
|
-
import_zod16.z.literal(SCOPES.RECORD_READ_AUDIT),
|
1543
|
-
import_zod16.z.literal(SCOPES.RECORD_READ_COMMENTS),
|
1544
|
-
import_zod16.z.literal(SCOPES.RECORD_CREATE_COMMENTS)
|
1545
|
-
]);
|
1546
|
-
var ProfileScopes = import_zod16.z.union([
|
1547
|
-
import_zod16.z.literal(SCOPES.PROFILE_UPDATE),
|
1548
|
-
import_zod16.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE)
|
1549
|
-
]);
|
1550
|
-
var PerformanceScopes = import_zod16.z.union([
|
1551
|
-
import_zod16.z.literal(SCOPES.PERFORMANCE_READ),
|
1552
|
-
import_zod16.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
|
1553
|
-
import_zod16.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS)
|
1554
|
-
]);
|
1555
|
-
var OrganisationScopes = import_zod16.z.union([
|
1556
|
-
import_zod16.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
|
1557
|
-
import_zod16.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
|
1558
|
-
import_zod16.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION)
|
1559
|
-
]);
|
1560
|
-
var UserScopes = import_zod16.z.union([
|
1561
|
-
import_zod16.z.literal(SCOPES.USER_READ),
|
1562
|
-
import_zod16.z.literal(SCOPES.USER_READ_MY_OFFICE),
|
1563
|
-
import_zod16.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
|
1564
|
-
import_zod16.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
|
1565
|
-
import_zod16.z.literal(SCOPES.USER_CREATE),
|
1566
|
-
import_zod16.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
|
1567
|
-
import_zod16.z.literal(SCOPES.USER_UPDATE),
|
1568
|
-
import_zod16.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION)
|
1569
|
-
]);
|
1570
|
-
var ConfigScope = import_zod16.z.literal(SCOPES.CONFIG_UPDATE_ALL);
|
1571
|
-
var DataSeedingScope = import_zod16.z.literal(SCOPES.USER_DATA_SEEDING);
|
1572
|
-
var LiteralScopes = import_zod16.z.union([
|
1573
|
-
LegacyScopes,
|
1574
|
-
IntegrationScopes,
|
1575
|
-
UnassignScope,
|
1576
|
-
DeclareScopes,
|
1577
|
-
ValidateScopes,
|
1578
|
-
RegisterScope,
|
1579
|
-
CertifyScopes,
|
1580
|
-
CorrectionScopes,
|
1581
|
-
SearchScopes,
|
1582
|
-
AuditScopes,
|
1583
|
-
ProfileScopes,
|
1584
|
-
PerformanceScopes,
|
1585
|
-
OrganisationScopes,
|
1586
|
-
UserScopes,
|
1587
|
-
ConfigScope,
|
1588
|
-
DataSeedingScope
|
1589
|
-
]);
|
1590
|
-
var rawConfigurableScopeRegex = /^([a-zA-Z\.]+)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
|
1591
|
-
var rawConfigurableScope = import_zod16.z.string().regex(rawConfigurableScopeRegex);
|
1592
|
-
var CreateUserScope = import_zod16.z.object({
|
1593
|
-
type: import_zod16.z.literal("user.create"),
|
1594
|
-
options: import_zod16.z.object({
|
1595
|
-
role: import_zod16.z.array(import_zod16.z.string())
|
1596
|
-
})
|
1597
|
-
});
|
1598
|
-
var EditUserScope = import_zod16.z.object({
|
1599
|
-
type: import_zod16.z.literal("user.edit"),
|
1600
|
-
options: import_zod16.z.object({
|
1601
|
-
role: import_zod16.z.array(import_zod16.z.string())
|
1602
|
-
})
|
1603
|
-
});
|
1604
|
-
var WorkqueueScope = import_zod16.z.object({
|
1605
|
-
type: import_zod16.z.literal("workqueue"),
|
1606
|
-
options: import_zod16.z.object({
|
1607
|
-
id: import_zod16.z.array(import_zod16.z.string())
|
1608
|
-
})
|
1609
|
-
});
|
1610
|
-
var NotifyRecordScope = import_zod16.z.object({
|
1611
|
-
type: import_zod16.z.literal("record.notify"),
|
1612
|
-
options: import_zod16.z.object({
|
1613
|
-
event: import_zod16.z.array(import_zod16.z.string())
|
1614
|
-
})
|
1615
|
-
});
|
1616
|
-
var SearchScope = import_zod16.z.object({
|
1617
|
-
type: import_zod16.z.literal("search"),
|
1618
|
-
options: import_zod16.z.object({
|
1619
|
-
event: import_zod16.z.array(import_zod16.z.string()).length(1),
|
1620
|
-
access: import_zod16.z.array(import_zod16.z.enum(["my-jurisdiction", "all"])).length(1)
|
1621
|
-
})
|
1622
|
-
});
|
1623
|
-
var ConfigurableRawScopes = import_zod16.z.discriminatedUnion("type", [
|
1624
|
-
SearchScope,
|
1625
|
-
CreateUserScope,
|
1626
|
-
EditUserScope,
|
1627
|
-
WorkqueueScope,
|
1628
|
-
NotifyRecordScope
|
1629
|
-
]);
|
1630
|
-
var scopes = Object.values(SCOPES);
|
1631
|
-
var ActionScopes = import_zod16.z.union([
|
1632
|
-
DeclareScopes,
|
1633
|
-
ValidateScopes,
|
1634
|
-
RegisterScope,
|
1635
|
-
CertifyScopes,
|
1636
|
-
CorrectionScopes
|
1637
|
-
]);
|
1638
|
-
|
1639
|
-
// ../commons/src/authentication.ts
|
1640
|
-
var DEFAULT_ROLES_DEFINITION = [
|
1641
|
-
{
|
1642
|
-
id: "FIELD_AGENT",
|
1643
|
-
label: {
|
1644
|
-
defaultMessage: "Field Agent",
|
1645
|
-
description: "Name for user role Field Agent",
|
1646
|
-
id: "userRole.fieldAgent"
|
1647
|
-
},
|
1648
|
-
scopes: [
|
1649
|
-
// new scopes
|
1650
|
-
SCOPES.RECORD_DECLARE_BIRTH,
|
1651
|
-
SCOPES.RECORD_DECLARE_DEATH,
|
1652
|
-
SCOPES.RECORD_DECLARE_MARRIAGE,
|
1653
|
-
SCOPES.RECORD_SUBMIT_INCOMPLETE,
|
1654
|
-
SCOPES.RECORD_SUBMIT_FOR_REVIEW,
|
1655
|
-
SCOPES.SEARCH_BIRTH,
|
1656
|
-
SCOPES.SEARCH_DEATH,
|
1657
|
-
SCOPES.SEARCH_MARRIAGE
|
1658
|
-
]
|
1659
|
-
},
|
1660
|
-
{
|
1661
|
-
id: "REGISTRATION_AGENT",
|
1662
|
-
label: {
|
1663
|
-
defaultMessage: "Registration Agent",
|
1664
|
-
description: "Name for user role Registration Agent",
|
1665
|
-
id: "userRole.registrationAgent"
|
1666
|
-
},
|
1667
|
-
scopes: [
|
1668
|
-
SCOPES.PERFORMANCE,
|
1669
|
-
SCOPES.CERTIFY,
|
1670
|
-
SCOPES.RECORD_DECLARE_BIRTH,
|
1671
|
-
SCOPES.RECORD_DECLARE_DEATH,
|
1672
|
-
SCOPES.RECORD_DECLARE_MARRIAGE,
|
1673
|
-
SCOPES.RECORD_SUBMIT_FOR_APPROVAL,
|
1674
|
-
SCOPES.RECORD_SUBMIT_FOR_UPDATES,
|
1675
|
-
SCOPES.RECORD_DECLARATION_ARCHIVE,
|
1676
|
-
SCOPES.RECORD_DECLARATION_REINSTATE,
|
1677
|
-
SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION,
|
1678
|
-
SCOPES.RECORD_REGISTRATION_PRINT,
|
1679
|
-
SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS,
|
1680
|
-
SCOPES.RECORD_EXPORT_RECORDS,
|
1681
|
-
SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES,
|
1682
|
-
SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES,
|
1683
|
-
SCOPES.RECORD_CREATE_COMMENTS,
|
1684
|
-
SCOPES.PERFORMANCE_READ,
|
1685
|
-
SCOPES.PERFORMANCE_READ_DASHBOARDS,
|
1686
|
-
SCOPES.ORGANISATION_READ_LOCATIONS,
|
1687
|
-
SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE,
|
1688
|
-
SCOPES.SEARCH_BIRTH,
|
1689
|
-
SCOPES.SEARCH_DEATH,
|
1690
|
-
SCOPES.SEARCH_MARRIAGE
|
1691
|
-
]
|
1692
|
-
},
|
1693
|
-
{
|
1694
|
-
id: "LOCAL_REGISTRAR",
|
1695
|
-
label: {
|
1696
|
-
defaultMessage: "Local Registrar",
|
1697
|
-
description: "Name for user role Local Registrar",
|
1698
|
-
id: "userRole.localRegistrar"
|
1699
|
-
},
|
1700
|
-
scopes: [
|
1701
|
-
SCOPES.PERFORMANCE,
|
1702
|
-
SCOPES.CERTIFY,
|
1703
|
-
SCOPES.RECORD_DECLARE_BIRTH,
|
1704
|
-
SCOPES.RECORD_DECLARE_DEATH,
|
1705
|
-
SCOPES.RECORD_DECLARE_MARRIAGE,
|
1706
|
-
SCOPES.RECORD_SUBMIT_FOR_UPDATES,
|
1707
|
-
SCOPES.RECORD_REVIEW_DUPLICATES,
|
1708
|
-
SCOPES.RECORD_DECLARATION_ARCHIVE,
|
1709
|
-
SCOPES.RECORD_DECLARATION_REINSTATE,
|
1710
|
-
SCOPES.RECORD_REGISTER,
|
1711
|
-
SCOPES.RECORD_REGISTRATION_CORRECT,
|
1712
|
-
SCOPES.RECORD_REGISTRATION_PRINT,
|
1713
|
-
SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS,
|
1714
|
-
SCOPES.RECORD_EXPORT_RECORDS,
|
1715
|
-
SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES,
|
1716
|
-
SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES,
|
1717
|
-
SCOPES.RECORD_CREATE_COMMENTS,
|
1718
|
-
SCOPES.PERFORMANCE_READ,
|
1719
|
-
SCOPES.PERFORMANCE_READ_DASHBOARDS,
|
1720
|
-
SCOPES.ORGANISATION_READ_LOCATIONS,
|
1721
|
-
SCOPES.PROFILE_ELECTRONIC_SIGNATURE,
|
1722
|
-
SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE,
|
1723
|
-
SCOPES.SEARCH_BIRTH,
|
1724
|
-
SCOPES.SEARCH_DEATH,
|
1725
|
-
SCOPES.SEARCH_MARRIAGE
|
1726
|
-
]
|
1727
|
-
},
|
1728
|
-
{
|
1729
|
-
id: "LOCAL_SYSTEM_ADMIN",
|
1730
|
-
label: {
|
1731
|
-
defaultMessage: "Local System Admin",
|
1732
|
-
description: "Name for user role Local System Admin",
|
1733
|
-
id: "userRole.localSystemAdmin"
|
1734
|
-
},
|
1735
|
-
scopes: [
|
1736
|
-
SCOPES.SYSADMIN,
|
1737
|
-
SCOPES.USER_READ_MY_OFFICE,
|
1738
|
-
SCOPES.USER_CREATE_MY_JURISDICTION,
|
1739
|
-
SCOPES.USER_UPDATE_MY_JURISDICTION,
|
1740
|
-
SCOPES.ORGANISATION_READ_LOCATIONS,
|
1741
|
-
SCOPES.PERFORMANCE_READ,
|
1742
|
-
SCOPES.PERFORMANCE_READ_DASHBOARDS,
|
1743
|
-
SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS
|
1744
|
-
// 'organisation.read-users' ?
|
1745
|
-
]
|
1746
|
-
},
|
1747
|
-
{
|
1748
|
-
id: "NATIONAL_SYSTEM_ADMIN",
|
1749
|
-
label: {
|
1750
|
-
defaultMessage: "National System Admin",
|
1751
|
-
description: "Name for user role National System Admin",
|
1752
|
-
id: "userRole.nationalSystemAdmin"
|
1753
|
-
},
|
1754
|
-
scopes: [
|
1755
|
-
SCOPES.SYSADMIN,
|
1756
|
-
SCOPES.NATLSYSADMIN,
|
1757
|
-
SCOPES.USER_CREATE,
|
1758
|
-
SCOPES.USER_READ,
|
1759
|
-
SCOPES.USER_UPDATE,
|
1760
|
-
SCOPES.ORGANISATION_READ_LOCATIONS,
|
1761
|
-
SCOPES.PERFORMANCE_READ,
|
1762
|
-
SCOPES.PERFORMANCE_READ_DASHBOARDS,
|
1763
|
-
SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS
|
1764
|
-
// 'organisation.read-users' ?
|
1765
|
-
]
|
1766
|
-
},
|
1767
|
-
{
|
1768
|
-
id: "PERFORMANCE_MANAGER",
|
1769
|
-
label: {
|
1770
|
-
defaultMessage: "Performance Manager",
|
1771
|
-
description: "Name for user role Performance Manager",
|
1772
|
-
id: "userRole.performanceManager"
|
1773
|
-
},
|
1774
|
-
scopes: [
|
1775
|
-
SCOPES.PERFORMANCE,
|
1776
|
-
SCOPES.PERFORMANCE_READ,
|
1777
|
-
SCOPES.PERFORMANCE_READ_DASHBOARDS,
|
1778
|
-
SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS
|
1779
|
-
]
|
1780
|
-
}
|
1781
|
-
];
|
1782
|
-
var TokenUserType = import_zod17.z.enum(["user", "system"]);
|
1783
|
-
var TokenWithBearer = import_zod17.z.string().regex(/^Bearer\s/);
|
1784
|
-
|
1785
1337
|
// ../commons/src/events/ActionDocument.ts
|
1786
|
-
(0, import_zod_openapi7.extendZodWithOpenApi)(
|
1787
|
-
var ActionUpdate =
|
1788
|
-
var EventState =
|
1338
|
+
(0, import_zod_openapi7.extendZodWithOpenApi)(import_zod16.z);
|
1339
|
+
var ActionUpdate = import_zod16.z.record(import_zod16.z.string(), FieldUpdateValue);
|
1340
|
+
var EventState = import_zod16.z.record(import_zod16.z.string(), FieldValue);
|
1789
1341
|
var ActionStatus = {
|
1790
1342
|
Requested: "Requested",
|
1791
1343
|
Accepted: "Accepted",
|
1792
1344
|
Rejected: "Rejected"
|
1793
1345
|
};
|
1794
|
-
var ActionBase =
|
1346
|
+
var ActionBase = import_zod16.z.object({
|
1795
1347
|
id: UUID,
|
1796
|
-
transactionId:
|
1797
|
-
|
1798
|
-
|
1799
|
-
|
1800
|
-
|
1801
|
-
createdBySignature: import_zod18.z.string().nullish().describe("Reference to signature of the user who created the action"),
|
1348
|
+
transactionId: import_zod16.z.string(),
|
1349
|
+
createdAt: import_zod16.z.string().datetime(),
|
1350
|
+
createdBy: import_zod16.z.string(),
|
1351
|
+
createdByRole: import_zod16.z.string(),
|
1352
|
+
createdBySignature: import_zod16.z.string().nullish().describe("Reference to signature of the user who created the action"),
|
1802
1353
|
createdAtLocation: CreatedAtLocation,
|
1803
1354
|
declaration: ActionUpdate,
|
1804
1355
|
annotation: ActionUpdate.optional().nullable(),
|
1805
|
-
status:
|
1356
|
+
status: import_zod16.z.enum([
|
1806
1357
|
ActionStatus.Requested,
|
1807
1358
|
ActionStatus.Accepted,
|
1808
1359
|
ActionStatus.Rejected
|
1809
1360
|
]),
|
1810
1361
|
// If the action is an asynchronous confirmation for another action, we will save the original action id here.
|
1811
|
-
originalActionId: UUID.optional().nullable()
|
1812
|
-
"Reference to the original action that was asynchronously rejected or accepted by 3rd party integration."
|
1813
|
-
)
|
1362
|
+
originalActionId: UUID.optional().nullable()
|
1814
1363
|
});
|
1815
1364
|
var AssignedAction = ActionBase.merge(
|
1816
|
-
|
1817
|
-
type:
|
1818
|
-
assignedTo:
|
1365
|
+
import_zod16.z.object({
|
1366
|
+
type: import_zod16.z.literal(ActionType.ASSIGN),
|
1367
|
+
assignedTo: import_zod16.z.string()
|
1819
1368
|
})
|
1820
1369
|
);
|
1821
1370
|
var UnassignedAction = ActionBase.merge(
|
1822
|
-
|
1823
|
-
type:
|
1371
|
+
import_zod16.z.object({
|
1372
|
+
type: import_zod16.z.literal(ActionType.UNASSIGN),
|
1373
|
+
assignedTo: import_zod16.z.literal(null)
|
1824
1374
|
})
|
1825
1375
|
);
|
1826
1376
|
var RegisterAction = ActionBase.merge(
|
1827
|
-
|
1828
|
-
type:
|
1829
|
-
registrationNumber:
|
1377
|
+
import_zod16.z.object({
|
1378
|
+
type: import_zod16.z.literal(ActionType.REGISTER),
|
1379
|
+
registrationNumber: import_zod16.z.string().optional()
|
1830
1380
|
})
|
1831
1381
|
);
|
1832
1382
|
var DeclareAction = ActionBase.merge(
|
1833
|
-
|
1834
|
-
type:
|
1383
|
+
import_zod16.z.object({
|
1384
|
+
type: import_zod16.z.literal(ActionType.DECLARE)
|
1835
1385
|
})
|
1836
1386
|
);
|
1837
1387
|
var ValidateAction = ActionBase.merge(
|
1838
|
-
|
1839
|
-
type:
|
1388
|
+
import_zod16.z.object({
|
1389
|
+
type: import_zod16.z.literal(ActionType.VALIDATE)
|
1840
1390
|
})
|
1841
1391
|
);
|
1842
|
-
var RejectionReason =
|
1843
|
-
message:
|
1844
|
-
isDuplicate:
|
1392
|
+
var RejectionReason = import_zod16.z.object({
|
1393
|
+
message: import_zod16.z.string().min(1, { message: "Message cannot be empty" }).describe("Message describing reason for rejection or archiving"),
|
1394
|
+
isDuplicate: import_zod16.z.boolean().optional().describe("If a declaration is duplicated")
|
1845
1395
|
});
|
1846
1396
|
var RejectAction = ActionBase.merge(
|
1847
|
-
|
1848
|
-
type:
|
1397
|
+
import_zod16.z.object({
|
1398
|
+
type: import_zod16.z.literal(ActionType.REJECT),
|
1849
1399
|
reason: RejectionReason
|
1850
1400
|
})
|
1851
1401
|
);
|
1852
1402
|
var MarkAsDuplicateAction = ActionBase.merge(
|
1853
|
-
|
1854
|
-
type:
|
1403
|
+
import_zod16.z.object({
|
1404
|
+
type: import_zod16.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1855
1405
|
})
|
1856
1406
|
);
|
1857
1407
|
var ArchiveAction = ActionBase.merge(
|
1858
|
-
|
1859
|
-
type:
|
1408
|
+
import_zod16.z.object({
|
1409
|
+
type: import_zod16.z.literal(ActionType.ARCHIVE),
|
1860
1410
|
reason: RejectionReason
|
1861
1411
|
})
|
1862
1412
|
);
|
1863
1413
|
var CreatedAction = ActionBase.merge(
|
1864
|
-
|
1865
|
-
type:
|
1414
|
+
import_zod16.z.object({
|
1415
|
+
type: import_zod16.z.literal(ActionType.CREATE)
|
1866
1416
|
})
|
1867
1417
|
);
|
1868
1418
|
var NotifiedAction = ActionBase.merge(
|
1869
|
-
|
1870
|
-
type:
|
1419
|
+
import_zod16.z.object({
|
1420
|
+
type: import_zod16.z.literal(ActionType.NOTIFY)
|
1871
1421
|
})
|
1872
1422
|
);
|
1873
1423
|
var PrintCertificateAction = ActionBase.merge(
|
1874
|
-
|
1875
|
-
type:
|
1424
|
+
import_zod16.z.object({
|
1425
|
+
type: import_zod16.z.literal(ActionType.PRINT_CERTIFICATE)
|
1876
1426
|
})
|
1877
1427
|
);
|
1878
1428
|
var RequestedCorrectionAction = ActionBase.merge(
|
1879
|
-
|
1880
|
-
type:
|
1429
|
+
import_zod16.z.object({
|
1430
|
+
type: import_zod16.z.literal(ActionType.REQUEST_CORRECTION)
|
1881
1431
|
})
|
1882
1432
|
);
|
1883
1433
|
var ApprovedCorrectionAction = ActionBase.merge(
|
1884
|
-
|
1885
|
-
type:
|
1886
|
-
requestId:
|
1434
|
+
import_zod16.z.object({
|
1435
|
+
type: import_zod16.z.literal(ActionType.APPROVE_CORRECTION),
|
1436
|
+
requestId: import_zod16.z.string()
|
1887
1437
|
})
|
1888
1438
|
);
|
1889
1439
|
var RejectedCorrectionAction = ActionBase.merge(
|
1890
|
-
|
1891
|
-
type:
|
1892
|
-
requestId:
|
1440
|
+
import_zod16.z.object({
|
1441
|
+
type: import_zod16.z.literal(ActionType.REJECT_CORRECTION),
|
1442
|
+
requestId: import_zod16.z.string()
|
1893
1443
|
})
|
1894
1444
|
);
|
1895
1445
|
var ReadAction = ActionBase.merge(
|
1896
|
-
|
1897
|
-
type:
|
1446
|
+
import_zod16.z.object({
|
1447
|
+
type: import_zod16.z.literal(ActionType.READ)
|
1898
1448
|
})
|
1899
1449
|
);
|
1900
|
-
var ActionDocument =
|
1450
|
+
var ActionDocument = import_zod16.z.discriminatedUnion("type", [
|
1901
1451
|
CreatedAction.openapi({ ref: "CreatedAction" }),
|
1902
1452
|
ValidateAction.openapi({ ref: "ValidateAction" }),
|
1903
1453
|
RejectAction.openapi({ ref: "RejectAction" }),
|
@@ -1920,20 +1470,20 @@ var AsyncRejectActionDocument = ActionBase.omit({
|
|
1920
1470
|
declaration: true,
|
1921
1471
|
annotation: true
|
1922
1472
|
}).merge(
|
1923
|
-
|
1924
|
-
type:
|
1925
|
-
status:
|
1473
|
+
import_zod16.z.object({
|
1474
|
+
type: import_zod16.z.enum(ConfirmableActions),
|
1475
|
+
status: import_zod16.z.literal(ActionStatus.Rejected)
|
1926
1476
|
})
|
1927
1477
|
);
|
1928
|
-
var Action =
|
1929
|
-
var ResolvedUser =
|
1930
|
-
id:
|
1931
|
-
role:
|
1932
|
-
name:
|
1933
|
-
|
1934
|
-
use:
|
1935
|
-
given:
|
1936
|
-
family:
|
1478
|
+
var Action = import_zod16.z.union([ActionDocument, AsyncRejectActionDocument]);
|
1479
|
+
var ResolvedUser = import_zod16.z.object({
|
1480
|
+
id: import_zod16.z.string(),
|
1481
|
+
role: import_zod16.z.string(),
|
1482
|
+
name: import_zod16.z.array(
|
1483
|
+
import_zod16.z.object({
|
1484
|
+
use: import_zod16.z.string(),
|
1485
|
+
given: import_zod16.z.array(import_zod16.z.string()),
|
1486
|
+
family: import_zod16.z.string()
|
1937
1487
|
})
|
1938
1488
|
)
|
1939
1489
|
});
|
@@ -1944,7 +1494,7 @@ var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
1944
1494
|
var import_date_fns = require("date-fns");
|
1945
1495
|
|
1946
1496
|
// ../commons/src/events/FieldTypeMapping.ts
|
1947
|
-
var
|
1497
|
+
var import_zod17 = require("zod");
|
1948
1498
|
function mapFieldTypeToZod(type, required) {
|
1949
1499
|
let schema;
|
1950
1500
|
switch (type) {
|
@@ -2004,7 +1554,7 @@ function createValidationSchema(config) {
|
|
2004
1554
|
for (const field2 of config) {
|
2005
1555
|
shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
|
2006
1556
|
}
|
2007
|
-
return
|
1557
|
+
return import_zod17.z.object(shape);
|
2008
1558
|
}
|
2009
1559
|
function mapFieldTypeToEmptyValue(field2) {
|
2010
1560
|
switch (field2.type) {
|
@@ -2144,29 +1694,6 @@ var ajv = new import_ajv.default({
|
|
2144
1694
|
allowUnionTypes: true
|
2145
1695
|
});
|
2146
1696
|
(0, import_ajv_formats.default)(ajv);
|
2147
|
-
ajv.addKeyword({
|
2148
|
-
keyword: "daysFromNow",
|
2149
|
-
type: "string",
|
2150
|
-
schemaType: "object",
|
2151
|
-
$data: true,
|
2152
|
-
errors: true,
|
2153
|
-
validate(schema, data, _, dataContext) {
|
2154
|
-
if (!(dataContext && dataContext.rootData && typeof dataContext.rootData === "object" && "$now" in dataContext.rootData && typeof dataContext.rootData.$now === "string")) {
|
2155
|
-
throw new Error("Validation context must contain $now");
|
2156
|
-
}
|
2157
|
-
const { days, clause } = schema;
|
2158
|
-
if (typeof data !== "string") {
|
2159
|
-
return false;
|
2160
|
-
}
|
2161
|
-
const date = new Date(data);
|
2162
|
-
if (isNaN(date.getTime())) {
|
2163
|
-
return false;
|
2164
|
-
}
|
2165
|
-
const now = new Date(dataContext.rootData.$now);
|
2166
|
-
const offsetDate = new Date(now.getTime() + days * 24 * 60 * 60 * 1e3);
|
2167
|
-
return clause === "after" ? (0, import_date_fns.isAfter)(date, offsetDate) : (0, import_date_fns.isBefore)(date, offsetDate);
|
2168
|
-
}
|
2169
|
-
});
|
2170
1697
|
function validate(schema, data) {
|
2171
1698
|
return ajv.validate(schema, data);
|
2172
1699
|
}
|
@@ -2232,7 +1759,7 @@ var errorMessages = {
|
|
2232
1759
|
id: "v2.error.invalidEmail"
|
2233
1760
|
},
|
2234
1761
|
requiredField: {
|
2235
|
-
defaultMessage: "Required",
|
1762
|
+
defaultMessage: "Required for registration",
|
2236
1763
|
description: "Error message when required field is missing",
|
2237
1764
|
id: "v2.error.required"
|
2238
1765
|
},
|
@@ -2387,9 +1914,6 @@ function getOrThrow(x, message) {
|
|
2387
1914
|
}
|
2388
1915
|
return x;
|
2389
1916
|
}
|
2390
|
-
function joinValues(values, separator = " ") {
|
2391
|
-
return values.filter((value) => !!value).join(separator).trim();
|
2392
|
-
}
|
2393
1917
|
|
2394
1918
|
// ../commons/src/events/utils.ts
|
2395
1919
|
function isDeclarationActionConfig(action) {
|
@@ -2489,7 +2013,6 @@ function createEmptyDraft(eventId, draftId, actionType) {
|
|
2489
2013
|
declaration: {},
|
2490
2014
|
annotation: {},
|
2491
2015
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
2492
|
-
createdByUserType: TokenUserType.Enum.user,
|
2493
2016
|
createdBy: "@todo",
|
2494
2017
|
createdAtLocation: "00000000-0000-0000-0000-000000000000",
|
2495
2018
|
status: ActionStatus.Accepted,
|
@@ -2594,9 +2117,9 @@ function getEventConfigById(eventConfigs, id) {
|
|
2594
2117
|
|
2595
2118
|
// ../commons/src/events/EventConfig.ts
|
2596
2119
|
var import_zod_openapi8 = require("zod-openapi");
|
2597
|
-
(0, import_zod_openapi8.extendZodWithOpenApi)(
|
2598
|
-
var EventConfig =
|
2599
|
-
id:
|
2120
|
+
(0, import_zod_openapi8.extendZodWithOpenApi)(import_zod18.z);
|
2121
|
+
var EventConfig = import_zod18.z.object({
|
2122
|
+
id: import_zod18.z.string().describe(
|
2600
2123
|
'A machine-readable identifier for the event, e.g. "birth" or "death"'
|
2601
2124
|
),
|
2602
2125
|
dateOfEvent: FieldReference.optional(),
|
@@ -2606,10 +2129,10 @@ var EventConfig = import_zod20.z.object({
|
|
2606
2129
|
),
|
2607
2130
|
summary: SummaryConfig,
|
2608
2131
|
label: TranslationConfig,
|
2609
|
-
actions:
|
2132
|
+
actions: import_zod18.z.array(ActionConfig),
|
2610
2133
|
declaration: DeclarationFormConfig,
|
2611
|
-
deduplication:
|
2612
|
-
advancedSearch:
|
2134
|
+
deduplication: import_zod18.z.array(DeduplicationConfig).optional().default([]),
|
2135
|
+
advancedSearch: import_zod18.z.array(AdvancedSearchConfig).optional().default([])
|
2613
2136
|
}).superRefine((event2, ctx) => {
|
2614
2137
|
const allFields = findAllFields(event2);
|
2615
2138
|
const fieldIds = allFields.map((field2) => field2.id);
|
@@ -2671,12 +2194,12 @@ var definePage = (page) => PageConfig.parse(page);
|
|
2671
2194
|
var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
|
2672
2195
|
|
2673
2196
|
// ../commons/src/events/WorkqueueConfig.ts
|
2674
|
-
var
|
2197
|
+
var import_zod25 = require("zod");
|
2675
2198
|
|
2676
2199
|
// ../commons/src/events/serializers/user/serializer.ts
|
2677
|
-
var
|
2678
|
-
var SerializedUserField =
|
2679
|
-
$userField:
|
2200
|
+
var import_zod19 = require("zod");
|
2201
|
+
var SerializedUserField = import_zod19.z.object({
|
2202
|
+
$userField: import_zod19.z.enum([
|
2680
2203
|
"id",
|
2681
2204
|
"name",
|
2682
2205
|
"role",
|
@@ -2784,6 +2307,9 @@ function createEventConditionals() {
|
|
2784
2307
|
})
|
2785
2308
|
};
|
2786
2309
|
}
|
2310
|
+
function getDateFromNow(days) {
|
2311
|
+
return new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
|
2312
|
+
}
|
2787
2313
|
function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
|
2788
2314
|
return {
|
2789
2315
|
type: "object",
|
@@ -2802,20 +2328,6 @@ function isFieldReference(value) {
|
|
2802
2328
|
return typeof value === "object" && value !== null && "$$field" in value;
|
2803
2329
|
}
|
2804
2330
|
function createFieldConditionals(fieldId) {
|
2805
|
-
const getDayRange = (days, clause) => ({
|
2806
|
-
type: "object",
|
2807
|
-
properties: {
|
2808
|
-
[fieldId]: {
|
2809
|
-
type: "string",
|
2810
|
-
format: "date",
|
2811
|
-
daysFromNow: {
|
2812
|
-
days,
|
2813
|
-
clause
|
2814
|
-
}
|
2815
|
-
}
|
2816
|
-
},
|
2817
|
-
required: [fieldId]
|
2818
|
-
});
|
2819
2331
|
const getDateRange = (date, clause) => ({
|
2820
2332
|
type: "object",
|
2821
2333
|
properties: {
|
@@ -2834,8 +2346,12 @@ function createFieldConditionals(fieldId) {
|
|
2834
2346
|
$$field: fieldId,
|
2835
2347
|
isAfter: () => ({
|
2836
2348
|
days: (days) => ({
|
2837
|
-
inPast: () => defineFormConditional(
|
2838
|
-
|
2349
|
+
inPast: () => defineFormConditional(
|
2350
|
+
getDateRange(getDateFromNow(days), "formatMinimum")
|
2351
|
+
),
|
2352
|
+
inFuture: () => defineFormConditional(
|
2353
|
+
getDateRange(getDateFromNow(-days), "formatMinimum")
|
2354
|
+
)
|
2839
2355
|
}),
|
2840
2356
|
date: (date) => {
|
2841
2357
|
if (isFieldReference(date)) {
|
@@ -2850,12 +2366,16 @@ function createFieldConditionals(fieldId) {
|
|
2850
2366
|
}
|
2851
2367
|
return defineFormConditional(getDateRange(date, "formatMinimum"));
|
2852
2368
|
},
|
2853
|
-
now: () => defineFormConditional(getDateRange(
|
2369
|
+
now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMinimum"))
|
2854
2370
|
}),
|
2855
2371
|
isBefore: () => ({
|
2856
2372
|
days: (days) => ({
|
2857
|
-
inPast: () => defineFormConditional(
|
2858
|
-
|
2373
|
+
inPast: () => defineFormConditional(
|
2374
|
+
getDateRange(getDateFromNow(days), "formatMaximum")
|
2375
|
+
),
|
2376
|
+
inFuture: () => defineFormConditional(
|
2377
|
+
getDateRange(getDateFromNow(-days), "formatMaximum")
|
2378
|
+
)
|
2859
2379
|
}),
|
2860
2380
|
date: (date) => {
|
2861
2381
|
if (isFieldReference(date)) {
|
@@ -2870,7 +2390,7 @@ function createFieldConditionals(fieldId) {
|
|
2870
2390
|
}
|
2871
2391
|
return defineFormConditional(getDateRange(date, "formatMaximum"));
|
2872
2392
|
},
|
2873
|
-
now: () => defineFormConditional(getDateRange(
|
2393
|
+
now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMaximum"))
|
2874
2394
|
}),
|
2875
2395
|
isEqualTo: (value) => {
|
2876
2396
|
if (isFieldReference(value)) {
|
@@ -3082,11 +2602,11 @@ var event = Object.assign(eventFn, {
|
|
3082
2602
|
});
|
3083
2603
|
|
3084
2604
|
// ../commons/src/events/WorkqueueColumnConfig.ts
|
3085
|
-
var
|
2605
|
+
var import_zod21 = require("zod");
|
3086
2606
|
|
3087
2607
|
// ../commons/src/events/EventMetadata.ts
|
3088
|
-
var
|
3089
|
-
var EventStatus =
|
2608
|
+
var import_zod20 = require("zod");
|
2609
|
+
var EventStatus = import_zod20.z.enum([
|
3090
2610
|
"CREATED",
|
3091
2611
|
"NOTIFIED",
|
3092
2612
|
"DECLARED",
|
@@ -3096,69 +2616,62 @@ var EventStatus = import_zod22.z.enum([
|
|
3096
2616
|
"REJECTED",
|
3097
2617
|
"ARCHIVED"
|
3098
2618
|
]);
|
3099
|
-
var
|
3100
|
-
|
3101
|
-
INCOMPLETE: "incomplete",
|
3102
|
-
REJECTED: "rejected",
|
3103
|
-
CORRECTION_REQUESTED: "correction-requested"
|
2619
|
+
var CustomFlags = {
|
2620
|
+
CERTIFICATE_PRINTED: "certificate-printed"
|
3104
2621
|
};
|
3105
|
-
var Flag =
|
2622
|
+
var Flag = import_zod20.z.string().regex(
|
3106
2623
|
new RegExp(
|
3107
2624
|
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
3108
2625
|
ActionStatus
|
3109
2626
|
).join("|").toLowerCase()})$`
|
3110
2627
|
),
|
3111
2628
|
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
3112
|
-
).or(
|
3113
|
-
var ZodDate =
|
3114
|
-
var ActionCreationMetadata =
|
3115
|
-
createdAt:
|
3116
|
-
createdBy:
|
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."),
|
3117
2634
|
createdAtLocation: CreatedAtLocation.describe(
|
3118
2635
|
"Location of the user who created the action request."
|
3119
2636
|
),
|
3120
|
-
|
3121
|
-
|
3122
|
-
|
3123
|
-
createdBySignature: import_zod22.z.string().nullish().describe("Signature of the user who created the action request.")
|
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.")
|
3124
2640
|
});
|
3125
2641
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
3126
|
-
registrationNumber:
|
2642
|
+
registrationNumber: import_zod20.z.string().describe(
|
3127
2643
|
"Registration number of the event. Always present for accepted registrations."
|
3128
2644
|
)
|
3129
2645
|
});
|
3130
|
-
var LegalStatuses =
|
2646
|
+
var LegalStatuses = import_zod20.z.object({
|
3131
2647
|
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
3132
2648
|
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
3133
2649
|
});
|
3134
|
-
var EventMetadata =
|
2650
|
+
var EventMetadata = import_zod20.z.object({
|
3135
2651
|
id: UUID,
|
3136
|
-
type:
|
2652
|
+
type: import_zod20.z.string().describe("The type of event, such as birth, death, or marriage."),
|
3137
2653
|
status: EventStatus,
|
3138
2654
|
legalStatuses: LegalStatuses.describe(
|
3139
2655
|
"Metadata related to the legal registration of the event, such as who registered it and when."
|
3140
2656
|
),
|
3141
|
-
createdAt:
|
2657
|
+
createdAt: import_zod20.z.string().datetime().describe("The timestamp when the event was first created and saved."),
|
3142
2658
|
dateOfEvent: ZodDate.nullish(),
|
3143
|
-
createdBy:
|
3144
|
-
|
3145
|
-
updatedByUserRole: import_zod22.z.string().describe("Role of the user who last changed the status."),
|
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."),
|
3146
2661
|
createdAtLocation: CreatedAtLocation.describe(
|
3147
2662
|
"Location of the user who created the event."
|
3148
2663
|
),
|
3149
|
-
createdBySignature:
|
2664
|
+
createdBySignature: import_zod20.z.string().nullish().describe("Signature of the user who created the event."),
|
3150
2665
|
updatedAtLocation: UUID.nullish().describe(
|
3151
|
-
"Location of the user who last
|
2666
|
+
"Location of the user who last updated the declaration."
|
3152
2667
|
),
|
3153
|
-
updatedAt:
|
3154
|
-
|
3155
|
-
),
|
3156
|
-
|
3157
|
-
updatedBy: import_zod22.z.string().nullish().describe("ID of the user who last changed the status."),
|
3158
|
-
trackingId: import_zod22.z.string().describe(
|
2668
|
+
updatedAt: import_zod20.z.string().datetime().describe("Timestamp of the most recent declaration update."),
|
2669
|
+
assignedTo: import_zod20.z.string().nullish().describe("ID of the user currently assigned to the event."),
|
2670
|
+
updatedBy: import_zod20.z.string().nullish().describe("ID of the user who last updated the declaration."),
|
2671
|
+
trackingId: import_zod20.z.string().describe(
|
3159
2672
|
"System-generated tracking ID used by informants or registrars to look up the event."
|
3160
2673
|
),
|
3161
|
-
flags:
|
2674
|
+
flags: import_zod20.z.array(Flag)
|
3162
2675
|
});
|
3163
2676
|
var EventMetadataKeysArray = [
|
3164
2677
|
"id",
|
@@ -3167,7 +2680,6 @@ var EventMetadataKeysArray = [
|
|
3167
2680
|
"createdAt",
|
3168
2681
|
"dateOfEvent",
|
3169
2682
|
"createdBy",
|
3170
|
-
"createdByUserType",
|
3171
2683
|
"updatedByUserRole",
|
3172
2684
|
"createdAtLocation",
|
3173
2685
|
"updatedAtLocation",
|
@@ -3178,7 +2690,7 @@ var EventMetadataKeysArray = [
|
|
3178
2690
|
"legalStatuses",
|
3179
2691
|
"flags"
|
3180
2692
|
];
|
3181
|
-
var EventMetadataKeys =
|
2693
|
+
var EventMetadataKeys = import_zod20.z.enum(EventMetadataKeysArray);
|
3182
2694
|
var eventMetadataLabelMap = {
|
3183
2695
|
"event.assignedTo": {
|
3184
2696
|
id: "event.assignedTo.label",
|
@@ -3190,11 +2702,6 @@ var eventMetadataLabelMap = {
|
|
3190
2702
|
defaultMessage: "Created",
|
3191
2703
|
description: "Created At"
|
3192
2704
|
},
|
3193
|
-
"event.createdByUserType": {
|
3194
|
-
id: "event.createdByUserType.label",
|
3195
|
-
defaultMessage: "createdByUserType",
|
3196
|
-
description: "createdByUserType:user or system"
|
3197
|
-
},
|
3198
2705
|
"event.dateOfEvent": {
|
3199
2706
|
id: "event.dateOfEvent.label",
|
3200
2707
|
defaultMessage: "Date of Event",
|
@@ -3260,14 +2767,13 @@ var eventMetadataLabelMap = {
|
|
3260
2767
|
// ../commons/src/events/WorkqueueColumnConfig.ts
|
3261
2768
|
var WorkqueueColumnKeysArray = [
|
3262
2769
|
...EventMetadataKeysArray,
|
3263
|
-
"title"
|
3264
|
-
"outbox"
|
2770
|
+
"title"
|
3265
2771
|
];
|
3266
|
-
var WorkqueueColumnKeys =
|
3267
|
-
var WorkqueueColumnValue =
|
2772
|
+
var WorkqueueColumnKeys = import_zod21.z.enum(WorkqueueColumnKeysArray);
|
2773
|
+
var WorkqueueColumnValue = import_zod21.z.object({
|
3268
2774
|
$event: WorkqueueColumnKeys
|
3269
2775
|
});
|
3270
|
-
var WorkqueueColumn =
|
2776
|
+
var WorkqueueColumn = import_zod21.z.object({
|
3271
2777
|
label: TranslationConfig,
|
3272
2778
|
value: WorkqueueColumnValue
|
3273
2779
|
});
|
@@ -3278,115 +2784,97 @@ function defineWorkqueuesColumns(workqueueColumns) {
|
|
3278
2784
|
}
|
3279
2785
|
|
3280
2786
|
// ../commons/src/events/CountryConfigQueryInput.ts
|
3281
|
-
var
|
2787
|
+
var import_zod23 = require("zod");
|
3282
2788
|
|
3283
2789
|
// ../commons/src/events/EventIndex.ts
|
3284
|
-
var
|
2790
|
+
var import_zod22 = require("zod");
|
3285
2791
|
var import_zod_openapi9 = require("zod-openapi");
|
3286
|
-
(0, import_zod_openapi9.extendZodWithOpenApi)(
|
2792
|
+
(0, import_zod_openapi9.extendZodWithOpenApi)(import_zod22.z);
|
3287
2793
|
var EventIndex = EventMetadata.extend({
|
3288
2794
|
declaration: EventState
|
3289
2795
|
}).openapi({
|
3290
2796
|
ref: "EventIndex"
|
3291
2797
|
});
|
3292
|
-
var EventSearchIndex =
|
3293
|
-
|
3294
|
-
type:
|
2798
|
+
var EventSearchIndex = import_zod22.z.record(import_zod22.z.string(), import_zod22.z.any()).and(
|
2799
|
+
import_zod22.z.object({
|
2800
|
+
type: import_zod22.z.string()
|
3295
2801
|
// Ensures "type" (event-id) exists and is a string
|
3296
2802
|
})
|
3297
2803
|
).openapi({
|
3298
2804
|
ref: "EventSearchIndex"
|
3299
2805
|
});
|
3300
|
-
var Fuzzy =
|
2806
|
+
var Fuzzy = import_zod22.z.object({ type: import_zod22.z.literal("fuzzy"), term: import_zod22.z.string() }).openapi({
|
3301
2807
|
ref: "Fuzzy"
|
3302
2808
|
});
|
3303
|
-
var Exact =
|
2809
|
+
var Exact = import_zod22.z.object({ type: import_zod22.z.literal("exact"), term: import_zod22.z.string() }).openapi({
|
3304
2810
|
ref: "Exact"
|
3305
2811
|
});
|
3306
|
-
var
|
3307
|
-
type:
|
3308
|
-
|
2812
|
+
var AnyOf = import_zod22.z.object({
|
2813
|
+
type: import_zod22.z.literal("anyOf"),
|
2814
|
+
terms: import_zod22.z.array(import_zod22.z.string())
|
3309
2815
|
}).openapi({
|
3310
|
-
ref: "
|
2816
|
+
ref: "AnyOf"
|
3311
2817
|
});
|
3312
|
-
var
|
3313
|
-
type:
|
3314
|
-
|
2818
|
+
var ExactStatus = import_zod22.z.object({
|
2819
|
+
type: import_zod22.z.literal("exact"),
|
2820
|
+
term: EventStatus
|
3315
2821
|
}).openapi({
|
3316
|
-
ref: "
|
2822
|
+
ref: "ExactStatus"
|
3317
2823
|
});
|
3318
|
-
var AnyOfStatus =
|
3319
|
-
type:
|
3320
|
-
terms:
|
2824
|
+
var AnyOfStatus = import_zod22.z.object({
|
2825
|
+
type: import_zod22.z.literal("anyOf"),
|
2826
|
+
terms: import_zod22.z.array(EventStatus)
|
3321
2827
|
}).openapi({
|
3322
2828
|
ref: "AnyOfStatus"
|
3323
2829
|
});
|
3324
|
-
var Range =
|
3325
|
-
type:
|
3326
|
-
gte:
|
3327
|
-
lte:
|
2830
|
+
var Range = import_zod22.z.object({
|
2831
|
+
type: import_zod22.z.literal("range"),
|
2832
|
+
gte: import_zod22.z.string(),
|
2833
|
+
lte: import_zod22.z.string()
|
3328
2834
|
}).openapi({
|
3329
2835
|
ref: "Range"
|
3330
2836
|
});
|
3331
|
-
var
|
3332
|
-
|
3333
|
-
noneOf: import_zod24.z.array(Flag).optional()
|
3334
|
-
}).openapi({
|
3335
|
-
ref: "ContainsFlags"
|
2837
|
+
var Not = import_zod22.z.object({ type: import_zod22.z.literal("not"), term: import_zod22.z.string() }).openapi({
|
2838
|
+
ref: "Not"
|
3336
2839
|
});
|
3337
|
-
var Within =
|
2840
|
+
var Within = import_zod22.z.object({ type: import_zod22.z.literal("within"), location: import_zod22.z.string() }).openapi({
|
3338
2841
|
ref: "Within"
|
3339
2842
|
});
|
3340
|
-
var
|
3341
|
-
gte: import_zod24.z.string().date().or(import_zod24.z.string().datetime()),
|
3342
|
-
lte: import_zod24.z.string().date().or(import_zod24.z.string().datetime())
|
3343
|
-
}).openapi({
|
3344
|
-
ref: "RangeDate"
|
3345
|
-
});
|
3346
|
-
var ExactDate = Exact.extend({
|
3347
|
-
term: import_zod24.z.string().date().or(import_zod24.z.string().datetime())
|
3348
|
-
}).openapi({
|
3349
|
-
ref: "ExactDate"
|
3350
|
-
});
|
3351
|
-
var DateCondition = import_zod24.z.union([ExactDate, RangeDate]).openapi({
|
2843
|
+
var DateCondition = import_zod22.z.union([Exact, Range]).openapi({
|
3352
2844
|
ref: "DateCondition"
|
3353
2845
|
});
|
3354
|
-
var QueryInput =
|
3355
|
-
() =>
|
3356
|
-
|
3357
|
-
|
2846
|
+
var QueryInput = import_zod22.z.lazy(
|
2847
|
+
() => import_zod22.z.union([
|
2848
|
+
import_zod22.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf, Not]),
|
2849
|
+
import_zod22.z.record(import_zod22.z.string(), QueryInput)
|
3358
2850
|
])
|
3359
2851
|
).openapi({
|
3360
2852
|
ref: "QueryInput"
|
3361
2853
|
});
|
3362
|
-
var QueryExpression =
|
3363
|
-
|
3364
|
-
|
3365
|
-
|
3366
|
-
|
3367
|
-
|
3368
|
-
"legalStatus.REGISTERED.
|
3369
|
-
|
3370
|
-
import_zod24.z.union([Within, Exact])
|
2854
|
+
var QueryExpression = import_zod22.z.object({
|
2855
|
+
eventType: import_zod22.z.string(),
|
2856
|
+
status: import_zod22.z.optional(import_zod22.z.union([AnyOfStatus, ExactStatus])),
|
2857
|
+
createdAt: import_zod22.z.optional(DateCondition),
|
2858
|
+
updatedAt: import_zod22.z.optional(DateCondition),
|
2859
|
+
"legalStatus.REGISTERED.createdAt": import_zod22.z.optional(DateCondition),
|
2860
|
+
"legalStatus.REGISTERED.createdAtLocation": import_zod22.z.optional(
|
2861
|
+
import_zod22.z.union([Within, Exact])
|
3371
2862
|
),
|
3372
|
-
"legalStatus.REGISTERED.registrationNumber":
|
3373
|
-
createdAtLocation:
|
3374
|
-
updatedAtLocation:
|
3375
|
-
assignedTo:
|
3376
|
-
|
3377
|
-
|
3378
|
-
|
3379
|
-
|
3380
|
-
flags: import_zod24.z.optional(ContainsFlags),
|
2863
|
+
"legalStatus.REGISTERED.registrationNumber": import_zod22.z.optional(Exact),
|
2864
|
+
createdAtLocation: import_zod22.z.optional(import_zod22.z.union([Within, Exact])),
|
2865
|
+
updatedAtLocation: import_zod22.z.optional(import_zod22.z.union([Within, Exact])),
|
2866
|
+
assignedTo: import_zod22.z.optional(Exact),
|
2867
|
+
createdBy: import_zod22.z.optional(Exact),
|
2868
|
+
updatedBy: import_zod22.z.optional(Exact),
|
2869
|
+
trackingId: import_zod22.z.optional(Exact),
|
2870
|
+
flags: import_zod22.z.optional(import_zod22.z.array(import_zod22.z.union([AnyOf, Not]))),
|
3381
2871
|
data: QueryInput
|
3382
|
-
}).partial().
|
3383
|
-
message: "At least one query field must be specified."
|
3384
|
-
}).openapi({
|
2872
|
+
}).partial().openapi({
|
3385
2873
|
ref: "QueryExpression"
|
3386
2874
|
});
|
3387
|
-
var QueryType =
|
3388
|
-
type:
|
3389
|
-
clauses:
|
2875
|
+
var QueryType = import_zod22.z.object({
|
2876
|
+
type: import_zod22.z.literal("and").or(import_zod22.z.literal("or")).openapi({ default: "and" }),
|
2877
|
+
clauses: import_zod22.z.preprocess(
|
3390
2878
|
(val) => {
|
3391
2879
|
if (typeof val === "string") {
|
3392
2880
|
return [JSON.parse(val)];
|
@@ -3396,7 +2884,7 @@ var QueryType = import_zod24.z.object({
|
|
3396
2884
|
}
|
3397
2885
|
return val;
|
3398
2886
|
},
|
3399
|
-
|
2887
|
+
import_zod22.z.array(QueryExpression).nonempty("At least one clause is required.").openapi({
|
3400
2888
|
default: [
|
3401
2889
|
{
|
3402
2890
|
eventType: TENNIS_CLUB_MEMBERSHIP,
|
@@ -3417,62 +2905,52 @@ var QueryType = import_zod24.z.object({
|
|
3417
2905
|
}).openapi({
|
3418
2906
|
ref: "QueryType"
|
3419
2907
|
});
|
3420
|
-
var SearchScopeAccessLevels = {
|
3421
|
-
MY_JURISDICTION: "my-jurisdiction",
|
3422
|
-
ALL: "all"
|
3423
|
-
};
|
3424
2908
|
|
3425
2909
|
// ../commons/src/events/CountryConfigQueryInput.ts
|
3426
|
-
var SerializableExact =
|
3427
|
-
type:
|
3428
|
-
term:
|
2910
|
+
var SerializableExact = import_zod23.z.object({
|
2911
|
+
type: import_zod23.z.literal("exact"),
|
2912
|
+
term: import_zod23.z.union([import_zod23.z.string(), SerializedUserField])
|
3429
2913
|
});
|
3430
|
-
var SerializableWithin =
|
3431
|
-
type:
|
3432
|
-
location:
|
2914
|
+
var SerializableWithin = import_zod23.z.object({
|
2915
|
+
type: import_zod23.z.literal("within"),
|
2916
|
+
location: import_zod23.z.union([import_zod23.z.string(), SerializedUserField])
|
3433
2917
|
});
|
3434
|
-
var SerializedQueryExpression =
|
3435
|
-
eventType:
|
3436
|
-
status:
|
3437
|
-
createdAt:
|
3438
|
-
updatedAt:
|
3439
|
-
|
3440
|
-
|
3441
|
-
import_zod25.z.union([Within, Exact])
|
3442
|
-
),
|
3443
|
-
"legalStatus.REGISTERED.registrationNumber": import_zod25.z.optional(Exact),
|
3444
|
-
createdAtLocation: import_zod25.z.optional(
|
3445
|
-
import_zod25.z.union([SerializableWithin, SerializableExact])
|
2918
|
+
var SerializedQueryExpression = import_zod23.z.object({
|
2919
|
+
eventType: import_zod23.z.string(),
|
2920
|
+
status: import_zod23.z.optional(import_zod23.z.union([AnyOfStatus, ExactStatus])),
|
2921
|
+
createdAt: import_zod23.z.optional(DateCondition),
|
2922
|
+
updatedAt: import_zod23.z.optional(DateCondition),
|
2923
|
+
createdAtLocation: import_zod23.z.optional(
|
2924
|
+
import_zod23.z.union([SerializableWithin, SerializableExact])
|
3446
2925
|
),
|
3447
|
-
updatedAtLocation:
|
3448
|
-
|
2926
|
+
updatedAtLocation: import_zod23.z.optional(
|
2927
|
+
import_zod23.z.union([SerializableWithin, SerializableExact])
|
3449
2928
|
),
|
3450
|
-
assignedTo:
|
3451
|
-
createdBy:
|
3452
|
-
|
3453
|
-
|
3454
|
-
|
3455
|
-
flags: import_zod25.z.optional(ContainsFlags),
|
2929
|
+
assignedTo: import_zod23.z.optional(SerializableExact),
|
2930
|
+
createdBy: import_zod23.z.optional(SerializableExact),
|
2931
|
+
updatedBy: import_zod23.z.optional(SerializableExact),
|
2932
|
+
trackingId: import_zod23.z.optional(Exact),
|
2933
|
+
flags: import_zod23.z.optional(import_zod23.z.array(import_zod23.z.union([AnyOf, Not]))),
|
3456
2934
|
data: QueryInput
|
3457
2935
|
}).partial();
|
3458
|
-
var Or2 =
|
3459
|
-
type:
|
3460
|
-
clauses:
|
2936
|
+
var Or2 = import_zod23.z.object({
|
2937
|
+
type: import_zod23.z.literal("or"),
|
2938
|
+
clauses: import_zod23.z.array(SerializedQueryExpression)
|
3461
2939
|
});
|
3462
|
-
var And2 =
|
3463
|
-
type:
|
3464
|
-
clauses:
|
2940
|
+
var And2 = import_zod23.z.object({
|
2941
|
+
type: import_zod23.z.literal("and"),
|
2942
|
+
clauses: import_zod23.z.array(SerializedQueryExpression)
|
3465
2943
|
});
|
3466
|
-
var CountryConfigQueryType =
|
3467
|
-
var CountryConfigQueryInputType =
|
2944
|
+
var CountryConfigQueryType = import_zod23.z.discriminatedUnion("type", [And2, Or2]);
|
2945
|
+
var CountryConfigQueryInputType = import_zod23.z.union([
|
3468
2946
|
SerializedQueryExpression,
|
3469
2947
|
And2,
|
3470
2948
|
Or2
|
3471
2949
|
]);
|
3472
2950
|
|
3473
2951
|
// ../commons/src/icons.ts
|
3474
|
-
var
|
3475
|
-
var AvailableIcons =
|
2952
|
+
var import_zod24 = require("zod");
|
2953
|
+
var AvailableIcons = import_zod24.z.enum([
|
3476
2954
|
"Archived",
|
3477
2955
|
"Assigned",
|
3478
2956
|
"Certified",
|
@@ -3510,6 +2988,7 @@ var AvailableIcons = import_zod26.z.enum([
|
|
3510
2988
|
"Copy",
|
3511
2989
|
"Database",
|
3512
2990
|
"DotsThreeVertical",
|
2991
|
+
"DownloadSimple",
|
3513
2992
|
"ArrowCounterClockwise",
|
3514
2993
|
"MagnifyingGlassMinus",
|
3515
2994
|
"MagnifyingGlassPlus",
|
@@ -3593,42 +3072,38 @@ var mandatoryColumns = defineWorkqueuesColumns([
|
|
3593
3072
|
value: event.field("updatedAt")
|
3594
3073
|
}
|
3595
3074
|
]);
|
3596
|
-
var WorkqueueActionsWithDefault =
|
3075
|
+
var WorkqueueActionsWithDefault = import_zod25.z.enum([
|
3597
3076
|
...workqueueActions.options,
|
3598
3077
|
"DEFAULT"
|
3599
3078
|
]);
|
3600
|
-
var WorkqueueConfig =
|
3601
|
-
slug:
|
3079
|
+
var WorkqueueConfig = import_zod25.z.object({
|
3080
|
+
slug: import_zod25.z.string().describe("Determines the url of the workqueue."),
|
3602
3081
|
name: TranslationConfig.describe(
|
3603
3082
|
"Title of the workflow (both in navigation and on the page)"
|
3604
3083
|
),
|
3605
3084
|
query: CountryConfigQueryType,
|
3606
|
-
actions:
|
3607
|
-
|
3085
|
+
actions: import_zod25.z.array(
|
3086
|
+
import_zod25.z.object({
|
3608
3087
|
type: WorkqueueActionsWithDefault,
|
3609
|
-
conditionals:
|
3088
|
+
conditionals: import_zod25.z.array(Conditional).optional()
|
3610
3089
|
})
|
3611
3090
|
),
|
3612
|
-
columns:
|
3091
|
+
columns: import_zod25.z.array(WorkqueueColumn).default(mandatoryColumns),
|
3613
3092
|
icon: AvailableIcons
|
3614
3093
|
}).describe("Configuration for workqueue.");
|
3615
|
-
var
|
3616
|
-
|
3617
|
-
columns: true
|
3618
|
-
});
|
3619
|
-
var WorkqueueConfigInput = import_zod27.z.object({
|
3620
|
-
slug: import_zod27.z.string().describe("Determines the url of the workqueue."),
|
3094
|
+
var WorkqueueConfigInput = import_zod25.z.object({
|
3095
|
+
slug: import_zod25.z.string().describe("Determines the url of the workqueue."),
|
3621
3096
|
name: TranslationConfig.describe(
|
3622
3097
|
"Title of the workflow (both in navigation and on the page)"
|
3623
3098
|
),
|
3624
3099
|
query: CountryConfigQueryInputType,
|
3625
|
-
actions:
|
3626
|
-
|
3100
|
+
actions: import_zod25.z.array(
|
3101
|
+
import_zod25.z.object({
|
3627
3102
|
type: WorkqueueActionsWithDefault,
|
3628
|
-
conditionals:
|
3103
|
+
conditionals: import_zod25.z.array(Conditional).optional()
|
3629
3104
|
})
|
3630
3105
|
),
|
3631
|
-
columns:
|
3106
|
+
columns: import_zod25.z.array(WorkqueueColumn).default(mandatoryColumns),
|
3632
3107
|
icon: AvailableIcons
|
3633
3108
|
});
|
3634
3109
|
function defineWorkqueue(workqueueInput) {
|
@@ -3639,10 +3114,10 @@ function defineWorkqueue(workqueueInput) {
|
|
3639
3114
|
function defineWorkqueues(workqueues) {
|
3640
3115
|
return workqueues.map((workqueue) => defineWorkqueue(workqueue));
|
3641
3116
|
}
|
3642
|
-
var WorkqueueCountInput =
|
3643
|
-
|
3117
|
+
var WorkqueueCountInput = import_zod25.z.array(
|
3118
|
+
import_zod25.z.object({ slug: import_zod25.z.string(), query: QueryType })
|
3644
3119
|
);
|
3645
|
-
var WorkqueueCountOutput =
|
3120
|
+
var WorkqueueCountOutput = import_zod25.z.record(import_zod25.z.string(), import_zod25.z.number());
|
3646
3121
|
|
3647
3122
|
// ../commons/src/events/workqueueDefaultColumns.ts
|
3648
3123
|
var defaultWorkqueueColumns = [
|
@@ -3665,42 +3140,41 @@ var defaultWorkqueueColumns = [
|
|
3665
3140
|
];
|
3666
3141
|
|
3667
3142
|
// ../commons/src/events/Draft.ts
|
3668
|
-
var
|
3143
|
+
var import_zod27 = require("zod");
|
3669
3144
|
|
3670
3145
|
// ../commons/src/events/ActionInput.ts
|
3671
|
-
var
|
3146
|
+
var import_zod26 = require("zod");
|
3672
3147
|
var import_zod_openapi10 = require("zod-openapi");
|
3673
|
-
(0, import_zod_openapi10.extendZodWithOpenApi)(
|
3674
|
-
var BaseActionInput =
|
3148
|
+
(0, import_zod_openapi10.extendZodWithOpenApi)(import_zod26.z);
|
3149
|
+
var BaseActionInput = import_zod26.z.object({
|
3675
3150
|
eventId: UUID,
|
3676
|
-
transactionId:
|
3151
|
+
transactionId: import_zod26.z.string(),
|
3677
3152
|
declaration: ActionUpdate.default({}),
|
3678
3153
|
annotation: ActionUpdate.optional(),
|
3679
3154
|
originalActionId: UUID.optional(),
|
3680
|
-
|
3681
|
-
keepAssignment: import_zod28.z.boolean().optional()
|
3155
|
+
keepAssignment: import_zod26.z.boolean().optional()
|
3682
3156
|
});
|
3683
3157
|
var CreateActionInput = BaseActionInput.merge(
|
3684
|
-
|
3685
|
-
type:
|
3158
|
+
import_zod26.z.object({
|
3159
|
+
type: import_zod26.z.literal(ActionType.CREATE).default(ActionType.CREATE),
|
3686
3160
|
createdAtLocation: CreatedAtLocation
|
3687
3161
|
})
|
3688
3162
|
);
|
3689
3163
|
var RegisterActionInput = BaseActionInput.merge(
|
3690
|
-
|
3691
|
-
type:
|
3692
|
-
registrationNumber:
|
3164
|
+
import_zod26.z.object({
|
3165
|
+
type: import_zod26.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
3166
|
+
registrationNumber: import_zod26.z.string().optional()
|
3693
3167
|
})
|
3694
|
-
)
|
3168
|
+
);
|
3695
3169
|
var ValidateActionInput = BaseActionInput.merge(
|
3696
|
-
|
3697
|
-
type:
|
3698
|
-
duplicates:
|
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())
|
3699
3173
|
})
|
3700
3174
|
);
|
3701
3175
|
var NotifyActionInput = BaseActionInput.merge(
|
3702
|
-
|
3703
|
-
type:
|
3176
|
+
import_zod26.z.object({
|
3177
|
+
type: import_zod26.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
|
3704
3178
|
})
|
3705
3179
|
).openapi({
|
3706
3180
|
default: {
|
@@ -3712,68 +3186,68 @@ var NotifyActionInput = BaseActionInput.merge(
|
|
3712
3186
|
}
|
3713
3187
|
});
|
3714
3188
|
var DeclareActionInput = BaseActionInput.merge(
|
3715
|
-
|
3716
|
-
type:
|
3189
|
+
import_zod26.z.object({
|
3190
|
+
type: import_zod26.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
3717
3191
|
})
|
3718
3192
|
);
|
3719
3193
|
var PrintCertificateActionInput = BaseActionInput.merge(
|
3720
|
-
|
3721
|
-
type:
|
3194
|
+
import_zod26.z.object({
|
3195
|
+
type: import_zod26.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
|
3722
3196
|
})
|
3723
3197
|
);
|
3724
3198
|
var RejectDeclarationActionInput = BaseActionInput.merge(
|
3725
|
-
|
3726
|
-
type:
|
3199
|
+
import_zod26.z.object({
|
3200
|
+
type: import_zod26.z.literal(ActionType.REJECT).default(ActionType.REJECT),
|
3727
3201
|
reason: RejectionReason
|
3728
3202
|
})
|
3729
3203
|
);
|
3730
3204
|
var MarkedAsDuplicateActionInput = BaseActionInput.merge(
|
3731
|
-
|
3732
|
-
type:
|
3205
|
+
import_zod26.z.object({
|
3206
|
+
type: import_zod26.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
|
3733
3207
|
})
|
3734
3208
|
);
|
3735
3209
|
var ArchiveActionInput = BaseActionInput.merge(
|
3736
|
-
|
3737
|
-
type:
|
3210
|
+
import_zod26.z.object({
|
3211
|
+
type: import_zod26.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
|
3738
3212
|
reason: RejectionReason
|
3739
3213
|
})
|
3740
3214
|
);
|
3741
3215
|
var AssignActionInput = BaseActionInput.merge(
|
3742
|
-
|
3743
|
-
type:
|
3744
|
-
assignedTo:
|
3216
|
+
import_zod26.z.object({
|
3217
|
+
type: import_zod26.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
|
3218
|
+
assignedTo: import_zod26.z.string()
|
3745
3219
|
})
|
3746
3220
|
);
|
3747
3221
|
var UnassignActionInput = BaseActionInput.merge(
|
3748
|
-
|
3749
|
-
type:
|
3750
|
-
assignedTo:
|
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)
|
3751
3225
|
})
|
3752
3226
|
);
|
3753
3227
|
var RequestCorrectionActionInput = BaseActionInput.merge(
|
3754
|
-
|
3755
|
-
type:
|
3228
|
+
import_zod26.z.object({
|
3229
|
+
type: import_zod26.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
3756
3230
|
})
|
3757
3231
|
);
|
3758
3232
|
var RejectCorrectionActionInput = BaseActionInput.merge(
|
3759
|
-
|
3760
|
-
requestId:
|
3761
|
-
type:
|
3233
|
+
import_zod26.z.object({
|
3234
|
+
requestId: import_zod26.z.string(),
|
3235
|
+
type: import_zod26.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
|
3762
3236
|
})
|
3763
3237
|
);
|
3764
3238
|
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
3765
|
-
|
3766
|
-
requestId:
|
3767
|
-
type:
|
3239
|
+
import_zod26.z.object({
|
3240
|
+
requestId: import_zod26.z.string(),
|
3241
|
+
type: import_zod26.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
3768
3242
|
})
|
3769
3243
|
);
|
3770
3244
|
var ReadActionInput = BaseActionInput.merge(
|
3771
|
-
|
3772
|
-
type:
|
3245
|
+
import_zod26.z.object({
|
3246
|
+
type: import_zod26.z.literal(ActionType.READ).default(ActionType.READ)
|
3773
3247
|
})
|
3774
3248
|
);
|
3775
|
-
var DeleteActionInput =
|
3776
|
-
var ActionInput =
|
3249
|
+
var DeleteActionInput = import_zod26.z.object({ eventId: UUID });
|
3250
|
+
var ActionInput = import_zod26.z.discriminatedUnion("type", [
|
3777
3251
|
CreateActionInput.openapi({ ref: "CreateActionInput" }),
|
3778
3252
|
ValidateActionInput.openapi({ ref: "ValidateActionInput" }),
|
3779
3253
|
RegisterActionInput.openapi({ ref: "RegisterActionInput" }),
|
@@ -3802,18 +3276,18 @@ var ActionInput = import_zod28.z.discriminatedUnion("type", [
|
|
3802
3276
|
});
|
3803
3277
|
|
3804
3278
|
// ../commons/src/events/Draft.ts
|
3805
|
-
var Draft =
|
3279
|
+
var Draft = import_zod27.z.object({
|
3806
3280
|
id: UUID,
|
3807
3281
|
eventId: UUID,
|
3808
|
-
transactionId:
|
3809
|
-
createdAt:
|
3282
|
+
transactionId: import_zod27.z.string(),
|
3283
|
+
createdAt: import_zod27.z.string().datetime(),
|
3810
3284
|
action: ActionBase.extend({
|
3811
3285
|
type: ActionTypes
|
3812
3286
|
}).omit({ id: true })
|
3813
3287
|
});
|
3814
3288
|
var DraftInput = BaseActionInput.extend({
|
3815
3289
|
type: ActionTypes,
|
3816
|
-
status:
|
3290
|
+
status: import_zod27.z.enum([
|
3817
3291
|
ActionStatus.Requested,
|
3818
3292
|
ActionStatus.Accepted,
|
3819
3293
|
ActionStatus.Rejected
|
@@ -3821,28 +3295,27 @@ var DraftInput = BaseActionInput.extend({
|
|
3821
3295
|
});
|
3822
3296
|
|
3823
3297
|
// ../commons/src/events/EventInput.ts
|
3824
|
-
var
|
3298
|
+
var import_zod28 = require("zod");
|
3825
3299
|
var import_uuid8 = require("uuid");
|
3826
|
-
var EventInput =
|
3827
|
-
transactionId:
|
3828
|
-
type:
|
3300
|
+
var EventInput = import_zod28.z.object({
|
3301
|
+
transactionId: import_zod28.z.string(),
|
3302
|
+
type: import_zod28.z.string()
|
3829
3303
|
}).openapi({ default: { transactionId: (0, import_uuid8.v4)(), type: "v2.birth" } });
|
3830
3304
|
|
3831
3305
|
// ../commons/src/events/EventDocument.ts
|
3832
|
-
var
|
3306
|
+
var import_zod29 = require("zod");
|
3833
3307
|
var import_zod_openapi11 = require("zod-openapi");
|
3834
|
-
(0, import_zod_openapi11.extendZodWithOpenApi)(
|
3835
|
-
var EventDocument =
|
3308
|
+
(0, import_zod_openapi11.extendZodWithOpenApi)(import_zod29.z);
|
3309
|
+
var EventDocument = import_zod29.z.object({
|
3836
3310
|
id: UUID,
|
3837
|
-
type:
|
3838
|
-
createdAt:
|
3839
|
-
updatedAt:
|
3840
|
-
actions:
|
3841
|
-
trackingId:
|
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()
|
3842
3316
|
}).openapi({ ref: "EventDocument" });
|
3843
3317
|
|
3844
3318
|
// ../commons/src/events/state/utils.ts
|
3845
|
-
var import_lodash2 = require("lodash");
|
3846
3319
|
function getActionRequests(actionType, actions) {
|
3847
3320
|
const filtered = actions.filter((action) => action.type === actionType);
|
3848
3321
|
const accept = filtered.find(
|
@@ -3873,7 +3346,6 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
|
|
3873
3346
|
// When 3rd party API returns 200 OK, we assume that the request was accepted, and persist single 'accepted' action.
|
3874
3347
|
createdAt: requestAction?.createdAt ?? acceptAction.createdAt,
|
3875
3348
|
createdBy: requestAction?.createdBy ?? acceptAction.createdBy,
|
3876
|
-
createdByUserType: requestAction?.createdByUserType ?? acceptAction.createdByUserType,
|
3877
3349
|
createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
|
3878
3350
|
acceptedAt: acceptAction.createdAt,
|
3879
3351
|
createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
|
@@ -3881,38 +3353,27 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
|
|
3881
3353
|
registrationNumber
|
3882
3354
|
};
|
3883
3355
|
}
|
3884
|
-
|
3885
|
-
ActionType.CREATE,
|
3886
|
-
ActionType.NOTIFY,
|
3887
|
-
ActionType.DECLARE,
|
3888
|
-
ActionType.VALIDATE,
|
3889
|
-
ActionType.REGISTER,
|
3890
|
-
ActionType.REJECT,
|
3891
|
-
ActionType.ARCHIVE,
|
3892
|
-
ActionType.PRINT_CERTIFICATE,
|
3893
|
-
ActionType.REQUEST_CORRECTION
|
3894
|
-
]);
|
3895
|
-
function getActionUpdateMetadata(actions) {
|
3356
|
+
function getDeclarationActionUpdateMetadata(actions) {
|
3896
3357
|
const createAction = getOrThrow(
|
3897
3358
|
actions.find((action) => action.type === ActionType.CREATE),
|
3898
3359
|
`Event has no ${ActionType.CREATE} action`
|
3899
3360
|
);
|
3900
|
-
|
3901
|
-
|
3902
|
-
|
3903
|
-
|
3904
|
-
|
3905
|
-
|
3906
|
-
|
3907
|
-
|
3908
|
-
|
3909
|
-
if (action.originalActionId) {
|
3910
|
-
const originalAction = actions.find(({ id }) => id === action.originalActionId) ?? action;
|
3911
|
-
return (0, import_lodash2.pick)(originalAction, metadataFields);
|
3912
|
-
}
|
3913
|
-
return (0, import_lodash2.pick)(action, metadataFields);
|
3361
|
+
return [ActionType.DECLARE, ActionType.VALIDATE, ActionType.REGISTER].reduce(
|
3362
|
+
(metadata, actionType) => {
|
3363
|
+
const { accept, request } = getActionRequests(actionType, actions);
|
3364
|
+
return {
|
3365
|
+
createdAt: request?.createdAt ?? accept?.createdAt ?? metadata.createdAt,
|
3366
|
+
createdBy: request?.createdBy ?? accept?.createdBy ?? metadata.createdBy,
|
3367
|
+
createdAtLocation: request?.createdAtLocation ?? accept?.createdAtLocation ?? metadata.createdAtLocation,
|
3368
|
+
createdByRole: request?.createdByRole ?? accept?.createdByRole ?? metadata.createdByRole
|
3369
|
+
};
|
3914
3370
|
},
|
3915
|
-
|
3371
|
+
{
|
3372
|
+
createdAt: createAction.createdAt,
|
3373
|
+
createdBy: createAction.createdBy,
|
3374
|
+
createdAtLocation: createAction.createdAtLocation,
|
3375
|
+
createdByRole: createAction.createdByRole
|
3376
|
+
}
|
3916
3377
|
);
|
3917
3378
|
}
|
3918
3379
|
function getLegalStatuses(actions) {
|
@@ -3928,69 +3389,15 @@ function getLegalStatuses(actions) {
|
|
3928
3389
|
};
|
3929
3390
|
}
|
3930
3391
|
|
3931
|
-
// ../commons/src/events/state/flags.ts
|
3932
|
-
function isCertificatePrinted(actions) {
|
3933
|
-
return actions.reduce((prev, { type }) => {
|
3934
|
-
if (type === ActionType.PRINT_CERTIFICATE) {
|
3935
|
-
return true;
|
3936
|
-
}
|
3937
|
-
if (type === ActionType.APPROVE_CORRECTION) {
|
3938
|
-
return false;
|
3939
|
-
}
|
3940
|
-
return prev;
|
3941
|
-
}, false);
|
3942
|
-
}
|
3943
|
-
function isCorrectionRequested(actions) {
|
3944
|
-
return actions.reduce((prev, { type }) => {
|
3945
|
-
if (type === ActionType.REQUEST_CORRECTION) {
|
3946
|
-
return true;
|
3947
|
-
}
|
3948
|
-
if (type === ActionType.APPROVE_CORRECTION) {
|
3949
|
-
return false;
|
3950
|
-
}
|
3951
|
-
if (type === ActionType.REJECT_CORRECTION) {
|
3952
|
-
return false;
|
3953
|
-
}
|
3954
|
-
return prev;
|
3955
|
-
}, false);
|
3956
|
-
}
|
3957
|
-
function isDeclarationIncomplete(actions) {
|
3958
|
-
return getStatusFromActions(actions) === EventStatus.enum.NOTIFIED;
|
3959
|
-
}
|
3960
|
-
function isRejected(actions) {
|
3961
|
-
return getStatusFromActions(actions) === EventStatus.enum.REJECTED;
|
3962
|
-
}
|
3963
|
-
function getFlagsFromActions(actions) {
|
3964
|
-
const sortedActions = actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
3965
|
-
const actionStatus = sortedActions.reduce(
|
3966
|
-
(actionStatuses, { type, status }) => ({
|
3967
|
-
...actionStatuses,
|
3968
|
-
[type]: status
|
3969
|
-
}),
|
3970
|
-
{}
|
3971
|
-
);
|
3972
|
-
const flags = Object.entries(actionStatus).filter(([, status]) => status !== ActionStatus.Accepted).map(([type, status]) => {
|
3973
|
-
const flag = joinValues([type, status], ":").toLowerCase();
|
3974
|
-
return flag;
|
3975
|
-
});
|
3976
|
-
if (isCertificatePrinted(sortedActions)) {
|
3977
|
-
flags.push(InherentFlags.PRINTED);
|
3978
|
-
}
|
3979
|
-
if (isCorrectionRequested(sortedActions)) {
|
3980
|
-
flags.push(InherentFlags.CORRECTION_REQUESTED);
|
3981
|
-
}
|
3982
|
-
if (isDeclarationIncomplete(sortedActions)) {
|
3983
|
-
flags.push(InherentFlags.INCOMPLETE);
|
3984
|
-
}
|
3985
|
-
if (isRejected(sortedActions)) {
|
3986
|
-
flags.push(InherentFlags.REJECTED);
|
3987
|
-
}
|
3988
|
-
return flags;
|
3989
|
-
}
|
3990
|
-
|
3991
3392
|
// ../commons/src/events/state/index.ts
|
3992
3393
|
function getStatusFromActions(actions) {
|
3993
|
-
|
3394
|
+
const hasRejectedAction = actions.some(
|
3395
|
+
(a) => a.status === ActionStatus.Rejected
|
3396
|
+
);
|
3397
|
+
if (hasRejectedAction) {
|
3398
|
+
return EventStatus.enum.REJECTED;
|
3399
|
+
}
|
3400
|
+
return actions.reduce((status, action) => {
|
3994
3401
|
switch (action.type) {
|
3995
3402
|
case ActionType.CREATE:
|
3996
3403
|
return EventStatus.enum.CREATED;
|
@@ -4020,6 +3427,38 @@ function getStatusFromActions(actions) {
|
|
4020
3427
|
}
|
4021
3428
|
}, EventStatus.enum.CREATED);
|
4022
3429
|
}
|
3430
|
+
function getFlagsFromActions(actions) {
|
3431
|
+
const sortedactions = actions.sort(
|
3432
|
+
(a, b) => a.createdAt.localeCompare(b.createdAt)
|
3433
|
+
);
|
3434
|
+
const actionStatus = sortedactions.reduce(
|
3435
|
+
(actionStatuses, { type, status }) => ({
|
3436
|
+
...actionStatuses,
|
3437
|
+
[type]: status
|
3438
|
+
}),
|
3439
|
+
{}
|
3440
|
+
);
|
3441
|
+
const flags = Object.entries(actionStatus).filter(([, status]) => status !== ActionStatus.Accepted).map(([type, status]) => {
|
3442
|
+
const flag = `${type.toLowerCase()}:${status.toLowerCase()}`;
|
3443
|
+
return flag;
|
3444
|
+
});
|
3445
|
+
const isCertificatePrinted = sortedactions.reduce(
|
3446
|
+
(prev, { type }) => {
|
3447
|
+
if (type === ActionType.PRINT_CERTIFICATE) {
|
3448
|
+
return true;
|
3449
|
+
}
|
3450
|
+
if (type === ActionType.APPROVE_CORRECTION) {
|
3451
|
+
return false;
|
3452
|
+
}
|
3453
|
+
return prev;
|
3454
|
+
},
|
3455
|
+
false
|
3456
|
+
);
|
3457
|
+
if (isCertificatePrinted) {
|
3458
|
+
flags.push(CustomFlags.CERTIFICATE_PRINTED);
|
3459
|
+
}
|
3460
|
+
return flags;
|
3461
|
+
}
|
4023
3462
|
function getAssignedUserFromActions(actions) {
|
4024
3463
|
return actions.reduce((user2, action) => {
|
4025
3464
|
if (action.type === ActionType.ASSIGN) {
|
@@ -4086,13 +3525,6 @@ function getAcceptedActions(event2) {
|
|
4086
3525
|
);
|
4087
3526
|
}
|
4088
3527
|
var DEFAULT_DATE_OF_EVENT_PROPERTY = "createdAt";
|
4089
|
-
function resolveDateOfEvent(eventMetadata, declaration, config) {
|
4090
|
-
if (!config.dateOfEvent) {
|
4091
|
-
return eventMetadata[DEFAULT_DATE_OF_EVENT_PROPERTY].split("T")[0];
|
4092
|
-
}
|
4093
|
-
const parsedDate = ZodDate.safeParse(declaration[config.dateOfEvent.$$field]);
|
4094
|
-
return parsedDate.success ? parsedDate.data : void 0;
|
4095
|
-
}
|
4096
3528
|
function getCurrentEventState(event2, config) {
|
4097
3529
|
const creationAction = event2.actions.find(
|
4098
3530
|
(action) => action.type === ActionType.CREATE
|
@@ -4100,12 +3532,22 @@ function getCurrentEventState(event2, config) {
|
|
4100
3532
|
if (!creationAction) {
|
4101
3533
|
throw new Error(`Event ${event2.id} has no creation action`);
|
4102
3534
|
}
|
4103
|
-
const acceptedActions = getAcceptedActions(event2)
|
4104
|
-
|
3535
|
+
const acceptedActions = getAcceptedActions(event2);
|
3536
|
+
const declarationUpdateMetadata = getDeclarationActionUpdateMetadata(
|
3537
|
+
event2.actions
|
4105
3538
|
);
|
4106
|
-
const requestActionMetadata = getActionUpdateMetadata(event2.actions);
|
4107
|
-
const acceptedActionMetadata = getActionUpdateMetadata(acceptedActions);
|
4108
3539
|
const declaration = aggregateActionDeclarations(acceptedActions);
|
3540
|
+
let dateOfEvent;
|
3541
|
+
if (config.dateOfEvent) {
|
3542
|
+
const parsedDate = ZodDate.safeParse(
|
3543
|
+
declaration[config.dateOfEvent.$$field]
|
3544
|
+
);
|
3545
|
+
if (parsedDate.success) {
|
3546
|
+
dateOfEvent = parsedDate.data;
|
3547
|
+
}
|
3548
|
+
} else {
|
3549
|
+
dateOfEvent = event2[DEFAULT_DATE_OF_EVENT_PROPERTY].split("T")[0];
|
3550
|
+
}
|
4109
3551
|
return deepDropNulls({
|
4110
3552
|
id: event2.id,
|
4111
3553
|
type: event2.type,
|
@@ -4113,18 +3555,17 @@ function getCurrentEventState(event2, config) {
|
|
4113
3555
|
legalStatuses: getLegalStatuses(event2.actions),
|
4114
3556
|
createdAt: creationAction.createdAt,
|
4115
3557
|
createdBy: creationAction.createdBy,
|
4116
|
-
createdByUserType: creationAction.createdByUserType,
|
4117
3558
|
createdAtLocation: creationAction.createdAtLocation,
|
4118
3559
|
createdBySignature: creationAction.createdBySignature,
|
4119
|
-
updatedAt:
|
3560
|
+
updatedAt: declarationUpdateMetadata.createdAt,
|
4120
3561
|
assignedTo: getAssignedUserFromActions(acceptedActions),
|
4121
3562
|
assignedToSignature: getAssignedUserSignatureFromActions(acceptedActions),
|
4122
|
-
updatedBy:
|
4123
|
-
updatedAtLocation:
|
3563
|
+
updatedBy: declarationUpdateMetadata.createdBy,
|
3564
|
+
updatedAtLocation: declarationUpdateMetadata.createdAtLocation,
|
4124
3565
|
declaration,
|
4125
3566
|
trackingId: event2.trackingId,
|
4126
|
-
updatedByUserRole:
|
4127
|
-
dateOfEvent
|
3567
|
+
updatedByUserRole: declarationUpdateMetadata.createdByRole,
|
3568
|
+
dateOfEvent,
|
4128
3569
|
flags: getFlagsFromActions(event2.actions)
|
4129
3570
|
});
|
4130
3571
|
}
|
@@ -4153,29 +3594,19 @@ function getCurrentEventStateWithDrafts({
|
|
4153
3594
|
};
|
4154
3595
|
return getCurrentEventState(withDrafts, configuration);
|
4155
3596
|
}
|
4156
|
-
function
|
4157
|
-
const updatedDeclaration = deepMerge(eventIndex.declaration, declaration);
|
4158
|
-
return {
|
4159
|
-
...eventIndex,
|
4160
|
-
dateOfEvent: resolveDateOfEvent(
|
4161
|
-
eventIndex,
|
4162
|
-
updatedDeclaration,
|
4163
|
-
eventConfiguration
|
4164
|
-
),
|
4165
|
-
declaration: updatedDeclaration
|
4166
|
-
};
|
4167
|
-
}
|
4168
|
-
function applyDraftsToEventIndex(eventIndex, drafts, eventConfiguration) {
|
3597
|
+
function applyDraftsToEventIndex(eventIndex, drafts) {
|
4169
3598
|
const indexedAt = eventIndex.updatedAt;
|
4170
3599
|
const activeDrafts = drafts.filter(({ createdAt }) => new Date(createdAt) > new Date(indexedAt)).map((draft) => draft.action).sort();
|
4171
3600
|
if (activeDrafts.length === 0) {
|
4172
3601
|
return eventIndex;
|
4173
3602
|
}
|
4174
|
-
return
|
4175
|
-
eventIndex,
|
4176
|
-
|
4177
|
-
|
4178
|
-
|
3603
|
+
return {
|
3604
|
+
...eventIndex,
|
3605
|
+
declaration: {
|
3606
|
+
...eventIndex.declaration,
|
3607
|
+
...activeDrafts[activeDrafts.length - 1].declaration
|
3608
|
+
}
|
3609
|
+
};
|
4179
3610
|
}
|
4180
3611
|
function getAnnotationFromDrafts(drafts) {
|
4181
3612
|
const actions = drafts.map((draft) => draft.action);
|
@@ -4216,23 +3647,23 @@ function generateTransactionId() {
|
|
4216
3647
|
}
|
4217
3648
|
|
4218
3649
|
// ../commons/src/events/User.ts
|
4219
|
-
var
|
4220
|
-
var User =
|
4221
|
-
id:
|
4222
|
-
name:
|
4223
|
-
|
4224
|
-
use:
|
4225
|
-
given:
|
4226
|
-
family:
|
3650
|
+
var import_zod30 = require("zod");
|
3651
|
+
var User = import_zod30.z.object({
|
3652
|
+
id: import_zod30.z.string(),
|
3653
|
+
name: import_zod30.z.array(
|
3654
|
+
import_zod30.z.object({
|
3655
|
+
use: import_zod30.z.string(),
|
3656
|
+
given: import_zod30.z.array(import_zod30.z.string()),
|
3657
|
+
family: import_zod30.z.string()
|
4227
3658
|
})
|
4228
3659
|
),
|
4229
|
-
role:
|
4230
|
-
signatureFilename:
|
3660
|
+
role: import_zod30.z.string(),
|
3661
|
+
signatureFilename: import_zod30.z.string().optional()
|
4231
3662
|
});
|
4232
3663
|
|
4233
3664
|
// ../commons/src/events/test.utils.ts
|
4234
|
-
var
|
4235
|
-
var
|
3665
|
+
var import_lodash2 = require("lodash");
|
3666
|
+
var import_addDays = __toESM(require("date-fns/addDays"));
|
4236
3667
|
|
4237
3668
|
// ../commons/src/field-config/field-configuration.ts
|
4238
3669
|
function createFieldConfig(fieldId, options) {
|
@@ -4912,7 +4343,7 @@ var PRINT_CERTIFICATE_FORM = defineActionForm({
|
|
4912
4343
|
var TENNIS_CLUB_DECLARATION_REVIEW = {
|
4913
4344
|
title: {
|
4914
4345
|
id: "v2.event.tennis-club-membership.action.declare.form.review.title",
|
4915
|
-
defaultMessage: "{applicant.name.firstname, select, __EMPTY__ {Member declaration} other {{applicant.name.surname, select, __EMPTY__ {Member declaration
|
4346
|
+
defaultMessage: "{applicant.name.firstname, select, __EMPTY__ {Member declaration} other {{applicant.name.surname, select, __EMPTY__ {Member declaration} other {Member declaration for {applicant.name.firstname} {applicant.name.surname}}}}}",
|
4916
4347
|
description: "Title of the review page"
|
4917
4348
|
},
|
4918
4349
|
fields: [
|
@@ -5051,7 +4482,6 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
|
5051
4482
|
id: "applicant.address",
|
5052
4483
|
type: "ADDRESS",
|
5053
4484
|
required: true,
|
5054
|
-
secured: true,
|
5055
4485
|
conditionals: [],
|
5056
4486
|
label: {
|
5057
4487
|
defaultMessage: "Applicant's address",
|
@@ -6218,14 +5648,6 @@ var v2BirthEvent = defineConfig({
|
|
6218
5648
|
});
|
6219
5649
|
|
6220
5650
|
// ../commons/src/events/test.utils.ts
|
6221
|
-
var import_zod33 = require("zod");
|
6222
|
-
var TestUserRole = import_zod33.z.enum([
|
6223
|
-
"FIELD_AGENT",
|
6224
|
-
"LOCAL_REGISTRAR",
|
6225
|
-
"LOCAL_SYSTEM_ADMIN",
|
6226
|
-
"NATIONAL_REGISTRAR",
|
6227
|
-
"REGISTRATION_AGENT"
|
6228
|
-
]);
|
6229
5651
|
function pickRandom(rng, items) {
|
6230
5652
|
return items[Math.floor(rng() * items.length)];
|
6231
5653
|
}
|
@@ -6374,7 +5796,7 @@ function eventPayloadGenerator(rng) {
|
|
6374
5796
|
type: input.type ?? TENNIS_CLUB_MEMBERSHIP,
|
6375
5797
|
id
|
6376
5798
|
}),
|
6377
|
-
draft: ({ eventId, actionType }, input = {}) => (0,
|
5799
|
+
draft: ({ eventId, actionType }, input = {}) => (0, import_lodash2.merge)(
|
6378
5800
|
{
|
6379
5801
|
id: getUUID(),
|
6380
5802
|
eventId,
|
@@ -6398,7 +5820,6 @@ function eventPayloadGenerator(rng) {
|
|
6398
5820
|
},
|
6399
5821
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
6400
5822
|
createdBy: "@todo",
|
6401
|
-
createdByUserType: TokenUserType.Enum.user,
|
6402
5823
|
createdByRole: "@todo",
|
6403
5824
|
createdAtLocation: "@todo"
|
6404
5825
|
}
|
@@ -6428,13 +5849,13 @@ function eventPayloadGenerator(rng) {
|
|
6428
5849
|
notify: (eventId, input = {}) => {
|
6429
5850
|
let declaration = input.declaration;
|
6430
5851
|
if (!declaration) {
|
6431
|
-
const partialDeclaration = (0,
|
5852
|
+
const partialDeclaration = (0, import_lodash2.omitBy)(
|
6432
5853
|
generateActionDeclarationInput(
|
6433
5854
|
tennisClubMembershipEvent,
|
6434
5855
|
ActionType.DECLARE,
|
6435
5856
|
rng
|
6436
5857
|
),
|
6437
|
-
|
5858
|
+
import_lodash2.isString
|
6438
5859
|
);
|
6439
5860
|
declaration = partialDeclaration;
|
6440
5861
|
}
|
@@ -6584,18 +6005,16 @@ function generateActionDocument({
|
|
6584
6005
|
configuration,
|
6585
6006
|
action,
|
6586
6007
|
rng = () => 0.1,
|
6587
|
-
defaults = {}
|
6588
|
-
user: user2 = {}
|
6008
|
+
defaults = {}
|
6589
6009
|
}) {
|
6590
6010
|
const actionBase = {
|
6591
6011
|
// Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
|
6592
6012
|
// @TODO: This should be fixed in the future.
|
6593
6013
|
createdAt: new Date(Date.now() - 500).toISOString(),
|
6594
|
-
createdBy:
|
6595
|
-
|
6596
|
-
createdByRole: TestUserRole.Enum.FIELD_AGENT,
|
6014
|
+
createdBy: getUUID(),
|
6015
|
+
createdByRole: "FIELD_AGENT",
|
6597
6016
|
id: getUUID(),
|
6598
|
-
createdAtLocation:
|
6017
|
+
createdAtLocation: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
6599
6018
|
declaration: generateActionDeclarationInput(configuration, action, rng),
|
6600
6019
|
annotation: {},
|
6601
6020
|
status: ActionStatus.Accepted,
|
@@ -6610,7 +6029,7 @@ function generateActionDocument({
|
|
6610
6029
|
case ActionType.DECLARE:
|
6611
6030
|
return { ...actionBase, type: action };
|
6612
6031
|
case ActionType.UNASSIGN:
|
6613
|
-
return { ...actionBase, type: action };
|
6032
|
+
return { ...actionBase, type: action, assignedTo: null };
|
6614
6033
|
case ActionType.ASSIGN:
|
6615
6034
|
return { ...actionBase, assignedTo: getUUID(), type: action };
|
6616
6035
|
case ActionType.VALIDATE:
|
@@ -6649,14 +6068,13 @@ function generateActionDocument({
|
|
6649
6068
|
function generateEventDocument({
|
6650
6069
|
configuration,
|
6651
6070
|
actions,
|
6652
|
-
rng = () => 0.1
|
6653
|
-
user: user2
|
6071
|
+
rng = () => 0.1
|
6654
6072
|
}) {
|
6655
6073
|
return {
|
6656
6074
|
trackingId: getUUID(),
|
6657
6075
|
type: configuration.id,
|
6658
6076
|
actions: actions.map(
|
6659
|
-
(action) => generateActionDocument({ configuration, action, rng
|
6077
|
+
(action) => generateActionDocument({ configuration, action, rng })
|
6660
6078
|
),
|
6661
6079
|
// Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
|
6662
6080
|
// @TODO: This should be fixed in the future.
|
@@ -6724,7 +6142,7 @@ function createPrng(seed) {
|
|
6724
6142
|
return state / MODULUS;
|
6725
6143
|
};
|
6726
6144
|
}
|
6727
|
-
function generateUuid(rng
|
6145
|
+
function generateUuid(rng) {
|
6728
6146
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
6729
6147
|
const r = Math.floor(rng() * 16);
|
6730
6148
|
const v = c === "x" ? r : r & 3 | 8;
|
@@ -6736,11 +6154,6 @@ function generateTrackingId(rng) {
|
|
6736
6154
|
const trackingId = uuid.slice(0, 6).toUpperCase();
|
6737
6155
|
return trackingId;
|
6738
6156
|
}
|
6739
|
-
function generateRegistrationNumber(rng) {
|
6740
|
-
const uuid = generateUuid(rng).replace(/-/g, "");
|
6741
|
-
const registrationNumber = uuid.slice(0, 12).toUpperCase();
|
6742
|
-
return registrationNumber;
|
6743
|
-
}
|
6744
6157
|
function generateRandomSignature(rng) {
|
6745
6158
|
return `/random-bucket/${generateUuid(rng)}.png`;
|
6746
6159
|
}
|
@@ -6756,12 +6169,11 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
|
|
6756
6169
|
type: overrides.type ?? TENNIS_CLUB_MEMBERSHIP,
|
6757
6170
|
status: overrides.status ?? pickRandom(rng, EventStatus.options),
|
6758
6171
|
createdAt: overrides.createdAt ?? createdAt,
|
6759
|
-
createdByUserType: overrides.createdByUserType ?? "user",
|
6760
6172
|
createdBy: overrides.createdBy ?? generateUuid(rng),
|
6761
6173
|
createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
|
6762
6174
|
updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
|
6763
6175
|
createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
|
6764
|
-
updatedAt: overrides.updatedAt ?? (0,
|
6176
|
+
updatedAt: overrides.updatedAt ?? (0, import_addDays.default)(new Date(createdAt), 1).toISOString(),
|
6765
6177
|
assignedTo: overrides.assignedTo ?? null,
|
6766
6178
|
updatedBy: overrides.updatedBy ?? generateUuid(rng),
|
6767
6179
|
updatedByUserRole: overrides.updatedByUserRole ?? "FIELD_AGENT",
|
@@ -6833,7 +6245,235 @@ function isFieldConfigDefaultValue(value) {
|
|
6833
6245
|
}
|
6834
6246
|
|
6835
6247
|
// ../commons/src/events/scopes.ts
|
6836
|
-
var
|
6248
|
+
var import_lodash3 = require("lodash");
|
6249
|
+
|
6250
|
+
// ../commons/src/scopes.ts
|
6251
|
+
var import_zod31 = require("zod");
|
6252
|
+
var SCOPES = {
|
6253
|
+
// TODO v1.8 legacy scopes
|
6254
|
+
NATLSYSADMIN: "natlsysadmin",
|
6255
|
+
BYPASSRATELIMIT: "bypassratelimit",
|
6256
|
+
DECLARE: "declare",
|
6257
|
+
REGISTER: "register",
|
6258
|
+
VALIDATE: "validate",
|
6259
|
+
DEMO: "demo",
|
6260
|
+
CERTIFY: "certify",
|
6261
|
+
PERFORMANCE: "performance",
|
6262
|
+
SYSADMIN: "sysadmin",
|
6263
|
+
TEAMS: "teams",
|
6264
|
+
CONFIG: "config",
|
6265
|
+
// systems / integrations
|
6266
|
+
WEBHOOK: "webhook",
|
6267
|
+
NATIONALID: "nationalId",
|
6268
|
+
NOTIFICATION_API: "notification-api",
|
6269
|
+
RECORDSEARCH: "recordsearch",
|
6270
|
+
/**
|
6271
|
+
* @TODO This is a temporary scope to be used for V2 Events custom events declaration
|
6272
|
+
*/
|
6273
|
+
RECORD_DECLARE: "record.declare-birth",
|
6274
|
+
// declare
|
6275
|
+
RECORD_IMPORT: "record.import",
|
6276
|
+
// declare
|
6277
|
+
RECORD_DECLARE_BIRTH: "record.declare-birth",
|
6278
|
+
RECORD_DECLARE_BIRTH_MY_JURISDICTION: "record.declare-birth:my-jurisdiction",
|
6279
|
+
RECORD_DECLARE_DEATH: "record.declare-death",
|
6280
|
+
RECORD_DECLARE_DEATH_MY_JURISDICTION: "record.declare-death:my-jurisdiction",
|
6281
|
+
RECORD_DECLARE_MARRIAGE: "record.declare-marriage",
|
6282
|
+
RECORD_DECLARE_MARRIAGE_MY_JURISDICTION: "record.declare-marriage:my-jurisdiction",
|
6283
|
+
RECORD_SUBMIT_INCOMPLETE: "record.declaration-submit-incomplete",
|
6284
|
+
RECORD_SUBMIT_FOR_REVIEW: "record.declaration-submit-for-review",
|
6285
|
+
RECORD_UNASSIGN_OTHERS: "record.unassign-others",
|
6286
|
+
// validate
|
6287
|
+
RECORD_SUBMIT_FOR_APPROVAL: "record.declaration-submit-for-approval",
|
6288
|
+
RECORD_SUBMIT_FOR_UPDATES: "record.declaration-submit-for-updates",
|
6289
|
+
RECORD_DECLARATION_EDIT: "record.declaration-edit",
|
6290
|
+
RECORD_REVIEW_DUPLICATES: "record.review-duplicates",
|
6291
|
+
RECORD_DECLARATION_ARCHIVE: "record.declaration-archive",
|
6292
|
+
RECORD_DECLARATION_REINSTATE: "record.declaration-reinstate",
|
6293
|
+
// register
|
6294
|
+
RECORD_REGISTER: "record.register",
|
6295
|
+
// certify
|
6296
|
+
RECORD_EXPORT_RECORDS: "record.export-records",
|
6297
|
+
RECORD_DECLARATION_PRINT: "record.declaration-print",
|
6298
|
+
RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS: "record.declaration-print-supporting-documents",
|
6299
|
+
RECORD_REGISTRATION_PRINT: "record.registration-print",
|
6300
|
+
// v1.8
|
6301
|
+
/**
|
6302
|
+
* This scope is used to **print and **issue certified copies of a record
|
6303
|
+
* after it has been registered. Previously Registrars had this permission.
|
6304
|
+
*/
|
6305
|
+
RECORD_PRINT_ISSUE_CERTIFIED_COPIES: "record.registration-print&issue-certified-copies",
|
6306
|
+
RECORD_PRINT_CERTIFIED_COPIES: "record.registration-print-certified-copies",
|
6307
|
+
// v1.8
|
6308
|
+
RECORD_BULK_PRINT_CERTIFIED_COPIES: "record.registration-bulk-print-certified-copies",
|
6309
|
+
// v1.8
|
6310
|
+
RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES: "record.registration-verify-certified-copies",
|
6311
|
+
// v1.8
|
6312
|
+
// correct
|
6313
|
+
RECORD_REGISTRATION_REQUEST_CORRECTION: "record.registration-request-correction",
|
6314
|
+
RECORD_REGISTRATION_CORRECT: "record.registration-correct",
|
6315
|
+
RECORD_REGISTRATION_REQUEST_REVOCATION: "record.registration-request-revocation",
|
6316
|
+
// v1.8
|
6317
|
+
RECORD_REGISTRATION_REVOKE: "record.registration-revoke",
|
6318
|
+
// v1.8
|
6319
|
+
RECORD_REGISTRATION_REQUEST_REINSTATEMENT: "record.registration-request-reinstatement",
|
6320
|
+
// v1.8
|
6321
|
+
RECORD_REGISTRATION_REINSTATE: "record.registration-reinstate",
|
6322
|
+
// v1.8
|
6323
|
+
RECORD_CONFIRM_REGISTRATION: "record.confirm-registration",
|
6324
|
+
RECORD_REJECT_REGISTRATION: "record.reject-registration",
|
6325
|
+
// search
|
6326
|
+
SEARCH_BIRTH_MY_JURISDICTION: "search.birth:my-jurisdiction",
|
6327
|
+
SEARCH_BIRTH: "search.birth",
|
6328
|
+
SEARCH_DEATH_MY_JURISDICTION: "search.death:my-jurisdiction",
|
6329
|
+
SEARCH_DEATH: "search.death",
|
6330
|
+
SEARCH_MARRIAGE_MY_JURISDICTION: "search.marriage:my-jurisdiction",
|
6331
|
+
SEARCH_MARRIAGE: "search.marriage",
|
6332
|
+
// audit v1.8
|
6333
|
+
RECORD_READ: "record.read",
|
6334
|
+
RECORD_READ_AUDIT: "record.read-audit",
|
6335
|
+
RECORD_READ_COMMENTS: "record.read-comments",
|
6336
|
+
RECORD_CREATE_COMMENTS: "record.create-comments",
|
6337
|
+
// profile
|
6338
|
+
PROFILE_UPDATE: "profile.update",
|
6339
|
+
//v1.8
|
6340
|
+
PROFILE_ELECTRONIC_SIGNATURE: "profile.electronic-signature",
|
6341
|
+
// performance
|
6342
|
+
PERFORMANCE_READ: "performance.read",
|
6343
|
+
PERFORMANCE_READ_DASHBOARDS: "performance.read-dashboards",
|
6344
|
+
PERFORMANCE_EXPORT_VITAL_STATISTICS: "performance.vital-statistics-export",
|
6345
|
+
// organisation
|
6346
|
+
ORGANISATION_READ_LOCATIONS: "organisation.read-locations:all",
|
6347
|
+
ORGANISATION_READ_LOCATIONS_MY_OFFICE: "organisation.read-locations:my-office",
|
6348
|
+
ORGANISATION_READ_LOCATIONS_MY_JURISDICTION: "organisation.read-locations:my-jurisdiction",
|
6349
|
+
// user
|
6350
|
+
USER_READ: "user.read:all",
|
6351
|
+
USER_READ_MY_OFFICE: "user.read:my-office",
|
6352
|
+
USER_READ_MY_JURISDICTION: "user.read:my-jurisdiction",
|
6353
|
+
USER_READ_ONLY_MY_AUDIT: "user.read:only-my-audit",
|
6354
|
+
//v1.8
|
6355
|
+
USER_CREATE: "user.create:all",
|
6356
|
+
USER_CREATE_MY_JURISDICTION: "user.create:my-jurisdiction",
|
6357
|
+
USER_UPDATE: "user.update:all",
|
6358
|
+
USER_UPDATE_MY_JURISDICTION: "user.update:my-jurisdiction",
|
6359
|
+
// config
|
6360
|
+
CONFIG_UPDATE_ALL: "config.update:all",
|
6361
|
+
// data seeding
|
6362
|
+
USER_DATA_SEEDING: "user.data-seeding"
|
6363
|
+
};
|
6364
|
+
var LiteralScopes = import_zod31.z.union([
|
6365
|
+
import_zod31.z.literal(SCOPES.NATLSYSADMIN),
|
6366
|
+
import_zod31.z.literal(SCOPES.BYPASSRATELIMIT),
|
6367
|
+
import_zod31.z.literal(SCOPES.DECLARE),
|
6368
|
+
import_zod31.z.literal(SCOPES.REGISTER),
|
6369
|
+
import_zod31.z.literal(SCOPES.VALIDATE),
|
6370
|
+
import_zod31.z.literal(SCOPES.DEMO),
|
6371
|
+
import_zod31.z.literal(SCOPES.CERTIFY),
|
6372
|
+
import_zod31.z.literal(SCOPES.PERFORMANCE),
|
6373
|
+
import_zod31.z.literal(SCOPES.SYSADMIN),
|
6374
|
+
import_zod31.z.literal(SCOPES.TEAMS),
|
6375
|
+
import_zod31.z.literal(SCOPES.CONFIG),
|
6376
|
+
import_zod31.z.literal(SCOPES.WEBHOOK),
|
6377
|
+
import_zod31.z.literal(SCOPES.NATIONALID),
|
6378
|
+
import_zod31.z.literal(SCOPES.NOTIFICATION_API),
|
6379
|
+
import_zod31.z.literal(SCOPES.RECORDSEARCH),
|
6380
|
+
import_zod31.z.literal(SCOPES.RECORD_IMPORT),
|
6381
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
|
6382
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
|
6383
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_DEATH),
|
6384
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
|
6385
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
|
6386
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
|
6387
|
+
import_zod31.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
|
6388
|
+
import_zod31.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW),
|
6389
|
+
import_zod31.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS),
|
6390
|
+
import_zod31.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
|
6391
|
+
import_zod31.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
|
6392
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
|
6393
|
+
import_zod31.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
|
6394
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
|
6395
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE),
|
6396
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTER),
|
6397
|
+
import_zod31.z.literal(SCOPES.RECORD_EXPORT_RECORDS),
|
6398
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARATION_PRINT),
|
6399
|
+
import_zod31.z.literal(SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS),
|
6400
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_PRINT),
|
6401
|
+
import_zod31.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
|
6402
|
+
import_zod31.z.literal(SCOPES.RECORD_PRINT_CERTIFIED_COPIES),
|
6403
|
+
import_zod31.z.literal(SCOPES.RECORD_BULK_PRINT_CERTIFIED_COPIES),
|
6404
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES),
|
6405
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
|
6406
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
|
6407
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REVOCATION),
|
6408
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REVOKE),
|
6409
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REINSTATEMENT),
|
6410
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REINSTATE),
|
6411
|
+
import_zod31.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
|
6412
|
+
import_zod31.z.literal(SCOPES.RECORD_REJECT_REGISTRATION),
|
6413
|
+
import_zod31.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
|
6414
|
+
import_zod31.z.literal(SCOPES.SEARCH_BIRTH),
|
6415
|
+
import_zod31.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
|
6416
|
+
import_zod31.z.literal(SCOPES.SEARCH_DEATH),
|
6417
|
+
import_zod31.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
|
6418
|
+
import_zod31.z.literal(SCOPES.SEARCH_MARRIAGE),
|
6419
|
+
import_zod31.z.literal(SCOPES.RECORD_READ),
|
6420
|
+
import_zod31.z.literal(SCOPES.RECORD_READ_AUDIT),
|
6421
|
+
import_zod31.z.literal(SCOPES.RECORD_READ_COMMENTS),
|
6422
|
+
import_zod31.z.literal(SCOPES.RECORD_CREATE_COMMENTS),
|
6423
|
+
import_zod31.z.literal(SCOPES.PROFILE_UPDATE),
|
6424
|
+
import_zod31.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE),
|
6425
|
+
import_zod31.z.literal(SCOPES.PERFORMANCE_READ),
|
6426
|
+
import_zod31.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
|
6427
|
+
import_zod31.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS),
|
6428
|
+
import_zod31.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
|
6429
|
+
import_zod31.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
|
6430
|
+
import_zod31.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION),
|
6431
|
+
import_zod31.z.literal(SCOPES.USER_READ),
|
6432
|
+
import_zod31.z.literal(SCOPES.USER_READ_MY_OFFICE),
|
6433
|
+
import_zod31.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
|
6434
|
+
import_zod31.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
|
6435
|
+
import_zod31.z.literal(SCOPES.USER_CREATE),
|
6436
|
+
import_zod31.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
|
6437
|
+
import_zod31.z.literal(SCOPES.USER_UPDATE),
|
6438
|
+
import_zod31.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION),
|
6439
|
+
import_zod31.z.literal(SCOPES.CONFIG_UPDATE_ALL),
|
6440
|
+
import_zod31.z.literal(SCOPES.USER_DATA_SEEDING)
|
6441
|
+
]);
|
6442
|
+
var rawConfigurableScopeRegex = /^([a-zA-Z\.]+)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
|
6443
|
+
var rawConfigurableScope = import_zod31.z.string().regex(rawConfigurableScopeRegex);
|
6444
|
+
var CreateUserScope = import_zod31.z.object({
|
6445
|
+
type: import_zod31.z.literal("user.create"),
|
6446
|
+
options: import_zod31.z.object({
|
6447
|
+
role: import_zod31.z.array(import_zod31.z.string())
|
6448
|
+
})
|
6449
|
+
});
|
6450
|
+
var EditUserScope = import_zod31.z.object({
|
6451
|
+
type: import_zod31.z.literal("user.edit"),
|
6452
|
+
options: import_zod31.z.object({
|
6453
|
+
role: import_zod31.z.array(import_zod31.z.string())
|
6454
|
+
})
|
6455
|
+
});
|
6456
|
+
var WorkqueueScope = import_zod31.z.object({
|
6457
|
+
type: import_zod31.z.literal("workqueue"),
|
6458
|
+
options: import_zod31.z.object({
|
6459
|
+
id: import_zod31.z.array(import_zod31.z.string())
|
6460
|
+
})
|
6461
|
+
});
|
6462
|
+
var NotifyRecordScope = import_zod31.z.object({
|
6463
|
+
type: import_zod31.z.literal("record.notify"),
|
6464
|
+
options: import_zod31.z.object({
|
6465
|
+
event: import_zod31.z.array(import_zod31.z.string())
|
6466
|
+
})
|
6467
|
+
});
|
6468
|
+
var ConfigurableScopes = import_zod31.z.discriminatedUnion("type", [
|
6469
|
+
CreateUserScope,
|
6470
|
+
EditUserScope,
|
6471
|
+
WorkqueueScope,
|
6472
|
+
NotifyRecordScope
|
6473
|
+
]);
|
6474
|
+
var scopes = Object.values(SCOPES);
|
6475
|
+
|
6476
|
+
// ../commons/src/events/scopes.ts
|
6837
6477
|
var CONFIG_GET_ALLOWED_SCOPES = [
|
6838
6478
|
SCOPES.RECORD_DECLARE,
|
6839
6479
|
SCOPES.RECORD_READ,
|
@@ -6910,20 +6550,30 @@ var ACTION_ALLOWED_CONFIGURABLE_SCOPES = {
|
|
6910
6550
|
[ActionType.UNASSIGN]: [],
|
6911
6551
|
[ActionType.DETECT_DUPLICATE]: []
|
6912
6552
|
};
|
6913
|
-
var WRITE_ACTION_SCOPES = [
|
6914
|
-
...ACTION_ALLOWED_SCOPES[ActionType.DECLARE],
|
6915
|
-
...ACTION_ALLOWED_SCOPES[ActionType.VALIDATE],
|
6916
|
-
...ACTION_ALLOWED_SCOPES[ActionType.REGISTER],
|
6917
|
-
...ACTION_ALLOWED_SCOPES[ActionType.PRINT_CERTIFICATE]
|
6918
|
-
];
|
6919
6553
|
function hasAnyOfScopes(a, b) {
|
6920
|
-
return (0,
|
6554
|
+
return (0, import_lodash3.intersection)(a, b).length > 0;
|
6555
|
+
}
|
6556
|
+
function filterUnallowedActions(actions, userScopes) {
|
6557
|
+
const allowedActions = actions.filter((action) => {
|
6558
|
+
const requiredScopes = ACTION_ALLOWED_SCOPES[action];
|
6559
|
+
if (requiredScopes === null) {
|
6560
|
+
return true;
|
6561
|
+
}
|
6562
|
+
return hasAnyOfScopes(userScopes, requiredScopes);
|
6563
|
+
});
|
6564
|
+
const hasOtherAllowedActions = allowedActions.some(
|
6565
|
+
(action) => !isMetaAction(action)
|
6566
|
+
);
|
6567
|
+
if (hasOtherAllowedActions) {
|
6568
|
+
return allowedActions;
|
6569
|
+
}
|
6570
|
+
return [ActionType.READ];
|
6921
6571
|
}
|
6922
6572
|
|
6923
6573
|
// ../commons/src/events/serializers/user/deserializer.ts
|
6924
|
-
var
|
6574
|
+
var import_zod32 = require("zod");
|
6925
6575
|
var UserWithPrimaryOffice = User.extend({
|
6926
|
-
primaryOfficeId:
|
6576
|
+
primaryOfficeId: import_zod32.z.string()
|
6927
6577
|
});
|
6928
6578
|
function userDeserializer(serializedUserField, user2) {
|
6929
6579
|
if (typeof serializedUserField === "string") {
|
@@ -6943,7 +6593,6 @@ function deserializeQueryExpression(expression, user2) {
|
|
6943
6593
|
...expression.assignedTo,
|
6944
6594
|
term: userDeserializer(expression.assignedTo.term, user2)
|
6945
6595
|
},
|
6946
|
-
createdByUserType: expression.createdByUserType,
|
6947
6596
|
createdBy: expression.createdBy && {
|
6948
6597
|
...expression.createdBy,
|
6949
6598
|
term: userDeserializer(expression.createdBy.term, user2)
|
@@ -6984,51 +6633,3 @@ function deserializeQuery(query, user2) {
|
|
6984
6633
|
)
|
6985
6634
|
};
|
6986
6635
|
}
|
6987
|
-
|
6988
|
-
// ../commons/src/events/state/availableActions.ts
|
6989
|
-
var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
6990
|
-
[EventStatus.enum.CREATED]: [
|
6991
|
-
ActionType.READ,
|
6992
|
-
ActionType.DECLARE,
|
6993
|
-
ActionType.NOTIFY,
|
6994
|
-
ActionType.DELETE
|
6995
|
-
],
|
6996
|
-
[EventStatus.enum.NOTIFIED]: [
|
6997
|
-
ActionType.READ,
|
6998
|
-
ActionType.DECLARE,
|
6999
|
-
ActionType.ARCHIVE,
|
7000
|
-
ActionType.REJECT
|
7001
|
-
],
|
7002
|
-
[EventStatus.enum.DECLARED]: [
|
7003
|
-
ActionType.READ,
|
7004
|
-
ActionType.VALIDATE,
|
7005
|
-
ActionType.ARCHIVE,
|
7006
|
-
ActionType.REJECT
|
7007
|
-
],
|
7008
|
-
[EventStatus.enum.VALIDATED]: [
|
7009
|
-
ActionType.READ,
|
7010
|
-
ActionType.REGISTER,
|
7011
|
-
ActionType.ARCHIVE,
|
7012
|
-
ActionType.REJECT
|
7013
|
-
],
|
7014
|
-
[EventStatus.enum.REJECTED]: [
|
7015
|
-
ActionType.READ,
|
7016
|
-
ActionType.DECLARE,
|
7017
|
-
ActionType.VALIDATE
|
7018
|
-
],
|
7019
|
-
[EventStatus.enum.REGISTERED]: [
|
7020
|
-
ActionType.READ,
|
7021
|
-
ActionType.PRINT_CERTIFICATE,
|
7022
|
-
ActionType.REQUEST_CORRECTION
|
7023
|
-
],
|
7024
|
-
[EventStatus.enum.CERTIFIED]: [
|
7025
|
-
ActionType.READ,
|
7026
|
-
ActionType.PRINT_CERTIFICATE,
|
7027
|
-
ActionType.REQUEST_CORRECTION
|
7028
|
-
],
|
7029
|
-
[EventStatus.enum.ARCHIVED]: [
|
7030
|
-
ActionType.READ,
|
7031
|
-
ActionType.ASSIGN,
|
7032
|
-
ActionType.UNASSIGN
|
7033
|
-
]
|
7034
|
-
};
|