@opencrvs/toolkit 1.9.12-rc.2bd27dc → 1.9.12-rc.8753d72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commons/api/router.d.ts +2 -2
- package/dist/commons/conditionals/validate.d.ts +8 -5
- package/dist/commons/events/ActionDocument.d.ts +1 -1
- package/dist/commons/events/AdvancedSearchConfig.d.ts +31 -25
- package/dist/commons/events/EventConfig.d.ts +22 -20
- package/dist/commons/events/EventIndex.d.ts +2 -2
- package/dist/commons/events/FieldConfig.d.ts +52 -17
- package/dist/commons/events/FieldType.d.ts +2 -1
- package/dist/commons/events/FieldTypeMapping.d.ts +22 -22
- package/dist/commons/events/FieldValue.d.ts +170 -7
- package/dist/commons/events/defineConfig.d.ts +2 -2
- package/dist/commons/events/utils.d.ts +140 -4
- package/dist/events/index.js +289 -164
- package/dist/notification/index.js +191 -178
- package/package.json +1 -1
|
@@ -64,7 +64,7 @@ export declare const ButtonFieldValue: z.ZodNumber;
|
|
|
64
64
|
export type ButtonFieldValue = z.infer<typeof ButtonFieldValue>;
|
|
65
65
|
export declare const VerificationStatusValue: z.ZodEnum<["verified", "authenticated", "failed", "pending"]>;
|
|
66
66
|
export type VerificationStatusValue = z.infer<typeof VerificationStatusValue>;
|
|
67
|
-
declare const
|
|
67
|
+
declare const LeafFieldValues: z.ZodUnion<[z.ZodDiscriminatedUnion<"addressType", [z.ZodObject<z.objectUtil.extendShape<{
|
|
68
68
|
country: z.ZodString;
|
|
69
69
|
streetLevelDetails: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
70
70
|
}, {
|
|
@@ -226,7 +226,170 @@ declare const FieldValuesWithoutDataField: z.ZodUnion<[z.ZodDiscriminatedUnion<"
|
|
|
226
226
|
numericValue?: number | undefined;
|
|
227
227
|
unit?: string | undefined;
|
|
228
228
|
}>]>;
|
|
229
|
-
type
|
|
229
|
+
type LeafFieldValues = z.infer<typeof LeafFieldValues>;
|
|
230
|
+
export declare const FieldGroupValue: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodDiscriminatedUnion<"addressType", [z.ZodObject<z.objectUtil.extendShape<{
|
|
231
|
+
country: z.ZodString;
|
|
232
|
+
streetLevelDetails: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
233
|
+
}, {
|
|
234
|
+
addressType: z.ZodLiteral<"DOMESTIC">;
|
|
235
|
+
administrativeArea: z.ZodString;
|
|
236
|
+
}>, "strip", z.ZodTypeAny, {
|
|
237
|
+
country: string;
|
|
238
|
+
addressType: "DOMESTIC";
|
|
239
|
+
administrativeArea: string;
|
|
240
|
+
streetLevelDetails?: Record<string, string> | undefined;
|
|
241
|
+
}, {
|
|
242
|
+
country: string;
|
|
243
|
+
addressType: "DOMESTIC";
|
|
244
|
+
administrativeArea: string;
|
|
245
|
+
streetLevelDetails?: Record<string, string> | undefined;
|
|
246
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
247
|
+
country: z.ZodString;
|
|
248
|
+
streetLevelDetails: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
249
|
+
}, {
|
|
250
|
+
addressType: z.ZodLiteral<"INTERNATIONAL">;
|
|
251
|
+
}>, "strip", z.ZodTypeAny, {
|
|
252
|
+
country: string;
|
|
253
|
+
addressType: "INTERNATIONAL";
|
|
254
|
+
streetLevelDetails?: Record<string, string> | undefined;
|
|
255
|
+
}, {
|
|
256
|
+
country: string;
|
|
257
|
+
addressType: "INTERNATIONAL";
|
|
258
|
+
streetLevelDetails?: Record<string, string> | undefined;
|
|
259
|
+
}>]>, z.ZodString, z.ZodBranded<z.ZodString, "PlainDate">, z.ZodObject<{
|
|
260
|
+
age: z.ZodNumber;
|
|
261
|
+
asOfDateRef: z.ZodString;
|
|
262
|
+
}, "strip", z.ZodTypeAny, {
|
|
263
|
+
age: number;
|
|
264
|
+
asOfDateRef: string;
|
|
265
|
+
}, {
|
|
266
|
+
age: number;
|
|
267
|
+
asOfDateRef: string;
|
|
268
|
+
}>, z.ZodString, z.ZodUnion<[z.ZodObject<{
|
|
269
|
+
start: z.ZodBranded<z.ZodString, "PlainDate">;
|
|
270
|
+
end: z.ZodBranded<z.ZodString, "PlainDate">;
|
|
271
|
+
}, "strip", z.ZodTypeAny, {
|
|
272
|
+
start: string & z.BRAND<"PlainDate">;
|
|
273
|
+
end: string & z.BRAND<"PlainDate">;
|
|
274
|
+
}, {
|
|
275
|
+
start: string;
|
|
276
|
+
end: string;
|
|
277
|
+
}>, z.ZodBranded<z.ZodString, "PlainDate">]>, z.ZodEnum<["last7Days", "last30Days", "last90Days", "last365Days"]>, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
|
|
278
|
+
path: z.ZodEffects<z.ZodString, string, string>;
|
|
279
|
+
originalFilename: z.ZodString;
|
|
280
|
+
type: z.ZodString;
|
|
281
|
+
}, "strip", z.ZodTypeAny, {
|
|
282
|
+
type: string;
|
|
283
|
+
path: string;
|
|
284
|
+
originalFilename: string;
|
|
285
|
+
}, {
|
|
286
|
+
type: string;
|
|
287
|
+
path: string;
|
|
288
|
+
originalFilename: string;
|
|
289
|
+
}>, z.ZodArray<z.ZodObject<{
|
|
290
|
+
path: z.ZodEffects<z.ZodString, string, string>;
|
|
291
|
+
originalFilename: z.ZodString;
|
|
292
|
+
type: z.ZodString;
|
|
293
|
+
option: z.ZodString;
|
|
294
|
+
}, "strip", z.ZodTypeAny, {
|
|
295
|
+
type: string;
|
|
296
|
+
option: string;
|
|
297
|
+
path: string;
|
|
298
|
+
originalFilename: string;
|
|
299
|
+
}, {
|
|
300
|
+
type: string;
|
|
301
|
+
option: string;
|
|
302
|
+
path: string;
|
|
303
|
+
originalFilename: string;
|
|
304
|
+
}>, "many">, z.ZodObject<{
|
|
305
|
+
firstname: z.ZodString;
|
|
306
|
+
surname: z.ZodString;
|
|
307
|
+
middlename: z.ZodOptional<z.ZodString>;
|
|
308
|
+
}, "strip", z.ZodTypeAny, {
|
|
309
|
+
firstname: string;
|
|
310
|
+
surname: string;
|
|
311
|
+
middlename?: string | undefined;
|
|
312
|
+
}, {
|
|
313
|
+
firstname: string;
|
|
314
|
+
surname: string;
|
|
315
|
+
middlename?: string | undefined;
|
|
316
|
+
}>, z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
|
|
317
|
+
firstname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
318
|
+
surname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
319
|
+
middlename: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
320
|
+
}, "strip", z.ZodTypeAny, {
|
|
321
|
+
firstname?: string | null | undefined;
|
|
322
|
+
surname?: string | null | undefined;
|
|
323
|
+
middlename?: string | null | undefined;
|
|
324
|
+
}, {
|
|
325
|
+
firstname?: string | null | undefined;
|
|
326
|
+
surname?: string | null | undefined;
|
|
327
|
+
middlename?: string | null | undefined;
|
|
328
|
+
}>, z.ZodNull]>, z.ZodUndefined]>, z.ZodNumber, z.ZodObject<{
|
|
329
|
+
loading: z.ZodBoolean;
|
|
330
|
+
error: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
331
|
+
statusCode: z.ZodNumber;
|
|
332
|
+
message: z.ZodString;
|
|
333
|
+
}, "strip", z.ZodTypeAny, {
|
|
334
|
+
message: string;
|
|
335
|
+
statusCode: number;
|
|
336
|
+
}, {
|
|
337
|
+
message: string;
|
|
338
|
+
statusCode: number;
|
|
339
|
+
}>>>;
|
|
340
|
+
data: z.ZodAny;
|
|
341
|
+
}, "strip", z.ZodTypeAny, {
|
|
342
|
+
loading: boolean;
|
|
343
|
+
data?: any;
|
|
344
|
+
error?: {
|
|
345
|
+
message: string;
|
|
346
|
+
statusCode: number;
|
|
347
|
+
} | null | undefined;
|
|
348
|
+
}, {
|
|
349
|
+
loading: boolean;
|
|
350
|
+
data?: any;
|
|
351
|
+
error?: {
|
|
352
|
+
message: string;
|
|
353
|
+
statusCode: number;
|
|
354
|
+
} | null | undefined;
|
|
355
|
+
}>, z.ZodEnum<["verified", "authenticated", "failed", "pending"]>, z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
356
|
+
data: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
357
|
+
}, "strip", z.ZodTypeAny, {
|
|
358
|
+
data: Record<string, string>;
|
|
359
|
+
}, {
|
|
360
|
+
data: Record<string, string>;
|
|
361
|
+
}>>>, z.ZodObject<{
|
|
362
|
+
data: z.ZodAny;
|
|
363
|
+
}, "strip", z.ZodTypeAny, {
|
|
364
|
+
data?: any;
|
|
365
|
+
}, {
|
|
366
|
+
data?: any;
|
|
367
|
+
}>, z.ZodObject<{
|
|
368
|
+
data: z.ZodAny;
|
|
369
|
+
}, "strip", z.ZodTypeAny, {
|
|
370
|
+
data?: any;
|
|
371
|
+
}, {
|
|
372
|
+
data?: any;
|
|
373
|
+
}>, z.ZodObject<{
|
|
374
|
+
numericValue: z.ZodNumber;
|
|
375
|
+
unit: z.ZodString;
|
|
376
|
+
}, "strip", z.ZodTypeAny, {
|
|
377
|
+
numericValue: number;
|
|
378
|
+
unit: string;
|
|
379
|
+
}, {
|
|
380
|
+
numericValue: number;
|
|
381
|
+
unit: string;
|
|
382
|
+
}>, z.ZodObject<{
|
|
383
|
+
numericValue: z.ZodOptional<z.ZodNumber>;
|
|
384
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
385
|
+
}, "strip", z.ZodTypeAny, {
|
|
386
|
+
numericValue?: number | undefined;
|
|
387
|
+
unit?: string | undefined;
|
|
388
|
+
}, {
|
|
389
|
+
numericValue?: number | undefined;
|
|
390
|
+
unit?: string | undefined;
|
|
391
|
+
}>]>>;
|
|
392
|
+
export type FieldGroupValue = z.infer<typeof FieldGroupValue>;
|
|
230
393
|
export declare const DataFieldValue: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
231
394
|
data: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodDiscriminatedUnion<"addressType", [z.ZodObject<z.objectUtil.extendShape<{
|
|
232
395
|
country: z.ZodString;
|
|
@@ -494,19 +657,19 @@ export declare const DataFieldValue: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
|
494
657
|
} | null | undefined>;
|
|
495
658
|
}>>>;
|
|
496
659
|
export type DataFieldValue = z.infer<typeof DataFieldValue>;
|
|
497
|
-
export type FieldValue =
|
|
498
|
-
export declare const FieldValue: z.ZodType<FieldValue
|
|
660
|
+
export type FieldValue = LeafFieldValues | DataFieldValue | FieldGroupValue;
|
|
661
|
+
export declare const FieldValue: z.ZodType<FieldValue>;
|
|
499
662
|
export declare function safeUnion<T extends [z.ZodTypeAny, ...z.ZodTypeAny[]]>(schemas: T): z.ZodType<z.TypeOf<T[number]>, z.ZodTypeDef, z.TypeOf<T[number]>>;
|
|
500
|
-
export type FieldUpdateValue = z.infer<typeof TextValue> | PlainDate | z.infer<typeof TimeValue> | z.infer<typeof AgeUpdateValue> | z.infer<typeof AddressFieldUpdateValue> | z.infer<typeof DateRangeFieldValue> | z.infer<typeof SelectDateRangeValue> | z.infer<typeof CheckboxFieldValue> | z.infer<typeof NumberFieldValue> | z.infer<typeof NumberWithUnitFieldUpdateValue> | z.infer<typeof FileFieldValue> | z.infer<typeof FileFieldWithOptionValue> |
|
|
663
|
+
export type FieldUpdateValue = z.infer<typeof TextValue> | PlainDate | z.infer<typeof TimeValue> | z.infer<typeof AgeUpdateValue> | z.infer<typeof AddressFieldUpdateValue> | z.infer<typeof DateRangeFieldValue> | z.infer<typeof SelectDateRangeValue> | z.infer<typeof CheckboxFieldValue> | z.infer<typeof NumberFieldValue> | z.infer<typeof NumberWithUnitFieldUpdateValue> | z.infer<typeof FileFieldValue> | z.infer<typeof FileFieldWithOptionValue> | DataFieldValue | FieldGroupValue | z.infer<typeof NameFieldUpdateValue> | z.infer<typeof HttpFieldUpdateValue> | z.infer<typeof QueryParamReaderFieldUpdateValue>;
|
|
501
664
|
export declare const FieldUpdateValue: z.ZodType<FieldUpdateValue>;
|
|
502
665
|
/**
|
|
503
666
|
* NOTE: This is an exception. We need schema as a type in order to generate schema dynamically.
|
|
504
667
|
* */
|
|
505
|
-
export type FieldValueSchema = typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldValue | typeof NumberFieldValue | typeof NumberWithUnitFieldValue | typeof DataFieldValue | typeof NameFieldValue | z.ZodString | z.ZodBoolean;
|
|
668
|
+
export type FieldValueSchema = typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldValue | typeof NumberFieldValue | typeof NumberWithUnitFieldValue | typeof DataFieldValue | typeof FieldGroupValue | typeof NameFieldValue | z.ZodString | z.ZodBoolean;
|
|
506
669
|
/**
|
|
507
670
|
* NOTE: This is an exception. We need schema as a type in order to generate schema dynamically.
|
|
508
671
|
*
|
|
509
672
|
* FieldValueInputSchema uses Input types which have set optional values as nullish
|
|
510
673
|
* */
|
|
511
|
-
export type FieldUpdateValueSchema = typeof PlainDate | typeof DateRangeFieldValue | typeof AgeValue | typeof SelectDateRangeValue | typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldUpdateValue | typeof NumberFieldValue | typeof NumberWithUnitFieldValue | typeof NumberWithUnitFieldUpdateValue | typeof DataFieldValue | typeof NameFieldValue | typeof NameFieldUpdateValue | typeof HttpFieldUpdateValue | typeof QueryParamReaderFieldUpdateValue | typeof ButtonFieldValue | typeof QrReaderFieldValue | typeof IdReaderFieldValue | z.ZodString | z.ZodBoolean;
|
|
674
|
+
export type FieldUpdateValueSchema = typeof PlainDate | typeof DateRangeFieldValue | typeof AgeValue | typeof SelectDateRangeValue | typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldUpdateValue | typeof NumberFieldValue | typeof NumberWithUnitFieldValue | typeof NumberWithUnitFieldUpdateValue | typeof DataFieldValue | typeof FieldGroupValue | typeof NameFieldValue | typeof NameFieldUpdateValue | typeof HttpFieldUpdateValue | typeof QueryParamReaderFieldUpdateValue | typeof ButtonFieldValue | typeof QrReaderFieldValue | typeof IdReaderFieldValue | z.ZodString | z.ZodBoolean;
|
|
512
675
|
//# sourceMappingURL=FieldValue.d.ts.map
|
|
@@ -172,7 +172,7 @@ export declare const defineConfig: (config: EventConfigInput) => {
|
|
|
172
172
|
};
|
|
173
173
|
fieldId: string;
|
|
174
174
|
fieldType: "field";
|
|
175
|
-
type?: "NAME" | "PHONE" | "ID" | "ADDRESS" | "TEXT" | "NUMBER" | "NUMBER_WITH_UNIT" | "TEXTAREA" | "EMAIL" | "DATE" | "AGE" | "DATE_RANGE" | "SELECT_DATE_RANGE" | "TIME" | "PARAGRAPH" | "PAGE_HEADER" | "RADIO_GROUP" | "FILE" | "FILE_WITH_OPTIONS" | "BULLET_LIST" | "CHECKBOX" | "SELECT" | "COUNTRY" | "LOCATION" | "DIVIDER" | "ADMINISTRATIVE_AREA" | "FACILITY" | "OFFICE" | "SIGNATURE" | "DATA" | "BUTTON" | "SEARCH" | "ALPHA_PRINT_BUTTON" | "HTTP" | "LINK_BUTTON" | "VERIFICATION_STATUS" | "QUERY_PARAM_READER" | "QR_READER" | "ID_READER" | "LOADER" | undefined;
|
|
175
|
+
type?: "NAME" | "PHONE" | "ID" | "ADDRESS" | "TEXT" | "NUMBER" | "NUMBER_WITH_UNIT" | "TEXTAREA" | "EMAIL" | "DATE" | "AGE" | "DATE_RANGE" | "SELECT_DATE_RANGE" | "TIME" | "PARAGRAPH" | "PAGE_HEADER" | "RADIO_GROUP" | "FIELD_GROUP" | "FILE" | "FILE_WITH_OPTIONS" | "BULLET_LIST" | "CHECKBOX" | "SELECT" | "COUNTRY" | "LOCATION" | "DIVIDER" | "ADMINISTRATIVE_AREA" | "FACILITY" | "OFFICE" | "SIGNATURE" | "DATA" | "BUTTON" | "SEARCH" | "ALPHA_PRINT_BUTTON" | "HTTP" | "LINK_BUTTON" | "VERIFICATION_STATUS" | "QUERY_PARAM_READER" | "QR_READER" | "ID_READER" | "LOADER" | undefined;
|
|
176
176
|
options?: {
|
|
177
177
|
value: string;
|
|
178
178
|
label: string | import("./TranslationConfig").TranslationConfig;
|
|
@@ -200,7 +200,7 @@ export declare const defineConfig: (config: EventConfigInput) => {
|
|
|
200
200
|
};
|
|
201
201
|
fieldId: "event.status" | "event.trackingId" | "event.updatedAt" | "event.legalStatuses.REGISTERED.acceptedAt" | "event.legalStatuses.REGISTERED.createdAtLocation" | "event.legalStatuses.REGISTERED.registrationNumber";
|
|
202
202
|
fieldType: "event";
|
|
203
|
-
type?: "NAME" | "PHONE" | "ID" | "ADDRESS" | "TEXT" | "NUMBER" | "NUMBER_WITH_UNIT" | "TEXTAREA" | "EMAIL" | "DATE" | "AGE" | "DATE_RANGE" | "SELECT_DATE_RANGE" | "TIME" | "PARAGRAPH" | "PAGE_HEADER" | "RADIO_GROUP" | "FILE" | "FILE_WITH_OPTIONS" | "BULLET_LIST" | "CHECKBOX" | "SELECT" | "COUNTRY" | "LOCATION" | "DIVIDER" | "ADMINISTRATIVE_AREA" | "FACILITY" | "OFFICE" | "SIGNATURE" | "DATA" | "BUTTON" | "SEARCH" | "ALPHA_PRINT_BUTTON" | "HTTP" | "LINK_BUTTON" | "VERIFICATION_STATUS" | "QUERY_PARAM_READER" | "QR_READER" | "ID_READER" | "LOADER" | undefined;
|
|
203
|
+
type?: "NAME" | "PHONE" | "ID" | "ADDRESS" | "TEXT" | "NUMBER" | "NUMBER_WITH_UNIT" | "TEXTAREA" | "EMAIL" | "DATE" | "AGE" | "DATE_RANGE" | "SELECT_DATE_RANGE" | "TIME" | "PARAGRAPH" | "PAGE_HEADER" | "RADIO_GROUP" | "FIELD_GROUP" | "FILE" | "FILE_WITH_OPTIONS" | "BULLET_LIST" | "CHECKBOX" | "SELECT" | "COUNTRY" | "LOCATION" | "DIVIDER" | "ADMINISTRATIVE_AREA" | "FACILITY" | "OFFICE" | "SIGNATURE" | "DATA" | "BUTTON" | "SEARCH" | "ALPHA_PRINT_BUTTON" | "HTTP" | "LINK_BUTTON" | "VERIFICATION_STATUS" | "QUERY_PARAM_READER" | "QR_READER" | "ID_READER" | "LOADER" | undefined;
|
|
204
204
|
options?: {
|
|
205
205
|
value: string;
|
|
206
206
|
label: string | import("./TranslationConfig").TranslationConfig;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ActionType, DeclarationActionType } from './ActionType';
|
|
2
2
|
import { EventConfig } from './EventConfig';
|
|
3
|
-
import { FieldConfig } from './FieldConfig';
|
|
3
|
+
import { FieldConfig, FieldReference } from './FieldConfig';
|
|
4
4
|
import { Action, ActionDocument, ActionUpdate, EventState } from './ActionDocument';
|
|
5
5
|
import { PageConfig, VerificationPageConfig } from './PageConfig';
|
|
6
6
|
import { ValidatorContext } from '../conditionals/validate';
|
|
@@ -162,7 +162,56 @@ export declare function omitHiddenAnnotationFields(actionConfig: ActionConfig, d
|
|
|
162
162
|
} | {
|
|
163
163
|
start: string & import("zod").BRAND<"PlainDate">;
|
|
164
164
|
end: string & import("zod").BRAND<"PlainDate">;
|
|
165
|
+
} | Record<string, string | number | boolean | {
|
|
166
|
+
type: string;
|
|
167
|
+
path: string;
|
|
168
|
+
originalFilename: string;
|
|
169
|
+
} | {
|
|
170
|
+
firstname: string;
|
|
171
|
+
surname: string;
|
|
172
|
+
middlename?: string | undefined;
|
|
173
|
+
} | {
|
|
174
|
+
firstname?: string | null | undefined;
|
|
175
|
+
surname?: string | null | undefined;
|
|
176
|
+
middlename?: string | null | undefined;
|
|
165
177
|
} | {
|
|
178
|
+
country: string;
|
|
179
|
+
addressType: "DOMESTIC";
|
|
180
|
+
administrativeArea: string;
|
|
181
|
+
streetLevelDetails?: Record<string, string> | undefined;
|
|
182
|
+
} | {
|
|
183
|
+
country: string;
|
|
184
|
+
addressType: "INTERNATIONAL";
|
|
185
|
+
streetLevelDetails?: Record<string, string> | undefined;
|
|
186
|
+
} | {
|
|
187
|
+
type: string;
|
|
188
|
+
option: string;
|
|
189
|
+
path: string;
|
|
190
|
+
originalFilename: string;
|
|
191
|
+
}[] | {
|
|
192
|
+
loading: boolean;
|
|
193
|
+
data?: any;
|
|
194
|
+
error?: {
|
|
195
|
+
message: string;
|
|
196
|
+
statusCode: number;
|
|
197
|
+
} | null | undefined;
|
|
198
|
+
} | {
|
|
199
|
+
data: Record<string, string>;
|
|
200
|
+
} | {
|
|
201
|
+
data?: any;
|
|
202
|
+
} | {
|
|
203
|
+
numericValue: number;
|
|
204
|
+
unit: string;
|
|
205
|
+
} | {
|
|
206
|
+
numericValue?: number | undefined;
|
|
207
|
+
unit?: string | undefined;
|
|
208
|
+
} | (string & import("zod").BRAND<"PlainDate">) | {
|
|
209
|
+
age: number;
|
|
210
|
+
asOfDateRef: string;
|
|
211
|
+
} | {
|
|
212
|
+
start: string & import("zod").BRAND<"PlainDate">;
|
|
213
|
+
end: string & import("zod").BRAND<"PlainDate">;
|
|
214
|
+
} | null | undefined> | {
|
|
166
215
|
data: Record<string, string | number | boolean | {
|
|
167
216
|
type: string;
|
|
168
217
|
path: string;
|
|
@@ -225,12 +274,99 @@ export declare function omitHiddenAnnotationFields(actionConfig: ActionConfig, d
|
|
|
225
274
|
*/
|
|
226
275
|
export declare function deepMerge<T extends Record<string, unknown>, K extends Record<string, unknown>>(currentDocument: T, actionDocument: K): T & K;
|
|
227
276
|
export declare function findLastAssignmentAction(actions: Action[]): Action | undefined;
|
|
228
|
-
/**
|
|
277
|
+
/**
|
|
278
|
+
* Tell compiler that accessing record with arbitrary key might result to undefined
|
|
229
279
|
* Use when you **cannot guarantee** that key exists in the record
|
|
230
280
|
*/
|
|
231
281
|
export type IndexMap<T> = {
|
|
232
282
|
[id: string]: T | undefined;
|
|
233
283
|
};
|
|
284
|
+
/**
|
|
285
|
+
* Recursive union type that mirrors the shape of a form configuration.
|
|
286
|
+
*
|
|
287
|
+
* A `FormState<T>` is either:
|
|
288
|
+
* - A leaf value of type `T` (e.g. a field's current value, error message, or
|
|
289
|
+
* touched flag), or
|
|
290
|
+
* - A nested object whose values are themselves `FormState<T>`, representing a
|
|
291
|
+
* `FIELD_GROUP` whose children each carry their own state.
|
|
292
|
+
*
|
|
293
|
+
* This makes it possible to represent form field values as well as metadata
|
|
294
|
+
* (errors, touched state, etc.) in a single recursive structure that naturally
|
|
295
|
+
* matches the nesting of the form configuration.
|
|
296
|
+
*/
|
|
297
|
+
export type FormState<T> = T | {
|
|
298
|
+
[id: string]: FormState<T> | undefined;
|
|
299
|
+
};
|
|
300
|
+
/**
|
|
301
|
+
* Construct a `FormState` map from a list of `FieldConfig` items by applying a
|
|
302
|
+
* mapper function to every leaf field.
|
|
303
|
+
*
|
|
304
|
+
* `FIELD_GROUP` fields are handled recursively: instead of calling `mapper` on
|
|
305
|
+
* the group itself, `buildFormState` descends into the group's `fields` and
|
|
306
|
+
* stores the resulting nested state under the group's id.
|
|
307
|
+
*
|
|
308
|
+
* Leaf fields for which `mapper` returns `undefined` are omitted from the
|
|
309
|
+
* result entirely.
|
|
310
|
+
*
|
|
311
|
+
* @param fields - Flat or nested list (using FIELD_GROUP) of field configurations
|
|
312
|
+
* to process.
|
|
313
|
+
* @param mapper - Called for every non-group field. Return a value to include
|
|
314
|
+
* that field in the state, or `undefined` to omit it.
|
|
315
|
+
* @returns A nested state map whose structure mirrors the field hierarchy.
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* const fields = [
|
|
319
|
+
* { id: 'firstName', type: 'TEXT' },
|
|
320
|
+
* {
|
|
321
|
+
* id: 'address',
|
|
322
|
+
* type: 'FIELD_GROUP',
|
|
323
|
+
* fields: [
|
|
324
|
+
* { id: 'street', type: 'TEXT'},
|
|
325
|
+
* { id: 'city', type: 'TEXT'}
|
|
326
|
+
* ]
|
|
327
|
+
* }
|
|
328
|
+
* ]
|
|
329
|
+
* // Mark every field as untouched (false)
|
|
330
|
+
* const touched = buildFormState(fields, () => false)
|
|
331
|
+
* // { firstName: false, address: { street: false, city: false } }
|
|
332
|
+
*/
|
|
333
|
+
export declare function buildFormState<T>(fields: FieldConfig[], mapper: (field: FieldConfig) => T | undefined): IndexMap<FormState<T>>;
|
|
334
|
+
/**
|
|
335
|
+
* Transform every leaf value in a `FormState` via a mapping function,
|
|
336
|
+
* preserving the nested structure.
|
|
337
|
+
*
|
|
338
|
+
* `undefined` entries are dropped from the result. Objects
|
|
339
|
+
* are treated as nested groups and traversed recursively
|
|
340
|
+
* Leaf values are passed to `fn`.
|
|
341
|
+
*
|
|
342
|
+
* @param state - The source state to transform.
|
|
343
|
+
* @param fn - Transformer applied to each leaf value.
|
|
344
|
+
* @returns A new state with the same shape but with leaf values replaced by the
|
|
345
|
+
* return value of `fn`.
|
|
346
|
+
*
|
|
347
|
+
* @example
|
|
348
|
+
* // Convert an error state from string[] to boolean (has-error flag)
|
|
349
|
+
* const hasErrors = mapFormState(formErrors, (msgs) => msgs.length > 0)
|
|
350
|
+
*/
|
|
351
|
+
export declare function mapFormState<T, R>(state: IndexMap<FormState<T>>, fn: (leafState: T) => R): IndexMap<FormState<R>>;
|
|
352
|
+
/**
|
|
353
|
+
* Flatten a nested `FormState` into an array of `[path, value]` pairs, where
|
|
354
|
+
* `path` is the sequence of keys that leads to the leaf value.
|
|
355
|
+
*
|
|
356
|
+
* Empty arrays are treated as "no value" and are omitted from the output.
|
|
357
|
+
*
|
|
358
|
+
* @param state - The state to flatten.
|
|
359
|
+
* @param path - Internal accumulator for the current key path. Callers should
|
|
360
|
+
* omit this parameter (defaults to `[]`).
|
|
361
|
+
* @returns An array of `[string[], T]` tuples — one entry per leaf value.
|
|
362
|
+
*
|
|
363
|
+
* @example
|
|
364
|
+
* const errors = { firstName: ['Required'], address: { city: ['Required'] } }
|
|
365
|
+
* flattenFormState(errors)
|
|
366
|
+
* // => [ [['firstName'], ['Required']], [['address', 'city'], ['Required']] ]
|
|
367
|
+
*/
|
|
368
|
+
export declare function flattenFormState<T>(state: FormState<T>, path?: string[]): Array<[string[], T]>;
|
|
369
|
+
export declare function flattenFieldReference(ref: FieldReference): string[];
|
|
234
370
|
export declare function isWriteAction(actionType: ActionType): boolean;
|
|
235
371
|
/**
|
|
236
372
|
* @returns All the fields in the event configuration.
|
|
@@ -414,7 +550,7 @@ export declare function getEventConfigById(eventConfigs: EventConfig[], id: stri
|
|
|
414
550
|
};
|
|
415
551
|
fieldId: string;
|
|
416
552
|
fieldType: "field";
|
|
417
|
-
type?: "NAME" | "PHONE" | "ID" | "ADDRESS" | "TEXT" | "NUMBER" | "NUMBER_WITH_UNIT" | "TEXTAREA" | "EMAIL" | "DATE" | "AGE" | "DATE_RANGE" | "SELECT_DATE_RANGE" | "TIME" | "PARAGRAPH" | "PAGE_HEADER" | "RADIO_GROUP" | "FILE" | "FILE_WITH_OPTIONS" | "BULLET_LIST" | "CHECKBOX" | "SELECT" | "COUNTRY" | "LOCATION" | "DIVIDER" | "ADMINISTRATIVE_AREA" | "FACILITY" | "OFFICE" | "SIGNATURE" | "DATA" | "BUTTON" | "SEARCH" | "ALPHA_PRINT_BUTTON" | "HTTP" | "LINK_BUTTON" | "VERIFICATION_STATUS" | "QUERY_PARAM_READER" | "QR_READER" | "ID_READER" | "LOADER" | undefined;
|
|
553
|
+
type?: "NAME" | "PHONE" | "ID" | "ADDRESS" | "TEXT" | "NUMBER" | "NUMBER_WITH_UNIT" | "TEXTAREA" | "EMAIL" | "DATE" | "AGE" | "DATE_RANGE" | "SELECT_DATE_RANGE" | "TIME" | "PARAGRAPH" | "PAGE_HEADER" | "RADIO_GROUP" | "FIELD_GROUP" | "FILE" | "FILE_WITH_OPTIONS" | "BULLET_LIST" | "CHECKBOX" | "SELECT" | "COUNTRY" | "LOCATION" | "DIVIDER" | "ADMINISTRATIVE_AREA" | "FACILITY" | "OFFICE" | "SIGNATURE" | "DATA" | "BUTTON" | "SEARCH" | "ALPHA_PRINT_BUTTON" | "HTTP" | "LINK_BUTTON" | "VERIFICATION_STATUS" | "QUERY_PARAM_READER" | "QR_READER" | "ID_READER" | "LOADER" | undefined;
|
|
418
554
|
options?: {
|
|
419
555
|
value: string;
|
|
420
556
|
label: string | import("./TranslationConfig").TranslationConfig;
|
|
@@ -442,7 +578,7 @@ export declare function getEventConfigById(eventConfigs: EventConfig[], id: stri
|
|
|
442
578
|
};
|
|
443
579
|
fieldId: "event.status" | "event.trackingId" | "event.updatedAt" | "event.legalStatuses.REGISTERED.acceptedAt" | "event.legalStatuses.REGISTERED.createdAtLocation" | "event.legalStatuses.REGISTERED.registrationNumber";
|
|
444
580
|
fieldType: "event";
|
|
445
|
-
type?: "NAME" | "PHONE" | "ID" | "ADDRESS" | "TEXT" | "NUMBER" | "NUMBER_WITH_UNIT" | "TEXTAREA" | "EMAIL" | "DATE" | "AGE" | "DATE_RANGE" | "SELECT_DATE_RANGE" | "TIME" | "PARAGRAPH" | "PAGE_HEADER" | "RADIO_GROUP" | "FILE" | "FILE_WITH_OPTIONS" | "BULLET_LIST" | "CHECKBOX" | "SELECT" | "COUNTRY" | "LOCATION" | "DIVIDER" | "ADMINISTRATIVE_AREA" | "FACILITY" | "OFFICE" | "SIGNATURE" | "DATA" | "BUTTON" | "SEARCH" | "ALPHA_PRINT_BUTTON" | "HTTP" | "LINK_BUTTON" | "VERIFICATION_STATUS" | "QUERY_PARAM_READER" | "QR_READER" | "ID_READER" | "LOADER" | undefined;
|
|
581
|
+
type?: "NAME" | "PHONE" | "ID" | "ADDRESS" | "TEXT" | "NUMBER" | "NUMBER_WITH_UNIT" | "TEXTAREA" | "EMAIL" | "DATE" | "AGE" | "DATE_RANGE" | "SELECT_DATE_RANGE" | "TIME" | "PARAGRAPH" | "PAGE_HEADER" | "RADIO_GROUP" | "FIELD_GROUP" | "FILE" | "FILE_WITH_OPTIONS" | "BULLET_LIST" | "CHECKBOX" | "SELECT" | "COUNTRY" | "LOCATION" | "DIVIDER" | "ADMINISTRATIVE_AREA" | "FACILITY" | "OFFICE" | "SIGNATURE" | "DATA" | "BUTTON" | "SEARCH" | "ALPHA_PRINT_BUTTON" | "HTTP" | "LINK_BUTTON" | "VERIFICATION_STATUS" | "QUERY_PARAM_READER" | "QR_READER" | "ID_READER" | "LOADER" | undefined;
|
|
446
582
|
options?: {
|
|
447
583
|
value: string;
|
|
448
584
|
label: string | import("./TranslationConfig").TranslationConfig;
|