@opencrvs/toolkit 2.2.0-rc.045257f → 2.2.0-rc.19ec10b
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/build.sh +7 -2
- package/dist/application-config/index.js +16 -5
- package/dist/authentication/index.d.ts +1 -1
- package/dist/authentication/index.js +4 -8
- package/dist/cli.js +927 -356
- package/dist/commons/api/router.d.ts +17 -4
- package/dist/commons/application-config/index.d.ts +1 -1
- package/dist/commons/conditionals/conditionals.d.ts +55 -4
- package/dist/commons/conditionals/validate.d.ts +1 -1
- package/dist/commons/events/ActionStatus.d.ts +2 -2
- package/dist/commons/events/ActionType.d.ts +2 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +3 -0
- package/dist/commons/events/Draft.d.ts +34 -1
- package/dist/commons/events/EventConfig.d.ts +446 -0
- package/dist/commons/events/EventDocument.d.ts +2 -0
- package/dist/commons/events/EventIndex.d.ts +1 -0
- package/dist/commons/events/EventInput.d.ts +1 -0
- package/dist/commons/events/EventMetadata.d.ts +1 -0
- package/dist/commons/events/FieldTypeMapping.d.ts +19 -19
- package/dist/commons/events/PlainDate.d.ts +5 -0
- package/dist/commons/events/defineConfig.d.ts +7 -2
- package/dist/commons/events/event.d.ts +20 -1
- package/dist/commons/events/field.d.ts +37 -0
- package/dist/commons/events/locations.d.ts +1 -1
- package/dist/commons/events/scopes.d.ts +2 -1
- package/dist/commons/events/state/index.d.ts +1 -0
- package/dist/commons/events/test.utils.d.ts +59 -6
- package/dist/commons/events/utils.d.ts +28 -2
- package/dist/commons/users/Role.d.ts +23 -0
- package/dist/commons/users/User.d.ts +263 -0
- package/dist/commons/users/authentication.d.ts +67 -0
- package/dist/commons/users/index.d.ts +5 -0
- package/dist/commons/users/roleValidations.d.ts +15 -0
- package/dist/commons/users/scopes.d.ts +1402 -0
- package/dist/commons/users/userReferences.d.ts +176 -0
- package/dist/conditionals/index.js +13 -5
- package/dist/environment/custom-types.d.ts +1 -0
- package/dist/environment/custom-types.d.ts.map +1 -1
- package/dist/environment/derived-variables.d.ts +8 -0
- package/dist/environment/derived-variables.d.ts.map +1 -1
- package/dist/environment/derived-variables.js +9 -0
- package/dist/environment/questions.d.ts +42 -9
- package/dist/environment/questions.d.ts.map +1 -1
- package/dist/environment/questions.js +70 -47
- package/dist/environment/registry.d.ts +15 -0
- package/dist/environment/registry.d.ts.map +1 -0
- package/dist/environment/registry.js +112 -0
- package/dist/environment/setup-environment.d.ts.map +1 -1
- package/dist/environment/setup-environment.js +104 -23
- package/dist/events/index.js +1627 -1100
- package/dist/migrations/add-notify-config.d.ts +40 -0
- package/dist/migrations/add-notify-config.d.ts.map +1 -0
- package/dist/migrations/add-notify-config.js +249 -0
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +602 -143
- package/dist/migrations/move-declaration-to-declare-action.d.ts.map +1 -1
- package/dist/migrations/move-declaration-to-declare-action.js +27 -144
- package/dist/migrations/read-declaration-through-helper.d.ts.map +1 -1
- package/dist/migrations/read-declaration-through-helper.js +3 -61
- package/dist/migrations/resolve-versioned-event-config.d.ts +56 -0
- package/dist/migrations/resolve-versioned-event-config.d.ts.map +1 -0
- package/dist/migrations/resolve-versioned-event-config.js +353 -0
- package/dist/migrations/utils.d.ts +61 -0
- package/dist/migrations/utils.d.ts.map +1 -0
- package/dist/migrations/utils.js +218 -0
- package/dist/notification/index.js +707 -119
- package/dist/roles/index.d.ts +2 -0
- package/dist/roles/index.d.ts.map +1 -0
- package/dist/roles/index.js +730 -0
- package/dist/scopes/index.d.ts +0 -10
- package/dist/scopes/index.js +3 -7
- package/dist/templates/charts-values/dependencies/values.yaml +5 -2
- package/dist/templates/charts-values/opencrvs-services/values.yaml +2 -5
- package/dist/verify/endpoints.d.ts +11 -0
- package/dist/verify/endpoints.d.ts.map +1 -1
- package/dist/verify/endpoints.js +21 -27
- package/opencrvs-toolkit-2.2.0-rc.19ec10b.tgz +0 -0
- package/package.json +4 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/tsconfig.json +3 -5
- package/dist/environment/dockerhub.d.ts +0 -15
- package/dist/environment/dockerhub.d.ts.map +0 -1
- package/dist/environment/dockerhub.js +0 -104
- package/opencrvs-toolkit-2.2.0-rc.045257f.tgz +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ActionDateReference, ActionMatcher } from '../conditionals/conditionals';
|
|
1
2
|
import { NonSearchableEventMetadataTimeFieldIdInput, AdvancedSearchConfig } from '../event-config/event-configuration';
|
|
2
3
|
import { ActionType } from './ActionType';
|
|
3
4
|
import { EventFieldIdInput } from './AdvancedSearchConfig';
|
|
@@ -15,9 +16,17 @@ declare function eventFn(fieldId: EventFieldIdInput): AdvancedSearchConfig;
|
|
|
15
16
|
declare function eventFn(fieldId: NonSearchableEventMetadataTimeFieldIdInput): {
|
|
16
17
|
$$event: NonSearchableEventMetadataTimeFieldIdInput;
|
|
17
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* An action type, or a matcher for a custom action. A bare `ActionType.CUSTOM`
|
|
21
|
+
* is not allowed because it would match every custom action.
|
|
22
|
+
*/
|
|
23
|
+
type ActionAnchor = Exclude<ActionType, typeof ActionType.CUSTOM> | ActionMatcher;
|
|
18
24
|
declare const event: typeof eventFn & {
|
|
19
25
|
/**
|
|
20
|
-
* Checks if the event contains a specific action type.
|
|
26
|
+
* Checks if the event contains a specific accepted action type.
|
|
27
|
+
* Only Accepted actions are matched: a confirmable action is stored as a
|
|
28
|
+
* Requested and an Accepted action, and a pending or rejected request must
|
|
29
|
+
* not count as the action having happened.
|
|
21
30
|
* Can be used directly as a conditional or chained with additional methods.
|
|
22
31
|
* @param action - The action type to check for.
|
|
23
32
|
*/
|
|
@@ -77,6 +86,16 @@ declare const event: typeof eventFn & {
|
|
|
77
86
|
};
|
|
78
87
|
};
|
|
79
88
|
field(field: WorkqueueColumnKeys): WorkqueueColumnValue;
|
|
89
|
+
/**
|
|
90
|
+
* References the date of the first action matching any of the given types,
|
|
91
|
+
* e.g. `field('child.dob').isAfter().days(30).beforeAction(event.firstAction(ActionType.DECLARE))`.
|
|
92
|
+
* Until a matching action exists, the comparison uses $now.
|
|
93
|
+
*/
|
|
94
|
+
firstAction: (first: ActionAnchor, ...rest: ActionAnchor[]) => ActionDateReference;
|
|
95
|
+
/**
|
|
96
|
+
* Like {@link event.firstAction}, but references the most recent matching action.
|
|
97
|
+
*/
|
|
98
|
+
lastAction: (first: ActionAnchor, ...rest: ActionAnchor[]) => ActionDateReference;
|
|
80
99
|
/**
|
|
81
100
|
* Checks if the event currently has the given status.
|
|
82
101
|
* @param eventStatus - The status to check for.
|
|
@@ -37,6 +37,7 @@ export declare function field(fieldId: string, options?: {
|
|
|
37
37
|
validations?: ValidationConfig[];
|
|
38
38
|
searchCriteriaLabelPrefix?: TranslationConfig;
|
|
39
39
|
allowedLocations?: JurisdictionReference;
|
|
40
|
+
defaultValue?: boolean | string | number;
|
|
40
41
|
}): {
|
|
41
42
|
$$field: string;
|
|
42
43
|
$$subfield: string[];
|
|
@@ -57,6 +58,8 @@ export declare function field(fieldId: string, options?: {
|
|
|
57
58
|
inFuture: () => import("../conditionals/conditionals").JSONSchema;
|
|
58
59
|
fromDate: (date: `${string}-${string}-${string}` | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
59
60
|
fromNow: () => import("../conditionals/conditionals").JSONSchema;
|
|
61
|
+
beforeAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
62
|
+
afterAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
60
63
|
};
|
|
61
64
|
date: (date: string | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
62
65
|
now: () => import("../conditionals/conditionals").JSONSchema;
|
|
@@ -67,6 +70,8 @@ export declare function field(fieldId: string, options?: {
|
|
|
67
70
|
inFuture: () => import("../conditionals/conditionals").JSONSchema;
|
|
68
71
|
fromDate: (date: `${string}-${string}-${string}` | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
69
72
|
fromNow: () => import("../conditionals/conditionals").JSONSchema;
|
|
73
|
+
beforeAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
74
|
+
afterAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
70
75
|
};
|
|
71
76
|
date: (date: `${string}-${string}-${string}` | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
72
77
|
now: () => import("../conditionals/conditionals").JSONSchema;
|
|
@@ -96,6 +101,8 @@ export declare function field(fieldId: string, options?: {
|
|
|
96
101
|
inFuture: () => import("../conditionals/conditionals").JSONSchema;
|
|
97
102
|
fromDate: (date: `${string}-${string}-${string}` | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
98
103
|
fromNow: () => import("../conditionals/conditionals").JSONSchema;
|
|
104
|
+
beforeAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
105
|
+
afterAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
99
106
|
};
|
|
100
107
|
date: (date: string | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
101
108
|
now: () => import("../conditionals/conditionals").JSONSchema;
|
|
@@ -106,6 +113,8 @@ export declare function field(fieldId: string, options?: {
|
|
|
106
113
|
inFuture: () => import("../conditionals/conditionals").JSONSchema;
|
|
107
114
|
fromDate: (date: `${string}-${string}-${string}` | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
108
115
|
fromNow: () => import("../conditionals/conditionals").JSONSchema;
|
|
116
|
+
beforeAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
117
|
+
afterAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
109
118
|
};
|
|
110
119
|
date: (date: `${string}-${string}-${string}` | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
111
120
|
now: () => import("../conditionals/conditionals").JSONSchema;
|
|
@@ -140,6 +149,8 @@ export declare function field(fieldId: string, options?: {
|
|
|
140
149
|
inFuture: () => import("../conditionals/conditionals").JSONSchema;
|
|
141
150
|
fromDate: (date: `${string}-${string}-${string}` | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
142
151
|
fromNow: () => import("../conditionals/conditionals").JSONSchema;
|
|
152
|
+
beforeAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
153
|
+
afterAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
143
154
|
};
|
|
144
155
|
date: (date: string | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
145
156
|
now: () => import("../conditionals/conditionals").JSONSchema;
|
|
@@ -150,6 +161,8 @@ export declare function field(fieldId: string, options?: {
|
|
|
150
161
|
inFuture: () => import("../conditionals/conditionals").JSONSchema;
|
|
151
162
|
fromDate: (date: `${string}-${string}-${string}` | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
152
163
|
fromNow: () => import("../conditionals/conditionals").JSONSchema;
|
|
164
|
+
beforeAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
165
|
+
afterAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
153
166
|
};
|
|
154
167
|
date: (date: `${string}-${string}-${string}` | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
155
168
|
now: () => import("../conditionals/conditionals").JSONSchema;
|
|
@@ -188,6 +201,8 @@ export declare function field(fieldId: string, options?: {
|
|
|
188
201
|
inFuture: () => import("../conditionals/conditionals").JSONSchema;
|
|
189
202
|
fromDate: (date: `${string}-${string}-${string}` | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
190
203
|
fromNow: () => import("../conditionals/conditionals").JSONSchema;
|
|
204
|
+
beforeAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
205
|
+
afterAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
191
206
|
};
|
|
192
207
|
date: (date: string | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
193
208
|
now: () => import("../conditionals/conditionals").JSONSchema;
|
|
@@ -198,6 +213,8 @@ export declare function field(fieldId: string, options?: {
|
|
|
198
213
|
inFuture: () => import("../conditionals/conditionals").JSONSchema;
|
|
199
214
|
fromDate: (date: `${string}-${string}-${string}` | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
200
215
|
fromNow: () => import("../conditionals/conditionals").JSONSchema;
|
|
216
|
+
beforeAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
217
|
+
afterAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
201
218
|
};
|
|
202
219
|
date: (date: `${string}-${string}-${string}` | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
203
220
|
now: () => import("../conditionals/conditionals").JSONSchema;
|
|
@@ -227,6 +244,8 @@ export declare function field(fieldId: string, options?: {
|
|
|
227
244
|
inFuture: () => import("../conditionals/conditionals").JSONSchema;
|
|
228
245
|
fromDate: (date: `${string}-${string}-${string}` | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
229
246
|
fromNow: () => import("../conditionals/conditionals").JSONSchema;
|
|
247
|
+
beforeAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
248
|
+
afterAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
230
249
|
};
|
|
231
250
|
date: (date: string | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
232
251
|
now: () => import("../conditionals/conditionals").JSONSchema;
|
|
@@ -237,6 +256,8 @@ export declare function field(fieldId: string, options?: {
|
|
|
237
256
|
inFuture: () => import("../conditionals/conditionals").JSONSchema;
|
|
238
257
|
fromDate: (date: `${string}-${string}-${string}` | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
239
258
|
fromNow: () => import("../conditionals/conditionals").JSONSchema;
|
|
259
|
+
beforeAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
260
|
+
afterAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
240
261
|
};
|
|
241
262
|
date: (date: `${string}-${string}-${string}` | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
242
263
|
now: () => import("../conditionals/conditionals").JSONSchema;
|
|
@@ -275,6 +296,8 @@ export declare function field(fieldId: string, options?: {
|
|
|
275
296
|
inFuture: () => import("../conditionals/conditionals").JSONSchema;
|
|
276
297
|
fromDate: (date: `${string}-${string}-${string}` | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
277
298
|
fromNow: () => import("../conditionals/conditionals").JSONSchema;
|
|
299
|
+
beforeAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
300
|
+
afterAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
278
301
|
};
|
|
279
302
|
date: (date: string | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
280
303
|
now: () => import("../conditionals/conditionals").JSONSchema;
|
|
@@ -285,6 +308,8 @@ export declare function field(fieldId: string, options?: {
|
|
|
285
308
|
inFuture: () => import("../conditionals/conditionals").JSONSchema;
|
|
286
309
|
fromDate: (date: `${string}-${string}-${string}` | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
287
310
|
fromNow: () => import("../conditionals/conditionals").JSONSchema;
|
|
311
|
+
beforeAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
312
|
+
afterAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
288
313
|
};
|
|
289
314
|
date: (date: `${string}-${string}-${string}` | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
290
315
|
now: () => import("../conditionals/conditionals").JSONSchema;
|
|
@@ -314,6 +339,8 @@ export declare function field(fieldId: string, options?: {
|
|
|
314
339
|
inFuture: () => import("../conditionals/conditionals").JSONSchema;
|
|
315
340
|
fromDate: (date: `${string}-${string}-${string}` | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
316
341
|
fromNow: () => import("../conditionals/conditionals").JSONSchema;
|
|
342
|
+
beforeAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
343
|
+
afterAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
317
344
|
};
|
|
318
345
|
date: (date: string | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
319
346
|
now: () => import("../conditionals/conditionals").JSONSchema;
|
|
@@ -324,6 +351,8 @@ export declare function field(fieldId: string, options?: {
|
|
|
324
351
|
inFuture: () => import("../conditionals/conditionals").JSONSchema;
|
|
325
352
|
fromDate: (date: `${string}-${string}-${string}` | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
326
353
|
fromNow: () => import("../conditionals/conditionals").JSONSchema;
|
|
354
|
+
beforeAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
355
|
+
afterAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
327
356
|
};
|
|
328
357
|
date: (date: `${string}-${string}-${string}` | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
329
358
|
now: () => import("../conditionals/conditionals").JSONSchema;
|
|
@@ -351,6 +380,8 @@ export declare function field(fieldId: string, options?: {
|
|
|
351
380
|
inFuture: () => import("../conditionals/conditionals").JSONSchema;
|
|
352
381
|
fromDate: (date: `${string}-${string}-${string}` | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
353
382
|
fromNow: () => import("../conditionals/conditionals").JSONSchema;
|
|
383
|
+
beforeAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
384
|
+
afterAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
354
385
|
};
|
|
355
386
|
date: (date: string | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
356
387
|
now: () => import("../conditionals/conditionals").JSONSchema;
|
|
@@ -361,6 +392,8 @@ export declare function field(fieldId: string, options?: {
|
|
|
361
392
|
inFuture: () => import("../conditionals/conditionals").JSONSchema;
|
|
362
393
|
fromDate: (date: `${string}-${string}-${string}` | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
363
394
|
fromNow: () => import("../conditionals/conditionals").JSONSchema;
|
|
395
|
+
beforeAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
396
|
+
afterAction: (action: import("../conditionals/conditionals").ActionDateReference) => import("../conditionals/conditionals").JSONSchema;
|
|
364
397
|
};
|
|
365
398
|
date: (date: `${string}-${string}-${string}` | import("./FieldConfig").FieldReference) => import("../conditionals/conditionals").JSONSchema;
|
|
366
399
|
now: () => import("../conditionals/conditionals").JSONSchema;
|
|
@@ -387,6 +420,7 @@ export declare function field(fieldId: string, options?: {
|
|
|
387
420
|
validations?: ValidationConfig[];
|
|
388
421
|
searchCriteriaLabelPrefix?: TranslationConfig;
|
|
389
422
|
allowedLocations?: JurisdictionReference;
|
|
423
|
+
defaultValue?: boolean | string | number;
|
|
390
424
|
fieldId: string;
|
|
391
425
|
fieldType: 'field';
|
|
392
426
|
} & {
|
|
@@ -400,6 +434,7 @@ export declare function field(fieldId: string, options?: {
|
|
|
400
434
|
validations?: ValidationConfig[];
|
|
401
435
|
searchCriteriaLabelPrefix?: TranslationConfig;
|
|
402
436
|
allowedLocations?: JurisdictionReference;
|
|
437
|
+
defaultValue?: boolean | string | number;
|
|
403
438
|
fieldId: string;
|
|
404
439
|
fieldType: 'field';
|
|
405
440
|
} & {
|
|
@@ -413,6 +448,7 @@ export declare function field(fieldId: string, options?: {
|
|
|
413
448
|
validations?: ValidationConfig[];
|
|
414
449
|
searchCriteriaLabelPrefix?: TranslationConfig;
|
|
415
450
|
allowedLocations?: JurisdictionReference;
|
|
451
|
+
defaultValue?: boolean | string | number;
|
|
416
452
|
fieldId: string;
|
|
417
453
|
fieldType: 'field';
|
|
418
454
|
} & {
|
|
@@ -426,6 +462,7 @@ export declare function field(fieldId: string, options?: {
|
|
|
426
462
|
validations?: ValidationConfig[];
|
|
427
463
|
searchCriteriaLabelPrefix?: TranslationConfig;
|
|
428
464
|
allowedLocations?: JurisdictionReference;
|
|
465
|
+
defaultValue?: boolean | string | number;
|
|
429
466
|
fieldId: string;
|
|
430
467
|
fieldType: 'field';
|
|
431
468
|
} & {
|
|
@@ -3,7 +3,7 @@ import * as z from 'zod/v4';
|
|
|
3
3
|
import { PlainDate } from './PlainDate';
|
|
4
4
|
import { EventIndex } from './EventIndex';
|
|
5
5
|
import { ActionCreationMetadata, RegistrationCreationMetadata } from './EventMetadata';
|
|
6
|
-
import { RecordScopeV2, UserScopeV2 } from '../scopes';
|
|
6
|
+
import { RecordScopeV2, UserScopeV2 } from '../users/scopes';
|
|
7
7
|
import { SystemContext, UserContext } from '../users/User';
|
|
8
8
|
/** @deprecated Moving on, location types are arbitrary and defined by the country config. */
|
|
9
9
|
export declare const LocationTypeV1: z.ZodEnum<{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DisplayableAction } from './ActionType';
|
|
2
|
-
import { EncodedScope, RecordScopeTypeV2, ScopeType, UserScopeV2 } from '../scopes';
|
|
2
|
+
import { EncodedScope, RecordScopeTypeV2, ScopeType, UserScopeV2 } from '../users/scopes';
|
|
3
3
|
import { EventIndexWithAdministrativeHierarchy } from './locations';
|
|
4
4
|
import { UserContext } from '../users/User';
|
|
5
5
|
import { EventIndex } from './EventIndex';
|
|
@@ -15,6 +15,7 @@ export declare const ACTION_SCOPE_MAP: {
|
|
|
15
15
|
PRINT_CERTIFICATE: "record.print-certified-copies"[];
|
|
16
16
|
REQUEST_CORRECTION: ("record.correct" | "record.request-correction")[];
|
|
17
17
|
REVIEW_CORRECTION_REQUEST: "record.correct"[];
|
|
18
|
+
CONTINUE_DRAFT: never[];
|
|
18
19
|
REJECT_CORRECTION: "record.correct"[];
|
|
19
20
|
APPROVE_CORRECTION: "record.correct"[];
|
|
20
21
|
REVOKE_REGISTRATION: "record.revoke-registration"[];
|
|
@@ -63,6 +63,7 @@ export declare function applyDeclarationToEventIndex(eventIndex: EventIndex, dec
|
|
|
63
63
|
export declare function applyDraftToEventIndex(eventIndex: EventIndex, draft: Draft, eventConfiguration: EventConfig): {
|
|
64
64
|
id: string & import("zod").$brand<"UUID">;
|
|
65
65
|
type: string;
|
|
66
|
+
configVersionId: string;
|
|
66
67
|
status: "ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED" | "REVOKED";
|
|
67
68
|
legalStatuses: {
|
|
68
69
|
NOTIFIED?: {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { UUID } from '../uuid';
|
|
2
|
-
import { ActionDocument, ActionUpdate } from './ActionDocument';
|
|
2
|
+
import { Action, ActionBase, ActionDocument, ActionStatus, ActionUpdate } from './ActionDocument';
|
|
3
3
|
import { ValidatorContext } from '../conditionals/validate';
|
|
4
4
|
import { ApproveCorrectionActionInput, ArchiveActionInput, AssignActionInput, DeclareActionInput, EditActionInput, MarkAsDuplicateActionInput, MarkNotDuplicateActionInput, NotifyActionInput, RegisterActionInput, RejectCorrectionActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnarchiveActionInput, UnassignActionInput, RevokeRegistrationActionInput, ReinstateRegistrationActionInput } from './ActionInput';
|
|
5
5
|
import { ActionType } from './ActionType';
|
|
6
|
-
import { Draft } from './Draft';
|
|
7
|
-
import { EventConfig, EventConfigInput } from './EventConfig';
|
|
6
|
+
import { Draft, DraftInput, RemoteDraft } from './Draft';
|
|
7
|
+
import { EventConfig, EventConfigInput, VersionedEventConfig } from './EventConfig';
|
|
8
8
|
import { EventDocument } from './EventDocument';
|
|
9
9
|
import { EventIndex } from './EventIndex';
|
|
10
10
|
import { EventInput } from './EventInput';
|
|
@@ -98,7 +98,8 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
|
|
|
98
98
|
eventId: string;
|
|
99
99
|
};
|
|
100
100
|
/**
|
|
101
|
-
*
|
|
101
|
+
* NOTIFY submits the values of the notification form, and the record can stay incomplete.
|
|
102
|
+
* When `declaration` is not given, string values are left out of the generated declaration to make it incomplete.
|
|
102
103
|
*/
|
|
103
104
|
notify: (eventId: string, input?: Partial<Pick<NotifyActionInput, 'transactionId' | 'declaration' | 'keepAssignment' | 'keepAssignmentIfRejected' | 'keepAssignmentIfAccepted' | 'waitFor'>>) => {
|
|
104
105
|
type: "NOTIFY";
|
|
@@ -278,6 +279,13 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
|
|
|
278
279
|
};
|
|
279
280
|
};
|
|
280
281
|
};
|
|
282
|
+
/**
|
|
283
|
+
* Generates a single action document with exactly the given status (Accepted by default).
|
|
284
|
+
*
|
|
285
|
+
* For realistic data use `generateActionDocuments`, which also creates the Requested
|
|
286
|
+
* action the events service stores for a confirmable action. Use this one for edge
|
|
287
|
+
* cases, such as pending or rejected requests, or actions without an original request.
|
|
288
|
+
*/
|
|
281
289
|
export declare function generateActionDocument<T extends ActionType>({ configuration, action, rng, defaults, declarationOverrides }: {
|
|
282
290
|
configuration: EventConfig;
|
|
283
291
|
action: T;
|
|
@@ -287,6 +295,45 @@ export declare function generateActionDocument<T extends ActionType>({ configura
|
|
|
287
295
|
}>>;
|
|
288
296
|
declarationOverrides?: ActionUpdate;
|
|
289
297
|
}): ActionDocument;
|
|
298
|
+
type GenerateActionDocumentsArgs<T extends ActionType> = Parameters<typeof generateActionDocument<T>>[0];
|
|
299
|
+
type ActionConfirmation<S extends ActionStatus> = {
|
|
300
|
+
status: S;
|
|
301
|
+
defaults?: Partial<ActionBase>;
|
|
302
|
+
};
|
|
303
|
+
/**
|
|
304
|
+
* Generates the action documents the events service stores for a single action.
|
|
305
|
+
*
|
|
306
|
+
* Mirrors the events service: a confirmable action is first stored as Requested,
|
|
307
|
+
* carrying the declaration and annotation, and then confirmed by a separate
|
|
308
|
+
* Accepted (or Rejected) action that points back to it through originalActionId.
|
|
309
|
+
* Other actions are stored once, as Accepted.
|
|
310
|
+
*
|
|
311
|
+
* `confirmation.status` picks the outcome of a confirmable action:
|
|
312
|
+
* - Accepted (default): [Requested, Accepted]
|
|
313
|
+
* - Rejected: [Requested, Rejected]
|
|
314
|
+
* - Requested: [Requested], i.e. still waiting for confirmation
|
|
315
|
+
*
|
|
316
|
+
* By default the request is confirmed synchronously, so both actions share the
|
|
317
|
+
* `transactionId`. `confirmation.defaults` apply to the confirming action only,
|
|
318
|
+
* e.g. a system user and a `transactionId` of its own for an asynchronous confirmation.
|
|
319
|
+
*
|
|
320
|
+
* The confirming action keeps the generated (or given) `id`, since references such
|
|
321
|
+
* as `requestId` of APPROVE_CORRECTION point to the accepted action.
|
|
322
|
+
*
|
|
323
|
+
* Use `generateActionDocument` instead to build a single action with an explicit status.
|
|
324
|
+
*
|
|
325
|
+
* Only a rejection yields an AsyncRejectActionDocument, so the result is typed
|
|
326
|
+
* as `ActionDocument[]` when `confirmation.status` is known not to be Rejected.
|
|
327
|
+
*/
|
|
328
|
+
export declare function generateActionDocuments<T extends ActionType>(args: GenerateActionDocumentsArgs<T> & {
|
|
329
|
+
confirmation: ActionConfirmation<typeof ActionStatus.Rejected>;
|
|
330
|
+
}): Action[];
|
|
331
|
+
export declare function generateActionDocuments<T extends ActionType>(args: GenerateActionDocumentsArgs<T> & {
|
|
332
|
+
confirmation?: Partial<ActionConfirmation<typeof ActionStatus.Accepted | typeof ActionStatus.Requested>>;
|
|
333
|
+
}): ActionDocument[];
|
|
334
|
+
export declare function generateActionDocuments<T extends ActionType>(args: GenerateActionDocumentsArgs<T> & {
|
|
335
|
+
confirmation?: Partial<ActionConfirmation<ActionStatus>>;
|
|
336
|
+
}): Action[];
|
|
290
337
|
export declare function generateRandomDatetime(rng: () => number, start: Date, end: Date): string;
|
|
291
338
|
export declare function getRandomDate(rng: () => number, start: string, end: string): string;
|
|
292
339
|
export declare function generateEventDocument({ configuration, actions, rng, defaults }: {
|
|
@@ -310,11 +357,11 @@ export declare function generateEventDocument({ configuration, actions, rng, def
|
|
|
310
357
|
}): EventDocument;
|
|
311
358
|
export declare function generateEventDraftDocument({ eventId, actionType, rng, declaration }: {
|
|
312
359
|
eventId: UUID;
|
|
313
|
-
actionType:
|
|
360
|
+
actionType: DraftInput['type'];
|
|
314
361
|
rng?: () => number;
|
|
315
362
|
declaration?: ActionUpdate;
|
|
316
363
|
annotation?: ActionUpdate;
|
|
317
|
-
}):
|
|
364
|
+
}): RemoteDraft;
|
|
318
365
|
/**
|
|
319
366
|
* Useful for testing when we need deterministic outcome.
|
|
320
367
|
* @param seed - Seed value for the pseudo-random number generator
|
|
@@ -373,4 +420,10 @@ export declare function generateTestValidatorContext(userRole?: TestUserRole, ev
|
|
|
373
420
|
event: EventDocument;
|
|
374
421
|
eventConfig: EventConfig;
|
|
375
422
|
}): ValidatorContext;
|
|
423
|
+
/**
|
|
424
|
+
* Serves `config` as country config does: as the only version of its event.
|
|
425
|
+
* For mocking `/config/events` and `event.config.get` with a configuration built in a test.
|
|
426
|
+
*/
|
|
427
|
+
export declare function toVersionedEventConfig({ id, label, advancedSearch, ...version }: EventConfig): VersionedEventConfig;
|
|
428
|
+
export {};
|
|
376
429
|
//# sourceMappingURL=test.utils.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ActionType, DeclarationActionType, DisplayableAction } from './ActionType';
|
|
2
|
-
import { EventConfig } from './EventConfig';
|
|
2
|
+
import { EventConfig, VersionedEventConfig } from './EventConfig';
|
|
3
3
|
import { FieldConfig, FieldReference } from './FieldConfig';
|
|
4
4
|
import { Action, ActionDocument, ActionUpdate, EventState } from './ActionDocument';
|
|
5
5
|
import { PageConfig, VerificationPageConfig } from './PageConfig';
|
|
@@ -46,6 +46,17 @@ export declare function getDeclarationPages(configuration: EventConfig): {
|
|
|
46
46
|
type: "FORM";
|
|
47
47
|
}[];
|
|
48
48
|
export declare function getDeclarationFields(configuration: EventConfig): FieldConfig[];
|
|
49
|
+
/**
|
|
50
|
+
* @returns the declaration fields of every version of the event, one per id: what any
|
|
51
|
+
* record of the event can hold, whichever version it was created under. Where versions
|
|
52
|
+
* define an id differently, the newest version's field is kept.
|
|
53
|
+
*
|
|
54
|
+
* Used to build the search index mapping: records of every version share one index per
|
|
55
|
+
* event, so its mapping must hold the fields of all of them. Goes away once each version
|
|
56
|
+
* gets its own index (#14335).
|
|
57
|
+
* Known limitation: a field id must keep its type in every version until #14335.
|
|
58
|
+
*/
|
|
59
|
+
export declare function getDeclarationFieldsOfAllVersions(config: VersionedEventConfig): FieldConfig[];
|
|
49
60
|
/**
|
|
50
61
|
* @returns the notification form configured on the NOTIFY action.
|
|
51
62
|
* @throws when the event has no NOTIFY action.
|
|
@@ -636,7 +647,9 @@ export declare const findAllFields: (config: EventConfig) => FieldConfig[];
|
|
|
636
647
|
* @returns the value of the object at the given path.
|
|
637
648
|
*/
|
|
638
649
|
export declare function getMixedPath<T = unknown>(obj: Record<string, unknown>, path: string, defaultValue?: T | undefined): T | undefined;
|
|
639
|
-
export declare function getEventConfigById
|
|
650
|
+
export declare function getEventConfigById<T extends {
|
|
651
|
+
id: string;
|
|
652
|
+
}>(eventConfigs: T[], id: string): T;
|
|
640
653
|
export declare function timePeriodToDateRange(value: SelectDateRangeValue): {
|
|
641
654
|
startDate: string;
|
|
642
655
|
endDate: string;
|
|
@@ -654,6 +667,19 @@ export declare function getCompleteActionAnnotation(event: EventDocument, action
|
|
|
654
667
|
export declare function getCompleteActionContent(event: EventDocument, action: ActionDocument): Record<string, unknown> | null | undefined;
|
|
655
668
|
export declare function getCompleteActionDeclaration<T extends EventState | ActionUpdate>(declaration: T, event: EventDocument, action: ActionDocument): T;
|
|
656
669
|
export declare function getAcceptedActions(event: EventDocument): ActionDocument[];
|
|
670
|
+
/**
|
|
671
|
+
* Returns the event with each Accepted action completed with the details of
|
|
672
|
+
* its original Requested action: who requested it, where, and the request's
|
|
673
|
+
* declaration, annotation and content (the Accepted action's own values win).
|
|
674
|
+
*
|
|
675
|
+
* `$event` conditionals match Accepted actions only, but an Accepted action
|
|
676
|
+
* does not carry everything its request did. A synchronous confirmation drops
|
|
677
|
+
* the request's annotation; an asynchronous `accept` is created by the system
|
|
678
|
+
* user and carries only what the country configuration sent. Without this,
|
|
679
|
+
* `event.hasAction(...).withTemplate(...)` / `.withFields(...)` would stop
|
|
680
|
+
* matching fields that matched the Requested action.
|
|
681
|
+
*/
|
|
682
|
+
export declare function getEventWithCompleteAcceptedActions(event: EventDocument): EventDocument;
|
|
657
683
|
export declare function aggregateActionDeclarations(event: EventDocument): EventState;
|
|
658
684
|
/**
|
|
659
685
|
* Returns the declaration after each of `event.actions`, which must be in chronological order.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { VersionedEventConfig } from '../events/EventConfig';
|
|
3
|
+
export declare const Role: z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
scopes: z.ZodArray<z.core.$ZodBranded<z.ZodString, "EncodedScope", "out">>;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export type Role = z.infer<typeof Role>;
|
|
8
|
+
export declare const Roles: z.ZodArray<z.ZodObject<{
|
|
9
|
+
id: z.ZodString;
|
|
10
|
+
scopes: z.ZodArray<z.core.$ZodBranded<z.ZodString, "EncodedScope", "out">>;
|
|
11
|
+
}, z.core.$strip>>;
|
|
12
|
+
export type Roles = z.infer<typeof Roles>;
|
|
13
|
+
/**
|
|
14
|
+
* Helper for defining user roles. Should be used in country config.
|
|
15
|
+
*
|
|
16
|
+
* @param roles Array of roles in object format.
|
|
17
|
+
* @param eventConfigs Array of event configurations, which are needed to run validations for scopes.
|
|
18
|
+
*/
|
|
19
|
+
export declare function defineRoles(roles: Roles, eventConfigs: VersionedEventConfig[]): {
|
|
20
|
+
id: string;
|
|
21
|
+
scopes: (string & z.$brand<"EncodedScope">)[];
|
|
22
|
+
}[];
|
|
23
|
+
//# sourceMappingURL=Role.d.ts.map
|