@opencrvs/toolkit 1.8.0-rc.fbb7263 → 1.8.0-rc.fd16d13
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 +3769 -22
- package/dist/commons/conditionals/validate-address.test.d.ts +2 -0
- package/dist/commons/conditionals/validate.d.ts +27 -0
- package/dist/commons/conditionals/validate.test.d.ts +2 -0
- package/dist/commons/events/ActionConfig.d.ts +6 -24
- package/dist/commons/events/ActionDocument.d.ts +1630 -73
- package/dist/commons/events/ActionInput.d.ts +2456 -116
- package/dist/commons/events/ActionType.d.ts +1 -1
- package/dist/commons/events/CompositeFieldValue.d.ts +120 -10
- package/dist/commons/events/Draft.d.ts +224 -8
- package/dist/commons/events/EventConfig.d.ts +4 -28
- package/dist/commons/events/EventDocument.d.ts +1955 -65
- package/dist/commons/events/FieldConfig.d.ts +49 -3
- package/dist/commons/events/FieldType.d.ts +4 -0
- package/dist/commons/events/FieldTypeMapping.d.ts +108 -6
- package/dist/commons/events/FieldValue.d.ts +58 -4
- package/dist/commons/events/TemplateConfig.d.ts +38 -0
- package/dist/commons/events/defineConfig.d.ts +1 -7
- package/dist/commons/events/index.d.ts +1 -0
- package/dist/commons/events/test.utils.d.ts +111 -3
- package/dist/commons/events/utils.d.ts +112 -0
- package/dist/events/index.js +284 -93
- package/package.json +1 -1
@@ -2319,6 +2319,7 @@ declare const Country: z.ZodObject<z.objectUtil.extendShape<{
|
|
2319
2319
|
hideLabel?: boolean | undefined;
|
2320
2320
|
}>;
|
2321
2321
|
export type Country = z.infer<typeof Country>;
|
2322
|
+
export declare const AdministrativeAreas: z.ZodEnum<["ADMIN_STRUCTURE", "HEALTH_FACILITY", "CRVS_OFFICE"]>;
|
2322
2323
|
declare const AdministrativeAreaConfiguration: z.ZodObject<{
|
2323
2324
|
partOf: z.ZodOptional<z.ZodObject<{
|
2324
2325
|
$data: z.ZodString;
|
@@ -3049,8 +3050,8 @@ declare const Address: z.ZodObject<z.objectUtil.extendShape<{
|
|
3049
3050
|
hideLabel: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
3050
3051
|
}, {
|
3051
3052
|
type: z.ZodLiteral<"ADDRESS">;
|
3052
|
-
defaultValue: z.ZodOptional<z.ZodDiscriminatedUnion<"urbanOrRural", [z.ZodObject<z.objectUtil.extendShape<{
|
3053
|
-
country: z.
|
3053
|
+
defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodDiscriminatedUnion<"urbanOrRural", [z.ZodObject<z.objectUtil.extendShape<{
|
3054
|
+
country: z.ZodLiteral<string>;
|
3054
3055
|
province: z.ZodString;
|
3055
3056
|
district: z.ZodString;
|
3056
3057
|
}, {
|
@@ -3081,7 +3082,7 @@ declare const Address: z.ZodObject<z.objectUtil.extendShape<{
|
|
3081
3082
|
street?: string | undefined;
|
3082
3083
|
zipCode?: string | undefined;
|
3083
3084
|
}>, z.ZodObject<z.objectUtil.extendShape<{
|
3084
|
-
country: z.
|
3085
|
+
country: z.ZodLiteral<string>;
|
3085
3086
|
province: z.ZodString;
|
3086
3087
|
district: z.ZodString;
|
3087
3088
|
}, {
|
@@ -3099,6 +3100,33 @@ declare const Address: z.ZodObject<z.objectUtil.extendShape<{
|
|
3099
3100
|
province: string;
|
3100
3101
|
urbanOrRural: "RURAL";
|
3101
3102
|
village?: string | undefined;
|
3103
|
+
}>]>, z.ZodObject<{
|
3104
|
+
country: z.ZodEffects<z.ZodString, string, string>;
|
3105
|
+
state: z.ZodString;
|
3106
|
+
district2: z.ZodString;
|
3107
|
+
cityOrTown: z.ZodOptional<z.ZodString>;
|
3108
|
+
addressLine1: z.ZodOptional<z.ZodString>;
|
3109
|
+
addressLine2: z.ZodOptional<z.ZodString>;
|
3110
|
+
addressLine3: z.ZodOptional<z.ZodString>;
|
3111
|
+
postcodeOrZip: z.ZodOptional<z.ZodString>;
|
3112
|
+
}, "strip", z.ZodTypeAny, {
|
3113
|
+
country: string;
|
3114
|
+
state: string;
|
3115
|
+
district2: string;
|
3116
|
+
cityOrTown?: string | undefined;
|
3117
|
+
addressLine1?: string | undefined;
|
3118
|
+
addressLine2?: string | undefined;
|
3119
|
+
addressLine3?: string | undefined;
|
3120
|
+
postcodeOrZip?: string | undefined;
|
3121
|
+
}, {
|
3122
|
+
country: string;
|
3123
|
+
state: string;
|
3124
|
+
district2: string;
|
3125
|
+
cityOrTown?: string | undefined;
|
3126
|
+
addressLine1?: string | undefined;
|
3127
|
+
addressLine2?: string | undefined;
|
3128
|
+
addressLine3?: string | undefined;
|
3129
|
+
postcodeOrZip?: string | undefined;
|
3102
3130
|
}>]>>;
|
3103
3131
|
}>, "strip", z.ZodTypeAny, {
|
3104
3132
|
type: "ADDRESS";
|
@@ -3126,6 +3154,15 @@ declare const Address: z.ZodObject<z.objectUtil.extendShape<{
|
|
3126
3154
|
province: string;
|
3127
3155
|
urbanOrRural: "RURAL";
|
3128
3156
|
village?: string | undefined;
|
3157
|
+
} | {
|
3158
|
+
country: string;
|
3159
|
+
state: string;
|
3160
|
+
district2: string;
|
3161
|
+
cityOrTown?: string | undefined;
|
3162
|
+
addressLine1?: string | undefined;
|
3163
|
+
addressLine2?: string | undefined;
|
3164
|
+
addressLine3?: string | undefined;
|
3165
|
+
postcodeOrZip?: string | undefined;
|
3129
3166
|
} | undefined;
|
3130
3167
|
conditionals?: ({
|
3131
3168
|
type: "SHOW";
|
@@ -3172,6 +3209,15 @@ declare const Address: z.ZodObject<z.objectUtil.extendShape<{
|
|
3172
3209
|
province: string;
|
3173
3210
|
urbanOrRural: "RURAL";
|
3174
3211
|
village?: string | undefined;
|
3212
|
+
} | {
|
3213
|
+
country: string;
|
3214
|
+
state: string;
|
3215
|
+
district2: string;
|
3216
|
+
cityOrTown?: string | undefined;
|
3217
|
+
addressLine1?: string | undefined;
|
3218
|
+
addressLine2?: string | undefined;
|
3219
|
+
addressLine3?: string | undefined;
|
3220
|
+
postcodeOrZip?: string | undefined;
|
3175
3221
|
} | undefined;
|
3176
3222
|
conditionals?: ({
|
3177
3223
|
type: "SHOW";
|
@@ -24,4 +24,8 @@ export declare const FieldType: {
|
|
24
24
|
};
|
25
25
|
export declare const fieldTypes: ("ADDRESS" | "TEXT" | "NUMBER" | "TEXTAREA" | "EMAIL" | "DATE" | "PARAGRAPH" | "PAGE_HEADER" | "RADIO_GROUP" | "FILE" | "FILE_WITH_OPTIONS" | "HIDDEN" | "BULLET_LIST" | "CHECKBOX" | "SELECT" | "COUNTRY" | "LOCATION" | "DIVIDER" | "ADMINISTRATIVE_AREA" | "FACILITY" | "OFFICE" | "SIGNATURE")[];
|
26
26
|
export type FieldType = (typeof fieldTypes)[number];
|
27
|
+
/**
|
28
|
+
* Composite field types are field types that consist of multiple field values.
|
29
|
+
*/
|
30
|
+
export declare const compositeFieldTypes: ("ADDRESS" | "FILE" | "FILE_WITH_OPTIONS")[];
|
27
31
|
//# sourceMappingURL=FieldType.d.ts.map
|
@@ -42,8 +42,8 @@ export declare function mapFieldTypeToZod(type: FieldType, required?: boolean):
|
|
42
42
|
type: string;
|
43
43
|
filename: string;
|
44
44
|
originalFilename: string;
|
45
|
-
}>>> | z.ZodDiscriminatedUnion<"urbanOrRural", [z.ZodObject<z.objectUtil.extendShape<{
|
46
|
-
country: z.
|
45
|
+
}>>> | z.ZodUnion<[z.ZodDiscriminatedUnion<"urbanOrRural", [z.ZodObject<z.objectUtil.extendShape<{
|
46
|
+
country: z.ZodLiteral<string>;
|
47
47
|
province: z.ZodString;
|
48
48
|
district: z.ZodString;
|
49
49
|
}, {
|
@@ -74,7 +74,7 @@ export declare function mapFieldTypeToZod(type: FieldType, required?: boolean):
|
|
74
74
|
street?: string | null | undefined;
|
75
75
|
zipCode?: string | null | undefined;
|
76
76
|
}>, z.ZodObject<z.objectUtil.extendShape<{
|
77
|
-
country: z.
|
77
|
+
country: z.ZodLiteral<string>;
|
78
78
|
province: z.ZodString;
|
79
79
|
district: z.ZodString;
|
80
80
|
}, {
|
@@ -92,6 +92,33 @@ export declare function mapFieldTypeToZod(type: FieldType, required?: boolean):
|
|
92
92
|
province: string;
|
93
93
|
urbanOrRural: "RURAL";
|
94
94
|
village?: string | null | undefined;
|
95
|
+
}>]>, z.ZodObject<{
|
96
|
+
country: z.ZodEffects<z.ZodString, string, string>;
|
97
|
+
state: z.ZodString;
|
98
|
+
district2: z.ZodString;
|
99
|
+
cityOrTown: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
100
|
+
addressLine1: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
101
|
+
addressLine2: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
102
|
+
addressLine3: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
103
|
+
postcodeOrZip: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
104
|
+
}, "strip", z.ZodTypeAny, {
|
105
|
+
country: string;
|
106
|
+
state: string;
|
107
|
+
district2: string;
|
108
|
+
cityOrTown?: string | null | undefined;
|
109
|
+
addressLine1?: string | null | undefined;
|
110
|
+
addressLine2?: string | null | undefined;
|
111
|
+
addressLine3?: string | null | undefined;
|
112
|
+
postcodeOrZip?: string | null | undefined;
|
113
|
+
}, {
|
114
|
+
country: string;
|
115
|
+
state: string;
|
116
|
+
district2: string;
|
117
|
+
cityOrTown?: string | null | undefined;
|
118
|
+
addressLine1?: string | null | undefined;
|
119
|
+
addressLine2?: string | null | undefined;
|
120
|
+
addressLine3?: string | null | undefined;
|
121
|
+
postcodeOrZip?: string | null | undefined;
|
95
122
|
}>]> | z.ZodArray<z.ZodObject<{
|
96
123
|
filename: z.ZodString;
|
97
124
|
originalFilename: z.ZodString;
|
@@ -122,8 +149,8 @@ export declare function mapFieldTypeToZod(type: FieldType, required?: boolean):
|
|
122
149
|
option: string;
|
123
150
|
filename: string;
|
124
151
|
originalFilename: string;
|
125
|
-
}>, "many">>> | z.ZodBoolean | z.ZodOptional<z.ZodNullable<z.ZodBoolean>> | z.ZodNumber | z.ZodOptional<z.ZodNullable<z.ZodNumber>> | z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<"urbanOrRural", [z.ZodObject<z.objectUtil.extendShape<{
|
126
|
-
country: z.
|
152
|
+
}>, "many">>> | z.ZodBoolean | z.ZodOptional<z.ZodNullable<z.ZodBoolean>> | z.ZodNumber | z.ZodOptional<z.ZodNullable<z.ZodNumber>> | z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodDiscriminatedUnion<"urbanOrRural", [z.ZodObject<z.objectUtil.extendShape<{
|
153
|
+
country: z.ZodLiteral<string>;
|
127
154
|
province: z.ZodString;
|
128
155
|
district: z.ZodString;
|
129
156
|
}, {
|
@@ -154,7 +181,7 @@ export declare function mapFieldTypeToZod(type: FieldType, required?: boolean):
|
|
154
181
|
street?: string | null | undefined;
|
155
182
|
zipCode?: string | null | undefined;
|
156
183
|
}>, z.ZodObject<z.objectUtil.extendShape<{
|
157
|
-
country: z.
|
184
|
+
country: z.ZodLiteral<string>;
|
158
185
|
province: z.ZodString;
|
159
186
|
district: z.ZodString;
|
160
187
|
}, {
|
@@ -172,6 +199,33 @@ export declare function mapFieldTypeToZod(type: FieldType, required?: boolean):
|
|
172
199
|
province: string;
|
173
200
|
urbanOrRural: "RURAL";
|
174
201
|
village?: string | null | undefined;
|
202
|
+
}>]>, z.ZodObject<{
|
203
|
+
country: z.ZodEffects<z.ZodString, string, string>;
|
204
|
+
state: z.ZodString;
|
205
|
+
district2: z.ZodString;
|
206
|
+
cityOrTown: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
207
|
+
addressLine1: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
208
|
+
addressLine2: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
209
|
+
addressLine3: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
210
|
+
postcodeOrZip: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
211
|
+
}, "strip", z.ZodTypeAny, {
|
212
|
+
country: string;
|
213
|
+
state: string;
|
214
|
+
district2: string;
|
215
|
+
cityOrTown?: string | null | undefined;
|
216
|
+
addressLine1?: string | null | undefined;
|
217
|
+
addressLine2?: string | null | undefined;
|
218
|
+
addressLine3?: string | null | undefined;
|
219
|
+
postcodeOrZip?: string | null | undefined;
|
220
|
+
}, {
|
221
|
+
country: string;
|
222
|
+
state: string;
|
223
|
+
district2: string;
|
224
|
+
cityOrTown?: string | null | undefined;
|
225
|
+
addressLine1?: string | null | undefined;
|
226
|
+
addressLine2?: string | null | undefined;
|
227
|
+
addressLine3?: string | null | undefined;
|
228
|
+
postcodeOrZip?: string | null | undefined;
|
175
229
|
}>]>>>;
|
176
230
|
export declare function createValidationSchema(config: FieldConfig[]): z.ZodObject<Record<string, FieldUpdateValueSchema | NullishFieldValueSchema>, "strip", z.ZodTypeAny, {
|
177
231
|
[x: string]: string | number | boolean | {
|
@@ -194,6 +248,15 @@ export declare function createValidationSchema(config: FieldConfig[]): z.ZodObje
|
|
194
248
|
province: string;
|
195
249
|
urbanOrRural: "RURAL";
|
196
250
|
village?: string | null | undefined;
|
251
|
+
} | {
|
252
|
+
country: string;
|
253
|
+
state: string;
|
254
|
+
district2: string;
|
255
|
+
cityOrTown?: string | null | undefined;
|
256
|
+
addressLine1?: string | null | undefined;
|
257
|
+
addressLine2?: string | null | undefined;
|
258
|
+
addressLine3?: string | null | undefined;
|
259
|
+
postcodeOrZip?: string | null | undefined;
|
197
260
|
} | {
|
198
261
|
type: string;
|
199
262
|
option: string;
|
@@ -221,6 +284,15 @@ export declare function createValidationSchema(config: FieldConfig[]): z.ZodObje
|
|
221
284
|
province: string;
|
222
285
|
urbanOrRural: "RURAL";
|
223
286
|
village?: string | null | undefined;
|
287
|
+
} | {
|
288
|
+
country: string;
|
289
|
+
state: string;
|
290
|
+
district2: string;
|
291
|
+
cityOrTown?: string | null | undefined;
|
292
|
+
addressLine1?: string | null | undefined;
|
293
|
+
addressLine2?: string | null | undefined;
|
294
|
+
addressLine3?: string | null | undefined;
|
295
|
+
postcodeOrZip?: string | null | undefined;
|
224
296
|
} | {
|
225
297
|
type: string;
|
226
298
|
option: string;
|
@@ -258,6 +330,36 @@ export declare function mapFieldTypeToMockValue(field: FieldConfig, i: number):
|
|
258
330
|
number?: undefined;
|
259
331
|
zipCode?: undefined;
|
260
332
|
} | null;
|
333
|
+
/**
|
334
|
+
* Maps complex or nested field types, such as Address fields, to their corresponding empty values.
|
335
|
+
*/
|
336
|
+
export declare function mapFieldTypeToEmptyValue(field: FieldConfig): never[] | {
|
337
|
+
country: null;
|
338
|
+
province: null;
|
339
|
+
district: null;
|
340
|
+
urbanOrRural: string;
|
341
|
+
town: null;
|
342
|
+
residentialArea: null;
|
343
|
+
street: null;
|
344
|
+
number: null;
|
345
|
+
zipCode: null;
|
346
|
+
filename?: undefined;
|
347
|
+
originalFilename?: undefined;
|
348
|
+
type?: undefined;
|
349
|
+
} | {
|
350
|
+
filename: string;
|
351
|
+
originalFilename: string;
|
352
|
+
type: string;
|
353
|
+
country?: undefined;
|
354
|
+
province?: undefined;
|
355
|
+
district?: undefined;
|
356
|
+
urbanOrRural?: undefined;
|
357
|
+
town?: undefined;
|
358
|
+
residentialArea?: undefined;
|
359
|
+
street?: undefined;
|
360
|
+
number?: undefined;
|
361
|
+
zipCode?: undefined;
|
362
|
+
} | null;
|
261
363
|
export declare const isParagraphFieldType: (field: {
|
262
364
|
config: FieldConfig;
|
263
365
|
value: FieldValue;
|
@@ -48,7 +48,7 @@ export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBool
|
|
48
48
|
filename: string;
|
49
49
|
originalFilename: string;
|
50
50
|
}>, "many">, z.ZodObject<z.objectUtil.extendShape<{
|
51
|
-
country: z.
|
51
|
+
country: z.ZodLiteral<string>;
|
52
52
|
province: z.ZodString;
|
53
53
|
district: z.ZodString;
|
54
54
|
}, {
|
@@ -79,7 +79,7 @@ export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBool
|
|
79
79
|
street?: string | undefined;
|
80
80
|
zipCode?: string | undefined;
|
81
81
|
}>, z.ZodObject<z.objectUtil.extendShape<{
|
82
|
-
country: z.
|
82
|
+
country: z.ZodLiteral<string>;
|
83
83
|
province: z.ZodString;
|
84
84
|
district: z.ZodString;
|
85
85
|
}, {
|
@@ -97,6 +97,33 @@ export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBool
|
|
97
97
|
province: string;
|
98
98
|
urbanOrRural: "RURAL";
|
99
99
|
village?: string | undefined;
|
100
|
+
}>, z.ZodObject<{
|
101
|
+
country: z.ZodEffects<z.ZodString, string, string>;
|
102
|
+
state: z.ZodString;
|
103
|
+
district2: z.ZodString;
|
104
|
+
cityOrTown: z.ZodOptional<z.ZodString>;
|
105
|
+
addressLine1: z.ZodOptional<z.ZodString>;
|
106
|
+
addressLine2: z.ZodOptional<z.ZodString>;
|
107
|
+
addressLine3: z.ZodOptional<z.ZodString>;
|
108
|
+
postcodeOrZip: z.ZodOptional<z.ZodString>;
|
109
|
+
}, "strip", z.ZodTypeAny, {
|
110
|
+
country: string;
|
111
|
+
state: string;
|
112
|
+
district2: string;
|
113
|
+
cityOrTown?: string | undefined;
|
114
|
+
addressLine1?: string | undefined;
|
115
|
+
addressLine2?: string | undefined;
|
116
|
+
addressLine3?: string | undefined;
|
117
|
+
postcodeOrZip?: string | undefined;
|
118
|
+
}, {
|
119
|
+
country: string;
|
120
|
+
state: string;
|
121
|
+
district2: string;
|
122
|
+
cityOrTown?: string | undefined;
|
123
|
+
addressLine1?: string | undefined;
|
124
|
+
addressLine2?: string | undefined;
|
125
|
+
addressLine3?: string | undefined;
|
126
|
+
postcodeOrZip?: string | undefined;
|
100
127
|
}>]>;
|
101
128
|
export type FieldValue = z.infer<typeof FieldValue>;
|
102
129
|
export declare const FieldUpdateValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
|
@@ -127,7 +154,7 @@ export declare const FieldUpdateValue: z.ZodUnion<[z.ZodString, z.ZodString, z.Z
|
|
127
154
|
filename: string;
|
128
155
|
originalFilename: string;
|
129
156
|
}>, "many">, z.ZodObject<z.objectUtil.extendShape<{
|
130
|
-
country: z.
|
157
|
+
country: z.ZodLiteral<string>;
|
131
158
|
province: z.ZodString;
|
132
159
|
district: z.ZodString;
|
133
160
|
}, {
|
@@ -158,7 +185,7 @@ export declare const FieldUpdateValue: z.ZodUnion<[z.ZodString, z.ZodString, z.Z
|
|
158
185
|
street?: string | null | undefined;
|
159
186
|
zipCode?: string | null | undefined;
|
160
187
|
}>, z.ZodObject<z.objectUtil.extendShape<{
|
161
|
-
country: z.
|
188
|
+
country: z.ZodLiteral<string>;
|
162
189
|
province: z.ZodString;
|
163
190
|
district: z.ZodString;
|
164
191
|
}, {
|
@@ -176,6 +203,33 @@ export declare const FieldUpdateValue: z.ZodUnion<[z.ZodString, z.ZodString, z.Z
|
|
176
203
|
province: string;
|
177
204
|
urbanOrRural: "RURAL";
|
178
205
|
village?: string | null | undefined;
|
206
|
+
}>, z.ZodObject<{
|
207
|
+
country: z.ZodEffects<z.ZodString, string, string>;
|
208
|
+
state: z.ZodString;
|
209
|
+
district2: z.ZodString;
|
210
|
+
cityOrTown: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
211
|
+
addressLine1: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
212
|
+
addressLine2: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
213
|
+
addressLine3: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
214
|
+
postcodeOrZip: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
215
|
+
}, "strip", z.ZodTypeAny, {
|
216
|
+
country: string;
|
217
|
+
state: string;
|
218
|
+
district2: string;
|
219
|
+
cityOrTown?: string | null | undefined;
|
220
|
+
addressLine1?: string | null | undefined;
|
221
|
+
addressLine2?: string | null | undefined;
|
222
|
+
addressLine3?: string | null | undefined;
|
223
|
+
postcodeOrZip?: string | null | undefined;
|
224
|
+
}, {
|
225
|
+
country: string;
|
226
|
+
state: string;
|
227
|
+
district2: string;
|
228
|
+
cityOrTown?: string | null | undefined;
|
229
|
+
addressLine1?: string | null | undefined;
|
230
|
+
addressLine2?: string | null | undefined;
|
231
|
+
addressLine3?: string | null | undefined;
|
232
|
+
postcodeOrZip?: string | null | undefined;
|
179
233
|
}>]>;
|
180
234
|
export type FieldUpdateValue = z.infer<typeof FieldUpdateValue>;
|
181
235
|
/**
|
@@ -0,0 +1,38 @@
|
|
1
|
+
/**
|
2
|
+
* TemplateConfig defines configuration rules for system-based variables (e.g. $user.province).
|
3
|
+
* They are currently used for providing default values in FieldConfig.
|
4
|
+
*/
|
5
|
+
import { FieldValue } from './FieldValue';
|
6
|
+
/**
|
7
|
+
* Available system variables for configuration.
|
8
|
+
*/
|
9
|
+
export interface MetaFields {
|
10
|
+
$user: {
|
11
|
+
province: string;
|
12
|
+
district: string;
|
13
|
+
};
|
14
|
+
}
|
15
|
+
/**
|
16
|
+
* Recursively flatten the keys of an object. Used to limit types when configuring default values in country config.
|
17
|
+
* @example
|
18
|
+
* type Test = FlattenedKeyStrings<{ a: { b: string, c: { d: string } } }>
|
19
|
+
* // 'a.b' | 'a.c.d' but not 'a' or 'a.c'
|
20
|
+
*/
|
21
|
+
type FlattenedKeyStrings<T, Prefix extends string = ''> = {
|
22
|
+
[K in keyof T]: T[K] extends Record<string, any> ? FlattenedKeyStrings<T[K], `${Prefix}${K & string}.`> : `${Prefix}${K & string}`;
|
23
|
+
}[keyof T];
|
24
|
+
export type FlattenedMetaFields = FlattenedKeyStrings<MetaFields>;
|
25
|
+
/**
|
26
|
+
* Default value for a field when configuring a form.
|
27
|
+
*/
|
28
|
+
export type FieldConfigDefaultValue = FieldValue | FlattenedMetaFields | Record<string, FlattenedMetaFields | FieldValue>;
|
29
|
+
export declare function isTemplateVariable(value: FieldConfigDefaultValue): value is FlattenedMetaFields;
|
30
|
+
export declare function isFieldValue(value: FieldConfigDefaultValue): value is FieldValue;
|
31
|
+
/**
|
32
|
+
* Checks if given value is valid for a field, and known template variables are already resolved.
|
33
|
+
* @todo: Extend functionality to arbitrary depth objects. Currently only checks first level since our compoosite fields are only 1 level deep.
|
34
|
+
*/
|
35
|
+
export declare function isFieldValueWithoutTemplates(value: FieldConfigDefaultValue): value is FieldValue;
|
36
|
+
export declare function isFieldConfigDefaultValue(value: any): value is FieldConfigDefaultValue;
|
37
|
+
export {};
|
38
|
+
//# sourceMappingURL=TemplateConfig.d.ts.map
|
@@ -63,7 +63,6 @@ export declare const defineConfig: (config: EventConfigInput) => {
|
|
63
63
|
draft?: boolean | undefined;
|
64
64
|
} | {
|
65
65
|
type: "REJECT";
|
66
|
-
comment: string;
|
67
66
|
conditionals: ({
|
68
67
|
type: "SHOW";
|
69
68
|
conditional: import(".").JSONSchema;
|
@@ -89,11 +88,9 @@ export declare const defineConfig: (config: EventConfigInput) => {
|
|
89
88
|
fields: import("./FieldConfig").Inferred[];
|
90
89
|
};
|
91
90
|
}[];
|
92
|
-
isDuplicate: boolean;
|
93
91
|
draft?: boolean | undefined;
|
94
92
|
} | {
|
95
93
|
type: "MARKED_AS_DUPLICATE";
|
96
|
-
comment: string;
|
97
94
|
conditionals: ({
|
98
95
|
type: "SHOW";
|
99
96
|
conditional: import(".").JSONSchema;
|
@@ -119,11 +116,9 @@ export declare const defineConfig: (config: EventConfigInput) => {
|
|
119
116
|
fields: import("./FieldConfig").Inferred[];
|
120
117
|
};
|
121
118
|
}[];
|
122
|
-
duplicates: string[];
|
123
119
|
draft?: boolean | undefined;
|
124
120
|
} | {
|
125
|
-
type: "
|
126
|
-
comment: string;
|
121
|
+
type: "ARCHIVE";
|
127
122
|
conditionals: ({
|
128
123
|
type: "SHOW";
|
129
124
|
conditional: import(".").JSONSchema;
|
@@ -149,7 +144,6 @@ export declare const defineConfig: (config: EventConfigInput) => {
|
|
149
144
|
fields: import("./FieldConfig").Inferred[];
|
150
145
|
};
|
151
146
|
}[];
|
152
|
-
isDuplicate: boolean;
|
153
147
|
draft?: boolean | undefined;
|
154
148
|
} | {
|
155
149
|
type: "REGISTER";
|
@@ -28,6 +28,7 @@ export * from './FieldTypeMapping';
|
|
28
28
|
export * from './Conditional';
|
29
29
|
export * from './AdvancedSearchConfig';
|
30
30
|
export * from './test.utils';
|
31
|
+
export * from './TemplateConfig';
|
31
32
|
export * from '../conditionals/conditionals';
|
32
33
|
export * from '../conditionals/validate';
|
33
34
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ActionDocument } from './ActionDocument';
|
2
|
-
import {
|
2
|
+
import { ArchiveActionInput, DeclareActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, ValidateActionInput } from './ActionInput';
|
3
3
|
import { ActionType } from './ActionType';
|
4
4
|
import { Draft } from './Draft';
|
5
5
|
import { EventConfig } from './EventConfig';
|
@@ -27,6 +27,15 @@ export declare function generateActionInput(configuration: EventConfig, action:
|
|
27
27
|
province: string;
|
28
28
|
urbanOrRural: "RURAL";
|
29
29
|
village?: string | undefined;
|
30
|
+
} | {
|
31
|
+
country: string;
|
32
|
+
state: string;
|
33
|
+
district2: string;
|
34
|
+
cityOrTown?: string | undefined;
|
35
|
+
addressLine1?: string | undefined;
|
36
|
+
addressLine2?: string | undefined;
|
37
|
+
addressLine3?: string | undefined;
|
38
|
+
postcodeOrZip?: string | undefined;
|
30
39
|
} | {
|
31
40
|
type: string;
|
32
41
|
option: string;
|
@@ -91,6 +100,15 @@ export declare const eventPayloadGenerator: {
|
|
91
100
|
province: string;
|
92
101
|
urbanOrRural: "RURAL";
|
93
102
|
village?: string | null | undefined;
|
103
|
+
} | {
|
104
|
+
country: string;
|
105
|
+
state: string;
|
106
|
+
district2: string;
|
107
|
+
cityOrTown?: string | null | undefined;
|
108
|
+
addressLine1?: string | null | undefined;
|
109
|
+
addressLine2?: string | null | undefined;
|
110
|
+
addressLine3?: string | null | undefined;
|
111
|
+
postcodeOrZip?: string | null | undefined;
|
94
112
|
} | {
|
95
113
|
type: string;
|
96
114
|
option: string;
|
@@ -120,6 +138,15 @@ export declare const eventPayloadGenerator: {
|
|
120
138
|
province: string;
|
121
139
|
urbanOrRural: "RURAL";
|
122
140
|
village?: string | null | undefined;
|
141
|
+
} | {
|
142
|
+
country: string;
|
143
|
+
state: string;
|
144
|
+
district2: string;
|
145
|
+
cityOrTown?: string | null | undefined;
|
146
|
+
addressLine1?: string | null | undefined;
|
147
|
+
addressLine2?: string | null | undefined;
|
148
|
+
addressLine3?: string | null | undefined;
|
149
|
+
postcodeOrZip?: string | null | undefined;
|
123
150
|
} | {
|
124
151
|
type: string;
|
125
152
|
option: string;
|
@@ -152,6 +179,15 @@ export declare const eventPayloadGenerator: {
|
|
152
179
|
province: string;
|
153
180
|
urbanOrRural: "RURAL";
|
154
181
|
village?: string | null | undefined;
|
182
|
+
} | {
|
183
|
+
country: string;
|
184
|
+
state: string;
|
185
|
+
district2: string;
|
186
|
+
cityOrTown?: string | null | undefined;
|
187
|
+
addressLine1?: string | null | undefined;
|
188
|
+
addressLine2?: string | null | undefined;
|
189
|
+
addressLine3?: string | null | undefined;
|
190
|
+
postcodeOrZip?: string | null | undefined;
|
155
191
|
} | {
|
156
192
|
type: string;
|
157
193
|
option: string;
|
@@ -183,6 +219,15 @@ export declare const eventPayloadGenerator: {
|
|
183
219
|
province: string;
|
184
220
|
urbanOrRural: "RURAL";
|
185
221
|
village?: string | null | undefined;
|
222
|
+
} | {
|
223
|
+
country: string;
|
224
|
+
state: string;
|
225
|
+
district2: string;
|
226
|
+
cityOrTown?: string | null | undefined;
|
227
|
+
addressLine1?: string | null | undefined;
|
228
|
+
addressLine2?: string | null | undefined;
|
229
|
+
addressLine3?: string | null | undefined;
|
230
|
+
postcodeOrZip?: string | null | undefined;
|
186
231
|
} | {
|
187
232
|
type: string;
|
188
233
|
option: string;
|
@@ -192,8 +237,8 @@ export declare const eventPayloadGenerator: {
|
|
192
237
|
duplicates: never[];
|
193
238
|
eventId: string;
|
194
239
|
};
|
195
|
-
archive: (eventId: string, input?: Partial<Pick<
|
196
|
-
type: "
|
240
|
+
archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "data">>, isDuplicate?: boolean) => {
|
241
|
+
type: "ARCHIVE";
|
197
242
|
transactionId: string;
|
198
243
|
data: Record<string, string | number | boolean | {
|
199
244
|
type: string;
|
@@ -215,6 +260,15 @@ export declare const eventPayloadGenerator: {
|
|
215
260
|
province: string;
|
216
261
|
urbanOrRural: "RURAL";
|
217
262
|
village?: string | null | undefined;
|
263
|
+
} | {
|
264
|
+
country: string;
|
265
|
+
state: string;
|
266
|
+
district2: string;
|
267
|
+
cityOrTown?: string | null | undefined;
|
268
|
+
addressLine1?: string | null | undefined;
|
269
|
+
addressLine2?: string | null | undefined;
|
270
|
+
addressLine3?: string | null | undefined;
|
271
|
+
postcodeOrZip?: string | null | undefined;
|
218
272
|
} | {
|
219
273
|
type: string;
|
220
274
|
option: string;
|
@@ -250,6 +304,15 @@ export declare const eventPayloadGenerator: {
|
|
250
304
|
province: string;
|
251
305
|
urbanOrRural: "RURAL";
|
252
306
|
village?: string | null | undefined;
|
307
|
+
} | {
|
308
|
+
country: string;
|
309
|
+
state: string;
|
310
|
+
district2: string;
|
311
|
+
cityOrTown?: string | null | undefined;
|
312
|
+
addressLine1?: string | null | undefined;
|
313
|
+
addressLine2?: string | null | undefined;
|
314
|
+
addressLine3?: string | null | undefined;
|
315
|
+
postcodeOrZip?: string | null | undefined;
|
253
316
|
} | {
|
254
317
|
type: string;
|
255
318
|
option: string;
|
@@ -282,6 +345,15 @@ export declare const eventPayloadGenerator: {
|
|
282
345
|
province: string;
|
283
346
|
urbanOrRural: "RURAL";
|
284
347
|
village?: string | null | undefined;
|
348
|
+
} | {
|
349
|
+
country: string;
|
350
|
+
state: string;
|
351
|
+
district2: string;
|
352
|
+
cityOrTown?: string | null | undefined;
|
353
|
+
addressLine1?: string | null | undefined;
|
354
|
+
addressLine2?: string | null | undefined;
|
355
|
+
addressLine3?: string | null | undefined;
|
356
|
+
postcodeOrZip?: string | null | undefined;
|
285
357
|
} | {
|
286
358
|
type: string;
|
287
359
|
option: string;
|
@@ -313,6 +385,15 @@ export declare const eventPayloadGenerator: {
|
|
313
385
|
province: string;
|
314
386
|
urbanOrRural: "RURAL";
|
315
387
|
village?: string | null | undefined;
|
388
|
+
} | {
|
389
|
+
country: string;
|
390
|
+
state: string;
|
391
|
+
district2: string;
|
392
|
+
cityOrTown?: string | null | undefined;
|
393
|
+
addressLine1?: string | null | undefined;
|
394
|
+
addressLine2?: string | null | undefined;
|
395
|
+
addressLine3?: string | null | undefined;
|
396
|
+
postcodeOrZip?: string | null | undefined;
|
316
397
|
} | {
|
317
398
|
type: string;
|
318
399
|
option: string;
|
@@ -345,6 +426,15 @@ export declare const eventPayloadGenerator: {
|
|
345
426
|
province: string;
|
346
427
|
urbanOrRural: "RURAL";
|
347
428
|
village?: string | null | undefined;
|
429
|
+
} | {
|
430
|
+
country: string;
|
431
|
+
state: string;
|
432
|
+
district2: string;
|
433
|
+
cityOrTown?: string | null | undefined;
|
434
|
+
addressLine1?: string | null | undefined;
|
435
|
+
addressLine2?: string | null | undefined;
|
436
|
+
addressLine3?: string | null | undefined;
|
437
|
+
postcodeOrZip?: string | null | undefined;
|
348
438
|
} | {
|
349
439
|
type: string;
|
350
440
|
option: string;
|
@@ -377,6 +467,15 @@ export declare const eventPayloadGenerator: {
|
|
377
467
|
province: string;
|
378
468
|
urbanOrRural: "RURAL";
|
379
469
|
village?: string | null | undefined;
|
470
|
+
} | {
|
471
|
+
country: string;
|
472
|
+
state: string;
|
473
|
+
district2: string;
|
474
|
+
cityOrTown?: string | null | undefined;
|
475
|
+
addressLine1?: string | null | undefined;
|
476
|
+
addressLine2?: string | null | undefined;
|
477
|
+
addressLine3?: string | null | undefined;
|
478
|
+
postcodeOrZip?: string | null | undefined;
|
380
479
|
} | {
|
381
480
|
type: string;
|
382
481
|
option: string;
|
@@ -409,6 +508,15 @@ export declare const eventPayloadGenerator: {
|
|
409
508
|
province: string;
|
410
509
|
urbanOrRural: "RURAL";
|
411
510
|
village?: string | null | undefined;
|
511
|
+
} | {
|
512
|
+
country: string;
|
513
|
+
state: string;
|
514
|
+
district2: string;
|
515
|
+
cityOrTown?: string | null | undefined;
|
516
|
+
addressLine1?: string | null | undefined;
|
517
|
+
addressLine2?: string | null | undefined;
|
518
|
+
addressLine3?: string | null | undefined;
|
519
|
+
postcodeOrZip?: string | null | undefined;
|
412
520
|
} | {
|
413
521
|
type: string;
|
414
522
|
option: string;
|