@opencrvs/toolkit 1.8.0-rc.ff62f9e → 1.8.0-rc.ffb4f66

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.
@@ -1,175 +1,87 @@
1
- import { TranslationConfig } from './TranslationConfig';
2
- import { ActionType } from './ActionType';
1
+ import { ActionType, DeclarationActionType } from './ActionType';
3
2
  import { EventConfig } from './EventConfig';
4
- import { EventConfigInput } from './EventConfigInput';
5
- import { EventMetadataKeys } from './EventMetadata';
6
3
  import { FieldConfig } from './FieldConfig';
7
4
  import { WorkqueueConfig } from './WorkqueueConfig';
8
- import { ActionUpdate, EventState } from './ActionDocument';
9
- import { FormConfig, FormPageConfig } from './FormConfig';
5
+ import { Action, ActionUpdate, EventState } from './ActionDocument';
6
+ import { PageConfig, VerificationPageConfig } from './PageConfig';
10
7
  import { Draft } from './Draft';
11
8
  import { EventDocument } from './EventDocument';
12
- /**
13
- * @returns All the fields in the event configuration input.
14
- */
15
- export declare const findInputPageFields: (config: EventConfigInput) => {
16
- id: string;
17
- label: TranslationConfig;
18
- }[];
19
- /**
20
- * @returns All the fields in the event configuration.
21
- */
22
- export declare const findPageFields: (config: EventConfig) => FieldConfig[];
23
- /**
24
- *
25
- * @param pageFields - All the fields in the event configuration
26
- * @param refFields - The fields referencing values within the event configuration (e.g. summary fields) or within system provided metadata fields (e.g. createdAt, updatedBy)
27
- * @returns referenced fields with populated labels
28
- */
29
- export declare const resolveLabelsFromKnownFields: ({ pageFields, refFields }: {
30
- pageFields: {
31
- id: string;
32
- label: TranslationConfig;
33
- }[];
34
- refFields: {
35
- id: EventMetadataKeys | string;
36
- label?: TranslationConfig;
37
- }[];
38
- }) => {
39
- id: EventMetadataKeys | string;
40
- label?: TranslationConfig;
41
- }[];
42
- export declare function getAllFields(configuration: EventConfig): import("./FieldConfig").Inferred[];
43
- export declare function getAllPages(configuration: EventConfig): ({
9
+ import { ActionConfig } from './ActionConfig';
10
+ import { FormConfig } from './FormConfig';
11
+ export declare function getDeclarationFields(configuration: EventConfig): FieldConfig[];
12
+ export declare function getDeclarationPages(configuration: EventConfig): {
44
13
  type: "FORM";
45
14
  id: string;
46
- title: TranslationConfig;
47
- fields: import("./FieldConfig").Inferred[];
48
- conditional?: import(".").JSONSchema | undefined;
49
- } | {
50
- type: "VERIFICATION";
51
- id: string;
52
- title: TranslationConfig;
53
- actions: {
54
- verify: {
55
- label: TranslationConfig;
56
- };
57
- cancel: {
58
- label: TranslationConfig;
59
- confirmation: {
60
- title: TranslationConfig;
61
- body: TranslationConfig;
62
- };
63
- };
64
- };
15
+ title: import("./TranslationConfig").TranslationConfig;
65
16
  fields: import("./FieldConfig").Inferred[];
66
17
  conditional?: import(".").JSONSchema | undefined;
67
- })[];
68
- export declare function validateWorkqueueConfig(workqueueConfigs: WorkqueueConfig[]): void;
69
- export declare const findActiveActionForm: (configuration: EventConfig, action: ActionType) => {
70
- active: boolean;
71
- version: {
72
- id: string;
73
- label: TranslationConfig;
74
- };
75
- label: TranslationConfig;
76
- pages: ({
18
+ }[];
19
+ export declare function getDeclaration(configuration: EventConfig): {
20
+ label: import("./TranslationConfig").TranslationConfig;
21
+ pages: {
77
22
  type: "FORM";
78
23
  id: string;
79
- title: TranslationConfig;
80
- fields: import("./FieldConfig").Inferred[];
81
- conditional?: import(".").JSONSchema | undefined;
82
- } | {
83
- type: "VERIFICATION";
84
- id: string;
85
- title: TranslationConfig;
86
- actions: {
87
- verify: {
88
- label: TranslationConfig;
89
- };
90
- cancel: {
91
- label: TranslationConfig;
92
- confirmation: {
93
- title: TranslationConfig;
94
- body: TranslationConfig;
95
- };
96
- };
97
- };
24
+ title: import("./TranslationConfig").TranslationConfig;
98
25
  fields: import("./FieldConfig").Inferred[];
99
26
  conditional?: import(".").JSONSchema | undefined;
100
- })[];
101
- review: {
102
- title: TranslationConfig;
103
- fields: import("./FieldConfig").Inferred[];
104
- };
105
- } | undefined;
106
- export declare const findActiveActionFormPages: (configuration: EventConfig, action: ActionType) => ({
107
- type: "FORM";
108
- id: string;
109
- title: TranslationConfig;
110
- fields: import("./FieldConfig").Inferred[];
111
- conditional?: import(".").JSONSchema | undefined;
112
- } | {
113
- type: "VERIFICATION";
114
- id: string;
115
- title: TranslationConfig;
116
- actions: {
117
- verify: {
118
- label: TranslationConfig;
119
- };
120
- cancel: {
121
- label: TranslationConfig;
122
- confirmation: {
123
- title: TranslationConfig;
124
- body: TranslationConfig;
125
- };
126
- };
127
- };
128
- fields: import("./FieldConfig").Inferred[];
129
- conditional?: import(".").JSONSchema | undefined;
130
- })[] | undefined;
131
- export declare const getFormFields: (formConfig: FormConfig) => import("./FieldConfig").Inferred[];
132
- export declare function isPageVisible(page: FormPageConfig, formValues: ActionUpdate): boolean;
133
- export declare const getVisiblePagesFormFields: (formConfig: FormConfig, formData: ActionUpdate) => import("./FieldConfig").Inferred[];
27
+ }[];
28
+ };
29
+ export declare const getActionAnnotationFields: (actionConfig: ActionConfig) => import("./FieldConfig").Inferred[];
30
+ export declare const getAllAnnotationFields: (config: EventConfig) => FieldConfig[];
134
31
  /**
135
- * Returns only form fields for the action type, if any, excluding review fields.
32
+ * @returns All the fields in the event configuration.
136
33
  */
137
- export declare const findActiveActionFormFields: (configuration: EventConfig, action: ActionType) => FieldConfig[] | undefined;
34
+ export declare const findAllFields: (config: EventConfig) => FieldConfig[];
138
35
  /**
139
- * Returns all fields for the action type, including review fields, if any.
36
+ * @TODO: Request correction should have same format as print certificate
140
37
  */
141
- export declare const findActiveActionFields: (configuration: EventConfig, action: ActionType, formData?: ActionUpdate) => FieldConfig[] | undefined;
142
- export declare const getActiveActionFormPages: (configuration: EventConfig, action: ActionType) => ({
143
- type: "FORM";
144
- id: string;
145
- title: TranslationConfig;
38
+ export declare const findRecordActionPages: (config: EventConfig, actionType: ActionType) => PageConfig[];
39
+ export declare function getActionReview(configuration: EventConfig, actionType: ActionType): {
40
+ title: import("./TranslationConfig").TranslationConfig;
146
41
  fields: import("./FieldConfig").Inferred[];
147
- conditional?: import(".").JSONSchema | undefined;
42
+ };
43
+ export declare function getActionReviewFields(configuration: EventConfig, actionType: DeclarationActionType): import("./FieldConfig").Inferred[];
44
+ export declare function validateWorkqueueConfig(workqueueConfigs: WorkqueueConfig[]): void;
45
+ export declare function isPageVisible(page: PageConfig, formValues: ActionUpdate): boolean;
46
+ export declare function omitHiddenFields(fields: FieldConfig[], values: EventState): import("lodash").Dictionary<string | number | boolean | {
47
+ type: string;
48
+ filename: string;
49
+ originalFilename: string;
148
50
  } | {
149
- type: "VERIFICATION";
150
- id: string;
151
- title: TranslationConfig;
152
- actions: {
153
- verify: {
154
- label: TranslationConfig;
155
- };
156
- cancel: {
157
- label: TranslationConfig;
158
- confirmation: {
159
- title: TranslationConfig;
160
- body: TranslationConfig;
161
- };
162
- };
163
- };
164
- fields: import("./FieldConfig").Inferred[];
165
- conditional?: import(".").JSONSchema | undefined;
166
- })[];
167
- /**
168
- * Returns all fields for the action type, including review fields, or throws
169
- */
170
- export declare function getActiveActionFields(configuration: EventConfig, action: ActionType): FieldConfig[];
171
- export declare function getEventConfiguration(eventConfigurations: EventConfig[], type: string): EventConfig;
172
- export declare function stripHiddenFields(fields: FieldConfig[], data: EventState): import("lodash").Dictionary<string | number | boolean | {
51
+ country: string;
52
+ district: string;
53
+ addressType: "DOMESTIC";
54
+ province: string;
55
+ urbanOrRural: "URBAN";
56
+ number?: string | undefined;
57
+ town?: string | undefined;
58
+ residentialArea?: string | undefined;
59
+ street?: string | undefined;
60
+ zipCode?: string | undefined;
61
+ } | {
62
+ country: string;
63
+ district: string;
64
+ addressType: "DOMESTIC";
65
+ province: string;
66
+ urbanOrRural: "RURAL";
67
+ village?: string | undefined;
68
+ } | {
69
+ country: string;
70
+ state: string;
71
+ addressType: "INTERNATIONAL";
72
+ district2: string;
73
+ cityOrTown?: string | undefined;
74
+ addressLine1?: string | undefined;
75
+ addressLine2?: string | undefined;
76
+ addressLine3?: string | undefined;
77
+ postcodeOrZip?: string | undefined;
78
+ } | {
79
+ type: string;
80
+ option: string;
81
+ filename: string;
82
+ originalFilename: string;
83
+ }[] | undefined>;
84
+ export declare function omitHiddenPaginatedFields(formConfig: FormConfig, declaration: EventState): import("lodash").Dictionary<string | number | boolean | {
173
85
  type: string;
174
86
  filename: string;
175
87
  originalFilename: string;
@@ -213,8 +125,11 @@ export declare function findActiveDrafts(event: EventDocument, drafts: Draft[]):
213
125
  eventId: string;
214
126
  transactionId: string;
215
127
  action: {
216
- type: ActionType;
217
- data: Record<string, string | number | boolean | {
128
+ type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "CREATE" | "NOTIFY" | "DETECT_DUPLICATE" | "REJECT" | "MARKED_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "READ" | "ASSIGN" | "UNASSIGN";
129
+ status: "Rejected" | "Requested" | "Accepted";
130
+ createdAt: string;
131
+ createdBy: string;
132
+ declaration: Record<string, string | number | boolean | {
218
133
  type: string;
219
134
  filename: string;
220
135
  originalFilename: string;
@@ -252,10 +167,8 @@ export declare function findActiveDrafts(event: EventDocument, drafts: Draft[]):
252
167
  filename: string;
253
168
  originalFilename: string;
254
169
  }[] | undefined>;
255
- createdAt: string;
256
- createdBy: string;
257
170
  createdAtLocation: string;
258
- metadata?: Record<string, string | number | boolean | {
171
+ annotation?: Record<string, string | number | boolean | {
259
172
  type: string;
260
173
  filename: string;
261
174
  originalFilename: string;
@@ -293,6 +206,7 @@ export declare function findActiveDrafts(event: EventDocument, drafts: Draft[]):
293
206
  filename: string;
294
207
  originalFilename: string;
295
208
  }[] | undefined> | undefined;
209
+ originalActionId?: string | undefined;
296
210
  };
297
211
  }[];
298
212
  export declare function createEmptyDraft(eventId: string, draftId: string, actionType: ActionType): {
@@ -302,30 +216,21 @@ export declare function createEmptyDraft(eventId: string, draftId: string, actio
302
216
  transactionId: import("../uuid").UUID;
303
217
  action: {
304
218
  type: ActionType;
305
- data: {};
306
- metadata: {};
219
+ declaration: {};
220
+ annotation: {};
307
221
  createdAt: string;
308
222
  createdBy: string;
309
223
  createdAtLocation: string;
310
224
  };
311
225
  };
312
- export declare function isVerificationPage(page: FormPageConfig): page is {
313
- type: "VERIFICATION";
314
- id: string;
315
- title: TranslationConfig;
316
- actions: {
317
- verify: {
318
- label: TranslationConfig;
319
- };
320
- cancel: {
321
- label: TranslationConfig;
322
- confirmation: {
323
- title: TranslationConfig;
324
- body: TranslationConfig;
325
- };
326
- };
327
- };
328
- fields: import("./FieldConfig").Inferred[];
329
- conditional?: import(".").JSONSchema | undefined;
226
+ export declare function isVerificationPage(page: PageConfig): page is VerificationPageConfig;
227
+ export declare function deepMerge<T extends Record<string, unknown>>(currentDocument: T, actionDocument: T): T;
228
+ export declare function findLastAssignmentAction(actions: Action[]): Action | undefined;
229
+ /** Tell compiler that accessing record with arbitrary key might result to undefined
230
+ * Use when you **cannot guarantee** that key exists in the record
231
+ */
232
+ export type IndexMap<T> = {
233
+ [id: string]: T | undefined;
330
234
  };
235
+ export declare function isWriteAction(actionType: ActionType): boolean;
331
236
  //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=utils.test.d.ts.map
@@ -23,8 +23,10 @@ __export(conditionals_exports, {
23
23
  alwaysTrue: () => alwaysTrue,
24
24
  and: () => and,
25
25
  defineConditional: () => defineConditional,
26
+ defineFormConditional: () => defineFormConditional,
26
27
  event: () => event,
27
28
  field: () => field,
29
+ never: () => never,
28
30
  not: () => not,
29
31
  or: () => or,
30
32
  user: () => user
@@ -35,6 +37,16 @@ module.exports = __toCommonJS(conditionals_exports);
35
37
  function defineConditional(schema) {
36
38
  return schema;
37
39
  }
40
+ function defineFormConditional(schema) {
41
+ const schemaWithForm = {
42
+ type: "object",
43
+ properties: {
44
+ $form: schema
45
+ },
46
+ required: ["$form"]
47
+ };
48
+ return defineConditional(schemaWithForm);
49
+ }
38
50
  function alwaysTrue() {
39
51
  return {};
40
52
  }
@@ -59,6 +71,9 @@ function not(condition) {
59
71
  required: []
60
72
  });
61
73
  }
74
+ function never() {
75
+ return not(alwaysTrue());
76
+ }
62
77
  var user = {
63
78
  hasScope: (scope) => defineConditional({
64
79
  type: "object",
@@ -106,69 +121,120 @@ var event = {
106
121
  required: ["$event"]
107
122
  })
108
123
  };
124
+ function getDateFromNow(days) {
125
+ return new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
126
+ }
127
+ function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
128
+ return {
129
+ type: "object",
130
+ properties: {
131
+ [fieldId]: {
132
+ type: "string",
133
+ format: "date",
134
+ [clause]: { $data: `1/${comparedFieldId}` }
135
+ },
136
+ [comparedFieldId]: { type: "string", format: "date" }
137
+ },
138
+ required: [fieldId]
139
+ };
140
+ }
141
+ function isFieldReference(value) {
142
+ return typeof value === "object" && value !== null && "_fieldId" in value;
143
+ }
109
144
  function field(fieldId) {
110
- const getDateFromNow = (days) => new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
111
145
  const getDateRange = (date, clause) => ({
112
146
  type: "object",
113
147
  properties: {
114
- $form: {
115
- type: "object",
116
- properties: {
117
- [fieldId]: {
118
- type: "string",
119
- format: "date",
120
- [clause]: date
121
- }
122
- },
123
- required: [fieldId]
148
+ [fieldId]: {
149
+ type: "string",
150
+ format: "date",
151
+ [clause]: date
124
152
  }
125
153
  },
126
- required: ["$form"]
154
+ required: [fieldId]
127
155
  });
128
156
  return {
157
+ /**
158
+ * @private Internal property used for field reference tracking.
159
+ */
160
+ _fieldId: fieldId,
129
161
  isAfter: () => ({
130
162
  days: (days) => ({
131
- inPast: () => defineConditional(
163
+ inPast: () => defineFormConditional(
132
164
  getDateRange(getDateFromNow(days), "formatMinimum")
133
165
  ),
134
- inFuture: () => defineConditional(
166
+ inFuture: () => defineFormConditional(
135
167
  getDateRange(getDateFromNow(-days), "formatMinimum")
136
168
  )
137
169
  }),
138
- date: (date) => defineConditional(getDateRange(date, "formatMinimum")),
139
- now: () => defineConditional(getDateRange(getDateFromNow(0), "formatMinimum"))
170
+ date: (date) => {
171
+ if (isFieldReference(date)) {
172
+ const comparedFieldId = date._fieldId;
173
+ return defineFormConditional(
174
+ getDateRangeToFieldReference(
175
+ fieldId,
176
+ comparedFieldId,
177
+ "formatMinimum"
178
+ )
179
+ );
180
+ }
181
+ return defineFormConditional(getDateRange(date, "formatMinimum"));
182
+ },
183
+ now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMinimum"))
140
184
  }),
141
185
  isBefore: () => ({
142
186
  days: (days) => ({
143
- inPast: () => defineConditional(
187
+ inPast: () => defineFormConditional(
144
188
  getDateRange(getDateFromNow(days), "formatMaximum")
145
189
  ),
146
- inFuture: () => defineConditional(
190
+ inFuture: () => defineFormConditional(
147
191
  getDateRange(getDateFromNow(-days), "formatMaximum")
148
192
  )
149
193
  }),
150
- date: (date) => defineConditional(getDateRange(date, "formatMaximum")),
151
- now: () => defineConditional(getDateRange(getDateFromNow(0), "formatMaximum"))
194
+ date: (date) => {
195
+ if (isFieldReference(date)) {
196
+ const comparedFieldId = date._fieldId;
197
+ return defineFormConditional(
198
+ getDateRangeToFieldReference(
199
+ fieldId,
200
+ comparedFieldId,
201
+ "formatMaximum"
202
+ )
203
+ );
204
+ }
205
+ return defineFormConditional(getDateRange(date, "formatMaximum"));
206
+ },
207
+ now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMaximum"))
152
208
  }),
153
- isEqualTo: (value) => defineConditional({
154
- type: "object",
155
- properties: {
156
- $form: {
209
+ isEqualTo: (value) => {
210
+ if (isFieldReference(value)) {
211
+ const comparedFieldId = value._fieldId;
212
+ return defineFormConditional({
157
213
  type: "object",
158
214
  properties: {
159
215
  [fieldId]: {
160
- oneOf: [
161
- { type: "string", const: value },
162
- { type: "boolean", const: value }
163
- ],
164
- const: value
165
- }
216
+ type: ["string", "boolean"],
217
+ const: { $data: `1/${comparedFieldId}` }
218
+ },
219
+ [comparedFieldId]: { type: ["string", "boolean"] }
166
220
  },
167
- required: [fieldId]
168
- }
169
- },
170
- required: ["$form"]
171
- }),
221
+ required: [fieldId, comparedFieldId]
222
+ });
223
+ }
224
+ return defineFormConditional({
225
+ type: "object",
226
+ properties: {
227
+ [fieldId]: {
228
+ oneOf: [
229
+ { type: "string", const: value },
230
+ { type: "boolean", const: value }
231
+ ],
232
+ const: value
233
+ }
234
+ },
235
+ required: [fieldId]
236
+ });
237
+ },
172
238
  /**
173
239
  * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
174
240
  * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
@@ -177,85 +243,87 @@ function field(fieldId) {
177
243
  * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
178
244
  *
179
245
  */
180
- isFalsy: () => defineConditional({
246
+ isFalsy: () => defineFormConditional({
181
247
  type: "object",
182
248
  properties: {
183
- $form: {
184
- type: "object",
185
- properties: {
186
- [fieldId]: {
187
- anyOf: [
188
- { const: "undefined" },
189
- { const: false },
190
- { const: null },
191
- { const: "" }
192
- ]
193
- }
194
- },
249
+ [fieldId]: {
195
250
  anyOf: [
196
- {
197
- required: [fieldId]
198
- },
199
- {
200
- not: {
201
- required: [fieldId]
202
- }
203
- }
251
+ { const: "undefined" },
252
+ { const: false },
253
+ { const: null },
254
+ { const: "" }
204
255
  ]
205
256
  }
206
257
  },
207
- required: ["$form"]
208
- }),
209
- isUndefined: () => defineConditional({
210
- type: "object",
211
- properties: {
212
- $form: {
213
- type: "object",
214
- properties: {
215
- [fieldId]: {
216
- type: "string",
217
- enum: ["undefined"]
218
- }
219
- },
258
+ anyOf: [
259
+ {
260
+ required: [fieldId]
261
+ },
262
+ {
220
263
  not: {
221
264
  required: [fieldId]
222
265
  }
223
266
  }
267
+ ]
268
+ }),
269
+ isUndefined: () => defineFormConditional({
270
+ type: "object",
271
+ properties: {
272
+ [fieldId]: {
273
+ type: "string",
274
+ enum: ["undefined"]
275
+ }
224
276
  },
225
- required: ["$form"]
277
+ not: {
278
+ required: [fieldId]
279
+ }
226
280
  }),
227
- inArray: (values) => defineConditional({
281
+ inArray: (values) => defineFormConditional({
228
282
  type: "object",
229
283
  properties: {
230
- $form: {
231
- type: "object",
232
- properties: {
233
- [fieldId]: {
234
- type: "string",
235
- enum: values
236
- }
237
- },
238
- required: [fieldId]
284
+ [fieldId]: {
285
+ type: "string",
286
+ enum: values
239
287
  }
240
288
  },
241
- required: ["$form"]
289
+ required: [fieldId]
242
290
  }),
243
- isValidEnglishName: () => defineConditional({
291
+ isValidEnglishName: () => defineFormConditional({
244
292
  type: "object",
245
293
  properties: {
246
- $form: {
247
- type: "object",
248
- properties: {
249
- [fieldId]: {
250
- type: "string",
251
- pattern: "^[\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*( [\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*)*$",
252
- description: "Name must contain only letters, numbers, and allowed special characters ('._-). No double spaces."
253
- }
254
- },
255
- required: [fieldId]
294
+ [fieldId]: {
295
+ type: "string",
296
+ pattern: "^[\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*( [\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*)*$",
297
+ description: "Name must contain only letters, numbers, and allowed special characters ('._-). No double spaces."
298
+ }
299
+ },
300
+ required: [fieldId]
301
+ }),
302
+ /**
303
+ * Checks if the field value matches a given regular expression pattern.
304
+ * @param pattern - The regular expression pattern to match the field value against.
305
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
306
+ */
307
+ matches: (pattern) => defineFormConditional({
308
+ type: "object",
309
+ properties: {
310
+ [fieldId]: {
311
+ type: "string",
312
+ pattern
313
+ }
314
+ },
315
+ required: [fieldId]
316
+ }),
317
+ isBetween: (min, max) => defineFormConditional({
318
+ type: "object",
319
+ properties: {
320
+ [fieldId]: {
321
+ type: "number",
322
+ minimum: min,
323
+ maximum: max
256
324
  }
257
325
  },
258
- required: ["$form"]
326
+ required: [fieldId]
259
327
  })
260
328
  };
261
329
  }