@nira-opencrvs/toolkit 1.9.11-rc.1f36427
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -0
- package/build.sh +56 -0
- package/dist/api/index.d.ts +11 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +52 -0
- package/dist/commons/api/router.d.ts +4125 -0
- package/dist/commons/conditionals/conditionals.d.ts +824 -0
- package/dist/commons/conditionals/index.d.ts +2 -0
- package/dist/commons/conditionals/validate.d.ts +101 -0
- package/dist/commons/events/ActionConfig.d.ts +1609 -0
- package/dist/commons/events/ActionDocument.d.ts +2180 -0
- package/dist/commons/events/ActionInput.d.ts +1229 -0
- package/dist/commons/events/ActionType.d.ts +52 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +1538 -0
- package/dist/commons/events/CompositeFieldValue.d.ts +280 -0
- package/dist/commons/events/Conditional.d.ts +55 -0
- package/dist/commons/events/Constants.d.ts +3 -0
- package/dist/commons/events/CountryConfigQueryInput.d.ts +4784 -0
- package/dist/commons/events/CreatedAtLocation.d.ts +2 -0
- package/dist/commons/events/DeduplicationConfig.d.ts +233 -0
- package/dist/commons/events/Draft.d.ts +118 -0
- package/dist/commons/events/DynamicFieldValue.d.ts +139 -0
- package/dist/commons/events/EventConfig.d.ts +2255 -0
- package/dist/commons/events/EventConfigInput.d.ts +10 -0
- package/dist/commons/events/EventDocument.d.ts +1457 -0
- package/dist/commons/events/EventIndex.d.ts +1134 -0
- package/dist/commons/events/EventInput.d.ts +13 -0
- package/dist/commons/events/EventMetadata.d.ts +413 -0
- package/dist/commons/events/FieldConfig.d.ts +12935 -0
- package/dist/commons/events/FieldType.d.ts +55 -0
- package/dist/commons/events/FieldTypeMapping.d.ts +1289 -0
- package/dist/commons/events/FieldValue.d.ts +512 -0
- package/dist/commons/events/FileUtils.d.ts +4 -0
- package/dist/commons/events/FormConfig.d.ts +755 -0
- package/dist/commons/events/PageConfig.d.ts +342 -0
- package/dist/commons/events/PlainDate.d.ts +19 -0
- package/dist/commons/events/SummaryConfig.d.ts +170 -0
- package/dist/commons/events/TemplateConfig.d.ts +66 -0
- package/dist/commons/events/TranslationConfig.d.ts +15 -0
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +53 -0
- package/dist/commons/events/WorkqueueConfig.d.ts +7957 -0
- package/dist/commons/events/deduplication.d.ts +69 -0
- package/dist/commons/events/defineConfig.d.ts +234 -0
- package/dist/commons/events/event.d.ts +80 -0
- package/dist/commons/events/field.d.ts +514 -0
- package/dist/commons/events/index.d.ts +45 -0
- package/dist/commons/events/locations.d.ts +24 -0
- package/dist/commons/events/scopes.d.ts +55 -0
- package/dist/commons/events/serializer.d.ts +2 -0
- package/dist/commons/events/state/availableActions.d.ts +6 -0
- package/dist/commons/events/state/flags.d.ts +4 -0
- package/dist/commons/events/state/index.d.ts +119 -0
- package/dist/commons/events/state/utils.d.ts +311 -0
- package/dist/commons/events/test.utils.d.ts +248 -0
- package/dist/commons/events/transactions.d.ts +2 -0
- package/dist/commons/events/utils.d.ts +486 -0
- package/dist/commons/events/workqueueDefaultColumns.d.ts +3 -0
- package/dist/commons/notification/UserNotifications.d.ts +762 -0
- package/dist/commons/notification/index.d.ts +2 -0
- package/dist/conditionals/index.d.ts +2 -0
- package/dist/conditionals/index.d.ts.map +1 -0
- package/dist/conditionals/index.js +689 -0
- package/dist/events/deduplication.d.ts +69 -0
- package/dist/events/deduplication.d.ts.map +1 -0
- package/dist/events/deduplication.js +101 -0
- package/dist/events/index.d.ts +2 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +9327 -0
- package/dist/notification/index.d.ts +2 -0
- package/dist/notification/index.d.ts.map +1 -0
- package/dist/notification/index.js +6674 -0
- package/dist/scopes/index.d.ts +385 -0
- package/dist/scopes/index.d.ts.map +1 -0
- package/dist/scopes/index.js +349 -0
- package/package.json +40 -0
- package/tsconfig.json +27 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,824 @@
|
|
|
1
|
+
import { EventDocument } from '../events/EventDocument';
|
|
2
|
+
import { EventState } from '../events/ActionDocument';
|
|
3
|
+
import { ITokenPayload as TokenPayload, Scope } from '../authentication';
|
|
4
|
+
import { PartialSchema as AjvJSONSchemaType } from 'ajv/dist/types/json-schema';
|
|
5
|
+
import { userSerializer } from '../events/serializers/user/serializer';
|
|
6
|
+
import { UUID } from '../uuid';
|
|
7
|
+
import { todayDateTimeValueSerializer } from '../events/serializers/date/serializer';
|
|
8
|
+
import { FieldReference } from '../events/FieldConfig';
|
|
9
|
+
/** @knipignore */
|
|
10
|
+
export type JSONSchema = {
|
|
11
|
+
$id: string;
|
|
12
|
+
readonly __nominal__type: 'JSONSchema';
|
|
13
|
+
};
|
|
14
|
+
export declare function defineConditional(schema: any): JSONSchema;
|
|
15
|
+
export declare function defineFormConditional(schema: Record<string, unknown>): JSONSchema;
|
|
16
|
+
type CommonConditionalParameters = {
|
|
17
|
+
$now: string;
|
|
18
|
+
$online: boolean;
|
|
19
|
+
};
|
|
20
|
+
export type UserConditionalParameters = CommonConditionalParameters & {
|
|
21
|
+
$user: TokenPayload;
|
|
22
|
+
};
|
|
23
|
+
export type EventConditionalParameters = CommonConditionalParameters & {
|
|
24
|
+
$event: EventDocument;
|
|
25
|
+
};
|
|
26
|
+
export type FormConditionalParameters = CommonConditionalParameters & {
|
|
27
|
+
$form: EventState | Record<string, unknown>;
|
|
28
|
+
$leafAdminStructureLocationIds?: Array<{
|
|
29
|
+
id: UUID;
|
|
30
|
+
}>;
|
|
31
|
+
};
|
|
32
|
+
export type ConditionalParameters = UserConditionalParameters | EventConditionalParameters | FormConditionalParameters;
|
|
33
|
+
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
34
|
+
type AjvJSONSchema = AjvJSONSchemaType<UnionToIntersection<ConditionalParameters>>;
|
|
35
|
+
/**
|
|
36
|
+
* Returns an empty JSON Schema object, which is treated as always valid.
|
|
37
|
+
*
|
|
38
|
+
* @returns {AjvJSONSchema} An empty schema object `{}` that always evaluates to true.
|
|
39
|
+
*/
|
|
40
|
+
export declare function alwaysTrue(): AjvJSONSchema;
|
|
41
|
+
/**
|
|
42
|
+
* Universal boolean connector to be used with any type of conditional. (user, event, field)
|
|
43
|
+
*
|
|
44
|
+
* @example and(field('foo').isEqualTo('bar'), field('baz').isUndefined())
|
|
45
|
+
*/
|
|
46
|
+
export declare function and(...conditions: AjvJSONSchema[]): JSONSchema;
|
|
47
|
+
/**
|
|
48
|
+
* Universal boolean connector to be used with any type of conditional. (user, event, field)
|
|
49
|
+
*
|
|
50
|
+
* @example or(field('foo').isEqualTo('bar'), field('baz').isUndefined())
|
|
51
|
+
*/
|
|
52
|
+
export declare function or(...conditions: AjvJSONSchema[]): JSONSchema;
|
|
53
|
+
/**
|
|
54
|
+
* Universal boolean connector to be used with any type of conditional. (user, event, field)
|
|
55
|
+
*
|
|
56
|
+
* @example not(field('foo').isEqualTo('bar'))
|
|
57
|
+
*/
|
|
58
|
+
export declare function not(condition: AjvJSONSchema): JSONSchema;
|
|
59
|
+
/**
|
|
60
|
+
* Returns an JSON Schema object, which is treated as always invalid.
|
|
61
|
+
*
|
|
62
|
+
* @returns {JSONSchema} An schema object that always evaluates to false.
|
|
63
|
+
*/
|
|
64
|
+
export declare function never(): JSONSchema;
|
|
65
|
+
/**
|
|
66
|
+
* Generate conditional rules for current date
|
|
67
|
+
*/
|
|
68
|
+
export declare const now: typeof todayDateTimeValueSerializer;
|
|
69
|
+
/**
|
|
70
|
+
*
|
|
71
|
+
* Generate conditional rules for user.
|
|
72
|
+
*/
|
|
73
|
+
export declare const user: typeof userSerializer & {
|
|
74
|
+
hasScope: (scope: Scope) => JSONSchema;
|
|
75
|
+
hasRole: (role: string) => JSONSchema;
|
|
76
|
+
isOnline: () => JSONSchema;
|
|
77
|
+
locationLevel: (adminLevelId: string) => {
|
|
78
|
+
$user: {
|
|
79
|
+
$location: string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
export declare function isFieldReference(value: unknown): value is FieldReference;
|
|
84
|
+
export declare function isEventFieldReference(value: unknown): value is FieldReference;
|
|
85
|
+
/**
|
|
86
|
+
* Generate conditional rules for a form field.
|
|
87
|
+
*
|
|
88
|
+
* @param fieldId - The field ID condition is applied to.
|
|
89
|
+
* @example to combine multiple conditions, utilise connectors like `and`, `or`, `not`:
|
|
90
|
+
* and(field('foo').isEqualTo('bar'), field('baz').isUndefined())
|
|
91
|
+
*
|
|
92
|
+
*/
|
|
93
|
+
export declare function createFieldConditionals(fieldId: string): {
|
|
94
|
+
/**
|
|
95
|
+
* @private Internal property used for field reference tracking.
|
|
96
|
+
*/
|
|
97
|
+
$$field: string;
|
|
98
|
+
/**
|
|
99
|
+
* @private Internal property used for solving a object path within field's value
|
|
100
|
+
*/
|
|
101
|
+
$$subfield: string[];
|
|
102
|
+
get(fieldPath: string): {
|
|
103
|
+
$$subfield: string[];
|
|
104
|
+
/**
|
|
105
|
+
* @private Internal property used for field reference tracking.
|
|
106
|
+
*/
|
|
107
|
+
$$field: string;
|
|
108
|
+
get(fieldPath: string): any;
|
|
109
|
+
getByPath(fieldPath: string[]): {
|
|
110
|
+
$$subfield: string[];
|
|
111
|
+
/**
|
|
112
|
+
* @private Internal property used for field reference tracking.
|
|
113
|
+
*/
|
|
114
|
+
$$field: string;
|
|
115
|
+
get(fieldPath: string): any;
|
|
116
|
+
getByPath(fieldPath: string[]): any;
|
|
117
|
+
asDob(): any;
|
|
118
|
+
asAge(): any;
|
|
119
|
+
isAfter(): {
|
|
120
|
+
days: (days: number) => {
|
|
121
|
+
inPast: () => JSONSchema;
|
|
122
|
+
inFuture: () => JSONSchema;
|
|
123
|
+
fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
124
|
+
fromNow: () => JSONSchema;
|
|
125
|
+
};
|
|
126
|
+
date: (date: string | FieldReference) => JSONSchema;
|
|
127
|
+
now: () => JSONSchema;
|
|
128
|
+
};
|
|
129
|
+
isBefore(): {
|
|
130
|
+
days: (days: number) => {
|
|
131
|
+
inPast: () => JSONSchema;
|
|
132
|
+
inFuture: () => JSONSchema;
|
|
133
|
+
fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
134
|
+
fromNow: () => JSONSchema;
|
|
135
|
+
};
|
|
136
|
+
date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
137
|
+
now: () => JSONSchema;
|
|
138
|
+
};
|
|
139
|
+
isGreaterThan(value: number | FieldReference): JSONSchema;
|
|
140
|
+
isLessThan(value: number | FieldReference): JSONSchema;
|
|
141
|
+
isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
|
|
142
|
+
/**
|
|
143
|
+
* Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
|
|
144
|
+
* @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
|
|
145
|
+
* @returns whether the field is falsy (undefined, false, null, empty string)
|
|
146
|
+
*
|
|
147
|
+
* NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
|
|
148
|
+
*
|
|
149
|
+
*/
|
|
150
|
+
isFalsy(): JSONSchema;
|
|
151
|
+
isUndefined(): JSONSchema;
|
|
152
|
+
inArray(values: string[]): JSONSchema;
|
|
153
|
+
isValidEnglishName(): JSONSchema;
|
|
154
|
+
isValidAdministrativeLeafLevel(): JSONSchema;
|
|
155
|
+
/**
|
|
156
|
+
* Checks if the field value matches a given regular expression pattern.
|
|
157
|
+
* @param pattern - The regular expression pattern to match the field value against.
|
|
158
|
+
* @returns A JSONSchema conditional that validates the field value against the pattern.
|
|
159
|
+
*/
|
|
160
|
+
matches(pattern: string): JSONSchema;
|
|
161
|
+
isBetween(min: number, max: number): JSONSchema;
|
|
162
|
+
getId: () => {
|
|
163
|
+
fieldId: string;
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* @deprecated
|
|
167
|
+
* use field(fieldId).get(nestedProperty) instead
|
|
168
|
+
* with 'and' combinator e.g.
|
|
169
|
+
* and(
|
|
170
|
+
* field('child.name').get('firstname').isEqualTo('John'),
|
|
171
|
+
* field('child.name').get('surname').isEqualTo('Doe')
|
|
172
|
+
* )
|
|
173
|
+
*/
|
|
174
|
+
object: (options: Record<string, any>) => JSONSchema;
|
|
175
|
+
};
|
|
176
|
+
asDob(): any;
|
|
177
|
+
asAge(): any;
|
|
178
|
+
isAfter(): {
|
|
179
|
+
days: (days: number) => {
|
|
180
|
+
inPast: () => JSONSchema;
|
|
181
|
+
inFuture: () => JSONSchema;
|
|
182
|
+
fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
183
|
+
fromNow: () => JSONSchema;
|
|
184
|
+
};
|
|
185
|
+
date: (date: string | FieldReference) => JSONSchema;
|
|
186
|
+
now: () => JSONSchema;
|
|
187
|
+
};
|
|
188
|
+
isBefore(): {
|
|
189
|
+
days: (days: number) => {
|
|
190
|
+
inPast: () => JSONSchema;
|
|
191
|
+
inFuture: () => JSONSchema;
|
|
192
|
+
fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
193
|
+
fromNow: () => JSONSchema;
|
|
194
|
+
};
|
|
195
|
+
date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
196
|
+
now: () => JSONSchema;
|
|
197
|
+
};
|
|
198
|
+
isGreaterThan(value: number | FieldReference): JSONSchema;
|
|
199
|
+
isLessThan(value: number | FieldReference): JSONSchema;
|
|
200
|
+
isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
|
|
201
|
+
/**
|
|
202
|
+
* Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
|
|
203
|
+
* @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
|
|
204
|
+
* @returns whether the field is falsy (undefined, false, null, empty string)
|
|
205
|
+
*
|
|
206
|
+
* NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
|
|
207
|
+
*
|
|
208
|
+
*/
|
|
209
|
+
isFalsy(): JSONSchema;
|
|
210
|
+
isUndefined(): JSONSchema;
|
|
211
|
+
inArray(values: string[]): JSONSchema;
|
|
212
|
+
isValidEnglishName(): JSONSchema;
|
|
213
|
+
isValidAdministrativeLeafLevel(): JSONSchema;
|
|
214
|
+
/**
|
|
215
|
+
* Checks if the field value matches a given regular expression pattern.
|
|
216
|
+
* @param pattern - The regular expression pattern to match the field value against.
|
|
217
|
+
* @returns A JSONSchema conditional that validates the field value against the pattern.
|
|
218
|
+
*/
|
|
219
|
+
matches(pattern: string): JSONSchema;
|
|
220
|
+
isBetween(min: number, max: number): JSONSchema;
|
|
221
|
+
getId: () => {
|
|
222
|
+
fieldId: string;
|
|
223
|
+
};
|
|
224
|
+
/**
|
|
225
|
+
* @deprecated
|
|
226
|
+
* use field(fieldId).get(nestedProperty) instead
|
|
227
|
+
* with 'and' combinator e.g.
|
|
228
|
+
* and(
|
|
229
|
+
* field('child.name').get('firstname').isEqualTo('John'),
|
|
230
|
+
* field('child.name').get('surname').isEqualTo('Doe')
|
|
231
|
+
* )
|
|
232
|
+
*/
|
|
233
|
+
object: (options: Record<string, any>) => JSONSchema;
|
|
234
|
+
};
|
|
235
|
+
getByPath(fieldPath: string[]): {
|
|
236
|
+
$$subfield: string[];
|
|
237
|
+
/**
|
|
238
|
+
* @private Internal property used for field reference tracking.
|
|
239
|
+
*/
|
|
240
|
+
$$field: string;
|
|
241
|
+
get(fieldPath: string): {
|
|
242
|
+
$$subfield: string[];
|
|
243
|
+
/**
|
|
244
|
+
* @private Internal property used for field reference tracking.
|
|
245
|
+
*/
|
|
246
|
+
$$field: string;
|
|
247
|
+
get(fieldPath: string): any;
|
|
248
|
+
getByPath(fieldPath: string[]): any;
|
|
249
|
+
asDob(): any;
|
|
250
|
+
asAge(): any;
|
|
251
|
+
isAfter(): {
|
|
252
|
+
days: (days: number) => {
|
|
253
|
+
inPast: () => JSONSchema;
|
|
254
|
+
inFuture: () => JSONSchema;
|
|
255
|
+
fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
256
|
+
fromNow: () => JSONSchema;
|
|
257
|
+
};
|
|
258
|
+
date: (date: string | FieldReference) => JSONSchema;
|
|
259
|
+
now: () => JSONSchema;
|
|
260
|
+
};
|
|
261
|
+
isBefore(): {
|
|
262
|
+
days: (days: number) => {
|
|
263
|
+
inPast: () => JSONSchema;
|
|
264
|
+
inFuture: () => JSONSchema;
|
|
265
|
+
fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
266
|
+
fromNow: () => JSONSchema;
|
|
267
|
+
};
|
|
268
|
+
date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
269
|
+
now: () => JSONSchema;
|
|
270
|
+
};
|
|
271
|
+
isGreaterThan(value: number | FieldReference): JSONSchema;
|
|
272
|
+
isLessThan(value: number | FieldReference): JSONSchema;
|
|
273
|
+
isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
|
|
274
|
+
/**
|
|
275
|
+
* Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
|
|
276
|
+
* @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
|
|
277
|
+
* @returns whether the field is falsy (undefined, false, null, empty string)
|
|
278
|
+
*
|
|
279
|
+
* NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
|
|
280
|
+
*
|
|
281
|
+
*/
|
|
282
|
+
isFalsy(): JSONSchema;
|
|
283
|
+
isUndefined(): JSONSchema;
|
|
284
|
+
inArray(values: string[]): JSONSchema;
|
|
285
|
+
isValidEnglishName(): JSONSchema;
|
|
286
|
+
isValidAdministrativeLeafLevel(): JSONSchema;
|
|
287
|
+
/**
|
|
288
|
+
* Checks if the field value matches a given regular expression pattern.
|
|
289
|
+
* @param pattern - The regular expression pattern to match the field value against.
|
|
290
|
+
* @returns A JSONSchema conditional that validates the field value against the pattern.
|
|
291
|
+
*/
|
|
292
|
+
matches(pattern: string): JSONSchema;
|
|
293
|
+
isBetween(min: number, max: number): JSONSchema;
|
|
294
|
+
getId: () => {
|
|
295
|
+
fieldId: string;
|
|
296
|
+
};
|
|
297
|
+
/**
|
|
298
|
+
* @deprecated
|
|
299
|
+
* use field(fieldId).get(nestedProperty) instead
|
|
300
|
+
* with 'and' combinator e.g.
|
|
301
|
+
* and(
|
|
302
|
+
* field('child.name').get('firstname').isEqualTo('John'),
|
|
303
|
+
* field('child.name').get('surname').isEqualTo('Doe')
|
|
304
|
+
* )
|
|
305
|
+
*/
|
|
306
|
+
object: (options: Record<string, any>) => JSONSchema;
|
|
307
|
+
};
|
|
308
|
+
getByPath(fieldPath: string[]): any;
|
|
309
|
+
asDob(): {
|
|
310
|
+
$$subfield: string[];
|
|
311
|
+
/**
|
|
312
|
+
* @private Internal property used for field reference tracking.
|
|
313
|
+
*/
|
|
314
|
+
$$field: string;
|
|
315
|
+
get(fieldPath: string): any;
|
|
316
|
+
getByPath(fieldPath: string[]): any;
|
|
317
|
+
asDob(): any;
|
|
318
|
+
asAge(): any;
|
|
319
|
+
isAfter(): {
|
|
320
|
+
days: (days: number) => {
|
|
321
|
+
inPast: () => JSONSchema;
|
|
322
|
+
inFuture: () => JSONSchema;
|
|
323
|
+
fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
324
|
+
fromNow: () => JSONSchema;
|
|
325
|
+
};
|
|
326
|
+
date: (date: string | FieldReference) => JSONSchema;
|
|
327
|
+
now: () => JSONSchema;
|
|
328
|
+
};
|
|
329
|
+
isBefore(): {
|
|
330
|
+
days: (days: number) => {
|
|
331
|
+
inPast: () => JSONSchema;
|
|
332
|
+
inFuture: () => JSONSchema;
|
|
333
|
+
fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
334
|
+
fromNow: () => JSONSchema;
|
|
335
|
+
};
|
|
336
|
+
date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
337
|
+
now: () => JSONSchema;
|
|
338
|
+
};
|
|
339
|
+
isGreaterThan(value: number | FieldReference): JSONSchema;
|
|
340
|
+
isLessThan(value: number | FieldReference): JSONSchema;
|
|
341
|
+
isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
|
|
342
|
+
/**
|
|
343
|
+
* Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
|
|
344
|
+
* @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
|
|
345
|
+
* @returns whether the field is falsy (undefined, false, null, empty string)
|
|
346
|
+
*
|
|
347
|
+
* NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
|
|
348
|
+
*
|
|
349
|
+
*/
|
|
350
|
+
isFalsy(): JSONSchema;
|
|
351
|
+
isUndefined(): JSONSchema;
|
|
352
|
+
inArray(values: string[]): JSONSchema;
|
|
353
|
+
isValidEnglishName(): JSONSchema;
|
|
354
|
+
isValidAdministrativeLeafLevel(): JSONSchema;
|
|
355
|
+
/**
|
|
356
|
+
* Checks if the field value matches a given regular expression pattern.
|
|
357
|
+
* @param pattern - The regular expression pattern to match the field value against.
|
|
358
|
+
* @returns A JSONSchema conditional that validates the field value against the pattern.
|
|
359
|
+
*/
|
|
360
|
+
matches(pattern: string): JSONSchema;
|
|
361
|
+
isBetween(min: number, max: number): JSONSchema;
|
|
362
|
+
getId: () => {
|
|
363
|
+
fieldId: string;
|
|
364
|
+
};
|
|
365
|
+
/**
|
|
366
|
+
* @deprecated
|
|
367
|
+
* use field(fieldId).get(nestedProperty) instead
|
|
368
|
+
* with 'and' combinator e.g.
|
|
369
|
+
* and(
|
|
370
|
+
* field('child.name').get('firstname').isEqualTo('John'),
|
|
371
|
+
* field('child.name').get('surname').isEqualTo('Doe')
|
|
372
|
+
* )
|
|
373
|
+
*/
|
|
374
|
+
object: (options: Record<string, any>) => JSONSchema;
|
|
375
|
+
};
|
|
376
|
+
asAge(): {
|
|
377
|
+
$$subfield: string[];
|
|
378
|
+
/**
|
|
379
|
+
* @private Internal property used for field reference tracking.
|
|
380
|
+
*/
|
|
381
|
+
$$field: string;
|
|
382
|
+
get(fieldPath: string): any;
|
|
383
|
+
getByPath(fieldPath: string[]): any;
|
|
384
|
+
asDob(): any;
|
|
385
|
+
asAge(): any;
|
|
386
|
+
isAfter(): {
|
|
387
|
+
days: (days: number) => {
|
|
388
|
+
inPast: () => JSONSchema;
|
|
389
|
+
inFuture: () => JSONSchema;
|
|
390
|
+
fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
391
|
+
fromNow: () => JSONSchema;
|
|
392
|
+
};
|
|
393
|
+
date: (date: string | FieldReference) => JSONSchema;
|
|
394
|
+
now: () => JSONSchema;
|
|
395
|
+
};
|
|
396
|
+
isBefore(): {
|
|
397
|
+
days: (days: number) => {
|
|
398
|
+
inPast: () => JSONSchema;
|
|
399
|
+
inFuture: () => JSONSchema;
|
|
400
|
+
fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
401
|
+
fromNow: () => JSONSchema;
|
|
402
|
+
};
|
|
403
|
+
date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
404
|
+
now: () => JSONSchema;
|
|
405
|
+
};
|
|
406
|
+
isGreaterThan(value: number | FieldReference): JSONSchema;
|
|
407
|
+
isLessThan(value: number | FieldReference): JSONSchema;
|
|
408
|
+
isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
|
|
409
|
+
/**
|
|
410
|
+
* Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
|
|
411
|
+
* @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
|
|
412
|
+
* @returns whether the field is falsy (undefined, false, null, empty string)
|
|
413
|
+
*
|
|
414
|
+
* NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
|
|
415
|
+
*
|
|
416
|
+
*/
|
|
417
|
+
isFalsy(): JSONSchema;
|
|
418
|
+
isUndefined(): JSONSchema;
|
|
419
|
+
inArray(values: string[]): JSONSchema;
|
|
420
|
+
isValidEnglishName(): JSONSchema;
|
|
421
|
+
isValidAdministrativeLeafLevel(): JSONSchema;
|
|
422
|
+
/**
|
|
423
|
+
* Checks if the field value matches a given regular expression pattern.
|
|
424
|
+
* @param pattern - The regular expression pattern to match the field value against.
|
|
425
|
+
* @returns A JSONSchema conditional that validates the field value against the pattern.
|
|
426
|
+
*/
|
|
427
|
+
matches(pattern: string): JSONSchema;
|
|
428
|
+
isBetween(min: number, max: number): JSONSchema;
|
|
429
|
+
getId: () => {
|
|
430
|
+
fieldId: string;
|
|
431
|
+
};
|
|
432
|
+
/**
|
|
433
|
+
* @deprecated
|
|
434
|
+
* use field(fieldId).get(nestedProperty) instead
|
|
435
|
+
* with 'and' combinator e.g.
|
|
436
|
+
* and(
|
|
437
|
+
* field('child.name').get('firstname').isEqualTo('John'),
|
|
438
|
+
* field('child.name').get('surname').isEqualTo('Doe')
|
|
439
|
+
* )
|
|
440
|
+
*/
|
|
441
|
+
object: (options: Record<string, any>) => JSONSchema;
|
|
442
|
+
};
|
|
443
|
+
isAfter(): {
|
|
444
|
+
days: (days: number) => {
|
|
445
|
+
inPast: () => JSONSchema;
|
|
446
|
+
inFuture: () => JSONSchema;
|
|
447
|
+
fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
448
|
+
fromNow: () => JSONSchema;
|
|
449
|
+
};
|
|
450
|
+
date: (date: string | FieldReference) => JSONSchema;
|
|
451
|
+
now: () => JSONSchema;
|
|
452
|
+
};
|
|
453
|
+
isBefore(): {
|
|
454
|
+
days: (days: number) => {
|
|
455
|
+
inPast: () => JSONSchema;
|
|
456
|
+
inFuture: () => JSONSchema;
|
|
457
|
+
fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
458
|
+
fromNow: () => JSONSchema;
|
|
459
|
+
};
|
|
460
|
+
date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
461
|
+
now: () => JSONSchema;
|
|
462
|
+
};
|
|
463
|
+
isGreaterThan(value: number | FieldReference): JSONSchema;
|
|
464
|
+
isLessThan(value: number | FieldReference): JSONSchema;
|
|
465
|
+
isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
|
|
466
|
+
/**
|
|
467
|
+
* Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
|
|
468
|
+
* @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
|
|
469
|
+
* @returns whether the field is falsy (undefined, false, null, empty string)
|
|
470
|
+
*
|
|
471
|
+
* NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
|
|
472
|
+
*
|
|
473
|
+
*/
|
|
474
|
+
isFalsy(): JSONSchema;
|
|
475
|
+
isUndefined(): JSONSchema;
|
|
476
|
+
inArray(values: string[]): JSONSchema;
|
|
477
|
+
isValidEnglishName(): JSONSchema;
|
|
478
|
+
isValidAdministrativeLeafLevel(): JSONSchema;
|
|
479
|
+
/**
|
|
480
|
+
* Checks if the field value matches a given regular expression pattern.
|
|
481
|
+
* @param pattern - The regular expression pattern to match the field value against.
|
|
482
|
+
* @returns A JSONSchema conditional that validates the field value against the pattern.
|
|
483
|
+
*/
|
|
484
|
+
matches(pattern: string): JSONSchema;
|
|
485
|
+
isBetween(min: number, max: number): JSONSchema;
|
|
486
|
+
getId: () => {
|
|
487
|
+
fieldId: string;
|
|
488
|
+
};
|
|
489
|
+
/**
|
|
490
|
+
* @deprecated
|
|
491
|
+
* use field(fieldId).get(nestedProperty) instead
|
|
492
|
+
* with 'and' combinator e.g.
|
|
493
|
+
* and(
|
|
494
|
+
* field('child.name').get('firstname').isEqualTo('John'),
|
|
495
|
+
* field('child.name').get('surname').isEqualTo('Doe')
|
|
496
|
+
* )
|
|
497
|
+
*/
|
|
498
|
+
object: (options: Record<string, any>) => JSONSchema;
|
|
499
|
+
};
|
|
500
|
+
asDob(): {
|
|
501
|
+
$$subfield: string[];
|
|
502
|
+
/**
|
|
503
|
+
* @private Internal property used for field reference tracking.
|
|
504
|
+
*/
|
|
505
|
+
$$field: string;
|
|
506
|
+
get(fieldPath: string): any;
|
|
507
|
+
getByPath(fieldPath: string[]): {
|
|
508
|
+
$$subfield: string[];
|
|
509
|
+
/**
|
|
510
|
+
* @private Internal property used for field reference tracking.
|
|
511
|
+
*/
|
|
512
|
+
$$field: string;
|
|
513
|
+
get(fieldPath: string): any;
|
|
514
|
+
getByPath(fieldPath: string[]): any;
|
|
515
|
+
asDob(): any;
|
|
516
|
+
asAge(): any;
|
|
517
|
+
isAfter(): {
|
|
518
|
+
days: (days: number) => {
|
|
519
|
+
inPast: () => JSONSchema;
|
|
520
|
+
inFuture: () => JSONSchema;
|
|
521
|
+
fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
522
|
+
fromNow: () => JSONSchema;
|
|
523
|
+
};
|
|
524
|
+
date: (date: string | FieldReference) => JSONSchema;
|
|
525
|
+
now: () => JSONSchema;
|
|
526
|
+
};
|
|
527
|
+
isBefore(): {
|
|
528
|
+
days: (days: number) => {
|
|
529
|
+
inPast: () => JSONSchema;
|
|
530
|
+
inFuture: () => JSONSchema;
|
|
531
|
+
fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
532
|
+
fromNow: () => JSONSchema;
|
|
533
|
+
};
|
|
534
|
+
date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
535
|
+
now: () => JSONSchema;
|
|
536
|
+
};
|
|
537
|
+
isGreaterThan(value: number | FieldReference): JSONSchema;
|
|
538
|
+
isLessThan(value: number | FieldReference): JSONSchema;
|
|
539
|
+
isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
|
|
540
|
+
/**
|
|
541
|
+
* Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
|
|
542
|
+
* @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
|
|
543
|
+
* @returns whether the field is falsy (undefined, false, null, empty string)
|
|
544
|
+
*
|
|
545
|
+
* NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
|
|
546
|
+
*
|
|
547
|
+
*/
|
|
548
|
+
isFalsy(): JSONSchema;
|
|
549
|
+
isUndefined(): JSONSchema;
|
|
550
|
+
inArray(values: string[]): JSONSchema;
|
|
551
|
+
isValidEnglishName(): JSONSchema;
|
|
552
|
+
isValidAdministrativeLeafLevel(): JSONSchema;
|
|
553
|
+
/**
|
|
554
|
+
* Checks if the field value matches a given regular expression pattern.
|
|
555
|
+
* @param pattern - The regular expression pattern to match the field value against.
|
|
556
|
+
* @returns A JSONSchema conditional that validates the field value against the pattern.
|
|
557
|
+
*/
|
|
558
|
+
matches(pattern: string): JSONSchema;
|
|
559
|
+
isBetween(min: number, max: number): JSONSchema;
|
|
560
|
+
getId: () => {
|
|
561
|
+
fieldId: string;
|
|
562
|
+
};
|
|
563
|
+
/**
|
|
564
|
+
* @deprecated
|
|
565
|
+
* use field(fieldId).get(nestedProperty) instead
|
|
566
|
+
* with 'and' combinator e.g.
|
|
567
|
+
* and(
|
|
568
|
+
* field('child.name').get('firstname').isEqualTo('John'),
|
|
569
|
+
* field('child.name').get('surname').isEqualTo('Doe')
|
|
570
|
+
* )
|
|
571
|
+
*/
|
|
572
|
+
object: (options: Record<string, any>) => JSONSchema;
|
|
573
|
+
};
|
|
574
|
+
asDob(): any;
|
|
575
|
+
asAge(): any;
|
|
576
|
+
isAfter(): {
|
|
577
|
+
days: (days: number) => {
|
|
578
|
+
inPast: () => JSONSchema;
|
|
579
|
+
inFuture: () => JSONSchema;
|
|
580
|
+
fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
581
|
+
fromNow: () => JSONSchema;
|
|
582
|
+
};
|
|
583
|
+
date: (date: string | FieldReference) => JSONSchema;
|
|
584
|
+
now: () => JSONSchema;
|
|
585
|
+
};
|
|
586
|
+
isBefore(): {
|
|
587
|
+
days: (days: number) => {
|
|
588
|
+
inPast: () => JSONSchema;
|
|
589
|
+
inFuture: () => JSONSchema;
|
|
590
|
+
fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
591
|
+
fromNow: () => JSONSchema;
|
|
592
|
+
};
|
|
593
|
+
date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
594
|
+
now: () => JSONSchema;
|
|
595
|
+
};
|
|
596
|
+
isGreaterThan(value: number | FieldReference): JSONSchema;
|
|
597
|
+
isLessThan(value: number | FieldReference): JSONSchema;
|
|
598
|
+
isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
|
|
599
|
+
/**
|
|
600
|
+
* Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
|
|
601
|
+
* @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
|
|
602
|
+
* @returns whether the field is falsy (undefined, false, null, empty string)
|
|
603
|
+
*
|
|
604
|
+
* NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
|
|
605
|
+
*
|
|
606
|
+
*/
|
|
607
|
+
isFalsy(): JSONSchema;
|
|
608
|
+
isUndefined(): JSONSchema;
|
|
609
|
+
inArray(values: string[]): JSONSchema;
|
|
610
|
+
isValidEnglishName(): JSONSchema;
|
|
611
|
+
isValidAdministrativeLeafLevel(): JSONSchema;
|
|
612
|
+
/**
|
|
613
|
+
* Checks if the field value matches a given regular expression pattern.
|
|
614
|
+
* @param pattern - The regular expression pattern to match the field value against.
|
|
615
|
+
* @returns A JSONSchema conditional that validates the field value against the pattern.
|
|
616
|
+
*/
|
|
617
|
+
matches(pattern: string): JSONSchema;
|
|
618
|
+
isBetween(min: number, max: number): JSONSchema;
|
|
619
|
+
getId: () => {
|
|
620
|
+
fieldId: string;
|
|
621
|
+
};
|
|
622
|
+
/**
|
|
623
|
+
* @deprecated
|
|
624
|
+
* use field(fieldId).get(nestedProperty) instead
|
|
625
|
+
* with 'and' combinator e.g.
|
|
626
|
+
* and(
|
|
627
|
+
* field('child.name').get('firstname').isEqualTo('John'),
|
|
628
|
+
* field('child.name').get('surname').isEqualTo('Doe')
|
|
629
|
+
* )
|
|
630
|
+
*/
|
|
631
|
+
object: (options: Record<string, any>) => JSONSchema;
|
|
632
|
+
};
|
|
633
|
+
asAge(): {
|
|
634
|
+
$$subfield: string[];
|
|
635
|
+
/**
|
|
636
|
+
* @private Internal property used for field reference tracking.
|
|
637
|
+
*/
|
|
638
|
+
$$field: string;
|
|
639
|
+
get(fieldPath: string): any;
|
|
640
|
+
getByPath(fieldPath: string[]): {
|
|
641
|
+
$$subfield: string[];
|
|
642
|
+
/**
|
|
643
|
+
* @private Internal property used for field reference tracking.
|
|
644
|
+
*/
|
|
645
|
+
$$field: string;
|
|
646
|
+
get(fieldPath: string): any;
|
|
647
|
+
getByPath(fieldPath: string[]): any;
|
|
648
|
+
asDob(): any;
|
|
649
|
+
asAge(): any;
|
|
650
|
+
isAfter(): {
|
|
651
|
+
days: (days: number) => {
|
|
652
|
+
inPast: () => JSONSchema;
|
|
653
|
+
inFuture: () => JSONSchema;
|
|
654
|
+
fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
655
|
+
fromNow: () => JSONSchema;
|
|
656
|
+
};
|
|
657
|
+
date: (date: string | FieldReference) => JSONSchema;
|
|
658
|
+
now: () => JSONSchema;
|
|
659
|
+
};
|
|
660
|
+
isBefore(): {
|
|
661
|
+
days: (days: number) => {
|
|
662
|
+
inPast: () => JSONSchema;
|
|
663
|
+
inFuture: () => JSONSchema;
|
|
664
|
+
fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
665
|
+
fromNow: () => JSONSchema;
|
|
666
|
+
};
|
|
667
|
+
date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
668
|
+
now: () => JSONSchema;
|
|
669
|
+
};
|
|
670
|
+
isGreaterThan(value: number | FieldReference): JSONSchema;
|
|
671
|
+
isLessThan(value: number | FieldReference): JSONSchema;
|
|
672
|
+
isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
|
|
673
|
+
/**
|
|
674
|
+
* Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
|
|
675
|
+
* @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
|
|
676
|
+
* @returns whether the field is falsy (undefined, false, null, empty string)
|
|
677
|
+
*
|
|
678
|
+
* NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
|
|
679
|
+
*
|
|
680
|
+
*/
|
|
681
|
+
isFalsy(): JSONSchema;
|
|
682
|
+
isUndefined(): JSONSchema;
|
|
683
|
+
inArray(values: string[]): JSONSchema;
|
|
684
|
+
isValidEnglishName(): JSONSchema;
|
|
685
|
+
isValidAdministrativeLeafLevel(): JSONSchema;
|
|
686
|
+
/**
|
|
687
|
+
* Checks if the field value matches a given regular expression pattern.
|
|
688
|
+
* @param pattern - The regular expression pattern to match the field value against.
|
|
689
|
+
* @returns A JSONSchema conditional that validates the field value against the pattern.
|
|
690
|
+
*/
|
|
691
|
+
matches(pattern: string): JSONSchema;
|
|
692
|
+
isBetween(min: number, max: number): JSONSchema;
|
|
693
|
+
getId: () => {
|
|
694
|
+
fieldId: string;
|
|
695
|
+
};
|
|
696
|
+
/**
|
|
697
|
+
* @deprecated
|
|
698
|
+
* use field(fieldId).get(nestedProperty) instead
|
|
699
|
+
* with 'and' combinator e.g.
|
|
700
|
+
* and(
|
|
701
|
+
* field('child.name').get('firstname').isEqualTo('John'),
|
|
702
|
+
* field('child.name').get('surname').isEqualTo('Doe')
|
|
703
|
+
* )
|
|
704
|
+
*/
|
|
705
|
+
object: (options: Record<string, any>) => JSONSchema;
|
|
706
|
+
};
|
|
707
|
+
asDob(): any;
|
|
708
|
+
asAge(): any;
|
|
709
|
+
isAfter(): {
|
|
710
|
+
days: (days: number) => {
|
|
711
|
+
inPast: () => JSONSchema;
|
|
712
|
+
inFuture: () => JSONSchema;
|
|
713
|
+
fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
714
|
+
fromNow: () => JSONSchema;
|
|
715
|
+
};
|
|
716
|
+
date: (date: string | FieldReference) => JSONSchema;
|
|
717
|
+
now: () => JSONSchema;
|
|
718
|
+
};
|
|
719
|
+
isBefore(): {
|
|
720
|
+
days: (days: number) => {
|
|
721
|
+
inPast: () => JSONSchema;
|
|
722
|
+
inFuture: () => JSONSchema;
|
|
723
|
+
fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
724
|
+
fromNow: () => JSONSchema;
|
|
725
|
+
};
|
|
726
|
+
date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
727
|
+
now: () => JSONSchema;
|
|
728
|
+
};
|
|
729
|
+
isGreaterThan(value: number | FieldReference): JSONSchema;
|
|
730
|
+
isLessThan(value: number | FieldReference): JSONSchema;
|
|
731
|
+
isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
|
|
732
|
+
/**
|
|
733
|
+
* Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
|
|
734
|
+
* @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
|
|
735
|
+
* @returns whether the field is falsy (undefined, false, null, empty string)
|
|
736
|
+
*
|
|
737
|
+
* NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
|
|
738
|
+
*
|
|
739
|
+
*/
|
|
740
|
+
isFalsy(): JSONSchema;
|
|
741
|
+
isUndefined(): JSONSchema;
|
|
742
|
+
inArray(values: string[]): JSONSchema;
|
|
743
|
+
isValidEnglishName(): JSONSchema;
|
|
744
|
+
isValidAdministrativeLeafLevel(): JSONSchema;
|
|
745
|
+
/**
|
|
746
|
+
* Checks if the field value matches a given regular expression pattern.
|
|
747
|
+
* @param pattern - The regular expression pattern to match the field value against.
|
|
748
|
+
* @returns A JSONSchema conditional that validates the field value against the pattern.
|
|
749
|
+
*/
|
|
750
|
+
matches(pattern: string): JSONSchema;
|
|
751
|
+
isBetween(min: number, max: number): JSONSchema;
|
|
752
|
+
getId: () => {
|
|
753
|
+
fieldId: string;
|
|
754
|
+
};
|
|
755
|
+
/**
|
|
756
|
+
* @deprecated
|
|
757
|
+
* use field(fieldId).get(nestedProperty) instead
|
|
758
|
+
* with 'and' combinator e.g.
|
|
759
|
+
* and(
|
|
760
|
+
* field('child.name').get('firstname').isEqualTo('John'),
|
|
761
|
+
* field('child.name').get('surname').isEqualTo('Doe')
|
|
762
|
+
* )
|
|
763
|
+
*/
|
|
764
|
+
object: (options: Record<string, any>) => JSONSchema;
|
|
765
|
+
};
|
|
766
|
+
isAfter(): {
|
|
767
|
+
days: (days: number) => {
|
|
768
|
+
inPast: () => JSONSchema;
|
|
769
|
+
inFuture: () => JSONSchema;
|
|
770
|
+
fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
771
|
+
fromNow: () => JSONSchema;
|
|
772
|
+
};
|
|
773
|
+
date: (date: string | FieldReference) => JSONSchema;
|
|
774
|
+
now: () => JSONSchema;
|
|
775
|
+
};
|
|
776
|
+
isBefore(): {
|
|
777
|
+
days: (days: number) => {
|
|
778
|
+
inPast: () => JSONSchema;
|
|
779
|
+
inFuture: () => JSONSchema;
|
|
780
|
+
fromDate: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
781
|
+
fromNow: () => JSONSchema;
|
|
782
|
+
};
|
|
783
|
+
date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
|
|
784
|
+
now: () => JSONSchema;
|
|
785
|
+
};
|
|
786
|
+
isGreaterThan(value: number | FieldReference): JSONSchema;
|
|
787
|
+
isLessThan(value: number | FieldReference): JSONSchema;
|
|
788
|
+
isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
|
|
789
|
+
/**
|
|
790
|
+
* Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
|
|
791
|
+
* @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
|
|
792
|
+
* @returns whether the field is falsy (undefined, false, null, empty string)
|
|
793
|
+
*
|
|
794
|
+
* NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
|
|
795
|
+
*
|
|
796
|
+
*/
|
|
797
|
+
isFalsy(): JSONSchema;
|
|
798
|
+
isUndefined(): JSONSchema;
|
|
799
|
+
inArray(values: string[]): JSONSchema;
|
|
800
|
+
isValidEnglishName(): JSONSchema;
|
|
801
|
+
isValidAdministrativeLeafLevel(): JSONSchema;
|
|
802
|
+
/**
|
|
803
|
+
* Checks if the field value matches a given regular expression pattern.
|
|
804
|
+
* @param pattern - The regular expression pattern to match the field value against.
|
|
805
|
+
* @returns A JSONSchema conditional that validates the field value against the pattern.
|
|
806
|
+
*/
|
|
807
|
+
matches(pattern: string): JSONSchema;
|
|
808
|
+
isBetween(min: number, max: number): JSONSchema;
|
|
809
|
+
getId: () => {
|
|
810
|
+
fieldId: string;
|
|
811
|
+
};
|
|
812
|
+
/**
|
|
813
|
+
* @deprecated
|
|
814
|
+
* use field(fieldId).get(nestedProperty) instead
|
|
815
|
+
* with 'and' combinator e.g.
|
|
816
|
+
* and(
|
|
817
|
+
* field('child.name').get('firstname').isEqualTo('John'),
|
|
818
|
+
* field('child.name').get('surname').isEqualTo('Doe')
|
|
819
|
+
* )
|
|
820
|
+
*/
|
|
821
|
+
object: (options: Record<string, any>) => JSONSchema;
|
|
822
|
+
};
|
|
823
|
+
export {};
|
|
824
|
+
//# sourceMappingURL=conditionals.d.ts.map
|