@opencrvs/toolkit 1.9.12-rc.ba08187 → 1.9.12-rc.bacc78f
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/build.sh +8 -0
- package/dist/application-config/index.js +2045 -41
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +3633 -0
- package/dist/commons/api/router.d.ts +337 -118
- package/dist/commons/application-config/index.d.ts +13 -16
- package/dist/commons/conditionals/conditionals.d.ts +8 -8
- package/dist/commons/events/ActionDocument.d.ts +196 -196
- package/dist/commons/events/ActionInput.d.ts +113 -113
- package/dist/commons/events/ActionType.d.ts +3 -3
- package/dist/commons/events/AdvancedSearchConfig.d.ts +6 -0
- package/dist/commons/events/AuditLog.d.ts +345 -163
- package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
- package/dist/commons/events/CountryConfigQueryInput.d.ts +461 -190
- package/dist/commons/events/Draft.d.ts +9 -9
- package/dist/commons/events/DynamicFieldValue.d.ts +37 -19
- package/dist/commons/events/EventConfig.d.ts +3 -1
- package/dist/commons/events/EventDocument.d.ts +80 -80
- package/dist/commons/events/EventIndex.d.ts +35 -27
- package/dist/commons/events/EventInput.d.ts +1 -1
- package/dist/commons/events/EventMetadata.d.ts +19 -19
- package/dist/commons/events/FieldConfig.d.ts +287 -71
- package/dist/commons/events/FieldType.d.ts +2 -1
- package/dist/commons/events/FieldTypeMapping.d.ts +98 -72
- package/dist/commons/events/FieldValue.d.ts +54 -26
- package/dist/commons/events/PlainDate.d.ts +1 -1
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +7 -7
- package/dist/commons/events/WorkqueueConfig.d.ts +443 -199
- package/dist/commons/events/defineConfig.d.ts +0 -4
- package/dist/commons/events/locations.d.ts +4 -4
- package/dist/commons/events/scopes.d.ts +4 -3
- package/dist/commons/events/state/index.d.ts +2 -2
- package/dist/commons/events/state/utils.d.ts +1 -1
- package/dist/commons/events/test.utils.d.ts +2 -2
- package/dist/commons/events/utils.d.ts +3 -175
- package/dist/commons/notification/UserNotifications.d.ts +6 -1
- package/dist/conditionals/index.js +74 -359
- package/dist/events/index.js +1196 -1260
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts +3 -0
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -0
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +405 -0
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +3 -0
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -0
- package/dist/migrations/v2.0/checkout-upstream-files.js +143 -0
- package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts +2 -0
- package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +1 -0
- package/dist/migrations/v2.0/convert-config-files-to-ts.js +829 -0
- package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts +3 -0
- package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +1 -0
- package/dist/migrations/v2.0/convert-paragraph-to-heading.js +159 -0
- package/dist/migrations/v2.0/create-events-index.d.ts +3 -0
- package/dist/migrations/v2.0/create-events-index.d.ts.map +1 -0
- package/dist/migrations/v2.0/create-events-index.js +326 -0
- package/dist/migrations/v2.0/index.d.ts +7 -0
- package/dist/migrations/v2.0/index.d.ts.map +1 -0
- package/dist/migrations/v2.0/index.js +3572 -0
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts +3 -0
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -0
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +344 -0
- package/dist/migrations/v2.0/migrate-scopes.d.ts +3 -0
- package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -0
- package/dist/migrations/v2.0/migrate-scopes.js +282 -0
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts +3 -0
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +1 -0
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +268 -0
- package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts +3 -0
- package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -0
- package/dist/migrations/v2.0/migrate-workqueue-configs.js +237 -0
- package/dist/migrations/v2.0/remove-delete-actions.d.ts +3 -0
- package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-delete-actions.js +157 -0
- package/dist/migrations/v2.0/remove-demo-scope.d.ts +3 -0
- package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-demo-scope.js +75 -0
- package/dist/migrations/v2.0/remove-deprecated-imports.d.ts +3 -0
- package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-deprecated-imports.js +97 -0
- package/dist/migrations/v2.0/remove-hearth-migrations.d.ts +3 -0
- package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-hearth-migrations.js +78 -0
- package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts +3 -0
- package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-pending-certification-flag.js +110 -0
- package/dist/migrations/v2.0/remove-review-from-register-action.d.ts +3 -0
- package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-review-from-register-action.js +164 -0
- package/dist/migrations/v2.0/rename-api-paths.d.ts +3 -0
- package/dist/migrations/v2.0/rename-api-paths.d.ts.map +1 -0
- package/dist/migrations/v2.0/rename-api-paths.js +188 -0
- package/dist/migrations/v2.0/rename-location-parent-id.d.ts +3 -0
- package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +1 -0
- package/dist/migrations/v2.0/rename-location-parent-id.js +181 -0
- package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts +3 -0
- package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts.map +1 -0
- package/dist/migrations/v2.0/simplify-analytics-precalculations.js +196 -0
- package/dist/notification/index.js +1007 -1135
- package/dist/scopes/index.d.ts +389 -152
- package/dist/scopes/index.js +128 -322
- package/opencrvs-toolkit-1.9.12-rc.bacc78f.tgz +0 -0
- package/package.json +11 -7
- package/tsconfig.json +3 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-1.9.12-rc.ba08187.tgz +0 -0
package/dist/events/index.js
CHANGED
|
@@ -63,6 +63,9 @@ __export(events_exports, {
|
|
|
63
63
|
AssignActionInput: () => AssignActionInput,
|
|
64
64
|
AssignmentStatus: () => AssignmentStatus,
|
|
65
65
|
AsyncRejectActionDocument: () => AsyncRejectActionDocument,
|
|
66
|
+
AuditLogEntrySchema: () => AuditLogEntrySchema,
|
|
67
|
+
AutocompleteUpdateValue: () => AutocompleteUpdateValue,
|
|
68
|
+
AutocompleteValue: () => AutocompleteValue,
|
|
66
69
|
BaseActionInput: () => BaseActionInput,
|
|
67
70
|
BearerTokenByUserType: () => BearerTokenByUserType,
|
|
68
71
|
ButtonFieldValue: () => ButtonFieldValue,
|
|
@@ -329,6 +332,7 @@ __export(events_exports, {
|
|
|
329
332
|
isAddressFieldType: () => isAddressFieldType,
|
|
330
333
|
isAdministrativeAreaFieldType: () => isAdministrativeAreaFieldType,
|
|
331
334
|
isAgeFieldType: () => isAgeFieldType,
|
|
335
|
+
isAutocompleteFieldType: () => isAutocompleteFieldType,
|
|
332
336
|
isBulletListFieldType: () => isBulletListFieldType,
|
|
333
337
|
isButtonFieldType: () => isButtonFieldType,
|
|
334
338
|
isCheckboxFieldType: () => isCheckboxFieldType,
|
|
@@ -422,111 +426,267 @@ __export(events_exports, {
|
|
|
422
426
|
module.exports = __toCommonJS(events_exports);
|
|
423
427
|
|
|
424
428
|
// ../commons/src/events/AuditLog.ts
|
|
429
|
+
var z5 = __toESM(require("zod/v4"));
|
|
430
|
+
|
|
431
|
+
// ../commons/src/authentication.ts
|
|
432
|
+
var import_jwt_decode = __toESM(require("jwt-decode"));
|
|
433
|
+
var z3 = __toESM(require("zod/v4"));
|
|
434
|
+
|
|
435
|
+
// ../commons/src/scopes.ts
|
|
436
|
+
var z2 = __toESM(require("zod/v4"));
|
|
437
|
+
var qs = __toESM(require("qs"));
|
|
438
|
+
|
|
439
|
+
// ../commons/src/uuid.ts
|
|
440
|
+
var import_uuid = require("uuid");
|
|
425
441
|
var z = __toESM(require("zod/v4"));
|
|
426
|
-
var
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
442
|
+
var UUID = z.uuid().brand("UUID");
|
|
443
|
+
function getUUID() {
|
|
444
|
+
return (0, import_uuid.v4)();
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
// ../commons/src/scopes.ts
|
|
448
|
+
var JurisdictionFilter = z2.enum(["administrativeArea", "location", "all"]).describe(
|
|
449
|
+
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
450
|
+
);
|
|
451
|
+
var UserFilter = z2.enum(["user"]).describe("Filters based on the user. Limits to self.");
|
|
452
|
+
var RecordScopeTypeV2 = z2.enum([
|
|
453
|
+
"record.search",
|
|
454
|
+
"record.create",
|
|
455
|
+
"record.read",
|
|
456
|
+
"record.declare",
|
|
457
|
+
"record.notify",
|
|
458
|
+
"record.edit",
|
|
459
|
+
"record.reject",
|
|
460
|
+
"record.archive",
|
|
461
|
+
"record.review-duplicates",
|
|
462
|
+
"record.register",
|
|
463
|
+
"record.print-certified-copies",
|
|
464
|
+
"record.request-correction",
|
|
465
|
+
"record.correct",
|
|
466
|
+
"record.unassign-others",
|
|
467
|
+
"record.custom-action"
|
|
468
|
+
]);
|
|
469
|
+
var PlainScopeType = z2.enum([
|
|
470
|
+
// Misc. system scopes
|
|
471
|
+
"bypassratelimit",
|
|
472
|
+
"record.reindex",
|
|
473
|
+
"user.data-seeding",
|
|
474
|
+
"integration.create",
|
|
475
|
+
"record.import",
|
|
476
|
+
"config.update-all",
|
|
477
|
+
"attachment.upload",
|
|
478
|
+
"profile.electronic-signature",
|
|
479
|
+
"user.read-only-my-audit",
|
|
480
|
+
// Performance dashboard
|
|
481
|
+
"performance.read",
|
|
482
|
+
"performance.read-dashboards",
|
|
483
|
+
"performance.vital-statistics-export",
|
|
484
|
+
// Scopes used exclusively by countryconfig integration token
|
|
485
|
+
"record.confirm-registration",
|
|
486
|
+
"record.reject-registration"
|
|
487
|
+
]);
|
|
488
|
+
var scopeByEvent = z2.preprocess(
|
|
489
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
490
|
+
z2.array(z2.string()).optional()
|
|
491
|
+
).describe("Event type, e.g. birth, death");
|
|
492
|
+
var scopeOptionsPlaceEvent = z2.object({
|
|
493
|
+
event: scopeByEvent,
|
|
494
|
+
placeOfEvent: JurisdictionFilter.optional()
|
|
495
|
+
}).describe("Options applicable to all record scopes.");
|
|
496
|
+
var scopeOptionsDeclared = scopeOptionsPlaceEvent.extend({
|
|
497
|
+
declaredIn: JurisdictionFilter.optional(),
|
|
498
|
+
declaredBy: UserFilter.optional()
|
|
499
|
+
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
500
|
+
var AllRecordScopeOptions = scopeOptionsDeclared.extend({
|
|
501
|
+
registeredIn: JurisdictionFilter.optional(),
|
|
502
|
+
registeredBy: UserFilter.optional()
|
|
503
|
+
}).describe(
|
|
504
|
+
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
505
|
+
);
|
|
506
|
+
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
507
|
+
customActionTypes: z2.preprocess(
|
|
508
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
509
|
+
z2.array(z2.string()).optional()
|
|
510
|
+
).describe("Allowed custom action types")
|
|
511
|
+
});
|
|
512
|
+
var AccessLevelOptions = z2.object({
|
|
513
|
+
accessLevel: JurisdictionFilter.optional()
|
|
514
|
+
});
|
|
515
|
+
var WorkqueueOrDashboardOptions = z2.object({
|
|
516
|
+
ids: z2.preprocess(
|
|
517
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
518
|
+
z2.array(z2.string())
|
|
519
|
+
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
520
|
+
});
|
|
521
|
+
var AllScopeOptions = z2.object({
|
|
522
|
+
...AllRecordScopeOptions.shape,
|
|
523
|
+
...AccessLevelOptions.shape,
|
|
524
|
+
...WorkqueueOrDashboardOptions.shape
|
|
525
|
+
});
|
|
526
|
+
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
527
|
+
var ResolvedScopeOptionsPlaceEvent = z2.object({
|
|
528
|
+
event: scopeByEvent,
|
|
529
|
+
placeOfEvent: UUID.nullish()
|
|
530
|
+
}).describe(
|
|
531
|
+
"Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
|
|
532
|
+
);
|
|
533
|
+
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
534
|
+
declaredIn: UUID.nullish(),
|
|
535
|
+
declaredBy: z2.string().optional()
|
|
536
|
+
}).describe(
|
|
537
|
+
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
538
|
+
);
|
|
539
|
+
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
540
|
+
registeredIn: UUID.nullish(),
|
|
541
|
+
registeredBy: z2.string().optional()
|
|
542
|
+
}).describe(
|
|
543
|
+
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
544
|
+
);
|
|
545
|
+
var ScopesWithPlaceEventOptions = RecordScopeTypeV2.extract([
|
|
546
|
+
"record.create",
|
|
547
|
+
"record.declare",
|
|
548
|
+
"record.notify"
|
|
549
|
+
]);
|
|
550
|
+
var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
551
|
+
"record.edit",
|
|
552
|
+
"record.reject",
|
|
553
|
+
"record.archive",
|
|
554
|
+
"record.review-duplicates",
|
|
555
|
+
"record.register"
|
|
556
|
+
]);
|
|
557
|
+
var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
558
|
+
"record.search",
|
|
559
|
+
"record.read",
|
|
560
|
+
"record.request-correction",
|
|
561
|
+
"record.correct",
|
|
562
|
+
"record.unassign-others"
|
|
563
|
+
]);
|
|
564
|
+
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
565
|
+
templates: z2.preprocess(
|
|
566
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
567
|
+
z2.array(z2.string()).optional()
|
|
568
|
+
).describe(
|
|
569
|
+
"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."
|
|
570
|
+
)
|
|
571
|
+
});
|
|
572
|
+
var RecordScopeV2 = z2.discriminatedUnion("type", [
|
|
573
|
+
z2.object({
|
|
574
|
+
type: ScopesWithPlaceEventOptions,
|
|
575
|
+
options: scopeOptionsPlaceEvent.optional()
|
|
463
576
|
}),
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
responseSummary: z.object({})
|
|
577
|
+
z2.object({
|
|
578
|
+
type: ScopesWithDeclaredOptions,
|
|
579
|
+
options: scopeOptionsDeclared.optional()
|
|
468
580
|
}),
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
responseSummary: z.object({})
|
|
581
|
+
z2.object({
|
|
582
|
+
type: ScopesWithFullOptions,
|
|
583
|
+
options: AllRecordScopeOptions.optional()
|
|
473
584
|
}),
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
responseSummary: z.object({})
|
|
585
|
+
z2.object({
|
|
586
|
+
type: z2.literal("record.custom-action"),
|
|
587
|
+
options: CustomActionScopeOptions.optional()
|
|
478
588
|
}),
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
589
|
+
z2.object({
|
|
590
|
+
type: z2.literal("record.print-certified-copies"),
|
|
591
|
+
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
592
|
+
})
|
|
593
|
+
]).describe(
|
|
594
|
+
"Scopes used to check user's permission to perform actions on a record."
|
|
595
|
+
);
|
|
596
|
+
function scopeUsesDeclaredOptions(scope) {
|
|
597
|
+
return !ScopesWithPlaceEventOptions.options.some((opt) => opt === scope.type);
|
|
598
|
+
}
|
|
599
|
+
function scopeUsesFullOptions(scope) {
|
|
600
|
+
return ScopesWithFullOptions.options.some((opt) => opt === scope.type);
|
|
601
|
+
}
|
|
602
|
+
function scopeUsesPrintCertifiedCopiesOptions(scope) {
|
|
603
|
+
return scope.type === "record.print-certified-copies";
|
|
604
|
+
}
|
|
605
|
+
function isCustomActionScope(scope) {
|
|
606
|
+
return scope.type === "record.custom-action";
|
|
607
|
+
}
|
|
608
|
+
var ResolvedRecordScopeV2 = z2.discriminatedUnion("type", [
|
|
609
|
+
z2.object({
|
|
610
|
+
type: ScopesWithPlaceEventOptions,
|
|
611
|
+
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
483
612
|
}),
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
responseSummary: z.object({})
|
|
613
|
+
z2.object({
|
|
614
|
+
type: ScopesWithDeclaredOptions,
|
|
615
|
+
options: ResolvedScopeOptionsDeclared.optional()
|
|
488
616
|
}),
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
responseSummary: z.object({ phoneNumber: z.string() })
|
|
617
|
+
z2.object({
|
|
618
|
+
type: ScopesWithFullOptions,
|
|
619
|
+
options: ResolvedScopeOptionsFull.optional()
|
|
493
620
|
}),
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
621
|
+
z2.object({
|
|
622
|
+
type: z2.literal("record.print-certified-copies"),
|
|
623
|
+
options: ResolvedScopeOptionsFull.extend({
|
|
624
|
+
templates: z2.array(z2.string()).optional()
|
|
625
|
+
}).optional()
|
|
626
|
+
})
|
|
627
|
+
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
628
|
+
var SystemScopeType = z2.enum([
|
|
629
|
+
"organisation.read-locations",
|
|
630
|
+
"user.read",
|
|
631
|
+
"user.create",
|
|
632
|
+
"user.edit"
|
|
633
|
+
]);
|
|
634
|
+
var Scope = z2.discriminatedUnion("type", [
|
|
635
|
+
z2.object({ type: PlainScopeType }),
|
|
636
|
+
...RecordScopeV2.options,
|
|
637
|
+
z2.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
|
|
638
|
+
z2.object({
|
|
639
|
+
type: z2.literal("workqueue"),
|
|
640
|
+
options: WorkqueueOrDashboardOptions
|
|
498
641
|
}),
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
responseSummary: z.object({})
|
|
642
|
+
z2.object({
|
|
643
|
+
type: z2.literal("dashboard.view"),
|
|
644
|
+
options: WorkqueueOrDashboardOptions
|
|
503
645
|
})
|
|
504
646
|
]);
|
|
647
|
+
var ScopeType = z2.enum([
|
|
648
|
+
...SystemScopeType.options,
|
|
649
|
+
...RecordScopeTypeV2.options,
|
|
650
|
+
...PlainScopeType.options,
|
|
651
|
+
"workqueue",
|
|
652
|
+
"dashboard.view"
|
|
653
|
+
]);
|
|
654
|
+
var unflattenScope = (input) => {
|
|
655
|
+
const { type, ...options } = input;
|
|
656
|
+
return { type, options };
|
|
657
|
+
};
|
|
658
|
+
var EncodedScope = z2.string().brand("EncodedScope");
|
|
659
|
+
var decodeScope = (query) => {
|
|
660
|
+
const scope = qs.parse(query, {
|
|
661
|
+
ignoreQueryPrefix: true,
|
|
662
|
+
comma: true,
|
|
663
|
+
allowDots: true
|
|
664
|
+
});
|
|
665
|
+
const unflattenedScope = unflattenScope(scope);
|
|
666
|
+
return Scope.safeParse(unflattenedScope)?.data;
|
|
667
|
+
};
|
|
668
|
+
var DEFAULT_SCOPE_OPTIONS = {
|
|
669
|
+
placeOfEvent: JurisdictionFilter.enum.all,
|
|
670
|
+
accessLevel: JurisdictionFilter.enum.all
|
|
671
|
+
};
|
|
672
|
+
function getAcceptedScopesByType({
|
|
673
|
+
acceptedScopes,
|
|
674
|
+
scopes
|
|
675
|
+
}) {
|
|
676
|
+
return scopes.map((scope) => {
|
|
677
|
+
const parsedScope = decodeScope(scope);
|
|
678
|
+
return parsedScope && acceptedScopes.some(
|
|
679
|
+
(acceptedScope) => acceptedScope === parsedScope.type
|
|
680
|
+
) ? parsedScope : null;
|
|
681
|
+
}).filter((scope) => scope !== null);
|
|
682
|
+
}
|
|
505
683
|
|
|
506
|
-
// ../commons/src/
|
|
507
|
-
var
|
|
508
|
-
var
|
|
509
|
-
|
|
510
|
-
// ../commons/src/events/ActionConfig.ts
|
|
511
|
-
var z25 = __toESM(require("zod/v4"));
|
|
512
|
-
|
|
513
|
-
// ../commons/src/events/TranslationConfig.ts
|
|
514
|
-
var z2 = __toESM(require("zod/v4"));
|
|
515
|
-
var TranslationConfig = z2.object({
|
|
516
|
-
id: z2.string().describe(
|
|
517
|
-
"The identifier of the translation referred in translation CSV files"
|
|
518
|
-
),
|
|
519
|
-
defaultMessage: z2.string().describe("Default translation message"),
|
|
520
|
-
description: z2.string().describe(
|
|
521
|
-
"Describe the translation for a translator to be able to identify it."
|
|
522
|
-
)
|
|
523
|
-
}).meta({
|
|
524
|
-
description: "Translation configuration",
|
|
525
|
-
id: "TranslationConfig"
|
|
526
|
-
});
|
|
684
|
+
// ../commons/src/authentication.ts
|
|
685
|
+
var TokenUserType = z3.enum(["user", "system"]);
|
|
686
|
+
var TokenWithBearer = z3.string().regex(/^Bearer\s/);
|
|
527
687
|
|
|
528
688
|
// ../commons/src/events/ActionType.ts
|
|
529
|
-
var
|
|
689
|
+
var z4 = __toESM(require("zod/v4"));
|
|
530
690
|
var ActionType = {
|
|
531
691
|
// Pre-declaration actions
|
|
532
692
|
DELETE: "DELETE",
|
|
@@ -568,7 +728,7 @@ var ConfirmableActions = [
|
|
|
568
728
|
ActionType.REJECT_CORRECTION,
|
|
569
729
|
ActionType.CUSTOM
|
|
570
730
|
];
|
|
571
|
-
var ActionTypes =
|
|
731
|
+
var ActionTypes = z4.enum([
|
|
572
732
|
"DELETE",
|
|
573
733
|
"CREATE",
|
|
574
734
|
"NOTIFY",
|
|
@@ -635,12 +795,225 @@ function isMetaAction(actionType) {
|
|
|
635
795
|
return META_ACTIONS.includes(actionType);
|
|
636
796
|
}
|
|
637
797
|
|
|
798
|
+
// ../commons/src/events/AuditLog.ts
|
|
799
|
+
var AuditLogEntryBase = z5.object({
|
|
800
|
+
id: z5.string(),
|
|
801
|
+
clientId: z5.string(),
|
|
802
|
+
clientType: TokenUserType,
|
|
803
|
+
createdAt: z5.string()
|
|
804
|
+
});
|
|
805
|
+
var EventCreateEntrySchema = AuditLogEntryBase.extend({
|
|
806
|
+
operation: z5.literal("event.create"),
|
|
807
|
+
requestData: z5.object({
|
|
808
|
+
transactionId: z5.string(),
|
|
809
|
+
type: z5.string(),
|
|
810
|
+
createdAtLocation: z5.string().nullable()
|
|
811
|
+
}),
|
|
812
|
+
responseSummary: z5.object({
|
|
813
|
+
eventId: z5.string(),
|
|
814
|
+
trackingId: z5.string()
|
|
815
|
+
})
|
|
816
|
+
});
|
|
817
|
+
var EventGetEntrySchema = AuditLogEntryBase.extend({
|
|
818
|
+
operation: z5.literal("event.get"),
|
|
819
|
+
requestData: z5.object({ eventId: z5.string() }),
|
|
820
|
+
responseSummary: z5.object({
|
|
821
|
+
eventType: z5.string(),
|
|
822
|
+
trackingId: z5.string()
|
|
823
|
+
})
|
|
824
|
+
});
|
|
825
|
+
var EventSearchEntrySchema = AuditLogEntryBase.extend({
|
|
826
|
+
operation: z5.literal("event.search"),
|
|
827
|
+
clientType: z5.literal("system"),
|
|
828
|
+
requestData: z5.object({
|
|
829
|
+
query: z5.record(z5.string(), z5.unknown()).nullable(),
|
|
830
|
+
limit: z5.number().nullable(),
|
|
831
|
+
offset: z5.number().nullable()
|
|
832
|
+
}),
|
|
833
|
+
responseSummary: z5.object({
|
|
834
|
+
total: z5.number(),
|
|
835
|
+
eventIds: z5.array(z5.string())
|
|
836
|
+
})
|
|
837
|
+
});
|
|
838
|
+
var EventActionEntrySchema = AuditLogEntryBase.extend({
|
|
839
|
+
operation: z5.enum([
|
|
840
|
+
"event.actions.notify.request",
|
|
841
|
+
"event.actions.declare.request",
|
|
842
|
+
"event.actions.register.request",
|
|
843
|
+
"event.actions.reject.request",
|
|
844
|
+
"event.actions.validate.request",
|
|
845
|
+
"event.actions.edit.request",
|
|
846
|
+
"event.actions.assign.request",
|
|
847
|
+
"event.actions.unassign.request",
|
|
848
|
+
"event.actions.read.request",
|
|
849
|
+
"event.actions.archive.request",
|
|
850
|
+
"event.actions.reinstate.request",
|
|
851
|
+
"event.actions.print_certificate.request",
|
|
852
|
+
"event.actions.correction.request.request",
|
|
853
|
+
"event.actions.correction.approve.request",
|
|
854
|
+
"event.actions.correction.reject.request",
|
|
855
|
+
"event.actions.mark_as_duplicate.request",
|
|
856
|
+
"event.actions.mark_as_not_duplicate.request"
|
|
857
|
+
]),
|
|
858
|
+
requestData: z5.object({
|
|
859
|
+
eventId: z5.string(),
|
|
860
|
+
actionType: z5.string(),
|
|
861
|
+
eventType: z5.string(),
|
|
862
|
+
trackingId: z5.string(),
|
|
863
|
+
transactionId: z5.string()
|
|
864
|
+
})
|
|
865
|
+
});
|
|
866
|
+
var EventCustomActionEntrySchema = AuditLogEntryBase.extend({
|
|
867
|
+
operation: z5.literal("event.actions.custom.request"),
|
|
868
|
+
requestData: z5.object({
|
|
869
|
+
eventId: z5.string(),
|
|
870
|
+
actionType: z5.literal(ActionType.CUSTOM),
|
|
871
|
+
customAction: z5.string(),
|
|
872
|
+
eventType: z5.string(),
|
|
873
|
+
trackingId: z5.string(),
|
|
874
|
+
transactionId: z5.string()
|
|
875
|
+
})
|
|
876
|
+
});
|
|
877
|
+
var IntegrationCreateEntrySchema = AuditLogEntryBase.extend({
|
|
878
|
+
operation: z5.literal("integrations.create"),
|
|
879
|
+
requestData: z5.object({ name: z5.string(), scopes: z5.array(z5.string()) }),
|
|
880
|
+
responseSummary: z5.object({ clientId: z5.string() })
|
|
881
|
+
});
|
|
882
|
+
var IntegrationRefreshTokenEntrySchema = AuditLogEntryBase.extend({
|
|
883
|
+
operation: z5.literal("integrations.refreshToken"),
|
|
884
|
+
requestData: z5.object({ clientId: z5.string() }),
|
|
885
|
+
responseSummary: z5.object({ clientId: z5.string() })
|
|
886
|
+
});
|
|
887
|
+
var IntegrationDeactivateEntrySchema = AuditLogEntryBase.extend({
|
|
888
|
+
operation: z5.literal("integrations.deactivate"),
|
|
889
|
+
requestData: z5.object({ id: z5.string() }),
|
|
890
|
+
responseSummary: z5.object({ id: z5.string(), status: z5.string() })
|
|
891
|
+
});
|
|
892
|
+
var IntegrationActivateEntrySchema = AuditLogEntryBase.extend({
|
|
893
|
+
operation: z5.literal("integrations.activate"),
|
|
894
|
+
requestData: z5.object({ id: z5.string() }),
|
|
895
|
+
responseSummary: z5.object({ id: z5.string(), status: z5.string() })
|
|
896
|
+
});
|
|
897
|
+
var IntegrationDeleteEntrySchema = AuditLogEntryBase.extend({
|
|
898
|
+
operation: z5.literal("integrations.delete"),
|
|
899
|
+
requestData: z5.object({ id: z5.string() }),
|
|
900
|
+
responseSummary: z5.object({ id: z5.string(), name: z5.string() })
|
|
901
|
+
});
|
|
902
|
+
var IntegrationRefreshSecretEntrySchema = AuditLogEntryBase.extend({
|
|
903
|
+
operation: z5.literal("integrations.refreshSecret"),
|
|
904
|
+
requestData: z5.object({ id: z5.string() }),
|
|
905
|
+
responseSummary: z5.object({ clientId: z5.string() })
|
|
906
|
+
});
|
|
907
|
+
var AttachmentUploadEntrySchema = AuditLogEntryBase.extend({
|
|
908
|
+
operation: z5.literal("attachments.upload"),
|
|
909
|
+
requestData: z5.object({
|
|
910
|
+
transactionId: z5.string(),
|
|
911
|
+
path: z5.string().nullable()
|
|
912
|
+
}),
|
|
913
|
+
responseSummary: z5.object({ fileUrl: z5.string() })
|
|
914
|
+
});
|
|
915
|
+
var subjectOnly = z5.object({ subjectId: z5.string() });
|
|
916
|
+
var subjectWithReason = z5.object({
|
|
917
|
+
subjectId: z5.string(),
|
|
918
|
+
reason: z5.string(),
|
|
919
|
+
comment: z5.string().optional()
|
|
920
|
+
});
|
|
921
|
+
var UserCreateEntrySchema = AuditLogEntryBase.extend({
|
|
922
|
+
operation: z5.literal("user.create_user"),
|
|
923
|
+
requestData: z5.object({
|
|
924
|
+
subjectId: z5.string(),
|
|
925
|
+
role: z5.string(),
|
|
926
|
+
primaryOfficeId: z5.string()
|
|
927
|
+
})
|
|
928
|
+
});
|
|
929
|
+
var UserReasonEntrySchema = AuditLogEntryBase.extend({
|
|
930
|
+
operation: z5.enum(["user.deactivate", "user.reactivate"]),
|
|
931
|
+
requestData: subjectWithReason
|
|
932
|
+
});
|
|
933
|
+
var UserSubjectOnlyEntrySchema = AuditLogEntryBase.extend({
|
|
934
|
+
operation: z5.enum([
|
|
935
|
+
"user.edit_user",
|
|
936
|
+
"user.logged_in",
|
|
937
|
+
"user.logged_out",
|
|
938
|
+
"user.password_changed",
|
|
939
|
+
"user.password_reset",
|
|
940
|
+
"user.password_reset_by_admin",
|
|
941
|
+
"user.username_reminder",
|
|
942
|
+
"user.username_reminder_by_admin"
|
|
943
|
+
]),
|
|
944
|
+
requestData: subjectOnly
|
|
945
|
+
});
|
|
946
|
+
var UserEmailChangedEntrySchema = AuditLogEntryBase.extend({
|
|
947
|
+
operation: z5.literal("user.email_address_changed"),
|
|
948
|
+
requestData: subjectOnly,
|
|
949
|
+
responseSummary: z5.object({ email: z5.string() })
|
|
950
|
+
});
|
|
951
|
+
var UserPhoneChangedEntrySchema = AuditLogEntryBase.extend({
|
|
952
|
+
operation: z5.literal("user.phone_number_changed"),
|
|
953
|
+
requestData: subjectOnly,
|
|
954
|
+
responseSummary: z5.object({ phoneNumber: z5.string() })
|
|
955
|
+
});
|
|
956
|
+
var userBaseOmit = {
|
|
957
|
+
id: true,
|
|
958
|
+
clientId: true,
|
|
959
|
+
clientType: true,
|
|
960
|
+
createdAt: true
|
|
961
|
+
};
|
|
962
|
+
var UserAuditRecordInput = z5.discriminatedUnion("operation", [
|
|
963
|
+
UserCreateEntrySchema.omit(userBaseOmit),
|
|
964
|
+
UserReasonEntrySchema.omit(userBaseOmit),
|
|
965
|
+
UserSubjectOnlyEntrySchema.omit(userBaseOmit),
|
|
966
|
+
UserEmailChangedEntrySchema.omit(userBaseOmit),
|
|
967
|
+
UserPhoneChangedEntrySchema.omit(userBaseOmit)
|
|
968
|
+
]);
|
|
969
|
+
var AuditLogEntrySchema = z5.discriminatedUnion("operation", [
|
|
970
|
+
EventCreateEntrySchema,
|
|
971
|
+
EventGetEntrySchema,
|
|
972
|
+
EventSearchEntrySchema,
|
|
973
|
+
EventActionEntrySchema,
|
|
974
|
+
EventCustomActionEntrySchema,
|
|
975
|
+
IntegrationCreateEntrySchema,
|
|
976
|
+
IntegrationRefreshTokenEntrySchema,
|
|
977
|
+
IntegrationDeactivateEntrySchema,
|
|
978
|
+
IntegrationActivateEntrySchema,
|
|
979
|
+
IntegrationDeleteEntrySchema,
|
|
980
|
+
IntegrationRefreshSecretEntrySchema,
|
|
981
|
+
AttachmentUploadEntrySchema,
|
|
982
|
+
UserCreateEntrySchema,
|
|
983
|
+
UserReasonEntrySchema,
|
|
984
|
+
UserSubjectOnlyEntrySchema,
|
|
985
|
+
UserEmailChangedEntrySchema,
|
|
986
|
+
UserPhoneChangedEntrySchema
|
|
987
|
+
]);
|
|
988
|
+
|
|
989
|
+
// ../commons/src/events/Constants.ts
|
|
990
|
+
var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
|
|
991
|
+
var CHILD_ONBOARDING_EVENT = "child-onboarding";
|
|
992
|
+
|
|
993
|
+
// ../commons/src/events/ActionConfig.ts
|
|
994
|
+
var z24 = __toESM(require("zod/v4"));
|
|
995
|
+
|
|
996
|
+
// ../commons/src/events/TranslationConfig.ts
|
|
997
|
+
var z6 = __toESM(require("zod/v4"));
|
|
998
|
+
var TranslationConfig = z6.object({
|
|
999
|
+
id: z6.string().describe(
|
|
1000
|
+
"The identifier of the translation referred in translation CSV files"
|
|
1001
|
+
),
|
|
1002
|
+
defaultMessage: z6.string().describe("Default translation message"),
|
|
1003
|
+
description: z6.string().describe(
|
|
1004
|
+
"Describe the translation for a translator to be able to identify it."
|
|
1005
|
+
)
|
|
1006
|
+
}).meta({
|
|
1007
|
+
description: "Translation configuration",
|
|
1008
|
+
id: "TranslationConfig"
|
|
1009
|
+
});
|
|
1010
|
+
|
|
638
1011
|
// ../commons/src/events/FieldConfig.ts
|
|
639
1012
|
var import_v43 = __toESM(require("zod/v4"));
|
|
640
1013
|
|
|
641
1014
|
// ../commons/src/events/Conditional.ts
|
|
642
|
-
var
|
|
643
|
-
var Conditional =
|
|
1015
|
+
var z7 = __toESM(require("zod/v4"));
|
|
1016
|
+
var Conditional = z7.any().describe("JSONSchema").meta({
|
|
644
1017
|
description: "JSON schema conditional configuration",
|
|
645
1018
|
id: "Conditional"
|
|
646
1019
|
});
|
|
@@ -649,31 +1022,31 @@ var ConditionalType = {
|
|
|
649
1022
|
ENABLE: "ENABLE",
|
|
650
1023
|
DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
|
|
651
1024
|
};
|
|
652
|
-
var ShowConditional =
|
|
653
|
-
type:
|
|
1025
|
+
var ShowConditional = z7.object({
|
|
1026
|
+
type: z7.literal(ConditionalType.SHOW),
|
|
654
1027
|
conditional: Conditional
|
|
655
1028
|
}).describe(
|
|
656
1029
|
"If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
|
|
657
1030
|
);
|
|
658
|
-
var EnableConditional =
|
|
659
|
-
type:
|
|
1031
|
+
var EnableConditional = z7.object({
|
|
1032
|
+
type: z7.literal(ConditionalType.ENABLE),
|
|
660
1033
|
conditional: Conditional
|
|
661
1034
|
}).describe(
|
|
662
1035
|
"If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
|
|
663
1036
|
);
|
|
664
|
-
var ActionConditional =
|
|
1037
|
+
var ActionConditional = z7.discriminatedUnion("type", [
|
|
665
1038
|
// Action can be shown / hidden
|
|
666
1039
|
ShowConditional,
|
|
667
1040
|
// Action can be shown to the user in the list but as disabled
|
|
668
1041
|
EnableConditional
|
|
669
1042
|
]);
|
|
670
|
-
var DisplayOnReviewConditional =
|
|
671
|
-
type:
|
|
1043
|
+
var DisplayOnReviewConditional = z7.object({
|
|
1044
|
+
type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
672
1045
|
conditional: Conditional
|
|
673
1046
|
}).describe(
|
|
674
1047
|
"If 'DISPLAY_ON_REVIEW' conditional is defined, the component is shown on the review page only if both the 'DISPLAY_ON_REVIEW' and 'SHOW' conditions are met. This should only be used for fields within declaration forms, as they are the only ones with review pages."
|
|
675
1048
|
);
|
|
676
|
-
var FieldConditional =
|
|
1049
|
+
var FieldConditional = z7.discriminatedUnion("type", [
|
|
677
1050
|
// Field input can be shown / hidden
|
|
678
1051
|
ShowConditional,
|
|
679
1052
|
// Field input can be shown to the user but as disabled
|
|
@@ -686,7 +1059,7 @@ var FieldConditional = z4.discriminatedUnion("type", [
|
|
|
686
1059
|
});
|
|
687
1060
|
|
|
688
1061
|
// ../commons/src/events/FieldType.ts
|
|
689
|
-
var
|
|
1062
|
+
var z8 = __toESM(require("zod/v4"));
|
|
690
1063
|
var FieldType = {
|
|
691
1064
|
NAME: "NAME",
|
|
692
1065
|
PHONE: "PHONE",
|
|
@@ -726,6 +1099,7 @@ var FieldType = {
|
|
|
726
1099
|
SIGNATURE: "SIGNATURE",
|
|
727
1100
|
DATA: "DATA",
|
|
728
1101
|
BUTTON: "BUTTON",
|
|
1102
|
+
AUTOCOMPLETE: "AUTOCOMPLETE",
|
|
729
1103
|
SEARCH: "SEARCH",
|
|
730
1104
|
ALPHA_PRINT_BUTTON: "ALPHA_PRINT_BUTTON",
|
|
731
1105
|
HTTP: "HTTP",
|
|
@@ -749,7 +1123,7 @@ var FieldType = {
|
|
|
749
1123
|
*/
|
|
750
1124
|
_EXPERIMENTAL_CUSTOM: "CUSTOM"
|
|
751
1125
|
};
|
|
752
|
-
var FileFieldType =
|
|
1126
|
+
var FileFieldType = z8.enum([
|
|
753
1127
|
FieldType.FILE,
|
|
754
1128
|
FieldType.FILE_WITH_OPTIONS,
|
|
755
1129
|
FieldType.SIGNATURE
|
|
@@ -780,22 +1154,22 @@ var FieldTypesToHideInReview = [
|
|
|
780
1154
|
];
|
|
781
1155
|
|
|
782
1156
|
// ../commons/src/events/FieldValue.ts
|
|
783
|
-
var
|
|
1157
|
+
var z12 = __toESM(require("zod/v4"));
|
|
784
1158
|
|
|
785
1159
|
// ../commons/src/documents.ts
|
|
786
|
-
var
|
|
787
|
-
var FullDocumentUrl =
|
|
1160
|
+
var z9 = __toESM(require("zod/v4"));
|
|
1161
|
+
var FullDocumentUrl = z9.string().brand("FullDocumentUrl").describe(
|
|
788
1162
|
"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"
|
|
789
1163
|
);
|
|
790
|
-
var FullDocumentPath =
|
|
1164
|
+
var FullDocumentPath = z9.string().overwrite((val) => val.startsWith("/") ? val : `/${val}`).meta({ effectType: "input", type: "string" }).describe(
|
|
791
1165
|
"A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
|
|
792
1166
|
);
|
|
793
|
-
var DocumentPath =
|
|
1167
|
+
var DocumentPath = z9.string().brand("DocumentPath").describe(
|
|
794
1168
|
"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."
|
|
795
1169
|
);
|
|
796
1170
|
|
|
797
1171
|
// ../commons/src/events/CompositeFieldValue.ts
|
|
798
|
-
var
|
|
1172
|
+
var z10 = __toESM(require("zod/v4"));
|
|
799
1173
|
var GeographicalArea = {
|
|
800
1174
|
URBAN: "URBAN",
|
|
801
1175
|
RURAL: "RURAL"
|
|
@@ -804,94 +1178,94 @@ var AddressType = {
|
|
|
804
1178
|
DOMESTIC: "DOMESTIC",
|
|
805
1179
|
INTERNATIONAL: "INTERNATIONAL"
|
|
806
1180
|
};
|
|
807
|
-
var FileFieldValue =
|
|
1181
|
+
var FileFieldValue = z10.object({
|
|
808
1182
|
path: DocumentPath,
|
|
809
|
-
originalFilename:
|
|
810
|
-
type:
|
|
811
|
-
});
|
|
812
|
-
var NameFieldValue =
|
|
813
|
-
firstname:
|
|
814
|
-
surname:
|
|
815
|
-
middlename:
|
|
816
|
-
});
|
|
817
|
-
var NameFieldUpdateValue =
|
|
818
|
-
firstname:
|
|
819
|
-
surname:
|
|
820
|
-
middlename:
|
|
821
|
-
}).or(
|
|
822
|
-
var StreetLevelDetailsValue =
|
|
823
|
-
var StreetLevelDetailsUpdateValue =
|
|
824
|
-
var BaseAddressFieldValue =
|
|
825
|
-
country:
|
|
1183
|
+
originalFilename: z10.string(),
|
|
1184
|
+
type: z10.string()
|
|
1185
|
+
});
|
|
1186
|
+
var NameFieldValue = z10.object({
|
|
1187
|
+
firstname: z10.string(),
|
|
1188
|
+
surname: z10.string(),
|
|
1189
|
+
middlename: z10.string().optional()
|
|
1190
|
+
});
|
|
1191
|
+
var NameFieldUpdateValue = z10.object({
|
|
1192
|
+
firstname: z10.string().nullish(),
|
|
1193
|
+
surname: z10.string().nullish(),
|
|
1194
|
+
middlename: z10.string().nullish()
|
|
1195
|
+
}).or(z10.null()).or(z10.undefined());
|
|
1196
|
+
var StreetLevelDetailsValue = z10.record(z10.string(), z10.string()).optional();
|
|
1197
|
+
var StreetLevelDetailsUpdateValue = z10.record(z10.string(), z10.string().nullable()).nullish();
|
|
1198
|
+
var BaseAddressFieldValue = z10.object({
|
|
1199
|
+
country: z10.string(),
|
|
826
1200
|
streetLevelDetails: StreetLevelDetailsValue
|
|
827
1201
|
});
|
|
828
|
-
var BaseAddressFieldUpdateValue =
|
|
829
|
-
country:
|
|
1202
|
+
var BaseAddressFieldUpdateValue = z10.object({
|
|
1203
|
+
country: z10.string().nullish(),
|
|
830
1204
|
streetLevelDetails: StreetLevelDetailsUpdateValue
|
|
831
1205
|
});
|
|
832
1206
|
var DomesticAddressFieldValue = BaseAddressFieldValue.extend({
|
|
833
|
-
addressType:
|
|
834
|
-
administrativeArea:
|
|
1207
|
+
addressType: z10.literal(AddressType.DOMESTIC),
|
|
1208
|
+
administrativeArea: z10.string().uuid()
|
|
835
1209
|
});
|
|
836
1210
|
var InternationalAddressFieldValue = BaseAddressFieldValue.extend({
|
|
837
|
-
addressType:
|
|
1211
|
+
addressType: z10.literal(AddressType.INTERNATIONAL)
|
|
838
1212
|
});
|
|
839
|
-
var AddressFieldValue =
|
|
1213
|
+
var AddressFieldValue = z10.discriminatedUnion("addressType", [
|
|
840
1214
|
DomesticAddressFieldValue,
|
|
841
1215
|
InternationalAddressFieldValue
|
|
842
1216
|
]);
|
|
843
1217
|
var DomesticAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend({
|
|
844
|
-
addressType:
|
|
845
|
-
administrativeArea:
|
|
1218
|
+
addressType: z10.literal(AddressType.DOMESTIC),
|
|
1219
|
+
administrativeArea: z10.string().uuid().nullish()
|
|
846
1220
|
/* Leaf level admin structure */
|
|
847
1221
|
});
|
|
848
1222
|
var InternationalAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend(
|
|
849
1223
|
{
|
|
850
|
-
addressType:
|
|
1224
|
+
addressType: z10.literal(AddressType.INTERNATIONAL)
|
|
851
1225
|
}
|
|
852
1226
|
);
|
|
853
|
-
var AddressFieldUpdateValue =
|
|
1227
|
+
var AddressFieldUpdateValue = z10.discriminatedUnion("addressType", [
|
|
854
1228
|
DomesticAddressUpdateFieldValue,
|
|
855
1229
|
InternationalAddressUpdateFieldValue
|
|
856
1230
|
]).nullish();
|
|
857
|
-
var FileFieldValueWithOption =
|
|
1231
|
+
var FileFieldValueWithOption = z10.object({
|
|
858
1232
|
path: DocumentPath,
|
|
859
|
-
originalFilename:
|
|
860
|
-
type:
|
|
861
|
-
option:
|
|
862
|
-
});
|
|
863
|
-
var FileFieldWithOptionValue =
|
|
864
|
-
var HttpFieldValue =
|
|
865
|
-
loading:
|
|
866
|
-
error:
|
|
867
|
-
data:
|
|
868
|
-
});
|
|
869
|
-
var HttpFieldUpdateValue =
|
|
870
|
-
loading:
|
|
871
|
-
error:
|
|
872
|
-
data:
|
|
873
|
-
}).or(
|
|
874
|
-
var QueryParamReaderFieldValue =
|
|
875
|
-
data:
|
|
876
|
-
updatedAt:
|
|
1233
|
+
originalFilename: z10.string(),
|
|
1234
|
+
type: z10.string(),
|
|
1235
|
+
option: z10.string()
|
|
1236
|
+
});
|
|
1237
|
+
var FileFieldWithOptionValue = z10.array(FileFieldValueWithOption);
|
|
1238
|
+
var HttpFieldValue = z10.object({
|
|
1239
|
+
loading: z10.boolean(),
|
|
1240
|
+
error: z10.object({ statusCode: z10.number(), message: z10.string() }).nullish(),
|
|
1241
|
+
data: z10.any()
|
|
1242
|
+
});
|
|
1243
|
+
var HttpFieldUpdateValue = z10.object({
|
|
1244
|
+
loading: z10.boolean().nullish(),
|
|
1245
|
+
error: z10.object({ statusCode: z10.number(), message: z10.string() }).nullish(),
|
|
1246
|
+
data: z10.any().nullish()
|
|
1247
|
+
}).or(z10.null()).or(z10.undefined());
|
|
1248
|
+
var QueryParamReaderFieldValue = z10.object({
|
|
1249
|
+
data: z10.record(z10.string(), z10.string()),
|
|
1250
|
+
updatedAt: z10.iso.datetime()
|
|
877
1251
|
}).nullish();
|
|
878
|
-
var QueryParamReaderFieldUpdateValue =
|
|
879
|
-
data:
|
|
1252
|
+
var QueryParamReaderFieldUpdateValue = z10.object({
|
|
1253
|
+
data: z10.record(z10.string(), z10.string())
|
|
880
1254
|
});
|
|
881
|
-
var ReadDataValue =
|
|
882
|
-
data:
|
|
1255
|
+
var ReadDataValue = z10.object({
|
|
1256
|
+
data: z10.any()
|
|
883
1257
|
});
|
|
884
1258
|
var QrReaderFieldValue = ReadDataValue;
|
|
885
1259
|
var IdReaderFieldValue = ReadDataValue;
|
|
886
|
-
var NumberWithUnitFieldValue =
|
|
887
|
-
numericValue:
|
|
888
|
-
unit:
|
|
1260
|
+
var NumberWithUnitFieldValue = z10.object({
|
|
1261
|
+
numericValue: z10.number(),
|
|
1262
|
+
unit: z10.string()
|
|
889
1263
|
});
|
|
890
|
-
var NumberWithUnitFieldUpdateValue =
|
|
891
|
-
numericValue:
|
|
892
|
-
unit:
|
|
1264
|
+
var NumberWithUnitFieldUpdateValue = z10.object({
|
|
1265
|
+
numericValue: z10.number().optional(),
|
|
1266
|
+
unit: z10.string().optional()
|
|
893
1267
|
});
|
|
894
|
-
var CustomFieldValue =
|
|
1268
|
+
var CustomFieldValue = z10.unknown().brand("CustomFieldValue");
|
|
895
1269
|
|
|
896
1270
|
// ../commons/src/events/PlainDate.ts
|
|
897
1271
|
var import_zod = require("zod");
|
|
@@ -902,40 +1276,45 @@ function plainDateToLocalDate(date) {
|
|
|
902
1276
|
}
|
|
903
1277
|
|
|
904
1278
|
// ../commons/src/events/FieldValue.ts
|
|
905
|
-
var TextValue =
|
|
906
|
-
var HiddenFieldValue =
|
|
1279
|
+
var TextValue = z12.string();
|
|
1280
|
+
var HiddenFieldValue = z12.string();
|
|
907
1281
|
var NonEmptyTextValue = TextValue.min(1);
|
|
908
|
-
var DateValue =
|
|
909
|
-
var AgeValue =
|
|
910
|
-
age:
|
|
911
|
-
asOfDateRef:
|
|
1282
|
+
var DateValue = z12.iso.date().describe("Date in the format YYYY-MM-DD");
|
|
1283
|
+
var AgeValue = z12.object({
|
|
1284
|
+
age: z12.number(),
|
|
1285
|
+
asOfDateRef: z12.string()
|
|
912
1286
|
});
|
|
913
1287
|
var AgeUpdateValue = AgeValue.optional().nullable();
|
|
914
|
-
var
|
|
915
|
-
|
|
916
|
-
|
|
1288
|
+
var AutocompleteValue = z12.object({
|
|
1289
|
+
label: z12.string(),
|
|
1290
|
+
value: z12.string()
|
|
1291
|
+
});
|
|
1292
|
+
var AutocompleteUpdateValue = AutocompleteValue.optional().nullable();
|
|
1293
|
+
var TimeValue = z12.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/);
|
|
1294
|
+
var DatetimeValue = z12.iso.datetime();
|
|
1295
|
+
var SelectDateRangeValue = z12.enum([
|
|
917
1296
|
"last7Days",
|
|
918
1297
|
"last30Days",
|
|
919
1298
|
"last90Days",
|
|
920
1299
|
"last365Days"
|
|
921
1300
|
]);
|
|
922
|
-
var DateRangeFieldValue =
|
|
1301
|
+
var DateRangeFieldValue = z12.object({
|
|
923
1302
|
start: PlainDate,
|
|
924
1303
|
end: PlainDate
|
|
925
1304
|
}).or(PlainDate).describe(
|
|
926
1305
|
"Date range with start and end dates in the format YYYY-MM-DD. Inclusive start, exclusive end."
|
|
927
1306
|
);
|
|
928
|
-
var EmailValue =
|
|
929
|
-
var CheckboxFieldValue =
|
|
930
|
-
var NumberFieldValue =
|
|
931
|
-
var ButtonFieldValue =
|
|
932
|
-
var VerificationStatusValue =
|
|
1307
|
+
var EmailValue = z12.email();
|
|
1308
|
+
var CheckboxFieldValue = z12.boolean();
|
|
1309
|
+
var NumberFieldValue = z12.number();
|
|
1310
|
+
var ButtonFieldValue = z12.number();
|
|
1311
|
+
var VerificationStatusValue = z12.enum([
|
|
933
1312
|
"verified",
|
|
934
1313
|
"authenticated",
|
|
935
1314
|
"failed",
|
|
936
1315
|
"pending"
|
|
937
1316
|
]);
|
|
938
|
-
var LeafFieldValues =
|
|
1317
|
+
var LeafFieldValues = z12.union([
|
|
939
1318
|
AddressFieldValue,
|
|
940
1319
|
TextValue,
|
|
941
1320
|
PlainDate,
|
|
@@ -957,13 +1336,15 @@ var LeafFieldValues = z9.union([
|
|
|
957
1336
|
IdReaderFieldValue,
|
|
958
1337
|
NumberWithUnitFieldValue,
|
|
959
1338
|
NumberWithUnitFieldUpdateValue,
|
|
960
|
-
CustomFieldValue
|
|
1339
|
+
CustomFieldValue,
|
|
1340
|
+
AutocompleteValue,
|
|
1341
|
+
AutocompleteUpdateValue
|
|
961
1342
|
]);
|
|
962
|
-
var FieldGroupValue =
|
|
963
|
-
var DataFieldValue =
|
|
964
|
-
data:
|
|
1343
|
+
var FieldGroupValue = z12.record(z12.string(), LeafFieldValues);
|
|
1344
|
+
var DataFieldValue = z12.object({
|
|
1345
|
+
data: z12.record(z12.string(), LeafFieldValues)
|
|
965
1346
|
}).nullish();
|
|
966
|
-
var FieldValue =
|
|
1347
|
+
var FieldValue = z12.union([
|
|
967
1348
|
LeafFieldValues,
|
|
968
1349
|
DataFieldValue,
|
|
969
1350
|
FieldGroupValue
|
|
@@ -981,659 +1362,116 @@ var PRIORITY_ORDER = [
|
|
|
981
1362
|
"NumberFieldValue",
|
|
982
1363
|
"NumberWithUnitFieldUpdateValue",
|
|
983
1364
|
"FileFieldValue",
|
|
984
|
-
"FileFieldWithOptionValue",
|
|
985
|
-
"DataFieldValue",
|
|
986
|
-
"GroupFieldValue"
|
|
987
|
-
];
|
|
988
|
-
function schemaPriority(schema) {
|
|
989
|
-
const name = schema.description;
|
|
990
|
-
if (!name) {
|
|
991
|
-
return 9999;
|
|
992
|
-
}
|
|
993
|
-
const idx = PRIORITY_ORDER.indexOf(name);
|
|
994
|
-
return idx === -1 ? 9999 : idx;
|
|
995
|
-
}
|
|
996
|
-
function safeUnion(schemas) {
|
|
997
|
-
return
|
|
998
|
-
const successful = schemas.filter((s) => s.safeParse(val).success);
|
|
999
|
-
if (successful.length === 1) {
|
|
1000
|
-
return;
|
|
1001
|
-
}
|
|
1002
|
-
if (successful.length === 0) {
|
|
1003
|
-
ctx.addIssue({
|
|
1004
|
-
code: "invalid_type",
|
|
1005
|
-
expected: "custom",
|
|
1006
|
-
message: "Value does not match any schema"
|
|
1007
|
-
});
|
|
1008
|
-
return;
|
|
1009
|
-
}
|
|
1010
|
-
successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
|
|
1011
|
-
const best = successful[0];
|
|
1012
|
-
if (!best.safeParse(val).success) {
|
|
1013
|
-
ctx.addIssue({
|
|
1014
|
-
expected: "custom",
|
|
1015
|
-
code: "invalid_type",
|
|
1016
|
-
message: "Value did not match the best schema"
|
|
1017
|
-
});
|
|
1018
|
-
}
|
|
1019
|
-
}).meta({
|
|
1020
|
-
description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
|
|
1021
|
-
});
|
|
1022
|
-
}
|
|
1023
|
-
var FieldUpdateValue = safeUnion([
|
|
1024
|
-
TextValue.describe("TextValue"),
|
|
1025
|
-
PlainDate.describe("PlainDate"),
|
|
1026
|
-
TimeValue.describe("TimeValue"),
|
|
1027
|
-
AgeUpdateValue.describe("AgeUpdateValue"),
|
|
1028
|
-
AddressFieldUpdateValue.describe("AddressFieldUpdateValue"),
|
|
1029
|
-
DateRangeFieldValue.describe("DateRangeFieldValue"),
|
|
1030
|
-
SelectDateRangeValue.describe("SelectDateRangeValue"),
|
|
1031
|
-
CheckboxFieldValue.describe("CheckboxFieldValue"),
|
|
1032
|
-
NumberFieldValue.describe("NumberFieldValue"),
|
|
1033
|
-
NumberWithUnitFieldUpdateValue.describe("NumberWithUnitFieldUpdateValue"),
|
|
1034
|
-
FileFieldValue.describe("FileFieldValue"),
|
|
1035
|
-
FileFieldWithOptionValue.describe("FileFieldWithOptionValue"),
|
|
1036
|
-
DataFieldValue.describe("DataFieldValue"),
|
|
1037
|
-
FieldGroupValue.describe("GroupFieldValue"),
|
|
1038
|
-
NameFieldUpdateValue.describe("NameFieldUpdateValue"),
|
|
1039
|
-
HttpFieldUpdateValue.describe("HttpFieldUpdateValue"),
|
|
1040
|
-
QueryParamReaderFieldUpdateValue.describe("QueryParamReaderFieldUpdateValue"),
|
|
1041
|
-
CustomFieldValue.describe("CustomFieldValue"),
|
|
1042
|
-
HiddenFieldValue.describe("HiddenFieldValue")
|
|
1043
|
-
]);
|
|
1044
|
-
|
|
1045
|
-
// ../commons/src/uuid.ts
|
|
1046
|
-
var import_uuid = require("uuid");
|
|
1047
|
-
var z10 = __toESM(require("zod/v4"));
|
|
1048
|
-
var UUID = z10.uuid().brand("UUID");
|
|
1049
|
-
function getUUID() {
|
|
1050
|
-
return (0, import_uuid.v4)();
|
|
1051
|
-
}
|
|
1052
|
-
|
|
1053
|
-
// ../commons/src/events/serializers/user/serializer.ts
|
|
1054
|
-
var z11 = __toESM(require("zod/v4"));
|
|
1055
|
-
var SerializedUserField = z11.object({
|
|
1056
|
-
$userField: z11.enum([
|
|
1057
|
-
"id",
|
|
1058
|
-
"name",
|
|
1059
|
-
"role",
|
|
1060
|
-
"fullHonorificName",
|
|
1061
|
-
"device",
|
|
1062
|
-
"firstname",
|
|
1063
|
-
"middlename",
|
|
1064
|
-
"surname",
|
|
1065
|
-
"signature",
|
|
1066
|
-
"avatar",
|
|
1067
|
-
"primaryOfficeId",
|
|
1068
|
-
"administrativeAreaId"
|
|
1069
|
-
]),
|
|
1070
|
-
$location: z11.string().optional()
|
|
1071
|
-
});
|
|
1072
|
-
function userSerializer(userField) {
|
|
1073
|
-
return {
|
|
1074
|
-
$userField: userField,
|
|
1075
|
-
locationLevel(adminLevelId) {
|
|
1076
|
-
return {
|
|
1077
|
-
$userField: this.$userField,
|
|
1078
|
-
$location: adminLevelId
|
|
1079
|
-
};
|
|
1080
|
-
},
|
|
1081
|
-
toJSON() {
|
|
1082
|
-
return {
|
|
1083
|
-
$userField: userField
|
|
1084
|
-
};
|
|
1085
|
-
}
|
|
1086
|
-
};
|
|
1087
|
-
}
|
|
1088
|
-
|
|
1089
|
-
// ../commons/src/events/EventIndex.ts
|
|
1090
|
-
var import_v4 = require("zod/v4");
|
|
1091
|
-
|
|
1092
|
-
// ../commons/src/events/EventMetadata.ts
|
|
1093
|
-
var z17 = __toESM(require("zod/v4"));
|
|
1094
|
-
|
|
1095
|
-
// ../commons/src/events/ActionDocument.ts
|
|
1096
|
-
var z15 = __toESM(require("zod/v4"));
|
|
1097
|
-
|
|
1098
|
-
// ../commons/src/authentication.ts
|
|
1099
|
-
var import_jwt_decode = __toESM(require("jwt-decode"));
|
|
1100
|
-
var z14 = __toESM(require("zod/v4"));
|
|
1101
|
-
|
|
1102
|
-
// ../commons/src/scopes.ts
|
|
1103
|
-
var z13 = __toESM(require("zod/v4"));
|
|
1104
|
-
var qs = __toESM(require("qs"));
|
|
1105
|
-
|
|
1106
|
-
// ../commons/src/scopes.deprecated.do-not-use.ts
|
|
1107
|
-
var z12 = __toESM(require("zod/v4"));
|
|
1108
|
-
var rawConfigurableScopeRegex = /^([a-zA-Z][a-zA-Z0-9.-]*(?:\.[a-zA-Z0-9.-]+)*)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
|
|
1109
|
-
var rawConfigurableScope = z12.string().regex(rawConfigurableScopeRegex);
|
|
1110
|
-
var SearchScope = z12.object({
|
|
1111
|
-
type: z12.literal("search"),
|
|
1112
|
-
options: z12.object({
|
|
1113
|
-
event: z12.array(z12.string()).length(1),
|
|
1114
|
-
access: z12.array(z12.enum(["my-jurisdiction", "all"])).length(1)
|
|
1115
|
-
})
|
|
1116
|
-
});
|
|
1117
|
-
var CreateUserScope = z12.object({
|
|
1118
|
-
type: z12.literal("user.create"),
|
|
1119
|
-
options: z12.object({
|
|
1120
|
-
role: z12.array(z12.string())
|
|
1121
|
-
})
|
|
1122
|
-
});
|
|
1123
|
-
var EditUserScope = z12.object({
|
|
1124
|
-
type: z12.literal("user.edit"),
|
|
1125
|
-
options: z12.object({
|
|
1126
|
-
role: z12.array(z12.string())
|
|
1127
|
-
})
|
|
1128
|
-
});
|
|
1129
|
-
var WorkqueueScope = z12.object({
|
|
1130
|
-
type: z12.literal("workqueue"),
|
|
1131
|
-
options: z12.object({
|
|
1132
|
-
id: z12.array(z12.string())
|
|
1133
|
-
})
|
|
1134
|
-
});
|
|
1135
|
-
var PrintCertifiedCopiesScope = z12.object({
|
|
1136
|
-
type: z12.literal("record.registered.print-certified-copies"),
|
|
1137
|
-
options: z12.object({
|
|
1138
|
-
event: z12.array(z12.string()).describe("Event type, e.g. birth, death"),
|
|
1139
|
-
templates: z12.array(z12.string()).optional().describe(
|
|
1140
|
-
"Template IDs for certified copies. If not provided, all templates will be used."
|
|
1141
|
-
)
|
|
1142
|
-
})
|
|
1143
|
-
});
|
|
1144
|
-
var LegacyRecordScope = z12.object({
|
|
1145
|
-
type: z12.enum([
|
|
1146
|
-
"record.create",
|
|
1147
|
-
"record.read",
|
|
1148
|
-
"record.declare",
|
|
1149
|
-
"record.notify",
|
|
1150
|
-
"record.declared.edit",
|
|
1151
|
-
"record.declared.validate",
|
|
1152
|
-
"record.declared.reject",
|
|
1153
|
-
"record.declared.archive",
|
|
1154
|
-
"record.declared.review-duplicates",
|
|
1155
|
-
"record.register",
|
|
1156
|
-
"record.registered.request-correction",
|
|
1157
|
-
"record.registered.correct",
|
|
1158
|
-
"record.unassign-others"
|
|
1159
|
-
]),
|
|
1160
|
-
options: z12.object({
|
|
1161
|
-
event: z12.array(z12.string()).describe("Event type, e.g. birth, death")
|
|
1162
|
-
})
|
|
1163
|
-
}).describe(
|
|
1164
|
-
"Scopes used to check user's permission to perform actions on a record."
|
|
1165
|
-
);
|
|
1166
|
-
var ConfigurableRawScopes = z12.discriminatedUnion("type", [
|
|
1167
|
-
SearchScope,
|
|
1168
|
-
LegacyRecordScope,
|
|
1169
|
-
PrintCertifiedCopiesScope,
|
|
1170
|
-
CreateUserScope,
|
|
1171
|
-
EditUserScope,
|
|
1172
|
-
WorkqueueScope
|
|
1173
|
-
]);
|
|
1174
|
-
|
|
1175
|
-
// ../commons/src/scopes.ts
|
|
1176
|
-
var SCOPES = {
|
|
1177
|
-
// TODO v1.8 legacy scopes
|
|
1178
|
-
BYPASSRATELIMIT: "bypassratelimit",
|
|
1179
|
-
REGISTER: "register",
|
|
1180
|
-
DEMO: "demo",
|
|
1181
|
-
CONFIG: "config",
|
|
1182
|
-
// systems / integrations
|
|
1183
|
-
WEBHOOK: "webhook",
|
|
1184
|
-
NATIONALID: "nationalId",
|
|
1185
|
-
NOTIFICATION_API: "notification-api",
|
|
1186
|
-
RECORDSEARCH: "recordsearch",
|
|
1187
|
-
RECORD_IMPORT: "record.import",
|
|
1188
|
-
RECORD_EXPORT: "record.export",
|
|
1189
|
-
RECORD_REINDEX: "record.reindex",
|
|
1190
|
-
INTEGRATION_CREATE: "integration.create",
|
|
1191
|
-
// declare
|
|
1192
|
-
RECORD_DECLARE_BIRTH: "record.declare-birth",
|
|
1193
|
-
RECORD_DECLARE_BIRTH_MY_JURISDICTION: "record.declare-birth:my-jurisdiction",
|
|
1194
|
-
RECORD_DECLARE_DEATH: "record.declare-death",
|
|
1195
|
-
RECORD_DECLARE_DEATH_MY_JURISDICTION: "record.declare-death:my-jurisdiction",
|
|
1196
|
-
RECORD_DECLARE_MARRIAGE: "record.declare-marriage",
|
|
1197
|
-
RECORD_DECLARE_MARRIAGE_MY_JURISDICTION: "record.declare-marriage:my-jurisdiction",
|
|
1198
|
-
RECORD_SUBMIT_INCOMPLETE: "record.declaration-submit-incomplete",
|
|
1199
|
-
// @todo: should this record be removed from events v2?
|
|
1200
|
-
RECORD_SUBMIT_FOR_REVIEW: "record.declaration-submit-for-review",
|
|
1201
|
-
RECORD_UNASSIGN_OTHERS: "record.unassign-others",
|
|
1202
|
-
// validate
|
|
1203
|
-
RECORD_SUBMIT_FOR_APPROVAL: "record.declaration-submit-for-approval",
|
|
1204
|
-
RECORD_SUBMIT_FOR_UPDATES: "record.declaration-submit-for-updates",
|
|
1205
|
-
RECORD_DECLARATION_EDIT: "record.declaration-edit",
|
|
1206
|
-
RECORD_REVIEW_DUPLICATES: "record.review-duplicates",
|
|
1207
|
-
RECORD_DECLARATION_ARCHIVE: "record.declaration-archive",
|
|
1208
|
-
RECORD_DECLARATION_REINSTATE: "record.declaration-reinstate",
|
|
1209
|
-
// register
|
|
1210
|
-
RECORD_REGISTER: "record.register",
|
|
1211
|
-
/**
|
|
1212
|
-
* This scope is used to **print and **issue certified copies of a record
|
|
1213
|
-
* after it has been registered. Previously Registrars had this permission.
|
|
1214
|
-
*/
|
|
1215
|
-
RECORD_PRINT_ISSUE_CERTIFIED_COPIES: "record.registration-print&issue-certified-copies",
|
|
1216
|
-
// correct
|
|
1217
|
-
RECORD_REGISTRATION_REQUEST_CORRECTION: "record.registration-request-correction",
|
|
1218
|
-
RECORD_REGISTRATION_CORRECT: "record.registration-correct",
|
|
1219
|
-
RECORD_CONFIRM_REGISTRATION: "record.confirm-registration",
|
|
1220
|
-
RECORD_REJECT_REGISTRATION: "record.reject-registration",
|
|
1221
|
-
// search
|
|
1222
|
-
SEARCH_BIRTH_MY_JURISDICTION: "search.birth:my-jurisdiction",
|
|
1223
|
-
SEARCH_BIRTH: "search.birth",
|
|
1224
|
-
SEARCH_DEATH_MY_JURISDICTION: "search.death:my-jurisdiction",
|
|
1225
|
-
SEARCH_DEATH: "search.death",
|
|
1226
|
-
SEARCH_MARRIAGE_MY_JURISDICTION: "search.marriage:my-jurisdiction",
|
|
1227
|
-
SEARCH_MARRIAGE: "search.marriage",
|
|
1228
|
-
// audit v1.8
|
|
1229
|
-
RECORD_READ: "record.read",
|
|
1230
|
-
// profile
|
|
1231
|
-
PROFILE_ELECTRONIC_SIGNATURE: "profile.electronic-signature",
|
|
1232
|
-
// performance
|
|
1233
|
-
PERFORMANCE_READ: "performance.read",
|
|
1234
|
-
PERFORMANCE_READ_DASHBOARDS: "performance.read-dashboards",
|
|
1235
|
-
PERFORMANCE_EXPORT_VITAL_STATISTICS: "performance.vital-statistics-export",
|
|
1236
|
-
// organisation
|
|
1237
|
-
ORGANISATION_READ_LOCATIONS: "organisation.read-locations:all",
|
|
1238
|
-
ORGANISATION_READ_LOCATIONS_MY_OFFICE: "organisation.read-locations:my-office",
|
|
1239
|
-
ORGANISATION_READ_LOCATIONS_MY_JURISDICTION: "organisation.read-locations:my-jurisdiction",
|
|
1240
|
-
// user
|
|
1241
|
-
USER_READ: "user.read:all",
|
|
1242
|
-
USER_READ_MY_OFFICE: "user.read:my-office",
|
|
1243
|
-
USER_READ_MY_JURISDICTION: "user.read:my-jurisdiction",
|
|
1244
|
-
USER_READ_ONLY_MY_AUDIT: "user.read:only-my-audit",
|
|
1245
|
-
//v1.8
|
|
1246
|
-
USER_CREATE: "user.create:all",
|
|
1247
|
-
USER_CREATE_MY_JURISDICTION: "user.create:my-jurisdiction",
|
|
1248
|
-
USER_UPDATE: "user.update:all",
|
|
1249
|
-
USER_UPDATE_MY_JURISDICTION: "user.update:my-jurisdiction",
|
|
1250
|
-
// config
|
|
1251
|
-
CONFIG_UPDATE_ALL: "config.update:all",
|
|
1252
|
-
// data seeding
|
|
1253
|
-
USER_DATA_SEEDING: "user.data-seeding",
|
|
1254
|
-
// attachment
|
|
1255
|
-
ATTACHMENT_UPLOAD: "attachment.upload"
|
|
1256
|
-
};
|
|
1257
|
-
var LegacyScopes = z13.union([
|
|
1258
|
-
z13.literal(SCOPES.BYPASSRATELIMIT),
|
|
1259
|
-
z13.literal(SCOPES.REGISTER),
|
|
1260
|
-
z13.literal(SCOPES.DEMO),
|
|
1261
|
-
z13.literal(SCOPES.CONFIG)
|
|
1262
|
-
]);
|
|
1263
|
-
var IntegrationScopes = z13.union([
|
|
1264
|
-
z13.literal(SCOPES.WEBHOOK),
|
|
1265
|
-
z13.literal(SCOPES.NATIONALID),
|
|
1266
|
-
z13.literal(SCOPES.NOTIFICATION_API),
|
|
1267
|
-
z13.literal(SCOPES.RECORDSEARCH),
|
|
1268
|
-
z13.literal(SCOPES.INTEGRATION_CREATE)
|
|
1269
|
-
]);
|
|
1270
|
-
var InternalOperationsScopes = z13.union([
|
|
1271
|
-
z13.literal(SCOPES.RECORD_REINDEX),
|
|
1272
|
-
z13.literal(SCOPES.RECORD_IMPORT)
|
|
1273
|
-
]);
|
|
1274
|
-
var PerformanceScopes = z13.union([
|
|
1275
|
-
z13.literal(SCOPES.PERFORMANCE_READ),
|
|
1276
|
-
z13.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
|
|
1277
|
-
z13.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS)
|
|
1278
|
-
]);
|
|
1279
|
-
var OrganisationScopes = z13.union([
|
|
1280
|
-
z13.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
|
|
1281
|
-
z13.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
|
|
1282
|
-
z13.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION)
|
|
1283
|
-
]);
|
|
1284
|
-
var UserScopes = z13.union([
|
|
1285
|
-
z13.literal(SCOPES.USER_READ),
|
|
1286
|
-
z13.literal(SCOPES.USER_READ_MY_OFFICE),
|
|
1287
|
-
z13.literal(SCOPES.USER_READ_MY_JURISDICTION),
|
|
1288
|
-
z13.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
|
|
1289
|
-
z13.literal(SCOPES.USER_CREATE),
|
|
1290
|
-
z13.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
|
|
1291
|
-
z13.literal(SCOPES.USER_UPDATE),
|
|
1292
|
-
z13.literal(SCOPES.USER_UPDATE_MY_JURISDICTION)
|
|
1293
|
-
]);
|
|
1294
|
-
var ConfigScope = z13.literal(SCOPES.CONFIG_UPDATE_ALL);
|
|
1295
|
-
var DataSeedingScope = z13.literal(SCOPES.USER_DATA_SEEDING);
|
|
1296
|
-
var AttachmentScope = z13.literal(SCOPES.ATTACHMENT_UPLOAD);
|
|
1297
|
-
var LiteralScopes = z13.union([
|
|
1298
|
-
LegacyScopes,
|
|
1299
|
-
IntegrationScopes,
|
|
1300
|
-
z13.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE),
|
|
1301
|
-
z13.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
|
|
1302
|
-
PerformanceScopes,
|
|
1303
|
-
OrganisationScopes,
|
|
1304
|
-
UserScopes,
|
|
1305
|
-
ConfigScope,
|
|
1306
|
-
DataSeedingScope,
|
|
1307
|
-
InternalOperationsScopes,
|
|
1308
|
-
AttachmentScope
|
|
1309
|
-
]);
|
|
1310
|
-
var JurisdictionFilter = z13.enum(["administrativeArea", "location", "all"]).describe(
|
|
1311
|
-
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
1312
|
-
);
|
|
1313
|
-
var UserFilter = z13.enum(["user"]).describe("Filters based on the user. Limits to self.");
|
|
1314
|
-
var RecordScopeTypeV2 = z13.enum([
|
|
1315
|
-
"record.search",
|
|
1316
|
-
"record.create",
|
|
1317
|
-
"record.read",
|
|
1318
|
-
"record.declare",
|
|
1319
|
-
"record.notify",
|
|
1320
|
-
"record.edit",
|
|
1321
|
-
"record.reject",
|
|
1322
|
-
"record.archive",
|
|
1323
|
-
"record.review-duplicates",
|
|
1324
|
-
"record.register",
|
|
1325
|
-
"record.print-certified-copies",
|
|
1326
|
-
"record.request-correction",
|
|
1327
|
-
"record.correct",
|
|
1328
|
-
"record.unassign-others",
|
|
1329
|
-
"record.custom-action"
|
|
1330
|
-
]);
|
|
1331
|
-
var scopeByEvent = z13.preprocess(
|
|
1332
|
-
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
1333
|
-
z13.array(z13.string()).optional()
|
|
1334
|
-
).describe("Event type, e.g. birth, death");
|
|
1335
|
-
var scopeOptionsPlaceEvent = z13.object({
|
|
1336
|
-
event: scopeByEvent,
|
|
1337
|
-
placeOfEvent: JurisdictionFilter.optional()
|
|
1338
|
-
}).describe("Options applicable to all record scopes.");
|
|
1339
|
-
var scopeOptionsDeclared = scopeOptionsPlaceEvent.extend({
|
|
1340
|
-
declaredIn: JurisdictionFilter.optional(),
|
|
1341
|
-
declaredBy: UserFilter.optional()
|
|
1342
|
-
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
1343
|
-
var ScopeOptionsFull = scopeOptionsDeclared.extend({
|
|
1344
|
-
registeredIn: JurisdictionFilter.optional(),
|
|
1345
|
-
registeredBy: UserFilter.optional()
|
|
1346
|
-
}).describe(
|
|
1347
|
-
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
1348
|
-
);
|
|
1349
|
-
var CustomActionScopeOptions = ScopeOptionsFull.extend({
|
|
1350
|
-
customActionTypes: z13.preprocess(
|
|
1351
|
-
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
1352
|
-
z13.array(z13.string()).optional()
|
|
1353
|
-
).describe("Allowed custom action types")
|
|
1354
|
-
});
|
|
1355
|
-
var ScopeOptionKey = ScopeOptionsFull.keyof();
|
|
1356
|
-
var ResolvedScopeOptionsPlaceEvent = z13.object({
|
|
1357
|
-
event: scopeByEvent,
|
|
1358
|
-
placeOfEvent: UUID.nullish()
|
|
1359
|
-
}).describe(
|
|
1360
|
-
"Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
|
|
1361
|
-
);
|
|
1362
|
-
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
1363
|
-
declaredIn: UUID.nullish(),
|
|
1364
|
-
declaredBy: z13.string().optional()
|
|
1365
|
-
}).describe(
|
|
1366
|
-
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
1367
|
-
);
|
|
1368
|
-
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
1369
|
-
registeredIn: UUID.nullish(),
|
|
1370
|
-
registeredBy: z13.string().optional()
|
|
1371
|
-
}).describe(
|
|
1372
|
-
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
1373
|
-
);
|
|
1374
|
-
var ScopesWithPlaceEventOptions = RecordScopeTypeV2.extract([
|
|
1375
|
-
"record.create",
|
|
1376
|
-
"record.declare",
|
|
1377
|
-
"record.notify"
|
|
1378
|
-
]);
|
|
1379
|
-
var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
1380
|
-
"record.edit",
|
|
1381
|
-
"record.reject",
|
|
1382
|
-
"record.archive",
|
|
1383
|
-
"record.review-duplicates",
|
|
1384
|
-
"record.register"
|
|
1385
|
-
]);
|
|
1386
|
-
var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
1387
|
-
"record.search",
|
|
1388
|
-
"record.read",
|
|
1389
|
-
"record.request-correction",
|
|
1390
|
-
"record.correct",
|
|
1391
|
-
"record.unassign-others"
|
|
1392
|
-
]);
|
|
1393
|
-
var ScopeOptionsPrintCertifiedCopies = ScopeOptionsFull.extend({
|
|
1394
|
-
templates: z13.preprocess(
|
|
1395
|
-
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
1396
|
-
z13.array(z13.string()).optional()
|
|
1397
|
-
).describe(
|
|
1398
|
-
"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."
|
|
1399
|
-
)
|
|
1400
|
-
});
|
|
1401
|
-
var RecordScopeV2 = z13.discriminatedUnion("type", [
|
|
1402
|
-
z13.object({
|
|
1403
|
-
type: ScopesWithPlaceEventOptions,
|
|
1404
|
-
options: scopeOptionsPlaceEvent.optional()
|
|
1405
|
-
}),
|
|
1406
|
-
z13.object({
|
|
1407
|
-
type: ScopesWithDeclaredOptions,
|
|
1408
|
-
options: scopeOptionsDeclared.optional()
|
|
1409
|
-
}),
|
|
1410
|
-
z13.object({
|
|
1411
|
-
type: ScopesWithFullOptions,
|
|
1412
|
-
options: ScopeOptionsFull.optional()
|
|
1413
|
-
}),
|
|
1414
|
-
z13.object({
|
|
1415
|
-
type: z13.literal("record.custom-action"),
|
|
1416
|
-
options: CustomActionScopeOptions.optional()
|
|
1417
|
-
}),
|
|
1418
|
-
z13.object({
|
|
1419
|
-
type: z13.literal("record.print-certified-copies"),
|
|
1420
|
-
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
1421
|
-
})
|
|
1422
|
-
]).describe(
|
|
1423
|
-
"Scopes used to check user's permission to perform actions on a record."
|
|
1424
|
-
);
|
|
1425
|
-
function scopeUsesDeclaredOptions(scope) {
|
|
1426
|
-
return !ScopesWithPlaceEventOptions.options.some((opt) => opt === scope.type);
|
|
1427
|
-
}
|
|
1428
|
-
function scopeUsesFullOptions(scope) {
|
|
1429
|
-
return ScopesWithFullOptions.options.some((opt) => opt === scope.type);
|
|
1430
|
-
}
|
|
1431
|
-
function scopeUsesPrintCertifiedCopiesOptions(scope) {
|
|
1432
|
-
return scope.type === "record.print-certified-copies";
|
|
1433
|
-
}
|
|
1434
|
-
function isCustomActionScope(scope) {
|
|
1435
|
-
return scope.type === "record.custom-action";
|
|
1436
|
-
}
|
|
1437
|
-
var ResolvedRecordScopeV2 = z13.discriminatedUnion("type", [
|
|
1438
|
-
z13.object({
|
|
1439
|
-
type: ScopesWithPlaceEventOptions,
|
|
1440
|
-
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
1441
|
-
}),
|
|
1442
|
-
z13.object({
|
|
1443
|
-
type: ScopesWithDeclaredOptions,
|
|
1444
|
-
options: ResolvedScopeOptionsDeclared.optional()
|
|
1445
|
-
}),
|
|
1446
|
-
z13.object({
|
|
1447
|
-
type: ScopesWithFullOptions,
|
|
1448
|
-
options: ResolvedScopeOptionsFull.optional()
|
|
1449
|
-
}),
|
|
1450
|
-
z13.object({
|
|
1451
|
-
type: z13.literal("record.print-certified-copies"),
|
|
1452
|
-
options: ResolvedScopeOptionsFull.extend({
|
|
1453
|
-
templates: z13.array(z13.string()).optional()
|
|
1454
|
-
}).optional()
|
|
1455
|
-
})
|
|
1456
|
-
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
1457
|
-
var flattenScope = (scope) => ({
|
|
1458
|
-
type: scope.type,
|
|
1459
|
-
...scope.options
|
|
1460
|
-
});
|
|
1461
|
-
var unflattenScope = (input) => {
|
|
1462
|
-
const { type, ...options } = input;
|
|
1463
|
-
return { type, options };
|
|
1464
|
-
};
|
|
1465
|
-
var encodeScope = (scope) => {
|
|
1466
|
-
const flattened = flattenScope(scope);
|
|
1467
|
-
return qs.stringify(flattened, {
|
|
1468
|
-
arrayFormat: "comma",
|
|
1469
|
-
allowDots: true,
|
|
1470
|
-
addQueryPrefix: false,
|
|
1471
|
-
encode: false
|
|
1472
|
-
});
|
|
1473
|
-
};
|
|
1474
|
-
var decodeScope = (query) => {
|
|
1475
|
-
const scope = qs.parse(query, {
|
|
1476
|
-
ignoreQueryPrefix: true,
|
|
1477
|
-
comma: true,
|
|
1478
|
-
allowDots: true
|
|
1365
|
+
"FileFieldWithOptionValue",
|
|
1366
|
+
"DataFieldValue",
|
|
1367
|
+
"GroupFieldValue"
|
|
1368
|
+
];
|
|
1369
|
+
function schemaPriority(schema) {
|
|
1370
|
+
const name = schema.description;
|
|
1371
|
+
if (!name) {
|
|
1372
|
+
return 9999;
|
|
1373
|
+
}
|
|
1374
|
+
const idx = PRIORITY_ORDER.indexOf(name);
|
|
1375
|
+
return idx === -1 ? 9999 : idx;
|
|
1376
|
+
}
|
|
1377
|
+
function safeUnion(schemas) {
|
|
1378
|
+
return z12.any().superRefine((val, ctx) => {
|
|
1379
|
+
const successful = schemas.filter((s) => s.safeParse(val).success);
|
|
1380
|
+
if (successful.length === 1) {
|
|
1381
|
+
return;
|
|
1382
|
+
}
|
|
1383
|
+
if (successful.length === 0) {
|
|
1384
|
+
ctx.addIssue({
|
|
1385
|
+
code: "invalid_type",
|
|
1386
|
+
expected: "custom",
|
|
1387
|
+
message: "Value does not match any schema"
|
|
1388
|
+
});
|
|
1389
|
+
return;
|
|
1390
|
+
}
|
|
1391
|
+
successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
|
|
1392
|
+
const best = successful[0];
|
|
1393
|
+
if (!best.safeParse(val).success) {
|
|
1394
|
+
ctx.addIssue({
|
|
1395
|
+
expected: "custom",
|
|
1396
|
+
code: "invalid_type",
|
|
1397
|
+
message: "Value did not match the best schema"
|
|
1398
|
+
});
|
|
1399
|
+
}
|
|
1400
|
+
}).meta({
|
|
1401
|
+
description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
|
|
1479
1402
|
});
|
|
1480
|
-
const unflattenedScope = unflattenScope(scope);
|
|
1481
|
-
return RecordScopeV2.safeParse(unflattenedScope)?.data;
|
|
1482
|
-
};
|
|
1483
|
-
var DEFAULT_SCOPE_OPTIONS = {
|
|
1484
|
-
placeOfEvent: JurisdictionFilter.enum.all
|
|
1485
|
-
};
|
|
1486
|
-
function getAcceptedScopesByType({
|
|
1487
|
-
acceptedScopes,
|
|
1488
|
-
scopes
|
|
1489
|
-
}) {
|
|
1490
|
-
return scopes.map((scope) => {
|
|
1491
|
-
const parsedScope = decodeScope(scope);
|
|
1492
|
-
return parsedScope && acceptedScopes.some(
|
|
1493
|
-
(acceptedScope) => acceptedScope === parsedScope.type
|
|
1494
|
-
) ? parsedScope : null;
|
|
1495
|
-
}).filter((scope) => scope !== null);
|
|
1496
1403
|
}
|
|
1404
|
+
var FieldUpdateValue = safeUnion([
|
|
1405
|
+
TextValue.describe("TextValue"),
|
|
1406
|
+
PlainDate.describe("PlainDate"),
|
|
1407
|
+
TimeValue.describe("TimeValue"),
|
|
1408
|
+
AgeUpdateValue.describe("AgeUpdateValue"),
|
|
1409
|
+
AddressFieldUpdateValue.describe("AddressFieldUpdateValue"),
|
|
1410
|
+
DateRangeFieldValue.describe("DateRangeFieldValue"),
|
|
1411
|
+
SelectDateRangeValue.describe("SelectDateRangeValue"),
|
|
1412
|
+
CheckboxFieldValue.describe("CheckboxFieldValue"),
|
|
1413
|
+
NumberFieldValue.describe("NumberFieldValue"),
|
|
1414
|
+
NumberWithUnitFieldUpdateValue.describe("NumberWithUnitFieldUpdateValue"),
|
|
1415
|
+
FileFieldValue.describe("FileFieldValue"),
|
|
1416
|
+
FileFieldWithOptionValue.describe("FileFieldWithOptionValue"),
|
|
1417
|
+
DataFieldValue.describe("DataFieldValue"),
|
|
1418
|
+
FieldGroupValue.describe("GroupFieldValue"),
|
|
1419
|
+
NameFieldUpdateValue.describe("NameFieldUpdateValue"),
|
|
1420
|
+
HttpFieldUpdateValue.describe("HttpFieldUpdateValue"),
|
|
1421
|
+
QueryParamReaderFieldUpdateValue.describe("QueryParamReaderFieldUpdateValue"),
|
|
1422
|
+
CustomFieldValue.describe("CustomFieldValue"),
|
|
1423
|
+
HiddenFieldValue.describe("HiddenFieldValue"),
|
|
1424
|
+
AutocompleteUpdateValue.describe("AutocompleteUpdateValue")
|
|
1425
|
+
]);
|
|
1497
1426
|
|
|
1498
|
-
// ../commons/src/
|
|
1499
|
-
var
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
defaultMessage: "Registration Agent",
|
|
1526
|
-
description: "Name for user role Registration Agent",
|
|
1527
|
-
id: "userRole.registrationAgent"
|
|
1528
|
-
},
|
|
1529
|
-
scopes: [
|
|
1530
|
-
encodeScope({
|
|
1531
|
-
type: "record.create",
|
|
1532
|
-
options: {
|
|
1533
|
-
event: ["birth", "death", "tennis-club-membership"]
|
|
1534
|
-
}
|
|
1535
|
-
}),
|
|
1536
|
-
encodeScope({
|
|
1537
|
-
type: "record.declare",
|
|
1538
|
-
options: {
|
|
1539
|
-
event: ["birth", "death", "tennis-club-membership"]
|
|
1540
|
-
}
|
|
1541
|
-
}),
|
|
1542
|
-
SCOPES.PERFORMANCE_READ,
|
|
1543
|
-
SCOPES.PERFORMANCE_READ_DASHBOARDS,
|
|
1544
|
-
SCOPES.ORGANISATION_READ_LOCATIONS,
|
|
1545
|
-
SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE
|
|
1546
|
-
]
|
|
1547
|
-
},
|
|
1548
|
-
{
|
|
1549
|
-
id: "LOCAL_REGISTRAR",
|
|
1550
|
-
label: {
|
|
1551
|
-
defaultMessage: "Local Registrar",
|
|
1552
|
-
description: "Name for user role Local Registrar",
|
|
1553
|
-
id: "userRole.localRegistrar"
|
|
1554
|
-
},
|
|
1555
|
-
scopes: [
|
|
1556
|
-
encodeScope({
|
|
1557
|
-
type: "record.create",
|
|
1558
|
-
options: {
|
|
1559
|
-
event: ["birth", "death", "tennis-club-membership"]
|
|
1560
|
-
}
|
|
1561
|
-
}),
|
|
1562
|
-
encodeScope({
|
|
1563
|
-
type: "record.declare",
|
|
1564
|
-
options: {
|
|
1565
|
-
event: ["birth", "death", "tennis-club-membership"]
|
|
1566
|
-
}
|
|
1567
|
-
}),
|
|
1568
|
-
encodeScope({
|
|
1569
|
-
type: "record.review-duplicates",
|
|
1570
|
-
options: {
|
|
1571
|
-
event: ["birth", "death", "tennis-club-membership"]
|
|
1572
|
-
}
|
|
1573
|
-
}),
|
|
1574
|
-
SCOPES.PERFORMANCE_READ,
|
|
1575
|
-
SCOPES.PERFORMANCE_READ_DASHBOARDS,
|
|
1576
|
-
SCOPES.ORGANISATION_READ_LOCATIONS,
|
|
1577
|
-
SCOPES.PROFILE_ELECTRONIC_SIGNATURE,
|
|
1578
|
-
SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE
|
|
1579
|
-
]
|
|
1580
|
-
},
|
|
1581
|
-
{
|
|
1582
|
-
id: "LOCAL_SYSTEM_ADMIN",
|
|
1583
|
-
label: {
|
|
1584
|
-
defaultMessage: "Local System Admin",
|
|
1585
|
-
description: "Name for user role Local System Admin",
|
|
1586
|
-
id: "userRole.localSystemAdmin"
|
|
1587
|
-
},
|
|
1588
|
-
scopes: [
|
|
1589
|
-
SCOPES.USER_READ_MY_OFFICE,
|
|
1590
|
-
SCOPES.USER_CREATE_MY_JURISDICTION,
|
|
1591
|
-
SCOPES.USER_UPDATE_MY_JURISDICTION,
|
|
1592
|
-
SCOPES.ORGANISATION_READ_LOCATIONS,
|
|
1593
|
-
SCOPES.PERFORMANCE_READ,
|
|
1594
|
-
SCOPES.PERFORMANCE_READ_DASHBOARDS,
|
|
1595
|
-
SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS
|
|
1596
|
-
]
|
|
1597
|
-
},
|
|
1598
|
-
{
|
|
1599
|
-
id: "NATIONAL_SYSTEM_ADMIN",
|
|
1600
|
-
label: {
|
|
1601
|
-
defaultMessage: "National System Admin",
|
|
1602
|
-
description: "Name for user role National System Admin",
|
|
1603
|
-
id: "userRole.nationalSystemAdmin"
|
|
1604
|
-
},
|
|
1605
|
-
scopes: [
|
|
1606
|
-
SCOPES.USER_CREATE,
|
|
1607
|
-
SCOPES.USER_READ,
|
|
1608
|
-
SCOPES.USER_UPDATE,
|
|
1609
|
-
SCOPES.ORGANISATION_READ_LOCATIONS,
|
|
1610
|
-
SCOPES.PERFORMANCE_READ,
|
|
1611
|
-
SCOPES.PERFORMANCE_READ_DASHBOARDS,
|
|
1612
|
-
SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS
|
|
1613
|
-
]
|
|
1614
|
-
},
|
|
1615
|
-
{
|
|
1616
|
-
id: "PERFORMANCE_MANAGER",
|
|
1617
|
-
label: {
|
|
1618
|
-
defaultMessage: "Performance Manager",
|
|
1619
|
-
description: "Name for user role Performance Manager",
|
|
1620
|
-
id: "userRole.performanceManager"
|
|
1427
|
+
// ../commons/src/events/serializers/user/serializer.ts
|
|
1428
|
+
var z13 = __toESM(require("zod/v4"));
|
|
1429
|
+
var SerializedUserField = z13.object({
|
|
1430
|
+
$userField: z13.enum([
|
|
1431
|
+
"id",
|
|
1432
|
+
"name",
|
|
1433
|
+
"role",
|
|
1434
|
+
"fullHonorificName",
|
|
1435
|
+
"device",
|
|
1436
|
+
"firstname",
|
|
1437
|
+
"middlename",
|
|
1438
|
+
"surname",
|
|
1439
|
+
"signature",
|
|
1440
|
+
"avatar",
|
|
1441
|
+
"primaryOfficeId",
|
|
1442
|
+
"administrativeAreaId"
|
|
1443
|
+
]),
|
|
1444
|
+
$location: z13.string().optional()
|
|
1445
|
+
});
|
|
1446
|
+
function userSerializer(userField) {
|
|
1447
|
+
return {
|
|
1448
|
+
$userField: userField,
|
|
1449
|
+
locationLevel(adminLevelId) {
|
|
1450
|
+
return {
|
|
1451
|
+
$userField: this.$userField,
|
|
1452
|
+
$location: adminLevelId
|
|
1453
|
+
};
|
|
1621
1454
|
},
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
}
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1455
|
+
toJSON() {
|
|
1456
|
+
return {
|
|
1457
|
+
$userField: userField
|
|
1458
|
+
};
|
|
1459
|
+
}
|
|
1460
|
+
};
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
// ../commons/src/events/EventIndex.ts
|
|
1464
|
+
var import_v4 = require("zod/v4");
|
|
1465
|
+
|
|
1466
|
+
// ../commons/src/events/EventMetadata.ts
|
|
1467
|
+
var z16 = __toESM(require("zod/v4"));
|
|
1631
1468
|
|
|
1632
1469
|
// ../commons/src/events/ActionDocument.ts
|
|
1633
|
-
var
|
|
1470
|
+
var z14 = __toESM(require("zod/v4"));
|
|
1471
|
+
var ActionUpdate = z14.record(z14.string(), FieldUpdateValue).describe(
|
|
1634
1472
|
"Record of field-level changes made by an action. Supports partial updates and nullable values."
|
|
1635
1473
|
);
|
|
1636
|
-
var EventState =
|
|
1474
|
+
var EventState = z14.record(z14.string(), FieldValue).describe(
|
|
1637
1475
|
"Aggregate representation of event data after all actions have been applied, with all updates consolidated and null values removed."
|
|
1638
1476
|
);
|
|
1639
1477
|
var ActionStatus = {
|
|
@@ -1641,15 +1479,15 @@ var ActionStatus = {
|
|
|
1641
1479
|
Accepted: "Accepted",
|
|
1642
1480
|
Rejected: "Rejected"
|
|
1643
1481
|
};
|
|
1644
|
-
var ActionBase =
|
|
1482
|
+
var ActionBase = z14.object({
|
|
1645
1483
|
id: UUID.describe("Unique identifier of the action."),
|
|
1646
|
-
transactionId:
|
|
1484
|
+
transactionId: z14.string().describe("Unique identifier of the transaction."),
|
|
1647
1485
|
createdByUserType: TokenUserType.describe(
|
|
1648
1486
|
"Indicates whether the action was created by a human-user or by a system-user."
|
|
1649
1487
|
),
|
|
1650
|
-
createdAt:
|
|
1651
|
-
createdBy:
|
|
1652
|
-
createdByRole:
|
|
1488
|
+
createdAt: z14.string().datetime().describe("Timestamp indicating when the action was created."),
|
|
1489
|
+
createdBy: z14.string().describe("Identifier of the user who created the action."),
|
|
1490
|
+
createdByRole: z14.string().optional().describe("Role of the user who created the action."),
|
|
1653
1491
|
createdBySignature: DocumentPath.nullish().describe(
|
|
1654
1492
|
"Reference to the signature of the user who created the action."
|
|
1655
1493
|
),
|
|
@@ -1661,7 +1499,7 @@ var ActionBase = z15.object({
|
|
|
1661
1499
|
"Declaration data defined by the ActionConfig. Supports partial updates."
|
|
1662
1500
|
),
|
|
1663
1501
|
annotation: ActionUpdate.optional().nullable().describe("Action-specific metadata used to annotate the event."),
|
|
1664
|
-
status:
|
|
1502
|
+
status: z14.enum([
|
|
1665
1503
|
ActionStatus.Requested,
|
|
1666
1504
|
ActionStatus.Accepted,
|
|
1667
1505
|
ActionStatus.Rejected
|
|
@@ -1673,132 +1511,132 @@ var ActionBase = z15.object({
|
|
|
1673
1511
|
)
|
|
1674
1512
|
});
|
|
1675
1513
|
var AssignedAction = ActionBase.extend(
|
|
1676
|
-
|
|
1677
|
-
type:
|
|
1678
|
-
assignedTo:
|
|
1514
|
+
z14.object({
|
|
1515
|
+
type: z14.literal(ActionType.ASSIGN),
|
|
1516
|
+
assignedTo: z14.string().describe("Identifier of the user to whom the action is assigned.")
|
|
1679
1517
|
// TODO move into 'content' property
|
|
1680
1518
|
}).shape
|
|
1681
1519
|
);
|
|
1682
1520
|
var UnassignedAction = ActionBase.extend(
|
|
1683
|
-
|
|
1684
|
-
type:
|
|
1521
|
+
z14.object({
|
|
1522
|
+
type: z14.literal(ActionType.UNASSIGN)
|
|
1685
1523
|
}).shape
|
|
1686
1524
|
);
|
|
1687
1525
|
var RegisterAction = ActionBase.extend(
|
|
1688
|
-
|
|
1689
|
-
type:
|
|
1690
|
-
registrationNumber:
|
|
1526
|
+
z14.object({
|
|
1527
|
+
type: z14.literal(ActionType.REGISTER),
|
|
1528
|
+
registrationNumber: z14.string().optional().describe(
|
|
1691
1529
|
"Registration number of the event. Always present for accepted registrations."
|
|
1692
1530
|
)
|
|
1693
1531
|
// TODO move into 'content' property
|
|
1694
1532
|
}).shape
|
|
1695
1533
|
);
|
|
1696
1534
|
var DeclareAction = ActionBase.extend(
|
|
1697
|
-
|
|
1698
|
-
type:
|
|
1535
|
+
z14.object({
|
|
1536
|
+
type: z14.literal(ActionType.DECLARE)
|
|
1699
1537
|
}).shape
|
|
1700
1538
|
);
|
|
1701
|
-
var ReasonContent =
|
|
1702
|
-
reason:
|
|
1539
|
+
var ReasonContent = z14.object({
|
|
1540
|
+
reason: z14.string().min(1, { error: "Message cannot be empty" }).describe(
|
|
1703
1541
|
"Message describing the reason for rejecting or archiving the event."
|
|
1704
1542
|
)
|
|
1705
1543
|
});
|
|
1706
1544
|
var RejectAction = ActionBase.extend(
|
|
1707
|
-
|
|
1708
|
-
type:
|
|
1545
|
+
z14.object({
|
|
1546
|
+
type: z14.literal(ActionType.REJECT),
|
|
1709
1547
|
content: ReasonContent
|
|
1710
1548
|
}).shape
|
|
1711
1549
|
);
|
|
1712
|
-
var PotentialDuplicate =
|
|
1550
|
+
var PotentialDuplicate = z14.object({
|
|
1713
1551
|
id: UUID,
|
|
1714
|
-
trackingId:
|
|
1552
|
+
trackingId: z14.string()
|
|
1715
1553
|
});
|
|
1716
1554
|
var DuplicateDetectedAction = ActionBase.extend(
|
|
1717
|
-
|
|
1718
|
-
type:
|
|
1719
|
-
content:
|
|
1720
|
-
duplicates:
|
|
1555
|
+
z14.object({
|
|
1556
|
+
type: z14.literal(ActionType.DUPLICATE_DETECTED),
|
|
1557
|
+
content: z14.object({
|
|
1558
|
+
duplicates: z14.array(PotentialDuplicate)
|
|
1721
1559
|
})
|
|
1722
1560
|
}).shape
|
|
1723
1561
|
);
|
|
1724
1562
|
var MarkNotDuplicateAction = ActionBase.extend(
|
|
1725
|
-
|
|
1726
|
-
type:
|
|
1563
|
+
z14.object({
|
|
1564
|
+
type: z14.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
1727
1565
|
}).shape
|
|
1728
1566
|
);
|
|
1729
1567
|
var MarkAsDuplicateAction = ActionBase.extend(
|
|
1730
|
-
|
|
1731
|
-
type:
|
|
1732
|
-
content:
|
|
1568
|
+
z14.object({
|
|
1569
|
+
type: z14.literal(ActionType.MARK_AS_DUPLICATE),
|
|
1570
|
+
content: z14.object({
|
|
1733
1571
|
duplicateOf: UUID
|
|
1734
1572
|
}).optional()
|
|
1735
1573
|
}).shape
|
|
1736
1574
|
);
|
|
1737
1575
|
var ArchiveAction = ActionBase.extend(
|
|
1738
|
-
|
|
1739
|
-
type:
|
|
1576
|
+
z14.object({
|
|
1577
|
+
type: z14.literal(ActionType.ARCHIVE),
|
|
1740
1578
|
content: ReasonContent
|
|
1741
1579
|
}).shape
|
|
1742
1580
|
);
|
|
1743
1581
|
var CreatedAction = ActionBase.extend(
|
|
1744
|
-
|
|
1745
|
-
type:
|
|
1582
|
+
z14.object({
|
|
1583
|
+
type: z14.literal(ActionType.CREATE)
|
|
1746
1584
|
}).shape
|
|
1747
1585
|
);
|
|
1748
1586
|
var NotifiedAction = ActionBase.extend(
|
|
1749
|
-
|
|
1750
|
-
type:
|
|
1587
|
+
z14.object({
|
|
1588
|
+
type: z14.literal(ActionType.NOTIFY)
|
|
1751
1589
|
}).shape
|
|
1752
1590
|
);
|
|
1753
1591
|
var EditAction = ActionBase.extend(
|
|
1754
|
-
|
|
1755
|
-
type:
|
|
1756
|
-
content:
|
|
1757
|
-
comment:
|
|
1592
|
+
z14.object({
|
|
1593
|
+
type: z14.literal(ActionType.EDIT),
|
|
1594
|
+
content: z14.object({
|
|
1595
|
+
comment: z14.string().describe("Comment for the edit action.").optional()
|
|
1758
1596
|
})
|
|
1759
1597
|
}).shape
|
|
1760
1598
|
);
|
|
1761
|
-
var PrintContent =
|
|
1762
|
-
templateId:
|
|
1599
|
+
var PrintContent = z14.object({
|
|
1600
|
+
templateId: z14.string().optional()
|
|
1763
1601
|
});
|
|
1764
1602
|
var PrintCertificateAction = ActionBase.extend(
|
|
1765
|
-
|
|
1766
|
-
type:
|
|
1603
|
+
z14.object({
|
|
1604
|
+
type: z14.literal(ActionType.PRINT_CERTIFICATE),
|
|
1767
1605
|
content: PrintContent.optional().nullable()
|
|
1768
1606
|
}).shape
|
|
1769
1607
|
);
|
|
1770
1608
|
var RequestedCorrectionAction = ActionBase.extend(
|
|
1771
|
-
|
|
1772
|
-
type:
|
|
1609
|
+
z14.object({
|
|
1610
|
+
type: z14.literal(ActionType.REQUEST_CORRECTION)
|
|
1773
1611
|
}).shape
|
|
1774
1612
|
);
|
|
1775
1613
|
var ApprovedCorrectionAction = ActionBase.extend(
|
|
1776
|
-
|
|
1777
|
-
type:
|
|
1778
|
-
requestId:
|
|
1614
|
+
z14.object({
|
|
1615
|
+
type: z14.literal(ActionType.APPROVE_CORRECTION),
|
|
1616
|
+
requestId: z14.string()
|
|
1779
1617
|
// TODO move into 'content' property
|
|
1780
1618
|
}).shape
|
|
1781
1619
|
);
|
|
1782
1620
|
var RejectedCorrectionAction = ActionBase.extend(
|
|
1783
|
-
|
|
1784
|
-
type:
|
|
1785
|
-
requestId:
|
|
1621
|
+
z14.object({
|
|
1622
|
+
type: z14.literal(ActionType.REJECT_CORRECTION),
|
|
1623
|
+
requestId: z14.string(),
|
|
1786
1624
|
// TODO move into 'content' property
|
|
1787
1625
|
content: ReasonContent
|
|
1788
1626
|
}).shape
|
|
1789
1627
|
);
|
|
1790
1628
|
var ReadAction = ActionBase.extend(
|
|
1791
|
-
|
|
1792
|
-
type:
|
|
1629
|
+
z14.object({
|
|
1630
|
+
type: z14.literal(ActionType.READ)
|
|
1793
1631
|
}).shape
|
|
1794
1632
|
);
|
|
1795
1633
|
var CustomAction = ActionBase.merge(
|
|
1796
|
-
|
|
1797
|
-
type:
|
|
1798
|
-
customActionType:
|
|
1634
|
+
z14.object({
|
|
1635
|
+
type: z14.literal(ActionType.CUSTOM),
|
|
1636
|
+
customActionType: z14.string()
|
|
1799
1637
|
})
|
|
1800
1638
|
);
|
|
1801
|
-
var ActionDocument =
|
|
1639
|
+
var ActionDocument = z14.discriminatedUnion("type", [
|
|
1802
1640
|
CreatedAction.meta({ id: "CreatedAction" }),
|
|
1803
1641
|
RejectAction.meta({ id: "RejectAction" }),
|
|
1804
1642
|
DuplicateDetectedAction.meta({ id: "DuplicateDetectedAction" }),
|
|
@@ -1824,15 +1662,15 @@ var AsyncRejectActionDocument = ActionBase.omit({
|
|
|
1824
1662
|
declaration: true,
|
|
1825
1663
|
annotation: true
|
|
1826
1664
|
}).extend(
|
|
1827
|
-
|
|
1828
|
-
type:
|
|
1829
|
-
status:
|
|
1665
|
+
z14.object({
|
|
1666
|
+
type: z14.enum(ConfirmableActions),
|
|
1667
|
+
status: z14.literal(ActionStatus.Rejected)
|
|
1830
1668
|
}).shape
|
|
1831
1669
|
);
|
|
1832
|
-
var Action =
|
|
1670
|
+
var Action = z14.union([ActionDocument, AsyncRejectActionDocument]);
|
|
1833
1671
|
|
|
1834
1672
|
// ../commons/src/events/Flag.ts
|
|
1835
|
-
var
|
|
1673
|
+
var z15 = __toESM(require("zod/v4"));
|
|
1836
1674
|
var InherentFlags = {
|
|
1837
1675
|
INCOMPLETE: "incomplete",
|
|
1838
1676
|
REJECTED: "rejected",
|
|
@@ -1846,7 +1684,7 @@ var InherentFlags = {
|
|
|
1846
1684
|
*/
|
|
1847
1685
|
EDIT_IN_PROGRESS: "edit-in-progress"
|
|
1848
1686
|
};
|
|
1849
|
-
var ActionFlag =
|
|
1687
|
+
var ActionFlag = z15.string().regex(
|
|
1850
1688
|
new RegExp(
|
|
1851
1689
|
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
1852
1690
|
ActionStatus
|
|
@@ -1854,73 +1692,73 @@ var ActionFlag = z16.string().regex(
|
|
|
1854
1692
|
),
|
|
1855
1693
|
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
1856
1694
|
);
|
|
1857
|
-
var CustomFlag =
|
|
1695
|
+
var CustomFlag = z15.string().refine((val) => !Object.values(InherentFlags).includes(val), {
|
|
1858
1696
|
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
1859
1697
|
InherentFlags
|
|
1860
1698
|
).join(", ")}`
|
|
1861
1699
|
}).refine((val) => !ActionFlag.safeParse(val).success, {
|
|
1862
1700
|
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
1863
1701
|
}).describe("Custom flag identifier defined by the country config.");
|
|
1864
|
-
var Flag = ActionFlag.or(
|
|
1865
|
-
var FlagConfig =
|
|
1702
|
+
var Flag = ActionFlag.or(z15.enum(InherentFlags)).or(CustomFlag);
|
|
1703
|
+
var FlagConfig = z15.object({
|
|
1866
1704
|
id: CustomFlag,
|
|
1867
|
-
requiresAction:
|
|
1705
|
+
requiresAction: z15.boolean().describe(
|
|
1868
1706
|
"Indicates if this flag expects an action to be performed to be cleared."
|
|
1869
1707
|
),
|
|
1870
1708
|
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1871
1709
|
});
|
|
1872
|
-
var ActionFlagConfig =
|
|
1710
|
+
var ActionFlagConfig = z15.object({
|
|
1873
1711
|
id: Flag,
|
|
1874
|
-
operation:
|
|
1712
|
+
operation: z15.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
1875
1713
|
conditional: Conditional.optional().describe(
|
|
1876
1714
|
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1877
1715
|
)
|
|
1878
1716
|
});
|
|
1879
1717
|
|
|
1880
1718
|
// ../commons/src/events/EventMetadata.ts
|
|
1881
|
-
var EventStatus =
|
|
1719
|
+
var EventStatus = z16.enum([
|
|
1882
1720
|
"CREATED",
|
|
1883
1721
|
"NOTIFIED",
|
|
1884
1722
|
"DECLARED",
|
|
1885
1723
|
"REGISTERED",
|
|
1886
1724
|
"ARCHIVED"
|
|
1887
1725
|
]);
|
|
1888
|
-
var ZodDate =
|
|
1889
|
-
var ZodDateTime =
|
|
1890
|
-
var ActionCreationMetadata =
|
|
1891
|
-
createdAt:
|
|
1892
|
-
createdBy:
|
|
1726
|
+
var ZodDate = z16.iso.date();
|
|
1727
|
+
var ZodDateTime = z16.string().datetime();
|
|
1728
|
+
var ActionCreationMetadata = z16.object({
|
|
1729
|
+
createdAt: z16.iso.datetime().describe("The timestamp when the action request was created."),
|
|
1730
|
+
createdBy: z16.string().describe("ID of the user who created the action request."),
|
|
1893
1731
|
// @TODO: createdAtLocation should be non-nullable in the future once all action requests have this field populated.
|
|
1894
1732
|
createdAtLocation: UUID.nullish().describe(
|
|
1895
1733
|
"Location of the user who created the action request."
|
|
1896
1734
|
),
|
|
1897
|
-
createdByUserType:
|
|
1898
|
-
acceptedAt:
|
|
1899
|
-
createdByRole:
|
|
1900
|
-
createdBySignature:
|
|
1735
|
+
createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1736
|
+
acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
|
|
1737
|
+
createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation."),
|
|
1738
|
+
createdBySignature: z16.string().nullish().describe("Signature of the user who created the action request.")
|
|
1901
1739
|
});
|
|
1902
1740
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
1903
|
-
registrationNumber:
|
|
1741
|
+
registrationNumber: z16.string().describe(
|
|
1904
1742
|
"Registration number of the event. Always present for accepted registrations."
|
|
1905
1743
|
)
|
|
1906
1744
|
});
|
|
1907
|
-
var LegalStatuses =
|
|
1745
|
+
var LegalStatuses = z16.object({
|
|
1908
1746
|
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
|
1909
1747
|
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
|
1910
1748
|
});
|
|
1911
|
-
var EventMetadata =
|
|
1749
|
+
var EventMetadata = z16.object({
|
|
1912
1750
|
id: UUID,
|
|
1913
|
-
type:
|
|
1751
|
+
type: z16.string().describe("The type of event, such as birth, death, or marriage."),
|
|
1914
1752
|
status: EventStatus,
|
|
1915
1753
|
legalStatuses: LegalStatuses.describe(
|
|
1916
1754
|
"Metadata related to the legal registration of the event, such as who registered it and when."
|
|
1917
1755
|
),
|
|
1918
|
-
createdAt:
|
|
1756
|
+
createdAt: z16.iso.datetime().describe("The timestamp when the event was first created and saved."),
|
|
1919
1757
|
dateOfEvent: ZodDate.nullish(),
|
|
1920
1758
|
placeOfEvent: UUID.nullish(),
|
|
1921
|
-
createdBy:
|
|
1922
|
-
createdByUserType:
|
|
1923
|
-
updatedByUserRole:
|
|
1759
|
+
createdBy: z16.string().describe("ID of the user who created the event."),
|
|
1760
|
+
createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1761
|
+
updatedByUserRole: z16.string().nullish().describe("Role of the user who last changed the status."),
|
|
1924
1762
|
// @TODO: createdAtLocation should be non-nullable in the future once all action requests have this field populated.
|
|
1925
1763
|
createdAtLocation: UUID.nullish().describe(
|
|
1926
1764
|
"Location of the user who created the event."
|
|
@@ -1931,18 +1769,18 @@ var EventMetadata = z17.object({
|
|
|
1931
1769
|
updatedAtLocation: UUID.nullish().describe(
|
|
1932
1770
|
"Location of the user who last changed the status."
|
|
1933
1771
|
),
|
|
1934
|
-
updatedAt:
|
|
1772
|
+
updatedAt: z16.iso.datetime().describe(
|
|
1935
1773
|
"Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
|
|
1936
1774
|
),
|
|
1937
|
-
assignedTo:
|
|
1938
|
-
updatedBy:
|
|
1939
|
-
trackingId:
|
|
1775
|
+
assignedTo: z16.string().nullish().describe("ID of the user currently assigned to the event."),
|
|
1776
|
+
updatedBy: z16.string().nullish().describe("ID of the user who last changed the status."),
|
|
1777
|
+
trackingId: z16.string().describe(
|
|
1940
1778
|
"System-generated tracking ID used by informants or registrars to look up the event."
|
|
1941
1779
|
),
|
|
1942
|
-
potentialDuplicates:
|
|
1780
|
+
potentialDuplicates: z16.array(PotentialDuplicate).describe(
|
|
1943
1781
|
"List of event IDs and their tracking IDs that this event could be a duplicate of."
|
|
1944
1782
|
),
|
|
1945
|
-
flags:
|
|
1783
|
+
flags: z16.array(Flag)
|
|
1946
1784
|
});
|
|
1947
1785
|
var EventMetadataKeysArray = [
|
|
1948
1786
|
"id",
|
|
@@ -1963,7 +1801,7 @@ var EventMetadataKeysArray = [
|
|
|
1963
1801
|
"legalStatuses",
|
|
1964
1802
|
"flags"
|
|
1965
1803
|
];
|
|
1966
|
-
var EventMetadataKeys =
|
|
1804
|
+
var EventMetadataKeys = z16.enum(EventMetadataKeysArray);
|
|
1967
1805
|
var eventMetadataLabelMap = {
|
|
1968
1806
|
"event.assignedTo": {
|
|
1969
1807
|
id: "event.assignedTo.label",
|
|
@@ -2046,7 +1884,7 @@ var eventMetadataLabelMap = {
|
|
|
2046
1884
|
description: "Flags"
|
|
2047
1885
|
}
|
|
2048
1886
|
};
|
|
2049
|
-
var EventMetadataDateFieldIdInput =
|
|
1887
|
+
var EventMetadataDateFieldIdInput = z16.enum([
|
|
2050
1888
|
"createdAt",
|
|
2051
1889
|
"updatedAt",
|
|
2052
1890
|
"legalStatuses.DECLARED.createdAt",
|
|
@@ -2054,7 +1892,7 @@ var EventMetadataDateFieldIdInput = z17.enum([
|
|
|
2054
1892
|
"legalStatuses.REGISTERED.createdAt",
|
|
2055
1893
|
"legalStatuses.REGISTERED.acceptedAt"
|
|
2056
1894
|
]);
|
|
2057
|
-
var EventMetadataDateFieldId =
|
|
1895
|
+
var EventMetadataDateFieldId = z16.enum([
|
|
2058
1896
|
"event.createdAt",
|
|
2059
1897
|
"event.updatedAt",
|
|
2060
1898
|
"event.legalStatuses.DECLARED.createdAt",
|
|
@@ -2162,8 +2000,8 @@ var QueryExpression = import_v4.z.object({
|
|
|
2162
2000
|
"legalStatuses.REGISTERED.createdAtLocation": import_v4.z.optional(Within).nullable(),
|
|
2163
2001
|
"legalStatuses.REGISTERED.createdByRole": import_v4.z.optional(AnyOf),
|
|
2164
2002
|
"legalStatuses.REGISTERED.registrationNumber": import_v4.z.optional(Exact),
|
|
2165
|
-
createdAtLocation: import_v4.z.optional(Within),
|
|
2166
|
-
updatedAtLocation: import_v4.z.optional(Within),
|
|
2003
|
+
createdAtLocation: import_v4.z.optional(import_v4.z.union([Within, Exact])),
|
|
2004
|
+
updatedAtLocation: import_v4.z.optional(import_v4.z.union([Within, Exact])),
|
|
2167
2005
|
assignedTo: import_v4.z.optional(Exact),
|
|
2168
2006
|
createdByUserType: import_v4.z.optional(ExactUserType),
|
|
2169
2007
|
updatedByUserRole: import_v4.z.optional(Exact),
|
|
@@ -2256,7 +2094,7 @@ function todayDateTimeValueSerializer() {
|
|
|
2256
2094
|
// ../commons/src/users/userReferences.ts
|
|
2257
2095
|
var import_v42 = __toESM(require("zod/v4"));
|
|
2258
2096
|
var ScopeOptionReference = import_v42.default.object({
|
|
2259
|
-
$scope:
|
|
2097
|
+
$scope: ScopeType,
|
|
2260
2098
|
$option: ScopeOptionKey
|
|
2261
2099
|
});
|
|
2262
2100
|
var JurisdictionReference = import_v42.default.object({
|
|
@@ -2500,17 +2338,14 @@ var ImageViewField = BaseField.extend({
|
|
|
2500
2338
|
}).describe("A read-only image component for form pages");
|
|
2501
2339
|
var Paragraph = BaseField.extend({
|
|
2502
2340
|
type: import_v43.default.literal(FieldType.PARAGRAPH),
|
|
2503
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
2504
2341
|
configuration: ParagraphConfiguration
|
|
2505
2342
|
}).describe("A read-only HTML <p> paragraph");
|
|
2506
2343
|
var Heading = BaseField.extend({
|
|
2507
2344
|
type: import_v43.default.literal(FieldType.HEADING),
|
|
2508
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
2509
2345
|
configuration: HeadingConfiguration
|
|
2510
2346
|
}).describe("A read-only heading component for form pages");
|
|
2511
2347
|
var PageHeader = BaseField.extend({
|
|
2512
|
-
type: import_v43.default.literal(FieldType.PAGE_HEADER)
|
|
2513
|
-
defaultValue: NonEmptyTextValue.optional()
|
|
2348
|
+
type: import_v43.default.literal(FieldType.PAGE_HEADER)
|
|
2514
2349
|
}).describe("A read-only header component for form pages");
|
|
2515
2350
|
var File = BaseField.extend({
|
|
2516
2351
|
type: import_v43.default.literal(FieldType.FILE),
|
|
@@ -2560,7 +2395,6 @@ var RadioGroup = BaseField.extend({
|
|
|
2560
2395
|
}).describe("Grouped radio options");
|
|
2561
2396
|
var BulletList = BaseField.extend({
|
|
2562
2397
|
type: import_v43.default.literal(FieldType.BULLET_LIST),
|
|
2563
|
-
defaultValue: TextValue.optional(),
|
|
2564
2398
|
items: import_v43.default.array(TranslationConfig).describe("A list of items"),
|
|
2565
2399
|
configuration: import_v43.default.object({
|
|
2566
2400
|
styles: import_v43.default.object({
|
|
@@ -2666,7 +2500,7 @@ var LocationInput = BaseField.extend({
|
|
|
2666
2500
|
configuration: import_v43.default.object({
|
|
2667
2501
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
2668
2502
|
allowedLocations: AllowedLocations
|
|
2669
|
-
})
|
|
2503
|
+
}).optional()
|
|
2670
2504
|
}).describe("Input field for a location");
|
|
2671
2505
|
var FileUploadWithOptions = BaseField.extend({
|
|
2672
2506
|
type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
|
|
@@ -2742,16 +2576,32 @@ var DataField = BaseField.extend({
|
|
|
2742
2576
|
data: import_v43.default.array(DataEntry)
|
|
2743
2577
|
})
|
|
2744
2578
|
}).describe("Data field for displaying read-only data");
|
|
2579
|
+
var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
|
|
2580
|
+
var ButtonType = import_v43.default.enum([
|
|
2581
|
+
"primary",
|
|
2582
|
+
"secondary",
|
|
2583
|
+
"tertiary",
|
|
2584
|
+
"positive",
|
|
2585
|
+
"negative",
|
|
2586
|
+
"secondaryNegative",
|
|
2587
|
+
"icon",
|
|
2588
|
+
"iconPrimary"
|
|
2589
|
+
]);
|
|
2590
|
+
var TextColor = import_v43.default.enum(["primary", "copy"]);
|
|
2591
|
+
var TextVariant = import_v43.default.enum(["bold14", "reg14"]);
|
|
2592
|
+
var ButtonConfiguration = import_v43.default.object({
|
|
2593
|
+
icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit."),
|
|
2594
|
+
loading: import_v43.default.boolean().optional().describe("Whether the button is in a loading state and shows a spinner"),
|
|
2595
|
+
buttonSize: ButtonSize.optional().describe("Size of the button."),
|
|
2596
|
+
buttonType: ButtonType.optional().describe("Type of the button."),
|
|
2597
|
+
textColor: TextColor.optional().describe("Color of the text."),
|
|
2598
|
+
textVariant: TextVariant.optional().describe("Variant of the text."),
|
|
2599
|
+
text: TranslationConfig.describe("Text to display on the button")
|
|
2600
|
+
});
|
|
2745
2601
|
var ButtonField = BaseField.extend({
|
|
2746
2602
|
type: import_v43.default.literal(FieldType.BUTTON),
|
|
2747
2603
|
defaultValue: ButtonFieldValue.optional(),
|
|
2748
|
-
configuration:
|
|
2749
|
-
icon: import_v43.default.string().optional().describe(
|
|
2750
|
-
"Icon for the button. You can find icons from OpenCRVS UI-Kit."
|
|
2751
|
-
),
|
|
2752
|
-
loading: import_v43.default.boolean().optional().describe("Whether the button is in a loading state and shows a spinner"),
|
|
2753
|
-
text: TranslationConfig.describe("Text to display on the button")
|
|
2754
|
-
})
|
|
2604
|
+
configuration: ButtonConfiguration
|
|
2755
2605
|
}).describe("Generic button without any built-in functionality");
|
|
2756
2606
|
var FieldGroup = BaseField.extend({
|
|
2757
2607
|
type: import_v43.default.literal(FieldType.FIELD_GROUP),
|
|
@@ -2783,6 +2633,19 @@ var HttpField = BaseField.extend({
|
|
|
2783
2633
|
timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
|
|
2784
2634
|
})
|
|
2785
2635
|
}).describe("HTTP request function triggered by a button click or other event");
|
|
2636
|
+
var AutocompleteField = BaseField.extend({
|
|
2637
|
+
type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
|
|
2638
|
+
configuration: import_v43.default.object({
|
|
2639
|
+
url: import_v43.default.string().describe("URL to fetch autocomplete suggestions from").optional(),
|
|
2640
|
+
method: import_v43.default.enum(["GET", "POST"]).default("GET").optional(),
|
|
2641
|
+
defaultOptions: import_v43.default.array(
|
|
2642
|
+
import_v43.default.object({
|
|
2643
|
+
label: import_v43.default.string(),
|
|
2644
|
+
value: import_v43.default.string()
|
|
2645
|
+
})
|
|
2646
|
+
).optional()
|
|
2647
|
+
})
|
|
2648
|
+
}).describe("Autocomplete input field");
|
|
2786
2649
|
var SearchField = HttpField.extend({
|
|
2787
2650
|
type: import_v43.default.literal(FieldType.SEARCH),
|
|
2788
2651
|
configuration: SearchQuery.pick({
|
|
@@ -2868,8 +2731,11 @@ var CustomField = BaseField.extend({
|
|
|
2868
2731
|
src: import_v43.default.string().describe("Module source path for the custom field component"),
|
|
2869
2732
|
configuration: import_v43.default.unknown().optional()
|
|
2870
2733
|
});
|
|
2734
|
+
var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
|
|
2871
2735
|
var LoaderField = BaseField.extend({
|
|
2872
2736
|
type: import_v43.default.literal(FieldType.LOADER),
|
|
2737
|
+
variant: FieldStyleVariant.default("default").optional(),
|
|
2738
|
+
hideLabel: import_v43.default.boolean().default(true).optional().describe("Loader field does not show a label by default"),
|
|
2873
2739
|
configuration: import_v43.default.object({
|
|
2874
2740
|
text: TranslationConfig.describe("Display text above the loading spinner")
|
|
2875
2741
|
})
|
|
@@ -2926,6 +2792,7 @@ var FieldConfig = import_v43.default.discriminatedUnion("type", [
|
|
|
2926
2792
|
ButtonField,
|
|
2927
2793
|
AlphaPrintButton,
|
|
2928
2794
|
HttpField,
|
|
2795
|
+
AutocompleteField,
|
|
2929
2796
|
LinkButtonField,
|
|
2930
2797
|
VerificationStatus,
|
|
2931
2798
|
QrReaderField,
|
|
@@ -2947,18 +2814,18 @@ var AnyFileField = import_v43.default.discriminatedUnion("type", [
|
|
|
2947
2814
|
]);
|
|
2948
2815
|
|
|
2949
2816
|
// ../commons/src/events/FormConfig.ts
|
|
2950
|
-
var
|
|
2817
|
+
var z22 = __toESM(require("zod/v4"));
|
|
2951
2818
|
|
|
2952
2819
|
// ../commons/src/events/PageConfig.ts
|
|
2953
|
-
var
|
|
2954
|
-
var PageTypes =
|
|
2955
|
-
var PageConfigBase =
|
|
2956
|
-
id:
|
|
2820
|
+
var z21 = __toESM(require("zod/v4"));
|
|
2821
|
+
var PageTypes = z21.enum(["FORM", "VERIFICATION"]);
|
|
2822
|
+
var PageConfigBase = z21.object({
|
|
2823
|
+
id: z21.string().describe("Unique identifier for the page"),
|
|
2957
2824
|
title: TranslationConfig.describe("Header title of the page"),
|
|
2958
|
-
requireCompletionToContinue:
|
|
2825
|
+
requireCompletionToContinue: z21.boolean().default(false).describe(
|
|
2959
2826
|
"If true, all required fields must be filled before continuing to the next page"
|
|
2960
2827
|
),
|
|
2961
|
-
fields:
|
|
2828
|
+
fields: z21.array(FieldConfig).describe("Fields to be rendered on the page"),
|
|
2962
2829
|
conditional: Conditional.optional().describe(
|
|
2963
2830
|
"Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
|
|
2964
2831
|
)
|
|
@@ -2967,13 +2834,13 @@ var PageConfigBase = z22.object({
|
|
|
2967
2834
|
id: "FormPageConfig"
|
|
2968
2835
|
});
|
|
2969
2836
|
var FormPageConfig = PageConfigBase.extend({
|
|
2970
|
-
type:
|
|
2837
|
+
type: z21.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
|
|
2971
2838
|
});
|
|
2972
|
-
var VerificationActionConfig =
|
|
2973
|
-
verify:
|
|
2974
|
-
cancel:
|
|
2839
|
+
var VerificationActionConfig = z21.object({
|
|
2840
|
+
verify: z21.object({ label: TranslationConfig }),
|
|
2841
|
+
cancel: z21.object({
|
|
2975
2842
|
label: TranslationConfig,
|
|
2976
|
-
confirmation:
|
|
2843
|
+
confirmation: z21.object({
|
|
2977
2844
|
title: TranslationConfig,
|
|
2978
2845
|
body: TranslationConfig
|
|
2979
2846
|
})
|
|
@@ -2983,31 +2850,31 @@ var VerificationActionConfig = z22.object({
|
|
|
2983
2850
|
id: "VerificationActionConfig"
|
|
2984
2851
|
});
|
|
2985
2852
|
var VerificationPageConfig = FormPageConfig.extend({
|
|
2986
|
-
type:
|
|
2853
|
+
type: z21.literal(PageTypes.enum.VERIFICATION),
|
|
2987
2854
|
actions: VerificationActionConfig
|
|
2988
2855
|
});
|
|
2989
|
-
var PageConfig =
|
|
2856
|
+
var PageConfig = z21.discriminatedUnion("type", [
|
|
2990
2857
|
FormPageConfig,
|
|
2991
2858
|
VerificationPageConfig
|
|
2992
2859
|
]);
|
|
2993
2860
|
|
|
2994
2861
|
// ../commons/src/events/FormConfig.ts
|
|
2995
|
-
var DeclarationFormConfig =
|
|
2862
|
+
var DeclarationFormConfig = z22.object({
|
|
2996
2863
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
2997
|
-
pages:
|
|
2864
|
+
pages: z22.array(FormPageConfig)
|
|
2998
2865
|
}).describe("Configuration of the declaration form.");
|
|
2999
|
-
var ActionFormConfig =
|
|
2866
|
+
var ActionFormConfig = z22.object({
|
|
3000
2867
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
3001
|
-
pages:
|
|
2868
|
+
pages: z22.array(PageConfig)
|
|
3002
2869
|
}).describe(
|
|
3003
2870
|
"Configuration of the form used for system actions beyond declaration, supporting a wider range of page types."
|
|
3004
2871
|
);
|
|
3005
|
-
var FormConfig =
|
|
2872
|
+
var FormConfig = z22.union([DeclarationFormConfig, ActionFormConfig]);
|
|
3006
2873
|
|
|
3007
2874
|
// ../commons/src/events/DeduplicationConfig.ts
|
|
3008
|
-
var
|
|
3009
|
-
var FieldReference2 =
|
|
3010
|
-
var Matcher =
|
|
2875
|
+
var z23 = __toESM(require("zod/v4"));
|
|
2876
|
+
var FieldReference2 = z23.string();
|
|
2877
|
+
var Matcher = z23.object({
|
|
3011
2878
|
/**
|
|
3012
2879
|
* Reference to the field used in matching.
|
|
3013
2880
|
*
|
|
@@ -3015,23 +2882,23 @@ var Matcher = z24.object({
|
|
|
3015
2882
|
* be used as the origin date to calculate the distance from.
|
|
3016
2883
|
*/
|
|
3017
2884
|
fieldId: FieldReference2,
|
|
3018
|
-
options:
|
|
3019
|
-
boost:
|
|
2885
|
+
options: z23.object({
|
|
2886
|
+
boost: z23.number().optional(),
|
|
3020
2887
|
matchAgainst: FieldReference2.optional()
|
|
3021
2888
|
}).optional().default({
|
|
3022
2889
|
boost: 1
|
|
3023
2890
|
})
|
|
3024
2891
|
});
|
|
3025
2892
|
var FuzzyMatcher = Matcher.extend({
|
|
3026
|
-
type:
|
|
3027
|
-
options:
|
|
2893
|
+
type: z23.literal("fuzzy"),
|
|
2894
|
+
options: z23.object({
|
|
3028
2895
|
/**
|
|
3029
2896
|
* Names of length 3 or less characters = 0 edits allowed
|
|
3030
2897
|
* Names of length 4 - 6 characters = 1 edit allowed
|
|
3031
2898
|
* Names of length >7 characters = 2 edits allowed
|
|
3032
2899
|
*/
|
|
3033
|
-
fuzziness:
|
|
3034
|
-
boost:
|
|
2900
|
+
fuzziness: z23.union([z23.string(), z23.number()]).optional().default("AUTO:4,7"),
|
|
2901
|
+
boost: z23.number().optional().default(1),
|
|
3035
2902
|
matchAgainst: FieldReference2.optional()
|
|
3036
2903
|
}).optional().default({
|
|
3037
2904
|
fuzziness: "AUTO:4,7",
|
|
@@ -3039,48 +2906,48 @@ var FuzzyMatcher = Matcher.extend({
|
|
|
3039
2906
|
})
|
|
3040
2907
|
});
|
|
3041
2908
|
var StrictMatcher = Matcher.extend({
|
|
3042
|
-
type:
|
|
3043
|
-
options:
|
|
3044
|
-
boost:
|
|
2909
|
+
type: z23.literal("strict"),
|
|
2910
|
+
options: z23.object({
|
|
2911
|
+
boost: z23.number().optional().default(1),
|
|
3045
2912
|
/**
|
|
3046
2913
|
* The constant value to be present in the field for both records
|
|
3047
2914
|
*/
|
|
3048
|
-
value:
|
|
2915
|
+
value: z23.string().optional(),
|
|
3049
2916
|
matchAgainst: FieldReference2.optional()
|
|
3050
2917
|
}).optional().default({
|
|
3051
2918
|
boost: 1
|
|
3052
2919
|
})
|
|
3053
2920
|
});
|
|
3054
2921
|
var DateRangeMatcher = Matcher.extend({
|
|
3055
|
-
type:
|
|
3056
|
-
options:
|
|
2922
|
+
type: z23.literal("dateRange"),
|
|
2923
|
+
options: z23.object({
|
|
3057
2924
|
/**
|
|
3058
2925
|
* The distance pivot in days. Distance from the origin (the value of
|
|
3059
2926
|
* fieldId) at which relevance scores receive half of the boost value
|
|
3060
2927
|
*/
|
|
3061
|
-
pivot:
|
|
3062
|
-
days:
|
|
3063
|
-
boost:
|
|
2928
|
+
pivot: z23.number().optional(),
|
|
2929
|
+
days: z23.number(),
|
|
2930
|
+
boost: z23.number().optional().default(1),
|
|
3064
2931
|
matchAgainst: FieldReference2.optional()
|
|
3065
2932
|
})
|
|
3066
2933
|
});
|
|
3067
|
-
var Not =
|
|
3068
|
-
type:
|
|
2934
|
+
var Not = z23.object({
|
|
2935
|
+
type: z23.literal("not"),
|
|
3069
2936
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
3070
|
-
clause:
|
|
2937
|
+
clause: z23.lazy(() => Clause)
|
|
3071
2938
|
});
|
|
3072
|
-
var And =
|
|
3073
|
-
type:
|
|
2939
|
+
var And = z23.object({
|
|
2940
|
+
type: z23.literal("and"),
|
|
3074
2941
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
3075
|
-
clauses:
|
|
2942
|
+
clauses: z23.lazy(() => Clause.array())
|
|
3076
2943
|
});
|
|
3077
|
-
var Or =
|
|
3078
|
-
type:
|
|
2944
|
+
var Or = z23.object({
|
|
2945
|
+
type: z23.literal("or"),
|
|
3079
2946
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
3080
|
-
clauses:
|
|
2947
|
+
clauses: z23.lazy(() => Clause.array())
|
|
3081
2948
|
});
|
|
3082
|
-
var Clause =
|
|
3083
|
-
() =>
|
|
2949
|
+
var Clause = z23.lazy(
|
|
2950
|
+
() => z23.discriminatedUnion("type", [
|
|
3084
2951
|
Not,
|
|
3085
2952
|
And,
|
|
3086
2953
|
Or,
|
|
@@ -3091,22 +2958,22 @@ var Clause = z24.lazy(
|
|
|
3091
2958
|
).meta({
|
|
3092
2959
|
id: "Clause"
|
|
3093
2960
|
});
|
|
3094
|
-
var DeduplicationConfig =
|
|
3095
|
-
id:
|
|
2961
|
+
var DeduplicationConfig = z23.object({
|
|
2962
|
+
id: z23.string(),
|
|
3096
2963
|
label: TranslationConfig,
|
|
3097
2964
|
query: Clause
|
|
3098
2965
|
});
|
|
3099
2966
|
|
|
3100
2967
|
// ../commons/src/events/ActionConfig.ts
|
|
3101
|
-
var DeclarationReviewConfig =
|
|
2968
|
+
var DeclarationReviewConfig = z24.object({
|
|
3102
2969
|
title: TranslationConfig.describe("Title of the review page"),
|
|
3103
|
-
fields:
|
|
2970
|
+
fields: z24.array(FieldConfig).describe("Fields displayed on the review page for annotations.")
|
|
3104
2971
|
}).describe(
|
|
3105
2972
|
"Configuration of the declaration review page for collecting event-related metadata."
|
|
3106
2973
|
);
|
|
3107
|
-
var ActionConfigBase =
|
|
2974
|
+
var ActionConfigBase = z24.object({
|
|
3108
2975
|
label: TranslationConfig.describe("Human readable description of the action"),
|
|
3109
|
-
flags:
|
|
2976
|
+
flags: z24.array(ActionFlagConfig).optional().default([]).describe("Flag actions which are executed when the action is performed."),
|
|
3110
2977
|
supportingCopy: TranslationConfig.optional().describe(
|
|
3111
2978
|
"Text displayed on the confirmation dialog"
|
|
3112
2979
|
),
|
|
@@ -3117,28 +2984,28 @@ var ActionConfigBase = z25.object({
|
|
|
3117
2984
|
* "The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed."
|
|
3118
2985
|
* for EventConfig.d.ts.
|
|
3119
2986
|
*/
|
|
3120
|
-
icon:
|
|
3121
|
-
conditionals:
|
|
2987
|
+
icon: z24.string().describe("Icon representing the action").optional(),
|
|
2988
|
+
conditionals: z24.array(ActionConditional).optional().describe("Conditionals which can disable or hide actions.")
|
|
3122
2989
|
});
|
|
3123
2990
|
var DeclarationActionBase = ActionConfigBase.extend({
|
|
3124
2991
|
deduplication: DeduplicationConfig.optional()
|
|
3125
2992
|
});
|
|
3126
2993
|
var ReadActionConfig = ActionConfigBase.extend(
|
|
3127
|
-
|
|
3128
|
-
type:
|
|
2994
|
+
z24.object({
|
|
2995
|
+
type: z24.literal(ActionType.READ),
|
|
3129
2996
|
review: DeclarationReviewConfig.describe(
|
|
3130
2997
|
"Configuration of the review page for read-only view."
|
|
3131
2998
|
),
|
|
3132
|
-
conditionals:
|
|
2999
|
+
conditionals: z24.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
|
|
3133
3000
|
}).shape
|
|
3134
3001
|
);
|
|
3135
3002
|
var DeclareConfig = DeclarationActionBase.extend(
|
|
3136
|
-
|
|
3137
|
-
type:
|
|
3003
|
+
z24.object({
|
|
3004
|
+
type: z24.literal(ActionType.DECLARE),
|
|
3138
3005
|
review: DeclarationReviewConfig.describe(
|
|
3139
3006
|
"Configuration of the review page fields."
|
|
3140
3007
|
),
|
|
3141
|
-
dialogCopy:
|
|
3008
|
+
dialogCopy: z24.object({
|
|
3142
3009
|
notify: TranslationConfig.describe(
|
|
3143
3010
|
"Confirmation text for the notify action"
|
|
3144
3011
|
),
|
|
@@ -3152,14 +3019,14 @@ var DeclareConfig = DeclarationActionBase.extend(
|
|
|
3152
3019
|
}).shape
|
|
3153
3020
|
);
|
|
3154
3021
|
var ArchiveConfig = ActionConfigBase.extend(
|
|
3155
|
-
|
|
3156
|
-
type:
|
|
3022
|
+
z24.object({
|
|
3023
|
+
type: z24.literal(ActionType.ARCHIVE)
|
|
3157
3024
|
}).shape
|
|
3158
3025
|
);
|
|
3159
3026
|
var EditActionConfig = ActionConfigBase.extend(
|
|
3160
|
-
|
|
3161
|
-
type:
|
|
3162
|
-
dialogCopy:
|
|
3027
|
+
z24.object({
|
|
3028
|
+
type: z24.literal(ActionType.EDIT),
|
|
3029
|
+
dialogCopy: z24.object({
|
|
3163
3030
|
notify: TranslationConfig.describe(
|
|
3164
3031
|
"Confirmation text for the notify with edits action"
|
|
3165
3032
|
),
|
|
@@ -3173,33 +3040,33 @@ var EditActionConfig = ActionConfigBase.extend(
|
|
|
3173
3040
|
}).shape
|
|
3174
3041
|
);
|
|
3175
3042
|
var RejectConfig = ActionConfigBase.extend(
|
|
3176
|
-
|
|
3177
|
-
type:
|
|
3043
|
+
z24.object({
|
|
3044
|
+
type: z24.literal(ActionType.REJECT)
|
|
3178
3045
|
}).shape
|
|
3179
3046
|
);
|
|
3180
3047
|
var RegisterConfig = DeclarationActionBase.extend(
|
|
3181
|
-
|
|
3182
|
-
type:
|
|
3048
|
+
z24.object({
|
|
3049
|
+
type: z24.literal(ActionType.REGISTER)
|
|
3183
3050
|
}).shape
|
|
3184
3051
|
);
|
|
3185
3052
|
var PrintCertificateActionConfig = ActionConfigBase.extend(
|
|
3186
|
-
|
|
3187
|
-
type:
|
|
3053
|
+
z24.object({
|
|
3054
|
+
type: z24.literal(ActionType.PRINT_CERTIFICATE),
|
|
3188
3055
|
printForm: ActionFormConfig
|
|
3189
3056
|
}).shape
|
|
3190
3057
|
);
|
|
3191
3058
|
var RequestCorrectionConfig = ActionConfigBase.extend(
|
|
3192
|
-
|
|
3193
|
-
type:
|
|
3059
|
+
z24.object({
|
|
3060
|
+
type: z24.literal(ActionType.REQUEST_CORRECTION),
|
|
3194
3061
|
correctionForm: ActionFormConfig
|
|
3195
3062
|
}).shape
|
|
3196
3063
|
);
|
|
3197
3064
|
var CustomActionConfig = ActionConfigBase.merge(
|
|
3198
|
-
|
|
3199
|
-
type:
|
|
3200
|
-
customActionType:
|
|
3065
|
+
z24.object({
|
|
3066
|
+
type: z24.literal(ActionType.CUSTOM),
|
|
3067
|
+
customActionType: z24.string().describe("Type identifier of the custom action."),
|
|
3201
3068
|
/** 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. */
|
|
3202
|
-
form:
|
|
3069
|
+
form: z24.array(FieldConfig).describe(
|
|
3203
3070
|
"Form configuration for the custom action. The form configured here will be used on the custom action confirmation modal."
|
|
3204
3071
|
),
|
|
3205
3072
|
auditHistoryLabel: TranslationConfig.describe(
|
|
@@ -3207,7 +3074,7 @@ var CustomActionConfig = ActionConfigBase.merge(
|
|
|
3207
3074
|
)
|
|
3208
3075
|
})
|
|
3209
3076
|
);
|
|
3210
|
-
var ActionConfig =
|
|
3077
|
+
var ActionConfig = z24.discriminatedUnion("type", [
|
|
3211
3078
|
/*
|
|
3212
3079
|
* OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
|
|
3213
3080
|
* and treat them as "models" instead of duplicating the data structure in each endpoint.
|
|
@@ -3229,86 +3096,86 @@ var ActionConfig = z25.discriminatedUnion("type", [
|
|
|
3229
3096
|
var actionConfigTypes = new Set(
|
|
3230
3097
|
ActionConfig.options.map((opt) => opt.shape.type.value)
|
|
3231
3098
|
);
|
|
3232
|
-
var DeclarationActionConfig =
|
|
3099
|
+
var DeclarationActionConfig = z24.discriminatedUnion("type", [
|
|
3233
3100
|
DeclareConfig,
|
|
3234
3101
|
RegisterConfig
|
|
3235
3102
|
]);
|
|
3236
3103
|
|
|
3237
3104
|
// ../commons/src/events/offline/CertificateConfig.ts
|
|
3238
|
-
var
|
|
3239
|
-
var FontFamily =
|
|
3240
|
-
normal:
|
|
3241
|
-
bold:
|
|
3242
|
-
italics:
|
|
3243
|
-
bolditalics:
|
|
3244
|
-
});
|
|
3245
|
-
var CertificateConfig =
|
|
3246
|
-
id:
|
|
3247
|
-
event:
|
|
3248
|
-
isV2Template:
|
|
3105
|
+
var z25 = __toESM(require("zod/v4"));
|
|
3106
|
+
var FontFamily = z25.object({
|
|
3107
|
+
normal: z25.string(),
|
|
3108
|
+
bold: z25.string(),
|
|
3109
|
+
italics: z25.string(),
|
|
3110
|
+
bolditalics: z25.string()
|
|
3111
|
+
});
|
|
3112
|
+
var CertificateConfig = z25.object({
|
|
3113
|
+
id: z25.string(),
|
|
3114
|
+
event: z25.string(),
|
|
3115
|
+
isV2Template: z25.boolean().optional(),
|
|
3249
3116
|
label: TranslationConfig,
|
|
3250
|
-
isDefault:
|
|
3251
|
-
fee:
|
|
3252
|
-
onTime:
|
|
3253
|
-
late:
|
|
3254
|
-
delayed:
|
|
3117
|
+
isDefault: z25.boolean(),
|
|
3118
|
+
fee: z25.object({
|
|
3119
|
+
onTime: z25.number(),
|
|
3120
|
+
late: z25.number(),
|
|
3121
|
+
delayed: z25.number()
|
|
3255
3122
|
}),
|
|
3256
|
-
svgUrl:
|
|
3257
|
-
fonts:
|
|
3258
|
-
conditionals:
|
|
3123
|
+
svgUrl: z25.string(),
|
|
3124
|
+
fonts: z25.record(z25.string(), FontFamily).optional(),
|
|
3125
|
+
conditionals: z25.array(ShowConditional).optional()
|
|
3259
3126
|
});
|
|
3260
3127
|
var CertificateTemplateConfig = CertificateConfig.extend({
|
|
3261
|
-
hash:
|
|
3262
|
-
svg:
|
|
3128
|
+
hash: z25.string().optional(),
|
|
3129
|
+
svg: z25.string()
|
|
3263
3130
|
});
|
|
3264
3131
|
|
|
3265
3132
|
// ../commons/src/events/offline/LanguageConfig.ts
|
|
3266
|
-
var
|
|
3267
|
-
var LanguageConfig =
|
|
3268
|
-
lang:
|
|
3133
|
+
var z26 = __toESM(require("zod/v4"));
|
|
3134
|
+
var LanguageConfig = z26.object({
|
|
3135
|
+
lang: z26.string(),
|
|
3269
3136
|
/**
|
|
3270
3137
|
* client.csv contents
|
|
3271
3138
|
*/
|
|
3272
|
-
messages:
|
|
3139
|
+
messages: z26.record(z26.string(), z26.string())
|
|
3273
3140
|
});
|
|
3274
3141
|
|
|
3275
3142
|
// ../commons/src/events/EventConfig.ts
|
|
3276
|
-
var
|
|
3143
|
+
var z33 = __toESM(require("zod/v4"));
|
|
3277
3144
|
|
|
3278
3145
|
// ../commons/src/events/SummaryConfig.ts
|
|
3279
|
-
var
|
|
3280
|
-
var BaseField2 =
|
|
3146
|
+
var z27 = __toESM(require("zod/v4"));
|
|
3147
|
+
var BaseField2 = z27.object({
|
|
3281
3148
|
emptyValueMessage: TranslationConfig.optional().describe(
|
|
3282
3149
|
"Default message displayed when the field value is empty."
|
|
3283
3150
|
),
|
|
3284
|
-
conditionals:
|
|
3151
|
+
conditionals: z27.array(ShowConditional).default([]).optional()
|
|
3285
3152
|
});
|
|
3286
3153
|
var ReferenceField = BaseField2.extend({
|
|
3287
|
-
fieldId:
|
|
3154
|
+
fieldId: z27.string(),
|
|
3288
3155
|
label: TranslationConfig.optional().describe(
|
|
3289
3156
|
"Overrides the default label from the referenced field when provided."
|
|
3290
3157
|
)
|
|
3291
3158
|
}).describe("Field referencing existing event data by field ID.");
|
|
3292
3159
|
var Field = BaseField2.extend({
|
|
3293
|
-
id:
|
|
3160
|
+
id: z27.string().describe("Identifier of the summary field."),
|
|
3294
3161
|
value: TranslationConfig.describe(
|
|
3295
3162
|
'Field value template supporting variables from configuration and EventMetadata (e.g. "{informant.phoneNo} {informant.email}").'
|
|
3296
3163
|
),
|
|
3297
3164
|
label: TranslationConfig
|
|
3298
3165
|
}).describe("Custom field defined for the summary view.");
|
|
3299
|
-
var SummaryConfig =
|
|
3300
|
-
fields:
|
|
3166
|
+
var SummaryConfig = z27.object({
|
|
3167
|
+
fields: z27.array(z27.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
|
|
3301
3168
|
}).describe("Configuration of the event summary section.");
|
|
3302
3169
|
|
|
3303
3170
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
|
3304
|
-
var
|
|
3305
|
-
var MatchType =
|
|
3306
|
-
var BaseField3 =
|
|
3307
|
-
config:
|
|
3171
|
+
var z28 = __toESM(require("zod/v4"));
|
|
3172
|
+
var MatchType = z28.enum(["fuzzy", "exact", "range", "within"]);
|
|
3173
|
+
var BaseField3 = z28.object({
|
|
3174
|
+
config: z28.object({
|
|
3308
3175
|
type: MatchType.describe(
|
|
3309
3176
|
"Determines the search type of field. How to match value."
|
|
3310
3177
|
),
|
|
3311
|
-
searchFields:
|
|
3178
|
+
searchFields: z28.array(z28.string()).optional().describe(
|
|
3312
3179
|
`
|
|
3313
3180
|
Defines multiple form fields that should be searched when this field has a value.
|
|
3314
3181
|
All specified fields will be combined using OR logic.
|
|
@@ -3318,7 +3185,7 @@ var BaseField3 = z29.object({
|
|
|
3318
3185
|
`
|
|
3319
3186
|
)
|
|
3320
3187
|
}),
|
|
3321
|
-
type:
|
|
3188
|
+
type: z28.nativeEnum(FieldType).optional().describe(
|
|
3322
3189
|
`
|
|
3323
3190
|
Explicitly specify the field type for searchFields.
|
|
3324
3191
|
This is required when searchFields is defined, to show the correct control in the UI.
|
|
@@ -3332,7 +3199,7 @@ var BaseField3 = z29.object({
|
|
|
3332
3199
|
This is required when searchFields is defined.
|
|
3333
3200
|
`
|
|
3334
3201
|
),
|
|
3335
|
-
options:
|
|
3202
|
+
options: z28.array(SelectOption).optional(),
|
|
3336
3203
|
searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
|
|
3337
3204
|
`
|
|
3338
3205
|
This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
|
|
@@ -3353,7 +3220,7 @@ var BaseField3 = z29.object({
|
|
|
3353
3220
|
in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
|
|
3354
3221
|
`
|
|
3355
3222
|
),
|
|
3356
|
-
conditionals:
|
|
3223
|
+
conditionals: z28.array(FieldConditional).optional().describe(
|
|
3357
3224
|
`
|
|
3358
3225
|
In advanced search, we sometimes need to override the default field visibility conditionals.
|
|
3359
3226
|
|
|
@@ -3367,20 +3234,20 @@ var BaseField3 = z29.object({
|
|
|
3367
3234
|
are always rendered in the advanced search form.
|
|
3368
3235
|
`
|
|
3369
3236
|
),
|
|
3370
|
-
validations:
|
|
3237
|
+
validations: z28.array(ValidationConfig).optional().describe(
|
|
3371
3238
|
`Option for overriding the field validations specifically for advanced search form.`
|
|
3372
3239
|
)
|
|
3373
3240
|
});
|
|
3374
|
-
var SearchQueryParams =
|
|
3375
|
-
eventType:
|
|
3241
|
+
var SearchQueryParams = z28.object({
|
|
3242
|
+
eventType: z28.string().optional().describe(
|
|
3376
3243
|
"Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
|
|
3377
3244
|
)
|
|
3378
3245
|
}).catchall(FieldValue);
|
|
3379
3246
|
var FieldConfigSchema = BaseField3.extend({
|
|
3380
|
-
fieldId:
|
|
3381
|
-
fieldType:
|
|
3247
|
+
fieldId: z28.string(),
|
|
3248
|
+
fieldType: z28.literal("field")
|
|
3382
3249
|
});
|
|
3383
|
-
var EventFieldIdInput =
|
|
3250
|
+
var EventFieldIdInput = z28.enum([
|
|
3384
3251
|
"trackingId",
|
|
3385
3252
|
"status",
|
|
3386
3253
|
"legalStatuses.REGISTERED.acceptedAt",
|
|
@@ -3389,7 +3256,7 @@ var EventFieldIdInput = z29.enum([
|
|
|
3389
3256
|
"updatedAt"
|
|
3390
3257
|
]);
|
|
3391
3258
|
var METADATA_FIELD_PREFIX = "event.";
|
|
3392
|
-
var EventFieldId =
|
|
3259
|
+
var EventFieldId = z28.enum([
|
|
3393
3260
|
`${METADATA_FIELD_PREFIX}trackingId`,
|
|
3394
3261
|
`${METADATA_FIELD_PREFIX}status`,
|
|
3395
3262
|
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
|
|
@@ -3399,29 +3266,29 @@ var EventFieldId = z29.enum([
|
|
|
3399
3266
|
]);
|
|
3400
3267
|
var EventFieldConfigSchema = BaseField3.extend({
|
|
3401
3268
|
fieldId: EventFieldId,
|
|
3402
|
-
fieldType:
|
|
3269
|
+
fieldType: z28.literal("event")
|
|
3403
3270
|
});
|
|
3404
|
-
var AdvancedSearchField =
|
|
3271
|
+
var AdvancedSearchField = z28.discriminatedUnion("fieldType", [FieldConfigSchema, EventFieldConfigSchema]).superRefine((data, ctx) => {
|
|
3405
3272
|
if (data.config.searchFields && data.config.searchFields.length > 0) {
|
|
3406
3273
|
if (!data.label) {
|
|
3407
3274
|
ctx.addIssue({
|
|
3408
|
-
code:
|
|
3275
|
+
code: z28.ZodIssueCode.custom,
|
|
3409
3276
|
message: "label is required when config.searchFields is defined.",
|
|
3410
3277
|
path: ["label"]
|
|
3411
3278
|
});
|
|
3412
3279
|
}
|
|
3413
3280
|
if (!data.type) {
|
|
3414
3281
|
ctx.addIssue({
|
|
3415
|
-
code:
|
|
3282
|
+
code: z28.ZodIssueCode.custom,
|
|
3416
3283
|
message: "type is required when config.searchFields is defined.",
|
|
3417
3284
|
path: ["type"]
|
|
3418
3285
|
});
|
|
3419
3286
|
}
|
|
3420
3287
|
}
|
|
3421
3288
|
});
|
|
3422
|
-
var AdvancedSearchConfig =
|
|
3289
|
+
var AdvancedSearchConfig = z28.object({
|
|
3423
3290
|
title: TranslationConfig.describe("Advanced search tab title"),
|
|
3424
|
-
fields:
|
|
3291
|
+
fields: z28.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
|
|
3425
3292
|
});
|
|
3426
3293
|
|
|
3427
3294
|
// ../commons/src/events/utils.ts
|
|
@@ -3430,17 +3297,17 @@ var import_lodash = require("lodash");
|
|
|
3430
3297
|
// ../commons/src/conditionals/validate.ts
|
|
3431
3298
|
var import__ = __toESM(require("ajv/dist/2019"));
|
|
3432
3299
|
var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
3433
|
-
var
|
|
3300
|
+
var z31 = __toESM(require("zod/v4"));
|
|
3434
3301
|
var import_date_fns = require("date-fns");
|
|
3435
3302
|
|
|
3436
3303
|
// ../commons/src/events/FieldTypeMapping.ts
|
|
3437
|
-
var
|
|
3304
|
+
var z30 = __toESM(require("zod/v4"));
|
|
3438
3305
|
|
|
3439
3306
|
// ../commons/src/events/DynamicFieldValue.ts
|
|
3440
|
-
var
|
|
3307
|
+
var z29 = __toESM(require("zod/v4"));
|
|
3441
3308
|
function getDynamicNameValue(field3) {
|
|
3442
3309
|
const nameConfiguration = field3.configuration?.name;
|
|
3443
|
-
return
|
|
3310
|
+
return z29.object({
|
|
3444
3311
|
firstname: nameConfiguration?.firstname?.required ? NonEmptyTextValue : TextValue,
|
|
3445
3312
|
surname: nameConfiguration?.surname?.required ? NonEmptyTextValue : TextValue,
|
|
3446
3313
|
middlename: nameConfiguration?.middlename?.required ? NonEmptyTextValue : TextValue.optional()
|
|
@@ -3471,7 +3338,7 @@ function mapFieldTypeToZod(field3, actionType) {
|
|
|
3471
3338
|
let schema;
|
|
3472
3339
|
switch (field3.type) {
|
|
3473
3340
|
case FieldType.FIELD_GROUP: {
|
|
3474
|
-
schema =
|
|
3341
|
+
schema = z30.object(
|
|
3475
3342
|
field3.fields.reduce((acc, subfield) => {
|
|
3476
3343
|
acc[subfield.id] = mapFieldTypeToZod(subfield, actionType);
|
|
3477
3344
|
return acc;
|
|
@@ -3552,6 +3419,9 @@ function mapFieldTypeToZod(field3, actionType) {
|
|
|
3552
3419
|
case FieldType.ALPHA_PRINT_BUTTON:
|
|
3553
3420
|
schema = TextValue;
|
|
3554
3421
|
break;
|
|
3422
|
+
case FieldType.AUTOCOMPLETE:
|
|
3423
|
+
schema = AutocompleteValue;
|
|
3424
|
+
break;
|
|
3555
3425
|
case FieldType.HTTP:
|
|
3556
3426
|
case FieldType.SEARCH:
|
|
3557
3427
|
schema = HttpFieldUpdateValue;
|
|
@@ -3612,6 +3482,7 @@ function mapFieldTypeToEmptyValue(field3) {
|
|
|
3612
3482
|
case FieldType.BUTTON:
|
|
3613
3483
|
case FieldType.ALPHA_PRINT_BUTTON:
|
|
3614
3484
|
case FieldType.HTTP:
|
|
3485
|
+
case FieldType.AUTOCOMPLETE:
|
|
3615
3486
|
case FieldType.SEARCH:
|
|
3616
3487
|
case FieldType.LINK_BUTTON:
|
|
3617
3488
|
case FieldType.QUERY_PARAM_READER:
|
|
@@ -3751,6 +3622,9 @@ var isPrintButtonFieldType = (field3) => {
|
|
|
3751
3622
|
var isHttpFieldType = (field3) => {
|
|
3752
3623
|
return field3.config.type === FieldType.HTTP;
|
|
3753
3624
|
};
|
|
3625
|
+
var isAutocompleteFieldType = (field3) => {
|
|
3626
|
+
return field3.config.type === FieldType.AUTOCOMPLETE;
|
|
3627
|
+
};
|
|
3754
3628
|
var isSearchFieldType = (field3) => {
|
|
3755
3629
|
return field3.config.type === FieldType.SEARCH;
|
|
3756
3630
|
};
|
|
@@ -3792,9 +3666,9 @@ var ajv = new import__.default({
|
|
|
3792
3666
|
strict: false
|
|
3793
3667
|
// Allow minContains and other newer features
|
|
3794
3668
|
});
|
|
3795
|
-
var DataContext =
|
|
3796
|
-
rootData:
|
|
3797
|
-
$leafAdminStructureLocationIds:
|
|
3669
|
+
var DataContext = z31.object({
|
|
3670
|
+
rootData: z31.object({
|
|
3671
|
+
$leafAdminStructureLocationIds: z31.array(z31.object({ id: UUID }))
|
|
3798
3672
|
})
|
|
3799
3673
|
});
|
|
3800
3674
|
function resolveDataPath(rootData, dataPath, instancePath) {
|
|
@@ -4243,7 +4117,7 @@ function areCertificateConditionsMet(conditions, values) {
|
|
|
4243
4117
|
}
|
|
4244
4118
|
|
|
4245
4119
|
// ../commons/src/utils.ts
|
|
4246
|
-
var
|
|
4120
|
+
var z32 = __toESM(require("zod/v4"));
|
|
4247
4121
|
var _ = __toESM(require("lodash"));
|
|
4248
4122
|
function getOrThrow(x, message) {
|
|
4249
4123
|
if (x === void 0 || x === null) {
|
|
@@ -4254,11 +4128,11 @@ function getOrThrow(x, message) {
|
|
|
4254
4128
|
function joinValues(values, separator = " ") {
|
|
4255
4129
|
return values.filter((value) => !!value).join(separator).trim();
|
|
4256
4130
|
}
|
|
4257
|
-
var FullNameV1 =
|
|
4258
|
-
|
|
4259
|
-
use:
|
|
4260
|
-
family:
|
|
4261
|
-
given:
|
|
4131
|
+
var FullNameV1 = z32.array(
|
|
4132
|
+
z32.object({
|
|
4133
|
+
use: z32.string(),
|
|
4134
|
+
family: z32.string(),
|
|
4135
|
+
given: z32.array(z32.string())
|
|
4262
4136
|
})
|
|
4263
4137
|
);
|
|
4264
4138
|
function omitKeyDeep(obj, keyToRemove) {
|
|
@@ -4394,16 +4268,17 @@ function isPageVisible(page, formValues, context) {
|
|
|
4394
4268
|
}
|
|
4395
4269
|
return isConditionMet(page.conditional, formValues, context);
|
|
4396
4270
|
}
|
|
4397
|
-
function omitHiddenFields(fields, formValues, validatorContext, includeHiddenFieldsWithNullValues = false) {
|
|
4271
|
+
function omitHiddenFields(fields, formValues, validatorContext, includeHiddenFieldsWithNullValues = false, declarationContext) {
|
|
4398
4272
|
const base = (0, import_lodash.cloneDeep)(formValues);
|
|
4399
4273
|
function fn(prevVisibilityContext) {
|
|
4274
|
+
const visibilityForm = declarationContext ? { ...declarationContext, ...prevVisibilityContext } : prevVisibilityContext;
|
|
4400
4275
|
const cleaned = (0, import_lodash.omitBy)(base, (value, fieldId) => {
|
|
4401
4276
|
const fieldConfig = fields.filter((f) => f.id === fieldId);
|
|
4402
4277
|
if (!fieldConfig.length) {
|
|
4403
4278
|
return false;
|
|
4404
4279
|
}
|
|
4405
4280
|
const isHidden = fieldConfig.every(
|
|
4406
|
-
(f) => !isFieldVisible(f,
|
|
4281
|
+
(f) => !isFieldVisible(f, visibilityForm, validatorContext)
|
|
4407
4282
|
);
|
|
4408
4283
|
if (!isHidden) {
|
|
4409
4284
|
return false;
|
|
@@ -4470,8 +4345,10 @@ function omitHiddenAnnotationFields(actionConfig, declaration, annotation, conte
|
|
|
4470
4345
|
const annotationFields = getActionAnnotationFields(actionConfig);
|
|
4471
4346
|
return omitHiddenFields(
|
|
4472
4347
|
annotationFields,
|
|
4473
|
-
|
|
4474
|
-
context
|
|
4348
|
+
annotation,
|
|
4349
|
+
context,
|
|
4350
|
+
false,
|
|
4351
|
+
declaration
|
|
4475
4352
|
);
|
|
4476
4353
|
}
|
|
4477
4354
|
function deepMerge(currentDocument, actionDocument) {
|
|
@@ -5428,11 +5305,11 @@ function validateActionOrder(event2, ctx) {
|
|
|
5428
5305
|
}
|
|
5429
5306
|
|
|
5430
5307
|
// ../commons/src/events/EventConfig.ts
|
|
5431
|
-
var EventFieldReference =
|
|
5308
|
+
var EventFieldReference = z33.object({ $$event: EventMetadataDateFieldIdInput }).describe(
|
|
5432
5309
|
"Reference to a field defined in the event metadata, using the field id."
|
|
5433
5310
|
);
|
|
5434
|
-
var _EventConfigBase =
|
|
5435
|
-
id:
|
|
5311
|
+
var _EventConfigBase = z33.object({
|
|
5312
|
+
id: z33.string().describe(
|
|
5436
5313
|
'Machine-readable identifier of the event (e.g. "birth", "death").'
|
|
5437
5314
|
),
|
|
5438
5315
|
dateOfEvent: FieldReference.or(EventFieldReference).optional().describe(
|
|
@@ -5451,20 +5328,23 @@ var _EventConfigBase = z34.object({
|
|
|
5451
5328
|
"Summary information displayed in the event overview."
|
|
5452
5329
|
),
|
|
5453
5330
|
label: TranslationConfig.describe("Human-readable label for the event type."),
|
|
5454
|
-
actions:
|
|
5331
|
+
actions: z33.array(ActionConfig).describe(
|
|
5455
5332
|
"Configuration of system-defined actions associated with the event."
|
|
5456
5333
|
),
|
|
5457
|
-
actionOrder:
|
|
5334
|
+
actionOrder: z33.array(z33.string()).optional().describe(
|
|
5458
5335
|
"Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
|
|
5459
5336
|
),
|
|
5460
5337
|
declaration: DeclarationFormConfig.describe(
|
|
5461
5338
|
"Configuration of the form used to gather event data."
|
|
5462
5339
|
),
|
|
5463
|
-
advancedSearch:
|
|
5340
|
+
advancedSearch: z33.array(AdvancedSearchConfig).optional().default([]).describe(
|
|
5464
5341
|
"Configuration of fields available in the advanced search feature."
|
|
5465
5342
|
),
|
|
5466
|
-
flags:
|
|
5343
|
+
flags: z33.array(FlagConfig).optional().default([]).describe(
|
|
5467
5344
|
"Configuration of flags associated with the actions of this event type."
|
|
5345
|
+
),
|
|
5346
|
+
analytics: z33.boolean().optional().default(true).describe(
|
|
5347
|
+
"Indicates whether the records of this event type are included in analytics"
|
|
5468
5348
|
)
|
|
5469
5349
|
});
|
|
5470
5350
|
var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
|
|
@@ -5484,7 +5364,7 @@ var definePage = (page) => PageConfig.parse(page);
|
|
|
5484
5364
|
var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
|
|
5485
5365
|
|
|
5486
5366
|
// ../commons/src/events/WorkqueueConfig.ts
|
|
5487
|
-
var
|
|
5367
|
+
var z37 = __toESM(require("zod/v4"));
|
|
5488
5368
|
|
|
5489
5369
|
// ../commons/src/searchConfigs.ts
|
|
5490
5370
|
function createSearchConfig(baseField) {
|
|
@@ -5685,17 +5565,17 @@ var event = Object.assign(eventFn, {
|
|
|
5685
5565
|
});
|
|
5686
5566
|
|
|
5687
5567
|
// ../commons/src/events/WorkqueueColumnConfig.ts
|
|
5688
|
-
var
|
|
5568
|
+
var z34 = __toESM(require("zod/v4"));
|
|
5689
5569
|
var WorkqueueColumnKeysArray = [
|
|
5690
5570
|
...EventMetadataKeysArray,
|
|
5691
5571
|
"title",
|
|
5692
5572
|
"outbox"
|
|
5693
5573
|
];
|
|
5694
|
-
var WorkqueueColumnKeys =
|
|
5695
|
-
var WorkqueueColumnValue =
|
|
5574
|
+
var WorkqueueColumnKeys = z34.enum(WorkqueueColumnKeysArray);
|
|
5575
|
+
var WorkqueueColumnValue = z34.object({
|
|
5696
5576
|
$event: WorkqueueColumnKeys
|
|
5697
5577
|
});
|
|
5698
|
-
var WorkqueueColumn =
|
|
5578
|
+
var WorkqueueColumn = z34.object({
|
|
5699
5579
|
label: TranslationConfig,
|
|
5700
5580
|
value: WorkqueueColumnValue
|
|
5701
5581
|
});
|
|
@@ -5706,55 +5586,59 @@ function defineWorkqueuesColumns(workqueueColumns) {
|
|
|
5706
5586
|
}
|
|
5707
5587
|
|
|
5708
5588
|
// ../commons/src/events/CountryConfigQueryInput.ts
|
|
5709
|
-
var
|
|
5710
|
-
var SerializableExact =
|
|
5711
|
-
type:
|
|
5712
|
-
term:
|
|
5713
|
-
});
|
|
5714
|
-
var SerializableWithin =
|
|
5715
|
-
type:
|
|
5716
|
-
location:
|
|
5717
|
-
});
|
|
5718
|
-
var SerializedQueryExpression =
|
|
5719
|
-
eventType:
|
|
5720
|
-
status:
|
|
5721
|
-
createdAt:
|
|
5722
|
-
updatedAt:
|
|
5723
|
-
"legalStatuses.DECLARED.createdAtLocation":
|
|
5724
|
-
"legalStatuses.DECLARED.createdByRole":
|
|
5725
|
-
"legalStatuses.REGISTERED.createdAt":
|
|
5726
|
-
"legalStatuses.REGISTERED.createdAtLocation":
|
|
5727
|
-
"legalStatuses.REGISTERED.createdByRole":
|
|
5728
|
-
"legalStatuses.REGISTERED.registrationNumber":
|
|
5729
|
-
createdAtLocation:
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5589
|
+
var z35 = __toESM(require("zod/v4"));
|
|
5590
|
+
var SerializableExact = z35.object({
|
|
5591
|
+
type: z35.literal("exact"),
|
|
5592
|
+
term: z35.union([z35.string(), SerializedUserField])
|
|
5593
|
+
});
|
|
5594
|
+
var SerializableWithin = z35.object({
|
|
5595
|
+
type: z35.literal("within"),
|
|
5596
|
+
location: z35.union([z35.string(), SerializedUserField])
|
|
5597
|
+
});
|
|
5598
|
+
var SerializedQueryExpression = z35.object({
|
|
5599
|
+
eventType: z35.string(),
|
|
5600
|
+
status: z35.optional(z35.union([AnyOfStatus, ExactStatus])),
|
|
5601
|
+
createdAt: z35.optional(DateCondition),
|
|
5602
|
+
updatedAt: z35.optional(DateCondition),
|
|
5603
|
+
"legalStatuses.DECLARED.createdAtLocation": z35.optional(SerializableWithin),
|
|
5604
|
+
"legalStatuses.DECLARED.createdByRole": z35.optional(AnyOf),
|
|
5605
|
+
"legalStatuses.REGISTERED.createdAt": z35.optional(DateCondition),
|
|
5606
|
+
"legalStatuses.REGISTERED.createdAtLocation": z35.optional(SerializableWithin),
|
|
5607
|
+
"legalStatuses.REGISTERED.createdByRole": z35.optional(AnyOf),
|
|
5608
|
+
"legalStatuses.REGISTERED.registrationNumber": z35.optional(Exact),
|
|
5609
|
+
createdAtLocation: z35.optional(
|
|
5610
|
+
z35.union([SerializableWithin, SerializableExact])
|
|
5611
|
+
),
|
|
5612
|
+
updatedAtLocation: z35.optional(
|
|
5613
|
+
z35.union([SerializableWithin, SerializableExact])
|
|
5614
|
+
),
|
|
5615
|
+
updatedByUserRole: z35.optional(SerializableExact),
|
|
5616
|
+
assignedTo: z35.optional(SerializableExact),
|
|
5617
|
+
createdBy: z35.optional(SerializableExact),
|
|
5734
5618
|
createdByUserType: ExactUserType,
|
|
5735
|
-
updatedBy:
|
|
5736
|
-
trackingId:
|
|
5737
|
-
flags:
|
|
5619
|
+
updatedBy: z35.optional(SerializableExact),
|
|
5620
|
+
trackingId: z35.optional(Exact),
|
|
5621
|
+
flags: z35.optional(ContainsFlags),
|
|
5738
5622
|
data: QueryInput
|
|
5739
5623
|
}).partial();
|
|
5740
|
-
var Or2 =
|
|
5741
|
-
type:
|
|
5742
|
-
clauses:
|
|
5624
|
+
var Or2 = z35.object({
|
|
5625
|
+
type: z35.literal("or"),
|
|
5626
|
+
clauses: z35.array(SerializedQueryExpression)
|
|
5743
5627
|
});
|
|
5744
|
-
var And2 =
|
|
5745
|
-
type:
|
|
5746
|
-
clauses:
|
|
5628
|
+
var And2 = z35.object({
|
|
5629
|
+
type: z35.literal("and"),
|
|
5630
|
+
clauses: z35.array(SerializedQueryExpression)
|
|
5747
5631
|
});
|
|
5748
|
-
var CountryConfigQueryType =
|
|
5749
|
-
var CountryConfigQueryInputType =
|
|
5632
|
+
var CountryConfigQueryType = z35.discriminatedUnion("type", [And2, Or2]);
|
|
5633
|
+
var CountryConfigQueryInputType = z35.union([
|
|
5750
5634
|
SerializedQueryExpression,
|
|
5751
5635
|
And2,
|
|
5752
5636
|
Or2
|
|
5753
5637
|
]);
|
|
5754
5638
|
|
|
5755
5639
|
// ../commons/src/icons.ts
|
|
5756
|
-
var
|
|
5757
|
-
var AvailableIcons =
|
|
5640
|
+
var z36 = __toESM(require("zod/v4"));
|
|
5641
|
+
var AvailableIcons = z36.enum([
|
|
5758
5642
|
"Archived",
|
|
5759
5643
|
"Assigned",
|
|
5760
5644
|
"Briefcase",
|
|
@@ -5879,16 +5763,16 @@ var mandatoryColumns = defineWorkqueuesColumns([
|
|
|
5879
5763
|
value: event.field("updatedAt")
|
|
5880
5764
|
}
|
|
5881
5765
|
]);
|
|
5882
|
-
var WorkqueueConfig =
|
|
5883
|
-
slug:
|
|
5766
|
+
var WorkqueueConfig = z37.object({
|
|
5767
|
+
slug: z37.string().describe("Determines the url of the workqueue."),
|
|
5884
5768
|
name: TranslationConfig.describe(
|
|
5885
5769
|
"Title of the workflow (both in navigation and on the page)"
|
|
5886
5770
|
),
|
|
5887
5771
|
query: CountryConfigQueryType,
|
|
5888
|
-
action:
|
|
5772
|
+
action: z37.object({ type: WorkqueueActionType }).optional().describe(
|
|
5889
5773
|
"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."
|
|
5890
5774
|
),
|
|
5891
|
-
columns:
|
|
5775
|
+
columns: z37.array(WorkqueueColumn).default(mandatoryColumns),
|
|
5892
5776
|
icon: AvailableIcons,
|
|
5893
5777
|
emptyMessage: TranslationConfig.optional()
|
|
5894
5778
|
}).describe("Configuration for workqueue.");
|
|
@@ -5896,16 +5780,16 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
|
|
|
5896
5780
|
query: true,
|
|
5897
5781
|
columns: true
|
|
5898
5782
|
});
|
|
5899
|
-
var WorkqueueConfigInput =
|
|
5900
|
-
slug:
|
|
5783
|
+
var WorkqueueConfigInput = z37.object({
|
|
5784
|
+
slug: z37.string().describe("Determines the url of the workqueue."),
|
|
5901
5785
|
name: TranslationConfig.describe(
|
|
5902
5786
|
"Title of the workflow (both in navigation and on the page)"
|
|
5903
5787
|
),
|
|
5904
5788
|
query: CountryConfigQueryInputType,
|
|
5905
|
-
action:
|
|
5789
|
+
action: z37.object({ type: WorkqueueActionType }).optional().describe(
|
|
5906
5790
|
"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."
|
|
5907
5791
|
),
|
|
5908
|
-
columns:
|
|
5792
|
+
columns: z37.array(WorkqueueColumn).default(mandatoryColumns),
|
|
5909
5793
|
icon: AvailableIcons,
|
|
5910
5794
|
emptyMessage: TranslationConfig.optional()
|
|
5911
5795
|
});
|
|
@@ -5914,13 +5798,26 @@ function defineWorkqueue(workqueueInput) {
|
|
|
5914
5798
|
const query = "type" in queryInput ? queryInput : { type: "and", clauses: [queryInput] };
|
|
5915
5799
|
return WorkqueueConfig.parse({ ...workqueueInput, query });
|
|
5916
5800
|
}
|
|
5801
|
+
function warnOnConfigurationIssues(workqueue) {
|
|
5802
|
+
if (workqueue.actions) {
|
|
5803
|
+
console.warn(
|
|
5804
|
+
`
|
|
5805
|
+
************** WARNING **************
|
|
5806
|
+
'actions' property is deprecated, but used on workqueue: '${workqueue.slug}'.
|
|
5807
|
+
Use 'action' property instead!
|
|
5808
|
+
************** WARNING **************
|
|
5809
|
+
`
|
|
5810
|
+
);
|
|
5811
|
+
}
|
|
5812
|
+
}
|
|
5917
5813
|
function defineWorkqueues(workqueues) {
|
|
5814
|
+
workqueues.forEach(warnOnConfigurationIssues);
|
|
5918
5815
|
return workqueues.map((workqueue) => defineWorkqueue(workqueue));
|
|
5919
5816
|
}
|
|
5920
|
-
var WorkqueueCountInput =
|
|
5921
|
-
|
|
5817
|
+
var WorkqueueCountInput = z37.array(
|
|
5818
|
+
z37.object({ slug: z37.string(), query: QueryType })
|
|
5922
5819
|
);
|
|
5923
|
-
var WorkqueueCountOutput =
|
|
5820
|
+
var WorkqueueCountOutput = z37.record(z37.string(), z37.number());
|
|
5924
5821
|
|
|
5925
5822
|
// ../commons/src/events/workqueueDefaultColumns.ts
|
|
5926
5823
|
var defaultWorkqueueColumns = [
|
|
@@ -5943,18 +5840,18 @@ var defaultWorkqueueColumns = [
|
|
|
5943
5840
|
];
|
|
5944
5841
|
|
|
5945
5842
|
// ../commons/src/events/Draft.ts
|
|
5946
|
-
var
|
|
5843
|
+
var z39 = __toESM(require("zod/v4"));
|
|
5947
5844
|
|
|
5948
5845
|
// ../commons/src/events/ActionInput.ts
|
|
5949
|
-
var
|
|
5950
|
-
var BaseActionInput =
|
|
5846
|
+
var z38 = __toESM(require("zod/v4"));
|
|
5847
|
+
var BaseActionInput = z38.object({
|
|
5951
5848
|
eventId: UUID,
|
|
5952
|
-
transactionId:
|
|
5849
|
+
transactionId: z38.string(),
|
|
5953
5850
|
declaration: ActionUpdate.default({}),
|
|
5954
5851
|
annotation: ActionUpdate.optional(),
|
|
5955
5852
|
originalActionId: UUID.optional(),
|
|
5956
5853
|
// should not be part of base action.
|
|
5957
|
-
keepAssignment:
|
|
5854
|
+
keepAssignment: z38.boolean().optional(),
|
|
5958
5855
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
5959
5856
|
// @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
|
|
5960
5857
|
createdAtLocation: UUID.nullish().describe(
|
|
@@ -5962,8 +5859,8 @@ var BaseActionInput = z39.object({
|
|
|
5962
5859
|
)
|
|
5963
5860
|
});
|
|
5964
5861
|
var CreateActionInput = BaseActionInput.extend(
|
|
5965
|
-
|
|
5966
|
-
type:
|
|
5862
|
+
z38.object({
|
|
5863
|
+
type: z38.literal(ActionType.CREATE).default(ActionType.CREATE),
|
|
5967
5864
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
5968
5865
|
createdAtLocation: UUID.nullish().describe(
|
|
5969
5866
|
"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."
|
|
@@ -5971,14 +5868,14 @@ var CreateActionInput = BaseActionInput.extend(
|
|
|
5971
5868
|
}).shape
|
|
5972
5869
|
);
|
|
5973
5870
|
var RegisterActionInput = BaseActionInput.extend(
|
|
5974
|
-
|
|
5975
|
-
type:
|
|
5976
|
-
registrationNumber:
|
|
5871
|
+
z38.strictObject({
|
|
5872
|
+
type: z38.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
|
5873
|
+
registrationNumber: z38.string().optional()
|
|
5977
5874
|
}).shape
|
|
5978
5875
|
);
|
|
5979
5876
|
var NotifyActionInput = BaseActionInput.extend(
|
|
5980
|
-
|
|
5981
|
-
type:
|
|
5877
|
+
z38.object({
|
|
5878
|
+
type: z38.literal(ActionType.NOTIFY).default(ActionType.NOTIFY),
|
|
5982
5879
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
5983
5880
|
createdAtLocation: UUID.nullish().describe(
|
|
5984
5881
|
"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."
|
|
@@ -5994,100 +5891,100 @@ var NotifyActionInput = BaseActionInput.extend(
|
|
|
5994
5891
|
}
|
|
5995
5892
|
});
|
|
5996
5893
|
var DeclareActionInput = BaseActionInput.extend(
|
|
5997
|
-
|
|
5998
|
-
type:
|
|
5894
|
+
z38.object({
|
|
5895
|
+
type: z38.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
|
5999
5896
|
}).shape
|
|
6000
5897
|
);
|
|
6001
5898
|
var EditActionInput = BaseActionInput.extend(
|
|
6002
|
-
|
|
6003
|
-
type:
|
|
6004
|
-
content:
|
|
6005
|
-
comment:
|
|
5899
|
+
z38.object({
|
|
5900
|
+
type: z38.literal(ActionType.EDIT).default(ActionType.EDIT),
|
|
5901
|
+
content: z38.object({
|
|
5902
|
+
comment: z38.string().describe("Comment for the edit action.").optional()
|
|
6006
5903
|
})
|
|
6007
5904
|
}).shape
|
|
6008
5905
|
);
|
|
6009
5906
|
var PrintCertificateActionInput = BaseActionInput.extend(
|
|
6010
|
-
|
|
6011
|
-
type:
|
|
5907
|
+
z38.object({
|
|
5908
|
+
type: z38.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
|
|
6012
5909
|
content: PrintContent.optional()
|
|
6013
5910
|
}).shape
|
|
6014
5911
|
);
|
|
6015
5912
|
var RejectDeclarationActionInput = BaseActionInput.extend(
|
|
6016
|
-
|
|
6017
|
-
type:
|
|
5913
|
+
z38.object({
|
|
5914
|
+
type: z38.literal(ActionType.REJECT).default(ActionType.REJECT),
|
|
6018
5915
|
content: ReasonContent
|
|
6019
5916
|
}).shape
|
|
6020
5917
|
);
|
|
6021
5918
|
var DuplicateDetectedActionInput = BaseActionInput.extend(
|
|
6022
|
-
|
|
6023
|
-
type:
|
|
6024
|
-
content:
|
|
6025
|
-
duplicates:
|
|
5919
|
+
z38.object({
|
|
5920
|
+
type: z38.literal(ActionType.DUPLICATE_DETECTED).default(ActionType.DUPLICATE_DETECTED),
|
|
5921
|
+
content: z38.object({
|
|
5922
|
+
duplicates: z38.array(PotentialDuplicate)
|
|
6026
5923
|
})
|
|
6027
5924
|
}).shape
|
|
6028
5925
|
);
|
|
6029
5926
|
var MarkAsDuplicateActionInput = BaseActionInput.extend(
|
|
6030
|
-
|
|
6031
|
-
type:
|
|
6032
|
-
content:
|
|
5927
|
+
z38.object({
|
|
5928
|
+
type: z38.literal(ActionType.MARK_AS_DUPLICATE).default(ActionType.MARK_AS_DUPLICATE),
|
|
5929
|
+
content: z38.object({
|
|
6033
5930
|
duplicateOf: UUID
|
|
6034
5931
|
}).optional()
|
|
6035
5932
|
}).shape
|
|
6036
5933
|
);
|
|
6037
5934
|
var MarkNotDuplicateActionInput = BaseActionInput.extend(
|
|
6038
|
-
|
|
6039
|
-
type:
|
|
5935
|
+
z38.object({
|
|
5936
|
+
type: z38.literal(ActionType.MARK_AS_NOT_DUPLICATE).default(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
6040
5937
|
}).shape
|
|
6041
5938
|
);
|
|
6042
5939
|
var ArchiveActionInput = BaseActionInput.extend(
|
|
6043
|
-
|
|
6044
|
-
type:
|
|
5940
|
+
z38.object({
|
|
5941
|
+
type: z38.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
|
|
6045
5942
|
content: ReasonContent
|
|
6046
5943
|
}).shape
|
|
6047
5944
|
);
|
|
6048
5945
|
var AssignActionInput = BaseActionInput.extend(
|
|
6049
|
-
|
|
6050
|
-
type:
|
|
6051
|
-
assignedTo:
|
|
5946
|
+
z38.object({
|
|
5947
|
+
type: z38.literal(ActionType.ASSIGN),
|
|
5948
|
+
assignedTo: z38.string()
|
|
6052
5949
|
}).shape
|
|
6053
5950
|
);
|
|
6054
5951
|
var UnassignActionInput = BaseActionInput.extend(
|
|
6055
|
-
|
|
6056
|
-
type:
|
|
6057
|
-
assignedTo:
|
|
5952
|
+
z38.object({
|
|
5953
|
+
type: z38.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
|
|
5954
|
+
assignedTo: z38.literal(null).default(null)
|
|
6058
5955
|
}).shape
|
|
6059
5956
|
);
|
|
6060
5957
|
var RequestCorrectionActionInput = BaseActionInput.extend(
|
|
6061
|
-
|
|
6062
|
-
type:
|
|
5958
|
+
z38.object({
|
|
5959
|
+
type: z38.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
|
6063
5960
|
}).shape
|
|
6064
5961
|
);
|
|
6065
5962
|
var RejectCorrectionActionInput = BaseActionInput.extend(
|
|
6066
|
-
|
|
6067
|
-
requestId:
|
|
6068
|
-
type:
|
|
5963
|
+
z38.object({
|
|
5964
|
+
requestId: z38.string(),
|
|
5965
|
+
type: z38.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION),
|
|
6069
5966
|
content: ReasonContent
|
|
6070
5967
|
}).shape
|
|
6071
5968
|
);
|
|
6072
5969
|
var ApproveCorrectionActionInput = BaseActionInput.extend(
|
|
6073
|
-
|
|
6074
|
-
requestId:
|
|
6075
|
-
type:
|
|
5970
|
+
z38.object({
|
|
5971
|
+
requestId: z38.string(),
|
|
5972
|
+
type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
|
6076
5973
|
}).shape
|
|
6077
5974
|
);
|
|
6078
5975
|
var ReadActionInput = BaseActionInput.extend(
|
|
6079
|
-
|
|
6080
|
-
type:
|
|
5976
|
+
z38.object({
|
|
5977
|
+
type: z38.literal(ActionType.READ).default(ActionType.READ)
|
|
6081
5978
|
}).shape
|
|
6082
5979
|
);
|
|
6083
|
-
var DeleteActionInput =
|
|
5980
|
+
var DeleteActionInput = z38.object({ eventId: UUID });
|
|
6084
5981
|
var CustomActionInput = BaseActionInput.extend(
|
|
6085
|
-
|
|
6086
|
-
type:
|
|
6087
|
-
customActionType:
|
|
5982
|
+
z38.object({
|
|
5983
|
+
type: z38.literal(ActionType.CUSTOM).default(ActionType.CUSTOM),
|
|
5984
|
+
customActionType: z38.string().describe("Name of the custom action.")
|
|
6088
5985
|
}).shape
|
|
6089
5986
|
);
|
|
6090
|
-
var ActionInput =
|
|
5987
|
+
var ActionInput = z38.discriminatedUnion("type", [
|
|
6091
5988
|
CreateActionInput.meta({ id: "CreateActionInput" }),
|
|
6092
5989
|
RegisterActionInput.meta({ id: "RegisterActionInput" }),
|
|
6093
5990
|
NotifyActionInput.meta({ id: "NotifyActionInput" }),
|
|
@@ -6123,11 +6020,11 @@ var ActionInput = z39.discriminatedUnion("type", [
|
|
|
6123
6020
|
});
|
|
6124
6021
|
|
|
6125
6022
|
// ../commons/src/events/Draft.ts
|
|
6126
|
-
var Draft =
|
|
6023
|
+
var Draft = z39.object({
|
|
6127
6024
|
id: UUID,
|
|
6128
6025
|
eventId: UUID,
|
|
6129
|
-
transactionId:
|
|
6130
|
-
createdAt:
|
|
6026
|
+
transactionId: z39.string(),
|
|
6027
|
+
createdAt: z39.string().datetime(),
|
|
6131
6028
|
action: ActionBase.extend({
|
|
6132
6029
|
type: ActionTypes.exclude([ActionTypes.enum.DELETE])
|
|
6133
6030
|
}).omit({ id: true, createdAtLocation: true })
|
|
@@ -6136,7 +6033,7 @@ var Draft = z40.object({
|
|
|
6136
6033
|
);
|
|
6137
6034
|
var DraftInput = BaseActionInput.extend({
|
|
6138
6035
|
type: ActionTypes.exclude([ActionTypes.enum.DELETE]),
|
|
6139
|
-
status:
|
|
6036
|
+
status: z39.enum([
|
|
6140
6037
|
ActionStatus.Requested,
|
|
6141
6038
|
ActionStatus.Accepted,
|
|
6142
6039
|
ActionStatus.Rejected
|
|
@@ -6144,27 +6041,27 @@ var DraftInput = BaseActionInput.extend({
|
|
|
6144
6041
|
});
|
|
6145
6042
|
|
|
6146
6043
|
// ../commons/src/events/EventInput.ts
|
|
6147
|
-
var
|
|
6044
|
+
var z40 = __toESM(require("zod/v4"));
|
|
6148
6045
|
var import_uuid10 = require("uuid");
|
|
6149
|
-
var EventInput =
|
|
6150
|
-
transactionId:
|
|
6151
|
-
type:
|
|
6046
|
+
var EventInput = z40.object({
|
|
6047
|
+
transactionId: z40.string(),
|
|
6048
|
+
type: z40.string(),
|
|
6152
6049
|
createdAtLocation: UUID.nullish().describe(
|
|
6153
6050
|
"Location where the event occurred. Required for system users."
|
|
6154
6051
|
)
|
|
6155
6052
|
}).meta({ default: { transactionId: (0, import_uuid10.v4)(), type: "birth" } });
|
|
6156
6053
|
|
|
6157
6054
|
// ../commons/src/events/EventDocument.ts
|
|
6158
|
-
var
|
|
6159
|
-
var EventDocument =
|
|
6055
|
+
var z41 = __toESM(require("zod/v4"));
|
|
6056
|
+
var EventDocument = z41.object({
|
|
6160
6057
|
id: UUID.describe("Unique identifier of the event."),
|
|
6161
|
-
type:
|
|
6162
|
-
createdAt:
|
|
6163
|
-
updatedAt:
|
|
6058
|
+
type: z41.string().describe("Type of the event (e.g. birth, death, marriage)."),
|
|
6059
|
+
createdAt: z41.string().datetime().describe("Timestamp indicating when the event was created."),
|
|
6060
|
+
updatedAt: z41.string().datetime().describe(
|
|
6164
6061
|
"Timestamp of the last update, excluding changes from actions."
|
|
6165
6062
|
),
|
|
6166
|
-
actions:
|
|
6167
|
-
trackingId:
|
|
6063
|
+
actions: z41.array(Action).describe("Ordered list of actions associated with the event."),
|
|
6064
|
+
trackingId: z41.string().describe(
|
|
6168
6065
|
"System-generated tracking identifier used to look up the event."
|
|
6169
6066
|
)
|
|
6170
6067
|
}).meta({ id: "EventDocument" });
|
|
@@ -6215,6 +6112,7 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
|
|
|
6215
6112
|
var updateActions = ActionTypes.extract([
|
|
6216
6113
|
ActionType.CREATE,
|
|
6217
6114
|
ActionType.NOTIFY,
|
|
6115
|
+
ActionType.EDIT,
|
|
6218
6116
|
ActionType.DECLARE,
|
|
6219
6117
|
ActionType.REGISTER,
|
|
6220
6118
|
ActionType.REJECT,
|
|
@@ -6645,9 +6543,10 @@ var IGNORED_EVENT_TYPES = [
|
|
|
6645
6543
|
"tennis-club-membership",
|
|
6646
6544
|
"library-membership",
|
|
6647
6545
|
"child-onboarding",
|
|
6648
|
-
"digital-identity"
|
|
6546
|
+
"digital-identity",
|
|
6547
|
+
"event-with-optional-address"
|
|
6649
6548
|
];
|
|
6650
|
-
function
|
|
6549
|
+
function warnOnConfigurationIssues2(config) {
|
|
6651
6550
|
const eventId = config.id;
|
|
6652
6551
|
if (IGNORED_EVENT_TYPES.includes(eventId)) {
|
|
6653
6552
|
return;
|
|
@@ -6670,7 +6569,7 @@ function warnOnConfigurationIssues(config) {
|
|
|
6670
6569
|
}
|
|
6671
6570
|
var defineConfig = (config) => {
|
|
6672
6571
|
const input = EventConfig.parse(config);
|
|
6673
|
-
|
|
6572
|
+
warnOnConfigurationIssues2(input);
|
|
6674
6573
|
return input;
|
|
6675
6574
|
};
|
|
6676
6575
|
|
|
@@ -9062,9 +8961,9 @@ var digitalIdentityEvent = defineConfig({
|
|
|
9062
8961
|
});
|
|
9063
8962
|
|
|
9064
8963
|
// ../commons/src/events/test.utils.ts
|
|
9065
|
-
var
|
|
8964
|
+
var z42 = __toESM(require("zod/v4"));
|
|
9066
8965
|
var TEST_SYSTEM_IANA_TIMEZONE = "Asia/Dhaka";
|
|
9067
|
-
var TestUserRole =
|
|
8966
|
+
var TestUserRole = z42.enum([
|
|
9068
8967
|
"FIELD_AGENT",
|
|
9069
8968
|
"LOCAL_REGISTRAR",
|
|
9070
8969
|
"LOCAL_SYSTEM_ADMIN",
|
|
@@ -9235,6 +9134,7 @@ function mapFieldTypeToMockValue(field3, i, rng, administrativeHierarchy) {
|
|
|
9235
9134
|
type: "image/png"
|
|
9236
9135
|
};
|
|
9237
9136
|
case FieldType.SEARCH:
|
|
9137
|
+
case FieldType.AUTOCOMPLETE:
|
|
9238
9138
|
case FieldType.HTTP:
|
|
9239
9139
|
return {
|
|
9240
9140
|
error: null,
|
|
@@ -9914,26 +9814,26 @@ function isFieldConfigDefaultValue(value) {
|
|
|
9914
9814
|
var import_lodash6 = require("lodash");
|
|
9915
9815
|
|
|
9916
9816
|
// ../commons/src/events/locations.ts
|
|
9917
|
-
var
|
|
9918
|
-
var LocationTypeV1 =
|
|
9817
|
+
var z43 = __toESM(require("zod/v4"));
|
|
9818
|
+
var LocationTypeV1 = z43.enum([
|
|
9919
9819
|
"ADMIN_STRUCTURE",
|
|
9920
9820
|
"CRVS_OFFICE",
|
|
9921
9821
|
"HEALTH_FACILITY"
|
|
9922
9822
|
]);
|
|
9923
|
-
var AdministrativeArea =
|
|
9823
|
+
var AdministrativeArea = z43.object({
|
|
9924
9824
|
id: UUID,
|
|
9925
|
-
name:
|
|
9926
|
-
externalId:
|
|
9825
|
+
name: z43.string(),
|
|
9826
|
+
externalId: z43.string().nullish(),
|
|
9927
9827
|
parentId: UUID.nullable(),
|
|
9928
|
-
validUntil:
|
|
9828
|
+
validUntil: z43.iso.datetime().nullable()
|
|
9929
9829
|
});
|
|
9930
|
-
var Location =
|
|
9830
|
+
var Location = z43.object({
|
|
9931
9831
|
id: UUID,
|
|
9932
|
-
name:
|
|
9933
|
-
externalId:
|
|
9832
|
+
name: z43.string(),
|
|
9833
|
+
externalId: z43.string().nullish(),
|
|
9934
9834
|
administrativeAreaId: UUID.nullable(),
|
|
9935
|
-
validUntil:
|
|
9936
|
-
locationType:
|
|
9835
|
+
validUntil: z43.iso.datetime().nullable(),
|
|
9836
|
+
locationType: z43.string().nullable()
|
|
9937
9837
|
});
|
|
9938
9838
|
function matchesJurisdictionFilter(locationIds, filter, user2) {
|
|
9939
9839
|
if (!locationIds) {
|
|
@@ -10033,7 +9933,7 @@ var ACTION_SCOPE_MAP = {
|
|
|
10033
9933
|
[ActionType.NOTIFY]: ["record.notify"],
|
|
10034
9934
|
[ActionType.DECLARE]: ["record.declare", "record.register"],
|
|
10035
9935
|
[ActionType.EDIT]: ["record.edit"],
|
|
10036
|
-
[ActionType.DELETE]: ["record.declare"],
|
|
9936
|
+
[ActionType.DELETE]: ["record.declare", "record.notify"],
|
|
10037
9937
|
[ActionType.REGISTER]: ["record.register"],
|
|
10038
9938
|
[ActionType.PRINT_CERTIFICATE]: ["record.print-certified-copies"],
|
|
10039
9939
|
[ActionType.REQUEST_CORRECTION]: [
|
|
@@ -10085,14 +9985,18 @@ function isActionInScope({
|
|
|
10085
9985
|
acceptedScopes,
|
|
10086
9986
|
scopes
|
|
10087
9987
|
});
|
|
10088
|
-
const canAccess = userCanAccessEventWithScopes(
|
|
10089
|
-
|
|
10090
|
-
|
|
10091
|
-
|
|
10092
|
-
|
|
10093
|
-
|
|
10094
|
-
|
|
10095
|
-
|
|
9988
|
+
const canAccess = userCanAccessEventWithScopes(
|
|
9989
|
+
event2,
|
|
9990
|
+
matchingScopes,
|
|
9991
|
+
{
|
|
9992
|
+
id: currentUser.id,
|
|
9993
|
+
primaryOfficeId: currentUser.primaryOfficeId,
|
|
9994
|
+
administrativeAreaId: currentUser.administrativeAreaId ?? null,
|
|
9995
|
+
role: currentUser.role,
|
|
9996
|
+
signature: currentUser.signature,
|
|
9997
|
+
type: currentUser.type
|
|
9998
|
+
}
|
|
9999
|
+
);
|
|
10096
10000
|
return canAccess;
|
|
10097
10001
|
}
|
|
10098
10002
|
|
|
@@ -10114,12 +10018,44 @@ function userDeserializer(serializedUserField, user2) {
|
|
|
10114
10018
|
function isDefined(value) {
|
|
10115
10019
|
return value !== void 0;
|
|
10116
10020
|
}
|
|
10021
|
+
function serializeLocationField(expression, user2) {
|
|
10022
|
+
if (expression.type === "exact") {
|
|
10023
|
+
return userDeserializer(expression.term, user2);
|
|
10024
|
+
}
|
|
10025
|
+
if (expression.type === "within") {
|
|
10026
|
+
return userDeserializer(expression.location, user2);
|
|
10027
|
+
}
|
|
10028
|
+
return void 0;
|
|
10029
|
+
}
|
|
10030
|
+
function deserializeExpression(expression, user2) {
|
|
10031
|
+
if (expression.type === "exact") {
|
|
10032
|
+
const term = userDeserializer(expression.term, user2);
|
|
10033
|
+
if (!term) {
|
|
10034
|
+
return void 0;
|
|
10035
|
+
}
|
|
10036
|
+
return {
|
|
10037
|
+
...expression,
|
|
10038
|
+
term
|
|
10039
|
+
};
|
|
10040
|
+
}
|
|
10041
|
+
if (expression.type === "within") {
|
|
10042
|
+
const location = userDeserializer(expression.location, user2);
|
|
10043
|
+
if (!location) {
|
|
10044
|
+
return void 0;
|
|
10045
|
+
}
|
|
10046
|
+
return {
|
|
10047
|
+
...expression,
|
|
10048
|
+
location
|
|
10049
|
+
};
|
|
10050
|
+
}
|
|
10051
|
+
return void 0;
|
|
10052
|
+
}
|
|
10117
10053
|
function deserializeQueryExpression(expression, user2) {
|
|
10118
10054
|
const assignedTo = expression.assignedTo ? userDeserializer(expression.assignedTo.term, user2) : void 0;
|
|
10119
10055
|
const createdBy = expression.createdBy ? userDeserializer(expression.createdBy.term, user2) : void 0;
|
|
10120
10056
|
const updatedBy = expression.updatedBy ? userDeserializer(expression.updatedBy.term, user2) : void 0;
|
|
10121
|
-
const createdAtLocation = expression.createdAtLocation ?
|
|
10122
|
-
const updatedAtLocation = expression.updatedAtLocation ?
|
|
10057
|
+
const createdAtLocation = expression.createdAtLocation ? serializeLocationField(expression.createdAtLocation, user2) : void 0;
|
|
10058
|
+
const updatedAtLocation = expression.updatedAtLocation ? serializeLocationField(expression.updatedAtLocation, user2) : void 0;
|
|
10123
10059
|
const updatedByUserRole = expression.updatedByUserRole ? userDeserializer(expression.updatedByUserRole.term, user2) : void 0;
|
|
10124
10060
|
const declaredLocation = expression["legalStatuses.DECLARED.createdAtLocation"] ? userDeserializer(
|
|
10125
10061
|
expression["legalStatuses.DECLARED.createdAtLocation"].location,
|
|
@@ -10138,8 +10074,8 @@ function deserializeQueryExpression(expression, user2) {
|
|
|
10138
10074
|
...expression.updatedByUserRole,
|
|
10139
10075
|
term: updatedByUserRole
|
|
10140
10076
|
} : void 0,
|
|
10141
|
-
createdAtLocation: expression.createdAtLocation && isDefined(createdAtLocation) ?
|
|
10142
|
-
updatedAtLocation: expression.updatedAtLocation && isDefined(updatedAtLocation) ?
|
|
10077
|
+
createdAtLocation: expression.createdAtLocation && isDefined(createdAtLocation) ? deserializeExpression(expression.createdAtLocation, user2) : void 0,
|
|
10078
|
+
updatedAtLocation: expression.updatedAtLocation && isDefined(updatedAtLocation) ? deserializeExpression(expression.updatedAtLocation, user2) : void 0,
|
|
10143
10079
|
["legalStatuses.DECLARED.createdAtLocation"]: expression["legalStatuses.DECLARED.createdAtLocation"] && isDefined(declaredLocation) ? {
|
|
10144
10080
|
...expression["legalStatuses.DECLARED.createdAtLocation"],
|
|
10145
10081
|
location: declaredLocation
|