@opencrvs/toolkit 2.1.0-rc.b0003b1 → 2.1.0-rc.b263ac1
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 +2 -2
- package/dist/application-config/index.js +244 -197
- package/dist/cli.js +347 -5220
- package/dist/commons/api/router.d.ts +3730 -2896
- package/dist/commons/application-config/index.d.ts +6 -6
- package/dist/commons/conditionals/conditionals.d.ts +32 -323
- package/dist/commons/conditionals/validate.d.ts +11 -4
- package/dist/commons/events/ActionConfig.d.ts +279 -70
- package/dist/commons/events/ActionDocument.d.ts +153 -115
- package/dist/commons/events/ActionInput.d.ts +26 -6
- package/dist/commons/events/ActionStatus.d.ts +14 -0
- package/dist/commons/events/ActionType.d.ts +63 -58
- package/dist/commons/events/AdvancedSearchConfig.d.ts +525 -501
- package/dist/commons/events/AuditLog.d.ts +189 -40
- package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
- package/dist/commons/events/Conditional.d.ts +3 -3
- package/dist/commons/events/CountryConfigQueryInput.d.ts +590 -590
- package/dist/commons/events/Draft.d.ts +37 -35
- package/dist/commons/events/DynamicFieldValue.d.ts +9 -9
- package/dist/commons/events/EventConfig.d.ts +8 -5
- package/dist/commons/events/EventDocument.d.ts +66 -44
- package/dist/commons/events/EventIndex.d.ts +49 -72
- package/dist/commons/events/EventMetadata.d.ts +40 -40
- package/dist/commons/events/FieldConfig.d.ts +411 -384
- package/dist/commons/events/FieldType.d.ts +51 -51
- package/dist/commons/events/FieldTypeMapping.d.ts +90 -90
- package/dist/commons/events/FieldValue.d.ts +14 -14
- package/dist/commons/events/Flag.d.ts +57 -15
- package/dist/commons/events/PlainDate.d.ts +8 -0
- package/dist/commons/events/SummaryConfig.d.ts +249 -0
- package/dist/commons/events/TemplateConfig.d.ts +1 -1
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +40 -40
- package/dist/commons/events/WorkqueueConfig.d.ts +822 -816
- package/dist/commons/events/deduplication.d.ts +1 -1
- package/dist/commons/events/event.d.ts +14 -2
- package/dist/commons/events/field.d.ts +69 -198
- package/dist/commons/events/index.d.ts +1 -0
- package/dist/commons/events/locationPayloads.d.ts +95 -0
- package/dist/commons/events/locations.d.ts +192 -12
- package/dist/commons/events/mocks.test.utils.d.ts +48 -4
- package/dist/commons/events/scopes.d.ts +5 -4
- package/dist/commons/events/state/index.d.ts +17 -17
- package/dist/commons/events/state/utils.d.ts +7 -7
- package/dist/commons/events/test.utils.d.ts +44 -39
- package/dist/commons/events/utils.d.ts +127 -105
- package/dist/commons/notification/UserNotifications.d.ts +10 -10
- package/dist/conditionals/index.js +309 -57
- package/dist/environment/derived-variables.d.ts +119 -131
- package/dist/environment/derived-variables.d.ts.map +1 -1
- package/dist/environment/derived-variables.js +0 -14
- 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 +3 -3
- package/dist/environment/manage-users.js +17 -7
- 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 +75 -74
- package/dist/environment/questions.d.ts.map +1 -1
- package/dist/environment/setup-environment.js +10 -29
- package/dist/environment/swarm-to-k8s.js +17 -7
- 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 +34 -12
- 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 +28 -20
- package/dist/environment/utils.d.ts +1 -1
- package/dist/environment/utils.js +17 -7
- package/dist/events/deduplication.d.ts +1 -1
- package/dist/events/index.js +3650 -3145
- package/dist/migrations/v2.0/convert-config-files-to-ts.js +17 -7
- package/dist/migrations/v2.0/index.js +88 -5144
- package/dist/migrations/v2.0/migrate-application-config-url.js +4 -3
- package/dist/migrations/v2.0/remove-hearth-migrations.js +17 -7
- package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts +3 -0
- package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts.map +1 -0
- package/dist/migrations/v2.1/add-explicit-correction-flags.js +234 -0
- package/dist/migrations/v2.1/index.d.ts +6 -0
- package/dist/migrations/v2.1/index.d.ts.map +1 -0
- package/dist/migrations/v2.1/index.js +218 -0
- package/dist/notification/index.js +2019 -1072
- package/dist/scopes/index.d.ts +437 -163
- package/dist/scopes/index.js +310 -57
- package/dist/templates/charts-values/dependencies/values.yaml +0 -3
- package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -7
- package/dist/templates/charts-values/opentelemetry/values.yaml +73 -0
- package/opencrvs-toolkit-2.1.0-rc.b263ac1.tgz +0 -0
- package/package.json +7 -7
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.1.0-rc.b0003b1.tgz +0 -0
|
@@ -47,7 +47,7 @@ __export(conditionals_exports, {
|
|
|
47
47
|
user: () => user
|
|
48
48
|
});
|
|
49
49
|
module.exports = __toCommonJS(conditionals_exports);
|
|
50
|
-
var
|
|
50
|
+
var z12 = __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 z10 = __toESM(require("zod/v4"));
|
|
128
128
|
var qs = __toESM(require("qs"));
|
|
129
129
|
|
|
130
130
|
// ../commons/src/uuid.ts
|
|
@@ -138,12 +138,257 @@ 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
|
+
|
|
141
386
|
// ../commons/src/scopes.ts
|
|
142
|
-
var JurisdictionFilter =
|
|
387
|
+
var JurisdictionFilter = z10.enum(["administrativeArea", "location", "all"]).describe(
|
|
143
388
|
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
144
389
|
);
|
|
145
|
-
var UserFilter =
|
|
146
|
-
var RecordScopeTypeV2 =
|
|
390
|
+
var UserFilter = z10.enum(["user"]).describe("Filters based on the user. Limits to self.");
|
|
391
|
+
var RecordScopeTypeV2 = z10.enum([
|
|
147
392
|
"record.search",
|
|
148
393
|
"record.create",
|
|
149
394
|
"record.read",
|
|
@@ -152,6 +397,7 @@ var RecordScopeTypeV2 = z6.enum([
|
|
|
152
397
|
"record.edit",
|
|
153
398
|
"record.reject",
|
|
154
399
|
"record.archive",
|
|
400
|
+
"record.unarchive",
|
|
155
401
|
"record.review-duplicates",
|
|
156
402
|
"record.register",
|
|
157
403
|
"record.print-certified-copies",
|
|
@@ -160,7 +406,7 @@ var RecordScopeTypeV2 = z6.enum([
|
|
|
160
406
|
"record.unassign-others",
|
|
161
407
|
"record.custom-action"
|
|
162
408
|
]);
|
|
163
|
-
var PlainScopeType =
|
|
409
|
+
var PlainScopeType = z10.enum([
|
|
164
410
|
// Misc. system scopes
|
|
165
411
|
"bypassratelimit",
|
|
166
412
|
"record.reindex",
|
|
@@ -168,6 +414,7 @@ var PlainScopeType = z6.enum([
|
|
|
168
414
|
"integration.create",
|
|
169
415
|
"record.import",
|
|
170
416
|
"config.update-all",
|
|
417
|
+
"location.edit",
|
|
171
418
|
"attachment.upload",
|
|
172
419
|
"profile.electronic-signature",
|
|
173
420
|
"user.read-only-my-audit",
|
|
@@ -179,17 +426,18 @@ var PlainScopeType = z6.enum([
|
|
|
179
426
|
"record.confirm-registration",
|
|
180
427
|
"record.reject-registration"
|
|
181
428
|
]);
|
|
182
|
-
var scopeByEvent =
|
|
429
|
+
var scopeByEvent = z10.preprocess(
|
|
183
430
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
184
|
-
|
|
431
|
+
z10.array(z10.string()).optional()
|
|
185
432
|
).describe("Event type, e.g. birth, death");
|
|
186
|
-
var userRole =
|
|
433
|
+
var userRole = z10.preprocess(
|
|
187
434
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
188
|
-
|
|
435
|
+
z10.array(z10.string()).optional()
|
|
189
436
|
).describe("User role, e.g. admin, field agent");
|
|
190
|
-
var scopeOptionsPlaceEvent =
|
|
437
|
+
var scopeOptionsPlaceEvent = z10.object({
|
|
191
438
|
event: scopeByEvent,
|
|
192
|
-
placeOfEvent: JurisdictionFilter.optional()
|
|
439
|
+
placeOfEvent: JurisdictionFilter.optional(),
|
|
440
|
+
createdBy: UserFilter.optional()
|
|
193
441
|
}).describe("Options applicable to all record scopes.");
|
|
194
442
|
var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
195
443
|
notifiedIn: JurisdictionFilter.optional(),
|
|
@@ -199,52 +447,55 @@ var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
|
199
447
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
200
448
|
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
201
449
|
registeredIn: JurisdictionFilter.optional(),
|
|
202
|
-
registeredBy: UserFilter.optional()
|
|
450
|
+
registeredBy: UserFilter.optional(),
|
|
451
|
+
flags: ContainsFlags.optional()
|
|
203
452
|
}).describe(
|
|
204
453
|
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
205
454
|
);
|
|
206
455
|
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
207
|
-
customActionTypes:
|
|
456
|
+
customActionTypes: z10.preprocess(
|
|
208
457
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
209
|
-
|
|
458
|
+
z10.array(z10.string()).optional()
|
|
210
459
|
).describe("Allowed custom action types")
|
|
211
460
|
});
|
|
212
|
-
var AccessLevelOptions =
|
|
461
|
+
var AccessLevelOptions = z10.object({
|
|
213
462
|
accessLevel: JurisdictionFilter.optional()
|
|
214
463
|
});
|
|
215
464
|
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
216
465
|
role: userRole.optional()
|
|
217
466
|
});
|
|
218
|
-
var WorkqueueOrDashboardOptions =
|
|
219
|
-
ids:
|
|
467
|
+
var WorkqueueOrDashboardOptions = z10.object({
|
|
468
|
+
ids: z10.preprocess(
|
|
220
469
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
221
|
-
|
|
470
|
+
z10.array(z10.string())
|
|
222
471
|
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
223
472
|
});
|
|
224
|
-
var AllScopeOptions =
|
|
473
|
+
var AllScopeOptions = z10.object({
|
|
225
474
|
...AllRecordScopeOptions.shape,
|
|
226
475
|
...AccessLevelOptions.shape,
|
|
227
476
|
...AllUserScopeOptions.shape,
|
|
228
477
|
...WorkqueueOrDashboardOptions.shape
|
|
229
478
|
});
|
|
230
479
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
231
|
-
var ResolvedScopeOptionsPlaceEvent =
|
|
480
|
+
var ResolvedScopeOptionsPlaceEvent = z10.object({
|
|
232
481
|
event: scopeByEvent,
|
|
233
|
-
placeOfEvent: UUID.nullish()
|
|
482
|
+
placeOfEvent: UUID.nullish(),
|
|
483
|
+
createdBy: z10.string().optional()
|
|
234
484
|
}).describe(
|
|
235
485
|
"Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
|
|
236
486
|
);
|
|
237
487
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
238
488
|
notifiedIn: UUID.nullish(),
|
|
239
|
-
notifiedBy:
|
|
489
|
+
notifiedBy: z10.string().optional(),
|
|
240
490
|
declaredIn: UUID.nullish(),
|
|
241
|
-
declaredBy:
|
|
491
|
+
declaredBy: z10.string().optional()
|
|
242
492
|
}).describe(
|
|
243
493
|
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
244
494
|
);
|
|
245
495
|
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
246
496
|
registeredIn: UUID.nullish(),
|
|
247
|
-
registeredBy:
|
|
497
|
+
registeredBy: z10.string().optional(),
|
|
498
|
+
flags: ContainsFlags.optional()
|
|
248
499
|
}).describe(
|
|
249
500
|
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
250
501
|
);
|
|
@@ -257,6 +508,7 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
|
257
508
|
"record.edit",
|
|
258
509
|
"record.reject",
|
|
259
510
|
"record.archive",
|
|
511
|
+
"record.unarchive",
|
|
260
512
|
"record.review-duplicates",
|
|
261
513
|
"record.register"
|
|
262
514
|
]);
|
|
@@ -268,38 +520,38 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
|
268
520
|
"record.unassign-others"
|
|
269
521
|
]);
|
|
270
522
|
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
271
|
-
templates:
|
|
523
|
+
templates: z10.preprocess(
|
|
272
524
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
273
|
-
|
|
525
|
+
z10.array(z10.string()).optional()
|
|
274
526
|
).describe(
|
|
275
527
|
"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."
|
|
276
528
|
)
|
|
277
529
|
});
|
|
278
|
-
var RecordScopeV2 =
|
|
279
|
-
|
|
530
|
+
var RecordScopeV2 = z10.discriminatedUnion("type", [
|
|
531
|
+
z10.object({
|
|
280
532
|
type: ScopesWithPlaceEventOptions,
|
|
281
533
|
options: scopeOptionsPlaceEvent.optional()
|
|
282
534
|
}),
|
|
283
|
-
|
|
535
|
+
z10.object({
|
|
284
536
|
type: ScopesWithDeclaredOptions,
|
|
285
537
|
options: scopeOptionsDeclaredOrNotified.optional()
|
|
286
538
|
}),
|
|
287
|
-
|
|
539
|
+
z10.object({
|
|
288
540
|
type: ScopesWithFullOptions,
|
|
289
541
|
options: AllRecordScopeOptions.optional()
|
|
290
542
|
}),
|
|
291
|
-
|
|
292
|
-
type:
|
|
543
|
+
z10.object({
|
|
544
|
+
type: z10.literal("record.custom-action"),
|
|
293
545
|
options: CustomActionScopeOptions.optional()
|
|
294
546
|
}),
|
|
295
|
-
|
|
296
|
-
type:
|
|
547
|
+
z10.object({
|
|
548
|
+
type: z10.literal("record.print-certified-copies"),
|
|
297
549
|
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
298
550
|
})
|
|
299
551
|
]).describe(
|
|
300
552
|
"Scopes used to check user's permission to perform actions on a record."
|
|
301
553
|
);
|
|
302
|
-
var SystemScopeType =
|
|
554
|
+
var SystemScopeType = z10.enum([
|
|
303
555
|
"organisation.read-locations",
|
|
304
556
|
"user.read",
|
|
305
557
|
"user.create",
|
|
@@ -313,61 +565,61 @@ var UserScopeType = SystemScopeType.extract([
|
|
|
313
565
|
"user.search"
|
|
314
566
|
]);
|
|
315
567
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
316
|
-
var UserScopeV2 =
|
|
317
|
-
|
|
568
|
+
var UserScopeV2 = z10.discriminatedUnion("type", [
|
|
569
|
+
z10.object({
|
|
318
570
|
type: ScopesWithRoleOption,
|
|
319
571
|
options: AllUserScopeOptions.optional()
|
|
320
572
|
}),
|
|
321
|
-
|
|
573
|
+
z10.object({
|
|
322
574
|
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
323
575
|
options: AccessLevelOptions.optional()
|
|
324
576
|
})
|
|
325
577
|
]);
|
|
326
|
-
var ResolvedRecordScopeV2 =
|
|
327
|
-
|
|
578
|
+
var ResolvedRecordScopeV2 = z10.discriminatedUnion("type", [
|
|
579
|
+
z10.object({
|
|
328
580
|
type: ScopesWithPlaceEventOptions,
|
|
329
581
|
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
330
582
|
}),
|
|
331
|
-
|
|
583
|
+
z10.object({
|
|
332
584
|
type: ScopesWithDeclaredOptions,
|
|
333
585
|
options: ResolvedScopeOptionsDeclared.optional()
|
|
334
586
|
}),
|
|
335
|
-
|
|
587
|
+
z10.object({
|
|
336
588
|
type: ScopesWithFullOptions,
|
|
337
589
|
options: ResolvedScopeOptionsFull.optional()
|
|
338
590
|
}),
|
|
339
|
-
|
|
340
|
-
type:
|
|
591
|
+
z10.object({
|
|
592
|
+
type: z10.literal("record.print-certified-copies"),
|
|
341
593
|
options: ResolvedScopeOptionsFull.extend({
|
|
342
|
-
templates:
|
|
594
|
+
templates: z10.array(z10.string()).optional()
|
|
343
595
|
}).optional()
|
|
344
596
|
})
|
|
345
597
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
346
|
-
var Scope2 =
|
|
347
|
-
|
|
598
|
+
var Scope2 = z10.discriminatedUnion("type", [
|
|
599
|
+
z10.object({ type: PlainScopeType }),
|
|
348
600
|
...RecordScopeV2.options,
|
|
349
601
|
...UserScopeV2.options,
|
|
350
|
-
|
|
351
|
-
type:
|
|
602
|
+
z10.object({
|
|
603
|
+
type: z10.literal("organisation.read-locations"),
|
|
352
604
|
options: AccessLevelOptions.optional()
|
|
353
605
|
}),
|
|
354
|
-
|
|
355
|
-
type:
|
|
606
|
+
z10.object({
|
|
607
|
+
type: z10.literal("workqueue"),
|
|
356
608
|
options: WorkqueueOrDashboardOptions
|
|
357
609
|
}),
|
|
358
|
-
|
|
359
|
-
type:
|
|
610
|
+
z10.object({
|
|
611
|
+
type: z10.literal("dashboard.view"),
|
|
360
612
|
options: WorkqueueOrDashboardOptions
|
|
361
613
|
})
|
|
362
614
|
]);
|
|
363
|
-
var ScopeType2 =
|
|
615
|
+
var ScopeType2 = z10.enum([
|
|
364
616
|
...SystemScopeType.options,
|
|
365
617
|
...RecordScopeTypeV2.options,
|
|
366
618
|
...PlainScopeType.options,
|
|
367
619
|
"workqueue",
|
|
368
620
|
"dashboard.view"
|
|
369
621
|
]);
|
|
370
|
-
var EncodedScope2 =
|
|
622
|
+
var EncodedScope2 = z10.string().brand("EncodedScope");
|
|
371
623
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
372
624
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
373
625
|
accessLevel: JurisdictionFilter.enum.all,
|
|
@@ -1062,4 +1314,4 @@ function createFieldConditionals(fieldId) {
|
|
|
1062
1314
|
}
|
|
1063
1315
|
|
|
1064
1316
|
// src/conditionals/index.ts
|
|
1065
|
-
|
|
1317
|
+
z12.globalRegistry.clear();
|