@opencrvs/toolkit 1.8.0-rc.fa72fdf → 1.8.0-rc.faacbde

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.
@@ -1,99 +1,57 @@
1
- import { TranslationConfig } from './TranslationConfig';
2
- import { ActionType } from './ActionType';
1
+ import { ActionType, DeclarationAction } from './ActionType';
3
2
  import { EventConfig } from './EventConfig';
4
- import { EventConfigInput } from './EventConfigInput';
5
- import { EventMetadataKeys } from './EventMetadata';
6
3
  import { FieldConfig } from './FieldConfig';
7
4
  import { WorkqueueConfig } from './WorkqueueConfig';
8
- import { EventState } from './ActionDocument';
9
- import { FormConfig } from './FormConfig';
5
+ import { ActionUpdate, EventState } from './ActionDocument';
6
+ import { PageConfig, VerificationPageConfig } from './PageConfig';
10
7
  import { Draft } from './Draft';
11
8
  import { EventDocument } from './EventDocument';
12
- /**
13
- * @returns All the fields in the event configuration input.
14
- */
15
- export declare const findInputPageFields: (config: EventConfigInput) => {
16
- id: string;
17
- label: TranslationConfig;
18
- }[];
9
+ import { ActionConfig } from './ActionConfig';
10
+ import { FormConfig } from './FormConfig';
19
11
  /**
20
12
  * @returns All the fields in the event configuration.
21
13
  */
22
- export declare const findPageFields: (config: EventConfig) => FieldConfig[];
14
+ export declare const findAllFields: (config: EventConfig) => FieldConfig[];
15
+ export declare const getAllAnnotationFields: (config: EventConfig) => FieldConfig[];
16
+ export declare const getActionAnnotationFields: (actionConfig: ActionConfig) => import("./FieldConfig").Inferred[];
23
17
  /**
24
- *
25
- * @param pageFields - All the fields in the event configuration
26
- * @param refFields - The fields referencing values within the event configuration (e.g. summary fields) or within system provided metadata fields (e.g. createdAt, updatedBy)
27
- * @returns referenced fields with populated labels
18
+ * @TODO: Request correction should have same format as print certificate
28
19
  */
29
- export declare const resolveLabelsFromKnownFields: ({ pageFields, refFields }: {
30
- pageFields: {
31
- id: string;
32
- label: TranslationConfig;
33
- }[];
34
- refFields: {
35
- id: EventMetadataKeys | string;
36
- label?: TranslationConfig;
37
- }[];
38
- }) => {
39
- id: EventMetadataKeys | string;
40
- label?: TranslationConfig;
41
- }[];
42
- export declare function getAllFields(configuration: EventConfig): import("./FieldConfig").Inferred[];
43
- export declare function getAllPages(configuration: EventConfig): {
20
+ export declare const findRecordActionPages: (config: EventConfig, actionType: ActionType) => PageConfig[];
21
+ export declare function getDeclarationFields(configuration: EventConfig): FieldConfig[];
22
+ export declare function getDeclarationPages(configuration: EventConfig): {
23
+ type: "FORM";
44
24
  id: string;
45
- title: TranslationConfig;
25
+ title: import("./TranslationConfig").TranslationConfig;
46
26
  fields: import("./FieldConfig").Inferred[];
27
+ conditional?: import(".").JSONSchema | undefined;
47
28
  }[];
48
- export declare function validateWorkqueueConfig(workqueueConfigs: WorkqueueConfig[]): void;
49
- export declare const findActiveActionForm: (configuration: EventConfig, action: ActionType) => {
50
- active: boolean;
51
- version: {
52
- id: string;
53
- label: TranslationConfig;
54
- };
55
- label: TranslationConfig;
29
+ export declare function getDeclaration(configuration: EventConfig): {
30
+ label: import("./TranslationConfig").TranslationConfig;
56
31
  pages: {
32
+ type: "FORM";
57
33
  id: string;
58
- title: TranslationConfig;
34
+ title: import("./TranslationConfig").TranslationConfig;
59
35
  fields: import("./FieldConfig").Inferred[];
36
+ conditional?: import(".").JSONSchema | undefined;
60
37
  }[];
61
- review: {
62
- title: TranslationConfig;
63
- fields: import("./FieldConfig").Inferred[];
64
- };
65
- } | undefined;
66
- export declare const findActiveActionFormPages: (configuration: EventConfig, action: ActionType) => {
67
- id: string;
68
- title: TranslationConfig;
69
- fields: import("./FieldConfig").Inferred[];
70
- }[] | undefined;
71
- export declare const getFormFields: (formConfig: FormConfig) => import("./FieldConfig").Inferred[];
72
- /**
73
- * Returns only form fields for the action type, if any, excluding review fields.
74
- */
75
- export declare const findActiveActionFormFields: (configuration: EventConfig, action: ActionType) => FieldConfig[] | undefined;
76
- /**
77
- * Returns all fields for the action type, including review fields, if any.
78
- */
79
- export declare const findActiveActionFields: (configuration: EventConfig, action: ActionType) => FieldConfig[] | undefined;
80
- export declare const getActiveActionFormPages: (configuration: EventConfig, action: ActionType) => {
81
- id: string;
82
- title: TranslationConfig;
38
+ };
39
+ export declare function getActionReviewFields(configuration: EventConfig, actionType: DeclarationAction): import("./FieldConfig").Inferred[];
40
+ export declare function getActionReview(configuration: EventConfig, actionType: ActionType): {
41
+ title: import("./TranslationConfig").TranslationConfig;
83
42
  fields: import("./FieldConfig").Inferred[];
84
- }[];
85
- /**
86
- * Returns all fields for the action type, including review fields, or throws
87
- */
88
- export declare function getActiveActionFields(configuration: EventConfig, action: ActionType): FieldConfig[];
89
- export declare function getEventConfiguration(eventConfigurations: EventConfig[], type: string): EventConfig;
90
- export declare function stripHiddenFields(fields: FieldConfig[], data: EventState): import("lodash").Dictionary<string | number | boolean | {
43
+ };
44
+ export declare function validateWorkqueueConfig(workqueueConfigs: WorkqueueConfig[]): void;
45
+ export declare function isPageVisible(page: PageConfig, formValues: ActionUpdate): boolean;
46
+ export declare const getVisiblePagesFormFields: (formConfig: FormConfig, formData: ActionUpdate) => import("./FieldConfig").Inferred[];
47
+ export declare function stripHiddenFields(fields: FieldConfig[], declaration: EventState): import("lodash").Dictionary<string | number | boolean | {
91
48
  type: string;
92
49
  filename: string;
93
50
  originalFilename: string;
94
51
  } | {
95
52
  country: string;
96
53
  district: string;
54
+ addressType: "DOMESTIC";
97
55
  province: string;
98
56
  urbanOrRural: "URBAN";
99
57
  number?: string | undefined;
@@ -104,29 +62,43 @@ export declare function stripHiddenFields(fields: FieldConfig[], data: EventStat
104
62
  } | {
105
63
  country: string;
106
64
  district: string;
65
+ addressType: "DOMESTIC";
107
66
  province: string;
108
67
  urbanOrRural: "RURAL";
109
68
  village?: string | undefined;
69
+ } | {
70
+ country: string;
71
+ state: string;
72
+ addressType: "INTERNATIONAL";
73
+ district2: string;
74
+ cityOrTown?: string | undefined;
75
+ addressLine1?: string | undefined;
76
+ addressLine2?: string | undefined;
77
+ addressLine3?: string | undefined;
78
+ postcodeOrZip?: string | undefined;
110
79
  } | {
111
80
  type: string;
112
81
  option: string;
113
82
  filename: string;
114
83
  originalFilename: string;
115
- }[]>;
84
+ }[] | undefined>;
116
85
  export declare function findActiveDrafts(event: EventDocument, drafts: Draft[]): {
117
86
  id: string;
118
87
  createdAt: string;
119
88
  eventId: string;
120
89
  transactionId: string;
121
90
  action: {
122
- type: ActionType;
123
- data: Record<string, string | number | boolean | {
91
+ type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "CREATE" | "NOTIFY" | "DETECT_DUPLICATE" | "REJECT" | "MARKED_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "READ" | "ASSIGN" | "UNASSIGN";
92
+ createdAt: string;
93
+ createdBy: string;
94
+ declaration: Record<string, string | number | boolean | {
124
95
  type: string;
125
96
  filename: string;
126
97
  originalFilename: string;
127
98
  } | {
128
99
  country: string;
129
100
  district: string;
101
+ addressType: "DOMESTIC";
130
102
  province: string;
131
103
  urbanOrRural: "URBAN";
132
104
  number?: string | null | undefined;
@@ -137,25 +109,35 @@ export declare function findActiveDrafts(event: EventDocument, drafts: Draft[]):
137
109
  } | {
138
110
  country: string;
139
111
  district: string;
112
+ addressType: "DOMESTIC";
140
113
  province: string;
141
114
  urbanOrRural: "RURAL";
142
115
  village?: string | null | undefined;
116
+ } | {
117
+ country: string;
118
+ state: string;
119
+ addressType: "INTERNATIONAL";
120
+ district2: string;
121
+ cityOrTown?: string | null | undefined;
122
+ addressLine1?: string | null | undefined;
123
+ addressLine2?: string | null | undefined;
124
+ addressLine3?: string | null | undefined;
125
+ postcodeOrZip?: string | null | undefined;
143
126
  } | {
144
127
  type: string;
145
128
  option: string;
146
129
  filename: string;
147
130
  originalFilename: string;
148
- }[]>;
149
- createdAt: string;
150
- createdBy: string;
131
+ }[] | undefined>;
151
132
  createdAtLocation: string;
152
- metadata?: Record<string, string | number | boolean | {
133
+ annotation?: Record<string, string | number | boolean | {
153
134
  type: string;
154
135
  filename: string;
155
136
  originalFilename: string;
156
137
  } | {
157
138
  country: string;
158
139
  district: string;
140
+ addressType: "DOMESTIC";
159
141
  province: string;
160
142
  urbanOrRural: "URBAN";
161
143
  number?: string | null | undefined;
@@ -166,15 +148,26 @@ export declare function findActiveDrafts(event: EventDocument, drafts: Draft[]):
166
148
  } | {
167
149
  country: string;
168
150
  district: string;
151
+ addressType: "DOMESTIC";
169
152
  province: string;
170
153
  urbanOrRural: "RURAL";
171
154
  village?: string | null | undefined;
155
+ } | {
156
+ country: string;
157
+ state: string;
158
+ addressType: "INTERNATIONAL";
159
+ district2: string;
160
+ cityOrTown?: string | null | undefined;
161
+ addressLine1?: string | null | undefined;
162
+ addressLine2?: string | null | undefined;
163
+ addressLine3?: string | null | undefined;
164
+ postcodeOrZip?: string | null | undefined;
172
165
  } | {
173
166
  type: string;
174
167
  option: string;
175
168
  filename: string;
176
169
  originalFilename: string;
177
- }[]> | undefined;
170
+ }[] | undefined> | undefined;
178
171
  };
179
172
  }[];
180
173
  export declare function createEmptyDraft(eventId: string, draftId: string, actionType: ActionType): {
@@ -184,11 +177,12 @@ export declare function createEmptyDraft(eventId: string, draftId: string, actio
184
177
  transactionId: import("../uuid").UUID;
185
178
  action: {
186
179
  type: ActionType;
187
- data: {};
188
- metadata: {};
180
+ declaration: {};
181
+ annotation: {};
189
182
  createdAt: string;
190
183
  createdBy: string;
191
184
  createdAtLocation: string;
192
185
  };
193
186
  };
187
+ export declare function isVerificationPage(page: PageConfig): page is VerificationPageConfig;
194
188
  //# sourceMappingURL=utils.d.ts.map
@@ -239,6 +239,61 @@ function field(fieldId) {
239
239
  }
240
240
  },
241
241
  required: ["$form"]
242
+ }),
243
+ isValidEnglishName: () => defineConditional({
244
+ type: "object",
245
+ properties: {
246
+ $form: {
247
+ type: "object",
248
+ properties: {
249
+ [fieldId]: {
250
+ type: "string",
251
+ pattern: "^[\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*( [\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*)*$",
252
+ description: "Name must contain only letters, numbers, and allowed special characters ('._-). No double spaces."
253
+ }
254
+ },
255
+ required: [fieldId]
256
+ }
257
+ },
258
+ required: ["$form"]
259
+ }),
260
+ /**
261
+ * Checks if the field value matches a given regular expression pattern.
262
+ * @param pattern - The regular expression pattern to match the field value against.
263
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
264
+ */
265
+ matches: (pattern) => defineConditional({
266
+ type: "object",
267
+ properties: {
268
+ $form: {
269
+ type: "object",
270
+ properties: {
271
+ [fieldId]: {
272
+ type: "string",
273
+ pattern
274
+ }
275
+ },
276
+ required: [fieldId]
277
+ }
278
+ },
279
+ required: ["$form"]
280
+ }),
281
+ isBetween: (min, max) => defineConditional({
282
+ type: "object",
283
+ properties: {
284
+ $form: {
285
+ type: "object",
286
+ properties: {
287
+ [fieldId]: {
288
+ type: "number",
289
+ minimum: min,
290
+ maximum: max
291
+ }
292
+ },
293
+ required: [fieldId]
294
+ }
295
+ },
296
+ required: ["$form"]
242
297
  })
243
298
  };
244
299
  }