@opencrvs/toolkit 1.8.0-rc.fe799b0 → 1.8.0-rc.fe87a15

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.
Files changed (49) hide show
  1. package/README.md +1 -1
  2. package/dist/commons/api/router.d.ts +15282 -10293
  3. package/dist/commons/conditionals/conditionals.d.ts +33 -6
  4. package/dist/commons/conditionals/validate-address.test.d.ts +2 -0
  5. package/dist/commons/conditionals/validate.d.ts +39 -17
  6. package/dist/commons/conditionals/validate.test.d.ts +2 -0
  7. package/dist/commons/events/ActionConfig.d.ts +104405 -2019
  8. package/dist/commons/events/ActionDocument.d.ts +10075 -381
  9. package/dist/commons/events/ActionInput.d.ts +5486 -633
  10. package/dist/commons/events/ActionType.d.ts +27 -12
  11. package/dist/commons/events/AdvancedSearchConfig.d.ts +957 -22
  12. package/dist/commons/events/CompositeFieldValue.d.ts +155 -2
  13. package/dist/commons/events/Conditional.d.ts +21 -5
  14. package/dist/commons/events/Constants.d.ts +2 -0
  15. package/dist/commons/events/CountryConfigQueryInput.d.ts +2982 -0
  16. package/dist/commons/events/CreatedAtLocation.d.ts +2 -0
  17. package/dist/commons/events/Draft.d.ts +384 -66
  18. package/dist/commons/events/EventConfig.d.ts +50285 -1826
  19. package/dist/commons/events/EventConfigInput.d.ts +6 -3
  20. package/dist/commons/events/EventDocument.d.ts +3738 -522
  21. package/dist/commons/events/EventIndex.d.ts +1344 -15
  22. package/dist/commons/events/EventMetadata.d.ts +302 -13
  23. package/dist/commons/events/FieldConfig.d.ts +4831 -806
  24. package/dist/commons/events/FieldType.d.ts +7 -2
  25. package/dist/commons/events/FieldTypeMapping.d.ts +169 -8
  26. package/dist/commons/events/FieldValue.d.ts +84 -5
  27. package/dist/commons/events/FormConfig.d.ts +44104 -73
  28. package/dist/commons/events/PageConfig.d.ts +11061 -0
  29. package/dist/commons/events/SummaryConfig.d.ts +95 -39
  30. package/dist/commons/events/TemplateConfig.d.ts +38 -0
  31. package/dist/commons/events/User.d.ts +31 -2
  32. package/dist/commons/events/WorkqueueColumnConfig.d.ts +53 -0
  33. package/dist/commons/events/WorkqueueConfig.d.ts +4525 -20
  34. package/dist/commons/events/defineConfig.d.ts +8087 -229
  35. package/dist/commons/events/event.d.ts +54 -0
  36. package/dist/commons/events/field.d.ts +73 -0
  37. package/dist/commons/events/index.d.ts +10 -1
  38. package/dist/commons/events/scopes.d.ts +45 -0
  39. package/dist/commons/events/serializer.d.ts +2 -0
  40. package/dist/commons/events/test.utils.d.ts +154 -243
  41. package/dist/commons/events/transactions.d.ts +1 -1
  42. package/dist/commons/events/utils.d.ts +3831 -69
  43. package/dist/commons/events/utils.test.d.ts +2 -0
  44. package/dist/commons/events/workqueueDefaultColumns.d.ts +3 -0
  45. package/dist/conditionals/index.js +217 -109
  46. package/dist/events/index.js +4558 -1865
  47. package/dist/scopes/index.d.ts +158 -1
  48. package/dist/scopes/index.js +152 -1
  49. 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
- title: z.ZodObject<{
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
- }, "strip", z.ZodTypeAny, {
17
- id: string;
18
- label: TranslationConfig;
19
- emptyValueMessage?: TranslationConfig | undefined;
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
- }, "strip", z.ZodTypeAny, {
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,100 @@ 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
- }>, "many">;
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
+ label: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
86
+ id: string;
87
+ description: string;
88
+ defaultMessage: string;
89
+ }>>;
90
+ }>, "strip", z.ZodTypeAny, {
91
+ fieldId: string;
92
+ conditionals?: {
93
+ type: "SHOW";
94
+ conditional: import(".").JSONSchema;
95
+ }[] | undefined;
96
+ label?: TranslationConfig | undefined;
97
+ emptyValueMessage?: TranslationConfig | undefined;
98
+ }, {
99
+ fieldId: string;
100
+ conditionals?: {
101
+ type: "SHOW";
102
+ conditional: import(".").JSONSchema;
103
+ }[] | undefined;
104
+ label?: {
105
+ id: string;
106
+ description: string;
107
+ defaultMessage: string;
108
+ } | undefined;
109
+ emptyValueMessage?: {
110
+ id: string;
111
+ description: string;
112
+ defaultMessage: string;
113
+ } | undefined;
114
+ }>]>, "many">;
73
115
  }, "strip", z.ZodTypeAny, {
74
- title: {
75
- id: string;
76
- label: TranslationConfig;
116
+ fields: ({
117
+ fieldId: string;
118
+ conditionals?: {
119
+ type: "SHOW";
120
+ conditional: import(".").JSONSchema;
121
+ }[] | undefined;
122
+ label?: TranslationConfig | undefined;
77
123
  emptyValueMessage?: TranslationConfig | undefined;
78
- };
79
- fields: {
124
+ } | {
80
125
  id: string;
81
126
  value: TranslationConfig;
82
127
  label: TranslationConfig;
128
+ conditionals?: {
129
+ type: "SHOW";
130
+ conditional: import(".").JSONSchema;
131
+ }[] | undefined;
83
132
  emptyValueMessage?: TranslationConfig | undefined;
84
- }[];
133
+ })[];
85
134
  }, {
86
- title: {
87
- id: string;
88
- label: {
135
+ fields: ({
136
+ fieldId: string;
137
+ conditionals?: {
138
+ type: "SHOW";
139
+ conditional: import(".").JSONSchema;
140
+ }[] | undefined;
141
+ label?: {
89
142
  id: string;
90
143
  description: string;
91
144
  defaultMessage: string;
92
- };
145
+ } | undefined;
93
146
  emptyValueMessage?: {
94
147
  id: string;
95
148
  description: string;
96
149
  defaultMessage: string;
97
150
  } | undefined;
98
- };
99
- fields: {
151
+ } | {
100
152
  id: string;
101
153
  value: {
102
154
  id: string;
@@ -108,12 +160,16 @@ export declare const SummaryConfig: z.ZodObject<{
108
160
  description: string;
109
161
  defaultMessage: string;
110
162
  };
163
+ conditionals?: {
164
+ type: "SHOW";
165
+ conditional: import(".").JSONSchema;
166
+ }[] | undefined;
111
167
  emptyValueMessage?: {
112
168
  id: string;
113
169
  description: string;
114
170
  defaultMessage: string;
115
171
  } | undefined;
116
- }[];
172
+ })[];
117
173
  }>;
118
174
  export type SummaryConfig = z.infer<typeof SummaryConfig>;
119
175
  //# sourceMappingURL=SummaryConfig.d.ts.map
@@ -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 type SystemVariables = {
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 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;
37
+ export {};
38
+ //# sourceMappingURL=TemplateConfig.d.ts.map
@@ -1,4 +1,31 @@
1
- export type User = {
1
+ import { z } from 'zod';
2
+ export declare const User: z.ZodObject<{
3
+ id: z.ZodString;
4
+ name: z.ZodArray<z.ZodObject<{
5
+ use: z.ZodString;
6
+ given: z.ZodArray<z.ZodString, "many">;
7
+ family: z.ZodString;
8
+ }, "strip", z.ZodTypeAny, {
9
+ use: string;
10
+ given: string[];
11
+ family: string;
12
+ }, {
13
+ use: string;
14
+ given: string[];
15
+ family: string;
16
+ }>, "many">;
17
+ role: z.ZodString;
18
+ signatureFilename: z.ZodOptional<z.ZodString>;
19
+ }, "strip", z.ZodTypeAny, {
20
+ id: string;
21
+ name: {
22
+ use: string;
23
+ given: string[];
24
+ family: string;
25
+ }[];
26
+ role: string;
27
+ signatureFilename?: string | undefined;
28
+ }, {
2
29
  id: string;
3
30
  name: {
4
31
  use: string;
@@ -6,5 +33,7 @@ export type User = {
6
33
  family: string;
7
34
  }[];
8
35
  role: string;
9
- };
36
+ signatureFilename?: string | undefined;
37
+ }>;
38
+ export type User = z.infer<typeof User>;
10
39
  //# sourceMappingURL=User.d.ts.map
@@ -0,0 +1,53 @@
1
+ import { z } from 'zod';
2
+ import { TranslationConfig } from './TranslationConfig';
3
+ export declare const WorkqueueColumnKeysArray: readonly ["id", "type", "status", "createdAt", "dateOfEvent", "createdBy", "updatedByUserRole", "createdAtLocation", "updatedAtLocation", "updatedAt", "assignedTo", "updatedBy", "trackingId", "legalStatuses", "flags", "title"];
4
+ export declare const WorkqueueColumnKeys: z.ZodEnum<["id", "type", "status", "createdAt", "dateOfEvent", "createdBy", "updatedByUserRole", "createdAtLocation", "updatedAtLocation", "updatedAt", "assignedTo", "updatedBy", "trackingId", "legalStatuses", "flags", "title"]>;
5
+ export type WorkqueueColumnKeys = z.infer<typeof WorkqueueColumnKeys>;
6
+ export declare const WorkqueueColumnValue: z.ZodObject<{
7
+ $event: z.ZodEnum<["id", "type", "status", "createdAt", "dateOfEvent", "createdBy", "updatedByUserRole", "createdAtLocation", "updatedAtLocation", "updatedAt", "assignedTo", "updatedBy", "trackingId", "legalStatuses", "flags", "title"]>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ $event: "type" | "id" | "status" | "title" | "createdAt" | "createdBy" | "createdAtLocation" | "assignedTo" | "updatedAt" | "trackingId" | "legalStatuses" | "dateOfEvent" | "updatedByUserRole" | "updatedAtLocation" | "updatedBy" | "flags";
10
+ }, {
11
+ $event: "type" | "id" | "status" | "title" | "createdAt" | "createdBy" | "createdAtLocation" | "assignedTo" | "updatedAt" | "trackingId" | "legalStatuses" | "dateOfEvent" | "updatedByUserRole" | "updatedAtLocation" | "updatedBy" | "flags";
12
+ }>;
13
+ export type WorkqueueColumnValue = z.infer<typeof WorkqueueColumnValue>;
14
+ /**
15
+ * Configuration for column header and value of cell of workqueue.
16
+ */
17
+ export declare const WorkqueueColumn: z.ZodObject<{
18
+ label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
19
+ id: string;
20
+ description: string;
21
+ defaultMessage: string;
22
+ }>;
23
+ value: z.ZodObject<{
24
+ $event: z.ZodEnum<["id", "type", "status", "createdAt", "dateOfEvent", "createdBy", "updatedByUserRole", "createdAtLocation", "updatedAtLocation", "updatedAt", "assignedTo", "updatedBy", "trackingId", "legalStatuses", "flags", "title"]>;
25
+ }, "strip", z.ZodTypeAny, {
26
+ $event: "type" | "id" | "status" | "title" | "createdAt" | "createdBy" | "createdAtLocation" | "assignedTo" | "updatedAt" | "trackingId" | "legalStatuses" | "dateOfEvent" | "updatedByUserRole" | "updatedAtLocation" | "updatedBy" | "flags";
27
+ }, {
28
+ $event: "type" | "id" | "status" | "title" | "createdAt" | "createdBy" | "createdAtLocation" | "assignedTo" | "updatedAt" | "trackingId" | "legalStatuses" | "dateOfEvent" | "updatedByUserRole" | "updatedAtLocation" | "updatedBy" | "flags";
29
+ }>;
30
+ }, "strip", z.ZodTypeAny, {
31
+ value: {
32
+ $event: "type" | "id" | "status" | "title" | "createdAt" | "createdBy" | "createdAtLocation" | "assignedTo" | "updatedAt" | "trackingId" | "legalStatuses" | "dateOfEvent" | "updatedByUserRole" | "updatedAtLocation" | "updatedBy" | "flags";
33
+ };
34
+ label: TranslationConfig;
35
+ }, {
36
+ value: {
37
+ $event: "type" | "id" | "status" | "title" | "createdAt" | "createdBy" | "createdAtLocation" | "assignedTo" | "updatedAt" | "trackingId" | "legalStatuses" | "dateOfEvent" | "updatedByUserRole" | "updatedAtLocation" | "updatedBy" | "flags";
38
+ };
39
+ label: {
40
+ id: string;
41
+ description: string;
42
+ defaultMessage: string;
43
+ };
44
+ }>;
45
+ export type WorkqueueColumn = z.infer<typeof WorkqueueColumn>;
46
+ export type WorkqueueColumnInput = z.infer<typeof WorkqueueColumn>;
47
+ export declare function defineWorkqueuesColumns(workqueueColumns: WorkqueueColumnInput[]): {
48
+ value: {
49
+ $event: "type" | "id" | "status" | "title" | "createdAt" | "createdBy" | "createdAtLocation" | "assignedTo" | "updatedAt" | "trackingId" | "legalStatuses" | "dateOfEvent" | "updatedByUserRole" | "updatedAtLocation" | "updatedBy" | "flags";
50
+ };
51
+ label: TranslationConfig;
52
+ }[];
53
+ //# sourceMappingURL=WorkqueueColumnConfig.d.ts.map