@opencrvs/toolkit 2.1.0-rc.c3b24ba → 2.1.0-rc.c500a81
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 +3 -12
- package/build.sh +12 -4
- package/create-countryconfig/index.js +441 -59
- package/create-countryconfig/node_modules/.bin/degit +21 -0
- package/create-countryconfig/package.json +4 -1
- package/dist/application-config/index.js +347 -283
- package/dist/authentication/index.d.ts +67 -0
- package/dist/authentication/index.d.ts.map +1 -0
- package/dist/authentication/index.js +751 -0
- package/dist/cli.js +3011 -1226
- package/dist/commons/api/router.d.ts +658 -132
- package/dist/commons/application-config/index.d.ts +0 -2
- package/dist/commons/conditionals/conditionals.d.ts +6 -6
- package/dist/commons/conditionals/validate.d.ts +16 -5
- package/dist/commons/events/ActionConfig.d.ts +4 -0
- package/dist/commons/events/ActionDocument.d.ts +35 -15
- 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 +30 -12
- 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 +472 -4
- 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 +94 -63
- package/dist/commons/events/FieldTypeMapping.d.ts +27 -27
- package/dist/commons/events/FieldValue.d.ts +3 -2
- package/dist/commons/events/Flag.d.ts +42 -0
- package/dist/commons/events/FormConfig.d.ts +6 -0
- package/dist/commons/events/PageConfig.d.ts +4 -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 +162 -26
- package/dist/commons/events/mocks.test.utils.d.ts +30 -0
- package/dist/commons/events/test.utils.d.ts +73 -18
- package/dist/commons/events/utils.d.ts +34 -4
- package/dist/commons/notification/UserNotifications.d.ts +28 -13
- package/dist/commons/notification/dispatch.d.ts +10 -0
- package/dist/commons/notification/index.d.ts +1 -0
- package/dist/conditionals/index.js +334 -64
- 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 +12 -1
- package/dist/environment/logger.d.ts +15 -3
- package/dist/environment/logger.d.ts.map +1 -1
- package/dist/environment/manage-users.js +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.d.ts +1 -1
- package/dist/environment/setup-environment.d.ts.map +1 -1
- package/dist/environment/setup-environment.js +587 -562
- package/dist/environment/templates.d.ts +0 -1
- package/dist/environment/templates.d.ts.map +1 -1
- package/dist/environment/templates.js +5 -9
- package/dist/environment/update-workflows.d.ts.map +1 -1
- package/dist/environment/update-workflows.js +21 -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/environment/utils.d.ts +0 -12
- package/dist/environment/utils.d.ts.map +1 -1
- package/dist/environment/utils.js +1 -28
- package/dist/events/index.js +7597 -7129
- 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.0/convert-config-files-to-ts.d.ts.map +1 -1
- package/dist/migrations/v2.0/convert-config-files-to-ts.js +3 -10
- package/dist/migrations/v2.0/merge-infrastructure-directory.js +3 -3
- 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 +149 -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 +455 -0
- package/dist/migrations/v2.1/index.d.ts.map +1 -1
- package/dist/migrations/v2.1/index.js +1223 -0
- package/dist/migrations/v2.1/rename-trigger-paths.d.ts +3 -0
- package/dist/migrations/v2.1/rename-trigger-paths.d.ts.map +1 -0
- package/dist/migrations/v2.1/rename-trigger-paths.js +216 -0
- package/dist/notification/index.js +1800 -1454
- package/dist/scopes/index.d.ts +433 -36
- package/dist/scopes/index.js +335 -64
- package/dist/telemetry/index.d.ts +45 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +43 -0
- package/dist/templates/charts-values/dependencies/values.yaml +2 -0
- package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -3
- package/dist/templates/charts-values/opentelemetry/values.yaml +102 -0
- package/dist/templates/charts-values/traefik/values.yaml +23 -9
- package/dist/templates/inventory/inventory.template.yml +1 -3
- package/dist/translations/template.d.ts +11 -0
- package/dist/translations/template.d.ts.map +1 -0
- package/dist/translations/template.js +100 -0
- package/dist/verify/endpoints.d.ts +2 -0
- package/dist/verify/endpoints.d.ts.map +1 -0
- package/dist/verify/endpoints.js +510 -0
- package/opencrvs-toolkit-2.1.0-rc.c500a81.tgz +0 -0
- package/package.json +13 -7
- package/tsconfig.build.json +11 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +3 -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.c3b24ba.tgz +0 -0
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -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,10 @@
|
|
|
1
|
+
import { TriggerEvent, TriggerPayload } from './UserNotifications';
|
|
2
|
+
export declare function triggerUserEventNotification<T extends TriggerEvent>({ event, payload, countryConfigUrl, authHeader }: {
|
|
3
|
+
event: T;
|
|
4
|
+
payload: TriggerPayload[T];
|
|
5
|
+
countryConfigUrl: string;
|
|
6
|
+
authHeader: {
|
|
7
|
+
Authorization: string;
|
|
8
|
+
};
|
|
9
|
+
}): Promise<Response>;
|
|
10
|
+
//# 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
|
|
@@ -138,12 +138,267 @@ var z5 = __toESM(require("zod/v4"));
|
|
|
138
138
|
var TokenUserType = z5.enum(["user", "system"]);
|
|
139
139
|
var TokenWithBearer = z5.string().regex(/^Bearer\s/);
|
|
140
140
|
|
|
141
|
+
// ../commons/src/events/ActionType.ts
|
|
142
|
+
var z6 = __toESM(require("zod/v4"));
|
|
143
|
+
var ActionType = {
|
|
144
|
+
// Pre-declaration actions
|
|
145
|
+
DELETE: "DELETE",
|
|
146
|
+
CREATE: "CREATE",
|
|
147
|
+
NOTIFY: "NOTIFY",
|
|
148
|
+
// Declaration actions
|
|
149
|
+
DECLARE: "DECLARE",
|
|
150
|
+
REGISTER: "REGISTER",
|
|
151
|
+
EDIT: "EDIT",
|
|
152
|
+
// Declaration system actions. Non-configurable.
|
|
153
|
+
DUPLICATE_DETECTED: "DUPLICATE_DETECTED",
|
|
154
|
+
REJECT: "REJECT",
|
|
155
|
+
// REJECT_DECLARATION
|
|
156
|
+
MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
|
|
157
|
+
MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
|
|
158
|
+
ARCHIVE: "ARCHIVE",
|
|
159
|
+
UNARCHIVE: "UNARCHIVE",
|
|
160
|
+
// Record actions
|
|
161
|
+
PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
|
|
162
|
+
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
|
163
|
+
REJECT_CORRECTION: "REJECT_CORRECTION",
|
|
164
|
+
APPROVE_CORRECTION: "APPROVE_CORRECTION",
|
|
165
|
+
// General actions
|
|
166
|
+
READ: "READ",
|
|
167
|
+
ASSIGN: "ASSIGN",
|
|
168
|
+
UNASSIGN: "UNASSIGN",
|
|
169
|
+
// Custom action
|
|
170
|
+
CUSTOM: "CUSTOM"
|
|
171
|
+
};
|
|
172
|
+
var ConfirmableActions = [
|
|
173
|
+
ActionType.NOTIFY,
|
|
174
|
+
ActionType.DECLARE,
|
|
175
|
+
ActionType.EDIT,
|
|
176
|
+
ActionType.REGISTER,
|
|
177
|
+
ActionType.REJECT,
|
|
178
|
+
ActionType.ARCHIVE,
|
|
179
|
+
ActionType.UNARCHIVE,
|
|
180
|
+
ActionType.PRINT_CERTIFICATE,
|
|
181
|
+
ActionType.REQUEST_CORRECTION,
|
|
182
|
+
ActionType.APPROVE_CORRECTION,
|
|
183
|
+
ActionType.REJECT_CORRECTION,
|
|
184
|
+
ActionType.CUSTOM
|
|
185
|
+
];
|
|
186
|
+
var ActionTypes = z6.enum([
|
|
187
|
+
"DELETE",
|
|
188
|
+
"CREATE",
|
|
189
|
+
"NOTIFY",
|
|
190
|
+
"DECLARE",
|
|
191
|
+
"EDIT",
|
|
192
|
+
"REGISTER",
|
|
193
|
+
"DUPLICATE_DETECTED",
|
|
194
|
+
"REJECT",
|
|
195
|
+
"MARK_AS_DUPLICATE",
|
|
196
|
+
"MARK_AS_NOT_DUPLICATE",
|
|
197
|
+
"ARCHIVE",
|
|
198
|
+
"UNARCHIVE",
|
|
199
|
+
"PRINT_CERTIFICATE",
|
|
200
|
+
"REQUEST_CORRECTION",
|
|
201
|
+
"REJECT_CORRECTION",
|
|
202
|
+
"APPROVE_CORRECTION",
|
|
203
|
+
"READ",
|
|
204
|
+
"ASSIGN",
|
|
205
|
+
"UNASSIGN",
|
|
206
|
+
"CUSTOM"
|
|
207
|
+
]);
|
|
208
|
+
var declarationActionValues = [
|
|
209
|
+
ActionTypes.enum.DECLARE,
|
|
210
|
+
ActionTypes.enum.EDIT,
|
|
211
|
+
ActionTypes.enum.REGISTER,
|
|
212
|
+
ActionTypes.enum.NOTIFY,
|
|
213
|
+
ActionTypes.enum.DUPLICATE_DETECTED
|
|
214
|
+
];
|
|
215
|
+
var DeclarationActions = ActionTypes.extract(declarationActionValues);
|
|
216
|
+
var declarationUpdateActionValues = [
|
|
217
|
+
...declarationActionValues,
|
|
218
|
+
ActionTypes.enum.REQUEST_CORRECTION
|
|
219
|
+
];
|
|
220
|
+
var DeclarationUpdateActions = ActionTypes.extract(
|
|
221
|
+
declarationUpdateActionValues
|
|
222
|
+
);
|
|
223
|
+
var annotationActions = ActionTypes.exclude(declarationActionValues);
|
|
224
|
+
var writeActions = ActionTypes.exclude([
|
|
225
|
+
ActionType.CREATE,
|
|
226
|
+
ActionType.READ,
|
|
227
|
+
ActionType.ASSIGN,
|
|
228
|
+
ActionType.UNASSIGN
|
|
229
|
+
]);
|
|
230
|
+
var WorkqueueActionType = ActionTypes.extract([
|
|
231
|
+
ActionType.READ,
|
|
232
|
+
ActionType.DELETE,
|
|
233
|
+
ActionType.DECLARE,
|
|
234
|
+
ActionType.REGISTER,
|
|
235
|
+
ActionType.EDIT,
|
|
236
|
+
ActionType.REJECT,
|
|
237
|
+
ActionType.MARK_AS_DUPLICATE,
|
|
238
|
+
ActionType.ARCHIVE,
|
|
239
|
+
ActionType.UNARCHIVE,
|
|
240
|
+
ActionType.PRINT_CERTIFICATE,
|
|
241
|
+
ActionType.REQUEST_CORRECTION
|
|
242
|
+
]);
|
|
243
|
+
var META_ACTIONS = [
|
|
244
|
+
ActionType.ASSIGN,
|
|
245
|
+
ActionType.UNASSIGN,
|
|
246
|
+
ActionType.READ
|
|
247
|
+
];
|
|
248
|
+
|
|
249
|
+
// ../commons/src/events/ActionStatus.ts
|
|
250
|
+
var ActionStatus = {
|
|
251
|
+
Requested: "Requested",
|
|
252
|
+
Accepted: "Accepted",
|
|
253
|
+
Rejected: "Rejected"
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
// ../commons/src/events/Flag.ts
|
|
257
|
+
var z9 = __toESM(require("zod/v4"));
|
|
258
|
+
|
|
259
|
+
// ../commons/src/events/TranslationConfig.ts
|
|
260
|
+
var z7 = __toESM(require("zod/v4"));
|
|
261
|
+
var TranslationConfig = z7.object({
|
|
262
|
+
id: z7.string().describe(
|
|
263
|
+
"The identifier of the translation referred in translation CSV files"
|
|
264
|
+
),
|
|
265
|
+
defaultMessage: z7.string().describe("Default translation message"),
|
|
266
|
+
description: z7.string().describe(
|
|
267
|
+
"Describe the translation for a translator to be able to identify it."
|
|
268
|
+
)
|
|
269
|
+
}).meta({
|
|
270
|
+
description: "Translation configuration",
|
|
271
|
+
id: "TranslationConfig"
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
// ../commons/src/events/Conditional.ts
|
|
275
|
+
var z8 = __toESM(require("zod/v4"));
|
|
276
|
+
var Conditional = z8.any().describe("JSONSchema").meta({
|
|
277
|
+
description: "JSON schema conditional configuration",
|
|
278
|
+
id: "Conditional"
|
|
279
|
+
});
|
|
280
|
+
var ConditionalType = {
|
|
281
|
+
SHOW: "SHOW",
|
|
282
|
+
ENABLE: "ENABLE",
|
|
283
|
+
DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
|
|
284
|
+
};
|
|
285
|
+
var ShowConditional = z8.object({
|
|
286
|
+
type: z8.literal(ConditionalType.SHOW),
|
|
287
|
+
conditional: Conditional
|
|
288
|
+
}).describe(
|
|
289
|
+
"If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
|
|
290
|
+
);
|
|
291
|
+
var EnableConditional = z8.object({
|
|
292
|
+
type: z8.literal(ConditionalType.ENABLE),
|
|
293
|
+
conditional: Conditional
|
|
294
|
+
}).describe(
|
|
295
|
+
"If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
|
|
296
|
+
);
|
|
297
|
+
var ActionConditional = z8.discriminatedUnion("type", [
|
|
298
|
+
// Action can be shown / hidden
|
|
299
|
+
ShowConditional,
|
|
300
|
+
// Action can be shown to the user in the list but as disabled
|
|
301
|
+
EnableConditional
|
|
302
|
+
]).meta({
|
|
303
|
+
id: "ActionConditional",
|
|
304
|
+
description: "Conditional gating whether an action is shown (SHOW) or enabled (ENABLE). When omitted from an action, the action is shown and enabled for everyone."
|
|
305
|
+
});
|
|
306
|
+
var DisplayOnReviewConditional = z8.object({
|
|
307
|
+
type: z8.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
308
|
+
conditional: Conditional
|
|
309
|
+
}).describe(
|
|
310
|
+
"If 'DISPLAY_ON_REVIEW' conditional is defined, the component is shown on the review page only if both the 'DISPLAY_ON_REVIEW' and 'SHOW' conditions are met. This should only be used for fields within declaration forms, as they are the only ones with review pages."
|
|
311
|
+
);
|
|
312
|
+
var FieldConditional = z8.discriminatedUnion("type", [
|
|
313
|
+
// Field input can be shown / hidden
|
|
314
|
+
ShowConditional,
|
|
315
|
+
// Field input can be shown to the user but as disabled
|
|
316
|
+
EnableConditional,
|
|
317
|
+
// Field output can be shown / hidden on the review page
|
|
318
|
+
DisplayOnReviewConditional
|
|
319
|
+
]).meta({
|
|
320
|
+
id: "FieldConditional",
|
|
321
|
+
description: "Conditional gating whether a form field is shown (SHOW), enabled (ENABLE), or displayed on the review page (DISPLAY_ON_REVIEW). When omitted, the field is shown and enabled for everyone, and is displayed on review whenever it has a value."
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
// ../commons/src/events/Flag.ts
|
|
325
|
+
var InherentFlags = {
|
|
326
|
+
INCOMPLETE: "incomplete",
|
|
327
|
+
REJECTED: "rejected",
|
|
328
|
+
CORRECTION_REQUESTED: "correction-requested",
|
|
329
|
+
POTENTIAL_DUPLICATE: "potential-duplicate",
|
|
330
|
+
/**
|
|
331
|
+
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
332
|
+
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
333
|
+
*
|
|
334
|
+
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
335
|
+
*/
|
|
336
|
+
EDIT_IN_PROGRESS: "edit-in-progress"
|
|
337
|
+
};
|
|
338
|
+
var actionFlagPattern;
|
|
339
|
+
function getActionFlagPattern() {
|
|
340
|
+
actionFlagPattern ??= new RegExp(
|
|
341
|
+
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
342
|
+
ActionStatus
|
|
343
|
+
).join("|").toLowerCase()})$`
|
|
344
|
+
);
|
|
345
|
+
return actionFlagPattern;
|
|
346
|
+
}
|
|
347
|
+
var ActionFlag = z9.string().refine((value) => getActionFlagPattern().test(value), {
|
|
348
|
+
message: "Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
349
|
+
});
|
|
350
|
+
var CustomFlag = z9.string().refine((val) => !Object.values(InherentFlags).includes(val), {
|
|
351
|
+
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
352
|
+
InherentFlags
|
|
353
|
+
).join(", ")}`
|
|
354
|
+
}).refine((val) => !ActionFlag.safeParse(val).success, {
|
|
355
|
+
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
356
|
+
}).describe("Custom flag identifier defined by the country config.");
|
|
357
|
+
var Flag = ActionFlag.or(z9.enum(InherentFlags)).or(CustomFlag);
|
|
358
|
+
var ContainsFlags = z9.object({
|
|
359
|
+
anyOf: z9.array(Flag).optional(),
|
|
360
|
+
noneOf: z9.array(Flag).optional(),
|
|
361
|
+
allOf: z9.array(Flag).optional()
|
|
362
|
+
}).meta({
|
|
363
|
+
id: "ContainsFlags"
|
|
364
|
+
});
|
|
365
|
+
var FlagConfig = z9.object({
|
|
366
|
+
id: CustomFlag,
|
|
367
|
+
requiresAction: z9.boolean().describe(
|
|
368
|
+
"Indicates if this flag expects an action to be performed to be cleared."
|
|
369
|
+
),
|
|
370
|
+
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
371
|
+
}).meta({
|
|
372
|
+
id: "FlagConfig",
|
|
373
|
+
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
374
|
+
});
|
|
375
|
+
var ActionFlagConfig = z9.object({
|
|
376
|
+
id: Flag,
|
|
377
|
+
operation: z9.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
378
|
+
conditional: Conditional.optional().describe(
|
|
379
|
+
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
380
|
+
)
|
|
381
|
+
}).meta({
|
|
382
|
+
id: "ActionFlagConfig",
|
|
383
|
+
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
384
|
+
});
|
|
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
|
+
|
|
141
396
|
// ../commons/src/scopes.ts
|
|
142
|
-
var JurisdictionFilter =
|
|
397
|
+
var JurisdictionFilter = z11.enum(["administrativeArea", "location", "all"]).describe(
|
|
143
398
|
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
144
399
|
);
|
|
145
|
-
var UserFilter =
|
|
146
|
-
var RecordScopeTypeV2 =
|
|
400
|
+
var UserFilter = z11.enum(["user"]).describe("Filters based on the user. Limits to self.");
|
|
401
|
+
var RecordScopeTypeV2 = z11.enum([
|
|
147
402
|
"record.search",
|
|
148
403
|
"record.create",
|
|
149
404
|
"record.read",
|
|
@@ -161,12 +416,17 @@ var RecordScopeTypeV2 = z6.enum([
|
|
|
161
416
|
"record.unassign-others",
|
|
162
417
|
"record.custom-action"
|
|
163
418
|
]);
|
|
164
|
-
var PlainScopeType =
|
|
419
|
+
var PlainScopeType = z11.enum([
|
|
165
420
|
// Misc. system scopes
|
|
166
421
|
"bypassratelimit",
|
|
167
422
|
"record.reindex",
|
|
168
423
|
"user.data-seeding",
|
|
169
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",
|
|
170
430
|
"record.import",
|
|
171
431
|
"config.update-all",
|
|
172
432
|
"location.edit",
|
|
@@ -176,77 +436,87 @@ var PlainScopeType = z6.enum([
|
|
|
176
436
|
// Performance dashboard
|
|
177
437
|
"performance.read",
|
|
178
438
|
"performance.read-dashboards",
|
|
179
|
-
"performance.vital-statistics-export"
|
|
180
|
-
// Scopes used exclusively by countryconfig integration token
|
|
181
|
-
"record.confirm-registration",
|
|
182
|
-
"record.reject-registration"
|
|
439
|
+
"performance.vital-statistics-export"
|
|
183
440
|
]);
|
|
184
|
-
var scopeByEvent =
|
|
441
|
+
var scopeByEvent = z11.preprocess(
|
|
185
442
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
186
|
-
|
|
443
|
+
z11.array(z11.string()).optional()
|
|
187
444
|
).describe("Event type, e.g. birth, death");
|
|
188
|
-
var
|
|
445
|
+
var scopeByStatus = z11.preprocess(
|
|
446
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
447
|
+
z11.array(EventStatus).optional()
|
|
448
|
+
).describe(
|
|
449
|
+
"Restricts the scope to records currently in one of these statuses."
|
|
450
|
+
);
|
|
451
|
+
var userRole = z11.preprocess(
|
|
189
452
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
190
|
-
|
|
453
|
+
z11.array(z11.string()).optional()
|
|
191
454
|
).describe("User role, e.g. admin, field agent");
|
|
192
|
-
var scopeOptionsPlaceEvent =
|
|
455
|
+
var scopeOptionsPlaceEvent = z11.object({
|
|
193
456
|
event: scopeByEvent,
|
|
194
|
-
placeOfEvent: JurisdictionFilter.optional()
|
|
457
|
+
placeOfEvent: JurisdictionFilter.optional(),
|
|
458
|
+
createdBy: UserFilter.optional(),
|
|
459
|
+
createdIn: JurisdictionFilter.optional()
|
|
195
460
|
}).describe("Options applicable to all record scopes.");
|
|
196
461
|
var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
197
462
|
notifiedIn: JurisdictionFilter.optional(),
|
|
198
463
|
notifiedBy: UserFilter.optional(),
|
|
199
464
|
declaredIn: JurisdictionFilter.optional(),
|
|
200
|
-
declaredBy: UserFilter.optional()
|
|
465
|
+
declaredBy: UserFilter.optional(),
|
|
466
|
+
status: scopeByStatus
|
|
201
467
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
202
468
|
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
203
469
|
registeredIn: JurisdictionFilter.optional(),
|
|
204
|
-
registeredBy: UserFilter.optional()
|
|
470
|
+
registeredBy: UserFilter.optional(),
|
|
471
|
+
flags: ContainsFlags.optional()
|
|
205
472
|
}).describe(
|
|
206
473
|
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
207
474
|
);
|
|
208
475
|
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
209
|
-
customActionTypes:
|
|
476
|
+
customActionTypes: z11.preprocess(
|
|
210
477
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
211
|
-
|
|
478
|
+
z11.array(z11.string()).optional()
|
|
212
479
|
).describe("Allowed custom action types")
|
|
213
480
|
});
|
|
214
|
-
var AccessLevelOptions =
|
|
481
|
+
var AccessLevelOptions = z11.object({
|
|
215
482
|
accessLevel: JurisdictionFilter.optional()
|
|
216
483
|
});
|
|
217
484
|
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
218
485
|
role: userRole.optional()
|
|
219
486
|
});
|
|
220
|
-
var WorkqueueOrDashboardOptions =
|
|
221
|
-
ids:
|
|
487
|
+
var WorkqueueOrDashboardOptions = z11.object({
|
|
488
|
+
ids: z11.preprocess(
|
|
222
489
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
223
|
-
|
|
490
|
+
z11.array(z11.string())
|
|
224
491
|
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
225
492
|
});
|
|
226
|
-
var AllScopeOptions =
|
|
493
|
+
var AllScopeOptions = z11.object({
|
|
227
494
|
...AllRecordScopeOptions.shape,
|
|
228
495
|
...AccessLevelOptions.shape,
|
|
229
496
|
...AllUserScopeOptions.shape,
|
|
230
497
|
...WorkqueueOrDashboardOptions.shape
|
|
231
498
|
});
|
|
232
499
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
233
|
-
var ResolvedScopeOptionsPlaceEvent =
|
|
500
|
+
var ResolvedScopeOptionsPlaceEvent = z11.object({
|
|
234
501
|
event: scopeByEvent,
|
|
235
|
-
placeOfEvent: UUID.nullish()
|
|
502
|
+
placeOfEvent: UUID.nullish(),
|
|
503
|
+
createdBy: z11.string().optional(),
|
|
504
|
+
createdIn: UUID.nullish()
|
|
236
505
|
}).describe(
|
|
237
506
|
"Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
|
|
238
507
|
);
|
|
239
508
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
240
509
|
notifiedIn: UUID.nullish(),
|
|
241
|
-
notifiedBy:
|
|
510
|
+
notifiedBy: z11.string().optional(),
|
|
242
511
|
declaredIn: UUID.nullish(),
|
|
243
|
-
declaredBy:
|
|
512
|
+
declaredBy: z11.string().optional()
|
|
244
513
|
}).describe(
|
|
245
514
|
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
246
515
|
);
|
|
247
516
|
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
248
517
|
registeredIn: UUID.nullish(),
|
|
249
|
-
registeredBy:
|
|
518
|
+
registeredBy: z11.string().optional(),
|
|
519
|
+
flags: ContainsFlags.optional()
|
|
250
520
|
}).describe(
|
|
251
521
|
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
252
522
|
);
|
|
@@ -260,7 +530,6 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
|
260
530
|
"record.reject",
|
|
261
531
|
"record.archive",
|
|
262
532
|
"record.unarchive",
|
|
263
|
-
"record.review-duplicates",
|
|
264
533
|
"record.register"
|
|
265
534
|
]);
|
|
266
535
|
var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
@@ -268,41 +537,42 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
|
268
537
|
"record.read",
|
|
269
538
|
"record.request-correction",
|
|
270
539
|
"record.correct",
|
|
271
|
-
"record.unassign-others"
|
|
540
|
+
"record.unassign-others",
|
|
541
|
+
"record.review-duplicates"
|
|
272
542
|
]);
|
|
273
543
|
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
274
|
-
templates:
|
|
544
|
+
templates: z11.preprocess(
|
|
275
545
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
276
|
-
|
|
546
|
+
z11.array(z11.string()).optional()
|
|
277
547
|
).describe(
|
|
278
548
|
"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."
|
|
279
549
|
)
|
|
280
550
|
});
|
|
281
|
-
var RecordScopeV2 =
|
|
282
|
-
|
|
551
|
+
var RecordScopeV2 = z11.discriminatedUnion("type", [
|
|
552
|
+
z11.object({
|
|
283
553
|
type: ScopesWithPlaceEventOptions,
|
|
284
554
|
options: scopeOptionsPlaceEvent.optional()
|
|
285
555
|
}),
|
|
286
|
-
|
|
556
|
+
z11.object({
|
|
287
557
|
type: ScopesWithDeclaredOptions,
|
|
288
558
|
options: scopeOptionsDeclaredOrNotified.optional()
|
|
289
559
|
}),
|
|
290
|
-
|
|
560
|
+
z11.object({
|
|
291
561
|
type: ScopesWithFullOptions,
|
|
292
562
|
options: AllRecordScopeOptions.optional()
|
|
293
563
|
}),
|
|
294
|
-
|
|
295
|
-
type:
|
|
564
|
+
z11.object({
|
|
565
|
+
type: z11.literal("record.custom-action"),
|
|
296
566
|
options: CustomActionScopeOptions.optional()
|
|
297
567
|
}),
|
|
298
|
-
|
|
299
|
-
type:
|
|
568
|
+
z11.object({
|
|
569
|
+
type: z11.literal("record.print-certified-copies"),
|
|
300
570
|
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
301
571
|
})
|
|
302
572
|
]).describe(
|
|
303
573
|
"Scopes used to check user's permission to perform actions on a record."
|
|
304
574
|
);
|
|
305
|
-
var SystemScopeType =
|
|
575
|
+
var SystemScopeType = z11.enum([
|
|
306
576
|
"organisation.read-locations",
|
|
307
577
|
"user.read",
|
|
308
578
|
"user.create",
|
|
@@ -316,61 +586,61 @@ var UserScopeType = SystemScopeType.extract([
|
|
|
316
586
|
"user.search"
|
|
317
587
|
]);
|
|
318
588
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
319
|
-
var UserScopeV2 =
|
|
320
|
-
|
|
589
|
+
var UserScopeV2 = z11.discriminatedUnion("type", [
|
|
590
|
+
z11.object({
|
|
321
591
|
type: ScopesWithRoleOption,
|
|
322
592
|
options: AllUserScopeOptions.optional()
|
|
323
593
|
}),
|
|
324
|
-
|
|
594
|
+
z11.object({
|
|
325
595
|
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
326
596
|
options: AccessLevelOptions.optional()
|
|
327
597
|
})
|
|
328
598
|
]);
|
|
329
|
-
var ResolvedRecordScopeV2 =
|
|
330
|
-
|
|
599
|
+
var ResolvedRecordScopeV2 = z11.discriminatedUnion("type", [
|
|
600
|
+
z11.object({
|
|
331
601
|
type: ScopesWithPlaceEventOptions,
|
|
332
602
|
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
333
603
|
}),
|
|
334
|
-
|
|
604
|
+
z11.object({
|
|
335
605
|
type: ScopesWithDeclaredOptions,
|
|
336
606
|
options: ResolvedScopeOptionsDeclared.optional()
|
|
337
607
|
}),
|
|
338
|
-
|
|
608
|
+
z11.object({
|
|
339
609
|
type: ScopesWithFullOptions,
|
|
340
610
|
options: ResolvedScopeOptionsFull.optional()
|
|
341
611
|
}),
|
|
342
|
-
|
|
343
|
-
type:
|
|
612
|
+
z11.object({
|
|
613
|
+
type: z11.literal("record.print-certified-copies"),
|
|
344
614
|
options: ResolvedScopeOptionsFull.extend({
|
|
345
|
-
templates:
|
|
615
|
+
templates: z11.array(z11.string()).optional()
|
|
346
616
|
}).optional()
|
|
347
617
|
})
|
|
348
618
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
349
|
-
var Scope2 =
|
|
350
|
-
|
|
619
|
+
var Scope2 = z11.discriminatedUnion("type", [
|
|
620
|
+
z11.object({ type: PlainScopeType }),
|
|
351
621
|
...RecordScopeV2.options,
|
|
352
622
|
...UserScopeV2.options,
|
|
353
|
-
|
|
354
|
-
type:
|
|
623
|
+
z11.object({
|
|
624
|
+
type: z11.literal("organisation.read-locations"),
|
|
355
625
|
options: AccessLevelOptions.optional()
|
|
356
626
|
}),
|
|
357
|
-
|
|
358
|
-
type:
|
|
627
|
+
z11.object({
|
|
628
|
+
type: z11.literal("workqueue"),
|
|
359
629
|
options: WorkqueueOrDashboardOptions
|
|
360
630
|
}),
|
|
361
|
-
|
|
362
|
-
type:
|
|
631
|
+
z11.object({
|
|
632
|
+
type: z11.literal("dashboard.view"),
|
|
363
633
|
options: WorkqueueOrDashboardOptions
|
|
364
634
|
})
|
|
365
635
|
]);
|
|
366
|
-
var ScopeType2 =
|
|
636
|
+
var ScopeType2 = z11.enum([
|
|
367
637
|
...SystemScopeType.options,
|
|
368
638
|
...RecordScopeTypeV2.options,
|
|
369
639
|
...PlainScopeType.options,
|
|
370
640
|
"workqueue",
|
|
371
641
|
"dashboard.view"
|
|
372
642
|
]);
|
|
373
|
-
var EncodedScope2 =
|
|
643
|
+
var EncodedScope2 = z11.string().brand("EncodedScope");
|
|
374
644
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
375
645
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
376
646
|
accessLevel: JurisdictionFilter.enum.all,
|
|
@@ -1065,4 +1335,4 @@ function createFieldConditionals(fieldId) {
|
|
|
1065
1335
|
}
|
|
1066
1336
|
|
|
1067
1337
|
// src/conditionals/index.ts
|
|
1068
|
-
|
|
1338
|
+
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"}
|