@opencrvs/toolkit 2.1.0-rc.2ec6bd5 → 2.1.0-rc.35e0e39

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.
Files changed (51) hide show
  1. package/dist/commons/api/router.d.ts +1565 -1565
  2. package/dist/commons/application-config/index.d.ts +6 -6
  3. package/dist/commons/conditionals/conditionals.d.ts +2102 -259
  4. package/dist/commons/events/ActionConfig.d.ts +105 -105
  5. package/dist/commons/events/ActionDocument.d.ts +113 -113
  6. package/dist/commons/events/ActionType.d.ts +62 -62
  7. package/dist/commons/events/AdvancedSearchConfig.d.ts +507 -507
  8. package/dist/commons/events/AuditLog.d.ts +43 -43
  9. package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
  10. package/dist/commons/events/Conditional.d.ts +3 -3
  11. package/dist/commons/events/CountryConfigQueryInput.d.ts +590 -590
  12. package/dist/commons/events/Draft.d.ts +37 -37
  13. package/dist/commons/events/DynamicFieldValue.d.ts +9 -9
  14. package/dist/commons/events/EventConfig.d.ts +5 -5
  15. package/dist/commons/events/EventDocument.d.ts +46 -46
  16. package/dist/commons/events/EventIndex.d.ts +62 -62
  17. package/dist/commons/events/EventMetadata.d.ts +40 -40
  18. package/dist/commons/events/FieldConfig.d.ts +337 -337
  19. package/dist/commons/events/FieldType.d.ts +51 -51
  20. package/dist/commons/events/FieldTypeMapping.d.ts +100 -100
  21. package/dist/commons/events/FieldValue.d.ts +12 -12
  22. package/dist/commons/events/Flag.d.ts +15 -15
  23. package/dist/commons/events/TemplateConfig.d.ts +1 -1
  24. package/dist/commons/events/WorkqueueColumnConfig.d.ts +40 -40
  25. package/dist/commons/events/WorkqueueConfig.d.ts +820 -820
  26. package/dist/commons/events/deduplication.d.ts +1 -1
  27. package/dist/commons/events/event.d.ts +2 -2
  28. package/dist/commons/events/field.d.ts +895 -78
  29. package/dist/commons/events/locations.d.ts +4 -4
  30. package/dist/commons/events/mocks.test.utils.d.ts +2 -2
  31. package/dist/commons/events/scopes.d.ts +4 -4
  32. package/dist/commons/events/state/index.d.ts +17 -17
  33. package/dist/commons/events/state/utils.d.ts +7 -7
  34. package/dist/commons/events/test.utils.d.ts +38 -35
  35. package/dist/commons/events/utils.d.ts +114 -114
  36. package/dist/commons/notification/UserNotifications.d.ts +10 -10
  37. package/dist/environment/derived-variables.d.ts +119 -119
  38. package/dist/environment/derived-variables.d.ts.map +1 -1
  39. package/dist/environment/logger.d.ts.map +1 -1
  40. package/dist/environment/questions.d.ts +74 -75
  41. package/dist/environment/questions.d.ts.map +1 -1
  42. package/dist/environment/setup-environment.js +14 -8
  43. package/dist/environment/utils.d.ts +1 -1
  44. package/dist/events/deduplication.d.ts +1 -1
  45. package/dist/events/index.js +1 -0
  46. package/dist/migrations/v2.0/migrate-application-config-url.js +3 -4
  47. package/dist/scopes/index.d.ts +146 -146
  48. package/opencrvs-toolkit-2.1.0-rc.35e0e39.tgz +0 -0
  49. package/package.json +4 -3
  50. package/tsconfig.tsbuildinfo +1 -1
  51. package/opencrvs-toolkit-2.1.0-rc.2ec6bd5.tgz +0 -0
@@ -83,70 +83,1915 @@ 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
+ };
86
94
  scope: (scope: import("../scopes").ScopeType) => {
87
95
  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";
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";
90
98
  };
91
99
  };
92
100
  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";
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";
95
103
  }) => {
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";
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";
99
107
  };
100
108
  };
101
- hasScope: (scope: string) => JSONSchema;
102
- hasRole: (role: string) => JSONSchema;
103
- isOnline: () => JSONSchema;
104
- locationLevel: (adminLevelId: string) => {
105
- $user: {
106
- $location: string;
109
+ };
110
+ export declare function isFieldReference(value: unknown): value is FieldReference;
111
+ export declare function isEventFieldReference(value: unknown): value is {
112
+ $$event: string;
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;
118
+ /**
119
+ * Generate conditional rules for a form field.
120
+ *
121
+ * @param fieldId - The field ID condition is applied to.
122
+ * @example to combine multiple conditions, utilise connectors like `and`, `or`, `not`:
123
+ * and(field('foo').isEqualTo('bar'), field('baz').isUndefined())
124
+ *
125
+ */
126
+ export declare function createFieldConditionals(fieldId: string): {
127
+ /**
128
+ * @private Internal property used for field reference tracking.
129
+ */
130
+ $$field: string;
131
+ /**
132
+ * @private Internal property used for solving a object path within field's value
133
+ */
134
+ $$subfield: string[];
135
+ get(fieldPath: string): {
136
+ $$subfield: string[];
137
+ /**
138
+ * @private Internal property used for field reference tracking.
139
+ */
140
+ $$field: string;
141
+ get(fieldPath: string): /*elided*/ any;
142
+ getByPath(fieldPath: string[]): {
143
+ $$subfield: string[];
144
+ /**
145
+ * @private Internal property used for field reference tracking.
146
+ */
147
+ $$field: string;
148
+ get(fieldPath: string): /*elided*/ any;
149
+ getByPath(fieldPath: string[]): /*elided*/ any;
150
+ asDob(): {
151
+ $$subfield: string[];
152
+ /**
153
+ * @private Internal property used for field reference tracking.
154
+ */
155
+ $$field: string;
156
+ get(fieldPath: string): /*elided*/ any;
157
+ getByPath(fieldPath: string[]): /*elided*/ any;
158
+ asDob(): /*elided*/ any;
159
+ asAge(): /*elided*/ any;
160
+ isAfter(): {
161
+ days: (days: number) => {
162
+ inPast: () => JSONSchema;
163
+ inFuture: () => JSONSchema;
164
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
165
+ fromNow: () => JSONSchema;
166
+ };
167
+ date: (date: string | FieldReference) => JSONSchema;
168
+ now: () => JSONSchema;
169
+ };
170
+ isBefore(): {
171
+ days: (days: number) => {
172
+ inPast: () => JSONSchema;
173
+ inFuture: () => JSONSchema;
174
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
175
+ fromNow: () => JSONSchema;
176
+ };
177
+ date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
178
+ now: () => JSONSchema;
179
+ };
180
+ isGreaterThan(value: number | FieldReference): JSONSchema;
181
+ isLessThan(value: number | FieldReference): JSONSchema;
182
+ isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
183
+ /**
184
+ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
185
+ * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
186
+ * @returns whether the field is falsy (undefined, false, null, empty string)
187
+ *
188
+ * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
189
+ *
190
+ */
191
+ isFalsy(): JSONSchema;
192
+ isUndefined(): JSONSchema;
193
+ inArray(values: string[]): JSONSchema;
194
+ isValidEnglishName(): JSONSchema;
195
+ isValidAdministrativeLeafLevel(): JSONSchema;
196
+ /**
197
+ * Checks if the field value matches a given regular expression pattern.
198
+ * @param pattern - The regular expression pattern to match the field value against.
199
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
200
+ */
201
+ matches(pattern: string): JSONSchema;
202
+ isBetween(min: number, max: number): JSONSchema;
203
+ getId: () => {
204
+ fieldId: string;
205
+ };
206
+ /**
207
+ * @deprecated
208
+ * use field(fieldId).get(nestedProperty) instead
209
+ * with 'and' combinator e.g.
210
+ * and(
211
+ * field('child.name').get('firstname').isEqualTo('John'),
212
+ * field('child.name').get('surname').isEqualTo('Doe')
213
+ * )
214
+ */
215
+ object: (options: Record<string, any>) => JSONSchema;
216
+ /**
217
+ * Custom client-side validator. The provided function is serialised and executed
218
+ * just-in-time on the client only. External references (e.g. lodash) are not
219
+ * available inside the function body — all logic must be self-contained.
220
+ *
221
+ * @example
222
+ * field('nid').customClientValidator((value) => {
223
+ * // LUHN check — all logic must be inline
224
+ * const digits = String(value).split('').map(Number)
225
+ * // ...
226
+ * return isValid
227
+ * })
228
+ */
229
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
230
+ /**
231
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
232
+ * that can be used as the `value` property or a DATA component entry.
233
+ * The function receives the referenced field's value as the first argument and
234
+ * the full form context as the second; its return value replaces the field reference.
235
+ * The function is serialised and executed just-in-time on the client only.
236
+ * External references (e.g. lodash) are not available inside the function body.
237
+ *
238
+ * For computing a default value without referencing a specific field, use
239
+ * `evaluate(fn)` in the `defaultValue` property instead.
240
+ *
241
+ * @example
242
+ * field('a').customClientEvaluation((aValue, ctx) =>
243
+ * Number(aValue) + Number(ctx.$form.b)
244
+ * )
245
+ */
246
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
247
+ };
248
+ asAge(): {
249
+ $$subfield: string[];
250
+ /**
251
+ * @private Internal property used for field reference tracking.
252
+ */
253
+ $$field: string;
254
+ get(fieldPath: string): /*elided*/ any;
255
+ getByPath(fieldPath: string[]): /*elided*/ any;
256
+ asDob(): /*elided*/ any;
257
+ asAge(): /*elided*/ any;
258
+ isAfter(): {
259
+ days: (days: number) => {
260
+ inPast: () => JSONSchema;
261
+ inFuture: () => JSONSchema;
262
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
263
+ fromNow: () => JSONSchema;
264
+ };
265
+ date: (date: string | FieldReference) => JSONSchema;
266
+ now: () => JSONSchema;
267
+ };
268
+ isBefore(): {
269
+ days: (days: number) => {
270
+ inPast: () => JSONSchema;
271
+ inFuture: () => JSONSchema;
272
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
273
+ fromNow: () => JSONSchema;
274
+ };
275
+ date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
276
+ now: () => JSONSchema;
277
+ };
278
+ isGreaterThan(value: number | FieldReference): JSONSchema;
279
+ isLessThan(value: number | FieldReference): JSONSchema;
280
+ isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
281
+ /**
282
+ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
283
+ * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
284
+ * @returns whether the field is falsy (undefined, false, null, empty string)
285
+ *
286
+ * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
287
+ *
288
+ */
289
+ isFalsy(): JSONSchema;
290
+ isUndefined(): JSONSchema;
291
+ inArray(values: string[]): JSONSchema;
292
+ isValidEnglishName(): JSONSchema;
293
+ isValidAdministrativeLeafLevel(): JSONSchema;
294
+ /**
295
+ * Checks if the field value matches a given regular expression pattern.
296
+ * @param pattern - The regular expression pattern to match the field value against.
297
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
298
+ */
299
+ matches(pattern: string): JSONSchema;
300
+ isBetween(min: number, max: number): JSONSchema;
301
+ getId: () => {
302
+ fieldId: string;
303
+ };
304
+ /**
305
+ * @deprecated
306
+ * use field(fieldId).get(nestedProperty) instead
307
+ * with 'and' combinator e.g.
308
+ * and(
309
+ * field('child.name').get('firstname').isEqualTo('John'),
310
+ * field('child.name').get('surname').isEqualTo('Doe')
311
+ * )
312
+ */
313
+ object: (options: Record<string, any>) => JSONSchema;
314
+ /**
315
+ * Custom client-side validator. The provided function is serialised and executed
316
+ * just-in-time on the client only. External references (e.g. lodash) are not
317
+ * available inside the function body — all logic must be self-contained.
318
+ *
319
+ * @example
320
+ * field('nid').customClientValidator((value) => {
321
+ * // LUHN check — all logic must be inline
322
+ * const digits = String(value).split('').map(Number)
323
+ * // ...
324
+ * return isValid
325
+ * })
326
+ */
327
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
328
+ /**
329
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
330
+ * that can be used as the `value` property or a DATA component entry.
331
+ * The function receives the referenced field's value as the first argument and
332
+ * the full form context as the second; its return value replaces the field reference.
333
+ * The function is serialised and executed just-in-time on the client only.
334
+ * External references (e.g. lodash) are not available inside the function body.
335
+ *
336
+ * For computing a default value without referencing a specific field, use
337
+ * `evaluate(fn)` in the `defaultValue` property instead.
338
+ *
339
+ * @example
340
+ * field('a').customClientEvaluation((aValue, ctx) =>
341
+ * Number(aValue) + Number(ctx.$form.b)
342
+ * )
343
+ */
344
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
345
+ };
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
+ };
434
+ asDob(): {
435
+ $$subfield: string[];
436
+ /**
437
+ * @private Internal property used for field reference tracking.
438
+ */
439
+ $$field: string;
440
+ get(fieldPath: string): /*elided*/ any;
441
+ getByPath(fieldPath: string[]): {
442
+ $$subfield: string[];
443
+ /**
444
+ * @private Internal property used for field reference tracking.
445
+ */
446
+ $$field: string;
447
+ get(fieldPath: string): /*elided*/ any;
448
+ getByPath(fieldPath: string[]): /*elided*/ any;
449
+ asDob(): /*elided*/ any;
450
+ asAge(): /*elided*/ any;
451
+ isAfter(): {
452
+ days: (days: number) => {
453
+ inPast: () => JSONSchema;
454
+ inFuture: () => JSONSchema;
455
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
456
+ fromNow: () => JSONSchema;
457
+ };
458
+ date: (date: string | FieldReference) => JSONSchema;
459
+ now: () => JSONSchema;
460
+ };
461
+ isBefore(): {
462
+ days: (days: number) => {
463
+ inPast: () => JSONSchema;
464
+ inFuture: () => JSONSchema;
465
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
466
+ fromNow: () => JSONSchema;
467
+ };
468
+ date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
469
+ now: () => JSONSchema;
470
+ };
471
+ isGreaterThan(value: number | FieldReference): JSONSchema;
472
+ isLessThan(value: number | FieldReference): JSONSchema;
473
+ isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
474
+ /**
475
+ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
476
+ * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
477
+ * @returns whether the field is falsy (undefined, false, null, empty string)
478
+ *
479
+ * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
480
+ *
481
+ */
482
+ isFalsy(): JSONSchema;
483
+ isUndefined(): JSONSchema;
484
+ inArray(values: string[]): JSONSchema;
485
+ isValidEnglishName(): JSONSchema;
486
+ isValidAdministrativeLeafLevel(): JSONSchema;
487
+ /**
488
+ * Checks if the field value matches a given regular expression pattern.
489
+ * @param pattern - The regular expression pattern to match the field value against.
490
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
491
+ */
492
+ matches(pattern: string): JSONSchema;
493
+ isBetween(min: number, max: number): JSONSchema;
494
+ getId: () => {
495
+ fieldId: string;
496
+ };
497
+ /**
498
+ * @deprecated
499
+ * use field(fieldId).get(nestedProperty) instead
500
+ * with 'and' combinator e.g.
501
+ * and(
502
+ * field('child.name').get('firstname').isEqualTo('John'),
503
+ * field('child.name').get('surname').isEqualTo('Doe')
504
+ * )
505
+ */
506
+ object: (options: Record<string, any>) => JSONSchema;
507
+ /**
508
+ * Custom client-side validator. The provided function is serialised and executed
509
+ * just-in-time on the client only. External references (e.g. lodash) are not
510
+ * available inside the function body — all logic must be self-contained.
511
+ *
512
+ * @example
513
+ * field('nid').customClientValidator((value) => {
514
+ * // LUHN check — all logic must be inline
515
+ * const digits = String(value).split('').map(Number)
516
+ * // ...
517
+ * return isValid
518
+ * })
519
+ */
520
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
521
+ /**
522
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
523
+ * that can be used as the `value` property or a DATA component entry.
524
+ * The function receives the referenced field's value as the first argument and
525
+ * the full form context as the second; its return value replaces the field reference.
526
+ * The function is serialised and executed just-in-time on the client only.
527
+ * External references (e.g. lodash) are not available inside the function body.
528
+ *
529
+ * For computing a default value without referencing a specific field, use
530
+ * `evaluate(fn)` in the `defaultValue` property instead.
531
+ *
532
+ * @example
533
+ * field('a').customClientEvaluation((aValue, ctx) =>
534
+ * Number(aValue) + Number(ctx.$form.b)
535
+ * )
536
+ */
537
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
538
+ };
539
+ asDob(): /*elided*/ any;
540
+ asAge(): /*elided*/ any;
541
+ isAfter(): {
542
+ days: (days: number) => {
543
+ inPast: () => JSONSchema;
544
+ inFuture: () => JSONSchema;
545
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
546
+ fromNow: () => JSONSchema;
547
+ };
548
+ date: (date: string | FieldReference) => JSONSchema;
549
+ now: () => JSONSchema;
550
+ };
551
+ isBefore(): {
552
+ days: (days: number) => {
553
+ inPast: () => JSONSchema;
554
+ inFuture: () => JSONSchema;
555
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
556
+ fromNow: () => JSONSchema;
557
+ };
558
+ date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
559
+ now: () => JSONSchema;
560
+ };
561
+ isGreaterThan(value: number | FieldReference): JSONSchema;
562
+ isLessThan(value: number | FieldReference): JSONSchema;
563
+ isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
564
+ /**
565
+ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
566
+ * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
567
+ * @returns whether the field is falsy (undefined, false, null, empty string)
568
+ *
569
+ * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
570
+ *
571
+ */
572
+ isFalsy(): JSONSchema;
573
+ isUndefined(): JSONSchema;
574
+ inArray(values: string[]): JSONSchema;
575
+ isValidEnglishName(): JSONSchema;
576
+ isValidAdministrativeLeafLevel(): JSONSchema;
577
+ /**
578
+ * Checks if the field value matches a given regular expression pattern.
579
+ * @param pattern - The regular expression pattern to match the field value against.
580
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
581
+ */
582
+ matches(pattern: string): JSONSchema;
583
+ isBetween(min: number, max: number): JSONSchema;
584
+ getId: () => {
585
+ fieldId: string;
586
+ };
587
+ /**
588
+ * @deprecated
589
+ * use field(fieldId).get(nestedProperty) instead
590
+ * with 'and' combinator e.g.
591
+ * and(
592
+ * field('child.name').get('firstname').isEqualTo('John'),
593
+ * field('child.name').get('surname').isEqualTo('Doe')
594
+ * )
595
+ */
596
+ object: (options: Record<string, any>) => JSONSchema;
597
+ /**
598
+ * Custom client-side validator. The provided function is serialised and executed
599
+ * just-in-time on the client only. External references (e.g. lodash) are not
600
+ * available inside the function body — all logic must be self-contained.
601
+ *
602
+ * @example
603
+ * field('nid').customClientValidator((value) => {
604
+ * // LUHN check — all logic must be inline
605
+ * const digits = String(value).split('').map(Number)
606
+ * // ...
607
+ * return isValid
608
+ * })
609
+ */
610
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
611
+ /**
612
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
613
+ * that can be used as the `value` property or a DATA component entry.
614
+ * The function receives the referenced field's value as the first argument and
615
+ * the full form context as the second; its return value replaces the field reference.
616
+ * The function is serialised and executed just-in-time on the client only.
617
+ * External references (e.g. lodash) are not available inside the function body.
618
+ *
619
+ * For computing a default value without referencing a specific field, use
620
+ * `evaluate(fn)` in the `defaultValue` property instead.
621
+ *
622
+ * @example
623
+ * field('a').customClientEvaluation((aValue, ctx) =>
624
+ * Number(aValue) + Number(ctx.$form.b)
625
+ * )
626
+ */
627
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
628
+ };
629
+ asAge(): {
630
+ $$subfield: string[];
631
+ /**
632
+ * @private Internal property used for field reference tracking.
633
+ */
634
+ $$field: string;
635
+ get(fieldPath: string): /*elided*/ any;
636
+ getByPath(fieldPath: string[]): {
637
+ $$subfield: string[];
638
+ /**
639
+ * @private Internal property used for field reference tracking.
640
+ */
641
+ $$field: string;
642
+ get(fieldPath: string): /*elided*/ any;
643
+ getByPath(fieldPath: string[]): /*elided*/ any;
644
+ asDob(): /*elided*/ any;
645
+ asAge(): /*elided*/ any;
646
+ isAfter(): {
647
+ days: (days: number) => {
648
+ inPast: () => JSONSchema;
649
+ inFuture: () => JSONSchema;
650
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
651
+ fromNow: () => JSONSchema;
652
+ };
653
+ date: (date: string | FieldReference) => JSONSchema;
654
+ now: () => JSONSchema;
655
+ };
656
+ isBefore(): {
657
+ days: (days: number) => {
658
+ inPast: () => JSONSchema;
659
+ inFuture: () => JSONSchema;
660
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
661
+ fromNow: () => JSONSchema;
662
+ };
663
+ date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
664
+ now: () => JSONSchema;
665
+ };
666
+ isGreaterThan(value: number | FieldReference): JSONSchema;
667
+ isLessThan(value: number | FieldReference): JSONSchema;
668
+ isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
669
+ /**
670
+ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
671
+ * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
672
+ * @returns whether the field is falsy (undefined, false, null, empty string)
673
+ *
674
+ * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
675
+ *
676
+ */
677
+ isFalsy(): JSONSchema;
678
+ isUndefined(): JSONSchema;
679
+ inArray(values: string[]): JSONSchema;
680
+ isValidEnglishName(): JSONSchema;
681
+ isValidAdministrativeLeafLevel(): JSONSchema;
682
+ /**
683
+ * Checks if the field value matches a given regular expression pattern.
684
+ * @param pattern - The regular expression pattern to match the field value against.
685
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
686
+ */
687
+ matches(pattern: string): JSONSchema;
688
+ isBetween(min: number, max: number): JSONSchema;
689
+ getId: () => {
690
+ fieldId: string;
691
+ };
692
+ /**
693
+ * @deprecated
694
+ * use field(fieldId).get(nestedProperty) instead
695
+ * with 'and' combinator e.g.
696
+ * and(
697
+ * field('child.name').get('firstname').isEqualTo('John'),
698
+ * field('child.name').get('surname').isEqualTo('Doe')
699
+ * )
700
+ */
701
+ object: (options: Record<string, any>) => JSONSchema;
702
+ /**
703
+ * Custom client-side validator. The provided function is serialised and executed
704
+ * just-in-time on the client only. External references (e.g. lodash) are not
705
+ * available inside the function body — all logic must be self-contained.
706
+ *
707
+ * @example
708
+ * field('nid').customClientValidator((value) => {
709
+ * // LUHN check — all logic must be inline
710
+ * const digits = String(value).split('').map(Number)
711
+ * // ...
712
+ * return isValid
713
+ * })
714
+ */
715
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
716
+ /**
717
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
718
+ * that can be used as the `value` property or a DATA component entry.
719
+ * The function receives the referenced field's value as the first argument and
720
+ * the full form context as the second; its return value replaces the field reference.
721
+ * The function is serialised and executed just-in-time on the client only.
722
+ * External references (e.g. lodash) are not available inside the function body.
723
+ *
724
+ * For computing a default value without referencing a specific field, use
725
+ * `evaluate(fn)` in the `defaultValue` property instead.
726
+ *
727
+ * @example
728
+ * field('a').customClientEvaluation((aValue, ctx) =>
729
+ * Number(aValue) + Number(ctx.$form.b)
730
+ * )
731
+ */
732
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
733
+ };
734
+ asDob(): /*elided*/ any;
735
+ asAge(): /*elided*/ any;
736
+ isAfter(): {
737
+ days: (days: number) => {
738
+ inPast: () => JSONSchema;
739
+ inFuture: () => JSONSchema;
740
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
741
+ fromNow: () => JSONSchema;
742
+ };
743
+ date: (date: string | FieldReference) => JSONSchema;
744
+ now: () => JSONSchema;
745
+ };
746
+ isBefore(): {
747
+ days: (days: number) => {
748
+ inPast: () => JSONSchema;
749
+ inFuture: () => JSONSchema;
750
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
751
+ fromNow: () => JSONSchema;
752
+ };
753
+ date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
754
+ now: () => JSONSchema;
755
+ };
756
+ isGreaterThan(value: number | FieldReference): JSONSchema;
757
+ isLessThan(value: number | FieldReference): JSONSchema;
758
+ isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
759
+ /**
760
+ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
761
+ * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
762
+ * @returns whether the field is falsy (undefined, false, null, empty string)
763
+ *
764
+ * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
765
+ *
766
+ */
767
+ isFalsy(): JSONSchema;
768
+ isUndefined(): JSONSchema;
769
+ inArray(values: string[]): JSONSchema;
770
+ isValidEnglishName(): JSONSchema;
771
+ isValidAdministrativeLeafLevel(): JSONSchema;
772
+ /**
773
+ * Checks if the field value matches a given regular expression pattern.
774
+ * @param pattern - The regular expression pattern to match the field value against.
775
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
776
+ */
777
+ matches(pattern: string): JSONSchema;
778
+ isBetween(min: number, max: number): JSONSchema;
779
+ getId: () => {
780
+ fieldId: string;
781
+ };
782
+ /**
783
+ * @deprecated
784
+ * use field(fieldId).get(nestedProperty) instead
785
+ * with 'and' combinator e.g.
786
+ * and(
787
+ * field('child.name').get('firstname').isEqualTo('John'),
788
+ * field('child.name').get('surname').isEqualTo('Doe')
789
+ * )
790
+ */
791
+ object: (options: Record<string, any>) => JSONSchema;
792
+ /**
793
+ * Custom client-side validator. The provided function is serialised and executed
794
+ * just-in-time on the client only. External references (e.g. lodash) are not
795
+ * available inside the function body — all logic must be self-contained.
796
+ *
797
+ * @example
798
+ * field('nid').customClientValidator((value) => {
799
+ * // LUHN check — all logic must be inline
800
+ * const digits = String(value).split('').map(Number)
801
+ * // ...
802
+ * return isValid
803
+ * })
804
+ */
805
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
806
+ /**
807
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
808
+ * that can be used as the `value` property or a DATA component entry.
809
+ * The function receives the referenced field's value as the first argument and
810
+ * the full form context as the second; its return value replaces the field reference.
811
+ * The function is serialised and executed just-in-time on the client only.
812
+ * External references (e.g. lodash) are not available inside the function body.
813
+ *
814
+ * For computing a default value without referencing a specific field, use
815
+ * `evaluate(fn)` in the `defaultValue` property instead.
816
+ *
817
+ * @example
818
+ * field('a').customClientEvaluation((aValue, ctx) =>
819
+ * Number(aValue) + Number(ctx.$form.b)
820
+ * )
821
+ */
822
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
823
+ };
824
+ isAfter(): {
825
+ days: (days: number) => {
826
+ inPast: () => JSONSchema;
827
+ inFuture: () => JSONSchema;
828
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
829
+ fromNow: () => JSONSchema;
830
+ };
831
+ date: (date: string | FieldReference) => JSONSchema;
832
+ now: () => JSONSchema;
833
+ };
834
+ isBefore(): {
835
+ days: (days: number) => {
836
+ inPast: () => JSONSchema;
837
+ inFuture: () => JSONSchema;
838
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
839
+ fromNow: () => JSONSchema;
840
+ };
841
+ date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
842
+ now: () => JSONSchema;
843
+ };
844
+ isGreaterThan(value: number | FieldReference): JSONSchema;
845
+ isLessThan(value: number | FieldReference): JSONSchema;
846
+ isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
847
+ /**
848
+ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
849
+ * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
850
+ * @returns whether the field is falsy (undefined, false, null, empty string)
851
+ *
852
+ * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
853
+ *
854
+ */
855
+ isFalsy(): JSONSchema;
856
+ isUndefined(): JSONSchema;
857
+ inArray(values: string[]): JSONSchema;
858
+ isValidEnglishName(): JSONSchema;
859
+ isValidAdministrativeLeafLevel(): JSONSchema;
860
+ /**
861
+ * Checks if the field value matches a given regular expression pattern.
862
+ * @param pattern - The regular expression pattern to match the field value against.
863
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
864
+ */
865
+ matches(pattern: string): JSONSchema;
866
+ isBetween(min: number, max: number): JSONSchema;
867
+ getId: () => {
868
+ fieldId: string;
869
+ };
870
+ /**
871
+ * @deprecated
872
+ * use field(fieldId).get(nestedProperty) instead
873
+ * with 'and' combinator e.g.
874
+ * and(
875
+ * field('child.name').get('firstname').isEqualTo('John'),
876
+ * field('child.name').get('surname').isEqualTo('Doe')
877
+ * )
878
+ */
879
+ object: (options: Record<string, any>) => JSONSchema;
880
+ /**
881
+ * Custom client-side validator. The provided function is serialised and executed
882
+ * just-in-time on the client only. External references (e.g. lodash) are not
883
+ * available inside the function body — all logic must be self-contained.
884
+ *
885
+ * @example
886
+ * field('nid').customClientValidator((value) => {
887
+ * // LUHN check — all logic must be inline
888
+ * const digits = String(value).split('').map(Number)
889
+ * // ...
890
+ * return isValid
891
+ * })
892
+ */
893
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
894
+ /**
895
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
896
+ * that can be used as the `value` property or a DATA component entry.
897
+ * The function receives the referenced field's value as the first argument and
898
+ * the full form context as the second; its return value replaces the field reference.
899
+ * The function is serialised and executed just-in-time on the client only.
900
+ * External references (e.g. lodash) are not available inside the function body.
901
+ *
902
+ * For computing a default value without referencing a specific field, use
903
+ * `evaluate(fn)` in the `defaultValue` property instead.
904
+ *
905
+ * @example
906
+ * field('a').customClientEvaluation((aValue, ctx) =>
907
+ * Number(aValue) + Number(ctx.$form.b)
908
+ * )
909
+ */
910
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
911
+ };
912
+ getByPath(fieldPath: string[]): {
913
+ $$subfield: string[];
914
+ /**
915
+ * @private Internal property used for field reference tracking.
916
+ */
917
+ $$field: string;
918
+ get(fieldPath: string): {
919
+ $$subfield: string[];
920
+ /**
921
+ * @private Internal property used for field reference tracking.
922
+ */
923
+ $$field: string;
924
+ get(fieldPath: string): /*elided*/ any;
925
+ getByPath(fieldPath: string[]): /*elided*/ any;
926
+ asDob(): {
927
+ $$subfield: string[];
928
+ /**
929
+ * @private Internal property used for field reference tracking.
930
+ */
931
+ $$field: string;
932
+ get(fieldPath: string): /*elided*/ any;
933
+ getByPath(fieldPath: string[]): /*elided*/ any;
934
+ asDob(): /*elided*/ any;
935
+ asAge(): /*elided*/ any;
936
+ isAfter(): {
937
+ days: (days: number) => {
938
+ inPast: () => JSONSchema;
939
+ inFuture: () => JSONSchema;
940
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
941
+ fromNow: () => JSONSchema;
942
+ };
943
+ date: (date: string | FieldReference) => JSONSchema;
944
+ now: () => JSONSchema;
945
+ };
946
+ isBefore(): {
947
+ days: (days: number) => {
948
+ inPast: () => JSONSchema;
949
+ inFuture: () => JSONSchema;
950
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
951
+ fromNow: () => JSONSchema;
952
+ };
953
+ date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
954
+ now: () => JSONSchema;
955
+ };
956
+ isGreaterThan(value: number | FieldReference): JSONSchema;
957
+ isLessThan(value: number | FieldReference): JSONSchema;
958
+ isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
959
+ /**
960
+ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
961
+ * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
962
+ * @returns whether the field is falsy (undefined, false, null, empty string)
963
+ *
964
+ * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
965
+ *
966
+ */
967
+ isFalsy(): JSONSchema;
968
+ isUndefined(): JSONSchema;
969
+ inArray(values: string[]): JSONSchema;
970
+ isValidEnglishName(): JSONSchema;
971
+ isValidAdministrativeLeafLevel(): JSONSchema;
972
+ /**
973
+ * Checks if the field value matches a given regular expression pattern.
974
+ * @param pattern - The regular expression pattern to match the field value against.
975
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
976
+ */
977
+ matches(pattern: string): JSONSchema;
978
+ isBetween(min: number, max: number): JSONSchema;
979
+ getId: () => {
980
+ fieldId: string;
981
+ };
982
+ /**
983
+ * @deprecated
984
+ * use field(fieldId).get(nestedProperty) instead
985
+ * with 'and' combinator e.g.
986
+ * and(
987
+ * field('child.name').get('firstname').isEqualTo('John'),
988
+ * field('child.name').get('surname').isEqualTo('Doe')
989
+ * )
990
+ */
991
+ object: (options: Record<string, any>) => JSONSchema;
992
+ /**
993
+ * Custom client-side validator. The provided function is serialised and executed
994
+ * just-in-time on the client only. External references (e.g. lodash) are not
995
+ * available inside the function body — all logic must be self-contained.
996
+ *
997
+ * @example
998
+ * field('nid').customClientValidator((value) => {
999
+ * // LUHN check — all logic must be inline
1000
+ * const digits = String(value).split('').map(Number)
1001
+ * // ...
1002
+ * return isValid
1003
+ * })
1004
+ */
1005
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
1006
+ /**
1007
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
1008
+ * that can be used as the `value` property or a DATA component entry.
1009
+ * The function receives the referenced field's value as the first argument and
1010
+ * the full form context as the second; its return value replaces the field reference.
1011
+ * The function is serialised and executed just-in-time on the client only.
1012
+ * External references (e.g. lodash) are not available inside the function body.
1013
+ *
1014
+ * For computing a default value without referencing a specific field, use
1015
+ * `evaluate(fn)` in the `defaultValue` property instead.
1016
+ *
1017
+ * @example
1018
+ * field('a').customClientEvaluation((aValue, ctx) =>
1019
+ * Number(aValue) + Number(ctx.$form.b)
1020
+ * )
1021
+ */
1022
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
1023
+ };
1024
+ asAge(): {
1025
+ $$subfield: string[];
1026
+ /**
1027
+ * @private Internal property used for field reference tracking.
1028
+ */
1029
+ $$field: string;
1030
+ get(fieldPath: string): /*elided*/ any;
1031
+ getByPath(fieldPath: string[]): /*elided*/ any;
1032
+ asDob(): /*elided*/ any;
1033
+ asAge(): /*elided*/ any;
1034
+ isAfter(): {
1035
+ days: (days: number) => {
1036
+ inPast: () => JSONSchema;
1037
+ inFuture: () => JSONSchema;
1038
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1039
+ fromNow: () => JSONSchema;
1040
+ };
1041
+ date: (date: string | FieldReference) => JSONSchema;
1042
+ now: () => JSONSchema;
1043
+ };
1044
+ isBefore(): {
1045
+ days: (days: number) => {
1046
+ inPast: () => JSONSchema;
1047
+ inFuture: () => JSONSchema;
1048
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1049
+ fromNow: () => JSONSchema;
1050
+ };
1051
+ date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1052
+ now: () => JSONSchema;
1053
+ };
1054
+ isGreaterThan(value: number | FieldReference): JSONSchema;
1055
+ isLessThan(value: number | FieldReference): JSONSchema;
1056
+ isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
1057
+ /**
1058
+ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
1059
+ * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
1060
+ * @returns whether the field is falsy (undefined, false, null, empty string)
1061
+ *
1062
+ * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
1063
+ *
1064
+ */
1065
+ isFalsy(): JSONSchema;
1066
+ isUndefined(): JSONSchema;
1067
+ inArray(values: string[]): JSONSchema;
1068
+ isValidEnglishName(): JSONSchema;
1069
+ isValidAdministrativeLeafLevel(): JSONSchema;
1070
+ /**
1071
+ * Checks if the field value matches a given regular expression pattern.
1072
+ * @param pattern - The regular expression pattern to match the field value against.
1073
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
1074
+ */
1075
+ matches(pattern: string): JSONSchema;
1076
+ isBetween(min: number, max: number): JSONSchema;
1077
+ getId: () => {
1078
+ fieldId: string;
1079
+ };
1080
+ /**
1081
+ * @deprecated
1082
+ * use field(fieldId).get(nestedProperty) instead
1083
+ * with 'and' combinator e.g.
1084
+ * and(
1085
+ * field('child.name').get('firstname').isEqualTo('John'),
1086
+ * field('child.name').get('surname').isEqualTo('Doe')
1087
+ * )
1088
+ */
1089
+ object: (options: Record<string, any>) => JSONSchema;
1090
+ /**
1091
+ * Custom client-side validator. The provided function is serialised and executed
1092
+ * just-in-time on the client only. External references (e.g. lodash) are not
1093
+ * available inside the function body — all logic must be self-contained.
1094
+ *
1095
+ * @example
1096
+ * field('nid').customClientValidator((value) => {
1097
+ * // LUHN check — all logic must be inline
1098
+ * const digits = String(value).split('').map(Number)
1099
+ * // ...
1100
+ * return isValid
1101
+ * })
1102
+ */
1103
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
1104
+ /**
1105
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
1106
+ * that can be used as the `value` property or a DATA component entry.
1107
+ * The function receives the referenced field's value as the first argument and
1108
+ * the full form context as the second; its return value replaces the field reference.
1109
+ * The function is serialised and executed just-in-time on the client only.
1110
+ * External references (e.g. lodash) are not available inside the function body.
1111
+ *
1112
+ * For computing a default value without referencing a specific field, use
1113
+ * `evaluate(fn)` in the `defaultValue` property instead.
1114
+ *
1115
+ * @example
1116
+ * field('a').customClientEvaluation((aValue, ctx) =>
1117
+ * Number(aValue) + Number(ctx.$form.b)
1118
+ * )
1119
+ */
1120
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
1121
+ };
1122
+ isAfter(): {
1123
+ days: (days: number) => {
1124
+ inPast: () => JSONSchema;
1125
+ inFuture: () => JSONSchema;
1126
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1127
+ fromNow: () => JSONSchema;
1128
+ };
1129
+ date: (date: string | FieldReference) => JSONSchema;
1130
+ now: () => JSONSchema;
1131
+ };
1132
+ isBefore(): {
1133
+ days: (days: number) => {
1134
+ inPast: () => JSONSchema;
1135
+ inFuture: () => JSONSchema;
1136
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1137
+ fromNow: () => JSONSchema;
1138
+ };
1139
+ date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1140
+ now: () => JSONSchema;
1141
+ };
1142
+ isGreaterThan(value: number | FieldReference): JSONSchema;
1143
+ isLessThan(value: number | FieldReference): JSONSchema;
1144
+ isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
1145
+ /**
1146
+ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
1147
+ * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
1148
+ * @returns whether the field is falsy (undefined, false, null, empty string)
1149
+ *
1150
+ * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
1151
+ *
1152
+ */
1153
+ isFalsy(): JSONSchema;
1154
+ isUndefined(): JSONSchema;
1155
+ inArray(values: string[]): JSONSchema;
1156
+ isValidEnglishName(): JSONSchema;
1157
+ isValidAdministrativeLeafLevel(): JSONSchema;
1158
+ /**
1159
+ * Checks if the field value matches a given regular expression pattern.
1160
+ * @param pattern - The regular expression pattern to match the field value against.
1161
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
1162
+ */
1163
+ matches(pattern: string): JSONSchema;
1164
+ isBetween(min: number, max: number): JSONSchema;
1165
+ getId: () => {
1166
+ fieldId: string;
1167
+ };
1168
+ /**
1169
+ * @deprecated
1170
+ * use field(fieldId).get(nestedProperty) instead
1171
+ * with 'and' combinator e.g.
1172
+ * and(
1173
+ * field('child.name').get('firstname').isEqualTo('John'),
1174
+ * field('child.name').get('surname').isEqualTo('Doe')
1175
+ * )
1176
+ */
1177
+ object: (options: Record<string, any>) => JSONSchema;
1178
+ /**
1179
+ * Custom client-side validator. The provided function is serialised and executed
1180
+ * just-in-time on the client only. External references (e.g. lodash) are not
1181
+ * available inside the function body — all logic must be self-contained.
1182
+ *
1183
+ * @example
1184
+ * field('nid').customClientValidator((value) => {
1185
+ * // LUHN check — all logic must be inline
1186
+ * const digits = String(value).split('').map(Number)
1187
+ * // ...
1188
+ * return isValid
1189
+ * })
1190
+ */
1191
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
1192
+ /**
1193
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
1194
+ * that can be used as the `value` property or a DATA component entry.
1195
+ * The function receives the referenced field's value as the first argument and
1196
+ * the full form context as the second; its return value replaces the field reference.
1197
+ * The function is serialised and executed just-in-time on the client only.
1198
+ * External references (e.g. lodash) are not available inside the function body.
1199
+ *
1200
+ * For computing a default value without referencing a specific field, use
1201
+ * `evaluate(fn)` in the `defaultValue` property instead.
1202
+ *
1203
+ * @example
1204
+ * field('a').customClientEvaluation((aValue, ctx) =>
1205
+ * Number(aValue) + Number(ctx.$form.b)
1206
+ * )
1207
+ */
1208
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
1209
+ };
1210
+ getByPath(fieldPath: string[]): /*elided*/ any;
1211
+ asDob(): {
1212
+ $$subfield: string[];
1213
+ /**
1214
+ * @private Internal property used for field reference tracking.
1215
+ */
1216
+ $$field: string;
1217
+ get(fieldPath: string): {
1218
+ $$subfield: string[];
1219
+ /**
1220
+ * @private Internal property used for field reference tracking.
1221
+ */
1222
+ $$field: string;
1223
+ get(fieldPath: string): /*elided*/ any;
1224
+ getByPath(fieldPath: string[]): /*elided*/ any;
1225
+ asDob(): /*elided*/ any;
1226
+ asAge(): /*elided*/ any;
1227
+ isAfter(): {
1228
+ days: (days: number) => {
1229
+ inPast: () => JSONSchema;
1230
+ inFuture: () => JSONSchema;
1231
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1232
+ fromNow: () => JSONSchema;
1233
+ };
1234
+ date: (date: string | FieldReference) => JSONSchema;
1235
+ now: () => JSONSchema;
1236
+ };
1237
+ isBefore(): {
1238
+ days: (days: number) => {
1239
+ inPast: () => JSONSchema;
1240
+ inFuture: () => JSONSchema;
1241
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1242
+ fromNow: () => JSONSchema;
1243
+ };
1244
+ date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1245
+ now: () => JSONSchema;
1246
+ };
1247
+ isGreaterThan(value: number | FieldReference): JSONSchema;
1248
+ isLessThan(value: number | FieldReference): JSONSchema;
1249
+ isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
1250
+ /**
1251
+ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
1252
+ * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
1253
+ * @returns whether the field is falsy (undefined, false, null, empty string)
1254
+ *
1255
+ * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
1256
+ *
1257
+ */
1258
+ isFalsy(): JSONSchema;
1259
+ isUndefined(): JSONSchema;
1260
+ inArray(values: string[]): JSONSchema;
1261
+ isValidEnglishName(): JSONSchema;
1262
+ isValidAdministrativeLeafLevel(): JSONSchema;
1263
+ /**
1264
+ * Checks if the field value matches a given regular expression pattern.
1265
+ * @param pattern - The regular expression pattern to match the field value against.
1266
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
1267
+ */
1268
+ matches(pattern: string): JSONSchema;
1269
+ isBetween(min: number, max: number): JSONSchema;
1270
+ getId: () => {
1271
+ fieldId: string;
1272
+ };
1273
+ /**
1274
+ * @deprecated
1275
+ * use field(fieldId).get(nestedProperty) instead
1276
+ * with 'and' combinator e.g.
1277
+ * and(
1278
+ * field('child.name').get('firstname').isEqualTo('John'),
1279
+ * field('child.name').get('surname').isEqualTo('Doe')
1280
+ * )
1281
+ */
1282
+ object: (options: Record<string, any>) => JSONSchema;
1283
+ /**
1284
+ * Custom client-side validator. The provided function is serialised and executed
1285
+ * just-in-time on the client only. External references (e.g. lodash) are not
1286
+ * available inside the function body — all logic must be self-contained.
1287
+ *
1288
+ * @example
1289
+ * field('nid').customClientValidator((value) => {
1290
+ * // LUHN check — all logic must be inline
1291
+ * const digits = String(value).split('').map(Number)
1292
+ * // ...
1293
+ * return isValid
1294
+ * })
1295
+ */
1296
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
1297
+ /**
1298
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
1299
+ * that can be used as the `value` property or a DATA component entry.
1300
+ * The function receives the referenced field's value as the first argument and
1301
+ * the full form context as the second; its return value replaces the field reference.
1302
+ * The function is serialised and executed just-in-time on the client only.
1303
+ * External references (e.g. lodash) are not available inside the function body.
1304
+ *
1305
+ * For computing a default value without referencing a specific field, use
1306
+ * `evaluate(fn)` in the `defaultValue` property instead.
1307
+ *
1308
+ * @example
1309
+ * field('a').customClientEvaluation((aValue, ctx) =>
1310
+ * Number(aValue) + Number(ctx.$form.b)
1311
+ * )
1312
+ */
1313
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
1314
+ };
1315
+ getByPath(fieldPath: string[]): /*elided*/ any;
1316
+ asDob(): /*elided*/ any;
1317
+ asAge(): /*elided*/ any;
1318
+ isAfter(): {
1319
+ days: (days: number) => {
1320
+ inPast: () => JSONSchema;
1321
+ inFuture: () => JSONSchema;
1322
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1323
+ fromNow: () => JSONSchema;
1324
+ };
1325
+ date: (date: string | FieldReference) => JSONSchema;
1326
+ now: () => JSONSchema;
1327
+ };
1328
+ isBefore(): {
1329
+ days: (days: number) => {
1330
+ inPast: () => JSONSchema;
1331
+ inFuture: () => JSONSchema;
1332
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1333
+ fromNow: () => JSONSchema;
1334
+ };
1335
+ date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1336
+ now: () => JSONSchema;
1337
+ };
1338
+ isGreaterThan(value: number | FieldReference): JSONSchema;
1339
+ isLessThan(value: number | FieldReference): JSONSchema;
1340
+ isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
1341
+ /**
1342
+ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
1343
+ * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
1344
+ * @returns whether the field is falsy (undefined, false, null, empty string)
1345
+ *
1346
+ * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
1347
+ *
1348
+ */
1349
+ isFalsy(): JSONSchema;
1350
+ isUndefined(): JSONSchema;
1351
+ inArray(values: string[]): JSONSchema;
1352
+ isValidEnglishName(): JSONSchema;
1353
+ isValidAdministrativeLeafLevel(): JSONSchema;
1354
+ /**
1355
+ * Checks if the field value matches a given regular expression pattern.
1356
+ * @param pattern - The regular expression pattern to match the field value against.
1357
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
1358
+ */
1359
+ matches(pattern: string): JSONSchema;
1360
+ isBetween(min: number, max: number): JSONSchema;
1361
+ getId: () => {
1362
+ fieldId: string;
1363
+ };
1364
+ /**
1365
+ * @deprecated
1366
+ * use field(fieldId).get(nestedProperty) instead
1367
+ * with 'and' combinator e.g.
1368
+ * and(
1369
+ * field('child.name').get('firstname').isEqualTo('John'),
1370
+ * field('child.name').get('surname').isEqualTo('Doe')
1371
+ * )
1372
+ */
1373
+ object: (options: Record<string, any>) => JSONSchema;
1374
+ /**
1375
+ * Custom client-side validator. The provided function is serialised and executed
1376
+ * just-in-time on the client only. External references (e.g. lodash) are not
1377
+ * available inside the function body — all logic must be self-contained.
1378
+ *
1379
+ * @example
1380
+ * field('nid').customClientValidator((value) => {
1381
+ * // LUHN check — all logic must be inline
1382
+ * const digits = String(value).split('').map(Number)
1383
+ * // ...
1384
+ * return isValid
1385
+ * })
1386
+ */
1387
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
1388
+ /**
1389
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
1390
+ * that can be used as the `value` property or a DATA component entry.
1391
+ * The function receives the referenced field's value as the first argument and
1392
+ * the full form context as the second; its return value replaces the field reference.
1393
+ * The function is serialised and executed just-in-time on the client only.
1394
+ * External references (e.g. lodash) are not available inside the function body.
1395
+ *
1396
+ * For computing a default value without referencing a specific field, use
1397
+ * `evaluate(fn)` in the `defaultValue` property instead.
1398
+ *
1399
+ * @example
1400
+ * field('a').customClientEvaluation((aValue, ctx) =>
1401
+ * Number(aValue) + Number(ctx.$form.b)
1402
+ * )
1403
+ */
1404
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
1405
+ };
1406
+ asAge(): {
1407
+ $$subfield: string[];
1408
+ /**
1409
+ * @private Internal property used for field reference tracking.
1410
+ */
1411
+ $$field: string;
1412
+ get(fieldPath: string): {
1413
+ $$subfield: string[];
1414
+ /**
1415
+ * @private Internal property used for field reference tracking.
1416
+ */
1417
+ $$field: string;
1418
+ get(fieldPath: string): /*elided*/ any;
1419
+ getByPath(fieldPath: string[]): /*elided*/ any;
1420
+ asDob(): /*elided*/ any;
1421
+ asAge(): /*elided*/ any;
1422
+ isAfter(): {
1423
+ days: (days: number) => {
1424
+ inPast: () => JSONSchema;
1425
+ inFuture: () => JSONSchema;
1426
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1427
+ fromNow: () => JSONSchema;
1428
+ };
1429
+ date: (date: string | FieldReference) => JSONSchema;
1430
+ now: () => JSONSchema;
1431
+ };
1432
+ isBefore(): {
1433
+ days: (days: number) => {
1434
+ inPast: () => JSONSchema;
1435
+ inFuture: () => JSONSchema;
1436
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1437
+ fromNow: () => JSONSchema;
1438
+ };
1439
+ date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1440
+ now: () => JSONSchema;
1441
+ };
1442
+ isGreaterThan(value: number | FieldReference): JSONSchema;
1443
+ isLessThan(value: number | FieldReference): JSONSchema;
1444
+ isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
1445
+ /**
1446
+ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
1447
+ * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
1448
+ * @returns whether the field is falsy (undefined, false, null, empty string)
1449
+ *
1450
+ * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
1451
+ *
1452
+ */
1453
+ isFalsy(): JSONSchema;
1454
+ isUndefined(): JSONSchema;
1455
+ inArray(values: string[]): JSONSchema;
1456
+ isValidEnglishName(): JSONSchema;
1457
+ isValidAdministrativeLeafLevel(): JSONSchema;
1458
+ /**
1459
+ * Checks if the field value matches a given regular expression pattern.
1460
+ * @param pattern - The regular expression pattern to match the field value against.
1461
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
1462
+ */
1463
+ matches(pattern: string): JSONSchema;
1464
+ isBetween(min: number, max: number): JSONSchema;
1465
+ getId: () => {
1466
+ fieldId: string;
1467
+ };
1468
+ /**
1469
+ * @deprecated
1470
+ * use field(fieldId).get(nestedProperty) instead
1471
+ * with 'and' combinator e.g.
1472
+ * and(
1473
+ * field('child.name').get('firstname').isEqualTo('John'),
1474
+ * field('child.name').get('surname').isEqualTo('Doe')
1475
+ * )
1476
+ */
1477
+ object: (options: Record<string, any>) => JSONSchema;
1478
+ /**
1479
+ * Custom client-side validator. The provided function is serialised and executed
1480
+ * just-in-time on the client only. External references (e.g. lodash) are not
1481
+ * available inside the function body — all logic must be self-contained.
1482
+ *
1483
+ * @example
1484
+ * field('nid').customClientValidator((value) => {
1485
+ * // LUHN check — all logic must be inline
1486
+ * const digits = String(value).split('').map(Number)
1487
+ * // ...
1488
+ * return isValid
1489
+ * })
1490
+ */
1491
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
1492
+ /**
1493
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
1494
+ * that can be used as the `value` property or a DATA component entry.
1495
+ * The function receives the referenced field's value as the first argument and
1496
+ * the full form context as the second; its return value replaces the field reference.
1497
+ * The function is serialised and executed just-in-time on the client only.
1498
+ * External references (e.g. lodash) are not available inside the function body.
1499
+ *
1500
+ * For computing a default value without referencing a specific field, use
1501
+ * `evaluate(fn)` in the `defaultValue` property instead.
1502
+ *
1503
+ * @example
1504
+ * field('a').customClientEvaluation((aValue, ctx) =>
1505
+ * Number(aValue) + Number(ctx.$form.b)
1506
+ * )
1507
+ */
1508
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
1509
+ };
1510
+ getByPath(fieldPath: string[]): /*elided*/ any;
1511
+ asDob(): /*elided*/ any;
1512
+ asAge(): /*elided*/ any;
1513
+ isAfter(): {
1514
+ days: (days: number) => {
1515
+ inPast: () => JSONSchema;
1516
+ inFuture: () => JSONSchema;
1517
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1518
+ fromNow: () => JSONSchema;
1519
+ };
1520
+ date: (date: string | FieldReference) => JSONSchema;
1521
+ now: () => JSONSchema;
1522
+ };
1523
+ isBefore(): {
1524
+ days: (days: number) => {
1525
+ inPast: () => JSONSchema;
1526
+ inFuture: () => JSONSchema;
1527
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1528
+ fromNow: () => JSONSchema;
1529
+ };
1530
+ date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1531
+ now: () => JSONSchema;
1532
+ };
1533
+ isGreaterThan(value: number | FieldReference): JSONSchema;
1534
+ isLessThan(value: number | FieldReference): JSONSchema;
1535
+ isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
1536
+ /**
1537
+ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
1538
+ * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
1539
+ * @returns whether the field is falsy (undefined, false, null, empty string)
1540
+ *
1541
+ * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
1542
+ *
1543
+ */
1544
+ isFalsy(): JSONSchema;
1545
+ isUndefined(): JSONSchema;
1546
+ inArray(values: string[]): JSONSchema;
1547
+ isValidEnglishName(): JSONSchema;
1548
+ isValidAdministrativeLeafLevel(): JSONSchema;
1549
+ /**
1550
+ * Checks if the field value matches a given regular expression pattern.
1551
+ * @param pattern - The regular expression pattern to match the field value against.
1552
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
1553
+ */
1554
+ matches(pattern: string): JSONSchema;
1555
+ isBetween(min: number, max: number): JSONSchema;
1556
+ getId: () => {
1557
+ fieldId: string;
1558
+ };
1559
+ /**
1560
+ * @deprecated
1561
+ * use field(fieldId).get(nestedProperty) instead
1562
+ * with 'and' combinator e.g.
1563
+ * and(
1564
+ * field('child.name').get('firstname').isEqualTo('John'),
1565
+ * field('child.name').get('surname').isEqualTo('Doe')
1566
+ * )
1567
+ */
1568
+ object: (options: Record<string, any>) => JSONSchema;
1569
+ /**
1570
+ * Custom client-side validator. The provided function is serialised and executed
1571
+ * just-in-time on the client only. External references (e.g. lodash) are not
1572
+ * available inside the function body — all logic must be self-contained.
1573
+ *
1574
+ * @example
1575
+ * field('nid').customClientValidator((value) => {
1576
+ * // LUHN check — all logic must be inline
1577
+ * const digits = String(value).split('').map(Number)
1578
+ * // ...
1579
+ * return isValid
1580
+ * })
1581
+ */
1582
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
1583
+ /**
1584
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
1585
+ * that can be used as the `value` property or a DATA component entry.
1586
+ * The function receives the referenced field's value as the first argument and
1587
+ * the full form context as the second; its return value replaces the field reference.
1588
+ * The function is serialised and executed just-in-time on the client only.
1589
+ * External references (e.g. lodash) are not available inside the function body.
1590
+ *
1591
+ * For computing a default value without referencing a specific field, use
1592
+ * `evaluate(fn)` in the `defaultValue` property instead.
1593
+ *
1594
+ * @example
1595
+ * field('a').customClientEvaluation((aValue, ctx) =>
1596
+ * Number(aValue) + Number(ctx.$form.b)
1597
+ * )
1598
+ */
1599
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
1600
+ };
1601
+ isAfter(): {
1602
+ days: (days: number) => {
1603
+ inPast: () => JSONSchema;
1604
+ inFuture: () => JSONSchema;
1605
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1606
+ fromNow: () => JSONSchema;
1607
+ };
1608
+ date: (date: string | FieldReference) => JSONSchema;
1609
+ now: () => JSONSchema;
1610
+ };
1611
+ isBefore(): {
1612
+ days: (days: number) => {
1613
+ inPast: () => JSONSchema;
1614
+ inFuture: () => JSONSchema;
1615
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1616
+ fromNow: () => JSONSchema;
1617
+ };
1618
+ date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1619
+ now: () => JSONSchema;
1620
+ };
1621
+ isGreaterThan(value: number | FieldReference): JSONSchema;
1622
+ isLessThan(value: number | FieldReference): JSONSchema;
1623
+ isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
1624
+ /**
1625
+ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
1626
+ * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
1627
+ * @returns whether the field is falsy (undefined, false, null, empty string)
1628
+ *
1629
+ * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
1630
+ *
1631
+ */
1632
+ isFalsy(): JSONSchema;
1633
+ isUndefined(): JSONSchema;
1634
+ inArray(values: string[]): JSONSchema;
1635
+ isValidEnglishName(): JSONSchema;
1636
+ isValidAdministrativeLeafLevel(): JSONSchema;
1637
+ /**
1638
+ * Checks if the field value matches a given regular expression pattern.
1639
+ * @param pattern - The regular expression pattern to match the field value against.
1640
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
1641
+ */
1642
+ matches(pattern: string): JSONSchema;
1643
+ isBetween(min: number, max: number): JSONSchema;
1644
+ getId: () => {
1645
+ fieldId: string;
1646
+ };
1647
+ /**
1648
+ * @deprecated
1649
+ * use field(fieldId).get(nestedProperty) instead
1650
+ * with 'and' combinator e.g.
1651
+ * and(
1652
+ * field('child.name').get('firstname').isEqualTo('John'),
1653
+ * field('child.name').get('surname').isEqualTo('Doe')
1654
+ * )
1655
+ */
1656
+ object: (options: Record<string, any>) => JSONSchema;
1657
+ /**
1658
+ * Custom client-side validator. The provided function is serialised and executed
1659
+ * just-in-time on the client only. External references (e.g. lodash) are not
1660
+ * available inside the function body — all logic must be self-contained.
1661
+ *
1662
+ * @example
1663
+ * field('nid').customClientValidator((value) => {
1664
+ * // LUHN check — all logic must be inline
1665
+ * const digits = String(value).split('').map(Number)
1666
+ * // ...
1667
+ * return isValid
1668
+ * })
1669
+ */
1670
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
1671
+ /**
1672
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
1673
+ * that can be used as the `value` property or a DATA component entry.
1674
+ * The function receives the referenced field's value as the first argument and
1675
+ * the full form context as the second; its return value replaces the field reference.
1676
+ * The function is serialised and executed just-in-time on the client only.
1677
+ * External references (e.g. lodash) are not available inside the function body.
1678
+ *
1679
+ * For computing a default value without referencing a specific field, use
1680
+ * `evaluate(fn)` in the `defaultValue` property instead.
1681
+ *
1682
+ * @example
1683
+ * field('a').customClientEvaluation((aValue, ctx) =>
1684
+ * Number(aValue) + Number(ctx.$form.b)
1685
+ * )
1686
+ */
1687
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
1688
+ };
1689
+ asDob(): {
1690
+ $$subfield: string[];
1691
+ /**
1692
+ * @private Internal property used for field reference tracking.
1693
+ */
1694
+ $$field: string;
1695
+ get(fieldPath: string): {
1696
+ $$subfield: string[];
1697
+ /**
1698
+ * @private Internal property used for field reference tracking.
1699
+ */
1700
+ $$field: string;
1701
+ get(fieldPath: string): /*elided*/ any;
1702
+ getByPath(fieldPath: string[]): {
1703
+ $$subfield: string[];
1704
+ /**
1705
+ * @private Internal property used for field reference tracking.
1706
+ */
1707
+ $$field: string;
1708
+ get(fieldPath: string): /*elided*/ any;
1709
+ getByPath(fieldPath: string[]): /*elided*/ any;
1710
+ asDob(): /*elided*/ any;
1711
+ asAge(): /*elided*/ any;
1712
+ isAfter(): {
1713
+ days: (days: number) => {
1714
+ inPast: () => JSONSchema;
1715
+ inFuture: () => JSONSchema;
1716
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1717
+ fromNow: () => JSONSchema;
1718
+ };
1719
+ date: (date: string | FieldReference) => JSONSchema;
1720
+ now: () => JSONSchema;
1721
+ };
1722
+ isBefore(): {
1723
+ days: (days: number) => {
1724
+ inPast: () => JSONSchema;
1725
+ inFuture: () => JSONSchema;
1726
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1727
+ fromNow: () => JSONSchema;
1728
+ };
1729
+ date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1730
+ now: () => JSONSchema;
1731
+ };
1732
+ isGreaterThan(value: number | FieldReference): JSONSchema;
1733
+ isLessThan(value: number | FieldReference): JSONSchema;
1734
+ isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
1735
+ /**
1736
+ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
1737
+ * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
1738
+ * @returns whether the field is falsy (undefined, false, null, empty string)
1739
+ *
1740
+ * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
1741
+ *
1742
+ */
1743
+ isFalsy(): JSONSchema;
1744
+ isUndefined(): JSONSchema;
1745
+ inArray(values: string[]): JSONSchema;
1746
+ isValidEnglishName(): JSONSchema;
1747
+ isValidAdministrativeLeafLevel(): JSONSchema;
1748
+ /**
1749
+ * Checks if the field value matches a given regular expression pattern.
1750
+ * @param pattern - The regular expression pattern to match the field value against.
1751
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
1752
+ */
1753
+ matches(pattern: string): JSONSchema;
1754
+ isBetween(min: number, max: number): JSONSchema;
1755
+ getId: () => {
1756
+ fieldId: string;
1757
+ };
1758
+ /**
1759
+ * @deprecated
1760
+ * use field(fieldId).get(nestedProperty) instead
1761
+ * with 'and' combinator e.g.
1762
+ * and(
1763
+ * field('child.name').get('firstname').isEqualTo('John'),
1764
+ * field('child.name').get('surname').isEqualTo('Doe')
1765
+ * )
1766
+ */
1767
+ object: (options: Record<string, any>) => JSONSchema;
1768
+ /**
1769
+ * Custom client-side validator. The provided function is serialised and executed
1770
+ * just-in-time on the client only. External references (e.g. lodash) are not
1771
+ * available inside the function body — all logic must be self-contained.
1772
+ *
1773
+ * @example
1774
+ * field('nid').customClientValidator((value) => {
1775
+ * // LUHN check — all logic must be inline
1776
+ * const digits = String(value).split('').map(Number)
1777
+ * // ...
1778
+ * return isValid
1779
+ * })
1780
+ */
1781
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
1782
+ /**
1783
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
1784
+ * that can be used as the `value` property or a DATA component entry.
1785
+ * The function receives the referenced field's value as the first argument and
1786
+ * the full form context as the second; its return value replaces the field reference.
1787
+ * The function is serialised and executed just-in-time on the client only.
1788
+ * External references (e.g. lodash) are not available inside the function body.
1789
+ *
1790
+ * For computing a default value without referencing a specific field, use
1791
+ * `evaluate(fn)` in the `defaultValue` property instead.
1792
+ *
1793
+ * @example
1794
+ * field('a').customClientEvaluation((aValue, ctx) =>
1795
+ * Number(aValue) + Number(ctx.$form.b)
1796
+ * )
1797
+ */
1798
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
1799
+ };
1800
+ asDob(): /*elided*/ any;
1801
+ asAge(): /*elided*/ any;
1802
+ isAfter(): {
1803
+ days: (days: number) => {
1804
+ inPast: () => JSONSchema;
1805
+ inFuture: () => JSONSchema;
1806
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1807
+ fromNow: () => JSONSchema;
1808
+ };
1809
+ date: (date: string | FieldReference) => JSONSchema;
1810
+ now: () => JSONSchema;
1811
+ };
1812
+ isBefore(): {
1813
+ days: (days: number) => {
1814
+ inPast: () => JSONSchema;
1815
+ inFuture: () => JSONSchema;
1816
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1817
+ fromNow: () => JSONSchema;
1818
+ };
1819
+ date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1820
+ now: () => JSONSchema;
1821
+ };
1822
+ isGreaterThan(value: number | FieldReference): JSONSchema;
1823
+ isLessThan(value: number | FieldReference): JSONSchema;
1824
+ isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
1825
+ /**
1826
+ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
1827
+ * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
1828
+ * @returns whether the field is falsy (undefined, false, null, empty string)
1829
+ *
1830
+ * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
1831
+ *
1832
+ */
1833
+ isFalsy(): JSONSchema;
1834
+ isUndefined(): JSONSchema;
1835
+ inArray(values: string[]): JSONSchema;
1836
+ isValidEnglishName(): JSONSchema;
1837
+ isValidAdministrativeLeafLevel(): JSONSchema;
1838
+ /**
1839
+ * Checks if the field value matches a given regular expression pattern.
1840
+ * @param pattern - The regular expression pattern to match the field value against.
1841
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
1842
+ */
1843
+ matches(pattern: string): JSONSchema;
1844
+ isBetween(min: number, max: number): JSONSchema;
1845
+ getId: () => {
1846
+ fieldId: string;
1847
+ };
1848
+ /**
1849
+ * @deprecated
1850
+ * use field(fieldId).get(nestedProperty) instead
1851
+ * with 'and' combinator e.g.
1852
+ * and(
1853
+ * field('child.name').get('firstname').isEqualTo('John'),
1854
+ * field('child.name').get('surname').isEqualTo('Doe')
1855
+ * )
1856
+ */
1857
+ object: (options: Record<string, any>) => JSONSchema;
1858
+ /**
1859
+ * Custom client-side validator. The provided function is serialised and executed
1860
+ * just-in-time on the client only. External references (e.g. lodash) are not
1861
+ * available inside the function body — all logic must be self-contained.
1862
+ *
1863
+ * @example
1864
+ * field('nid').customClientValidator((value) => {
1865
+ * // LUHN check — all logic must be inline
1866
+ * const digits = String(value).split('').map(Number)
1867
+ * // ...
1868
+ * return isValid
1869
+ * })
1870
+ */
1871
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
1872
+ /**
1873
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
1874
+ * that can be used as the `value` property or a DATA component entry.
1875
+ * The function receives the referenced field's value as the first argument and
1876
+ * the full form context as the second; its return value replaces the field reference.
1877
+ * The function is serialised and executed just-in-time on the client only.
1878
+ * External references (e.g. lodash) are not available inside the function body.
1879
+ *
1880
+ * For computing a default value without referencing a specific field, use
1881
+ * `evaluate(fn)` in the `defaultValue` property instead.
1882
+ *
1883
+ * @example
1884
+ * field('a').customClientEvaluation((aValue, ctx) =>
1885
+ * Number(aValue) + Number(ctx.$form.b)
1886
+ * )
1887
+ */
1888
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
107
1889
  };
108
- };
109
- };
110
- export declare function isFieldReference(value: unknown): value is FieldReference;
111
- export declare function isEventFieldReference(value: unknown): value is {
112
- $$event: string;
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;
118
- /**
119
- * Generate conditional rules for a form field.
120
- *
121
- * @param fieldId - The field ID condition is applied to.
122
- * @example to combine multiple conditions, utilise connectors like `and`, `or`, `not`:
123
- * and(field('foo').isEqualTo('bar'), field('baz').isUndefined())
124
- *
125
- */
126
- export declare function createFieldConditionals(fieldId: string): {
127
- /**
128
- * @private Internal property used for field reference tracking.
129
- */
130
- $$field: string;
131
- /**
132
- * @private Internal property used for solving a object path within field's value
133
- */
134
- $$subfield: string[];
135
- get(fieldPath: string): {
136
- /**
137
- * @private Internal property used for field reference tracking.
138
- */
139
- $$field: string;
140
- get(fieldPath: string): /*elided*/ any;
141
- $$subfield: string[];
142
1890
  getByPath(fieldPath: string[]): {
1891
+ $$subfield: string[];
143
1892
  /**
144
1893
  * @private Internal property used for field reference tracking.
145
1894
  */
146
1895
  $$field: string;
147
- get(fieldPath: string): /*elided*/ any;
1896
+ get(fieldPath: string): {
1897
+ $$subfield: string[];
1898
+ /**
1899
+ * @private Internal property used for field reference tracking.
1900
+ */
1901
+ $$field: string;
1902
+ get(fieldPath: string): /*elided*/ any;
1903
+ getByPath(fieldPath: string[]): /*elided*/ any;
1904
+ asDob(): /*elided*/ any;
1905
+ asAge(): /*elided*/ any;
1906
+ isAfter(): {
1907
+ days: (days: number) => {
1908
+ inPast: () => JSONSchema;
1909
+ inFuture: () => JSONSchema;
1910
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1911
+ fromNow: () => JSONSchema;
1912
+ };
1913
+ date: (date: string | FieldReference) => JSONSchema;
1914
+ now: () => JSONSchema;
1915
+ };
1916
+ isBefore(): {
1917
+ days: (days: number) => {
1918
+ inPast: () => JSONSchema;
1919
+ inFuture: () => JSONSchema;
1920
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1921
+ fromNow: () => JSONSchema;
1922
+ };
1923
+ date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
1924
+ now: () => JSONSchema;
1925
+ };
1926
+ isGreaterThan(value: number | FieldReference): JSONSchema;
1927
+ isLessThan(value: number | FieldReference): JSONSchema;
1928
+ isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
1929
+ /**
1930
+ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
1931
+ * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
1932
+ * @returns whether the field is falsy (undefined, false, null, empty string)
1933
+ *
1934
+ * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
1935
+ *
1936
+ */
1937
+ isFalsy(): JSONSchema;
1938
+ isUndefined(): JSONSchema;
1939
+ inArray(values: string[]): JSONSchema;
1940
+ isValidEnglishName(): JSONSchema;
1941
+ isValidAdministrativeLeafLevel(): JSONSchema;
1942
+ /**
1943
+ * Checks if the field value matches a given regular expression pattern.
1944
+ * @param pattern - The regular expression pattern to match the field value against.
1945
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
1946
+ */
1947
+ matches(pattern: string): JSONSchema;
1948
+ isBetween(min: number, max: number): JSONSchema;
1949
+ getId: () => {
1950
+ fieldId: string;
1951
+ };
1952
+ /**
1953
+ * @deprecated
1954
+ * use field(fieldId).get(nestedProperty) instead
1955
+ * with 'and' combinator e.g.
1956
+ * and(
1957
+ * field('child.name').get('firstname').isEqualTo('John'),
1958
+ * field('child.name').get('surname').isEqualTo('Doe')
1959
+ * )
1960
+ */
1961
+ object: (options: Record<string, any>) => JSONSchema;
1962
+ /**
1963
+ * Custom client-side validator. The provided function is serialised and executed
1964
+ * just-in-time on the client only. External references (e.g. lodash) are not
1965
+ * available inside the function body — all logic must be self-contained.
1966
+ *
1967
+ * @example
1968
+ * field('nid').customClientValidator((value) => {
1969
+ * // LUHN check — all logic must be inline
1970
+ * const digits = String(value).split('').map(Number)
1971
+ * // ...
1972
+ * return isValid
1973
+ * })
1974
+ */
1975
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
1976
+ /**
1977
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
1978
+ * that can be used as the `value` property or a DATA component entry.
1979
+ * The function receives the referenced field's value as the first argument and
1980
+ * the full form context as the second; its return value replaces the field reference.
1981
+ * The function is serialised and executed just-in-time on the client only.
1982
+ * External references (e.g. lodash) are not available inside the function body.
1983
+ *
1984
+ * For computing a default value without referencing a specific field, use
1985
+ * `evaluate(fn)` in the `defaultValue` property instead.
1986
+ *
1987
+ * @example
1988
+ * field('a').customClientEvaluation((aValue, ctx) =>
1989
+ * Number(aValue) + Number(ctx.$form.b)
1990
+ * )
1991
+ */
1992
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
1993
+ };
148
1994
  getByPath(fieldPath: string[]): /*elided*/ any;
149
- $$subfield: string[];
150
1995
  asDob(): /*elided*/ any;
151
1996
  asAge(): /*elided*/ any;
152
1997
  isAfter(): {
@@ -327,121 +2172,119 @@ export declare function createFieldConditionals(fieldId: string): {
327
2172
  */
328
2173
  customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
329
2174
  };
330
- getByPath(fieldPath: string[]): {
331
- /**
332
- * @private Internal property used for field reference tracking.
333
- */
334
- $$field: string;
335
- get(fieldPath: string): any;
336
- getByPath(fieldPath: string[]): any;
2175
+ asAge(): {
337
2176
  $$subfield: string[];
338
- asDob(): any;
339
- asAge(): any;
340
- isAfter(): {
341
- days: (days: number) => {
342
- inPast: () => JSONSchema;
343
- inFuture: () => JSONSchema;
344
- fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
345
- fromNow: () => JSONSchema;
346
- };
347
- date: (date: string | FieldReference) => JSONSchema;
348
- now: () => JSONSchema;
349
- };
350
- isBefore(): {
351
- days: (days: number) => {
352
- inPast: () => JSONSchema;
353
- inFuture: () => JSONSchema;
354
- fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
355
- fromNow: () => JSONSchema;
356
- };
357
- date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
358
- now: () => JSONSchema;
359
- };
360
- isGreaterThan(value: number | FieldReference): JSONSchema;
361
- isLessThan(value: number | FieldReference): JSONSchema;
362
- isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
363
- /**
364
- * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
365
- * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
366
- * @returns whether the field is falsy (undefined, false, null, empty string)
367
- *
368
- * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
369
- *
370
- */
371
- isFalsy(): JSONSchema;
372
- isUndefined(): JSONSchema;
373
- inArray(values: string[]): JSONSchema;
374
- isValidEnglishName(): JSONSchema;
375
- isValidAdministrativeLeafLevel(): JSONSchema;
376
- /**
377
- * Checks if the field value matches a given regular expression pattern.
378
- * @param pattern - The regular expression pattern to match the field value against.
379
- * @returns A JSONSchema conditional that validates the field value against the pattern.
380
- */
381
- matches(pattern: string): JSONSchema;
382
- isBetween(min: number, max: number): JSONSchema;
383
- getId: () => {
384
- fieldId: string;
385
- };
386
- /**
387
- * @deprecated
388
- * use field(fieldId).get(nestedProperty) instead
389
- * with 'and' combinator e.g.
390
- * and(
391
- * field('child.name').get('firstname').isEqualTo('John'),
392
- * field('child.name').get('surname').isEqualTo('Doe')
393
- * )
394
- */
395
- object: (options: Record<string, any>) => JSONSchema;
396
- /**
397
- * Custom client-side validator. The provided function is serialised and executed
398
- * just-in-time on the client only. External references (e.g. lodash) are not
399
- * available inside the function body — all logic must be self-contained.
400
- *
401
- * @example
402
- * field('nid').customClientValidator((value) => {
403
- * // LUHN check — all logic must be inline
404
- * const digits = String(value).split('').map(Number)
405
- * // ...
406
- * return isValid
407
- * })
408
- */
409
- customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
410
- /**
411
- * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
412
- * that can be used as the `value` property or a DATA component entry.
413
- * The function receives the referenced field's value as the first argument and
414
- * the full form context as the second; its return value replaces the field reference.
415
- * The function is serialised and executed just-in-time on the client only.
416
- * External references (e.g. lodash) are not available inside the function body.
417
- *
418
- * For computing a default value without referencing a specific field, use
419
- * `evaluate(fn)` in the `defaultValue` property instead.
420
- *
421
- * @example
422
- * field('a').customClientEvaluation((aValue, ctx) =>
423
- * Number(aValue) + Number(ctx.$form.b)
424
- * )
425
- */
426
- customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
427
- };
428
- asDob(): {
429
2177
  /**
430
2178
  * @private Internal property used for field reference tracking.
431
2179
  */
432
2180
  $$field: string;
433
- get(fieldPath: string): any;
434
- $$subfield: string[];
435
- getByPath(fieldPath: string[]): {
2181
+ get(fieldPath: string): {
2182
+ $$subfield: string[];
436
2183
  /**
437
2184
  * @private Internal property used for field reference tracking.
438
2185
  */
439
2186
  $$field: string;
440
- get(fieldPath: string): any;
441
- getByPath(fieldPath: string[]): any;
442
- $$subfield: string[];
443
- asDob(): any;
444
- asAge(): any;
2187
+ get(fieldPath: string): /*elided*/ any;
2188
+ getByPath(fieldPath: string[]): {
2189
+ $$subfield: string[];
2190
+ /**
2191
+ * @private Internal property used for field reference tracking.
2192
+ */
2193
+ $$field: string;
2194
+ get(fieldPath: string): /*elided*/ any;
2195
+ getByPath(fieldPath: string[]): /*elided*/ any;
2196
+ asDob(): /*elided*/ any;
2197
+ asAge(): /*elided*/ any;
2198
+ isAfter(): {
2199
+ days: (days: number) => {
2200
+ inPast: () => JSONSchema;
2201
+ inFuture: () => JSONSchema;
2202
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
2203
+ fromNow: () => JSONSchema;
2204
+ };
2205
+ date: (date: string | FieldReference) => JSONSchema;
2206
+ now: () => JSONSchema;
2207
+ };
2208
+ isBefore(): {
2209
+ days: (days: number) => {
2210
+ inPast: () => JSONSchema;
2211
+ inFuture: () => JSONSchema;
2212
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
2213
+ fromNow: () => JSONSchema;
2214
+ };
2215
+ date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
2216
+ now: () => JSONSchema;
2217
+ };
2218
+ isGreaterThan(value: number | FieldReference): JSONSchema;
2219
+ isLessThan(value: number | FieldReference): JSONSchema;
2220
+ isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
2221
+ /**
2222
+ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
2223
+ * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
2224
+ * @returns whether the field is falsy (undefined, false, null, empty string)
2225
+ *
2226
+ * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
2227
+ *
2228
+ */
2229
+ isFalsy(): JSONSchema;
2230
+ isUndefined(): JSONSchema;
2231
+ inArray(values: string[]): JSONSchema;
2232
+ isValidEnglishName(): JSONSchema;
2233
+ isValidAdministrativeLeafLevel(): JSONSchema;
2234
+ /**
2235
+ * Checks if the field value matches a given regular expression pattern.
2236
+ * @param pattern - The regular expression pattern to match the field value against.
2237
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
2238
+ */
2239
+ matches(pattern: string): JSONSchema;
2240
+ isBetween(min: number, max: number): JSONSchema;
2241
+ getId: () => {
2242
+ fieldId: string;
2243
+ };
2244
+ /**
2245
+ * @deprecated
2246
+ * use field(fieldId).get(nestedProperty) instead
2247
+ * with 'and' combinator e.g.
2248
+ * and(
2249
+ * field('child.name').get('firstname').isEqualTo('John'),
2250
+ * field('child.name').get('surname').isEqualTo('Doe')
2251
+ * )
2252
+ */
2253
+ object: (options: Record<string, any>) => JSONSchema;
2254
+ /**
2255
+ * Custom client-side validator. The provided function is serialised and executed
2256
+ * just-in-time on the client only. External references (e.g. lodash) are not
2257
+ * available inside the function body — all logic must be self-contained.
2258
+ *
2259
+ * @example
2260
+ * field('nid').customClientValidator((value) => {
2261
+ * // LUHN check — all logic must be inline
2262
+ * const digits = String(value).split('').map(Number)
2263
+ * // ...
2264
+ * return isValid
2265
+ * })
2266
+ */
2267
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
2268
+ /**
2269
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
2270
+ * that can be used as the `value` property or a DATA component entry.
2271
+ * The function receives the referenced field's value as the first argument and
2272
+ * the full form context as the second; its return value replaces the field reference.
2273
+ * The function is serialised and executed just-in-time on the client only.
2274
+ * External references (e.g. lodash) are not available inside the function body.
2275
+ *
2276
+ * For computing a default value without referencing a specific field, use
2277
+ * `evaluate(fn)` in the `defaultValue` property instead.
2278
+ *
2279
+ * @example
2280
+ * field('a').customClientEvaluation((aValue, ctx) =>
2281
+ * Number(aValue) + Number(ctx.$form.b)
2282
+ * )
2283
+ */
2284
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
2285
+ };
2286
+ asDob(): /*elided*/ any;
2287
+ asAge(): /*elided*/ any;
445
2288
  isAfter(): {
446
2289
  days: (days: number) => {
447
2290
  inPast: () => JSONSchema;
@@ -530,113 +2373,113 @@ export declare function createFieldConditionals(fieldId: string): {
530
2373
  */
531
2374
  customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
532
2375
  };
533
- asDob(): any;
534
- asAge(): any;
535
- isAfter(): {
536
- days: (days: number) => {
537
- inPast: () => JSONSchema;
538
- inFuture: () => JSONSchema;
539
- fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
540
- fromNow: () => JSONSchema;
541
- };
542
- date: (date: string | FieldReference) => JSONSchema;
543
- now: () => JSONSchema;
544
- };
545
- isBefore(): {
546
- days: (days: number) => {
547
- inPast: () => JSONSchema;
548
- inFuture: () => JSONSchema;
549
- fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
550
- fromNow: () => JSONSchema;
551
- };
552
- date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
553
- now: () => JSONSchema;
554
- };
555
- isGreaterThan(value: number | FieldReference): JSONSchema;
556
- isLessThan(value: number | FieldReference): JSONSchema;
557
- isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
558
- /**
559
- * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
560
- * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
561
- * @returns whether the field is falsy (undefined, false, null, empty string)
562
- *
563
- * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
564
- *
565
- */
566
- isFalsy(): JSONSchema;
567
- isUndefined(): JSONSchema;
568
- inArray(values: string[]): JSONSchema;
569
- isValidEnglishName(): JSONSchema;
570
- isValidAdministrativeLeafLevel(): JSONSchema;
571
- /**
572
- * Checks if the field value matches a given regular expression pattern.
573
- * @param pattern - The regular expression pattern to match the field value against.
574
- * @returns A JSONSchema conditional that validates the field value against the pattern.
575
- */
576
- matches(pattern: string): JSONSchema;
577
- isBetween(min: number, max: number): JSONSchema;
578
- getId: () => {
579
- fieldId: string;
580
- };
581
- /**
582
- * @deprecated
583
- * use field(fieldId).get(nestedProperty) instead
584
- * with 'and' combinator e.g.
585
- * and(
586
- * field('child.name').get('firstname').isEqualTo('John'),
587
- * field('child.name').get('surname').isEqualTo('Doe')
588
- * )
589
- */
590
- object: (options: Record<string, any>) => JSONSchema;
591
- /**
592
- * Custom client-side validator. The provided function is serialised and executed
593
- * just-in-time on the client only. External references (e.g. lodash) are not
594
- * available inside the function body — all logic must be self-contained.
595
- *
596
- * @example
597
- * field('nid').customClientValidator((value) => {
598
- * // LUHN check — all logic must be inline
599
- * const digits = String(value).split('').map(Number)
600
- * // ...
601
- * return isValid
602
- * })
603
- */
604
- customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
605
- /**
606
- * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
607
- * that can be used as the `value` property or a DATA component entry.
608
- * The function receives the referenced field's value as the first argument and
609
- * the full form context as the second; its return value replaces the field reference.
610
- * The function is serialised and executed just-in-time on the client only.
611
- * External references (e.g. lodash) are not available inside the function body.
612
- *
613
- * For computing a default value without referencing a specific field, use
614
- * `evaluate(fn)` in the `defaultValue` property instead.
615
- *
616
- * @example
617
- * field('a').customClientEvaluation((aValue, ctx) =>
618
- * Number(aValue) + Number(ctx.$form.b)
619
- * )
620
- */
621
- customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
622
- };
623
- asAge(): {
624
- /**
625
- * @private Internal property used for field reference tracking.
626
- */
627
- $$field: string;
628
- get(fieldPath: string): any;
629
- $$subfield: string[];
630
2376
  getByPath(fieldPath: string[]): {
2377
+ $$subfield: string[];
631
2378
  /**
632
2379
  * @private Internal property used for field reference tracking.
633
2380
  */
634
2381
  $$field: string;
635
- get(fieldPath: string): any;
636
- getByPath(fieldPath: string[]): any;
637
- $$subfield: string[];
638
- asDob(): any;
639
- asAge(): any;
2382
+ get(fieldPath: string): {
2383
+ $$subfield: string[];
2384
+ /**
2385
+ * @private Internal property used for field reference tracking.
2386
+ */
2387
+ $$field: string;
2388
+ get(fieldPath: string): /*elided*/ any;
2389
+ getByPath(fieldPath: string[]): /*elided*/ any;
2390
+ asDob(): /*elided*/ any;
2391
+ asAge(): /*elided*/ any;
2392
+ isAfter(): {
2393
+ days: (days: number) => {
2394
+ inPast: () => JSONSchema;
2395
+ inFuture: () => JSONSchema;
2396
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
2397
+ fromNow: () => JSONSchema;
2398
+ };
2399
+ date: (date: string | FieldReference) => JSONSchema;
2400
+ now: () => JSONSchema;
2401
+ };
2402
+ isBefore(): {
2403
+ days: (days: number) => {
2404
+ inPast: () => JSONSchema;
2405
+ inFuture: () => JSONSchema;
2406
+ fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
2407
+ fromNow: () => JSONSchema;
2408
+ };
2409
+ date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
2410
+ now: () => JSONSchema;
2411
+ };
2412
+ isGreaterThan(value: number | FieldReference): JSONSchema;
2413
+ isLessThan(value: number | FieldReference): JSONSchema;
2414
+ isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
2415
+ /**
2416
+ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
2417
+ * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
2418
+ * @returns whether the field is falsy (undefined, false, null, empty string)
2419
+ *
2420
+ * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
2421
+ *
2422
+ */
2423
+ isFalsy(): JSONSchema;
2424
+ isUndefined(): JSONSchema;
2425
+ inArray(values: string[]): JSONSchema;
2426
+ isValidEnglishName(): JSONSchema;
2427
+ isValidAdministrativeLeafLevel(): JSONSchema;
2428
+ /**
2429
+ * Checks if the field value matches a given regular expression pattern.
2430
+ * @param pattern - The regular expression pattern to match the field value against.
2431
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
2432
+ */
2433
+ matches(pattern: string): JSONSchema;
2434
+ isBetween(min: number, max: number): JSONSchema;
2435
+ getId: () => {
2436
+ fieldId: string;
2437
+ };
2438
+ /**
2439
+ * @deprecated
2440
+ * use field(fieldId).get(nestedProperty) instead
2441
+ * with 'and' combinator e.g.
2442
+ * and(
2443
+ * field('child.name').get('firstname').isEqualTo('John'),
2444
+ * field('child.name').get('surname').isEqualTo('Doe')
2445
+ * )
2446
+ */
2447
+ object: (options: Record<string, any>) => JSONSchema;
2448
+ /**
2449
+ * Custom client-side validator. The provided function is serialised and executed
2450
+ * just-in-time on the client only. External references (e.g. lodash) are not
2451
+ * available inside the function body — all logic must be self-contained.
2452
+ *
2453
+ * @example
2454
+ * field('nid').customClientValidator((value) => {
2455
+ * // LUHN check — all logic must be inline
2456
+ * const digits = String(value).split('').map(Number)
2457
+ * // ...
2458
+ * return isValid
2459
+ * })
2460
+ */
2461
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
2462
+ /**
2463
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
2464
+ * that can be used as the `value` property or a DATA component entry.
2465
+ * The function receives the referenced field's value as the first argument and
2466
+ * the full form context as the second; its return value replaces the field reference.
2467
+ * The function is serialised and executed just-in-time on the client only.
2468
+ * External references (e.g. lodash) are not available inside the function body.
2469
+ *
2470
+ * For computing a default value without referencing a specific field, use
2471
+ * `evaluate(fn)` in the `defaultValue` property instead.
2472
+ *
2473
+ * @example
2474
+ * field('a').customClientEvaluation((aValue, ctx) =>
2475
+ * Number(aValue) + Number(ctx.$form.b)
2476
+ * )
2477
+ */
2478
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
2479
+ };
2480
+ getByPath(fieldPath: string[]): /*elided*/ any;
2481
+ asDob(): /*elided*/ any;
2482
+ asAge(): /*elided*/ any;
640
2483
  isAfter(): {
641
2484
  days: (days: number) => {
642
2485
  inPast: () => JSONSchema;
@@ -725,8 +2568,8 @@ export declare function createFieldConditionals(fieldId: string): {
725
2568
  */
726
2569
  customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
727
2570
  };
728
- asDob(): any;
729
- asAge(): any;
2571
+ asDob(): /*elided*/ any;
2572
+ asAge(): /*elided*/ any;
730
2573
  isAfter(): {
731
2574
  days: (days: number) => {
732
2575
  inPast: () => JSONSchema;