@opencrvs/toolkit 1.8.0-rc.feaeeb7 → 1.8.0-rc.feef45c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/commons/api/router.d.ts +10781 -10314
- package/dist/commons/conditionals/conditionals.d.ts +31 -5
- package/dist/commons/conditionals/validate-address.test.d.ts +2 -0
- package/dist/commons/conditionals/validate.d.ts +39 -17
- package/dist/commons/conditionals/validate.test.d.ts +2 -0
- package/dist/commons/events/ActionConfig.d.ts +85782 -2035
- package/dist/commons/events/ActionDocument.d.ts +9850 -363
- package/dist/commons/events/ActionInput.d.ts +5365 -584
- package/dist/commons/events/ActionType.d.ts +27 -12
- package/dist/commons/events/AdvancedSearchConfig.d.ts +371 -25
- package/dist/commons/events/CompositeFieldValue.d.ts +155 -2
- package/dist/commons/events/Conditional.d.ts +21 -5
- package/dist/commons/events/Draft.d.ts +374 -59
- package/dist/commons/events/EventConfig.d.ts +40846 -1801
- package/dist/commons/events/EventConfigInput.d.ts +6 -3
- package/dist/commons/events/EventDocument.d.ts +3672 -504
- package/dist/commons/events/EventIndex.d.ts +921 -7
- package/dist/commons/events/EventInput.d.ts +13 -0
- package/dist/commons/events/EventMetadata.d.ts +16 -3
- package/dist/commons/events/FieldConfig.d.ts +3955 -757
- package/dist/commons/events/FieldType.d.ts +6 -2
- package/dist/commons/events/FieldTypeMapping.d.ts +154 -3
- package/dist/commons/events/FieldValue.d.ts +77 -3
- package/dist/commons/events/FormConfig.d.ts +38982 -69
- package/dist/commons/events/PageConfig.d.ts +9803 -0
- package/dist/commons/events/SummaryConfig.d.ts +81 -42
- package/dist/commons/events/TemplateConfig.d.ts +30 -10
- package/dist/commons/events/User.d.ts +5 -0
- package/dist/commons/events/WorkqueueConfig.d.ts +44 -20
- package/dist/commons/events/defineConfig.d.ts +6749 -230
- package/dist/commons/events/event.d.ts +25 -0
- package/dist/commons/events/field.d.ts +68 -0
- package/dist/commons/events/index.d.ts +5 -1
- package/dist/commons/events/scopes.d.ts +26 -0
- package/dist/commons/events/test.utils.d.ts +128 -238
- package/dist/commons/events/utils.d.ts +3528 -90
- package/dist/commons/events/utils.test.d.ts +2 -0
- package/dist/conditionals/index.js +196 -108
- package/dist/events/index.js +2201 -1197
- package/package.json +3 -2
@@ -1,36 +1,23 @@
|
|
1
1
|
import { z } from 'zod';
|
2
2
|
import { TranslationConfig } from './TranslationConfig';
|
3
3
|
export declare const SummaryConfig: z.ZodObject<{
|
4
|
-
|
5
|
-
id: z.ZodString;
|
6
|
-
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
7
|
-
id: string;
|
8
|
-
description: string;
|
9
|
-
defaultMessage: string;
|
10
|
-
}>;
|
4
|
+
fields: z.ZodArray<z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
|
11
5
|
emptyValueMessage: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
12
6
|
id: string;
|
13
7
|
description: string;
|
14
8
|
defaultMessage: string;
|
15
9
|
}>>;
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
10
|
+
conditionals: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
11
|
+
type: z.ZodLiteral<"SHOW">;
|
12
|
+
conditional: z.ZodType<import(".").JSONSchema, z.ZodTypeDef, import(".").JSONSchema>;
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
14
|
+
type: "SHOW";
|
15
|
+
conditional: import(".").JSONSchema;
|
16
|
+
}, {
|
17
|
+
type: "SHOW";
|
18
|
+
conditional: import(".").JSONSchema;
|
19
|
+
}>, "many">>>;
|
20
20
|
}, {
|
21
|
-
id: string;
|
22
|
-
label: {
|
23
|
-
id: string;
|
24
|
-
description: string;
|
25
|
-
defaultMessage: string;
|
26
|
-
};
|
27
|
-
emptyValueMessage?: {
|
28
|
-
id: string;
|
29
|
-
description: string;
|
30
|
-
defaultMessage: string;
|
31
|
-
} | undefined;
|
32
|
-
}>;
|
33
|
-
fields: z.ZodArray<z.ZodObject<{
|
34
21
|
id: z.ZodString;
|
35
22
|
value: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
36
23
|
id: string;
|
@@ -47,10 +34,14 @@ export declare const SummaryConfig: z.ZodObject<{
|
|
47
34
|
description: string;
|
48
35
|
defaultMessage: string;
|
49
36
|
}>>;
|
50
|
-
}
|
37
|
+
}>, "strip", z.ZodTypeAny, {
|
51
38
|
id: string;
|
52
39
|
value: TranslationConfig;
|
53
40
|
label: TranslationConfig;
|
41
|
+
conditionals?: {
|
42
|
+
type: "SHOW";
|
43
|
+
conditional: import(".").JSONSchema;
|
44
|
+
}[] | undefined;
|
54
45
|
emptyValueMessage?: TranslationConfig | undefined;
|
55
46
|
}, {
|
56
47
|
id: string;
|
@@ -64,39 +55,83 @@ export declare const SummaryConfig: z.ZodObject<{
|
|
64
55
|
description: string;
|
65
56
|
defaultMessage: string;
|
66
57
|
};
|
58
|
+
conditionals?: {
|
59
|
+
type: "SHOW";
|
60
|
+
conditional: import(".").JSONSchema;
|
61
|
+
}[] | undefined;
|
67
62
|
emptyValueMessage?: {
|
68
63
|
id: string;
|
69
64
|
description: string;
|
70
65
|
defaultMessage: string;
|
71
66
|
} | undefined;
|
72
|
-
}>,
|
67
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
68
|
+
emptyValueMessage: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
69
|
+
id: string;
|
70
|
+
description: string;
|
71
|
+
defaultMessage: string;
|
72
|
+
}>>;
|
73
|
+
conditionals: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
74
|
+
type: z.ZodLiteral<"SHOW">;
|
75
|
+
conditional: z.ZodType<import(".").JSONSchema, z.ZodTypeDef, import(".").JSONSchema>;
|
76
|
+
}, "strip", z.ZodTypeAny, {
|
77
|
+
type: "SHOW";
|
78
|
+
conditional: import(".").JSONSchema;
|
79
|
+
}, {
|
80
|
+
type: "SHOW";
|
81
|
+
conditional: import(".").JSONSchema;
|
82
|
+
}>, "many">>>;
|
83
|
+
}, {
|
84
|
+
fieldId: z.ZodString;
|
85
|
+
}>, "strip", z.ZodTypeAny, {
|
86
|
+
fieldId: string;
|
87
|
+
conditionals?: {
|
88
|
+
type: "SHOW";
|
89
|
+
conditional: import(".").JSONSchema;
|
90
|
+
}[] | undefined;
|
91
|
+
emptyValueMessage?: TranslationConfig | undefined;
|
92
|
+
}, {
|
93
|
+
fieldId: string;
|
94
|
+
conditionals?: {
|
95
|
+
type: "SHOW";
|
96
|
+
conditional: import(".").JSONSchema;
|
97
|
+
}[] | undefined;
|
98
|
+
emptyValueMessage?: {
|
99
|
+
id: string;
|
100
|
+
description: string;
|
101
|
+
defaultMessage: string;
|
102
|
+
} | undefined;
|
103
|
+
}>]>, "many">;
|
73
104
|
}, "strip", z.ZodTypeAny, {
|
74
|
-
|
75
|
-
|
76
|
-
|
105
|
+
fields: ({
|
106
|
+
fieldId: string;
|
107
|
+
conditionals?: {
|
108
|
+
type: "SHOW";
|
109
|
+
conditional: import(".").JSONSchema;
|
110
|
+
}[] | undefined;
|
77
111
|
emptyValueMessage?: TranslationConfig | undefined;
|
78
|
-
}
|
79
|
-
fields: {
|
112
|
+
} | {
|
80
113
|
id: string;
|
81
114
|
value: TranslationConfig;
|
82
115
|
label: TranslationConfig;
|
116
|
+
conditionals?: {
|
117
|
+
type: "SHOW";
|
118
|
+
conditional: import(".").JSONSchema;
|
119
|
+
}[] | undefined;
|
83
120
|
emptyValueMessage?: TranslationConfig | undefined;
|
84
|
-
}[];
|
121
|
+
})[];
|
85
122
|
}, {
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
};
|
123
|
+
fields: ({
|
124
|
+
fieldId: string;
|
125
|
+
conditionals?: {
|
126
|
+
type: "SHOW";
|
127
|
+
conditional: import(".").JSONSchema;
|
128
|
+
}[] | undefined;
|
93
129
|
emptyValueMessage?: {
|
94
130
|
id: string;
|
95
131
|
description: string;
|
96
132
|
defaultMessage: string;
|
97
133
|
} | undefined;
|
98
|
-
}
|
99
|
-
fields: {
|
134
|
+
} | {
|
100
135
|
id: string;
|
101
136
|
value: {
|
102
137
|
id: string;
|
@@ -108,12 +143,16 @@ export declare const SummaryConfig: z.ZodObject<{
|
|
108
143
|
description: string;
|
109
144
|
defaultMessage: string;
|
110
145
|
};
|
146
|
+
conditionals?: {
|
147
|
+
type: "SHOW";
|
148
|
+
conditional: import(".").JSONSchema;
|
149
|
+
}[] | undefined;
|
111
150
|
emptyValueMessage?: {
|
112
151
|
id: string;
|
113
152
|
description: string;
|
114
153
|
defaultMessage: string;
|
115
154
|
} | undefined;
|
116
|
-
}[];
|
155
|
+
})[];
|
117
156
|
}>;
|
118
157
|
export type SummaryConfig = z.infer<typeof SummaryConfig>;
|
119
158
|
//# sourceMappingURL=SummaryConfig.d.ts.map
|
@@ -1,18 +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
|
+
*/
|
1
5
|
import { FieldValue } from './FieldValue';
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
export
|
6
|
-
export declare function isDefaultValue(value: any): value is DefaultValue;
|
7
|
-
export interface MetaFields {
|
6
|
+
/**
|
7
|
+
* Available system variables for configuration.
|
8
|
+
*/
|
9
|
+
export type SystemVariables = {
|
8
10
|
$user: {
|
9
11
|
province: string;
|
10
12
|
district: string;
|
11
13
|
};
|
12
|
-
}
|
13
|
-
|
14
|
-
|
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}`;
|
15
23
|
}[keyof T];
|
16
|
-
export type
|
24
|
+
export type FlattenenedSystemVariables = FlattenedKeyStrings<SystemVariables>;
|
25
|
+
/**
|
26
|
+
* Default value for a field when configuring a form.
|
27
|
+
*/
|
28
|
+
export type FieldConfigDefaultValue = FieldValue | FlattenenedSystemVariables | Record<string, FlattenenedSystemVariables | FieldValue>;
|
29
|
+
export declare function isTemplateVariable(value: FieldConfigDefaultValue): value is FlattenenedSystemVariables;
|
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;
|
17
37
|
export {};
|
18
38
|
//# sourceMappingURL=TemplateConfig.d.ts.map
|
@@ -6,5 +6,10 @@ export type User = {
|
|
6
6
|
family: string;
|
7
7
|
}[];
|
8
8
|
role: string;
|
9
|
+
/**
|
10
|
+
* The filename of the user's signature stored in MinIO, ex: 'a552f64a-31c4-4e78-b44f-292c3179e2ef.png'.
|
11
|
+
* This is used to retrieve the signature file from storage.
|
12
|
+
*/
|
13
|
+
signatureFilename?: string;
|
9
14
|
};
|
10
15
|
//# sourceMappingURL=User.d.ts.map
|
@@ -1,36 +1,60 @@
|
|
1
1
|
import { z } from 'zod';
|
2
|
+
import { TranslationConfig } from './TranslationConfig';
|
2
3
|
/**
|
3
4
|
* Configuration for workqueue. Workqueues are used to display a list of events.
|
4
5
|
*/
|
5
6
|
export declare const WorkqueueConfig: z.ZodObject<{
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
7
|
+
slug: z.ZodString;
|
8
|
+
name: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
|
9
|
+
id: string;
|
10
|
+
description: string;
|
11
|
+
defaultMessage: string;
|
12
|
+
}>;
|
13
|
+
/**
|
14
|
+
* Placeholder untill the following gets merged to develop
|
15
|
+
* https://github.com/opencrvs/opencrvs-core/blob/5fbe9854a88504a7a13fcc856b3e82594b70c38c/packages/commons/src/events/EventIndex.ts#L92-L93
|
16
|
+
*/
|
17
|
+
query: z.ZodString;
|
18
|
+
actions: z.ZodArray<z.ZodObject<{
|
19
|
+
type: z.ZodString;
|
20
|
+
conditionals: z.ZodOptional<z.ZodArray<z.ZodType<import(".").JSONSchema, z.ZodTypeDef, import(".").JSONSchema>, "many">>;
|
18
21
|
}, "strip", z.ZodTypeAny, {
|
19
|
-
|
22
|
+
type: string;
|
23
|
+
conditionals?: import(".").JSONSchema[] | undefined;
|
20
24
|
}, {
|
21
|
-
|
25
|
+
type: string;
|
26
|
+
conditionals?: import(".").JSONSchema[] | undefined;
|
22
27
|
}>, "many">;
|
23
28
|
}, "strip", z.ZodTypeAny, {
|
24
|
-
|
25
|
-
|
26
|
-
|
29
|
+
name: TranslationConfig;
|
30
|
+
actions: {
|
31
|
+
type: string;
|
32
|
+
conditionals?: import(".").JSONSchema[] | undefined;
|
27
33
|
}[];
|
34
|
+
query: string;
|
35
|
+
slug: string;
|
28
36
|
}, {
|
29
|
-
|
30
|
-
|
31
|
-
|
37
|
+
name: {
|
38
|
+
id: string;
|
39
|
+
description: string;
|
40
|
+
defaultMessage: string;
|
41
|
+
};
|
42
|
+
actions: {
|
43
|
+
type: string;
|
44
|
+
conditionals?: import(".").JSONSchema[] | undefined;
|
32
45
|
}[];
|
46
|
+
query: string;
|
47
|
+
slug: string;
|
33
48
|
}>;
|
34
49
|
export type WorkqueueConfig = z.infer<typeof WorkqueueConfig>;
|
35
50
|
export type WorkqueueConfigInput = z.input<typeof WorkqueueConfig>;
|
51
|
+
export declare function defineWorkqueue(workqueues: WorkqueueConfigInput[]): {
|
52
|
+
name: TranslationConfig;
|
53
|
+
actions: {
|
54
|
+
type: string;
|
55
|
+
conditionals?: import(".").JSONSchema[] | undefined;
|
56
|
+
}[];
|
57
|
+
query: string;
|
58
|
+
slug: string;
|
59
|
+
}[];
|
36
60
|
//# sourceMappingURL=WorkqueueConfig.d.ts.map
|