@opencrvs/toolkit 2.1.0-rc.d078d1a → 2.1.0-rc.d1b9774
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/README.md +1 -0
- package/build.sh +9 -1
- package/create-countryconfig/index.js +284 -62
- package/create-countryconfig/node_modules/.bin/degit +21 -0
- package/create-countryconfig/package.json +4 -1
- package/dist/application-config/index.js +265 -209
- package/dist/authentication/index.d.ts +67 -0
- package/dist/authentication/index.d.ts.map +1 -0
- package/dist/authentication/index.js +750 -0
- package/dist/cli.js +1744 -104
- package/dist/commons/api/router.d.ts +599 -69
- package/dist/commons/conditionals/conditionals.d.ts +6 -6
- package/dist/commons/conditionals/validate.d.ts +13 -11
- package/dist/commons/events/ActionDocument.d.ts +4 -4
- package/dist/commons/events/ActionInput.d.ts +4 -4
- package/dist/commons/events/AdvancedSearchConfig.d.ts +12 -0
- package/dist/commons/events/AuditLog.d.ts +110 -0
- package/dist/commons/events/EventDocument.d.ts +470 -2
- package/dist/commons/events/EventIndex.d.ts +2 -2
- package/dist/commons/events/EventMetadata.d.ts +1 -11
- package/dist/commons/events/EventStatus.d.ts +19 -0
- package/dist/commons/events/FieldConfig.d.ts +78 -53
- package/dist/commons/events/FieldTypeMapping.d.ts +12 -12
- package/dist/commons/events/FieldValue.d.ts +2 -2
- package/dist/commons/events/PlainDate.d.ts +8 -0
- package/dist/commons/events/SummaryConfig.d.ts +249 -0
- package/dist/commons/events/locations.d.ts +158 -26
- package/dist/commons/events/mocks.test.utils.d.ts +30 -0
- package/dist/commons/events/test.utils.d.ts +8 -4
- package/dist/commons/events/utils.d.ts +2 -2
- package/dist/commons/notification/UserNotifications.d.ts +28 -13
- package/dist/commons/notification/dispatch.d.ts +10 -0
- package/dist/commons/notification/index.d.ts +1 -0
- package/dist/conditionals/index.js +79 -57
- package/dist/csv.d.ts +25 -0
- package/dist/csv.d.ts.map +1 -0
- package/dist/csv.js +120 -0
- package/dist/environment/index.d.ts +1 -0
- package/dist/environment/index.d.ts.map +1 -1
- package/dist/environment/index.js +10 -0
- package/dist/environment/logger.d.ts +15 -3
- package/dist/environment/logger.d.ts.map +1 -1
- package/dist/environment/paths.d.ts +7 -0
- package/dist/environment/paths.d.ts.map +1 -0
- package/dist/environment/paths.js +72 -0
- package/dist/environment/questions.d.ts.map +1 -1
- package/dist/environment/questions.js +20 -14
- package/dist/environment/setup-environment.js +3 -2
- package/dist/environment/templates.d.ts.map +1 -1
- package/dist/environment/templates.js +2 -1
- package/dist/environment/update-workflows.d.ts.map +1 -1
- package/dist/environment/update-workflows.js +17 -5
- package/dist/environment/upgrade.d.ts +2 -0
- package/dist/environment/upgrade.d.ts.map +1 -0
- package/dist/environment/upgrade.js +82 -0
- package/dist/environment/users.js +11 -13
- package/dist/events/index.js +1079 -843
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +2 -2
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.js +2 -2
- package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts +3 -0
- package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts.map +1 -0
- package/dist/migrations/v2.1/add-recovery-link-notifications.js +511 -0
- package/dist/migrations/v2.1/add-translations.d.ts +9 -0
- package/dist/migrations/v2.1/add-translations.d.ts.map +1 -0
- package/dist/migrations/v2.1/add-translations.js +213 -0
- package/dist/migrations/v2.1/enable-telemetry.d.ts +3 -0
- package/dist/migrations/v2.1/enable-telemetry.d.ts.map +1 -0
- package/dist/migrations/v2.1/enable-telemetry.js +438 -0
- package/dist/migrations/v2.1/index.d.ts.map +1 -1
- package/dist/migrations/v2.1/index.js +1058 -0
- package/dist/notification/index.js +1149 -1419
- package/dist/scopes/index.d.ts +102 -32
- package/dist/scopes/index.js +79 -57
- package/dist/telemetry/index.d.ts +45 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +39 -0
- package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -3
- package/dist/templates/charts-values/opentelemetry/values.yaml +95 -0
- package/dist/templates/charts-values/traefik/values.yaml +23 -9
- package/dist/templates/inventory/inventory.template.yml +1 -3
- package/dist/translations/check.d.ts +19 -0
- package/dist/translations/check.d.ts.map +1 -0
- package/dist/translations/check.js +127 -0
- package/dist/verify/endpoints.d.ts +2 -0
- package/dist/verify/endpoints.d.ts.map +1 -0
- package/dist/verify/endpoints.js +345 -0
- package/opencrvs-toolkit-2.1.0-rc.d1b9774.tgz +0 -0
- package/package.json +12 -7
- package/tsconfig.build.json +11 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +3 -0
- package/dist/templates/inventory/production.example.yml +0 -77
- package/dist/templates/inventory/qa.example.yml +0 -48
- package/opencrvs-toolkit-2.1.0-rc.d078d1a.tgz +0 -0
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -38,23 +38,17 @@ __export(notification_exports, {
|
|
|
38
38
|
triggerUserEventNotification: () => triggerUserEventNotification
|
|
39
39
|
});
|
|
40
40
|
module.exports = __toCommonJS(notification_exports);
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
// ../commons/src/url.ts
|
|
44
|
-
function joinUrl(base, path) {
|
|
45
|
-
const baseWithSlash = base.endsWith("/") ? base : base + "/";
|
|
46
|
-
return new URL(path, baseWithSlash);
|
|
47
|
-
}
|
|
41
|
+
var z47 = __toESM(require("zod/v4"));
|
|
48
42
|
|
|
49
43
|
// ../commons/src/events/AuditLog.ts
|
|
50
|
-
var
|
|
44
|
+
var z9 = __toESM(require("zod/v4"));
|
|
51
45
|
|
|
52
46
|
// ../commons/src/authentication.ts
|
|
53
47
|
var import_jwt_decode = __toESM(require("jwt-decode"));
|
|
54
|
-
var
|
|
48
|
+
var z8 = __toESM(require("zod/v4"));
|
|
55
49
|
|
|
56
50
|
// ../commons/src/scopes.ts
|
|
57
|
-
var
|
|
51
|
+
var z7 = __toESM(require("zod/v4"));
|
|
58
52
|
var qs = __toESM(require("qs"));
|
|
59
53
|
|
|
60
54
|
// ../commons/src/uuid.ts
|
|
@@ -175,9 +169,6 @@ var META_ACTIONS = [
|
|
|
175
169
|
ActionType.UNASSIGN,
|
|
176
170
|
ActionType.READ
|
|
177
171
|
];
|
|
178
|
-
function isMetaAction(actionType) {
|
|
179
|
-
return META_ACTIONS.includes(actionType);
|
|
180
|
-
}
|
|
181
172
|
|
|
182
173
|
// ../commons/src/events/ActionStatus.ts
|
|
183
174
|
var ActionStatus = {
|
|
@@ -316,12 +307,22 @@ var ActionFlagConfig = z5.object({
|
|
|
316
307
|
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
317
308
|
});
|
|
318
309
|
|
|
310
|
+
// ../commons/src/events/EventStatus.ts
|
|
311
|
+
var z6 = __toESM(require("zod/v4"));
|
|
312
|
+
var EventStatus = z6.enum([
|
|
313
|
+
"CREATED",
|
|
314
|
+
"NOTIFIED",
|
|
315
|
+
"DECLARED",
|
|
316
|
+
"REGISTERED",
|
|
317
|
+
"ARCHIVED"
|
|
318
|
+
]);
|
|
319
|
+
|
|
319
320
|
// ../commons/src/scopes.ts
|
|
320
|
-
var JurisdictionFilter =
|
|
321
|
+
var JurisdictionFilter = z7.enum(["administrativeArea", "location", "all"]).describe(
|
|
321
322
|
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
322
323
|
);
|
|
323
|
-
var UserFilter =
|
|
324
|
-
var RecordScopeTypeV2 =
|
|
324
|
+
var UserFilter = z7.enum(["user"]).describe("Filters based on the user. Limits to self.");
|
|
325
|
+
var RecordScopeTypeV2 = z7.enum([
|
|
325
326
|
"record.search",
|
|
326
327
|
"record.create",
|
|
327
328
|
"record.read",
|
|
@@ -339,12 +340,17 @@ var RecordScopeTypeV2 = z6.enum([
|
|
|
339
340
|
"record.unassign-others",
|
|
340
341
|
"record.custom-action"
|
|
341
342
|
]);
|
|
342
|
-
var PlainScopeType =
|
|
343
|
+
var PlainScopeType = z7.enum([
|
|
343
344
|
// Misc. system scopes
|
|
344
345
|
"bypassratelimit",
|
|
345
346
|
"record.reindex",
|
|
346
347
|
"user.data-seeding",
|
|
347
348
|
"integration.create",
|
|
349
|
+
// Reading an integration's audit log. Deliberately separate from
|
|
350
|
+
// 'integration.create' so read-only oversight can be granted on its own, and
|
|
351
|
+
// deliberately option-less: system clients have no office and no
|
|
352
|
+
// administrative area, so jurisdiction options would have nothing to bind to.
|
|
353
|
+
"integration.audit.read",
|
|
348
354
|
"record.import",
|
|
349
355
|
"config.update-all",
|
|
350
356
|
"location.edit",
|
|
@@ -359,15 +365,21 @@ var PlainScopeType = z6.enum([
|
|
|
359
365
|
"record.confirm-registration",
|
|
360
366
|
"record.reject-registration"
|
|
361
367
|
]);
|
|
362
|
-
var scopeByEvent =
|
|
368
|
+
var scopeByEvent = z7.preprocess(
|
|
363
369
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
364
|
-
|
|
370
|
+
z7.array(z7.string()).optional()
|
|
365
371
|
).describe("Event type, e.g. birth, death");
|
|
366
|
-
var
|
|
372
|
+
var scopeByStatus = z7.preprocess(
|
|
367
373
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
368
|
-
|
|
374
|
+
z7.array(EventStatus).optional()
|
|
375
|
+
).describe(
|
|
376
|
+
"Restricts the scope to records currently in one of these statuses."
|
|
377
|
+
);
|
|
378
|
+
var userRole = z7.preprocess(
|
|
379
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
380
|
+
z7.array(z7.string()).optional()
|
|
369
381
|
).describe("User role, e.g. admin, field agent");
|
|
370
|
-
var scopeOptionsPlaceEvent =
|
|
382
|
+
var scopeOptionsPlaceEvent = z7.object({
|
|
371
383
|
event: scopeByEvent,
|
|
372
384
|
placeOfEvent: JurisdictionFilter.optional()
|
|
373
385
|
}).describe("Options applicable to all record scopes.");
|
|
@@ -375,7 +387,8 @@ var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
|
375
387
|
notifiedIn: JurisdictionFilter.optional(),
|
|
376
388
|
notifiedBy: UserFilter.optional(),
|
|
377
389
|
declaredIn: JurisdictionFilter.optional(),
|
|
378
|
-
declaredBy: UserFilter.optional()
|
|
390
|
+
declaredBy: UserFilter.optional(),
|
|
391
|
+
status: scopeByStatus
|
|
379
392
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
380
393
|
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
381
394
|
registeredIn: JurisdictionFilter.optional(),
|
|
@@ -385,31 +398,31 @@ var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
|
385
398
|
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
386
399
|
);
|
|
387
400
|
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
388
|
-
customActionTypes:
|
|
401
|
+
customActionTypes: z7.preprocess(
|
|
389
402
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
390
|
-
|
|
403
|
+
z7.array(z7.string()).optional()
|
|
391
404
|
).describe("Allowed custom action types")
|
|
392
405
|
});
|
|
393
|
-
var AccessLevelOptions =
|
|
406
|
+
var AccessLevelOptions = z7.object({
|
|
394
407
|
accessLevel: JurisdictionFilter.optional()
|
|
395
408
|
});
|
|
396
409
|
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
397
410
|
role: userRole.optional()
|
|
398
411
|
});
|
|
399
|
-
var WorkqueueOrDashboardOptions =
|
|
400
|
-
ids:
|
|
412
|
+
var WorkqueueOrDashboardOptions = z7.object({
|
|
413
|
+
ids: z7.preprocess(
|
|
401
414
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
402
|
-
|
|
415
|
+
z7.array(z7.string())
|
|
403
416
|
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
404
417
|
});
|
|
405
|
-
var AllScopeOptions =
|
|
418
|
+
var AllScopeOptions = z7.object({
|
|
406
419
|
...AllRecordScopeOptions.shape,
|
|
407
420
|
...AccessLevelOptions.shape,
|
|
408
421
|
...AllUserScopeOptions.shape,
|
|
409
422
|
...WorkqueueOrDashboardOptions.shape
|
|
410
423
|
});
|
|
411
424
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
412
|
-
var ResolvedScopeOptionsPlaceEvent =
|
|
425
|
+
var ResolvedScopeOptionsPlaceEvent = z7.object({
|
|
413
426
|
event: scopeByEvent,
|
|
414
427
|
placeOfEvent: UUID.nullish()
|
|
415
428
|
}).describe(
|
|
@@ -417,15 +430,15 @@ var ResolvedScopeOptionsPlaceEvent = z6.object({
|
|
|
417
430
|
);
|
|
418
431
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
419
432
|
notifiedIn: UUID.nullish(),
|
|
420
|
-
notifiedBy:
|
|
433
|
+
notifiedBy: z7.string().optional(),
|
|
421
434
|
declaredIn: UUID.nullish(),
|
|
422
|
-
declaredBy:
|
|
435
|
+
declaredBy: z7.string().optional()
|
|
423
436
|
}).describe(
|
|
424
437
|
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
425
438
|
);
|
|
426
439
|
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
427
440
|
registeredIn: UUID.nullish(),
|
|
428
|
-
registeredBy:
|
|
441
|
+
registeredBy: z7.string().optional(),
|
|
429
442
|
flags: ContainsFlags.optional()
|
|
430
443
|
}).describe(
|
|
431
444
|
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
@@ -440,7 +453,6 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
|
440
453
|
"record.reject",
|
|
441
454
|
"record.archive",
|
|
442
455
|
"record.unarchive",
|
|
443
|
-
"record.review-duplicates",
|
|
444
456
|
"record.register"
|
|
445
457
|
]);
|
|
446
458
|
var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
@@ -448,41 +460,42 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
|
448
460
|
"record.read",
|
|
449
461
|
"record.request-correction",
|
|
450
462
|
"record.correct",
|
|
451
|
-
"record.unassign-others"
|
|
463
|
+
"record.unassign-others",
|
|
464
|
+
"record.review-duplicates"
|
|
452
465
|
]);
|
|
453
466
|
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
454
|
-
templates:
|
|
467
|
+
templates: z7.preprocess(
|
|
455
468
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
456
|
-
|
|
469
|
+
z7.array(z7.string()).optional()
|
|
457
470
|
).describe(
|
|
458
471
|
"Template IDs for certified copies. Controls which certificate templates are returned to the client via the config service. Certificate printing is a client-side operation \u2014 this option is not validated when the printCertificate action is submitted."
|
|
459
472
|
)
|
|
460
473
|
});
|
|
461
|
-
var RecordScopeV2 =
|
|
462
|
-
|
|
474
|
+
var RecordScopeV2 = z7.discriminatedUnion("type", [
|
|
475
|
+
z7.object({
|
|
463
476
|
type: ScopesWithPlaceEventOptions,
|
|
464
477
|
options: scopeOptionsPlaceEvent.optional()
|
|
465
478
|
}),
|
|
466
|
-
|
|
479
|
+
z7.object({
|
|
467
480
|
type: ScopesWithDeclaredOptions,
|
|
468
481
|
options: scopeOptionsDeclaredOrNotified.optional()
|
|
469
482
|
}),
|
|
470
|
-
|
|
483
|
+
z7.object({
|
|
471
484
|
type: ScopesWithFullOptions,
|
|
472
485
|
options: AllRecordScopeOptions.optional()
|
|
473
486
|
}),
|
|
474
|
-
|
|
475
|
-
type:
|
|
487
|
+
z7.object({
|
|
488
|
+
type: z7.literal("record.custom-action"),
|
|
476
489
|
options: CustomActionScopeOptions.optional()
|
|
477
490
|
}),
|
|
478
|
-
|
|
479
|
-
type:
|
|
491
|
+
z7.object({
|
|
492
|
+
type: z7.literal("record.print-certified-copies"),
|
|
480
493
|
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
481
494
|
})
|
|
482
495
|
]).describe(
|
|
483
496
|
"Scopes used to check user's permission to perform actions on a record."
|
|
484
497
|
);
|
|
485
|
-
var SystemScopeType =
|
|
498
|
+
var SystemScopeType = z7.enum([
|
|
486
499
|
"organisation.read-locations",
|
|
487
500
|
"user.read",
|
|
488
501
|
"user.create",
|
|
@@ -496,61 +509,61 @@ var UserScopeType = SystemScopeType.extract([
|
|
|
496
509
|
"user.search"
|
|
497
510
|
]);
|
|
498
511
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
499
|
-
var UserScopeV2 =
|
|
500
|
-
|
|
512
|
+
var UserScopeV2 = z7.discriminatedUnion("type", [
|
|
513
|
+
z7.object({
|
|
501
514
|
type: ScopesWithRoleOption,
|
|
502
515
|
options: AllUserScopeOptions.optional()
|
|
503
516
|
}),
|
|
504
|
-
|
|
517
|
+
z7.object({
|
|
505
518
|
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
506
519
|
options: AccessLevelOptions.optional()
|
|
507
520
|
})
|
|
508
521
|
]);
|
|
509
|
-
var ResolvedRecordScopeV2 =
|
|
510
|
-
|
|
522
|
+
var ResolvedRecordScopeV2 = z7.discriminatedUnion("type", [
|
|
523
|
+
z7.object({
|
|
511
524
|
type: ScopesWithPlaceEventOptions,
|
|
512
525
|
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
513
526
|
}),
|
|
514
|
-
|
|
527
|
+
z7.object({
|
|
515
528
|
type: ScopesWithDeclaredOptions,
|
|
516
529
|
options: ResolvedScopeOptionsDeclared.optional()
|
|
517
530
|
}),
|
|
518
|
-
|
|
531
|
+
z7.object({
|
|
519
532
|
type: ScopesWithFullOptions,
|
|
520
533
|
options: ResolvedScopeOptionsFull.optional()
|
|
521
534
|
}),
|
|
522
|
-
|
|
523
|
-
type:
|
|
535
|
+
z7.object({
|
|
536
|
+
type: z7.literal("record.print-certified-copies"),
|
|
524
537
|
options: ResolvedScopeOptionsFull.extend({
|
|
525
|
-
templates:
|
|
538
|
+
templates: z7.array(z7.string()).optional()
|
|
526
539
|
}).optional()
|
|
527
540
|
})
|
|
528
541
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
529
|
-
var Scope =
|
|
530
|
-
|
|
542
|
+
var Scope = z7.discriminatedUnion("type", [
|
|
543
|
+
z7.object({ type: PlainScopeType }),
|
|
531
544
|
...RecordScopeV2.options,
|
|
532
545
|
...UserScopeV2.options,
|
|
533
|
-
|
|
534
|
-
type:
|
|
546
|
+
z7.object({
|
|
547
|
+
type: z7.literal("organisation.read-locations"),
|
|
535
548
|
options: AccessLevelOptions.optional()
|
|
536
549
|
}),
|
|
537
|
-
|
|
538
|
-
type:
|
|
550
|
+
z7.object({
|
|
551
|
+
type: z7.literal("workqueue"),
|
|
539
552
|
options: WorkqueueOrDashboardOptions
|
|
540
553
|
}),
|
|
541
|
-
|
|
542
|
-
type:
|
|
554
|
+
z7.object({
|
|
555
|
+
type: z7.literal("dashboard.view"),
|
|
543
556
|
options: WorkqueueOrDashboardOptions
|
|
544
557
|
})
|
|
545
558
|
]);
|
|
546
|
-
var ScopeType =
|
|
559
|
+
var ScopeType = z7.enum([
|
|
547
560
|
...SystemScopeType.options,
|
|
548
561
|
...RecordScopeTypeV2.options,
|
|
549
562
|
...PlainScopeType.options,
|
|
550
563
|
"workqueue",
|
|
551
564
|
"dashboard.view"
|
|
552
565
|
]);
|
|
553
|
-
var EncodedScope =
|
|
566
|
+
var EncodedScope = z7.string().brand("EncodedScope");
|
|
554
567
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
555
568
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
556
569
|
accessLevel: JurisdictionFilter.enum.all,
|
|
@@ -560,51 +573,51 @@ var DEFAULT_SCOPE_OPTIONS = {
|
|
|
560
573
|
};
|
|
561
574
|
|
|
562
575
|
// ../commons/src/authentication.ts
|
|
563
|
-
var TokenUserType =
|
|
564
|
-
var TokenWithBearer =
|
|
576
|
+
var TokenUserType = z8.enum(["user", "system"]);
|
|
577
|
+
var TokenWithBearer = z8.string().regex(/^Bearer\s/);
|
|
565
578
|
|
|
566
579
|
// ../commons/src/events/AuditLog.ts
|
|
567
|
-
var AuditLogEntryBase =
|
|
568
|
-
id:
|
|
569
|
-
clientId:
|
|
580
|
+
var AuditLogEntryBase = z9.object({
|
|
581
|
+
id: z9.string(),
|
|
582
|
+
clientId: z9.string(),
|
|
570
583
|
clientType: TokenUserType,
|
|
571
|
-
createdAt:
|
|
584
|
+
createdAt: z9.string()
|
|
572
585
|
});
|
|
573
586
|
var EventCreateEntrySchema = AuditLogEntryBase.extend({
|
|
574
|
-
operation:
|
|
575
|
-
requestData:
|
|
576
|
-
transactionId:
|
|
577
|
-
type:
|
|
578
|
-
createdAtLocation:
|
|
587
|
+
operation: z9.literal("event.create"),
|
|
588
|
+
requestData: z9.object({
|
|
589
|
+
transactionId: z9.string(),
|
|
590
|
+
type: z9.string(),
|
|
591
|
+
createdAtLocation: z9.string().nullable()
|
|
579
592
|
}),
|
|
580
|
-
responseSummary:
|
|
581
|
-
eventId:
|
|
582
|
-
trackingId:
|
|
593
|
+
responseSummary: z9.object({
|
|
594
|
+
eventId: z9.string(),
|
|
595
|
+
trackingId: z9.string()
|
|
583
596
|
})
|
|
584
597
|
});
|
|
585
598
|
var EventGetEntrySchema = AuditLogEntryBase.extend({
|
|
586
|
-
operation:
|
|
587
|
-
requestData:
|
|
588
|
-
responseSummary:
|
|
589
|
-
eventType:
|
|
590
|
-
trackingId:
|
|
599
|
+
operation: z9.literal("event.get"),
|
|
600
|
+
requestData: z9.object({ eventId: z9.string() }),
|
|
601
|
+
responseSummary: z9.object({
|
|
602
|
+
eventType: z9.string(),
|
|
603
|
+
trackingId: z9.string()
|
|
591
604
|
})
|
|
592
605
|
});
|
|
593
606
|
var EventSearchEntrySchema = AuditLogEntryBase.extend({
|
|
594
|
-
operation:
|
|
595
|
-
clientType:
|
|
596
|
-
requestData:
|
|
597
|
-
query:
|
|
598
|
-
limit:
|
|
599
|
-
offset:
|
|
607
|
+
operation: z9.literal("event.search"),
|
|
608
|
+
clientType: z9.literal("system"),
|
|
609
|
+
requestData: z9.object({
|
|
610
|
+
query: z9.record(z9.string(), z9.unknown()).nullable(),
|
|
611
|
+
limit: z9.number().nullable(),
|
|
612
|
+
offset: z9.number().nullable()
|
|
600
613
|
}),
|
|
601
|
-
responseSummary:
|
|
602
|
-
total:
|
|
603
|
-
eventIds:
|
|
614
|
+
responseSummary: z9.object({
|
|
615
|
+
total: z9.number(),
|
|
616
|
+
eventIds: z9.array(z9.string())
|
|
604
617
|
})
|
|
605
618
|
});
|
|
606
619
|
var EventActionEntrySchema = AuditLogEntryBase.extend({
|
|
607
|
-
operation:
|
|
620
|
+
operation: z9.enum([
|
|
608
621
|
"event.actions.notify.request",
|
|
609
622
|
"event.actions.declare.request",
|
|
610
623
|
"event.actions.register.request",
|
|
@@ -624,106 +637,159 @@ var EventActionEntrySchema = AuditLogEntryBase.extend({
|
|
|
624
637
|
"event.actions.mark_as_duplicate.request",
|
|
625
638
|
"event.actions.mark_as_not_duplicate.request"
|
|
626
639
|
]),
|
|
627
|
-
requestData:
|
|
628
|
-
eventId:
|
|
629
|
-
actionType:
|
|
630
|
-
eventType:
|
|
631
|
-
trackingId:
|
|
632
|
-
transactionId:
|
|
640
|
+
requestData: z9.object({
|
|
641
|
+
eventId: z9.string(),
|
|
642
|
+
actionType: z9.string(),
|
|
643
|
+
eventType: z9.string(),
|
|
644
|
+
trackingId: z9.string(),
|
|
645
|
+
transactionId: z9.string()
|
|
633
646
|
})
|
|
634
647
|
});
|
|
635
648
|
var EventCustomActionEntrySchema = AuditLogEntryBase.extend({
|
|
636
|
-
operation:
|
|
637
|
-
requestData:
|
|
638
|
-
eventId:
|
|
639
|
-
actionType:
|
|
640
|
-
customAction:
|
|
641
|
-
eventType:
|
|
642
|
-
trackingId:
|
|
643
|
-
transactionId:
|
|
649
|
+
operation: z9.literal("event.actions.custom.request"),
|
|
650
|
+
requestData: z9.object({
|
|
651
|
+
eventId: z9.string(),
|
|
652
|
+
actionType: z9.literal(ActionType.CUSTOM),
|
|
653
|
+
customAction: z9.string(),
|
|
654
|
+
eventType: z9.string(),
|
|
655
|
+
trackingId: z9.string(),
|
|
656
|
+
transactionId: z9.string()
|
|
644
657
|
})
|
|
645
658
|
});
|
|
646
659
|
var IntegrationCreateEntrySchema = AuditLogEntryBase.extend({
|
|
647
|
-
operation:
|
|
648
|
-
requestData:
|
|
649
|
-
responseSummary:
|
|
660
|
+
operation: z9.literal("integrations.create"),
|
|
661
|
+
requestData: z9.object({ name: z9.string(), scopes: z9.array(z9.string()) }),
|
|
662
|
+
responseSummary: z9.object({ clientId: z9.string() })
|
|
650
663
|
});
|
|
651
664
|
var IntegrationRefreshTokenEntrySchema = AuditLogEntryBase.extend({
|
|
652
|
-
operation:
|
|
653
|
-
requestData:
|
|
654
|
-
responseSummary:
|
|
665
|
+
operation: z9.literal("integrations.refreshToken"),
|
|
666
|
+
requestData: z9.object({ clientId: z9.string() }),
|
|
667
|
+
responseSummary: z9.object({ clientId: z9.string() })
|
|
655
668
|
});
|
|
656
669
|
var IntegrationDeactivateEntrySchema = AuditLogEntryBase.extend({
|
|
657
|
-
operation:
|
|
658
|
-
requestData:
|
|
659
|
-
responseSummary:
|
|
670
|
+
operation: z9.literal("integrations.deactivate"),
|
|
671
|
+
requestData: z9.object({ id: z9.string() }),
|
|
672
|
+
responseSummary: z9.object({ id: z9.string(), status: z9.string() })
|
|
660
673
|
});
|
|
661
674
|
var IntegrationActivateEntrySchema = AuditLogEntryBase.extend({
|
|
662
|
-
operation:
|
|
663
|
-
requestData:
|
|
664
|
-
responseSummary:
|
|
675
|
+
operation: z9.literal("integrations.activate"),
|
|
676
|
+
requestData: z9.object({ id: z9.string() }),
|
|
677
|
+
responseSummary: z9.object({ id: z9.string(), status: z9.string() })
|
|
665
678
|
});
|
|
666
679
|
var IntegrationDeleteEntrySchema = AuditLogEntryBase.extend({
|
|
667
|
-
operation:
|
|
668
|
-
requestData:
|
|
669
|
-
responseSummary:
|
|
680
|
+
operation: z9.literal("integrations.delete"),
|
|
681
|
+
requestData: z9.object({ id: z9.string() }),
|
|
682
|
+
responseSummary: z9.object({ id: z9.string(), name: z9.string() })
|
|
670
683
|
});
|
|
671
684
|
var IntegrationRefreshSecretEntrySchema = AuditLogEntryBase.extend({
|
|
672
|
-
operation:
|
|
673
|
-
requestData:
|
|
674
|
-
responseSummary:
|
|
685
|
+
operation: z9.literal("integrations.refreshSecret"),
|
|
686
|
+
requestData: z9.object({ id: z9.string() }),
|
|
687
|
+
responseSummary: z9.object({ clientId: z9.string() })
|
|
675
688
|
});
|
|
676
689
|
var createdVersionFields = {
|
|
677
|
-
id:
|
|
678
|
-
versionId:
|
|
679
|
-
name:
|
|
680
|
-
externalId:
|
|
681
|
-
effectiveFrom:
|
|
682
|
-
status:
|
|
690
|
+
id: z9.string(),
|
|
691
|
+
versionId: z9.string(),
|
|
692
|
+
name: z9.string(),
|
|
693
|
+
externalId: z9.string().nullish(),
|
|
694
|
+
effectiveFrom: z9.string(),
|
|
695
|
+
status: z9.string()
|
|
683
696
|
};
|
|
684
697
|
var LocationCreateEntrySchema = AuditLogEntryBase.extend({
|
|
685
|
-
operation:
|
|
686
|
-
requestData:
|
|
698
|
+
operation: z9.literal("locations.create"),
|
|
699
|
+
requestData: z9.object({
|
|
687
700
|
...createdVersionFields,
|
|
688
|
-
administrativeAreaId:
|
|
689
|
-
locationType:
|
|
701
|
+
administrativeAreaId: z9.string().nullish(),
|
|
702
|
+
locationType: z9.string().nullish()
|
|
690
703
|
})
|
|
691
704
|
});
|
|
692
705
|
var AdministrativeAreaCreateEntrySchema = AuditLogEntryBase.extend({
|
|
693
|
-
operation:
|
|
694
|
-
requestData:
|
|
706
|
+
operation: z9.literal("administrativeAreas.create"),
|
|
707
|
+
requestData: z9.object({
|
|
695
708
|
...createdVersionFields,
|
|
696
|
-
parentId:
|
|
709
|
+
parentId: z9.string().nullish()
|
|
710
|
+
})
|
|
711
|
+
});
|
|
712
|
+
var ChangedStringField = z9.object({ from: z9.string(), to: z9.string() });
|
|
713
|
+
var ChangedNullableStringField = z9.object({
|
|
714
|
+
from: z9.string().nullable(),
|
|
715
|
+
to: z9.string().nullable()
|
|
716
|
+
});
|
|
717
|
+
var updatedVersionRequestData = z9.object({
|
|
718
|
+
id: z9.string(),
|
|
719
|
+
versionId: z9.string(),
|
|
720
|
+
name: z9.string(),
|
|
721
|
+
externalId: z9.string().nullish(),
|
|
722
|
+
status: z9.string(),
|
|
723
|
+
effectiveFrom: z9.string(),
|
|
724
|
+
lastVersionId: z9.string()
|
|
725
|
+
});
|
|
726
|
+
var updatedVersionResponseSummary = z9.object({
|
|
727
|
+
previousVersionId: z9.string(),
|
|
728
|
+
versionId: z9.string(),
|
|
729
|
+
changed: z9.object({
|
|
730
|
+
name: ChangedStringField.optional(),
|
|
731
|
+
externalId: ChangedNullableStringField.optional(),
|
|
732
|
+
status: ChangedStringField.optional()
|
|
697
733
|
})
|
|
698
734
|
});
|
|
735
|
+
var LocationUpdateEntrySchema = AuditLogEntryBase.extend({
|
|
736
|
+
operation: z9.literal("locations.update"),
|
|
737
|
+
requestData: updatedVersionRequestData,
|
|
738
|
+
responseSummary: updatedVersionResponseSummary
|
|
739
|
+
});
|
|
740
|
+
var AdministrativeAreaUpdateEntrySchema = AuditLogEntryBase.extend({
|
|
741
|
+
operation: z9.literal("administrativeAreas.update"),
|
|
742
|
+
requestData: updatedVersionRequestData,
|
|
743
|
+
responseSummary: updatedVersionResponseSummary
|
|
744
|
+
});
|
|
745
|
+
var withdrawVersionRequestData = z9.object({
|
|
746
|
+
id: z9.string(),
|
|
747
|
+
versionId: z9.string()
|
|
748
|
+
});
|
|
749
|
+
var withdrawVersionResponseSummary = z9.object({
|
|
750
|
+
effectiveFrom: z9.string(),
|
|
751
|
+
name: z9.string(),
|
|
752
|
+
externalId: z9.string().nullish(),
|
|
753
|
+
status: z9.string()
|
|
754
|
+
});
|
|
755
|
+
var LocationWithdrawEntrySchema = AuditLogEntryBase.extend({
|
|
756
|
+
operation: z9.literal("locations.withdrawVersion"),
|
|
757
|
+
requestData: withdrawVersionRequestData,
|
|
758
|
+
responseSummary: withdrawVersionResponseSummary
|
|
759
|
+
});
|
|
760
|
+
var AdministrativeAreaWithdrawEntrySchema = AuditLogEntryBase.extend({
|
|
761
|
+
operation: z9.literal("administrativeAreas.withdrawVersion"),
|
|
762
|
+
requestData: withdrawVersionRequestData,
|
|
763
|
+
responseSummary: withdrawVersionResponseSummary
|
|
764
|
+
});
|
|
699
765
|
var AttachmentUploadEntrySchema = AuditLogEntryBase.extend({
|
|
700
|
-
operation:
|
|
701
|
-
requestData:
|
|
702
|
-
transactionId:
|
|
703
|
-
path:
|
|
766
|
+
operation: z9.literal("attachments.upload"),
|
|
767
|
+
requestData: z9.object({
|
|
768
|
+
transactionId: z9.string(),
|
|
769
|
+
path: z9.string().nullable()
|
|
704
770
|
}),
|
|
705
|
-
responseSummary:
|
|
771
|
+
responseSummary: z9.object({ fileUrl: z9.string() })
|
|
706
772
|
});
|
|
707
|
-
var subjectOnly =
|
|
708
|
-
var subjectWithReason =
|
|
709
|
-
subjectId:
|
|
710
|
-
reason:
|
|
711
|
-
comment:
|
|
773
|
+
var subjectOnly = z9.object({ subjectId: z9.string() });
|
|
774
|
+
var subjectWithReason = z9.object({
|
|
775
|
+
subjectId: z9.string(),
|
|
776
|
+
reason: z9.string(),
|
|
777
|
+
comment: z9.string().optional()
|
|
712
778
|
});
|
|
713
779
|
var UserCreateEntrySchema = AuditLogEntryBase.extend({
|
|
714
|
-
operation:
|
|
715
|
-
requestData:
|
|
716
|
-
subjectId:
|
|
717
|
-
role:
|
|
718
|
-
primaryOfficeId:
|
|
780
|
+
operation: z9.literal("user.create_user"),
|
|
781
|
+
requestData: z9.object({
|
|
782
|
+
subjectId: z9.string(),
|
|
783
|
+
role: z9.string(),
|
|
784
|
+
primaryOfficeId: z9.string()
|
|
719
785
|
})
|
|
720
786
|
});
|
|
721
787
|
var UserReasonEntrySchema = AuditLogEntryBase.extend({
|
|
722
|
-
operation:
|
|
788
|
+
operation: z9.enum(["user.deactivate", "user.reactivate"]),
|
|
723
789
|
requestData: subjectWithReason
|
|
724
790
|
});
|
|
725
791
|
var UserSubjectOnlyEntrySchema = AuditLogEntryBase.extend({
|
|
726
|
-
operation:
|
|
792
|
+
operation: z9.enum([
|
|
727
793
|
"user.edit_user",
|
|
728
794
|
"user.logged_in",
|
|
729
795
|
"user.logged_out",
|
|
@@ -737,14 +803,14 @@ var UserSubjectOnlyEntrySchema = AuditLogEntryBase.extend({
|
|
|
737
803
|
requestData: subjectOnly
|
|
738
804
|
});
|
|
739
805
|
var UserEmailChangedEntrySchema = AuditLogEntryBase.extend({
|
|
740
|
-
operation:
|
|
806
|
+
operation: z9.literal("user.email_address_changed"),
|
|
741
807
|
requestData: subjectOnly,
|
|
742
|
-
responseSummary:
|
|
808
|
+
responseSummary: z9.object({ email: z9.string() })
|
|
743
809
|
});
|
|
744
810
|
var UserPhoneChangedEntrySchema = AuditLogEntryBase.extend({
|
|
745
|
-
operation:
|
|
811
|
+
operation: z9.literal("user.phone_number_changed"),
|
|
746
812
|
requestData: subjectOnly,
|
|
747
|
-
responseSummary:
|
|
813
|
+
responseSummary: z9.object({ phoneNumber: z9.string() })
|
|
748
814
|
});
|
|
749
815
|
var userBaseOmit = {
|
|
750
816
|
id: true,
|
|
@@ -752,14 +818,14 @@ var userBaseOmit = {
|
|
|
752
818
|
clientType: true,
|
|
753
819
|
createdAt: true
|
|
754
820
|
};
|
|
755
|
-
var UserAuditRecordInput =
|
|
821
|
+
var UserAuditRecordInput = z9.discriminatedUnion("operation", [
|
|
756
822
|
UserCreateEntrySchema.omit(userBaseOmit),
|
|
757
823
|
UserReasonEntrySchema.omit(userBaseOmit),
|
|
758
824
|
UserSubjectOnlyEntrySchema.omit(userBaseOmit),
|
|
759
825
|
UserEmailChangedEntrySchema.omit(userBaseOmit),
|
|
760
826
|
UserPhoneChangedEntrySchema.omit(userBaseOmit)
|
|
761
827
|
]);
|
|
762
|
-
var AuditLogEntrySchema =
|
|
828
|
+
var AuditLogEntrySchema = z9.discriminatedUnion("operation", [
|
|
763
829
|
EventCreateEntrySchema,
|
|
764
830
|
EventGetEntrySchema,
|
|
765
831
|
EventSearchEntrySchema,
|
|
@@ -772,6 +838,10 @@ var AuditLogEntrySchema = z8.discriminatedUnion("operation", [
|
|
|
772
838
|
IntegrationDeleteEntrySchema,
|
|
773
839
|
IntegrationRefreshSecretEntrySchema,
|
|
774
840
|
LocationCreateEntrySchema,
|
|
841
|
+
LocationUpdateEntrySchema,
|
|
842
|
+
AdministrativeAreaUpdateEntrySchema,
|
|
843
|
+
LocationWithdrawEntrySchema,
|
|
844
|
+
AdministrativeAreaWithdrawEntrySchema,
|
|
775
845
|
AdministrativeAreaCreateEntrySchema,
|
|
776
846
|
AttachmentUploadEntrySchema,
|
|
777
847
|
UserCreateEntrySchema,
|
|
@@ -786,13 +856,13 @@ var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
|
|
|
786
856
|
var CHILD_ONBOARDING_EVENT = "child-onboarding";
|
|
787
857
|
|
|
788
858
|
// ../commons/src/events/ActionConfig.ts
|
|
789
|
-
var
|
|
859
|
+
var z25 = __toESM(require("zod/v4"));
|
|
790
860
|
|
|
791
861
|
// ../commons/src/events/FieldConfig.ts
|
|
792
862
|
var import_v43 = __toESM(require("zod/v4"));
|
|
793
863
|
|
|
794
864
|
// ../commons/src/events/FieldType.ts
|
|
795
|
-
var
|
|
865
|
+
var z10 = __toESM(require("zod/v4"));
|
|
796
866
|
var FieldType = {
|
|
797
867
|
NAME: "NAME",
|
|
798
868
|
PHONE: "PHONE",
|
|
@@ -856,7 +926,7 @@ var FieldType = {
|
|
|
856
926
|
*/
|
|
857
927
|
_EXPERIMENTAL_CUSTOM: "CUSTOM"
|
|
858
928
|
};
|
|
859
|
-
var FileFieldType =
|
|
929
|
+
var FileFieldType = z10.enum([
|
|
860
930
|
FieldType.FILE,
|
|
861
931
|
FieldType.FILE_WITH_OPTIONS,
|
|
862
932
|
FieldType.SIGNATURE
|
|
@@ -892,164 +962,160 @@ var HiddenFieldTypes = [
|
|
|
892
962
|
];
|
|
893
963
|
|
|
894
964
|
// ../commons/src/events/FieldValue.ts
|
|
895
|
-
var
|
|
965
|
+
var z14 = __toESM(require("zod/v4"));
|
|
896
966
|
|
|
897
967
|
// ../commons/src/documents.ts
|
|
898
|
-
var
|
|
899
|
-
var FullDocumentUrl =
|
|
968
|
+
var z11 = __toESM(require("zod/v4"));
|
|
969
|
+
var FullDocumentUrl = z11.string().brand("FullDocumentUrl").describe(
|
|
900
970
|
"A full url with protocol, host, bucket name, starting from the root of the S3 server, https://minio.opencrvs.com/bucket-name/document-id.jpg"
|
|
901
971
|
);
|
|
902
|
-
var FullDocumentPath =
|
|
972
|
+
var FullDocumentPath = z11.string().overwrite((val) => val.startsWith("/") ? val : `/${val}`).meta({ effectType: "input", type: "string" }).describe(
|
|
903
973
|
"A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
|
|
904
974
|
);
|
|
905
|
-
var DocumentPath =
|
|
975
|
+
var DocumentPath = z11.string().brand("DocumentPath").describe(
|
|
906
976
|
"A relative path within the S3 bucket, never starting with /. e.g. document-id.jpg or directory/document-id.jpg. The document service constructs the full /bucket/path internally."
|
|
907
977
|
);
|
|
908
978
|
|
|
909
979
|
// ../commons/src/events/CompositeFieldValue.ts
|
|
910
|
-
var
|
|
980
|
+
var z12 = __toESM(require("zod/v4"));
|
|
911
981
|
var AddressType = {
|
|
912
982
|
DOMESTIC: "DOMESTIC",
|
|
913
983
|
INTERNATIONAL: "INTERNATIONAL"
|
|
914
984
|
};
|
|
915
|
-
var FileFieldValue =
|
|
985
|
+
var FileFieldValue = z12.object({
|
|
916
986
|
path: DocumentPath,
|
|
917
|
-
originalFilename:
|
|
918
|
-
type:
|
|
919
|
-
});
|
|
920
|
-
var NameFieldValue =
|
|
921
|
-
firstname:
|
|
922
|
-
surname:
|
|
923
|
-
middlename:
|
|
924
|
-
});
|
|
925
|
-
var NameFieldUpdateValue =
|
|
926
|
-
firstname:
|
|
927
|
-
surname:
|
|
928
|
-
middlename:
|
|
929
|
-
}).or(
|
|
930
|
-
var StreetLevelDetailsValue =
|
|
931
|
-
var StreetLevelDetailsUpdateValue =
|
|
932
|
-
var BaseAddressFieldValue =
|
|
933
|
-
country:
|
|
987
|
+
originalFilename: z12.string(),
|
|
988
|
+
type: z12.string()
|
|
989
|
+
});
|
|
990
|
+
var NameFieldValue = z12.object({
|
|
991
|
+
firstname: z12.string(),
|
|
992
|
+
surname: z12.string(),
|
|
993
|
+
middlename: z12.string().optional()
|
|
994
|
+
});
|
|
995
|
+
var NameFieldUpdateValue = z12.object({
|
|
996
|
+
firstname: z12.string().nullish(),
|
|
997
|
+
surname: z12.string().nullish(),
|
|
998
|
+
middlename: z12.string().nullish()
|
|
999
|
+
}).or(z12.null()).or(z12.undefined());
|
|
1000
|
+
var StreetLevelDetailsValue = z12.record(z12.string(), z12.string()).optional();
|
|
1001
|
+
var StreetLevelDetailsUpdateValue = z12.record(z12.string(), z12.string().nullable()).nullish();
|
|
1002
|
+
var BaseAddressFieldValue = z12.object({
|
|
1003
|
+
country: z12.string(),
|
|
934
1004
|
streetLevelDetails: StreetLevelDetailsValue
|
|
935
1005
|
});
|
|
936
|
-
var BaseAddressFieldUpdateValue =
|
|
937
|
-
country:
|
|
1006
|
+
var BaseAddressFieldUpdateValue = z12.object({
|
|
1007
|
+
country: z12.string().nullish(),
|
|
938
1008
|
streetLevelDetails: StreetLevelDetailsUpdateValue
|
|
939
1009
|
});
|
|
940
1010
|
var DomesticAddressFieldValue = BaseAddressFieldValue.extend({
|
|
941
|
-
addressType:
|
|
942
|
-
administrativeArea:
|
|
1011
|
+
addressType: z12.literal(AddressType.DOMESTIC),
|
|
1012
|
+
administrativeArea: z12.string().uuid()
|
|
943
1013
|
});
|
|
944
1014
|
var InternationalAddressFieldValue = BaseAddressFieldValue.extend({
|
|
945
|
-
addressType:
|
|
1015
|
+
addressType: z12.literal(AddressType.INTERNATIONAL)
|
|
946
1016
|
});
|
|
947
|
-
var AddressFieldValue =
|
|
1017
|
+
var AddressFieldValue = z12.discriminatedUnion("addressType", [
|
|
948
1018
|
DomesticAddressFieldValue,
|
|
949
1019
|
InternationalAddressFieldValue
|
|
950
1020
|
]);
|
|
951
1021
|
var DomesticAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend({
|
|
952
|
-
addressType:
|
|
953
|
-
administrativeArea:
|
|
1022
|
+
addressType: z12.literal(AddressType.DOMESTIC),
|
|
1023
|
+
administrativeArea: z12.string().uuid().nullish()
|
|
954
1024
|
/* Leaf level admin structure */
|
|
955
1025
|
});
|
|
956
1026
|
var InternationalAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend(
|
|
957
1027
|
{
|
|
958
|
-
addressType:
|
|
1028
|
+
addressType: z12.literal(AddressType.INTERNATIONAL)
|
|
959
1029
|
}
|
|
960
1030
|
);
|
|
961
|
-
var AddressFieldUpdateValue =
|
|
1031
|
+
var AddressFieldUpdateValue = z12.discriminatedUnion("addressType", [
|
|
962
1032
|
DomesticAddressUpdateFieldValue,
|
|
963
1033
|
InternationalAddressUpdateFieldValue
|
|
964
1034
|
]).nullish();
|
|
965
|
-
var FileFieldValueWithOption =
|
|
1035
|
+
var FileFieldValueWithOption = z12.object({
|
|
966
1036
|
path: DocumentPath,
|
|
967
|
-
originalFilename:
|
|
968
|
-
type:
|
|
969
|
-
option:
|
|
970
|
-
});
|
|
971
|
-
var FileFieldWithOptionValue =
|
|
972
|
-
var HttpFieldValue =
|
|
973
|
-
loading:
|
|
974
|
-
error:
|
|
975
|
-
data:
|
|
976
|
-
});
|
|
977
|
-
var HttpFieldUpdateValue =
|
|
978
|
-
loading:
|
|
979
|
-
error:
|
|
980
|
-
data:
|
|
981
|
-
}).or(
|
|
982
|
-
var QueryParamReaderFieldValue =
|
|
983
|
-
data:
|
|
984
|
-
updatedAt:
|
|
1037
|
+
originalFilename: z12.string(),
|
|
1038
|
+
type: z12.string(),
|
|
1039
|
+
option: z12.string()
|
|
1040
|
+
});
|
|
1041
|
+
var FileFieldWithOptionValue = z12.array(FileFieldValueWithOption);
|
|
1042
|
+
var HttpFieldValue = z12.object({
|
|
1043
|
+
loading: z12.boolean(),
|
|
1044
|
+
error: z12.object({ statusCode: z12.number(), message: z12.string() }).nullish(),
|
|
1045
|
+
data: z12.any()
|
|
1046
|
+
});
|
|
1047
|
+
var HttpFieldUpdateValue = z12.object({
|
|
1048
|
+
loading: z12.boolean().nullish(),
|
|
1049
|
+
error: z12.object({ statusCode: z12.number(), message: z12.string() }).nullish(),
|
|
1050
|
+
data: z12.any().nullish()
|
|
1051
|
+
}).or(z12.null()).or(z12.undefined());
|
|
1052
|
+
var QueryParamReaderFieldValue = z12.object({
|
|
1053
|
+
data: z12.record(z12.string(), z12.string()),
|
|
1054
|
+
updatedAt: z12.iso.datetime()
|
|
985
1055
|
}).nullish();
|
|
986
|
-
var QueryParamReaderFieldUpdateValue =
|
|
987
|
-
data:
|
|
1056
|
+
var QueryParamReaderFieldUpdateValue = z12.object({
|
|
1057
|
+
data: z12.record(z12.string(), z12.string())
|
|
988
1058
|
});
|
|
989
|
-
var ReadDataValue =
|
|
990
|
-
data:
|
|
1059
|
+
var ReadDataValue = z12.object({
|
|
1060
|
+
data: z12.any()
|
|
991
1061
|
});
|
|
992
1062
|
var QrReaderFieldValue = ReadDataValue;
|
|
993
1063
|
var IdReaderFieldValue = ReadDataValue;
|
|
994
|
-
var NumberWithUnitFieldValue =
|
|
995
|
-
numericValue:
|
|
996
|
-
unit:
|
|
1064
|
+
var NumberWithUnitFieldValue = z12.object({
|
|
1065
|
+
numericValue: z12.number(),
|
|
1066
|
+
unit: z12.string()
|
|
997
1067
|
});
|
|
998
|
-
var NumberWithUnitFieldUpdateValue =
|
|
999
|
-
numericValue:
|
|
1000
|
-
unit:
|
|
1068
|
+
var NumberWithUnitFieldUpdateValue = z12.object({
|
|
1069
|
+
numericValue: z12.number().optional(),
|
|
1070
|
+
unit: z12.string().optional()
|
|
1001
1071
|
});
|
|
1002
|
-
var CustomFieldValue =
|
|
1072
|
+
var CustomFieldValue = z12.unknown().brand("CustomFieldValue");
|
|
1003
1073
|
|
|
1004
1074
|
// ../commons/src/events/PlainDate.ts
|
|
1005
1075
|
var import_zod = require("zod");
|
|
1006
1076
|
var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date in the format YYYY-MM-DD");
|
|
1007
|
-
function plainDateToLocalDate(date) {
|
|
1008
|
-
const [year, month, day] = date.split("-").map(Number);
|
|
1009
|
-
return new Date(year, month - 1, day);
|
|
1010
|
-
}
|
|
1011
1077
|
|
|
1012
1078
|
// ../commons/src/events/FieldValue.ts
|
|
1013
|
-
var TextValue =
|
|
1014
|
-
var HiddenFieldValue =
|
|
1015
|
-
var NonEmptyTextValue =
|
|
1016
|
-
var DateValue =
|
|
1017
|
-
var AgeValue =
|
|
1018
|
-
age:
|
|
1019
|
-
asOfDateRef:
|
|
1079
|
+
var TextValue = z14.string();
|
|
1080
|
+
var HiddenFieldValue = z14.string();
|
|
1081
|
+
var NonEmptyTextValue = z14.string().trim().min(1);
|
|
1082
|
+
var DateValue = z14.iso.date().describe("Date in the format YYYY-MM-DD");
|
|
1083
|
+
var AgeValue = z14.object({
|
|
1084
|
+
age: z14.number(),
|
|
1085
|
+
asOfDateRef: z14.string()
|
|
1020
1086
|
});
|
|
1021
1087
|
var AgeUpdateValue = AgeValue.optional().nullable();
|
|
1022
|
-
var AutocompleteValue =
|
|
1023
|
-
label:
|
|
1024
|
-
value:
|
|
1088
|
+
var AutocompleteValue = z14.object({
|
|
1089
|
+
label: z14.string(),
|
|
1090
|
+
value: z14.string()
|
|
1025
1091
|
});
|
|
1026
1092
|
var AutocompleteUpdateValue = AutocompleteValue.optional().nullable();
|
|
1027
|
-
var TimeValue =
|
|
1028
|
-
var DatetimeValue =
|
|
1029
|
-
var SelectDateRangeValue =
|
|
1093
|
+
var TimeValue = z14.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/);
|
|
1094
|
+
var DatetimeValue = z14.iso.datetime();
|
|
1095
|
+
var SelectDateRangeValue = z14.enum([
|
|
1030
1096
|
"last7Days",
|
|
1031
1097
|
"last30Days",
|
|
1032
1098
|
"last90Days",
|
|
1033
1099
|
"last365Days"
|
|
1034
1100
|
]);
|
|
1035
|
-
var DateRangeFieldValue =
|
|
1101
|
+
var DateRangeFieldValue = z14.object({
|
|
1036
1102
|
start: PlainDate,
|
|
1037
1103
|
end: PlainDate
|
|
1038
1104
|
}).or(PlainDate).describe(
|
|
1039
1105
|
"Date range with start and end dates in the format YYYY-MM-DD. Inclusive start, exclusive end."
|
|
1040
1106
|
);
|
|
1041
|
-
var EmailValue =
|
|
1042
|
-
var CheckboxFieldValue =
|
|
1043
|
-
var NumberFieldValue =
|
|
1107
|
+
var EmailValue = z14.email();
|
|
1108
|
+
var CheckboxFieldValue = z14.boolean();
|
|
1109
|
+
var NumberFieldValue = z14.number();
|
|
1044
1110
|
var SignatureFieldValue = FileFieldValue;
|
|
1045
|
-
var ButtonFieldValue =
|
|
1046
|
-
var VerificationStatusValue =
|
|
1111
|
+
var ButtonFieldValue = z14.number();
|
|
1112
|
+
var VerificationStatusValue = z14.enum([
|
|
1047
1113
|
"verified",
|
|
1048
1114
|
"authenticated",
|
|
1049
1115
|
"failed",
|
|
1050
1116
|
"pending"
|
|
1051
1117
|
]);
|
|
1052
|
-
var LeafFieldValues =
|
|
1118
|
+
var LeafFieldValues = z14.union([
|
|
1053
1119
|
AddressFieldValue,
|
|
1054
1120
|
TextValue,
|
|
1055
1121
|
PlainDate,
|
|
@@ -1075,11 +1141,11 @@ var LeafFieldValues = z13.union([
|
|
|
1075
1141
|
AutocompleteValue,
|
|
1076
1142
|
AutocompleteUpdateValue
|
|
1077
1143
|
]);
|
|
1078
|
-
var FieldGroupValue =
|
|
1079
|
-
var DataFieldValue =
|
|
1080
|
-
data:
|
|
1144
|
+
var FieldGroupValue = z14.record(z14.string(), LeafFieldValues);
|
|
1145
|
+
var DataFieldValue = z14.object({
|
|
1146
|
+
data: z14.record(z14.string(), LeafFieldValues)
|
|
1081
1147
|
}).nullish();
|
|
1082
|
-
var FieldValue =
|
|
1148
|
+
var FieldValue = z14.union([
|
|
1083
1149
|
LeafFieldValues,
|
|
1084
1150
|
DataFieldValue,
|
|
1085
1151
|
FieldGroupValue
|
|
@@ -1113,7 +1179,7 @@ function safeUnion(schemas) {
|
|
|
1113
1179
|
const sortedSchemas = [...schemas].sort(
|
|
1114
1180
|
(a, b) => schemaPriority(a) - schemaPriority(b)
|
|
1115
1181
|
);
|
|
1116
|
-
return
|
|
1182
|
+
return z14.any().superRefine((val, ctx) => {
|
|
1117
1183
|
for (const schema of sortedSchemas) {
|
|
1118
1184
|
if (schema.safeParse(val).success) {
|
|
1119
1185
|
return;
|
|
@@ -1152,9 +1218,9 @@ var FieldUpdateValue = safeUnion([
|
|
|
1152
1218
|
]);
|
|
1153
1219
|
|
|
1154
1220
|
// ../commons/src/events/serializers/user/serializer.ts
|
|
1155
|
-
var
|
|
1156
|
-
var SerializedUserField =
|
|
1157
|
-
$userField:
|
|
1221
|
+
var z15 = __toESM(require("zod/v4"));
|
|
1222
|
+
var SerializedUserField = z15.object({
|
|
1223
|
+
$userField: z15.enum([
|
|
1158
1224
|
"id",
|
|
1159
1225
|
"name",
|
|
1160
1226
|
"role",
|
|
@@ -1168,7 +1234,7 @@ var SerializedUserField = z14.object({
|
|
|
1168
1234
|
"primaryOfficeId",
|
|
1169
1235
|
"administrativeAreaId"
|
|
1170
1236
|
]),
|
|
1171
|
-
$location:
|
|
1237
|
+
$location: z15.string().optional()
|
|
1172
1238
|
});
|
|
1173
1239
|
function userSerializer(userField) {
|
|
1174
1240
|
return {
|
|
@@ -1191,25 +1257,25 @@ function userSerializer(userField) {
|
|
|
1191
1257
|
var import_v4 = require("zod/v4");
|
|
1192
1258
|
|
|
1193
1259
|
// ../commons/src/events/EventMetadata.ts
|
|
1194
|
-
var
|
|
1260
|
+
var z17 = __toESM(require("zod/v4"));
|
|
1195
1261
|
|
|
1196
1262
|
// ../commons/src/events/ActionDocument.ts
|
|
1197
|
-
var
|
|
1198
|
-
var ActionUpdate =
|
|
1263
|
+
var z16 = __toESM(require("zod/v4"));
|
|
1264
|
+
var ActionUpdate = z16.record(z16.string(), FieldUpdateValue).describe(
|
|
1199
1265
|
"Record of field-level changes made by an action. Supports partial updates and nullable values."
|
|
1200
1266
|
);
|
|
1201
|
-
var EventState =
|
|
1267
|
+
var EventState = z16.record(z16.string(), FieldValue).describe(
|
|
1202
1268
|
"Aggregate representation of event data after all actions have been applied, with all updates consolidated and null values removed."
|
|
1203
1269
|
);
|
|
1204
|
-
var ActionBase =
|
|
1270
|
+
var ActionBase = z16.object({
|
|
1205
1271
|
id: UUID.describe("Unique identifier of the action."),
|
|
1206
|
-
transactionId:
|
|
1272
|
+
transactionId: z16.string().describe("Unique identifier of the transaction."),
|
|
1207
1273
|
createdByUserType: TokenUserType.describe(
|
|
1208
1274
|
"Indicates whether the action was created by a human-user or by a system-user."
|
|
1209
1275
|
),
|
|
1210
|
-
createdAt:
|
|
1211
|
-
createdBy:
|
|
1212
|
-
createdByRole:
|
|
1276
|
+
createdAt: z16.string().datetime().describe("Timestamp indicating when the action was created."),
|
|
1277
|
+
createdBy: z16.string().describe("Identifier of the user who created the action."),
|
|
1278
|
+
createdByRole: z16.string().optional().describe("Role of the user who created the action."),
|
|
1213
1279
|
createdBySignature: DocumentPath.nullish().describe(
|
|
1214
1280
|
"Reference to the signature of the user who created the action."
|
|
1215
1281
|
),
|
|
@@ -1221,7 +1287,7 @@ var ActionBase = z15.object({
|
|
|
1221
1287
|
"Declaration data defined by the ActionConfig. Supports partial updates."
|
|
1222
1288
|
),
|
|
1223
1289
|
annotation: ActionUpdate.optional().nullable().describe("Action-specific metadata used to annotate the event."),
|
|
1224
|
-
status:
|
|
1290
|
+
status: z16.enum([
|
|
1225
1291
|
ActionStatus.Requested,
|
|
1226
1292
|
ActionStatus.Accepted,
|
|
1227
1293
|
ActionStatus.Rejected
|
|
@@ -1233,139 +1299,143 @@ var ActionBase = z15.object({
|
|
|
1233
1299
|
)
|
|
1234
1300
|
});
|
|
1235
1301
|
var AssignedAction = ActionBase.extend(
|
|
1236
|
-
|
|
1237
|
-
type:
|
|
1238
|
-
assignedTo:
|
|
1302
|
+
z16.object({
|
|
1303
|
+
type: z16.literal(ActionType.ASSIGN),
|
|
1304
|
+
assignedTo: z16.string().describe("Identifier of the user to whom the action is assigned.")
|
|
1239
1305
|
// TODO move into 'content' property
|
|
1240
1306
|
}).shape
|
|
1241
1307
|
);
|
|
1242
1308
|
var UnassignedAction = ActionBase.extend(
|
|
1243
|
-
|
|
1244
|
-
type:
|
|
1309
|
+
z16.object({
|
|
1310
|
+
type: z16.literal(ActionType.UNASSIGN)
|
|
1245
1311
|
}).shape
|
|
1246
1312
|
);
|
|
1247
1313
|
var RegisterAction = ActionBase.extend(
|
|
1248
|
-
|
|
1249
|
-
type:
|
|
1250
|
-
registrationNumber:
|
|
1314
|
+
z16.object({
|
|
1315
|
+
type: z16.literal(ActionType.REGISTER),
|
|
1316
|
+
registrationNumber: z16.string().optional().describe(
|
|
1251
1317
|
"Registration number of the event. Always present for accepted registrations."
|
|
1252
1318
|
)
|
|
1253
1319
|
// TODO move into 'content' property
|
|
1254
1320
|
}).shape
|
|
1255
1321
|
);
|
|
1256
1322
|
var DeclareAction = ActionBase.extend(
|
|
1257
|
-
|
|
1258
|
-
type:
|
|
1323
|
+
z16.object({
|
|
1324
|
+
type: z16.literal(ActionType.DECLARE)
|
|
1259
1325
|
}).shape
|
|
1260
1326
|
);
|
|
1261
|
-
var ReasonContent =
|
|
1262
|
-
reason:
|
|
1327
|
+
var ReasonContent = z16.object({
|
|
1328
|
+
reason: z16.string().min(1, { error: "Message cannot be empty" }).describe(
|
|
1263
1329
|
"Message describing the reason for rejecting or archiving the event."
|
|
1264
1330
|
)
|
|
1265
1331
|
});
|
|
1266
1332
|
var RejectAction = ActionBase.extend(
|
|
1267
|
-
|
|
1268
|
-
type:
|
|
1333
|
+
z16.object({
|
|
1334
|
+
type: z16.literal(ActionType.REJECT),
|
|
1269
1335
|
content: ReasonContent
|
|
1270
1336
|
}).shape
|
|
1271
1337
|
);
|
|
1272
|
-
var PotentialDuplicate =
|
|
1338
|
+
var PotentialDuplicate = z16.object({
|
|
1273
1339
|
id: UUID,
|
|
1274
|
-
trackingId:
|
|
1340
|
+
trackingId: z16.string()
|
|
1275
1341
|
});
|
|
1276
1342
|
var DuplicateDetectedAction = ActionBase.extend(
|
|
1277
|
-
|
|
1278
|
-
type:
|
|
1279
|
-
content:
|
|
1280
|
-
duplicates:
|
|
1343
|
+
z16.object({
|
|
1344
|
+
type: z16.literal(ActionType.DUPLICATE_DETECTED),
|
|
1345
|
+
content: z16.object({
|
|
1346
|
+
duplicates: z16.array(PotentialDuplicate)
|
|
1281
1347
|
})
|
|
1282
1348
|
}).shape
|
|
1283
1349
|
);
|
|
1284
1350
|
var MarkNotDuplicateAction = ActionBase.extend(
|
|
1285
|
-
|
|
1286
|
-
type:
|
|
1351
|
+
z16.object({
|
|
1352
|
+
type: z16.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
1287
1353
|
}).shape
|
|
1288
1354
|
);
|
|
1289
1355
|
var MarkAsDuplicateAction = ActionBase.extend(
|
|
1290
|
-
|
|
1291
|
-
type:
|
|
1292
|
-
content:
|
|
1356
|
+
z16.object({
|
|
1357
|
+
type: z16.literal(ActionType.MARK_AS_DUPLICATE),
|
|
1358
|
+
content: z16.object({
|
|
1293
1359
|
duplicateOf: UUID
|
|
1294
1360
|
}).optional()
|
|
1295
1361
|
}).shape
|
|
1296
1362
|
);
|
|
1297
1363
|
var ArchiveAction = ActionBase.extend(
|
|
1298
|
-
|
|
1299
|
-
type:
|
|
1300
|
-
|
|
1364
|
+
z16.object({
|
|
1365
|
+
type: z16.literal(ActionType.ARCHIVE),
|
|
1366
|
+
/**
|
|
1367
|
+
* Archiving does not collect a reason on its own. Only the
|
|
1368
|
+
* "mark as duplicate" flow archives with a reason attached.
|
|
1369
|
+
*/
|
|
1370
|
+
content: ReasonContent.optional()
|
|
1301
1371
|
}).shape
|
|
1302
1372
|
);
|
|
1303
1373
|
var UnarchiveAction = ActionBase.extend(
|
|
1304
|
-
|
|
1305
|
-
type:
|
|
1374
|
+
z16.object({
|
|
1375
|
+
type: z16.literal(ActionType.UNARCHIVE)
|
|
1306
1376
|
}).shape
|
|
1307
1377
|
);
|
|
1308
1378
|
var CreatedAction = ActionBase.extend(
|
|
1309
|
-
|
|
1310
|
-
type:
|
|
1379
|
+
z16.object({
|
|
1380
|
+
type: z16.literal(ActionType.CREATE)
|
|
1311
1381
|
}).shape
|
|
1312
1382
|
);
|
|
1313
1383
|
var NotifiedAction = ActionBase.extend(
|
|
1314
|
-
|
|
1315
|
-
type:
|
|
1384
|
+
z16.object({
|
|
1385
|
+
type: z16.literal(ActionType.NOTIFY)
|
|
1316
1386
|
}).shape
|
|
1317
1387
|
);
|
|
1318
1388
|
var EditAction = ActionBase.extend(
|
|
1319
|
-
|
|
1320
|
-
type:
|
|
1389
|
+
z16.object({
|
|
1390
|
+
type: z16.literal(ActionType.EDIT),
|
|
1321
1391
|
/** @deprecated New Edit-actions should no longer contain content. This is kept for old 2.0 edits. */
|
|
1322
|
-
content:
|
|
1323
|
-
comment:
|
|
1392
|
+
content: z16.object({
|
|
1393
|
+
comment: z16.string().describe("Comment for the edit action.").optional()
|
|
1324
1394
|
}).optional()
|
|
1325
1395
|
}).shape
|
|
1326
1396
|
);
|
|
1327
|
-
var PrintContent =
|
|
1328
|
-
templateId:
|
|
1397
|
+
var PrintContent = z16.object({
|
|
1398
|
+
templateId: z16.string().optional()
|
|
1329
1399
|
});
|
|
1330
1400
|
var PrintCertificateAction = ActionBase.extend(
|
|
1331
|
-
|
|
1332
|
-
type:
|
|
1401
|
+
z16.object({
|
|
1402
|
+
type: z16.literal(ActionType.PRINT_CERTIFICATE),
|
|
1333
1403
|
content: PrintContent.optional().nullable()
|
|
1334
1404
|
}).shape
|
|
1335
1405
|
);
|
|
1336
1406
|
var RequestedCorrectionAction = ActionBase.extend(
|
|
1337
|
-
|
|
1338
|
-
type:
|
|
1407
|
+
z16.object({
|
|
1408
|
+
type: z16.literal(ActionType.REQUEST_CORRECTION)
|
|
1339
1409
|
}).shape
|
|
1340
1410
|
);
|
|
1341
1411
|
var ApprovedCorrectionAction = ActionBase.extend(
|
|
1342
|
-
|
|
1343
|
-
type:
|
|
1344
|
-
requestId:
|
|
1412
|
+
z16.object({
|
|
1413
|
+
type: z16.literal(ActionType.APPROVE_CORRECTION),
|
|
1414
|
+
requestId: z16.string(),
|
|
1345
1415
|
// TODO move into 'content' property
|
|
1346
|
-
content:
|
|
1416
|
+
content: z16.object({ immediateCorrection: z16.boolean().optional() }).optional()
|
|
1347
1417
|
}).shape
|
|
1348
1418
|
);
|
|
1349
1419
|
var RejectedCorrectionAction = ActionBase.extend(
|
|
1350
|
-
|
|
1351
|
-
type:
|
|
1352
|
-
requestId:
|
|
1420
|
+
z16.object({
|
|
1421
|
+
type: z16.literal(ActionType.REJECT_CORRECTION),
|
|
1422
|
+
requestId: z16.string(),
|
|
1353
1423
|
// TODO move into 'content' property
|
|
1354
1424
|
content: ReasonContent
|
|
1355
1425
|
}).shape
|
|
1356
1426
|
);
|
|
1357
1427
|
var ReadAction = ActionBase.extend(
|
|
1358
|
-
|
|
1359
|
-
type:
|
|
1428
|
+
z16.object({
|
|
1429
|
+
type: z16.literal(ActionType.READ)
|
|
1360
1430
|
}).shape
|
|
1361
1431
|
);
|
|
1362
1432
|
var CustomAction = ActionBase.merge(
|
|
1363
|
-
|
|
1364
|
-
type:
|
|
1365
|
-
customActionType:
|
|
1433
|
+
z16.object({
|
|
1434
|
+
type: z16.literal(ActionType.CUSTOM),
|
|
1435
|
+
customActionType: z16.string()
|
|
1366
1436
|
})
|
|
1367
1437
|
);
|
|
1368
|
-
var ActionDocument =
|
|
1438
|
+
var ActionDocument = z16.discriminatedUnion("type", [
|
|
1369
1439
|
CreatedAction.meta({ id: "CreatedAction" }),
|
|
1370
1440
|
RejectAction.meta({ id: "RejectAction" }),
|
|
1371
1441
|
DuplicateDetectedAction.meta({ id: "DuplicateDetectedAction" }),
|
|
@@ -1392,57 +1462,50 @@ var AsyncRejectActionDocument = ActionBase.omit({
|
|
|
1392
1462
|
declaration: true,
|
|
1393
1463
|
annotation: true
|
|
1394
1464
|
}).extend(
|
|
1395
|
-
|
|
1396
|
-
type:
|
|
1397
|
-
status:
|
|
1465
|
+
z16.object({
|
|
1466
|
+
type: z16.enum(ConfirmableActions),
|
|
1467
|
+
status: z16.literal(ActionStatus.Rejected)
|
|
1398
1468
|
}).shape
|
|
1399
1469
|
);
|
|
1400
|
-
var Action =
|
|
1470
|
+
var Action = z16.union([ActionDocument, AsyncRejectActionDocument]);
|
|
1401
1471
|
|
|
1402
1472
|
// ../commons/src/events/EventMetadata.ts
|
|
1403
|
-
var
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
"
|
|
1407
|
-
"
|
|
1408
|
-
"ARCHIVED"
|
|
1409
|
-
]);
|
|
1410
|
-
var ZodDate = z16.iso.date();
|
|
1411
|
-
var ZodDateTime = z16.string().datetime();
|
|
1412
|
-
var ActionCreationMetadata = z16.object({
|
|
1413
|
-
createdAt: z16.iso.datetime().describe("The timestamp when the action request was created."),
|
|
1414
|
-
createdBy: z16.string().describe("ID of the user who created the action request."),
|
|
1473
|
+
var ZodDate = z17.iso.date();
|
|
1474
|
+
var ZodDateTime = z17.string().datetime();
|
|
1475
|
+
var ActionCreationMetadata = z17.object({
|
|
1476
|
+
createdAt: z17.iso.datetime().describe("The timestamp when the action request was created."),
|
|
1477
|
+
createdBy: z17.string().describe("ID of the user who created the action request."),
|
|
1415
1478
|
// @TODO: createdAtLocation should be non-nullable in the future once all action requests have this field populated.
|
|
1416
1479
|
createdAtLocation: UUID.nullish().describe(
|
|
1417
1480
|
"Location of the user who created the action request."
|
|
1418
1481
|
),
|
|
1419
|
-
createdByUserType:
|
|
1420
|
-
acceptedAt:
|
|
1421
|
-
createdByRole:
|
|
1482
|
+
createdByUserType: z17.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1483
|
+
acceptedAt: z17.iso.datetime().describe("Timestamp when the action request was accepted."),
|
|
1484
|
+
createdByRole: z17.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1422
1485
|
});
|
|
1423
1486
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
1424
|
-
registrationNumber:
|
|
1487
|
+
registrationNumber: z17.string().describe(
|
|
1425
1488
|
"Registration number of the event. Always present for accepted registrations."
|
|
1426
1489
|
)
|
|
1427
1490
|
});
|
|
1428
|
-
var LegalStatuses =
|
|
1491
|
+
var LegalStatuses = z17.object({
|
|
1429
1492
|
[EventStatus.enum.NOTIFIED]: ActionCreationMetadata.nullish(),
|
|
1430
1493
|
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
|
1431
1494
|
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
|
1432
1495
|
});
|
|
1433
|
-
var EventMetadata =
|
|
1496
|
+
var EventMetadata = z17.object({
|
|
1434
1497
|
id: UUID,
|
|
1435
|
-
type:
|
|
1498
|
+
type: z17.string().describe("The type of event, such as birth, death, or marriage."),
|
|
1436
1499
|
status: EventStatus,
|
|
1437
1500
|
legalStatuses: LegalStatuses.describe(
|
|
1438
1501
|
"Metadata related to the legal registration of the event, such as who registered it and when."
|
|
1439
1502
|
),
|
|
1440
|
-
createdAt:
|
|
1503
|
+
createdAt: z17.iso.datetime().describe("The timestamp when the event was first created and saved."),
|
|
1441
1504
|
dateOfEvent: ZodDate.nullish(),
|
|
1442
1505
|
placeOfEvent: UUID.nullish(),
|
|
1443
|
-
createdBy:
|
|
1444
|
-
createdByUserType:
|
|
1445
|
-
updatedByUserRole:
|
|
1506
|
+
createdBy: z17.string().describe("ID of the user who created the event."),
|
|
1507
|
+
createdByUserType: z17.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1508
|
+
updatedByUserRole: z17.string().nullish().describe("Role of the user who last changed the status."),
|
|
1446
1509
|
// @TODO: createdAtLocation should be non-nullable in the future once all action requests have this field populated.
|
|
1447
1510
|
createdAtLocation: UUID.nullish().describe(
|
|
1448
1511
|
"Location of the user who created the event."
|
|
@@ -1450,18 +1513,18 @@ var EventMetadata = z16.object({
|
|
|
1450
1513
|
updatedAtLocation: UUID.nullish().describe(
|
|
1451
1514
|
"Location of the user who last changed the status."
|
|
1452
1515
|
),
|
|
1453
|
-
updatedAt:
|
|
1516
|
+
updatedAt: z17.iso.datetime().describe(
|
|
1454
1517
|
"Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
|
|
1455
1518
|
),
|
|
1456
|
-
assignedTo:
|
|
1457
|
-
updatedBy:
|
|
1458
|
-
trackingId:
|
|
1519
|
+
assignedTo: z17.string().nullish().describe("ID of the user currently assigned to the event."),
|
|
1520
|
+
updatedBy: z17.string().nullish().describe("ID of the user who last changed the status."),
|
|
1521
|
+
trackingId: z17.string().describe(
|
|
1459
1522
|
"System-generated tracking ID used by informants or registrars to look up the event."
|
|
1460
1523
|
),
|
|
1461
|
-
potentialDuplicates:
|
|
1524
|
+
potentialDuplicates: z17.array(PotentialDuplicate).describe(
|
|
1462
1525
|
"List of event IDs and their tracking IDs that this event could be a duplicate of."
|
|
1463
1526
|
),
|
|
1464
|
-
flags:
|
|
1527
|
+
flags: z17.array(Flag)
|
|
1465
1528
|
});
|
|
1466
1529
|
var EventMetadataKeysArray = [
|
|
1467
1530
|
"id",
|
|
@@ -1482,8 +1545,8 @@ var EventMetadataKeysArray = [
|
|
|
1482
1545
|
"legalStatuses",
|
|
1483
1546
|
"flags"
|
|
1484
1547
|
];
|
|
1485
|
-
var EventMetadataKeys =
|
|
1486
|
-
var EventMetadataDateFieldIdInput =
|
|
1548
|
+
var EventMetadataKeys = z17.enum(EventMetadataKeysArray);
|
|
1549
|
+
var EventMetadataDateFieldIdInput = z17.enum([
|
|
1487
1550
|
"createdAt",
|
|
1488
1551
|
"updatedAt",
|
|
1489
1552
|
"legalStatuses.NOTIFIED.createdAt",
|
|
@@ -1493,7 +1556,7 @@ var EventMetadataDateFieldIdInput = z16.enum([
|
|
|
1493
1556
|
"legalStatuses.REGISTERED.createdAt",
|
|
1494
1557
|
"legalStatuses.REGISTERED.acceptedAt"
|
|
1495
1558
|
]);
|
|
1496
|
-
var EventMetadataDateFieldId =
|
|
1559
|
+
var EventMetadataDateFieldId = z17.enum([
|
|
1497
1560
|
"event.createdAt",
|
|
1498
1561
|
"event.updatedAt",
|
|
1499
1562
|
"event.legalStatuses.NOTIFIED.createdAt",
|
|
@@ -1781,8 +1844,8 @@ var BaseField = import_v43.default.object({
|
|
|
1781
1844
|
conditionals: import_v43.default.array(FieldConditional).default([]).optional().describe(
|
|
1782
1845
|
"Conditions determining when the field is shown or enabled. By default, the field is always shown and enabled."
|
|
1783
1846
|
),
|
|
1784
|
-
secured: import_v43.default.boolean().default(false).optional().describe(
|
|
1785
|
-
"Indicates whether the field is secured. Secured fields are not indexed for search and are only visible when explicitly assigned."
|
|
1847
|
+
secured: import_v43.default.union([import_v43.default.boolean(), Conditional]).default(false).optional().describe(
|
|
1848
|
+
"Indicates whether the field is secured, either always (boolean) or conditionally, evaluated against the event (a JSONSchema conditional, e.g. flag('sealed')). Secured fields are not indexed for search and are only visible when explicitly assigned."
|
|
1786
1849
|
),
|
|
1787
1850
|
placeholder: TranslationConfig.optional(),
|
|
1788
1851
|
validation: import_v43.default.array(ValidationConfig).default([]).optional().describe("Additional validation rules applied to the field."),
|
|
@@ -2180,7 +2243,16 @@ var AdministrativeAreaField = BaseField.extend({
|
|
|
2180
2243
|
configuration: import_v43.default.object({
|
|
2181
2244
|
partOf: FieldReference.optional().describe("Parent location"),
|
|
2182
2245
|
type: AdministrativeAreas,
|
|
2183
|
-
allowedLocations: AllowedLocations
|
|
2246
|
+
allowedLocations: AllowedLocations,
|
|
2247
|
+
listHistoricalNames: import_v43.default.boolean().optional().describe(
|
|
2248
|
+
"List every historical name a location has had as a separate, selectable option."
|
|
2249
|
+
),
|
|
2250
|
+
activeOnly: import_v43.default.boolean().optional().describe(
|
|
2251
|
+
"Offer only locations that are active at the resolved anchor date (today, or the date of event when anchorToDateOfEvent is set); inactive or not-yet-effective versions are excluded."
|
|
2252
|
+
),
|
|
2253
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional().describe(
|
|
2254
|
+
"Resolve selectable/displayed versions against the event's date of event (falling back to the record's creation date when empty) instead of today. Does not by itself exclude inactive versions; combine with activeOnly for that."
|
|
2255
|
+
)
|
|
2184
2256
|
}).describe("Administrative area options")
|
|
2185
2257
|
}).meta({
|
|
2186
2258
|
description: "Administrative area input field",
|
|
@@ -2191,7 +2263,16 @@ var LocationInput = BaseField.extend({
|
|
|
2191
2263
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
|
|
2192
2264
|
configuration: import_v43.default.object({
|
|
2193
2265
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
2194
|
-
allowedLocations: AllowedLocations
|
|
2266
|
+
allowedLocations: AllowedLocations,
|
|
2267
|
+
listHistoricalNames: import_v43.default.boolean().optional().describe(
|
|
2268
|
+
"List every historical name a location has had as a separate, selectable option."
|
|
2269
|
+
),
|
|
2270
|
+
activeOnly: import_v43.default.boolean().optional().describe(
|
|
2271
|
+
"Offer only locations that are active at the resolved anchor date (today, or the date of event when anchorToDateOfEvent is set); inactive or not-yet-effective versions are excluded."
|
|
2272
|
+
),
|
|
2273
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional().describe(
|
|
2274
|
+
"Resolve selectable/displayed versions against the event's date of event (falling back to the record's creation date when empty) instead of today. Does not by itself exclude inactive versions; combine with activeOnly for that."
|
|
2275
|
+
)
|
|
2195
2276
|
}).optional()
|
|
2196
2277
|
}).meta({
|
|
2197
2278
|
description: "A field for selecting a location",
|
|
@@ -2217,12 +2298,22 @@ var FileUploadWithOptions = BaseField.extend({
|
|
|
2217
2298
|
var Facility = BaseField.extend({
|
|
2218
2299
|
type: import_v43.default.literal(FieldType.FACILITY),
|
|
2219
2300
|
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
2220
|
-
configuration: import_v43.default.object({
|
|
2301
|
+
configuration: import_v43.default.object({
|
|
2302
|
+
allowedLocations: AllowedLocations,
|
|
2303
|
+
listHistoricalNames: import_v43.default.boolean().optional(),
|
|
2304
|
+
activeOnly: import_v43.default.boolean().optional(),
|
|
2305
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional()
|
|
2306
|
+
}).optional()
|
|
2221
2307
|
}).describe("Input field for a facility");
|
|
2222
2308
|
var Office = BaseField.extend({
|
|
2223
2309
|
type: import_v43.default.literal(FieldType.OFFICE),
|
|
2224
2310
|
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
2225
|
-
configuration: import_v43.default.object({
|
|
2311
|
+
configuration: import_v43.default.object({
|
|
2312
|
+
allowedLocations: AllowedLocations,
|
|
2313
|
+
listHistoricalNames: import_v43.default.boolean().optional(),
|
|
2314
|
+
activeOnly: import_v43.default.boolean().optional(),
|
|
2315
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional()
|
|
2316
|
+
}).optional()
|
|
2226
2317
|
}).describe("Input field for an office");
|
|
2227
2318
|
var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
|
|
2228
2319
|
administrativeArea: import_v43.default.union([UUID, SerializedUserField]).optional()
|
|
@@ -2255,7 +2346,16 @@ var Address = BaseField.extend({
|
|
|
2255
2346
|
parent: FieldReference.optional()
|
|
2256
2347
|
})
|
|
2257
2348
|
).optional(),
|
|
2258
|
-
allowedLocations: AllowedLocations
|
|
2349
|
+
allowedLocations: AllowedLocations,
|
|
2350
|
+
listHistoricalNames: import_v43.default.boolean().optional().describe(
|
|
2351
|
+
"List every historical name a location has had as a separate, selectable option. Propagated to the embedded admin-area selectors."
|
|
2352
|
+
),
|
|
2353
|
+
activeOnly: import_v43.default.boolean().optional().describe(
|
|
2354
|
+
"Offer only admin areas that are active at the resolved anchor date (today, or the date of event when anchorToDateOfEvent is set); inactive or not-yet-effective versions are excluded. Propagated to the embedded admin-area selectors."
|
|
2355
|
+
),
|
|
2356
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional().describe(
|
|
2357
|
+
"Resolve selectable/displayed versions against the event's date of event (falling back to the record's creation date when empty) instead of today. Does not by itself exclude inactive versions; combine with activeOnly for that. Propagated to the embedded admin-area selectors."
|
|
2358
|
+
)
|
|
2259
2359
|
}).optional(),
|
|
2260
2360
|
defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
|
|
2261
2361
|
}).meta({
|
|
@@ -2556,18 +2656,18 @@ var AnyFileField = import_v43.default.discriminatedUnion("type", [
|
|
|
2556
2656
|
]);
|
|
2557
2657
|
|
|
2558
2658
|
// ../commons/src/events/FormConfig.ts
|
|
2559
|
-
var
|
|
2659
|
+
var z23 = __toESM(require("zod/v4"));
|
|
2560
2660
|
|
|
2561
2661
|
// ../commons/src/events/PageConfig.ts
|
|
2562
|
-
var
|
|
2563
|
-
var PageTypes =
|
|
2564
|
-
var PageConfigBase =
|
|
2565
|
-
id:
|
|
2662
|
+
var z22 = __toESM(require("zod/v4"));
|
|
2663
|
+
var PageTypes = z22.enum(["FORM", "VERIFICATION"]);
|
|
2664
|
+
var PageConfigBase = z22.object({
|
|
2665
|
+
id: z22.string().describe("Unique identifier for the page"),
|
|
2566
2666
|
title: TranslationConfig.describe("Header title of the page"),
|
|
2567
|
-
requireCompletionToContinue:
|
|
2667
|
+
requireCompletionToContinue: z22.boolean().default(false).describe(
|
|
2568
2668
|
"If true, all required fields must be filled before continuing to the next page"
|
|
2569
2669
|
),
|
|
2570
|
-
fields:
|
|
2670
|
+
fields: z22.array(FieldConfig).describe("Fields to be rendered on the page"),
|
|
2571
2671
|
conditional: Conditional.optional().describe(
|
|
2572
2672
|
"Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
|
|
2573
2673
|
)
|
|
@@ -2576,13 +2676,13 @@ var PageConfigBase = z21.object({
|
|
|
2576
2676
|
id: "FormPageConfig"
|
|
2577
2677
|
});
|
|
2578
2678
|
var FormPageConfig = PageConfigBase.extend({
|
|
2579
|
-
type:
|
|
2679
|
+
type: z22.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
|
|
2580
2680
|
});
|
|
2581
|
-
var VerificationActionConfig =
|
|
2582
|
-
verify:
|
|
2583
|
-
cancel:
|
|
2681
|
+
var VerificationActionConfig = z22.object({
|
|
2682
|
+
verify: z22.object({ label: TranslationConfig }),
|
|
2683
|
+
cancel: z22.object({
|
|
2584
2684
|
label: TranslationConfig,
|
|
2585
|
-
confirmation:
|
|
2685
|
+
confirmation: z22.object({
|
|
2586
2686
|
title: TranslationConfig,
|
|
2587
2687
|
body: TranslationConfig
|
|
2588
2688
|
})
|
|
@@ -2592,34 +2692,34 @@ var VerificationActionConfig = z21.object({
|
|
|
2592
2692
|
id: "VerificationActionConfig"
|
|
2593
2693
|
});
|
|
2594
2694
|
var VerificationPageConfig = FormPageConfig.extend({
|
|
2595
|
-
type:
|
|
2695
|
+
type: z22.literal(PageTypes.enum.VERIFICATION),
|
|
2596
2696
|
actions: VerificationActionConfig
|
|
2597
2697
|
});
|
|
2598
|
-
var PageConfig =
|
|
2698
|
+
var PageConfig = z22.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
|
|
2599
2699
|
id: "PageConfig",
|
|
2600
2700
|
description: "Configuration for a single page in a form. Either a form page with fields and a continue button, or a verification page with verify/cancel options."
|
|
2601
2701
|
});
|
|
2602
2702
|
|
|
2603
2703
|
// ../commons/src/events/FormConfig.ts
|
|
2604
|
-
var DeclarationFormConfig =
|
|
2704
|
+
var DeclarationFormConfig = z23.object({
|
|
2605
2705
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
2606
|
-
pages:
|
|
2706
|
+
pages: z23.array(FormPageConfig)
|
|
2607
2707
|
}).meta({
|
|
2608
2708
|
id: "DeclarationFormConfig",
|
|
2609
2709
|
description: "Configuration of the declaration form."
|
|
2610
2710
|
});
|
|
2611
|
-
var ActionFormConfig =
|
|
2711
|
+
var ActionFormConfig = z23.object({
|
|
2612
2712
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
2613
|
-
pages:
|
|
2713
|
+
pages: z23.array(PageConfig)
|
|
2614
2714
|
}).describe(
|
|
2615
2715
|
"Configuration of the form used for system actions beyond declaration, supporting a wider range of page types."
|
|
2616
2716
|
);
|
|
2617
|
-
var FormConfig =
|
|
2717
|
+
var FormConfig = z23.union([DeclarationFormConfig, ActionFormConfig]);
|
|
2618
2718
|
|
|
2619
2719
|
// ../commons/src/events/DeduplicationConfig.ts
|
|
2620
|
-
var
|
|
2621
|
-
var FieldReference2 =
|
|
2622
|
-
var Matcher =
|
|
2720
|
+
var z24 = __toESM(require("zod/v4"));
|
|
2721
|
+
var FieldReference2 = z24.string();
|
|
2722
|
+
var Matcher = z24.object({
|
|
2623
2723
|
/**
|
|
2624
2724
|
* Reference to the field used in matching.
|
|
2625
2725
|
*
|
|
@@ -2627,23 +2727,23 @@ var Matcher = z23.object({
|
|
|
2627
2727
|
* be used as the origin date to calculate the distance from.
|
|
2628
2728
|
*/
|
|
2629
2729
|
fieldId: FieldReference2,
|
|
2630
|
-
options:
|
|
2631
|
-
boost:
|
|
2730
|
+
options: z24.object({
|
|
2731
|
+
boost: z24.number().optional(),
|
|
2632
2732
|
matchAgainst: FieldReference2.optional()
|
|
2633
2733
|
}).optional().default({
|
|
2634
2734
|
boost: 1
|
|
2635
2735
|
})
|
|
2636
2736
|
});
|
|
2637
2737
|
var FuzzyMatcher = Matcher.extend({
|
|
2638
|
-
type:
|
|
2639
|
-
options:
|
|
2738
|
+
type: z24.literal("fuzzy"),
|
|
2739
|
+
options: z24.object({
|
|
2640
2740
|
/**
|
|
2641
2741
|
* Names of length 3 or less characters = 0 edits allowed
|
|
2642
2742
|
* Names of length 4 - 6 characters = 1 edit allowed
|
|
2643
2743
|
* Names of length >7 characters = 2 edits allowed
|
|
2644
2744
|
*/
|
|
2645
|
-
fuzziness:
|
|
2646
|
-
boost:
|
|
2745
|
+
fuzziness: z24.union([z24.string(), z24.number()]).optional().default("AUTO:4,7"),
|
|
2746
|
+
boost: z24.number().optional().default(1),
|
|
2647
2747
|
matchAgainst: FieldReference2.optional()
|
|
2648
2748
|
}).optional().default({
|
|
2649
2749
|
fuzziness: "AUTO:4,7",
|
|
@@ -2651,48 +2751,48 @@ var FuzzyMatcher = Matcher.extend({
|
|
|
2651
2751
|
})
|
|
2652
2752
|
});
|
|
2653
2753
|
var StrictMatcher = Matcher.extend({
|
|
2654
|
-
type:
|
|
2655
|
-
options:
|
|
2656
|
-
boost:
|
|
2754
|
+
type: z24.literal("strict"),
|
|
2755
|
+
options: z24.object({
|
|
2756
|
+
boost: z24.number().optional().default(1),
|
|
2657
2757
|
/**
|
|
2658
2758
|
* The constant value to be present in the field for both records
|
|
2659
2759
|
*/
|
|
2660
|
-
value:
|
|
2760
|
+
value: z24.string().optional(),
|
|
2661
2761
|
matchAgainst: FieldReference2.optional()
|
|
2662
2762
|
}).optional().default({
|
|
2663
2763
|
boost: 1
|
|
2664
2764
|
})
|
|
2665
2765
|
});
|
|
2666
2766
|
var DateRangeMatcher = Matcher.extend({
|
|
2667
|
-
type:
|
|
2668
|
-
options:
|
|
2767
|
+
type: z24.literal("dateRange"),
|
|
2768
|
+
options: z24.object({
|
|
2669
2769
|
/**
|
|
2670
2770
|
* The distance pivot in days. Distance from the origin (the value of
|
|
2671
2771
|
* fieldId) at which relevance scores receive half of the boost value
|
|
2672
2772
|
*/
|
|
2673
|
-
pivot:
|
|
2674
|
-
days:
|
|
2675
|
-
boost:
|
|
2773
|
+
pivot: z24.number().optional(),
|
|
2774
|
+
days: z24.number(),
|
|
2775
|
+
boost: z24.number().optional().default(1),
|
|
2676
2776
|
matchAgainst: FieldReference2.optional()
|
|
2677
2777
|
})
|
|
2678
2778
|
});
|
|
2679
|
-
var Not =
|
|
2680
|
-
type:
|
|
2779
|
+
var Not = z24.object({
|
|
2780
|
+
type: z24.literal("not"),
|
|
2681
2781
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2682
|
-
clause:
|
|
2782
|
+
clause: z24.lazy(() => Clause)
|
|
2683
2783
|
});
|
|
2684
|
-
var And =
|
|
2685
|
-
type:
|
|
2784
|
+
var And = z24.object({
|
|
2785
|
+
type: z24.literal("and"),
|
|
2686
2786
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2687
|
-
clauses:
|
|
2787
|
+
clauses: z24.lazy(() => Clause.array())
|
|
2688
2788
|
});
|
|
2689
|
-
var Or =
|
|
2690
|
-
type:
|
|
2789
|
+
var Or = z24.object({
|
|
2790
|
+
type: z24.literal("or"),
|
|
2691
2791
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2692
|
-
clauses:
|
|
2792
|
+
clauses: z24.lazy(() => Clause.array())
|
|
2693
2793
|
});
|
|
2694
|
-
var Clause =
|
|
2695
|
-
() =>
|
|
2794
|
+
var Clause = z24.lazy(
|
|
2795
|
+
() => z24.discriminatedUnion("type", [
|
|
2696
2796
|
Not,
|
|
2697
2797
|
And,
|
|
2698
2798
|
Or,
|
|
@@ -2703,8 +2803,8 @@ var Clause = z23.lazy(
|
|
|
2703
2803
|
).meta({
|
|
2704
2804
|
id: "Clause"
|
|
2705
2805
|
});
|
|
2706
|
-
var DeduplicationConfig =
|
|
2707
|
-
id:
|
|
2806
|
+
var DeduplicationConfig = z24.object({
|
|
2807
|
+
id: z24.string(),
|
|
2708
2808
|
label: TranslationConfig,
|
|
2709
2809
|
query: Clause
|
|
2710
2810
|
}).meta({
|
|
@@ -2713,15 +2813,15 @@ var DeduplicationConfig = z23.object({
|
|
|
2713
2813
|
});
|
|
2714
2814
|
|
|
2715
2815
|
// ../commons/src/events/ActionConfig.ts
|
|
2716
|
-
var DeclarationReviewConfig =
|
|
2816
|
+
var DeclarationReviewConfig = z25.object({
|
|
2717
2817
|
title: TranslationConfig.describe("Title of the review page"),
|
|
2718
|
-
fields:
|
|
2818
|
+
fields: z25.array(FieldConfig).describe("Fields displayed on the review page for annotations.")
|
|
2719
2819
|
}).describe(
|
|
2720
2820
|
"Configuration of the declaration review page for collecting event-related metadata."
|
|
2721
2821
|
);
|
|
2722
|
-
var ActionConfigBase =
|
|
2822
|
+
var ActionConfigBase = z25.object({
|
|
2723
2823
|
label: TranslationConfig.describe("Human readable description of the action"),
|
|
2724
|
-
flags:
|
|
2824
|
+
flags: z25.array(ActionFlagConfig).optional().default([]).describe("Flag actions which are executed when the action is performed."),
|
|
2725
2825
|
supportingCopy: TranslationConfig.optional().describe(
|
|
2726
2826
|
"Text displayed on the confirmation dialog"
|
|
2727
2827
|
),
|
|
@@ -2732,84 +2832,84 @@ var ActionConfigBase = z24.object({
|
|
|
2732
2832
|
* "The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed."
|
|
2733
2833
|
* for EventConfig.d.ts.
|
|
2734
2834
|
*/
|
|
2735
|
-
icon:
|
|
2736
|
-
conditionals:
|
|
2835
|
+
icon: z25.string().describe("Icon representing the action").optional(),
|
|
2836
|
+
conditionals: z25.array(ActionConditional).optional().describe("Conditionals which can disable or hide actions.")
|
|
2737
2837
|
});
|
|
2738
2838
|
var DeclarationActionBase = ActionConfigBase.extend({
|
|
2739
2839
|
deduplication: DeduplicationConfig.optional()
|
|
2740
2840
|
});
|
|
2741
|
-
var actionConfirmationForm =
|
|
2841
|
+
var actionConfirmationForm = z25.array(FieldConfig).optional().describe(
|
|
2742
2842
|
"Fields rendered on the action confirmation dialog. Submitted values are stored in the action annotation and shown in the audit history."
|
|
2743
2843
|
);
|
|
2744
2844
|
var ReadActionConfig = ActionConfigBase.extend(
|
|
2745
|
-
|
|
2746
|
-
type:
|
|
2845
|
+
z25.object({
|
|
2846
|
+
type: z25.literal(ActionType.READ),
|
|
2747
2847
|
review: DeclarationReviewConfig.describe(
|
|
2748
2848
|
"Configuration of the review page for read-only view."
|
|
2749
2849
|
),
|
|
2750
|
-
conditionals:
|
|
2850
|
+
conditionals: z25.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
|
|
2751
2851
|
}).shape
|
|
2752
2852
|
);
|
|
2753
2853
|
var NotifyConfig = ActionConfigBase.extend(
|
|
2754
|
-
|
|
2755
|
-
type:
|
|
2854
|
+
z25.object({
|
|
2855
|
+
type: z25.literal(ActionType.NOTIFY),
|
|
2756
2856
|
form: actionConfirmationForm
|
|
2757
2857
|
}).shape
|
|
2758
2858
|
);
|
|
2759
2859
|
var DuplicateDetectedConfig = ActionConfigBase.extend(
|
|
2760
|
-
|
|
2761
|
-
type:
|
|
2762
|
-
label:
|
|
2860
|
+
z25.object({
|
|
2861
|
+
type: z25.literal(ActionType.DUPLICATE_DETECTED),
|
|
2862
|
+
label: z25.never().optional().describe(
|
|
2763
2863
|
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no label."
|
|
2764
2864
|
),
|
|
2765
|
-
supportingCopy:
|
|
2766
|
-
icon:
|
|
2865
|
+
supportingCopy: z25.never().optional(),
|
|
2866
|
+
icon: z25.never().optional().describe(
|
|
2767
2867
|
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no icon."
|
|
2768
2868
|
),
|
|
2769
|
-
conditionals:
|
|
2869
|
+
conditionals: z25.never().optional().describe(
|
|
2770
2870
|
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it cannot be disabled or hidden with conditionals."
|
|
2771
2871
|
)
|
|
2772
2872
|
}).shape
|
|
2773
2873
|
);
|
|
2774
2874
|
var MarkAsDuplicateConfig = ActionConfigBase.extend(
|
|
2775
|
-
|
|
2776
|
-
type:
|
|
2875
|
+
z25.object({
|
|
2876
|
+
type: z25.literal(ActionType.MARK_AS_DUPLICATE)
|
|
2777
2877
|
}).shape
|
|
2778
2878
|
);
|
|
2779
2879
|
var MarkAsNotDuplicateConfig = ActionConfigBase.extend(
|
|
2780
|
-
|
|
2781
|
-
type:
|
|
2880
|
+
z25.object({
|
|
2881
|
+
type: z25.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
2782
2882
|
}).shape
|
|
2783
2883
|
);
|
|
2784
2884
|
var AssignConfig = ActionConfigBase.extend(
|
|
2785
|
-
|
|
2786
|
-
type:
|
|
2787
|
-
flags:
|
|
2885
|
+
z25.object({
|
|
2886
|
+
type: z25.literal(ActionType.ASSIGN),
|
|
2887
|
+
flags: z25.never().optional().describe(
|
|
2788
2888
|
"ASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
|
|
2789
2889
|
)
|
|
2790
2890
|
}).shape
|
|
2791
2891
|
);
|
|
2792
2892
|
var UnassignConfig = ActionConfigBase.extend(
|
|
2793
|
-
|
|
2794
|
-
type:
|
|
2795
|
-
flags:
|
|
2893
|
+
z25.object({
|
|
2894
|
+
type: z25.literal(ActionType.UNASSIGN),
|
|
2895
|
+
flags: z25.never().optional().describe(
|
|
2796
2896
|
"UNASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
|
|
2797
2897
|
)
|
|
2798
2898
|
}).shape
|
|
2799
2899
|
);
|
|
2800
2900
|
var DeleteConfig = ActionConfigBase.extend(
|
|
2801
|
-
|
|
2802
|
-
type:
|
|
2901
|
+
z25.object({
|
|
2902
|
+
type: z25.literal(ActionType.DELETE)
|
|
2803
2903
|
}).shape
|
|
2804
2904
|
);
|
|
2805
2905
|
var DeclareConfig = DeclarationActionBase.extend(
|
|
2806
|
-
|
|
2807
|
-
type:
|
|
2906
|
+
z25.object({
|
|
2907
|
+
type: z25.literal(ActionType.DECLARE),
|
|
2808
2908
|
review: DeclarationReviewConfig.describe(
|
|
2809
2909
|
"Configuration of the review page fields."
|
|
2810
2910
|
),
|
|
2811
2911
|
form: actionConfirmationForm,
|
|
2812
|
-
dialogCopy:
|
|
2912
|
+
dialogCopy: z25.object({
|
|
2813
2913
|
notify: TranslationConfig.describe(
|
|
2814
2914
|
"Confirmation text for the notify action"
|
|
2815
2915
|
),
|
|
@@ -2823,20 +2923,20 @@ var DeclareConfig = DeclarationActionBase.extend(
|
|
|
2823
2923
|
}).shape
|
|
2824
2924
|
);
|
|
2825
2925
|
var ArchiveConfig = ActionConfigBase.extend(
|
|
2826
|
-
|
|
2827
|
-
type:
|
|
2926
|
+
z25.object({
|
|
2927
|
+
type: z25.literal(ActionType.ARCHIVE),
|
|
2828
2928
|
form: actionConfirmationForm
|
|
2829
2929
|
}).shape
|
|
2830
2930
|
);
|
|
2831
2931
|
var UnarchiveConfig = ActionConfigBase.extend(
|
|
2832
|
-
|
|
2833
|
-
type:
|
|
2932
|
+
z25.object({
|
|
2933
|
+
type: z25.literal(ActionType.UNARCHIVE)
|
|
2834
2934
|
}).shape
|
|
2835
2935
|
);
|
|
2836
2936
|
var EditActionConfig = ActionConfigBase.extend(
|
|
2837
|
-
|
|
2838
|
-
type:
|
|
2839
|
-
dialogCopy:
|
|
2937
|
+
z25.object({
|
|
2938
|
+
type: z25.literal(ActionType.EDIT),
|
|
2939
|
+
dialogCopy: z25.object({
|
|
2840
2940
|
notify: TranslationConfig.describe(
|
|
2841
2941
|
"Confirmation text for the notify with edits action"
|
|
2842
2942
|
),
|
|
@@ -2850,45 +2950,45 @@ var EditActionConfig = ActionConfigBase.extend(
|
|
|
2850
2950
|
}).shape
|
|
2851
2951
|
);
|
|
2852
2952
|
var RejectConfig = ActionConfigBase.extend(
|
|
2853
|
-
|
|
2854
|
-
type:
|
|
2953
|
+
z25.object({
|
|
2954
|
+
type: z25.literal(ActionType.REJECT),
|
|
2855
2955
|
form: actionConfirmationForm
|
|
2856
2956
|
}).shape
|
|
2857
2957
|
);
|
|
2858
2958
|
var RegisterConfig = DeclarationActionBase.extend(
|
|
2859
|
-
|
|
2860
|
-
type:
|
|
2959
|
+
z25.object({
|
|
2960
|
+
type: z25.literal(ActionType.REGISTER),
|
|
2861
2961
|
form: actionConfirmationForm
|
|
2862
2962
|
}).shape
|
|
2863
2963
|
);
|
|
2864
2964
|
var PrintCertificateActionConfig = ActionConfigBase.extend(
|
|
2865
|
-
|
|
2866
|
-
type:
|
|
2965
|
+
z25.object({
|
|
2966
|
+
type: z25.literal(ActionType.PRINT_CERTIFICATE),
|
|
2867
2967
|
printForm: ActionFormConfig
|
|
2868
2968
|
}).shape
|
|
2869
2969
|
);
|
|
2870
2970
|
var RequestCorrectionConfig = ActionConfigBase.extend(
|
|
2871
|
-
|
|
2872
|
-
type:
|
|
2971
|
+
z25.object({
|
|
2972
|
+
type: z25.literal(ActionType.REQUEST_CORRECTION),
|
|
2873
2973
|
correctionForm: ActionFormConfig
|
|
2874
2974
|
}).shape
|
|
2875
2975
|
);
|
|
2876
2976
|
var ApproveCorrectionConfig = ActionConfigBase.extend(
|
|
2877
|
-
|
|
2878
|
-
type:
|
|
2977
|
+
z25.object({
|
|
2978
|
+
type: z25.literal(ActionType.APPROVE_CORRECTION)
|
|
2879
2979
|
}).shape
|
|
2880
2980
|
);
|
|
2881
2981
|
var RejectCorrectionConfig = ActionConfigBase.extend(
|
|
2882
|
-
|
|
2883
|
-
type:
|
|
2982
|
+
z25.object({
|
|
2983
|
+
type: z25.literal(ActionType.REJECT_CORRECTION)
|
|
2884
2984
|
}).shape
|
|
2885
2985
|
);
|
|
2886
2986
|
var CustomActionConfig = ActionConfigBase.extend(
|
|
2887
|
-
|
|
2888
|
-
type:
|
|
2889
|
-
customActionType:
|
|
2987
|
+
z25.object({
|
|
2988
|
+
type: z25.literal(ActionType.CUSTOM),
|
|
2989
|
+
customActionType: z25.string().describe("Type identifier of the custom action."),
|
|
2890
2990
|
/** Custom action form configuration supports a simple array of field configs, which should be rendered on the action modal. In the future, we might add support for pages etc. */
|
|
2891
|
-
form:
|
|
2991
|
+
form: z25.array(FieldConfig).describe(
|
|
2892
2992
|
"Form configuration for the custom action. The form configured here will be used on the custom action confirmation modal."
|
|
2893
2993
|
),
|
|
2894
2994
|
auditHistoryLabel: TranslationConfig.describe(
|
|
@@ -2896,7 +2996,7 @@ var CustomActionConfig = ActionConfigBase.extend(
|
|
|
2896
2996
|
)
|
|
2897
2997
|
}).shape
|
|
2898
2998
|
);
|
|
2899
|
-
var ActionConfig =
|
|
2999
|
+
var ActionConfig = z25.discriminatedUnion("type", [
|
|
2900
3000
|
/*
|
|
2901
3001
|
* OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
|
|
2902
3002
|
* and treat them as "models" instead of duplicating the data structure in each endpoint.
|
|
@@ -2983,89 +3083,225 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
2983
3083
|
var actionConfigTypes = new Set(
|
|
2984
3084
|
ActionConfig.options.map((opt) => opt.shape.type.value)
|
|
2985
3085
|
);
|
|
2986
|
-
var DeclarationActionConfig =
|
|
3086
|
+
var DeclarationActionConfig = z25.discriminatedUnion("type", [
|
|
2987
3087
|
DeclareConfig,
|
|
2988
3088
|
RegisterConfig
|
|
2989
3089
|
]);
|
|
2990
3090
|
|
|
2991
3091
|
// ../commons/src/events/offline/CertificateConfig.ts
|
|
2992
|
-
var
|
|
2993
|
-
var FontFamily =
|
|
2994
|
-
normal:
|
|
2995
|
-
bold:
|
|
2996
|
-
italics:
|
|
2997
|
-
bolditalics:
|
|
2998
|
-
});
|
|
2999
|
-
var CertificateConfig =
|
|
3000
|
-
id:
|
|
3001
|
-
event:
|
|
3002
|
-
isV2Template:
|
|
3092
|
+
var z26 = __toESM(require("zod/v4"));
|
|
3093
|
+
var FontFamily = z26.object({
|
|
3094
|
+
normal: z26.string(),
|
|
3095
|
+
bold: z26.string(),
|
|
3096
|
+
italics: z26.string(),
|
|
3097
|
+
bolditalics: z26.string()
|
|
3098
|
+
});
|
|
3099
|
+
var CertificateConfig = z26.object({
|
|
3100
|
+
id: z26.string(),
|
|
3101
|
+
event: z26.string(),
|
|
3102
|
+
isV2Template: z26.boolean().optional(),
|
|
3003
3103
|
label: TranslationConfig,
|
|
3004
|
-
isDefault:
|
|
3005
|
-
fee:
|
|
3006
|
-
onTime:
|
|
3007
|
-
late:
|
|
3008
|
-
delayed:
|
|
3104
|
+
isDefault: z26.boolean(),
|
|
3105
|
+
fee: z26.object({
|
|
3106
|
+
onTime: z26.number(),
|
|
3107
|
+
late: z26.number(),
|
|
3108
|
+
delayed: z26.number()
|
|
3009
3109
|
}),
|
|
3010
|
-
svgUrl:
|
|
3011
|
-
fonts:
|
|
3012
|
-
conditionals:
|
|
3110
|
+
svgUrl: z26.string(),
|
|
3111
|
+
fonts: z26.record(z26.string(), FontFamily).optional(),
|
|
3112
|
+
conditionals: z26.array(ShowConditional).optional()
|
|
3013
3113
|
});
|
|
3014
3114
|
var CertificateTemplateConfig = CertificateConfig.extend({
|
|
3015
|
-
hash:
|
|
3016
|
-
svg:
|
|
3115
|
+
hash: z26.string().optional(),
|
|
3116
|
+
svg: z26.string()
|
|
3017
3117
|
});
|
|
3018
3118
|
|
|
3019
3119
|
// ../commons/src/events/offline/LanguageConfig.ts
|
|
3020
|
-
var
|
|
3021
|
-
var LanguageConfig =
|
|
3022
|
-
lang:
|
|
3120
|
+
var z27 = __toESM(require("zod/v4"));
|
|
3121
|
+
var LanguageConfig = z27.object({
|
|
3122
|
+
lang: z27.string(),
|
|
3023
3123
|
/**
|
|
3024
3124
|
* client.csv contents
|
|
3025
3125
|
*/
|
|
3026
|
-
messages:
|
|
3126
|
+
messages: z27.record(z27.string(), z27.string())
|
|
3027
3127
|
});
|
|
3028
3128
|
|
|
3029
3129
|
// ../commons/src/events/EventConfig.ts
|
|
3030
|
-
var
|
|
3130
|
+
var z35 = __toESM(require("zod/v4"));
|
|
3031
3131
|
|
|
3032
3132
|
// ../commons/src/events/SummaryConfig.ts
|
|
3033
|
-
var
|
|
3034
|
-
|
|
3133
|
+
var z29 = __toESM(require("zod/v4"));
|
|
3134
|
+
|
|
3135
|
+
// ../commons/src/icons.ts
|
|
3136
|
+
var z28 = __toESM(require("zod/v4"));
|
|
3137
|
+
var AvailableIcons = z28.enum([
|
|
3138
|
+
"Archived",
|
|
3139
|
+
"Assigned",
|
|
3140
|
+
"Briefcase",
|
|
3141
|
+
"Certified",
|
|
3142
|
+
"Close",
|
|
3143
|
+
"Collapse",
|
|
3144
|
+
"Draft",
|
|
3145
|
+
"DuplicateYellow",
|
|
3146
|
+
"Expand",
|
|
3147
|
+
"ExternalValidate",
|
|
3148
|
+
"FilledCheck",
|
|
3149
|
+
"InReview",
|
|
3150
|
+
"Offline",
|
|
3151
|
+
"Registered",
|
|
3152
|
+
"RequiresUpdates",
|
|
3153
|
+
"Sent",
|
|
3154
|
+
"Validated",
|
|
3155
|
+
"WaitingApproval",
|
|
3156
|
+
"ChartActivity",
|
|
3157
|
+
"Activity",
|
|
3158
|
+
"Archive",
|
|
3159
|
+
"ArchiveTray",
|
|
3160
|
+
"ArrowLeft",
|
|
3161
|
+
"ArrowRight",
|
|
3162
|
+
"Buildings",
|
|
3163
|
+
"Circle",
|
|
3164
|
+
"CaretDown",
|
|
3165
|
+
"CaretLeft",
|
|
3166
|
+
"CaretRight",
|
|
3167
|
+
"ChartBar",
|
|
3168
|
+
"ChartLine",
|
|
3169
|
+
"ChatCircle",
|
|
3170
|
+
"CheckSquare",
|
|
3171
|
+
"Compass",
|
|
3172
|
+
"Check",
|
|
3173
|
+
"Copy",
|
|
3174
|
+
"Database",
|
|
3175
|
+
"DotsThreeVertical",
|
|
3176
|
+
"ArrowCounterClockwise",
|
|
3177
|
+
"MagnifyingGlassMinus",
|
|
3178
|
+
"MagnifyingGlassPlus",
|
|
3179
|
+
"Export",
|
|
3180
|
+
"Eye",
|
|
3181
|
+
"EyeSlash",
|
|
3182
|
+
"Envelope",
|
|
3183
|
+
"File",
|
|
3184
|
+
"FileLock",
|
|
3185
|
+
"FileSearch",
|
|
3186
|
+
"FileMinus",
|
|
3187
|
+
"FilePlus",
|
|
3188
|
+
"FileText",
|
|
3189
|
+
"FileX",
|
|
3190
|
+
"Handshake",
|
|
3191
|
+
"Gear",
|
|
3192
|
+
"GitBranch",
|
|
3193
|
+
"IdentificationCard",
|
|
3194
|
+
"List",
|
|
3195
|
+
"ListBullets",
|
|
3196
|
+
"Lock",
|
|
3197
|
+
"MagnifyingGlass",
|
|
3198
|
+
"MapPin",
|
|
3199
|
+
"Medal",
|
|
3200
|
+
"NotePencil",
|
|
3201
|
+
"Paperclip",
|
|
3202
|
+
"PaperPlaneTilt",
|
|
3203
|
+
"Pen",
|
|
3204
|
+
"PenNib",
|
|
3205
|
+
"Pencil",
|
|
3206
|
+
"PencilSimpleLine",
|
|
3207
|
+
"Phone",
|
|
3208
|
+
"Plus",
|
|
3209
|
+
"Printer",
|
|
3210
|
+
"SignOut",
|
|
3211
|
+
"Stamp",
|
|
3212
|
+
"Star",
|
|
3213
|
+
"Target",
|
|
3214
|
+
"TextT",
|
|
3215
|
+
"Trash",
|
|
3216
|
+
"UploadSimple",
|
|
3217
|
+
"User",
|
|
3218
|
+
"UserPlus",
|
|
3219
|
+
"Users",
|
|
3220
|
+
"WarningCircle",
|
|
3221
|
+
"X",
|
|
3222
|
+
"ChatText",
|
|
3223
|
+
"CircleWavyCheck",
|
|
3224
|
+
"CircleWavyQuestion",
|
|
3225
|
+
"ArchiveBox",
|
|
3226
|
+
"ArrowCircleDown",
|
|
3227
|
+
"FileArrowUp",
|
|
3228
|
+
"FileDotted",
|
|
3229
|
+
"Files",
|
|
3230
|
+
"PencilLine",
|
|
3231
|
+
"PencilCircle",
|
|
3232
|
+
"UserCircle",
|
|
3233
|
+
"Clock",
|
|
3234
|
+
"QrCode",
|
|
3235
|
+
"Webcam",
|
|
3236
|
+
"Sun",
|
|
3237
|
+
"DeviceTabletCamera",
|
|
3238
|
+
"Globe",
|
|
3239
|
+
"Fingerprint",
|
|
3240
|
+
"PushPin",
|
|
3241
|
+
"Timer"
|
|
3242
|
+
]);
|
|
3243
|
+
|
|
3244
|
+
// ../commons/src/events/SummaryConfig.ts
|
|
3245
|
+
var InfoBox = z29.object({
|
|
3246
|
+
type: z29.enum(["info", "positive", "warning", "negative"]).describe(
|
|
3247
|
+
"Semantic tint of the icon block: info (blue), positive (green), warning (orange), negative (red)."
|
|
3248
|
+
),
|
|
3249
|
+
background: z29.enum(["tinted", "white"]).default("tinted").optional().describe(
|
|
3250
|
+
"tinted reads as a recessed empty state; white reads as a standalone card."
|
|
3251
|
+
),
|
|
3252
|
+
icon: AvailableIcons.optional().describe(
|
|
3253
|
+
"Icon displayed inside the icon block. Defaults to FileSearch."
|
|
3254
|
+
),
|
|
3255
|
+
heading: TranslationConfig.describe(
|
|
3256
|
+
"Primary message. Short, sentence-case."
|
|
3257
|
+
),
|
|
3258
|
+
description: TranslationConfig.optional().describe(
|
|
3259
|
+
"Secondary copy displayed below the heading, typically a suggested next step."
|
|
3260
|
+
),
|
|
3261
|
+
conditionals: z29.array(ShowConditional).default([]).optional().describe(
|
|
3262
|
+
"Conditions under which the info box is shown. When omitted, it is always shown."
|
|
3263
|
+
)
|
|
3264
|
+
}).describe(
|
|
3265
|
+
"A compact icon-block + heading + description block displayed above the summary fields in the event overview."
|
|
3266
|
+
);
|
|
3267
|
+
var BaseField2 = z29.object({
|
|
3035
3268
|
emptyValueMessage: TranslationConfig.optional().describe(
|
|
3036
3269
|
"Default message displayed when the field value is empty."
|
|
3037
3270
|
),
|
|
3038
|
-
conditionals:
|
|
3271
|
+
conditionals: z29.array(ShowConditional).default([]).optional()
|
|
3039
3272
|
});
|
|
3040
3273
|
var ReferenceField = BaseField2.extend({
|
|
3041
|
-
fieldId:
|
|
3274
|
+
fieldId: z29.string(),
|
|
3042
3275
|
label: TranslationConfig.optional().describe(
|
|
3043
3276
|
"Overrides the default label from the referenced field when provided."
|
|
3044
3277
|
)
|
|
3045
3278
|
}).describe("Field referencing existing event data by field ID.");
|
|
3046
3279
|
var Field = BaseField2.extend({
|
|
3047
|
-
id:
|
|
3280
|
+
id: z29.string().describe("Identifier of the summary field."),
|
|
3048
3281
|
value: TranslationConfig.describe(
|
|
3049
3282
|
'Field value template supporting variables from configuration and EventMetadata (e.g. "{informant.phoneNo} {informant.email}").'
|
|
3050
3283
|
),
|
|
3051
3284
|
label: TranslationConfig
|
|
3052
3285
|
}).describe("Custom field defined for the summary view.");
|
|
3053
|
-
var SummaryConfig =
|
|
3054
|
-
|
|
3286
|
+
var SummaryConfig = z29.object({
|
|
3287
|
+
banners: z29.array(InfoBox).default([]).optional().describe(
|
|
3288
|
+
"Info boxes displayed above the summary fields in the event overview."
|
|
3289
|
+
),
|
|
3290
|
+
fields: z29.array(z29.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
|
|
3055
3291
|
}).meta({
|
|
3056
3292
|
id: "SummaryConfig",
|
|
3057
3293
|
description: "Configuration of the event overview page. Defines which declaration fields appear in the record summary, optionally with custom labels, empty-value messages, and templated values."
|
|
3058
3294
|
});
|
|
3059
3295
|
|
|
3060
3296
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
|
3061
|
-
var
|
|
3062
|
-
var MatchType =
|
|
3063
|
-
var BaseField3 =
|
|
3064
|
-
config:
|
|
3297
|
+
var z30 = __toESM(require("zod/v4"));
|
|
3298
|
+
var MatchType = z30.enum(["fuzzy", "exact", "range", "within"]);
|
|
3299
|
+
var BaseField3 = z30.object({
|
|
3300
|
+
config: z30.object({
|
|
3065
3301
|
type: MatchType.describe(
|
|
3066
3302
|
"Determines the search type of field. How to match value."
|
|
3067
3303
|
),
|
|
3068
|
-
searchFields:
|
|
3304
|
+
searchFields: z30.array(z30.string()).optional().describe(
|
|
3069
3305
|
`
|
|
3070
3306
|
Defines multiple form fields that should be searched when this field has a value.
|
|
3071
3307
|
All specified fields will be combined using OR logic.
|
|
@@ -3075,7 +3311,7 @@ var BaseField3 = z28.object({
|
|
|
3075
3311
|
`
|
|
3076
3312
|
)
|
|
3077
3313
|
}),
|
|
3078
|
-
type:
|
|
3314
|
+
type: z30.nativeEnum(FieldType).optional().describe(
|
|
3079
3315
|
`
|
|
3080
3316
|
Explicitly specify the field type for searchFields.
|
|
3081
3317
|
This is required when searchFields is defined, to show the correct control in the UI.
|
|
@@ -3089,7 +3325,7 @@ var BaseField3 = z28.object({
|
|
|
3089
3325
|
This is required when searchFields is defined.
|
|
3090
3326
|
`
|
|
3091
3327
|
),
|
|
3092
|
-
options:
|
|
3328
|
+
options: z30.array(SelectOption).optional(),
|
|
3093
3329
|
searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
|
|
3094
3330
|
`
|
|
3095
3331
|
This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
|
|
@@ -3110,7 +3346,7 @@ var BaseField3 = z28.object({
|
|
|
3110
3346
|
in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
|
|
3111
3347
|
`
|
|
3112
3348
|
),
|
|
3113
|
-
conditionals:
|
|
3349
|
+
conditionals: z30.array(FieldConditional).optional().describe(
|
|
3114
3350
|
`
|
|
3115
3351
|
In advanced search, we sometimes need to override the default field visibility conditionals.
|
|
3116
3352
|
|
|
@@ -3124,23 +3360,23 @@ var BaseField3 = z28.object({
|
|
|
3124
3360
|
are always rendered in the advanced search form.
|
|
3125
3361
|
`
|
|
3126
3362
|
),
|
|
3127
|
-
validations:
|
|
3363
|
+
validations: z30.array(ValidationConfig).optional().describe(
|
|
3128
3364
|
`Option for overriding the field validations specifically for advanced search form.`
|
|
3129
3365
|
),
|
|
3130
3366
|
allowedLocations: JurisdictionReference.optional().describe(
|
|
3131
3367
|
`Override the allowedLocations for a location field in advanced search. Use this when the declaration form's allowedLocations references a scope (e.g. record.create) that search-only users don't have \u2014 specify record.search scope instead.`
|
|
3132
3368
|
)
|
|
3133
3369
|
});
|
|
3134
|
-
var SearchQueryParams =
|
|
3135
|
-
eventType:
|
|
3370
|
+
var SearchQueryParams = z30.object({
|
|
3371
|
+
eventType: z30.string().optional().describe(
|
|
3136
3372
|
"Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
|
|
3137
3373
|
)
|
|
3138
3374
|
}).catchall(FieldValue);
|
|
3139
3375
|
var FieldConfigSchema = BaseField3.extend({
|
|
3140
|
-
fieldId:
|
|
3141
|
-
fieldType:
|
|
3376
|
+
fieldId: z30.string(),
|
|
3377
|
+
fieldType: z30.literal("field")
|
|
3142
3378
|
});
|
|
3143
|
-
var EventFieldIdInput =
|
|
3379
|
+
var EventFieldIdInput = z30.enum([
|
|
3144
3380
|
"trackingId",
|
|
3145
3381
|
"status",
|
|
3146
3382
|
"legalStatuses.REGISTERED.acceptedAt",
|
|
@@ -3149,7 +3385,7 @@ var EventFieldIdInput = z28.enum([
|
|
|
3149
3385
|
"updatedAt"
|
|
3150
3386
|
]);
|
|
3151
3387
|
var METADATA_FIELD_PREFIX = "event.";
|
|
3152
|
-
var EventFieldId =
|
|
3388
|
+
var EventFieldId = z30.enum([
|
|
3153
3389
|
`${METADATA_FIELD_PREFIX}trackingId`,
|
|
3154
3390
|
`${METADATA_FIELD_PREFIX}status`,
|
|
3155
3391
|
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
|
|
@@ -3159,178 +3395,60 @@ var EventFieldId = z28.enum([
|
|
|
3159
3395
|
]);
|
|
3160
3396
|
var EventFieldConfigSchema = BaseField3.extend({
|
|
3161
3397
|
fieldId: EventFieldId,
|
|
3162
|
-
fieldType:
|
|
3398
|
+
fieldType: z30.literal("event")
|
|
3163
3399
|
});
|
|
3164
|
-
var AdvancedSearchField =
|
|
3400
|
+
var AdvancedSearchField = z30.discriminatedUnion("fieldType", [FieldConfigSchema, EventFieldConfigSchema]).superRefine((data, ctx) => {
|
|
3165
3401
|
if (data.config.searchFields && data.config.searchFields.length > 0) {
|
|
3166
3402
|
if (!data.label) {
|
|
3167
3403
|
ctx.addIssue({
|
|
3168
|
-
code:
|
|
3404
|
+
code: z30.ZodIssueCode.custom,
|
|
3169
3405
|
message: "label is required when config.searchFields is defined.",
|
|
3170
3406
|
path: ["label"]
|
|
3171
3407
|
});
|
|
3172
3408
|
}
|
|
3173
3409
|
if (!data.type) {
|
|
3174
3410
|
ctx.addIssue({
|
|
3175
|
-
code:
|
|
3411
|
+
code: z30.ZodIssueCode.custom,
|
|
3176
3412
|
message: "type is required when config.searchFields is defined.",
|
|
3177
3413
|
path: ["type"]
|
|
3178
3414
|
});
|
|
3179
3415
|
}
|
|
3180
3416
|
}
|
|
3181
3417
|
});
|
|
3182
|
-
var AdvancedSearchConfig =
|
|
3418
|
+
var AdvancedSearchConfig = z30.object({
|
|
3183
3419
|
title: TranslationConfig.describe("Advanced search tab title"),
|
|
3184
|
-
fields:
|
|
3420
|
+
fields: z30.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
|
|
3185
3421
|
}).meta({
|
|
3186
3422
|
id: "AdvancedSearchConfig",
|
|
3187
3423
|
description: "Configuration of one advanced search tab. Each tab has a title and a list of searchable fields \u2014 either declaration fields (via `field()`) or event metadata (via `event()`)."
|
|
3188
3424
|
});
|
|
3189
3425
|
|
|
3190
|
-
// ../commons/src/icons.ts
|
|
3191
|
-
var z29 = __toESM(require("zod/v4"));
|
|
3192
|
-
var AvailableIcons = z29.enum([
|
|
3193
|
-
"Archived",
|
|
3194
|
-
"Assigned",
|
|
3195
|
-
"Briefcase",
|
|
3196
|
-
"Certified",
|
|
3197
|
-
"Close",
|
|
3198
|
-
"Collapse",
|
|
3199
|
-
"Draft",
|
|
3200
|
-
"DuplicateYellow",
|
|
3201
|
-
"Expand",
|
|
3202
|
-
"ExternalValidate",
|
|
3203
|
-
"FilledCheck",
|
|
3204
|
-
"InReview",
|
|
3205
|
-
"Offline",
|
|
3206
|
-
"Registered",
|
|
3207
|
-
"RequiresUpdates",
|
|
3208
|
-
"Sent",
|
|
3209
|
-
"Validated",
|
|
3210
|
-
"WaitingApproval",
|
|
3211
|
-
"ChartActivity",
|
|
3212
|
-
"Activity",
|
|
3213
|
-
"Archive",
|
|
3214
|
-
"ArchiveTray",
|
|
3215
|
-
"ArrowLeft",
|
|
3216
|
-
"ArrowRight",
|
|
3217
|
-
"Buildings",
|
|
3218
|
-
"Circle",
|
|
3219
|
-
"CaretDown",
|
|
3220
|
-
"CaretLeft",
|
|
3221
|
-
"CaretRight",
|
|
3222
|
-
"ChartBar",
|
|
3223
|
-
"ChartLine",
|
|
3224
|
-
"ChatCircle",
|
|
3225
|
-
"CheckSquare",
|
|
3226
|
-
"Compass",
|
|
3227
|
-
"Check",
|
|
3228
|
-
"Copy",
|
|
3229
|
-
"Database",
|
|
3230
|
-
"DotsThreeVertical",
|
|
3231
|
-
"ArrowCounterClockwise",
|
|
3232
|
-
"MagnifyingGlassMinus",
|
|
3233
|
-
"MagnifyingGlassPlus",
|
|
3234
|
-
"Export",
|
|
3235
|
-
"Eye",
|
|
3236
|
-
"EyeSlash",
|
|
3237
|
-
"Envelope",
|
|
3238
|
-
"File",
|
|
3239
|
-
"FileLock",
|
|
3240
|
-
"FileSearch",
|
|
3241
|
-
"FileMinus",
|
|
3242
|
-
"FilePlus",
|
|
3243
|
-
"FileText",
|
|
3244
|
-
"FileX",
|
|
3245
|
-
"Handshake",
|
|
3246
|
-
"Gear",
|
|
3247
|
-
"GitBranch",
|
|
3248
|
-
"IdentificationCard",
|
|
3249
|
-
"List",
|
|
3250
|
-
"ListBullets",
|
|
3251
|
-
"Lock",
|
|
3252
|
-
"MagnifyingGlass",
|
|
3253
|
-
"MapPin",
|
|
3254
|
-
"Medal",
|
|
3255
|
-
"NotePencil",
|
|
3256
|
-
"Paperclip",
|
|
3257
|
-
"PaperPlaneTilt",
|
|
3258
|
-
"Pen",
|
|
3259
|
-
"PenNib",
|
|
3260
|
-
"Pencil",
|
|
3261
|
-
"PencilSimpleLine",
|
|
3262
|
-
"Phone",
|
|
3263
|
-
"Plus",
|
|
3264
|
-
"Printer",
|
|
3265
|
-
"SignOut",
|
|
3266
|
-
"Stamp",
|
|
3267
|
-
"Star",
|
|
3268
|
-
"Target",
|
|
3269
|
-
"TextT",
|
|
3270
|
-
"Trash",
|
|
3271
|
-
"UploadSimple",
|
|
3272
|
-
"User",
|
|
3273
|
-
"UserPlus",
|
|
3274
|
-
"Users",
|
|
3275
|
-
"WarningCircle",
|
|
3276
|
-
"X",
|
|
3277
|
-
"ChatText",
|
|
3278
|
-
"CircleWavyCheck",
|
|
3279
|
-
"CircleWavyQuestion",
|
|
3280
|
-
"ArchiveBox",
|
|
3281
|
-
"ArrowCircleDown",
|
|
3282
|
-
"FileArrowUp",
|
|
3283
|
-
"FileDotted",
|
|
3284
|
-
"Files",
|
|
3285
|
-
"PencilLine",
|
|
3286
|
-
"PencilCircle",
|
|
3287
|
-
"UserCircle",
|
|
3288
|
-
"Clock",
|
|
3289
|
-
"QrCode",
|
|
3290
|
-
"Webcam",
|
|
3291
|
-
"Sun",
|
|
3292
|
-
"DeviceTabletCamera",
|
|
3293
|
-
"Globe",
|
|
3294
|
-
"Fingerprint",
|
|
3295
|
-
"PushPin",
|
|
3296
|
-
"Timer"
|
|
3297
|
-
]);
|
|
3298
|
-
|
|
3299
3426
|
// ../commons/src/events/utils.ts
|
|
3300
3427
|
var import_lodash4 = require("lodash");
|
|
3301
3428
|
|
|
3302
3429
|
// ../commons/src/conditionals/validate.ts
|
|
3303
3430
|
var import__ = __toESM(require("ajv/dist/2019"));
|
|
3304
3431
|
var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
3305
|
-
var
|
|
3432
|
+
var z34 = __toESM(require("zod/v4"));
|
|
3306
3433
|
var import_date_fns2 = require("date-fns");
|
|
3307
3434
|
|
|
3308
3435
|
// ../commons/src/events/FieldTypeMapping.ts
|
|
3309
|
-
var
|
|
3436
|
+
var z32 = __toESM(require("zod/v4"));
|
|
3310
3437
|
|
|
3311
3438
|
// ../commons/src/events/DynamicFieldValue.ts
|
|
3312
|
-
var
|
|
3439
|
+
var z31 = __toESM(require("zod/v4"));
|
|
3313
3440
|
|
|
3314
3441
|
// ../commons/src/events/state/index.ts
|
|
3315
3442
|
var import_lodash3 = require("lodash");
|
|
3316
3443
|
|
|
3317
3444
|
// ../commons/src/utils.ts
|
|
3318
|
-
var
|
|
3445
|
+
var z33 = __toESM(require("zod/v4"));
|
|
3319
3446
|
var _ = __toESM(require("lodash"));
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
}
|
|
3326
|
-
function joinValues(values, separator = " ") {
|
|
3327
|
-
return values.filter((value) => !!value).join(separator).trim();
|
|
3328
|
-
}
|
|
3329
|
-
var FullNameV1 = z32.array(
|
|
3330
|
-
z32.object({
|
|
3331
|
-
use: z32.string(),
|
|
3332
|
-
family: z32.string(),
|
|
3333
|
-
given: z32.array(z32.string())
|
|
3447
|
+
var FullNameV1 = z33.array(
|
|
3448
|
+
z33.object({
|
|
3449
|
+
use: z33.string(),
|
|
3450
|
+
family: z33.string(),
|
|
3451
|
+
given: z33.array(z33.string())
|
|
3334
3452
|
})
|
|
3335
3453
|
);
|
|
3336
3454
|
function omitKeyDeep(obj, keyToRemove) {
|
|
@@ -3351,43 +3469,6 @@ function omitKeyDeep(obj, keyToRemove) {
|
|
|
3351
3469
|
|
|
3352
3470
|
// ../commons/src/events/state/utils.ts
|
|
3353
3471
|
var import_lodash = require("lodash");
|
|
3354
|
-
function getActionRequests(actionType, actions) {
|
|
3355
|
-
const filtered = actions.filter((action) => action.type === actionType).reverse();
|
|
3356
|
-
const accept = filtered.find(
|
|
3357
|
-
(action) => action.status === ActionStatus.Accepted
|
|
3358
|
-
);
|
|
3359
|
-
const request = filtered.find(
|
|
3360
|
-
(action) => action.status === ActionStatus.Requested
|
|
3361
|
-
);
|
|
3362
|
-
const reject = filtered.find(
|
|
3363
|
-
(action) => action.status === ActionStatus.Rejected
|
|
3364
|
-
);
|
|
3365
|
-
return {
|
|
3366
|
-
reject,
|
|
3367
|
-
accept,
|
|
3368
|
-
request
|
|
3369
|
-
};
|
|
3370
|
-
}
|
|
3371
|
-
function getDeclarationActionCreationMetadata(actionType, actions) {
|
|
3372
|
-
const { accept: acceptAction, request: requestAction } = getActionRequests(
|
|
3373
|
-
actionType,
|
|
3374
|
-
actions
|
|
3375
|
-
);
|
|
3376
|
-
if (!acceptAction) {
|
|
3377
|
-
return null;
|
|
3378
|
-
}
|
|
3379
|
-
const registrationNumber = acceptAction.type === ActionType.REGISTER ? acceptAction.registrationNumber : null;
|
|
3380
|
-
return {
|
|
3381
|
-
// When 3rd party API returns 200 OK, we assume that the request was accepted, and persist single 'accepted' action.
|
|
3382
|
-
createdAt: requestAction?.createdAt ?? acceptAction.createdAt,
|
|
3383
|
-
createdBy: requestAction?.createdBy ?? acceptAction.createdBy,
|
|
3384
|
-
createdByUserType: requestAction?.createdByUserType ?? acceptAction.createdByUserType,
|
|
3385
|
-
createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
|
|
3386
|
-
acceptedAt: acceptAction.createdAt,
|
|
3387
|
-
createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
|
|
3388
|
-
registrationNumber
|
|
3389
|
-
};
|
|
3390
|
-
}
|
|
3391
3472
|
var updateActions = ActionTypes.extract([
|
|
3392
3473
|
ActionType.CREATE,
|
|
3393
3474
|
ActionType.NOTIFY,
|
|
@@ -3403,88 +3484,10 @@ var updateActions = ActionTypes.extract([
|
|
|
3403
3484
|
ActionType.REJECT_CORRECTION,
|
|
3404
3485
|
ActionType.CUSTOM
|
|
3405
3486
|
]);
|
|
3406
|
-
function getActionUpdateMetadata(actions) {
|
|
3407
|
-
const createAction = getOrThrow(
|
|
3408
|
-
actions.find((action) => action.type === ActionType.CREATE),
|
|
3409
|
-
`Event has no ${ActionType.CREATE} action`
|
|
3410
|
-
);
|
|
3411
|
-
const metadataFields = [
|
|
3412
|
-
"createdAt",
|
|
3413
|
-
"createdBy",
|
|
3414
|
-
"createdByUserType",
|
|
3415
|
-
"createdAtLocation",
|
|
3416
|
-
"createdByRole"
|
|
3417
|
-
];
|
|
3418
|
-
return actions.filter(({ type }) => updateActions.safeParse(type).success).reduce(
|
|
3419
|
-
(_2, action) => {
|
|
3420
|
-
if (action.originalActionId) {
|
|
3421
|
-
const originalAction = actions.find(({ id }) => id === action.originalActionId) ?? action;
|
|
3422
|
-
return (0, import_lodash.pick)(originalAction, metadataFields);
|
|
3423
|
-
}
|
|
3424
|
-
return (0, import_lodash.pick)(action, metadataFields);
|
|
3425
|
-
},
|
|
3426
|
-
(0, import_lodash.pick)(createAction, metadataFields)
|
|
3427
|
-
);
|
|
3428
|
-
}
|
|
3429
|
-
function getLegalStatuses(actions) {
|
|
3430
|
-
return {
|
|
3431
|
-
[EventStatus.enum.NOTIFIED]: getDeclarationActionCreationMetadata(
|
|
3432
|
-
ActionType.NOTIFY,
|
|
3433
|
-
actions
|
|
3434
|
-
),
|
|
3435
|
-
[EventStatus.enum.DECLARED]: getDeclarationActionCreationMetadata(
|
|
3436
|
-
ActionType.DECLARE,
|
|
3437
|
-
actions
|
|
3438
|
-
),
|
|
3439
|
-
[EventStatus.enum.REGISTERED]: getDeclarationActionCreationMetadata(
|
|
3440
|
-
ActionType.REGISTER,
|
|
3441
|
-
actions
|
|
3442
|
-
)
|
|
3443
|
-
};
|
|
3444
|
-
}
|
|
3445
3487
|
|
|
3446
3488
|
// ../commons/src/events/state/flags.ts
|
|
3447
3489
|
var import_lodash2 = require("lodash");
|
|
3448
3490
|
var import_date_fns = require("date-fns");
|
|
3449
|
-
function isFlagConditionMet(conditional, form, action) {
|
|
3450
|
-
const now2 = (0, import_date_fns.isValid)((0, import_date_fns.parseISO)(action.createdAt)) ? (0, import_date_fns.formatISO)((0, import_date_fns.parseISO)(action.createdAt), { representation: "date" }) : (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
|
|
3451
|
-
return validate(conditional, {
|
|
3452
|
-
$form: form,
|
|
3453
|
-
$now: now2,
|
|
3454
|
-
$online: true,
|
|
3455
|
-
$user: {
|
|
3456
|
-
sub: "",
|
|
3457
|
-
exp: "",
|
|
3458
|
-
role: action.createdByRole,
|
|
3459
|
-
algorithm: "",
|
|
3460
|
-
scope: [],
|
|
3461
|
-
userType: action.createdByUserType
|
|
3462
|
-
}
|
|
3463
|
-
});
|
|
3464
|
-
}
|
|
3465
|
-
function actionConfigRemovesFlag(action, flagId, actionsUpToAndIncluding, event2, eventConfiguration) {
|
|
3466
|
-
if (!isActionConfigType(action.type)) {
|
|
3467
|
-
return false;
|
|
3468
|
-
}
|
|
3469
|
-
const actionConfig = getActionConfig({
|
|
3470
|
-
eventConfiguration,
|
|
3471
|
-
actionType: action.type,
|
|
3472
|
-
customActionType: "customActionType" in action ? action.customActionType : void 0
|
|
3473
|
-
});
|
|
3474
|
-
const removeOperations = (actionConfig?.flags ?? []).filter(
|
|
3475
|
-
({ id, operation }) => id === flagId && operation === "remove"
|
|
3476
|
-
);
|
|
3477
|
-
if (removeOperations.length === 0) {
|
|
3478
|
-
return false;
|
|
3479
|
-
}
|
|
3480
|
-
const eventUpToThisAction = { ...event2, actions: actionsUpToAndIncluding };
|
|
3481
|
-
const declaration = aggregateActionDeclarations(eventUpToThisAction);
|
|
3482
|
-
const annotation = aggregateActionAnnotations(eventUpToThisAction);
|
|
3483
|
-
const form = { ...declaration, ...annotation };
|
|
3484
|
-
return removeOperations.some(
|
|
3485
|
-
({ conditional }) => conditional ? isFlagConditionMet(conditional, form, action) : true
|
|
3486
|
-
);
|
|
3487
|
-
}
|
|
3488
3491
|
var INHERENT_FLAG_RULES = [
|
|
3489
3492
|
{
|
|
3490
3493
|
flag: InherentFlags.CORRECTION_REQUESTED,
|
|
@@ -3521,90 +3524,6 @@ var INHERENT_FLAG_RULES = [
|
|
|
3521
3524
|
resetOnAnyOtherAction: true
|
|
3522
3525
|
}
|
|
3523
3526
|
];
|
|
3524
|
-
function resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration) {
|
|
3525
|
-
return acceptedActions.reduce((present, action, idx) => {
|
|
3526
|
-
if (rule.setOn.includes(action.type)) {
|
|
3527
|
-
return true;
|
|
3528
|
-
}
|
|
3529
|
-
if (rule.resetOnAnyOtherAction || (rule.resetOn ?? []).includes(action.type)) {
|
|
3530
|
-
return false;
|
|
3531
|
-
}
|
|
3532
|
-
if (actionConfigRemovesFlag(
|
|
3533
|
-
action,
|
|
3534
|
-
rule.flag,
|
|
3535
|
-
acceptedActions.slice(0, idx + 1),
|
|
3536
|
-
event2,
|
|
3537
|
-
eventConfiguration
|
|
3538
|
-
)) {
|
|
3539
|
-
return false;
|
|
3540
|
-
}
|
|
3541
|
-
return present;
|
|
3542
|
-
}, false);
|
|
3543
|
-
}
|
|
3544
|
-
function resolveEventCustomFlags(event2, eventConfiguration) {
|
|
3545
|
-
const actions = getAcceptedActions(event2).filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
3546
|
-
return actions.reduce((acc, action, idx) => {
|
|
3547
|
-
let actionConfig;
|
|
3548
|
-
if (isActionConfigType(action.type)) {
|
|
3549
|
-
actionConfig = getActionConfig({
|
|
3550
|
-
eventConfiguration,
|
|
3551
|
-
actionType: action.type,
|
|
3552
|
-
customActionType: "customActionType" in action ? action.customActionType : void 0
|
|
3553
|
-
});
|
|
3554
|
-
}
|
|
3555
|
-
if (!actionConfig) {
|
|
3556
|
-
return acc;
|
|
3557
|
-
}
|
|
3558
|
-
const eventUpToThisAction = {
|
|
3559
|
-
...event2,
|
|
3560
|
-
actions: actions.slice(0, idx + 1)
|
|
3561
|
-
};
|
|
3562
|
-
const declaration = aggregateActionDeclarations(eventUpToThisAction);
|
|
3563
|
-
const annotation = aggregateActionAnnotations(eventUpToThisAction);
|
|
3564
|
-
const form = { ...declaration, ...annotation };
|
|
3565
|
-
const flagsWithMetConditions = (actionConfig.flags ?? []).filter(
|
|
3566
|
-
({ conditional }) => (
|
|
3567
|
-
// If conditional is not provided, the flag is resolved
|
|
3568
|
-
conditional ? isFlagConditionMet(conditional, form, action) : true
|
|
3569
|
-
)
|
|
3570
|
-
);
|
|
3571
|
-
const addedFlags = flagsWithMetConditions.filter(({ operation }) => operation === "add").map(({ id }) => id);
|
|
3572
|
-
const removedFlags = flagsWithMetConditions.filter(({ operation }) => operation === "remove").map(({ id }) => id);
|
|
3573
|
-
const flags = [...acc, ...addedFlags].filter(
|
|
3574
|
-
(flagId) => !removedFlags.includes(flagId)
|
|
3575
|
-
);
|
|
3576
|
-
return (0, import_lodash2.uniq)(flags);
|
|
3577
|
-
}, []);
|
|
3578
|
-
}
|
|
3579
|
-
function getActionStatusFlags(sortedActions) {
|
|
3580
|
-
const actionStatus = sortedActions.reduce(
|
|
3581
|
-
(actionStatuses, { type, status: status2 }) => ({
|
|
3582
|
-
...actionStatuses,
|
|
3583
|
-
[type]: status2
|
|
3584
|
-
}),
|
|
3585
|
-
{}
|
|
3586
|
-
);
|
|
3587
|
-
return Object.entries(actionStatus).filter(([, status2]) => status2 !== ActionStatus.Accepted).map(([type, status2]) => {
|
|
3588
|
-
const flag2 = joinValues([type, status2], ":").toLowerCase();
|
|
3589
|
-
return flag2;
|
|
3590
|
-
});
|
|
3591
|
-
}
|
|
3592
|
-
function getInherentFlags(sortedActions, event2, eventConfiguration) {
|
|
3593
|
-
const acceptedActions = sortedActions.filter(
|
|
3594
|
-
({ status: status2 }) => status2 === ActionStatus.Accepted
|
|
3595
|
-
);
|
|
3596
|
-
return INHERENT_FLAG_RULES.filter(
|
|
3597
|
-
(rule) => resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration)
|
|
3598
|
-
).map(({ flag: flag2 }) => flag2);
|
|
3599
|
-
}
|
|
3600
|
-
function getEventFlags(event2, config) {
|
|
3601
|
-
const sortedActions = event2.actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
3602
|
-
return [
|
|
3603
|
-
...getActionStatusFlags(sortedActions),
|
|
3604
|
-
...getInherentFlags(sortedActions, event2, config),
|
|
3605
|
-
...resolveEventCustomFlags(event2, config)
|
|
3606
|
-
];
|
|
3607
|
-
}
|
|
3608
3527
|
|
|
3609
3528
|
// ../commons/src/conditionals/conditionals.ts
|
|
3610
3529
|
var objectHash = __toESM(require("object-hash"));
|
|
@@ -4240,183 +4159,6 @@ function createFieldConditionals(fieldId) {
|
|
|
4240
4159
|
};
|
|
4241
4160
|
}
|
|
4242
4161
|
|
|
4243
|
-
// ../commons/src/events/state/index.ts
|
|
4244
|
-
function getStatusFromActions(actions) {
|
|
4245
|
-
const acceptedActions = actions.filter(
|
|
4246
|
-
({ status: status2 }) => status2 === ActionStatus.Accepted
|
|
4247
|
-
);
|
|
4248
|
-
const isCurrentlyArchived = acceptedActions.reduce(
|
|
4249
|
-
(archived, action) => {
|
|
4250
|
-
if (action.type === ActionType.ARCHIVE) {
|
|
4251
|
-
return true;
|
|
4252
|
-
}
|
|
4253
|
-
if (action.type === ActionType.UNARCHIVE) {
|
|
4254
|
-
return false;
|
|
4255
|
-
}
|
|
4256
|
-
return archived;
|
|
4257
|
-
},
|
|
4258
|
-
false
|
|
4259
|
-
);
|
|
4260
|
-
if (isCurrentlyArchived) {
|
|
4261
|
-
return EventStatus.enum.ARCHIVED;
|
|
4262
|
-
}
|
|
4263
|
-
return acceptedActions.filter(
|
|
4264
|
-
({ type }) => type !== ActionType.ARCHIVE && type !== ActionType.UNARCHIVE
|
|
4265
|
-
).reduce((status2, action) => {
|
|
4266
|
-
switch (action.type) {
|
|
4267
|
-
case ActionType.CREATE:
|
|
4268
|
-
return EventStatus.enum.CREATED;
|
|
4269
|
-
case ActionType.DECLARE:
|
|
4270
|
-
return EventStatus.enum.DECLARED;
|
|
4271
|
-
case ActionType.REGISTER:
|
|
4272
|
-
return EventStatus.enum.REGISTERED;
|
|
4273
|
-
case ActionType.NOTIFY:
|
|
4274
|
-
return EventStatus.enum.NOTIFIED;
|
|
4275
|
-
// Already filtered out above; listed here only to satisfy exhaustiveness.
|
|
4276
|
-
case ActionType.ARCHIVE:
|
|
4277
|
-
case ActionType.UNARCHIVE:
|
|
4278
|
-
case ActionType.CUSTOM:
|
|
4279
|
-
case ActionType.PRINT_CERTIFICATE:
|
|
4280
|
-
case ActionType.ASSIGN:
|
|
4281
|
-
case ActionType.UNASSIGN:
|
|
4282
|
-
case ActionType.REJECT:
|
|
4283
|
-
case ActionType.REQUEST_CORRECTION:
|
|
4284
|
-
case ActionType.APPROVE_CORRECTION:
|
|
4285
|
-
case ActionType.DUPLICATE_DETECTED:
|
|
4286
|
-
case ActionType.MARK_AS_NOT_DUPLICATE:
|
|
4287
|
-
case ActionType.MARK_AS_DUPLICATE:
|
|
4288
|
-
case ActionType.REJECT_CORRECTION:
|
|
4289
|
-
case ActionType.READ:
|
|
4290
|
-
case ActionType.EDIT:
|
|
4291
|
-
default:
|
|
4292
|
-
return status2;
|
|
4293
|
-
}
|
|
4294
|
-
}, EventStatus.enum.CREATED);
|
|
4295
|
-
}
|
|
4296
|
-
function getAssignedUserFromActions(actions) {
|
|
4297
|
-
return actions.reduce((user2, action) => {
|
|
4298
|
-
if (action.type === ActionType.ASSIGN) {
|
|
4299
|
-
return action.assignedTo;
|
|
4300
|
-
}
|
|
4301
|
-
if (action.type === ActionType.UNASSIGN) {
|
|
4302
|
-
return null;
|
|
4303
|
-
}
|
|
4304
|
-
return user2;
|
|
4305
|
-
}, null);
|
|
4306
|
-
}
|
|
4307
|
-
function deepDropNulls(obj) {
|
|
4308
|
-
if (Array.isArray(obj)) {
|
|
4309
|
-
return obj.map(deepDropNulls);
|
|
4310
|
-
}
|
|
4311
|
-
if (obj !== null && typeof obj === "object") {
|
|
4312
|
-
return Object.entries(obj).reduce((acc, [key, value]) => {
|
|
4313
|
-
const cleanedValue = deepDropNulls(value);
|
|
4314
|
-
if (cleanedValue !== null) {
|
|
4315
|
-
;
|
|
4316
|
-
acc[key] = cleanedValue;
|
|
4317
|
-
}
|
|
4318
|
-
return acc;
|
|
4319
|
-
}, {});
|
|
4320
|
-
}
|
|
4321
|
-
return obj;
|
|
4322
|
-
}
|
|
4323
|
-
var DEFAULT_DATE_OF_EVENT_PROPERTY = "createdAt";
|
|
4324
|
-
function extractDateString(dateTime) {
|
|
4325
|
-
return dateTime.split("T")[0];
|
|
4326
|
-
}
|
|
4327
|
-
function resolveDateOfEvent(eventIndex, declaration, config) {
|
|
4328
|
-
if (!config.dateOfEvent) {
|
|
4329
|
-
return extractDateString(eventIndex[DEFAULT_DATE_OF_EVENT_PROPERTY]);
|
|
4330
|
-
}
|
|
4331
|
-
const parsedDate = isFieldReference(config.dateOfEvent) ? ZodDate.safeParse(declaration[config.dateOfEvent.$$field]) : ZodDateTime.safeParse(
|
|
4332
|
-
getMixedPath(eventIndex, config.dateOfEvent.$$event)
|
|
4333
|
-
);
|
|
4334
|
-
return parsedDate.success ? extractDateString(parsedDate.data) : void 0;
|
|
4335
|
-
}
|
|
4336
|
-
var DEFAULT_PLACE_OF_EVENT_PROPERTY = "createdAtLocation";
|
|
4337
|
-
function getParsedUUID(value, oldValue) {
|
|
4338
|
-
const parsed = UUID.safeParse(value);
|
|
4339
|
-
return parsed.success ? parsed.data : oldValue;
|
|
4340
|
-
}
|
|
4341
|
-
function resolvePlaceOfEvent(eventMetadata, declaration, config) {
|
|
4342
|
-
let placeOfEvent = getParsedUUID(
|
|
4343
|
-
eventMetadata[DEFAULT_PLACE_OF_EVENT_PROPERTY]
|
|
4344
|
-
);
|
|
4345
|
-
if (config.placeOfEvent) {
|
|
4346
|
-
const addressFieldValue = AddressFieldValue.safeParse(
|
|
4347
|
-
declaration[config.placeOfEvent.$$field]
|
|
4348
|
-
);
|
|
4349
|
-
if (addressFieldValue.success && addressFieldValue.data.addressType === AddressType.DOMESTIC && addressFieldValue.data.administrativeArea) {
|
|
4350
|
-
placeOfEvent = getParsedUUID(
|
|
4351
|
-
addressFieldValue.data.administrativeArea,
|
|
4352
|
-
placeOfEvent
|
|
4353
|
-
);
|
|
4354
|
-
} else {
|
|
4355
|
-
placeOfEvent = getParsedUUID(
|
|
4356
|
-
declaration[config.placeOfEvent.$$field],
|
|
4357
|
-
placeOfEvent
|
|
4358
|
-
);
|
|
4359
|
-
}
|
|
4360
|
-
}
|
|
4361
|
-
return placeOfEvent;
|
|
4362
|
-
}
|
|
4363
|
-
function extractPotentialDuplicatesFromActions(actions) {
|
|
4364
|
-
return actions.reduce((duplicates, action) => {
|
|
4365
|
-
if (action.type === ActionType.DUPLICATE_DETECTED) {
|
|
4366
|
-
duplicates = action.content.duplicates;
|
|
4367
|
-
}
|
|
4368
|
-
if (action.type === ActionType.MARK_AS_NOT_DUPLICATE || action.type === ActionType.MARK_AS_DUPLICATE) {
|
|
4369
|
-
duplicates = [];
|
|
4370
|
-
}
|
|
4371
|
-
return duplicates;
|
|
4372
|
-
}, []);
|
|
4373
|
-
}
|
|
4374
|
-
function getCurrentEventState(event2, config) {
|
|
4375
|
-
const sortedActions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
4376
|
-
const creationAction = sortedActions.find(
|
|
4377
|
-
(action) => action.type === ActionType.CREATE
|
|
4378
|
-
);
|
|
4379
|
-
if (!creationAction) {
|
|
4380
|
-
throw new Error(`Event ${event2.id} has no creation action`);
|
|
4381
|
-
}
|
|
4382
|
-
const acceptedActions = getAcceptedActions(event2).sort(
|
|
4383
|
-
(a, b) => a.createdAt.localeCompare(b.createdAt)
|
|
4384
|
-
);
|
|
4385
|
-
const requestActionMetadata = getActionUpdateMetadata(sortedActions);
|
|
4386
|
-
const acceptedActionMetadata = getActionUpdateMetadata(acceptedActions);
|
|
4387
|
-
const declaration = aggregateActionDeclarations(event2);
|
|
4388
|
-
const status2 = getStatusFromActions(sortedActions);
|
|
4389
|
-
const legalStatuses = getLegalStatuses(sortedActions);
|
|
4390
|
-
const base = deepDropNulls({
|
|
4391
|
-
id: event2.id,
|
|
4392
|
-
type: event2.type,
|
|
4393
|
-
status: status2,
|
|
4394
|
-
legalStatuses,
|
|
4395
|
-
createdAt: creationAction.createdAt,
|
|
4396
|
-
createdBy: creationAction.createdBy,
|
|
4397
|
-
createdByUserType: creationAction.createdByUserType,
|
|
4398
|
-
createdAtLocation: creationAction.createdAtLocation,
|
|
4399
|
-
updatedAt: acceptedActionMetadata.createdAt,
|
|
4400
|
-
assignedTo: getAssignedUserFromActions(acceptedActions),
|
|
4401
|
-
updatedBy: requestActionMetadata.createdBy,
|
|
4402
|
-
updatedAtLocation: requestActionMetadata.createdAtLocation,
|
|
4403
|
-
declaration,
|
|
4404
|
-
trackingId: event2.trackingId,
|
|
4405
|
-
updatedByUserRole: requestActionMetadata.createdByRole,
|
|
4406
|
-
placeOfEvent: resolvePlaceOfEvent(
|
|
4407
|
-
{ createdAtLocation: creationAction.createdAtLocation },
|
|
4408
|
-
declaration,
|
|
4409
|
-
config
|
|
4410
|
-
),
|
|
4411
|
-
potentialDuplicates: extractPotentialDuplicatesFromActions(sortedActions),
|
|
4412
|
-
flags: getEventFlags(event2, config)
|
|
4413
|
-
});
|
|
4414
|
-
return deepDropNulls({
|
|
4415
|
-
...base,
|
|
4416
|
-
dateOfEvent: resolveDateOfEvent(base, declaration, config)
|
|
4417
|
-
});
|
|
4418
|
-
}
|
|
4419
|
-
|
|
4420
4162
|
// ../commons/src/conditionals/validate.ts
|
|
4421
4163
|
var ajv = new import__.default({
|
|
4422
4164
|
$data: true,
|
|
@@ -4424,9 +4166,9 @@ var ajv = new import__.default({
|
|
|
4424
4166
|
strict: false
|
|
4425
4167
|
// Allow minContains and other newer features
|
|
4426
4168
|
});
|
|
4427
|
-
var DataContext =
|
|
4428
|
-
rootData:
|
|
4429
|
-
$leafAdminStructureLocationIds:
|
|
4169
|
+
var DataContext = z34.object({
|
|
4170
|
+
rootData: z34.object({
|
|
4171
|
+
$leafAdminStructureLocationIds: z34.array(z34.object({ id: UUID }))
|
|
4430
4172
|
})
|
|
4431
4173
|
});
|
|
4432
4174
|
function resolveDataPath(rootData, dataPath, instancePath) {
|
|
@@ -4464,18 +4206,14 @@ function compileClientFunction(code) {
|
|
|
4464
4206
|
}
|
|
4465
4207
|
(0, import_ajv_formats.default)(ajv);
|
|
4466
4208
|
function buildClientFunctionContext(input) {
|
|
4467
|
-
const flags = input.validatorContext?.event && input.validatorContext?.eventConfig ? getCurrentEventState(
|
|
4468
|
-
input.validatorContext?.event,
|
|
4469
|
-
input.validatorContext?.eventConfig
|
|
4470
|
-
)?.flags : [];
|
|
4471
4209
|
return {
|
|
4472
4210
|
$form: input.form,
|
|
4473
|
-
$flags: flags,
|
|
4211
|
+
$flags: input.validatorContext?.event?.state.flags ?? [],
|
|
4474
4212
|
$now: todayISO(),
|
|
4475
4213
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
4476
4214
|
$online: isOnline(),
|
|
4477
4215
|
$user: input.validatorContext?.user,
|
|
4478
|
-
$event: input.validatorContext?.event,
|
|
4216
|
+
$event: input.validatorContext?.event?.document,
|
|
4479
4217
|
$leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
|
|
4480
4218
|
user: input.systemVariables?.user,
|
|
4481
4219
|
$window: input.systemVariables?.$window,
|
|
@@ -4536,9 +4274,6 @@ ajv.addKeyword({
|
|
|
4536
4274
|
return locations.some((location) => location.id === locationIdInput);
|
|
4537
4275
|
}
|
|
4538
4276
|
});
|
|
4539
|
-
function isAgeValue(value) {
|
|
4540
|
-
return typeof value === "object" && value !== null && "age" in value && typeof value.age === "number";
|
|
4541
|
-
}
|
|
4542
4277
|
ajv.addKeyword({
|
|
4543
4278
|
keyword: "customClientValidator",
|
|
4544
4279
|
schemaType: "object",
|
|
@@ -4556,31 +4291,6 @@ ajv.addKeyword({
|
|
|
4556
4291
|
);
|
|
4557
4292
|
}
|
|
4558
4293
|
});
|
|
4559
|
-
function validate(schema, data) {
|
|
4560
|
-
const validator = ajv.getSchema(schema.$id) || ajv.compile(schema);
|
|
4561
|
-
if ("$form" in data) {
|
|
4562
|
-
const entries = Object.entries(data.$form).map(([key, value]) => {
|
|
4563
|
-
if (!isAgeValue(value)) {
|
|
4564
|
-
return [key, value];
|
|
4565
|
-
}
|
|
4566
|
-
const age = value.age;
|
|
4567
|
-
const maybeAsOfDate = PlainDate.safeParse(data.$form[value.asOfDateRef]);
|
|
4568
|
-
return [
|
|
4569
|
-
key,
|
|
4570
|
-
{
|
|
4571
|
-
age,
|
|
4572
|
-
dob: ageToDate(
|
|
4573
|
-
age,
|
|
4574
|
-
maybeAsOfDate.success ? maybeAsOfDate.data : PlainDate.parse(data.$now)
|
|
4575
|
-
)
|
|
4576
|
-
}
|
|
4577
|
-
];
|
|
4578
|
-
});
|
|
4579
|
-
data.$form = Object.fromEntries(entries);
|
|
4580
|
-
}
|
|
4581
|
-
const result = validator(data);
|
|
4582
|
-
return result;
|
|
4583
|
-
}
|
|
4584
4294
|
function isOnline() {
|
|
4585
4295
|
if (typeof window !== "undefined" && typeof navigator !== "undefined") {
|
|
4586
4296
|
return navigator.onLine;
|
|
@@ -4590,31 +4300,9 @@ function isOnline() {
|
|
|
4590
4300
|
|
|
4591
4301
|
// ../commons/src/events/utils.ts
|
|
4592
4302
|
var import_date_fns3 = require("date-fns");
|
|
4593
|
-
function ageToDate(age, asOfDate) {
|
|
4594
|
-
const date = plainDateToLocalDate(asOfDate);
|
|
4595
|
-
return PlainDate.parse((0, import_date_fns3.format)((0, import_date_fns3.subYears)(date, age), "yyyy-MM-dd"));
|
|
4596
|
-
}
|
|
4597
4303
|
function getDeclarationFields(configuration) {
|
|
4598
4304
|
return configuration.declaration.pages.flatMap(({ fields }) => fields);
|
|
4599
4305
|
}
|
|
4600
|
-
function isActionConfigType(type) {
|
|
4601
|
-
return actionConfigTypes.has(type);
|
|
4602
|
-
}
|
|
4603
|
-
function getActionConfig({
|
|
4604
|
-
eventConfiguration,
|
|
4605
|
-
actionType,
|
|
4606
|
-
customActionType
|
|
4607
|
-
}) {
|
|
4608
|
-
if (actionType === ActionType.NOTIFY) {
|
|
4609
|
-
return eventConfiguration.actions.find((a) => a.type === ActionType.NOTIFY) ?? eventConfiguration.actions.find((a) => a.type === ActionType.DECLARE);
|
|
4610
|
-
}
|
|
4611
|
-
return eventConfiguration.actions.find((a) => {
|
|
4612
|
-
if (a.type === ActionType.CUSTOM && customActionType) {
|
|
4613
|
-
return a.customActionType === customActionType;
|
|
4614
|
-
}
|
|
4615
|
-
return a.type === actionType;
|
|
4616
|
-
});
|
|
4617
|
-
}
|
|
4618
4306
|
var getActionAnnotationFields = (actionConfig) => {
|
|
4619
4307
|
if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
|
|
4620
4308
|
return actionConfig.correctionForm.pages.flatMap(({ fields }) => fields);
|
|
@@ -4629,122 +4317,17 @@ var getActionAnnotationFields = (actionConfig) => {
|
|
|
4629
4317
|
function getAllAnnotationFields(config) {
|
|
4630
4318
|
return (0, import_lodash4.flattenDeep)(config.actions.map(getActionAnnotationFields));
|
|
4631
4319
|
}
|
|
4632
|
-
function deepMerge(currentDocument, actionDocument) {
|
|
4633
|
-
const currentDocumentClone = (0, import_lodash4.cloneDeep)(currentDocument);
|
|
4634
|
-
return (0, import_lodash4.mergeWith)(
|
|
4635
|
-
(0, import_lodash4.cloneDeep)(currentDocumentClone),
|
|
4636
|
-
actionDocument,
|
|
4637
|
-
(previousValue, incomingValue) => {
|
|
4638
|
-
if (incomingValue === void 0) {
|
|
4639
|
-
return previousValue;
|
|
4640
|
-
}
|
|
4641
|
-
if ((0, import_lodash4.isArray)(incomingValue)) {
|
|
4642
|
-
return incomingValue;
|
|
4643
|
-
}
|
|
4644
|
-
if ((0, import_lodash4.isObject)(previousValue) && (0, import_lodash4.isObject)(incomingValue)) {
|
|
4645
|
-
return void 0;
|
|
4646
|
-
}
|
|
4647
|
-
return incomingValue;
|
|
4648
|
-
}
|
|
4649
|
-
);
|
|
4650
|
-
}
|
|
4651
4320
|
var findAllFields = (config) => {
|
|
4652
4321
|
return (0, import_lodash4.flattenDeep)([
|
|
4653
4322
|
...getDeclarationFields(config),
|
|
4654
4323
|
...getAllAnnotationFields(config)
|
|
4655
4324
|
]);
|
|
4656
4325
|
};
|
|
4657
|
-
function getMixedPath(obj, path, defaultValue) {
|
|
4658
|
-
const parts = path.split(".");
|
|
4659
|
-
const resolve = (current, segments) => {
|
|
4660
|
-
if (current == null || segments.length === 0) {
|
|
4661
|
-
return current;
|
|
4662
|
-
}
|
|
4663
|
-
for (let i = segments.length; i > 0; i--) {
|
|
4664
|
-
const compoundKey = segments.slice(0, i).join(".");
|
|
4665
|
-
if ((0, import_lodash4.has)(current, compoundKey)) {
|
|
4666
|
-
const next = (0, import_lodash4.get)(current, compoundKey);
|
|
4667
|
-
return resolve(next, segments.slice(i));
|
|
4668
|
-
}
|
|
4669
|
-
}
|
|
4670
|
-
return void 0;
|
|
4671
|
-
};
|
|
4672
|
-
const result = resolve(obj, parts);
|
|
4673
|
-
return (0, import_lodash4.isNil)(result) ? defaultValue : result;
|
|
4674
|
-
}
|
|
4675
|
-
function isAcceptedAction(a) {
|
|
4676
|
-
return a.status === ActionStatus.Accepted;
|
|
4677
|
-
}
|
|
4678
|
-
function getCompleteActionAnnotation(event2, action) {
|
|
4679
|
-
if (action.originalActionId) {
|
|
4680
|
-
const originalAction = event2.actions.find(
|
|
4681
|
-
({ id }) => id === action.originalActionId
|
|
4682
|
-
);
|
|
4683
|
-
if (originalAction?.status === ActionStatus.Requested) {
|
|
4684
|
-
return deepMerge(originalAction.annotation ?? {}, action.annotation ?? {});
|
|
4685
|
-
}
|
|
4686
|
-
}
|
|
4687
|
-
return action.annotation ?? {};
|
|
4688
|
-
}
|
|
4689
|
-
function getCompleteActionDeclaration(declaration, event2, action) {
|
|
4690
|
-
if (action.originalActionId) {
|
|
4691
|
-
const originalAction = event2.actions.find(
|
|
4692
|
-
({ id }) => id === action.originalActionId
|
|
4693
|
-
);
|
|
4694
|
-
if (originalAction?.status === ActionStatus.Requested) {
|
|
4695
|
-
return deepMerge(
|
|
4696
|
-
deepMerge(declaration, originalAction.declaration),
|
|
4697
|
-
action.declaration
|
|
4698
|
-
);
|
|
4699
|
-
}
|
|
4700
|
-
}
|
|
4701
|
-
return deepMerge(declaration, action.declaration);
|
|
4702
|
-
}
|
|
4703
|
-
function getAcceptedActions(event2) {
|
|
4704
|
-
return event2.actions.filter(isAcceptedAction).map((action) => ({
|
|
4705
|
-
...action,
|
|
4706
|
-
declaration: getCompleteActionDeclaration({}, event2, action),
|
|
4707
|
-
annotation: getCompleteActionAnnotation(event2, action)
|
|
4708
|
-
}));
|
|
4709
|
-
}
|
|
4710
4326
|
var EXCLUDED_ACTIONS = [
|
|
4711
4327
|
ActionType.REQUEST_CORRECTION,
|
|
4712
4328
|
ActionType.PRINT_CERTIFICATE,
|
|
4713
4329
|
ActionType.REJECT_CORRECTION
|
|
4714
4330
|
];
|
|
4715
|
-
function aggregateActionDeclarations(event2) {
|
|
4716
|
-
const allAcceptedActions = getAcceptedActions(event2);
|
|
4717
|
-
const aggregatedActions = allAcceptedActions.filter((a) => !EXCLUDED_ACTIONS.some((type) => type === a.type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
4718
|
-
return aggregatedActions.reduce((declaration, action) => {
|
|
4719
|
-
if (action.type === ActionType.APPROVE_CORRECTION) {
|
|
4720
|
-
const requestAction = allAcceptedActions.find(
|
|
4721
|
-
({ id }) => id === action.requestId
|
|
4722
|
-
);
|
|
4723
|
-
if (!requestAction) {
|
|
4724
|
-
return declaration;
|
|
4725
|
-
}
|
|
4726
|
-
const declarationWithApprovedCorrection = getCompleteActionDeclaration(
|
|
4727
|
-
declaration,
|
|
4728
|
-
event2,
|
|
4729
|
-
requestAction
|
|
4730
|
-
);
|
|
4731
|
-
return getCompleteActionDeclaration(
|
|
4732
|
-
declarationWithApprovedCorrection,
|
|
4733
|
-
event2,
|
|
4734
|
-
action
|
|
4735
|
-
);
|
|
4736
|
-
}
|
|
4737
|
-
return getCompleteActionDeclaration(declaration, event2, action);
|
|
4738
|
-
}, {});
|
|
4739
|
-
}
|
|
4740
|
-
function aggregateActionAnnotations(event2) {
|
|
4741
|
-
return event2.actions.reduce((ann, sortedAction) => {
|
|
4742
|
-
if (!("annotation" in sortedAction) || !sortedAction.annotation) {
|
|
4743
|
-
return ann;
|
|
4744
|
-
}
|
|
4745
|
-
return deepMerge(ann, sortedAction.annotation);
|
|
4746
|
-
}, {});
|
|
4747
|
-
}
|
|
4748
4331
|
|
|
4749
4332
|
// ../commons/src/events/eventConfigValidation.ts
|
|
4750
4333
|
function validateAdvancedSearchConfig(event2, ctx) {
|
|
@@ -4866,11 +4449,11 @@ function validateActionOrder(event2, ctx) {
|
|
|
4866
4449
|
}
|
|
4867
4450
|
|
|
4868
4451
|
// ../commons/src/events/EventConfig.ts
|
|
4869
|
-
var EventFieldReference =
|
|
4452
|
+
var EventFieldReference = z35.object({ $$event: EventMetadataDateFieldIdInput }).describe(
|
|
4870
4453
|
"Reference to a field defined in the event metadata, using the field id."
|
|
4871
4454
|
);
|
|
4872
|
-
var _EventConfigBase =
|
|
4873
|
-
id:
|
|
4455
|
+
var _EventConfigBase = z35.object({
|
|
4456
|
+
id: z35.string().describe(
|
|
4874
4457
|
'Machine-readable identifier of the event (e.g. "birth", "death").'
|
|
4875
4458
|
),
|
|
4876
4459
|
dateOfEvent: FieldReference.or(EventFieldReference).optional().describe(
|
|
@@ -4889,25 +4472,25 @@ var _EventConfigBase = z34.object({
|
|
|
4889
4472
|
"Summary information displayed in the event overview."
|
|
4890
4473
|
),
|
|
4891
4474
|
label: TranslationConfig.describe("Human-readable label for the event type."),
|
|
4892
|
-
actions:
|
|
4475
|
+
actions: z35.array(ActionConfig).describe(
|
|
4893
4476
|
"Configuration of core and custom actions associated with the event."
|
|
4894
4477
|
),
|
|
4895
|
-
actionOrder:
|
|
4478
|
+
actionOrder: z35.array(z35.string()).optional().describe(
|
|
4896
4479
|
"Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
|
|
4897
4480
|
),
|
|
4898
4481
|
declaration: DeclarationFormConfig.describe(
|
|
4899
4482
|
"Configuration of the form used to gather event data."
|
|
4900
4483
|
),
|
|
4901
|
-
advancedSearch:
|
|
4484
|
+
advancedSearch: z35.array(AdvancedSearchConfig).optional().default([]).describe(
|
|
4902
4485
|
"Configuration of fields available in the advanced search feature."
|
|
4903
4486
|
),
|
|
4904
|
-
flags:
|
|
4487
|
+
flags: z35.array(FlagConfig).optional().default([]).describe(
|
|
4905
4488
|
"Configuration of custom flags associated with the actions of this event type."
|
|
4906
4489
|
),
|
|
4907
|
-
analytics:
|
|
4490
|
+
analytics: z35.boolean().optional().default(true).describe(
|
|
4908
4491
|
"Indicates whether the records of this event type are included in analytics"
|
|
4909
4492
|
),
|
|
4910
|
-
icon:
|
|
4493
|
+
icon: z35.partialRecord(AvailableIcons, Conditional).optional().describe(
|
|
4911
4494
|
'Maps an icon name to a conditional. The icon of the first entry (in definition order) whose conditional matches the event is used when rendering it (e.g. in the "iconWithName"/"iconWithNameEvent" workqueue columns). Falls back to the default status-based icon when unset or when no conditional matches.'
|
|
4912
4495
|
)
|
|
4913
4496
|
});
|
|
@@ -4928,7 +4511,7 @@ var defineActionForm = (actionForm) => ActionFormConfig.parse(actionForm);
|
|
|
4928
4511
|
var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
|
|
4929
4512
|
|
|
4930
4513
|
// ../commons/src/events/WorkqueueConfig.ts
|
|
4931
|
-
var
|
|
4514
|
+
var z38 = __toESM(require("zod/v4"));
|
|
4932
4515
|
|
|
4933
4516
|
// ../commons/src/searchConfigs.ts
|
|
4934
4517
|
function createSearchConfig(baseField) {
|
|
@@ -5139,17 +4722,17 @@ var event = Object.assign(eventFn, {
|
|
|
5139
4722
|
});
|
|
5140
4723
|
|
|
5141
4724
|
// ../commons/src/events/WorkqueueColumnConfig.ts
|
|
5142
|
-
var
|
|
4725
|
+
var z36 = __toESM(require("zod/v4"));
|
|
5143
4726
|
var WorkqueueColumnKeysArray = [
|
|
5144
4727
|
...EventMetadataKeysArray,
|
|
5145
4728
|
"title",
|
|
5146
4729
|
"outbox"
|
|
5147
4730
|
];
|
|
5148
|
-
var WorkqueueColumnKeys =
|
|
5149
|
-
var WorkqueueColumnValue =
|
|
4731
|
+
var WorkqueueColumnKeys = z36.enum(WorkqueueColumnKeysArray);
|
|
4732
|
+
var WorkqueueColumnValue = z36.object({
|
|
5150
4733
|
$event: WorkqueueColumnKeys
|
|
5151
4734
|
});
|
|
5152
|
-
var WorkqueueColumn =
|
|
4735
|
+
var WorkqueueColumn = z36.object({
|
|
5153
4736
|
label: TranslationConfig,
|
|
5154
4737
|
value: WorkqueueColumnValue
|
|
5155
4738
|
}).meta({
|
|
@@ -5163,51 +4746,51 @@ function defineWorkqueuesColumns(workqueueColumns) {
|
|
|
5163
4746
|
}
|
|
5164
4747
|
|
|
5165
4748
|
// ../commons/src/events/CountryConfigQueryInput.ts
|
|
5166
|
-
var
|
|
5167
|
-
var SerializableExact =
|
|
5168
|
-
type:
|
|
5169
|
-
term:
|
|
5170
|
-
});
|
|
5171
|
-
var SerializableWithin =
|
|
5172
|
-
type:
|
|
5173
|
-
location:
|
|
5174
|
-
});
|
|
5175
|
-
var SerializedQueryExpression =
|
|
5176
|
-
eventType:
|
|
5177
|
-
status:
|
|
5178
|
-
createdAt:
|
|
5179
|
-
updatedAt:
|
|
5180
|
-
"legalStatuses.DECLARED.createdAtLocation":
|
|
5181
|
-
"legalStatuses.DECLARED.createdByRole":
|
|
5182
|
-
"legalStatuses.REGISTERED.createdAt":
|
|
5183
|
-
"legalStatuses.REGISTERED.createdAtLocation":
|
|
5184
|
-
"legalStatuses.REGISTERED.createdByRole":
|
|
5185
|
-
"legalStatuses.REGISTERED.registrationNumber":
|
|
5186
|
-
createdAtLocation:
|
|
5187
|
-
|
|
4749
|
+
var z37 = __toESM(require("zod/v4"));
|
|
4750
|
+
var SerializableExact = z37.object({
|
|
4751
|
+
type: z37.literal("exact"),
|
|
4752
|
+
term: z37.union([z37.string(), SerializedUserField])
|
|
4753
|
+
});
|
|
4754
|
+
var SerializableWithin = z37.object({
|
|
4755
|
+
type: z37.literal("within"),
|
|
4756
|
+
location: z37.union([z37.string(), SerializedUserField])
|
|
4757
|
+
});
|
|
4758
|
+
var SerializedQueryExpression = z37.object({
|
|
4759
|
+
eventType: z37.string(),
|
|
4760
|
+
status: z37.optional(z37.union([AnyOfStatus, ExactStatus])),
|
|
4761
|
+
createdAt: z37.optional(DateCondition),
|
|
4762
|
+
updatedAt: z37.optional(DateCondition),
|
|
4763
|
+
"legalStatuses.DECLARED.createdAtLocation": z37.optional(SerializableWithin),
|
|
4764
|
+
"legalStatuses.DECLARED.createdByRole": z37.optional(AnyOf),
|
|
4765
|
+
"legalStatuses.REGISTERED.createdAt": z37.optional(DateCondition),
|
|
4766
|
+
"legalStatuses.REGISTERED.createdAtLocation": z37.optional(SerializableWithin),
|
|
4767
|
+
"legalStatuses.REGISTERED.createdByRole": z37.optional(AnyOf),
|
|
4768
|
+
"legalStatuses.REGISTERED.registrationNumber": z37.optional(Exact),
|
|
4769
|
+
createdAtLocation: z37.optional(
|
|
4770
|
+
z37.union([SerializableWithin, SerializableExact])
|
|
5188
4771
|
),
|
|
5189
|
-
updatedAtLocation:
|
|
5190
|
-
|
|
4772
|
+
updatedAtLocation: z37.optional(
|
|
4773
|
+
z37.union([SerializableWithin, SerializableExact])
|
|
5191
4774
|
),
|
|
5192
|
-
updatedByUserRole:
|
|
5193
|
-
assignedTo:
|
|
5194
|
-
createdBy:
|
|
4775
|
+
updatedByUserRole: z37.optional(SerializableExact),
|
|
4776
|
+
assignedTo: z37.optional(SerializableExact),
|
|
4777
|
+
createdBy: z37.optional(SerializableExact),
|
|
5195
4778
|
createdByUserType: ExactUserType,
|
|
5196
|
-
updatedBy:
|
|
5197
|
-
trackingId:
|
|
5198
|
-
flags:
|
|
4779
|
+
updatedBy: z37.optional(SerializableExact),
|
|
4780
|
+
trackingId: z37.optional(Exact),
|
|
4781
|
+
flags: z37.optional(ContainsFlags),
|
|
5199
4782
|
data: QueryInput
|
|
5200
4783
|
}).partial();
|
|
5201
|
-
var Or2 =
|
|
5202
|
-
type:
|
|
5203
|
-
clauses:
|
|
4784
|
+
var Or2 = z37.object({
|
|
4785
|
+
type: z37.literal("or"),
|
|
4786
|
+
clauses: z37.array(SerializedQueryExpression)
|
|
5204
4787
|
});
|
|
5205
|
-
var And2 =
|
|
5206
|
-
type:
|
|
5207
|
-
clauses:
|
|
4788
|
+
var And2 = z37.object({
|
|
4789
|
+
type: z37.literal("and"),
|
|
4790
|
+
clauses: z37.array(SerializedQueryExpression)
|
|
5208
4791
|
});
|
|
5209
|
-
var CountryConfigQueryType =
|
|
5210
|
-
var CountryConfigQueryInputType =
|
|
4792
|
+
var CountryConfigQueryType = z37.discriminatedUnion("type", [And2, Or2]);
|
|
4793
|
+
var CountryConfigQueryInputType = z37.union([
|
|
5211
4794
|
SerializedQueryExpression,
|
|
5212
4795
|
And2,
|
|
5213
4796
|
Or2
|
|
@@ -5232,16 +4815,16 @@ var mandatoryColumns = defineWorkqueuesColumns([
|
|
|
5232
4815
|
value: event.field("updatedAt")
|
|
5233
4816
|
}
|
|
5234
4817
|
]);
|
|
5235
|
-
var WorkqueueConfig =
|
|
5236
|
-
slug:
|
|
4818
|
+
var WorkqueueConfig = z38.object({
|
|
4819
|
+
slug: z38.string().describe("Determines the url of the workqueue."),
|
|
5237
4820
|
name: TranslationConfig.describe(
|
|
5238
4821
|
"Title of the workflow (both in navigation and on the page)"
|
|
5239
4822
|
),
|
|
5240
4823
|
query: CountryConfigQueryType,
|
|
5241
|
-
action:
|
|
4824
|
+
action: z38.object({ type: WorkqueueActionType }).optional().describe(
|
|
5242
4825
|
"Workqueue call-to-action button configuration. This determines the quick action button shown on each event card and the action taken when the button is clicked."
|
|
5243
4826
|
),
|
|
5244
|
-
columns:
|
|
4827
|
+
columns: z38.array(WorkqueueColumn).default(mandatoryColumns),
|
|
5245
4828
|
icon: AvailableIcons,
|
|
5246
4829
|
emptyMessage: TranslationConfig.optional()
|
|
5247
4830
|
}).describe("Configuration for workqueue.");
|
|
@@ -5255,10 +4838,10 @@ var WorkqueueConfigInput = WorkqueueConfig.extend({
|
|
|
5255
4838
|
id: "WorkqueueConfig",
|
|
5256
4839
|
description: "Configuration for a single workqueue. Defines the filter applied to the event index, the quick-action button, the columns shown on each row, and the message rendered when the queue is empty."
|
|
5257
4840
|
});
|
|
5258
|
-
var WorkqueueCountInput =
|
|
5259
|
-
|
|
4841
|
+
var WorkqueueCountInput = z38.array(
|
|
4842
|
+
z38.object({ slug: z38.string(), query: QueryType })
|
|
5260
4843
|
);
|
|
5261
|
-
var WorkqueueCountOutput =
|
|
4844
|
+
var WorkqueueCountOutput = z38.record(z38.string(), z38.number());
|
|
5262
4845
|
|
|
5263
4846
|
// ../commons/src/events/workqueueDefaultColumns.ts
|
|
5264
4847
|
var defaultWorkqueueColumns = [
|
|
@@ -5281,21 +4864,21 @@ var defaultWorkqueueColumns = [
|
|
|
5281
4864
|
];
|
|
5282
4865
|
|
|
5283
4866
|
// ../commons/src/events/Draft.ts
|
|
5284
|
-
var
|
|
4867
|
+
var z40 = __toESM(require("zod/v4"));
|
|
5285
4868
|
|
|
5286
4869
|
// ../commons/src/events/ActionInput.ts
|
|
5287
|
-
var
|
|
5288
|
-
var BaseActionInput =
|
|
4870
|
+
var z39 = __toESM(require("zod/v4"));
|
|
4871
|
+
var BaseActionInput = z39.object({
|
|
5289
4872
|
eventId: UUID,
|
|
5290
|
-
transactionId:
|
|
4873
|
+
transactionId: z39.string(),
|
|
5291
4874
|
declaration: ActionUpdate.default({}),
|
|
5292
4875
|
annotation: ActionUpdate.optional(),
|
|
5293
4876
|
originalActionId: UUID.optional(),
|
|
5294
4877
|
// should not be part of base action.
|
|
5295
|
-
keepAssignment:
|
|
5296
|
-
keepAssignmentIfAccepted:
|
|
5297
|
-
keepAssignmentIfRejected:
|
|
5298
|
-
waitFor:
|
|
4878
|
+
keepAssignment: z39.boolean().optional(),
|
|
4879
|
+
keepAssignmentIfAccepted: z39.boolean().optional(),
|
|
4880
|
+
keepAssignmentIfRejected: z39.boolean().optional(),
|
|
4881
|
+
waitFor: z39.boolean().default(true).describe(
|
|
5299
4882
|
"Whether action waits for the indexing before returning. Defaults to true. Setting this to to false completes faster but might lead to stale data in the client if the client tries to read the event immediately after performing the action. Use with care."
|
|
5300
4883
|
),
|
|
5301
4884
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
@@ -5305,8 +4888,8 @@ var BaseActionInput = z38.object({
|
|
|
5305
4888
|
)
|
|
5306
4889
|
});
|
|
5307
4890
|
var CreateActionInput = BaseActionInput.extend(
|
|
5308
|
-
|
|
5309
|
-
type:
|
|
4891
|
+
z39.object({
|
|
4892
|
+
type: z39.literal(ActionType.CREATE).default(ActionType.CREATE),
|
|
5310
4893
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
5311
4894
|
createdAtLocation: UUID.nullish().describe(
|
|
5312
4895
|
"A valid office location ID. This is required for system users performing actions. The provided location must be a leaf-location, i.e. it must not have any children locations."
|
|
@@ -5314,14 +4897,14 @@ var CreateActionInput = BaseActionInput.extend(
|
|
|
5314
4897
|
}).shape
|
|
5315
4898
|
);
|
|
5316
4899
|
var RegisterActionInput = BaseActionInput.extend(
|
|
5317
|
-
|
|
5318
|
-
type:
|
|
5319
|
-
registrationNumber:
|
|
4900
|
+
z39.strictObject({
|
|
4901
|
+
type: z39.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
|
4902
|
+
registrationNumber: z39.string().optional()
|
|
5320
4903
|
}).shape
|
|
5321
4904
|
);
|
|
5322
4905
|
var NotifyActionInput = BaseActionInput.extend(
|
|
5323
|
-
|
|
5324
|
-
type:
|
|
4906
|
+
z39.object({
|
|
4907
|
+
type: z39.literal(ActionType.NOTIFY).default(ActionType.NOTIFY),
|
|
5325
4908
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
5326
4909
|
createdAtLocation: UUID.nullish().describe(
|
|
5327
4910
|
"A valid office location ID. This is required for system users performing actions. The provided location must be a leaf-location, i.e. it must not have any children locations."
|
|
@@ -5337,103 +4920,107 @@ var NotifyActionInput = BaseActionInput.extend(
|
|
|
5337
4920
|
}
|
|
5338
4921
|
});
|
|
5339
4922
|
var DeclareActionInput = BaseActionInput.extend(
|
|
5340
|
-
|
|
5341
|
-
type:
|
|
4923
|
+
z39.object({
|
|
4924
|
+
type: z39.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
|
5342
4925
|
}).shape
|
|
5343
4926
|
);
|
|
5344
4927
|
var EditActionInput = BaseActionInput.extend(
|
|
5345
|
-
|
|
5346
|
-
type:
|
|
4928
|
+
z39.object({
|
|
4929
|
+
type: z39.literal(ActionType.EDIT).default(ActionType.EDIT)
|
|
5347
4930
|
}).shape
|
|
5348
4931
|
);
|
|
5349
4932
|
var PrintCertificateActionInput = BaseActionInput.extend(
|
|
5350
|
-
|
|
5351
|
-
type:
|
|
4933
|
+
z39.object({
|
|
4934
|
+
type: z39.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
|
|
5352
4935
|
content: PrintContent.optional()
|
|
5353
4936
|
}).shape
|
|
5354
4937
|
);
|
|
5355
4938
|
var RejectDeclarationActionInput = BaseActionInput.extend(
|
|
5356
|
-
|
|
5357
|
-
type:
|
|
4939
|
+
z39.object({
|
|
4940
|
+
type: z39.literal(ActionType.REJECT).default(ActionType.REJECT),
|
|
5358
4941
|
content: ReasonContent
|
|
5359
4942
|
}).shape
|
|
5360
4943
|
);
|
|
5361
4944
|
var DuplicateDetectedActionInput = BaseActionInput.extend(
|
|
5362
|
-
|
|
5363
|
-
type:
|
|
5364
|
-
content:
|
|
5365
|
-
duplicates:
|
|
4945
|
+
z39.object({
|
|
4946
|
+
type: z39.literal(ActionType.DUPLICATE_DETECTED).default(ActionType.DUPLICATE_DETECTED),
|
|
4947
|
+
content: z39.object({
|
|
4948
|
+
duplicates: z39.array(PotentialDuplicate)
|
|
5366
4949
|
})
|
|
5367
4950
|
}).shape
|
|
5368
4951
|
);
|
|
5369
4952
|
var MarkAsDuplicateActionInput = BaseActionInput.extend(
|
|
5370
|
-
|
|
5371
|
-
type:
|
|
5372
|
-
content:
|
|
4953
|
+
z39.object({
|
|
4954
|
+
type: z39.literal(ActionType.MARK_AS_DUPLICATE).default(ActionType.MARK_AS_DUPLICATE),
|
|
4955
|
+
content: z39.object({
|
|
5373
4956
|
duplicateOf: UUID
|
|
5374
4957
|
}).optional()
|
|
5375
4958
|
}).shape
|
|
5376
4959
|
);
|
|
5377
4960
|
var MarkNotDuplicateActionInput = BaseActionInput.extend(
|
|
5378
|
-
|
|
5379
|
-
type:
|
|
4961
|
+
z39.object({
|
|
4962
|
+
type: z39.literal(ActionType.MARK_AS_NOT_DUPLICATE).default(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
5380
4963
|
}).shape
|
|
5381
4964
|
);
|
|
5382
4965
|
var ArchiveActionInput = BaseActionInput.extend(
|
|
5383
|
-
|
|
5384
|
-
type:
|
|
5385
|
-
|
|
4966
|
+
z39.object({
|
|
4967
|
+
type: z39.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
|
|
4968
|
+
/**
|
|
4969
|
+
* Archiving does not collect a reason on its own. Only the
|
|
4970
|
+
* "mark as duplicate" flow archives with a reason attached.
|
|
4971
|
+
*/
|
|
4972
|
+
content: ReasonContent.optional()
|
|
5386
4973
|
}).shape
|
|
5387
4974
|
);
|
|
5388
4975
|
var UnarchiveActionInput = BaseActionInput.extend(
|
|
5389
|
-
|
|
5390
|
-
type:
|
|
4976
|
+
z39.object({
|
|
4977
|
+
type: z39.literal(ActionType.UNARCHIVE).default(ActionType.UNARCHIVE)
|
|
5391
4978
|
}).shape
|
|
5392
4979
|
);
|
|
5393
4980
|
var AssignActionInput = BaseActionInput.extend(
|
|
5394
|
-
|
|
5395
|
-
type:
|
|
5396
|
-
assignedTo:
|
|
4981
|
+
z39.object({
|
|
4982
|
+
type: z39.literal(ActionType.ASSIGN),
|
|
4983
|
+
assignedTo: z39.string()
|
|
5397
4984
|
}).shape
|
|
5398
4985
|
);
|
|
5399
4986
|
var UnassignActionInput = BaseActionInput.extend(
|
|
5400
|
-
|
|
5401
|
-
type:
|
|
5402
|
-
assignedTo:
|
|
4987
|
+
z39.object({
|
|
4988
|
+
type: z39.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
|
|
4989
|
+
assignedTo: z39.literal(null).default(null)
|
|
5403
4990
|
}).shape
|
|
5404
4991
|
);
|
|
5405
4992
|
var RequestCorrectionActionInput = BaseActionInput.extend(
|
|
5406
|
-
|
|
5407
|
-
type:
|
|
4993
|
+
z39.object({
|
|
4994
|
+
type: z39.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
|
5408
4995
|
}).shape
|
|
5409
4996
|
);
|
|
5410
4997
|
var RejectCorrectionActionInput = BaseActionInput.extend(
|
|
5411
|
-
|
|
5412
|
-
requestId:
|
|
5413
|
-
type:
|
|
4998
|
+
z39.object({
|
|
4999
|
+
requestId: z39.string(),
|
|
5000
|
+
type: z39.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION),
|
|
5414
5001
|
content: ReasonContent
|
|
5415
5002
|
}).shape
|
|
5416
5003
|
);
|
|
5417
5004
|
var ApproveCorrectionActionInput = BaseActionInput.extend(
|
|
5418
|
-
|
|
5419
|
-
requestId:
|
|
5420
|
-
type:
|
|
5421
|
-
content:
|
|
5005
|
+
z39.object({
|
|
5006
|
+
requestId: z39.string(),
|
|
5007
|
+
type: z39.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION),
|
|
5008
|
+
content: z39.object({ immediateCorrection: z39.boolean().optional() }).optional()
|
|
5422
5009
|
}).shape
|
|
5423
5010
|
);
|
|
5424
5011
|
var ReadActionInput = BaseActionInput.extend(
|
|
5425
|
-
|
|
5426
|
-
type:
|
|
5012
|
+
z39.object({
|
|
5013
|
+
type: z39.literal(ActionType.READ).default(ActionType.READ)
|
|
5427
5014
|
}).shape
|
|
5428
5015
|
);
|
|
5429
|
-
var DeleteActionInput =
|
|
5016
|
+
var DeleteActionInput = z39.object({ eventId: UUID });
|
|
5430
5017
|
var CustomActionInput = BaseActionInput.extend(
|
|
5431
|
-
|
|
5432
|
-
type:
|
|
5433
|
-
customActionType:
|
|
5018
|
+
z39.object({
|
|
5019
|
+
type: z39.literal(ActionType.CUSTOM).default(ActionType.CUSTOM),
|
|
5020
|
+
customActionType: z39.string().describe("Name of the custom action.")
|
|
5434
5021
|
}).shape
|
|
5435
5022
|
);
|
|
5436
|
-
var ActionInput =
|
|
5023
|
+
var ActionInput = z39.discriminatedUnion("type", [
|
|
5437
5024
|
CreateActionInput.meta({ id: "CreateActionInput" }),
|
|
5438
5025
|
RegisterActionInput.meta({ id: "RegisterActionInput" }),
|
|
5439
5026
|
NotifyActionInput.meta({ id: "NotifyActionInput" }),
|
|
@@ -5470,11 +5057,11 @@ var ActionInput = z38.discriminatedUnion("type", [
|
|
|
5470
5057
|
});
|
|
5471
5058
|
|
|
5472
5059
|
// ../commons/src/events/Draft.ts
|
|
5473
|
-
var Draft =
|
|
5060
|
+
var Draft = z40.object({
|
|
5474
5061
|
id: UUID,
|
|
5475
5062
|
eventId: UUID,
|
|
5476
|
-
transactionId:
|
|
5477
|
-
createdAt:
|
|
5063
|
+
transactionId: z40.string(),
|
|
5064
|
+
createdAt: z40.string().datetime(),
|
|
5478
5065
|
action: ActionBase.extend({
|
|
5479
5066
|
type: ActionTypes.exclude([ActionTypes.enum.DELETE])
|
|
5480
5067
|
}).omit({ id: true, createdAtLocation: true })
|
|
@@ -5483,7 +5070,7 @@ var Draft = z39.object({
|
|
|
5483
5070
|
);
|
|
5484
5071
|
var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
|
|
5485
5072
|
type: ActionTypes.exclude([ActionTypes.enum.DELETE]),
|
|
5486
|
-
status:
|
|
5073
|
+
status: z40.enum([
|
|
5487
5074
|
ActionStatus.Requested,
|
|
5488
5075
|
ActionStatus.Accepted,
|
|
5489
5076
|
ActionStatus.Rejected
|
|
@@ -5491,30 +5078,33 @@ var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
|
|
|
5491
5078
|
});
|
|
5492
5079
|
|
|
5493
5080
|
// ../commons/src/events/EventInput.ts
|
|
5494
|
-
var
|
|
5081
|
+
var z41 = __toESM(require("zod/v4"));
|
|
5495
5082
|
var import_uuid11 = require("uuid");
|
|
5496
|
-
var EventInput =
|
|
5497
|
-
transactionId:
|
|
5498
|
-
type:
|
|
5083
|
+
var EventInput = z41.object({
|
|
5084
|
+
transactionId: z41.string(),
|
|
5085
|
+
type: z41.string(),
|
|
5499
5086
|
createdAtLocation: UUID.nullish().describe(
|
|
5500
5087
|
"Location where the event occurred. Required for system users."
|
|
5501
5088
|
)
|
|
5502
5089
|
}).meta({ default: { transactionId: (0, import_uuid11.v4)(), type: "birth" } });
|
|
5503
5090
|
|
|
5504
5091
|
// ../commons/src/events/EventDocument.ts
|
|
5505
|
-
var
|
|
5506
|
-
var EventDocument =
|
|
5092
|
+
var z42 = __toESM(require("zod/v4"));
|
|
5093
|
+
var EventDocument = z42.object({
|
|
5507
5094
|
id: UUID.describe("Unique identifier of the event."),
|
|
5508
|
-
type:
|
|
5509
|
-
createdAt:
|
|
5510
|
-
updatedAt:
|
|
5095
|
+
type: z42.string().describe("Type of the event (e.g. birth, death, marriage)."),
|
|
5096
|
+
createdAt: z42.string().datetime().describe("Timestamp indicating when the event was created."),
|
|
5097
|
+
updatedAt: z42.string().datetime().describe(
|
|
5511
5098
|
"Timestamp of the last update, excluding changes from actions."
|
|
5512
5099
|
),
|
|
5513
|
-
actions:
|
|
5514
|
-
trackingId:
|
|
5100
|
+
actions: z42.array(Action).describe("Ordered list of actions associated with the event."),
|
|
5101
|
+
trackingId: z42.string().describe(
|
|
5515
5102
|
"System-generated tracking identifier used to look up the event."
|
|
5516
5103
|
)
|
|
5517
5104
|
}).meta({ id: "EventDocument" });
|
|
5105
|
+
var EventDocumentOnlyLastAction = EventDocument.extend({
|
|
5106
|
+
actions: z42.array(Action).max(1).describe("Only the last action associated with the event.")
|
|
5107
|
+
}).brand("EventDocumentOnlyLastAction");
|
|
5518
5108
|
|
|
5519
5109
|
// ../commons/src/events/defineConfig.ts
|
|
5520
5110
|
var IGNORED_EVENT_TYPES = [
|
|
@@ -7965,8 +7555,8 @@ var digitalIdentityEvent = defineConfig({
|
|
|
7965
7555
|
});
|
|
7966
7556
|
|
|
7967
7557
|
// ../commons/src/events/test.utils.ts
|
|
7968
|
-
var
|
|
7969
|
-
var TestUserRole =
|
|
7558
|
+
var z43 = __toESM(require("zod/v4"));
|
|
7559
|
+
var TestUserRole = z43.enum([
|
|
7970
7560
|
"FIELD_AGENT",
|
|
7971
7561
|
"LOCAL_REGISTRAR",
|
|
7972
7562
|
"LOCAL_SYSTEM_ADMIN",
|
|
@@ -7982,49 +7572,94 @@ var TestUserRole = z42.enum([
|
|
|
7982
7572
|
var import_lodash6 = require("lodash");
|
|
7983
7573
|
|
|
7984
7574
|
// ../commons/src/events/locations.ts
|
|
7985
|
-
var
|
|
7986
|
-
var LocationTypeV1 =
|
|
7575
|
+
var z44 = __toESM(require("zod/v4"));
|
|
7576
|
+
var LocationTypeV1 = z44.enum([
|
|
7987
7577
|
"ADMIN_STRUCTURE",
|
|
7988
7578
|
"CRVS_OFFICE",
|
|
7989
7579
|
"HEALTH_FACILITY"
|
|
7990
7580
|
]);
|
|
7991
|
-
var LocationStatus =
|
|
7992
|
-
var LocationVersion =
|
|
7581
|
+
var LocationStatus = z44.enum(["active", "inactive"]);
|
|
7582
|
+
var LocationVersion = z44.object({
|
|
7993
7583
|
versionId: UUID,
|
|
7994
|
-
effectiveFrom:
|
|
7995
|
-
name:
|
|
7996
|
-
externalId:
|
|
7584
|
+
effectiveFrom: z44.iso.date(),
|
|
7585
|
+
name: z44.string(),
|
|
7586
|
+
externalId: z44.string().nullish(),
|
|
7997
7587
|
status: LocationStatus
|
|
7998
7588
|
});
|
|
7999
|
-
var AdministrativeArea =
|
|
7589
|
+
var AdministrativeArea = z44.object({
|
|
8000
7590
|
id: UUID,
|
|
8001
|
-
name:
|
|
8002
|
-
externalId:
|
|
7591
|
+
name: z44.string(),
|
|
7592
|
+
externalId: z44.string().nullish(),
|
|
8003
7593
|
parentId: UUID.nullable(),
|
|
8004
7594
|
status: LocationStatus,
|
|
8005
|
-
versions:
|
|
7595
|
+
versions: z44.array(LocationVersion)
|
|
8006
7596
|
});
|
|
8007
|
-
var Location =
|
|
7597
|
+
var Location = z44.object({
|
|
8008
7598
|
id: UUID,
|
|
8009
|
-
name:
|
|
8010
|
-
externalId:
|
|
7599
|
+
name: z44.string(),
|
|
7600
|
+
externalId: z44.string().nullish(),
|
|
8011
7601
|
administrativeAreaId: UUID.nullable(),
|
|
8012
|
-
locationType:
|
|
7602
|
+
locationType: z44.string().nullable(),
|
|
8013
7603
|
status: LocationStatus,
|
|
8014
|
-
versions:
|
|
7604
|
+
versions: z44.array(LocationVersion)
|
|
7605
|
+
});
|
|
7606
|
+
var ClientAdministrativeArea = AdministrativeArea.omit({
|
|
7607
|
+
name: true,
|
|
7608
|
+
status: true,
|
|
7609
|
+
externalId: true
|
|
7610
|
+
});
|
|
7611
|
+
var ClientLocation = Location.omit({
|
|
7612
|
+
name: true,
|
|
7613
|
+
status: true,
|
|
7614
|
+
externalId: true
|
|
7615
|
+
});
|
|
7616
|
+
function toClientLocation(location) {
|
|
7617
|
+
return {
|
|
7618
|
+
id: location.id,
|
|
7619
|
+
administrativeAreaId: location.administrativeAreaId,
|
|
7620
|
+
locationType: location.locationType,
|
|
7621
|
+
versions: location.versions
|
|
7622
|
+
};
|
|
7623
|
+
}
|
|
7624
|
+
function toClientAdministrativeArea(area) {
|
|
7625
|
+
return {
|
|
7626
|
+
id: area.id,
|
|
7627
|
+
parentId: area.parentId,
|
|
7628
|
+
versions: area.versions
|
|
7629
|
+
};
|
|
7630
|
+
}
|
|
7631
|
+
function validateAscendingDates(versions, ctx) {
|
|
7632
|
+
const ascending = versions.every(
|
|
7633
|
+
(version, index) => index === 0 || versions[index - 1].effectiveFrom < version.effectiveFrom
|
|
7634
|
+
);
|
|
7635
|
+
if (!ascending) {
|
|
7636
|
+
ctx.addIssue("versions must be strictly ascending by effectiveFrom");
|
|
7637
|
+
}
|
|
7638
|
+
}
|
|
7639
|
+
function validateUniqueIds(versions, ctx) {
|
|
7640
|
+
const versionIds = new Set(versions.map((version) => version.versionId));
|
|
7641
|
+
if (versionIds.size !== versions.length) {
|
|
7642
|
+
ctx.addIssue("versions must not repeat a versionId");
|
|
7643
|
+
}
|
|
7644
|
+
}
|
|
7645
|
+
var SeededLocationVersions = z44.array(LocationVersion).min(1).superRefine((versions, ctx) => {
|
|
7646
|
+
validateAscendingDates(versions, ctx);
|
|
7647
|
+
validateUniqueIds(versions, ctx);
|
|
8015
7648
|
});
|
|
8016
|
-
var SetLocationPayload =
|
|
7649
|
+
var SetLocationPayload = z44.object({
|
|
8017
7650
|
id: UUID,
|
|
8018
|
-
name:
|
|
8019
|
-
externalId:
|
|
7651
|
+
name: z44.string(),
|
|
7652
|
+
externalId: z44.string().nullish(),
|
|
8020
7653
|
administrativeAreaId: UUID.nullable(),
|
|
8021
|
-
locationType:
|
|
7654
|
+
locationType: z44.string().nullable(),
|
|
7655
|
+
versions: SeededLocationVersions.optional()
|
|
8022
7656
|
});
|
|
8023
|
-
var SetAdministrativeAreaPayload =
|
|
7657
|
+
var SetAdministrativeAreaPayload = z44.object({
|
|
8024
7658
|
id: UUID,
|
|
8025
|
-
name:
|
|
8026
|
-
externalId:
|
|
8027
|
-
parentId: UUID.nullable()
|
|
7659
|
+
name: z44.string(),
|
|
7660
|
+
externalId: z44.string().nullish(),
|
|
7661
|
+
parentId: UUID.nullable(),
|
|
7662
|
+
versions: SeededLocationVersions.optional()
|
|
8028
7663
|
});
|
|
8029
7664
|
|
|
8030
7665
|
// ../commons/src/events/scopes.ts
|
|
@@ -8061,8 +7696,7 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
|
8061
7696
|
ActionType.READ,
|
|
8062
7697
|
ActionType.DECLARE,
|
|
8063
7698
|
ActionType.NOTIFY,
|
|
8064
|
-
ActionType.DELETE
|
|
8065
|
-
ActionType.CUSTOM
|
|
7699
|
+
ActionType.DELETE
|
|
8066
7700
|
],
|
|
8067
7701
|
[EventStatus.enum.NOTIFIED]: [
|
|
8068
7702
|
ActionType.READ,
|
|
@@ -8455,138 +8089,234 @@ var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
|
|
|
8455
8089
|
var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
|
|
8456
8090
|
V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
|
|
8457
8091
|
);
|
|
8092
|
+
var V2_DEFAULT_MOCK_CLIENT_LOCATIONS_MAP = new Map(
|
|
8093
|
+
V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, toClientLocation(l)])
|
|
8094
|
+
);
|
|
8095
|
+
var V2_DEFAULT_MOCK_CLIENT_ADMINISTRATIVE_AREAS_MAP = new Map(
|
|
8096
|
+
V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [
|
|
8097
|
+
a.id,
|
|
8098
|
+
toClientAdministrativeArea(a)
|
|
8099
|
+
])
|
|
8100
|
+
);
|
|
8458
8101
|
|
|
8459
8102
|
// ../commons/src/events/locationPayloads.ts
|
|
8460
|
-
var
|
|
8461
|
-
var CreateLocationPayload =
|
|
8103
|
+
var z45 = __toESM(require("zod/v4"));
|
|
8104
|
+
var CreateLocationPayload = z45.object({
|
|
8462
8105
|
id: UUID.optional(),
|
|
8463
8106
|
versionId: UUID.optional(),
|
|
8464
|
-
name:
|
|
8465
|
-
externalId:
|
|
8107
|
+
name: z45.string(),
|
|
8108
|
+
externalId: z45.string().nullish(),
|
|
8466
8109
|
administrativeAreaId: UUID.nullable(),
|
|
8467
|
-
locationType:
|
|
8468
|
-
effectiveFrom:
|
|
8110
|
+
locationType: z45.string().nullable(),
|
|
8111
|
+
effectiveFrom: z45.iso.date().optional(),
|
|
8469
8112
|
status: LocationStatus.default("active")
|
|
8470
8113
|
});
|
|
8471
|
-
var UpdateLocationPayload =
|
|
8114
|
+
var UpdateLocationPayload = z45.strictObject({
|
|
8472
8115
|
id: UUID,
|
|
8473
8116
|
versionId: UUID.optional(),
|
|
8474
|
-
name:
|
|
8475
|
-
externalId:
|
|
8117
|
+
name: z45.string(),
|
|
8118
|
+
externalId: z45.string().nullish(),
|
|
8476
8119
|
status: LocationStatus,
|
|
8477
|
-
effectiveFrom:
|
|
8120
|
+
effectiveFrom: z45.iso.date().optional(),
|
|
8478
8121
|
lastVersionId: UUID
|
|
8479
8122
|
});
|
|
8480
|
-
var WithdrawLocationVersionPayload =
|
|
8123
|
+
var WithdrawLocationVersionPayload = z45.object({
|
|
8481
8124
|
id: UUID,
|
|
8482
8125
|
versionId: UUID
|
|
8483
8126
|
});
|
|
8484
|
-
var CreateAdministrativeAreaPayload =
|
|
8127
|
+
var CreateAdministrativeAreaPayload = z45.object({
|
|
8485
8128
|
id: UUID.optional(),
|
|
8486
8129
|
versionId: UUID.optional(),
|
|
8487
|
-
name:
|
|
8488
|
-
externalId:
|
|
8130
|
+
name: z45.string(),
|
|
8131
|
+
externalId: z45.string().nullish(),
|
|
8489
8132
|
parentId: UUID.nullable(),
|
|
8490
|
-
effectiveFrom:
|
|
8133
|
+
effectiveFrom: z45.iso.date().optional(),
|
|
8491
8134
|
status: LocationStatus.default("active")
|
|
8492
8135
|
});
|
|
8493
|
-
var UpdateAdministrativeAreaPayload =
|
|
8136
|
+
var UpdateAdministrativeAreaPayload = z45.strictObject({
|
|
8494
8137
|
id: UUID,
|
|
8495
8138
|
versionId: UUID.optional(),
|
|
8496
|
-
name:
|
|
8497
|
-
externalId:
|
|
8139
|
+
name: z45.string(),
|
|
8140
|
+
externalId: z45.string().nullish(),
|
|
8498
8141
|
status: LocationStatus,
|
|
8499
|
-
effectiveFrom:
|
|
8142
|
+
effectiveFrom: z45.iso.date().optional(),
|
|
8500
8143
|
lastVersionId: UUID
|
|
8501
8144
|
});
|
|
8502
|
-
var WithdrawAdministrativeAreaVersionPayload =
|
|
8145
|
+
var WithdrawAdministrativeAreaVersionPayload = z45.object({
|
|
8503
8146
|
id: UUID,
|
|
8504
8147
|
versionId: UUID
|
|
8505
8148
|
});
|
|
8506
8149
|
|
|
8507
8150
|
// ../commons/src/notification/UserNotifications.ts
|
|
8508
|
-
var
|
|
8151
|
+
var z46 = __toESM(require("zod/v4"));
|
|
8509
8152
|
var TriggerEvent = {
|
|
8510
8153
|
USER_CREATED: "user-created",
|
|
8511
8154
|
USER_UPDATED: "user-updated",
|
|
8512
8155
|
USERNAME_REMINDER: "username-reminder",
|
|
8513
8156
|
RESET_PASSWORD: "reset-password",
|
|
8514
8157
|
RESET_PASSWORD_BY_ADMIN: "reset-password-by-admin",
|
|
8158
|
+
PASSWORD_RESET_LINK: "password-reset-link",
|
|
8159
|
+
USERNAME_REMINDER_LINK: "username-reminder-link",
|
|
8515
8160
|
RESEND_INVITE: "resend-invite",
|
|
8516
8161
|
TWO_FA: "2fa",
|
|
8517
8162
|
ALL_USER_NOTIFICATION: "all-user-notification",
|
|
8518
8163
|
CHANGE_PHONE_NUMBER: "change-phone-number",
|
|
8519
8164
|
CHANGE_EMAIL_ADDRESS: "change-email-address"
|
|
8520
8165
|
};
|
|
8521
|
-
var Recipient =
|
|
8166
|
+
var Recipient = z46.object({
|
|
8522
8167
|
name: NameFieldValue.optional(),
|
|
8523
|
-
mobile:
|
|
8524
|
-
email:
|
|
8525
|
-
bcc:
|
|
8168
|
+
mobile: z46.string().optional(),
|
|
8169
|
+
email: z46.string().optional(),
|
|
8170
|
+
bcc: z46.array(z46.string()).optional()
|
|
8526
8171
|
});
|
|
8527
|
-
var BasePayload =
|
|
8172
|
+
var BasePayload = z46.object({
|
|
8528
8173
|
recipient: Recipient
|
|
8529
8174
|
});
|
|
8530
8175
|
var TriggerPayload = {
|
|
8531
8176
|
[TriggerEvent.USER_CREATED]: BasePayload.extend({
|
|
8532
|
-
username:
|
|
8533
|
-
temporaryPassword:
|
|
8177
|
+
username: z46.string(),
|
|
8178
|
+
temporaryPassword: z46.string()
|
|
8534
8179
|
}),
|
|
8535
8180
|
[TriggerEvent.USER_UPDATED]: BasePayload.extend({
|
|
8536
|
-
oldUsername:
|
|
8537
|
-
newUsername:
|
|
8181
|
+
oldUsername: z46.string(),
|
|
8182
|
+
newUsername: z46.string()
|
|
8538
8183
|
}),
|
|
8539
8184
|
[TriggerEvent.USERNAME_REMINDER]: BasePayload.extend({
|
|
8540
|
-
username:
|
|
8185
|
+
username: z46.string()
|
|
8541
8186
|
}),
|
|
8542
8187
|
[TriggerEvent.RESET_PASSWORD]: BasePayload.extend({
|
|
8543
|
-
code:
|
|
8188
|
+
code: z46.string()
|
|
8544
8189
|
}),
|
|
8545
8190
|
[TriggerEvent.RESET_PASSWORD_BY_ADMIN]: BasePayload.extend({
|
|
8546
|
-
temporaryPassword:
|
|
8547
|
-
admin:
|
|
8548
|
-
id:
|
|
8191
|
+
temporaryPassword: z46.string(),
|
|
8192
|
+
admin: z46.object({
|
|
8193
|
+
id: z46.string(),
|
|
8549
8194
|
name: NameFieldValue,
|
|
8550
|
-
role:
|
|
8195
|
+
role: z46.string()
|
|
8551
8196
|
})
|
|
8552
8197
|
}),
|
|
8198
|
+
[TriggerEvent.PASSWORD_RESET_LINK]: BasePayload.extend({
|
|
8199
|
+
token: z46.string()
|
|
8200
|
+
}),
|
|
8201
|
+
[TriggerEvent.USERNAME_REMINDER_LINK]: BasePayload.extend({
|
|
8202
|
+
token: z46.string()
|
|
8203
|
+
}),
|
|
8553
8204
|
[TriggerEvent.RESEND_INVITE]: BasePayload.extend({
|
|
8554
|
-
username:
|
|
8555
|
-
temporaryPassword:
|
|
8205
|
+
username: z46.string(),
|
|
8206
|
+
temporaryPassword: z46.string()
|
|
8556
8207
|
}),
|
|
8557
8208
|
[TriggerEvent.TWO_FA]: BasePayload.extend({
|
|
8558
|
-
code:
|
|
8209
|
+
code: z46.string()
|
|
8559
8210
|
}),
|
|
8560
8211
|
[TriggerEvent.ALL_USER_NOTIFICATION]: BasePayload.extend({
|
|
8561
|
-
subject:
|
|
8562
|
-
body:
|
|
8212
|
+
subject: z46.string(),
|
|
8213
|
+
body: z46.string()
|
|
8563
8214
|
}),
|
|
8564
8215
|
[TriggerEvent.CHANGE_PHONE_NUMBER]: BasePayload.extend({
|
|
8565
|
-
code:
|
|
8216
|
+
code: z46.string()
|
|
8566
8217
|
}),
|
|
8567
8218
|
[TriggerEvent.CHANGE_EMAIL_ADDRESS]: BasePayload.extend({
|
|
8568
|
-
code:
|
|
8219
|
+
code: z46.string()
|
|
8569
8220
|
})
|
|
8570
8221
|
};
|
|
8222
|
+
function parseUserEventTrigger(event2, body) {
|
|
8223
|
+
const schema = TriggerPayload[event2];
|
|
8224
|
+
return schema.parse(body);
|
|
8225
|
+
}
|
|
8226
|
+
|
|
8227
|
+
// ../commons/src/url.ts
|
|
8228
|
+
function joinUrl(base, path) {
|
|
8229
|
+
const baseWithSlash = base.endsWith("/") ? base : base + "/";
|
|
8230
|
+
return new URL(path, baseWithSlash);
|
|
8231
|
+
}
|
|
8232
|
+
|
|
8233
|
+
// ../commons/src/logger.ts
|
|
8234
|
+
var import_pino = __toESM(require("pino"));
|
|
8235
|
+
function normalizeLogArgs(args) {
|
|
8236
|
+
const [first, ...rest] = args;
|
|
8237
|
+
if (typeof first !== "string" || rest.length === 0) {
|
|
8238
|
+
return args;
|
|
8239
|
+
}
|
|
8240
|
+
const mergingObject = {};
|
|
8241
|
+
const primitives = [];
|
|
8242
|
+
for (const arg of rest) {
|
|
8243
|
+
if (arg instanceof Error) {
|
|
8244
|
+
mergingObject.err = import_pino.default.stdSerializers.err(arg);
|
|
8245
|
+
} else if (arg !== null && typeof arg === "object") {
|
|
8246
|
+
Object.assign(mergingObject, arg);
|
|
8247
|
+
} else {
|
|
8248
|
+
primitives.push(arg);
|
|
8249
|
+
}
|
|
8250
|
+
}
|
|
8251
|
+
const message = primitives.length ? `${first} ${primitives.join(" ")}` : first;
|
|
8252
|
+
return Object.keys(mergingObject).length ? [mergingObject, message] : [message];
|
|
8253
|
+
}
|
|
8254
|
+
function filterHealthCheckLogs(args, method) {
|
|
8255
|
+
const logger2 = this;
|
|
8256
|
+
for (const arg of args) {
|
|
8257
|
+
if (typeof arg === "string" && arg.includes("get /ping 200")) {
|
|
8258
|
+
if (logger2.debug) {
|
|
8259
|
+
return logger2.debug(...args);
|
|
8260
|
+
}
|
|
8261
|
+
}
|
|
8262
|
+
}
|
|
8263
|
+
return method.apply(this, normalizeLogArgs(args));
|
|
8264
|
+
}
|
|
8265
|
+
function buildLoggerOptions() {
|
|
8266
|
+
return {
|
|
8267
|
+
serializers: { err: import_pino.default.stdSerializers.err },
|
|
8268
|
+
hooks: { logMethod: filterHealthCheckLogs }
|
|
8269
|
+
};
|
|
8270
|
+
}
|
|
8271
|
+
var logger = false ? (0, import_pino.default)({
|
|
8272
|
+
level: "info",
|
|
8273
|
+
redact: [
|
|
8274
|
+
"req.headers.authorization",
|
|
8275
|
+
"req.remoteAddress",
|
|
8276
|
+
"req.headers['x-real-ip']"
|
|
8277
|
+
],
|
|
8278
|
+
...buildLoggerOptions()
|
|
8279
|
+
}) : (0, import_pino.default)({
|
|
8280
|
+
level: "debug",
|
|
8281
|
+
transport: {
|
|
8282
|
+
target: "pino-pretty",
|
|
8283
|
+
options: {
|
|
8284
|
+
colorize: true,
|
|
8285
|
+
ignore: "pid,hostname"
|
|
8286
|
+
}
|
|
8287
|
+
},
|
|
8288
|
+
...buildLoggerOptions()
|
|
8289
|
+
});
|
|
8290
|
+
var level = false ? "silent" : process.env.LOG_LEVEL;
|
|
8291
|
+
if (level) {
|
|
8292
|
+
logger.level = level;
|
|
8293
|
+
}
|
|
8294
|
+
|
|
8295
|
+
// ../commons/src/notification/dispatch.ts
|
|
8571
8296
|
async function triggerUserEventNotification({
|
|
8572
8297
|
event: event2,
|
|
8573
8298
|
payload,
|
|
8574
8299
|
countryConfigUrl,
|
|
8575
8300
|
authHeader
|
|
8576
8301
|
}) {
|
|
8577
|
-
|
|
8578
|
-
|
|
8579
|
-
|
|
8580
|
-
|
|
8581
|
-
|
|
8582
|
-
|
|
8302
|
+
const response = await fetch(
|
|
8303
|
+
joinUrl(countryConfigUrl, `triggers/user/${event2}`),
|
|
8304
|
+
{
|
|
8305
|
+
method: "POST",
|
|
8306
|
+
body: JSON.stringify(payload),
|
|
8307
|
+
headers: {
|
|
8308
|
+
"Content-Type": "application/json",
|
|
8309
|
+
...authHeader
|
|
8310
|
+
}
|
|
8583
8311
|
}
|
|
8584
|
-
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
|
|
8312
|
+
);
|
|
8313
|
+
if (!response.ok) {
|
|
8314
|
+
logger.error(
|
|
8315
|
+
`triggerUserEventNotification: dispatch failed for event "${event2}" with status ${response.status}`
|
|
8316
|
+
);
|
|
8317
|
+
}
|
|
8318
|
+
return response;
|
|
8589
8319
|
}
|
|
8590
8320
|
|
|
8591
8321
|
// src/notification/index.ts
|
|
8592
|
-
|
|
8322
|
+
z47.globalRegistry.clear();
|