@opencrvs/toolkit 2.1.0-rc.a2d8806 → 2.1.0-rc.a4ec5a4
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/build.sh +5 -1
- package/create-countryconfig/index.js +284 -62
- package/create-countryconfig/node_modules/.bin/degit +21 -0
- package/create-countryconfig/package.json +4 -1
- package/dist/application-config/index.js +340 -274
- package/dist/cli.js +1423 -104
- package/dist/commons/api/router.d.ts +600 -70
- package/dist/commons/conditionals/conditionals.d.ts +6 -6
- package/dist/commons/conditionals/validate.d.ts +13 -2
- package/dist/commons/events/ActionDocument.d.ts +5 -11
- package/dist/commons/events/ActionInput.d.ts +4 -4
- package/dist/commons/events/ActionStatus.d.ts +14 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +18 -0
- package/dist/commons/events/AuditLog.d.ts +110 -0
- package/dist/commons/events/EventConfig.d.ts +3 -0
- package/dist/commons/events/EventDocument.d.ts +470 -2
- package/dist/commons/events/EventIndex.d.ts +3 -26
- package/dist/commons/events/EventMetadata.d.ts +1 -11
- package/dist/commons/events/EventStatus.d.ts +19 -0
- package/dist/commons/events/FieldConfig.d.ts +83 -53
- package/dist/commons/events/FieldTypeMapping.d.ts +27 -27
- package/dist/commons/events/Flag.d.ts +42 -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 +59 -10
- package/dist/commons/events/test.utils.d.ts +8 -4
- package/dist/commons/events/utils.d.ts +2 -2
- package/dist/commons/notification/UserNotifications.d.ts +28 -13
- package/dist/commons/notification/dispatch.d.ts +15 -0
- package/dist/commons/notification/index.d.ts +1 -0
- package/dist/conditionals/index.js +327 -58
- package/dist/csv.d.ts +25 -0
- package/dist/csv.d.ts.map +1 -0
- package/dist/csv.js +120 -0
- 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/questions.d.ts.map +1 -1
- package/dist/environment/questions.js +20 -14
- package/dist/environment/setup-environment.js +3 -2
- 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 +3586 -3334
- 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/migrations/v2.1/add-recovery-link-notifications.d.ts +3 -0
- package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts.map +1 -0
- package/dist/migrations/v2.1/add-recovery-link-notifications.js +511 -0
- package/dist/migrations/v2.1/add-translations.d.ts +9 -0
- package/dist/migrations/v2.1/add-translations.d.ts.map +1 -0
- package/dist/migrations/v2.1/add-translations.js +213 -0
- package/dist/migrations/v2.1/enable-telemetry.d.ts +3 -0
- package/dist/migrations/v2.1/enable-telemetry.d.ts.map +1 -0
- package/dist/migrations/v2.1/enable-telemetry.js +438 -0
- package/dist/migrations/v2.1/index.d.ts.map +1 -1
- package/dist/migrations/v2.1/index.js +1058 -0
- package/dist/notification/index.js +1777 -1478
- package/dist/scopes/index.d.ts +325 -32
- package/dist/scopes/index.js +328 -58
- package/dist/telemetry/index.d.ts +45 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +39 -0
- package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -3
- package/dist/templates/charts-values/opentelemetry/values.yaml +95 -0
- package/dist/templates/charts-values/traefik/values.yaml +23 -9
- package/dist/templates/inventory/inventory.template.yml +1 -3
- package/dist/translations/check.d.ts +19 -0
- package/dist/translations/check.d.ts.map +1 -0
- package/dist/translations/check.js +127 -0
- package/opencrvs-toolkit-2.1.0-rc.a4ec5a4.tgz +0 -0
- package/package.json +10 -6
- package/tsconfig.build.json +11 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/dist/templates/inventory/production.example.yml +0 -77
- package/dist/templates/inventory/qa.example.yml +0 -48
- package/opencrvs-toolkit-2.1.0-rc.a2d8806.tgz +0 -0
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -18,9 +18,11 @@ export declare const LocationStatus: z.ZodEnum<{
|
|
|
18
18
|
}>;
|
|
19
19
|
export type LocationStatus = z.infer<typeof LocationStatus>;
|
|
20
20
|
/**
|
|
21
|
-
* A single element of the
|
|
22
|
-
*
|
|
23
|
-
*
|
|
21
|
+
* A single element of the `versions` history of a location or administrative
|
|
22
|
+
* area. Versions are sorted ascending by `effectiveFrom` ('0001-01-01' is used
|
|
23
|
+
* as the beginning-of-time sentinel). Updates only ever append, but a
|
|
24
|
+
* not-yet-effective version can be withdrawn and seeding replaces a history
|
|
25
|
+
* wholesale, so the array is not append-only.
|
|
24
26
|
*/
|
|
25
27
|
export declare const LocationVersion: z.ZodObject<{
|
|
26
28
|
versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
@@ -131,9 +133,25 @@ export type ClientLocation = z.infer<typeof ClientLocation>;
|
|
|
131
133
|
export declare function toClientLocation(location: Location): ClientLocation;
|
|
132
134
|
/** See {@link toClientLocation}. */
|
|
133
135
|
export declare function toClientAdministrativeArea(area: AdministrativeArea): ClientAdministrativeArea;
|
|
136
|
+
export declare const SeededLocationVersions: z.ZodArray<z.ZodObject<{
|
|
137
|
+
versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
138
|
+
effectiveFrom: z.ZodISODate;
|
|
139
|
+
name: z.ZodString;
|
|
140
|
+
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
141
|
+
status: z.ZodEnum<{
|
|
142
|
+
active: "active";
|
|
143
|
+
inactive: "inactive";
|
|
144
|
+
}>;
|
|
145
|
+
}, z.core.$strip>>;
|
|
146
|
+
export type SeededLocationVersions = z.infer<typeof SeededLocationVersions>;
|
|
134
147
|
/**
|
|
135
|
-
* Input payload for the locations `set` mutation. Carries
|
|
136
|
-
* identity and hierarchy fields
|
|
148
|
+
* Input payload for the locations `set` mutation. Carries the seedable
|
|
149
|
+
* identity and hierarchy fields, plus an optional pre-built history.
|
|
150
|
+
*
|
|
151
|
+
* Last-write-wins on history: a repeated seed of the same row replaces its
|
|
152
|
+
* stored `versions`, so a caller that means to keep one has to send it every
|
|
153
|
+
* time. Seeding is only reachable while system initialisation is incomplete,
|
|
154
|
+
* so this replaces what an earlier seed attempt wrote, never a live history.
|
|
137
155
|
*/
|
|
138
156
|
export declare const SetLocationPayload: z.ZodObject<{
|
|
139
157
|
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
@@ -141,18 +159,38 @@ export declare const SetLocationPayload: z.ZodObject<{
|
|
|
141
159
|
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
142
160
|
administrativeAreaId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
143
161
|
locationType: z.ZodNullable<z.ZodString>;
|
|
162
|
+
versions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
163
|
+
versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
164
|
+
effectiveFrom: z.ZodISODate;
|
|
165
|
+
name: z.ZodString;
|
|
166
|
+
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
167
|
+
status: z.ZodEnum<{
|
|
168
|
+
active: "active";
|
|
169
|
+
inactive: "inactive";
|
|
170
|
+
}>;
|
|
171
|
+
}, z.core.$strip>>>;
|
|
144
172
|
}, z.core.$strip>;
|
|
145
173
|
export type SetLocationPayload = z.infer<typeof SetLocationPayload>;
|
|
146
174
|
/**
|
|
147
|
-
* Input payload for the administrative areas `set` mutation.
|
|
148
|
-
*
|
|
149
|
-
*
|
|
175
|
+
* Input payload for the administrative areas `set` mutation. Twin of
|
|
176
|
+
* {@link SetLocationPayload}, including the optional pre-built `versions`
|
|
177
|
+
* history and the same semantics for omitting it.
|
|
150
178
|
*/
|
|
151
179
|
export declare const SetAdministrativeAreaPayload: z.ZodObject<{
|
|
152
180
|
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
153
181
|
name: z.ZodString;
|
|
154
182
|
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
155
183
|
parentId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
184
|
+
versions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
185
|
+
versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
186
|
+
effectiveFrom: z.ZodISODate;
|
|
187
|
+
name: z.ZodString;
|
|
188
|
+
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
189
|
+
status: z.ZodEnum<{
|
|
190
|
+
active: "active";
|
|
191
|
+
inactive: "inactive";
|
|
192
|
+
}>;
|
|
193
|
+
}, z.core.$strip>>>;
|
|
156
194
|
}, z.core.$strip>;
|
|
157
195
|
export type SetAdministrativeAreaPayload = z.infer<typeof SetAdministrativeAreaPayload>;
|
|
158
196
|
/**
|
|
@@ -167,6 +205,17 @@ export type SetAdministrativeAreaPayload = z.infer<typeof SetAdministrativeAreaP
|
|
|
167
205
|
export declare function resolveVersion<T extends {
|
|
168
206
|
effectiveFrom: string;
|
|
169
207
|
}>(versions: T[], anchor: string): T;
|
|
208
|
+
/**
|
|
209
|
+
* Whether the entity is selectable at `anchor`: it must already have a
|
|
210
|
+
* version effective by then, and the version that resolves at `anchor` must
|
|
211
|
+
* be active. `resolveVersion` alone is not enough for this — when `anchor`
|
|
212
|
+
* precedes every version it falls back to the earliest one, which would
|
|
213
|
+
* otherwise make a location created after `anchor` look selectable.
|
|
214
|
+
*/
|
|
215
|
+
export declare function isSelectableAtAnchor<T extends {
|
|
216
|
+
effectiveFrom: string;
|
|
217
|
+
status: string;
|
|
218
|
+
}>(versions: T[], anchor: string): boolean;
|
|
170
219
|
/**
|
|
171
220
|
* Whether the entity holds the given externalId with active status at the
|
|
172
221
|
* anchor date or at any point after it. Used for point-in-time uniqueness of
|
|
@@ -198,7 +247,7 @@ export type EventIndexWithAdministrativeHierarchy = Omit<ToArrayFields<EventInde
|
|
|
198
247
|
* Return false early to break out of checks as soon as possible - if any option is not satisfied, the scope does not allow access to the event, so no need to check further options.
|
|
199
248
|
*
|
|
200
249
|
*/
|
|
201
|
-
export declare function canAccessEventWithScope(event:
|
|
250
|
+
export declare function canAccessEventWithScope(event: EventIndexWithAdministrativeHierarchy, scope: RecordScopeV2, user: UserContext | SystemContext, customActionType?: string): boolean;
|
|
202
251
|
export type UserWithResolvedHierarchy = {
|
|
203
252
|
role: string;
|
|
204
253
|
administrativeHierarchy: UUID[];
|
|
@@ -219,7 +268,7 @@ export declare function canAccessOtherUserWithScopes({ scopes, userToAccess, use
|
|
|
219
268
|
*
|
|
220
269
|
* One of the scopes must allow access for the event to be accessible.
|
|
221
270
|
*/
|
|
222
|
-
export declare function userCanAccessEventWithScopes(event:
|
|
271
|
+
export declare function userCanAccessEventWithScopes(event: EventIndexWithAdministrativeHierarchy, scopes: RecordScopeV2[], user: UserContext | SystemContext, customActionType?: string): boolean;
|
|
223
272
|
export declare function getAdministrativeAreaHierarchy<A extends {
|
|
224
273
|
id: UUID;
|
|
225
274
|
parentId: UUID | null;
|
|
@@ -9,7 +9,7 @@ import { EventIndex } from './EventIndex';
|
|
|
9
9
|
import { EventInput } from './EventInput';
|
|
10
10
|
import { TranslationConfig } from './TranslationConfig';
|
|
11
11
|
import { FieldConfig } from './FieldConfig';
|
|
12
|
-
import { SetLocationPayload, SetAdministrativeAreaPayload } from './locations';
|
|
12
|
+
import { LocationVersion, SetLocationPayload, SetAdministrativeAreaPayload } from './locations';
|
|
13
13
|
import { WorkqueueConfig } from './WorkqueueConfig';
|
|
14
14
|
import * as z from 'zod/v4';
|
|
15
15
|
import { DocumentPath } from '../documents';
|
|
@@ -43,6 +43,13 @@ export declare function generateUuid(rng?: () => number): UUID;
|
|
|
43
43
|
export declare function generateTrackingId(rng: () => number): string;
|
|
44
44
|
export declare function generateRegistrationNumber(rng: () => number): string;
|
|
45
45
|
export declare function generateRandomSignature(rng: () => number): DocumentPath;
|
|
46
|
+
/**
|
|
47
|
+
* Builds one element of a location / administrative area `versions` history.
|
|
48
|
+
* Every field is defaulted so a call names only what its assertion is about —
|
|
49
|
+
* an `effectiveFrom`, a `name`, or an explicit `versionId` when the test needs
|
|
50
|
+
* to control version identity.
|
|
51
|
+
*/
|
|
52
|
+
export declare function locationVersion(overrides?: Partial<LocationVersion>, rng?: () => number): LocationVersion;
|
|
46
53
|
export declare function fieldConfigsToActionPayload(fields: FieldConfig[], rng: () => number,
|
|
47
54
|
/**
|
|
48
55
|
* Given hierarchy, ensures that related fields (e.g. location and administrative area) have valid values based on the hierarchy.
|
|
@@ -124,9 +131,6 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
|
|
|
124
131
|
declaration: {};
|
|
125
132
|
annotation: {};
|
|
126
133
|
eventId: string;
|
|
127
|
-
content: {
|
|
128
|
-
reason: string;
|
|
129
|
-
};
|
|
130
134
|
};
|
|
131
135
|
unarchive: (eventId: string, input?: Partial<Pick<UnarchiveActionInput, 'transactionId' | 'declaration' | 'keepAssignment'>>) => {
|
|
132
136
|
keepAssignment?: boolean | undefined;
|
|
@@ -255,9 +255,9 @@ export declare function findLastAssignmentAction(actions: Action[]): {
|
|
|
255
255
|
status: "Accepted" | "Rejected" | "Requested";
|
|
256
256
|
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
257
257
|
type: "ARCHIVE";
|
|
258
|
-
content
|
|
258
|
+
content?: {
|
|
259
259
|
reason: string;
|
|
260
|
-
};
|
|
260
|
+
} | undefined;
|
|
261
261
|
} | {
|
|
262
262
|
id: string & import("zod").$brand<"UUID">;
|
|
263
263
|
transactionId: string;
|
|
@@ -5,6 +5,8 @@ export declare const TriggerEvent: {
|
|
|
5
5
|
readonly USERNAME_REMINDER: 'username-reminder';
|
|
6
6
|
readonly RESET_PASSWORD: 'reset-password';
|
|
7
7
|
readonly RESET_PASSWORD_BY_ADMIN: 'reset-password-by-admin';
|
|
8
|
+
readonly PASSWORD_RESET_LINK: 'password-reset-link';
|
|
9
|
+
readonly USERNAME_REMINDER_LINK: 'username-reminder-link';
|
|
8
10
|
readonly RESEND_INVITE: 'resend-invite';
|
|
9
11
|
readonly TWO_FA: '2fa';
|
|
10
12
|
readonly ALL_USER_NOTIFICATION: 'all-user-notification';
|
|
@@ -113,6 +115,32 @@ export declare const TriggerPayload: {
|
|
|
113
115
|
role: z.ZodString;
|
|
114
116
|
}, z.core.$strip>;
|
|
115
117
|
}, z.core.$strip>;
|
|
118
|
+
readonly "password-reset-link": z.ZodObject<{
|
|
119
|
+
recipient: z.ZodObject<{
|
|
120
|
+
name: z.ZodOptional<z.ZodObject<{
|
|
121
|
+
firstname: z.ZodString;
|
|
122
|
+
surname: z.ZodString;
|
|
123
|
+
middlename: z.ZodOptional<z.ZodString>;
|
|
124
|
+
}, z.core.$strip>>;
|
|
125
|
+
mobile: z.ZodOptional<z.ZodString>;
|
|
126
|
+
email: z.ZodOptional<z.ZodString>;
|
|
127
|
+
bcc: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
128
|
+
}, z.core.$strip>;
|
|
129
|
+
token: z.ZodString;
|
|
130
|
+
}, z.core.$strip>;
|
|
131
|
+
readonly "username-reminder-link": z.ZodObject<{
|
|
132
|
+
recipient: z.ZodObject<{
|
|
133
|
+
name: z.ZodOptional<z.ZodObject<{
|
|
134
|
+
firstname: z.ZodString;
|
|
135
|
+
surname: z.ZodString;
|
|
136
|
+
middlename: z.ZodOptional<z.ZodString>;
|
|
137
|
+
}, z.core.$strip>>;
|
|
138
|
+
mobile: z.ZodOptional<z.ZodString>;
|
|
139
|
+
email: z.ZodOptional<z.ZodString>;
|
|
140
|
+
bcc: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
141
|
+
}, z.core.$strip>;
|
|
142
|
+
token: z.ZodString;
|
|
143
|
+
}, z.core.$strip>;
|
|
116
144
|
readonly "resend-invite": z.ZodObject<{
|
|
117
145
|
recipient: z.ZodObject<{
|
|
118
146
|
name: z.ZodOptional<z.ZodObject<{
|
|
@@ -184,18 +212,5 @@ export declare const TriggerPayload: {
|
|
|
184
212
|
export type TriggerPayload = {
|
|
185
213
|
[K in TriggerEvent]: z.infer<(typeof TriggerPayload)[K]>;
|
|
186
214
|
};
|
|
187
|
-
export declare function triggerUserEventNotification(args: {
|
|
188
|
-
event: typeof TriggerEvent.ALL_USER_NOTIFICATION;
|
|
189
|
-
payload: TriggerPayload[typeof TriggerEvent.ALL_USER_NOTIFICATION];
|
|
190
|
-
countryConfigUrl: string;
|
|
191
|
-
}): Promise<Response>;
|
|
192
|
-
export declare function triggerUserEventNotification<T extends Exclude<TriggerEvent, typeof TriggerEvent.ALL_USER_NOTIFICATION>>(args: {
|
|
193
|
-
event: T;
|
|
194
|
-
payload: TriggerPayload[T];
|
|
195
|
-
countryConfigUrl: string;
|
|
196
|
-
authHeader: {
|
|
197
|
-
Authorization: string;
|
|
198
|
-
};
|
|
199
|
-
}): Promise<Response>;
|
|
200
215
|
export declare function parseUserEventTrigger<T extends TriggerEvent>(event: T, body: unknown): TriggerPayload[T];
|
|
201
216
|
//# sourceMappingURL=UserNotifications.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TriggerEvent, TriggerPayload } from './UserNotifications';
|
|
2
|
+
export declare function triggerUserEventNotification(args: {
|
|
3
|
+
event: typeof TriggerEvent.ALL_USER_NOTIFICATION;
|
|
4
|
+
payload: TriggerPayload[typeof TriggerEvent.ALL_USER_NOTIFICATION];
|
|
5
|
+
countryConfigUrl: string;
|
|
6
|
+
}): Promise<Response>;
|
|
7
|
+
export declare function triggerUserEventNotification<T extends Exclude<TriggerEvent, typeof TriggerEvent.ALL_USER_NOTIFICATION>>(args: {
|
|
8
|
+
event: T;
|
|
9
|
+
payload: TriggerPayload[T];
|
|
10
|
+
countryConfigUrl: string;
|
|
11
|
+
authHeader: {
|
|
12
|
+
Authorization: string;
|
|
13
|
+
};
|
|
14
|
+
}): Promise<Response>;
|
|
15
|
+
//# sourceMappingURL=dispatch.d.ts.map
|