@opencrvs/toolkit 2.1.0-rc.75e32d8 → 2.1.0-rc.7985421
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 +3 -1
- package/dist/commons/api/router.d.ts +3546 -3359
- package/dist/commons/application-config/index.d.ts +6 -6
- package/dist/commons/conditionals/conditionals.d.ts +32 -323
- 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 +0 -6
- package/dist/commons/events/ActionType.d.ts +62 -62
- package/dist/commons/events/AdvancedSearchConfig.d.ts +513 -507
- package/dist/commons/events/AuditLog.d.ts +151 -42
- 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 +341 -336
- 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 +826 -826
- 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 +69 -198
- package/dist/commons/events/index.d.ts +1 -0
- package/dist/commons/events/locationPayloads.d.ts +95 -0
- package/dist/commons/events/locations.d.ts +103 -6
- package/dist/commons/events/mocks.test.utils.d.ts +18 -4
- 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 +40 -43
- package/dist/commons/events/utils.d.ts +114 -114
- package/dist/commons/notification/UserNotifications.d.ts +10 -10
- package/dist/conditionals/index.js +1 -0
- 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 +3 -12
- package/dist/environment/logger.d.ts.map +1 -1
- package/dist/environment/manage-users.js +17 -7
- package/dist/environment/questions.d.ts +75 -74
- package/dist/environment/questions.d.ts.map +1 -1
- package/dist/environment/setup-environment.js +8 -14
- package/dist/environment/swarm-to-k8s.js +17 -7
- package/dist/environment/update-workflows.js +17 -7
- package/dist/environment/users.js +17 -7
- package/dist/environment/utils.d.ts +1 -1
- package/dist/environment/utils.js +17 -7
- package/dist/events/deduplication.d.ts +1 -1
- package/dist/events/index.js +185 -58
- package/dist/migrations/v2.0/convert-config-files-to-ts.js +17 -7
- package/dist/migrations/v2.0/migrate-application-config-url.js +4 -3
- package/dist/migrations/v2.0/remove-hearth-migrations.js +17 -7
- package/dist/notification/index.js +182 -82
- package/dist/scopes/index.d.ts +148 -146
- package/dist/scopes/index.js +1 -0
- package/opencrvs-toolkit-2.1.0-rc.7985421.tgz +0 -0
- package/package.json +5 -5
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.1.0-rc.75e32d8.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
|
-
NAME: "NAME";
|
|
5
4
|
EMAIL: "EMAIL";
|
|
6
|
-
|
|
7
|
-
REGISTRATION_NUMBER: "REGISTRATION_NUMBER";
|
|
5
|
+
NAME: "NAME";
|
|
8
6
|
NATIONAL_ID: "NATIONAL_ID";
|
|
9
7
|
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
|
-
NAME: "NAME";
|
|
37
36
|
EMAIL: "EMAIL";
|
|
38
|
-
|
|
39
|
-
REGISTRATION_NUMBER: "REGISTRATION_NUMBER";
|
|
37
|
+
NAME: "NAME";
|
|
40
38
|
NATIONAL_ID: "NATIONAL_ID";
|
|
41
39
|
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,27 +83,27 @@ export declare const now: typeof todayDateTimeValueSerializer;
|
|
|
83
83
|
* Generate conditional rules for user.
|
|
84
84
|
*/
|
|
85
85
|
export declare const user: typeof userSerializer & {
|
|
86
|
-
hasScope: (scope: string) => JSONSchema;
|
|
87
|
-
hasRole: (role: string) => JSONSchema;
|
|
88
|
-
isOnline: () => JSONSchema;
|
|
89
|
-
locationLevel: (adminLevelId: string) => {
|
|
90
|
-
$user: {
|
|
91
|
-
$location: string;
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
86
|
scope: (scope: import("../scopes").ScopeType) => {
|
|
95
87
|
attribute: (option: import("../scopes").ScopeOptionKey) => {
|
|
96
|
-
$scope: "
|
|
97
|
-
$option: "
|
|
88
|
+
$scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.create" | "location.edit" | "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";
|
|
98
90
|
};
|
|
99
91
|
};
|
|
100
92
|
jurisdiction: (jurisdiction: import("../scopes").JurisdictionFilter | {
|
|
101
|
-
$scope: "
|
|
102
|
-
$option: "
|
|
93
|
+
$scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.create" | "location.edit" | "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";
|
|
103
95
|
}) => {
|
|
104
|
-
$jurisdiction: "administrativeArea" | "
|
|
105
|
-
$scope: "
|
|
106
|
-
$option: "
|
|
96
|
+
$jurisdiction: "administrativeArea" | "all" | "location" | {
|
|
97
|
+
$scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.create" | "location.edit" | "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
|
+
hasScope: (scope: string) => JSONSchema;
|
|
102
|
+
hasRole: (role: string) => JSONSchema;
|
|
103
|
+
isOnline: () => JSONSchema;
|
|
104
|
+
locationLevel: (adminLevelId: string) => {
|
|
105
|
+
$user: {
|
|
106
|
+
$location: string;
|
|
107
107
|
};
|
|
108
108
|
};
|
|
109
109
|
};
|
|
@@ -133,22 +133,22 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
133
133
|
*/
|
|
134
134
|
$$subfield: string[];
|
|
135
135
|
get(fieldPath: string): {
|
|
136
|
-
$$subfield: string[];
|
|
137
136
|
/**
|
|
138
137
|
* @private Internal property used for field reference tracking.
|
|
139
138
|
*/
|
|
140
139
|
$$field: string;
|
|
141
|
-
get(fieldPath: string): any;
|
|
140
|
+
get(fieldPath: string): /*elided*/ any;
|
|
141
|
+
$$subfield: string[];
|
|
142
142
|
getByPath(fieldPath: string[]): {
|
|
143
|
-
$$subfield: string[];
|
|
144
143
|
/**
|
|
145
144
|
* @private Internal property used for field reference tracking.
|
|
146
145
|
*/
|
|
147
146
|
$$field: string;
|
|
148
|
-
get(fieldPath: string): any;
|
|
149
|
-
getByPath(fieldPath: string[]): any;
|
|
150
|
-
|
|
151
|
-
|
|
147
|
+
get(fieldPath: string): /*elided*/ any;
|
|
148
|
+
getByPath(fieldPath: string[]): /*elided*/ any;
|
|
149
|
+
$$subfield: string[];
|
|
150
|
+
asDob(): /*elided*/ any;
|
|
151
|
+
asAge(): /*elided*/ 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(): any;
|
|
241
|
-
asAge(): any;
|
|
240
|
+
asDob(): /*elided*/ any;
|
|
241
|
+
asAge(): /*elided*/ any;
|
|
242
242
|
isAfter(): {
|
|
243
243
|
days: (days: number) => {
|
|
244
244
|
inPast: () => JSONSchema;
|
|
@@ -328,306 +328,15 @@ 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[];
|
|
332
331
|
/**
|
|
333
332
|
* @private Internal property used for field reference tracking.
|
|
334
333
|
*/
|
|
335
334
|
$$field: 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
|
-
};
|
|
335
|
+
get(fieldPath: string): any;
|
|
434
336
|
getByPath(fieldPath: string[]): any;
|
|
435
|
-
|
|
436
|
-
|
|
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
|
-
};
|
|
337
|
+
$$subfield: string[];
|
|
338
|
+
asDob(): any;
|
|
339
|
+
asAge(): any;
|
|
631
340
|
isAfter(): {
|
|
632
341
|
days: (days: number) => {
|
|
633
342
|
inPast: () => JSONSchema;
|
|
@@ -717,20 +426,20 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
717
426
|
customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
|
|
718
427
|
};
|
|
719
428
|
asDob(): {
|
|
720
|
-
$$subfield: string[];
|
|
721
429
|
/**
|
|
722
430
|
* @private Internal property used for field reference tracking.
|
|
723
431
|
*/
|
|
724
432
|
$$field: string;
|
|
725
433
|
get(fieldPath: string): any;
|
|
434
|
+
$$subfield: string[];
|
|
726
435
|
getByPath(fieldPath: string[]): {
|
|
727
|
-
$$subfield: string[];
|
|
728
436
|
/**
|
|
729
437
|
* @private Internal property used for field reference tracking.
|
|
730
438
|
*/
|
|
731
439
|
$$field: string;
|
|
732
440
|
get(fieldPath: string): any;
|
|
733
441
|
getByPath(fieldPath: string[]): any;
|
|
442
|
+
$$subfield: string[];
|
|
734
443
|
asDob(): any;
|
|
735
444
|
asAge(): any;
|
|
736
445
|
isAfter(): {
|
|
@@ -912,20 +621,20 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
912
621
|
customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
|
|
913
622
|
};
|
|
914
623
|
asAge(): {
|
|
915
|
-
$$subfield: string[];
|
|
916
624
|
/**
|
|
917
625
|
* @private Internal property used for field reference tracking.
|
|
918
626
|
*/
|
|
919
627
|
$$field: string;
|
|
920
628
|
get(fieldPath: string): any;
|
|
629
|
+
$$subfield: string[];
|
|
921
630
|
getByPath(fieldPath: string[]): {
|
|
922
|
-
$$subfield: string[];
|
|
923
631
|
/**
|
|
924
632
|
* @private Internal property used for field reference tracking.
|
|
925
633
|
*/
|
|
926
634
|
$$field: string;
|
|
927
635
|
get(fieldPath: string): any;
|
|
928
636
|
getByPath(fieldPath: string[]): any;
|
|
637
|
+
$$subfield: string[];
|
|
929
638
|
asDob(): any;
|
|
930
639
|
asAge(): any;
|
|
931
640
|
isAfter(): {
|