@opencrvs/toolkit 1.8.0-rc.fbb7263 → 1.8.0-rc.fca3e39
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 +5020 -22
- package/dist/commons/conditionals/conditionals.d.ts +1 -0
- 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 +2079 -3
- package/dist/commons/events/ActionInput.d.ts +3132 -12
- package/dist/commons/events/ActionType.d.ts +6 -1
- package/dist/commons/events/CompositeFieldValue.d.ts +152 -2
- package/dist/commons/events/Draft.d.ts +288 -0
- package/dist/commons/events/EventConfig.d.ts +4 -28
- package/dist/commons/events/EventDocument.d.ts +2525 -5
- package/dist/commons/events/FieldConfig.d.ts +62 -1
- package/dist/commons/events/FieldType.d.ts +4 -0
- package/dist/commons/events/FieldTypeMapping.d.ts +132 -2
- package/dist/commons/events/FieldValue.d.ts +72 -0
- 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 +147 -3
- package/dist/commons/events/utils.d.ts +121 -0
- package/dist/conditionals/index.js +17 -0
- package/dist/events/index.js +314 -91
- 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,9 @@ 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
|
+
defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodDiscriminatedUnion<"urbanOrRural", [z.ZodObject<z.objectUtil.extendShape<{
|
3053
3054
|
country: z.ZodString;
|
3055
|
+
addressType: z.ZodLiteral<"DOMESTIC">;
|
3054
3056
|
province: z.ZodString;
|
3055
3057
|
district: z.ZodString;
|
3056
3058
|
}, {
|
@@ -3063,6 +3065,7 @@ declare const Address: z.ZodObject<z.objectUtil.extendShape<{
|
|
3063
3065
|
}>, "strip", z.ZodTypeAny, {
|
3064
3066
|
country: string;
|
3065
3067
|
district: string;
|
3068
|
+
addressType: "DOMESTIC";
|
3066
3069
|
province: string;
|
3067
3070
|
urbanOrRural: "URBAN";
|
3068
3071
|
number?: string | undefined;
|
@@ -3073,6 +3076,7 @@ declare const Address: z.ZodObject<z.objectUtil.extendShape<{
|
|
3073
3076
|
}, {
|
3074
3077
|
country: string;
|
3075
3078
|
district: string;
|
3079
|
+
addressType: "DOMESTIC";
|
3076
3080
|
province: string;
|
3077
3081
|
urbanOrRural: "URBAN";
|
3078
3082
|
number?: string | undefined;
|
@@ -3082,6 +3086,7 @@ declare const Address: z.ZodObject<z.objectUtil.extendShape<{
|
|
3082
3086
|
zipCode?: string | undefined;
|
3083
3087
|
}>, z.ZodObject<z.objectUtil.extendShape<{
|
3084
3088
|
country: z.ZodString;
|
3089
|
+
addressType: z.ZodLiteral<"DOMESTIC">;
|
3085
3090
|
province: z.ZodString;
|
3086
3091
|
district: z.ZodString;
|
3087
3092
|
}, {
|
@@ -3090,15 +3095,47 @@ declare const Address: z.ZodObject<z.objectUtil.extendShape<{
|
|
3090
3095
|
}>, "strip", z.ZodTypeAny, {
|
3091
3096
|
country: string;
|
3092
3097
|
district: string;
|
3098
|
+
addressType: "DOMESTIC";
|
3093
3099
|
province: string;
|
3094
3100
|
urbanOrRural: "RURAL";
|
3095
3101
|
village?: string | undefined;
|
3096
3102
|
}, {
|
3097
3103
|
country: string;
|
3098
3104
|
district: string;
|
3105
|
+
addressType: "DOMESTIC";
|
3099
3106
|
province: string;
|
3100
3107
|
urbanOrRural: "RURAL";
|
3101
3108
|
village?: string | undefined;
|
3109
|
+
}>]>, z.ZodObject<{
|
3110
|
+
country: z.ZodString;
|
3111
|
+
addressType: z.ZodLiteral<"INTERNATIONAL">;
|
3112
|
+
state: z.ZodString;
|
3113
|
+
district2: z.ZodString;
|
3114
|
+
cityOrTown: z.ZodOptional<z.ZodString>;
|
3115
|
+
addressLine1: z.ZodOptional<z.ZodString>;
|
3116
|
+
addressLine2: z.ZodOptional<z.ZodString>;
|
3117
|
+
addressLine3: z.ZodOptional<z.ZodString>;
|
3118
|
+
postcodeOrZip: z.ZodOptional<z.ZodString>;
|
3119
|
+
}, "strip", z.ZodTypeAny, {
|
3120
|
+
country: string;
|
3121
|
+
state: string;
|
3122
|
+
addressType: "INTERNATIONAL";
|
3123
|
+
district2: string;
|
3124
|
+
cityOrTown?: string | undefined;
|
3125
|
+
addressLine1?: string | undefined;
|
3126
|
+
addressLine2?: string | undefined;
|
3127
|
+
addressLine3?: string | undefined;
|
3128
|
+
postcodeOrZip?: string | undefined;
|
3129
|
+
}, {
|
3130
|
+
country: string;
|
3131
|
+
state: string;
|
3132
|
+
addressType: "INTERNATIONAL";
|
3133
|
+
district2: string;
|
3134
|
+
cityOrTown?: string | undefined;
|
3135
|
+
addressLine1?: string | undefined;
|
3136
|
+
addressLine2?: string | undefined;
|
3137
|
+
addressLine3?: string | undefined;
|
3138
|
+
postcodeOrZip?: string | undefined;
|
3102
3139
|
}>]>>;
|
3103
3140
|
}>, "strip", z.ZodTypeAny, {
|
3104
3141
|
type: "ADDRESS";
|
@@ -3113,6 +3150,7 @@ declare const Address: z.ZodObject<z.objectUtil.extendShape<{
|
|
3113
3150
|
defaultValue?: {
|
3114
3151
|
country: string;
|
3115
3152
|
district: string;
|
3153
|
+
addressType: "DOMESTIC";
|
3116
3154
|
province: string;
|
3117
3155
|
urbanOrRural: "URBAN";
|
3118
3156
|
number?: string | undefined;
|
@@ -3123,9 +3161,20 @@ declare const Address: z.ZodObject<z.objectUtil.extendShape<{
|
|
3123
3161
|
} | {
|
3124
3162
|
country: string;
|
3125
3163
|
district: string;
|
3164
|
+
addressType: "DOMESTIC";
|
3126
3165
|
province: string;
|
3127
3166
|
urbanOrRural: "RURAL";
|
3128
3167
|
village?: string | undefined;
|
3168
|
+
} | {
|
3169
|
+
country: string;
|
3170
|
+
state: string;
|
3171
|
+
addressType: "INTERNATIONAL";
|
3172
|
+
district2: string;
|
3173
|
+
cityOrTown?: string | undefined;
|
3174
|
+
addressLine1?: string | undefined;
|
3175
|
+
addressLine2?: string | undefined;
|
3176
|
+
addressLine3?: string | undefined;
|
3177
|
+
postcodeOrZip?: string | undefined;
|
3129
3178
|
} | undefined;
|
3130
3179
|
conditionals?: ({
|
3131
3180
|
type: "SHOW";
|
@@ -3159,6 +3208,7 @@ declare const Address: z.ZodObject<z.objectUtil.extendShape<{
|
|
3159
3208
|
defaultValue?: {
|
3160
3209
|
country: string;
|
3161
3210
|
district: string;
|
3211
|
+
addressType: "DOMESTIC";
|
3162
3212
|
province: string;
|
3163
3213
|
urbanOrRural: "URBAN";
|
3164
3214
|
number?: string | undefined;
|
@@ -3169,9 +3219,20 @@ declare const Address: z.ZodObject<z.objectUtil.extendShape<{
|
|
3169
3219
|
} | {
|
3170
3220
|
country: string;
|
3171
3221
|
district: string;
|
3222
|
+
addressType: "DOMESTIC";
|
3172
3223
|
province: string;
|
3173
3224
|
urbanOrRural: "RURAL";
|
3174
3225
|
village?: string | undefined;
|
3226
|
+
} | {
|
3227
|
+
country: string;
|
3228
|
+
state: string;
|
3229
|
+
addressType: "INTERNATIONAL";
|
3230
|
+
district2: string;
|
3231
|
+
cityOrTown?: string | undefined;
|
3232
|
+
addressLine1?: string | undefined;
|
3233
|
+
addressLine2?: string | undefined;
|
3234
|
+
addressLine3?: string | undefined;
|
3235
|
+
postcodeOrZip?: string | undefined;
|
3175
3236
|
} | undefined;
|
3176
3237
|
conditionals?: ({
|
3177
3238
|
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,9 @@ 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<{
|
45
|
+
}>>> | z.ZodUnion<[z.ZodDiscriminatedUnion<"urbanOrRural", [z.ZodObject<z.objectUtil.extendShape<{
|
46
46
|
country: z.ZodString;
|
47
|
+
addressType: z.ZodLiteral<"DOMESTIC">;
|
47
48
|
province: z.ZodString;
|
48
49
|
district: z.ZodString;
|
49
50
|
}, {
|
@@ -56,6 +57,7 @@ export declare function mapFieldTypeToZod(type: FieldType, required?: boolean):
|
|
56
57
|
}>, "strip", z.ZodTypeAny, {
|
57
58
|
country: string;
|
58
59
|
district: string;
|
60
|
+
addressType: "DOMESTIC";
|
59
61
|
province: string;
|
60
62
|
urbanOrRural: "URBAN";
|
61
63
|
number?: string | null | undefined;
|
@@ -66,6 +68,7 @@ export declare function mapFieldTypeToZod(type: FieldType, required?: boolean):
|
|
66
68
|
}, {
|
67
69
|
country: string;
|
68
70
|
district: string;
|
71
|
+
addressType: "DOMESTIC";
|
69
72
|
province: string;
|
70
73
|
urbanOrRural: "URBAN";
|
71
74
|
number?: string | null | undefined;
|
@@ -75,6 +78,7 @@ export declare function mapFieldTypeToZod(type: FieldType, required?: boolean):
|
|
75
78
|
zipCode?: string | null | undefined;
|
76
79
|
}>, z.ZodObject<z.objectUtil.extendShape<{
|
77
80
|
country: z.ZodString;
|
81
|
+
addressType: z.ZodLiteral<"DOMESTIC">;
|
78
82
|
province: z.ZodString;
|
79
83
|
district: z.ZodString;
|
80
84
|
}, {
|
@@ -83,15 +87,47 @@ export declare function mapFieldTypeToZod(type: FieldType, required?: boolean):
|
|
83
87
|
}>, "strip", z.ZodTypeAny, {
|
84
88
|
country: string;
|
85
89
|
district: string;
|
90
|
+
addressType: "DOMESTIC";
|
86
91
|
province: string;
|
87
92
|
urbanOrRural: "RURAL";
|
88
93
|
village?: string | null | undefined;
|
89
94
|
}, {
|
90
95
|
country: string;
|
91
96
|
district: string;
|
97
|
+
addressType: "DOMESTIC";
|
92
98
|
province: string;
|
93
99
|
urbanOrRural: "RURAL";
|
94
100
|
village?: string | null | undefined;
|
101
|
+
}>]>, z.ZodObject<{
|
102
|
+
country: z.ZodString;
|
103
|
+
addressType: z.ZodLiteral<"INTERNATIONAL">;
|
104
|
+
state: z.ZodString;
|
105
|
+
district2: z.ZodString;
|
106
|
+
cityOrTown: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
107
|
+
addressLine1: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
108
|
+
addressLine2: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
109
|
+
addressLine3: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
110
|
+
postcodeOrZip: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
111
|
+
}, "strip", z.ZodTypeAny, {
|
112
|
+
country: string;
|
113
|
+
state: string;
|
114
|
+
addressType: "INTERNATIONAL";
|
115
|
+
district2: string;
|
116
|
+
cityOrTown?: string | null | undefined;
|
117
|
+
addressLine1?: string | null | undefined;
|
118
|
+
addressLine2?: string | null | undefined;
|
119
|
+
addressLine3?: string | null | undefined;
|
120
|
+
postcodeOrZip?: string | null | undefined;
|
121
|
+
}, {
|
122
|
+
country: string;
|
123
|
+
state: string;
|
124
|
+
addressType: "INTERNATIONAL";
|
125
|
+
district2: string;
|
126
|
+
cityOrTown?: string | null | undefined;
|
127
|
+
addressLine1?: string | null | undefined;
|
128
|
+
addressLine2?: string | null | undefined;
|
129
|
+
addressLine3?: string | null | undefined;
|
130
|
+
postcodeOrZip?: string | null | undefined;
|
95
131
|
}>]> | z.ZodArray<z.ZodObject<{
|
96
132
|
filename: z.ZodString;
|
97
133
|
originalFilename: z.ZodString;
|
@@ -122,8 +158,9 @@ export declare function mapFieldTypeToZod(type: FieldType, required?: boolean):
|
|
122
158
|
option: string;
|
123
159
|
filename: string;
|
124
160
|
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<{
|
161
|
+
}>, "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<{
|
126
162
|
country: z.ZodString;
|
163
|
+
addressType: z.ZodLiteral<"DOMESTIC">;
|
127
164
|
province: z.ZodString;
|
128
165
|
district: z.ZodString;
|
129
166
|
}, {
|
@@ -136,6 +173,7 @@ export declare function mapFieldTypeToZod(type: FieldType, required?: boolean):
|
|
136
173
|
}>, "strip", z.ZodTypeAny, {
|
137
174
|
country: string;
|
138
175
|
district: string;
|
176
|
+
addressType: "DOMESTIC";
|
139
177
|
province: string;
|
140
178
|
urbanOrRural: "URBAN";
|
141
179
|
number?: string | null | undefined;
|
@@ -146,6 +184,7 @@ export declare function mapFieldTypeToZod(type: FieldType, required?: boolean):
|
|
146
184
|
}, {
|
147
185
|
country: string;
|
148
186
|
district: string;
|
187
|
+
addressType: "DOMESTIC";
|
149
188
|
province: string;
|
150
189
|
urbanOrRural: "URBAN";
|
151
190
|
number?: string | null | undefined;
|
@@ -155,6 +194,7 @@ export declare function mapFieldTypeToZod(type: FieldType, required?: boolean):
|
|
155
194
|
zipCode?: string | null | undefined;
|
156
195
|
}>, z.ZodObject<z.objectUtil.extendShape<{
|
157
196
|
country: z.ZodString;
|
197
|
+
addressType: z.ZodLiteral<"DOMESTIC">;
|
158
198
|
province: z.ZodString;
|
159
199
|
district: z.ZodString;
|
160
200
|
}, {
|
@@ -163,15 +203,47 @@ export declare function mapFieldTypeToZod(type: FieldType, required?: boolean):
|
|
163
203
|
}>, "strip", z.ZodTypeAny, {
|
164
204
|
country: string;
|
165
205
|
district: string;
|
206
|
+
addressType: "DOMESTIC";
|
166
207
|
province: string;
|
167
208
|
urbanOrRural: "RURAL";
|
168
209
|
village?: string | null | undefined;
|
169
210
|
}, {
|
170
211
|
country: string;
|
171
212
|
district: string;
|
213
|
+
addressType: "DOMESTIC";
|
172
214
|
province: string;
|
173
215
|
urbanOrRural: "RURAL";
|
174
216
|
village?: string | null | undefined;
|
217
|
+
}>]>, z.ZodObject<{
|
218
|
+
country: z.ZodString;
|
219
|
+
addressType: z.ZodLiteral<"INTERNATIONAL">;
|
220
|
+
state: z.ZodString;
|
221
|
+
district2: z.ZodString;
|
222
|
+
cityOrTown: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
223
|
+
addressLine1: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
224
|
+
addressLine2: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
225
|
+
addressLine3: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
226
|
+
postcodeOrZip: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
227
|
+
}, "strip", z.ZodTypeAny, {
|
228
|
+
country: string;
|
229
|
+
state: string;
|
230
|
+
addressType: "INTERNATIONAL";
|
231
|
+
district2: string;
|
232
|
+
cityOrTown?: string | null | undefined;
|
233
|
+
addressLine1?: string | null | undefined;
|
234
|
+
addressLine2?: string | null | undefined;
|
235
|
+
addressLine3?: string | null | undefined;
|
236
|
+
postcodeOrZip?: string | null | undefined;
|
237
|
+
}, {
|
238
|
+
country: string;
|
239
|
+
state: string;
|
240
|
+
addressType: "INTERNATIONAL";
|
241
|
+
district2: string;
|
242
|
+
cityOrTown?: string | null | undefined;
|
243
|
+
addressLine1?: string | null | undefined;
|
244
|
+
addressLine2?: string | null | undefined;
|
245
|
+
addressLine3?: string | null | undefined;
|
246
|
+
postcodeOrZip?: string | null | undefined;
|
175
247
|
}>]>>>;
|
176
248
|
export declare function createValidationSchema(config: FieldConfig[]): z.ZodObject<Record<string, FieldUpdateValueSchema | NullishFieldValueSchema>, "strip", z.ZodTypeAny, {
|
177
249
|
[x: string]: string | number | boolean | {
|
@@ -181,6 +253,7 @@ export declare function createValidationSchema(config: FieldConfig[]): z.ZodObje
|
|
181
253
|
} | {
|
182
254
|
country: string;
|
183
255
|
district: string;
|
256
|
+
addressType: "DOMESTIC";
|
184
257
|
province: string;
|
185
258
|
urbanOrRural: "URBAN";
|
186
259
|
number?: string | null | undefined;
|
@@ -191,9 +264,20 @@ export declare function createValidationSchema(config: FieldConfig[]): z.ZodObje
|
|
191
264
|
} | {
|
192
265
|
country: string;
|
193
266
|
district: string;
|
267
|
+
addressType: "DOMESTIC";
|
194
268
|
province: string;
|
195
269
|
urbanOrRural: "RURAL";
|
196
270
|
village?: string | null | undefined;
|
271
|
+
} | {
|
272
|
+
country: string;
|
273
|
+
state: string;
|
274
|
+
addressType: "INTERNATIONAL";
|
275
|
+
district2: string;
|
276
|
+
cityOrTown?: string | null | undefined;
|
277
|
+
addressLine1?: string | null | undefined;
|
278
|
+
addressLine2?: string | null | undefined;
|
279
|
+
addressLine3?: string | null | undefined;
|
280
|
+
postcodeOrZip?: string | null | undefined;
|
197
281
|
} | {
|
198
282
|
type: string;
|
199
283
|
option: string;
|
@@ -208,6 +292,7 @@ export declare function createValidationSchema(config: FieldConfig[]): z.ZodObje
|
|
208
292
|
} | {
|
209
293
|
country: string;
|
210
294
|
district: string;
|
295
|
+
addressType: "DOMESTIC";
|
211
296
|
province: string;
|
212
297
|
urbanOrRural: "URBAN";
|
213
298
|
number?: string | null | undefined;
|
@@ -218,9 +303,20 @@ export declare function createValidationSchema(config: FieldConfig[]): z.ZodObje
|
|
218
303
|
} | {
|
219
304
|
country: string;
|
220
305
|
district: string;
|
306
|
+
addressType: "DOMESTIC";
|
221
307
|
province: string;
|
222
308
|
urbanOrRural: "RURAL";
|
223
309
|
village?: string | null | undefined;
|
310
|
+
} | {
|
311
|
+
country: string;
|
312
|
+
state: string;
|
313
|
+
addressType: "INTERNATIONAL";
|
314
|
+
district2: string;
|
315
|
+
cityOrTown?: string | null | undefined;
|
316
|
+
addressLine1?: string | null | undefined;
|
317
|
+
addressLine2?: string | null | undefined;
|
318
|
+
addressLine3?: string | null | undefined;
|
319
|
+
postcodeOrZip?: string | null | undefined;
|
224
320
|
} | {
|
225
321
|
type: string;
|
226
322
|
option: string;
|
@@ -233,6 +329,7 @@ export declare function createValidationSchema(config: FieldConfig[]): z.ZodObje
|
|
233
329
|
*/
|
234
330
|
export declare function mapFieldTypeToMockValue(field: FieldConfig, i: number): string | true | 19 | {
|
235
331
|
country: string;
|
332
|
+
addressType: "DOMESTIC";
|
236
333
|
province: string;
|
237
334
|
district: string;
|
238
335
|
urbanOrRural: string;
|
@@ -249,6 +346,39 @@ export declare function mapFieldTypeToMockValue(field: FieldConfig, i: number):
|
|
249
346
|
originalFilename: string;
|
250
347
|
type: string;
|
251
348
|
country?: undefined;
|
349
|
+
addressType?: undefined;
|
350
|
+
province?: undefined;
|
351
|
+
district?: undefined;
|
352
|
+
urbanOrRural?: undefined;
|
353
|
+
town?: undefined;
|
354
|
+
residentialArea?: undefined;
|
355
|
+
street?: undefined;
|
356
|
+
number?: undefined;
|
357
|
+
zipCode?: undefined;
|
358
|
+
} | null;
|
359
|
+
/**
|
360
|
+
* Maps complex or nested field types, such as Address fields, to their corresponding empty values.
|
361
|
+
*/
|
362
|
+
export declare function mapFieldTypeToEmptyValue(field: FieldConfig): never[] | {
|
363
|
+
country: null;
|
364
|
+
addressType: "DOMESTIC";
|
365
|
+
province: null;
|
366
|
+
district: null;
|
367
|
+
urbanOrRural: string;
|
368
|
+
town: null;
|
369
|
+
residentialArea: null;
|
370
|
+
street: null;
|
371
|
+
number: null;
|
372
|
+
zipCode: null;
|
373
|
+
filename?: undefined;
|
374
|
+
originalFilename?: undefined;
|
375
|
+
type?: undefined;
|
376
|
+
} | {
|
377
|
+
filename: string;
|
378
|
+
originalFilename: string;
|
379
|
+
type: string;
|
380
|
+
country?: undefined;
|
381
|
+
addressType?: undefined;
|
252
382
|
province?: undefined;
|
253
383
|
district?: undefined;
|
254
384
|
urbanOrRural?: undefined;
|
@@ -49,6 +49,7 @@ export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBool
|
|
49
49
|
originalFilename: string;
|
50
50
|
}>, "many">, z.ZodObject<z.objectUtil.extendShape<{
|
51
51
|
country: z.ZodString;
|
52
|
+
addressType: z.ZodLiteral<"DOMESTIC">;
|
52
53
|
province: z.ZodString;
|
53
54
|
district: z.ZodString;
|
54
55
|
}, {
|
@@ -61,6 +62,7 @@ export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBool
|
|
61
62
|
}>, "strip", z.ZodTypeAny, {
|
62
63
|
country: string;
|
63
64
|
district: string;
|
65
|
+
addressType: "DOMESTIC";
|
64
66
|
province: string;
|
65
67
|
urbanOrRural: "URBAN";
|
66
68
|
number?: string | undefined;
|
@@ -71,6 +73,7 @@ export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBool
|
|
71
73
|
}, {
|
72
74
|
country: string;
|
73
75
|
district: string;
|
76
|
+
addressType: "DOMESTIC";
|
74
77
|
province: string;
|
75
78
|
urbanOrRural: "URBAN";
|
76
79
|
number?: string | undefined;
|
@@ -80,6 +83,7 @@ export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBool
|
|
80
83
|
zipCode?: string | undefined;
|
81
84
|
}>, z.ZodObject<z.objectUtil.extendShape<{
|
82
85
|
country: z.ZodString;
|
86
|
+
addressType: z.ZodLiteral<"DOMESTIC">;
|
83
87
|
province: z.ZodString;
|
84
88
|
district: z.ZodString;
|
85
89
|
}, {
|
@@ -88,15 +92,47 @@ export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBool
|
|
88
92
|
}>, "strip", z.ZodTypeAny, {
|
89
93
|
country: string;
|
90
94
|
district: string;
|
95
|
+
addressType: "DOMESTIC";
|
91
96
|
province: string;
|
92
97
|
urbanOrRural: "RURAL";
|
93
98
|
village?: string | undefined;
|
94
99
|
}, {
|
95
100
|
country: string;
|
96
101
|
district: string;
|
102
|
+
addressType: "DOMESTIC";
|
97
103
|
province: string;
|
98
104
|
urbanOrRural: "RURAL";
|
99
105
|
village?: string | undefined;
|
106
|
+
}>, z.ZodObject<{
|
107
|
+
country: z.ZodString;
|
108
|
+
addressType: z.ZodLiteral<"INTERNATIONAL">;
|
109
|
+
state: z.ZodString;
|
110
|
+
district2: z.ZodString;
|
111
|
+
cityOrTown: z.ZodOptional<z.ZodString>;
|
112
|
+
addressLine1: z.ZodOptional<z.ZodString>;
|
113
|
+
addressLine2: z.ZodOptional<z.ZodString>;
|
114
|
+
addressLine3: z.ZodOptional<z.ZodString>;
|
115
|
+
postcodeOrZip: z.ZodOptional<z.ZodString>;
|
116
|
+
}, "strip", z.ZodTypeAny, {
|
117
|
+
country: string;
|
118
|
+
state: string;
|
119
|
+
addressType: "INTERNATIONAL";
|
120
|
+
district2: string;
|
121
|
+
cityOrTown?: string | undefined;
|
122
|
+
addressLine1?: string | undefined;
|
123
|
+
addressLine2?: string | undefined;
|
124
|
+
addressLine3?: string | undefined;
|
125
|
+
postcodeOrZip?: string | undefined;
|
126
|
+
}, {
|
127
|
+
country: string;
|
128
|
+
state: string;
|
129
|
+
addressType: "INTERNATIONAL";
|
130
|
+
district2: string;
|
131
|
+
cityOrTown?: string | undefined;
|
132
|
+
addressLine1?: string | undefined;
|
133
|
+
addressLine2?: string | undefined;
|
134
|
+
addressLine3?: string | undefined;
|
135
|
+
postcodeOrZip?: string | undefined;
|
100
136
|
}>]>;
|
101
137
|
export type FieldValue = z.infer<typeof FieldValue>;
|
102
138
|
export declare const FieldUpdateValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
|
@@ -128,6 +164,7 @@ export declare const FieldUpdateValue: z.ZodUnion<[z.ZodString, z.ZodString, z.Z
|
|
128
164
|
originalFilename: string;
|
129
165
|
}>, "many">, z.ZodObject<z.objectUtil.extendShape<{
|
130
166
|
country: z.ZodString;
|
167
|
+
addressType: z.ZodLiteral<"DOMESTIC">;
|
131
168
|
province: z.ZodString;
|
132
169
|
district: z.ZodString;
|
133
170
|
}, {
|
@@ -140,6 +177,7 @@ export declare const FieldUpdateValue: z.ZodUnion<[z.ZodString, z.ZodString, z.Z
|
|
140
177
|
}>, "strip", z.ZodTypeAny, {
|
141
178
|
country: string;
|
142
179
|
district: string;
|
180
|
+
addressType: "DOMESTIC";
|
143
181
|
province: string;
|
144
182
|
urbanOrRural: "URBAN";
|
145
183
|
number?: string | null | undefined;
|
@@ -150,6 +188,7 @@ export declare const FieldUpdateValue: z.ZodUnion<[z.ZodString, z.ZodString, z.Z
|
|
150
188
|
}, {
|
151
189
|
country: string;
|
152
190
|
district: string;
|
191
|
+
addressType: "DOMESTIC";
|
153
192
|
province: string;
|
154
193
|
urbanOrRural: "URBAN";
|
155
194
|
number?: string | null | undefined;
|
@@ -159,6 +198,7 @@ export declare const FieldUpdateValue: z.ZodUnion<[z.ZodString, z.ZodString, z.Z
|
|
159
198
|
zipCode?: string | null | undefined;
|
160
199
|
}>, z.ZodObject<z.objectUtil.extendShape<{
|
161
200
|
country: z.ZodString;
|
201
|
+
addressType: z.ZodLiteral<"DOMESTIC">;
|
162
202
|
province: z.ZodString;
|
163
203
|
district: z.ZodString;
|
164
204
|
}, {
|
@@ -167,15 +207,47 @@ export declare const FieldUpdateValue: z.ZodUnion<[z.ZodString, z.ZodString, z.Z
|
|
167
207
|
}>, "strip", z.ZodTypeAny, {
|
168
208
|
country: string;
|
169
209
|
district: string;
|
210
|
+
addressType: "DOMESTIC";
|
170
211
|
province: string;
|
171
212
|
urbanOrRural: "RURAL";
|
172
213
|
village?: string | null | undefined;
|
173
214
|
}, {
|
174
215
|
country: string;
|
175
216
|
district: string;
|
217
|
+
addressType: "DOMESTIC";
|
176
218
|
province: string;
|
177
219
|
urbanOrRural: "RURAL";
|
178
220
|
village?: string | null | undefined;
|
221
|
+
}>, z.ZodObject<{
|
222
|
+
country: z.ZodString;
|
223
|
+
addressType: z.ZodLiteral<"INTERNATIONAL">;
|
224
|
+
state: z.ZodString;
|
225
|
+
district2: z.ZodString;
|
226
|
+
cityOrTown: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
227
|
+
addressLine1: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
228
|
+
addressLine2: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
229
|
+
addressLine3: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
230
|
+
postcodeOrZip: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
231
|
+
}, "strip", z.ZodTypeAny, {
|
232
|
+
country: string;
|
233
|
+
state: string;
|
234
|
+
addressType: "INTERNATIONAL";
|
235
|
+
district2: string;
|
236
|
+
cityOrTown?: string | null | undefined;
|
237
|
+
addressLine1?: string | null | undefined;
|
238
|
+
addressLine2?: string | null | undefined;
|
239
|
+
addressLine3?: string | null | undefined;
|
240
|
+
postcodeOrZip?: string | null | undefined;
|
241
|
+
}, {
|
242
|
+
country: string;
|
243
|
+
state: string;
|
244
|
+
addressType: "INTERNATIONAL";
|
245
|
+
district2: string;
|
246
|
+
cityOrTown?: string | null | undefined;
|
247
|
+
addressLine1?: string | null | undefined;
|
248
|
+
addressLine2?: string | null | undefined;
|
249
|
+
addressLine3?: string | null | undefined;
|
250
|
+
postcodeOrZip?: string | null | undefined;
|
179
251
|
}>]>;
|
180
252
|
export type FieldUpdateValue = z.infer<typeof FieldUpdateValue>;
|
181
253
|
/**
|
@@ -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
|