@opencrvs/toolkit 1.8.0-rc.f876361 → 1.8.0-rc.f881988
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 +7334 -1430
- package/dist/commons/conditionals/conditionals.d.ts +23 -13
- package/dist/commons/conditionals/validate.d.ts +12 -17
- package/dist/commons/events/ActionConfig.d.ts +86380 -1682
- package/dist/commons/events/ActionDocument.d.ts +420 -103
- package/dist/commons/events/ActionInput.d.ts +1135 -232
- package/dist/commons/events/ActionType.d.ts +5 -3
- package/dist/commons/events/AdvancedSearchConfig.d.ts +371 -25
- package/dist/commons/events/CompositeFieldValue.d.ts +3 -0
- package/dist/commons/events/Conditional.d.ts +21 -5
- package/dist/commons/events/Draft.d.ts +37 -15
- package/dist/commons/events/EventConfig.d.ts +41061 -1337
- package/dist/commons/events/EventDocument.d.ts +334 -77
- package/dist/commons/events/EventIndex.d.ts +915 -4
- package/dist/commons/events/EventInput.d.ts +13 -0
- package/dist/commons/events/EventMetadata.d.ts +13 -3
- package/dist/commons/events/FieldConfig.d.ts +3628 -745
- package/dist/commons/events/FieldType.d.ts +1 -2
- package/dist/commons/events/FieldValue.d.ts +1 -1
- package/dist/commons/events/FormConfig.d.ts +38845 -517
- package/dist/commons/events/PageConfig.d.ts +9655 -211
- package/dist/commons/events/SummaryConfig.d.ts +81 -42
- package/dist/commons/events/TemplateConfig.d.ts +5 -5
- 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 +6681 -31
- 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 +3 -0
- package/dist/commons/events/scopes.d.ts +26 -0
- package/dist/commons/events/test.utils.d.ts +20 -149
- package/dist/commons/events/utils.d.ts +3417 -97
- package/dist/commons/events/utils.test.d.ts +2 -0
- package/dist/conditionals/index.js +164 -181
- package/dist/events/index.js +1336 -889
- package/package.json +3 -2
@@ -0,0 +1,25 @@
|
|
1
|
+
import { EventFieldId } from './AdvancedSearchConfig';
|
2
|
+
import { SelectOption } from './FieldConfig';
|
3
|
+
/**
|
4
|
+
* Creates a function that acts like a callable + static method container.
|
5
|
+
*
|
6
|
+
* @example
|
7
|
+
* event('status') // → returns search config
|
8
|
+
* event.hasAction('CLICKED') // → returns conditional
|
9
|
+
*/
|
10
|
+
declare function eventFn(fieldId: EventFieldId, options?: SelectOption[]): {
|
11
|
+
fieldId: "status" | "trackingId";
|
12
|
+
options: {
|
13
|
+
value: string;
|
14
|
+
label: import("./TranslationConfig").TranslationConfig;
|
15
|
+
}[] | undefined;
|
16
|
+
config: {
|
17
|
+
type: "EXACT";
|
18
|
+
};
|
19
|
+
fieldType: "event";
|
20
|
+
};
|
21
|
+
declare const event: typeof eventFn & {
|
22
|
+
hasAction: (action: import("./ActionType").ActionType) => import("../conditionals/conditionals").JSONSchema;
|
23
|
+
};
|
24
|
+
export { event };
|
25
|
+
//# sourceMappingURL=event.d.ts.map
|
@@ -0,0 +1,68 @@
|
|
1
|
+
/**
|
2
|
+
* Entry point for defining conditional logic or configuration for a form field.
|
3
|
+
* @param fieldId - The ID of the field to define rules or config for.
|
4
|
+
* @returns An object combining conditional methods and configuration builders.
|
5
|
+
*/
|
6
|
+
export declare function field(fieldId: string): {
|
7
|
+
range: () => {
|
8
|
+
config: {
|
9
|
+
type: "RANGE";
|
10
|
+
};
|
11
|
+
fieldId: string;
|
12
|
+
fieldType: "field";
|
13
|
+
};
|
14
|
+
exact: () => {
|
15
|
+
config: {
|
16
|
+
type: "EXACT";
|
17
|
+
};
|
18
|
+
fieldId: string;
|
19
|
+
fieldType: "field";
|
20
|
+
};
|
21
|
+
fuzzy: () => {
|
22
|
+
config: {
|
23
|
+
type: "FUZZY";
|
24
|
+
};
|
25
|
+
fieldId: string;
|
26
|
+
fieldType: "field";
|
27
|
+
};
|
28
|
+
isAfter: () => {
|
29
|
+
days: (days: number) => {
|
30
|
+
inPast: () => import("../conditionals/conditionals").JSONSchema;
|
31
|
+
inFuture: () => import("../conditionals/conditionals").JSONSchema;
|
32
|
+
};
|
33
|
+
date: (date: string | {
|
34
|
+
[key: string]: unknown;
|
35
|
+
_fieldId: string;
|
36
|
+
}) => import("../conditionals/conditionals").JSONSchema;
|
37
|
+
now: () => import("../conditionals/conditionals").JSONSchema;
|
38
|
+
};
|
39
|
+
isBefore: () => {
|
40
|
+
days: (days: number) => {
|
41
|
+
inPast: () => import("../conditionals/conditionals").JSONSchema;
|
42
|
+
inFuture: () => import("../conditionals/conditionals").JSONSchema;
|
43
|
+
};
|
44
|
+
date: (date: string | {
|
45
|
+
[key: string]: unknown;
|
46
|
+
_fieldId: string;
|
47
|
+
}) => import("../conditionals/conditionals").JSONSchema;
|
48
|
+
now: () => import("../conditionals/conditionals").JSONSchema;
|
49
|
+
};
|
50
|
+
isEqualTo: (value: string | boolean | {
|
51
|
+
[key: string]: unknown;
|
52
|
+
_fieldId: string;
|
53
|
+
}) => import("../conditionals/conditionals").JSONSchema;
|
54
|
+
isFalsy: () => import("../conditionals/conditionals").JSONSchema;
|
55
|
+
isUndefined: () => import("../conditionals/conditionals").JSONSchema;
|
56
|
+
inArray: (values: string[]) => import("../conditionals/conditionals").JSONSchema;
|
57
|
+
isValidEnglishName: () => import("../conditionals/conditionals").JSONSchema;
|
58
|
+
matches: (pattern: string) => import("../conditionals/conditionals").JSONSchema;
|
59
|
+
isBetween: (min: number, max: number) => import("../conditionals/conditionals").JSONSchema;
|
60
|
+
getId: () => {
|
61
|
+
fieldId: string;
|
62
|
+
};
|
63
|
+
/**
|
64
|
+
* @private Internal property used for field reference tracking.
|
65
|
+
*/
|
66
|
+
_fieldId: string;
|
67
|
+
};
|
68
|
+
//# sourceMappingURL=field.d.ts.map
|
@@ -30,6 +30,9 @@ export * from './Conditional';
|
|
30
30
|
export * from './AdvancedSearchConfig';
|
31
31
|
export * from './test.utils';
|
32
32
|
export * from './TemplateConfig';
|
33
|
+
export * from './scopes';
|
33
34
|
export * from '../conditionals/conditionals';
|
34
35
|
export * from '../conditionals/validate';
|
36
|
+
export * from './field';
|
37
|
+
export * from './event';
|
35
38
|
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { Scope } from '../scopes';
|
2
|
+
import { ActionType } from './ActionType';
|
3
|
+
export declare function hasAnyOfScopes(a: Scope[], b: Scope[]): boolean;
|
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"];
|
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")[];
|
6
|
+
export declare const ACTION_ALLOWED_SCOPES: {
|
7
|
+
READ: ["record.declare-birth", "record.read", "record.declaration-submit-incomplete", "record.declaration-submit-for-review", "record.register", "record.export-records"];
|
8
|
+
CREATE: ["record.declare-birth", "record.declaration-submit-incomplete", "record.declaration-submit-for-review"];
|
9
|
+
NOTIFY: ["record.declaration-submit-incomplete"];
|
10
|
+
DECLARE: ["record.declare-birth", "record.declaration-submit-for-approval", "record.register"];
|
11
|
+
DELETE: ["record.declare-birth"];
|
12
|
+
VALIDATE: ["record.declaration-submit-for-approval", "record.register"];
|
13
|
+
REGISTER: ["record.register"];
|
14
|
+
PRINT_CERTIFICATE: ["record.registration-print&issue-certified-copies"];
|
15
|
+
REQUEST_CORRECTION: ["record.registration-request-correction"];
|
16
|
+
REJECT_CORRECTION: ["record.registration-correct"];
|
17
|
+
APPROVE_CORRECTION: ["record.registration-correct"];
|
18
|
+
MARKED_AS_DUPLICATE: ["record.declaration-archive"];
|
19
|
+
ARCHIVE: ["record.declaration-archive"];
|
20
|
+
REJECT: ["record.declaration-submit-for-updates"];
|
21
|
+
ASSIGN: null;
|
22
|
+
UNASSIGN: null;
|
23
|
+
DETECT_DUPLICATE: [];
|
24
|
+
};
|
25
|
+
export declare function filterUnallowedActions(actions: ActionType[], userScopes: Scope[]): ActionType[];
|
26
|
+
//# sourceMappingURL=scopes.d.ts.map
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ActionDocument, ActionUpdate } from './ActionDocument';
|
2
|
-
import { ArchiveActionInput, DeclareActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, ValidateActionInput } from './ActionInput';
|
2
|
+
import { ArchiveActionInput, AssignActionInput, DeclareActionInput, 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';
|
@@ -8,45 +8,8 @@ import { EventIndex } from './EventIndex';
|
|
8
8
|
import { EventInput } from './EventInput';
|
9
9
|
import { FieldValue } from './FieldValue';
|
10
10
|
import { TranslationConfig } from './TranslationConfig';
|
11
|
-
export declare function
|
12
|
-
|
13
|
-
filename: string;
|
14
|
-
originalFilename: string;
|
15
|
-
} | {
|
16
|
-
country: string;
|
17
|
-
district: string;
|
18
|
-
addressType: "DOMESTIC";
|
19
|
-
province: string;
|
20
|
-
urbanOrRural: "URBAN";
|
21
|
-
number?: string | undefined;
|
22
|
-
town?: string | undefined;
|
23
|
-
residentialArea?: string | undefined;
|
24
|
-
street?: string | undefined;
|
25
|
-
zipCode?: string | undefined;
|
26
|
-
} | {
|
27
|
-
country: string;
|
28
|
-
district: string;
|
29
|
-
addressType: "DOMESTIC";
|
30
|
-
province: string;
|
31
|
-
urbanOrRural: "RURAL";
|
32
|
-
village?: string | undefined;
|
33
|
-
} | {
|
34
|
-
country: string;
|
35
|
-
state: string;
|
36
|
-
addressType: "INTERNATIONAL";
|
37
|
-
district2: string;
|
38
|
-
cityOrTown?: string | undefined;
|
39
|
-
addressLine1?: string | undefined;
|
40
|
-
addressLine2?: string | undefined;
|
41
|
-
addressLine3?: string | undefined;
|
42
|
-
postcodeOrZip?: string | undefined;
|
43
|
-
} | {
|
44
|
-
type: string;
|
45
|
-
option: string;
|
46
|
-
filename: string;
|
47
|
-
originalFilename: string;
|
48
|
-
}[] | undefined>;
|
49
|
-
export declare function generateActionMetadataInput(configuration: EventConfig, action: ActionType): {};
|
11
|
+
export declare function generateActionDeclarationInput(configuration: EventConfig, action: ActionType): Partial<import("./ActionDocument").EventState>;
|
12
|
+
export declare function generateActionAnnotationInput(configuration: EventConfig, action: ActionType): {};
|
50
13
|
export declare const eventPayloadGenerator: {
|
51
14
|
create: (input?: Partial<EventInput>) => {
|
52
15
|
transactionId: string;
|
@@ -57,116 +20,10 @@ export declare const eventPayloadGenerator: {
|
|
57
20
|
type: string;
|
58
21
|
id: string;
|
59
22
|
};
|
60
|
-
draft: (eventId
|
61
|
-
id: import("../uuid").UUID;
|
23
|
+
draft: ({ eventId, actionType }: {
|
62
24
|
eventId: string;
|
63
|
-
|
64
|
-
|
65
|
-
action: {
|
66
|
-
type: "REQUEST_CORRECTION";
|
67
|
-
declaration: {
|
68
|
-
'applicant.firstname': string;
|
69
|
-
'applicant.surname': string;
|
70
|
-
'applicant.dob': string;
|
71
|
-
'recommender.none': boolean;
|
72
|
-
};
|
73
|
-
annotation: {
|
74
|
-
'correction.requester.relationship': string;
|
75
|
-
'correction.request.reason': string;
|
76
|
-
};
|
77
|
-
createdAt: string;
|
78
|
-
createdBy: string;
|
79
|
-
createdAtLocation: string;
|
80
|
-
};
|
81
|
-
} & Partial<{
|
82
|
-
id: string;
|
83
|
-
createdAt: string;
|
84
|
-
eventId: string;
|
85
|
-
transactionId: string;
|
86
|
-
action: {
|
87
|
-
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";
|
88
|
-
createdAt: string;
|
89
|
-
createdBy: string;
|
90
|
-
declaration: Record<string, string | number | boolean | {
|
91
|
-
type: string;
|
92
|
-
filename: string;
|
93
|
-
originalFilename: string;
|
94
|
-
} | {
|
95
|
-
country: string;
|
96
|
-
district: string;
|
97
|
-
addressType: "DOMESTIC";
|
98
|
-
province: string;
|
99
|
-
urbanOrRural: "URBAN";
|
100
|
-
number?: string | null | undefined;
|
101
|
-
town?: string | null | undefined;
|
102
|
-
residentialArea?: string | null | undefined;
|
103
|
-
street?: string | null | undefined;
|
104
|
-
zipCode?: string | null | undefined;
|
105
|
-
} | {
|
106
|
-
country: string;
|
107
|
-
district: string;
|
108
|
-
addressType: "DOMESTIC";
|
109
|
-
province: string;
|
110
|
-
urbanOrRural: "RURAL";
|
111
|
-
village?: string | null | undefined;
|
112
|
-
} | {
|
113
|
-
country: string;
|
114
|
-
state: string;
|
115
|
-
addressType: "INTERNATIONAL";
|
116
|
-
district2: string;
|
117
|
-
cityOrTown?: string | null | undefined;
|
118
|
-
addressLine1?: string | null | undefined;
|
119
|
-
addressLine2?: string | null | undefined;
|
120
|
-
addressLine3?: string | null | undefined;
|
121
|
-
postcodeOrZip?: string | null | undefined;
|
122
|
-
} | {
|
123
|
-
type: string;
|
124
|
-
option: string;
|
125
|
-
filename: string;
|
126
|
-
originalFilename: string;
|
127
|
-
}[] | undefined>;
|
128
|
-
createdAtLocation: string;
|
129
|
-
annotation?: Record<string, string | number | boolean | {
|
130
|
-
type: string;
|
131
|
-
filename: string;
|
132
|
-
originalFilename: string;
|
133
|
-
} | {
|
134
|
-
country: string;
|
135
|
-
district: string;
|
136
|
-
addressType: "DOMESTIC";
|
137
|
-
province: string;
|
138
|
-
urbanOrRural: "URBAN";
|
139
|
-
number?: string | null | undefined;
|
140
|
-
town?: string | null | undefined;
|
141
|
-
residentialArea?: string | null | undefined;
|
142
|
-
street?: string | null | undefined;
|
143
|
-
zipCode?: string | null | undefined;
|
144
|
-
} | {
|
145
|
-
country: string;
|
146
|
-
district: string;
|
147
|
-
addressType: "DOMESTIC";
|
148
|
-
province: string;
|
149
|
-
urbanOrRural: "RURAL";
|
150
|
-
village?: string | null | undefined;
|
151
|
-
} | {
|
152
|
-
country: string;
|
153
|
-
state: string;
|
154
|
-
addressType: "INTERNATIONAL";
|
155
|
-
district2: string;
|
156
|
-
cityOrTown?: string | null | undefined;
|
157
|
-
addressLine1?: string | null | undefined;
|
158
|
-
addressLine2?: string | null | undefined;
|
159
|
-
addressLine3?: string | null | undefined;
|
160
|
-
postcodeOrZip?: string | null | undefined;
|
161
|
-
} | {
|
162
|
-
type: string;
|
163
|
-
option: string;
|
164
|
-
filename: string;
|
165
|
-
originalFilename: string;
|
166
|
-
}[] | undefined> | undefined;
|
167
|
-
originalActionId?: string | undefined;
|
168
|
-
};
|
169
|
-
}>;
|
25
|
+
actionType: ActionType;
|
26
|
+
}, input?: Partial<Draft>) => Draft;
|
170
27
|
actions: {
|
171
28
|
declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "declaration" | "annotation">>) => {
|
172
29
|
type: "DECLARE";
|
@@ -306,6 +163,20 @@ export declare const eventPayloadGenerator: {
|
|
306
163
|
duplicates: never[];
|
307
164
|
eventId: string;
|
308
165
|
};
|
166
|
+
assign: (eventId: string, input?: Partial<Pick<AssignActionInput, "transactionId" | "assignedTo">>) => {
|
167
|
+
type: "ASSIGN";
|
168
|
+
transactionId: string;
|
169
|
+
declaration: {};
|
170
|
+
assignedTo: string;
|
171
|
+
eventId: string;
|
172
|
+
};
|
173
|
+
unassign: (eventId: string, input?: Partial<Pick<UnassignActionInput, "transactionId">>) => {
|
174
|
+
type: "UNASSIGN";
|
175
|
+
transactionId: string;
|
176
|
+
declaration: {};
|
177
|
+
assignedTo: null;
|
178
|
+
eventId: string;
|
179
|
+
};
|
309
180
|
archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "declaration">>, isDuplicate?: boolean) => {
|
310
181
|
type: "ARCHIVE";
|
311
182
|
transactionId: string;
|