@opencrvs/toolkit 2.1.0-rc.e773220 → 2.1.0-rc.eb366a1
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/dist/application-config/index.js +210 -187
- package/dist/commons/api/router.d.ts +613 -20
- package/dist/commons/conditionals/conditionals.d.ts +6 -6
- package/dist/commons/conditionals/validate.d.ts +2 -1
- package/dist/commons/events/ActionConfig.d.ts +54 -0
- package/dist/commons/events/ActionDocument.d.ts +45 -7
- package/dist/commons/events/ActionInput.d.ts +26 -0
- package/dist/commons/events/ActionStatus.d.ts +14 -0
- package/dist/commons/events/ActionType.d.ts +6 -1
- package/dist/commons/events/AdvancedSearchConfig.d.ts +12 -0
- package/dist/commons/events/AuditLog.d.ts +2 -0
- package/dist/commons/events/CountryConfigQueryInput.d.ts +18 -0
- package/dist/commons/events/Draft.d.ts +2 -0
- package/dist/commons/events/EventDocument.d.ts +22 -0
- package/dist/commons/events/EventIndex.d.ts +5 -24
- package/dist/commons/events/EventMetadata.d.ts +2 -1
- package/dist/commons/events/FieldConfig.d.ts +10 -0
- package/dist/commons/events/Flag.d.ts +48 -0
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +4 -4
- package/dist/commons/events/WorkqueueConfig.d.ts +25 -7
- package/dist/commons/events/scopes.d.ts +1 -0
- package/dist/commons/events/test.utils.d.ts +9 -1
- package/dist/commons/events/utils.d.ts +23 -1
- package/dist/conditionals/index.js +305 -55
- package/dist/events/index.js +3261 -3141
- package/dist/notification/index.js +1481 -882
- package/dist/scopes/index.d.ts +257 -1
- package/dist/scopes/index.js +306 -55
- package/opencrvs-toolkit-2.1.0-rc.eb366a1.tgz +0 -0
- package/package.json +1 -1
- package/opencrvs-toolkit-2.1.0-rc.e773220.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,258 @@ 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
|
+
SEALED: "sealed"
|
|
338
|
+
};
|
|
339
|
+
var actionFlagPattern;
|
|
340
|
+
function getActionFlagPattern() {
|
|
341
|
+
actionFlagPattern ??= new RegExp(
|
|
342
|
+
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
343
|
+
ActionStatus
|
|
344
|
+
).join("|").toLowerCase()})$`
|
|
345
|
+
);
|
|
346
|
+
return actionFlagPattern;
|
|
347
|
+
}
|
|
348
|
+
var ActionFlag = z9.string().refine((value) => getActionFlagPattern().test(value), {
|
|
349
|
+
message: "Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
350
|
+
});
|
|
351
|
+
var CustomFlag = z9.string().refine((val) => !Object.values(InherentFlags).includes(val), {
|
|
352
|
+
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
353
|
+
InherentFlags
|
|
354
|
+
).join(", ")}`
|
|
355
|
+
}).refine((val) => !ActionFlag.safeParse(val).success, {
|
|
356
|
+
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
357
|
+
}).describe("Custom flag identifier defined by the country config.");
|
|
358
|
+
var Flag = ActionFlag.or(z9.enum(InherentFlags)).or(CustomFlag);
|
|
359
|
+
var ContainsFlags = z9.object({
|
|
360
|
+
anyOf: z9.array(Flag).optional(),
|
|
361
|
+
noneOf: z9.array(Flag).optional(),
|
|
362
|
+
allOf: z9.array(Flag).optional()
|
|
363
|
+
}).meta({
|
|
364
|
+
id: "ContainsFlags"
|
|
365
|
+
});
|
|
366
|
+
var FlagConfig = z9.object({
|
|
367
|
+
id: CustomFlag,
|
|
368
|
+
requiresAction: z9.boolean().describe(
|
|
369
|
+
"Indicates if this flag expects an action to be performed to be cleared."
|
|
370
|
+
),
|
|
371
|
+
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
372
|
+
}).meta({
|
|
373
|
+
id: "FlagConfig",
|
|
374
|
+
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
375
|
+
});
|
|
376
|
+
var ActionFlagConfig = z9.object({
|
|
377
|
+
id: Flag,
|
|
378
|
+
operation: z9.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
379
|
+
conditional: Conditional.optional().describe(
|
|
380
|
+
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
381
|
+
)
|
|
382
|
+
}).meta({
|
|
383
|
+
id: "ActionFlagConfig",
|
|
384
|
+
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
385
|
+
});
|
|
386
|
+
|
|
141
387
|
// ../commons/src/scopes.ts
|
|
142
|
-
var JurisdictionFilter =
|
|
388
|
+
var JurisdictionFilter = z10.enum(["administrativeArea", "location", "all"]).describe(
|
|
143
389
|
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
144
390
|
);
|
|
145
|
-
var UserFilter =
|
|
146
|
-
var RecordScopeTypeV2 =
|
|
391
|
+
var UserFilter = z10.enum(["user"]).describe("Filters based on the user. Limits to self.");
|
|
392
|
+
var RecordScopeTypeV2 = z10.enum([
|
|
147
393
|
"record.search",
|
|
148
394
|
"record.create",
|
|
149
395
|
"record.read",
|
|
@@ -152,6 +398,7 @@ var RecordScopeTypeV2 = z6.enum([
|
|
|
152
398
|
"record.edit",
|
|
153
399
|
"record.reject",
|
|
154
400
|
"record.archive",
|
|
401
|
+
"record.unarchive",
|
|
155
402
|
"record.review-duplicates",
|
|
156
403
|
"record.register",
|
|
157
404
|
"record.print-certified-copies",
|
|
@@ -160,7 +407,7 @@ var RecordScopeTypeV2 = z6.enum([
|
|
|
160
407
|
"record.unassign-others",
|
|
161
408
|
"record.custom-action"
|
|
162
409
|
]);
|
|
163
|
-
var PlainScopeType =
|
|
410
|
+
var PlainScopeType = z10.enum([
|
|
164
411
|
// Misc. system scopes
|
|
165
412
|
"bypassratelimit",
|
|
166
413
|
"record.reindex",
|
|
@@ -179,15 +426,15 @@ 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
439
|
placeOfEvent: JurisdictionFilter.optional()
|
|
193
440
|
}).describe("Options applicable to all record scopes.");
|
|
@@ -199,36 +446,37 @@ var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
|
199
446
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
200
447
|
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
201
448
|
registeredIn: JurisdictionFilter.optional(),
|
|
202
|
-
registeredBy: UserFilter.optional()
|
|
449
|
+
registeredBy: UserFilter.optional(),
|
|
450
|
+
flags: ContainsFlags.optional()
|
|
203
451
|
}).describe(
|
|
204
452
|
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
205
453
|
);
|
|
206
454
|
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
207
|
-
customActionTypes:
|
|
455
|
+
customActionTypes: z10.preprocess(
|
|
208
456
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
209
|
-
|
|
457
|
+
z10.array(z10.string()).optional()
|
|
210
458
|
).describe("Allowed custom action types")
|
|
211
459
|
});
|
|
212
|
-
var AccessLevelOptions =
|
|
460
|
+
var AccessLevelOptions = z10.object({
|
|
213
461
|
accessLevel: JurisdictionFilter.optional()
|
|
214
462
|
});
|
|
215
463
|
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
216
464
|
role: userRole.optional()
|
|
217
465
|
});
|
|
218
|
-
var WorkqueueOrDashboardOptions =
|
|
219
|
-
ids:
|
|
466
|
+
var WorkqueueOrDashboardOptions = z10.object({
|
|
467
|
+
ids: z10.preprocess(
|
|
220
468
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
221
|
-
|
|
469
|
+
z10.array(z10.string())
|
|
222
470
|
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
223
471
|
});
|
|
224
|
-
var AllScopeOptions =
|
|
472
|
+
var AllScopeOptions = z10.object({
|
|
225
473
|
...AllRecordScopeOptions.shape,
|
|
226
474
|
...AccessLevelOptions.shape,
|
|
227
475
|
...AllUserScopeOptions.shape,
|
|
228
476
|
...WorkqueueOrDashboardOptions.shape
|
|
229
477
|
});
|
|
230
478
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
231
|
-
var ResolvedScopeOptionsPlaceEvent =
|
|
479
|
+
var ResolvedScopeOptionsPlaceEvent = z10.object({
|
|
232
480
|
event: scopeByEvent,
|
|
233
481
|
placeOfEvent: UUID.nullish()
|
|
234
482
|
}).describe(
|
|
@@ -236,15 +484,16 @@ var ResolvedScopeOptionsPlaceEvent = z6.object({
|
|
|
236
484
|
);
|
|
237
485
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
238
486
|
notifiedIn: UUID.nullish(),
|
|
239
|
-
notifiedBy:
|
|
487
|
+
notifiedBy: z10.string().optional(),
|
|
240
488
|
declaredIn: UUID.nullish(),
|
|
241
|
-
declaredBy:
|
|
489
|
+
declaredBy: z10.string().optional()
|
|
242
490
|
}).describe(
|
|
243
491
|
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
244
492
|
);
|
|
245
493
|
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
246
494
|
registeredIn: UUID.nullish(),
|
|
247
|
-
registeredBy:
|
|
495
|
+
registeredBy: z10.string().optional(),
|
|
496
|
+
flags: ContainsFlags.optional()
|
|
248
497
|
}).describe(
|
|
249
498
|
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
250
499
|
);
|
|
@@ -257,6 +506,7 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
|
257
506
|
"record.edit",
|
|
258
507
|
"record.reject",
|
|
259
508
|
"record.archive",
|
|
509
|
+
"record.unarchive",
|
|
260
510
|
"record.review-duplicates",
|
|
261
511
|
"record.register"
|
|
262
512
|
]);
|
|
@@ -268,38 +518,38 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
|
268
518
|
"record.unassign-others"
|
|
269
519
|
]);
|
|
270
520
|
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
271
|
-
templates:
|
|
521
|
+
templates: z10.preprocess(
|
|
272
522
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
273
|
-
|
|
523
|
+
z10.array(z10.string()).optional()
|
|
274
524
|
).describe(
|
|
275
525
|
"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
526
|
)
|
|
277
527
|
});
|
|
278
|
-
var RecordScopeV2 =
|
|
279
|
-
|
|
528
|
+
var RecordScopeV2 = z10.discriminatedUnion("type", [
|
|
529
|
+
z10.object({
|
|
280
530
|
type: ScopesWithPlaceEventOptions,
|
|
281
531
|
options: scopeOptionsPlaceEvent.optional()
|
|
282
532
|
}),
|
|
283
|
-
|
|
533
|
+
z10.object({
|
|
284
534
|
type: ScopesWithDeclaredOptions,
|
|
285
535
|
options: scopeOptionsDeclaredOrNotified.optional()
|
|
286
536
|
}),
|
|
287
|
-
|
|
537
|
+
z10.object({
|
|
288
538
|
type: ScopesWithFullOptions,
|
|
289
539
|
options: AllRecordScopeOptions.optional()
|
|
290
540
|
}),
|
|
291
|
-
|
|
292
|
-
type:
|
|
541
|
+
z10.object({
|
|
542
|
+
type: z10.literal("record.custom-action"),
|
|
293
543
|
options: CustomActionScopeOptions.optional()
|
|
294
544
|
}),
|
|
295
|
-
|
|
296
|
-
type:
|
|
545
|
+
z10.object({
|
|
546
|
+
type: z10.literal("record.print-certified-copies"),
|
|
297
547
|
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
298
548
|
})
|
|
299
549
|
]).describe(
|
|
300
550
|
"Scopes used to check user's permission to perform actions on a record."
|
|
301
551
|
);
|
|
302
|
-
var SystemScopeType =
|
|
552
|
+
var SystemScopeType = z10.enum([
|
|
303
553
|
"organisation.read-locations",
|
|
304
554
|
"user.read",
|
|
305
555
|
"user.create",
|
|
@@ -313,61 +563,61 @@ var UserScopeType = SystemScopeType.extract([
|
|
|
313
563
|
"user.search"
|
|
314
564
|
]);
|
|
315
565
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
316
|
-
var UserScopeV2 =
|
|
317
|
-
|
|
566
|
+
var UserScopeV2 = z10.discriminatedUnion("type", [
|
|
567
|
+
z10.object({
|
|
318
568
|
type: ScopesWithRoleOption,
|
|
319
569
|
options: AllUserScopeOptions.optional()
|
|
320
570
|
}),
|
|
321
|
-
|
|
571
|
+
z10.object({
|
|
322
572
|
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
323
573
|
options: AccessLevelOptions.optional()
|
|
324
574
|
})
|
|
325
575
|
]);
|
|
326
|
-
var ResolvedRecordScopeV2 =
|
|
327
|
-
|
|
576
|
+
var ResolvedRecordScopeV2 = z10.discriminatedUnion("type", [
|
|
577
|
+
z10.object({
|
|
328
578
|
type: ScopesWithPlaceEventOptions,
|
|
329
579
|
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
330
580
|
}),
|
|
331
|
-
|
|
581
|
+
z10.object({
|
|
332
582
|
type: ScopesWithDeclaredOptions,
|
|
333
583
|
options: ResolvedScopeOptionsDeclared.optional()
|
|
334
584
|
}),
|
|
335
|
-
|
|
585
|
+
z10.object({
|
|
336
586
|
type: ScopesWithFullOptions,
|
|
337
587
|
options: ResolvedScopeOptionsFull.optional()
|
|
338
588
|
}),
|
|
339
|
-
|
|
340
|
-
type:
|
|
589
|
+
z10.object({
|
|
590
|
+
type: z10.literal("record.print-certified-copies"),
|
|
341
591
|
options: ResolvedScopeOptionsFull.extend({
|
|
342
|
-
templates:
|
|
592
|
+
templates: z10.array(z10.string()).optional()
|
|
343
593
|
}).optional()
|
|
344
594
|
})
|
|
345
595
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
346
|
-
var Scope2 =
|
|
347
|
-
|
|
596
|
+
var Scope2 = z10.discriminatedUnion("type", [
|
|
597
|
+
z10.object({ type: PlainScopeType }),
|
|
348
598
|
...RecordScopeV2.options,
|
|
349
599
|
...UserScopeV2.options,
|
|
350
|
-
|
|
351
|
-
type:
|
|
600
|
+
z10.object({
|
|
601
|
+
type: z10.literal("organisation.read-locations"),
|
|
352
602
|
options: AccessLevelOptions.optional()
|
|
353
603
|
}),
|
|
354
|
-
|
|
355
|
-
type:
|
|
604
|
+
z10.object({
|
|
605
|
+
type: z10.literal("workqueue"),
|
|
356
606
|
options: WorkqueueOrDashboardOptions
|
|
357
607
|
}),
|
|
358
|
-
|
|
359
|
-
type:
|
|
608
|
+
z10.object({
|
|
609
|
+
type: z10.literal("dashboard.view"),
|
|
360
610
|
options: WorkqueueOrDashboardOptions
|
|
361
611
|
})
|
|
362
612
|
]);
|
|
363
|
-
var ScopeType2 =
|
|
613
|
+
var ScopeType2 = z10.enum([
|
|
364
614
|
...SystemScopeType.options,
|
|
365
615
|
...RecordScopeTypeV2.options,
|
|
366
616
|
...PlainScopeType.options,
|
|
367
617
|
"workqueue",
|
|
368
618
|
"dashboard.view"
|
|
369
619
|
]);
|
|
370
|
-
var EncodedScope2 =
|
|
620
|
+
var EncodedScope2 = z10.string().brand("EncodedScope");
|
|
371
621
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
372
622
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
373
623
|
accessLevel: JurisdictionFilter.enum.all,
|
|
@@ -1062,4 +1312,4 @@ function createFieldConditionals(fieldId) {
|
|
|
1062
1312
|
}
|
|
1063
1313
|
|
|
1064
1314
|
// src/conditionals/index.ts
|
|
1065
|
-
|
|
1315
|
+
z12.globalRegistry.clear();
|