@opencrvs/toolkit 1.8.0-rc.fec1d5d → 1.8.0-rc.fef0fdd
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 +851 -10142
- package/dist/commons/events/ActionDocument.d.ts +486 -387
- package/dist/commons/events/ActionInput.d.ts +126 -126
- package/dist/commons/events/ActionType.d.ts +2 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +204 -0
- package/dist/commons/events/CountryConfigQueryInput.d.ts +254 -168
- package/dist/commons/events/CreatedAtLocation.d.ts +1 -2
- package/dist/commons/events/Draft.d.ts +28 -23
- package/dist/commons/events/EventConfig.d.ts +132 -0
- package/dist/commons/events/EventDocument.d.ts +350 -275
- package/dist/commons/events/EventIndex.d.ts +572 -146
- package/dist/commons/events/EventMetadata.d.ts +59 -26
- package/dist/commons/events/FieldConfig.d.ts +19 -0
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +11 -11
- package/dist/commons/events/WorkqueueConfig.d.ts +1937 -459
- package/dist/commons/events/defineConfig.d.ts +8 -0
- package/dist/commons/events/field.d.ts +5 -0
- package/dist/commons/events/index.d.ts +1 -0
- package/dist/commons/events/scopes.d.ts +1 -2
- package/dist/commons/events/test.utils.d.ts +28 -5
- package/dist/commons/events/transactions.d.ts +1 -1
- package/dist/commons/events/utils.d.ts +16 -6
- package/dist/events/index.js +880 -567
- package/dist/scopes/index.d.ts +4 -1
- package/dist/scopes/index.js +67 -17
- package/package.json +3 -3
@@ -9455,6 +9455,10 @@ export declare const defineConfig: (config: EventConfigInput) => {
|
|
9455
9455
|
conditional: import(".").JSONSchema;
|
9456
9456
|
})[] | undefined;
|
9457
9457
|
searchCriteriaLabelPrefix?: import("./TranslationConfig").TranslationConfig | undefined;
|
9458
|
+
validations?: {
|
9459
|
+
message: import("./TranslationConfig").TranslationConfig;
|
9460
|
+
validator: import(".").JSONSchema;
|
9461
|
+
}[] | undefined;
|
9458
9462
|
} | {
|
9459
9463
|
config: {
|
9460
9464
|
type: "exact" | "fuzzy" | "range";
|
@@ -9476,6 +9480,10 @@ export declare const defineConfig: (config: EventConfigInput) => {
|
|
9476
9480
|
conditional: import(".").JSONSchema;
|
9477
9481
|
})[] | undefined;
|
9478
9482
|
searchCriteriaLabelPrefix?: import("./TranslationConfig").TranslationConfig | undefined;
|
9483
|
+
validations?: {
|
9484
|
+
message: import("./TranslationConfig").TranslationConfig;
|
9485
|
+
validator: import(".").JSONSchema;
|
9486
|
+
}[] | undefined;
|
9479
9487
|
})[];
|
9480
9488
|
}[];
|
9481
9489
|
dateOfEvent?: {
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { FieldConditional } from './Conditional';
|
2
2
|
import { TranslationConfig } from './TranslationConfig';
|
3
|
+
import { ValidationConfig } from './FieldConfig';
|
3
4
|
/**
|
4
5
|
* Entry point for defining conditional logic or configuration for a form field.
|
5
6
|
* @param fieldId - The ID of the field to define rules or config for.
|
@@ -7,10 +8,12 @@ import { TranslationConfig } from './TranslationConfig';
|
|
7
8
|
*/
|
8
9
|
export declare function field(fieldId: string, options?: {
|
9
10
|
conditionals?: FieldConditional[];
|
11
|
+
validations?: ValidationConfig[];
|
10
12
|
searchCriteriaLabelPrefix?: TranslationConfig;
|
11
13
|
}): {
|
12
14
|
range: () => {
|
13
15
|
conditionals?: FieldConditional[];
|
16
|
+
validations?: ValidationConfig[];
|
14
17
|
searchCriteriaLabelPrefix?: TranslationConfig;
|
15
18
|
fieldId: string;
|
16
19
|
fieldType: "field";
|
@@ -21,6 +24,7 @@ export declare function field(fieldId: string, options?: {
|
|
21
24
|
};
|
22
25
|
exact: () => {
|
23
26
|
conditionals?: FieldConditional[];
|
27
|
+
validations?: ValidationConfig[];
|
24
28
|
searchCriteriaLabelPrefix?: TranslationConfig;
|
25
29
|
fieldId: string;
|
26
30
|
fieldType: "field";
|
@@ -31,6 +35,7 @@ export declare function field(fieldId: string, options?: {
|
|
31
35
|
};
|
32
36
|
fuzzy: () => {
|
33
37
|
conditionals?: FieldConditional[];
|
38
|
+
validations?: ValidationConfig[];
|
34
39
|
searchCriteriaLabelPrefix?: TranslationConfig;
|
35
40
|
fieldId: string;
|
36
41
|
fieldType: "field";
|
@@ -35,6 +35,7 @@ export * from './test.utils';
|
|
35
35
|
export * from './TemplateConfig';
|
36
36
|
export * from './scopes';
|
37
37
|
export * from './serializer';
|
38
|
+
export * from './state/availableActions';
|
38
39
|
export * from '../conditionals/conditionals';
|
39
40
|
export * from '../conditionals/validate';
|
40
41
|
export * from './field';
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import { Scope } from '../scopes';
|
2
|
-
import { ActionType } from './ActionType';
|
3
2
|
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
3
|
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
4
|
export declare const ACTION_ALLOWED_SCOPES: {
|
@@ -40,6 +39,6 @@ export declare const ACTION_ALLOWED_CONFIGURABLE_SCOPES: {
|
|
40
39
|
UNASSIGN: never[];
|
41
40
|
DETECT_DUPLICATE: never[];
|
42
41
|
};
|
42
|
+
export declare const WRITE_ACTION_SCOPES: ("record.declare-birth" | "record.declaration-submit-for-approval" | "record.register" | "record.registration-print&issue-certified-copies")[];
|
43
43
|
export declare function hasAnyOfScopes(a: Scope[], b: Scope[]): boolean;
|
44
|
-
export declare function filterUnallowedActions(actions: ActionType[], userScopes: Scope[]): ActionType[];
|
45
44
|
//# sourceMappingURL=scopes.d.ts.map
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { UUID } from '../uuid';
|
1
2
|
import { ActionDocument, EventState } from './ActionDocument';
|
2
3
|
import { ArchiveActionInput, AssignActionInput, DeclareActionInput, NotifyActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnassignActionInput, ValidateActionInput } from './ActionInput';
|
3
4
|
import { ActionType } from './ActionType';
|
@@ -10,6 +11,13 @@ import { TranslationConfig } from './TranslationConfig';
|
|
10
11
|
import { FieldConfig } from './FieldConfig';
|
11
12
|
import { WorkqueueConfig } from './WorkqueueConfig';
|
12
13
|
import { FieldValue } from './FieldValue';
|
14
|
+
import { z } from 'zod';
|
15
|
+
/**
|
16
|
+
* In real application, the roles are defined in the countryconfig.
|
17
|
+
* These are just for testing purposes to generate realistic mock data.
|
18
|
+
*/
|
19
|
+
export declare const TestUserRole: z.ZodEnum<["FIELD_AGENT", "LOCAL_REGISTRAR", "LOCAL_SYSTEM_ADMIN", "NATIONAL_REGISTRAR", "REGISTRATION_AGENT"]>;
|
20
|
+
export type TestUserRole = z.infer<typeof TestUserRole>;
|
13
21
|
export declare function generateRandomName(rng: () => number): {
|
14
22
|
firstname: string;
|
15
23
|
surname: string;
|
@@ -31,7 +39,7 @@ export declare function eventPayloadGenerator(rng: () => number): {
|
|
31
39
|
id: string;
|
32
40
|
};
|
33
41
|
draft: ({ eventId, actionType }: {
|
34
|
-
eventId:
|
42
|
+
eventId: UUID;
|
35
43
|
actionType: ActionType;
|
36
44
|
}, input?: Partial<Draft>) => Draft;
|
37
45
|
actions: {
|
@@ -265,7 +273,7 @@ export declare function eventPayloadGenerator(rng: () => number): {
|
|
265
273
|
message: string;
|
266
274
|
};
|
267
275
|
};
|
268
|
-
register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
|
276
|
+
register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment" | "registrationNumber">>) => {
|
269
277
|
transactionId: string;
|
270
278
|
declaration: Record<string, string | number | boolean | {
|
271
279
|
type: string;
|
@@ -310,6 +318,7 @@ export declare function eventPayloadGenerator(rng: () => number): {
|
|
310
318
|
originalFilename: string;
|
311
319
|
}[] | [string, string] | null | undefined>;
|
312
320
|
annotation: {};
|
321
|
+
registrationNumber?: string | undefined;
|
313
322
|
keepAssignment?: boolean | undefined;
|
314
323
|
type: "REGISTER";
|
315
324
|
eventId: string;
|
@@ -393,19 +402,31 @@ export declare function eventPayloadGenerator(rng: () => number): {
|
|
393
402
|
};
|
394
403
|
};
|
395
404
|
};
|
396
|
-
export declare function generateActionDocument({ configuration, action, rng, defaults }: {
|
405
|
+
export declare function generateActionDocument({ configuration, action, rng, defaults, user }: {
|
397
406
|
configuration: EventConfig;
|
398
407
|
action: ActionType;
|
399
408
|
rng?: () => number;
|
400
409
|
defaults?: Partial<ActionDocument>;
|
410
|
+
user?: Partial<{
|
411
|
+
signature: string;
|
412
|
+
primaryOfficeId: UUID;
|
413
|
+
role: TestUserRole;
|
414
|
+
id: string;
|
415
|
+
}>;
|
401
416
|
}): ActionDocument;
|
402
|
-
export declare function generateEventDocument({ configuration, actions, rng }: {
|
417
|
+
export declare function generateEventDocument({ configuration, actions, rng, user }: {
|
403
418
|
configuration: EventConfig;
|
404
419
|
actions: ActionType[];
|
405
420
|
rng?: () => number;
|
421
|
+
user?: Partial<{
|
422
|
+
signature: string;
|
423
|
+
primaryOfficeId: UUID;
|
424
|
+
role: TestUserRole;
|
425
|
+
id: string;
|
426
|
+
}>;
|
406
427
|
}): EventDocument;
|
407
428
|
export declare function generateEventDraftDocument({ eventId, actionType, rng, declaration }: {
|
408
|
-
eventId:
|
429
|
+
eventId: UUID;
|
409
430
|
actionType: ActionType;
|
410
431
|
rng?: () => number;
|
411
432
|
declaration?: EventState;
|
@@ -419,6 +440,8 @@ export declare function getRandomDate(rng: () => number, start: string, end: str
|
|
419
440
|
* @returns A function that generates pseudo-random numbers between 0 and 1 [0, 1)
|
420
441
|
*/
|
421
442
|
export declare function createPrng(seed: number): () => number;
|
443
|
+
export declare function generateUuid(rng?: () => number): UUID;
|
444
|
+
export declare function generateRegistrationNumber(rng: () => number): string;
|
422
445
|
export declare function generateRandomSignature(rng: () => number): string;
|
423
446
|
export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>, seed?: number) => EventIndex;
|
424
447
|
export declare const generateTranslationConfig: (message: string) => TranslationConfig;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
export declare function generateTransactionId(): import("
|
1
|
+
export declare function generateTransactionId(): string & import("zod").BRAND<"UUID">;
|
2
2
|
//# sourceMappingURL=transactions.d.ts.map
|
@@ -5,6 +5,7 @@ import { Action, ActionUpdate, EventState } from './ActionDocument';
|
|
5
5
|
import { PageConfig, VerificationPageConfig } from './PageConfig';
|
6
6
|
import { Draft } from './Draft';
|
7
7
|
import { EventDocument } from './EventDocument';
|
8
|
+
import { UUID } from '../uuid';
|
8
9
|
import { ActionConfig } from './ActionConfig';
|
9
10
|
import { FormConfig } from './FormConfig';
|
10
11
|
export declare function getDeclarationFields(configuration: EventConfig): FieldConfig[];
|
@@ -4251,14 +4252,15 @@ export declare function omitHiddenPaginatedFields(formConfig: FormConfig, declar
|
|
4251
4252
|
originalFilename: string;
|
4252
4253
|
}[] | [string, string] | null | undefined>>;
|
4253
4254
|
export declare function findActiveDrafts(event: EventDocument, drafts: Draft[]): {
|
4254
|
-
id: string
|
4255
|
+
id: string & import("zod").BRAND<"UUID">;
|
4255
4256
|
transactionId: string;
|
4256
4257
|
createdAt: string;
|
4257
|
-
eventId: string
|
4258
|
+
eventId: string & import("zod").BRAND<"UUID">;
|
4258
4259
|
action: {
|
4259
4260
|
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";
|
4260
4261
|
status: "Rejected" | "Requested" | "Accepted";
|
4261
4262
|
transactionId: string;
|
4263
|
+
createdByUserType: "system" | "user";
|
4262
4264
|
createdAt: string;
|
4263
4265
|
createdBy: string;
|
4264
4266
|
createdByRole: string;
|
@@ -4305,7 +4307,7 @@ export declare function findActiveDrafts(event: EventDocument, drafts: Draft[]):
|
|
4305
4307
|
originalFilename: string;
|
4306
4308
|
}[] | [string, string] | null | undefined>;
|
4307
4309
|
createdBySignature?: string | null | undefined;
|
4308
|
-
createdAtLocation?: string | null | undefined;
|
4310
|
+
createdAtLocation?: (string & import("zod").BRAND<"UUID">) | null | undefined;
|
4309
4311
|
annotation?: Record<string, string | number | boolean | {
|
4310
4312
|
type: string;
|
4311
4313
|
filename: string;
|
@@ -4347,11 +4349,11 @@ export declare function findActiveDrafts(event: EventDocument, drafts: Draft[]):
|
|
4347
4349
|
option: string;
|
4348
4350
|
filename: string;
|
4349
4351
|
originalFilename: string;
|
4350
|
-
}[] | [string, string] | null | undefined> | undefined;
|
4351
|
-
originalActionId?: string | undefined;
|
4352
|
+
}[] | [string, string] | null | undefined> | null | undefined;
|
4353
|
+
originalActionId?: (string & import("zod").BRAND<"UUID">) | null | undefined;
|
4352
4354
|
};
|
4353
4355
|
}[];
|
4354
|
-
export declare function createEmptyDraft(eventId:
|
4356
|
+
export declare function createEmptyDraft(eventId: UUID, draftId: UUID, actionType: ActionType): Draft;
|
4355
4357
|
export declare function isVerificationPage(page: PageConfig): page is VerificationPageConfig;
|
4356
4358
|
export declare function getVisibleVerificationPageIds(pages: PageConfig[], annotation: ActionUpdate): string[];
|
4357
4359
|
export declare function getActionVerificationPageIds(actionConfig: ActionConfig, annotation: ActionUpdate): string[];
|
@@ -13905,6 +13907,10 @@ export declare function getEventConfigById(eventConfigs: EventConfig[], id: stri
|
|
13905
13907
|
conditional: import(".").JSONSchema;
|
13906
13908
|
})[] | undefined;
|
13907
13909
|
searchCriteriaLabelPrefix?: import("./TranslationConfig").TranslationConfig | undefined;
|
13910
|
+
validations?: {
|
13911
|
+
message: import("./TranslationConfig").TranslationConfig;
|
13912
|
+
validator: import(".").JSONSchema;
|
13913
|
+
}[] | undefined;
|
13908
13914
|
} | {
|
13909
13915
|
config: {
|
13910
13916
|
type: "exact" | "fuzzy" | "range";
|
@@ -13926,6 +13932,10 @@ export declare function getEventConfigById(eventConfigs: EventConfig[], id: stri
|
|
13926
13932
|
conditional: import(".").JSONSchema;
|
13927
13933
|
})[] | undefined;
|
13928
13934
|
searchCriteriaLabelPrefix?: import("./TranslationConfig").TranslationConfig | undefined;
|
13935
|
+
validations?: {
|
13936
|
+
message: import("./TranslationConfig").TranslationConfig;
|
13937
|
+
validator: import(".").JSONSchema;
|
13938
|
+
}[] | undefined;
|
13929
13939
|
})[];
|
13930
13940
|
}[];
|
13931
13941
|
dateOfEvent?: {
|