@opencrvs/toolkit 2.1.0-rc.a434ca3 → 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/build.sh +5 -1
- package/create-countryconfig/index.js +284 -97
- package/create-countryconfig/node_modules/.bin/degit +21 -0
- package/create-countryconfig/package.json +4 -1
- package/dist/application-config/index.js +244 -209
- package/dist/cli.js +1287 -84
- package/dist/commons/api/router.d.ts +407 -50
- package/dist/commons/conditionals/conditionals.d.ts +6 -6
- package/dist/commons/conditionals/validate.d.ts +6 -2
- package/dist/commons/events/ActionDocument.d.ts +4 -4
- package/dist/commons/events/ActionInput.d.ts +4 -4
- package/dist/commons/events/AdvancedSearchConfig.d.ts +12 -0
- package/dist/commons/events/EventDocument.d.ts +470 -2
- 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 +18 -0
- package/dist/commons/events/FieldTypeMapping.d.ts +15 -15
- 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 +79 -57
- package/dist/csv.d.ts +25 -0
- package/dist/csv.d.ts.map +1 -0
- package/dist/csv.js +120 -0
- package/dist/environment/questions.d.ts.map +1 -1
- package/dist/environment/questions.js +20 -14
- package/dist/environment/setup-environment.js +1 -1
- package/dist/events/index.js +841 -777
- 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 +938 -1361
- package/dist/scopes/index.d.ts +77 -7
- package/dist/scopes/index.js +79 -57
- 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 +1 -1
- package/dist/templates/charts-values/opentelemetry/values.yaml +22 -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 +7 -3
- 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.a434ca3.tgz +0 -0
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -29,15 +29,11 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
|
|
|
29
29
|
}> | z.ZodNumber | z.ZodObject<Readonly<{
|
|
30
30
|
[k: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
31
31
|
}>, z.core.$strip> | z.ZodObject<{
|
|
32
|
-
age: z.ZodNumber;
|
|
33
|
-
asOfDateRef: z.ZodString;
|
|
34
|
-
}, z.core.$strip> | z.ZodObject<{
|
|
35
|
-
label: z.ZodString;
|
|
36
|
-
value: z.ZodString;
|
|
37
|
-
}, z.core.$strip> | z.ZodObject<{
|
|
38
32
|
path: z.core.$ZodBranded<z.ZodString, "DocumentPath", "out">;
|
|
39
33
|
originalFilename: z.ZodString;
|
|
40
34
|
type: z.ZodString;
|
|
35
|
+
}, z.core.$strip> | z.ZodObject<{
|
|
36
|
+
data: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
41
37
|
}, z.core.$strip> | z.ZodObject<{
|
|
42
38
|
data: z.ZodAny;
|
|
43
39
|
}, z.core.$strip> | z.ZodObject<{
|
|
@@ -47,7 +43,11 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
|
|
|
47
43
|
numericValue: z.ZodOptional<z.ZodNumber>;
|
|
48
44
|
unit: z.ZodOptional<z.ZodString>;
|
|
49
45
|
}, z.core.$strip> | z.ZodObject<{
|
|
50
|
-
|
|
46
|
+
age: z.ZodNumber;
|
|
47
|
+
asOfDateRef: z.ZodString;
|
|
48
|
+
}, z.core.$strip> | z.ZodObject<{
|
|
49
|
+
label: z.ZodString;
|
|
50
|
+
value: z.ZodString;
|
|
51
51
|
}, z.core.$strip> | z.ZodObject<{
|
|
52
52
|
firstname: z.ZodString;
|
|
53
53
|
surname: z.ZodString;
|
|
@@ -65,15 +65,11 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
|
|
|
65
65
|
}>>> | z.ZodOptional<z.ZodNullable<z.ZodNumber>> | z.ZodOptional<z.ZodNullable<z.ZodObject<Readonly<{
|
|
66
66
|
[k: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
67
67
|
}>, z.core.$strip>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
68
|
-
age: z.ZodNumber;
|
|
69
|
-
asOfDateRef: z.ZodString;
|
|
70
|
-
}, z.core.$strip>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
71
|
-
label: z.ZodString;
|
|
72
|
-
value: z.ZodString;
|
|
73
|
-
}, z.core.$strip>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
74
68
|
path: z.core.$ZodBranded<z.ZodString, "DocumentPath", "out">;
|
|
75
69
|
originalFilename: z.ZodString;
|
|
76
70
|
type: z.ZodString;
|
|
71
|
+
}, z.core.$strip>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
72
|
+
data: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
77
73
|
}, z.core.$strip>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
78
74
|
data: z.ZodAny;
|
|
79
75
|
}, z.core.$strip>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
@@ -82,6 +78,12 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
|
|
|
82
78
|
}, z.core.$strip>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
83
79
|
numericValue: z.ZodOptional<z.ZodNumber>;
|
|
84
80
|
unit: z.ZodOptional<z.ZodString>;
|
|
81
|
+
}, z.core.$strip>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
82
|
+
age: z.ZodNumber;
|
|
83
|
+
asOfDateRef: z.ZodString;
|
|
84
|
+
}, z.core.$strip>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
85
|
+
label: z.ZodString;
|
|
86
|
+
value: z.ZodString;
|
|
85
87
|
}, z.core.$strip>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
86
88
|
data: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
87
89
|
country: z.ZodString;
|
|
@@ -152,8 +154,6 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
|
|
|
152
154
|
label: z.ZodString;
|
|
153
155
|
value: z.ZodString;
|
|
154
156
|
}, z.core.$strip>>>]>>;
|
|
155
|
-
}, z.core.$strip>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
156
|
-
data: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
157
157
|
}, z.core.$strip>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
158
158
|
firstname: z.ZodString;
|
|
159
159
|
surname: z.ZodString;
|
|
@@ -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
|
|
@@ -47,7 +47,7 @@ __export(conditionals_exports, {
|
|
|
47
47
|
user: () => user
|
|
48
48
|
});
|
|
49
49
|
module.exports = __toCommonJS(conditionals_exports);
|
|
50
|
-
var
|
|
50
|
+
var z13 = __toESM(require("zod/v4"));
|
|
51
51
|
|
|
52
52
|
// ../commons/src/conditionals/conditionals.ts
|
|
53
53
|
var objectHash = __toESM(require("object-hash"));
|
|
@@ -124,7 +124,7 @@ function todayDateTimeValueSerializer() {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
// ../commons/src/scopes.ts
|
|
127
|
-
var
|
|
127
|
+
var z11 = __toESM(require("zod/v4"));
|
|
128
128
|
var qs = __toESM(require("qs"));
|
|
129
129
|
|
|
130
130
|
// ../commons/src/uuid.ts
|
|
@@ -383,12 +383,22 @@ var ActionFlagConfig = z9.object({
|
|
|
383
383
|
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
384
384
|
});
|
|
385
385
|
|
|
386
|
+
// ../commons/src/events/EventStatus.ts
|
|
387
|
+
var z10 = __toESM(require("zod/v4"));
|
|
388
|
+
var EventStatus = z10.enum([
|
|
389
|
+
"CREATED",
|
|
390
|
+
"NOTIFIED",
|
|
391
|
+
"DECLARED",
|
|
392
|
+
"REGISTERED",
|
|
393
|
+
"ARCHIVED"
|
|
394
|
+
]);
|
|
395
|
+
|
|
386
396
|
// ../commons/src/scopes.ts
|
|
387
|
-
var JurisdictionFilter =
|
|
397
|
+
var JurisdictionFilter = z11.enum(["administrativeArea", "location", "all"]).describe(
|
|
388
398
|
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
389
399
|
);
|
|
390
|
-
var UserFilter =
|
|
391
|
-
var RecordScopeTypeV2 =
|
|
400
|
+
var UserFilter = z11.enum(["user"]).describe("Filters based on the user. Limits to self.");
|
|
401
|
+
var RecordScopeTypeV2 = z11.enum([
|
|
392
402
|
"record.search",
|
|
393
403
|
"record.create",
|
|
394
404
|
"record.read",
|
|
@@ -406,12 +416,17 @@ var RecordScopeTypeV2 = z10.enum([
|
|
|
406
416
|
"record.unassign-others",
|
|
407
417
|
"record.custom-action"
|
|
408
418
|
]);
|
|
409
|
-
var PlainScopeType =
|
|
419
|
+
var PlainScopeType = z11.enum([
|
|
410
420
|
// Misc. system scopes
|
|
411
421
|
"bypassratelimit",
|
|
412
422
|
"record.reindex",
|
|
413
423
|
"user.data-seeding",
|
|
414
424
|
"integration.create",
|
|
425
|
+
// Reading an integration's audit log. Deliberately separate from
|
|
426
|
+
// 'integration.create' so read-only oversight can be granted on its own, and
|
|
427
|
+
// deliberately option-less: system clients have no office and no
|
|
428
|
+
// administrative area, so jurisdiction options would have nothing to bind to.
|
|
429
|
+
"integration.audit.read",
|
|
415
430
|
"record.import",
|
|
416
431
|
"config.update-all",
|
|
417
432
|
"location.edit",
|
|
@@ -426,15 +441,21 @@ var PlainScopeType = z10.enum([
|
|
|
426
441
|
"record.confirm-registration",
|
|
427
442
|
"record.reject-registration"
|
|
428
443
|
]);
|
|
429
|
-
var scopeByEvent =
|
|
444
|
+
var scopeByEvent = z11.preprocess(
|
|
430
445
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
431
|
-
|
|
446
|
+
z11.array(z11.string()).optional()
|
|
432
447
|
).describe("Event type, e.g. birth, death");
|
|
433
|
-
var
|
|
448
|
+
var scopeByStatus = z11.preprocess(
|
|
434
449
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
435
|
-
|
|
450
|
+
z11.array(EventStatus).optional()
|
|
451
|
+
).describe(
|
|
452
|
+
"Restricts the scope to records currently in one of these statuses."
|
|
453
|
+
);
|
|
454
|
+
var userRole = z11.preprocess(
|
|
455
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
456
|
+
z11.array(z11.string()).optional()
|
|
436
457
|
).describe("User role, e.g. admin, field agent");
|
|
437
|
-
var scopeOptionsPlaceEvent =
|
|
458
|
+
var scopeOptionsPlaceEvent = z11.object({
|
|
438
459
|
event: scopeByEvent,
|
|
439
460
|
placeOfEvent: JurisdictionFilter.optional()
|
|
440
461
|
}).describe("Options applicable to all record scopes.");
|
|
@@ -442,7 +463,8 @@ var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
|
442
463
|
notifiedIn: JurisdictionFilter.optional(),
|
|
443
464
|
notifiedBy: UserFilter.optional(),
|
|
444
465
|
declaredIn: JurisdictionFilter.optional(),
|
|
445
|
-
declaredBy: UserFilter.optional()
|
|
466
|
+
declaredBy: UserFilter.optional(),
|
|
467
|
+
status: scopeByStatus
|
|
446
468
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
447
469
|
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
448
470
|
registeredIn: JurisdictionFilter.optional(),
|
|
@@ -452,31 +474,31 @@ var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
|
452
474
|
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
453
475
|
);
|
|
454
476
|
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
455
|
-
customActionTypes:
|
|
477
|
+
customActionTypes: z11.preprocess(
|
|
456
478
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
457
|
-
|
|
479
|
+
z11.array(z11.string()).optional()
|
|
458
480
|
).describe("Allowed custom action types")
|
|
459
481
|
});
|
|
460
|
-
var AccessLevelOptions =
|
|
482
|
+
var AccessLevelOptions = z11.object({
|
|
461
483
|
accessLevel: JurisdictionFilter.optional()
|
|
462
484
|
});
|
|
463
485
|
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
464
486
|
role: userRole.optional()
|
|
465
487
|
});
|
|
466
|
-
var WorkqueueOrDashboardOptions =
|
|
467
|
-
ids:
|
|
488
|
+
var WorkqueueOrDashboardOptions = z11.object({
|
|
489
|
+
ids: z11.preprocess(
|
|
468
490
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
469
|
-
|
|
491
|
+
z11.array(z11.string())
|
|
470
492
|
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
471
493
|
});
|
|
472
|
-
var AllScopeOptions =
|
|
494
|
+
var AllScopeOptions = z11.object({
|
|
473
495
|
...AllRecordScopeOptions.shape,
|
|
474
496
|
...AccessLevelOptions.shape,
|
|
475
497
|
...AllUserScopeOptions.shape,
|
|
476
498
|
...WorkqueueOrDashboardOptions.shape
|
|
477
499
|
});
|
|
478
500
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
479
|
-
var ResolvedScopeOptionsPlaceEvent =
|
|
501
|
+
var ResolvedScopeOptionsPlaceEvent = z11.object({
|
|
480
502
|
event: scopeByEvent,
|
|
481
503
|
placeOfEvent: UUID.nullish()
|
|
482
504
|
}).describe(
|
|
@@ -484,15 +506,15 @@ var ResolvedScopeOptionsPlaceEvent = z10.object({
|
|
|
484
506
|
);
|
|
485
507
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
486
508
|
notifiedIn: UUID.nullish(),
|
|
487
|
-
notifiedBy:
|
|
509
|
+
notifiedBy: z11.string().optional(),
|
|
488
510
|
declaredIn: UUID.nullish(),
|
|
489
|
-
declaredBy:
|
|
511
|
+
declaredBy: z11.string().optional()
|
|
490
512
|
}).describe(
|
|
491
513
|
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
492
514
|
);
|
|
493
515
|
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
494
516
|
registeredIn: UUID.nullish(),
|
|
495
|
-
registeredBy:
|
|
517
|
+
registeredBy: z11.string().optional(),
|
|
496
518
|
flags: ContainsFlags.optional()
|
|
497
519
|
}).describe(
|
|
498
520
|
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
@@ -507,7 +529,6 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
|
507
529
|
"record.reject",
|
|
508
530
|
"record.archive",
|
|
509
531
|
"record.unarchive",
|
|
510
|
-
"record.review-duplicates",
|
|
511
532
|
"record.register"
|
|
512
533
|
]);
|
|
513
534
|
var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
@@ -515,41 +536,42 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
|
515
536
|
"record.read",
|
|
516
537
|
"record.request-correction",
|
|
517
538
|
"record.correct",
|
|
518
|
-
"record.unassign-others"
|
|
539
|
+
"record.unassign-others",
|
|
540
|
+
"record.review-duplicates"
|
|
519
541
|
]);
|
|
520
542
|
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
521
|
-
templates:
|
|
543
|
+
templates: z11.preprocess(
|
|
522
544
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
523
|
-
|
|
545
|
+
z11.array(z11.string()).optional()
|
|
524
546
|
).describe(
|
|
525
547
|
"Template IDs for certified copies. Controls which certificate templates are returned to the client via the config service. Certificate printing is a client-side operation \u2014 this option is not validated when the printCertificate action is submitted."
|
|
526
548
|
)
|
|
527
549
|
});
|
|
528
|
-
var RecordScopeV2 =
|
|
529
|
-
|
|
550
|
+
var RecordScopeV2 = z11.discriminatedUnion("type", [
|
|
551
|
+
z11.object({
|
|
530
552
|
type: ScopesWithPlaceEventOptions,
|
|
531
553
|
options: scopeOptionsPlaceEvent.optional()
|
|
532
554
|
}),
|
|
533
|
-
|
|
555
|
+
z11.object({
|
|
534
556
|
type: ScopesWithDeclaredOptions,
|
|
535
557
|
options: scopeOptionsDeclaredOrNotified.optional()
|
|
536
558
|
}),
|
|
537
|
-
|
|
559
|
+
z11.object({
|
|
538
560
|
type: ScopesWithFullOptions,
|
|
539
561
|
options: AllRecordScopeOptions.optional()
|
|
540
562
|
}),
|
|
541
|
-
|
|
542
|
-
type:
|
|
563
|
+
z11.object({
|
|
564
|
+
type: z11.literal("record.custom-action"),
|
|
543
565
|
options: CustomActionScopeOptions.optional()
|
|
544
566
|
}),
|
|
545
|
-
|
|
546
|
-
type:
|
|
567
|
+
z11.object({
|
|
568
|
+
type: z11.literal("record.print-certified-copies"),
|
|
547
569
|
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
548
570
|
})
|
|
549
571
|
]).describe(
|
|
550
572
|
"Scopes used to check user's permission to perform actions on a record."
|
|
551
573
|
);
|
|
552
|
-
var SystemScopeType =
|
|
574
|
+
var SystemScopeType = z11.enum([
|
|
553
575
|
"organisation.read-locations",
|
|
554
576
|
"user.read",
|
|
555
577
|
"user.create",
|
|
@@ -563,61 +585,61 @@ var UserScopeType = SystemScopeType.extract([
|
|
|
563
585
|
"user.search"
|
|
564
586
|
]);
|
|
565
587
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
566
|
-
var UserScopeV2 =
|
|
567
|
-
|
|
588
|
+
var UserScopeV2 = z11.discriminatedUnion("type", [
|
|
589
|
+
z11.object({
|
|
568
590
|
type: ScopesWithRoleOption,
|
|
569
591
|
options: AllUserScopeOptions.optional()
|
|
570
592
|
}),
|
|
571
|
-
|
|
593
|
+
z11.object({
|
|
572
594
|
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
573
595
|
options: AccessLevelOptions.optional()
|
|
574
596
|
})
|
|
575
597
|
]);
|
|
576
|
-
var ResolvedRecordScopeV2 =
|
|
577
|
-
|
|
598
|
+
var ResolvedRecordScopeV2 = z11.discriminatedUnion("type", [
|
|
599
|
+
z11.object({
|
|
578
600
|
type: ScopesWithPlaceEventOptions,
|
|
579
601
|
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
580
602
|
}),
|
|
581
|
-
|
|
603
|
+
z11.object({
|
|
582
604
|
type: ScopesWithDeclaredOptions,
|
|
583
605
|
options: ResolvedScopeOptionsDeclared.optional()
|
|
584
606
|
}),
|
|
585
|
-
|
|
607
|
+
z11.object({
|
|
586
608
|
type: ScopesWithFullOptions,
|
|
587
609
|
options: ResolvedScopeOptionsFull.optional()
|
|
588
610
|
}),
|
|
589
|
-
|
|
590
|
-
type:
|
|
611
|
+
z11.object({
|
|
612
|
+
type: z11.literal("record.print-certified-copies"),
|
|
591
613
|
options: ResolvedScopeOptionsFull.extend({
|
|
592
|
-
templates:
|
|
614
|
+
templates: z11.array(z11.string()).optional()
|
|
593
615
|
}).optional()
|
|
594
616
|
})
|
|
595
617
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
596
|
-
var Scope2 =
|
|
597
|
-
|
|
618
|
+
var Scope2 = z11.discriminatedUnion("type", [
|
|
619
|
+
z11.object({ type: PlainScopeType }),
|
|
598
620
|
...RecordScopeV2.options,
|
|
599
621
|
...UserScopeV2.options,
|
|
600
|
-
|
|
601
|
-
type:
|
|
622
|
+
z11.object({
|
|
623
|
+
type: z11.literal("organisation.read-locations"),
|
|
602
624
|
options: AccessLevelOptions.optional()
|
|
603
625
|
}),
|
|
604
|
-
|
|
605
|
-
type:
|
|
626
|
+
z11.object({
|
|
627
|
+
type: z11.literal("workqueue"),
|
|
606
628
|
options: WorkqueueOrDashboardOptions
|
|
607
629
|
}),
|
|
608
|
-
|
|
609
|
-
type:
|
|
630
|
+
z11.object({
|
|
631
|
+
type: z11.literal("dashboard.view"),
|
|
610
632
|
options: WorkqueueOrDashboardOptions
|
|
611
633
|
})
|
|
612
634
|
]);
|
|
613
|
-
var ScopeType2 =
|
|
635
|
+
var ScopeType2 = z11.enum([
|
|
614
636
|
...SystemScopeType.options,
|
|
615
637
|
...RecordScopeTypeV2.options,
|
|
616
638
|
...PlainScopeType.options,
|
|
617
639
|
"workqueue",
|
|
618
640
|
"dashboard.view"
|
|
619
641
|
]);
|
|
620
|
-
var EncodedScope2 =
|
|
642
|
+
var EncodedScope2 = z11.string().brand("EncodedScope");
|
|
621
643
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
622
644
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
623
645
|
accessLevel: JurisdictionFilter.enum.all,
|
|
@@ -1312,4 +1334,4 @@ function createFieldConditionals(fieldId) {
|
|
|
1312
1334
|
}
|
|
1313
1335
|
|
|
1314
1336
|
// src/conditionals/index.ts
|
|
1315
|
-
|
|
1337
|
+
z13.globalRegistry.clear();
|
package/dist/csv.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type CsvFile = {
|
|
2
|
+
header: string;
|
|
3
|
+
body: string[];
|
|
4
|
+
/** Preserved so a file written on Windows stays written on Windows. */
|
|
5
|
+
newline: string;
|
|
6
|
+
trailingNewline: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function parseCsvLine(line: string): string[];
|
|
9
|
+
export declare function toCsvLine(values: string[]): string;
|
|
10
|
+
/**
|
|
11
|
+
* The id of a row, which is its first column. Translation ids never contain a
|
|
12
|
+
* comma or a quote, so this does not need the parser.
|
|
13
|
+
*/
|
|
14
|
+
export declare function idOf(line: string): string;
|
|
15
|
+
export declare function readCsvFile(path: string): CsvFile | undefined;
|
|
16
|
+
export declare function writeCsvFile(path: string, file: CsvFile): void;
|
|
17
|
+
/**
|
|
18
|
+
* Adds the rows the file does not already have an id for, in place. Rows go in
|
|
19
|
+
* sorted position when the file is sorted by id, and at the end when it is not,
|
|
20
|
+
* so a country config that keeps its own order keeps it.
|
|
21
|
+
*
|
|
22
|
+
* Returns the ids that were added.
|
|
23
|
+
*/
|
|
24
|
+
export declare function addRows(file: CsvFile, rows: string[]): string[];
|
|
25
|
+
//# sourceMappingURL=csv.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csv.d.ts","sourceRoot":"","sources":["../src/csv.ts"],"names":[],"mappings":"AAuBA,MAAM,MAAM,OAAO,GAAG;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,uEAAuE;IACvE,OAAO,EAAE,MAAM,CAAA;IACf,eAAe,EAAE,OAAO,CAAA;CACzB,CAAA;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAiCnD;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAMlD;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKzC;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAe7D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAM9D;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CA4B/D"}
|