@opencrvs/toolkit 1.9.14 → 2.0.0-rc.013c085
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 +13 -0
- package/create-countryconfig/index.js +103 -0
- package/create-countryconfig/package.json +21 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/application-config/index.d.ts +2 -0
- package/dist/application-config/index.d.ts.map +1 -0
- package/dist/application-config/index.js +2304 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +5238 -0
- package/dist/commons/api/router.d.ts +5630 -3673
- package/dist/commons/application-config/index.d.ts +97 -0
- package/dist/commons/conditionals/conditionals.d.ts +33 -3
- package/dist/commons/conditionals/validate.d.ts +20 -1
- package/dist/commons/events/ActionConfig.d.ts +415 -1555
- package/dist/commons/events/ActionDocument.d.ts +894 -1941
- package/dist/commons/events/ActionInput.d.ts +326 -1212
- package/dist/commons/events/ActionType.d.ts +91 -11
- package/dist/commons/events/AdvancedSearchConfig.d.ts +294 -1496
- package/dist/commons/events/AuditLog.d.ts +407 -0
- package/dist/commons/events/CompositeFieldValue.d.ts +30 -190
- package/dist/commons/events/Conditional.d.ts +26 -38
- package/dist/commons/events/Constants.d.ts +1 -1
- package/dist/commons/events/CountryConfigQueryInput.d.ts +1592 -4471
- package/dist/commons/events/DeduplicationConfig.d.ts +15 -171
- package/dist/commons/events/Draft.d.ts +72 -111
- package/dist/commons/events/DynamicFieldValue.d.ts +12 -78
- package/dist/commons/events/EventConfig.d.ts +37 -2427
- package/dist/commons/events/EventConfigInput.d.ts +0 -3
- package/dist/commons/events/EventDocument.d.ts +357 -1366
- package/dist/commons/events/EventIndex.d.ts +211 -1012
- package/dist/commons/events/EventInput.d.ts +3 -8
- package/dist/commons/events/EventMetadata.d.ts +129 -363
- package/dist/commons/events/FieldConfig.d.ts +3147 -14211
- package/dist/commons/events/FieldType.d.ts +26 -4
- package/dist/commons/events/FieldTypeMapping.d.ts +314 -906
- package/dist/commons/events/FieldValue.d.ts +154 -526
- package/dist/commons/events/FileUtils.d.ts +2 -2
- package/dist/commons/events/Flag.d.ts +67 -0
- package/dist/commons/events/FormConfig.d.ts +54 -721
- package/dist/commons/events/PageConfig.d.ts +58 -320
- package/dist/commons/events/PlainDate.d.ts +1 -1
- package/dist/commons/events/SummaryConfig.d.ts +14 -161
- package/dist/commons/events/TemplateConfig.d.ts +2 -3
- package/dist/commons/events/TranslationConfig.d.ts +2 -2
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +74 -37
- package/dist/commons/events/WorkqueueConfig.d.ts +2232 -7577
- package/dist/commons/events/deduplication.d.ts +3 -3
- package/dist/commons/events/defineConfig.d.ts +2 -248
- package/dist/commons/events/eventConfigValidation.d.ts +8 -0
- package/dist/commons/events/index.d.ts +5 -0
- package/dist/commons/events/locations.d.ts +93 -19
- package/dist/commons/events/mocks.test.utils.d.ts +19 -0
- package/dist/commons/events/scopes.d.ts +56 -32
- package/dist/commons/events/state/availableActions.d.ts +7 -2
- package/dist/commons/events/state/flags.d.ts +37 -3
- package/dist/commons/events/state/index.d.ts +29 -30
- package/dist/commons/events/state/utils.d.ts +191 -172
- package/dist/commons/events/test.utils.d.ts +52 -11
- package/dist/commons/events/transactions.d.ts +1 -1
- package/dist/commons/events/utils.d.ts +383 -273
- package/dist/commons/notification/UserNotifications.d.ts +76 -637
- package/dist/conditionals/index.d.ts.map +1 -1
- package/dist/conditionals/index.js +338 -14
- package/dist/events/deduplication.d.ts +3 -3
- package/dist/events/index.js +3680 -2227
- 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 +429 -0
- package/dist/migrations/v2.0/add-resend-invite-notification.d.ts +3 -0
- package/dist/migrations/v2.0/add-resend-invite-notification.d.ts.map +1 -0
- package/dist/migrations/v2.0/add-resend-invite-notification.js +373 -0
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +22 -0
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -0
- package/dist/migrations/v2.0/checkout-upstream-files.js +146 -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 +828 -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 +158 -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 +325 -0
- package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +11 -0
- package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -0
- package/dist/migrations/v2.0/delete-infrastructure-directory.js +123 -0
- package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +3 -0
- package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +1 -0
- package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +110 -0
- package/dist/migrations/v2.0/index.d.ts +13 -0
- package/dist/migrations/v2.0/index.d.ts.map +1 -0
- package/dist/migrations/v2.0/index.js +5148 -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 +432 -0
- package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +13 -0
- package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -0
- package/dist/migrations/v2.0/merge-infrastructure-directory.js +222 -0
- package/dist/migrations/v2.0/migrate-application-config-url.d.ts +3 -0
- package/dist/migrations/v2.0/migrate-application-config-url.d.ts.map +1 -0
- package/dist/migrations/v2.0/migrate-application-config-url.js +342 -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 +305 -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 +267 -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 +317 -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 +156 -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 +74 -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 +96 -0
- package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts +3 -0
- package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-fhir-url-helpers.js +163 -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 +77 -0
- package/dist/migrations/v2.0/remove-old-statistics-service.d.ts +3 -0
- package/dist/migrations/v2.0/remove-old-statistics-service.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-old-statistics-service.js +356 -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 +109 -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 +163 -0
- package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts +3 -0
- package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-unused-environment-variables.js +186 -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 +187 -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 +180 -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 +195 -0
- package/dist/migrations/v2.0/update-package-json.d.ts +3 -0
- package/dist/migrations/v2.0/update-package-json.d.ts.map +1 -0
- package/dist/migrations/v2.0/update-package-json.js +105 -0
- package/dist/notification/index.d.ts.map +1 -1
- package/dist/notification/index.js +2727 -1848
- package/dist/scopes/index.d.ts +716 -352
- package/dist/scopes/index.d.ts.map +1 -1
- package/dist/scopes/index.js +376 -299
- package/opencrvs-toolkit-2.0.0-rc.013c085.tgz +0 -0
- package/package.json +14 -4
- package/tsconfig.json +12 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/commons/events/CreatedAtLocation.d.ts +0 -2
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
import { FieldConfig } from './events/FieldConfig';
|
|
3
|
+
export declare const SearchCriteria: z.ZodEnum<{
|
|
4
|
+
NAME: "NAME";
|
|
5
|
+
EMAIL: "EMAIL";
|
|
6
|
+
TRACKING_ID: "TRACKING_ID";
|
|
7
|
+
REGISTRATION_NUMBER: "REGISTRATION_NUMBER";
|
|
8
|
+
NATIONAL_ID: "NATIONAL_ID";
|
|
9
|
+
PHONE_NUMBER: "PHONE_NUMBER";
|
|
10
|
+
}>;
|
|
11
|
+
export declare const ApplicationConfig: z.ZodObject<{
|
|
12
|
+
APPLICATION_NAME: z.ZodString;
|
|
13
|
+
COUNTRY_LOGO: z.ZodObject<{
|
|
14
|
+
fileName: z.ZodString;
|
|
15
|
+
file: z.ZodString;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
SYSTEM_IANA_TIMEZONE: z.ZodString;
|
|
18
|
+
CURRENCY: z.ZodObject<{
|
|
19
|
+
languagesAndCountry: z.ZodArray<z.ZodString>;
|
|
20
|
+
isoCode: z.ZodString;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
ADMIN_STRUCTURE: z.ZodArray<z.ZodObject<{
|
|
23
|
+
id: z.ZodString;
|
|
24
|
+
label: z.ZodObject<import("./events/TranslationConfig").MessageDescriptorZod, z.core.$strip>;
|
|
25
|
+
}, z.core.$strip>>;
|
|
26
|
+
PHONE_NUMBER_PATTERN: z.ZodUnion<[z.ZodString, z.ZodCustom<RegExp, RegExp>]>;
|
|
27
|
+
USER_NOTIFICATION_DELIVERY_METHOD: z.ZodEnum<{
|
|
28
|
+
email: "email";
|
|
29
|
+
sms: "sms";
|
|
30
|
+
}>;
|
|
31
|
+
INFORMANT_NOTIFICATION_DELIVERY_METHOD: z.ZodEnum<{
|
|
32
|
+
email: "email";
|
|
33
|
+
sms: "sms";
|
|
34
|
+
}>;
|
|
35
|
+
SEARCH_DEFAULT_CRITERIA: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
36
|
+
NAME: "NAME";
|
|
37
|
+
EMAIL: "EMAIL";
|
|
38
|
+
TRACKING_ID: "TRACKING_ID";
|
|
39
|
+
REGISTRATION_NUMBER: "REGISTRATION_NUMBER";
|
|
40
|
+
NATIONAL_ID: "NATIONAL_ID";
|
|
41
|
+
PHONE_NUMBER: "PHONE_NUMBER";
|
|
42
|
+
}>>>;
|
|
43
|
+
ADDITIONAL_USER_FIELDS: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodType<FieldConfig, import("./events/FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./events/FieldConfig").FieldConfigInput>>>>>;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
export type ApplicationConfig = z.infer<typeof ApplicationConfig>;
|
|
46
|
+
export declare const defineApplicationConfig: (config: z.input<typeof ApplicationConfig>) => ApplicationConfig;
|
|
47
|
+
export declare const BackgroundConfig: z.ZodObject<{
|
|
48
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
49
|
+
backgroundImage: z.ZodOptional<z.ZodString>;
|
|
50
|
+
imageFit: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
export declare const LoginConfig: z.ZodObject<{
|
|
53
|
+
COUNTRY: z.ZodString;
|
|
54
|
+
LANGUAGES: z.ZodArray<z.ZodString>;
|
|
55
|
+
USER_NOTIFICATION_DELIVERY_METHOD: z.ZodEnum<{
|
|
56
|
+
email: "email";
|
|
57
|
+
sms: "sms";
|
|
58
|
+
}>;
|
|
59
|
+
INFORMANT_NOTIFICATION_DELIVERY_METHOD: z.ZodEnum<{
|
|
60
|
+
email: "email";
|
|
61
|
+
sms: "sms";
|
|
62
|
+
}>;
|
|
63
|
+
PHONE_NUMBER_PATTERN: z.ZodUnion<[z.ZodString, z.ZodCustom<RegExp, RegExp>]>;
|
|
64
|
+
LOGIN_BACKGROUND: z.ZodObject<{
|
|
65
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
66
|
+
backgroundImage: z.ZodOptional<z.ZodString>;
|
|
67
|
+
imageFit: z.ZodOptional<z.ZodString>;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
SENTRY: z.ZodOptional<z.ZodString>;
|
|
70
|
+
}, z.core.$strip>;
|
|
71
|
+
export type LoginConfig = z.infer<typeof LoginConfig>;
|
|
72
|
+
export declare const defineLoginConfig: (config: z.input<typeof LoginConfig>) => LoginConfig;
|
|
73
|
+
export declare const ClientConfig: z.ZodObject<{
|
|
74
|
+
COUNTRY: z.ZodString;
|
|
75
|
+
LANGUAGES: z.ZodArray<z.ZodString>;
|
|
76
|
+
SENTRY: z.ZodOptional<z.ZodString>;
|
|
77
|
+
LOGIN_URL: z.ZodOptional<z.ZodString>;
|
|
78
|
+
REGISTER_BACKGROUND: z.ZodObject<{
|
|
79
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
80
|
+
backgroundImage: z.ZodOptional<z.ZodString>;
|
|
81
|
+
imageFit: z.ZodOptional<z.ZodString>;
|
|
82
|
+
}, z.core.$strip>;
|
|
83
|
+
DASHBOARDS: z.ZodArray<z.ZodObject<{
|
|
84
|
+
id: z.ZodString;
|
|
85
|
+
title: z.ZodObject<import("./events/TranslationConfig").MessageDescriptorZod, z.core.$strip>;
|
|
86
|
+
url: z.ZodString;
|
|
87
|
+
context: z.ZodOptional<z.ZodObject<{
|
|
88
|
+
auth: z.ZodLiteral<"REQUEST_AUTH_TOKEN">;
|
|
89
|
+
}, z.core.$strip>>;
|
|
90
|
+
}, z.core.$strip>>;
|
|
91
|
+
FEATURES: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
92
|
+
V2_EVENTS: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
93
|
+
}, z.core.$strip>>>;
|
|
94
|
+
}, z.core.$strip>;
|
|
95
|
+
export type ClientConfig = z.infer<typeof ClientConfig>;
|
|
96
|
+
export declare const defineClientConfig: (config: z.input<typeof ClientConfig>) => ClientConfig;
|
|
97
|
+
//# sourceMappingURL=application-config.d.ts.map
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { EventDocument } from '../events/EventDocument';
|
|
2
2
|
import { ActionUpdate, EventState } from '../events/ActionDocument';
|
|
3
|
-
import { ITokenPayload as TokenPayload
|
|
3
|
+
import { ITokenPayload as TokenPayload } from '../authentication';
|
|
4
4
|
import { PartialSchema as AjvJSONSchemaType } from 'ajv/dist/types/json-schema';
|
|
5
5
|
import { userSerializer } from '../events/serializers/user/serializer';
|
|
6
6
|
import { UUID } from '../uuid';
|
|
7
7
|
import { todayDateTimeValueSerializer } from '../events/serializers/date/serializer';
|
|
8
|
+
import { EventStatus } from '../events/EventMetadata';
|
|
8
9
|
import { CodeToEvaluate, FieldReference } from '../events/FieldConfig';
|
|
9
10
|
import type { ClientFunctionContext } from './validate';
|
|
10
11
|
/** @knipignore */
|
|
@@ -30,7 +31,11 @@ export type FormConditionalParameters = CommonConditionalParameters & {
|
|
|
30
31
|
id: UUID;
|
|
31
32
|
}>;
|
|
32
33
|
};
|
|
33
|
-
export type
|
|
34
|
+
export type EventStateConditionalParameters = CommonConditionalParameters & {
|
|
35
|
+
$flags: string[];
|
|
36
|
+
$status: EventStatus;
|
|
37
|
+
};
|
|
38
|
+
export type ConditionalParameters = UserConditionalParameters | EventConditionalParameters | FormConditionalParameters | EventStateConditionalParameters;
|
|
34
39
|
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
35
40
|
type AjvJSONSchema = AjvJSONSchemaType<UnionToIntersection<ConditionalParameters>>;
|
|
36
41
|
/**
|
|
@@ -63,6 +68,12 @@ export declare function not(condition: AjvJSONSchema): JSONSchema;
|
|
|
63
68
|
* @returns {JSONSchema} An schema object that always evaluates to false.
|
|
64
69
|
*/
|
|
65
70
|
export declare function never(): JSONSchema;
|
|
71
|
+
/**
|
|
72
|
+
* Returns an JSON Schema object, which is treated as always valid.
|
|
73
|
+
*
|
|
74
|
+
* @returns {JSONSchema} An schema object that always evaluates to true.
|
|
75
|
+
*/
|
|
76
|
+
export declare function always(): JSONSchema;
|
|
66
77
|
/**
|
|
67
78
|
* Generate conditional rules for current date
|
|
68
79
|
*/
|
|
@@ -72,7 +83,7 @@ export declare const now: typeof todayDateTimeValueSerializer;
|
|
|
72
83
|
* Generate conditional rules for user.
|
|
73
84
|
*/
|
|
74
85
|
export declare const user: typeof userSerializer & {
|
|
75
|
-
hasScope: (scope:
|
|
86
|
+
hasScope: (scope: string) => JSONSchema;
|
|
76
87
|
hasRole: (role: string) => JSONSchema;
|
|
77
88
|
isOnline: () => JSONSchema;
|
|
78
89
|
locationLevel: (adminLevelId: string) => {
|
|
@@ -80,11 +91,30 @@ export declare const user: typeof userSerializer & {
|
|
|
80
91
|
$location: string;
|
|
81
92
|
};
|
|
82
93
|
};
|
|
94
|
+
scope: (scope: import("../scopes").ScopeType) => {
|
|
95
|
+
attribute: (option: import("../scopes").ScopeOptionKey) => {
|
|
96
|
+
$scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "user.search" | "workqueue" | "dashboard.view";
|
|
97
|
+
$option: "role" | "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
jurisdiction: (jurisdiction: import("../scopes").JurisdictionFilter | {
|
|
101
|
+
$scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "user.search" | "workqueue" | "dashboard.view";
|
|
102
|
+
$option: "role" | "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
|
|
103
|
+
}) => {
|
|
104
|
+
$jurisdiction: "administrativeArea" | "location" | "all" | {
|
|
105
|
+
$scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "user.search" | "workqueue" | "dashboard.view";
|
|
106
|
+
$option: "role" | "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
|
|
107
|
+
};
|
|
108
|
+
};
|
|
83
109
|
};
|
|
84
110
|
export declare function isFieldReference(value: unknown): value is FieldReference;
|
|
85
111
|
export declare function isEventFieldReference(value: unknown): value is {
|
|
86
112
|
$$event: string;
|
|
87
113
|
};
|
|
114
|
+
/** Check if an event flag is present */
|
|
115
|
+
export declare function flag(flagvalue: string): JSONSchema;
|
|
116
|
+
/** Check if an event flag is present */
|
|
117
|
+
export declare function status(statusValue: EventStatus): JSONSchema;
|
|
88
118
|
/**
|
|
89
119
|
* Generate conditional rules for a form field.
|
|
90
120
|
*
|
|
@@ -7,8 +7,11 @@ import { TranslationConfig } from '../events/TranslationConfig';
|
|
|
7
7
|
import { ITokenPayload } from '../authentication';
|
|
8
8
|
import { UUID } from '../uuid';
|
|
9
9
|
import { FormState } from '../events/utils';
|
|
10
|
+
import { ActionConfig } from '../events/ActionConfig';
|
|
10
11
|
import { ActionType } from '../events/ActionType';
|
|
12
|
+
import { EventConfig } from '../events/EventConfig';
|
|
11
13
|
import { EventDocument } from '../events/EventDocument';
|
|
14
|
+
import { EventIndex } from '../events/EventIndex';
|
|
12
15
|
import { Location } from '../events/locations';
|
|
13
16
|
import { SystemVariables } from '../events/TemplateConfig';
|
|
14
17
|
/** Returns today's date as an ISO date string (YYYY-MM-DD). */
|
|
@@ -33,6 +36,8 @@ export type ClientFunctionContext = {
|
|
|
33
36
|
$window?: SystemVariables['$window'];
|
|
34
37
|
locations?: Location[];
|
|
35
38
|
adminLevelIds?: string[];
|
|
39
|
+
$flags?: string[];
|
|
40
|
+
$status?: string;
|
|
36
41
|
};
|
|
37
42
|
type CompiledClientFunction = (data: FieldValue | undefined, context: ClientFunctionContext) => unknown;
|
|
38
43
|
/**
|
|
@@ -45,15 +50,26 @@ export declare function buildClientFunctionContext(input: {
|
|
|
45
50
|
form: EventState | ActionUpdate;
|
|
46
51
|
validatorContext?: ValidatorContext;
|
|
47
52
|
systemVariables?: SystemVariables;
|
|
53
|
+
/**
|
|
54
|
+
* In real use cases, there can be hundreds of thousands of locations.
|
|
55
|
+
* Make sure that the context contains only the locations that are needed for validation.
|
|
56
|
+
* E.g. if the user is a leaf admin, only the leaf locations under their admin structure are needed.
|
|
57
|
+
* Loading few megabytes of locations to memory just for validation is not efficient and will choke the application.
|
|
58
|
+
*/
|
|
48
59
|
locations?: Location[];
|
|
49
60
|
adminLevelIds?: string[];
|
|
50
61
|
}): ClientFunctionContext;
|
|
51
62
|
export declare function runClientFunction(code: string, data: FieldValue | undefined, context: ClientFunctionContext): unknown;
|
|
63
|
+
/**
|
|
64
|
+
* Precompiles action conditional schemas from the event configurations to improve performance of condition validation later on.
|
|
65
|
+
* Best called once on application startup before any condition validation is done.
|
|
66
|
+
*/
|
|
67
|
+
export declare function precompileActionSchemas(eventConfigurations: EventConfig[]): void;
|
|
52
68
|
export declare function validate(schema: JSONSchema, data: ConditionalParameters): boolean;
|
|
53
69
|
export declare function validateValue(schema: JSONSchema, data: unknown): boolean;
|
|
54
70
|
export declare function isOnline(): boolean;
|
|
55
71
|
export declare function isConditionMet(conditional: JSONSchema, values: EventState | ActionUpdate, context: ValidatorContext): boolean;
|
|
56
|
-
export declare function areConditionsMet(conditions: FieldConditional[], values: Record<string, FieldValue>, context: ValidatorContext): boolean;
|
|
72
|
+
export declare function areConditionsMet(conditions: FieldConditional[], values: Record<string, FieldValue>, context: ValidatorContext, _event: EventIndex): boolean;
|
|
57
73
|
export type ValidatorContext = {
|
|
58
74
|
user?: ITokenPayload;
|
|
59
75
|
leafAdminStructureLocationIds?: Array<{
|
|
@@ -65,6 +81,9 @@ export type ValidatorContext = {
|
|
|
65
81
|
export declare function isFieldVisible(field: FieldConfig, form: Partial<ActionUpdate | EventState>, context: ValidatorContext): boolean;
|
|
66
82
|
export declare function isFieldEnabled(field: FieldConfig, form: ActionUpdate | EventState, context: ValidatorContext): boolean;
|
|
67
83
|
export declare function isFieldDisplayedOnReview(field: FieldConfig, form: ActionUpdate | EventState, context: ValidatorContext): boolean;
|
|
84
|
+
export declare function isActionEnabled(actionConfig: ActionConfig, event: EventIndex, context: ValidatorContext): boolean;
|
|
85
|
+
export declare function isActionVisible(actionConfig: ActionConfig, event: EventIndex, context: ValidatorContext): boolean;
|
|
86
|
+
export declare function isActionAvailable(actionConfig: ActionConfig, event: EventIndex, context: ValidatorContext): boolean;
|
|
68
87
|
export declare const errorMessages: {
|
|
69
88
|
hiddenField: {
|
|
70
89
|
id: string;
|