@opencrvs/toolkit 2.1.0-rc.d078d1a → 2.1.0-rc.d13869e
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 +189 -200
- package/dist/commons/api/router.d.ts +1 -86
- package/dist/commons/conditionals/conditionals.d.ts +6 -6
- package/dist/commons/conditionals/validate.d.ts +1 -10
- package/dist/commons/events/ActionDocument.d.ts +7 -1
- package/dist/commons/events/AdvancedSearchConfig.d.ts +0 -12
- package/dist/commons/events/AuditLog.d.ts +0 -37
- package/dist/commons/events/EventConfig.d.ts +0 -3
- package/dist/commons/events/EventIndex.d.ts +24 -1
- package/dist/commons/events/FieldConfig.d.ts +0 -10
- package/dist/commons/events/FieldTypeMapping.d.ts +27 -27
- package/dist/commons/events/Flag.d.ts +0 -42
- package/dist/commons/events/WorkqueueConfig.d.ts +14 -17
- package/dist/commons/events/event.d.ts +0 -12
- package/dist/commons/events/index.d.ts +0 -1
- package/dist/commons/events/locations.d.ts +0 -7
- package/dist/conditionals/index.js +55 -303
- package/dist/events/index.js +2829 -2988
- package/dist/notification/index.js +1047 -1724
- package/dist/scopes/index.d.ts +1 -226
- package/dist/scopes/index.js +55 -304
- package/opencrvs-toolkit-2.1.0-rc.d13869e.tgz +0 -0
- package/package.json +1 -1
- package/dist/commons/events/ActionStatus.d.ts +0 -14
- package/dist/commons/events/locationPayloads.d.ts +0 -95
- package/opencrvs-toolkit-2.1.0-rc.d078d1a.tgz +0 -0
|
@@ -38,7 +38,7 @@ __export(notification_exports, {
|
|
|
38
38
|
triggerUserEventNotification: () => triggerUserEventNotification
|
|
39
39
|
});
|
|
40
40
|
module.exports = __toCommonJS(notification_exports);
|
|
41
|
-
var
|
|
41
|
+
var z45 = __toESM(require("zod/v4"));
|
|
42
42
|
|
|
43
43
|
// ../commons/src/url.ts
|
|
44
44
|
function joinUrl(base, path) {
|
|
@@ -47,14 +47,14 @@ function joinUrl(base, path) {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
// ../commons/src/events/AuditLog.ts
|
|
50
|
-
var
|
|
50
|
+
var z5 = __toESM(require("zod/v4"));
|
|
51
51
|
|
|
52
52
|
// ../commons/src/authentication.ts
|
|
53
53
|
var import_jwt_decode = __toESM(require("jwt-decode"));
|
|
54
|
-
var
|
|
54
|
+
var z3 = __toESM(require("zod/v4"));
|
|
55
55
|
|
|
56
56
|
// ../commons/src/scopes.ts
|
|
57
|
-
var
|
|
57
|
+
var z2 = __toESM(require("zod/v4"));
|
|
58
58
|
var qs = __toESM(require("qs"));
|
|
59
59
|
|
|
60
60
|
// ../commons/src/uuid.ts
|
|
@@ -65,263 +65,12 @@ function getUUID() {
|
|
|
65
65
|
return (0, import_uuid.v4)();
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
// ../commons/src/events/ActionType.ts
|
|
69
|
-
var z2 = __toESM(require("zod/v4"));
|
|
70
|
-
var ActionType = {
|
|
71
|
-
// Pre-declaration actions
|
|
72
|
-
DELETE: "DELETE",
|
|
73
|
-
CREATE: "CREATE",
|
|
74
|
-
NOTIFY: "NOTIFY",
|
|
75
|
-
// Declaration actions
|
|
76
|
-
DECLARE: "DECLARE",
|
|
77
|
-
REGISTER: "REGISTER",
|
|
78
|
-
EDIT: "EDIT",
|
|
79
|
-
// Declaration system actions. Non-configurable.
|
|
80
|
-
DUPLICATE_DETECTED: "DUPLICATE_DETECTED",
|
|
81
|
-
REJECT: "REJECT",
|
|
82
|
-
// REJECT_DECLARATION
|
|
83
|
-
MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
|
|
84
|
-
MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
|
|
85
|
-
ARCHIVE: "ARCHIVE",
|
|
86
|
-
UNARCHIVE: "UNARCHIVE",
|
|
87
|
-
// Record actions
|
|
88
|
-
PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
|
|
89
|
-
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
|
90
|
-
REJECT_CORRECTION: "REJECT_CORRECTION",
|
|
91
|
-
APPROVE_CORRECTION: "APPROVE_CORRECTION",
|
|
92
|
-
// General actions
|
|
93
|
-
READ: "READ",
|
|
94
|
-
ASSIGN: "ASSIGN",
|
|
95
|
-
UNASSIGN: "UNASSIGN",
|
|
96
|
-
// Custom action
|
|
97
|
-
CUSTOM: "CUSTOM"
|
|
98
|
-
};
|
|
99
|
-
var ConfirmableActions = [
|
|
100
|
-
ActionType.NOTIFY,
|
|
101
|
-
ActionType.DECLARE,
|
|
102
|
-
ActionType.EDIT,
|
|
103
|
-
ActionType.REGISTER,
|
|
104
|
-
ActionType.REJECT,
|
|
105
|
-
ActionType.ARCHIVE,
|
|
106
|
-
ActionType.UNARCHIVE,
|
|
107
|
-
ActionType.PRINT_CERTIFICATE,
|
|
108
|
-
ActionType.REQUEST_CORRECTION,
|
|
109
|
-
ActionType.APPROVE_CORRECTION,
|
|
110
|
-
ActionType.REJECT_CORRECTION,
|
|
111
|
-
ActionType.CUSTOM
|
|
112
|
-
];
|
|
113
|
-
var ActionTypes = z2.enum([
|
|
114
|
-
"DELETE",
|
|
115
|
-
"CREATE",
|
|
116
|
-
"NOTIFY",
|
|
117
|
-
"DECLARE",
|
|
118
|
-
"EDIT",
|
|
119
|
-
"REGISTER",
|
|
120
|
-
"DUPLICATE_DETECTED",
|
|
121
|
-
"REJECT",
|
|
122
|
-
"MARK_AS_DUPLICATE",
|
|
123
|
-
"MARK_AS_NOT_DUPLICATE",
|
|
124
|
-
"ARCHIVE",
|
|
125
|
-
"UNARCHIVE",
|
|
126
|
-
"PRINT_CERTIFICATE",
|
|
127
|
-
"REQUEST_CORRECTION",
|
|
128
|
-
"REJECT_CORRECTION",
|
|
129
|
-
"APPROVE_CORRECTION",
|
|
130
|
-
"READ",
|
|
131
|
-
"ASSIGN",
|
|
132
|
-
"UNASSIGN",
|
|
133
|
-
"CUSTOM"
|
|
134
|
-
]);
|
|
135
|
-
var ClientSpecificAction = {
|
|
136
|
-
REVIEW_CORRECTION_REQUEST: "REVIEW_CORRECTION_REQUEST"
|
|
137
|
-
};
|
|
138
|
-
var declarationActionValues = [
|
|
139
|
-
ActionTypes.enum.DECLARE,
|
|
140
|
-
ActionTypes.enum.EDIT,
|
|
141
|
-
ActionTypes.enum.REGISTER,
|
|
142
|
-
ActionTypes.enum.NOTIFY,
|
|
143
|
-
ActionTypes.enum.DUPLICATE_DETECTED
|
|
144
|
-
];
|
|
145
|
-
var DeclarationActions = ActionTypes.extract(declarationActionValues);
|
|
146
|
-
var declarationUpdateActionValues = [
|
|
147
|
-
...declarationActionValues,
|
|
148
|
-
ActionTypes.enum.REQUEST_CORRECTION
|
|
149
|
-
];
|
|
150
|
-
var DeclarationUpdateActions = ActionTypes.extract(
|
|
151
|
-
declarationUpdateActionValues
|
|
152
|
-
);
|
|
153
|
-
var annotationActions = ActionTypes.exclude(declarationActionValues);
|
|
154
|
-
var writeActions = ActionTypes.exclude([
|
|
155
|
-
ActionType.CREATE,
|
|
156
|
-
ActionType.READ,
|
|
157
|
-
ActionType.ASSIGN,
|
|
158
|
-
ActionType.UNASSIGN
|
|
159
|
-
]);
|
|
160
|
-
var WorkqueueActionType = ActionTypes.extract([
|
|
161
|
-
ActionType.READ,
|
|
162
|
-
ActionType.DELETE,
|
|
163
|
-
ActionType.DECLARE,
|
|
164
|
-
ActionType.REGISTER,
|
|
165
|
-
ActionType.EDIT,
|
|
166
|
-
ActionType.REJECT,
|
|
167
|
-
ActionType.MARK_AS_DUPLICATE,
|
|
168
|
-
ActionType.ARCHIVE,
|
|
169
|
-
ActionType.UNARCHIVE,
|
|
170
|
-
ActionType.PRINT_CERTIFICATE,
|
|
171
|
-
ActionType.REQUEST_CORRECTION
|
|
172
|
-
]);
|
|
173
|
-
var META_ACTIONS = [
|
|
174
|
-
ActionType.ASSIGN,
|
|
175
|
-
ActionType.UNASSIGN,
|
|
176
|
-
ActionType.READ
|
|
177
|
-
];
|
|
178
|
-
function isMetaAction(actionType) {
|
|
179
|
-
return META_ACTIONS.includes(actionType);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
// ../commons/src/events/ActionStatus.ts
|
|
183
|
-
var ActionStatus = {
|
|
184
|
-
Requested: "Requested",
|
|
185
|
-
Accepted: "Accepted",
|
|
186
|
-
Rejected: "Rejected"
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
// ../commons/src/events/Flag.ts
|
|
190
|
-
var z5 = __toESM(require("zod/v4"));
|
|
191
|
-
|
|
192
|
-
// ../commons/src/events/TranslationConfig.ts
|
|
193
|
-
var z3 = __toESM(require("zod/v4"));
|
|
194
|
-
var TranslationConfig = z3.object({
|
|
195
|
-
id: z3.string().describe(
|
|
196
|
-
"The identifier of the translation referred in translation CSV files"
|
|
197
|
-
),
|
|
198
|
-
defaultMessage: z3.string().describe("Default translation message"),
|
|
199
|
-
description: z3.string().describe(
|
|
200
|
-
"Describe the translation for a translator to be able to identify it."
|
|
201
|
-
)
|
|
202
|
-
}).meta({
|
|
203
|
-
description: "Translation configuration",
|
|
204
|
-
id: "TranslationConfig"
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
// ../commons/src/events/Conditional.ts
|
|
208
|
-
var z4 = __toESM(require("zod/v4"));
|
|
209
|
-
var Conditional = z4.any().describe("JSONSchema").meta({
|
|
210
|
-
description: "JSON schema conditional configuration",
|
|
211
|
-
id: "Conditional"
|
|
212
|
-
});
|
|
213
|
-
var ConditionalType = {
|
|
214
|
-
SHOW: "SHOW",
|
|
215
|
-
ENABLE: "ENABLE",
|
|
216
|
-
DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
|
|
217
|
-
};
|
|
218
|
-
var ShowConditional = z4.object({
|
|
219
|
-
type: z4.literal(ConditionalType.SHOW),
|
|
220
|
-
conditional: Conditional
|
|
221
|
-
}).describe(
|
|
222
|
-
"If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
|
|
223
|
-
);
|
|
224
|
-
var EnableConditional = z4.object({
|
|
225
|
-
type: z4.literal(ConditionalType.ENABLE),
|
|
226
|
-
conditional: Conditional
|
|
227
|
-
}).describe(
|
|
228
|
-
"If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
|
|
229
|
-
);
|
|
230
|
-
var ActionConditional = z4.discriminatedUnion("type", [
|
|
231
|
-
// Action can be shown / hidden
|
|
232
|
-
ShowConditional,
|
|
233
|
-
// Action can be shown to the user in the list but as disabled
|
|
234
|
-
EnableConditional
|
|
235
|
-
]).meta({
|
|
236
|
-
id: "ActionConditional",
|
|
237
|
-
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."
|
|
238
|
-
});
|
|
239
|
-
var DisplayOnReviewConditional = z4.object({
|
|
240
|
-
type: z4.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
241
|
-
conditional: Conditional
|
|
242
|
-
}).describe(
|
|
243
|
-
"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."
|
|
244
|
-
);
|
|
245
|
-
var FieldConditional = z4.discriminatedUnion("type", [
|
|
246
|
-
// Field input can be shown / hidden
|
|
247
|
-
ShowConditional,
|
|
248
|
-
// Field input can be shown to the user but as disabled
|
|
249
|
-
EnableConditional,
|
|
250
|
-
// Field output can be shown / hidden on the review page
|
|
251
|
-
DisplayOnReviewConditional
|
|
252
|
-
]).meta({
|
|
253
|
-
id: "FieldConditional",
|
|
254
|
-
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."
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
// ../commons/src/events/Flag.ts
|
|
258
|
-
var InherentFlags = {
|
|
259
|
-
INCOMPLETE: "incomplete",
|
|
260
|
-
REJECTED: "rejected",
|
|
261
|
-
CORRECTION_REQUESTED: "correction-requested",
|
|
262
|
-
POTENTIAL_DUPLICATE: "potential-duplicate",
|
|
263
|
-
/**
|
|
264
|
-
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
265
|
-
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
266
|
-
*
|
|
267
|
-
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
268
|
-
*/
|
|
269
|
-
EDIT_IN_PROGRESS: "edit-in-progress"
|
|
270
|
-
};
|
|
271
|
-
var actionFlagPattern;
|
|
272
|
-
function getActionFlagPattern() {
|
|
273
|
-
actionFlagPattern ??= new RegExp(
|
|
274
|
-
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
275
|
-
ActionStatus
|
|
276
|
-
).join("|").toLowerCase()})$`
|
|
277
|
-
);
|
|
278
|
-
return actionFlagPattern;
|
|
279
|
-
}
|
|
280
|
-
var ActionFlag = z5.string().refine((value) => getActionFlagPattern().test(value), {
|
|
281
|
-
message: "Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
282
|
-
});
|
|
283
|
-
var CustomFlag = z5.string().refine((val) => !Object.values(InherentFlags).includes(val), {
|
|
284
|
-
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
285
|
-
InherentFlags
|
|
286
|
-
).join(", ")}`
|
|
287
|
-
}).refine((val) => !ActionFlag.safeParse(val).success, {
|
|
288
|
-
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
289
|
-
}).describe("Custom flag identifier defined by the country config.");
|
|
290
|
-
var Flag = ActionFlag.or(z5.enum(InherentFlags)).or(CustomFlag);
|
|
291
|
-
var ContainsFlags = z5.object({
|
|
292
|
-
anyOf: z5.array(Flag).optional(),
|
|
293
|
-
noneOf: z5.array(Flag).optional(),
|
|
294
|
-
allOf: z5.array(Flag).optional()
|
|
295
|
-
}).meta({
|
|
296
|
-
id: "ContainsFlags"
|
|
297
|
-
});
|
|
298
|
-
var FlagConfig = z5.object({
|
|
299
|
-
id: CustomFlag,
|
|
300
|
-
requiresAction: z5.boolean().describe(
|
|
301
|
-
"Indicates if this flag expects an action to be performed to be cleared."
|
|
302
|
-
),
|
|
303
|
-
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
304
|
-
}).meta({
|
|
305
|
-
id: "FlagConfig",
|
|
306
|
-
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
307
|
-
});
|
|
308
|
-
var ActionFlagConfig = z5.object({
|
|
309
|
-
id: Flag,
|
|
310
|
-
operation: z5.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
311
|
-
conditional: Conditional.optional().describe(
|
|
312
|
-
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
313
|
-
)
|
|
314
|
-
}).meta({
|
|
315
|
-
id: "ActionFlagConfig",
|
|
316
|
-
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
317
|
-
});
|
|
318
|
-
|
|
319
68
|
// ../commons/src/scopes.ts
|
|
320
|
-
var JurisdictionFilter =
|
|
69
|
+
var JurisdictionFilter = z2.enum(["administrativeArea", "location", "all"]).describe(
|
|
321
70
|
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
322
71
|
);
|
|
323
|
-
var UserFilter =
|
|
324
|
-
var RecordScopeTypeV2 =
|
|
72
|
+
var UserFilter = z2.enum(["user"]).describe("Filters based on the user. Limits to self.");
|
|
73
|
+
var RecordScopeTypeV2 = z2.enum([
|
|
325
74
|
"record.search",
|
|
326
75
|
"record.create",
|
|
327
76
|
"record.read",
|
|
@@ -339,7 +88,7 @@ var RecordScopeTypeV2 = z6.enum([
|
|
|
339
88
|
"record.unassign-others",
|
|
340
89
|
"record.custom-action"
|
|
341
90
|
]);
|
|
342
|
-
var PlainScopeType =
|
|
91
|
+
var PlainScopeType = z2.enum([
|
|
343
92
|
// Misc. system scopes
|
|
344
93
|
"bypassratelimit",
|
|
345
94
|
"record.reindex",
|
|
@@ -347,7 +96,6 @@ var PlainScopeType = z6.enum([
|
|
|
347
96
|
"integration.create",
|
|
348
97
|
"record.import",
|
|
349
98
|
"config.update-all",
|
|
350
|
-
"location.edit",
|
|
351
99
|
"attachment.upload",
|
|
352
100
|
"profile.electronic-signature",
|
|
353
101
|
"user.read-only-my-audit",
|
|
@@ -359,15 +107,15 @@ var PlainScopeType = z6.enum([
|
|
|
359
107
|
"record.confirm-registration",
|
|
360
108
|
"record.reject-registration"
|
|
361
109
|
]);
|
|
362
|
-
var scopeByEvent =
|
|
110
|
+
var scopeByEvent = z2.preprocess(
|
|
363
111
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
364
|
-
|
|
112
|
+
z2.array(z2.string()).optional()
|
|
365
113
|
).describe("Event type, e.g. birth, death");
|
|
366
|
-
var userRole =
|
|
114
|
+
var userRole = z2.preprocess(
|
|
367
115
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
368
|
-
|
|
116
|
+
z2.array(z2.string()).optional()
|
|
369
117
|
).describe("User role, e.g. admin, field agent");
|
|
370
|
-
var scopeOptionsPlaceEvent =
|
|
118
|
+
var scopeOptionsPlaceEvent = z2.object({
|
|
371
119
|
event: scopeByEvent,
|
|
372
120
|
placeOfEvent: JurisdictionFilter.optional()
|
|
373
121
|
}).describe("Options applicable to all record scopes.");
|
|
@@ -379,37 +127,36 @@ var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
|
379
127
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
380
128
|
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
381
129
|
registeredIn: JurisdictionFilter.optional(),
|
|
382
|
-
registeredBy: UserFilter.optional()
|
|
383
|
-
flags: ContainsFlags.optional()
|
|
130
|
+
registeredBy: UserFilter.optional()
|
|
384
131
|
}).describe(
|
|
385
132
|
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
386
133
|
);
|
|
387
134
|
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
388
|
-
customActionTypes:
|
|
135
|
+
customActionTypes: z2.preprocess(
|
|
389
136
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
390
|
-
|
|
137
|
+
z2.array(z2.string()).optional()
|
|
391
138
|
).describe("Allowed custom action types")
|
|
392
139
|
});
|
|
393
|
-
var AccessLevelOptions =
|
|
140
|
+
var AccessLevelOptions = z2.object({
|
|
394
141
|
accessLevel: JurisdictionFilter.optional()
|
|
395
142
|
});
|
|
396
143
|
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
397
144
|
role: userRole.optional()
|
|
398
145
|
});
|
|
399
|
-
var WorkqueueOrDashboardOptions =
|
|
400
|
-
ids:
|
|
146
|
+
var WorkqueueOrDashboardOptions = z2.object({
|
|
147
|
+
ids: z2.preprocess(
|
|
401
148
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
402
|
-
|
|
149
|
+
z2.array(z2.string())
|
|
403
150
|
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
404
151
|
});
|
|
405
|
-
var AllScopeOptions =
|
|
152
|
+
var AllScopeOptions = z2.object({
|
|
406
153
|
...AllRecordScopeOptions.shape,
|
|
407
154
|
...AccessLevelOptions.shape,
|
|
408
155
|
...AllUserScopeOptions.shape,
|
|
409
156
|
...WorkqueueOrDashboardOptions.shape
|
|
410
157
|
});
|
|
411
158
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
412
|
-
var ResolvedScopeOptionsPlaceEvent =
|
|
159
|
+
var ResolvedScopeOptionsPlaceEvent = z2.object({
|
|
413
160
|
event: scopeByEvent,
|
|
414
161
|
placeOfEvent: UUID.nullish()
|
|
415
162
|
}).describe(
|
|
@@ -417,16 +164,15 @@ var ResolvedScopeOptionsPlaceEvent = z6.object({
|
|
|
417
164
|
);
|
|
418
165
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
419
166
|
notifiedIn: UUID.nullish(),
|
|
420
|
-
notifiedBy:
|
|
167
|
+
notifiedBy: z2.string().optional(),
|
|
421
168
|
declaredIn: UUID.nullish(),
|
|
422
|
-
declaredBy:
|
|
169
|
+
declaredBy: z2.string().optional()
|
|
423
170
|
}).describe(
|
|
424
171
|
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
425
172
|
);
|
|
426
173
|
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
427
174
|
registeredIn: UUID.nullish(),
|
|
428
|
-
registeredBy:
|
|
429
|
-
flags: ContainsFlags.optional()
|
|
175
|
+
registeredBy: z2.string().optional()
|
|
430
176
|
}).describe(
|
|
431
177
|
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
432
178
|
);
|
|
@@ -451,38 +197,38 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
|
451
197
|
"record.unassign-others"
|
|
452
198
|
]);
|
|
453
199
|
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
454
|
-
templates:
|
|
200
|
+
templates: z2.preprocess(
|
|
455
201
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
456
|
-
|
|
202
|
+
z2.array(z2.string()).optional()
|
|
457
203
|
).describe(
|
|
458
204
|
"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."
|
|
459
205
|
)
|
|
460
206
|
});
|
|
461
|
-
var RecordScopeV2 =
|
|
462
|
-
|
|
207
|
+
var RecordScopeV2 = z2.discriminatedUnion("type", [
|
|
208
|
+
z2.object({
|
|
463
209
|
type: ScopesWithPlaceEventOptions,
|
|
464
210
|
options: scopeOptionsPlaceEvent.optional()
|
|
465
211
|
}),
|
|
466
|
-
|
|
212
|
+
z2.object({
|
|
467
213
|
type: ScopesWithDeclaredOptions,
|
|
468
214
|
options: scopeOptionsDeclaredOrNotified.optional()
|
|
469
215
|
}),
|
|
470
|
-
|
|
216
|
+
z2.object({
|
|
471
217
|
type: ScopesWithFullOptions,
|
|
472
218
|
options: AllRecordScopeOptions.optional()
|
|
473
219
|
}),
|
|
474
|
-
|
|
475
|
-
type:
|
|
220
|
+
z2.object({
|
|
221
|
+
type: z2.literal("record.custom-action"),
|
|
476
222
|
options: CustomActionScopeOptions.optional()
|
|
477
223
|
}),
|
|
478
|
-
|
|
479
|
-
type:
|
|
224
|
+
z2.object({
|
|
225
|
+
type: z2.literal("record.print-certified-copies"),
|
|
480
226
|
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
481
227
|
})
|
|
482
228
|
]).describe(
|
|
483
229
|
"Scopes used to check user's permission to perform actions on a record."
|
|
484
230
|
);
|
|
485
|
-
var SystemScopeType =
|
|
231
|
+
var SystemScopeType = z2.enum([
|
|
486
232
|
"organisation.read-locations",
|
|
487
233
|
"user.read",
|
|
488
234
|
"user.create",
|
|
@@ -496,61 +242,61 @@ var UserScopeType = SystemScopeType.extract([
|
|
|
496
242
|
"user.search"
|
|
497
243
|
]);
|
|
498
244
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
499
|
-
var UserScopeV2 =
|
|
500
|
-
|
|
245
|
+
var UserScopeV2 = z2.discriminatedUnion("type", [
|
|
246
|
+
z2.object({
|
|
501
247
|
type: ScopesWithRoleOption,
|
|
502
248
|
options: AllUserScopeOptions.optional()
|
|
503
249
|
}),
|
|
504
|
-
|
|
250
|
+
z2.object({
|
|
505
251
|
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
506
252
|
options: AccessLevelOptions.optional()
|
|
507
253
|
})
|
|
508
254
|
]);
|
|
509
|
-
var ResolvedRecordScopeV2 =
|
|
510
|
-
|
|
255
|
+
var ResolvedRecordScopeV2 = z2.discriminatedUnion("type", [
|
|
256
|
+
z2.object({
|
|
511
257
|
type: ScopesWithPlaceEventOptions,
|
|
512
258
|
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
513
259
|
}),
|
|
514
|
-
|
|
260
|
+
z2.object({
|
|
515
261
|
type: ScopesWithDeclaredOptions,
|
|
516
262
|
options: ResolvedScopeOptionsDeclared.optional()
|
|
517
263
|
}),
|
|
518
|
-
|
|
264
|
+
z2.object({
|
|
519
265
|
type: ScopesWithFullOptions,
|
|
520
266
|
options: ResolvedScopeOptionsFull.optional()
|
|
521
267
|
}),
|
|
522
|
-
|
|
523
|
-
type:
|
|
268
|
+
z2.object({
|
|
269
|
+
type: z2.literal("record.print-certified-copies"),
|
|
524
270
|
options: ResolvedScopeOptionsFull.extend({
|
|
525
|
-
templates:
|
|
271
|
+
templates: z2.array(z2.string()).optional()
|
|
526
272
|
}).optional()
|
|
527
273
|
})
|
|
528
274
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
529
|
-
var Scope =
|
|
530
|
-
|
|
275
|
+
var Scope = z2.discriminatedUnion("type", [
|
|
276
|
+
z2.object({ type: PlainScopeType }),
|
|
531
277
|
...RecordScopeV2.options,
|
|
532
278
|
...UserScopeV2.options,
|
|
533
|
-
|
|
534
|
-
type:
|
|
279
|
+
z2.object({
|
|
280
|
+
type: z2.literal("organisation.read-locations"),
|
|
535
281
|
options: AccessLevelOptions.optional()
|
|
536
282
|
}),
|
|
537
|
-
|
|
538
|
-
type:
|
|
283
|
+
z2.object({
|
|
284
|
+
type: z2.literal("workqueue"),
|
|
539
285
|
options: WorkqueueOrDashboardOptions
|
|
540
286
|
}),
|
|
541
|
-
|
|
542
|
-
type:
|
|
287
|
+
z2.object({
|
|
288
|
+
type: z2.literal("dashboard.view"),
|
|
543
289
|
options: WorkqueueOrDashboardOptions
|
|
544
290
|
})
|
|
545
291
|
]);
|
|
546
|
-
var ScopeType =
|
|
292
|
+
var ScopeType = z2.enum([
|
|
547
293
|
...SystemScopeType.options,
|
|
548
294
|
...RecordScopeTypeV2.options,
|
|
549
295
|
...PlainScopeType.options,
|
|
550
296
|
"workqueue",
|
|
551
297
|
"dashboard.view"
|
|
552
298
|
]);
|
|
553
|
-
var EncodedScope =
|
|
299
|
+
var EncodedScope = z2.string().brand("EncodedScope");
|
|
554
300
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
555
301
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
556
302
|
accessLevel: JurisdictionFilter.enum.all,
|
|
@@ -560,170 +306,258 @@ var DEFAULT_SCOPE_OPTIONS = {
|
|
|
560
306
|
};
|
|
561
307
|
|
|
562
308
|
// ../commons/src/authentication.ts
|
|
563
|
-
var TokenUserType =
|
|
564
|
-
var TokenWithBearer =
|
|
309
|
+
var TokenUserType = z3.enum(["user", "system"]);
|
|
310
|
+
var TokenWithBearer = z3.string().regex(/^Bearer\s/);
|
|
565
311
|
|
|
566
|
-
// ../commons/src/events/
|
|
567
|
-
var
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
312
|
+
// ../commons/src/events/ActionType.ts
|
|
313
|
+
var z4 = __toESM(require("zod/v4"));
|
|
314
|
+
var ActionType = {
|
|
315
|
+
// Pre-declaration actions
|
|
316
|
+
DELETE: "DELETE",
|
|
317
|
+
CREATE: "CREATE",
|
|
318
|
+
NOTIFY: "NOTIFY",
|
|
319
|
+
// Declaration actions
|
|
320
|
+
DECLARE: "DECLARE",
|
|
321
|
+
REGISTER: "REGISTER",
|
|
322
|
+
EDIT: "EDIT",
|
|
323
|
+
// Declaration system actions. Non-configurable.
|
|
324
|
+
DUPLICATE_DETECTED: "DUPLICATE_DETECTED",
|
|
325
|
+
REJECT: "REJECT",
|
|
326
|
+
// REJECT_DECLARATION
|
|
327
|
+
MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
|
|
328
|
+
MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
|
|
329
|
+
ARCHIVE: "ARCHIVE",
|
|
330
|
+
UNARCHIVE: "UNARCHIVE",
|
|
331
|
+
// Record actions
|
|
332
|
+
PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
|
|
333
|
+
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
|
334
|
+
REJECT_CORRECTION: "REJECT_CORRECTION",
|
|
335
|
+
APPROVE_CORRECTION: "APPROVE_CORRECTION",
|
|
336
|
+
// General actions
|
|
337
|
+
READ: "READ",
|
|
338
|
+
ASSIGN: "ASSIGN",
|
|
339
|
+
UNASSIGN: "UNASSIGN",
|
|
340
|
+
// Custom action
|
|
341
|
+
CUSTOM: "CUSTOM"
|
|
342
|
+
};
|
|
343
|
+
var ConfirmableActions = [
|
|
344
|
+
ActionType.NOTIFY,
|
|
345
|
+
ActionType.DECLARE,
|
|
346
|
+
ActionType.EDIT,
|
|
347
|
+
ActionType.REGISTER,
|
|
348
|
+
ActionType.REJECT,
|
|
349
|
+
ActionType.ARCHIVE,
|
|
350
|
+
ActionType.UNARCHIVE,
|
|
351
|
+
ActionType.PRINT_CERTIFICATE,
|
|
352
|
+
ActionType.REQUEST_CORRECTION,
|
|
353
|
+
ActionType.APPROVE_CORRECTION,
|
|
354
|
+
ActionType.REJECT_CORRECTION,
|
|
355
|
+
ActionType.CUSTOM
|
|
356
|
+
];
|
|
357
|
+
var ActionTypes = z4.enum([
|
|
358
|
+
"DELETE",
|
|
359
|
+
"CREATE",
|
|
360
|
+
"NOTIFY",
|
|
361
|
+
"DECLARE",
|
|
362
|
+
"EDIT",
|
|
363
|
+
"REGISTER",
|
|
364
|
+
"DUPLICATE_DETECTED",
|
|
365
|
+
"REJECT",
|
|
366
|
+
"MARK_AS_DUPLICATE",
|
|
367
|
+
"MARK_AS_NOT_DUPLICATE",
|
|
368
|
+
"ARCHIVE",
|
|
369
|
+
"UNARCHIVE",
|
|
370
|
+
"PRINT_CERTIFICATE",
|
|
371
|
+
"REQUEST_CORRECTION",
|
|
372
|
+
"REJECT_CORRECTION",
|
|
373
|
+
"APPROVE_CORRECTION",
|
|
374
|
+
"READ",
|
|
375
|
+
"ASSIGN",
|
|
376
|
+
"UNASSIGN",
|
|
377
|
+
"CUSTOM"
|
|
378
|
+
]);
|
|
379
|
+
var ClientSpecificAction = {
|
|
380
|
+
REVIEW_CORRECTION_REQUEST: "REVIEW_CORRECTION_REQUEST"
|
|
381
|
+
};
|
|
382
|
+
var declarationActionValues = [
|
|
383
|
+
ActionTypes.enum.DECLARE,
|
|
384
|
+
ActionTypes.enum.EDIT,
|
|
385
|
+
ActionTypes.enum.REGISTER,
|
|
386
|
+
ActionTypes.enum.NOTIFY,
|
|
387
|
+
ActionTypes.enum.DUPLICATE_DETECTED
|
|
388
|
+
];
|
|
389
|
+
var DeclarationActions = ActionTypes.extract(declarationActionValues);
|
|
390
|
+
var declarationUpdateActionValues = [
|
|
391
|
+
...declarationActionValues,
|
|
392
|
+
ActionTypes.enum.REQUEST_CORRECTION
|
|
393
|
+
];
|
|
394
|
+
var DeclarationUpdateActions = ActionTypes.extract(
|
|
395
|
+
declarationUpdateActionValues
|
|
396
|
+
);
|
|
397
|
+
var annotationActions = ActionTypes.exclude(declarationActionValues);
|
|
398
|
+
var writeActions = ActionTypes.exclude([
|
|
399
|
+
ActionType.CREATE,
|
|
400
|
+
ActionType.READ,
|
|
401
|
+
ActionType.ASSIGN,
|
|
402
|
+
ActionType.UNASSIGN
|
|
403
|
+
]);
|
|
404
|
+
var WorkqueueActionType = ActionTypes.extract([
|
|
405
|
+
ActionType.READ,
|
|
406
|
+
ActionType.DELETE,
|
|
407
|
+
ActionType.DECLARE,
|
|
408
|
+
ActionType.REGISTER,
|
|
409
|
+
ActionType.EDIT,
|
|
410
|
+
ActionType.REJECT,
|
|
411
|
+
ActionType.MARK_AS_DUPLICATE,
|
|
412
|
+
ActionType.ARCHIVE,
|
|
413
|
+
ActionType.UNARCHIVE,
|
|
414
|
+
ActionType.PRINT_CERTIFICATE,
|
|
415
|
+
ActionType.REQUEST_CORRECTION
|
|
416
|
+
]);
|
|
417
|
+
var META_ACTIONS = [
|
|
418
|
+
ActionType.ASSIGN,
|
|
419
|
+
ActionType.UNASSIGN,
|
|
420
|
+
ActionType.READ
|
|
421
|
+
];
|
|
422
|
+
|
|
423
|
+
// ../commons/src/events/AuditLog.ts
|
|
424
|
+
var AuditLogEntryBase = z5.object({
|
|
425
|
+
id: z5.string(),
|
|
426
|
+
clientId: z5.string(),
|
|
427
|
+
clientType: TokenUserType,
|
|
428
|
+
createdAt: z5.string()
|
|
429
|
+
});
|
|
430
|
+
var EventCreateEntrySchema = AuditLogEntryBase.extend({
|
|
431
|
+
operation: z5.literal("event.create"),
|
|
432
|
+
requestData: z5.object({
|
|
433
|
+
transactionId: z5.string(),
|
|
434
|
+
type: z5.string(),
|
|
435
|
+
createdAtLocation: z5.string().nullable()
|
|
436
|
+
}),
|
|
437
|
+
responseSummary: z5.object({
|
|
438
|
+
eventId: z5.string(),
|
|
439
|
+
trackingId: z5.string()
|
|
440
|
+
})
|
|
441
|
+
});
|
|
442
|
+
var EventGetEntrySchema = AuditLogEntryBase.extend({
|
|
443
|
+
operation: z5.literal("event.get"),
|
|
444
|
+
requestData: z5.object({ eventId: z5.string() }),
|
|
445
|
+
responseSummary: z5.object({
|
|
446
|
+
eventType: z5.string(),
|
|
447
|
+
trackingId: z5.string()
|
|
448
|
+
})
|
|
449
|
+
});
|
|
450
|
+
var EventSearchEntrySchema = AuditLogEntryBase.extend({
|
|
451
|
+
operation: z5.literal("event.search"),
|
|
452
|
+
clientType: z5.literal("system"),
|
|
453
|
+
requestData: z5.object({
|
|
454
|
+
query: z5.record(z5.string(), z5.unknown()).nullable(),
|
|
455
|
+
limit: z5.number().nullable(),
|
|
456
|
+
offset: z5.number().nullable()
|
|
457
|
+
}),
|
|
458
|
+
responseSummary: z5.object({
|
|
459
|
+
total: z5.number(),
|
|
460
|
+
eventIds: z5.array(z5.string())
|
|
461
|
+
})
|
|
462
|
+
});
|
|
463
|
+
var EventActionEntrySchema = AuditLogEntryBase.extend({
|
|
464
|
+
operation: z5.enum([
|
|
465
|
+
"event.actions.notify.request",
|
|
466
|
+
"event.actions.declare.request",
|
|
467
|
+
"event.actions.register.request",
|
|
468
|
+
"event.actions.reject.request",
|
|
469
|
+
"event.actions.validate.request",
|
|
470
|
+
"event.actions.edit.request",
|
|
471
|
+
"event.actions.assign.request",
|
|
472
|
+
"event.actions.unassign.request",
|
|
473
|
+
"event.actions.read.request",
|
|
474
|
+
"event.actions.archive.request",
|
|
475
|
+
"event.actions.unarchive.request",
|
|
476
|
+
"event.actions.reinstate.request",
|
|
477
|
+
"event.actions.print_certificate.request",
|
|
478
|
+
"event.actions.correction.request.request",
|
|
479
|
+
"event.actions.correction.approve.request",
|
|
480
|
+
"event.actions.correction.reject.request",
|
|
624
481
|
"event.actions.mark_as_duplicate.request",
|
|
625
482
|
"event.actions.mark_as_not_duplicate.request"
|
|
626
483
|
]),
|
|
627
|
-
requestData:
|
|
628
|
-
eventId:
|
|
629
|
-
actionType:
|
|
630
|
-
eventType:
|
|
631
|
-
trackingId:
|
|
632
|
-
transactionId:
|
|
484
|
+
requestData: z5.object({
|
|
485
|
+
eventId: z5.string(),
|
|
486
|
+
actionType: z5.string(),
|
|
487
|
+
eventType: z5.string(),
|
|
488
|
+
trackingId: z5.string(),
|
|
489
|
+
transactionId: z5.string()
|
|
633
490
|
})
|
|
634
491
|
});
|
|
635
492
|
var EventCustomActionEntrySchema = AuditLogEntryBase.extend({
|
|
636
|
-
operation:
|
|
637
|
-
requestData:
|
|
638
|
-
eventId:
|
|
639
|
-
actionType:
|
|
640
|
-
customAction:
|
|
641
|
-
eventType:
|
|
642
|
-
trackingId:
|
|
643
|
-
transactionId:
|
|
493
|
+
operation: z5.literal("event.actions.custom.request"),
|
|
494
|
+
requestData: z5.object({
|
|
495
|
+
eventId: z5.string(),
|
|
496
|
+
actionType: z5.literal(ActionType.CUSTOM),
|
|
497
|
+
customAction: z5.string(),
|
|
498
|
+
eventType: z5.string(),
|
|
499
|
+
trackingId: z5.string(),
|
|
500
|
+
transactionId: z5.string()
|
|
644
501
|
})
|
|
645
502
|
});
|
|
646
503
|
var IntegrationCreateEntrySchema = AuditLogEntryBase.extend({
|
|
647
|
-
operation:
|
|
648
|
-
requestData:
|
|
649
|
-
responseSummary:
|
|
504
|
+
operation: z5.literal("integrations.create"),
|
|
505
|
+
requestData: z5.object({ name: z5.string(), scopes: z5.array(z5.string()) }),
|
|
506
|
+
responseSummary: z5.object({ clientId: z5.string() })
|
|
650
507
|
});
|
|
651
508
|
var IntegrationRefreshTokenEntrySchema = AuditLogEntryBase.extend({
|
|
652
|
-
operation:
|
|
653
|
-
requestData:
|
|
654
|
-
responseSummary:
|
|
509
|
+
operation: z5.literal("integrations.refreshToken"),
|
|
510
|
+
requestData: z5.object({ clientId: z5.string() }),
|
|
511
|
+
responseSummary: z5.object({ clientId: z5.string() })
|
|
655
512
|
});
|
|
656
513
|
var IntegrationDeactivateEntrySchema = AuditLogEntryBase.extend({
|
|
657
|
-
operation:
|
|
658
|
-
requestData:
|
|
659
|
-
responseSummary:
|
|
514
|
+
operation: z5.literal("integrations.deactivate"),
|
|
515
|
+
requestData: z5.object({ id: z5.string() }),
|
|
516
|
+
responseSummary: z5.object({ id: z5.string(), status: z5.string() })
|
|
660
517
|
});
|
|
661
518
|
var IntegrationActivateEntrySchema = AuditLogEntryBase.extend({
|
|
662
|
-
operation:
|
|
663
|
-
requestData:
|
|
664
|
-
responseSummary:
|
|
519
|
+
operation: z5.literal("integrations.activate"),
|
|
520
|
+
requestData: z5.object({ id: z5.string() }),
|
|
521
|
+
responseSummary: z5.object({ id: z5.string(), status: z5.string() })
|
|
665
522
|
});
|
|
666
523
|
var IntegrationDeleteEntrySchema = AuditLogEntryBase.extend({
|
|
667
|
-
operation:
|
|
668
|
-
requestData:
|
|
669
|
-
responseSummary:
|
|
524
|
+
operation: z5.literal("integrations.delete"),
|
|
525
|
+
requestData: z5.object({ id: z5.string() }),
|
|
526
|
+
responseSummary: z5.object({ id: z5.string(), name: z5.string() })
|
|
670
527
|
});
|
|
671
528
|
var IntegrationRefreshSecretEntrySchema = AuditLogEntryBase.extend({
|
|
672
|
-
operation:
|
|
673
|
-
requestData:
|
|
674
|
-
responseSummary:
|
|
675
|
-
});
|
|
676
|
-
var createdVersionFields = {
|
|
677
|
-
id: z8.string(),
|
|
678
|
-
versionId: z8.string(),
|
|
679
|
-
name: z8.string(),
|
|
680
|
-
externalId: z8.string().nullish(),
|
|
681
|
-
effectiveFrom: z8.string(),
|
|
682
|
-
status: z8.string()
|
|
683
|
-
};
|
|
684
|
-
var LocationCreateEntrySchema = AuditLogEntryBase.extend({
|
|
685
|
-
operation: z8.literal("locations.create"),
|
|
686
|
-
requestData: z8.object({
|
|
687
|
-
...createdVersionFields,
|
|
688
|
-
administrativeAreaId: z8.string().nullish(),
|
|
689
|
-
locationType: z8.string().nullish()
|
|
690
|
-
})
|
|
691
|
-
});
|
|
692
|
-
var AdministrativeAreaCreateEntrySchema = AuditLogEntryBase.extend({
|
|
693
|
-
operation: z8.literal("administrativeAreas.create"),
|
|
694
|
-
requestData: z8.object({
|
|
695
|
-
...createdVersionFields,
|
|
696
|
-
parentId: z8.string().nullish()
|
|
697
|
-
})
|
|
529
|
+
operation: z5.literal("integrations.refreshSecret"),
|
|
530
|
+
requestData: z5.object({ id: z5.string() }),
|
|
531
|
+
responseSummary: z5.object({ clientId: z5.string() })
|
|
698
532
|
});
|
|
699
533
|
var AttachmentUploadEntrySchema = AuditLogEntryBase.extend({
|
|
700
|
-
operation:
|
|
701
|
-
requestData:
|
|
702
|
-
transactionId:
|
|
703
|
-
path:
|
|
534
|
+
operation: z5.literal("attachments.upload"),
|
|
535
|
+
requestData: z5.object({
|
|
536
|
+
transactionId: z5.string(),
|
|
537
|
+
path: z5.string().nullable()
|
|
704
538
|
}),
|
|
705
|
-
responseSummary:
|
|
539
|
+
responseSummary: z5.object({ fileUrl: z5.string() })
|
|
706
540
|
});
|
|
707
|
-
var subjectOnly =
|
|
708
|
-
var subjectWithReason =
|
|
709
|
-
subjectId:
|
|
710
|
-
reason:
|
|
711
|
-
comment:
|
|
541
|
+
var subjectOnly = z5.object({ subjectId: z5.string() });
|
|
542
|
+
var subjectWithReason = z5.object({
|
|
543
|
+
subjectId: z5.string(),
|
|
544
|
+
reason: z5.string(),
|
|
545
|
+
comment: z5.string().optional()
|
|
712
546
|
});
|
|
713
547
|
var UserCreateEntrySchema = AuditLogEntryBase.extend({
|
|
714
|
-
operation:
|
|
715
|
-
requestData:
|
|
716
|
-
subjectId:
|
|
717
|
-
role:
|
|
718
|
-
primaryOfficeId:
|
|
548
|
+
operation: z5.literal("user.create_user"),
|
|
549
|
+
requestData: z5.object({
|
|
550
|
+
subjectId: z5.string(),
|
|
551
|
+
role: z5.string(),
|
|
552
|
+
primaryOfficeId: z5.string()
|
|
719
553
|
})
|
|
720
554
|
});
|
|
721
555
|
var UserReasonEntrySchema = AuditLogEntryBase.extend({
|
|
722
|
-
operation:
|
|
556
|
+
operation: z5.enum(["user.deactivate", "user.reactivate"]),
|
|
723
557
|
requestData: subjectWithReason
|
|
724
558
|
});
|
|
725
559
|
var UserSubjectOnlyEntrySchema = AuditLogEntryBase.extend({
|
|
726
|
-
operation:
|
|
560
|
+
operation: z5.enum([
|
|
727
561
|
"user.edit_user",
|
|
728
562
|
"user.logged_in",
|
|
729
563
|
"user.logged_out",
|
|
@@ -737,14 +571,14 @@ var UserSubjectOnlyEntrySchema = AuditLogEntryBase.extend({
|
|
|
737
571
|
requestData: subjectOnly
|
|
738
572
|
});
|
|
739
573
|
var UserEmailChangedEntrySchema = AuditLogEntryBase.extend({
|
|
740
|
-
operation:
|
|
574
|
+
operation: z5.literal("user.email_address_changed"),
|
|
741
575
|
requestData: subjectOnly,
|
|
742
|
-
responseSummary:
|
|
576
|
+
responseSummary: z5.object({ email: z5.string() })
|
|
743
577
|
});
|
|
744
578
|
var UserPhoneChangedEntrySchema = AuditLogEntryBase.extend({
|
|
745
|
-
operation:
|
|
579
|
+
operation: z5.literal("user.phone_number_changed"),
|
|
746
580
|
requestData: subjectOnly,
|
|
747
|
-
responseSummary:
|
|
581
|
+
responseSummary: z5.object({ phoneNumber: z5.string() })
|
|
748
582
|
});
|
|
749
583
|
var userBaseOmit = {
|
|
750
584
|
id: true,
|
|
@@ -752,14 +586,14 @@ var userBaseOmit = {
|
|
|
752
586
|
clientType: true,
|
|
753
587
|
createdAt: true
|
|
754
588
|
};
|
|
755
|
-
var UserAuditRecordInput =
|
|
589
|
+
var UserAuditRecordInput = z5.discriminatedUnion("operation", [
|
|
756
590
|
UserCreateEntrySchema.omit(userBaseOmit),
|
|
757
591
|
UserReasonEntrySchema.omit(userBaseOmit),
|
|
758
592
|
UserSubjectOnlyEntrySchema.omit(userBaseOmit),
|
|
759
593
|
UserEmailChangedEntrySchema.omit(userBaseOmit),
|
|
760
594
|
UserPhoneChangedEntrySchema.omit(userBaseOmit)
|
|
761
595
|
]);
|
|
762
|
-
var AuditLogEntrySchema =
|
|
596
|
+
var AuditLogEntrySchema = z5.discriminatedUnion("operation", [
|
|
763
597
|
EventCreateEntrySchema,
|
|
764
598
|
EventGetEntrySchema,
|
|
765
599
|
EventSearchEntrySchema,
|
|
@@ -771,8 +605,6 @@ var AuditLogEntrySchema = z8.discriminatedUnion("operation", [
|
|
|
771
605
|
IntegrationActivateEntrySchema,
|
|
772
606
|
IntegrationDeleteEntrySchema,
|
|
773
607
|
IntegrationRefreshSecretEntrySchema,
|
|
774
|
-
LocationCreateEntrySchema,
|
|
775
|
-
AdministrativeAreaCreateEntrySchema,
|
|
776
608
|
AttachmentUploadEntrySchema,
|
|
777
609
|
UserCreateEntrySchema,
|
|
778
610
|
UserReasonEntrySchema,
|
|
@@ -788,11 +620,76 @@ var CHILD_ONBOARDING_EVENT = "child-onboarding";
|
|
|
788
620
|
// ../commons/src/events/ActionConfig.ts
|
|
789
621
|
var z24 = __toESM(require("zod/v4"));
|
|
790
622
|
|
|
623
|
+
// ../commons/src/events/TranslationConfig.ts
|
|
624
|
+
var z6 = __toESM(require("zod/v4"));
|
|
625
|
+
var TranslationConfig = z6.object({
|
|
626
|
+
id: z6.string().describe(
|
|
627
|
+
"The identifier of the translation referred in translation CSV files"
|
|
628
|
+
),
|
|
629
|
+
defaultMessage: z6.string().describe("Default translation message"),
|
|
630
|
+
description: z6.string().describe(
|
|
631
|
+
"Describe the translation for a translator to be able to identify it."
|
|
632
|
+
)
|
|
633
|
+
}).meta({
|
|
634
|
+
description: "Translation configuration",
|
|
635
|
+
id: "TranslationConfig"
|
|
636
|
+
});
|
|
637
|
+
|
|
791
638
|
// ../commons/src/events/FieldConfig.ts
|
|
792
639
|
var import_v43 = __toESM(require("zod/v4"));
|
|
793
640
|
|
|
641
|
+
// ../commons/src/events/Conditional.ts
|
|
642
|
+
var z7 = __toESM(require("zod/v4"));
|
|
643
|
+
var Conditional = z7.any().describe("JSONSchema").meta({
|
|
644
|
+
description: "JSON schema conditional configuration",
|
|
645
|
+
id: "Conditional"
|
|
646
|
+
});
|
|
647
|
+
var ConditionalType = {
|
|
648
|
+
SHOW: "SHOW",
|
|
649
|
+
ENABLE: "ENABLE",
|
|
650
|
+
DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
|
|
651
|
+
};
|
|
652
|
+
var ShowConditional = z7.object({
|
|
653
|
+
type: z7.literal(ConditionalType.SHOW),
|
|
654
|
+
conditional: Conditional
|
|
655
|
+
}).describe(
|
|
656
|
+
"If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
|
|
657
|
+
);
|
|
658
|
+
var EnableConditional = z7.object({
|
|
659
|
+
type: z7.literal(ConditionalType.ENABLE),
|
|
660
|
+
conditional: Conditional
|
|
661
|
+
}).describe(
|
|
662
|
+
"If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
|
|
663
|
+
);
|
|
664
|
+
var ActionConditional = z7.discriminatedUnion("type", [
|
|
665
|
+
// Action can be shown / hidden
|
|
666
|
+
ShowConditional,
|
|
667
|
+
// Action can be shown to the user in the list but as disabled
|
|
668
|
+
EnableConditional
|
|
669
|
+
]).meta({
|
|
670
|
+
id: "ActionConditional",
|
|
671
|
+
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."
|
|
672
|
+
});
|
|
673
|
+
var DisplayOnReviewConditional = z7.object({
|
|
674
|
+
type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
675
|
+
conditional: Conditional
|
|
676
|
+
}).describe(
|
|
677
|
+
"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."
|
|
678
|
+
);
|
|
679
|
+
var FieldConditional = z7.discriminatedUnion("type", [
|
|
680
|
+
// Field input can be shown / hidden
|
|
681
|
+
ShowConditional,
|
|
682
|
+
// Field input can be shown to the user but as disabled
|
|
683
|
+
EnableConditional,
|
|
684
|
+
// Field output can be shown / hidden on the review page
|
|
685
|
+
DisplayOnReviewConditional
|
|
686
|
+
]).meta({
|
|
687
|
+
id: "FieldConditional",
|
|
688
|
+
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."
|
|
689
|
+
});
|
|
690
|
+
|
|
794
691
|
// ../commons/src/events/FieldType.ts
|
|
795
|
-
var
|
|
692
|
+
var z8 = __toESM(require("zod/v4"));
|
|
796
693
|
var FieldType = {
|
|
797
694
|
NAME: "NAME",
|
|
798
695
|
PHONE: "PHONE",
|
|
@@ -856,7 +753,7 @@ var FieldType = {
|
|
|
856
753
|
*/
|
|
857
754
|
_EXPERIMENTAL_CUSTOM: "CUSTOM"
|
|
858
755
|
};
|
|
859
|
-
var FileFieldType =
|
|
756
|
+
var FileFieldType = z8.enum([
|
|
860
757
|
FieldType.FILE,
|
|
861
758
|
FieldType.FILE_WITH_OPTIONS,
|
|
862
759
|
FieldType.SIGNATURE
|
|
@@ -892,164 +789,160 @@ var HiddenFieldTypes = [
|
|
|
892
789
|
];
|
|
893
790
|
|
|
894
791
|
// ../commons/src/events/FieldValue.ts
|
|
895
|
-
var
|
|
792
|
+
var z12 = __toESM(require("zod/v4"));
|
|
896
793
|
|
|
897
794
|
// ../commons/src/documents.ts
|
|
898
|
-
var
|
|
899
|
-
var FullDocumentUrl =
|
|
795
|
+
var z9 = __toESM(require("zod/v4"));
|
|
796
|
+
var FullDocumentUrl = z9.string().brand("FullDocumentUrl").describe(
|
|
900
797
|
"A full url with protocol, host, bucket name, starting from the root of the S3 server, https://minio.opencrvs.com/bucket-name/document-id.jpg"
|
|
901
798
|
);
|
|
902
|
-
var FullDocumentPath =
|
|
799
|
+
var FullDocumentPath = z9.string().overwrite((val) => val.startsWith("/") ? val : `/${val}`).meta({ effectType: "input", type: "string" }).describe(
|
|
903
800
|
"A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
|
|
904
801
|
);
|
|
905
|
-
var DocumentPath =
|
|
802
|
+
var DocumentPath = z9.string().brand("DocumentPath").describe(
|
|
906
803
|
"A relative path within the S3 bucket, never starting with /. e.g. document-id.jpg or directory/document-id.jpg. The document service constructs the full /bucket/path internally."
|
|
907
804
|
);
|
|
908
805
|
|
|
909
806
|
// ../commons/src/events/CompositeFieldValue.ts
|
|
910
|
-
var
|
|
807
|
+
var z10 = __toESM(require("zod/v4"));
|
|
911
808
|
var AddressType = {
|
|
912
809
|
DOMESTIC: "DOMESTIC",
|
|
913
810
|
INTERNATIONAL: "INTERNATIONAL"
|
|
914
811
|
};
|
|
915
|
-
var FileFieldValue =
|
|
812
|
+
var FileFieldValue = z10.object({
|
|
916
813
|
path: DocumentPath,
|
|
917
|
-
originalFilename:
|
|
918
|
-
type:
|
|
919
|
-
});
|
|
920
|
-
var NameFieldValue =
|
|
921
|
-
firstname:
|
|
922
|
-
surname:
|
|
923
|
-
middlename:
|
|
924
|
-
});
|
|
925
|
-
var NameFieldUpdateValue =
|
|
926
|
-
firstname:
|
|
927
|
-
surname:
|
|
928
|
-
middlename:
|
|
929
|
-
}).or(
|
|
930
|
-
var StreetLevelDetailsValue =
|
|
931
|
-
var StreetLevelDetailsUpdateValue =
|
|
932
|
-
var BaseAddressFieldValue =
|
|
933
|
-
country:
|
|
814
|
+
originalFilename: z10.string(),
|
|
815
|
+
type: z10.string()
|
|
816
|
+
});
|
|
817
|
+
var NameFieldValue = z10.object({
|
|
818
|
+
firstname: z10.string(),
|
|
819
|
+
surname: z10.string(),
|
|
820
|
+
middlename: z10.string().optional()
|
|
821
|
+
});
|
|
822
|
+
var NameFieldUpdateValue = z10.object({
|
|
823
|
+
firstname: z10.string().nullish(),
|
|
824
|
+
surname: z10.string().nullish(),
|
|
825
|
+
middlename: z10.string().nullish()
|
|
826
|
+
}).or(z10.null()).or(z10.undefined());
|
|
827
|
+
var StreetLevelDetailsValue = z10.record(z10.string(), z10.string()).optional();
|
|
828
|
+
var StreetLevelDetailsUpdateValue = z10.record(z10.string(), z10.string().nullable()).nullish();
|
|
829
|
+
var BaseAddressFieldValue = z10.object({
|
|
830
|
+
country: z10.string(),
|
|
934
831
|
streetLevelDetails: StreetLevelDetailsValue
|
|
935
832
|
});
|
|
936
|
-
var BaseAddressFieldUpdateValue =
|
|
937
|
-
country:
|
|
833
|
+
var BaseAddressFieldUpdateValue = z10.object({
|
|
834
|
+
country: z10.string().nullish(),
|
|
938
835
|
streetLevelDetails: StreetLevelDetailsUpdateValue
|
|
939
836
|
});
|
|
940
837
|
var DomesticAddressFieldValue = BaseAddressFieldValue.extend({
|
|
941
|
-
addressType:
|
|
942
|
-
administrativeArea:
|
|
838
|
+
addressType: z10.literal(AddressType.DOMESTIC),
|
|
839
|
+
administrativeArea: z10.string().uuid()
|
|
943
840
|
});
|
|
944
841
|
var InternationalAddressFieldValue = BaseAddressFieldValue.extend({
|
|
945
|
-
addressType:
|
|
842
|
+
addressType: z10.literal(AddressType.INTERNATIONAL)
|
|
946
843
|
});
|
|
947
|
-
var AddressFieldValue =
|
|
844
|
+
var AddressFieldValue = z10.discriminatedUnion("addressType", [
|
|
948
845
|
DomesticAddressFieldValue,
|
|
949
846
|
InternationalAddressFieldValue
|
|
950
847
|
]);
|
|
951
848
|
var DomesticAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend({
|
|
952
|
-
addressType:
|
|
953
|
-
administrativeArea:
|
|
849
|
+
addressType: z10.literal(AddressType.DOMESTIC),
|
|
850
|
+
administrativeArea: z10.string().uuid().nullish()
|
|
954
851
|
/* Leaf level admin structure */
|
|
955
852
|
});
|
|
956
853
|
var InternationalAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend(
|
|
957
854
|
{
|
|
958
|
-
addressType:
|
|
855
|
+
addressType: z10.literal(AddressType.INTERNATIONAL)
|
|
959
856
|
}
|
|
960
857
|
);
|
|
961
|
-
var AddressFieldUpdateValue =
|
|
858
|
+
var AddressFieldUpdateValue = z10.discriminatedUnion("addressType", [
|
|
962
859
|
DomesticAddressUpdateFieldValue,
|
|
963
860
|
InternationalAddressUpdateFieldValue
|
|
964
861
|
]).nullish();
|
|
965
|
-
var FileFieldValueWithOption =
|
|
862
|
+
var FileFieldValueWithOption = z10.object({
|
|
966
863
|
path: DocumentPath,
|
|
967
|
-
originalFilename:
|
|
968
|
-
type:
|
|
969
|
-
option:
|
|
970
|
-
});
|
|
971
|
-
var FileFieldWithOptionValue =
|
|
972
|
-
var HttpFieldValue =
|
|
973
|
-
loading:
|
|
974
|
-
error:
|
|
975
|
-
data:
|
|
976
|
-
});
|
|
977
|
-
var HttpFieldUpdateValue =
|
|
978
|
-
loading:
|
|
979
|
-
error:
|
|
980
|
-
data:
|
|
981
|
-
}).or(
|
|
982
|
-
var QueryParamReaderFieldValue =
|
|
983
|
-
data:
|
|
984
|
-
updatedAt:
|
|
864
|
+
originalFilename: z10.string(),
|
|
865
|
+
type: z10.string(),
|
|
866
|
+
option: z10.string()
|
|
867
|
+
});
|
|
868
|
+
var FileFieldWithOptionValue = z10.array(FileFieldValueWithOption);
|
|
869
|
+
var HttpFieldValue = z10.object({
|
|
870
|
+
loading: z10.boolean(),
|
|
871
|
+
error: z10.object({ statusCode: z10.number(), message: z10.string() }).nullish(),
|
|
872
|
+
data: z10.any()
|
|
873
|
+
});
|
|
874
|
+
var HttpFieldUpdateValue = z10.object({
|
|
875
|
+
loading: z10.boolean().nullish(),
|
|
876
|
+
error: z10.object({ statusCode: z10.number(), message: z10.string() }).nullish(),
|
|
877
|
+
data: z10.any().nullish()
|
|
878
|
+
}).or(z10.null()).or(z10.undefined());
|
|
879
|
+
var QueryParamReaderFieldValue = z10.object({
|
|
880
|
+
data: z10.record(z10.string(), z10.string()),
|
|
881
|
+
updatedAt: z10.iso.datetime()
|
|
985
882
|
}).nullish();
|
|
986
|
-
var QueryParamReaderFieldUpdateValue =
|
|
987
|
-
data:
|
|
883
|
+
var QueryParamReaderFieldUpdateValue = z10.object({
|
|
884
|
+
data: z10.record(z10.string(), z10.string())
|
|
988
885
|
});
|
|
989
|
-
var ReadDataValue =
|
|
990
|
-
data:
|
|
886
|
+
var ReadDataValue = z10.object({
|
|
887
|
+
data: z10.any()
|
|
991
888
|
});
|
|
992
889
|
var QrReaderFieldValue = ReadDataValue;
|
|
993
890
|
var IdReaderFieldValue = ReadDataValue;
|
|
994
|
-
var NumberWithUnitFieldValue =
|
|
995
|
-
numericValue:
|
|
996
|
-
unit:
|
|
891
|
+
var NumberWithUnitFieldValue = z10.object({
|
|
892
|
+
numericValue: z10.number(),
|
|
893
|
+
unit: z10.string()
|
|
997
894
|
});
|
|
998
|
-
var NumberWithUnitFieldUpdateValue =
|
|
999
|
-
numericValue:
|
|
1000
|
-
unit:
|
|
895
|
+
var NumberWithUnitFieldUpdateValue = z10.object({
|
|
896
|
+
numericValue: z10.number().optional(),
|
|
897
|
+
unit: z10.string().optional()
|
|
1001
898
|
});
|
|
1002
|
-
var CustomFieldValue =
|
|
899
|
+
var CustomFieldValue = z10.unknown().brand("CustomFieldValue");
|
|
1003
900
|
|
|
1004
901
|
// ../commons/src/events/PlainDate.ts
|
|
1005
902
|
var import_zod = require("zod");
|
|
1006
903
|
var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date in the format YYYY-MM-DD");
|
|
1007
|
-
function plainDateToLocalDate(date) {
|
|
1008
|
-
const [year, month, day] = date.split("-").map(Number);
|
|
1009
|
-
return new Date(year, month - 1, day);
|
|
1010
|
-
}
|
|
1011
904
|
|
|
1012
905
|
// ../commons/src/events/FieldValue.ts
|
|
1013
|
-
var TextValue =
|
|
1014
|
-
var HiddenFieldValue =
|
|
1015
|
-
var NonEmptyTextValue =
|
|
1016
|
-
var DateValue =
|
|
1017
|
-
var AgeValue =
|
|
1018
|
-
age:
|
|
1019
|
-
asOfDateRef:
|
|
906
|
+
var TextValue = z12.string();
|
|
907
|
+
var HiddenFieldValue = z12.string();
|
|
908
|
+
var NonEmptyTextValue = z12.string().trim().min(1);
|
|
909
|
+
var DateValue = z12.iso.date().describe("Date in the format YYYY-MM-DD");
|
|
910
|
+
var AgeValue = z12.object({
|
|
911
|
+
age: z12.number(),
|
|
912
|
+
asOfDateRef: z12.string()
|
|
1020
913
|
});
|
|
1021
914
|
var AgeUpdateValue = AgeValue.optional().nullable();
|
|
1022
|
-
var AutocompleteValue =
|
|
1023
|
-
label:
|
|
1024
|
-
value:
|
|
915
|
+
var AutocompleteValue = z12.object({
|
|
916
|
+
label: z12.string(),
|
|
917
|
+
value: z12.string()
|
|
1025
918
|
});
|
|
1026
919
|
var AutocompleteUpdateValue = AutocompleteValue.optional().nullable();
|
|
1027
|
-
var TimeValue =
|
|
1028
|
-
var DatetimeValue =
|
|
1029
|
-
var SelectDateRangeValue =
|
|
920
|
+
var TimeValue = z12.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/);
|
|
921
|
+
var DatetimeValue = z12.iso.datetime();
|
|
922
|
+
var SelectDateRangeValue = z12.enum([
|
|
1030
923
|
"last7Days",
|
|
1031
924
|
"last30Days",
|
|
1032
925
|
"last90Days",
|
|
1033
926
|
"last365Days"
|
|
1034
927
|
]);
|
|
1035
|
-
var DateRangeFieldValue =
|
|
928
|
+
var DateRangeFieldValue = z12.object({
|
|
1036
929
|
start: PlainDate,
|
|
1037
930
|
end: PlainDate
|
|
1038
931
|
}).or(PlainDate).describe(
|
|
1039
932
|
"Date range with start and end dates in the format YYYY-MM-DD. Inclusive start, exclusive end."
|
|
1040
933
|
);
|
|
1041
|
-
var EmailValue =
|
|
1042
|
-
var CheckboxFieldValue =
|
|
1043
|
-
var NumberFieldValue =
|
|
934
|
+
var EmailValue = z12.email();
|
|
935
|
+
var CheckboxFieldValue = z12.boolean();
|
|
936
|
+
var NumberFieldValue = z12.number();
|
|
1044
937
|
var SignatureFieldValue = FileFieldValue;
|
|
1045
|
-
var ButtonFieldValue =
|
|
1046
|
-
var VerificationStatusValue =
|
|
938
|
+
var ButtonFieldValue = z12.number();
|
|
939
|
+
var VerificationStatusValue = z12.enum([
|
|
1047
940
|
"verified",
|
|
1048
941
|
"authenticated",
|
|
1049
942
|
"failed",
|
|
1050
943
|
"pending"
|
|
1051
944
|
]);
|
|
1052
|
-
var LeafFieldValues =
|
|
945
|
+
var LeafFieldValues = z12.union([
|
|
1053
946
|
AddressFieldValue,
|
|
1054
947
|
TextValue,
|
|
1055
948
|
PlainDate,
|
|
@@ -1075,11 +968,11 @@ var LeafFieldValues = z13.union([
|
|
|
1075
968
|
AutocompleteValue,
|
|
1076
969
|
AutocompleteUpdateValue
|
|
1077
970
|
]);
|
|
1078
|
-
var FieldGroupValue =
|
|
1079
|
-
var DataFieldValue =
|
|
1080
|
-
data:
|
|
971
|
+
var FieldGroupValue = z12.record(z12.string(), LeafFieldValues);
|
|
972
|
+
var DataFieldValue = z12.object({
|
|
973
|
+
data: z12.record(z12.string(), LeafFieldValues)
|
|
1081
974
|
}).nullish();
|
|
1082
|
-
var FieldValue =
|
|
975
|
+
var FieldValue = z12.union([
|
|
1083
976
|
LeafFieldValues,
|
|
1084
977
|
DataFieldValue,
|
|
1085
978
|
FieldGroupValue
|
|
@@ -1113,7 +1006,7 @@ function safeUnion(schemas) {
|
|
|
1113
1006
|
const sortedSchemas = [...schemas].sort(
|
|
1114
1007
|
(a, b) => schemaPriority(a) - schemaPriority(b)
|
|
1115
1008
|
);
|
|
1116
|
-
return
|
|
1009
|
+
return z12.any().superRefine((val, ctx) => {
|
|
1117
1010
|
for (const schema of sortedSchemas) {
|
|
1118
1011
|
if (schema.safeParse(val).success) {
|
|
1119
1012
|
return;
|
|
@@ -1152,9 +1045,9 @@ var FieldUpdateValue = safeUnion([
|
|
|
1152
1045
|
]);
|
|
1153
1046
|
|
|
1154
1047
|
// ../commons/src/events/serializers/user/serializer.ts
|
|
1155
|
-
var
|
|
1156
|
-
var SerializedUserField =
|
|
1157
|
-
$userField:
|
|
1048
|
+
var z13 = __toESM(require("zod/v4"));
|
|
1049
|
+
var SerializedUserField = z13.object({
|
|
1050
|
+
$userField: z13.enum([
|
|
1158
1051
|
"id",
|
|
1159
1052
|
"name",
|
|
1160
1053
|
"role",
|
|
@@ -1168,7 +1061,7 @@ var SerializedUserField = z14.object({
|
|
|
1168
1061
|
"primaryOfficeId",
|
|
1169
1062
|
"administrativeAreaId"
|
|
1170
1063
|
]),
|
|
1171
|
-
$location:
|
|
1064
|
+
$location: z13.string().optional()
|
|
1172
1065
|
});
|
|
1173
1066
|
function userSerializer(userField) {
|
|
1174
1067
|
return {
|
|
@@ -1194,22 +1087,27 @@ var import_v4 = require("zod/v4");
|
|
|
1194
1087
|
var z16 = __toESM(require("zod/v4"));
|
|
1195
1088
|
|
|
1196
1089
|
// ../commons/src/events/ActionDocument.ts
|
|
1197
|
-
var
|
|
1198
|
-
var ActionUpdate =
|
|
1090
|
+
var z14 = __toESM(require("zod/v4"));
|
|
1091
|
+
var ActionUpdate = z14.record(z14.string(), FieldUpdateValue).describe(
|
|
1199
1092
|
"Record of field-level changes made by an action. Supports partial updates and nullable values."
|
|
1200
1093
|
);
|
|
1201
|
-
var EventState =
|
|
1094
|
+
var EventState = z14.record(z14.string(), FieldValue).describe(
|
|
1202
1095
|
"Aggregate representation of event data after all actions have been applied, with all updates consolidated and null values removed."
|
|
1203
1096
|
);
|
|
1204
|
-
var
|
|
1097
|
+
var ActionStatus = {
|
|
1098
|
+
Requested: "Requested",
|
|
1099
|
+
Accepted: "Accepted",
|
|
1100
|
+
Rejected: "Rejected"
|
|
1101
|
+
};
|
|
1102
|
+
var ActionBase = z14.object({
|
|
1205
1103
|
id: UUID.describe("Unique identifier of the action."),
|
|
1206
|
-
transactionId:
|
|
1104
|
+
transactionId: z14.string().describe("Unique identifier of the transaction."),
|
|
1207
1105
|
createdByUserType: TokenUserType.describe(
|
|
1208
1106
|
"Indicates whether the action was created by a human-user or by a system-user."
|
|
1209
1107
|
),
|
|
1210
|
-
createdAt:
|
|
1211
|
-
createdBy:
|
|
1212
|
-
createdByRole:
|
|
1108
|
+
createdAt: z14.string().datetime().describe("Timestamp indicating when the action was created."),
|
|
1109
|
+
createdBy: z14.string().describe("Identifier of the user who created the action."),
|
|
1110
|
+
createdByRole: z14.string().optional().describe("Role of the user who created the action."),
|
|
1213
1111
|
createdBySignature: DocumentPath.nullish().describe(
|
|
1214
1112
|
"Reference to the signature of the user who created the action."
|
|
1215
1113
|
),
|
|
@@ -1221,7 +1119,7 @@ var ActionBase = z15.object({
|
|
|
1221
1119
|
"Declaration data defined by the ActionConfig. Supports partial updates."
|
|
1222
1120
|
),
|
|
1223
1121
|
annotation: ActionUpdate.optional().nullable().describe("Action-specific metadata used to annotate the event."),
|
|
1224
|
-
status:
|
|
1122
|
+
status: z14.enum([
|
|
1225
1123
|
ActionStatus.Requested,
|
|
1226
1124
|
ActionStatus.Accepted,
|
|
1227
1125
|
ActionStatus.Rejected
|
|
@@ -1233,139 +1131,139 @@ var ActionBase = z15.object({
|
|
|
1233
1131
|
)
|
|
1234
1132
|
});
|
|
1235
1133
|
var AssignedAction = ActionBase.extend(
|
|
1236
|
-
|
|
1237
|
-
type:
|
|
1238
|
-
assignedTo:
|
|
1134
|
+
z14.object({
|
|
1135
|
+
type: z14.literal(ActionType.ASSIGN),
|
|
1136
|
+
assignedTo: z14.string().describe("Identifier of the user to whom the action is assigned.")
|
|
1239
1137
|
// TODO move into 'content' property
|
|
1240
1138
|
}).shape
|
|
1241
1139
|
);
|
|
1242
1140
|
var UnassignedAction = ActionBase.extend(
|
|
1243
|
-
|
|
1244
|
-
type:
|
|
1141
|
+
z14.object({
|
|
1142
|
+
type: z14.literal(ActionType.UNASSIGN)
|
|
1245
1143
|
}).shape
|
|
1246
1144
|
);
|
|
1247
1145
|
var RegisterAction = ActionBase.extend(
|
|
1248
|
-
|
|
1249
|
-
type:
|
|
1250
|
-
registrationNumber:
|
|
1146
|
+
z14.object({
|
|
1147
|
+
type: z14.literal(ActionType.REGISTER),
|
|
1148
|
+
registrationNumber: z14.string().optional().describe(
|
|
1251
1149
|
"Registration number of the event. Always present for accepted registrations."
|
|
1252
1150
|
)
|
|
1253
1151
|
// TODO move into 'content' property
|
|
1254
1152
|
}).shape
|
|
1255
1153
|
);
|
|
1256
1154
|
var DeclareAction = ActionBase.extend(
|
|
1257
|
-
|
|
1258
|
-
type:
|
|
1155
|
+
z14.object({
|
|
1156
|
+
type: z14.literal(ActionType.DECLARE)
|
|
1259
1157
|
}).shape
|
|
1260
1158
|
);
|
|
1261
|
-
var ReasonContent =
|
|
1262
|
-
reason:
|
|
1159
|
+
var ReasonContent = z14.object({
|
|
1160
|
+
reason: z14.string().min(1, { error: "Message cannot be empty" }).describe(
|
|
1263
1161
|
"Message describing the reason for rejecting or archiving the event."
|
|
1264
1162
|
)
|
|
1265
1163
|
});
|
|
1266
1164
|
var RejectAction = ActionBase.extend(
|
|
1267
|
-
|
|
1268
|
-
type:
|
|
1165
|
+
z14.object({
|
|
1166
|
+
type: z14.literal(ActionType.REJECT),
|
|
1269
1167
|
content: ReasonContent
|
|
1270
1168
|
}).shape
|
|
1271
1169
|
);
|
|
1272
|
-
var PotentialDuplicate =
|
|
1170
|
+
var PotentialDuplicate = z14.object({
|
|
1273
1171
|
id: UUID,
|
|
1274
|
-
trackingId:
|
|
1172
|
+
trackingId: z14.string()
|
|
1275
1173
|
});
|
|
1276
1174
|
var DuplicateDetectedAction = ActionBase.extend(
|
|
1277
|
-
|
|
1278
|
-
type:
|
|
1279
|
-
content:
|
|
1280
|
-
duplicates:
|
|
1175
|
+
z14.object({
|
|
1176
|
+
type: z14.literal(ActionType.DUPLICATE_DETECTED),
|
|
1177
|
+
content: z14.object({
|
|
1178
|
+
duplicates: z14.array(PotentialDuplicate)
|
|
1281
1179
|
})
|
|
1282
1180
|
}).shape
|
|
1283
1181
|
);
|
|
1284
1182
|
var MarkNotDuplicateAction = ActionBase.extend(
|
|
1285
|
-
|
|
1286
|
-
type:
|
|
1183
|
+
z14.object({
|
|
1184
|
+
type: z14.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
1287
1185
|
}).shape
|
|
1288
1186
|
);
|
|
1289
1187
|
var MarkAsDuplicateAction = ActionBase.extend(
|
|
1290
|
-
|
|
1291
|
-
type:
|
|
1292
|
-
content:
|
|
1188
|
+
z14.object({
|
|
1189
|
+
type: z14.literal(ActionType.MARK_AS_DUPLICATE),
|
|
1190
|
+
content: z14.object({
|
|
1293
1191
|
duplicateOf: UUID
|
|
1294
1192
|
}).optional()
|
|
1295
1193
|
}).shape
|
|
1296
1194
|
);
|
|
1297
1195
|
var ArchiveAction = ActionBase.extend(
|
|
1298
|
-
|
|
1299
|
-
type:
|
|
1196
|
+
z14.object({
|
|
1197
|
+
type: z14.literal(ActionType.ARCHIVE),
|
|
1300
1198
|
content: ReasonContent
|
|
1301
1199
|
}).shape
|
|
1302
1200
|
);
|
|
1303
1201
|
var UnarchiveAction = ActionBase.extend(
|
|
1304
|
-
|
|
1305
|
-
type:
|
|
1202
|
+
z14.object({
|
|
1203
|
+
type: z14.literal(ActionType.UNARCHIVE)
|
|
1306
1204
|
}).shape
|
|
1307
1205
|
);
|
|
1308
1206
|
var CreatedAction = ActionBase.extend(
|
|
1309
|
-
|
|
1310
|
-
type:
|
|
1207
|
+
z14.object({
|
|
1208
|
+
type: z14.literal(ActionType.CREATE)
|
|
1311
1209
|
}).shape
|
|
1312
1210
|
);
|
|
1313
1211
|
var NotifiedAction = ActionBase.extend(
|
|
1314
|
-
|
|
1315
|
-
type:
|
|
1212
|
+
z14.object({
|
|
1213
|
+
type: z14.literal(ActionType.NOTIFY)
|
|
1316
1214
|
}).shape
|
|
1317
1215
|
);
|
|
1318
1216
|
var EditAction = ActionBase.extend(
|
|
1319
|
-
|
|
1320
|
-
type:
|
|
1217
|
+
z14.object({
|
|
1218
|
+
type: z14.literal(ActionType.EDIT),
|
|
1321
1219
|
/** @deprecated New Edit-actions should no longer contain content. This is kept for old 2.0 edits. */
|
|
1322
|
-
content:
|
|
1323
|
-
comment:
|
|
1220
|
+
content: z14.object({
|
|
1221
|
+
comment: z14.string().describe("Comment for the edit action.").optional()
|
|
1324
1222
|
}).optional()
|
|
1325
1223
|
}).shape
|
|
1326
1224
|
);
|
|
1327
|
-
var PrintContent =
|
|
1328
|
-
templateId:
|
|
1225
|
+
var PrintContent = z14.object({
|
|
1226
|
+
templateId: z14.string().optional()
|
|
1329
1227
|
});
|
|
1330
1228
|
var PrintCertificateAction = ActionBase.extend(
|
|
1331
|
-
|
|
1332
|
-
type:
|
|
1229
|
+
z14.object({
|
|
1230
|
+
type: z14.literal(ActionType.PRINT_CERTIFICATE),
|
|
1333
1231
|
content: PrintContent.optional().nullable()
|
|
1334
1232
|
}).shape
|
|
1335
1233
|
);
|
|
1336
1234
|
var RequestedCorrectionAction = ActionBase.extend(
|
|
1337
|
-
|
|
1338
|
-
type:
|
|
1235
|
+
z14.object({
|
|
1236
|
+
type: z14.literal(ActionType.REQUEST_CORRECTION)
|
|
1339
1237
|
}).shape
|
|
1340
1238
|
);
|
|
1341
1239
|
var ApprovedCorrectionAction = ActionBase.extend(
|
|
1342
|
-
|
|
1343
|
-
type:
|
|
1344
|
-
requestId:
|
|
1240
|
+
z14.object({
|
|
1241
|
+
type: z14.literal(ActionType.APPROVE_CORRECTION),
|
|
1242
|
+
requestId: z14.string(),
|
|
1345
1243
|
// TODO move into 'content' property
|
|
1346
|
-
content:
|
|
1244
|
+
content: z14.object({ immediateCorrection: z14.boolean().optional() }).optional()
|
|
1347
1245
|
}).shape
|
|
1348
1246
|
);
|
|
1349
1247
|
var RejectedCorrectionAction = ActionBase.extend(
|
|
1350
|
-
|
|
1351
|
-
type:
|
|
1352
|
-
requestId:
|
|
1248
|
+
z14.object({
|
|
1249
|
+
type: z14.literal(ActionType.REJECT_CORRECTION),
|
|
1250
|
+
requestId: z14.string(),
|
|
1353
1251
|
// TODO move into 'content' property
|
|
1354
1252
|
content: ReasonContent
|
|
1355
1253
|
}).shape
|
|
1356
1254
|
);
|
|
1357
1255
|
var ReadAction = ActionBase.extend(
|
|
1358
|
-
|
|
1359
|
-
type:
|
|
1256
|
+
z14.object({
|
|
1257
|
+
type: z14.literal(ActionType.READ)
|
|
1360
1258
|
}).shape
|
|
1361
1259
|
);
|
|
1362
1260
|
var CustomAction = ActionBase.merge(
|
|
1363
|
-
|
|
1364
|
-
type:
|
|
1365
|
-
customActionType:
|
|
1261
|
+
z14.object({
|
|
1262
|
+
type: z14.literal(ActionType.CUSTOM),
|
|
1263
|
+
customActionType: z14.string()
|
|
1366
1264
|
})
|
|
1367
1265
|
);
|
|
1368
|
-
var ActionDocument =
|
|
1266
|
+
var ActionDocument = z14.discriminatedUnion("type", [
|
|
1369
1267
|
CreatedAction.meta({ id: "CreatedAction" }),
|
|
1370
1268
|
RejectAction.meta({ id: "RejectAction" }),
|
|
1371
1269
|
DuplicateDetectedAction.meta({ id: "DuplicateDetectedAction" }),
|
|
@@ -1392,12 +1290,64 @@ var AsyncRejectActionDocument = ActionBase.omit({
|
|
|
1392
1290
|
declaration: true,
|
|
1393
1291
|
annotation: true
|
|
1394
1292
|
}).extend(
|
|
1395
|
-
|
|
1396
|
-
type:
|
|
1397
|
-
status:
|
|
1293
|
+
z14.object({
|
|
1294
|
+
type: z14.enum(ConfirmableActions),
|
|
1295
|
+
status: z14.literal(ActionStatus.Rejected)
|
|
1398
1296
|
}).shape
|
|
1399
1297
|
);
|
|
1400
|
-
var Action =
|
|
1298
|
+
var Action = z14.union([ActionDocument, AsyncRejectActionDocument]);
|
|
1299
|
+
|
|
1300
|
+
// ../commons/src/events/Flag.ts
|
|
1301
|
+
var z15 = __toESM(require("zod/v4"));
|
|
1302
|
+
var InherentFlags = {
|
|
1303
|
+
INCOMPLETE: "incomplete",
|
|
1304
|
+
REJECTED: "rejected",
|
|
1305
|
+
CORRECTION_REQUESTED: "correction-requested",
|
|
1306
|
+
POTENTIAL_DUPLICATE: "potential-duplicate",
|
|
1307
|
+
/**
|
|
1308
|
+
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
1309
|
+
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
1310
|
+
*
|
|
1311
|
+
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
1312
|
+
*/
|
|
1313
|
+
EDIT_IN_PROGRESS: "edit-in-progress"
|
|
1314
|
+
};
|
|
1315
|
+
var ActionFlag = z15.string().regex(
|
|
1316
|
+
new RegExp(
|
|
1317
|
+
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
1318
|
+
ActionStatus
|
|
1319
|
+
).join("|").toLowerCase()})$`
|
|
1320
|
+
),
|
|
1321
|
+
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
1322
|
+
);
|
|
1323
|
+
var CustomFlag = z15.string().refine((val) => !Object.values(InherentFlags).includes(val), {
|
|
1324
|
+
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
1325
|
+
InherentFlags
|
|
1326
|
+
).join(", ")}`
|
|
1327
|
+
}).refine((val) => !ActionFlag.safeParse(val).success, {
|
|
1328
|
+
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
1329
|
+
}).describe("Custom flag identifier defined by the country config.");
|
|
1330
|
+
var Flag = ActionFlag.or(z15.enum(InherentFlags)).or(CustomFlag);
|
|
1331
|
+
var FlagConfig = z15.object({
|
|
1332
|
+
id: CustomFlag,
|
|
1333
|
+
requiresAction: z15.boolean().describe(
|
|
1334
|
+
"Indicates if this flag expects an action to be performed to be cleared."
|
|
1335
|
+
),
|
|
1336
|
+
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1337
|
+
}).meta({
|
|
1338
|
+
id: "FlagConfig",
|
|
1339
|
+
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
1340
|
+
});
|
|
1341
|
+
var ActionFlagConfig = z15.object({
|
|
1342
|
+
id: Flag,
|
|
1343
|
+
operation: z15.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
1344
|
+
conditional: Conditional.optional().describe(
|
|
1345
|
+
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1346
|
+
)
|
|
1347
|
+
}).meta({
|
|
1348
|
+
id: "ActionFlagConfig",
|
|
1349
|
+
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
1350
|
+
});
|
|
1401
1351
|
|
|
1402
1352
|
// ../commons/src/events/EventMetadata.ts
|
|
1403
1353
|
var EventStatus = z16.enum([
|
|
@@ -1555,6 +1505,13 @@ var Range = import_v4.z.object({
|
|
|
1555
1505
|
}).meta({
|
|
1556
1506
|
id: "Range"
|
|
1557
1507
|
});
|
|
1508
|
+
var ContainsFlags = import_v4.z.object({
|
|
1509
|
+
anyOf: import_v4.z.array(Flag).optional(),
|
|
1510
|
+
noneOf: import_v4.z.array(Flag).optional(),
|
|
1511
|
+
allOf: import_v4.z.array(Flag).optional()
|
|
1512
|
+
}).meta({
|
|
1513
|
+
id: "ContainsFlags"
|
|
1514
|
+
});
|
|
1558
1515
|
var Within = import_v4.z.object({ type: import_v4.z.literal("within"), location: import_v4.z.string() }).meta({
|
|
1559
1516
|
id: "Within"
|
|
1560
1517
|
});
|
|
@@ -3027,7 +2984,7 @@ var LanguageConfig = z26.object({
|
|
|
3027
2984
|
});
|
|
3028
2985
|
|
|
3029
2986
|
// ../commons/src/events/EventConfig.ts
|
|
3030
|
-
var
|
|
2987
|
+
var z33 = __toESM(require("zod/v4"));
|
|
3031
2988
|
|
|
3032
2989
|
// ../commons/src/events/SummaryConfig.ts
|
|
3033
2990
|
var z27 = __toESM(require("zod/v4"));
|
|
@@ -3187,424 +3144,215 @@ var AdvancedSearchConfig = z28.object({
|
|
|
3187
3144
|
description: "Configuration of one advanced search tab. Each tab has a title and a list of searchable fields \u2014 either declaration fields (via `field()`) or event metadata (via `event()`)."
|
|
3188
3145
|
});
|
|
3189
3146
|
|
|
3190
|
-
// ../commons/src/icons.ts
|
|
3191
|
-
var z29 = __toESM(require("zod/v4"));
|
|
3192
|
-
var AvailableIcons = z29.enum([
|
|
3193
|
-
"Archived",
|
|
3194
|
-
"Assigned",
|
|
3195
|
-
"Briefcase",
|
|
3196
|
-
"Certified",
|
|
3197
|
-
"Close",
|
|
3198
|
-
"Collapse",
|
|
3199
|
-
"Draft",
|
|
3200
|
-
"DuplicateYellow",
|
|
3201
|
-
"Expand",
|
|
3202
|
-
"ExternalValidate",
|
|
3203
|
-
"FilledCheck",
|
|
3204
|
-
"InReview",
|
|
3205
|
-
"Offline",
|
|
3206
|
-
"Registered",
|
|
3207
|
-
"RequiresUpdates",
|
|
3208
|
-
"Sent",
|
|
3209
|
-
"Validated",
|
|
3210
|
-
"WaitingApproval",
|
|
3211
|
-
"ChartActivity",
|
|
3212
|
-
"Activity",
|
|
3213
|
-
"Archive",
|
|
3214
|
-
"ArchiveTray",
|
|
3215
|
-
"ArrowLeft",
|
|
3216
|
-
"ArrowRight",
|
|
3217
|
-
"Buildings",
|
|
3218
|
-
"Circle",
|
|
3219
|
-
"CaretDown",
|
|
3220
|
-
"CaretLeft",
|
|
3221
|
-
"CaretRight",
|
|
3222
|
-
"ChartBar",
|
|
3223
|
-
"ChartLine",
|
|
3224
|
-
"ChatCircle",
|
|
3225
|
-
"CheckSquare",
|
|
3226
|
-
"Compass",
|
|
3227
|
-
"Check",
|
|
3228
|
-
"Copy",
|
|
3229
|
-
"Database",
|
|
3230
|
-
"DotsThreeVertical",
|
|
3231
|
-
"ArrowCounterClockwise",
|
|
3232
|
-
"MagnifyingGlassMinus",
|
|
3233
|
-
"MagnifyingGlassPlus",
|
|
3234
|
-
"Export",
|
|
3235
|
-
"Eye",
|
|
3236
|
-
"EyeSlash",
|
|
3237
|
-
"Envelope",
|
|
3238
|
-
"File",
|
|
3239
|
-
"FileLock",
|
|
3240
|
-
"FileSearch",
|
|
3241
|
-
"FileMinus",
|
|
3242
|
-
"FilePlus",
|
|
3243
|
-
"FileText",
|
|
3244
|
-
"FileX",
|
|
3245
|
-
"Handshake",
|
|
3246
|
-
"Gear",
|
|
3247
|
-
"GitBranch",
|
|
3248
|
-
"IdentificationCard",
|
|
3249
|
-
"List",
|
|
3250
|
-
"ListBullets",
|
|
3251
|
-
"Lock",
|
|
3252
|
-
"MagnifyingGlass",
|
|
3253
|
-
"MapPin",
|
|
3254
|
-
"Medal",
|
|
3255
|
-
"NotePencil",
|
|
3256
|
-
"Paperclip",
|
|
3257
|
-
"PaperPlaneTilt",
|
|
3258
|
-
"Pen",
|
|
3259
|
-
"PenNib",
|
|
3260
|
-
"Pencil",
|
|
3261
|
-
"PencilSimpleLine",
|
|
3262
|
-
"Phone",
|
|
3263
|
-
"Plus",
|
|
3264
|
-
"Printer",
|
|
3265
|
-
"SignOut",
|
|
3266
|
-
"Stamp",
|
|
3267
|
-
"Star",
|
|
3268
|
-
"Target",
|
|
3269
|
-
"TextT",
|
|
3270
|
-
"Trash",
|
|
3271
|
-
"UploadSimple",
|
|
3272
|
-
"User",
|
|
3273
|
-
"UserPlus",
|
|
3274
|
-
"Users",
|
|
3275
|
-
"WarningCircle",
|
|
3276
|
-
"X",
|
|
3277
|
-
"ChatText",
|
|
3278
|
-
"CircleWavyCheck",
|
|
3279
|
-
"CircleWavyQuestion",
|
|
3280
|
-
"ArchiveBox",
|
|
3281
|
-
"ArrowCircleDown",
|
|
3282
|
-
"FileArrowUp",
|
|
3283
|
-
"FileDotted",
|
|
3284
|
-
"Files",
|
|
3285
|
-
"PencilLine",
|
|
3286
|
-
"PencilCircle",
|
|
3287
|
-
"UserCircle",
|
|
3288
|
-
"Clock",
|
|
3289
|
-
"QrCode",
|
|
3290
|
-
"Webcam",
|
|
3291
|
-
"Sun",
|
|
3292
|
-
"DeviceTabletCamera",
|
|
3293
|
-
"Globe",
|
|
3294
|
-
"Fingerprint",
|
|
3295
|
-
"PushPin",
|
|
3296
|
-
"Timer"
|
|
3297
|
-
]);
|
|
3298
|
-
|
|
3299
3147
|
// ../commons/src/events/utils.ts
|
|
3300
|
-
var
|
|
3148
|
+
var import_lodash = require("lodash");
|
|
3301
3149
|
|
|
3302
3150
|
// ../commons/src/conditionals/validate.ts
|
|
3303
3151
|
var import__ = __toESM(require("ajv/dist/2019"));
|
|
3304
3152
|
var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
3305
|
-
var z33 = __toESM(require("zod/v4"));
|
|
3306
|
-
var import_date_fns2 = require("date-fns");
|
|
3307
|
-
|
|
3308
|
-
// ../commons/src/events/FieldTypeMapping.ts
|
|
3309
3153
|
var z31 = __toESM(require("zod/v4"));
|
|
3154
|
+
var import_date_fns = require("date-fns");
|
|
3310
3155
|
|
|
3311
|
-
// ../commons/src/events/
|
|
3156
|
+
// ../commons/src/events/FieldTypeMapping.ts
|
|
3312
3157
|
var z30 = __toESM(require("zod/v4"));
|
|
3313
3158
|
|
|
3314
|
-
// ../commons/src/events/
|
|
3315
|
-
var
|
|
3159
|
+
// ../commons/src/events/DynamicFieldValue.ts
|
|
3160
|
+
var z29 = __toESM(require("zod/v4"));
|
|
3316
3161
|
|
|
3317
|
-
// ../commons/src/
|
|
3318
|
-
var
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
return values.filter((value) => !!value).join(separator).trim();
|
|
3328
|
-
}
|
|
3329
|
-
var FullNameV1 = z32.array(
|
|
3330
|
-
z32.object({
|
|
3331
|
-
use: z32.string(),
|
|
3332
|
-
family: z32.string(),
|
|
3333
|
-
given: z32.array(z32.string())
|
|
3162
|
+
// ../commons/src/conditionals/validate.ts
|
|
3163
|
+
var ajv = new import__.default({
|
|
3164
|
+
$data: true,
|
|
3165
|
+
allowUnionTypes: true,
|
|
3166
|
+
strict: false
|
|
3167
|
+
// Allow minContains and other newer features
|
|
3168
|
+
});
|
|
3169
|
+
var DataContext = z31.object({
|
|
3170
|
+
rootData: z31.object({
|
|
3171
|
+
$leafAdminStructureLocationIds: z31.array(z31.object({ id: UUID }))
|
|
3334
3172
|
})
|
|
3335
|
-
);
|
|
3336
|
-
function
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3173
|
+
});
|
|
3174
|
+
function resolveDataPath(rootData, dataPath, instancePath) {
|
|
3175
|
+
const pathParts = dataPath.split("/");
|
|
3176
|
+
const levels = parseInt(pathParts[0], 10);
|
|
3177
|
+
const referencePath = pathParts.slice(1);
|
|
3178
|
+
const instanceParts = instancePath.split("/").filter(Boolean);
|
|
3179
|
+
const traversedParts = instanceParts.slice(0, -levels);
|
|
3180
|
+
let current = rootData;
|
|
3181
|
+
for (const part of traversedParts) {
|
|
3182
|
+
if (current === null || current === void 0) {
|
|
3183
|
+
return void 0;
|
|
3184
|
+
}
|
|
3185
|
+
current = current[part];
|
|
3342
3186
|
}
|
|
3343
|
-
const
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
newObj[key] = omitKeyDeep(obj[key], keyToRemove);
|
|
3187
|
+
for (const part of referencePath) {
|
|
3188
|
+
if (current === null || current === void 0) {
|
|
3189
|
+
return void 0;
|
|
3347
3190
|
}
|
|
3191
|
+
current = current[part];
|
|
3348
3192
|
}
|
|
3349
|
-
return
|
|
3193
|
+
return current;
|
|
3350
3194
|
}
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
var import_lodash = require("lodash");
|
|
3354
|
-
function getActionRequests(actionType, actions) {
|
|
3355
|
-
const filtered = actions.filter((action) => action.type === actionType).reverse();
|
|
3356
|
-
const accept = filtered.find(
|
|
3357
|
-
(action) => action.status === ActionStatus.Accepted
|
|
3358
|
-
);
|
|
3359
|
-
const request = filtered.find(
|
|
3360
|
-
(action) => action.status === ActionStatus.Requested
|
|
3361
|
-
);
|
|
3362
|
-
const reject = filtered.find(
|
|
3363
|
-
(action) => action.status === ActionStatus.Rejected
|
|
3364
|
-
);
|
|
3365
|
-
return {
|
|
3366
|
-
reject,
|
|
3367
|
-
accept,
|
|
3368
|
-
request
|
|
3369
|
-
};
|
|
3195
|
+
function todayISO() {
|
|
3196
|
+
return (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
|
|
3370
3197
|
}
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
return null;
|
|
3198
|
+
var compiledFunctionCache = /* @__PURE__ */ new Map();
|
|
3199
|
+
function compileClientFunction(code) {
|
|
3200
|
+
let fn = compiledFunctionCache.get(code);
|
|
3201
|
+
if (!fn) {
|
|
3202
|
+
fn = new Function(`return (${code})`)();
|
|
3203
|
+
compiledFunctionCache.set(code, fn);
|
|
3378
3204
|
}
|
|
3379
|
-
|
|
3380
|
-
return {
|
|
3381
|
-
// When 3rd party API returns 200 OK, we assume that the request was accepted, and persist single 'accepted' action.
|
|
3382
|
-
createdAt: requestAction?.createdAt ?? acceptAction.createdAt,
|
|
3383
|
-
createdBy: requestAction?.createdBy ?? acceptAction.createdBy,
|
|
3384
|
-
createdByUserType: requestAction?.createdByUserType ?? acceptAction.createdByUserType,
|
|
3385
|
-
createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
|
|
3386
|
-
acceptedAt: acceptAction.createdAt,
|
|
3387
|
-
createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
|
|
3388
|
-
registrationNumber
|
|
3389
|
-
};
|
|
3390
|
-
}
|
|
3391
|
-
var updateActions = ActionTypes.extract([
|
|
3392
|
-
ActionType.CREATE,
|
|
3393
|
-
ActionType.NOTIFY,
|
|
3394
|
-
ActionType.EDIT,
|
|
3395
|
-
ActionType.DECLARE,
|
|
3396
|
-
ActionType.REGISTER,
|
|
3397
|
-
ActionType.REJECT,
|
|
3398
|
-
ActionType.ARCHIVE,
|
|
3399
|
-
ActionType.UNARCHIVE,
|
|
3400
|
-
ActionType.PRINT_CERTIFICATE,
|
|
3401
|
-
ActionType.REQUEST_CORRECTION,
|
|
3402
|
-
ActionType.APPROVE_CORRECTION,
|
|
3403
|
-
ActionType.REJECT_CORRECTION,
|
|
3404
|
-
ActionType.CUSTOM
|
|
3405
|
-
]);
|
|
3406
|
-
function getActionUpdateMetadata(actions) {
|
|
3407
|
-
const createAction = getOrThrow(
|
|
3408
|
-
actions.find((action) => action.type === ActionType.CREATE),
|
|
3409
|
-
`Event has no ${ActionType.CREATE} action`
|
|
3410
|
-
);
|
|
3411
|
-
const metadataFields = [
|
|
3412
|
-
"createdAt",
|
|
3413
|
-
"createdBy",
|
|
3414
|
-
"createdByUserType",
|
|
3415
|
-
"createdAtLocation",
|
|
3416
|
-
"createdByRole"
|
|
3417
|
-
];
|
|
3418
|
-
return actions.filter(({ type }) => updateActions.safeParse(type).success).reduce(
|
|
3419
|
-
(_2, action) => {
|
|
3420
|
-
if (action.originalActionId) {
|
|
3421
|
-
const originalAction = actions.find(({ id }) => id === action.originalActionId) ?? action;
|
|
3422
|
-
return (0, import_lodash.pick)(originalAction, metadataFields);
|
|
3423
|
-
}
|
|
3424
|
-
return (0, import_lodash.pick)(action, metadataFields);
|
|
3425
|
-
},
|
|
3426
|
-
(0, import_lodash.pick)(createAction, metadataFields)
|
|
3427
|
-
);
|
|
3205
|
+
return fn;
|
|
3428
3206
|
}
|
|
3429
|
-
|
|
3207
|
+
(0, import_ajv_formats.default)(ajv);
|
|
3208
|
+
function buildClientFunctionContext(input) {
|
|
3430
3209
|
return {
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
),
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
)
|
|
3210
|
+
$form: input.form,
|
|
3211
|
+
$now: todayISO(),
|
|
3212
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
3213
|
+
$online: isOnline(),
|
|
3214
|
+
$user: input.validatorContext?.user,
|
|
3215
|
+
$event: input.validatorContext?.event,
|
|
3216
|
+
$leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
|
|
3217
|
+
user: input.systemVariables?.user,
|
|
3218
|
+
$window: input.systemVariables?.$window,
|
|
3219
|
+
locations: input.locations,
|
|
3220
|
+
adminLevelIds: input.adminLevelIds
|
|
3443
3221
|
};
|
|
3444
3222
|
}
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
var import_lodash2 = require("lodash");
|
|
3448
|
-
var import_date_fns = require("date-fns");
|
|
3449
|
-
function isFlagConditionMet(conditional, form, action) {
|
|
3450
|
-
const now2 = (0, import_date_fns.isValid)((0, import_date_fns.parseISO)(action.createdAt)) ? (0, import_date_fns.formatISO)((0, import_date_fns.parseISO)(action.createdAt), { representation: "date" }) : (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
|
|
3451
|
-
return validate(conditional, {
|
|
3452
|
-
$form: form,
|
|
3453
|
-
$now: now2,
|
|
3454
|
-
$online: true,
|
|
3455
|
-
$user: {
|
|
3456
|
-
sub: "",
|
|
3457
|
-
exp: "",
|
|
3458
|
-
role: action.createdByRole,
|
|
3459
|
-
algorithm: "",
|
|
3460
|
-
scope: [],
|
|
3461
|
-
userType: action.createdByUserType
|
|
3462
|
-
}
|
|
3463
|
-
});
|
|
3464
|
-
}
|
|
3465
|
-
function actionConfigRemovesFlag(action, flagId, actionsUpToAndIncluding, event2, eventConfiguration) {
|
|
3466
|
-
if (!isActionConfigType(action.type)) {
|
|
3467
|
-
return false;
|
|
3468
|
-
}
|
|
3469
|
-
const actionConfig = getActionConfig({
|
|
3470
|
-
eventConfiguration,
|
|
3471
|
-
actionType: action.type,
|
|
3472
|
-
customActionType: "customActionType" in action ? action.customActionType : void 0
|
|
3473
|
-
});
|
|
3474
|
-
const removeOperations = (actionConfig?.flags ?? []).filter(
|
|
3475
|
-
({ id, operation }) => id === flagId && operation === "remove"
|
|
3476
|
-
);
|
|
3477
|
-
if (removeOperations.length === 0) {
|
|
3478
|
-
return false;
|
|
3479
|
-
}
|
|
3480
|
-
const eventUpToThisAction = { ...event2, actions: actionsUpToAndIncluding };
|
|
3481
|
-
const declaration = aggregateActionDeclarations(eventUpToThisAction);
|
|
3482
|
-
const annotation = aggregateActionAnnotations(eventUpToThisAction);
|
|
3483
|
-
const form = { ...declaration, ...annotation };
|
|
3484
|
-
return removeOperations.some(
|
|
3485
|
-
({ conditional }) => conditional ? isFlagConditionMet(conditional, form, action) : true
|
|
3486
|
-
);
|
|
3223
|
+
function runClientFunction(code, data, context) {
|
|
3224
|
+
return compileClientFunction(code)(data, context);
|
|
3487
3225
|
}
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
{
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
// are deliberately excluded so the flag freezes across an archive/unarchive
|
|
3498
|
-
// round trip and comes back exactly as it was.
|
|
3499
|
-
flag: InherentFlags.INCOMPLETE,
|
|
3500
|
-
setOn: [ActionType.NOTIFY],
|
|
3501
|
-
resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
|
|
3502
|
-
},
|
|
3503
|
-
{
|
|
3504
|
-
flag: InherentFlags.REJECTED,
|
|
3505
|
-
setOn: [ActionType.REJECT],
|
|
3506
|
-
resetOn: [
|
|
3507
|
-
ActionType.NOTIFY,
|
|
3508
|
-
ActionType.DECLARE,
|
|
3509
|
-
ActionType.EDIT,
|
|
3510
|
-
ActionType.REGISTER
|
|
3511
|
-
]
|
|
3512
|
-
},
|
|
3513
|
-
{
|
|
3514
|
-
flag: InherentFlags.POTENTIAL_DUPLICATE,
|
|
3515
|
-
setOn: [ActionType.DUPLICATE_DETECTED],
|
|
3516
|
-
resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
|
|
3517
|
-
},
|
|
3518
|
-
{
|
|
3519
|
-
flag: InherentFlags.EDIT_IN_PROGRESS,
|
|
3520
|
-
setOn: [ActionType.EDIT],
|
|
3521
|
-
resetOnAnyOtherAction: true
|
|
3522
|
-
}
|
|
3523
|
-
];
|
|
3524
|
-
function resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration) {
|
|
3525
|
-
return acceptedActions.reduce((present, action, idx) => {
|
|
3526
|
-
if (rule.setOn.includes(action.type)) {
|
|
3527
|
-
return true;
|
|
3226
|
+
ajv.addKeyword({
|
|
3227
|
+
keyword: "daysFromDate",
|
|
3228
|
+
type: "string",
|
|
3229
|
+
schemaType: "object",
|
|
3230
|
+
$data: true,
|
|
3231
|
+
errors: true,
|
|
3232
|
+
validate(schema, data, _2, dataContext) {
|
|
3233
|
+
if (!(dataContext && dataContext.rootData && typeof dataContext.rootData === "object" && "$now" in dataContext.rootData && typeof dataContext.rootData.$now === "string")) {
|
|
3234
|
+
throw new Error("Validation context must contain $now");
|
|
3528
3235
|
}
|
|
3529
|
-
|
|
3236
|
+
const { days, clause } = schema;
|
|
3237
|
+
if (typeof data !== "string") {
|
|
3530
3238
|
return false;
|
|
3531
3239
|
}
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
rule.flag,
|
|
3535
|
-
acceptedActions.slice(0, idx + 1),
|
|
3536
|
-
event2,
|
|
3537
|
-
eventConfiguration
|
|
3538
|
-
)) {
|
|
3240
|
+
const date = new Date(data);
|
|
3241
|
+
if (isNaN(date.getTime())) {
|
|
3539
3242
|
return false;
|
|
3540
3243
|
}
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
if (isActionConfigType(action.type)) {
|
|
3549
|
-
actionConfig = getActionConfig({
|
|
3550
|
-
eventConfiguration,
|
|
3551
|
-
actionType: action.type,
|
|
3552
|
-
customActionType: "customActionType" in action ? action.customActionType : void 0
|
|
3553
|
-
});
|
|
3244
|
+
let referenceDate = schema.referenceDate;
|
|
3245
|
+
if (referenceDate && typeof referenceDate === "object" && "$data" in referenceDate) {
|
|
3246
|
+
referenceDate = resolveDataPath(
|
|
3247
|
+
dataContext.rootData,
|
|
3248
|
+
referenceDate.$data,
|
|
3249
|
+
dataContext.instancePath
|
|
3250
|
+
);
|
|
3554
3251
|
}
|
|
3555
|
-
if (!
|
|
3556
|
-
|
|
3252
|
+
if (!referenceDate) {
|
|
3253
|
+
referenceDate = dataContext.rootData.$now;
|
|
3557
3254
|
}
|
|
3558
|
-
const
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
}
|
|
3562
|
-
const
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3255
|
+
const baseDate = new Date(referenceDate);
|
|
3256
|
+
if (isNaN(baseDate.getTime())) {
|
|
3257
|
+
return false;
|
|
3258
|
+
}
|
|
3259
|
+
const offsetDate = new Date(baseDate.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
3260
|
+
return clause === "after" ? (0, import_date_fns.isAfter)(date, offsetDate) : (0, import_date_fns.isBefore)(date, offsetDate);
|
|
3261
|
+
}
|
|
3262
|
+
});
|
|
3263
|
+
ajv.addKeyword({
|
|
3264
|
+
keyword: "isLeafLevelLocation",
|
|
3265
|
+
type: "string",
|
|
3266
|
+
schemaType: "boolean",
|
|
3267
|
+
$data: true,
|
|
3268
|
+
errors: true,
|
|
3269
|
+
// @ts-ignore -- Force type. We will move this away from AJV next. Parsing the array will take seconds and is only called by core.
|
|
3270
|
+
validate(_schema, data, _2, dataContext) {
|
|
3271
|
+
const locationIdInput = data;
|
|
3272
|
+
const locations = dataContext?.rootData.$leafAdminStructureLocationIds ?? [];
|
|
3273
|
+
return locations.some((location) => location.id === locationIdInput);
|
|
3274
|
+
}
|
|
3275
|
+
});
|
|
3276
|
+
ajv.addKeyword({
|
|
3277
|
+
keyword: "customClientValidator",
|
|
3278
|
+
schemaType: "object",
|
|
3279
|
+
errors: true,
|
|
3280
|
+
// @ts-expect-error -- AJV's public types don't expose `rootData`. All
|
|
3281
|
+
// `validate()` callers build root data via `buildClientFunctionContext`,
|
|
3282
|
+
// so the cast holds.
|
|
3283
|
+
validate(schema, data, _2, dataContext) {
|
|
3284
|
+
return Boolean(
|
|
3285
|
+
runClientFunction(
|
|
3286
|
+
schema.code,
|
|
3287
|
+
data,
|
|
3288
|
+
dataContext?.rootData ?? buildClientFunctionContext({ form: {} })
|
|
3569
3289
|
)
|
|
3570
3290
|
);
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3291
|
+
}
|
|
3292
|
+
});
|
|
3293
|
+
function isOnline() {
|
|
3294
|
+
if (typeof window !== "undefined" && typeof navigator !== "undefined") {
|
|
3295
|
+
return navigator.onLine;
|
|
3296
|
+
}
|
|
3297
|
+
return true;
|
|
3578
3298
|
}
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3299
|
+
|
|
3300
|
+
// ../commons/src/utils.ts
|
|
3301
|
+
var z32 = __toESM(require("zod/v4"));
|
|
3302
|
+
var _ = __toESM(require("lodash"));
|
|
3303
|
+
var FullNameV1 = z32.array(
|
|
3304
|
+
z32.object({
|
|
3305
|
+
use: z32.string(),
|
|
3306
|
+
family: z32.string(),
|
|
3307
|
+
given: z32.array(z32.string())
|
|
3308
|
+
})
|
|
3309
|
+
);
|
|
3310
|
+
function omitKeyDeep(obj, keyToRemove) {
|
|
3311
|
+
if (Array.isArray(obj)) {
|
|
3312
|
+
return obj.map((item) => omitKeyDeep(item, keyToRemove));
|
|
3313
|
+
}
|
|
3314
|
+
if (obj === null || typeof obj !== "object") {
|
|
3315
|
+
return obj;
|
|
3316
|
+
}
|
|
3317
|
+
const newObj = {};
|
|
3318
|
+
for (const key of Object.keys(obj)) {
|
|
3319
|
+
if (key !== keyToRemove) {
|
|
3320
|
+
newObj[key] = omitKeyDeep(obj[key], keyToRemove);
|
|
3321
|
+
}
|
|
3322
|
+
}
|
|
3323
|
+
return newObj;
|
|
3591
3324
|
}
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
return
|
|
3597
|
-
(rule) => resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration)
|
|
3598
|
-
).map(({ flag: flag2 }) => flag2);
|
|
3325
|
+
|
|
3326
|
+
// ../commons/src/events/utils.ts
|
|
3327
|
+
var import_date_fns2 = require("date-fns");
|
|
3328
|
+
function getDeclarationFields(configuration) {
|
|
3329
|
+
return configuration.declaration.pages.flatMap(({ fields }) => fields);
|
|
3599
3330
|
}
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3331
|
+
var getActionAnnotationFields = (actionConfig) => {
|
|
3332
|
+
if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
|
|
3333
|
+
return actionConfig.correctionForm.pages.flatMap(({ fields }) => fields);
|
|
3334
|
+
}
|
|
3335
|
+
if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
|
|
3336
|
+
return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
|
|
3337
|
+
}
|
|
3338
|
+
const reviewFields = "review" in actionConfig && actionConfig.review != null ? actionConfig.review.fields : [];
|
|
3339
|
+
const formFields = "form" in actionConfig && actionConfig.form != null ? actionConfig.form : [];
|
|
3340
|
+
return [...reviewFields, ...formFields];
|
|
3341
|
+
};
|
|
3342
|
+
function getAllAnnotationFields(config) {
|
|
3343
|
+
return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
|
|
3607
3344
|
}
|
|
3345
|
+
var findAllFields = (config) => {
|
|
3346
|
+
return (0, import_lodash.flattenDeep)([
|
|
3347
|
+
...getDeclarationFields(config),
|
|
3348
|
+
...getAllAnnotationFields(config)
|
|
3349
|
+
]);
|
|
3350
|
+
};
|
|
3351
|
+
var EXCLUDED_ACTIONS = [
|
|
3352
|
+
ActionType.REQUEST_CORRECTION,
|
|
3353
|
+
ActionType.PRINT_CERTIFICATE,
|
|
3354
|
+
ActionType.REJECT_CORRECTION
|
|
3355
|
+
];
|
|
3608
3356
|
|
|
3609
3357
|
// ../commons/src/conditionals/conditionals.ts
|
|
3610
3358
|
var objectHash = __toESM(require("object-hash"));
|
|
@@ -3812,33 +3560,6 @@ function defineComparison(field3, value, keyword) {
|
|
|
3812
3560
|
required: [field3.$$field]
|
|
3813
3561
|
});
|
|
3814
3562
|
}
|
|
3815
|
-
function flag(flagvalue) {
|
|
3816
|
-
return defineConditional({
|
|
3817
|
-
type: "object",
|
|
3818
|
-
properties: {
|
|
3819
|
-
$flags: {
|
|
3820
|
-
type: "array",
|
|
3821
|
-
contains: {
|
|
3822
|
-
type: "string",
|
|
3823
|
-
const: flagvalue
|
|
3824
|
-
}
|
|
3825
|
-
}
|
|
3826
|
-
},
|
|
3827
|
-
required: ["$flags"]
|
|
3828
|
-
});
|
|
3829
|
-
}
|
|
3830
|
-
function status(statusValue) {
|
|
3831
|
-
return defineConditional({
|
|
3832
|
-
type: "object",
|
|
3833
|
-
properties: {
|
|
3834
|
-
$status: {
|
|
3835
|
-
type: "string",
|
|
3836
|
-
const: statusValue
|
|
3837
|
-
}
|
|
3838
|
-
},
|
|
3839
|
-
required: ["$status"]
|
|
3840
|
-
});
|
|
3841
|
-
}
|
|
3842
3563
|
function createFieldConditionals(fieldId) {
|
|
3843
3564
|
const getDayRange = (field3, days, clause, referenceDate) => ({
|
|
3844
3565
|
type: "object",
|
|
@@ -4201,549 +3922,43 @@ function createFieldConditionals(fieldId) {
|
|
|
4201
3922
|
* const digits = String(value).split('').map(Number)
|
|
4202
3923
|
* // ...
|
|
4203
3924
|
* return isValid
|
|
4204
|
-
* })
|
|
4205
|
-
*/
|
|
4206
|
-
customClientValidator(validationFn) {
|
|
4207
|
-
const code = validationFn.toString();
|
|
4208
|
-
return defineFormConditional({
|
|
4209
|
-
type: "object",
|
|
4210
|
-
properties: wrapToPath(
|
|
4211
|
-
{ [fieldId]: { customClientValidator: { code } } },
|
|
4212
|
-
this.$$subfield
|
|
4213
|
-
),
|
|
4214
|
-
required: [fieldId]
|
|
4215
|
-
});
|
|
4216
|
-
},
|
|
4217
|
-
/**
|
|
4218
|
-
* Custom client-side evaluation. Returns a {@link FieldReference} descriptor
|
|
4219
|
-
* that can be used as the `value` property or a DATA component entry.
|
|
4220
|
-
* The function receives the referenced field's value as the first argument and
|
|
4221
|
-
* the full form context as the second; its return value replaces the field reference.
|
|
4222
|
-
* The function is serialised and executed just-in-time on the client only.
|
|
4223
|
-
* External references (e.g. lodash) are not available inside the function body.
|
|
4224
|
-
*
|
|
4225
|
-
* For computing a default value without referencing a specific field, use
|
|
4226
|
-
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
4227
|
-
*
|
|
4228
|
-
* @example
|
|
4229
|
-
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
4230
|
-
* Number(aValue) + Number(ctx.$form.b)
|
|
4231
|
-
* )
|
|
4232
|
-
*/
|
|
4233
|
-
customClientEvaluation(computationFn) {
|
|
4234
|
-
return {
|
|
4235
|
-
$$code: computationFn.toString(),
|
|
4236
|
-
$$field: fieldId,
|
|
4237
|
-
$$subfield: this.$$subfield
|
|
4238
|
-
};
|
|
4239
|
-
}
|
|
4240
|
-
};
|
|
4241
|
-
}
|
|
4242
|
-
|
|
4243
|
-
// ../commons/src/events/state/index.ts
|
|
4244
|
-
function getStatusFromActions(actions) {
|
|
4245
|
-
const acceptedActions = actions.filter(
|
|
4246
|
-
({ status: status2 }) => status2 === ActionStatus.Accepted
|
|
4247
|
-
);
|
|
4248
|
-
const isCurrentlyArchived = acceptedActions.reduce(
|
|
4249
|
-
(archived, action) => {
|
|
4250
|
-
if (action.type === ActionType.ARCHIVE) {
|
|
4251
|
-
return true;
|
|
4252
|
-
}
|
|
4253
|
-
if (action.type === ActionType.UNARCHIVE) {
|
|
4254
|
-
return false;
|
|
4255
|
-
}
|
|
4256
|
-
return archived;
|
|
4257
|
-
},
|
|
4258
|
-
false
|
|
4259
|
-
);
|
|
4260
|
-
if (isCurrentlyArchived) {
|
|
4261
|
-
return EventStatus.enum.ARCHIVED;
|
|
4262
|
-
}
|
|
4263
|
-
return acceptedActions.filter(
|
|
4264
|
-
({ type }) => type !== ActionType.ARCHIVE && type !== ActionType.UNARCHIVE
|
|
4265
|
-
).reduce((status2, action) => {
|
|
4266
|
-
switch (action.type) {
|
|
4267
|
-
case ActionType.CREATE:
|
|
4268
|
-
return EventStatus.enum.CREATED;
|
|
4269
|
-
case ActionType.DECLARE:
|
|
4270
|
-
return EventStatus.enum.DECLARED;
|
|
4271
|
-
case ActionType.REGISTER:
|
|
4272
|
-
return EventStatus.enum.REGISTERED;
|
|
4273
|
-
case ActionType.NOTIFY:
|
|
4274
|
-
return EventStatus.enum.NOTIFIED;
|
|
4275
|
-
// Already filtered out above; listed here only to satisfy exhaustiveness.
|
|
4276
|
-
case ActionType.ARCHIVE:
|
|
4277
|
-
case ActionType.UNARCHIVE:
|
|
4278
|
-
case ActionType.CUSTOM:
|
|
4279
|
-
case ActionType.PRINT_CERTIFICATE:
|
|
4280
|
-
case ActionType.ASSIGN:
|
|
4281
|
-
case ActionType.UNASSIGN:
|
|
4282
|
-
case ActionType.REJECT:
|
|
4283
|
-
case ActionType.REQUEST_CORRECTION:
|
|
4284
|
-
case ActionType.APPROVE_CORRECTION:
|
|
4285
|
-
case ActionType.DUPLICATE_DETECTED:
|
|
4286
|
-
case ActionType.MARK_AS_NOT_DUPLICATE:
|
|
4287
|
-
case ActionType.MARK_AS_DUPLICATE:
|
|
4288
|
-
case ActionType.REJECT_CORRECTION:
|
|
4289
|
-
case ActionType.READ:
|
|
4290
|
-
case ActionType.EDIT:
|
|
4291
|
-
default:
|
|
4292
|
-
return status2;
|
|
4293
|
-
}
|
|
4294
|
-
}, EventStatus.enum.CREATED);
|
|
4295
|
-
}
|
|
4296
|
-
function getAssignedUserFromActions(actions) {
|
|
4297
|
-
return actions.reduce((user2, action) => {
|
|
4298
|
-
if (action.type === ActionType.ASSIGN) {
|
|
4299
|
-
return action.assignedTo;
|
|
4300
|
-
}
|
|
4301
|
-
if (action.type === ActionType.UNASSIGN) {
|
|
4302
|
-
return null;
|
|
4303
|
-
}
|
|
4304
|
-
return user2;
|
|
4305
|
-
}, null);
|
|
4306
|
-
}
|
|
4307
|
-
function deepDropNulls(obj) {
|
|
4308
|
-
if (Array.isArray(obj)) {
|
|
4309
|
-
return obj.map(deepDropNulls);
|
|
4310
|
-
}
|
|
4311
|
-
if (obj !== null && typeof obj === "object") {
|
|
4312
|
-
return Object.entries(obj).reduce((acc, [key, value]) => {
|
|
4313
|
-
const cleanedValue = deepDropNulls(value);
|
|
4314
|
-
if (cleanedValue !== null) {
|
|
4315
|
-
;
|
|
4316
|
-
acc[key] = cleanedValue;
|
|
4317
|
-
}
|
|
4318
|
-
return acc;
|
|
4319
|
-
}, {});
|
|
4320
|
-
}
|
|
4321
|
-
return obj;
|
|
4322
|
-
}
|
|
4323
|
-
var DEFAULT_DATE_OF_EVENT_PROPERTY = "createdAt";
|
|
4324
|
-
function extractDateString(dateTime) {
|
|
4325
|
-
return dateTime.split("T")[0];
|
|
4326
|
-
}
|
|
4327
|
-
function resolveDateOfEvent(eventIndex, declaration, config) {
|
|
4328
|
-
if (!config.dateOfEvent) {
|
|
4329
|
-
return extractDateString(eventIndex[DEFAULT_DATE_OF_EVENT_PROPERTY]);
|
|
4330
|
-
}
|
|
4331
|
-
const parsedDate = isFieldReference(config.dateOfEvent) ? ZodDate.safeParse(declaration[config.dateOfEvent.$$field]) : ZodDateTime.safeParse(
|
|
4332
|
-
getMixedPath(eventIndex, config.dateOfEvent.$$event)
|
|
4333
|
-
);
|
|
4334
|
-
return parsedDate.success ? extractDateString(parsedDate.data) : void 0;
|
|
4335
|
-
}
|
|
4336
|
-
var DEFAULT_PLACE_OF_EVENT_PROPERTY = "createdAtLocation";
|
|
4337
|
-
function getParsedUUID(value, oldValue) {
|
|
4338
|
-
const parsed = UUID.safeParse(value);
|
|
4339
|
-
return parsed.success ? parsed.data : oldValue;
|
|
4340
|
-
}
|
|
4341
|
-
function resolvePlaceOfEvent(eventMetadata, declaration, config) {
|
|
4342
|
-
let placeOfEvent = getParsedUUID(
|
|
4343
|
-
eventMetadata[DEFAULT_PLACE_OF_EVENT_PROPERTY]
|
|
4344
|
-
);
|
|
4345
|
-
if (config.placeOfEvent) {
|
|
4346
|
-
const addressFieldValue = AddressFieldValue.safeParse(
|
|
4347
|
-
declaration[config.placeOfEvent.$$field]
|
|
4348
|
-
);
|
|
4349
|
-
if (addressFieldValue.success && addressFieldValue.data.addressType === AddressType.DOMESTIC && addressFieldValue.data.administrativeArea) {
|
|
4350
|
-
placeOfEvent = getParsedUUID(
|
|
4351
|
-
addressFieldValue.data.administrativeArea,
|
|
4352
|
-
placeOfEvent
|
|
4353
|
-
);
|
|
4354
|
-
} else {
|
|
4355
|
-
placeOfEvent = getParsedUUID(
|
|
4356
|
-
declaration[config.placeOfEvent.$$field],
|
|
4357
|
-
placeOfEvent
|
|
4358
|
-
);
|
|
4359
|
-
}
|
|
4360
|
-
}
|
|
4361
|
-
return placeOfEvent;
|
|
4362
|
-
}
|
|
4363
|
-
function extractPotentialDuplicatesFromActions(actions) {
|
|
4364
|
-
return actions.reduce((duplicates, action) => {
|
|
4365
|
-
if (action.type === ActionType.DUPLICATE_DETECTED) {
|
|
4366
|
-
duplicates = action.content.duplicates;
|
|
4367
|
-
}
|
|
4368
|
-
if (action.type === ActionType.MARK_AS_NOT_DUPLICATE || action.type === ActionType.MARK_AS_DUPLICATE) {
|
|
4369
|
-
duplicates = [];
|
|
4370
|
-
}
|
|
4371
|
-
return duplicates;
|
|
4372
|
-
}, []);
|
|
4373
|
-
}
|
|
4374
|
-
function getCurrentEventState(event2, config) {
|
|
4375
|
-
const sortedActions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
4376
|
-
const creationAction = sortedActions.find(
|
|
4377
|
-
(action) => action.type === ActionType.CREATE
|
|
4378
|
-
);
|
|
4379
|
-
if (!creationAction) {
|
|
4380
|
-
throw new Error(`Event ${event2.id} has no creation action`);
|
|
4381
|
-
}
|
|
4382
|
-
const acceptedActions = getAcceptedActions(event2).sort(
|
|
4383
|
-
(a, b) => a.createdAt.localeCompare(b.createdAt)
|
|
4384
|
-
);
|
|
4385
|
-
const requestActionMetadata = getActionUpdateMetadata(sortedActions);
|
|
4386
|
-
const acceptedActionMetadata = getActionUpdateMetadata(acceptedActions);
|
|
4387
|
-
const declaration = aggregateActionDeclarations(event2);
|
|
4388
|
-
const status2 = getStatusFromActions(sortedActions);
|
|
4389
|
-
const legalStatuses = getLegalStatuses(sortedActions);
|
|
4390
|
-
const base = deepDropNulls({
|
|
4391
|
-
id: event2.id,
|
|
4392
|
-
type: event2.type,
|
|
4393
|
-
status: status2,
|
|
4394
|
-
legalStatuses,
|
|
4395
|
-
createdAt: creationAction.createdAt,
|
|
4396
|
-
createdBy: creationAction.createdBy,
|
|
4397
|
-
createdByUserType: creationAction.createdByUserType,
|
|
4398
|
-
createdAtLocation: creationAction.createdAtLocation,
|
|
4399
|
-
updatedAt: acceptedActionMetadata.createdAt,
|
|
4400
|
-
assignedTo: getAssignedUserFromActions(acceptedActions),
|
|
4401
|
-
updatedBy: requestActionMetadata.createdBy,
|
|
4402
|
-
updatedAtLocation: requestActionMetadata.createdAtLocation,
|
|
4403
|
-
declaration,
|
|
4404
|
-
trackingId: event2.trackingId,
|
|
4405
|
-
updatedByUserRole: requestActionMetadata.createdByRole,
|
|
4406
|
-
placeOfEvent: resolvePlaceOfEvent(
|
|
4407
|
-
{ createdAtLocation: creationAction.createdAtLocation },
|
|
4408
|
-
declaration,
|
|
4409
|
-
config
|
|
4410
|
-
),
|
|
4411
|
-
potentialDuplicates: extractPotentialDuplicatesFromActions(sortedActions),
|
|
4412
|
-
flags: getEventFlags(event2, config)
|
|
4413
|
-
});
|
|
4414
|
-
return deepDropNulls({
|
|
4415
|
-
...base,
|
|
4416
|
-
dateOfEvent: resolveDateOfEvent(base, declaration, config)
|
|
4417
|
-
});
|
|
4418
|
-
}
|
|
4419
|
-
|
|
4420
|
-
// ../commons/src/conditionals/validate.ts
|
|
4421
|
-
var ajv = new import__.default({
|
|
4422
|
-
$data: true,
|
|
4423
|
-
allowUnionTypes: true,
|
|
4424
|
-
strict: false
|
|
4425
|
-
// Allow minContains and other newer features
|
|
4426
|
-
});
|
|
4427
|
-
var DataContext = z33.object({
|
|
4428
|
-
rootData: z33.object({
|
|
4429
|
-
$leafAdminStructureLocationIds: z33.array(z33.object({ id: UUID }))
|
|
4430
|
-
})
|
|
4431
|
-
});
|
|
4432
|
-
function resolveDataPath(rootData, dataPath, instancePath) {
|
|
4433
|
-
const pathParts = dataPath.split("/");
|
|
4434
|
-
const levels = parseInt(pathParts[0], 10);
|
|
4435
|
-
const referencePath = pathParts.slice(1);
|
|
4436
|
-
const instanceParts = instancePath.split("/").filter(Boolean);
|
|
4437
|
-
const traversedParts = instanceParts.slice(0, -levels);
|
|
4438
|
-
let current = rootData;
|
|
4439
|
-
for (const part of traversedParts) {
|
|
4440
|
-
if (current === null || current === void 0) {
|
|
4441
|
-
return void 0;
|
|
4442
|
-
}
|
|
4443
|
-
current = current[part];
|
|
4444
|
-
}
|
|
4445
|
-
for (const part of referencePath) {
|
|
4446
|
-
if (current === null || current === void 0) {
|
|
4447
|
-
return void 0;
|
|
4448
|
-
}
|
|
4449
|
-
current = current[part];
|
|
4450
|
-
}
|
|
4451
|
-
return current;
|
|
4452
|
-
}
|
|
4453
|
-
function todayISO() {
|
|
4454
|
-
return (0, import_date_fns2.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
|
|
4455
|
-
}
|
|
4456
|
-
var compiledFunctionCache = /* @__PURE__ */ new Map();
|
|
4457
|
-
function compileClientFunction(code) {
|
|
4458
|
-
let fn = compiledFunctionCache.get(code);
|
|
4459
|
-
if (!fn) {
|
|
4460
|
-
fn = new Function(`return (${code})`)();
|
|
4461
|
-
compiledFunctionCache.set(code, fn);
|
|
4462
|
-
}
|
|
4463
|
-
return fn;
|
|
4464
|
-
}
|
|
4465
|
-
(0, import_ajv_formats.default)(ajv);
|
|
4466
|
-
function buildClientFunctionContext(input) {
|
|
4467
|
-
const flags = input.validatorContext?.event && input.validatorContext?.eventConfig ? getCurrentEventState(
|
|
4468
|
-
input.validatorContext?.event,
|
|
4469
|
-
input.validatorContext?.eventConfig
|
|
4470
|
-
)?.flags : [];
|
|
4471
|
-
return {
|
|
4472
|
-
$form: input.form,
|
|
4473
|
-
$flags: flags,
|
|
4474
|
-
$now: todayISO(),
|
|
4475
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
4476
|
-
$online: isOnline(),
|
|
4477
|
-
$user: input.validatorContext?.user,
|
|
4478
|
-
$event: input.validatorContext?.event,
|
|
4479
|
-
$leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
|
|
4480
|
-
user: input.systemVariables?.user,
|
|
4481
|
-
$window: input.systemVariables?.$window,
|
|
4482
|
-
locations: input.locations,
|
|
4483
|
-
adminLevelIds: input.adminLevelIds
|
|
4484
|
-
};
|
|
4485
|
-
}
|
|
4486
|
-
function runClientFunction(code, data, context) {
|
|
4487
|
-
return compileClientFunction(code)(data, context);
|
|
4488
|
-
}
|
|
4489
|
-
ajv.addKeyword({
|
|
4490
|
-
keyword: "daysFromDate",
|
|
4491
|
-
type: "string",
|
|
4492
|
-
schemaType: "object",
|
|
4493
|
-
$data: true,
|
|
4494
|
-
errors: true,
|
|
4495
|
-
validate(schema, data, _2, dataContext) {
|
|
4496
|
-
if (!(dataContext && dataContext.rootData && typeof dataContext.rootData === "object" && "$now" in dataContext.rootData && typeof dataContext.rootData.$now === "string")) {
|
|
4497
|
-
throw new Error("Validation context must contain $now");
|
|
4498
|
-
}
|
|
4499
|
-
const { days, clause } = schema;
|
|
4500
|
-
if (typeof data !== "string") {
|
|
4501
|
-
return false;
|
|
4502
|
-
}
|
|
4503
|
-
const date = new Date(data);
|
|
4504
|
-
if (isNaN(date.getTime())) {
|
|
4505
|
-
return false;
|
|
4506
|
-
}
|
|
4507
|
-
let referenceDate = schema.referenceDate;
|
|
4508
|
-
if (referenceDate && typeof referenceDate === "object" && "$data" in referenceDate) {
|
|
4509
|
-
referenceDate = resolveDataPath(
|
|
4510
|
-
dataContext.rootData,
|
|
4511
|
-
referenceDate.$data,
|
|
4512
|
-
dataContext.instancePath
|
|
4513
|
-
);
|
|
4514
|
-
}
|
|
4515
|
-
if (!referenceDate) {
|
|
4516
|
-
referenceDate = dataContext.rootData.$now;
|
|
4517
|
-
}
|
|
4518
|
-
const baseDate = new Date(referenceDate);
|
|
4519
|
-
if (isNaN(baseDate.getTime())) {
|
|
4520
|
-
return false;
|
|
4521
|
-
}
|
|
4522
|
-
const offsetDate = new Date(baseDate.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
4523
|
-
return clause === "after" ? (0, import_date_fns2.isAfter)(date, offsetDate) : (0, import_date_fns2.isBefore)(date, offsetDate);
|
|
4524
|
-
}
|
|
4525
|
-
});
|
|
4526
|
-
ajv.addKeyword({
|
|
4527
|
-
keyword: "isLeafLevelLocation",
|
|
4528
|
-
type: "string",
|
|
4529
|
-
schemaType: "boolean",
|
|
4530
|
-
$data: true,
|
|
4531
|
-
errors: true,
|
|
4532
|
-
// @ts-ignore -- Force type. We will move this away from AJV next. Parsing the array will take seconds and is only called by core.
|
|
4533
|
-
validate(_schema, data, _2, dataContext) {
|
|
4534
|
-
const locationIdInput = data;
|
|
4535
|
-
const locations = dataContext?.rootData.$leafAdminStructureLocationIds ?? [];
|
|
4536
|
-
return locations.some((location) => location.id === locationIdInput);
|
|
4537
|
-
}
|
|
4538
|
-
});
|
|
4539
|
-
function isAgeValue(value) {
|
|
4540
|
-
return typeof value === "object" && value !== null && "age" in value && typeof value.age === "number";
|
|
4541
|
-
}
|
|
4542
|
-
ajv.addKeyword({
|
|
4543
|
-
keyword: "customClientValidator",
|
|
4544
|
-
schemaType: "object",
|
|
4545
|
-
errors: true,
|
|
4546
|
-
// @ts-expect-error -- AJV's public types don't expose `rootData`. All
|
|
4547
|
-
// `validate()` callers build root data via `buildClientFunctionContext`,
|
|
4548
|
-
// so the cast holds.
|
|
4549
|
-
validate(schema, data, _2, dataContext) {
|
|
4550
|
-
return Boolean(
|
|
4551
|
-
runClientFunction(
|
|
4552
|
-
schema.code,
|
|
4553
|
-
data,
|
|
4554
|
-
dataContext?.rootData ?? buildClientFunctionContext({ form: {} })
|
|
4555
|
-
)
|
|
4556
|
-
);
|
|
4557
|
-
}
|
|
4558
|
-
});
|
|
4559
|
-
function validate(schema, data) {
|
|
4560
|
-
const validator = ajv.getSchema(schema.$id) || ajv.compile(schema);
|
|
4561
|
-
if ("$form" in data) {
|
|
4562
|
-
const entries = Object.entries(data.$form).map(([key, value]) => {
|
|
4563
|
-
if (!isAgeValue(value)) {
|
|
4564
|
-
return [key, value];
|
|
4565
|
-
}
|
|
4566
|
-
const age = value.age;
|
|
4567
|
-
const maybeAsOfDate = PlainDate.safeParse(data.$form[value.asOfDateRef]);
|
|
4568
|
-
return [
|
|
4569
|
-
key,
|
|
4570
|
-
{
|
|
4571
|
-
age,
|
|
4572
|
-
dob: ageToDate(
|
|
4573
|
-
age,
|
|
4574
|
-
maybeAsOfDate.success ? maybeAsOfDate.data : PlainDate.parse(data.$now)
|
|
4575
|
-
)
|
|
4576
|
-
}
|
|
4577
|
-
];
|
|
4578
|
-
});
|
|
4579
|
-
data.$form = Object.fromEntries(entries);
|
|
4580
|
-
}
|
|
4581
|
-
const result = validator(data);
|
|
4582
|
-
return result;
|
|
4583
|
-
}
|
|
4584
|
-
function isOnline() {
|
|
4585
|
-
if (typeof window !== "undefined" && typeof navigator !== "undefined") {
|
|
4586
|
-
return navigator.onLine;
|
|
4587
|
-
}
|
|
4588
|
-
return true;
|
|
4589
|
-
}
|
|
4590
|
-
|
|
4591
|
-
// ../commons/src/events/utils.ts
|
|
4592
|
-
var import_date_fns3 = require("date-fns");
|
|
4593
|
-
function ageToDate(age, asOfDate) {
|
|
4594
|
-
const date = plainDateToLocalDate(asOfDate);
|
|
4595
|
-
return PlainDate.parse((0, import_date_fns3.format)((0, import_date_fns3.subYears)(date, age), "yyyy-MM-dd"));
|
|
4596
|
-
}
|
|
4597
|
-
function getDeclarationFields(configuration) {
|
|
4598
|
-
return configuration.declaration.pages.flatMap(({ fields }) => fields);
|
|
4599
|
-
}
|
|
4600
|
-
function isActionConfigType(type) {
|
|
4601
|
-
return actionConfigTypes.has(type);
|
|
4602
|
-
}
|
|
4603
|
-
function getActionConfig({
|
|
4604
|
-
eventConfiguration,
|
|
4605
|
-
actionType,
|
|
4606
|
-
customActionType
|
|
4607
|
-
}) {
|
|
4608
|
-
if (actionType === ActionType.NOTIFY) {
|
|
4609
|
-
return eventConfiguration.actions.find((a) => a.type === ActionType.NOTIFY) ?? eventConfiguration.actions.find((a) => a.type === ActionType.DECLARE);
|
|
4610
|
-
}
|
|
4611
|
-
return eventConfiguration.actions.find((a) => {
|
|
4612
|
-
if (a.type === ActionType.CUSTOM && customActionType) {
|
|
4613
|
-
return a.customActionType === customActionType;
|
|
4614
|
-
}
|
|
4615
|
-
return a.type === actionType;
|
|
4616
|
-
});
|
|
4617
|
-
}
|
|
4618
|
-
var getActionAnnotationFields = (actionConfig) => {
|
|
4619
|
-
if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
|
|
4620
|
-
return actionConfig.correctionForm.pages.flatMap(({ fields }) => fields);
|
|
4621
|
-
}
|
|
4622
|
-
if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
|
|
4623
|
-
return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
|
|
4624
|
-
}
|
|
4625
|
-
const reviewFields = "review" in actionConfig && actionConfig.review != null ? actionConfig.review.fields : [];
|
|
4626
|
-
const formFields = "form" in actionConfig && actionConfig.form != null ? actionConfig.form : [];
|
|
4627
|
-
return [...reviewFields, ...formFields];
|
|
4628
|
-
};
|
|
4629
|
-
function getAllAnnotationFields(config) {
|
|
4630
|
-
return (0, import_lodash4.flattenDeep)(config.actions.map(getActionAnnotationFields));
|
|
4631
|
-
}
|
|
4632
|
-
function deepMerge(currentDocument, actionDocument) {
|
|
4633
|
-
const currentDocumentClone = (0, import_lodash4.cloneDeep)(currentDocument);
|
|
4634
|
-
return (0, import_lodash4.mergeWith)(
|
|
4635
|
-
(0, import_lodash4.cloneDeep)(currentDocumentClone),
|
|
4636
|
-
actionDocument,
|
|
4637
|
-
(previousValue, incomingValue) => {
|
|
4638
|
-
if (incomingValue === void 0) {
|
|
4639
|
-
return previousValue;
|
|
4640
|
-
}
|
|
4641
|
-
if ((0, import_lodash4.isArray)(incomingValue)) {
|
|
4642
|
-
return incomingValue;
|
|
4643
|
-
}
|
|
4644
|
-
if ((0, import_lodash4.isObject)(previousValue) && (0, import_lodash4.isObject)(incomingValue)) {
|
|
4645
|
-
return void 0;
|
|
4646
|
-
}
|
|
4647
|
-
return incomingValue;
|
|
4648
|
-
}
|
|
4649
|
-
);
|
|
4650
|
-
}
|
|
4651
|
-
var findAllFields = (config) => {
|
|
4652
|
-
return (0, import_lodash4.flattenDeep)([
|
|
4653
|
-
...getDeclarationFields(config),
|
|
4654
|
-
...getAllAnnotationFields(config)
|
|
4655
|
-
]);
|
|
4656
|
-
};
|
|
4657
|
-
function getMixedPath(obj, path, defaultValue) {
|
|
4658
|
-
const parts = path.split(".");
|
|
4659
|
-
const resolve = (current, segments) => {
|
|
4660
|
-
if (current == null || segments.length === 0) {
|
|
4661
|
-
return current;
|
|
4662
|
-
}
|
|
4663
|
-
for (let i = segments.length; i > 0; i--) {
|
|
4664
|
-
const compoundKey = segments.slice(0, i).join(".");
|
|
4665
|
-
if ((0, import_lodash4.has)(current, compoundKey)) {
|
|
4666
|
-
const next = (0, import_lodash4.get)(current, compoundKey);
|
|
4667
|
-
return resolve(next, segments.slice(i));
|
|
4668
|
-
}
|
|
3925
|
+
* })
|
|
3926
|
+
*/
|
|
3927
|
+
customClientValidator(validationFn) {
|
|
3928
|
+
const code = validationFn.toString();
|
|
3929
|
+
return defineFormConditional({
|
|
3930
|
+
type: "object",
|
|
3931
|
+
properties: wrapToPath(
|
|
3932
|
+
{ [fieldId]: { customClientValidator: { code } } },
|
|
3933
|
+
this.$$subfield
|
|
3934
|
+
),
|
|
3935
|
+
required: [fieldId]
|
|
3936
|
+
});
|
|
3937
|
+
},
|
|
3938
|
+
/**
|
|
3939
|
+
* Custom client-side evaluation. Returns a {@link FieldReference} descriptor
|
|
3940
|
+
* that can be used as the `value` property or a DATA component entry.
|
|
3941
|
+
* The function receives the referenced field's value as the first argument and
|
|
3942
|
+
* the full form context as the second; its return value replaces the field reference.
|
|
3943
|
+
* The function is serialised and executed just-in-time on the client only.
|
|
3944
|
+
* External references (e.g. lodash) are not available inside the function body.
|
|
3945
|
+
*
|
|
3946
|
+
* For computing a default value without referencing a specific field, use
|
|
3947
|
+
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
3948
|
+
*
|
|
3949
|
+
* @example
|
|
3950
|
+
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
3951
|
+
* Number(aValue) + Number(ctx.$form.b)
|
|
3952
|
+
* )
|
|
3953
|
+
*/
|
|
3954
|
+
customClientEvaluation(computationFn) {
|
|
3955
|
+
return {
|
|
3956
|
+
$$code: computationFn.toString(),
|
|
3957
|
+
$$field: fieldId,
|
|
3958
|
+
$$subfield: this.$$subfield
|
|
3959
|
+
};
|
|
4669
3960
|
}
|
|
4670
|
-
return void 0;
|
|
4671
3961
|
};
|
|
4672
|
-
const result = resolve(obj, parts);
|
|
4673
|
-
return (0, import_lodash4.isNil)(result) ? defaultValue : result;
|
|
4674
|
-
}
|
|
4675
|
-
function isAcceptedAction(a) {
|
|
4676
|
-
return a.status === ActionStatus.Accepted;
|
|
4677
|
-
}
|
|
4678
|
-
function getCompleteActionAnnotation(event2, action) {
|
|
4679
|
-
if (action.originalActionId) {
|
|
4680
|
-
const originalAction = event2.actions.find(
|
|
4681
|
-
({ id }) => id === action.originalActionId
|
|
4682
|
-
);
|
|
4683
|
-
if (originalAction?.status === ActionStatus.Requested) {
|
|
4684
|
-
return deepMerge(originalAction.annotation ?? {}, action.annotation ?? {});
|
|
4685
|
-
}
|
|
4686
|
-
}
|
|
4687
|
-
return action.annotation ?? {};
|
|
4688
|
-
}
|
|
4689
|
-
function getCompleteActionDeclaration(declaration, event2, action) {
|
|
4690
|
-
if (action.originalActionId) {
|
|
4691
|
-
const originalAction = event2.actions.find(
|
|
4692
|
-
({ id }) => id === action.originalActionId
|
|
4693
|
-
);
|
|
4694
|
-
if (originalAction?.status === ActionStatus.Requested) {
|
|
4695
|
-
return deepMerge(
|
|
4696
|
-
deepMerge(declaration, originalAction.declaration),
|
|
4697
|
-
action.declaration
|
|
4698
|
-
);
|
|
4699
|
-
}
|
|
4700
|
-
}
|
|
4701
|
-
return deepMerge(declaration, action.declaration);
|
|
4702
|
-
}
|
|
4703
|
-
function getAcceptedActions(event2) {
|
|
4704
|
-
return event2.actions.filter(isAcceptedAction).map((action) => ({
|
|
4705
|
-
...action,
|
|
4706
|
-
declaration: getCompleteActionDeclaration({}, event2, action),
|
|
4707
|
-
annotation: getCompleteActionAnnotation(event2, action)
|
|
4708
|
-
}));
|
|
4709
|
-
}
|
|
4710
|
-
var EXCLUDED_ACTIONS = [
|
|
4711
|
-
ActionType.REQUEST_CORRECTION,
|
|
4712
|
-
ActionType.PRINT_CERTIFICATE,
|
|
4713
|
-
ActionType.REJECT_CORRECTION
|
|
4714
|
-
];
|
|
4715
|
-
function aggregateActionDeclarations(event2) {
|
|
4716
|
-
const allAcceptedActions = getAcceptedActions(event2);
|
|
4717
|
-
const aggregatedActions = allAcceptedActions.filter((a) => !EXCLUDED_ACTIONS.some((type) => type === a.type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
4718
|
-
return aggregatedActions.reduce((declaration, action) => {
|
|
4719
|
-
if (action.type === ActionType.APPROVE_CORRECTION) {
|
|
4720
|
-
const requestAction = allAcceptedActions.find(
|
|
4721
|
-
({ id }) => id === action.requestId
|
|
4722
|
-
);
|
|
4723
|
-
if (!requestAction) {
|
|
4724
|
-
return declaration;
|
|
4725
|
-
}
|
|
4726
|
-
const declarationWithApprovedCorrection = getCompleteActionDeclaration(
|
|
4727
|
-
declaration,
|
|
4728
|
-
event2,
|
|
4729
|
-
requestAction
|
|
4730
|
-
);
|
|
4731
|
-
return getCompleteActionDeclaration(
|
|
4732
|
-
declarationWithApprovedCorrection,
|
|
4733
|
-
event2,
|
|
4734
|
-
action
|
|
4735
|
-
);
|
|
4736
|
-
}
|
|
4737
|
-
return getCompleteActionDeclaration(declaration, event2, action);
|
|
4738
|
-
}, {});
|
|
4739
|
-
}
|
|
4740
|
-
function aggregateActionAnnotations(event2) {
|
|
4741
|
-
return event2.actions.reduce((ann, sortedAction) => {
|
|
4742
|
-
if (!("annotation" in sortedAction) || !sortedAction.annotation) {
|
|
4743
|
-
return ann;
|
|
4744
|
-
}
|
|
4745
|
-
return deepMerge(ann, sortedAction.annotation);
|
|
4746
|
-
}, {});
|
|
4747
3962
|
}
|
|
4748
3963
|
|
|
4749
3964
|
// ../commons/src/events/eventConfigValidation.ts
|
|
@@ -4828,9 +4043,9 @@ function validatePlaceOfEvent(event2, ctx) {
|
|
|
4828
4043
|
}
|
|
4829
4044
|
function validateActionFlags(event2, ctx) {
|
|
4830
4045
|
const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
|
|
4831
|
-
const configuredFlagIds = event2.flags.map((
|
|
4046
|
+
const configuredFlagIds = event2.flags.map((flag) => flag.id);
|
|
4832
4047
|
const actionFlagIds = event2.actions.flatMap(
|
|
4833
|
-
(action) => (action.flags ?? []).map((
|
|
4048
|
+
(action) => (action.flags ?? []).map((flag) => flag.id)
|
|
4834
4049
|
);
|
|
4835
4050
|
for (const actionFlagId of actionFlagIds) {
|
|
4836
4051
|
const isConfigured = configuredFlagIds.includes(actionFlagId);
|
|
@@ -4866,11 +4081,11 @@ function validateActionOrder(event2, ctx) {
|
|
|
4866
4081
|
}
|
|
4867
4082
|
|
|
4868
4083
|
// ../commons/src/events/EventConfig.ts
|
|
4869
|
-
var EventFieldReference =
|
|
4084
|
+
var EventFieldReference = z33.object({ $$event: EventMetadataDateFieldIdInput }).describe(
|
|
4870
4085
|
"Reference to a field defined in the event metadata, using the field id."
|
|
4871
4086
|
);
|
|
4872
|
-
var _EventConfigBase =
|
|
4873
|
-
id:
|
|
4087
|
+
var _EventConfigBase = z33.object({
|
|
4088
|
+
id: z33.string().describe(
|
|
4874
4089
|
'Machine-readable identifier of the event (e.g. "birth", "death").'
|
|
4875
4090
|
),
|
|
4876
4091
|
dateOfEvent: FieldReference.or(EventFieldReference).optional().describe(
|
|
@@ -4889,26 +4104,23 @@ var _EventConfigBase = z34.object({
|
|
|
4889
4104
|
"Summary information displayed in the event overview."
|
|
4890
4105
|
),
|
|
4891
4106
|
label: TranslationConfig.describe("Human-readable label for the event type."),
|
|
4892
|
-
actions:
|
|
4107
|
+
actions: z33.array(ActionConfig).describe(
|
|
4893
4108
|
"Configuration of core and custom actions associated with the event."
|
|
4894
4109
|
),
|
|
4895
|
-
actionOrder:
|
|
4110
|
+
actionOrder: z33.array(z33.string()).optional().describe(
|
|
4896
4111
|
"Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
|
|
4897
4112
|
),
|
|
4898
4113
|
declaration: DeclarationFormConfig.describe(
|
|
4899
4114
|
"Configuration of the form used to gather event data."
|
|
4900
4115
|
),
|
|
4901
|
-
advancedSearch:
|
|
4116
|
+
advancedSearch: z33.array(AdvancedSearchConfig).optional().default([]).describe(
|
|
4902
4117
|
"Configuration of fields available in the advanced search feature."
|
|
4903
4118
|
),
|
|
4904
|
-
flags:
|
|
4119
|
+
flags: z33.array(FlagConfig).optional().default([]).describe(
|
|
4905
4120
|
"Configuration of custom flags associated with the actions of this event type."
|
|
4906
4121
|
),
|
|
4907
|
-
analytics:
|
|
4122
|
+
analytics: z33.boolean().optional().default(true).describe(
|
|
4908
4123
|
"Indicates whether the records of this event type are included in analytics"
|
|
4909
|
-
),
|
|
4910
|
-
icon: z34.partialRecord(AvailableIcons, Conditional).optional().describe(
|
|
4911
|
-
'Maps an icon name to a conditional. The icon of the first entry (in definition order) whose conditional matches the event is used when rendering it (e.g. in the "iconWithName"/"iconWithNameEvent" workqueue columns). Falls back to the default status-based icon when unset or when no conditional matches.'
|
|
4912
4124
|
)
|
|
4913
4125
|
});
|
|
4914
4126
|
var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
|
|
@@ -5125,31 +4337,21 @@ var event = Object.assign(eventFn, {
|
|
|
5125
4337
|
return {
|
|
5126
4338
|
$event: field3
|
|
5127
4339
|
};
|
|
5128
|
-
}
|
|
5129
|
-
/**
|
|
5130
|
-
* Checks if the event currently has the given status.
|
|
5131
|
-
* @param eventStatus - The status to check for.
|
|
5132
|
-
*/
|
|
5133
|
-
hasStatus: (eventStatus) => status(eventStatus),
|
|
5134
|
-
/**
|
|
5135
|
-
* Checks if the event currently carries the given flag.
|
|
5136
|
-
* @param flagValue - The flag to check for.
|
|
5137
|
-
*/
|
|
5138
|
-
hasFlag: (flagValue) => flag(flagValue)
|
|
4340
|
+
}
|
|
5139
4341
|
});
|
|
5140
4342
|
|
|
5141
4343
|
// ../commons/src/events/WorkqueueColumnConfig.ts
|
|
5142
|
-
var
|
|
4344
|
+
var z34 = __toESM(require("zod/v4"));
|
|
5143
4345
|
var WorkqueueColumnKeysArray = [
|
|
5144
4346
|
...EventMetadataKeysArray,
|
|
5145
4347
|
"title",
|
|
5146
4348
|
"outbox"
|
|
5147
4349
|
];
|
|
5148
|
-
var WorkqueueColumnKeys =
|
|
5149
|
-
var WorkqueueColumnValue =
|
|
4350
|
+
var WorkqueueColumnKeys = z34.enum(WorkqueueColumnKeysArray);
|
|
4351
|
+
var WorkqueueColumnValue = z34.object({
|
|
5150
4352
|
$event: WorkqueueColumnKeys
|
|
5151
4353
|
});
|
|
5152
|
-
var WorkqueueColumn =
|
|
4354
|
+
var WorkqueueColumn = z34.object({
|
|
5153
4355
|
label: TranslationConfig,
|
|
5154
4356
|
value: WorkqueueColumnValue
|
|
5155
4357
|
}).meta({
|
|
@@ -5163,56 +4365,164 @@ function defineWorkqueuesColumns(workqueueColumns) {
|
|
|
5163
4365
|
}
|
|
5164
4366
|
|
|
5165
4367
|
// ../commons/src/events/CountryConfigQueryInput.ts
|
|
5166
|
-
var
|
|
5167
|
-
var SerializableExact =
|
|
5168
|
-
type:
|
|
5169
|
-
term:
|
|
5170
|
-
});
|
|
5171
|
-
var SerializableWithin =
|
|
5172
|
-
type:
|
|
5173
|
-
location:
|
|
5174
|
-
});
|
|
5175
|
-
var SerializedQueryExpression =
|
|
5176
|
-
eventType:
|
|
5177
|
-
status:
|
|
5178
|
-
createdAt:
|
|
5179
|
-
updatedAt:
|
|
5180
|
-
"legalStatuses.DECLARED.createdAtLocation":
|
|
5181
|
-
"legalStatuses.DECLARED.createdByRole":
|
|
5182
|
-
"legalStatuses.REGISTERED.createdAt":
|
|
5183
|
-
"legalStatuses.REGISTERED.createdAtLocation":
|
|
5184
|
-
"legalStatuses.REGISTERED.createdByRole":
|
|
5185
|
-
"legalStatuses.REGISTERED.registrationNumber":
|
|
5186
|
-
createdAtLocation:
|
|
5187
|
-
|
|
4368
|
+
var z35 = __toESM(require("zod/v4"));
|
|
4369
|
+
var SerializableExact = z35.object({
|
|
4370
|
+
type: z35.literal("exact"),
|
|
4371
|
+
term: z35.union([z35.string(), SerializedUserField])
|
|
4372
|
+
});
|
|
4373
|
+
var SerializableWithin = z35.object({
|
|
4374
|
+
type: z35.literal("within"),
|
|
4375
|
+
location: z35.union([z35.string(), SerializedUserField])
|
|
4376
|
+
});
|
|
4377
|
+
var SerializedQueryExpression = z35.object({
|
|
4378
|
+
eventType: z35.string(),
|
|
4379
|
+
status: z35.optional(z35.union([AnyOfStatus, ExactStatus])),
|
|
4380
|
+
createdAt: z35.optional(DateCondition),
|
|
4381
|
+
updatedAt: z35.optional(DateCondition),
|
|
4382
|
+
"legalStatuses.DECLARED.createdAtLocation": z35.optional(SerializableWithin),
|
|
4383
|
+
"legalStatuses.DECLARED.createdByRole": z35.optional(AnyOf),
|
|
4384
|
+
"legalStatuses.REGISTERED.createdAt": z35.optional(DateCondition),
|
|
4385
|
+
"legalStatuses.REGISTERED.createdAtLocation": z35.optional(SerializableWithin),
|
|
4386
|
+
"legalStatuses.REGISTERED.createdByRole": z35.optional(AnyOf),
|
|
4387
|
+
"legalStatuses.REGISTERED.registrationNumber": z35.optional(Exact),
|
|
4388
|
+
createdAtLocation: z35.optional(
|
|
4389
|
+
z35.union([SerializableWithin, SerializableExact])
|
|
5188
4390
|
),
|
|
5189
|
-
updatedAtLocation:
|
|
5190
|
-
|
|
4391
|
+
updatedAtLocation: z35.optional(
|
|
4392
|
+
z35.union([SerializableWithin, SerializableExact])
|
|
5191
4393
|
),
|
|
5192
|
-
updatedByUserRole:
|
|
5193
|
-
assignedTo:
|
|
5194
|
-
createdBy:
|
|
4394
|
+
updatedByUserRole: z35.optional(SerializableExact),
|
|
4395
|
+
assignedTo: z35.optional(SerializableExact),
|
|
4396
|
+
createdBy: z35.optional(SerializableExact),
|
|
5195
4397
|
createdByUserType: ExactUserType,
|
|
5196
|
-
updatedBy:
|
|
5197
|
-
trackingId:
|
|
5198
|
-
flags:
|
|
4398
|
+
updatedBy: z35.optional(SerializableExact),
|
|
4399
|
+
trackingId: z35.optional(Exact),
|
|
4400
|
+
flags: z35.optional(ContainsFlags),
|
|
5199
4401
|
data: QueryInput
|
|
5200
4402
|
}).partial();
|
|
5201
|
-
var Or2 =
|
|
5202
|
-
type:
|
|
5203
|
-
clauses:
|
|
4403
|
+
var Or2 = z35.object({
|
|
4404
|
+
type: z35.literal("or"),
|
|
4405
|
+
clauses: z35.array(SerializedQueryExpression)
|
|
5204
4406
|
});
|
|
5205
|
-
var And2 =
|
|
5206
|
-
type:
|
|
5207
|
-
clauses:
|
|
4407
|
+
var And2 = z35.object({
|
|
4408
|
+
type: z35.literal("and"),
|
|
4409
|
+
clauses: z35.array(SerializedQueryExpression)
|
|
5208
4410
|
});
|
|
5209
|
-
var CountryConfigQueryType =
|
|
5210
|
-
var CountryConfigQueryInputType =
|
|
4411
|
+
var CountryConfigQueryType = z35.discriminatedUnion("type", [And2, Or2]);
|
|
4412
|
+
var CountryConfigQueryInputType = z35.union([
|
|
5211
4413
|
SerializedQueryExpression,
|
|
5212
4414
|
And2,
|
|
5213
4415
|
Or2
|
|
5214
4416
|
]);
|
|
5215
4417
|
|
|
4418
|
+
// ../commons/src/icons.ts
|
|
4419
|
+
var z36 = __toESM(require("zod/v4"));
|
|
4420
|
+
var AvailableIcons = z36.enum([
|
|
4421
|
+
"Archived",
|
|
4422
|
+
"Assigned",
|
|
4423
|
+
"Briefcase",
|
|
4424
|
+
"Certified",
|
|
4425
|
+
"Close",
|
|
4426
|
+
"Collapse",
|
|
4427
|
+
"Draft",
|
|
4428
|
+
"DuplicateYellow",
|
|
4429
|
+
"Expand",
|
|
4430
|
+
"ExternalValidate",
|
|
4431
|
+
"FilledCheck",
|
|
4432
|
+
"InReview",
|
|
4433
|
+
"Offline",
|
|
4434
|
+
"Registered",
|
|
4435
|
+
"RequiresUpdates",
|
|
4436
|
+
"Sent",
|
|
4437
|
+
"Validated",
|
|
4438
|
+
"WaitingApproval",
|
|
4439
|
+
"ChartActivity",
|
|
4440
|
+
"Activity",
|
|
4441
|
+
"Archive",
|
|
4442
|
+
"ArchiveTray",
|
|
4443
|
+
"ArrowLeft",
|
|
4444
|
+
"ArrowRight",
|
|
4445
|
+
"Buildings",
|
|
4446
|
+
"Circle",
|
|
4447
|
+
"CaretDown",
|
|
4448
|
+
"CaretLeft",
|
|
4449
|
+
"CaretRight",
|
|
4450
|
+
"ChartBar",
|
|
4451
|
+
"ChartLine",
|
|
4452
|
+
"ChatCircle",
|
|
4453
|
+
"CheckSquare",
|
|
4454
|
+
"Compass",
|
|
4455
|
+
"Check",
|
|
4456
|
+
"Copy",
|
|
4457
|
+
"Database",
|
|
4458
|
+
"DotsThreeVertical",
|
|
4459
|
+
"ArrowCounterClockwise",
|
|
4460
|
+
"MagnifyingGlassMinus",
|
|
4461
|
+
"MagnifyingGlassPlus",
|
|
4462
|
+
"Export",
|
|
4463
|
+
"Eye",
|
|
4464
|
+
"EyeSlash",
|
|
4465
|
+
"Envelope",
|
|
4466
|
+
"File",
|
|
4467
|
+
"FileSearch",
|
|
4468
|
+
"FileMinus",
|
|
4469
|
+
"FilePlus",
|
|
4470
|
+
"FileText",
|
|
4471
|
+
"FileX",
|
|
4472
|
+
"Handshake",
|
|
4473
|
+
"Gear",
|
|
4474
|
+
"GitBranch",
|
|
4475
|
+
"IdentificationCard",
|
|
4476
|
+
"List",
|
|
4477
|
+
"ListBullets",
|
|
4478
|
+
"Lock",
|
|
4479
|
+
"MagnifyingGlass",
|
|
4480
|
+
"MapPin",
|
|
4481
|
+
"Medal",
|
|
4482
|
+
"NotePencil",
|
|
4483
|
+
"Paperclip",
|
|
4484
|
+
"PaperPlaneTilt",
|
|
4485
|
+
"Pen",
|
|
4486
|
+
"PenNib",
|
|
4487
|
+
"Pencil",
|
|
4488
|
+
"PencilSimpleLine",
|
|
4489
|
+
"Phone",
|
|
4490
|
+
"Plus",
|
|
4491
|
+
"Printer",
|
|
4492
|
+
"SignOut",
|
|
4493
|
+
"Stamp",
|
|
4494
|
+
"Star",
|
|
4495
|
+
"Target",
|
|
4496
|
+
"TextT",
|
|
4497
|
+
"Trash",
|
|
4498
|
+
"UploadSimple",
|
|
4499
|
+
"User",
|
|
4500
|
+
"UserPlus",
|
|
4501
|
+
"Users",
|
|
4502
|
+
"WarningCircle",
|
|
4503
|
+
"X",
|
|
4504
|
+
"ChatText",
|
|
4505
|
+
"CircleWavyCheck",
|
|
4506
|
+
"CircleWavyQuestion",
|
|
4507
|
+
"ArchiveBox",
|
|
4508
|
+
"ArrowCircleDown",
|
|
4509
|
+
"FileArrowUp",
|
|
4510
|
+
"FileDotted",
|
|
4511
|
+
"Files",
|
|
4512
|
+
"PencilLine",
|
|
4513
|
+
"PencilCircle",
|
|
4514
|
+
"UserCircle",
|
|
4515
|
+
"Clock",
|
|
4516
|
+
"QrCode",
|
|
4517
|
+
"Webcam",
|
|
4518
|
+
"Sun",
|
|
4519
|
+
"DeviceTabletCamera",
|
|
4520
|
+
"Globe",
|
|
4521
|
+
"Fingerprint",
|
|
4522
|
+
"PushPin",
|
|
4523
|
+
"Timer"
|
|
4524
|
+
]);
|
|
4525
|
+
|
|
5216
4526
|
// ../commons/src/events/WorkqueueConfig.ts
|
|
5217
4527
|
var mandatoryColumns = defineWorkqueuesColumns([
|
|
5218
4528
|
{
|
|
@@ -5492,14 +4802,14 @@ var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
|
|
|
5492
4802
|
|
|
5493
4803
|
// ../commons/src/events/EventInput.ts
|
|
5494
4804
|
var z40 = __toESM(require("zod/v4"));
|
|
5495
|
-
var
|
|
4805
|
+
var import_uuid10 = require("uuid");
|
|
5496
4806
|
var EventInput = z40.object({
|
|
5497
4807
|
transactionId: z40.string(),
|
|
5498
4808
|
type: z40.string(),
|
|
5499
4809
|
createdAtLocation: UUID.nullish().describe(
|
|
5500
4810
|
"Location where the event occurred. Required for system users."
|
|
5501
4811
|
)
|
|
5502
|
-
}).meta({ default: { transactionId: (0,
|
|
4812
|
+
}).meta({ default: { transactionId: (0, import_uuid10.v4)(), type: "birth" } });
|
|
5503
4813
|
|
|
5504
4814
|
// ../commons/src/events/EventDocument.ts
|
|
5505
4815
|
var z41 = __toESM(require("zod/v4"));
|
|
@@ -5516,6 +4826,67 @@ var EventDocument = z41.object({
|
|
|
5516
4826
|
)
|
|
5517
4827
|
}).meta({ id: "EventDocument" });
|
|
5518
4828
|
|
|
4829
|
+
// ../commons/src/events/state/index.ts
|
|
4830
|
+
var import_lodash4 = require("lodash");
|
|
4831
|
+
|
|
4832
|
+
// ../commons/src/events/state/utils.ts
|
|
4833
|
+
var import_lodash2 = require("lodash");
|
|
4834
|
+
var updateActions = ActionTypes.extract([
|
|
4835
|
+
ActionType.CREATE,
|
|
4836
|
+
ActionType.NOTIFY,
|
|
4837
|
+
ActionType.EDIT,
|
|
4838
|
+
ActionType.DECLARE,
|
|
4839
|
+
ActionType.REGISTER,
|
|
4840
|
+
ActionType.REJECT,
|
|
4841
|
+
ActionType.ARCHIVE,
|
|
4842
|
+
ActionType.UNARCHIVE,
|
|
4843
|
+
ActionType.PRINT_CERTIFICATE,
|
|
4844
|
+
ActionType.REQUEST_CORRECTION,
|
|
4845
|
+
ActionType.APPROVE_CORRECTION,
|
|
4846
|
+
ActionType.REJECT_CORRECTION,
|
|
4847
|
+
ActionType.CUSTOM
|
|
4848
|
+
]);
|
|
4849
|
+
|
|
4850
|
+
// ../commons/src/events/state/flags.ts
|
|
4851
|
+
var import_lodash3 = require("lodash");
|
|
4852
|
+
var import_date_fns3 = require("date-fns");
|
|
4853
|
+
var INHERENT_FLAG_RULES = [
|
|
4854
|
+
{
|
|
4855
|
+
flag: InherentFlags.CORRECTION_REQUESTED,
|
|
4856
|
+
setOn: [ActionType.REQUEST_CORRECTION],
|
|
4857
|
+
resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
|
|
4858
|
+
},
|
|
4859
|
+
{
|
|
4860
|
+
// INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
|
|
4861
|
+
// other status-changing action (see getStatusFromActions). ARCHIVE/UNARCHIVE
|
|
4862
|
+
// are deliberately excluded so the flag freezes across an archive/unarchive
|
|
4863
|
+
// round trip and comes back exactly as it was.
|
|
4864
|
+
flag: InherentFlags.INCOMPLETE,
|
|
4865
|
+
setOn: [ActionType.NOTIFY],
|
|
4866
|
+
resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
|
|
4867
|
+
},
|
|
4868
|
+
{
|
|
4869
|
+
flag: InherentFlags.REJECTED,
|
|
4870
|
+
setOn: [ActionType.REJECT],
|
|
4871
|
+
resetOn: [
|
|
4872
|
+
ActionType.NOTIFY,
|
|
4873
|
+
ActionType.DECLARE,
|
|
4874
|
+
ActionType.EDIT,
|
|
4875
|
+
ActionType.REGISTER
|
|
4876
|
+
]
|
|
4877
|
+
},
|
|
4878
|
+
{
|
|
4879
|
+
flag: InherentFlags.POTENTIAL_DUPLICATE,
|
|
4880
|
+
setOn: [ActionType.DUPLICATE_DETECTED],
|
|
4881
|
+
resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
|
|
4882
|
+
},
|
|
4883
|
+
{
|
|
4884
|
+
flag: InherentFlags.EDIT_IN_PROGRESS,
|
|
4885
|
+
setOn: [ActionType.EDIT],
|
|
4886
|
+
resetOnAnyOtherAction: true
|
|
4887
|
+
}
|
|
4888
|
+
];
|
|
4889
|
+
|
|
5519
4890
|
// ../commons/src/events/defineConfig.ts
|
|
5520
4891
|
var IGNORED_EVENT_TYPES = [
|
|
5521
4892
|
"FOOTBALL_CLUB_MEMBERSHIP",
|
|
@@ -8097,20 +7468,20 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
|
8097
7468
|
]
|
|
8098
7469
|
};
|
|
8099
7470
|
var ACTION_FILTERS = {
|
|
8100
|
-
[ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
8101
|
-
[ActionType.REQUEST_CORRECTION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
8102
|
-
[ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
8103
|
-
[ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
8104
|
-
[ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
8105
|
-
[ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((
|
|
8106
|
-
[ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((
|
|
8107
|
-
[ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((
|
|
8108
|
-
[ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((
|
|
8109
|
-
[ActionType.ARCHIVE]: (flags) => !flags.some((
|
|
8110
|
-
[ActionType.UNARCHIVE]: (flags) => !flags.some((
|
|
8111
|
-
[ActionType.ASSIGN]: (flags) => !flags.some((
|
|
8112
|
-
[ActionType.UNASSIGN]: (flags) => !flags.some((
|
|
8113
|
-
[ActionType.CUSTOM]: (flags) => !flags.some((
|
|
7471
|
+
[ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
7472
|
+
[ActionType.REQUEST_CORRECTION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
7473
|
+
[ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
7474
|
+
[ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
7475
|
+
[ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
7476
|
+
[ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
7477
|
+
[ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
7478
|
+
[ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
7479
|
+
[ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
7480
|
+
[ActionType.ARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
|
|
7481
|
+
[ActionType.UNARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
|
|
7482
|
+
[ActionType.ASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
|
|
7483
|
+
[ActionType.UNASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
|
|
7484
|
+
[ActionType.CUSTOM]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))
|
|
8114
7485
|
};
|
|
8115
7486
|
var REJECTED_ACTIONS = [
|
|
8116
7487
|
ActionType.READ,
|
|
@@ -8456,56 +7827,8 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
|
|
|
8456
7827
|
V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
|
|
8457
7828
|
);
|
|
8458
7829
|
|
|
8459
|
-
// ../commons/src/events/locationPayloads.ts
|
|
8460
|
-
var z44 = __toESM(require("zod/v4"));
|
|
8461
|
-
var CreateLocationPayload = z44.object({
|
|
8462
|
-
id: UUID.optional(),
|
|
8463
|
-
versionId: UUID.optional(),
|
|
8464
|
-
name: z44.string(),
|
|
8465
|
-
externalId: z44.string().nullish(),
|
|
8466
|
-
administrativeAreaId: UUID.nullable(),
|
|
8467
|
-
locationType: z44.string().nullable(),
|
|
8468
|
-
effectiveFrom: z44.iso.date().optional(),
|
|
8469
|
-
status: LocationStatus.default("active")
|
|
8470
|
-
});
|
|
8471
|
-
var UpdateLocationPayload = z44.strictObject({
|
|
8472
|
-
id: UUID,
|
|
8473
|
-
versionId: UUID.optional(),
|
|
8474
|
-
name: z44.string(),
|
|
8475
|
-
externalId: z44.string().nullish(),
|
|
8476
|
-
status: LocationStatus,
|
|
8477
|
-
effectiveFrom: z44.iso.date().optional(),
|
|
8478
|
-
lastVersionId: UUID
|
|
8479
|
-
});
|
|
8480
|
-
var WithdrawLocationVersionPayload = z44.object({
|
|
8481
|
-
id: UUID,
|
|
8482
|
-
versionId: UUID
|
|
8483
|
-
});
|
|
8484
|
-
var CreateAdministrativeAreaPayload = z44.object({
|
|
8485
|
-
id: UUID.optional(),
|
|
8486
|
-
versionId: UUID.optional(),
|
|
8487
|
-
name: z44.string(),
|
|
8488
|
-
externalId: z44.string().nullish(),
|
|
8489
|
-
parentId: UUID.nullable(),
|
|
8490
|
-
effectiveFrom: z44.iso.date().optional(),
|
|
8491
|
-
status: LocationStatus.default("active")
|
|
8492
|
-
});
|
|
8493
|
-
var UpdateAdministrativeAreaPayload = z44.strictObject({
|
|
8494
|
-
id: UUID,
|
|
8495
|
-
versionId: UUID.optional(),
|
|
8496
|
-
name: z44.string(),
|
|
8497
|
-
externalId: z44.string().nullish(),
|
|
8498
|
-
status: LocationStatus,
|
|
8499
|
-
effectiveFrom: z44.iso.date().optional(),
|
|
8500
|
-
lastVersionId: UUID
|
|
8501
|
-
});
|
|
8502
|
-
var WithdrawAdministrativeAreaVersionPayload = z44.object({
|
|
8503
|
-
id: UUID,
|
|
8504
|
-
versionId: UUID
|
|
8505
|
-
});
|
|
8506
|
-
|
|
8507
7830
|
// ../commons/src/notification/UserNotifications.ts
|
|
8508
|
-
var
|
|
7831
|
+
var z44 = __toESM(require("zod/v4"));
|
|
8509
7832
|
var TriggerEvent = {
|
|
8510
7833
|
USER_CREATED: "user-created",
|
|
8511
7834
|
USER_UPDATED: "user-updated",
|
|
@@ -8518,54 +7841,54 @@ var TriggerEvent = {
|
|
|
8518
7841
|
CHANGE_PHONE_NUMBER: "change-phone-number",
|
|
8519
7842
|
CHANGE_EMAIL_ADDRESS: "change-email-address"
|
|
8520
7843
|
};
|
|
8521
|
-
var Recipient =
|
|
7844
|
+
var Recipient = z44.object({
|
|
8522
7845
|
name: NameFieldValue.optional(),
|
|
8523
|
-
mobile:
|
|
8524
|
-
email:
|
|
8525
|
-
bcc:
|
|
7846
|
+
mobile: z44.string().optional(),
|
|
7847
|
+
email: z44.string().optional(),
|
|
7848
|
+
bcc: z44.array(z44.string()).optional()
|
|
8526
7849
|
});
|
|
8527
|
-
var BasePayload =
|
|
7850
|
+
var BasePayload = z44.object({
|
|
8528
7851
|
recipient: Recipient
|
|
8529
7852
|
});
|
|
8530
7853
|
var TriggerPayload = {
|
|
8531
7854
|
[TriggerEvent.USER_CREATED]: BasePayload.extend({
|
|
8532
|
-
username:
|
|
8533
|
-
temporaryPassword:
|
|
7855
|
+
username: z44.string(),
|
|
7856
|
+
temporaryPassword: z44.string()
|
|
8534
7857
|
}),
|
|
8535
7858
|
[TriggerEvent.USER_UPDATED]: BasePayload.extend({
|
|
8536
|
-
oldUsername:
|
|
8537
|
-
newUsername:
|
|
7859
|
+
oldUsername: z44.string(),
|
|
7860
|
+
newUsername: z44.string()
|
|
8538
7861
|
}),
|
|
8539
7862
|
[TriggerEvent.USERNAME_REMINDER]: BasePayload.extend({
|
|
8540
|
-
username:
|
|
7863
|
+
username: z44.string()
|
|
8541
7864
|
}),
|
|
8542
7865
|
[TriggerEvent.RESET_PASSWORD]: BasePayload.extend({
|
|
8543
|
-
code:
|
|
7866
|
+
code: z44.string()
|
|
8544
7867
|
}),
|
|
8545
7868
|
[TriggerEvent.RESET_PASSWORD_BY_ADMIN]: BasePayload.extend({
|
|
8546
|
-
temporaryPassword:
|
|
8547
|
-
admin:
|
|
8548
|
-
id:
|
|
7869
|
+
temporaryPassword: z44.string(),
|
|
7870
|
+
admin: z44.object({
|
|
7871
|
+
id: z44.string(),
|
|
8549
7872
|
name: NameFieldValue,
|
|
8550
|
-
role:
|
|
7873
|
+
role: z44.string()
|
|
8551
7874
|
})
|
|
8552
7875
|
}),
|
|
8553
7876
|
[TriggerEvent.RESEND_INVITE]: BasePayload.extend({
|
|
8554
|
-
username:
|
|
8555
|
-
temporaryPassword:
|
|
7877
|
+
username: z44.string(),
|
|
7878
|
+
temporaryPassword: z44.string()
|
|
8556
7879
|
}),
|
|
8557
7880
|
[TriggerEvent.TWO_FA]: BasePayload.extend({
|
|
8558
|
-
code:
|
|
7881
|
+
code: z44.string()
|
|
8559
7882
|
}),
|
|
8560
7883
|
[TriggerEvent.ALL_USER_NOTIFICATION]: BasePayload.extend({
|
|
8561
|
-
subject:
|
|
8562
|
-
body:
|
|
7884
|
+
subject: z44.string(),
|
|
7885
|
+
body: z44.string()
|
|
8563
7886
|
}),
|
|
8564
7887
|
[TriggerEvent.CHANGE_PHONE_NUMBER]: BasePayload.extend({
|
|
8565
|
-
code:
|
|
7888
|
+
code: z44.string()
|
|
8566
7889
|
}),
|
|
8567
7890
|
[TriggerEvent.CHANGE_EMAIL_ADDRESS]: BasePayload.extend({
|
|
8568
|
-
code:
|
|
7891
|
+
code: z44.string()
|
|
8569
7892
|
})
|
|
8570
7893
|
};
|
|
8571
7894
|
async function triggerUserEventNotification({
|
|
@@ -8589,4 +7912,4 @@ function parseUserEventTrigger(event2, body) {
|
|
|
8589
7912
|
}
|
|
8590
7913
|
|
|
8591
7914
|
// src/notification/index.ts
|
|
8592
|
-
|
|
7915
|
+
z45.globalRegistry.clear();
|