@opencrvs/toolkit 2.1.0-rc.d876831 → 2.1.0-rc.d987aec
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 +2 -12
- package/build.sh +9 -1
- package/create-countryconfig/index.js +412 -59
- package/create-countryconfig/node_modules/.bin/degit +21 -0
- package/create-countryconfig/package.json +4 -1
- package/dist/application-config/index.js +248 -215
- 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 +1650 -100
- package/dist/commons/api/router.d.ts +407 -50
- package/dist/commons/conditionals/conditionals.d.ts +6 -6
- package/dist/commons/conditionals/validate.d.ts +7 -3
- 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/EventDocument.d.ts +470 -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 +24 -5
- package/dist/commons/events/FieldTypeMapping.d.ts +15 -15
- package/dist/commons/events/locations.d.ts +63 -10
- package/dist/commons/events/test.utils.d.ts +25 -4
- package/dist/commons/events/utils.d.ts +13 -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/logger.d.ts +3 -0
- package/dist/environment/logger.d.ts.map +1 -1
- package/dist/environment/manage-users.js +1 -1
- package/dist/environment/questions.d.ts.map +1 -1
- package/dist/environment/questions.js +20 -14
- package/dist/environment/setup-environment.js +26 -6
- package/dist/environment/templates.d.ts +0 -1
- package/dist/environment/templates.d.ts.map +1 -1
- package/dist/environment/templates.js +3 -8
- package/dist/events/index.js +2632 -2481
- 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 +1027 -1452
- package/dist/scopes/index.d.ts +77 -7
- 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/dependencies/values.yaml +2 -0
- package/dist/templates/charts-values/opencrvs-services/values.yaml +1 -1
- package/dist/templates/charts-values/opentelemetry/values.yaml +22 -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 +21 -0
- package/dist/translations/check.d.ts.map +1 -0
- package/dist/translations/check.js +132 -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.d987aec.tgz +0 -0
- package/package.json +9 -4
- 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.d876831.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(
|
|
373
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
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(
|
|
367
379
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
368
|
-
|
|
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,159 +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()
|
|
697
710
|
})
|
|
698
711
|
});
|
|
699
|
-
var ChangedStringField =
|
|
700
|
-
var ChangedNullableStringField =
|
|
701
|
-
from:
|
|
702
|
-
to:
|
|
703
|
-
});
|
|
704
|
-
var updatedVersionRequestData =
|
|
705
|
-
id:
|
|
706
|
-
versionId:
|
|
707
|
-
name:
|
|
708
|
-
externalId:
|
|
709
|
-
status:
|
|
710
|
-
effectiveFrom:
|
|
711
|
-
lastVersionId:
|
|
712
|
-
});
|
|
713
|
-
var updatedVersionResponseSummary =
|
|
714
|
-
previousVersionId:
|
|
715
|
-
versionId:
|
|
716
|
-
changed:
|
|
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({
|
|
717
730
|
name: ChangedStringField.optional(),
|
|
718
731
|
externalId: ChangedNullableStringField.optional(),
|
|
719
732
|
status: ChangedStringField.optional()
|
|
720
733
|
})
|
|
721
734
|
});
|
|
722
735
|
var LocationUpdateEntrySchema = AuditLogEntryBase.extend({
|
|
723
|
-
operation:
|
|
736
|
+
operation: z9.literal("locations.update"),
|
|
724
737
|
requestData: updatedVersionRequestData,
|
|
725
738
|
responseSummary: updatedVersionResponseSummary
|
|
726
739
|
});
|
|
727
740
|
var AdministrativeAreaUpdateEntrySchema = AuditLogEntryBase.extend({
|
|
728
|
-
operation:
|
|
741
|
+
operation: z9.literal("administrativeAreas.update"),
|
|
729
742
|
requestData: updatedVersionRequestData,
|
|
730
743
|
responseSummary: updatedVersionResponseSummary
|
|
731
744
|
});
|
|
732
|
-
var withdrawVersionRequestData =
|
|
733
|
-
id:
|
|
734
|
-
versionId:
|
|
745
|
+
var withdrawVersionRequestData = z9.object({
|
|
746
|
+
id: z9.string(),
|
|
747
|
+
versionId: z9.string()
|
|
735
748
|
});
|
|
736
|
-
var withdrawVersionResponseSummary =
|
|
737
|
-
effectiveFrom:
|
|
738
|
-
name:
|
|
739
|
-
externalId:
|
|
740
|
-
status:
|
|
749
|
+
var withdrawVersionResponseSummary = z9.object({
|
|
750
|
+
effectiveFrom: z9.string(),
|
|
751
|
+
name: z9.string(),
|
|
752
|
+
externalId: z9.string().nullish(),
|
|
753
|
+
status: z9.string()
|
|
741
754
|
});
|
|
742
755
|
var LocationWithdrawEntrySchema = AuditLogEntryBase.extend({
|
|
743
|
-
operation:
|
|
756
|
+
operation: z9.literal("locations.withdrawVersion"),
|
|
744
757
|
requestData: withdrawVersionRequestData,
|
|
745
758
|
responseSummary: withdrawVersionResponseSummary
|
|
746
759
|
});
|
|
747
760
|
var AdministrativeAreaWithdrawEntrySchema = AuditLogEntryBase.extend({
|
|
748
|
-
operation:
|
|
761
|
+
operation: z9.literal("administrativeAreas.withdrawVersion"),
|
|
749
762
|
requestData: withdrawVersionRequestData,
|
|
750
763
|
responseSummary: withdrawVersionResponseSummary
|
|
751
764
|
});
|
|
752
765
|
var AttachmentUploadEntrySchema = AuditLogEntryBase.extend({
|
|
753
|
-
operation:
|
|
754
|
-
requestData:
|
|
755
|
-
transactionId:
|
|
756
|
-
path:
|
|
766
|
+
operation: z9.literal("attachments.upload"),
|
|
767
|
+
requestData: z9.object({
|
|
768
|
+
transactionId: z9.string(),
|
|
769
|
+
path: z9.string().nullable()
|
|
757
770
|
}),
|
|
758
|
-
responseSummary:
|
|
771
|
+
responseSummary: z9.object({ fileUrl: z9.string() })
|
|
759
772
|
});
|
|
760
|
-
var subjectOnly =
|
|
761
|
-
var subjectWithReason =
|
|
762
|
-
subjectId:
|
|
763
|
-
reason:
|
|
764
|
-
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()
|
|
765
778
|
});
|
|
766
779
|
var UserCreateEntrySchema = AuditLogEntryBase.extend({
|
|
767
|
-
operation:
|
|
768
|
-
requestData:
|
|
769
|
-
subjectId:
|
|
770
|
-
role:
|
|
771
|
-
primaryOfficeId:
|
|
780
|
+
operation: z9.literal("user.create_user"),
|
|
781
|
+
requestData: z9.object({
|
|
782
|
+
subjectId: z9.string(),
|
|
783
|
+
role: z9.string(),
|
|
784
|
+
primaryOfficeId: z9.string()
|
|
772
785
|
})
|
|
773
786
|
});
|
|
774
787
|
var UserReasonEntrySchema = AuditLogEntryBase.extend({
|
|
775
|
-
operation:
|
|
788
|
+
operation: z9.enum(["user.deactivate", "user.reactivate"]),
|
|
776
789
|
requestData: subjectWithReason
|
|
777
790
|
});
|
|
778
791
|
var UserSubjectOnlyEntrySchema = AuditLogEntryBase.extend({
|
|
779
|
-
operation:
|
|
792
|
+
operation: z9.enum([
|
|
780
793
|
"user.edit_user",
|
|
781
794
|
"user.logged_in",
|
|
782
795
|
"user.logged_out",
|
|
@@ -790,14 +803,14 @@ var UserSubjectOnlyEntrySchema = AuditLogEntryBase.extend({
|
|
|
790
803
|
requestData: subjectOnly
|
|
791
804
|
});
|
|
792
805
|
var UserEmailChangedEntrySchema = AuditLogEntryBase.extend({
|
|
793
|
-
operation:
|
|
806
|
+
operation: z9.literal("user.email_address_changed"),
|
|
794
807
|
requestData: subjectOnly,
|
|
795
|
-
responseSummary:
|
|
808
|
+
responseSummary: z9.object({ email: z9.string() })
|
|
796
809
|
});
|
|
797
810
|
var UserPhoneChangedEntrySchema = AuditLogEntryBase.extend({
|
|
798
|
-
operation:
|
|
811
|
+
operation: z9.literal("user.phone_number_changed"),
|
|
799
812
|
requestData: subjectOnly,
|
|
800
|
-
responseSummary:
|
|
813
|
+
responseSummary: z9.object({ phoneNumber: z9.string() })
|
|
801
814
|
});
|
|
802
815
|
var userBaseOmit = {
|
|
803
816
|
id: true,
|
|
@@ -805,14 +818,14 @@ var userBaseOmit = {
|
|
|
805
818
|
clientType: true,
|
|
806
819
|
createdAt: true
|
|
807
820
|
};
|
|
808
|
-
var UserAuditRecordInput =
|
|
821
|
+
var UserAuditRecordInput = z9.discriminatedUnion("operation", [
|
|
809
822
|
UserCreateEntrySchema.omit(userBaseOmit),
|
|
810
823
|
UserReasonEntrySchema.omit(userBaseOmit),
|
|
811
824
|
UserSubjectOnlyEntrySchema.omit(userBaseOmit),
|
|
812
825
|
UserEmailChangedEntrySchema.omit(userBaseOmit),
|
|
813
826
|
UserPhoneChangedEntrySchema.omit(userBaseOmit)
|
|
814
827
|
]);
|
|
815
|
-
var AuditLogEntrySchema =
|
|
828
|
+
var AuditLogEntrySchema = z9.discriminatedUnion("operation", [
|
|
816
829
|
EventCreateEntrySchema,
|
|
817
830
|
EventGetEntrySchema,
|
|
818
831
|
EventSearchEntrySchema,
|
|
@@ -843,13 +856,13 @@ var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
|
|
|
843
856
|
var CHILD_ONBOARDING_EVENT = "child-onboarding";
|
|
844
857
|
|
|
845
858
|
// ../commons/src/events/ActionConfig.ts
|
|
846
|
-
var
|
|
859
|
+
var z25 = __toESM(require("zod/v4"));
|
|
847
860
|
|
|
848
861
|
// ../commons/src/events/FieldConfig.ts
|
|
849
862
|
var import_v43 = __toESM(require("zod/v4"));
|
|
850
863
|
|
|
851
864
|
// ../commons/src/events/FieldType.ts
|
|
852
|
-
var
|
|
865
|
+
var z10 = __toESM(require("zod/v4"));
|
|
853
866
|
var FieldType = {
|
|
854
867
|
NAME: "NAME",
|
|
855
868
|
PHONE: "PHONE",
|
|
@@ -913,7 +926,7 @@ var FieldType = {
|
|
|
913
926
|
*/
|
|
914
927
|
_EXPERIMENTAL_CUSTOM: "CUSTOM"
|
|
915
928
|
};
|
|
916
|
-
var FileFieldType =
|
|
929
|
+
var FileFieldType = z10.enum([
|
|
917
930
|
FieldType.FILE,
|
|
918
931
|
FieldType.FILE_WITH_OPTIONS,
|
|
919
932
|
FieldType.SIGNATURE
|
|
@@ -949,164 +962,160 @@ var HiddenFieldTypes = [
|
|
|
949
962
|
];
|
|
950
963
|
|
|
951
964
|
// ../commons/src/events/FieldValue.ts
|
|
952
|
-
var
|
|
965
|
+
var z14 = __toESM(require("zod/v4"));
|
|
953
966
|
|
|
954
967
|
// ../commons/src/documents.ts
|
|
955
|
-
var
|
|
956
|
-
var FullDocumentUrl =
|
|
968
|
+
var z11 = __toESM(require("zod/v4"));
|
|
969
|
+
var FullDocumentUrl = z11.string().brand("FullDocumentUrl").describe(
|
|
957
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"
|
|
958
971
|
);
|
|
959
|
-
var FullDocumentPath =
|
|
972
|
+
var FullDocumentPath = z11.string().overwrite((val) => val.startsWith("/") ? val : `/${val}`).meta({ effectType: "input", type: "string" }).describe(
|
|
960
973
|
"A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
|
|
961
974
|
);
|
|
962
|
-
var DocumentPath =
|
|
975
|
+
var DocumentPath = z11.string().brand("DocumentPath").describe(
|
|
963
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."
|
|
964
977
|
);
|
|
965
978
|
|
|
966
979
|
// ../commons/src/events/CompositeFieldValue.ts
|
|
967
|
-
var
|
|
980
|
+
var z12 = __toESM(require("zod/v4"));
|
|
968
981
|
var AddressType = {
|
|
969
982
|
DOMESTIC: "DOMESTIC",
|
|
970
983
|
INTERNATIONAL: "INTERNATIONAL"
|
|
971
984
|
};
|
|
972
|
-
var FileFieldValue =
|
|
985
|
+
var FileFieldValue = z12.object({
|
|
973
986
|
path: DocumentPath,
|
|
974
|
-
originalFilename:
|
|
975
|
-
type:
|
|
976
|
-
});
|
|
977
|
-
var NameFieldValue =
|
|
978
|
-
firstname:
|
|
979
|
-
surname:
|
|
980
|
-
middlename:
|
|
981
|
-
});
|
|
982
|
-
var NameFieldUpdateValue =
|
|
983
|
-
firstname:
|
|
984
|
-
surname:
|
|
985
|
-
middlename:
|
|
986
|
-
}).or(
|
|
987
|
-
var StreetLevelDetailsValue =
|
|
988
|
-
var StreetLevelDetailsUpdateValue =
|
|
989
|
-
var BaseAddressFieldValue =
|
|
990
|
-
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(),
|
|
991
1004
|
streetLevelDetails: StreetLevelDetailsValue
|
|
992
1005
|
});
|
|
993
|
-
var BaseAddressFieldUpdateValue =
|
|
994
|
-
country:
|
|
1006
|
+
var BaseAddressFieldUpdateValue = z12.object({
|
|
1007
|
+
country: z12.string().nullish(),
|
|
995
1008
|
streetLevelDetails: StreetLevelDetailsUpdateValue
|
|
996
1009
|
});
|
|
997
1010
|
var DomesticAddressFieldValue = BaseAddressFieldValue.extend({
|
|
998
|
-
addressType:
|
|
999
|
-
administrativeArea:
|
|
1011
|
+
addressType: z12.literal(AddressType.DOMESTIC),
|
|
1012
|
+
administrativeArea: z12.string().uuid()
|
|
1000
1013
|
});
|
|
1001
1014
|
var InternationalAddressFieldValue = BaseAddressFieldValue.extend({
|
|
1002
|
-
addressType:
|
|
1015
|
+
addressType: z12.literal(AddressType.INTERNATIONAL)
|
|
1003
1016
|
});
|
|
1004
|
-
var AddressFieldValue =
|
|
1017
|
+
var AddressFieldValue = z12.discriminatedUnion("addressType", [
|
|
1005
1018
|
DomesticAddressFieldValue,
|
|
1006
1019
|
InternationalAddressFieldValue
|
|
1007
1020
|
]);
|
|
1008
1021
|
var DomesticAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend({
|
|
1009
|
-
addressType:
|
|
1010
|
-
administrativeArea:
|
|
1022
|
+
addressType: z12.literal(AddressType.DOMESTIC),
|
|
1023
|
+
administrativeArea: z12.string().uuid().nullish()
|
|
1011
1024
|
/* Leaf level admin structure */
|
|
1012
1025
|
});
|
|
1013
1026
|
var InternationalAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend(
|
|
1014
1027
|
{
|
|
1015
|
-
addressType:
|
|
1028
|
+
addressType: z12.literal(AddressType.INTERNATIONAL)
|
|
1016
1029
|
}
|
|
1017
1030
|
);
|
|
1018
|
-
var AddressFieldUpdateValue =
|
|
1031
|
+
var AddressFieldUpdateValue = z12.discriminatedUnion("addressType", [
|
|
1019
1032
|
DomesticAddressUpdateFieldValue,
|
|
1020
1033
|
InternationalAddressUpdateFieldValue
|
|
1021
1034
|
]).nullish();
|
|
1022
|
-
var FileFieldValueWithOption =
|
|
1035
|
+
var FileFieldValueWithOption = z12.object({
|
|
1023
1036
|
path: DocumentPath,
|
|
1024
|
-
originalFilename:
|
|
1025
|
-
type:
|
|
1026
|
-
option:
|
|
1027
|
-
});
|
|
1028
|
-
var FileFieldWithOptionValue =
|
|
1029
|
-
var HttpFieldValue =
|
|
1030
|
-
loading:
|
|
1031
|
-
error:
|
|
1032
|
-
data:
|
|
1033
|
-
});
|
|
1034
|
-
var HttpFieldUpdateValue =
|
|
1035
|
-
loading:
|
|
1036
|
-
error:
|
|
1037
|
-
data:
|
|
1038
|
-
}).or(
|
|
1039
|
-
var QueryParamReaderFieldValue =
|
|
1040
|
-
data:
|
|
1041
|
-
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()
|
|
1042
1055
|
}).nullish();
|
|
1043
|
-
var QueryParamReaderFieldUpdateValue =
|
|
1044
|
-
data:
|
|
1056
|
+
var QueryParamReaderFieldUpdateValue = z12.object({
|
|
1057
|
+
data: z12.record(z12.string(), z12.string())
|
|
1045
1058
|
});
|
|
1046
|
-
var ReadDataValue =
|
|
1047
|
-
data:
|
|
1059
|
+
var ReadDataValue = z12.object({
|
|
1060
|
+
data: z12.any()
|
|
1048
1061
|
});
|
|
1049
1062
|
var QrReaderFieldValue = ReadDataValue;
|
|
1050
1063
|
var IdReaderFieldValue = ReadDataValue;
|
|
1051
|
-
var NumberWithUnitFieldValue =
|
|
1052
|
-
numericValue:
|
|
1053
|
-
unit:
|
|
1064
|
+
var NumberWithUnitFieldValue = z12.object({
|
|
1065
|
+
numericValue: z12.number(),
|
|
1066
|
+
unit: z12.string()
|
|
1054
1067
|
});
|
|
1055
|
-
var NumberWithUnitFieldUpdateValue =
|
|
1056
|
-
numericValue:
|
|
1057
|
-
unit:
|
|
1068
|
+
var NumberWithUnitFieldUpdateValue = z12.object({
|
|
1069
|
+
numericValue: z12.number().optional(),
|
|
1070
|
+
unit: z12.string().optional()
|
|
1058
1071
|
});
|
|
1059
|
-
var CustomFieldValue =
|
|
1072
|
+
var CustomFieldValue = z12.unknown().brand("CustomFieldValue");
|
|
1060
1073
|
|
|
1061
1074
|
// ../commons/src/events/PlainDate.ts
|
|
1062
1075
|
var import_zod = require("zod");
|
|
1063
1076
|
var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date in the format YYYY-MM-DD");
|
|
1064
|
-
function plainDateToLocalDate(date) {
|
|
1065
|
-
const [year, month, day] = date.split("-").map(Number);
|
|
1066
|
-
return new Date(year, month - 1, day);
|
|
1067
|
-
}
|
|
1068
1077
|
|
|
1069
1078
|
// ../commons/src/events/FieldValue.ts
|
|
1070
|
-
var TextValue =
|
|
1071
|
-
var HiddenFieldValue =
|
|
1072
|
-
var NonEmptyTextValue =
|
|
1073
|
-
var DateValue =
|
|
1074
|
-
var AgeValue =
|
|
1075
|
-
age:
|
|
1076
|
-
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()
|
|
1077
1086
|
});
|
|
1078
1087
|
var AgeUpdateValue = AgeValue.optional().nullable();
|
|
1079
|
-
var AutocompleteValue =
|
|
1080
|
-
label:
|
|
1081
|
-
value:
|
|
1088
|
+
var AutocompleteValue = z14.object({
|
|
1089
|
+
label: z14.string(),
|
|
1090
|
+
value: z14.string()
|
|
1082
1091
|
});
|
|
1083
1092
|
var AutocompleteUpdateValue = AutocompleteValue.optional().nullable();
|
|
1084
|
-
var TimeValue =
|
|
1085
|
-
var DatetimeValue =
|
|
1086
|
-
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([
|
|
1087
1096
|
"last7Days",
|
|
1088
1097
|
"last30Days",
|
|
1089
1098
|
"last90Days",
|
|
1090
1099
|
"last365Days"
|
|
1091
1100
|
]);
|
|
1092
|
-
var DateRangeFieldValue =
|
|
1101
|
+
var DateRangeFieldValue = z14.object({
|
|
1093
1102
|
start: PlainDate,
|
|
1094
1103
|
end: PlainDate
|
|
1095
1104
|
}).or(PlainDate).describe(
|
|
1096
1105
|
"Date range with start and end dates in the format YYYY-MM-DD. Inclusive start, exclusive end."
|
|
1097
1106
|
);
|
|
1098
|
-
var EmailValue =
|
|
1099
|
-
var CheckboxFieldValue =
|
|
1100
|
-
var NumberFieldValue =
|
|
1107
|
+
var EmailValue = z14.email();
|
|
1108
|
+
var CheckboxFieldValue = z14.boolean();
|
|
1109
|
+
var NumberFieldValue = z14.number();
|
|
1101
1110
|
var SignatureFieldValue = FileFieldValue;
|
|
1102
|
-
var ButtonFieldValue =
|
|
1103
|
-
var VerificationStatusValue =
|
|
1111
|
+
var ButtonFieldValue = z14.number();
|
|
1112
|
+
var VerificationStatusValue = z14.enum([
|
|
1104
1113
|
"verified",
|
|
1105
1114
|
"authenticated",
|
|
1106
1115
|
"failed",
|
|
1107
1116
|
"pending"
|
|
1108
1117
|
]);
|
|
1109
|
-
var LeafFieldValues =
|
|
1118
|
+
var LeafFieldValues = z14.union([
|
|
1110
1119
|
AddressFieldValue,
|
|
1111
1120
|
TextValue,
|
|
1112
1121
|
PlainDate,
|
|
@@ -1132,11 +1141,11 @@ var LeafFieldValues = z13.union([
|
|
|
1132
1141
|
AutocompleteValue,
|
|
1133
1142
|
AutocompleteUpdateValue
|
|
1134
1143
|
]);
|
|
1135
|
-
var FieldGroupValue =
|
|
1136
|
-
var DataFieldValue =
|
|
1137
|
-
data:
|
|
1144
|
+
var FieldGroupValue = z14.record(z14.string(), LeafFieldValues);
|
|
1145
|
+
var DataFieldValue = z14.object({
|
|
1146
|
+
data: z14.record(z14.string(), LeafFieldValues)
|
|
1138
1147
|
}).nullish();
|
|
1139
|
-
var FieldValue =
|
|
1148
|
+
var FieldValue = z14.union([
|
|
1140
1149
|
LeafFieldValues,
|
|
1141
1150
|
DataFieldValue,
|
|
1142
1151
|
FieldGroupValue
|
|
@@ -1170,7 +1179,7 @@ function safeUnion(schemas) {
|
|
|
1170
1179
|
const sortedSchemas = [...schemas].sort(
|
|
1171
1180
|
(a, b) => schemaPriority(a) - schemaPriority(b)
|
|
1172
1181
|
);
|
|
1173
|
-
return
|
|
1182
|
+
return z14.any().superRefine((val, ctx) => {
|
|
1174
1183
|
for (const schema of sortedSchemas) {
|
|
1175
1184
|
if (schema.safeParse(val).success) {
|
|
1176
1185
|
return;
|
|
@@ -1209,9 +1218,9 @@ var FieldUpdateValue = safeUnion([
|
|
|
1209
1218
|
]);
|
|
1210
1219
|
|
|
1211
1220
|
// ../commons/src/events/serializers/user/serializer.ts
|
|
1212
|
-
var
|
|
1213
|
-
var SerializedUserField =
|
|
1214
|
-
$userField:
|
|
1221
|
+
var z15 = __toESM(require("zod/v4"));
|
|
1222
|
+
var SerializedUserField = z15.object({
|
|
1223
|
+
$userField: z15.enum([
|
|
1215
1224
|
"id",
|
|
1216
1225
|
"name",
|
|
1217
1226
|
"role",
|
|
@@ -1225,7 +1234,7 @@ var SerializedUserField = z14.object({
|
|
|
1225
1234
|
"primaryOfficeId",
|
|
1226
1235
|
"administrativeAreaId"
|
|
1227
1236
|
]),
|
|
1228
|
-
$location:
|
|
1237
|
+
$location: z15.string().optional()
|
|
1229
1238
|
});
|
|
1230
1239
|
function userSerializer(userField) {
|
|
1231
1240
|
return {
|
|
@@ -1248,25 +1257,25 @@ function userSerializer(userField) {
|
|
|
1248
1257
|
var import_v4 = require("zod/v4");
|
|
1249
1258
|
|
|
1250
1259
|
// ../commons/src/events/EventMetadata.ts
|
|
1251
|
-
var
|
|
1260
|
+
var z17 = __toESM(require("zod/v4"));
|
|
1252
1261
|
|
|
1253
1262
|
// ../commons/src/events/ActionDocument.ts
|
|
1254
|
-
var
|
|
1255
|
-
var ActionUpdate =
|
|
1263
|
+
var z16 = __toESM(require("zod/v4"));
|
|
1264
|
+
var ActionUpdate = z16.record(z16.string(), FieldUpdateValue).describe(
|
|
1256
1265
|
"Record of field-level changes made by an action. Supports partial updates and nullable values."
|
|
1257
1266
|
);
|
|
1258
|
-
var EventState =
|
|
1267
|
+
var EventState = z16.record(z16.string(), FieldValue).describe(
|
|
1259
1268
|
"Aggregate representation of event data after all actions have been applied, with all updates consolidated and null values removed."
|
|
1260
1269
|
);
|
|
1261
|
-
var ActionBase =
|
|
1270
|
+
var ActionBase = z16.object({
|
|
1262
1271
|
id: UUID.describe("Unique identifier of the action."),
|
|
1263
|
-
transactionId:
|
|
1272
|
+
transactionId: z16.string().describe("Unique identifier of the transaction."),
|
|
1264
1273
|
createdByUserType: TokenUserType.describe(
|
|
1265
1274
|
"Indicates whether the action was created by a human-user or by a system-user."
|
|
1266
1275
|
),
|
|
1267
|
-
createdAt:
|
|
1268
|
-
createdBy:
|
|
1269
|
-
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."),
|
|
1270
1279
|
createdBySignature: DocumentPath.nullish().describe(
|
|
1271
1280
|
"Reference to the signature of the user who created the action."
|
|
1272
1281
|
),
|
|
@@ -1278,7 +1287,7 @@ var ActionBase = z15.object({
|
|
|
1278
1287
|
"Declaration data defined by the ActionConfig. Supports partial updates."
|
|
1279
1288
|
),
|
|
1280
1289
|
annotation: ActionUpdate.optional().nullable().describe("Action-specific metadata used to annotate the event."),
|
|
1281
|
-
status:
|
|
1290
|
+
status: z16.enum([
|
|
1282
1291
|
ActionStatus.Requested,
|
|
1283
1292
|
ActionStatus.Accepted,
|
|
1284
1293
|
ActionStatus.Rejected
|
|
@@ -1290,139 +1299,143 @@ var ActionBase = z15.object({
|
|
|
1290
1299
|
)
|
|
1291
1300
|
});
|
|
1292
1301
|
var AssignedAction = ActionBase.extend(
|
|
1293
|
-
|
|
1294
|
-
type:
|
|
1295
|
-
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.")
|
|
1296
1305
|
// TODO move into 'content' property
|
|
1297
1306
|
}).shape
|
|
1298
1307
|
);
|
|
1299
1308
|
var UnassignedAction = ActionBase.extend(
|
|
1300
|
-
|
|
1301
|
-
type:
|
|
1309
|
+
z16.object({
|
|
1310
|
+
type: z16.literal(ActionType.UNASSIGN)
|
|
1302
1311
|
}).shape
|
|
1303
1312
|
);
|
|
1304
1313
|
var RegisterAction = ActionBase.extend(
|
|
1305
|
-
|
|
1306
|
-
type:
|
|
1307
|
-
registrationNumber:
|
|
1314
|
+
z16.object({
|
|
1315
|
+
type: z16.literal(ActionType.REGISTER),
|
|
1316
|
+
registrationNumber: z16.string().optional().describe(
|
|
1308
1317
|
"Registration number of the event. Always present for accepted registrations."
|
|
1309
1318
|
)
|
|
1310
1319
|
// TODO move into 'content' property
|
|
1311
1320
|
}).shape
|
|
1312
1321
|
);
|
|
1313
1322
|
var DeclareAction = ActionBase.extend(
|
|
1314
|
-
|
|
1315
|
-
type:
|
|
1323
|
+
z16.object({
|
|
1324
|
+
type: z16.literal(ActionType.DECLARE)
|
|
1316
1325
|
}).shape
|
|
1317
1326
|
);
|
|
1318
|
-
var ReasonContent =
|
|
1319
|
-
reason:
|
|
1327
|
+
var ReasonContent = z16.object({
|
|
1328
|
+
reason: z16.string().min(1, { error: "Message cannot be empty" }).describe(
|
|
1320
1329
|
"Message describing the reason for rejecting or archiving the event."
|
|
1321
1330
|
)
|
|
1322
1331
|
});
|
|
1323
1332
|
var RejectAction = ActionBase.extend(
|
|
1324
|
-
|
|
1325
|
-
type:
|
|
1333
|
+
z16.object({
|
|
1334
|
+
type: z16.literal(ActionType.REJECT),
|
|
1326
1335
|
content: ReasonContent
|
|
1327
1336
|
}).shape
|
|
1328
1337
|
);
|
|
1329
|
-
var PotentialDuplicate =
|
|
1338
|
+
var PotentialDuplicate = z16.object({
|
|
1330
1339
|
id: UUID,
|
|
1331
|
-
trackingId:
|
|
1340
|
+
trackingId: z16.string()
|
|
1332
1341
|
});
|
|
1333
1342
|
var DuplicateDetectedAction = ActionBase.extend(
|
|
1334
|
-
|
|
1335
|
-
type:
|
|
1336
|
-
content:
|
|
1337
|
-
duplicates:
|
|
1343
|
+
z16.object({
|
|
1344
|
+
type: z16.literal(ActionType.DUPLICATE_DETECTED),
|
|
1345
|
+
content: z16.object({
|
|
1346
|
+
duplicates: z16.array(PotentialDuplicate)
|
|
1338
1347
|
})
|
|
1339
1348
|
}).shape
|
|
1340
1349
|
);
|
|
1341
1350
|
var MarkNotDuplicateAction = ActionBase.extend(
|
|
1342
|
-
|
|
1343
|
-
type:
|
|
1351
|
+
z16.object({
|
|
1352
|
+
type: z16.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
1344
1353
|
}).shape
|
|
1345
1354
|
);
|
|
1346
1355
|
var MarkAsDuplicateAction = ActionBase.extend(
|
|
1347
|
-
|
|
1348
|
-
type:
|
|
1349
|
-
content:
|
|
1356
|
+
z16.object({
|
|
1357
|
+
type: z16.literal(ActionType.MARK_AS_DUPLICATE),
|
|
1358
|
+
content: z16.object({
|
|
1350
1359
|
duplicateOf: UUID
|
|
1351
1360
|
}).optional()
|
|
1352
1361
|
}).shape
|
|
1353
1362
|
);
|
|
1354
1363
|
var ArchiveAction = ActionBase.extend(
|
|
1355
|
-
|
|
1356
|
-
type:
|
|
1357
|
-
|
|
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()
|
|
1358
1371
|
}).shape
|
|
1359
1372
|
);
|
|
1360
1373
|
var UnarchiveAction = ActionBase.extend(
|
|
1361
|
-
|
|
1362
|
-
type:
|
|
1374
|
+
z16.object({
|
|
1375
|
+
type: z16.literal(ActionType.UNARCHIVE)
|
|
1363
1376
|
}).shape
|
|
1364
1377
|
);
|
|
1365
1378
|
var CreatedAction = ActionBase.extend(
|
|
1366
|
-
|
|
1367
|
-
type:
|
|
1379
|
+
z16.object({
|
|
1380
|
+
type: z16.literal(ActionType.CREATE)
|
|
1368
1381
|
}).shape
|
|
1369
1382
|
);
|
|
1370
1383
|
var NotifiedAction = ActionBase.extend(
|
|
1371
|
-
|
|
1372
|
-
type:
|
|
1384
|
+
z16.object({
|
|
1385
|
+
type: z16.literal(ActionType.NOTIFY)
|
|
1373
1386
|
}).shape
|
|
1374
1387
|
);
|
|
1375
1388
|
var EditAction = ActionBase.extend(
|
|
1376
|
-
|
|
1377
|
-
type:
|
|
1389
|
+
z16.object({
|
|
1390
|
+
type: z16.literal(ActionType.EDIT),
|
|
1378
1391
|
/** @deprecated New Edit-actions should no longer contain content. This is kept for old 2.0 edits. */
|
|
1379
|
-
content:
|
|
1380
|
-
comment:
|
|
1392
|
+
content: z16.object({
|
|
1393
|
+
comment: z16.string().describe("Comment for the edit action.").optional()
|
|
1381
1394
|
}).optional()
|
|
1382
1395
|
}).shape
|
|
1383
1396
|
);
|
|
1384
|
-
var PrintContent =
|
|
1385
|
-
templateId:
|
|
1397
|
+
var PrintContent = z16.object({
|
|
1398
|
+
templateId: z16.string().optional()
|
|
1386
1399
|
});
|
|
1387
1400
|
var PrintCertificateAction = ActionBase.extend(
|
|
1388
|
-
|
|
1389
|
-
type:
|
|
1401
|
+
z16.object({
|
|
1402
|
+
type: z16.literal(ActionType.PRINT_CERTIFICATE),
|
|
1390
1403
|
content: PrintContent.optional().nullable()
|
|
1391
1404
|
}).shape
|
|
1392
1405
|
);
|
|
1393
1406
|
var RequestedCorrectionAction = ActionBase.extend(
|
|
1394
|
-
|
|
1395
|
-
type:
|
|
1407
|
+
z16.object({
|
|
1408
|
+
type: z16.literal(ActionType.REQUEST_CORRECTION)
|
|
1396
1409
|
}).shape
|
|
1397
1410
|
);
|
|
1398
1411
|
var ApprovedCorrectionAction = ActionBase.extend(
|
|
1399
|
-
|
|
1400
|
-
type:
|
|
1401
|
-
requestId:
|
|
1412
|
+
z16.object({
|
|
1413
|
+
type: z16.literal(ActionType.APPROVE_CORRECTION),
|
|
1414
|
+
requestId: z16.string(),
|
|
1402
1415
|
// TODO move into 'content' property
|
|
1403
|
-
content:
|
|
1416
|
+
content: z16.object({ immediateCorrection: z16.boolean().optional() }).optional()
|
|
1404
1417
|
}).shape
|
|
1405
1418
|
);
|
|
1406
1419
|
var RejectedCorrectionAction = ActionBase.extend(
|
|
1407
|
-
|
|
1408
|
-
type:
|
|
1409
|
-
requestId:
|
|
1420
|
+
z16.object({
|
|
1421
|
+
type: z16.literal(ActionType.REJECT_CORRECTION),
|
|
1422
|
+
requestId: z16.string(),
|
|
1410
1423
|
// TODO move into 'content' property
|
|
1411
1424
|
content: ReasonContent
|
|
1412
1425
|
}).shape
|
|
1413
1426
|
);
|
|
1414
1427
|
var ReadAction = ActionBase.extend(
|
|
1415
|
-
|
|
1416
|
-
type:
|
|
1428
|
+
z16.object({
|
|
1429
|
+
type: z16.literal(ActionType.READ)
|
|
1417
1430
|
}).shape
|
|
1418
1431
|
);
|
|
1419
1432
|
var CustomAction = ActionBase.merge(
|
|
1420
|
-
|
|
1421
|
-
type:
|
|
1422
|
-
customActionType:
|
|
1433
|
+
z16.object({
|
|
1434
|
+
type: z16.literal(ActionType.CUSTOM),
|
|
1435
|
+
customActionType: z16.string()
|
|
1423
1436
|
})
|
|
1424
1437
|
);
|
|
1425
|
-
var ActionDocument =
|
|
1438
|
+
var ActionDocument = z16.discriminatedUnion("type", [
|
|
1426
1439
|
CreatedAction.meta({ id: "CreatedAction" }),
|
|
1427
1440
|
RejectAction.meta({ id: "RejectAction" }),
|
|
1428
1441
|
DuplicateDetectedAction.meta({ id: "DuplicateDetectedAction" }),
|
|
@@ -1449,57 +1462,50 @@ var AsyncRejectActionDocument = ActionBase.omit({
|
|
|
1449
1462
|
declaration: true,
|
|
1450
1463
|
annotation: true
|
|
1451
1464
|
}).extend(
|
|
1452
|
-
|
|
1453
|
-
type:
|
|
1454
|
-
status:
|
|
1465
|
+
z16.object({
|
|
1466
|
+
type: z16.enum(ConfirmableActions),
|
|
1467
|
+
status: z16.literal(ActionStatus.Rejected)
|
|
1455
1468
|
}).shape
|
|
1456
1469
|
);
|
|
1457
|
-
var Action =
|
|
1470
|
+
var Action = z16.union([ActionDocument, AsyncRejectActionDocument]);
|
|
1458
1471
|
|
|
1459
1472
|
// ../commons/src/events/EventMetadata.ts
|
|
1460
|
-
var
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
"
|
|
1464
|
-
"
|
|
1465
|
-
"ARCHIVED"
|
|
1466
|
-
]);
|
|
1467
|
-
var ZodDate = z16.iso.date();
|
|
1468
|
-
var ZodDateTime = z16.string().datetime();
|
|
1469
|
-
var ActionCreationMetadata = z16.object({
|
|
1470
|
-
createdAt: z16.iso.datetime().describe("The timestamp when the action request was created."),
|
|
1471
|
-
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."),
|
|
1472
1478
|
// @TODO: createdAtLocation should be non-nullable in the future once all action requests have this field populated.
|
|
1473
1479
|
createdAtLocation: UUID.nullish().describe(
|
|
1474
1480
|
"Location of the user who created the action request."
|
|
1475
1481
|
),
|
|
1476
|
-
createdByUserType:
|
|
1477
|
-
acceptedAt:
|
|
1478
|
-
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.")
|
|
1479
1485
|
});
|
|
1480
1486
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
1481
|
-
registrationNumber:
|
|
1487
|
+
registrationNumber: z17.string().describe(
|
|
1482
1488
|
"Registration number of the event. Always present for accepted registrations."
|
|
1483
1489
|
)
|
|
1484
1490
|
});
|
|
1485
|
-
var LegalStatuses =
|
|
1491
|
+
var LegalStatuses = z17.object({
|
|
1486
1492
|
[EventStatus.enum.NOTIFIED]: ActionCreationMetadata.nullish(),
|
|
1487
1493
|
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
|
1488
1494
|
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
|
1489
1495
|
});
|
|
1490
|
-
var EventMetadata =
|
|
1496
|
+
var EventMetadata = z17.object({
|
|
1491
1497
|
id: UUID,
|
|
1492
|
-
type:
|
|
1498
|
+
type: z17.string().describe("The type of event, such as birth, death, or marriage."),
|
|
1493
1499
|
status: EventStatus,
|
|
1494
1500
|
legalStatuses: LegalStatuses.describe(
|
|
1495
1501
|
"Metadata related to the legal registration of the event, such as who registered it and when."
|
|
1496
1502
|
),
|
|
1497
|
-
createdAt:
|
|
1503
|
+
createdAt: z17.iso.datetime().describe("The timestamp when the event was first created and saved."),
|
|
1498
1504
|
dateOfEvent: ZodDate.nullish(),
|
|
1499
1505
|
placeOfEvent: UUID.nullish(),
|
|
1500
|
-
createdBy:
|
|
1501
|
-
createdByUserType:
|
|
1502
|
-
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."),
|
|
1503
1509
|
// @TODO: createdAtLocation should be non-nullable in the future once all action requests have this field populated.
|
|
1504
1510
|
createdAtLocation: UUID.nullish().describe(
|
|
1505
1511
|
"Location of the user who created the event."
|
|
@@ -1507,18 +1513,18 @@ var EventMetadata = z16.object({
|
|
|
1507
1513
|
updatedAtLocation: UUID.nullish().describe(
|
|
1508
1514
|
"Location of the user who last changed the status."
|
|
1509
1515
|
),
|
|
1510
|
-
updatedAt:
|
|
1516
|
+
updatedAt: z17.iso.datetime().describe(
|
|
1511
1517
|
"Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
|
|
1512
1518
|
),
|
|
1513
|
-
assignedTo:
|
|
1514
|
-
updatedBy:
|
|
1515
|
-
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(
|
|
1516
1522
|
"System-generated tracking ID used by informants or registrars to look up the event."
|
|
1517
1523
|
),
|
|
1518
|
-
potentialDuplicates:
|
|
1524
|
+
potentialDuplicates: z17.array(PotentialDuplicate).describe(
|
|
1519
1525
|
"List of event IDs and their tracking IDs that this event could be a duplicate of."
|
|
1520
1526
|
),
|
|
1521
|
-
flags:
|
|
1527
|
+
flags: z17.array(Flag)
|
|
1522
1528
|
});
|
|
1523
1529
|
var EventMetadataKeysArray = [
|
|
1524
1530
|
"id",
|
|
@@ -1539,8 +1545,8 @@ var EventMetadataKeysArray = [
|
|
|
1539
1545
|
"legalStatuses",
|
|
1540
1546
|
"flags"
|
|
1541
1547
|
];
|
|
1542
|
-
var EventMetadataKeys =
|
|
1543
|
-
var EventMetadataDateFieldIdInput =
|
|
1548
|
+
var EventMetadataKeys = z17.enum(EventMetadataKeysArray);
|
|
1549
|
+
var EventMetadataDateFieldIdInput = z17.enum([
|
|
1544
1550
|
"createdAt",
|
|
1545
1551
|
"updatedAt",
|
|
1546
1552
|
"legalStatuses.NOTIFIED.createdAt",
|
|
@@ -1550,7 +1556,7 @@ var EventMetadataDateFieldIdInput = z16.enum([
|
|
|
1550
1556
|
"legalStatuses.REGISTERED.createdAt",
|
|
1551
1557
|
"legalStatuses.REGISTERED.acceptedAt"
|
|
1552
1558
|
]);
|
|
1553
|
-
var EventMetadataDateFieldId =
|
|
1559
|
+
var EventMetadataDateFieldId = z17.enum([
|
|
1554
1560
|
"event.createdAt",
|
|
1555
1561
|
"event.updatedAt",
|
|
1556
1562
|
"event.legalStatuses.NOTIFIED.createdAt",
|
|
@@ -2238,11 +2244,11 @@ var AdministrativeAreaField = BaseField.extend({
|
|
|
2238
2244
|
partOf: FieldReference.optional().describe("Parent location"),
|
|
2239
2245
|
type: AdministrativeAreas,
|
|
2240
2246
|
allowedLocations: AllowedLocations,
|
|
2241
|
-
listHistoricalNames: import_v43.default.boolean().optional().describe(
|
|
2242
|
-
"Advanced search: list every historical name a location has had as a separate, selectable option."
|
|
2243
|
-
),
|
|
2244
2247
|
activeOnly: import_v43.default.boolean().optional().describe(
|
|
2245
|
-
"
|
|
2248
|
+
"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."
|
|
2249
|
+
),
|
|
2250
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional().describe(
|
|
2251
|
+
"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."
|
|
2246
2252
|
)
|
|
2247
2253
|
}).describe("Administrative area options")
|
|
2248
2254
|
}).meta({
|
|
@@ -2255,8 +2261,11 @@ var LocationInput = BaseField.extend({
|
|
|
2255
2261
|
configuration: import_v43.default.object({
|
|
2256
2262
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
2257
2263
|
allowedLocations: AllowedLocations,
|
|
2258
|
-
|
|
2259
|
-
"
|
|
2264
|
+
activeOnly: import_v43.default.boolean().optional().describe(
|
|
2265
|
+
"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."
|
|
2266
|
+
),
|
|
2267
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional().describe(
|
|
2268
|
+
"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."
|
|
2260
2269
|
)
|
|
2261
2270
|
}).optional()
|
|
2262
2271
|
}).meta({
|
|
@@ -2285,7 +2294,8 @@ var Facility = BaseField.extend({
|
|
|
2285
2294
|
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
2286
2295
|
configuration: import_v43.default.object({
|
|
2287
2296
|
allowedLocations: AllowedLocations,
|
|
2288
|
-
|
|
2297
|
+
activeOnly: import_v43.default.boolean().optional(),
|
|
2298
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional()
|
|
2289
2299
|
}).optional()
|
|
2290
2300
|
}).describe("Input field for a facility");
|
|
2291
2301
|
var Office = BaseField.extend({
|
|
@@ -2293,7 +2303,8 @@ var Office = BaseField.extend({
|
|
|
2293
2303
|
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
2294
2304
|
configuration: import_v43.default.object({
|
|
2295
2305
|
allowedLocations: AllowedLocations,
|
|
2296
|
-
|
|
2306
|
+
activeOnly: import_v43.default.boolean().optional(),
|
|
2307
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional()
|
|
2297
2308
|
}).optional()
|
|
2298
2309
|
}).describe("Input field for an office");
|
|
2299
2310
|
var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
|
|
@@ -2328,11 +2339,11 @@ var Address = BaseField.extend({
|
|
|
2328
2339
|
})
|
|
2329
2340
|
).optional(),
|
|
2330
2341
|
allowedLocations: AllowedLocations,
|
|
2331
|
-
listHistoricalNames: import_v43.default.boolean().optional().describe(
|
|
2332
|
-
"Advanced search: list every historical name a location has had as a separate, selectable option. Propagated to the embedded admin-area selectors."
|
|
2333
|
-
),
|
|
2334
2342
|
activeOnly: import_v43.default.boolean().optional().describe(
|
|
2335
|
-
"
|
|
2343
|
+
"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."
|
|
2344
|
+
),
|
|
2345
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional().describe(
|
|
2346
|
+
"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."
|
|
2336
2347
|
)
|
|
2337
2348
|
}).optional(),
|
|
2338
2349
|
defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
|
|
@@ -2388,10 +2399,19 @@ var ButtonField = BaseField.extend({
|
|
|
2388
2399
|
description: "A generic button that can be used to trigger an action",
|
|
2389
2400
|
id: "ButtonField"
|
|
2390
2401
|
});
|
|
2402
|
+
var FieldGroupConfiguration = import_v43.default.object({
|
|
2403
|
+
separator: import_v43.default.string().optional().describe(
|
|
2404
|
+
'Joins the subfield values when the group is rendered as output, e.g. ", ". Defaults to one subfield per line.'
|
|
2405
|
+
),
|
|
2406
|
+
hideEmptyFields: import_v43.default.boolean().default(false).optional().describe(
|
|
2407
|
+
"Leaves subfields without a value out of the output. Pair it with a separator so the separator does not double up around the gaps."
|
|
2408
|
+
)
|
|
2409
|
+
});
|
|
2391
2410
|
var FieldGroup = BaseField.extend({
|
|
2392
2411
|
type: import_v43.default.literal(FieldType.FIELD_GROUP),
|
|
2393
2412
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2394
|
-
fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig))
|
|
2413
|
+
fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig)),
|
|
2414
|
+
configuration: FieldGroupConfiguration.optional()
|
|
2395
2415
|
}).meta({
|
|
2396
2416
|
description: "A group of fields that are displayed together",
|
|
2397
2417
|
id: "FieldGroup"
|
|
@@ -2634,18 +2654,18 @@ var AnyFileField = import_v43.default.discriminatedUnion("type", [
|
|
|
2634
2654
|
]);
|
|
2635
2655
|
|
|
2636
2656
|
// ../commons/src/events/FormConfig.ts
|
|
2637
|
-
var
|
|
2657
|
+
var z23 = __toESM(require("zod/v4"));
|
|
2638
2658
|
|
|
2639
2659
|
// ../commons/src/events/PageConfig.ts
|
|
2640
|
-
var
|
|
2641
|
-
var PageTypes =
|
|
2642
|
-
var PageConfigBase =
|
|
2643
|
-
id:
|
|
2660
|
+
var z22 = __toESM(require("zod/v4"));
|
|
2661
|
+
var PageTypes = z22.enum(["FORM", "VERIFICATION"]);
|
|
2662
|
+
var PageConfigBase = z22.object({
|
|
2663
|
+
id: z22.string().describe("Unique identifier for the page"),
|
|
2644
2664
|
title: TranslationConfig.describe("Header title of the page"),
|
|
2645
|
-
requireCompletionToContinue:
|
|
2665
|
+
requireCompletionToContinue: z22.boolean().default(false).describe(
|
|
2646
2666
|
"If true, all required fields must be filled before continuing to the next page"
|
|
2647
2667
|
),
|
|
2648
|
-
fields:
|
|
2668
|
+
fields: z22.array(FieldConfig).describe("Fields to be rendered on the page"),
|
|
2649
2669
|
conditional: Conditional.optional().describe(
|
|
2650
2670
|
"Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
|
|
2651
2671
|
)
|
|
@@ -2654,13 +2674,13 @@ var PageConfigBase = z21.object({
|
|
|
2654
2674
|
id: "FormPageConfig"
|
|
2655
2675
|
});
|
|
2656
2676
|
var FormPageConfig = PageConfigBase.extend({
|
|
2657
|
-
type:
|
|
2677
|
+
type: z22.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
|
|
2658
2678
|
});
|
|
2659
|
-
var VerificationActionConfig =
|
|
2660
|
-
verify:
|
|
2661
|
-
cancel:
|
|
2679
|
+
var VerificationActionConfig = z22.object({
|
|
2680
|
+
verify: z22.object({ label: TranslationConfig }),
|
|
2681
|
+
cancel: z22.object({
|
|
2662
2682
|
label: TranslationConfig,
|
|
2663
|
-
confirmation:
|
|
2683
|
+
confirmation: z22.object({
|
|
2664
2684
|
title: TranslationConfig,
|
|
2665
2685
|
body: TranslationConfig
|
|
2666
2686
|
})
|
|
@@ -2670,34 +2690,34 @@ var VerificationActionConfig = z21.object({
|
|
|
2670
2690
|
id: "VerificationActionConfig"
|
|
2671
2691
|
});
|
|
2672
2692
|
var VerificationPageConfig = FormPageConfig.extend({
|
|
2673
|
-
type:
|
|
2693
|
+
type: z22.literal(PageTypes.enum.VERIFICATION),
|
|
2674
2694
|
actions: VerificationActionConfig
|
|
2675
2695
|
});
|
|
2676
|
-
var PageConfig =
|
|
2696
|
+
var PageConfig = z22.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
|
|
2677
2697
|
id: "PageConfig",
|
|
2678
2698
|
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."
|
|
2679
2699
|
});
|
|
2680
2700
|
|
|
2681
2701
|
// ../commons/src/events/FormConfig.ts
|
|
2682
|
-
var DeclarationFormConfig =
|
|
2702
|
+
var DeclarationFormConfig = z23.object({
|
|
2683
2703
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
2684
|
-
pages:
|
|
2704
|
+
pages: z23.array(FormPageConfig)
|
|
2685
2705
|
}).meta({
|
|
2686
2706
|
id: "DeclarationFormConfig",
|
|
2687
2707
|
description: "Configuration of the declaration form."
|
|
2688
2708
|
});
|
|
2689
|
-
var ActionFormConfig =
|
|
2709
|
+
var ActionFormConfig = z23.object({
|
|
2690
2710
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
2691
|
-
pages:
|
|
2711
|
+
pages: z23.array(PageConfig)
|
|
2692
2712
|
}).describe(
|
|
2693
2713
|
"Configuration of the form used for system actions beyond declaration, supporting a wider range of page types."
|
|
2694
2714
|
);
|
|
2695
|
-
var FormConfig =
|
|
2715
|
+
var FormConfig = z23.union([DeclarationFormConfig, ActionFormConfig]);
|
|
2696
2716
|
|
|
2697
2717
|
// ../commons/src/events/DeduplicationConfig.ts
|
|
2698
|
-
var
|
|
2699
|
-
var FieldReference2 =
|
|
2700
|
-
var Matcher =
|
|
2718
|
+
var z24 = __toESM(require("zod/v4"));
|
|
2719
|
+
var FieldReference2 = z24.string();
|
|
2720
|
+
var Matcher = z24.object({
|
|
2701
2721
|
/**
|
|
2702
2722
|
* Reference to the field used in matching.
|
|
2703
2723
|
*
|
|
@@ -2705,23 +2725,23 @@ var Matcher = z23.object({
|
|
|
2705
2725
|
* be used as the origin date to calculate the distance from.
|
|
2706
2726
|
*/
|
|
2707
2727
|
fieldId: FieldReference2,
|
|
2708
|
-
options:
|
|
2709
|
-
boost:
|
|
2728
|
+
options: z24.object({
|
|
2729
|
+
boost: z24.number().optional(),
|
|
2710
2730
|
matchAgainst: FieldReference2.optional()
|
|
2711
2731
|
}).optional().default({
|
|
2712
2732
|
boost: 1
|
|
2713
2733
|
})
|
|
2714
2734
|
});
|
|
2715
2735
|
var FuzzyMatcher = Matcher.extend({
|
|
2716
|
-
type:
|
|
2717
|
-
options:
|
|
2736
|
+
type: z24.literal("fuzzy"),
|
|
2737
|
+
options: z24.object({
|
|
2718
2738
|
/**
|
|
2719
2739
|
* Names of length 3 or less characters = 0 edits allowed
|
|
2720
2740
|
* Names of length 4 - 6 characters = 1 edit allowed
|
|
2721
2741
|
* Names of length >7 characters = 2 edits allowed
|
|
2722
2742
|
*/
|
|
2723
|
-
fuzziness:
|
|
2724
|
-
boost:
|
|
2743
|
+
fuzziness: z24.union([z24.string(), z24.number()]).optional().default("AUTO:4,7"),
|
|
2744
|
+
boost: z24.number().optional().default(1),
|
|
2725
2745
|
matchAgainst: FieldReference2.optional()
|
|
2726
2746
|
}).optional().default({
|
|
2727
2747
|
fuzziness: "AUTO:4,7",
|
|
@@ -2729,48 +2749,48 @@ var FuzzyMatcher = Matcher.extend({
|
|
|
2729
2749
|
})
|
|
2730
2750
|
});
|
|
2731
2751
|
var StrictMatcher = Matcher.extend({
|
|
2732
|
-
type:
|
|
2733
|
-
options:
|
|
2734
|
-
boost:
|
|
2752
|
+
type: z24.literal("strict"),
|
|
2753
|
+
options: z24.object({
|
|
2754
|
+
boost: z24.number().optional().default(1),
|
|
2735
2755
|
/**
|
|
2736
2756
|
* The constant value to be present in the field for both records
|
|
2737
2757
|
*/
|
|
2738
|
-
value:
|
|
2758
|
+
value: z24.string().optional(),
|
|
2739
2759
|
matchAgainst: FieldReference2.optional()
|
|
2740
2760
|
}).optional().default({
|
|
2741
2761
|
boost: 1
|
|
2742
2762
|
})
|
|
2743
2763
|
});
|
|
2744
2764
|
var DateRangeMatcher = Matcher.extend({
|
|
2745
|
-
type:
|
|
2746
|
-
options:
|
|
2765
|
+
type: z24.literal("dateRange"),
|
|
2766
|
+
options: z24.object({
|
|
2747
2767
|
/**
|
|
2748
2768
|
* The distance pivot in days. Distance from the origin (the value of
|
|
2749
2769
|
* fieldId) at which relevance scores receive half of the boost value
|
|
2750
2770
|
*/
|
|
2751
|
-
pivot:
|
|
2752
|
-
days:
|
|
2753
|
-
boost:
|
|
2771
|
+
pivot: z24.number().optional(),
|
|
2772
|
+
days: z24.number(),
|
|
2773
|
+
boost: z24.number().optional().default(1),
|
|
2754
2774
|
matchAgainst: FieldReference2.optional()
|
|
2755
2775
|
})
|
|
2756
2776
|
});
|
|
2757
|
-
var Not =
|
|
2758
|
-
type:
|
|
2777
|
+
var Not = z24.object({
|
|
2778
|
+
type: z24.literal("not"),
|
|
2759
2779
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2760
|
-
clause:
|
|
2780
|
+
clause: z24.lazy(() => Clause)
|
|
2761
2781
|
});
|
|
2762
|
-
var And =
|
|
2763
|
-
type:
|
|
2782
|
+
var And = z24.object({
|
|
2783
|
+
type: z24.literal("and"),
|
|
2764
2784
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2765
|
-
clauses:
|
|
2785
|
+
clauses: z24.lazy(() => Clause.array())
|
|
2766
2786
|
});
|
|
2767
|
-
var Or =
|
|
2768
|
-
type:
|
|
2787
|
+
var Or = z24.object({
|
|
2788
|
+
type: z24.literal("or"),
|
|
2769
2789
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2770
|
-
clauses:
|
|
2790
|
+
clauses: z24.lazy(() => Clause.array())
|
|
2771
2791
|
});
|
|
2772
|
-
var Clause =
|
|
2773
|
-
() =>
|
|
2792
|
+
var Clause = z24.lazy(
|
|
2793
|
+
() => z24.discriminatedUnion("type", [
|
|
2774
2794
|
Not,
|
|
2775
2795
|
And,
|
|
2776
2796
|
Or,
|
|
@@ -2781,8 +2801,8 @@ var Clause = z23.lazy(
|
|
|
2781
2801
|
).meta({
|
|
2782
2802
|
id: "Clause"
|
|
2783
2803
|
});
|
|
2784
|
-
var DeduplicationConfig =
|
|
2785
|
-
id:
|
|
2804
|
+
var DeduplicationConfig = z24.object({
|
|
2805
|
+
id: z24.string(),
|
|
2786
2806
|
label: TranslationConfig,
|
|
2787
2807
|
query: Clause
|
|
2788
2808
|
}).meta({
|
|
@@ -2791,15 +2811,15 @@ var DeduplicationConfig = z23.object({
|
|
|
2791
2811
|
});
|
|
2792
2812
|
|
|
2793
2813
|
// ../commons/src/events/ActionConfig.ts
|
|
2794
|
-
var DeclarationReviewConfig =
|
|
2814
|
+
var DeclarationReviewConfig = z25.object({
|
|
2795
2815
|
title: TranslationConfig.describe("Title of the review page"),
|
|
2796
|
-
fields:
|
|
2816
|
+
fields: z25.array(FieldConfig).describe("Fields displayed on the review page for annotations.")
|
|
2797
2817
|
}).describe(
|
|
2798
2818
|
"Configuration of the declaration review page for collecting event-related metadata."
|
|
2799
2819
|
);
|
|
2800
|
-
var ActionConfigBase =
|
|
2820
|
+
var ActionConfigBase = z25.object({
|
|
2801
2821
|
label: TranslationConfig.describe("Human readable description of the action"),
|
|
2802
|
-
flags:
|
|
2822
|
+
flags: z25.array(ActionFlagConfig).optional().default([]).describe("Flag actions which are executed when the action is performed."),
|
|
2803
2823
|
supportingCopy: TranslationConfig.optional().describe(
|
|
2804
2824
|
"Text displayed on the confirmation dialog"
|
|
2805
2825
|
),
|
|
@@ -2810,84 +2830,84 @@ var ActionConfigBase = z24.object({
|
|
|
2810
2830
|
* "The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed."
|
|
2811
2831
|
* for EventConfig.d.ts.
|
|
2812
2832
|
*/
|
|
2813
|
-
icon:
|
|
2814
|
-
conditionals:
|
|
2833
|
+
icon: z25.string().describe("Icon representing the action").optional(),
|
|
2834
|
+
conditionals: z25.array(ActionConditional).optional().describe("Conditionals which can disable or hide actions.")
|
|
2815
2835
|
});
|
|
2816
2836
|
var DeclarationActionBase = ActionConfigBase.extend({
|
|
2817
2837
|
deduplication: DeduplicationConfig.optional()
|
|
2818
2838
|
});
|
|
2819
|
-
var actionConfirmationForm =
|
|
2839
|
+
var actionConfirmationForm = z25.array(FieldConfig).optional().describe(
|
|
2820
2840
|
"Fields rendered on the action confirmation dialog. Submitted values are stored in the action annotation and shown in the audit history."
|
|
2821
2841
|
);
|
|
2822
2842
|
var ReadActionConfig = ActionConfigBase.extend(
|
|
2823
|
-
|
|
2824
|
-
type:
|
|
2843
|
+
z25.object({
|
|
2844
|
+
type: z25.literal(ActionType.READ),
|
|
2825
2845
|
review: DeclarationReviewConfig.describe(
|
|
2826
2846
|
"Configuration of the review page for read-only view."
|
|
2827
2847
|
),
|
|
2828
|
-
conditionals:
|
|
2848
|
+
conditionals: z25.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
|
|
2829
2849
|
}).shape
|
|
2830
2850
|
);
|
|
2831
2851
|
var NotifyConfig = ActionConfigBase.extend(
|
|
2832
|
-
|
|
2833
|
-
type:
|
|
2852
|
+
z25.object({
|
|
2853
|
+
type: z25.literal(ActionType.NOTIFY),
|
|
2834
2854
|
form: actionConfirmationForm
|
|
2835
2855
|
}).shape
|
|
2836
2856
|
);
|
|
2837
2857
|
var DuplicateDetectedConfig = ActionConfigBase.extend(
|
|
2838
|
-
|
|
2839
|
-
type:
|
|
2840
|
-
label:
|
|
2858
|
+
z25.object({
|
|
2859
|
+
type: z25.literal(ActionType.DUPLICATE_DETECTED),
|
|
2860
|
+
label: z25.never().optional().describe(
|
|
2841
2861
|
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no label."
|
|
2842
2862
|
),
|
|
2843
|
-
supportingCopy:
|
|
2844
|
-
icon:
|
|
2863
|
+
supportingCopy: z25.never().optional(),
|
|
2864
|
+
icon: z25.never().optional().describe(
|
|
2845
2865
|
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no icon."
|
|
2846
2866
|
),
|
|
2847
|
-
conditionals:
|
|
2867
|
+
conditionals: z25.never().optional().describe(
|
|
2848
2868
|
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it cannot be disabled or hidden with conditionals."
|
|
2849
2869
|
)
|
|
2850
2870
|
}).shape
|
|
2851
2871
|
);
|
|
2852
2872
|
var MarkAsDuplicateConfig = ActionConfigBase.extend(
|
|
2853
|
-
|
|
2854
|
-
type:
|
|
2873
|
+
z25.object({
|
|
2874
|
+
type: z25.literal(ActionType.MARK_AS_DUPLICATE)
|
|
2855
2875
|
}).shape
|
|
2856
2876
|
);
|
|
2857
2877
|
var MarkAsNotDuplicateConfig = ActionConfigBase.extend(
|
|
2858
|
-
|
|
2859
|
-
type:
|
|
2878
|
+
z25.object({
|
|
2879
|
+
type: z25.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
2860
2880
|
}).shape
|
|
2861
2881
|
);
|
|
2862
2882
|
var AssignConfig = ActionConfigBase.extend(
|
|
2863
|
-
|
|
2864
|
-
type:
|
|
2865
|
-
flags:
|
|
2883
|
+
z25.object({
|
|
2884
|
+
type: z25.literal(ActionType.ASSIGN),
|
|
2885
|
+
flags: z25.never().optional().describe(
|
|
2866
2886
|
"ASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
|
|
2867
2887
|
)
|
|
2868
2888
|
}).shape
|
|
2869
2889
|
);
|
|
2870
2890
|
var UnassignConfig = ActionConfigBase.extend(
|
|
2871
|
-
|
|
2872
|
-
type:
|
|
2873
|
-
flags:
|
|
2891
|
+
z25.object({
|
|
2892
|
+
type: z25.literal(ActionType.UNASSIGN),
|
|
2893
|
+
flags: z25.never().optional().describe(
|
|
2874
2894
|
"UNASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
|
|
2875
2895
|
)
|
|
2876
2896
|
}).shape
|
|
2877
2897
|
);
|
|
2878
2898
|
var DeleteConfig = ActionConfigBase.extend(
|
|
2879
|
-
|
|
2880
|
-
type:
|
|
2899
|
+
z25.object({
|
|
2900
|
+
type: z25.literal(ActionType.DELETE)
|
|
2881
2901
|
}).shape
|
|
2882
2902
|
);
|
|
2883
2903
|
var DeclareConfig = DeclarationActionBase.extend(
|
|
2884
|
-
|
|
2885
|
-
type:
|
|
2904
|
+
z25.object({
|
|
2905
|
+
type: z25.literal(ActionType.DECLARE),
|
|
2886
2906
|
review: DeclarationReviewConfig.describe(
|
|
2887
2907
|
"Configuration of the review page fields."
|
|
2888
2908
|
),
|
|
2889
2909
|
form: actionConfirmationForm,
|
|
2890
|
-
dialogCopy:
|
|
2910
|
+
dialogCopy: z25.object({
|
|
2891
2911
|
notify: TranslationConfig.describe(
|
|
2892
2912
|
"Confirmation text for the notify action"
|
|
2893
2913
|
),
|
|
@@ -2901,20 +2921,20 @@ var DeclareConfig = DeclarationActionBase.extend(
|
|
|
2901
2921
|
}).shape
|
|
2902
2922
|
);
|
|
2903
2923
|
var ArchiveConfig = ActionConfigBase.extend(
|
|
2904
|
-
|
|
2905
|
-
type:
|
|
2924
|
+
z25.object({
|
|
2925
|
+
type: z25.literal(ActionType.ARCHIVE),
|
|
2906
2926
|
form: actionConfirmationForm
|
|
2907
2927
|
}).shape
|
|
2908
2928
|
);
|
|
2909
2929
|
var UnarchiveConfig = ActionConfigBase.extend(
|
|
2910
|
-
|
|
2911
|
-
type:
|
|
2930
|
+
z25.object({
|
|
2931
|
+
type: z25.literal(ActionType.UNARCHIVE)
|
|
2912
2932
|
}).shape
|
|
2913
2933
|
);
|
|
2914
2934
|
var EditActionConfig = ActionConfigBase.extend(
|
|
2915
|
-
|
|
2916
|
-
type:
|
|
2917
|
-
dialogCopy:
|
|
2935
|
+
z25.object({
|
|
2936
|
+
type: z25.literal(ActionType.EDIT),
|
|
2937
|
+
dialogCopy: z25.object({
|
|
2918
2938
|
notify: TranslationConfig.describe(
|
|
2919
2939
|
"Confirmation text for the notify with edits action"
|
|
2920
2940
|
),
|
|
@@ -2928,45 +2948,45 @@ var EditActionConfig = ActionConfigBase.extend(
|
|
|
2928
2948
|
}).shape
|
|
2929
2949
|
);
|
|
2930
2950
|
var RejectConfig = ActionConfigBase.extend(
|
|
2931
|
-
|
|
2932
|
-
type:
|
|
2951
|
+
z25.object({
|
|
2952
|
+
type: z25.literal(ActionType.REJECT),
|
|
2933
2953
|
form: actionConfirmationForm
|
|
2934
2954
|
}).shape
|
|
2935
2955
|
);
|
|
2936
2956
|
var RegisterConfig = DeclarationActionBase.extend(
|
|
2937
|
-
|
|
2938
|
-
type:
|
|
2957
|
+
z25.object({
|
|
2958
|
+
type: z25.literal(ActionType.REGISTER),
|
|
2939
2959
|
form: actionConfirmationForm
|
|
2940
2960
|
}).shape
|
|
2941
2961
|
);
|
|
2942
2962
|
var PrintCertificateActionConfig = ActionConfigBase.extend(
|
|
2943
|
-
|
|
2944
|
-
type:
|
|
2963
|
+
z25.object({
|
|
2964
|
+
type: z25.literal(ActionType.PRINT_CERTIFICATE),
|
|
2945
2965
|
printForm: ActionFormConfig
|
|
2946
2966
|
}).shape
|
|
2947
2967
|
);
|
|
2948
2968
|
var RequestCorrectionConfig = ActionConfigBase.extend(
|
|
2949
|
-
|
|
2950
|
-
type:
|
|
2969
|
+
z25.object({
|
|
2970
|
+
type: z25.literal(ActionType.REQUEST_CORRECTION),
|
|
2951
2971
|
correctionForm: ActionFormConfig
|
|
2952
2972
|
}).shape
|
|
2953
2973
|
);
|
|
2954
2974
|
var ApproveCorrectionConfig = ActionConfigBase.extend(
|
|
2955
|
-
|
|
2956
|
-
type:
|
|
2975
|
+
z25.object({
|
|
2976
|
+
type: z25.literal(ActionType.APPROVE_CORRECTION)
|
|
2957
2977
|
}).shape
|
|
2958
2978
|
);
|
|
2959
2979
|
var RejectCorrectionConfig = ActionConfigBase.extend(
|
|
2960
|
-
|
|
2961
|
-
type:
|
|
2980
|
+
z25.object({
|
|
2981
|
+
type: z25.literal(ActionType.REJECT_CORRECTION)
|
|
2962
2982
|
}).shape
|
|
2963
2983
|
);
|
|
2964
2984
|
var CustomActionConfig = ActionConfigBase.extend(
|
|
2965
|
-
|
|
2966
|
-
type:
|
|
2967
|
-
customActionType:
|
|
2985
|
+
z25.object({
|
|
2986
|
+
type: z25.literal(ActionType.CUSTOM),
|
|
2987
|
+
customActionType: z25.string().describe("Type identifier of the custom action."),
|
|
2968
2988
|
/** 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. */
|
|
2969
|
-
form:
|
|
2989
|
+
form: z25.array(FieldConfig).describe(
|
|
2970
2990
|
"Form configuration for the custom action. The form configured here will be used on the custom action confirmation modal."
|
|
2971
2991
|
),
|
|
2972
2992
|
auditHistoryLabel: TranslationConfig.describe(
|
|
@@ -2974,7 +2994,7 @@ var CustomActionConfig = ActionConfigBase.extend(
|
|
|
2974
2994
|
)
|
|
2975
2995
|
}).shape
|
|
2976
2996
|
);
|
|
2977
|
-
var ActionConfig =
|
|
2997
|
+
var ActionConfig = z25.discriminatedUnion("type", [
|
|
2978
2998
|
/*
|
|
2979
2999
|
* OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
|
|
2980
3000
|
* and treat them as "models" instead of duplicating the data structure in each endpoint.
|
|
@@ -3061,58 +3081,58 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3061
3081
|
var actionConfigTypes = new Set(
|
|
3062
3082
|
ActionConfig.options.map((opt) => opt.shape.type.value)
|
|
3063
3083
|
);
|
|
3064
|
-
var DeclarationActionConfig =
|
|
3084
|
+
var DeclarationActionConfig = z25.discriminatedUnion("type", [
|
|
3065
3085
|
DeclareConfig,
|
|
3066
3086
|
RegisterConfig
|
|
3067
3087
|
]);
|
|
3068
3088
|
|
|
3069
3089
|
// ../commons/src/events/offline/CertificateConfig.ts
|
|
3070
|
-
var
|
|
3071
|
-
var FontFamily =
|
|
3072
|
-
normal:
|
|
3073
|
-
bold:
|
|
3074
|
-
italics:
|
|
3075
|
-
bolditalics:
|
|
3076
|
-
});
|
|
3077
|
-
var CertificateConfig =
|
|
3078
|
-
id:
|
|
3079
|
-
event:
|
|
3080
|
-
isV2Template:
|
|
3090
|
+
var z26 = __toESM(require("zod/v4"));
|
|
3091
|
+
var FontFamily = z26.object({
|
|
3092
|
+
normal: z26.string(),
|
|
3093
|
+
bold: z26.string(),
|
|
3094
|
+
italics: z26.string(),
|
|
3095
|
+
bolditalics: z26.string()
|
|
3096
|
+
});
|
|
3097
|
+
var CertificateConfig = z26.object({
|
|
3098
|
+
id: z26.string(),
|
|
3099
|
+
event: z26.string(),
|
|
3100
|
+
isV2Template: z26.boolean().optional(),
|
|
3081
3101
|
label: TranslationConfig,
|
|
3082
|
-
isDefault:
|
|
3083
|
-
fee:
|
|
3084
|
-
onTime:
|
|
3085
|
-
late:
|
|
3086
|
-
delayed:
|
|
3102
|
+
isDefault: z26.boolean(),
|
|
3103
|
+
fee: z26.object({
|
|
3104
|
+
onTime: z26.number(),
|
|
3105
|
+
late: z26.number(),
|
|
3106
|
+
delayed: z26.number()
|
|
3087
3107
|
}),
|
|
3088
|
-
svgUrl:
|
|
3089
|
-
fonts:
|
|
3090
|
-
conditionals:
|
|
3108
|
+
svgUrl: z26.string(),
|
|
3109
|
+
fonts: z26.record(z26.string(), FontFamily).optional(),
|
|
3110
|
+
conditionals: z26.array(ShowConditional).optional()
|
|
3091
3111
|
});
|
|
3092
3112
|
var CertificateTemplateConfig = CertificateConfig.extend({
|
|
3093
|
-
hash:
|
|
3094
|
-
svg:
|
|
3113
|
+
hash: z26.string().optional(),
|
|
3114
|
+
svg: z26.string()
|
|
3095
3115
|
});
|
|
3096
3116
|
|
|
3097
3117
|
// ../commons/src/events/offline/LanguageConfig.ts
|
|
3098
|
-
var
|
|
3099
|
-
var LanguageConfig =
|
|
3100
|
-
lang:
|
|
3118
|
+
var z27 = __toESM(require("zod/v4"));
|
|
3119
|
+
var LanguageConfig = z27.object({
|
|
3120
|
+
lang: z27.string(),
|
|
3101
3121
|
/**
|
|
3102
3122
|
* client.csv contents
|
|
3103
3123
|
*/
|
|
3104
|
-
messages:
|
|
3124
|
+
messages: z27.record(z27.string(), z27.string())
|
|
3105
3125
|
});
|
|
3106
3126
|
|
|
3107
3127
|
// ../commons/src/events/EventConfig.ts
|
|
3108
|
-
var
|
|
3128
|
+
var z35 = __toESM(require("zod/v4"));
|
|
3109
3129
|
|
|
3110
3130
|
// ../commons/src/events/SummaryConfig.ts
|
|
3111
|
-
var
|
|
3131
|
+
var z29 = __toESM(require("zod/v4"));
|
|
3112
3132
|
|
|
3113
3133
|
// ../commons/src/icons.ts
|
|
3114
|
-
var
|
|
3115
|
-
var AvailableIcons =
|
|
3134
|
+
var z28 = __toESM(require("zod/v4"));
|
|
3135
|
+
var AvailableIcons = z28.enum([
|
|
3116
3136
|
"Archived",
|
|
3117
3137
|
"Assigned",
|
|
3118
3138
|
"Briefcase",
|
|
@@ -3220,11 +3240,11 @@ var AvailableIcons = z27.enum([
|
|
|
3220
3240
|
]);
|
|
3221
3241
|
|
|
3222
3242
|
// ../commons/src/events/SummaryConfig.ts
|
|
3223
|
-
var InfoBox =
|
|
3224
|
-
type:
|
|
3243
|
+
var InfoBox = z29.object({
|
|
3244
|
+
type: z29.enum(["info", "positive", "warning", "negative"]).describe(
|
|
3225
3245
|
"Semantic tint of the icon block: info (blue), positive (green), warning (orange), negative (red)."
|
|
3226
3246
|
),
|
|
3227
|
-
background:
|
|
3247
|
+
background: z29.enum(["tinted", "white"]).default("tinted").optional().describe(
|
|
3228
3248
|
"tinted reads as a recessed empty state; white reads as a standalone card."
|
|
3229
3249
|
),
|
|
3230
3250
|
icon: AvailableIcons.optional().describe(
|
|
@@ -3236,50 +3256,50 @@ var InfoBox = z28.object({
|
|
|
3236
3256
|
description: TranslationConfig.optional().describe(
|
|
3237
3257
|
"Secondary copy displayed below the heading, typically a suggested next step."
|
|
3238
3258
|
),
|
|
3239
|
-
conditionals:
|
|
3259
|
+
conditionals: z29.array(ShowConditional).default([]).optional().describe(
|
|
3240
3260
|
"Conditions under which the info box is shown. When omitted, it is always shown."
|
|
3241
3261
|
)
|
|
3242
3262
|
}).describe(
|
|
3243
3263
|
"A compact icon-block + heading + description block displayed above the summary fields in the event overview."
|
|
3244
3264
|
);
|
|
3245
|
-
var BaseField2 =
|
|
3265
|
+
var BaseField2 = z29.object({
|
|
3246
3266
|
emptyValueMessage: TranslationConfig.optional().describe(
|
|
3247
3267
|
"Default message displayed when the field value is empty."
|
|
3248
3268
|
),
|
|
3249
|
-
conditionals:
|
|
3269
|
+
conditionals: z29.array(ShowConditional).default([]).optional()
|
|
3250
3270
|
});
|
|
3251
3271
|
var ReferenceField = BaseField2.extend({
|
|
3252
|
-
fieldId:
|
|
3272
|
+
fieldId: z29.string(),
|
|
3253
3273
|
label: TranslationConfig.optional().describe(
|
|
3254
3274
|
"Overrides the default label from the referenced field when provided."
|
|
3255
3275
|
)
|
|
3256
3276
|
}).describe("Field referencing existing event data by field ID.");
|
|
3257
3277
|
var Field = BaseField2.extend({
|
|
3258
|
-
id:
|
|
3278
|
+
id: z29.string().describe("Identifier of the summary field."),
|
|
3259
3279
|
value: TranslationConfig.describe(
|
|
3260
3280
|
'Field value template supporting variables from configuration and EventMetadata (e.g. "{informant.phoneNo} {informant.email}").'
|
|
3261
3281
|
),
|
|
3262
3282
|
label: TranslationConfig
|
|
3263
3283
|
}).describe("Custom field defined for the summary view.");
|
|
3264
|
-
var SummaryConfig =
|
|
3265
|
-
banners:
|
|
3284
|
+
var SummaryConfig = z29.object({
|
|
3285
|
+
banners: z29.array(InfoBox).default([]).optional().describe(
|
|
3266
3286
|
"Info boxes displayed above the summary fields in the event overview."
|
|
3267
3287
|
),
|
|
3268
|
-
fields:
|
|
3288
|
+
fields: z29.array(z29.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
|
|
3269
3289
|
}).meta({
|
|
3270
3290
|
id: "SummaryConfig",
|
|
3271
3291
|
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."
|
|
3272
3292
|
});
|
|
3273
3293
|
|
|
3274
3294
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
|
3275
|
-
var
|
|
3276
|
-
var MatchType =
|
|
3277
|
-
var BaseField3 =
|
|
3278
|
-
config:
|
|
3295
|
+
var z30 = __toESM(require("zod/v4"));
|
|
3296
|
+
var MatchType = z30.enum(["fuzzy", "exact", "range", "within"]);
|
|
3297
|
+
var BaseField3 = z30.object({
|
|
3298
|
+
config: z30.object({
|
|
3279
3299
|
type: MatchType.describe(
|
|
3280
3300
|
"Determines the search type of field. How to match value."
|
|
3281
3301
|
),
|
|
3282
|
-
searchFields:
|
|
3302
|
+
searchFields: z30.array(z30.string()).optional().describe(
|
|
3283
3303
|
`
|
|
3284
3304
|
Defines multiple form fields that should be searched when this field has a value.
|
|
3285
3305
|
All specified fields will be combined using OR logic.
|
|
@@ -3289,7 +3309,7 @@ var BaseField3 = z29.object({
|
|
|
3289
3309
|
`
|
|
3290
3310
|
)
|
|
3291
3311
|
}),
|
|
3292
|
-
type:
|
|
3312
|
+
type: z30.nativeEnum(FieldType).optional().describe(
|
|
3293
3313
|
`
|
|
3294
3314
|
Explicitly specify the field type for searchFields.
|
|
3295
3315
|
This is required when searchFields is defined, to show the correct control in the UI.
|
|
@@ -3303,7 +3323,7 @@ var BaseField3 = z29.object({
|
|
|
3303
3323
|
This is required when searchFields is defined.
|
|
3304
3324
|
`
|
|
3305
3325
|
),
|
|
3306
|
-
options:
|
|
3326
|
+
options: z30.array(SelectOption).optional(),
|
|
3307
3327
|
searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
|
|
3308
3328
|
`
|
|
3309
3329
|
This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
|
|
@@ -3324,7 +3344,7 @@ var BaseField3 = z29.object({
|
|
|
3324
3344
|
in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
|
|
3325
3345
|
`
|
|
3326
3346
|
),
|
|
3327
|
-
conditionals:
|
|
3347
|
+
conditionals: z30.array(FieldConditional).optional().describe(
|
|
3328
3348
|
`
|
|
3329
3349
|
In advanced search, we sometimes need to override the default field visibility conditionals.
|
|
3330
3350
|
|
|
@@ -3338,23 +3358,23 @@ var BaseField3 = z29.object({
|
|
|
3338
3358
|
are always rendered in the advanced search form.
|
|
3339
3359
|
`
|
|
3340
3360
|
),
|
|
3341
|
-
validations:
|
|
3361
|
+
validations: z30.array(ValidationConfig).optional().describe(
|
|
3342
3362
|
`Option for overriding the field validations specifically for advanced search form.`
|
|
3343
3363
|
),
|
|
3344
3364
|
allowedLocations: JurisdictionReference.optional().describe(
|
|
3345
3365
|
`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.`
|
|
3346
3366
|
)
|
|
3347
3367
|
});
|
|
3348
|
-
var SearchQueryParams =
|
|
3349
|
-
eventType:
|
|
3368
|
+
var SearchQueryParams = z30.object({
|
|
3369
|
+
eventType: z30.string().optional().describe(
|
|
3350
3370
|
"Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
|
|
3351
3371
|
)
|
|
3352
3372
|
}).catchall(FieldValue);
|
|
3353
3373
|
var FieldConfigSchema = BaseField3.extend({
|
|
3354
|
-
fieldId:
|
|
3355
|
-
fieldType:
|
|
3374
|
+
fieldId: z30.string(),
|
|
3375
|
+
fieldType: z30.literal("field")
|
|
3356
3376
|
});
|
|
3357
|
-
var EventFieldIdInput =
|
|
3377
|
+
var EventFieldIdInput = z30.enum([
|
|
3358
3378
|
"trackingId",
|
|
3359
3379
|
"status",
|
|
3360
3380
|
"legalStatuses.REGISTERED.acceptedAt",
|
|
@@ -3363,7 +3383,7 @@ var EventFieldIdInput = z29.enum([
|
|
|
3363
3383
|
"updatedAt"
|
|
3364
3384
|
]);
|
|
3365
3385
|
var METADATA_FIELD_PREFIX = "event.";
|
|
3366
|
-
var EventFieldId =
|
|
3386
|
+
var EventFieldId = z30.enum([
|
|
3367
3387
|
`${METADATA_FIELD_PREFIX}trackingId`,
|
|
3368
3388
|
`${METADATA_FIELD_PREFIX}status`,
|
|
3369
3389
|
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
|
|
@@ -3373,29 +3393,29 @@ var EventFieldId = z29.enum([
|
|
|
3373
3393
|
]);
|
|
3374
3394
|
var EventFieldConfigSchema = BaseField3.extend({
|
|
3375
3395
|
fieldId: EventFieldId,
|
|
3376
|
-
fieldType:
|
|
3396
|
+
fieldType: z30.literal("event")
|
|
3377
3397
|
});
|
|
3378
|
-
var AdvancedSearchField =
|
|
3398
|
+
var AdvancedSearchField = z30.discriminatedUnion("fieldType", [FieldConfigSchema, EventFieldConfigSchema]).superRefine((data, ctx) => {
|
|
3379
3399
|
if (data.config.searchFields && data.config.searchFields.length > 0) {
|
|
3380
3400
|
if (!data.label) {
|
|
3381
3401
|
ctx.addIssue({
|
|
3382
|
-
code:
|
|
3402
|
+
code: z30.ZodIssueCode.custom,
|
|
3383
3403
|
message: "label is required when config.searchFields is defined.",
|
|
3384
3404
|
path: ["label"]
|
|
3385
3405
|
});
|
|
3386
3406
|
}
|
|
3387
3407
|
if (!data.type) {
|
|
3388
3408
|
ctx.addIssue({
|
|
3389
|
-
code:
|
|
3409
|
+
code: z30.ZodIssueCode.custom,
|
|
3390
3410
|
message: "type is required when config.searchFields is defined.",
|
|
3391
3411
|
path: ["type"]
|
|
3392
3412
|
});
|
|
3393
3413
|
}
|
|
3394
3414
|
}
|
|
3395
3415
|
});
|
|
3396
|
-
var AdvancedSearchConfig =
|
|
3416
|
+
var AdvancedSearchConfig = z30.object({
|
|
3397
3417
|
title: TranslationConfig.describe("Advanced search tab title"),
|
|
3398
|
-
fields:
|
|
3418
|
+
fields: z30.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
|
|
3399
3419
|
}).meta({
|
|
3400
3420
|
id: "AdvancedSearchConfig",
|
|
3401
3421
|
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()`)."
|
|
@@ -3407,35 +3427,26 @@ var import_lodash4 = require("lodash");
|
|
|
3407
3427
|
// ../commons/src/conditionals/validate.ts
|
|
3408
3428
|
var import__ = __toESM(require("ajv/dist/2019"));
|
|
3409
3429
|
var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
3410
|
-
var
|
|
3430
|
+
var z34 = __toESM(require("zod/v4"));
|
|
3411
3431
|
var import_date_fns2 = require("date-fns");
|
|
3412
3432
|
|
|
3413
3433
|
// ../commons/src/events/FieldTypeMapping.ts
|
|
3414
|
-
var
|
|
3434
|
+
var z32 = __toESM(require("zod/v4"));
|
|
3415
3435
|
|
|
3416
3436
|
// ../commons/src/events/DynamicFieldValue.ts
|
|
3417
|
-
var
|
|
3437
|
+
var z31 = __toESM(require("zod/v4"));
|
|
3418
3438
|
|
|
3419
3439
|
// ../commons/src/events/state/index.ts
|
|
3420
3440
|
var import_lodash3 = require("lodash");
|
|
3421
3441
|
|
|
3422
3442
|
// ../commons/src/utils.ts
|
|
3423
|
-
var
|
|
3443
|
+
var z33 = __toESM(require("zod/v4"));
|
|
3424
3444
|
var _ = __toESM(require("lodash"));
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
}
|
|
3431
|
-
function joinValues(values, separator = " ") {
|
|
3432
|
-
return values.filter((value) => !!value).join(separator).trim();
|
|
3433
|
-
}
|
|
3434
|
-
var FullNameV1 = z32.array(
|
|
3435
|
-
z32.object({
|
|
3436
|
-
use: z32.string(),
|
|
3437
|
-
family: z32.string(),
|
|
3438
|
-
given: z32.array(z32.string())
|
|
3445
|
+
var FullNameV1 = z33.array(
|
|
3446
|
+
z33.object({
|
|
3447
|
+
use: z33.string(),
|
|
3448
|
+
family: z33.string(),
|
|
3449
|
+
given: z33.array(z33.string())
|
|
3439
3450
|
})
|
|
3440
3451
|
);
|
|
3441
3452
|
function omitKeyDeep(obj, keyToRemove) {
|
|
@@ -3456,43 +3467,6 @@ function omitKeyDeep(obj, keyToRemove) {
|
|
|
3456
3467
|
|
|
3457
3468
|
// ../commons/src/events/state/utils.ts
|
|
3458
3469
|
var import_lodash = require("lodash");
|
|
3459
|
-
function getActionRequests(actionType, actions) {
|
|
3460
|
-
const filtered = actions.filter((action) => action.type === actionType).reverse();
|
|
3461
|
-
const accept = filtered.find(
|
|
3462
|
-
(action) => action.status === ActionStatus.Accepted
|
|
3463
|
-
);
|
|
3464
|
-
const request = filtered.find(
|
|
3465
|
-
(action) => action.status === ActionStatus.Requested
|
|
3466
|
-
);
|
|
3467
|
-
const reject = filtered.find(
|
|
3468
|
-
(action) => action.status === ActionStatus.Rejected
|
|
3469
|
-
);
|
|
3470
|
-
return {
|
|
3471
|
-
reject,
|
|
3472
|
-
accept,
|
|
3473
|
-
request
|
|
3474
|
-
};
|
|
3475
|
-
}
|
|
3476
|
-
function getDeclarationActionCreationMetadata(actionType, actions) {
|
|
3477
|
-
const { accept: acceptAction, request: requestAction } = getActionRequests(
|
|
3478
|
-
actionType,
|
|
3479
|
-
actions
|
|
3480
|
-
);
|
|
3481
|
-
if (!acceptAction) {
|
|
3482
|
-
return null;
|
|
3483
|
-
}
|
|
3484
|
-
const registrationNumber = acceptAction.type === ActionType.REGISTER ? acceptAction.registrationNumber : null;
|
|
3485
|
-
return {
|
|
3486
|
-
// When 3rd party API returns 200 OK, we assume that the request was accepted, and persist single 'accepted' action.
|
|
3487
|
-
createdAt: requestAction?.createdAt ?? acceptAction.createdAt,
|
|
3488
|
-
createdBy: requestAction?.createdBy ?? acceptAction.createdBy,
|
|
3489
|
-
createdByUserType: requestAction?.createdByUserType ?? acceptAction.createdByUserType,
|
|
3490
|
-
createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
|
|
3491
|
-
acceptedAt: acceptAction.createdAt,
|
|
3492
|
-
createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
|
|
3493
|
-
registrationNumber
|
|
3494
|
-
};
|
|
3495
|
-
}
|
|
3496
3470
|
var updateActions = ActionTypes.extract([
|
|
3497
3471
|
ActionType.CREATE,
|
|
3498
3472
|
ActionType.NOTIFY,
|
|
@@ -3508,88 +3482,10 @@ var updateActions = ActionTypes.extract([
|
|
|
3508
3482
|
ActionType.REJECT_CORRECTION,
|
|
3509
3483
|
ActionType.CUSTOM
|
|
3510
3484
|
]);
|
|
3511
|
-
function getActionUpdateMetadata(actions) {
|
|
3512
|
-
const createAction = getOrThrow(
|
|
3513
|
-
actions.find((action) => action.type === ActionType.CREATE),
|
|
3514
|
-
`Event has no ${ActionType.CREATE} action`
|
|
3515
|
-
);
|
|
3516
|
-
const metadataFields = [
|
|
3517
|
-
"createdAt",
|
|
3518
|
-
"createdBy",
|
|
3519
|
-
"createdByUserType",
|
|
3520
|
-
"createdAtLocation",
|
|
3521
|
-
"createdByRole"
|
|
3522
|
-
];
|
|
3523
|
-
return actions.filter(({ type }) => updateActions.safeParse(type).success).reduce(
|
|
3524
|
-
(_2, action) => {
|
|
3525
|
-
if (action.originalActionId) {
|
|
3526
|
-
const originalAction = actions.find(({ id }) => id === action.originalActionId) ?? action;
|
|
3527
|
-
return (0, import_lodash.pick)(originalAction, metadataFields);
|
|
3528
|
-
}
|
|
3529
|
-
return (0, import_lodash.pick)(action, metadataFields);
|
|
3530
|
-
},
|
|
3531
|
-
(0, import_lodash.pick)(createAction, metadataFields)
|
|
3532
|
-
);
|
|
3533
|
-
}
|
|
3534
|
-
function getLegalStatuses(actions) {
|
|
3535
|
-
return {
|
|
3536
|
-
[EventStatus.enum.NOTIFIED]: getDeclarationActionCreationMetadata(
|
|
3537
|
-
ActionType.NOTIFY,
|
|
3538
|
-
actions
|
|
3539
|
-
),
|
|
3540
|
-
[EventStatus.enum.DECLARED]: getDeclarationActionCreationMetadata(
|
|
3541
|
-
ActionType.DECLARE,
|
|
3542
|
-
actions
|
|
3543
|
-
),
|
|
3544
|
-
[EventStatus.enum.REGISTERED]: getDeclarationActionCreationMetadata(
|
|
3545
|
-
ActionType.REGISTER,
|
|
3546
|
-
actions
|
|
3547
|
-
)
|
|
3548
|
-
};
|
|
3549
|
-
}
|
|
3550
3485
|
|
|
3551
3486
|
// ../commons/src/events/state/flags.ts
|
|
3552
3487
|
var import_lodash2 = require("lodash");
|
|
3553
3488
|
var import_date_fns = require("date-fns");
|
|
3554
|
-
function isFlagConditionMet(conditional, form, action) {
|
|
3555
|
-
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" });
|
|
3556
|
-
return validate(conditional, {
|
|
3557
|
-
$form: form,
|
|
3558
|
-
$now: now2,
|
|
3559
|
-
$online: true,
|
|
3560
|
-
$user: {
|
|
3561
|
-
sub: "",
|
|
3562
|
-
exp: "",
|
|
3563
|
-
role: action.createdByRole,
|
|
3564
|
-
algorithm: "",
|
|
3565
|
-
scope: [],
|
|
3566
|
-
userType: action.createdByUserType
|
|
3567
|
-
}
|
|
3568
|
-
});
|
|
3569
|
-
}
|
|
3570
|
-
function actionConfigRemovesFlag(action, flagId, actionsUpToAndIncluding, event2, eventConfiguration) {
|
|
3571
|
-
if (!isActionConfigType(action.type)) {
|
|
3572
|
-
return false;
|
|
3573
|
-
}
|
|
3574
|
-
const actionConfig = getActionConfig({
|
|
3575
|
-
eventConfiguration,
|
|
3576
|
-
actionType: action.type,
|
|
3577
|
-
customActionType: "customActionType" in action ? action.customActionType : void 0
|
|
3578
|
-
});
|
|
3579
|
-
const removeOperations = (actionConfig?.flags ?? []).filter(
|
|
3580
|
-
({ id, operation }) => id === flagId && operation === "remove"
|
|
3581
|
-
);
|
|
3582
|
-
if (removeOperations.length === 0) {
|
|
3583
|
-
return false;
|
|
3584
|
-
}
|
|
3585
|
-
const eventUpToThisAction = { ...event2, actions: actionsUpToAndIncluding };
|
|
3586
|
-
const declaration = aggregateActionDeclarations(eventUpToThisAction);
|
|
3587
|
-
const annotation = aggregateActionAnnotations(eventUpToThisAction);
|
|
3588
|
-
const form = { ...declaration, ...annotation };
|
|
3589
|
-
return removeOperations.some(
|
|
3590
|
-
({ conditional }) => conditional ? isFlagConditionMet(conditional, form, action) : true
|
|
3591
|
-
);
|
|
3592
|
-
}
|
|
3593
3489
|
var INHERENT_FLAG_RULES = [
|
|
3594
3490
|
{
|
|
3595
3491
|
flag: InherentFlags.CORRECTION_REQUESTED,
|
|
@@ -3626,90 +3522,6 @@ var INHERENT_FLAG_RULES = [
|
|
|
3626
3522
|
resetOnAnyOtherAction: true
|
|
3627
3523
|
}
|
|
3628
3524
|
];
|
|
3629
|
-
function resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration) {
|
|
3630
|
-
return acceptedActions.reduce((present, action, idx) => {
|
|
3631
|
-
if (rule.setOn.includes(action.type)) {
|
|
3632
|
-
return true;
|
|
3633
|
-
}
|
|
3634
|
-
if (rule.resetOnAnyOtherAction || (rule.resetOn ?? []).includes(action.type)) {
|
|
3635
|
-
return false;
|
|
3636
|
-
}
|
|
3637
|
-
if (actionConfigRemovesFlag(
|
|
3638
|
-
action,
|
|
3639
|
-
rule.flag,
|
|
3640
|
-
acceptedActions.slice(0, idx + 1),
|
|
3641
|
-
event2,
|
|
3642
|
-
eventConfiguration
|
|
3643
|
-
)) {
|
|
3644
|
-
return false;
|
|
3645
|
-
}
|
|
3646
|
-
return present;
|
|
3647
|
-
}, false);
|
|
3648
|
-
}
|
|
3649
|
-
function resolveEventCustomFlags(event2, eventConfiguration) {
|
|
3650
|
-
const actions = getAcceptedActions(event2).filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
3651
|
-
return actions.reduce((acc, action, idx) => {
|
|
3652
|
-
let actionConfig;
|
|
3653
|
-
if (isActionConfigType(action.type)) {
|
|
3654
|
-
actionConfig = getActionConfig({
|
|
3655
|
-
eventConfiguration,
|
|
3656
|
-
actionType: action.type,
|
|
3657
|
-
customActionType: "customActionType" in action ? action.customActionType : void 0
|
|
3658
|
-
});
|
|
3659
|
-
}
|
|
3660
|
-
if (!actionConfig) {
|
|
3661
|
-
return acc;
|
|
3662
|
-
}
|
|
3663
|
-
const eventUpToThisAction = {
|
|
3664
|
-
...event2,
|
|
3665
|
-
actions: actions.slice(0, idx + 1)
|
|
3666
|
-
};
|
|
3667
|
-
const declaration = aggregateActionDeclarations(eventUpToThisAction);
|
|
3668
|
-
const annotation = aggregateActionAnnotations(eventUpToThisAction);
|
|
3669
|
-
const form = { ...declaration, ...annotation };
|
|
3670
|
-
const flagsWithMetConditions = (actionConfig.flags ?? []).filter(
|
|
3671
|
-
({ conditional }) => (
|
|
3672
|
-
// If conditional is not provided, the flag is resolved
|
|
3673
|
-
conditional ? isFlagConditionMet(conditional, form, action) : true
|
|
3674
|
-
)
|
|
3675
|
-
);
|
|
3676
|
-
const addedFlags = flagsWithMetConditions.filter(({ operation }) => operation === "add").map(({ id }) => id);
|
|
3677
|
-
const removedFlags = flagsWithMetConditions.filter(({ operation }) => operation === "remove").map(({ id }) => id);
|
|
3678
|
-
const flags = [...acc, ...addedFlags].filter(
|
|
3679
|
-
(flagId) => !removedFlags.includes(flagId)
|
|
3680
|
-
);
|
|
3681
|
-
return (0, import_lodash2.uniq)(flags);
|
|
3682
|
-
}, []);
|
|
3683
|
-
}
|
|
3684
|
-
function getActionStatusFlags(sortedActions) {
|
|
3685
|
-
const actionStatus = sortedActions.reduce(
|
|
3686
|
-
(actionStatuses, { type, status: status2 }) => ({
|
|
3687
|
-
...actionStatuses,
|
|
3688
|
-
[type]: status2
|
|
3689
|
-
}),
|
|
3690
|
-
{}
|
|
3691
|
-
);
|
|
3692
|
-
return Object.entries(actionStatus).filter(([, status2]) => status2 !== ActionStatus.Accepted).map(([type, status2]) => {
|
|
3693
|
-
const flag2 = joinValues([type, status2], ":").toLowerCase();
|
|
3694
|
-
return flag2;
|
|
3695
|
-
});
|
|
3696
|
-
}
|
|
3697
|
-
function getInherentFlags(sortedActions, event2, eventConfiguration) {
|
|
3698
|
-
const acceptedActions = sortedActions.filter(
|
|
3699
|
-
({ status: status2 }) => status2 === ActionStatus.Accepted
|
|
3700
|
-
);
|
|
3701
|
-
return INHERENT_FLAG_RULES.filter(
|
|
3702
|
-
(rule) => resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration)
|
|
3703
|
-
).map(({ flag: flag2 }) => flag2);
|
|
3704
|
-
}
|
|
3705
|
-
function getEventFlags(event2, config) {
|
|
3706
|
-
const sortedActions = event2.actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
3707
|
-
return [
|
|
3708
|
-
...getActionStatusFlags(sortedActions),
|
|
3709
|
-
...getInherentFlags(sortedActions, event2, config),
|
|
3710
|
-
...resolveEventCustomFlags(event2, config)
|
|
3711
|
-
];
|
|
3712
|
-
}
|
|
3713
3525
|
|
|
3714
3526
|
// ../commons/src/conditionals/conditionals.ts
|
|
3715
3527
|
var objectHash = __toESM(require("object-hash"));
|
|
@@ -4345,183 +4157,6 @@ function createFieldConditionals(fieldId) {
|
|
|
4345
4157
|
};
|
|
4346
4158
|
}
|
|
4347
4159
|
|
|
4348
|
-
// ../commons/src/events/state/index.ts
|
|
4349
|
-
function getStatusFromActions(actions) {
|
|
4350
|
-
const acceptedActions = actions.filter(
|
|
4351
|
-
({ status: status2 }) => status2 === ActionStatus.Accepted
|
|
4352
|
-
);
|
|
4353
|
-
const isCurrentlyArchived = acceptedActions.reduce(
|
|
4354
|
-
(archived, action) => {
|
|
4355
|
-
if (action.type === ActionType.ARCHIVE) {
|
|
4356
|
-
return true;
|
|
4357
|
-
}
|
|
4358
|
-
if (action.type === ActionType.UNARCHIVE) {
|
|
4359
|
-
return false;
|
|
4360
|
-
}
|
|
4361
|
-
return archived;
|
|
4362
|
-
},
|
|
4363
|
-
false
|
|
4364
|
-
);
|
|
4365
|
-
if (isCurrentlyArchived) {
|
|
4366
|
-
return EventStatus.enum.ARCHIVED;
|
|
4367
|
-
}
|
|
4368
|
-
return acceptedActions.filter(
|
|
4369
|
-
({ type }) => type !== ActionType.ARCHIVE && type !== ActionType.UNARCHIVE
|
|
4370
|
-
).reduce((status2, action) => {
|
|
4371
|
-
switch (action.type) {
|
|
4372
|
-
case ActionType.CREATE:
|
|
4373
|
-
return EventStatus.enum.CREATED;
|
|
4374
|
-
case ActionType.DECLARE:
|
|
4375
|
-
return EventStatus.enum.DECLARED;
|
|
4376
|
-
case ActionType.REGISTER:
|
|
4377
|
-
return EventStatus.enum.REGISTERED;
|
|
4378
|
-
case ActionType.NOTIFY:
|
|
4379
|
-
return EventStatus.enum.NOTIFIED;
|
|
4380
|
-
// Already filtered out above; listed here only to satisfy exhaustiveness.
|
|
4381
|
-
case ActionType.ARCHIVE:
|
|
4382
|
-
case ActionType.UNARCHIVE:
|
|
4383
|
-
case ActionType.CUSTOM:
|
|
4384
|
-
case ActionType.PRINT_CERTIFICATE:
|
|
4385
|
-
case ActionType.ASSIGN:
|
|
4386
|
-
case ActionType.UNASSIGN:
|
|
4387
|
-
case ActionType.REJECT:
|
|
4388
|
-
case ActionType.REQUEST_CORRECTION:
|
|
4389
|
-
case ActionType.APPROVE_CORRECTION:
|
|
4390
|
-
case ActionType.DUPLICATE_DETECTED:
|
|
4391
|
-
case ActionType.MARK_AS_NOT_DUPLICATE:
|
|
4392
|
-
case ActionType.MARK_AS_DUPLICATE:
|
|
4393
|
-
case ActionType.REJECT_CORRECTION:
|
|
4394
|
-
case ActionType.READ:
|
|
4395
|
-
case ActionType.EDIT:
|
|
4396
|
-
default:
|
|
4397
|
-
return status2;
|
|
4398
|
-
}
|
|
4399
|
-
}, EventStatus.enum.CREATED);
|
|
4400
|
-
}
|
|
4401
|
-
function getAssignedUserFromActions(actions) {
|
|
4402
|
-
return actions.reduce((user2, action) => {
|
|
4403
|
-
if (action.type === ActionType.ASSIGN) {
|
|
4404
|
-
return action.assignedTo;
|
|
4405
|
-
}
|
|
4406
|
-
if (action.type === ActionType.UNASSIGN) {
|
|
4407
|
-
return null;
|
|
4408
|
-
}
|
|
4409
|
-
return user2;
|
|
4410
|
-
}, null);
|
|
4411
|
-
}
|
|
4412
|
-
function deepDropNulls(obj) {
|
|
4413
|
-
if (Array.isArray(obj)) {
|
|
4414
|
-
return obj.map(deepDropNulls);
|
|
4415
|
-
}
|
|
4416
|
-
if (obj !== null && typeof obj === "object") {
|
|
4417
|
-
return Object.entries(obj).reduce((acc, [key, value]) => {
|
|
4418
|
-
const cleanedValue = deepDropNulls(value);
|
|
4419
|
-
if (cleanedValue !== null) {
|
|
4420
|
-
;
|
|
4421
|
-
acc[key] = cleanedValue;
|
|
4422
|
-
}
|
|
4423
|
-
return acc;
|
|
4424
|
-
}, {});
|
|
4425
|
-
}
|
|
4426
|
-
return obj;
|
|
4427
|
-
}
|
|
4428
|
-
var DEFAULT_DATE_OF_EVENT_PROPERTY = "createdAt";
|
|
4429
|
-
function extractDateString(dateTime) {
|
|
4430
|
-
return dateTime.split("T")[0];
|
|
4431
|
-
}
|
|
4432
|
-
function resolveDateOfEvent(eventIndex, declaration, config) {
|
|
4433
|
-
if (!config.dateOfEvent) {
|
|
4434
|
-
return extractDateString(eventIndex[DEFAULT_DATE_OF_EVENT_PROPERTY]);
|
|
4435
|
-
}
|
|
4436
|
-
const parsedDate = isFieldReference(config.dateOfEvent) ? ZodDate.safeParse(declaration[config.dateOfEvent.$$field]) : ZodDateTime.safeParse(
|
|
4437
|
-
getMixedPath(eventIndex, config.dateOfEvent.$$event)
|
|
4438
|
-
);
|
|
4439
|
-
return parsedDate.success ? extractDateString(parsedDate.data) : void 0;
|
|
4440
|
-
}
|
|
4441
|
-
var DEFAULT_PLACE_OF_EVENT_PROPERTY = "createdAtLocation";
|
|
4442
|
-
function getParsedUUID(value, oldValue) {
|
|
4443
|
-
const parsed = UUID.safeParse(value);
|
|
4444
|
-
return parsed.success ? parsed.data : oldValue;
|
|
4445
|
-
}
|
|
4446
|
-
function resolvePlaceOfEvent(eventMetadata, declaration, config) {
|
|
4447
|
-
let placeOfEvent = getParsedUUID(
|
|
4448
|
-
eventMetadata[DEFAULT_PLACE_OF_EVENT_PROPERTY]
|
|
4449
|
-
);
|
|
4450
|
-
if (config.placeOfEvent) {
|
|
4451
|
-
const addressFieldValue = AddressFieldValue.safeParse(
|
|
4452
|
-
declaration[config.placeOfEvent.$$field]
|
|
4453
|
-
);
|
|
4454
|
-
if (addressFieldValue.success && addressFieldValue.data.addressType === AddressType.DOMESTIC && addressFieldValue.data.administrativeArea) {
|
|
4455
|
-
placeOfEvent = getParsedUUID(
|
|
4456
|
-
addressFieldValue.data.administrativeArea,
|
|
4457
|
-
placeOfEvent
|
|
4458
|
-
);
|
|
4459
|
-
} else {
|
|
4460
|
-
placeOfEvent = getParsedUUID(
|
|
4461
|
-
declaration[config.placeOfEvent.$$field],
|
|
4462
|
-
placeOfEvent
|
|
4463
|
-
);
|
|
4464
|
-
}
|
|
4465
|
-
}
|
|
4466
|
-
return placeOfEvent;
|
|
4467
|
-
}
|
|
4468
|
-
function extractPotentialDuplicatesFromActions(actions) {
|
|
4469
|
-
return actions.reduce((duplicates, action) => {
|
|
4470
|
-
if (action.type === ActionType.DUPLICATE_DETECTED) {
|
|
4471
|
-
duplicates = action.content.duplicates;
|
|
4472
|
-
}
|
|
4473
|
-
if (action.type === ActionType.MARK_AS_NOT_DUPLICATE || action.type === ActionType.MARK_AS_DUPLICATE) {
|
|
4474
|
-
duplicates = [];
|
|
4475
|
-
}
|
|
4476
|
-
return duplicates;
|
|
4477
|
-
}, []);
|
|
4478
|
-
}
|
|
4479
|
-
function getCurrentEventState(event2, config) {
|
|
4480
|
-
const sortedActions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
4481
|
-
const creationAction = sortedActions.find(
|
|
4482
|
-
(action) => action.type === ActionType.CREATE
|
|
4483
|
-
);
|
|
4484
|
-
if (!creationAction) {
|
|
4485
|
-
throw new Error(`Event ${event2.id} has no creation action`);
|
|
4486
|
-
}
|
|
4487
|
-
const acceptedActions = getAcceptedActions(event2).sort(
|
|
4488
|
-
(a, b) => a.createdAt.localeCompare(b.createdAt)
|
|
4489
|
-
);
|
|
4490
|
-
const requestActionMetadata = getActionUpdateMetadata(sortedActions);
|
|
4491
|
-
const acceptedActionMetadata = getActionUpdateMetadata(acceptedActions);
|
|
4492
|
-
const declaration = aggregateActionDeclarations(event2);
|
|
4493
|
-
const status2 = getStatusFromActions(sortedActions);
|
|
4494
|
-
const legalStatuses = getLegalStatuses(sortedActions);
|
|
4495
|
-
const base = deepDropNulls({
|
|
4496
|
-
id: event2.id,
|
|
4497
|
-
type: event2.type,
|
|
4498
|
-
status: status2,
|
|
4499
|
-
legalStatuses,
|
|
4500
|
-
createdAt: creationAction.createdAt,
|
|
4501
|
-
createdBy: creationAction.createdBy,
|
|
4502
|
-
createdByUserType: creationAction.createdByUserType,
|
|
4503
|
-
createdAtLocation: creationAction.createdAtLocation,
|
|
4504
|
-
updatedAt: acceptedActionMetadata.createdAt,
|
|
4505
|
-
assignedTo: getAssignedUserFromActions(acceptedActions),
|
|
4506
|
-
updatedBy: requestActionMetadata.createdBy,
|
|
4507
|
-
updatedAtLocation: requestActionMetadata.createdAtLocation,
|
|
4508
|
-
declaration,
|
|
4509
|
-
trackingId: event2.trackingId,
|
|
4510
|
-
updatedByUserRole: requestActionMetadata.createdByRole,
|
|
4511
|
-
placeOfEvent: resolvePlaceOfEvent(
|
|
4512
|
-
{ createdAtLocation: creationAction.createdAtLocation },
|
|
4513
|
-
declaration,
|
|
4514
|
-
config
|
|
4515
|
-
),
|
|
4516
|
-
potentialDuplicates: extractPotentialDuplicatesFromActions(sortedActions),
|
|
4517
|
-
flags: getEventFlags(event2, config)
|
|
4518
|
-
});
|
|
4519
|
-
return deepDropNulls({
|
|
4520
|
-
...base,
|
|
4521
|
-
dateOfEvent: resolveDateOfEvent(base, declaration, config)
|
|
4522
|
-
});
|
|
4523
|
-
}
|
|
4524
|
-
|
|
4525
4160
|
// ../commons/src/conditionals/validate.ts
|
|
4526
4161
|
var ajv = new import__.default({
|
|
4527
4162
|
$data: true,
|
|
@@ -4529,9 +4164,9 @@ var ajv = new import__.default({
|
|
|
4529
4164
|
strict: false
|
|
4530
4165
|
// Allow minContains and other newer features
|
|
4531
4166
|
});
|
|
4532
|
-
var DataContext =
|
|
4533
|
-
rootData:
|
|
4534
|
-
$leafAdminStructureLocationIds:
|
|
4167
|
+
var DataContext = z34.object({
|
|
4168
|
+
rootData: z34.object({
|
|
4169
|
+
$leafAdminStructureLocationIds: z34.array(z34.object({ id: UUID }))
|
|
4535
4170
|
})
|
|
4536
4171
|
});
|
|
4537
4172
|
function resolveDataPath(rootData, dataPath, instancePath) {
|
|
@@ -4568,33 +4203,15 @@ function compileClientFunction(code) {
|
|
|
4568
4203
|
return fn;
|
|
4569
4204
|
}
|
|
4570
4205
|
(0, import_ajv_formats.default)(ajv);
|
|
4571
|
-
var inMemoryEventStateCache = /* @__PURE__ */ new WeakMap();
|
|
4572
|
-
function getInMemoryEventState(event2, config) {
|
|
4573
|
-
let stateByConfig = inMemoryEventStateCache.get(event2);
|
|
4574
|
-
if (!stateByConfig) {
|
|
4575
|
-
stateByConfig = /* @__PURE__ */ new WeakMap();
|
|
4576
|
-
inMemoryEventStateCache.set(event2, stateByConfig);
|
|
4577
|
-
}
|
|
4578
|
-
let state = stateByConfig.get(config);
|
|
4579
|
-
if (!state) {
|
|
4580
|
-
state = getCurrentEventState(event2, config);
|
|
4581
|
-
stateByConfig.set(config, state);
|
|
4582
|
-
}
|
|
4583
|
-
return state;
|
|
4584
|
-
}
|
|
4585
4206
|
function buildClientFunctionContext(input) {
|
|
4586
|
-
const flags = input.validatorContext?.event && input.validatorContext?.eventConfig ? getInMemoryEventState(
|
|
4587
|
-
input.validatorContext?.event,
|
|
4588
|
-
input.validatorContext?.eventConfig
|
|
4589
|
-
)?.flags : [];
|
|
4590
4207
|
return {
|
|
4591
4208
|
$form: input.form,
|
|
4592
|
-
$flags: flags,
|
|
4209
|
+
$flags: input.validatorContext?.event?.state.flags ?? [],
|
|
4593
4210
|
$now: todayISO(),
|
|
4594
4211
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
4595
4212
|
$online: isOnline(),
|
|
4596
4213
|
$user: input.validatorContext?.user,
|
|
4597
|
-
$event: input.validatorContext?.event,
|
|
4214
|
+
$event: input.validatorContext?.event?.document,
|
|
4598
4215
|
$leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
|
|
4599
4216
|
user: input.systemVariables?.user,
|
|
4600
4217
|
$window: input.systemVariables?.$window,
|
|
@@ -4655,9 +4272,6 @@ ajv.addKeyword({
|
|
|
4655
4272
|
return locations.some((location) => location.id === locationIdInput);
|
|
4656
4273
|
}
|
|
4657
4274
|
});
|
|
4658
|
-
function isAgeValue(value) {
|
|
4659
|
-
return typeof value === "object" && value !== null && "age" in value && typeof value.age === "number";
|
|
4660
|
-
}
|
|
4661
4275
|
ajv.addKeyword({
|
|
4662
4276
|
keyword: "customClientValidator",
|
|
4663
4277
|
schemaType: "object",
|
|
@@ -4675,31 +4289,6 @@ ajv.addKeyword({
|
|
|
4675
4289
|
);
|
|
4676
4290
|
}
|
|
4677
4291
|
});
|
|
4678
|
-
function validate(schema, data) {
|
|
4679
|
-
const validator = ajv.getSchema(schema.$id) || ajv.compile(schema);
|
|
4680
|
-
if ("$form" in data) {
|
|
4681
|
-
const entries = Object.entries(data.$form).map(([key, value]) => {
|
|
4682
|
-
if (!isAgeValue(value)) {
|
|
4683
|
-
return [key, value];
|
|
4684
|
-
}
|
|
4685
|
-
const age = value.age;
|
|
4686
|
-
const maybeAsOfDate = PlainDate.safeParse(data.$form[value.asOfDateRef]);
|
|
4687
|
-
return [
|
|
4688
|
-
key,
|
|
4689
|
-
{
|
|
4690
|
-
age,
|
|
4691
|
-
dob: ageToDate(
|
|
4692
|
-
age,
|
|
4693
|
-
maybeAsOfDate.success ? maybeAsOfDate.data : PlainDate.parse(data.$now)
|
|
4694
|
-
)
|
|
4695
|
-
}
|
|
4696
|
-
];
|
|
4697
|
-
});
|
|
4698
|
-
data.$form = Object.fromEntries(entries);
|
|
4699
|
-
}
|
|
4700
|
-
const result = validator(data);
|
|
4701
|
-
return result;
|
|
4702
|
-
}
|
|
4703
4292
|
function isOnline() {
|
|
4704
4293
|
if (typeof window !== "undefined" && typeof navigator !== "undefined") {
|
|
4705
4294
|
return navigator.onLine;
|
|
@@ -4709,31 +4298,9 @@ function isOnline() {
|
|
|
4709
4298
|
|
|
4710
4299
|
// ../commons/src/events/utils.ts
|
|
4711
4300
|
var import_date_fns3 = require("date-fns");
|
|
4712
|
-
function ageToDate(age, asOfDate) {
|
|
4713
|
-
const date = plainDateToLocalDate(asOfDate);
|
|
4714
|
-
return PlainDate.parse((0, import_date_fns3.format)((0, import_date_fns3.subYears)(date, age), "yyyy-MM-dd"));
|
|
4715
|
-
}
|
|
4716
4301
|
function getDeclarationFields(configuration) {
|
|
4717
4302
|
return configuration.declaration.pages.flatMap(({ fields }) => fields);
|
|
4718
4303
|
}
|
|
4719
|
-
function isActionConfigType(type) {
|
|
4720
|
-
return actionConfigTypes.has(type);
|
|
4721
|
-
}
|
|
4722
|
-
function getActionConfig({
|
|
4723
|
-
eventConfiguration,
|
|
4724
|
-
actionType,
|
|
4725
|
-
customActionType
|
|
4726
|
-
}) {
|
|
4727
|
-
if (actionType === ActionType.NOTIFY) {
|
|
4728
|
-
return eventConfiguration.actions.find((a) => a.type === ActionType.NOTIFY) ?? eventConfiguration.actions.find((a) => a.type === ActionType.DECLARE);
|
|
4729
|
-
}
|
|
4730
|
-
return eventConfiguration.actions.find((a) => {
|
|
4731
|
-
if (a.type === ActionType.CUSTOM && customActionType) {
|
|
4732
|
-
return a.customActionType === customActionType;
|
|
4733
|
-
}
|
|
4734
|
-
return a.type === actionType;
|
|
4735
|
-
});
|
|
4736
|
-
}
|
|
4737
4304
|
var getActionAnnotationFields = (actionConfig) => {
|
|
4738
4305
|
if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
|
|
4739
4306
|
return actionConfig.correctionForm.pages.flatMap(({ fields }) => fields);
|
|
@@ -4748,122 +4315,17 @@ var getActionAnnotationFields = (actionConfig) => {
|
|
|
4748
4315
|
function getAllAnnotationFields(config) {
|
|
4749
4316
|
return (0, import_lodash4.flattenDeep)(config.actions.map(getActionAnnotationFields));
|
|
4750
4317
|
}
|
|
4751
|
-
function deepMerge(currentDocument, actionDocument) {
|
|
4752
|
-
const currentDocumentClone = (0, import_lodash4.cloneDeep)(currentDocument);
|
|
4753
|
-
return (0, import_lodash4.mergeWith)(
|
|
4754
|
-
(0, import_lodash4.cloneDeep)(currentDocumentClone),
|
|
4755
|
-
actionDocument,
|
|
4756
|
-
(previousValue, incomingValue) => {
|
|
4757
|
-
if (incomingValue === void 0) {
|
|
4758
|
-
return previousValue;
|
|
4759
|
-
}
|
|
4760
|
-
if ((0, import_lodash4.isArray)(incomingValue)) {
|
|
4761
|
-
return incomingValue;
|
|
4762
|
-
}
|
|
4763
|
-
if ((0, import_lodash4.isObject)(previousValue) && (0, import_lodash4.isObject)(incomingValue)) {
|
|
4764
|
-
return void 0;
|
|
4765
|
-
}
|
|
4766
|
-
return incomingValue;
|
|
4767
|
-
}
|
|
4768
|
-
);
|
|
4769
|
-
}
|
|
4770
4318
|
var findAllFields = (config) => {
|
|
4771
4319
|
return (0, import_lodash4.flattenDeep)([
|
|
4772
4320
|
...getDeclarationFields(config),
|
|
4773
4321
|
...getAllAnnotationFields(config)
|
|
4774
4322
|
]);
|
|
4775
4323
|
};
|
|
4776
|
-
function getMixedPath(obj, path, defaultValue) {
|
|
4777
|
-
const parts = path.split(".");
|
|
4778
|
-
const resolve = (current, segments) => {
|
|
4779
|
-
if (current == null || segments.length === 0) {
|
|
4780
|
-
return current;
|
|
4781
|
-
}
|
|
4782
|
-
for (let i = segments.length; i > 0; i--) {
|
|
4783
|
-
const compoundKey = segments.slice(0, i).join(".");
|
|
4784
|
-
if ((0, import_lodash4.has)(current, compoundKey)) {
|
|
4785
|
-
const next = (0, import_lodash4.get)(current, compoundKey);
|
|
4786
|
-
return resolve(next, segments.slice(i));
|
|
4787
|
-
}
|
|
4788
|
-
}
|
|
4789
|
-
return void 0;
|
|
4790
|
-
};
|
|
4791
|
-
const result = resolve(obj, parts);
|
|
4792
|
-
return (0, import_lodash4.isNil)(result) ? defaultValue : result;
|
|
4793
|
-
}
|
|
4794
|
-
function isAcceptedAction(a) {
|
|
4795
|
-
return a.status === ActionStatus.Accepted;
|
|
4796
|
-
}
|
|
4797
|
-
function getCompleteActionAnnotation(event2, action) {
|
|
4798
|
-
if (action.originalActionId) {
|
|
4799
|
-
const originalAction = event2.actions.find(
|
|
4800
|
-
({ id }) => id === action.originalActionId
|
|
4801
|
-
);
|
|
4802
|
-
if (originalAction?.status === ActionStatus.Requested) {
|
|
4803
|
-
return deepMerge(originalAction.annotation ?? {}, action.annotation ?? {});
|
|
4804
|
-
}
|
|
4805
|
-
}
|
|
4806
|
-
return action.annotation ?? {};
|
|
4807
|
-
}
|
|
4808
|
-
function getCompleteActionDeclaration(declaration, event2, action) {
|
|
4809
|
-
if (action.originalActionId) {
|
|
4810
|
-
const originalAction = event2.actions.find(
|
|
4811
|
-
({ id }) => id === action.originalActionId
|
|
4812
|
-
);
|
|
4813
|
-
if (originalAction?.status === ActionStatus.Requested) {
|
|
4814
|
-
return deepMerge(
|
|
4815
|
-
deepMerge(declaration, originalAction.declaration),
|
|
4816
|
-
action.declaration
|
|
4817
|
-
);
|
|
4818
|
-
}
|
|
4819
|
-
}
|
|
4820
|
-
return deepMerge(declaration, action.declaration);
|
|
4821
|
-
}
|
|
4822
|
-
function getAcceptedActions(event2) {
|
|
4823
|
-
return event2.actions.filter(isAcceptedAction).map((action) => ({
|
|
4824
|
-
...action,
|
|
4825
|
-
declaration: getCompleteActionDeclaration({}, event2, action),
|
|
4826
|
-
annotation: getCompleteActionAnnotation(event2, action)
|
|
4827
|
-
}));
|
|
4828
|
-
}
|
|
4829
4324
|
var EXCLUDED_ACTIONS = [
|
|
4830
4325
|
ActionType.REQUEST_CORRECTION,
|
|
4831
4326
|
ActionType.PRINT_CERTIFICATE,
|
|
4832
4327
|
ActionType.REJECT_CORRECTION
|
|
4833
4328
|
];
|
|
4834
|
-
function aggregateActionDeclarations(event2) {
|
|
4835
|
-
const allAcceptedActions = getAcceptedActions(event2);
|
|
4836
|
-
const aggregatedActions = allAcceptedActions.filter((a) => !EXCLUDED_ACTIONS.some((type) => type === a.type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
4837
|
-
return aggregatedActions.reduce((declaration, action) => {
|
|
4838
|
-
if (action.type === ActionType.APPROVE_CORRECTION) {
|
|
4839
|
-
const requestAction = allAcceptedActions.find(
|
|
4840
|
-
({ id }) => id === action.requestId
|
|
4841
|
-
);
|
|
4842
|
-
if (!requestAction) {
|
|
4843
|
-
return declaration;
|
|
4844
|
-
}
|
|
4845
|
-
const declarationWithApprovedCorrection = getCompleteActionDeclaration(
|
|
4846
|
-
declaration,
|
|
4847
|
-
event2,
|
|
4848
|
-
requestAction
|
|
4849
|
-
);
|
|
4850
|
-
return getCompleteActionDeclaration(
|
|
4851
|
-
declarationWithApprovedCorrection,
|
|
4852
|
-
event2,
|
|
4853
|
-
action
|
|
4854
|
-
);
|
|
4855
|
-
}
|
|
4856
|
-
return getCompleteActionDeclaration(declaration, event2, action);
|
|
4857
|
-
}, {});
|
|
4858
|
-
}
|
|
4859
|
-
function aggregateActionAnnotations(event2) {
|
|
4860
|
-
return event2.actions.reduce((ann, sortedAction) => {
|
|
4861
|
-
if (!("annotation" in sortedAction) || !sortedAction.annotation) {
|
|
4862
|
-
return ann;
|
|
4863
|
-
}
|
|
4864
|
-
return deepMerge(ann, sortedAction.annotation);
|
|
4865
|
-
}, {});
|
|
4866
|
-
}
|
|
4867
4329
|
|
|
4868
4330
|
// ../commons/src/events/eventConfigValidation.ts
|
|
4869
4331
|
function validateAdvancedSearchConfig(event2, ctx) {
|
|
@@ -4985,11 +4447,11 @@ function validateActionOrder(event2, ctx) {
|
|
|
4985
4447
|
}
|
|
4986
4448
|
|
|
4987
4449
|
// ../commons/src/events/EventConfig.ts
|
|
4988
|
-
var EventFieldReference =
|
|
4450
|
+
var EventFieldReference = z35.object({ $$event: EventMetadataDateFieldIdInput }).describe(
|
|
4989
4451
|
"Reference to a field defined in the event metadata, using the field id."
|
|
4990
4452
|
);
|
|
4991
|
-
var _EventConfigBase =
|
|
4992
|
-
id:
|
|
4453
|
+
var _EventConfigBase = z35.object({
|
|
4454
|
+
id: z35.string().describe(
|
|
4993
4455
|
'Machine-readable identifier of the event (e.g. "birth", "death").'
|
|
4994
4456
|
),
|
|
4995
4457
|
dateOfEvent: FieldReference.or(EventFieldReference).optional().describe(
|
|
@@ -5008,25 +4470,25 @@ var _EventConfigBase = z34.object({
|
|
|
5008
4470
|
"Summary information displayed in the event overview."
|
|
5009
4471
|
),
|
|
5010
4472
|
label: TranslationConfig.describe("Human-readable label for the event type."),
|
|
5011
|
-
actions:
|
|
4473
|
+
actions: z35.array(ActionConfig).describe(
|
|
5012
4474
|
"Configuration of core and custom actions associated with the event."
|
|
5013
4475
|
),
|
|
5014
|
-
actionOrder:
|
|
4476
|
+
actionOrder: z35.array(z35.string()).optional().describe(
|
|
5015
4477
|
"Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
|
|
5016
4478
|
),
|
|
5017
4479
|
declaration: DeclarationFormConfig.describe(
|
|
5018
4480
|
"Configuration of the form used to gather event data."
|
|
5019
4481
|
),
|
|
5020
|
-
advancedSearch:
|
|
4482
|
+
advancedSearch: z35.array(AdvancedSearchConfig).optional().default([]).describe(
|
|
5021
4483
|
"Configuration of fields available in the advanced search feature."
|
|
5022
4484
|
),
|
|
5023
|
-
flags:
|
|
4485
|
+
flags: z35.array(FlagConfig).optional().default([]).describe(
|
|
5024
4486
|
"Configuration of custom flags associated with the actions of this event type."
|
|
5025
4487
|
),
|
|
5026
|
-
analytics:
|
|
4488
|
+
analytics: z35.boolean().optional().default(true).describe(
|
|
5027
4489
|
"Indicates whether the records of this event type are included in analytics"
|
|
5028
4490
|
),
|
|
5029
|
-
icon:
|
|
4491
|
+
icon: z35.partialRecord(AvailableIcons, Conditional).optional().describe(
|
|
5030
4492
|
'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.'
|
|
5031
4493
|
)
|
|
5032
4494
|
});
|
|
@@ -5047,7 +4509,7 @@ var defineActionForm = (actionForm) => ActionFormConfig.parse(actionForm);
|
|
|
5047
4509
|
var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
|
|
5048
4510
|
|
|
5049
4511
|
// ../commons/src/events/WorkqueueConfig.ts
|
|
5050
|
-
var
|
|
4512
|
+
var z38 = __toESM(require("zod/v4"));
|
|
5051
4513
|
|
|
5052
4514
|
// ../commons/src/searchConfigs.ts
|
|
5053
4515
|
function createSearchConfig(baseField) {
|
|
@@ -5258,17 +4720,17 @@ var event = Object.assign(eventFn, {
|
|
|
5258
4720
|
});
|
|
5259
4721
|
|
|
5260
4722
|
// ../commons/src/events/WorkqueueColumnConfig.ts
|
|
5261
|
-
var
|
|
4723
|
+
var z36 = __toESM(require("zod/v4"));
|
|
5262
4724
|
var WorkqueueColumnKeysArray = [
|
|
5263
4725
|
...EventMetadataKeysArray,
|
|
5264
4726
|
"title",
|
|
5265
4727
|
"outbox"
|
|
5266
4728
|
];
|
|
5267
|
-
var WorkqueueColumnKeys =
|
|
5268
|
-
var WorkqueueColumnValue =
|
|
4729
|
+
var WorkqueueColumnKeys = z36.enum(WorkqueueColumnKeysArray);
|
|
4730
|
+
var WorkqueueColumnValue = z36.object({
|
|
5269
4731
|
$event: WorkqueueColumnKeys
|
|
5270
4732
|
});
|
|
5271
|
-
var WorkqueueColumn =
|
|
4733
|
+
var WorkqueueColumn = z36.object({
|
|
5272
4734
|
label: TranslationConfig,
|
|
5273
4735
|
value: WorkqueueColumnValue
|
|
5274
4736
|
}).meta({
|
|
@@ -5282,51 +4744,51 @@ function defineWorkqueuesColumns(workqueueColumns) {
|
|
|
5282
4744
|
}
|
|
5283
4745
|
|
|
5284
4746
|
// ../commons/src/events/CountryConfigQueryInput.ts
|
|
5285
|
-
var
|
|
5286
|
-
var SerializableExact =
|
|
5287
|
-
type:
|
|
5288
|
-
term:
|
|
5289
|
-
});
|
|
5290
|
-
var SerializableWithin =
|
|
5291
|
-
type:
|
|
5292
|
-
location:
|
|
5293
|
-
});
|
|
5294
|
-
var SerializedQueryExpression =
|
|
5295
|
-
eventType:
|
|
5296
|
-
status:
|
|
5297
|
-
createdAt:
|
|
5298
|
-
updatedAt:
|
|
5299
|
-
"legalStatuses.DECLARED.createdAtLocation":
|
|
5300
|
-
"legalStatuses.DECLARED.createdByRole":
|
|
5301
|
-
"legalStatuses.REGISTERED.createdAt":
|
|
5302
|
-
"legalStatuses.REGISTERED.createdAtLocation":
|
|
5303
|
-
"legalStatuses.REGISTERED.createdByRole":
|
|
5304
|
-
"legalStatuses.REGISTERED.registrationNumber":
|
|
5305
|
-
createdAtLocation:
|
|
5306
|
-
|
|
4747
|
+
var z37 = __toESM(require("zod/v4"));
|
|
4748
|
+
var SerializableExact = z37.object({
|
|
4749
|
+
type: z37.literal("exact"),
|
|
4750
|
+
term: z37.union([z37.string(), SerializedUserField])
|
|
4751
|
+
});
|
|
4752
|
+
var SerializableWithin = z37.object({
|
|
4753
|
+
type: z37.literal("within"),
|
|
4754
|
+
location: z37.union([z37.string(), SerializedUserField])
|
|
4755
|
+
});
|
|
4756
|
+
var SerializedQueryExpression = z37.object({
|
|
4757
|
+
eventType: z37.string(),
|
|
4758
|
+
status: z37.optional(z37.union([AnyOfStatus, ExactStatus])),
|
|
4759
|
+
createdAt: z37.optional(DateCondition),
|
|
4760
|
+
updatedAt: z37.optional(DateCondition),
|
|
4761
|
+
"legalStatuses.DECLARED.createdAtLocation": z37.optional(SerializableWithin),
|
|
4762
|
+
"legalStatuses.DECLARED.createdByRole": z37.optional(AnyOf),
|
|
4763
|
+
"legalStatuses.REGISTERED.createdAt": z37.optional(DateCondition),
|
|
4764
|
+
"legalStatuses.REGISTERED.createdAtLocation": z37.optional(SerializableWithin),
|
|
4765
|
+
"legalStatuses.REGISTERED.createdByRole": z37.optional(AnyOf),
|
|
4766
|
+
"legalStatuses.REGISTERED.registrationNumber": z37.optional(Exact),
|
|
4767
|
+
createdAtLocation: z37.optional(
|
|
4768
|
+
z37.union([SerializableWithin, SerializableExact])
|
|
5307
4769
|
),
|
|
5308
|
-
updatedAtLocation:
|
|
5309
|
-
|
|
4770
|
+
updatedAtLocation: z37.optional(
|
|
4771
|
+
z37.union([SerializableWithin, SerializableExact])
|
|
5310
4772
|
),
|
|
5311
|
-
updatedByUserRole:
|
|
5312
|
-
assignedTo:
|
|
5313
|
-
createdBy:
|
|
4773
|
+
updatedByUserRole: z37.optional(SerializableExact),
|
|
4774
|
+
assignedTo: z37.optional(SerializableExact),
|
|
4775
|
+
createdBy: z37.optional(SerializableExact),
|
|
5314
4776
|
createdByUserType: ExactUserType,
|
|
5315
|
-
updatedBy:
|
|
5316
|
-
trackingId:
|
|
5317
|
-
flags:
|
|
4777
|
+
updatedBy: z37.optional(SerializableExact),
|
|
4778
|
+
trackingId: z37.optional(Exact),
|
|
4779
|
+
flags: z37.optional(ContainsFlags),
|
|
5318
4780
|
data: QueryInput
|
|
5319
4781
|
}).partial();
|
|
5320
|
-
var Or2 =
|
|
5321
|
-
type:
|
|
5322
|
-
clauses:
|
|
4782
|
+
var Or2 = z37.object({
|
|
4783
|
+
type: z37.literal("or"),
|
|
4784
|
+
clauses: z37.array(SerializedQueryExpression)
|
|
5323
4785
|
});
|
|
5324
|
-
var And2 =
|
|
5325
|
-
type:
|
|
5326
|
-
clauses:
|
|
4786
|
+
var And2 = z37.object({
|
|
4787
|
+
type: z37.literal("and"),
|
|
4788
|
+
clauses: z37.array(SerializedQueryExpression)
|
|
5327
4789
|
});
|
|
5328
|
-
var CountryConfigQueryType =
|
|
5329
|
-
var CountryConfigQueryInputType =
|
|
4790
|
+
var CountryConfigQueryType = z37.discriminatedUnion("type", [And2, Or2]);
|
|
4791
|
+
var CountryConfigQueryInputType = z37.union([
|
|
5330
4792
|
SerializedQueryExpression,
|
|
5331
4793
|
And2,
|
|
5332
4794
|
Or2
|
|
@@ -5351,16 +4813,16 @@ var mandatoryColumns = defineWorkqueuesColumns([
|
|
|
5351
4813
|
value: event.field("updatedAt")
|
|
5352
4814
|
}
|
|
5353
4815
|
]);
|
|
5354
|
-
var WorkqueueConfig =
|
|
5355
|
-
slug:
|
|
4816
|
+
var WorkqueueConfig = z38.object({
|
|
4817
|
+
slug: z38.string().describe("Determines the url of the workqueue."),
|
|
5356
4818
|
name: TranslationConfig.describe(
|
|
5357
4819
|
"Title of the workflow (both in navigation and on the page)"
|
|
5358
4820
|
),
|
|
5359
4821
|
query: CountryConfigQueryType,
|
|
5360
|
-
action:
|
|
4822
|
+
action: z38.object({ type: WorkqueueActionType }).optional().describe(
|
|
5361
4823
|
"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."
|
|
5362
4824
|
),
|
|
5363
|
-
columns:
|
|
4825
|
+
columns: z38.array(WorkqueueColumn).default(mandatoryColumns),
|
|
5364
4826
|
icon: AvailableIcons,
|
|
5365
4827
|
emptyMessage: TranslationConfig.optional()
|
|
5366
4828
|
}).describe("Configuration for workqueue.");
|
|
@@ -5374,10 +4836,10 @@ var WorkqueueConfigInput = WorkqueueConfig.extend({
|
|
|
5374
4836
|
id: "WorkqueueConfig",
|
|
5375
4837
|
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."
|
|
5376
4838
|
});
|
|
5377
|
-
var WorkqueueCountInput =
|
|
5378
|
-
|
|
4839
|
+
var WorkqueueCountInput = z38.array(
|
|
4840
|
+
z38.object({ slug: z38.string(), query: QueryType })
|
|
5379
4841
|
);
|
|
5380
|
-
var WorkqueueCountOutput =
|
|
4842
|
+
var WorkqueueCountOutput = z38.record(z38.string(), z38.number());
|
|
5381
4843
|
|
|
5382
4844
|
// ../commons/src/events/workqueueDefaultColumns.ts
|
|
5383
4845
|
var defaultWorkqueueColumns = [
|
|
@@ -5400,21 +4862,21 @@ var defaultWorkqueueColumns = [
|
|
|
5400
4862
|
];
|
|
5401
4863
|
|
|
5402
4864
|
// ../commons/src/events/Draft.ts
|
|
5403
|
-
var
|
|
4865
|
+
var z40 = __toESM(require("zod/v4"));
|
|
5404
4866
|
|
|
5405
4867
|
// ../commons/src/events/ActionInput.ts
|
|
5406
|
-
var
|
|
5407
|
-
var BaseActionInput =
|
|
4868
|
+
var z39 = __toESM(require("zod/v4"));
|
|
4869
|
+
var BaseActionInput = z39.object({
|
|
5408
4870
|
eventId: UUID,
|
|
5409
|
-
transactionId:
|
|
4871
|
+
transactionId: z39.string(),
|
|
5410
4872
|
declaration: ActionUpdate.default({}),
|
|
5411
4873
|
annotation: ActionUpdate.optional(),
|
|
5412
4874
|
originalActionId: UUID.optional(),
|
|
5413
4875
|
// should not be part of base action.
|
|
5414
|
-
keepAssignment:
|
|
5415
|
-
keepAssignmentIfAccepted:
|
|
5416
|
-
keepAssignmentIfRejected:
|
|
5417
|
-
waitFor:
|
|
4876
|
+
keepAssignment: z39.boolean().optional(),
|
|
4877
|
+
keepAssignmentIfAccepted: z39.boolean().optional(),
|
|
4878
|
+
keepAssignmentIfRejected: z39.boolean().optional(),
|
|
4879
|
+
waitFor: z39.boolean().default(true).describe(
|
|
5418
4880
|
"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."
|
|
5419
4881
|
),
|
|
5420
4882
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
@@ -5424,8 +4886,8 @@ var BaseActionInput = z38.object({
|
|
|
5424
4886
|
)
|
|
5425
4887
|
});
|
|
5426
4888
|
var CreateActionInput = BaseActionInput.extend(
|
|
5427
|
-
|
|
5428
|
-
type:
|
|
4889
|
+
z39.object({
|
|
4890
|
+
type: z39.literal(ActionType.CREATE).default(ActionType.CREATE),
|
|
5429
4891
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
5430
4892
|
createdAtLocation: UUID.nullish().describe(
|
|
5431
4893
|
"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."
|
|
@@ -5433,14 +4895,14 @@ var CreateActionInput = BaseActionInput.extend(
|
|
|
5433
4895
|
}).shape
|
|
5434
4896
|
);
|
|
5435
4897
|
var RegisterActionInput = BaseActionInput.extend(
|
|
5436
|
-
|
|
5437
|
-
type:
|
|
5438
|
-
registrationNumber:
|
|
4898
|
+
z39.strictObject({
|
|
4899
|
+
type: z39.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
|
4900
|
+
registrationNumber: z39.string().optional()
|
|
5439
4901
|
}).shape
|
|
5440
4902
|
);
|
|
5441
4903
|
var NotifyActionInput = BaseActionInput.extend(
|
|
5442
|
-
|
|
5443
|
-
type:
|
|
4904
|
+
z39.object({
|
|
4905
|
+
type: z39.literal(ActionType.NOTIFY).default(ActionType.NOTIFY),
|
|
5444
4906
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
5445
4907
|
createdAtLocation: UUID.nullish().describe(
|
|
5446
4908
|
"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."
|
|
@@ -5456,103 +4918,107 @@ var NotifyActionInput = BaseActionInput.extend(
|
|
|
5456
4918
|
}
|
|
5457
4919
|
});
|
|
5458
4920
|
var DeclareActionInput = BaseActionInput.extend(
|
|
5459
|
-
|
|
5460
|
-
type:
|
|
4921
|
+
z39.object({
|
|
4922
|
+
type: z39.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
|
5461
4923
|
}).shape
|
|
5462
4924
|
);
|
|
5463
4925
|
var EditActionInput = BaseActionInput.extend(
|
|
5464
|
-
|
|
5465
|
-
type:
|
|
4926
|
+
z39.object({
|
|
4927
|
+
type: z39.literal(ActionType.EDIT).default(ActionType.EDIT)
|
|
5466
4928
|
}).shape
|
|
5467
4929
|
);
|
|
5468
4930
|
var PrintCertificateActionInput = BaseActionInput.extend(
|
|
5469
|
-
|
|
5470
|
-
type:
|
|
4931
|
+
z39.object({
|
|
4932
|
+
type: z39.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
|
|
5471
4933
|
content: PrintContent.optional()
|
|
5472
4934
|
}).shape
|
|
5473
4935
|
);
|
|
5474
4936
|
var RejectDeclarationActionInput = BaseActionInput.extend(
|
|
5475
|
-
|
|
5476
|
-
type:
|
|
4937
|
+
z39.object({
|
|
4938
|
+
type: z39.literal(ActionType.REJECT).default(ActionType.REJECT),
|
|
5477
4939
|
content: ReasonContent
|
|
5478
4940
|
}).shape
|
|
5479
4941
|
);
|
|
5480
4942
|
var DuplicateDetectedActionInput = BaseActionInput.extend(
|
|
5481
|
-
|
|
5482
|
-
type:
|
|
5483
|
-
content:
|
|
5484
|
-
duplicates:
|
|
4943
|
+
z39.object({
|
|
4944
|
+
type: z39.literal(ActionType.DUPLICATE_DETECTED).default(ActionType.DUPLICATE_DETECTED),
|
|
4945
|
+
content: z39.object({
|
|
4946
|
+
duplicates: z39.array(PotentialDuplicate)
|
|
5485
4947
|
})
|
|
5486
4948
|
}).shape
|
|
5487
4949
|
);
|
|
5488
4950
|
var MarkAsDuplicateActionInput = BaseActionInput.extend(
|
|
5489
|
-
|
|
5490
|
-
type:
|
|
5491
|
-
content:
|
|
4951
|
+
z39.object({
|
|
4952
|
+
type: z39.literal(ActionType.MARK_AS_DUPLICATE).default(ActionType.MARK_AS_DUPLICATE),
|
|
4953
|
+
content: z39.object({
|
|
5492
4954
|
duplicateOf: UUID
|
|
5493
4955
|
}).optional()
|
|
5494
4956
|
}).shape
|
|
5495
4957
|
);
|
|
5496
4958
|
var MarkNotDuplicateActionInput = BaseActionInput.extend(
|
|
5497
|
-
|
|
5498
|
-
type:
|
|
4959
|
+
z39.object({
|
|
4960
|
+
type: z39.literal(ActionType.MARK_AS_NOT_DUPLICATE).default(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
5499
4961
|
}).shape
|
|
5500
4962
|
);
|
|
5501
4963
|
var ArchiveActionInput = BaseActionInput.extend(
|
|
5502
|
-
|
|
5503
|
-
type:
|
|
5504
|
-
|
|
4964
|
+
z39.object({
|
|
4965
|
+
type: z39.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
|
|
4966
|
+
/**
|
|
4967
|
+
* Archiving does not collect a reason on its own. Only the
|
|
4968
|
+
* "mark as duplicate" flow archives with a reason attached.
|
|
4969
|
+
*/
|
|
4970
|
+
content: ReasonContent.optional()
|
|
5505
4971
|
}).shape
|
|
5506
4972
|
);
|
|
5507
4973
|
var UnarchiveActionInput = BaseActionInput.extend(
|
|
5508
|
-
|
|
5509
|
-
type:
|
|
4974
|
+
z39.object({
|
|
4975
|
+
type: z39.literal(ActionType.UNARCHIVE).default(ActionType.UNARCHIVE)
|
|
5510
4976
|
}).shape
|
|
5511
4977
|
);
|
|
5512
4978
|
var AssignActionInput = BaseActionInput.extend(
|
|
5513
|
-
|
|
5514
|
-
type:
|
|
5515
|
-
assignedTo:
|
|
4979
|
+
z39.object({
|
|
4980
|
+
type: z39.literal(ActionType.ASSIGN),
|
|
4981
|
+
assignedTo: z39.string()
|
|
5516
4982
|
}).shape
|
|
5517
4983
|
);
|
|
5518
4984
|
var UnassignActionInput = BaseActionInput.extend(
|
|
5519
|
-
|
|
5520
|
-
type:
|
|
5521
|
-
assignedTo:
|
|
4985
|
+
z39.object({
|
|
4986
|
+
type: z39.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
|
|
4987
|
+
assignedTo: z39.literal(null).default(null)
|
|
5522
4988
|
}).shape
|
|
5523
4989
|
);
|
|
5524
4990
|
var RequestCorrectionActionInput = BaseActionInput.extend(
|
|
5525
|
-
|
|
5526
|
-
type:
|
|
4991
|
+
z39.object({
|
|
4992
|
+
type: z39.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
|
5527
4993
|
}).shape
|
|
5528
4994
|
);
|
|
5529
4995
|
var RejectCorrectionActionInput = BaseActionInput.extend(
|
|
5530
|
-
|
|
5531
|
-
requestId:
|
|
5532
|
-
type:
|
|
4996
|
+
z39.object({
|
|
4997
|
+
requestId: z39.string(),
|
|
4998
|
+
type: z39.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION),
|
|
5533
4999
|
content: ReasonContent
|
|
5534
5000
|
}).shape
|
|
5535
5001
|
);
|
|
5536
5002
|
var ApproveCorrectionActionInput = BaseActionInput.extend(
|
|
5537
|
-
|
|
5538
|
-
requestId:
|
|
5539
|
-
type:
|
|
5540
|
-
content:
|
|
5003
|
+
z39.object({
|
|
5004
|
+
requestId: z39.string(),
|
|
5005
|
+
type: z39.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION),
|
|
5006
|
+
content: z39.object({ immediateCorrection: z39.boolean().optional() }).optional()
|
|
5541
5007
|
}).shape
|
|
5542
5008
|
);
|
|
5543
5009
|
var ReadActionInput = BaseActionInput.extend(
|
|
5544
|
-
|
|
5545
|
-
type:
|
|
5010
|
+
z39.object({
|
|
5011
|
+
type: z39.literal(ActionType.READ).default(ActionType.READ)
|
|
5546
5012
|
}).shape
|
|
5547
5013
|
);
|
|
5548
|
-
var DeleteActionInput =
|
|
5014
|
+
var DeleteActionInput = z39.object({ eventId: UUID });
|
|
5549
5015
|
var CustomActionInput = BaseActionInput.extend(
|
|
5550
|
-
|
|
5551
|
-
type:
|
|
5552
|
-
customActionType:
|
|
5016
|
+
z39.object({
|
|
5017
|
+
type: z39.literal(ActionType.CUSTOM).default(ActionType.CUSTOM),
|
|
5018
|
+
customActionType: z39.string().describe("Name of the custom action.")
|
|
5553
5019
|
}).shape
|
|
5554
5020
|
);
|
|
5555
|
-
var ActionInput =
|
|
5021
|
+
var ActionInput = z39.discriminatedUnion("type", [
|
|
5556
5022
|
CreateActionInput.meta({ id: "CreateActionInput" }),
|
|
5557
5023
|
RegisterActionInput.meta({ id: "RegisterActionInput" }),
|
|
5558
5024
|
NotifyActionInput.meta({ id: "NotifyActionInput" }),
|
|
@@ -5589,11 +5055,11 @@ var ActionInput = z38.discriminatedUnion("type", [
|
|
|
5589
5055
|
});
|
|
5590
5056
|
|
|
5591
5057
|
// ../commons/src/events/Draft.ts
|
|
5592
|
-
var Draft =
|
|
5058
|
+
var Draft = z40.object({
|
|
5593
5059
|
id: UUID,
|
|
5594
5060
|
eventId: UUID,
|
|
5595
|
-
transactionId:
|
|
5596
|
-
createdAt:
|
|
5061
|
+
transactionId: z40.string(),
|
|
5062
|
+
createdAt: z40.string().datetime(),
|
|
5597
5063
|
action: ActionBase.extend({
|
|
5598
5064
|
type: ActionTypes.exclude([ActionTypes.enum.DELETE])
|
|
5599
5065
|
}).omit({ id: true, createdAtLocation: true })
|
|
@@ -5602,7 +5068,7 @@ var Draft = z39.object({
|
|
|
5602
5068
|
);
|
|
5603
5069
|
var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
|
|
5604
5070
|
type: ActionTypes.exclude([ActionTypes.enum.DELETE]),
|
|
5605
|
-
status:
|
|
5071
|
+
status: z40.enum([
|
|
5606
5072
|
ActionStatus.Requested,
|
|
5607
5073
|
ActionStatus.Accepted,
|
|
5608
5074
|
ActionStatus.Rejected
|
|
@@ -5610,30 +5076,33 @@ var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
|
|
|
5610
5076
|
});
|
|
5611
5077
|
|
|
5612
5078
|
// ../commons/src/events/EventInput.ts
|
|
5613
|
-
var
|
|
5079
|
+
var z41 = __toESM(require("zod/v4"));
|
|
5614
5080
|
var import_uuid11 = require("uuid");
|
|
5615
|
-
var EventInput =
|
|
5616
|
-
transactionId:
|
|
5617
|
-
type:
|
|
5081
|
+
var EventInput = z41.object({
|
|
5082
|
+
transactionId: z41.string(),
|
|
5083
|
+
type: z41.string(),
|
|
5618
5084
|
createdAtLocation: UUID.nullish().describe(
|
|
5619
5085
|
"Location where the event occurred. Required for system users."
|
|
5620
5086
|
)
|
|
5621
5087
|
}).meta({ default: { transactionId: (0, import_uuid11.v4)(), type: "birth" } });
|
|
5622
5088
|
|
|
5623
5089
|
// ../commons/src/events/EventDocument.ts
|
|
5624
|
-
var
|
|
5625
|
-
var EventDocument =
|
|
5090
|
+
var z42 = __toESM(require("zod/v4"));
|
|
5091
|
+
var EventDocument = z42.object({
|
|
5626
5092
|
id: UUID.describe("Unique identifier of the event."),
|
|
5627
|
-
type:
|
|
5628
|
-
createdAt:
|
|
5629
|
-
updatedAt:
|
|
5093
|
+
type: z42.string().describe("Type of the event (e.g. birth, death, marriage)."),
|
|
5094
|
+
createdAt: z42.string().datetime().describe("Timestamp indicating when the event was created."),
|
|
5095
|
+
updatedAt: z42.string().datetime().describe(
|
|
5630
5096
|
"Timestamp of the last update, excluding changes from actions."
|
|
5631
5097
|
),
|
|
5632
|
-
actions:
|
|
5633
|
-
trackingId:
|
|
5098
|
+
actions: z42.array(Action).describe("Ordered list of actions associated with the event."),
|
|
5099
|
+
trackingId: z42.string().describe(
|
|
5634
5100
|
"System-generated tracking identifier used to look up the event."
|
|
5635
5101
|
)
|
|
5636
5102
|
}).meta({ id: "EventDocument" });
|
|
5103
|
+
var EventDocumentOnlyLastAction = EventDocument.extend({
|
|
5104
|
+
actions: z42.array(Action).max(1).describe("Only the last action associated with the event.")
|
|
5105
|
+
}).brand("EventDocumentOnlyLastAction");
|
|
5637
5106
|
|
|
5638
5107
|
// ../commons/src/events/defineConfig.ts
|
|
5639
5108
|
var IGNORED_EVENT_TYPES = [
|
|
@@ -8084,21 +7553,7 @@ var digitalIdentityEvent = defineConfig({
|
|
|
8084
7553
|
});
|
|
8085
7554
|
|
|
8086
7555
|
// ../commons/src/events/test.utils.ts
|
|
8087
|
-
var
|
|
8088
|
-
var TestUserRole = z42.enum([
|
|
8089
|
-
"FIELD_AGENT",
|
|
8090
|
-
"LOCAL_REGISTRAR",
|
|
8091
|
-
"LOCAL_SYSTEM_ADMIN",
|
|
8092
|
-
"NATIONAL_REGISTRAR",
|
|
8093
|
-
"REGISTRATION_AGENT",
|
|
8094
|
-
"NATIONAL_SYSTEM_ADMIN",
|
|
8095
|
-
"SOCIAL_WORKER",
|
|
8096
|
-
"COMMUNITY_LEADER",
|
|
8097
|
-
"PROVINCIAL_REGISTRAR"
|
|
8098
|
-
]);
|
|
8099
|
-
|
|
8100
|
-
// ../commons/src/events/scopes.ts
|
|
8101
|
-
var import_lodash6 = require("lodash");
|
|
7556
|
+
var z44 = __toESM(require("zod/v4"));
|
|
8102
7557
|
|
|
8103
7558
|
// ../commons/src/events/locations.ts
|
|
8104
7559
|
var z43 = __toESM(require("zod/v4"));
|
|
@@ -8157,116 +7612,40 @@ function toClientAdministrativeArea(area) {
|
|
|
8157
7612
|
versions: area.versions
|
|
8158
7613
|
};
|
|
8159
7614
|
}
|
|
7615
|
+
function validateAscendingDates(versions, ctx) {
|
|
7616
|
+
const ascending = versions.every(
|
|
7617
|
+
(version, index) => index === 0 || versions[index - 1].effectiveFrom < version.effectiveFrom
|
|
7618
|
+
);
|
|
7619
|
+
if (!ascending) {
|
|
7620
|
+
ctx.addIssue("versions must be strictly ascending by effectiveFrom");
|
|
7621
|
+
}
|
|
7622
|
+
}
|
|
7623
|
+
function validateUniqueIds(versions, ctx) {
|
|
7624
|
+
const versionIds = new Set(versions.map((version) => version.versionId));
|
|
7625
|
+
if (versionIds.size !== versions.length) {
|
|
7626
|
+
ctx.addIssue("versions must not repeat a versionId");
|
|
7627
|
+
}
|
|
7628
|
+
}
|
|
7629
|
+
var SeededLocationVersions = z43.array(LocationVersion).min(1).superRefine((versions, ctx) => {
|
|
7630
|
+
validateAscendingDates(versions, ctx);
|
|
7631
|
+
validateUniqueIds(versions, ctx);
|
|
7632
|
+
});
|
|
8160
7633
|
var SetLocationPayload = z43.object({
|
|
8161
7634
|
id: UUID,
|
|
8162
7635
|
name: z43.string(),
|
|
8163
7636
|
externalId: z43.string().nullish(),
|
|
8164
7637
|
administrativeAreaId: UUID.nullable(),
|
|
8165
|
-
locationType: z43.string().nullable()
|
|
7638
|
+
locationType: z43.string().nullable(),
|
|
7639
|
+
versions: SeededLocationVersions.optional()
|
|
8166
7640
|
});
|
|
8167
7641
|
var SetAdministrativeAreaPayload = z43.object({
|
|
8168
7642
|
id: UUID,
|
|
8169
7643
|
name: z43.string(),
|
|
8170
7644
|
externalId: z43.string().nullish(),
|
|
8171
|
-
parentId: UUID.nullable()
|
|
7645
|
+
parentId: UUID.nullable(),
|
|
7646
|
+
versions: SeededLocationVersions.optional()
|
|
8172
7647
|
});
|
|
8173
7648
|
|
|
8174
|
-
// ../commons/src/events/scopes.ts
|
|
8175
|
-
var ACTION_SCOPE_MAP = {
|
|
8176
|
-
[ActionType.READ]: ["record.read"],
|
|
8177
|
-
[ActionType.CREATE]: ["record.create"],
|
|
8178
|
-
[ActionType.NOTIFY]: ["record.notify"],
|
|
8179
|
-
[ActionType.DECLARE]: ["record.declare", "record.register"],
|
|
8180
|
-
[ActionType.EDIT]: ["record.edit"],
|
|
8181
|
-
[ActionType.DELETE]: ["record.declare", "record.notify"],
|
|
8182
|
-
[ActionType.REGISTER]: ["record.register"],
|
|
8183
|
-
[ActionType.PRINT_CERTIFICATE]: ["record.print-certified-copies"],
|
|
8184
|
-
[ActionType.REQUEST_CORRECTION]: [
|
|
8185
|
-
"record.request-correction",
|
|
8186
|
-
"record.correct"
|
|
8187
|
-
],
|
|
8188
|
-
[ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: ["record.correct"],
|
|
8189
|
-
[ActionType.REJECT_CORRECTION]: ["record.correct"],
|
|
8190
|
-
[ActionType.APPROVE_CORRECTION]: ["record.correct"],
|
|
8191
|
-
[ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
|
|
8192
|
-
[ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
|
|
8193
|
-
[ActionType.ARCHIVE]: ["record.archive"],
|
|
8194
|
-
[ActionType.UNARCHIVE]: ["record.unarchive"],
|
|
8195
|
-
[ActionType.REJECT]: ["record.reject"],
|
|
8196
|
-
[ActionType.ASSIGN]: null,
|
|
8197
|
-
[ActionType.UNASSIGN]: null,
|
|
8198
|
-
[ActionType.DUPLICATE_DETECTED]: [],
|
|
8199
|
-
[ActionType.CUSTOM]: []
|
|
8200
|
-
};
|
|
8201
|
-
|
|
8202
|
-
// ../commons/src/events/state/availableActions.ts
|
|
8203
|
-
var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
8204
|
-
[EventStatus.enum.CREATED]: [
|
|
8205
|
-
ActionType.READ,
|
|
8206
|
-
ActionType.DECLARE,
|
|
8207
|
-
ActionType.NOTIFY,
|
|
8208
|
-
ActionType.DELETE,
|
|
8209
|
-
ActionType.CUSTOM
|
|
8210
|
-
],
|
|
8211
|
-
[EventStatus.enum.NOTIFIED]: [
|
|
8212
|
-
ActionType.READ,
|
|
8213
|
-
ActionType.EDIT,
|
|
8214
|
-
ActionType.MARK_AS_DUPLICATE,
|
|
8215
|
-
ActionType.ARCHIVE,
|
|
8216
|
-
ActionType.REJECT,
|
|
8217
|
-
ActionType.CUSTOM
|
|
8218
|
-
],
|
|
8219
|
-
[EventStatus.enum.DECLARED]: [
|
|
8220
|
-
ActionType.READ,
|
|
8221
|
-
ActionType.REGISTER,
|
|
8222
|
-
ActionType.MARK_AS_DUPLICATE,
|
|
8223
|
-
ActionType.ARCHIVE,
|
|
8224
|
-
ActionType.REJECT,
|
|
8225
|
-
ActionType.CUSTOM,
|
|
8226
|
-
ActionType.EDIT
|
|
8227
|
-
],
|
|
8228
|
-
[EventStatus.enum.REGISTERED]: [
|
|
8229
|
-
ActionType.READ,
|
|
8230
|
-
ActionType.PRINT_CERTIFICATE,
|
|
8231
|
-
ActionType.REQUEST_CORRECTION,
|
|
8232
|
-
ActionType.APPROVE_CORRECTION,
|
|
8233
|
-
ActionType.REJECT_CORRECTION,
|
|
8234
|
-
ActionType.CUSTOM,
|
|
8235
|
-
ClientSpecificAction.REVIEW_CORRECTION_REQUEST
|
|
8236
|
-
],
|
|
8237
|
-
[EventStatus.enum.ARCHIVED]: [
|
|
8238
|
-
ActionType.READ,
|
|
8239
|
-
ActionType.CUSTOM,
|
|
8240
|
-
ActionType.UNARCHIVE
|
|
8241
|
-
]
|
|
8242
|
-
};
|
|
8243
|
-
var ACTION_FILTERS = {
|
|
8244
|
-
[ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8245
|
-
[ActionType.REQUEST_CORRECTION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8246
|
-
[ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8247
|
-
[ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8248
|
-
[ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8249
|
-
[ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8250
|
-
[ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8251
|
-
[ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8252
|
-
[ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8253
|
-
[ActionType.ARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8254
|
-
[ActionType.UNARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8255
|
-
[ActionType.ASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8256
|
-
[ActionType.UNASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8257
|
-
[ActionType.CUSTOM]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested"))
|
|
8258
|
-
};
|
|
8259
|
-
var REJECTED_ACTIONS = [
|
|
8260
|
-
ActionType.READ,
|
|
8261
|
-
ActionType.NOTIFY,
|
|
8262
|
-
ActionType.CUSTOM,
|
|
8263
|
-
ActionType.EDIT,
|
|
8264
|
-
ActionType.ARCHIVE
|
|
8265
|
-
];
|
|
8266
|
-
|
|
8267
|
-
// ../commons/src/events/FileUtils.ts
|
|
8268
|
-
var import_lodash7 = require("lodash");
|
|
8269
|
-
|
|
8270
7649
|
// ../commons/src/events/mocks.test.utils.ts
|
|
8271
7650
|
function withVersionFields(entity) {
|
|
8272
7651
|
return {
|
|
@@ -8609,137 +7988,333 @@ var V2_DEFAULT_MOCK_CLIENT_ADMINISTRATIVE_AREAS_MAP = new Map(
|
|
|
8609
7988
|
])
|
|
8610
7989
|
);
|
|
8611
7990
|
|
|
7991
|
+
// ../commons/src/events/test.utils.ts
|
|
7992
|
+
var TestUserRole = z44.enum([
|
|
7993
|
+
"FIELD_AGENT",
|
|
7994
|
+
"LOCAL_REGISTRAR",
|
|
7995
|
+
"LOCAL_SYSTEM_ADMIN",
|
|
7996
|
+
"NATIONAL_REGISTRAR",
|
|
7997
|
+
"REGISTRATION_AGENT",
|
|
7998
|
+
"NATIONAL_SYSTEM_ADMIN",
|
|
7999
|
+
"SOCIAL_WORKER",
|
|
8000
|
+
"COMMUNITY_LEADER",
|
|
8001
|
+
"PROVINCIAL_REGISTRAR"
|
|
8002
|
+
]);
|
|
8003
|
+
|
|
8004
|
+
// ../commons/src/events/scopes.ts
|
|
8005
|
+
var import_lodash6 = require("lodash");
|
|
8006
|
+
var ACTION_SCOPE_MAP = {
|
|
8007
|
+
[ActionType.READ]: ["record.read"],
|
|
8008
|
+
[ActionType.CREATE]: ["record.create"],
|
|
8009
|
+
[ActionType.NOTIFY]: ["record.notify"],
|
|
8010
|
+
[ActionType.DECLARE]: ["record.declare", "record.register"],
|
|
8011
|
+
[ActionType.EDIT]: ["record.edit"],
|
|
8012
|
+
[ActionType.DELETE]: ["record.declare", "record.notify"],
|
|
8013
|
+
[ActionType.REGISTER]: ["record.register"],
|
|
8014
|
+
[ActionType.PRINT_CERTIFICATE]: ["record.print-certified-copies"],
|
|
8015
|
+
[ActionType.REQUEST_CORRECTION]: [
|
|
8016
|
+
"record.request-correction",
|
|
8017
|
+
"record.correct"
|
|
8018
|
+
],
|
|
8019
|
+
[ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: ["record.correct"],
|
|
8020
|
+
[ActionType.REJECT_CORRECTION]: ["record.correct"],
|
|
8021
|
+
[ActionType.APPROVE_CORRECTION]: ["record.correct"],
|
|
8022
|
+
[ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
|
|
8023
|
+
[ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
|
|
8024
|
+
[ActionType.ARCHIVE]: ["record.archive"],
|
|
8025
|
+
[ActionType.UNARCHIVE]: ["record.unarchive"],
|
|
8026
|
+
[ActionType.REJECT]: ["record.reject"],
|
|
8027
|
+
[ActionType.ASSIGN]: null,
|
|
8028
|
+
[ActionType.UNASSIGN]: null,
|
|
8029
|
+
[ActionType.DUPLICATE_DETECTED]: [],
|
|
8030
|
+
[ActionType.CUSTOM]: []
|
|
8031
|
+
};
|
|
8032
|
+
|
|
8033
|
+
// ../commons/src/events/state/availableActions.ts
|
|
8034
|
+
var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
8035
|
+
[EventStatus.enum.CREATED]: [
|
|
8036
|
+
ActionType.READ,
|
|
8037
|
+
ActionType.DECLARE,
|
|
8038
|
+
ActionType.NOTIFY,
|
|
8039
|
+
ActionType.DELETE
|
|
8040
|
+
],
|
|
8041
|
+
[EventStatus.enum.NOTIFIED]: [
|
|
8042
|
+
ActionType.READ,
|
|
8043
|
+
ActionType.EDIT,
|
|
8044
|
+
ActionType.MARK_AS_DUPLICATE,
|
|
8045
|
+
ActionType.ARCHIVE,
|
|
8046
|
+
ActionType.REJECT,
|
|
8047
|
+
ActionType.CUSTOM
|
|
8048
|
+
],
|
|
8049
|
+
[EventStatus.enum.DECLARED]: [
|
|
8050
|
+
ActionType.READ,
|
|
8051
|
+
ActionType.REGISTER,
|
|
8052
|
+
ActionType.MARK_AS_DUPLICATE,
|
|
8053
|
+
ActionType.ARCHIVE,
|
|
8054
|
+
ActionType.REJECT,
|
|
8055
|
+
ActionType.CUSTOM,
|
|
8056
|
+
ActionType.EDIT
|
|
8057
|
+
],
|
|
8058
|
+
[EventStatus.enum.REGISTERED]: [
|
|
8059
|
+
ActionType.READ,
|
|
8060
|
+
ActionType.PRINT_CERTIFICATE,
|
|
8061
|
+
ActionType.REQUEST_CORRECTION,
|
|
8062
|
+
ActionType.APPROVE_CORRECTION,
|
|
8063
|
+
ActionType.REJECT_CORRECTION,
|
|
8064
|
+
ActionType.CUSTOM,
|
|
8065
|
+
ClientSpecificAction.REVIEW_CORRECTION_REQUEST
|
|
8066
|
+
],
|
|
8067
|
+
[EventStatus.enum.ARCHIVED]: [
|
|
8068
|
+
ActionType.READ,
|
|
8069
|
+
ActionType.CUSTOM,
|
|
8070
|
+
ActionType.UNARCHIVE
|
|
8071
|
+
]
|
|
8072
|
+
};
|
|
8073
|
+
var ACTION_FILTERS = {
|
|
8074
|
+
[ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8075
|
+
[ActionType.REQUEST_CORRECTION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8076
|
+
[ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8077
|
+
[ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8078
|
+
[ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8079
|
+
[ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8080
|
+
[ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8081
|
+
[ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8082
|
+
[ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8083
|
+
[ActionType.ARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8084
|
+
[ActionType.UNARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8085
|
+
[ActionType.ASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8086
|
+
[ActionType.UNASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8087
|
+
[ActionType.CUSTOM]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested"))
|
|
8088
|
+
};
|
|
8089
|
+
var REJECTED_ACTIONS = [
|
|
8090
|
+
ActionType.READ,
|
|
8091
|
+
ActionType.NOTIFY,
|
|
8092
|
+
ActionType.CUSTOM,
|
|
8093
|
+
ActionType.EDIT,
|
|
8094
|
+
ActionType.ARCHIVE
|
|
8095
|
+
];
|
|
8096
|
+
|
|
8097
|
+
// ../commons/src/events/FileUtils.ts
|
|
8098
|
+
var import_lodash7 = require("lodash");
|
|
8099
|
+
|
|
8612
8100
|
// ../commons/src/events/locationPayloads.ts
|
|
8613
|
-
var
|
|
8614
|
-
var CreateLocationPayload =
|
|
8101
|
+
var z45 = __toESM(require("zod/v4"));
|
|
8102
|
+
var CreateLocationPayload = z45.object({
|
|
8615
8103
|
id: UUID.optional(),
|
|
8616
8104
|
versionId: UUID.optional(),
|
|
8617
|
-
name:
|
|
8618
|
-
externalId:
|
|
8105
|
+
name: z45.string(),
|
|
8106
|
+
externalId: z45.string().nullish(),
|
|
8619
8107
|
administrativeAreaId: UUID.nullable(),
|
|
8620
|
-
locationType:
|
|
8621
|
-
effectiveFrom:
|
|
8108
|
+
locationType: z45.string().nullable(),
|
|
8109
|
+
effectiveFrom: z45.iso.date().optional(),
|
|
8622
8110
|
status: LocationStatus.default("active")
|
|
8623
8111
|
});
|
|
8624
|
-
var UpdateLocationPayload =
|
|
8112
|
+
var UpdateLocationPayload = z45.strictObject({
|
|
8625
8113
|
id: UUID,
|
|
8626
8114
|
versionId: UUID.optional(),
|
|
8627
|
-
name:
|
|
8628
|
-
externalId:
|
|
8115
|
+
name: z45.string(),
|
|
8116
|
+
externalId: z45.string().nullish(),
|
|
8629
8117
|
status: LocationStatus,
|
|
8630
|
-
effectiveFrom:
|
|
8118
|
+
effectiveFrom: z45.iso.date().optional(),
|
|
8631
8119
|
lastVersionId: UUID
|
|
8632
8120
|
});
|
|
8633
|
-
var WithdrawLocationVersionPayload =
|
|
8121
|
+
var WithdrawLocationVersionPayload = z45.object({
|
|
8634
8122
|
id: UUID,
|
|
8635
8123
|
versionId: UUID
|
|
8636
8124
|
});
|
|
8637
|
-
var CreateAdministrativeAreaPayload =
|
|
8125
|
+
var CreateAdministrativeAreaPayload = z45.object({
|
|
8638
8126
|
id: UUID.optional(),
|
|
8639
8127
|
versionId: UUID.optional(),
|
|
8640
|
-
name:
|
|
8641
|
-
externalId:
|
|
8128
|
+
name: z45.string(),
|
|
8129
|
+
externalId: z45.string().nullish(),
|
|
8642
8130
|
parentId: UUID.nullable(),
|
|
8643
|
-
effectiveFrom:
|
|
8131
|
+
effectiveFrom: z45.iso.date().optional(),
|
|
8644
8132
|
status: LocationStatus.default("active")
|
|
8645
8133
|
});
|
|
8646
|
-
var UpdateAdministrativeAreaPayload =
|
|
8134
|
+
var UpdateAdministrativeAreaPayload = z45.strictObject({
|
|
8647
8135
|
id: UUID,
|
|
8648
8136
|
versionId: UUID.optional(),
|
|
8649
|
-
name:
|
|
8650
|
-
externalId:
|
|
8137
|
+
name: z45.string(),
|
|
8138
|
+
externalId: z45.string().nullish(),
|
|
8651
8139
|
status: LocationStatus,
|
|
8652
|
-
effectiveFrom:
|
|
8140
|
+
effectiveFrom: z45.iso.date().optional(),
|
|
8653
8141
|
lastVersionId: UUID
|
|
8654
8142
|
});
|
|
8655
|
-
var WithdrawAdministrativeAreaVersionPayload =
|
|
8143
|
+
var WithdrawAdministrativeAreaVersionPayload = z45.object({
|
|
8656
8144
|
id: UUID,
|
|
8657
8145
|
versionId: UUID
|
|
8658
8146
|
});
|
|
8659
8147
|
|
|
8660
8148
|
// ../commons/src/notification/UserNotifications.ts
|
|
8661
|
-
var
|
|
8149
|
+
var z46 = __toESM(require("zod/v4"));
|
|
8662
8150
|
var TriggerEvent = {
|
|
8663
8151
|
USER_CREATED: "user-created",
|
|
8664
8152
|
USER_UPDATED: "user-updated",
|
|
8665
8153
|
USERNAME_REMINDER: "username-reminder",
|
|
8666
8154
|
RESET_PASSWORD: "reset-password",
|
|
8667
8155
|
RESET_PASSWORD_BY_ADMIN: "reset-password-by-admin",
|
|
8156
|
+
PASSWORD_RESET_LINK: "password-reset-link",
|
|
8157
|
+
USERNAME_REMINDER_LINK: "username-reminder-link",
|
|
8668
8158
|
RESEND_INVITE: "resend-invite",
|
|
8669
8159
|
TWO_FA: "2fa",
|
|
8670
8160
|
ALL_USER_NOTIFICATION: "all-user-notification",
|
|
8671
8161
|
CHANGE_PHONE_NUMBER: "change-phone-number",
|
|
8672
8162
|
CHANGE_EMAIL_ADDRESS: "change-email-address"
|
|
8673
8163
|
};
|
|
8674
|
-
var Recipient =
|
|
8164
|
+
var Recipient = z46.object({
|
|
8675
8165
|
name: NameFieldValue.optional(),
|
|
8676
|
-
mobile:
|
|
8677
|
-
email:
|
|
8678
|
-
bcc:
|
|
8166
|
+
mobile: z46.string().optional(),
|
|
8167
|
+
email: z46.string().optional(),
|
|
8168
|
+
bcc: z46.array(z46.string()).optional()
|
|
8679
8169
|
});
|
|
8680
|
-
var BasePayload =
|
|
8170
|
+
var BasePayload = z46.object({
|
|
8681
8171
|
recipient: Recipient
|
|
8682
8172
|
});
|
|
8683
8173
|
var TriggerPayload = {
|
|
8684
8174
|
[TriggerEvent.USER_CREATED]: BasePayload.extend({
|
|
8685
|
-
username:
|
|
8686
|
-
temporaryPassword:
|
|
8175
|
+
username: z46.string(),
|
|
8176
|
+
temporaryPassword: z46.string()
|
|
8687
8177
|
}),
|
|
8688
8178
|
[TriggerEvent.USER_UPDATED]: BasePayload.extend({
|
|
8689
|
-
oldUsername:
|
|
8690
|
-
newUsername:
|
|
8179
|
+
oldUsername: z46.string(),
|
|
8180
|
+
newUsername: z46.string()
|
|
8691
8181
|
}),
|
|
8692
8182
|
[TriggerEvent.USERNAME_REMINDER]: BasePayload.extend({
|
|
8693
|
-
username:
|
|
8183
|
+
username: z46.string()
|
|
8694
8184
|
}),
|
|
8695
8185
|
[TriggerEvent.RESET_PASSWORD]: BasePayload.extend({
|
|
8696
|
-
code:
|
|
8186
|
+
code: z46.string()
|
|
8697
8187
|
}),
|
|
8698
8188
|
[TriggerEvent.RESET_PASSWORD_BY_ADMIN]: BasePayload.extend({
|
|
8699
|
-
temporaryPassword:
|
|
8700
|
-
admin:
|
|
8701
|
-
id:
|
|
8189
|
+
temporaryPassword: z46.string(),
|
|
8190
|
+
admin: z46.object({
|
|
8191
|
+
id: z46.string(),
|
|
8702
8192
|
name: NameFieldValue,
|
|
8703
|
-
role:
|
|
8193
|
+
role: z46.string()
|
|
8704
8194
|
})
|
|
8705
8195
|
}),
|
|
8196
|
+
[TriggerEvent.PASSWORD_RESET_LINK]: BasePayload.extend({
|
|
8197
|
+
token: z46.string()
|
|
8198
|
+
}),
|
|
8199
|
+
[TriggerEvent.USERNAME_REMINDER_LINK]: BasePayload.extend({
|
|
8200
|
+
token: z46.string()
|
|
8201
|
+
}),
|
|
8706
8202
|
[TriggerEvent.RESEND_INVITE]: BasePayload.extend({
|
|
8707
|
-
username:
|
|
8708
|
-
temporaryPassword:
|
|
8203
|
+
username: z46.string(),
|
|
8204
|
+
temporaryPassword: z46.string()
|
|
8709
8205
|
}),
|
|
8710
8206
|
[TriggerEvent.TWO_FA]: BasePayload.extend({
|
|
8711
|
-
code:
|
|
8207
|
+
code: z46.string()
|
|
8712
8208
|
}),
|
|
8713
8209
|
[TriggerEvent.ALL_USER_NOTIFICATION]: BasePayload.extend({
|
|
8714
|
-
subject:
|
|
8715
|
-
body:
|
|
8210
|
+
subject: z46.string(),
|
|
8211
|
+
body: z46.string()
|
|
8716
8212
|
}),
|
|
8717
8213
|
[TriggerEvent.CHANGE_PHONE_NUMBER]: BasePayload.extend({
|
|
8718
|
-
code:
|
|
8214
|
+
code: z46.string()
|
|
8719
8215
|
}),
|
|
8720
8216
|
[TriggerEvent.CHANGE_EMAIL_ADDRESS]: BasePayload.extend({
|
|
8721
|
-
code:
|
|
8217
|
+
code: z46.string()
|
|
8722
8218
|
})
|
|
8723
8219
|
};
|
|
8220
|
+
function parseUserEventTrigger(event2, body) {
|
|
8221
|
+
const schema = TriggerPayload[event2];
|
|
8222
|
+
return schema.parse(body);
|
|
8223
|
+
}
|
|
8224
|
+
|
|
8225
|
+
// ../commons/src/url.ts
|
|
8226
|
+
function joinUrl(base, path) {
|
|
8227
|
+
const baseWithSlash = base.endsWith("/") ? base : base + "/";
|
|
8228
|
+
return new URL(path, baseWithSlash);
|
|
8229
|
+
}
|
|
8230
|
+
|
|
8231
|
+
// ../commons/src/logger.ts
|
|
8232
|
+
var import_pino = __toESM(require("pino"));
|
|
8233
|
+
function normalizeLogArgs(args) {
|
|
8234
|
+
const [first, ...rest] = args;
|
|
8235
|
+
if (typeof first !== "string" || rest.length === 0) {
|
|
8236
|
+
return args;
|
|
8237
|
+
}
|
|
8238
|
+
const mergingObject = {};
|
|
8239
|
+
const primitives = [];
|
|
8240
|
+
for (const arg of rest) {
|
|
8241
|
+
if (arg instanceof Error) {
|
|
8242
|
+
mergingObject.err = import_pino.default.stdSerializers.err(arg);
|
|
8243
|
+
} else if (arg !== null && typeof arg === "object") {
|
|
8244
|
+
Object.assign(mergingObject, arg);
|
|
8245
|
+
} else {
|
|
8246
|
+
primitives.push(arg);
|
|
8247
|
+
}
|
|
8248
|
+
}
|
|
8249
|
+
const message = primitives.length ? `${first} ${primitives.join(" ")}` : first;
|
|
8250
|
+
return Object.keys(mergingObject).length ? [mergingObject, message] : [message];
|
|
8251
|
+
}
|
|
8252
|
+
function filterHealthCheckLogs(args, method) {
|
|
8253
|
+
const logger2 = this;
|
|
8254
|
+
for (const arg of args) {
|
|
8255
|
+
if (typeof arg === "string" && arg.includes("get /ping 200")) {
|
|
8256
|
+
if (logger2.debug) {
|
|
8257
|
+
return logger2.debug(...args);
|
|
8258
|
+
}
|
|
8259
|
+
}
|
|
8260
|
+
}
|
|
8261
|
+
return method.apply(this, normalizeLogArgs(args));
|
|
8262
|
+
}
|
|
8263
|
+
function buildLoggerOptions() {
|
|
8264
|
+
return {
|
|
8265
|
+
serializers: { err: import_pino.default.stdSerializers.err },
|
|
8266
|
+
hooks: { logMethod: filterHealthCheckLogs }
|
|
8267
|
+
};
|
|
8268
|
+
}
|
|
8269
|
+
var logger = false ? (0, import_pino.default)({
|
|
8270
|
+
level: "info",
|
|
8271
|
+
redact: [
|
|
8272
|
+
"req.headers.authorization",
|
|
8273
|
+
"req.remoteAddress",
|
|
8274
|
+
"req.headers['x-real-ip']"
|
|
8275
|
+
],
|
|
8276
|
+
...buildLoggerOptions()
|
|
8277
|
+
}) : (0, import_pino.default)({
|
|
8278
|
+
level: "debug",
|
|
8279
|
+
transport: {
|
|
8280
|
+
target: "pino-pretty",
|
|
8281
|
+
options: {
|
|
8282
|
+
colorize: true,
|
|
8283
|
+
ignore: "pid,hostname"
|
|
8284
|
+
}
|
|
8285
|
+
},
|
|
8286
|
+
...buildLoggerOptions()
|
|
8287
|
+
});
|
|
8288
|
+
var level = false ? "silent" : process.env.LOG_LEVEL;
|
|
8289
|
+
if (level) {
|
|
8290
|
+
logger.level = level;
|
|
8291
|
+
}
|
|
8292
|
+
|
|
8293
|
+
// ../commons/src/notification/dispatch.ts
|
|
8724
8294
|
async function triggerUserEventNotification({
|
|
8725
8295
|
event: event2,
|
|
8726
8296
|
payload,
|
|
8727
8297
|
countryConfigUrl,
|
|
8728
8298
|
authHeader
|
|
8729
8299
|
}) {
|
|
8730
|
-
|
|
8731
|
-
|
|
8732
|
-
|
|
8733
|
-
|
|
8734
|
-
|
|
8735
|
-
|
|
8300
|
+
const response = await fetch(
|
|
8301
|
+
joinUrl(countryConfigUrl, `triggers/user/${event2}`),
|
|
8302
|
+
{
|
|
8303
|
+
method: "POST",
|
|
8304
|
+
body: JSON.stringify(payload),
|
|
8305
|
+
headers: {
|
|
8306
|
+
"Content-Type": "application/json",
|
|
8307
|
+
...authHeader
|
|
8308
|
+
}
|
|
8736
8309
|
}
|
|
8737
|
-
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
|
|
8741
|
-
|
|
8310
|
+
);
|
|
8311
|
+
if (!response.ok) {
|
|
8312
|
+
logger.error(
|
|
8313
|
+
`triggerUserEventNotification: dispatch failed for event "${event2}" with status ${response.status}`
|
|
8314
|
+
);
|
|
8315
|
+
}
|
|
8316
|
+
return response;
|
|
8742
8317
|
}
|
|
8743
8318
|
|
|
8744
8319
|
// src/notification/index.ts
|
|
8745
|
-
|
|
8320
|
+
z47.globalRegistry.clear();
|