@opencrvs/toolkit 2.1.0-rc.6a144d4 → 2.1.0-rc.6bae709
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/README.md +1 -0
- package/create-countryconfig/index.js +114 -66
- package/create-countryconfig/node_modules/.bin/degit +21 -0
- package/create-countryconfig/package.json +4 -1
- package/dist/application-config/index.js +227 -196
- package/dist/cli.js +174 -58
- package/dist/commons/api/router.d.ts +76 -22
- package/dist/commons/conditionals/conditionals.d.ts +3 -3
- package/dist/commons/conditionals/validate.d.ts +11 -4
- package/dist/commons/events/ActionDocument.d.ts +1 -7
- package/dist/commons/events/ActionStatus.d.ts +14 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +6 -0
- package/dist/commons/events/AuditLog.d.ts +38 -0
- package/dist/commons/events/EventConfig.d.ts +3 -0
- package/dist/commons/events/EventIndex.d.ts +3 -26
- package/dist/commons/events/FieldConfig.d.ts +65 -53
- package/dist/commons/events/FieldTypeMapping.d.ts +19 -19
- package/dist/commons/events/FieldValue.d.ts +2 -2
- package/dist/commons/events/Flag.d.ts +42 -0
- package/dist/commons/events/PlainDate.d.ts +8 -0
- package/dist/commons/events/SummaryConfig.d.ts +249 -0
- package/dist/commons/events/WorkqueueConfig.d.ts +17 -14
- package/dist/commons/events/event.d.ts +12 -0
- package/dist/commons/events/locations.d.ts +99 -16
- package/dist/commons/events/mocks.test.utils.d.ts +30 -0
- package/dist/conditionals/index.js +302 -55
- package/dist/environment/index.d.ts +1 -0
- package/dist/environment/index.d.ts.map +1 -1
- package/dist/environment/index.js +10 -0
- package/dist/environment/logger.d.ts +12 -3
- package/dist/environment/logger.d.ts.map +1 -1
- package/dist/environment/paths.d.ts +7 -0
- package/dist/environment/paths.d.ts.map +1 -0
- package/dist/environment/paths.js +72 -0
- package/dist/environment/setup-environment.js +2 -1
- package/dist/environment/templates.d.ts.map +1 -1
- package/dist/environment/templates.js +2 -1
- package/dist/environment/update-workflows.d.ts.map +1 -1
- package/dist/environment/update-workflows.js +17 -5
- package/dist/environment/upgrade.d.ts +2 -0
- package/dist/environment/upgrade.d.ts.map +1 -0
- package/dist/environment/upgrade.js +82 -0
- package/dist/environment/users.js +11 -13
- package/dist/events/index.js +3480 -3272
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +2 -2
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.js +2 -2
- package/dist/notification/index.js +1795 -1074
- package/dist/scopes/index.d.ts +248 -25
- package/dist/scopes/index.js +303 -55
- package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -3
- package/dist/templates/charts-values/opentelemetry/values.yaml +73 -0
- package/opencrvs-toolkit-2.1.0-rc.6bae709.tgz +0 -0
- package/package.json +5 -5
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.1.0-rc.6a144d4.tgz +0 -0
|
@@ -2,7 +2,7 @@ import { ConditionalParameters, JSONSchema } from './conditionals';
|
|
|
2
2
|
import { ActionUpdate, EventState } from '../events/ActionDocument';
|
|
3
3
|
import { FieldConditional } from '../events/Conditional';
|
|
4
4
|
import { FieldConfig } from '../events/FieldConfig';
|
|
5
|
-
import { FieldUpdateValue, FieldValue } from '../events/FieldValue';
|
|
5
|
+
import { PlainDate, FieldUpdateValue, FieldValue } from '../events/FieldValue';
|
|
6
6
|
import { TranslationConfig } from '../events/TranslationConfig';
|
|
7
7
|
import { ITokenPayload } from '../authentication';
|
|
8
8
|
import { UUID } from '../uuid';
|
|
@@ -14,8 +14,8 @@ import { EventDocument } from '../events/EventDocument';
|
|
|
14
14
|
import { EventIndex } from '../events/EventIndex';
|
|
15
15
|
import { Location } from '../events/locations';
|
|
16
16
|
import { SystemVariables } from '../events/TemplateConfig';
|
|
17
|
-
/** Returns today's date as
|
|
18
|
-
export declare function todayISO():
|
|
17
|
+
/** Returns today's date as a {@link PlainDate} (YYYY-MM-DD), device-local. */
|
|
18
|
+
export declare function todayISO(): PlainDate;
|
|
19
19
|
/**
|
|
20
20
|
* Context passed to every serialised client-side function ({@link runClientFunction}).
|
|
21
21
|
*
|
|
@@ -69,13 +69,20 @@ export declare function validate(schema: JSONSchema, data: ConditionalParameters
|
|
|
69
69
|
export declare function validateValue(schema: JSONSchema, data: unknown): boolean;
|
|
70
70
|
export declare function isOnline(): boolean;
|
|
71
71
|
export declare function isConditionMet(conditional: JSONSchema, values: EventState | ActionUpdate, context: ValidatorContext): boolean;
|
|
72
|
-
export declare function areConditionsMet(conditions: FieldConditional[], values: Record<string, FieldValue>, context: ValidatorContext,
|
|
72
|
+
export declare function areConditionsMet(conditions: FieldConditional[], values: Record<string, FieldValue>, context: ValidatorContext, event: EventIndex): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Given a field's `secured` property (a boolean, or a JSONSchema conditional
|
|
75
|
+
* evaluated against the event, e.g. `flag('sealed')`), returns whether the
|
|
76
|
+
* field is currently secured for the given event.
|
|
77
|
+
*/
|
|
78
|
+
export declare function isFieldSecured(field: Pick<FieldConfig, 'secured'>, event: EventIndex, context?: ValidatorContext): boolean;
|
|
73
79
|
export type ValidatorContext = {
|
|
74
80
|
user?: ITokenPayload;
|
|
75
81
|
leafAdminStructureLocationIds?: Array<{
|
|
76
82
|
id: UUID;
|
|
77
83
|
}>;
|
|
78
84
|
event?: EventDocument;
|
|
85
|
+
eventConfig?: EventConfig;
|
|
79
86
|
baseFormState?: EventState;
|
|
80
87
|
};
|
|
81
88
|
export declare function isFieldVisible(field: FieldConfig, form: Partial<ActionUpdate | EventState>, context: ValidatorContext): boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as z from 'zod/v4';
|
|
2
2
|
import { FieldValue, FieldUpdateValue } from './FieldValue';
|
|
3
|
+
export { ActionStatus } from './ActionStatus';
|
|
3
4
|
/**
|
|
4
5
|
* ActionUpdate is a record of a specific action that updated data fields.
|
|
5
6
|
*/
|
|
@@ -10,12 +11,6 @@ export type ActionUpdate = z.infer<typeof ActionUpdate>;
|
|
|
10
11
|
*/
|
|
11
12
|
export declare const EventState: z.ZodRecord<z.ZodString, z.ZodType<FieldValue, unknown, z.core.$ZodTypeInternals<FieldValue, unknown>>>;
|
|
12
13
|
export type EventState = z.infer<typeof EventState>;
|
|
13
|
-
export declare const ActionStatus: {
|
|
14
|
-
readonly Requested: 'Requested';
|
|
15
|
-
readonly Accepted: 'Accepted';
|
|
16
|
-
readonly Rejected: 'Rejected';
|
|
17
|
-
};
|
|
18
|
-
export type ActionStatus = keyof typeof ActionStatus;
|
|
19
14
|
export declare const ActionBase: z.ZodObject<{
|
|
20
15
|
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
21
16
|
transactionId: z.ZodString;
|
|
@@ -1173,5 +1168,4 @@ export declare const Action: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.Zod
|
|
|
1173
1168
|
export type Action = z.infer<typeof Action>;
|
|
1174
1169
|
export type CreatedAction = z.infer<typeof CreatedAction>;
|
|
1175
1170
|
export type AssignedAction = z.infer<typeof AssignedAction>;
|
|
1176
|
-
export {};
|
|
1177
1171
|
//# sourceMappingURL=ActionDocument.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deliberately dependency-free (aside from language builtins) so that files
|
|
3
|
+
* like Flag.ts can depend on ActionStatus without being pulled into the
|
|
4
|
+
* commons/scopes.ts <-> commons/authentication.ts import cycle that
|
|
5
|
+
* ActionDocument.ts participates in (it imports TokenUserType from
|
|
6
|
+
* '../authentication').
|
|
7
|
+
*/
|
|
8
|
+
export declare const ActionStatus: {
|
|
9
|
+
readonly Requested: 'Requested';
|
|
10
|
+
readonly Accepted: 'Accepted';
|
|
11
|
+
readonly Rejected: 'Rejected';
|
|
12
|
+
};
|
|
13
|
+
export type ActionStatus = keyof typeof ActionStatus;
|
|
14
|
+
//# sourceMappingURL=ActionStatus.d.ts.map
|
|
@@ -142,6 +142,7 @@ export declare const FieldConfigSchema: z.ZodObject<{
|
|
|
142
142
|
declaredBy: "declaredBy";
|
|
143
143
|
declaredIn: "declaredIn";
|
|
144
144
|
event: "event";
|
|
145
|
+
flags: "flags";
|
|
145
146
|
ids: "ids";
|
|
146
147
|
notifiedBy: "notifiedBy";
|
|
147
148
|
notifiedIn: "notifiedIn";
|
|
@@ -323,6 +324,7 @@ export declare const EventFieldConfigSchema: z.ZodObject<{
|
|
|
323
324
|
declaredBy: "declaredBy";
|
|
324
325
|
declaredIn: "declaredIn";
|
|
325
326
|
event: "event";
|
|
327
|
+
flags: "flags";
|
|
326
328
|
ids: "ids";
|
|
327
329
|
notifiedBy: "notifiedBy";
|
|
328
330
|
notifiedIn: "notifiedIn";
|
|
@@ -480,6 +482,7 @@ export declare const AdvancedSearchField: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
480
482
|
declaredBy: "declaredBy";
|
|
481
483
|
declaredIn: "declaredIn";
|
|
482
484
|
event: "event";
|
|
485
|
+
flags: "flags";
|
|
483
486
|
ids: "ids";
|
|
484
487
|
notifiedBy: "notifiedBy";
|
|
485
488
|
notifiedIn: "notifiedIn";
|
|
@@ -629,6 +632,7 @@ export declare const AdvancedSearchField: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
629
632
|
declaredBy: "declaredBy";
|
|
630
633
|
declaredIn: "declaredIn";
|
|
631
634
|
event: "event";
|
|
635
|
+
flags: "flags";
|
|
632
636
|
ids: "ids";
|
|
633
637
|
notifiedBy: "notifiedBy";
|
|
634
638
|
notifiedIn: "notifiedIn";
|
|
@@ -789,6 +793,7 @@ export declare const AdvancedSearchConfig: z.ZodObject<{
|
|
|
789
793
|
declaredBy: "declaredBy";
|
|
790
794
|
declaredIn: "declaredIn";
|
|
791
795
|
event: "event";
|
|
796
|
+
flags: "flags";
|
|
792
797
|
ids: "ids";
|
|
793
798
|
notifiedBy: "notifiedBy";
|
|
794
799
|
notifiedIn: "notifiedIn";
|
|
@@ -938,6 +943,7 @@ export declare const AdvancedSearchConfig: z.ZodObject<{
|
|
|
938
943
|
declaredBy: "declaredBy";
|
|
939
944
|
declaredIn: "declaredIn";
|
|
940
945
|
event: "event";
|
|
946
|
+
flags: "flags";
|
|
941
947
|
ids: "ids";
|
|
942
948
|
notifiedBy: "notifiedBy";
|
|
943
949
|
notifiedIn: "notifiedIn";
|
|
@@ -372,6 +372,44 @@ export declare const AuditLogEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
372
372
|
}, z.core.$strip>>;
|
|
373
373
|
}, z.core.$strip>;
|
|
374
374
|
}, z.core.$strip>;
|
|
375
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
376
|
+
id: z.ZodString;
|
|
377
|
+
clientId: z.ZodString;
|
|
378
|
+
clientType: z.ZodEnum<{
|
|
379
|
+
system: "system";
|
|
380
|
+
user: "user";
|
|
381
|
+
}>;
|
|
382
|
+
createdAt: z.ZodString;
|
|
383
|
+
operation: z.ZodLiteral<"locations.withdrawVersion">;
|
|
384
|
+
requestData: z.ZodObject<{
|
|
385
|
+
id: z.ZodString;
|
|
386
|
+
versionId: z.ZodString;
|
|
387
|
+
}, z.core.$strip>;
|
|
388
|
+
responseSummary: z.ZodObject<{
|
|
389
|
+
effectiveFrom: z.ZodString;
|
|
390
|
+
name: z.ZodString;
|
|
391
|
+
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
392
|
+
status: z.ZodString;
|
|
393
|
+
}, z.core.$strip>;
|
|
394
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
395
|
+
id: z.ZodString;
|
|
396
|
+
clientId: z.ZodString;
|
|
397
|
+
clientType: z.ZodEnum<{
|
|
398
|
+
system: "system";
|
|
399
|
+
user: "user";
|
|
400
|
+
}>;
|
|
401
|
+
createdAt: z.ZodString;
|
|
402
|
+
operation: z.ZodLiteral<"administrativeAreas.withdrawVersion">;
|
|
403
|
+
requestData: z.ZodObject<{
|
|
404
|
+
id: z.ZodString;
|
|
405
|
+
versionId: z.ZodString;
|
|
406
|
+
}, z.core.$strip>;
|
|
407
|
+
responseSummary: z.ZodObject<{
|
|
408
|
+
effectiveFrom: z.ZodString;
|
|
409
|
+
name: z.ZodString;
|
|
410
|
+
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
411
|
+
status: z.ZodString;
|
|
412
|
+
}, z.core.$strip>;
|
|
375
413
|
}, z.core.$strip>, z.ZodObject<{
|
|
376
414
|
id: z.ZodString;
|
|
377
415
|
clientId: z.ZodString;
|
|
@@ -6,6 +6,8 @@ import { AdvancedSearchConfig } from './AdvancedSearchConfig';
|
|
|
6
6
|
import { DeclarationFormConfig, DeclarationFormConfigInput } from './FormConfig';
|
|
7
7
|
import { FieldReference } from './FieldConfig';
|
|
8
8
|
import { FlagConfig } from './Flag';
|
|
9
|
+
import type { JSONSchema } from '../conditionals/conditionals';
|
|
10
|
+
import { AvailableIcons } from '../icons';
|
|
9
11
|
export declare const EventFieldReference: z.ZodObject<{
|
|
10
12
|
$$event: z.ZodEnum<{
|
|
11
13
|
createdAt: "createdAt";
|
|
@@ -32,6 +34,7 @@ export type EventConfig = {
|
|
|
32
34
|
advancedSearch: AdvancedSearchConfig[];
|
|
33
35
|
flags: FlagConfig[];
|
|
34
36
|
analytics: boolean;
|
|
37
|
+
icon?: Partial<Record<AvailableIcons, JSONSchema>>;
|
|
35
38
|
};
|
|
36
39
|
export type EventConfigInput = Omit<EventConfig, 'advancedSearch' | 'flags' | 'declaration' | 'actions' | 'dateOfEvent' | 'placeOfEvent' | 'analytics'> & {
|
|
37
40
|
dateOfEvent?: z.input<typeof FieldReference> | z.infer<typeof EventFieldReference>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z, ZodType } from 'zod/v4';
|
|
2
|
+
export { ContainsFlags } from './Flag';
|
|
2
3
|
export declare const EventIndex: z.ZodObject<{
|
|
3
4
|
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
4
5
|
type: z.ZodString;
|
|
@@ -123,29 +124,6 @@ export declare const Range: z.ZodObject<{
|
|
|
123
124
|
gte: z.ZodString;
|
|
124
125
|
lte: z.ZodString;
|
|
125
126
|
}, z.core.$strip>;
|
|
126
|
-
export declare const ContainsFlags: z.ZodObject<{
|
|
127
|
-
anyOf: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
|
|
128
|
-
readonly INCOMPLETE: 'incomplete';
|
|
129
|
-
readonly REJECTED: 'rejected';
|
|
130
|
-
readonly CORRECTION_REQUESTED: 'correction-requested';
|
|
131
|
-
readonly POTENTIAL_DUPLICATE: 'potential-duplicate';
|
|
132
|
-
readonly EDIT_IN_PROGRESS: 'edit-in-progress';
|
|
133
|
-
}>]>, z.ZodString]>>>;
|
|
134
|
-
noneOf: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
|
|
135
|
-
readonly INCOMPLETE: 'incomplete';
|
|
136
|
-
readonly REJECTED: 'rejected';
|
|
137
|
-
readonly CORRECTION_REQUESTED: 'correction-requested';
|
|
138
|
-
readonly POTENTIAL_DUPLICATE: 'potential-duplicate';
|
|
139
|
-
readonly EDIT_IN_PROGRESS: 'edit-in-progress';
|
|
140
|
-
}>]>, z.ZodString]>>>;
|
|
141
|
-
allOf: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
|
|
142
|
-
readonly INCOMPLETE: 'incomplete';
|
|
143
|
-
readonly REJECTED: 'rejected';
|
|
144
|
-
readonly CORRECTION_REQUESTED: 'correction-requested';
|
|
145
|
-
readonly POTENTIAL_DUPLICATE: 'potential-duplicate';
|
|
146
|
-
readonly EDIT_IN_PROGRESS: 'edit-in-progress';
|
|
147
|
-
}>]>, z.ZodString]>>>;
|
|
148
|
-
}, z.core.$strip>;
|
|
149
127
|
export declare const Within: z.ZodObject<{
|
|
150
128
|
type: z.ZodLiteral<"within">;
|
|
151
129
|
location: z.ZodString;
|
|
@@ -340,10 +318,10 @@ export type QueryTypeShape = {
|
|
|
340
318
|
};
|
|
341
319
|
export declare const QueryType: z.ZodType<QueryTypeShape>;
|
|
342
320
|
export declare const SearchQuery: z.ZodObject<{
|
|
343
|
-
query: z.
|
|
321
|
+
query: z.ZodPreprocess<ZodType<QueryTypeShape, unknown, z.core.$ZodTypeInternals<QueryTypeShape, unknown>>>;
|
|
344
322
|
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
345
323
|
offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
346
|
-
sort: z.ZodOptional<z.
|
|
324
|
+
sort: z.ZodOptional<z.ZodPreprocess<z.ZodArray<z.ZodObject<{
|
|
347
325
|
field: z.ZodString;
|
|
348
326
|
direction: z.ZodDefault<z.ZodEnum<{
|
|
349
327
|
asc: "asc";
|
|
@@ -354,5 +332,4 @@ export declare const SearchQuery: z.ZodObject<{
|
|
|
354
332
|
export type SearchQuery = z.infer<typeof SearchQuery>;
|
|
355
333
|
export type QueryType = z.infer<typeof QueryType>;
|
|
356
334
|
export type QueryExpression = z.infer<typeof QueryExpression>;
|
|
357
|
-
export {};
|
|
358
335
|
//# sourceMappingURL=EventIndex.d.ts.map
|