@opencrvs/toolkit 2.2.0-rc.9042a13 → 2.2.0-rc.9dfc125
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 +2 -12
- package/dist/application-config/index.js +12 -7
- package/dist/authentication/index.d.ts +1 -0
- package/dist/authentication/index.js +16 -5
- package/dist/cli.js +875 -193
- package/dist/commons/api/router.d.ts +252 -246
- package/dist/commons/application-config/index.d.ts +2 -2
- package/dist/commons/conditionals/index.d.ts +1 -0
- package/dist/commons/conditionals/validate.d.ts +5 -0
- package/dist/commons/events/ActionConfig.d.ts +16 -23
- package/dist/commons/events/ActionDocument.d.ts +1 -0
- package/dist/commons/events/ActionInput.d.ts +4 -4
- package/dist/commons/events/CompositeFieldValue.d.ts +5 -1
- package/dist/commons/events/CountryConfigQueryInput.d.ts +60 -18
- package/dist/commons/events/EventConfig.d.ts +12 -2
- package/dist/commons/events/EventIndex.d.ts +23 -6
- package/dist/commons/events/EventMetadata.d.ts +0 -1
- package/dist/commons/events/FieldConfig.d.ts +1 -1
- package/dist/commons/events/FieldTypeMapping.d.ts +6 -6
- package/dist/commons/events/Flag.d.ts +1 -7
- package/dist/commons/events/PlainDate.d.ts +1 -0
- package/dist/commons/events/WorkqueueConfig.d.ts +74 -27
- package/dist/commons/events/eventConfigValidation.d.ts +9 -0
- package/dist/commons/events/index.d.ts +2 -0
- package/dist/commons/events/notificationFormFallback.d.ts +10 -0
- package/dist/commons/events/state/flags.d.ts +1 -1
- package/dist/commons/events/test.utils.d.ts +3 -0
- package/dist/commons/events/utils.d.ts +85 -56
- package/dist/conditionals/index.js +2 -3
- package/dist/environment/custom-types.d.ts +1 -0
- package/dist/environment/custom-types.d.ts.map +1 -1
- package/dist/environment/derived-variables.d.ts +12 -4
- package/dist/environment/derived-variables.d.ts.map +1 -1
- package/dist/environment/derived-variables.js +13 -4
- package/dist/environment/questions.d.ts +14 -2
- package/dist/environment/questions.d.ts.map +1 -1
- package/dist/environment/questions.js +40 -19
- package/dist/environment/registry.d.ts +15 -0
- package/dist/environment/registry.d.ts.map +1 -0
- package/dist/environment/registry.js +112 -0
- package/dist/environment/setup-environment.d.ts.map +1 -1
- package/dist/environment/setup-environment.js +111 -24
- package/dist/environment/templates.d.ts.map +1 -1
- package/dist/events/index.js +251 -67
- package/dist/migrations/index.d.ts +9 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +847 -0
- package/dist/migrations/move-declaration-to-declare-action.d.ts +38 -0
- package/dist/migrations/move-declaration-to-declare-action.d.ts.map +1 -0
- package/dist/migrations/move-declaration-to-declare-action.js +377 -0
- package/dist/migrations/{add-translations.d.ts → persistent/add-translations.d.ts} +1 -1
- package/dist/migrations/persistent/add-translations.d.ts.map +1 -0
- package/dist/migrations/{add-translations.js → persistent/add-translations.js} +2 -2
- package/dist/migrations/persistent/check-upgrade-path.d.ts +36 -0
- package/dist/migrations/persistent/check-upgrade-path.d.ts.map +1 -0
- package/dist/migrations/persistent/check-upgrade-path.js +105 -0
- package/dist/migrations/persistent/update-toolkit-dependency.d.ts +7 -0
- package/dist/migrations/persistent/update-toolkit-dependency.d.ts.map +1 -0
- package/dist/migrations/persistent/update-toolkit-dependency.js +77 -0
- package/dist/migrations/{v2.2/read-declaration-through-helper.d.ts → read-declaration-through-helper.d.ts} +1 -1
- package/dist/migrations/read-declaration-through-helper.d.ts.map +1 -0
- package/dist/migrations/{v2.2/read-declaration-through-helper.js → read-declaration-through-helper.js} +1 -1
- package/dist/migrations/replace-incomplete-flag.d.ts +26 -0
- package/dist/migrations/replace-incomplete-flag.d.ts.map +1 -0
- package/dist/migrations/replace-incomplete-flag.js +126 -0
- package/dist/notification/index.js +151 -21
- package/dist/scopes/index.d.ts +54 -84
- package/dist/scopes/index.js +12 -5
- package/dist/templates/charts-values/dependencies/values.yaml +1 -1
- package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -6
- package/dist/templates/charts-values/traefik/values.yaml +2 -0
- package/opencrvs-toolkit-2.2.0-rc.9dfc125.tgz +0 -0
- package/package.json +2 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/dist/migrations/add-translations.d.ts.map +0 -1
- package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts +0 -3
- package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts.map +0 -1
- package/dist/migrations/v2.1/add-explicit-correction-flags.js +0 -234
- package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts +0 -3
- package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts.map +0 -1
- package/dist/migrations/v2.1/add-recovery-link-notifications.js +0 -511
- package/dist/migrations/v2.1/enable-telemetry.d.ts +0 -3
- package/dist/migrations/v2.1/enable-telemetry.d.ts.map +0 -1
- package/dist/migrations/v2.1/enable-telemetry.js +0 -455
- package/dist/migrations/v2.1/index.d.ts +0 -6
- package/dist/migrations/v2.1/index.d.ts.map +0 -1
- package/dist/migrations/v2.1/index.js +0 -50
- package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts +0 -17
- package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts.map +0 -1
- package/dist/migrations/v2.1/migrate-infrastructure-to-assets.js +0 -348
- package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts +0 -2
- package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts.map +0 -1
- package/dist/migrations/v2.1/remove-metabase-package-installs.js +0 -161
- package/dist/migrations/v2.1/remove-sentry.d.ts +0 -3
- package/dist/migrations/v2.1/remove-sentry.d.ts.map +0 -1
- package/dist/migrations/v2.1/remove-sentry.js +0 -354
- package/dist/migrations/v2.1/rename-trigger-paths.d.ts +0 -3
- package/dist/migrations/v2.1/rename-trigger-paths.d.ts.map +0 -1
- package/dist/migrations/v2.1/rename-trigger-paths.js +0 -216
- package/dist/migrations/v2.1/template-files.d.ts +0 -8
- package/dist/migrations/v2.1/template-files.d.ts.map +0 -1
- package/dist/migrations/v2.1/template-files.js +0 -49
- package/dist/migrations/v2.1/upgrade-tilt.d.ts +0 -11
- package/dist/migrations/v2.1/upgrade-tilt.d.ts.map +0 -1
- package/dist/migrations/v2.1/upgrade-tilt.js +0 -139
- package/dist/migrations/v2.2/index.d.ts +0 -6
- package/dist/migrations/v2.2/index.d.ts.map +0 -1
- package/dist/migrations/v2.2/index.js +0 -456
- package/dist/migrations/v2.2/read-declaration-through-helper.d.ts.map +0 -1
- package/dist/templates/countryconfig-template/.tiltignore +0 -1
- package/dist/templates/countryconfig-template/Dockerfile.assets +0 -7
- package/dist/templates/countryconfig-template/Tiltfile +0 -112
- package/dist/templates/countryconfig-template/assets/README.md +0 -1
- package/dist/templates/countryconfig-template/assets/clear-all-data-dev.sh +0 -61
- package/dist/templates/countryconfig-template/assets/deployment/deploy.sh +0 -455
- package/dist/templates/countryconfig-template/assets/deployment/reindex.sh +0 -168
- package/dist/templates/countryconfig-template/assets/deployment/validate-required-variables-in-compose-files.ts +0 -67
- package/dist/templates/countryconfig-template/assets/elasticsearch/reindex.sh +0 -168
- package/dist/templates/countryconfig-template/assets/metabase/README.md +0 -34
- package/dist/templates/countryconfig-template/assets/metabase/environment-configuration.sql +0 -36
- package/dist/templates/countryconfig-template/assets/metabase/initialize-database.sh +0 -46
- package/dist/templates/countryconfig-template/assets/metabase/metabase.init.db.sql +0 -27737
- package/dist/templates/countryconfig-template/assets/metabase/open-shell.sh +0 -21
- package/dist/templates/countryconfig-template/assets/metabase/package.json +0 -13
- package/dist/templates/countryconfig-template/assets/metabase/run-dev.sh +0 -108
- package/dist/templates/countryconfig-template/assets/metabase/run.sh +0 -120
- package/dist/templates/countryconfig-template/assets/metabase/update-database.sh +0 -40
- package/dist/templates/countryconfig-template/assets/postgres/setup-analytics.sh +0 -135
- package/dist/templates/countryconfig-template/assets/postgres/setup-reference-data.sh +0 -108
- package/dist/templates/countryconfig-template/tilt/clear-all-data.ps1 +0 -50
- package/dist/templates/countryconfig-template/tilt/clear-all-data.sh +0 -35
- package/dist/templates/countryconfig-template/tilt/common.tilt +0 -145
- package/dist/templates/countryconfig-template/tilt/examples/dependencies/values.yaml +0 -15
- package/dist/templates/countryconfig-template/tilt/examples/opencrvs-services/values.yaml +0 -56
- package/dist/templates/countryconfig-template/tilt/examples/traefik/values-minikube.yaml +0 -21
- package/dist/templates/countryconfig-template/tilt/examples/traefik/values.yaml +0 -38
- package/dist/templates/countryconfig-template/tilt/helm/dependencies/values.yaml +0 -17
- package/dist/templates/countryconfig-template/tilt/helm/opencrvs-services/values.yaml +0 -16
- package/dist/templates/countryconfig-template/tilt/lib.tilt +0 -95
- package/dist/templates/countryconfig-template/tilt/opencrvs.tilt +0 -136
- package/opencrvs-toolkit-2.2.0-rc.9042a13.tgz +0 -0
package/dist/events/index.js
CHANGED
|
@@ -180,6 +180,7 @@ __export(events_exports, {
|
|
|
180
180
|
NameFieldUpdateValue: () => NameFieldUpdateValue,
|
|
181
181
|
NameFieldValue: () => NameFieldValue,
|
|
182
182
|
NonEmptyTextValue: () => NonEmptyTextValue,
|
|
183
|
+
NoneOfStatus: () => NoneOfStatus,
|
|
183
184
|
NotifyActionInput: () => NotifyActionInput,
|
|
184
185
|
NumberFieldValue: () => NumberFieldValue,
|
|
185
186
|
NumberWithUnitFieldUpdateValue: () => NumberWithUnitFieldUpdateValue,
|
|
@@ -338,6 +339,7 @@ __export(events_exports, {
|
|
|
338
339
|
getActionAnnotation: () => getActionAnnotation,
|
|
339
340
|
getActionAnnotationFields: () => getActionAnnotationFields,
|
|
340
341
|
getActionConfig: () => getActionConfig,
|
|
342
|
+
getActionForm: () => getActionForm,
|
|
341
343
|
getActionFormFields: () => getActionFormFields,
|
|
342
344
|
getActionReview: () => getActionReview,
|
|
343
345
|
getActionReviewFields: () => getActionReviewFields,
|
|
@@ -366,6 +368,8 @@ __export(events_exports, {
|
|
|
366
368
|
getLeafAdministrativeAreaIds: () => getLeafAdministrativeAreaIds,
|
|
367
369
|
getLocationHierarchy: () => getLocationHierarchy,
|
|
368
370
|
getMixedPath: () => getMixedPath,
|
|
371
|
+
getNotificationFields: () => getNotificationFields,
|
|
372
|
+
getNotificationForm: () => getNotificationForm,
|
|
369
373
|
getPendingAction: () => getPendingAction,
|
|
370
374
|
getPrintCertificatePages: () => getPrintCertificatePages,
|
|
371
375
|
getRandomDate: () => getRandomDate,
|
|
@@ -376,10 +380,12 @@ __export(events_exports, {
|
|
|
376
380
|
hasAnyOfScopes: () => hasAnyOfScopes,
|
|
377
381
|
isActionAvailable: () => isActionAvailable,
|
|
378
382
|
isActionConfigType: () => isActionConfigType,
|
|
383
|
+
isActionDocument: () => isActionDocument,
|
|
379
384
|
isActionEnabled: () => isActionEnabled,
|
|
380
385
|
isActionInScope: () => isActionInScope,
|
|
381
386
|
isActionVisible: () => isActionVisible,
|
|
382
387
|
isAddressFieldType: () => isAddressFieldType,
|
|
388
|
+
isAddressFieldValue: () => isAddressFieldValue,
|
|
383
389
|
isAdministrativeAreaFieldType: () => isAdministrativeAreaFieldType,
|
|
384
390
|
isAgeFieldType: () => isAgeFieldType,
|
|
385
391
|
isAutocompleteFieldType: () => isAutocompleteFieldType,
|
|
@@ -394,6 +400,7 @@ __export(events_exports, {
|
|
|
394
400
|
isDateFieldType: () => isDateFieldType,
|
|
395
401
|
isDateRangeFieldType: () => isDateRangeFieldType,
|
|
396
402
|
isDividerFieldType: () => isDividerFieldType,
|
|
403
|
+
isDomesticAddressFieldValue: () => isDomesticAddressFieldValue,
|
|
397
404
|
isEmailFieldType: () => isEmailFieldType,
|
|
398
405
|
isEventFieldReference: () => isEventFieldReference,
|
|
399
406
|
isFacilityFieldType: () => isFacilityFieldType,
|
|
@@ -407,7 +414,9 @@ __export(events_exports, {
|
|
|
407
414
|
isFieldValueWithoutTemplates: () => isFieldValueWithoutTemplates,
|
|
408
415
|
isFieldVisible: () => isFieldVisible,
|
|
409
416
|
isFileFieldType: () => isFileFieldType,
|
|
417
|
+
isFileFieldValue: () => isFileFieldValue,
|
|
410
418
|
isFileFieldWithOptionType: () => isFileFieldWithOptionType,
|
|
419
|
+
isFileFieldWithOptionValue: () => isFileFieldWithOptionValue,
|
|
411
420
|
isHeadingFieldType: () => isHeadingFieldType,
|
|
412
421
|
isHiddenFieldType: () => isHiddenFieldType,
|
|
413
422
|
isHttpFieldType: () => isHttpFieldType,
|
|
@@ -428,6 +437,7 @@ __export(events_exports, {
|
|
|
428
437
|
isPageVisible: () => isPageVisible,
|
|
429
438
|
isParagraphFieldType: () => isParagraphFieldType,
|
|
430
439
|
isPhoneFieldType: () => isPhoneFieldType,
|
|
440
|
+
isPlainDate: () => isPlainDate,
|
|
431
441
|
isPotentialDuplicate: () => isPotentialDuplicate,
|
|
432
442
|
isPrintButtonFieldType: () => isPrintButtonFieldType,
|
|
433
443
|
isQrReaderFieldType: () => isQrReaderFieldType,
|
|
@@ -489,6 +499,9 @@ __export(events_exports, {
|
|
|
489
499
|
});
|
|
490
500
|
module.exports = __toCommonJS(events_exports);
|
|
491
501
|
|
|
502
|
+
// ../commons/src/events/index.ts
|
|
503
|
+
var import_compile = require("zod/compile");
|
|
504
|
+
|
|
492
505
|
// ../commons/src/events/AuditLog.ts
|
|
493
506
|
var z9 = __toESM(require("zod/v4"));
|
|
494
507
|
|
|
@@ -507,6 +520,12 @@ var UUID = z.uuid().brand("UUID");
|
|
|
507
520
|
function getUUID() {
|
|
508
521
|
return (0, import_uuid.v4)();
|
|
509
522
|
}
|
|
523
|
+
function isUUID(id) {
|
|
524
|
+
return UUID.validate(id);
|
|
525
|
+
}
|
|
526
|
+
function maybeUuid(value) {
|
|
527
|
+
return isUUID(value) ? value : void 0;
|
|
528
|
+
}
|
|
510
529
|
|
|
511
530
|
// ../commons/src/events/ActionType.ts
|
|
512
531
|
var z2 = __toESM(require("zod/v4"));
|
|
@@ -638,7 +657,7 @@ var ActionStatus = {
|
|
|
638
657
|
};
|
|
639
658
|
|
|
640
659
|
// ../commons/src/events/Flag.ts
|
|
641
|
-
var z5 = __toESM(require("zod
|
|
660
|
+
var z5 = __toESM(require("zod"));
|
|
642
661
|
|
|
643
662
|
// ../commons/src/events/TranslationConfig.ts
|
|
644
663
|
var z3 = __toESM(require("zod/v4"));
|
|
@@ -707,7 +726,6 @@ var FieldConditional = z4.discriminatedUnion("type", [
|
|
|
707
726
|
|
|
708
727
|
// ../commons/src/events/Flag.ts
|
|
709
728
|
var InherentFlags = {
|
|
710
|
-
INCOMPLETE: "incomplete",
|
|
711
729
|
REJECTED: "rejected",
|
|
712
730
|
CORRECTION_REQUESTED: "correction-requested",
|
|
713
731
|
POTENTIAL_DUPLICATE: "potential-duplicate",
|
|
@@ -735,7 +753,7 @@ var CustomFlag = z5.string().refine((val) => !Object.values(InherentFlags).inclu
|
|
|
735
753
|
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
736
754
|
InherentFlags
|
|
737
755
|
).join(", ")}`
|
|
738
|
-
}).refine((val) => !ActionFlag.
|
|
756
|
+
}).refine((val) => !ActionFlag.validate(val), {
|
|
739
757
|
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
740
758
|
}).describe("Custom flag identifier defined by the country config.");
|
|
741
759
|
var Flag = ActionFlag.or(z5.enum(InherentFlags)).or(CustomFlag);
|
|
@@ -1508,7 +1526,7 @@ var z14 = __toESM(require("zod/v4"));
|
|
|
1508
1526
|
// ../commons/src/documents.ts
|
|
1509
1527
|
var z11 = __toESM(require("zod/v4"));
|
|
1510
1528
|
var FullDocumentUrl = z11.string().brand("FullDocumentUrl").describe(
|
|
1511
|
-
"A full url with protocol, host, bucket name, starting from the root of the S3 server, https://
|
|
1529
|
+
"A full url with protocol, host, bucket name, starting from the root of the S3 server, https://s3.opencrvs.com/bucket-name/document-id.jpg"
|
|
1512
1530
|
);
|
|
1513
1531
|
var FullDocumentPath = z11.string().overwrite((val) => val.startsWith("/") ? val : `/${val}`).meta({ effectType: "input", type: "string" }).describe(
|
|
1514
1532
|
"A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
|
|
@@ -1518,7 +1536,7 @@ var DocumentPath = z11.string().brand("DocumentPath").describe(
|
|
|
1518
1536
|
);
|
|
1519
1537
|
|
|
1520
1538
|
// ../commons/src/events/CompositeFieldValue.ts
|
|
1521
|
-
var z12 = __toESM(require("zod
|
|
1539
|
+
var z12 = __toESM(require("zod"));
|
|
1522
1540
|
var GeographicalArea = {
|
|
1523
1541
|
URBAN: "URBAN",
|
|
1524
1542
|
RURAL: "RURAL"
|
|
@@ -1532,6 +1550,9 @@ var FileFieldValue = z12.object({
|
|
|
1532
1550
|
originalFilename: z12.string(),
|
|
1533
1551
|
type: z12.string()
|
|
1534
1552
|
});
|
|
1553
|
+
function isFileFieldValue(value) {
|
|
1554
|
+
return FileFieldValue.validate(value);
|
|
1555
|
+
}
|
|
1535
1556
|
var NameFieldValue = z12.object({
|
|
1536
1557
|
firstname: z12.string(),
|
|
1537
1558
|
surname: z12.string(),
|
|
@@ -1556,6 +1577,9 @@ var DomesticAddressFieldValue = BaseAddressFieldValue.extend({
|
|
|
1556
1577
|
addressType: z12.literal(AddressType.DOMESTIC),
|
|
1557
1578
|
administrativeArea: z12.string().uuid()
|
|
1558
1579
|
});
|
|
1580
|
+
function isDomesticAddressFieldValue(value) {
|
|
1581
|
+
return DomesticAddressFieldValue.validate(value);
|
|
1582
|
+
}
|
|
1559
1583
|
var InternationalAddressFieldValue = BaseAddressFieldValue.extend({
|
|
1560
1584
|
addressType: z12.literal(AddressType.INTERNATIONAL)
|
|
1561
1585
|
});
|
|
@@ -1563,6 +1587,9 @@ var AddressFieldValue = z12.discriminatedUnion("addressType", [
|
|
|
1563
1587
|
DomesticAddressFieldValue,
|
|
1564
1588
|
InternationalAddressFieldValue
|
|
1565
1589
|
]);
|
|
1590
|
+
function isAddressFieldValue(value) {
|
|
1591
|
+
return AddressFieldValue.validate(value);
|
|
1592
|
+
}
|
|
1566
1593
|
var DomesticAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend({
|
|
1567
1594
|
addressType: z12.literal(AddressType.DOMESTIC),
|
|
1568
1595
|
administrativeArea: z12.string().uuid().nullish()
|
|
@@ -1584,6 +1611,9 @@ var FileFieldValueWithOption = z12.object({
|
|
|
1584
1611
|
option: z12.string()
|
|
1585
1612
|
});
|
|
1586
1613
|
var FileFieldWithOptionValue = z12.array(FileFieldValueWithOption);
|
|
1614
|
+
function isFileFieldWithOptionValue(value) {
|
|
1615
|
+
return FileFieldWithOptionValue.validate(value);
|
|
1616
|
+
}
|
|
1587
1617
|
var HttpFieldValue = z12.object({
|
|
1588
1618
|
loading: z12.boolean(),
|
|
1589
1619
|
error: z12.object({ statusCode: z12.number(), message: z12.string() }).nullish(),
|
|
@@ -1619,6 +1649,7 @@ var CustomFieldValue = z12.unknown().brand("CustomFieldValue");
|
|
|
1619
1649
|
// ../commons/src/events/PlainDate.ts
|
|
1620
1650
|
var import_zod = require("zod");
|
|
1621
1651
|
var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date in the format YYYY-MM-DD");
|
|
1652
|
+
var isPlainDate = (date) => PlainDate.validate(date);
|
|
1622
1653
|
function toPlainDate(dateTime) {
|
|
1623
1654
|
return dateTime.split("T")[0];
|
|
1624
1655
|
}
|
|
@@ -1734,7 +1765,7 @@ function safeUnion(schemas) {
|
|
|
1734
1765
|
);
|
|
1735
1766
|
return z14.any().superRefine((val, ctx) => {
|
|
1736
1767
|
for (const schema of sortedSchemas) {
|
|
1737
|
-
if (schema.
|
|
1768
|
+
if (schema.validate(val)) {
|
|
1738
1769
|
return;
|
|
1739
1770
|
}
|
|
1740
1771
|
}
|
|
@@ -2023,6 +2054,7 @@ var ActionDocument = z16.discriminatedUnion("type", [
|
|
|
2023
2054
|
]).meta({
|
|
2024
2055
|
id: "ActionDocument"
|
|
2025
2056
|
});
|
|
2057
|
+
var isActionDocument = (a) => ActionDocument.validate(a);
|
|
2026
2058
|
var AsyncRejectActionDocument = ActionBase.omit({
|
|
2027
2059
|
declaration: true,
|
|
2028
2060
|
annotation: true
|
|
@@ -2259,6 +2291,12 @@ var AnyOfStatus = import_v4.z.object({
|
|
|
2259
2291
|
}).meta({
|
|
2260
2292
|
id: "AnyOfStatus"
|
|
2261
2293
|
});
|
|
2294
|
+
var NoneOfStatus = import_v4.z.object({
|
|
2295
|
+
type: import_v4.z.literal("noneOf"),
|
|
2296
|
+
terms: import_v4.z.array(EventStatus)
|
|
2297
|
+
}).meta({
|
|
2298
|
+
id: "NoneOfStatus"
|
|
2299
|
+
});
|
|
2262
2300
|
var Range = import_v4.z.object({
|
|
2263
2301
|
type: import_v4.z.literal("range"),
|
|
2264
2302
|
gte: import_v4.z.string(),
|
|
@@ -2299,7 +2337,7 @@ var QueryInput = import_v4.z.lazy(
|
|
|
2299
2337
|
var QueryExpression = import_v4.z.object({
|
|
2300
2338
|
id: import_v4.z.optional(import_v4.z.string()),
|
|
2301
2339
|
eventType: import_v4.z.string(),
|
|
2302
|
-
status: import_v4.z.optional(import_v4.z.union([AnyOfStatus, ExactStatus])),
|
|
2340
|
+
status: import_v4.z.optional(import_v4.z.union([AnyOfStatus, NoneOfStatus, ExactStatus])),
|
|
2303
2341
|
createdAt: import_v4.z.optional(DateCondition),
|
|
2304
2342
|
updatedAt: import_v4.z.optional(DateCondition),
|
|
2305
2343
|
"legalStatuses.DECLARED.createdAtLocation": import_v4.z.optional(Within).nullable(),
|
|
@@ -3509,6 +3547,12 @@ var ReadActionConfig = ActionConfigBase.extend(
|
|
|
3509
3547
|
var NotifyConfig = ActionConfigBase.extend(
|
|
3510
3548
|
z25.object({
|
|
3511
3549
|
type: z25.literal(ActionType.NOTIFY),
|
|
3550
|
+
notificationForm: DeclarationFormConfig.optional().describe(
|
|
3551
|
+
"Notification form configuration. Its fields must be a subset of the declaration form fields, with matching types. The values submitted on the notification form pre-fill the declaration. If not defined, the declare action's declaration is used (with all fields optional)."
|
|
3552
|
+
),
|
|
3553
|
+
review: DeclarationReviewConfig.describe(
|
|
3554
|
+
"Review page configuration for the notify action. Values of its fields are stored as the NOTIFY action annotation. If not defined, defineConfig generates it from the declare action's review (with all fields optional)."
|
|
3555
|
+
),
|
|
3512
3556
|
form: actionConfirmationForm
|
|
3513
3557
|
}).shape
|
|
3514
3558
|
);
|
|
@@ -3690,11 +3734,11 @@ var ActionConfig = z25.discriminatedUnion("type", [
|
|
|
3690
3734
|
}),
|
|
3691
3735
|
NotifyConfig.meta({
|
|
3692
3736
|
id: "NotifyActionConfig",
|
|
3693
|
-
description: "Configuration for the notify action
|
|
3737
|
+
description: "Configuration for the notify action, including the notification form and its review page. When undefined, it is generated using the DeclareActionConfig."
|
|
3694
3738
|
}),
|
|
3695
3739
|
DeclareConfig.meta({
|
|
3696
3740
|
id: "DeclareActionConfig",
|
|
3697
|
-
description: "Configuration for the declare action. Includes review-page fields.
|
|
3741
|
+
description: "Configuration for the declare action. Includes the declaration form and review-page fields."
|
|
3698
3742
|
}),
|
|
3699
3743
|
DuplicateDetectedConfig.meta({
|
|
3700
3744
|
id: "DuplicateDetectedActionConfig",
|
|
@@ -4686,15 +4730,6 @@ var INHERENT_FLAG_RULES = [
|
|
|
4686
4730
|
setOn: [ActionType.REQUEST_CORRECTION],
|
|
4687
4731
|
resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
|
|
4688
4732
|
},
|
|
4689
|
-
{
|
|
4690
|
-
// INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
|
|
4691
|
-
// other status-changing action (see getStatusFromActions). ARCHIVE/UNARCHIVE
|
|
4692
|
-
// are deliberately excluded so the flag freezes across an archive/unarchive
|
|
4693
|
-
// round trip and comes back exactly as it was.
|
|
4694
|
-
flag: InherentFlags.INCOMPLETE,
|
|
4695
|
-
setOn: [ActionType.NOTIFY],
|
|
4696
|
-
resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
|
|
4697
|
-
},
|
|
4698
4733
|
{
|
|
4699
4734
|
flag: InherentFlags.REJECTED,
|
|
4700
4735
|
setOn: [ActionType.REJECT],
|
|
@@ -5542,35 +5577,24 @@ function resolveDateOfEvent(eventIndex, declaration, config) {
|
|
|
5542
5577
|
if (!config.dateOfEvent) {
|
|
5543
5578
|
return extractDateString(eventIndex[DEFAULT_DATE_OF_EVENT_PROPERTY]);
|
|
5544
5579
|
}
|
|
5545
|
-
|
|
5546
|
-
|
|
5580
|
+
if (isFieldReference(config.dateOfEvent)) {
|
|
5581
|
+
const fieldDate = declaration[config.dateOfEvent.$$field];
|
|
5582
|
+
return ZodDate.validate(fieldDate) ? extractDateString(fieldDate) : void 0;
|
|
5583
|
+
}
|
|
5584
|
+
const eventDate = getMixedPath(
|
|
5585
|
+
eventIndex,
|
|
5586
|
+
config.dateOfEvent.$$event
|
|
5547
5587
|
);
|
|
5548
|
-
return
|
|
5588
|
+
return ZodDateTime.validate(eventDate) ? extractDateString(eventDate) : void 0;
|
|
5549
5589
|
}
|
|
5550
5590
|
var DEFAULT_PLACE_OF_EVENT_PROPERTY = "createdAtLocation";
|
|
5551
|
-
function getParsedUUID(value, oldValue) {
|
|
5552
|
-
const parsed = UUID.safeParse(value);
|
|
5553
|
-
return parsed.success ? parsed.data : oldValue;
|
|
5554
|
-
}
|
|
5555
5591
|
function resolvePlaceOfEvent(eventMetadata, declaration, config) {
|
|
5556
|
-
let placeOfEvent =
|
|
5592
|
+
let placeOfEvent = maybeUuid(
|
|
5557
5593
|
eventMetadata[DEFAULT_PLACE_OF_EVENT_PROPERTY]
|
|
5558
5594
|
);
|
|
5559
5595
|
if (config.placeOfEvent) {
|
|
5560
|
-
const addressFieldValue =
|
|
5561
|
-
|
|
5562
|
-
);
|
|
5563
|
-
if (addressFieldValue.success && addressFieldValue.data.addressType === AddressType.DOMESTIC && addressFieldValue.data.administrativeArea) {
|
|
5564
|
-
placeOfEvent = getParsedUUID(
|
|
5565
|
-
addressFieldValue.data.administrativeArea,
|
|
5566
|
-
placeOfEvent
|
|
5567
|
-
);
|
|
5568
|
-
} else {
|
|
5569
|
-
placeOfEvent = getParsedUUID(
|
|
5570
|
-
declaration[config.placeOfEvent.$$field],
|
|
5571
|
-
placeOfEvent
|
|
5572
|
-
);
|
|
5573
|
-
}
|
|
5596
|
+
const addressFieldValue = declaration[config.placeOfEvent.$$field];
|
|
5597
|
+
placeOfEvent = isDomesticAddressFieldValue(addressFieldValue) ? maybeUuid(addressFieldValue.administrativeArea) ?? placeOfEvent : maybeUuid(declaration[config.placeOfEvent.$$field]) ?? placeOfEvent;
|
|
5574
5598
|
}
|
|
5575
5599
|
return placeOfEvent;
|
|
5576
5600
|
}
|
|
@@ -5855,7 +5879,7 @@ function precompileActionSchemas(eventConfigurations) {
|
|
|
5855
5879
|
}
|
|
5856
5880
|
}
|
|
5857
5881
|
function isAgeValue(value) {
|
|
5858
|
-
return
|
|
5882
|
+
return AgeValue.validate(value);
|
|
5859
5883
|
}
|
|
5860
5884
|
function mergeWithBaseFormState(values, context) {
|
|
5861
5885
|
return { ...context.baseFormState, ...values };
|
|
@@ -5885,15 +5909,13 @@ function validate(schema, data) {
|
|
|
5885
5909
|
return [key, value];
|
|
5886
5910
|
}
|
|
5887
5911
|
const age = value.age;
|
|
5888
|
-
const
|
|
5912
|
+
const asOf = data.$form[value.asOfDateRef];
|
|
5913
|
+
const asOfDate = isPlainDate(asOf) ? asOf : PlainDate.parse(data.$now);
|
|
5889
5914
|
return [
|
|
5890
5915
|
key,
|
|
5891
5916
|
{
|
|
5892
5917
|
age,
|
|
5893
|
-
dob: ageToDate(
|
|
5894
|
-
age,
|
|
5895
|
-
maybeAsOfDate.success ? maybeAsOfDate.data : PlainDate.parse(data.$now)
|
|
5896
|
-
)
|
|
5918
|
+
dob: ageToDate(age, asOfDate)
|
|
5897
5919
|
}
|
|
5898
5920
|
];
|
|
5899
5921
|
});
|
|
@@ -6056,6 +6078,11 @@ var errorMessages = {
|
|
|
6056
6078
|
description: "Error message when field is not expected",
|
|
6057
6079
|
id: "error.unexpectedField"
|
|
6058
6080
|
},
|
|
6081
|
+
notInNotifyForm: {
|
|
6082
|
+
defaultMessage: "Field is not part of the notify form. Notify-only data belongs in annotation",
|
|
6083
|
+
description: "Error message when a notify declaration contains a field outside the notify form",
|
|
6084
|
+
id: "error.notInNotifyForm"
|
|
6085
|
+
},
|
|
6059
6086
|
correctionNotAllowed: {
|
|
6060
6087
|
defaultMessage: "Correction not allowed for field",
|
|
6061
6088
|
description: "Error message when correction is not allowed for field",
|
|
@@ -6269,6 +6296,34 @@ function areCertificateConditionsMet(conditions, values) {
|
|
|
6269
6296
|
});
|
|
6270
6297
|
}
|
|
6271
6298
|
|
|
6299
|
+
// ../commons/src/events/notificationFormFallback.ts
|
|
6300
|
+
function toOptionalField(field3) {
|
|
6301
|
+
const { validation: _validation, ...rest } = field3;
|
|
6302
|
+
if (rest.type === FieldType.FIELD_GROUP && "fields" in rest) {
|
|
6303
|
+
return {
|
|
6304
|
+
...rest,
|
|
6305
|
+
required: false,
|
|
6306
|
+
fields: rest.fields.map(toOptionalField)
|
|
6307
|
+
};
|
|
6308
|
+
}
|
|
6309
|
+
return { ...rest, required: false };
|
|
6310
|
+
}
|
|
6311
|
+
function deriveNotificationForm(declaration) {
|
|
6312
|
+
return {
|
|
6313
|
+
...declaration,
|
|
6314
|
+
pages: declaration.pages.map((page) => ({
|
|
6315
|
+
...page,
|
|
6316
|
+
fields: page.fields.map(toOptionalField)
|
|
6317
|
+
}))
|
|
6318
|
+
};
|
|
6319
|
+
}
|
|
6320
|
+
function generateNotifyReview(declareReview) {
|
|
6321
|
+
return {
|
|
6322
|
+
...declareReview,
|
|
6323
|
+
fields: declareReview.fields.map(toOptionalField)
|
|
6324
|
+
};
|
|
6325
|
+
}
|
|
6326
|
+
|
|
6272
6327
|
// ../commons/src/events/utils.ts
|
|
6273
6328
|
var import_date_fns3 = require("date-fns");
|
|
6274
6329
|
function ageToDate(age, asOfDate) {
|
|
@@ -6292,6 +6347,34 @@ function getDeclarationPages(configuration) {
|
|
|
6292
6347
|
function getDeclarationFields(configuration) {
|
|
6293
6348
|
return getDeclarationPages(configuration).flatMap(({ fields }) => fields);
|
|
6294
6349
|
}
|
|
6350
|
+
function getConfiguredNotificationForm(configuration) {
|
|
6351
|
+
const notifyAction = configuration.actions.find(
|
|
6352
|
+
(action) => action.type === ActionType.NOTIFY
|
|
6353
|
+
);
|
|
6354
|
+
return notifyAction?.type === ActionType.NOTIFY ? notifyAction.notificationForm : void 0;
|
|
6355
|
+
}
|
|
6356
|
+
var derivedNotificationForms = /* @__PURE__ */ new WeakMap();
|
|
6357
|
+
function getNotificationForm(configuration) {
|
|
6358
|
+
const configured = getConfiguredNotificationForm(configuration);
|
|
6359
|
+
if (configured) {
|
|
6360
|
+
return configured;
|
|
6361
|
+
}
|
|
6362
|
+
const cached = derivedNotificationForms.get(configuration);
|
|
6363
|
+
if (cached) {
|
|
6364
|
+
return cached;
|
|
6365
|
+
}
|
|
6366
|
+
const derived = deriveNotificationForm(getDeclaration(configuration));
|
|
6367
|
+
derivedNotificationForms.set(configuration, derived);
|
|
6368
|
+
return derived;
|
|
6369
|
+
}
|
|
6370
|
+
function getNotificationFields(configuration) {
|
|
6371
|
+
return getNotificationForm(configuration).pages.flatMap(
|
|
6372
|
+
({ fields }) => fields
|
|
6373
|
+
);
|
|
6374
|
+
}
|
|
6375
|
+
function getActionForm(configuration, actionType) {
|
|
6376
|
+
return actionType === ActionType.NOTIFY ? getNotificationForm(configuration) : getDeclaration(configuration);
|
|
6377
|
+
}
|
|
6295
6378
|
function isActionConfigType(type) {
|
|
6296
6379
|
return actionConfigTypes.has(type);
|
|
6297
6380
|
}
|
|
@@ -6300,9 +6383,6 @@ function getActionConfig({
|
|
|
6300
6383
|
actionType,
|
|
6301
6384
|
customActionType
|
|
6302
6385
|
}) {
|
|
6303
|
-
if (actionType === ActionType.NOTIFY) {
|
|
6304
|
-
return eventConfiguration.actions.find((a) => a.type === ActionType.NOTIFY) ?? eventConfiguration.actions.find((a) => a.type === ActionType.DECLARE);
|
|
6305
|
-
}
|
|
6306
6386
|
return eventConfiguration.actions.find((a) => {
|
|
6307
6387
|
if (a.type === ActionType.CUSTOM && customActionType) {
|
|
6308
6388
|
return a.customActionType === customActionType;
|
|
@@ -6550,11 +6630,15 @@ function flattenFieldReference(ref) {
|
|
|
6550
6630
|
return [ref.$$field, ...ref.$$subfield];
|
|
6551
6631
|
}
|
|
6552
6632
|
function isWriteAction(actionType) {
|
|
6553
|
-
return writeActions.
|
|
6633
|
+
return writeActions.validate(actionType);
|
|
6554
6634
|
}
|
|
6555
6635
|
var findAllFields = (config) => {
|
|
6556
6636
|
return (0, import_lodash4.flattenDeep)([
|
|
6557
6637
|
...getDeclarationFields(config),
|
|
6638
|
+
// Only a configured notification form: a derived one repeats the declaration fields.
|
|
6639
|
+
...getConfiguredNotificationForm(config)?.pages.flatMap(
|
|
6640
|
+
({ fields }) => fields
|
|
6641
|
+
) ?? [],
|
|
6558
6642
|
...getAllAnnotationFields(config)
|
|
6559
6643
|
]);
|
|
6560
6644
|
};
|
|
@@ -6948,6 +7032,50 @@ function validateDeclarationGivenExactlyOnce(config, ctx) {
|
|
|
6948
7032
|
});
|
|
6949
7033
|
}
|
|
6950
7034
|
}
|
|
7035
|
+
function validateNotificationForm(event2, ctx) {
|
|
7036
|
+
const declarationFields = getDeclarationPages(event2).flatMap(
|
|
7037
|
+
(page) => page.fields.map((field3) => ({ field: field3, pageId: page.id }))
|
|
7038
|
+
);
|
|
7039
|
+
event2.actions.forEach((action, actionIndex) => {
|
|
7040
|
+
if (action.type !== ActionType.NOTIFY || !action.notificationForm) {
|
|
7041
|
+
return;
|
|
7042
|
+
}
|
|
7043
|
+
action.notificationForm.pages.forEach((page, pageIndex) => {
|
|
7044
|
+
page.fields.forEach((field3, fieldIndex) => {
|
|
7045
|
+
const path = [
|
|
7046
|
+
"actions",
|
|
7047
|
+
actionIndex,
|
|
7048
|
+
"notificationForm",
|
|
7049
|
+
"pages",
|
|
7050
|
+
pageIndex,
|
|
7051
|
+
"fields",
|
|
7052
|
+
fieldIndex
|
|
7053
|
+
];
|
|
7054
|
+
const matchingFields = declarationFields.filter(
|
|
7055
|
+
(declarationField) => declarationField.field.id === field3.id
|
|
7056
|
+
);
|
|
7057
|
+
if (matchingFields.length === 0) {
|
|
7058
|
+
ctx.addIssue({
|
|
7059
|
+
code: "custom",
|
|
7060
|
+
message: `Notification form field '${field3.id}' does not exist in the declaration form of event '${event2.id}'. Notification form fields must also be defined in the ${ActionType.DECLARE} action's declaration.`,
|
|
7061
|
+
path
|
|
7062
|
+
});
|
|
7063
|
+
return;
|
|
7064
|
+
}
|
|
7065
|
+
if (!matchingFields.some(
|
|
7066
|
+
(declarationField) => declarationField.field.type === field3.type
|
|
7067
|
+
)) {
|
|
7068
|
+
const [declarationField] = matchingFields;
|
|
7069
|
+
ctx.addIssue({
|
|
7070
|
+
code: "custom",
|
|
7071
|
+
message: `Notification form field '${field3.id}' on page '${page.id}' is of type ${field3.type}, but the declaration form field with the same id in event '${event2.id}' (${ActionType.DECLARE} declaration, page '${declarationField.pageId}') is of type ${declarationField.field.type}.`,
|
|
7072
|
+
path
|
|
7073
|
+
});
|
|
7074
|
+
}
|
|
7075
|
+
});
|
|
7076
|
+
});
|
|
7077
|
+
});
|
|
7078
|
+
}
|
|
6951
7079
|
|
|
6952
7080
|
// ../commons/src/events/EventConfig.ts
|
|
6953
7081
|
var EventFieldReference = z35.object({ $$event: EventMetadataDateFieldIdInput }).describe(
|
|
@@ -6998,6 +7126,7 @@ var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
|
|
|
6998
7126
|
if (!validateExactlyOneDeclareAction(event2, ctx)) {
|
|
6999
7127
|
return;
|
|
7000
7128
|
}
|
|
7129
|
+
validateNotificationForm(event2, ctx);
|
|
7001
7130
|
validateAdvancedSearchConfig(event2, ctx);
|
|
7002
7131
|
validateDateOfEvent(event2, ctx);
|
|
7003
7132
|
validatePlaceOfEvent(event2, ctx);
|
|
@@ -7079,7 +7208,7 @@ function createSearchConfig(baseField) {
|
|
|
7079
7208
|
|
|
7080
7209
|
// ../commons/src/event-config/event-configuration.ts
|
|
7081
7210
|
function isNonSearchableEventMetadataTimeFieldId(fieldId) {
|
|
7082
|
-
return !EventFieldIdInput.
|
|
7211
|
+
return !EventFieldIdInput.validate(fieldId);
|
|
7083
7212
|
}
|
|
7084
7213
|
function createEventFieldConfig(fieldId) {
|
|
7085
7214
|
const baseField = {
|
|
@@ -7261,7 +7390,7 @@ var SerializableWithin = z37.object({
|
|
|
7261
7390
|
});
|
|
7262
7391
|
var SerializedQueryExpression = z37.object({
|
|
7263
7392
|
eventType: z37.string(),
|
|
7264
|
-
status: z37.optional(z37.union([AnyOfStatus, ExactStatus])),
|
|
7393
|
+
status: z37.optional(z37.union([AnyOfStatus, NoneOfStatus, ExactStatus])),
|
|
7265
7394
|
createdAt: z37.optional(DateCondition),
|
|
7266
7395
|
updatedAt: z37.optional(DateCondition),
|
|
7267
7396
|
"legalStatuses.DECLARED.createdAtLocation": z37.optional(SerializableWithin),
|
|
@@ -7431,6 +7560,12 @@ var RegisterActionInput = BaseActionInput.extend(
|
|
|
7431
7560
|
var NotifyActionInput = BaseActionInput.extend(
|
|
7432
7561
|
z39.object({
|
|
7433
7562
|
type: z39.literal(ActionType.NOTIFY).default(ActionType.NOTIFY),
|
|
7563
|
+
declaration: BaseActionInput.shape.declaration.describe(
|
|
7564
|
+
"Values for fields of the notification form, keyed by field id. Fields outside the notification form are rejected. Only these values become part of the record declaration, so any id that needs to be searchable must be a declaration field."
|
|
7565
|
+
),
|
|
7566
|
+
annotation: BaseActionInput.shape.annotation.describe(
|
|
7567
|
+
"Values for notify-only fields (NOTIFY review and form fields), keyed by field id. These are stored on the NOTIFY action, not in the record declaration."
|
|
7568
|
+
),
|
|
7434
7569
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
7435
7570
|
createdAtLocation: UUID.nullish().describe(
|
|
7436
7571
|
"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."
|
|
@@ -7673,11 +7808,56 @@ function moveDeclarationToDeclareAction({
|
|
|
7673
7808
|
)
|
|
7674
7809
|
};
|
|
7675
7810
|
}
|
|
7811
|
+
function generateNotificationFormFallback(config) {
|
|
7812
|
+
const declareAction = config.actions.find(
|
|
7813
|
+
(action) => action.type === ActionType.DECLARE
|
|
7814
|
+
);
|
|
7815
|
+
const notifyAction = config.actions.find(
|
|
7816
|
+
(action) => action.type === ActionType.NOTIFY
|
|
7817
|
+
);
|
|
7818
|
+
if (!notifyAction?.notificationForm) {
|
|
7819
|
+
console.warn(
|
|
7820
|
+
`Event '${config.id}' has no ${ActionType.NOTIFY} form. Using the ${ActionType.DECLARE} form with all fields optional. Configure \`actions[${ActionType.NOTIFY}].notificationForm\`. This fallback will be removed in a future release.`
|
|
7821
|
+
);
|
|
7822
|
+
}
|
|
7823
|
+
if (notifyAction?.review) {
|
|
7824
|
+
return config;
|
|
7825
|
+
}
|
|
7826
|
+
if (!declareAction?.declaration) {
|
|
7827
|
+
throw new Error(
|
|
7828
|
+
`Event '${config.id}' has no ${ActionType.DECLARE} form. Configure \`actions[${ActionType.DECLARE}].declaration\`.`
|
|
7829
|
+
);
|
|
7830
|
+
}
|
|
7831
|
+
const review = generateNotifyReview(declareAction.review);
|
|
7832
|
+
if (notifyAction) {
|
|
7833
|
+
return {
|
|
7834
|
+
...config,
|
|
7835
|
+
actions: config.actions.map(
|
|
7836
|
+
(action) => action === notifyAction ? { ...notifyAction, review } : action
|
|
7837
|
+
)
|
|
7838
|
+
};
|
|
7839
|
+
}
|
|
7840
|
+
const notifyFromDeclare = {
|
|
7841
|
+
type: ActionType.NOTIFY,
|
|
7842
|
+
label: declareAction.label,
|
|
7843
|
+
icon: declareAction.icon,
|
|
7844
|
+
conditionals: declareAction.conditionals,
|
|
7845
|
+
flags: declareAction.flags,
|
|
7846
|
+
supportingCopy: declareAction.dialogCopy?.notify,
|
|
7847
|
+
review
|
|
7848
|
+
};
|
|
7849
|
+
return {
|
|
7850
|
+
...config,
|
|
7851
|
+
actions: config.actions.flatMap(
|
|
7852
|
+
(action) => action === declareAction ? [notifyFromDeclare, action] : [action]
|
|
7853
|
+
)
|
|
7854
|
+
};
|
|
7855
|
+
}
|
|
7676
7856
|
var EventConfigDefinition = z43.custom().superRefine((config, ctx) => {
|
|
7677
7857
|
if (validateExactlyOneDeclareAction(config, ctx)) {
|
|
7678
7858
|
validateDeclarationGivenExactlyOnce(config, ctx);
|
|
7679
7859
|
}
|
|
7680
|
-
}).transform(moveDeclarationToDeclareAction).pipe(EventConfig);
|
|
7860
|
+
}).transform(moveDeclarationToDeclareAction).transform(generateNotificationFormFallback).pipe(EventConfig);
|
|
7681
7861
|
var defineConfig = (config) => EventConfigDefinition.parse(config);
|
|
7682
7862
|
|
|
7683
7863
|
// ../commons/src/events/transactions.ts
|
|
@@ -10462,8 +10642,8 @@ function userCanAccessEventWithScopes(event2, scopes, user2, customActionType) {
|
|
|
10462
10642
|
}
|
|
10463
10643
|
function getAdministrativeAreaHierarchy(administrativeAreaId, administrativeAreas) {
|
|
10464
10644
|
const collectedLocations = [];
|
|
10465
|
-
const
|
|
10466
|
-
let current =
|
|
10645
|
+
const maybeAdministrativeAreaId = maybeUuid(administrativeAreaId);
|
|
10646
|
+
let current = maybeAdministrativeAreaId ? administrativeAreas.get(maybeAdministrativeAreaId) : null;
|
|
10467
10647
|
while (current) {
|
|
10468
10648
|
collectedLocations.push(current);
|
|
10469
10649
|
if (!current.parentId) {
|
|
@@ -11063,11 +11243,10 @@ function fieldConfigsToActionPayload(fields, rng, administrativeHierarchy) {
|
|
|
11063
11243
|
);
|
|
11064
11244
|
}
|
|
11065
11245
|
function generateActionDeclarationInput(configuration, action, rng, overrides, administrativeHierarchy) {
|
|
11066
|
-
const parsed = DeclarationUpdateActions.safeParse(action);
|
|
11067
11246
|
if ((0, import_lodash5.isEmpty)(overrides) && typeof overrides === "object") {
|
|
11068
11247
|
return {};
|
|
11069
11248
|
}
|
|
11070
|
-
if (
|
|
11249
|
+
if (DeclarationUpdateActions.validate(action)) {
|
|
11071
11250
|
const fields = getDeclarationFields(configuration);
|
|
11072
11251
|
const declarationConfig = getDeclaration(configuration);
|
|
11073
11252
|
const declaration = fieldConfigsToActionPayload(
|
|
@@ -11701,9 +11880,16 @@ var generateEventConfig = ({
|
|
|
11701
11880
|
function withDeclaration(configuration, declaration) {
|
|
11702
11881
|
return {
|
|
11703
11882
|
...configuration,
|
|
11704
|
-
actions: configuration.actions.map(
|
|
11705
|
-
(action
|
|
11706
|
-
|
|
11883
|
+
actions: configuration.actions.map((action) => {
|
|
11884
|
+
if (action.type === ActionType.DECLARE) {
|
|
11885
|
+
return { ...action, declaration };
|
|
11886
|
+
}
|
|
11887
|
+
if (action.type === ActionType.NOTIFY) {
|
|
11888
|
+
const { notificationForm: _notificationForm, ...notifyAction } = action;
|
|
11889
|
+
return notifyAction;
|
|
11890
|
+
}
|
|
11891
|
+
return action;
|
|
11892
|
+
})
|
|
11707
11893
|
};
|
|
11708
11894
|
}
|
|
11709
11895
|
function getLeafAdministrativeAreaIds(administrativeAreas) {
|
|
@@ -11767,7 +11953,7 @@ function isTemplateVariable(value) {
|
|
|
11767
11953
|
return typeof value === "string" && value.startsWith("$");
|
|
11768
11954
|
}
|
|
11769
11955
|
function isFieldValue(value) {
|
|
11770
|
-
return FieldValue.
|
|
11956
|
+
return FieldValue.validate(value);
|
|
11771
11957
|
}
|
|
11772
11958
|
function isFieldValueWithoutTemplates(value) {
|
|
11773
11959
|
if (isTemplateVariable(value)) {
|
|
@@ -12119,13 +12305,11 @@ function getFilePathsFromEvent(event2) {
|
|
|
12119
12305
|
...declarationValues,
|
|
12120
12306
|
...annotationValues
|
|
12121
12307
|
].flatMap((value) => {
|
|
12122
|
-
|
|
12123
|
-
|
|
12124
|
-
return [fileParsed.data.path];
|
|
12308
|
+
if (isFileFieldValue(value)) {
|
|
12309
|
+
return [value.path];
|
|
12125
12310
|
}
|
|
12126
|
-
|
|
12127
|
-
|
|
12128
|
-
return fileOptionParsed.data.map((val) => val.path);
|
|
12311
|
+
if (isFileFieldWithOptionValue(value)) {
|
|
12312
|
+
return value.map((val) => val.path);
|
|
12129
12313
|
}
|
|
12130
12314
|
return [];
|
|
12131
12315
|
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run the upgrade process for the country config in the current working
|
|
3
|
+
* directory.
|
|
4
|
+
*
|
|
5
|
+
* @param toolkitVersion the version of the toolkit running the upgrade, e.g.
|
|
6
|
+
* `2.2.0` or `2.2.0-rc.1`. The country config is upgraded to its major.minor.
|
|
7
|
+
*/
|
|
8
|
+
export declare function runUpgrade(toolkitVersion: string): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAgBA;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,cAAc,EAAE,MAAM,iBAStD"}
|