@opencrvs/toolkit 1.8.0-rc.fa564ca → 1.8.0-rc.fa82472
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 +6661 -391
- package/dist/commons/conditionals/conditionals.d.ts +4 -0
- package/dist/commons/conditionals/validate.d.ts +6 -0
- package/dist/commons/events/ActionConfig.d.ts +18678 -6326
- package/dist/commons/events/ActionDocument.d.ts +1713 -204
- package/dist/commons/events/ActionInput.d.ts +1380 -180
- package/dist/commons/events/ActionType.d.ts +2 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +75 -3
- package/dist/commons/events/CompositeFieldValue.d.ts +28 -0
- package/dist/commons/events/Constants.d.ts +1 -0
- package/dist/commons/events/CountryConfigQueryInput.d.ts +254 -168
- package/dist/commons/events/Draft.d.ts +117 -16
- package/dist/commons/events/EventConfig.d.ts +8242 -2365
- package/dist/commons/events/EventDocument.d.ts +1096 -152
- package/dist/commons/events/EventIndex.d.ts +793 -118
- package/dist/commons/events/EventMetadata.d.ts +38 -35
- package/dist/commons/events/FieldConfig.d.ts +1572 -746
- package/dist/commons/events/FieldType.d.ts +4 -1
- package/dist/commons/events/FieldTypeMapping.d.ts +89 -50
- package/dist/commons/events/FieldValue.d.ts +41 -5
- package/dist/commons/events/FormConfig.d.ts +7640 -2444
- package/dist/commons/events/PageConfig.d.ts +2816 -1540
- package/dist/commons/events/SummaryConfig.d.ts +0 -5
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +11 -11
- package/dist/commons/events/WorkqueueConfig.d.ts +3266 -1503
- package/dist/commons/events/defineConfig.d.ts +959 -13
- package/dist/commons/events/field.d.ts +4 -0
- package/dist/commons/events/scopes.d.ts +6 -0
- package/dist/commons/events/test.utils.d.ts +137 -38
- package/dist/commons/events/utils.d.ts +9661 -10
- package/dist/conditionals/index.js +18 -1
- package/dist/events/index.js +1488 -928
- package/dist/scopes/index.d.ts +4 -1
- package/dist/scopes/index.js +67 -17
- package/package.json +1 -1
@@ -69,5 +69,9 @@ export declare function field(fieldId: string, options?: {
|
|
69
69
|
isValidEnglishName: () => import("../conditionals/conditionals").JSONSchema;
|
70
70
|
matches: (pattern: string) => import("../conditionals/conditionals").JSONSchema;
|
71
71
|
isBetween: (min: number, max: number) => import("../conditionals/conditionals").JSONSchema;
|
72
|
+
getId: () => {
|
73
|
+
fieldId: string;
|
74
|
+
};
|
75
|
+
object: (options: Record<string, any>) => import("../conditionals/conditionals").JSONSchema;
|
72
76
|
};
|
73
77
|
//# sourceMappingURL=field.d.ts.map
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { Scope } from '../scopes';
|
2
2
|
import { ActionType } from './ActionType';
|
3
|
+
import { EventStatus } from './EventMetadata';
|
3
4
|
export declare const CONFIG_GET_ALLOWED_SCOPES: ["record.declare-birth", "record.read", "record.declaration-submit-incomplete", "record.declaration-submit-for-review", "record.register", "record.export-records", "config", "config.update:all"];
|
4
5
|
export declare const CONFIG_SEARCH_ALLOWED_SCOPES: ("search.birth:my-jurisdiction" | "search.birth" | "search.death:my-jurisdiction" | "search.death" | "search.marriage:my-jurisdiction" | "search.marriage")[];
|
5
6
|
export declare const ACTION_ALLOWED_SCOPES: {
|
@@ -40,6 +41,11 @@ export declare const ACTION_ALLOWED_CONFIGURABLE_SCOPES: {
|
|
40
41
|
UNASSIGN: never[];
|
41
42
|
DETECT_DUPLICATE: never[];
|
42
43
|
};
|
44
|
+
export declare const WRITE_ACTION_SCOPES: ("record.declare-birth" | "record.declaration-submit-for-approval" | "record.register" | "record.registration-print&issue-certified-copies")[];
|
43
45
|
export declare function hasAnyOfScopes(a: Scope[], b: Scope[]): boolean;
|
44
46
|
export declare function filterUnallowedActions(actions: ActionType[], userScopes: Scope[]): ActionType[];
|
47
|
+
/**
|
48
|
+
* Actions that can be performed on an event based on its status and user scope.
|
49
|
+
*/
|
50
|
+
export declare function getUserActionsByStatus(status: EventStatus, assignmentActions: ActionType[], userScopes: Scope[]): ActionType[];
|
45
51
|
//# sourceMappingURL=scopes.d.ts.map
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { ActionDocument,
|
2
|
-
import { ArchiveActionInput, AssignActionInput, DeclareActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnassignActionInput, ValidateActionInput } from './ActionInput';
|
1
|
+
import { ActionDocument, EventState } from './ActionDocument';
|
2
|
+
import { ArchiveActionInput, AssignActionInput, DeclareActionInput, NotifyActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnassignActionInput, ValidateActionInput } from './ActionInput';
|
3
3
|
import { ActionType } from './ActionType';
|
4
4
|
import { Draft } from './Draft';
|
5
5
|
import { EventConfig } from './EventConfig';
|
@@ -7,10 +7,27 @@ import { EventDocument } from './EventDocument';
|
|
7
7
|
import { EventIndex } from './EventIndex';
|
8
8
|
import { EventInput } from './EventInput';
|
9
9
|
import { TranslationConfig } from './TranslationConfig';
|
10
|
+
import { FieldConfig } from './FieldConfig';
|
10
11
|
import { WorkqueueConfig } from './WorkqueueConfig';
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
import { FieldValue } from './FieldValue';
|
13
|
+
import { z } from 'zod';
|
14
|
+
/**
|
15
|
+
* In real application, the roles are defined in the countryconfig.
|
16
|
+
* These are just for testing purposes to generate realistic mock data.
|
17
|
+
*/
|
18
|
+
export declare const TestUserRole: z.ZodEnum<["FIELD_AGENT", "LOCAL_REGISTRAR", "LOCAL_SYSTEM_ADMIN", "NATIONAL_REGISTRAR", "REGISTRATION_AGENT"]>;
|
19
|
+
export type TestUserRole = z.infer<typeof TestUserRole>;
|
20
|
+
export declare function generateRandomName(rng: () => number): {
|
21
|
+
firstname: string;
|
22
|
+
surname: string;
|
23
|
+
};
|
24
|
+
/**
|
25
|
+
* Quick-and-dirty mock data generator for event actions.
|
26
|
+
*/
|
27
|
+
export declare function mapFieldTypeToMockValue(field: FieldConfig, i: number, rng: () => number): FieldValue;
|
28
|
+
export declare function generateActionDeclarationInput(configuration: EventConfig, action: ActionType, rng: () => number): EventState;
|
29
|
+
export declare function generateActionAnnotationInput(configuration: EventConfig, action: ActionType, rng: () => number): {};
|
30
|
+
export declare function eventPayloadGenerator(rng: () => number): {
|
14
31
|
create: (input?: Partial<EventInput>) => {
|
15
32
|
transactionId: string;
|
16
33
|
type: string;
|
@@ -25,8 +42,7 @@ export declare const eventPayloadGenerator: {
|
|
25
42
|
actionType: ActionType;
|
26
43
|
}, input?: Partial<Draft>) => Draft;
|
27
44
|
actions: {
|
28
|
-
declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "declaration" | "annotation">>) => {
|
29
|
-
type: "DECLARE";
|
45
|
+
declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
|
30
46
|
transactionId: string;
|
31
47
|
declaration: Record<string, string | number | boolean | {
|
32
48
|
type: string;
|
@@ -43,6 +59,10 @@ export declare const eventPayloadGenerator: {
|
|
43
59
|
residentialArea?: string | null | undefined;
|
44
60
|
street?: string | null | undefined;
|
45
61
|
zipCode?: string | null | undefined;
|
62
|
+
} | {
|
63
|
+
firstname: string;
|
64
|
+
surname: string;
|
65
|
+
middlename?: string | null | undefined;
|
46
66
|
} | {
|
47
67
|
country: string;
|
48
68
|
district: string;
|
@@ -65,20 +85,19 @@ export declare const eventPayloadGenerator: {
|
|
65
85
|
option: string;
|
66
86
|
filename: string;
|
67
87
|
originalFilename: string;
|
68
|
-
}[] | [string, string] | undefined>;
|
88
|
+
}[] | [string, string] | null | undefined>;
|
69
89
|
annotation: {};
|
90
|
+
keepAssignment?: boolean | undefined;
|
91
|
+
type: "DECLARE";
|
70
92
|
eventId: string;
|
71
93
|
};
|
72
94
|
/**
|
73
95
|
* Notify allows sending incomplete data. Think it as 'partial declare' for now.
|
74
96
|
*/
|
75
|
-
notify: (eventId: string, input?: {
|
76
|
-
transactionId?: string;
|
77
|
-
declaration?: Partial<ActionUpdate>;
|
78
|
-
}) => {
|
97
|
+
notify: (eventId: string, input?: Partial<Pick<NotifyActionInput, "transactionId" | "declaration" | "keepAssignment">>) => {
|
79
98
|
type: "NOTIFY";
|
80
99
|
transactionId: string;
|
81
|
-
declaration:
|
100
|
+
declaration: Record<string, string | number | boolean | {
|
82
101
|
type: string;
|
83
102
|
filename: string;
|
84
103
|
originalFilename: string;
|
@@ -93,6 +112,10 @@ export declare const eventPayloadGenerator: {
|
|
93
112
|
residentialArea?: string | null | undefined;
|
94
113
|
street?: string | null | undefined;
|
95
114
|
zipCode?: string | null | undefined;
|
115
|
+
} | {
|
116
|
+
firstname: string;
|
117
|
+
surname: string;
|
118
|
+
middlename?: string | null | undefined;
|
96
119
|
} | {
|
97
120
|
country: string;
|
98
121
|
district: string;
|
@@ -115,11 +138,11 @@ export declare const eventPayloadGenerator: {
|
|
115
138
|
option: string;
|
116
139
|
filename: string;
|
117
140
|
originalFilename: string;
|
118
|
-
}[] | [string, string] | undefined
|
141
|
+
}[] | [string, string] | null | undefined>;
|
119
142
|
eventId: string;
|
143
|
+
keepAssignment: boolean | undefined;
|
120
144
|
};
|
121
|
-
validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "declaration" | "annotation">>) => {
|
122
|
-
type: "VALIDATE";
|
145
|
+
validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
|
123
146
|
transactionId: string;
|
124
147
|
declaration: Record<string, string | number | boolean | {
|
125
148
|
type: string;
|
@@ -136,6 +159,10 @@ export declare const eventPayloadGenerator: {
|
|
136
159
|
residentialArea?: string | null | undefined;
|
137
160
|
street?: string | null | undefined;
|
138
161
|
zipCode?: string | null | undefined;
|
162
|
+
} | {
|
163
|
+
firstname: string;
|
164
|
+
surname: string;
|
165
|
+
middlename?: string | null | undefined;
|
139
166
|
} | {
|
140
167
|
country: string;
|
141
168
|
district: string;
|
@@ -158,8 +185,10 @@ export declare const eventPayloadGenerator: {
|
|
158
185
|
option: string;
|
159
186
|
filename: string;
|
160
187
|
originalFilename: string;
|
161
|
-
}[] | [string, string] | undefined>;
|
188
|
+
}[] | [string, string] | null | undefined>;
|
162
189
|
annotation: {};
|
190
|
+
keepAssignment?: boolean | undefined;
|
191
|
+
type: "VALIDATE";
|
163
192
|
duplicates: never[];
|
164
193
|
eventId: string;
|
165
194
|
};
|
@@ -177,10 +206,52 @@ export declare const eventPayloadGenerator: {
|
|
177
206
|
assignedTo: null;
|
178
207
|
eventId: string;
|
179
208
|
};
|
180
|
-
archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "declaration">>, isDuplicate?: boolean) => {
|
181
|
-
type: "ARCHIVE";
|
209
|
+
archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "declaration" | "keepAssignment">>, isDuplicate?: boolean) => {
|
182
210
|
transactionId: string;
|
183
|
-
declaration: {
|
211
|
+
declaration: Record<string, string | number | boolean | {
|
212
|
+
type: string;
|
213
|
+
filename: string;
|
214
|
+
originalFilename: string;
|
215
|
+
} | {
|
216
|
+
country: string;
|
217
|
+
district: string;
|
218
|
+
addressType: "DOMESTIC";
|
219
|
+
province: string;
|
220
|
+
urbanOrRural: "URBAN";
|
221
|
+
number?: string | null | undefined;
|
222
|
+
town?: string | null | undefined;
|
223
|
+
residentialArea?: string | null | undefined;
|
224
|
+
street?: string | null | undefined;
|
225
|
+
zipCode?: string | null | undefined;
|
226
|
+
} | {
|
227
|
+
firstname: string;
|
228
|
+
surname: string;
|
229
|
+
middlename?: string | null | undefined;
|
230
|
+
} | {
|
231
|
+
country: string;
|
232
|
+
district: string;
|
233
|
+
addressType: "DOMESTIC";
|
234
|
+
province: string;
|
235
|
+
urbanOrRural: "RURAL";
|
236
|
+
village?: 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;
|
247
|
+
} | {
|
248
|
+
type: string;
|
249
|
+
option: string;
|
250
|
+
filename: string;
|
251
|
+
originalFilename: string;
|
252
|
+
}[] | [string, string] | null | undefined>;
|
253
|
+
keepAssignment?: boolean | undefined;
|
254
|
+
type: "ARCHIVE";
|
184
255
|
annotation: {};
|
185
256
|
duplicates: never[];
|
186
257
|
eventId: string;
|
@@ -189,19 +260,19 @@ export declare const eventPayloadGenerator: {
|
|
189
260
|
isDuplicate: boolean;
|
190
261
|
};
|
191
262
|
};
|
192
|
-
reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation">>) => {
|
193
|
-
type: "REJECT";
|
263
|
+
reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
|
194
264
|
transactionId: string;
|
195
|
-
declaration: {};
|
196
265
|
annotation: {};
|
266
|
+
keepAssignment?: boolean | undefined;
|
267
|
+
type: "REJECT";
|
268
|
+
declaration: {};
|
197
269
|
duplicates: never[];
|
198
270
|
eventId: string;
|
199
271
|
reason: {
|
200
272
|
message: string;
|
201
273
|
};
|
202
274
|
};
|
203
|
-
register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation">>) => {
|
204
|
-
type: "REGISTER";
|
275
|
+
register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
|
205
276
|
transactionId: string;
|
206
277
|
declaration: Record<string, string | number | boolean | {
|
207
278
|
type: string;
|
@@ -218,6 +289,10 @@ export declare const eventPayloadGenerator: {
|
|
218
289
|
residentialArea?: string | null | undefined;
|
219
290
|
street?: string | null | undefined;
|
220
291
|
zipCode?: string | null | undefined;
|
292
|
+
} | {
|
293
|
+
firstname: string;
|
294
|
+
surname: string;
|
295
|
+
middlename?: string | null | undefined;
|
221
296
|
} | {
|
222
297
|
country: string;
|
223
298
|
district: string;
|
@@ -240,19 +315,22 @@ export declare const eventPayloadGenerator: {
|
|
240
315
|
option: string;
|
241
316
|
filename: string;
|
242
317
|
originalFilename: string;
|
243
|
-
}[] | [string, string] | undefined>;
|
318
|
+
}[] | [string, string] | null | undefined>;
|
244
319
|
annotation: {};
|
320
|
+
keepAssignment?: boolean | undefined;
|
321
|
+
type: "REGISTER";
|
245
322
|
eventId: string;
|
246
323
|
};
|
247
|
-
printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "annotation">>) => {
|
248
|
-
type: "PRINT_CERTIFICATE";
|
324
|
+
printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
|
249
325
|
transactionId: string;
|
250
|
-
declaration: {};
|
251
326
|
annotation: {};
|
327
|
+
keepAssignment?: boolean | undefined;
|
328
|
+
type: "PRINT_CERTIFICATE";
|
329
|
+
declaration: {};
|
252
330
|
eventId: string;
|
253
331
|
};
|
254
332
|
correction: {
|
255
|
-
request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "declaration" | "annotation">>) => {
|
333
|
+
request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
|
256
334
|
type: "REQUEST_CORRECTION";
|
257
335
|
transactionId: string;
|
258
336
|
declaration: Record<string, string | number | boolean | {
|
@@ -270,6 +348,10 @@ export declare const eventPayloadGenerator: {
|
|
270
348
|
residentialArea?: string | null | undefined;
|
271
349
|
street?: string | null | undefined;
|
272
350
|
zipCode?: string | null | undefined;
|
351
|
+
} | {
|
352
|
+
firstname: string;
|
353
|
+
surname: string;
|
354
|
+
middlename?: string | null | undefined;
|
273
355
|
} | {
|
274
356
|
country: string;
|
275
357
|
district: string;
|
@@ -292,47 +374,64 @@ export declare const eventPayloadGenerator: {
|
|
292
374
|
option: string;
|
293
375
|
filename: string;
|
294
376
|
originalFilename: string;
|
295
|
-
}[] | [string, string] | undefined>;
|
377
|
+
}[] | [string, string] | null | undefined>;
|
296
378
|
annotation: {};
|
297
379
|
eventId: string;
|
380
|
+
keepAssignment: boolean | undefined;
|
298
381
|
};
|
299
|
-
approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
|
382
|
+
approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
|
300
383
|
type: "APPROVE_CORRECTION";
|
301
384
|
transactionId: string;
|
302
385
|
declaration: {};
|
303
386
|
annotation: {};
|
304
387
|
eventId: string;
|
305
388
|
requestId: string;
|
389
|
+
keepAssignment: boolean | undefined;
|
306
390
|
};
|
307
|
-
reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
|
391
|
+
reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation" | "keepAssignment">>) => {
|
308
392
|
type: "REJECT_CORRECTION";
|
309
393
|
transactionId: string;
|
310
394
|
declaration: {};
|
311
395
|
annotation: {};
|
312
396
|
eventId: string;
|
313
397
|
requestId: string;
|
398
|
+
keepAssignment: boolean | undefined;
|
314
399
|
};
|
315
400
|
};
|
316
401
|
};
|
317
402
|
};
|
318
|
-
export declare function generateActionDocument({ configuration, action, defaults }: {
|
403
|
+
export declare function generateActionDocument({ configuration, action, rng, defaults }: {
|
319
404
|
configuration: EventConfig;
|
320
405
|
action: ActionType;
|
406
|
+
rng?: () => number;
|
321
407
|
defaults?: Partial<ActionDocument>;
|
408
|
+
user?: Partial<{
|
409
|
+
signature: string;
|
410
|
+
primaryOfficeId: string;
|
411
|
+
role: TestUserRole;
|
412
|
+
id: string;
|
413
|
+
}>;
|
322
414
|
}): ActionDocument;
|
323
|
-
export declare function generateEventDocument({ configuration, actions }: {
|
415
|
+
export declare function generateEventDocument({ configuration, actions, rng }: {
|
324
416
|
configuration: EventConfig;
|
325
417
|
actions: ActionType[];
|
418
|
+
rng?: () => number;
|
326
419
|
}): EventDocument;
|
327
|
-
export declare function generateEventDraftDocument(eventId
|
420
|
+
export declare function generateEventDraftDocument({ eventId, actionType, rng, declaration }: {
|
421
|
+
eventId: string;
|
422
|
+
actionType: ActionType;
|
423
|
+
rng?: () => number;
|
424
|
+
declaration?: EventState;
|
425
|
+
}): Draft;
|
328
426
|
export declare function getRandomDatetime(rng: () => number, start: Date, end: Date): string;
|
427
|
+
export declare function getRandomDate(rng: () => number, start: string, end: string): string;
|
329
428
|
/**
|
330
429
|
* Useful for testing when we need deterministic outcome.
|
331
430
|
* @param seed - Seed value for the pseudo-random number generator
|
332
431
|
*
|
333
|
-
* @returns A function that generates pseudo-random numbers between 0 and 1
|
432
|
+
* @returns A function that generates pseudo-random numbers between 0 and 1 [0, 1)
|
334
433
|
*/
|
335
|
-
export declare function
|
434
|
+
export declare function createPrng(seed: number): () => number;
|
336
435
|
export declare function generateRandomSignature(rng: () => number): string;
|
337
436
|
export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>, seed?: number) => EventIndex;
|
338
437
|
export declare const generateTranslationConfig: (message: string) => TranslationConfig;
|