@opencrvs/toolkit 2.1.0-rc.b5d11bf → 2.1.0-rc.b632d41
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/dist/application-config/index.js +1 -2
- package/dist/commons/api/router.d.ts +1640 -1604
- package/dist/commons/application-config/index.d.ts +6 -6
- package/dist/commons/conditionals/conditionals.d.ts +323 -32
- package/dist/commons/events/ActionConfig.d.ts +105 -105
- package/dist/commons/events/ActionDocument.d.ts +119 -119
- package/dist/commons/events/ActionInput.d.ts +6 -0
- package/dist/commons/events/ActionType.d.ts +62 -62
- package/dist/commons/events/AdvancedSearchConfig.d.ts +507 -507
- package/dist/commons/events/AuditLog.d.ts +43 -43
- package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
- package/dist/commons/events/Conditional.d.ts +3 -3
- package/dist/commons/events/CountryConfigQueryInput.d.ts +590 -590
- package/dist/commons/events/Draft.d.ts +37 -37
- package/dist/commons/events/DynamicFieldValue.d.ts +9 -9
- package/dist/commons/events/EventConfig.d.ts +5 -5
- package/dist/commons/events/EventDocument.d.ts +48 -48
- package/dist/commons/events/EventIndex.d.ts +62 -62
- package/dist/commons/events/EventMetadata.d.ts +40 -40
- package/dist/commons/events/FieldConfig.d.ts +337 -337
- package/dist/commons/events/FieldType.d.ts +51 -51
- package/dist/commons/events/FieldTypeMapping.d.ts +100 -100
- package/dist/commons/events/FieldValue.d.ts +12 -12
- package/dist/commons/events/Flag.d.ts +15 -15
- package/dist/commons/events/TemplateConfig.d.ts +1 -1
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +40 -40
- package/dist/commons/events/WorkqueueConfig.d.ts +820 -820
- package/dist/commons/events/deduplication.d.ts +1 -1
- package/dist/commons/events/event.d.ts +2 -2
- package/dist/commons/events/field.d.ts +198 -69
- package/dist/commons/events/locations.d.ts +4 -4
- package/dist/commons/events/mocks.test.utils.d.ts +2 -2
- package/dist/commons/events/scopes.d.ts +4 -4
- package/dist/commons/events/state/index.d.ts +17 -17
- package/dist/commons/events/state/utils.d.ts +7 -7
- package/dist/commons/events/test.utils.d.ts +38 -35
- package/dist/commons/events/utils.d.ts +114 -114
- package/dist/commons/notification/UserNotifications.d.ts +10 -10
- package/dist/environment/derived-variables.d.ts +119 -119
- package/dist/environment/derived-variables.d.ts.map +1 -1
- package/dist/environment/logger.d.ts +12 -3
- package/dist/environment/logger.d.ts.map +1 -1
- package/dist/environment/manage-users.js +7 -17
- package/dist/environment/questions.d.ts +74 -75
- package/dist/environment/questions.d.ts.map +1 -1
- package/dist/environment/setup-environment.js +14 -8
- package/dist/environment/swarm-to-k8s.js +7 -17
- package/dist/environment/update-workflows.js +7 -17
- package/dist/environment/users.js +7 -17
- package/dist/environment/utils.d.ts +1 -1
- package/dist/environment/utils.js +7 -17
- package/dist/events/deduplication.d.ts +1 -1
- package/dist/events/index.js +6 -3
- package/dist/migrations/v2.0/convert-config-files-to-ts.js +7 -17
- package/dist/migrations/v2.0/migrate-application-config-url.js +3 -4
- package/dist/migrations/v2.0/remove-hearth-migrations.js +7 -17
- package/dist/notification/index.js +5 -3
- package/dist/scopes/index.d.ts +146 -146
- package/opencrvs-toolkit-2.1.0-rc.b632d41.tgz +0 -0
- package/package.json +4 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.1.0-rc.b5d11bf.tgz +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as z from 'zod/v4';
|
|
2
2
|
import { FieldConfig } from './events/FieldConfig';
|
|
3
3
|
export declare const SearchCriteria: z.ZodEnum<{
|
|
4
|
-
EMAIL: "EMAIL";
|
|
5
4
|
NAME: "NAME";
|
|
5
|
+
EMAIL: "EMAIL";
|
|
6
|
+
TRACKING_ID: "TRACKING_ID";
|
|
7
|
+
REGISTRATION_NUMBER: "REGISTRATION_NUMBER";
|
|
6
8
|
NATIONAL_ID: "NATIONAL_ID";
|
|
7
9
|
PHONE_NUMBER: "PHONE_NUMBER";
|
|
8
|
-
REGISTRATION_NUMBER: "REGISTRATION_NUMBER";
|
|
9
|
-
TRACKING_ID: "TRACKING_ID";
|
|
10
10
|
}>;
|
|
11
11
|
export declare const ApplicationConfig: z.ZodObject<{
|
|
12
12
|
APPLICATION_NAME: z.ZodString;
|
|
@@ -33,12 +33,12 @@ export declare const ApplicationConfig: z.ZodObject<{
|
|
|
33
33
|
sms: "sms";
|
|
34
34
|
}>;
|
|
35
35
|
SEARCH_DEFAULT_CRITERIA: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
36
|
-
EMAIL: "EMAIL";
|
|
37
36
|
NAME: "NAME";
|
|
37
|
+
EMAIL: "EMAIL";
|
|
38
|
+
TRACKING_ID: "TRACKING_ID";
|
|
39
|
+
REGISTRATION_NUMBER: "REGISTRATION_NUMBER";
|
|
38
40
|
NATIONAL_ID: "NATIONAL_ID";
|
|
39
41
|
PHONE_NUMBER: "PHONE_NUMBER";
|
|
40
|
-
REGISTRATION_NUMBER: "REGISTRATION_NUMBER";
|
|
41
|
-
TRACKING_ID: "TRACKING_ID";
|
|
42
42
|
}>>>;
|
|
43
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
44
|
}, z.core.$strip>;
|
|
@@ -83,21 +83,6 @@ export declare const now: typeof todayDateTimeValueSerializer;
|
|
|
83
83
|
* Generate conditional rules for user.
|
|
84
84
|
*/
|
|
85
85
|
export declare const user: typeof userSerializer & {
|
|
86
|
-
scope: (scope: import("../scopes").ScopeType) => {
|
|
87
|
-
attribute: (option: import("../scopes").ScopeOptionKey) => {
|
|
88
|
-
$scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.create" | "organisation.read-locations" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "profile.electronic-signature" | "record.archive" | "record.confirm-registration" | "record.correct" | "record.create" | "record.custom-action" | "record.declare" | "record.edit" | "record.import" | "record.notify" | "record.print-certified-copies" | "record.read" | "record.register" | "record.reindex" | "record.reject" | "record.reject-registration" | "record.request-correction" | "record.review-duplicates" | "record.search" | "record.unarchive" | "record.unassign-others" | "user.create" | "user.data-seeding" | "user.edit" | "user.read" | "user.read-only-my-audit" | "user.search" | "workqueue";
|
|
89
|
-
$option: "accessLevel" | "declaredBy" | "declaredIn" | "event" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role";
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
jurisdiction: (jurisdiction: import("../scopes").JurisdictionFilter | {
|
|
93
|
-
$scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.create" | "organisation.read-locations" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "profile.electronic-signature" | "record.archive" | "record.confirm-registration" | "record.correct" | "record.create" | "record.custom-action" | "record.declare" | "record.edit" | "record.import" | "record.notify" | "record.print-certified-copies" | "record.read" | "record.register" | "record.reindex" | "record.reject" | "record.reject-registration" | "record.request-correction" | "record.review-duplicates" | "record.search" | "record.unarchive" | "record.unassign-others" | "user.create" | "user.data-seeding" | "user.edit" | "user.read" | "user.read-only-my-audit" | "user.search" | "workqueue";
|
|
94
|
-
$option: "accessLevel" | "declaredBy" | "declaredIn" | "event" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role";
|
|
95
|
-
}) => {
|
|
96
|
-
$jurisdiction: "administrativeArea" | "all" | "location" | {
|
|
97
|
-
$scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.create" | "organisation.read-locations" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "profile.electronic-signature" | "record.archive" | "record.confirm-registration" | "record.correct" | "record.create" | "record.custom-action" | "record.declare" | "record.edit" | "record.import" | "record.notify" | "record.print-certified-copies" | "record.read" | "record.register" | "record.reindex" | "record.reject" | "record.reject-registration" | "record.request-correction" | "record.review-duplicates" | "record.search" | "record.unarchive" | "record.unassign-others" | "user.create" | "user.data-seeding" | "user.edit" | "user.read" | "user.read-only-my-audit" | "user.search" | "workqueue";
|
|
98
|
-
$option: "accessLevel" | "declaredBy" | "declaredIn" | "event" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role";
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
86
|
hasScope: (scope: string) => JSONSchema;
|
|
102
87
|
hasRole: (role: string) => JSONSchema;
|
|
103
88
|
isOnline: () => JSONSchema;
|
|
@@ -106,6 +91,21 @@ export declare const user: typeof userSerializer & {
|
|
|
106
91
|
$location: string;
|
|
107
92
|
};
|
|
108
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.unarchive" | "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" | "notifiedIn" | "notifiedBy" | "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.unarchive" | "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" | "notifiedIn" | "notifiedBy" | "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.unarchive" | "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" | "notifiedIn" | "notifiedBy" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
109
|
};
|
|
110
110
|
export declare function isFieldReference(value: unknown): value is FieldReference;
|
|
111
111
|
export declare function isEventFieldReference(value: unknown): value is {
|
|
@@ -133,22 +133,22 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
133
133
|
*/
|
|
134
134
|
$$subfield: string[];
|
|
135
135
|
get(fieldPath: string): {
|
|
136
|
+
$$subfield: string[];
|
|
136
137
|
/**
|
|
137
138
|
* @private Internal property used for field reference tracking.
|
|
138
139
|
*/
|
|
139
140
|
$$field: string;
|
|
140
|
-
get(fieldPath: string):
|
|
141
|
-
$$subfield: string[];
|
|
141
|
+
get(fieldPath: string): any;
|
|
142
142
|
getByPath(fieldPath: string[]): {
|
|
143
|
+
$$subfield: string[];
|
|
143
144
|
/**
|
|
144
145
|
* @private Internal property used for field reference tracking.
|
|
145
146
|
*/
|
|
146
147
|
$$field: string;
|
|
147
|
-
get(fieldPath: string):
|
|
148
|
-
getByPath(fieldPath: string[]):
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
asAge(): /*elided*/ any;
|
|
148
|
+
get(fieldPath: string): any;
|
|
149
|
+
getByPath(fieldPath: string[]): any;
|
|
150
|
+
asDob(): any;
|
|
151
|
+
asAge(): any;
|
|
152
152
|
isAfter(): {
|
|
153
153
|
days: (days: number) => {
|
|
154
154
|
inPast: () => JSONSchema;
|
|
@@ -237,8 +237,8 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
237
237
|
*/
|
|
238
238
|
customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
|
|
239
239
|
};
|
|
240
|
-
asDob():
|
|
241
|
-
asAge():
|
|
240
|
+
asDob(): any;
|
|
241
|
+
asAge(): any;
|
|
242
242
|
isAfter(): {
|
|
243
243
|
days: (days: number) => {
|
|
244
244
|
inPast: () => JSONSchema;
|
|
@@ -328,15 +328,306 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
328
328
|
customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
|
|
329
329
|
};
|
|
330
330
|
getByPath(fieldPath: string[]): {
|
|
331
|
+
$$subfield: string[];
|
|
331
332
|
/**
|
|
332
333
|
* @private Internal property used for field reference tracking.
|
|
333
334
|
*/
|
|
334
335
|
$$field: string;
|
|
335
|
-
get(fieldPath: string):
|
|
336
|
+
get(fieldPath: string): {
|
|
337
|
+
$$subfield: string[];
|
|
338
|
+
/**
|
|
339
|
+
* @private Internal property used for field reference tracking.
|
|
340
|
+
*/
|
|
341
|
+
$$field: string;
|
|
342
|
+
get(fieldPath: string): any;
|
|
343
|
+
getByPath(fieldPath: string[]): any;
|
|
344
|
+
asDob(): any;
|
|
345
|
+
asAge(): any;
|
|
346
|
+
isAfter(): {
|
|
347
|
+
days: (days: number) => {
|
|
348
|
+
inPast: () => JSONSchema;
|
|
349
|
+
inFuture: () => JSONSchema;
|
|
350
|
+
fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
351
|
+
fromNow: () => JSONSchema;
|
|
352
|
+
};
|
|
353
|
+
date: (date: string | FieldReference) => JSONSchema;
|
|
354
|
+
now: () => JSONSchema;
|
|
355
|
+
};
|
|
356
|
+
isBefore(): {
|
|
357
|
+
days: (days: number) => {
|
|
358
|
+
inPast: () => JSONSchema;
|
|
359
|
+
inFuture: () => JSONSchema;
|
|
360
|
+
fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
361
|
+
fromNow: () => JSONSchema;
|
|
362
|
+
};
|
|
363
|
+
date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
364
|
+
now: () => JSONSchema;
|
|
365
|
+
};
|
|
366
|
+
isGreaterThan(value: number | FieldReference): JSONSchema;
|
|
367
|
+
isLessThan(value: number | FieldReference): JSONSchema;
|
|
368
|
+
isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
|
|
369
|
+
/**
|
|
370
|
+
* Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
|
|
371
|
+
* @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
|
|
372
|
+
* @returns whether the field is falsy (undefined, false, null, empty string)
|
|
373
|
+
*
|
|
374
|
+
* NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
|
|
375
|
+
*
|
|
376
|
+
*/
|
|
377
|
+
isFalsy(): JSONSchema;
|
|
378
|
+
isUndefined(): JSONSchema;
|
|
379
|
+
inArray(values: string[]): JSONSchema;
|
|
380
|
+
isValidEnglishName(): JSONSchema;
|
|
381
|
+
isValidAdministrativeLeafLevel(): JSONSchema;
|
|
382
|
+
/**
|
|
383
|
+
* Checks if the field value matches a given regular expression pattern.
|
|
384
|
+
* @param pattern - The regular expression pattern to match the field value against.
|
|
385
|
+
* @returns A JSONSchema conditional that validates the field value against the pattern.
|
|
386
|
+
*/
|
|
387
|
+
matches(pattern: string): JSONSchema;
|
|
388
|
+
isBetween(min: number, max: number): JSONSchema;
|
|
389
|
+
getId: () => {
|
|
390
|
+
fieldId: string;
|
|
391
|
+
};
|
|
392
|
+
/**
|
|
393
|
+
* @deprecated
|
|
394
|
+
* use field(fieldId).get(nestedProperty) instead
|
|
395
|
+
* with 'and' combinator e.g.
|
|
396
|
+
* and(
|
|
397
|
+
* field('child.name').get('firstname').isEqualTo('John'),
|
|
398
|
+
* field('child.name').get('surname').isEqualTo('Doe')
|
|
399
|
+
* )
|
|
400
|
+
*/
|
|
401
|
+
object: (options: Record<string, any>) => JSONSchema;
|
|
402
|
+
/**
|
|
403
|
+
* Custom client-side validator. The provided function is serialised and executed
|
|
404
|
+
* just-in-time on the client only. External references (e.g. lodash) are not
|
|
405
|
+
* available inside the function body — all logic must be self-contained.
|
|
406
|
+
*
|
|
407
|
+
* @example
|
|
408
|
+
* field('nid').customClientValidator((value) => {
|
|
409
|
+
* // LUHN check — all logic must be inline
|
|
410
|
+
* const digits = String(value).split('').map(Number)
|
|
411
|
+
* // ...
|
|
412
|
+
* return isValid
|
|
413
|
+
* })
|
|
414
|
+
*/
|
|
415
|
+
customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
|
|
416
|
+
/**
|
|
417
|
+
* Custom client-side evaluation. Returns a {@link FieldReference} descriptor
|
|
418
|
+
* that can be used as the `value` property or a DATA component entry.
|
|
419
|
+
* The function receives the referenced field's value as the first argument and
|
|
420
|
+
* the full form context as the second; its return value replaces the field reference.
|
|
421
|
+
* The function is serialised and executed just-in-time on the client only.
|
|
422
|
+
* External references (e.g. lodash) are not available inside the function body.
|
|
423
|
+
*
|
|
424
|
+
* For computing a default value without referencing a specific field, use
|
|
425
|
+
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
426
|
+
*
|
|
427
|
+
* @example
|
|
428
|
+
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
429
|
+
* Number(aValue) + Number(ctx.$form.b)
|
|
430
|
+
* )
|
|
431
|
+
*/
|
|
432
|
+
customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
|
|
433
|
+
};
|
|
336
434
|
getByPath(fieldPath: string[]): any;
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
435
|
+
asDob(): {
|
|
436
|
+
$$subfield: string[];
|
|
437
|
+
/**
|
|
438
|
+
* @private Internal property used for field reference tracking.
|
|
439
|
+
*/
|
|
440
|
+
$$field: string;
|
|
441
|
+
get(fieldPath: string): any;
|
|
442
|
+
getByPath(fieldPath: string[]): any;
|
|
443
|
+
asDob(): any;
|
|
444
|
+
asAge(): any;
|
|
445
|
+
isAfter(): {
|
|
446
|
+
days: (days: number) => {
|
|
447
|
+
inPast: () => JSONSchema;
|
|
448
|
+
inFuture: () => JSONSchema;
|
|
449
|
+
fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
450
|
+
fromNow: () => JSONSchema;
|
|
451
|
+
};
|
|
452
|
+
date: (date: string | FieldReference) => JSONSchema;
|
|
453
|
+
now: () => JSONSchema;
|
|
454
|
+
};
|
|
455
|
+
isBefore(): {
|
|
456
|
+
days: (days: number) => {
|
|
457
|
+
inPast: () => JSONSchema;
|
|
458
|
+
inFuture: () => JSONSchema;
|
|
459
|
+
fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
460
|
+
fromNow: () => JSONSchema;
|
|
461
|
+
};
|
|
462
|
+
date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
463
|
+
now: () => JSONSchema;
|
|
464
|
+
};
|
|
465
|
+
isGreaterThan(value: number | FieldReference): JSONSchema;
|
|
466
|
+
isLessThan(value: number | FieldReference): JSONSchema;
|
|
467
|
+
isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
|
|
468
|
+
/**
|
|
469
|
+
* Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
|
|
470
|
+
* @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
|
|
471
|
+
* @returns whether the field is falsy (undefined, false, null, empty string)
|
|
472
|
+
*
|
|
473
|
+
* NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
|
|
474
|
+
*
|
|
475
|
+
*/
|
|
476
|
+
isFalsy(): JSONSchema;
|
|
477
|
+
isUndefined(): JSONSchema;
|
|
478
|
+
inArray(values: string[]): JSONSchema;
|
|
479
|
+
isValidEnglishName(): JSONSchema;
|
|
480
|
+
isValidAdministrativeLeafLevel(): JSONSchema;
|
|
481
|
+
/**
|
|
482
|
+
* Checks if the field value matches a given regular expression pattern.
|
|
483
|
+
* @param pattern - The regular expression pattern to match the field value against.
|
|
484
|
+
* @returns A JSONSchema conditional that validates the field value against the pattern.
|
|
485
|
+
*/
|
|
486
|
+
matches(pattern: string): JSONSchema;
|
|
487
|
+
isBetween(min: number, max: number): JSONSchema;
|
|
488
|
+
getId: () => {
|
|
489
|
+
fieldId: string;
|
|
490
|
+
};
|
|
491
|
+
/**
|
|
492
|
+
* @deprecated
|
|
493
|
+
* use field(fieldId).get(nestedProperty) instead
|
|
494
|
+
* with 'and' combinator e.g.
|
|
495
|
+
* and(
|
|
496
|
+
* field('child.name').get('firstname').isEqualTo('John'),
|
|
497
|
+
* field('child.name').get('surname').isEqualTo('Doe')
|
|
498
|
+
* )
|
|
499
|
+
*/
|
|
500
|
+
object: (options: Record<string, any>) => JSONSchema;
|
|
501
|
+
/**
|
|
502
|
+
* Custom client-side validator. The provided function is serialised and executed
|
|
503
|
+
* just-in-time on the client only. External references (e.g. lodash) are not
|
|
504
|
+
* available inside the function body — all logic must be self-contained.
|
|
505
|
+
*
|
|
506
|
+
* @example
|
|
507
|
+
* field('nid').customClientValidator((value) => {
|
|
508
|
+
* // LUHN check — all logic must be inline
|
|
509
|
+
* const digits = String(value).split('').map(Number)
|
|
510
|
+
* // ...
|
|
511
|
+
* return isValid
|
|
512
|
+
* })
|
|
513
|
+
*/
|
|
514
|
+
customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
|
|
515
|
+
/**
|
|
516
|
+
* Custom client-side evaluation. Returns a {@link FieldReference} descriptor
|
|
517
|
+
* that can be used as the `value` property or a DATA component entry.
|
|
518
|
+
* The function receives the referenced field's value as the first argument and
|
|
519
|
+
* the full form context as the second; its return value replaces the field reference.
|
|
520
|
+
* The function is serialised and executed just-in-time on the client only.
|
|
521
|
+
* External references (e.g. lodash) are not available inside the function body.
|
|
522
|
+
*
|
|
523
|
+
* For computing a default value without referencing a specific field, use
|
|
524
|
+
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
525
|
+
*
|
|
526
|
+
* @example
|
|
527
|
+
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
528
|
+
* Number(aValue) + Number(ctx.$form.b)
|
|
529
|
+
* )
|
|
530
|
+
*/
|
|
531
|
+
customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
|
|
532
|
+
};
|
|
533
|
+
asAge(): {
|
|
534
|
+
$$subfield: string[];
|
|
535
|
+
/**
|
|
536
|
+
* @private Internal property used for field reference tracking.
|
|
537
|
+
*/
|
|
538
|
+
$$field: string;
|
|
539
|
+
get(fieldPath: string): any;
|
|
540
|
+
getByPath(fieldPath: string[]): any;
|
|
541
|
+
asDob(): any;
|
|
542
|
+
asAge(): any;
|
|
543
|
+
isAfter(): {
|
|
544
|
+
days: (days: number) => {
|
|
545
|
+
inPast: () => JSONSchema;
|
|
546
|
+
inFuture: () => JSONSchema;
|
|
547
|
+
fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
548
|
+
fromNow: () => JSONSchema;
|
|
549
|
+
};
|
|
550
|
+
date: (date: string | FieldReference) => JSONSchema;
|
|
551
|
+
now: () => JSONSchema;
|
|
552
|
+
};
|
|
553
|
+
isBefore(): {
|
|
554
|
+
days: (days: number) => {
|
|
555
|
+
inPast: () => JSONSchema;
|
|
556
|
+
inFuture: () => JSONSchema;
|
|
557
|
+
fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
558
|
+
fromNow: () => JSONSchema;
|
|
559
|
+
};
|
|
560
|
+
date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
561
|
+
now: () => JSONSchema;
|
|
562
|
+
};
|
|
563
|
+
isGreaterThan(value: number | FieldReference): JSONSchema;
|
|
564
|
+
isLessThan(value: number | FieldReference): JSONSchema;
|
|
565
|
+
isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
|
|
566
|
+
/**
|
|
567
|
+
* Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
|
|
568
|
+
* @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
|
|
569
|
+
* @returns whether the field is falsy (undefined, false, null, empty string)
|
|
570
|
+
*
|
|
571
|
+
* NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
|
|
572
|
+
*
|
|
573
|
+
*/
|
|
574
|
+
isFalsy(): JSONSchema;
|
|
575
|
+
isUndefined(): JSONSchema;
|
|
576
|
+
inArray(values: string[]): JSONSchema;
|
|
577
|
+
isValidEnglishName(): JSONSchema;
|
|
578
|
+
isValidAdministrativeLeafLevel(): JSONSchema;
|
|
579
|
+
/**
|
|
580
|
+
* Checks if the field value matches a given regular expression pattern.
|
|
581
|
+
* @param pattern - The regular expression pattern to match the field value against.
|
|
582
|
+
* @returns A JSONSchema conditional that validates the field value against the pattern.
|
|
583
|
+
*/
|
|
584
|
+
matches(pattern: string): JSONSchema;
|
|
585
|
+
isBetween(min: number, max: number): JSONSchema;
|
|
586
|
+
getId: () => {
|
|
587
|
+
fieldId: string;
|
|
588
|
+
};
|
|
589
|
+
/**
|
|
590
|
+
* @deprecated
|
|
591
|
+
* use field(fieldId).get(nestedProperty) instead
|
|
592
|
+
* with 'and' combinator e.g.
|
|
593
|
+
* and(
|
|
594
|
+
* field('child.name').get('firstname').isEqualTo('John'),
|
|
595
|
+
* field('child.name').get('surname').isEqualTo('Doe')
|
|
596
|
+
* )
|
|
597
|
+
*/
|
|
598
|
+
object: (options: Record<string, any>) => JSONSchema;
|
|
599
|
+
/**
|
|
600
|
+
* Custom client-side validator. The provided function is serialised and executed
|
|
601
|
+
* just-in-time on the client only. External references (e.g. lodash) are not
|
|
602
|
+
* available inside the function body — all logic must be self-contained.
|
|
603
|
+
*
|
|
604
|
+
* @example
|
|
605
|
+
* field('nid').customClientValidator((value) => {
|
|
606
|
+
* // LUHN check — all logic must be inline
|
|
607
|
+
* const digits = String(value).split('').map(Number)
|
|
608
|
+
* // ...
|
|
609
|
+
* return isValid
|
|
610
|
+
* })
|
|
611
|
+
*/
|
|
612
|
+
customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
|
|
613
|
+
/**
|
|
614
|
+
* Custom client-side evaluation. Returns a {@link FieldReference} descriptor
|
|
615
|
+
* that can be used as the `value` property or a DATA component entry.
|
|
616
|
+
* The function receives the referenced field's value as the first argument and
|
|
617
|
+
* the full form context as the second; its return value replaces the field reference.
|
|
618
|
+
* The function is serialised and executed just-in-time on the client only.
|
|
619
|
+
* External references (e.g. lodash) are not available inside the function body.
|
|
620
|
+
*
|
|
621
|
+
* For computing a default value without referencing a specific field, use
|
|
622
|
+
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
623
|
+
*
|
|
624
|
+
* @example
|
|
625
|
+
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
626
|
+
* Number(aValue) + Number(ctx.$form.b)
|
|
627
|
+
* )
|
|
628
|
+
*/
|
|
629
|
+
customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
|
|
630
|
+
};
|
|
340
631
|
isAfter(): {
|
|
341
632
|
days: (days: number) => {
|
|
342
633
|
inPast: () => JSONSchema;
|
|
@@ -426,20 +717,20 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
426
717
|
customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
|
|
427
718
|
};
|
|
428
719
|
asDob(): {
|
|
720
|
+
$$subfield: string[];
|
|
429
721
|
/**
|
|
430
722
|
* @private Internal property used for field reference tracking.
|
|
431
723
|
*/
|
|
432
724
|
$$field: string;
|
|
433
725
|
get(fieldPath: string): any;
|
|
434
|
-
$$subfield: string[];
|
|
435
726
|
getByPath(fieldPath: string[]): {
|
|
727
|
+
$$subfield: string[];
|
|
436
728
|
/**
|
|
437
729
|
* @private Internal property used for field reference tracking.
|
|
438
730
|
*/
|
|
439
731
|
$$field: string;
|
|
440
732
|
get(fieldPath: string): any;
|
|
441
733
|
getByPath(fieldPath: string[]): any;
|
|
442
|
-
$$subfield: string[];
|
|
443
734
|
asDob(): any;
|
|
444
735
|
asAge(): any;
|
|
445
736
|
isAfter(): {
|
|
@@ -621,20 +912,20 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
621
912
|
customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
|
|
622
913
|
};
|
|
623
914
|
asAge(): {
|
|
915
|
+
$$subfield: string[];
|
|
624
916
|
/**
|
|
625
917
|
* @private Internal property used for field reference tracking.
|
|
626
918
|
*/
|
|
627
919
|
$$field: string;
|
|
628
920
|
get(fieldPath: string): any;
|
|
629
|
-
$$subfield: string[];
|
|
630
921
|
getByPath(fieldPath: string[]): {
|
|
922
|
+
$$subfield: string[];
|
|
631
923
|
/**
|
|
632
924
|
* @private Internal property used for field reference tracking.
|
|
633
925
|
*/
|
|
634
926
|
$$field: string;
|
|
635
927
|
get(fieldPath: string): any;
|
|
636
928
|
getByPath(fieldPath: string[]): any;
|
|
637
|
-
$$subfield: string[];
|
|
638
929
|
asDob(): any;
|
|
639
930
|
asAge(): any;
|
|
640
931
|
isAfter(): {
|