@opencrvs/toolkit 2.1.0-rc.b0003b1 → 2.1.0-rc.b263ac1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/build.sh +2 -2
- package/dist/application-config/index.js +244 -197
- package/dist/cli.js +347 -5220
- package/dist/commons/api/router.d.ts +3730 -2896
- package/dist/commons/application-config/index.d.ts +6 -6
- package/dist/commons/conditionals/conditionals.d.ts +32 -323
- package/dist/commons/conditionals/validate.d.ts +11 -4
- package/dist/commons/events/ActionConfig.d.ts +279 -70
- package/dist/commons/events/ActionDocument.d.ts +153 -115
- package/dist/commons/events/ActionInput.d.ts +26 -6
- package/dist/commons/events/ActionStatus.d.ts +14 -0
- package/dist/commons/events/ActionType.d.ts +63 -58
- package/dist/commons/events/AdvancedSearchConfig.d.ts +525 -501
- package/dist/commons/events/AuditLog.d.ts +189 -40
- package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
- package/dist/commons/events/Conditional.d.ts +3 -3
- package/dist/commons/events/CountryConfigQueryInput.d.ts +590 -590
- package/dist/commons/events/Draft.d.ts +37 -35
- package/dist/commons/events/DynamicFieldValue.d.ts +9 -9
- package/dist/commons/events/EventConfig.d.ts +8 -5
- package/dist/commons/events/EventDocument.d.ts +66 -44
- package/dist/commons/events/EventIndex.d.ts +49 -72
- package/dist/commons/events/EventMetadata.d.ts +40 -40
- package/dist/commons/events/FieldConfig.d.ts +411 -384
- package/dist/commons/events/FieldType.d.ts +51 -51
- package/dist/commons/events/FieldTypeMapping.d.ts +90 -90
- package/dist/commons/events/FieldValue.d.ts +14 -14
- package/dist/commons/events/Flag.d.ts +57 -15
- package/dist/commons/events/PlainDate.d.ts +8 -0
- package/dist/commons/events/SummaryConfig.d.ts +249 -0
- package/dist/commons/events/TemplateConfig.d.ts +1 -1
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +40 -40
- package/dist/commons/events/WorkqueueConfig.d.ts +822 -816
- package/dist/commons/events/deduplication.d.ts +1 -1
- package/dist/commons/events/event.d.ts +14 -2
- package/dist/commons/events/field.d.ts +69 -198
- package/dist/commons/events/index.d.ts +1 -0
- package/dist/commons/events/locationPayloads.d.ts +95 -0
- package/dist/commons/events/locations.d.ts +192 -12
- package/dist/commons/events/mocks.test.utils.d.ts +48 -4
- package/dist/commons/events/scopes.d.ts +5 -4
- package/dist/commons/events/state/index.d.ts +17 -17
- package/dist/commons/events/state/utils.d.ts +7 -7
- package/dist/commons/events/test.utils.d.ts +44 -39
- package/dist/commons/events/utils.d.ts +127 -105
- package/dist/commons/notification/UserNotifications.d.ts +10 -10
- package/dist/conditionals/index.js +309 -57
- package/dist/environment/derived-variables.d.ts +119 -131
- package/dist/environment/derived-variables.d.ts.map +1 -1
- package/dist/environment/derived-variables.js +0 -14
- package/dist/environment/index.d.ts +1 -0
- package/dist/environment/index.d.ts.map +1 -1
- package/dist/environment/index.js +10 -0
- package/dist/environment/logger.d.ts +3 -3
- package/dist/environment/manage-users.js +17 -7
- package/dist/environment/paths.d.ts +7 -0
- package/dist/environment/paths.d.ts.map +1 -0
- package/dist/environment/paths.js +72 -0
- package/dist/environment/questions.d.ts +75 -74
- package/dist/environment/questions.d.ts.map +1 -1
- package/dist/environment/setup-environment.js +10 -29
- package/dist/environment/swarm-to-k8s.js +17 -7
- package/dist/environment/templates.d.ts.map +1 -1
- package/dist/environment/templates.js +2 -1
- package/dist/environment/update-workflows.d.ts.map +1 -1
- package/dist/environment/update-workflows.js +34 -12
- package/dist/environment/upgrade.d.ts +2 -0
- package/dist/environment/upgrade.d.ts.map +1 -0
- package/dist/environment/upgrade.js +82 -0
- package/dist/environment/users.js +28 -20
- package/dist/environment/utils.d.ts +1 -1
- package/dist/environment/utils.js +17 -7
- package/dist/events/deduplication.d.ts +1 -1
- package/dist/events/index.js +3650 -3145
- package/dist/migrations/v2.0/convert-config-files-to-ts.js +17 -7
- package/dist/migrations/v2.0/index.js +88 -5144
- package/dist/migrations/v2.0/migrate-application-config-url.js +4 -3
- package/dist/migrations/v2.0/remove-hearth-migrations.js +17 -7
- package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts +3 -0
- package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts.map +1 -0
- package/dist/migrations/v2.1/add-explicit-correction-flags.js +234 -0
- package/dist/migrations/v2.1/index.d.ts +6 -0
- package/dist/migrations/v2.1/index.d.ts.map +1 -0
- package/dist/migrations/v2.1/index.js +218 -0
- package/dist/notification/index.js +2019 -1072
- package/dist/scopes/index.d.ts +437 -163
- package/dist/scopes/index.js +310 -57
- package/dist/templates/charts-values/dependencies/values.yaml +0 -3
- package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -7
- package/dist/templates/charts-values/opentelemetry/values.yaml +73 -0
- package/opencrvs-toolkit-2.1.0-rc.b263ac1.tgz +0 -0
- package/package.json +7 -7
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.1.0-rc.b0003b1.tgz +0 -0
|
@@ -38,7 +38,7 @@ __export(notification_exports, {
|
|
|
38
38
|
triggerUserEventNotification: () => triggerUserEventNotification
|
|
39
39
|
});
|
|
40
40
|
module.exports = __toCommonJS(notification_exports);
|
|
41
|
-
var
|
|
41
|
+
var z46 = __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 z8 = __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 z7 = __toESM(require("zod/v4"));
|
|
55
55
|
|
|
56
56
|
// ../commons/src/scopes.ts
|
|
57
|
-
var
|
|
57
|
+
var z6 = __toESM(require("zod/v4"));
|
|
58
58
|
var qs = __toESM(require("qs"));
|
|
59
59
|
|
|
60
60
|
// ../commons/src/uuid.ts
|
|
@@ -65,12 +65,263 @@ 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
|
+
|
|
68
319
|
// ../commons/src/scopes.ts
|
|
69
|
-
var JurisdictionFilter =
|
|
320
|
+
var JurisdictionFilter = z6.enum(["administrativeArea", "location", "all"]).describe(
|
|
70
321
|
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
71
322
|
);
|
|
72
|
-
var UserFilter =
|
|
73
|
-
var RecordScopeTypeV2 =
|
|
323
|
+
var UserFilter = z6.enum(["user"]).describe("Filters based on the user. Limits to self.");
|
|
324
|
+
var RecordScopeTypeV2 = z6.enum([
|
|
74
325
|
"record.search",
|
|
75
326
|
"record.create",
|
|
76
327
|
"record.read",
|
|
@@ -79,6 +330,7 @@ var RecordScopeTypeV2 = z2.enum([
|
|
|
79
330
|
"record.edit",
|
|
80
331
|
"record.reject",
|
|
81
332
|
"record.archive",
|
|
333
|
+
"record.unarchive",
|
|
82
334
|
"record.review-duplicates",
|
|
83
335
|
"record.register",
|
|
84
336
|
"record.print-certified-copies",
|
|
@@ -87,7 +339,7 @@ var RecordScopeTypeV2 = z2.enum([
|
|
|
87
339
|
"record.unassign-others",
|
|
88
340
|
"record.custom-action"
|
|
89
341
|
]);
|
|
90
|
-
var PlainScopeType =
|
|
342
|
+
var PlainScopeType = z6.enum([
|
|
91
343
|
// Misc. system scopes
|
|
92
344
|
"bypassratelimit",
|
|
93
345
|
"record.reindex",
|
|
@@ -95,6 +347,7 @@ var PlainScopeType = z2.enum([
|
|
|
95
347
|
"integration.create",
|
|
96
348
|
"record.import",
|
|
97
349
|
"config.update-all",
|
|
350
|
+
"location.edit",
|
|
98
351
|
"attachment.upload",
|
|
99
352
|
"profile.electronic-signature",
|
|
100
353
|
"user.read-only-my-audit",
|
|
@@ -106,17 +359,18 @@ var PlainScopeType = z2.enum([
|
|
|
106
359
|
"record.confirm-registration",
|
|
107
360
|
"record.reject-registration"
|
|
108
361
|
]);
|
|
109
|
-
var scopeByEvent =
|
|
362
|
+
var scopeByEvent = z6.preprocess(
|
|
110
363
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
111
|
-
|
|
364
|
+
z6.array(z6.string()).optional()
|
|
112
365
|
).describe("Event type, e.g. birth, death");
|
|
113
|
-
var userRole =
|
|
366
|
+
var userRole = z6.preprocess(
|
|
114
367
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
115
|
-
|
|
368
|
+
z6.array(z6.string()).optional()
|
|
116
369
|
).describe("User role, e.g. admin, field agent");
|
|
117
|
-
var scopeOptionsPlaceEvent =
|
|
370
|
+
var scopeOptionsPlaceEvent = z6.object({
|
|
118
371
|
event: scopeByEvent,
|
|
119
|
-
placeOfEvent: JurisdictionFilter.optional()
|
|
372
|
+
placeOfEvent: JurisdictionFilter.optional(),
|
|
373
|
+
createdBy: UserFilter.optional()
|
|
120
374
|
}).describe("Options applicable to all record scopes.");
|
|
121
375
|
var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
122
376
|
notifiedIn: JurisdictionFilter.optional(),
|
|
@@ -126,52 +380,55 @@ var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
|
126
380
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
127
381
|
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
128
382
|
registeredIn: JurisdictionFilter.optional(),
|
|
129
|
-
registeredBy: UserFilter.optional()
|
|
383
|
+
registeredBy: UserFilter.optional(),
|
|
384
|
+
flags: ContainsFlags.optional()
|
|
130
385
|
}).describe(
|
|
131
386
|
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
132
387
|
);
|
|
133
388
|
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
134
|
-
customActionTypes:
|
|
389
|
+
customActionTypes: z6.preprocess(
|
|
135
390
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
136
|
-
|
|
391
|
+
z6.array(z6.string()).optional()
|
|
137
392
|
).describe("Allowed custom action types")
|
|
138
393
|
});
|
|
139
|
-
var AccessLevelOptions =
|
|
394
|
+
var AccessLevelOptions = z6.object({
|
|
140
395
|
accessLevel: JurisdictionFilter.optional()
|
|
141
396
|
});
|
|
142
397
|
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
143
398
|
role: userRole.optional()
|
|
144
399
|
});
|
|
145
|
-
var WorkqueueOrDashboardOptions =
|
|
146
|
-
ids:
|
|
400
|
+
var WorkqueueOrDashboardOptions = z6.object({
|
|
401
|
+
ids: z6.preprocess(
|
|
147
402
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
148
|
-
|
|
403
|
+
z6.array(z6.string())
|
|
149
404
|
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
150
405
|
});
|
|
151
|
-
var AllScopeOptions =
|
|
406
|
+
var AllScopeOptions = z6.object({
|
|
152
407
|
...AllRecordScopeOptions.shape,
|
|
153
408
|
...AccessLevelOptions.shape,
|
|
154
409
|
...AllUserScopeOptions.shape,
|
|
155
410
|
...WorkqueueOrDashboardOptions.shape
|
|
156
411
|
});
|
|
157
412
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
158
|
-
var ResolvedScopeOptionsPlaceEvent =
|
|
413
|
+
var ResolvedScopeOptionsPlaceEvent = z6.object({
|
|
159
414
|
event: scopeByEvent,
|
|
160
|
-
placeOfEvent: UUID.nullish()
|
|
415
|
+
placeOfEvent: UUID.nullish(),
|
|
416
|
+
createdBy: z6.string().optional()
|
|
161
417
|
}).describe(
|
|
162
418
|
"Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
|
|
163
419
|
);
|
|
164
420
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
165
421
|
notifiedIn: UUID.nullish(),
|
|
166
|
-
notifiedBy:
|
|
422
|
+
notifiedBy: z6.string().optional(),
|
|
167
423
|
declaredIn: UUID.nullish(),
|
|
168
|
-
declaredBy:
|
|
424
|
+
declaredBy: z6.string().optional()
|
|
169
425
|
}).describe(
|
|
170
426
|
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
171
427
|
);
|
|
172
428
|
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
173
429
|
registeredIn: UUID.nullish(),
|
|
174
|
-
registeredBy:
|
|
430
|
+
registeredBy: z6.string().optional(),
|
|
431
|
+
flags: ContainsFlags.optional()
|
|
175
432
|
}).describe(
|
|
176
433
|
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
177
434
|
);
|
|
@@ -184,6 +441,7 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
|
184
441
|
"record.edit",
|
|
185
442
|
"record.reject",
|
|
186
443
|
"record.archive",
|
|
444
|
+
"record.unarchive",
|
|
187
445
|
"record.review-duplicates",
|
|
188
446
|
"record.register"
|
|
189
447
|
]);
|
|
@@ -195,38 +453,38 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
|
195
453
|
"record.unassign-others"
|
|
196
454
|
]);
|
|
197
455
|
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
198
|
-
templates:
|
|
456
|
+
templates: z6.preprocess(
|
|
199
457
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
200
|
-
|
|
458
|
+
z6.array(z6.string()).optional()
|
|
201
459
|
).describe(
|
|
202
460
|
"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."
|
|
203
461
|
)
|
|
204
462
|
});
|
|
205
|
-
var RecordScopeV2 =
|
|
206
|
-
|
|
463
|
+
var RecordScopeV2 = z6.discriminatedUnion("type", [
|
|
464
|
+
z6.object({
|
|
207
465
|
type: ScopesWithPlaceEventOptions,
|
|
208
466
|
options: scopeOptionsPlaceEvent.optional()
|
|
209
467
|
}),
|
|
210
|
-
|
|
468
|
+
z6.object({
|
|
211
469
|
type: ScopesWithDeclaredOptions,
|
|
212
470
|
options: scopeOptionsDeclaredOrNotified.optional()
|
|
213
471
|
}),
|
|
214
|
-
|
|
472
|
+
z6.object({
|
|
215
473
|
type: ScopesWithFullOptions,
|
|
216
474
|
options: AllRecordScopeOptions.optional()
|
|
217
475
|
}),
|
|
218
|
-
|
|
219
|
-
type:
|
|
476
|
+
z6.object({
|
|
477
|
+
type: z6.literal("record.custom-action"),
|
|
220
478
|
options: CustomActionScopeOptions.optional()
|
|
221
479
|
}),
|
|
222
|
-
|
|
223
|
-
type:
|
|
480
|
+
z6.object({
|
|
481
|
+
type: z6.literal("record.print-certified-copies"),
|
|
224
482
|
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
225
483
|
})
|
|
226
484
|
]).describe(
|
|
227
485
|
"Scopes used to check user's permission to perform actions on a record."
|
|
228
486
|
);
|
|
229
|
-
var SystemScopeType =
|
|
487
|
+
var SystemScopeType = z6.enum([
|
|
230
488
|
"organisation.read-locations",
|
|
231
489
|
"user.read",
|
|
232
490
|
"user.create",
|
|
@@ -240,61 +498,61 @@ var UserScopeType = SystemScopeType.extract([
|
|
|
240
498
|
"user.search"
|
|
241
499
|
]);
|
|
242
500
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
243
|
-
var UserScopeV2 =
|
|
244
|
-
|
|
501
|
+
var UserScopeV2 = z6.discriminatedUnion("type", [
|
|
502
|
+
z6.object({
|
|
245
503
|
type: ScopesWithRoleOption,
|
|
246
504
|
options: AllUserScopeOptions.optional()
|
|
247
505
|
}),
|
|
248
|
-
|
|
506
|
+
z6.object({
|
|
249
507
|
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
250
508
|
options: AccessLevelOptions.optional()
|
|
251
509
|
})
|
|
252
510
|
]);
|
|
253
|
-
var ResolvedRecordScopeV2 =
|
|
254
|
-
|
|
511
|
+
var ResolvedRecordScopeV2 = z6.discriminatedUnion("type", [
|
|
512
|
+
z6.object({
|
|
255
513
|
type: ScopesWithPlaceEventOptions,
|
|
256
514
|
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
257
515
|
}),
|
|
258
|
-
|
|
516
|
+
z6.object({
|
|
259
517
|
type: ScopesWithDeclaredOptions,
|
|
260
518
|
options: ResolvedScopeOptionsDeclared.optional()
|
|
261
519
|
}),
|
|
262
|
-
|
|
520
|
+
z6.object({
|
|
263
521
|
type: ScopesWithFullOptions,
|
|
264
522
|
options: ResolvedScopeOptionsFull.optional()
|
|
265
523
|
}),
|
|
266
|
-
|
|
267
|
-
type:
|
|
524
|
+
z6.object({
|
|
525
|
+
type: z6.literal("record.print-certified-copies"),
|
|
268
526
|
options: ResolvedScopeOptionsFull.extend({
|
|
269
|
-
templates:
|
|
527
|
+
templates: z6.array(z6.string()).optional()
|
|
270
528
|
}).optional()
|
|
271
529
|
})
|
|
272
530
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
273
|
-
var Scope =
|
|
274
|
-
|
|
531
|
+
var Scope = z6.discriminatedUnion("type", [
|
|
532
|
+
z6.object({ type: PlainScopeType }),
|
|
275
533
|
...RecordScopeV2.options,
|
|
276
534
|
...UserScopeV2.options,
|
|
277
|
-
|
|
278
|
-
type:
|
|
535
|
+
z6.object({
|
|
536
|
+
type: z6.literal("organisation.read-locations"),
|
|
279
537
|
options: AccessLevelOptions.optional()
|
|
280
538
|
}),
|
|
281
|
-
|
|
282
|
-
type:
|
|
539
|
+
z6.object({
|
|
540
|
+
type: z6.literal("workqueue"),
|
|
283
541
|
options: WorkqueueOrDashboardOptions
|
|
284
542
|
}),
|
|
285
|
-
|
|
286
|
-
type:
|
|
543
|
+
z6.object({
|
|
544
|
+
type: z6.literal("dashboard.view"),
|
|
287
545
|
options: WorkqueueOrDashboardOptions
|
|
288
546
|
})
|
|
289
547
|
]);
|
|
290
|
-
var ScopeType =
|
|
548
|
+
var ScopeType = z6.enum([
|
|
291
549
|
...SystemScopeType.options,
|
|
292
550
|
...RecordScopeTypeV2.options,
|
|
293
551
|
...PlainScopeType.options,
|
|
294
552
|
"workqueue",
|
|
295
553
|
"dashboard.view"
|
|
296
554
|
]);
|
|
297
|
-
var EncodedScope =
|
|
555
|
+
var EncodedScope = z6.string().brand("EncodedScope");
|
|
298
556
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
299
557
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
300
558
|
accessLevel: JurisdictionFilter.enum.all,
|
|
@@ -304,158 +562,51 @@ var DEFAULT_SCOPE_OPTIONS = {
|
|
|
304
562
|
};
|
|
305
563
|
|
|
306
564
|
// ../commons/src/authentication.ts
|
|
307
|
-
var TokenUserType =
|
|
308
|
-
var TokenWithBearer =
|
|
309
|
-
|
|
310
|
-
// ../commons/src/events/ActionType.ts
|
|
311
|
-
var z4 = __toESM(require("zod/v4"));
|
|
312
|
-
var ActionType = {
|
|
313
|
-
// Pre-declaration actions
|
|
314
|
-
DELETE: "DELETE",
|
|
315
|
-
CREATE: "CREATE",
|
|
316
|
-
NOTIFY: "NOTIFY",
|
|
317
|
-
// Declaration actions
|
|
318
|
-
DECLARE: "DECLARE",
|
|
319
|
-
REGISTER: "REGISTER",
|
|
320
|
-
EDIT: "EDIT",
|
|
321
|
-
// Declaration system actions. Non-configurable.
|
|
322
|
-
DUPLICATE_DETECTED: "DUPLICATE_DETECTED",
|
|
323
|
-
REJECT: "REJECT",
|
|
324
|
-
// REJECT_DECLARATION
|
|
325
|
-
MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
|
|
326
|
-
MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
|
|
327
|
-
ARCHIVE: "ARCHIVE",
|
|
328
|
-
// Record actions
|
|
329
|
-
PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
|
|
330
|
-
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
|
331
|
-
REJECT_CORRECTION: "REJECT_CORRECTION",
|
|
332
|
-
APPROVE_CORRECTION: "APPROVE_CORRECTION",
|
|
333
|
-
// General actions
|
|
334
|
-
READ: "READ",
|
|
335
|
-
ASSIGN: "ASSIGN",
|
|
336
|
-
UNASSIGN: "UNASSIGN",
|
|
337
|
-
// Custom action
|
|
338
|
-
CUSTOM: "CUSTOM"
|
|
339
|
-
};
|
|
340
|
-
var ConfirmableActions = [
|
|
341
|
-
ActionType.NOTIFY,
|
|
342
|
-
ActionType.DECLARE,
|
|
343
|
-
ActionType.EDIT,
|
|
344
|
-
ActionType.REGISTER,
|
|
345
|
-
ActionType.REJECT,
|
|
346
|
-
ActionType.ARCHIVE,
|
|
347
|
-
ActionType.PRINT_CERTIFICATE,
|
|
348
|
-
ActionType.REQUEST_CORRECTION,
|
|
349
|
-
ActionType.APPROVE_CORRECTION,
|
|
350
|
-
ActionType.REJECT_CORRECTION,
|
|
351
|
-
ActionType.CUSTOM
|
|
352
|
-
];
|
|
353
|
-
var ActionTypes = z4.enum([
|
|
354
|
-
"DELETE",
|
|
355
|
-
"CREATE",
|
|
356
|
-
"NOTIFY",
|
|
357
|
-
"DECLARE",
|
|
358
|
-
"EDIT",
|
|
359
|
-
"REGISTER",
|
|
360
|
-
"DUPLICATE_DETECTED",
|
|
361
|
-
"REJECT",
|
|
362
|
-
"MARK_AS_DUPLICATE",
|
|
363
|
-
"MARK_AS_NOT_DUPLICATE",
|
|
364
|
-
"ARCHIVE",
|
|
365
|
-
"PRINT_CERTIFICATE",
|
|
366
|
-
"REQUEST_CORRECTION",
|
|
367
|
-
"REJECT_CORRECTION",
|
|
368
|
-
"APPROVE_CORRECTION",
|
|
369
|
-
"READ",
|
|
370
|
-
"ASSIGN",
|
|
371
|
-
"UNASSIGN",
|
|
372
|
-
"CUSTOM"
|
|
373
|
-
]);
|
|
374
|
-
var ClientSpecificAction = {
|
|
375
|
-
REVIEW_CORRECTION_REQUEST: "REVIEW_CORRECTION_REQUEST"
|
|
376
|
-
};
|
|
377
|
-
var declarationActionValues = [
|
|
378
|
-
ActionTypes.enum.DECLARE,
|
|
379
|
-
ActionTypes.enum.EDIT,
|
|
380
|
-
ActionTypes.enum.REGISTER,
|
|
381
|
-
ActionTypes.enum.NOTIFY,
|
|
382
|
-
ActionTypes.enum.DUPLICATE_DETECTED
|
|
383
|
-
];
|
|
384
|
-
var DeclarationActions = ActionTypes.extract(declarationActionValues);
|
|
385
|
-
var declarationUpdateActionValues = [
|
|
386
|
-
...declarationActionValues,
|
|
387
|
-
ActionTypes.enum.REQUEST_CORRECTION
|
|
388
|
-
];
|
|
389
|
-
var DeclarationUpdateActions = ActionTypes.extract(
|
|
390
|
-
declarationUpdateActionValues
|
|
391
|
-
);
|
|
392
|
-
var annotationActions = ActionTypes.exclude(declarationActionValues);
|
|
393
|
-
var writeActions = ActionTypes.exclude([
|
|
394
|
-
ActionType.CREATE,
|
|
395
|
-
ActionType.READ,
|
|
396
|
-
ActionType.ASSIGN,
|
|
397
|
-
ActionType.UNASSIGN
|
|
398
|
-
]);
|
|
399
|
-
var WorkqueueActionType = ActionTypes.extract([
|
|
400
|
-
ActionType.READ,
|
|
401
|
-
ActionType.DELETE,
|
|
402
|
-
ActionType.DECLARE,
|
|
403
|
-
ActionType.REGISTER,
|
|
404
|
-
ActionType.EDIT,
|
|
405
|
-
ActionType.REJECT,
|
|
406
|
-
ActionType.MARK_AS_DUPLICATE,
|
|
407
|
-
ActionType.ARCHIVE,
|
|
408
|
-
ActionType.PRINT_CERTIFICATE,
|
|
409
|
-
ActionType.REQUEST_CORRECTION
|
|
410
|
-
]);
|
|
411
|
-
var META_ACTIONS = [
|
|
412
|
-
ActionType.ASSIGN,
|
|
413
|
-
ActionType.UNASSIGN,
|
|
414
|
-
ActionType.READ
|
|
415
|
-
];
|
|
565
|
+
var TokenUserType = z7.enum(["user", "system"]);
|
|
566
|
+
var TokenWithBearer = z7.string().regex(/^Bearer\s/);
|
|
416
567
|
|
|
417
568
|
// ../commons/src/events/AuditLog.ts
|
|
418
|
-
var AuditLogEntryBase =
|
|
419
|
-
id:
|
|
420
|
-
clientId:
|
|
569
|
+
var AuditLogEntryBase = z8.object({
|
|
570
|
+
id: z8.string(),
|
|
571
|
+
clientId: z8.string(),
|
|
421
572
|
clientType: TokenUserType,
|
|
422
|
-
createdAt:
|
|
573
|
+
createdAt: z8.string()
|
|
423
574
|
});
|
|
424
575
|
var EventCreateEntrySchema = AuditLogEntryBase.extend({
|
|
425
|
-
operation:
|
|
426
|
-
requestData:
|
|
427
|
-
transactionId:
|
|
428
|
-
type:
|
|
429
|
-
createdAtLocation:
|
|
576
|
+
operation: z8.literal("event.create"),
|
|
577
|
+
requestData: z8.object({
|
|
578
|
+
transactionId: z8.string(),
|
|
579
|
+
type: z8.string(),
|
|
580
|
+
createdAtLocation: z8.string().nullable()
|
|
430
581
|
}),
|
|
431
|
-
responseSummary:
|
|
432
|
-
eventId:
|
|
433
|
-
trackingId:
|
|
582
|
+
responseSummary: z8.object({
|
|
583
|
+
eventId: z8.string(),
|
|
584
|
+
trackingId: z8.string()
|
|
434
585
|
})
|
|
435
586
|
});
|
|
436
587
|
var EventGetEntrySchema = AuditLogEntryBase.extend({
|
|
437
|
-
operation:
|
|
438
|
-
requestData:
|
|
439
|
-
responseSummary:
|
|
440
|
-
eventType:
|
|
441
|
-
trackingId:
|
|
588
|
+
operation: z8.literal("event.get"),
|
|
589
|
+
requestData: z8.object({ eventId: z8.string() }),
|
|
590
|
+
responseSummary: z8.object({
|
|
591
|
+
eventType: z8.string(),
|
|
592
|
+
trackingId: z8.string()
|
|
442
593
|
})
|
|
443
594
|
});
|
|
444
595
|
var EventSearchEntrySchema = AuditLogEntryBase.extend({
|
|
445
|
-
operation:
|
|
446
|
-
clientType:
|
|
447
|
-
requestData:
|
|
448
|
-
query:
|
|
449
|
-
limit:
|
|
450
|
-
offset:
|
|
596
|
+
operation: z8.literal("event.search"),
|
|
597
|
+
clientType: z8.literal("system"),
|
|
598
|
+
requestData: z8.object({
|
|
599
|
+
query: z8.record(z8.string(), z8.unknown()).nullable(),
|
|
600
|
+
limit: z8.number().nullable(),
|
|
601
|
+
offset: z8.number().nullable()
|
|
451
602
|
}),
|
|
452
|
-
responseSummary:
|
|
453
|
-
total:
|
|
454
|
-
eventIds:
|
|
603
|
+
responseSummary: z8.object({
|
|
604
|
+
total: z8.number(),
|
|
605
|
+
eventIds: z8.array(z8.string())
|
|
455
606
|
})
|
|
456
607
|
});
|
|
457
608
|
var EventActionEntrySchema = AuditLogEntryBase.extend({
|
|
458
|
-
operation:
|
|
609
|
+
operation: z8.enum([
|
|
459
610
|
"event.actions.notify.request",
|
|
460
611
|
"event.actions.declare.request",
|
|
461
612
|
"event.actions.register.request",
|
|
@@ -466,6 +617,7 @@ var EventActionEntrySchema = AuditLogEntryBase.extend({
|
|
|
466
617
|
"event.actions.unassign.request",
|
|
467
618
|
"event.actions.read.request",
|
|
468
619
|
"event.actions.archive.request",
|
|
620
|
+
"event.actions.unarchive.request",
|
|
469
621
|
"event.actions.reinstate.request",
|
|
470
622
|
"event.actions.print_certificate.request",
|
|
471
623
|
"event.actions.correction.request.request",
|
|
@@ -474,83 +626,159 @@ var EventActionEntrySchema = AuditLogEntryBase.extend({
|
|
|
474
626
|
"event.actions.mark_as_duplicate.request",
|
|
475
627
|
"event.actions.mark_as_not_duplicate.request"
|
|
476
628
|
]),
|
|
477
|
-
requestData:
|
|
478
|
-
eventId:
|
|
479
|
-
actionType:
|
|
480
|
-
eventType:
|
|
481
|
-
trackingId:
|
|
482
|
-
transactionId:
|
|
629
|
+
requestData: z8.object({
|
|
630
|
+
eventId: z8.string(),
|
|
631
|
+
actionType: z8.string(),
|
|
632
|
+
eventType: z8.string(),
|
|
633
|
+
trackingId: z8.string(),
|
|
634
|
+
transactionId: z8.string()
|
|
483
635
|
})
|
|
484
636
|
});
|
|
485
637
|
var EventCustomActionEntrySchema = AuditLogEntryBase.extend({
|
|
486
|
-
operation:
|
|
487
|
-
requestData:
|
|
488
|
-
eventId:
|
|
489
|
-
actionType:
|
|
490
|
-
customAction:
|
|
491
|
-
eventType:
|
|
492
|
-
trackingId:
|
|
493
|
-
transactionId:
|
|
638
|
+
operation: z8.literal("event.actions.custom.request"),
|
|
639
|
+
requestData: z8.object({
|
|
640
|
+
eventId: z8.string(),
|
|
641
|
+
actionType: z8.literal(ActionType.CUSTOM),
|
|
642
|
+
customAction: z8.string(),
|
|
643
|
+
eventType: z8.string(),
|
|
644
|
+
trackingId: z8.string(),
|
|
645
|
+
transactionId: z8.string()
|
|
494
646
|
})
|
|
495
647
|
});
|
|
496
648
|
var IntegrationCreateEntrySchema = AuditLogEntryBase.extend({
|
|
497
|
-
operation:
|
|
498
|
-
requestData:
|
|
499
|
-
responseSummary:
|
|
649
|
+
operation: z8.literal("integrations.create"),
|
|
650
|
+
requestData: z8.object({ name: z8.string(), scopes: z8.array(z8.string()) }),
|
|
651
|
+
responseSummary: z8.object({ clientId: z8.string() })
|
|
500
652
|
});
|
|
501
653
|
var IntegrationRefreshTokenEntrySchema = AuditLogEntryBase.extend({
|
|
502
|
-
operation:
|
|
503
|
-
requestData:
|
|
504
|
-
responseSummary:
|
|
654
|
+
operation: z8.literal("integrations.refreshToken"),
|
|
655
|
+
requestData: z8.object({ clientId: z8.string() }),
|
|
656
|
+
responseSummary: z8.object({ clientId: z8.string() })
|
|
505
657
|
});
|
|
506
658
|
var IntegrationDeactivateEntrySchema = AuditLogEntryBase.extend({
|
|
507
|
-
operation:
|
|
508
|
-
requestData:
|
|
509
|
-
responseSummary:
|
|
659
|
+
operation: z8.literal("integrations.deactivate"),
|
|
660
|
+
requestData: z8.object({ id: z8.string() }),
|
|
661
|
+
responseSummary: z8.object({ id: z8.string(), status: z8.string() })
|
|
510
662
|
});
|
|
511
663
|
var IntegrationActivateEntrySchema = AuditLogEntryBase.extend({
|
|
512
|
-
operation:
|
|
513
|
-
requestData:
|
|
514
|
-
responseSummary:
|
|
664
|
+
operation: z8.literal("integrations.activate"),
|
|
665
|
+
requestData: z8.object({ id: z8.string() }),
|
|
666
|
+
responseSummary: z8.object({ id: z8.string(), status: z8.string() })
|
|
515
667
|
});
|
|
516
668
|
var IntegrationDeleteEntrySchema = AuditLogEntryBase.extend({
|
|
517
|
-
operation:
|
|
518
|
-
requestData:
|
|
519
|
-
responseSummary:
|
|
669
|
+
operation: z8.literal("integrations.delete"),
|
|
670
|
+
requestData: z8.object({ id: z8.string() }),
|
|
671
|
+
responseSummary: z8.object({ id: z8.string(), name: z8.string() })
|
|
520
672
|
});
|
|
521
673
|
var IntegrationRefreshSecretEntrySchema = AuditLogEntryBase.extend({
|
|
522
|
-
operation:
|
|
523
|
-
requestData:
|
|
524
|
-
responseSummary:
|
|
674
|
+
operation: z8.literal("integrations.refreshSecret"),
|
|
675
|
+
requestData: z8.object({ id: z8.string() }),
|
|
676
|
+
responseSummary: z8.object({ clientId: z8.string() })
|
|
677
|
+
});
|
|
678
|
+
var createdVersionFields = {
|
|
679
|
+
id: z8.string(),
|
|
680
|
+
versionId: z8.string(),
|
|
681
|
+
name: z8.string(),
|
|
682
|
+
externalId: z8.string().nullish(),
|
|
683
|
+
effectiveFrom: z8.string(),
|
|
684
|
+
status: z8.string()
|
|
685
|
+
};
|
|
686
|
+
var LocationCreateEntrySchema = AuditLogEntryBase.extend({
|
|
687
|
+
operation: z8.literal("locations.create"),
|
|
688
|
+
requestData: z8.object({
|
|
689
|
+
...createdVersionFields,
|
|
690
|
+
administrativeAreaId: z8.string().nullish(),
|
|
691
|
+
locationType: z8.string().nullish()
|
|
692
|
+
})
|
|
693
|
+
});
|
|
694
|
+
var AdministrativeAreaCreateEntrySchema = AuditLogEntryBase.extend({
|
|
695
|
+
operation: z8.literal("administrativeAreas.create"),
|
|
696
|
+
requestData: z8.object({
|
|
697
|
+
...createdVersionFields,
|
|
698
|
+
parentId: z8.string().nullish()
|
|
699
|
+
})
|
|
700
|
+
});
|
|
701
|
+
var ChangedStringField = z8.object({ from: z8.string(), to: z8.string() });
|
|
702
|
+
var ChangedNullableStringField = z8.object({
|
|
703
|
+
from: z8.string().nullable(),
|
|
704
|
+
to: z8.string().nullable()
|
|
705
|
+
});
|
|
706
|
+
var updatedVersionRequestData = z8.object({
|
|
707
|
+
id: z8.string(),
|
|
708
|
+
versionId: z8.string(),
|
|
709
|
+
name: z8.string(),
|
|
710
|
+
externalId: z8.string().nullish(),
|
|
711
|
+
status: z8.string(),
|
|
712
|
+
effectiveFrom: z8.string(),
|
|
713
|
+
lastVersionId: z8.string()
|
|
714
|
+
});
|
|
715
|
+
var updatedVersionResponseSummary = z8.object({
|
|
716
|
+
previousVersionId: z8.string(),
|
|
717
|
+
versionId: z8.string(),
|
|
718
|
+
changed: z8.object({
|
|
719
|
+
name: ChangedStringField.optional(),
|
|
720
|
+
externalId: ChangedNullableStringField.optional(),
|
|
721
|
+
status: ChangedStringField.optional()
|
|
722
|
+
})
|
|
723
|
+
});
|
|
724
|
+
var LocationUpdateEntrySchema = AuditLogEntryBase.extend({
|
|
725
|
+
operation: z8.literal("locations.update"),
|
|
726
|
+
requestData: updatedVersionRequestData,
|
|
727
|
+
responseSummary: updatedVersionResponseSummary
|
|
728
|
+
});
|
|
729
|
+
var AdministrativeAreaUpdateEntrySchema = AuditLogEntryBase.extend({
|
|
730
|
+
operation: z8.literal("administrativeAreas.update"),
|
|
731
|
+
requestData: updatedVersionRequestData,
|
|
732
|
+
responseSummary: updatedVersionResponseSummary
|
|
733
|
+
});
|
|
734
|
+
var withdrawVersionRequestData = z8.object({
|
|
735
|
+
id: z8.string(),
|
|
736
|
+
versionId: z8.string()
|
|
737
|
+
});
|
|
738
|
+
var withdrawVersionResponseSummary = z8.object({
|
|
739
|
+
effectiveFrom: z8.string(),
|
|
740
|
+
name: z8.string(),
|
|
741
|
+
externalId: z8.string().nullish(),
|
|
742
|
+
status: z8.string()
|
|
743
|
+
});
|
|
744
|
+
var LocationWithdrawEntrySchema = AuditLogEntryBase.extend({
|
|
745
|
+
operation: z8.literal("locations.withdrawVersion"),
|
|
746
|
+
requestData: withdrawVersionRequestData,
|
|
747
|
+
responseSummary: withdrawVersionResponseSummary
|
|
748
|
+
});
|
|
749
|
+
var AdministrativeAreaWithdrawEntrySchema = AuditLogEntryBase.extend({
|
|
750
|
+
operation: z8.literal("administrativeAreas.withdrawVersion"),
|
|
751
|
+
requestData: withdrawVersionRequestData,
|
|
752
|
+
responseSummary: withdrawVersionResponseSummary
|
|
525
753
|
});
|
|
526
754
|
var AttachmentUploadEntrySchema = AuditLogEntryBase.extend({
|
|
527
|
-
operation:
|
|
528
|
-
requestData:
|
|
529
|
-
transactionId:
|
|
530
|
-
path:
|
|
755
|
+
operation: z8.literal("attachments.upload"),
|
|
756
|
+
requestData: z8.object({
|
|
757
|
+
transactionId: z8.string(),
|
|
758
|
+
path: z8.string().nullable()
|
|
531
759
|
}),
|
|
532
|
-
responseSummary:
|
|
760
|
+
responseSummary: z8.object({ fileUrl: z8.string() })
|
|
533
761
|
});
|
|
534
|
-
var subjectOnly =
|
|
535
|
-
var subjectWithReason =
|
|
536
|
-
subjectId:
|
|
537
|
-
reason:
|
|
538
|
-
comment:
|
|
762
|
+
var subjectOnly = z8.object({ subjectId: z8.string() });
|
|
763
|
+
var subjectWithReason = z8.object({
|
|
764
|
+
subjectId: z8.string(),
|
|
765
|
+
reason: z8.string(),
|
|
766
|
+
comment: z8.string().optional()
|
|
539
767
|
});
|
|
540
768
|
var UserCreateEntrySchema = AuditLogEntryBase.extend({
|
|
541
|
-
operation:
|
|
542
|
-
requestData:
|
|
543
|
-
subjectId:
|
|
544
|
-
role:
|
|
545
|
-
primaryOfficeId:
|
|
769
|
+
operation: z8.literal("user.create_user"),
|
|
770
|
+
requestData: z8.object({
|
|
771
|
+
subjectId: z8.string(),
|
|
772
|
+
role: z8.string(),
|
|
773
|
+
primaryOfficeId: z8.string()
|
|
546
774
|
})
|
|
547
775
|
});
|
|
548
776
|
var UserReasonEntrySchema = AuditLogEntryBase.extend({
|
|
549
|
-
operation:
|
|
777
|
+
operation: z8.enum(["user.deactivate", "user.reactivate"]),
|
|
550
778
|
requestData: subjectWithReason
|
|
551
779
|
});
|
|
552
780
|
var UserSubjectOnlyEntrySchema = AuditLogEntryBase.extend({
|
|
553
|
-
operation:
|
|
781
|
+
operation: z8.enum([
|
|
554
782
|
"user.edit_user",
|
|
555
783
|
"user.logged_in",
|
|
556
784
|
"user.logged_out",
|
|
@@ -564,14 +792,14 @@ var UserSubjectOnlyEntrySchema = AuditLogEntryBase.extend({
|
|
|
564
792
|
requestData: subjectOnly
|
|
565
793
|
});
|
|
566
794
|
var UserEmailChangedEntrySchema = AuditLogEntryBase.extend({
|
|
567
|
-
operation:
|
|
795
|
+
operation: z8.literal("user.email_address_changed"),
|
|
568
796
|
requestData: subjectOnly,
|
|
569
|
-
responseSummary:
|
|
797
|
+
responseSummary: z8.object({ email: z8.string() })
|
|
570
798
|
});
|
|
571
799
|
var UserPhoneChangedEntrySchema = AuditLogEntryBase.extend({
|
|
572
|
-
operation:
|
|
800
|
+
operation: z8.literal("user.phone_number_changed"),
|
|
573
801
|
requestData: subjectOnly,
|
|
574
|
-
responseSummary:
|
|
802
|
+
responseSummary: z8.object({ phoneNumber: z8.string() })
|
|
575
803
|
});
|
|
576
804
|
var userBaseOmit = {
|
|
577
805
|
id: true,
|
|
@@ -579,14 +807,14 @@ var userBaseOmit = {
|
|
|
579
807
|
clientType: true,
|
|
580
808
|
createdAt: true
|
|
581
809
|
};
|
|
582
|
-
var UserAuditRecordInput =
|
|
810
|
+
var UserAuditRecordInput = z8.discriminatedUnion("operation", [
|
|
583
811
|
UserCreateEntrySchema.omit(userBaseOmit),
|
|
584
812
|
UserReasonEntrySchema.omit(userBaseOmit),
|
|
585
813
|
UserSubjectOnlyEntrySchema.omit(userBaseOmit),
|
|
586
814
|
UserEmailChangedEntrySchema.omit(userBaseOmit),
|
|
587
815
|
UserPhoneChangedEntrySchema.omit(userBaseOmit)
|
|
588
816
|
]);
|
|
589
|
-
var AuditLogEntrySchema =
|
|
817
|
+
var AuditLogEntrySchema = z8.discriminatedUnion("operation", [
|
|
590
818
|
EventCreateEntrySchema,
|
|
591
819
|
EventGetEntrySchema,
|
|
592
820
|
EventSearchEntrySchema,
|
|
@@ -598,6 +826,12 @@ var AuditLogEntrySchema = z5.discriminatedUnion("operation", [
|
|
|
598
826
|
IntegrationActivateEntrySchema,
|
|
599
827
|
IntegrationDeleteEntrySchema,
|
|
600
828
|
IntegrationRefreshSecretEntrySchema,
|
|
829
|
+
LocationCreateEntrySchema,
|
|
830
|
+
LocationUpdateEntrySchema,
|
|
831
|
+
AdministrativeAreaUpdateEntrySchema,
|
|
832
|
+
LocationWithdrawEntrySchema,
|
|
833
|
+
AdministrativeAreaWithdrawEntrySchema,
|
|
834
|
+
AdministrativeAreaCreateEntrySchema,
|
|
601
835
|
AttachmentUploadEntrySchema,
|
|
602
836
|
UserCreateEntrySchema,
|
|
603
837
|
UserReasonEntrySchema,
|
|
@@ -613,76 +847,11 @@ var CHILD_ONBOARDING_EVENT = "child-onboarding";
|
|
|
613
847
|
// ../commons/src/events/ActionConfig.ts
|
|
614
848
|
var z24 = __toESM(require("zod/v4"));
|
|
615
849
|
|
|
616
|
-
// ../commons/src/events/TranslationConfig.ts
|
|
617
|
-
var z6 = __toESM(require("zod/v4"));
|
|
618
|
-
var TranslationConfig = z6.object({
|
|
619
|
-
id: z6.string().describe(
|
|
620
|
-
"The identifier of the translation referred in translation CSV files"
|
|
621
|
-
),
|
|
622
|
-
defaultMessage: z6.string().describe("Default translation message"),
|
|
623
|
-
description: z6.string().describe(
|
|
624
|
-
"Describe the translation for a translator to be able to identify it."
|
|
625
|
-
)
|
|
626
|
-
}).meta({
|
|
627
|
-
description: "Translation configuration",
|
|
628
|
-
id: "TranslationConfig"
|
|
629
|
-
});
|
|
630
|
-
|
|
631
850
|
// ../commons/src/events/FieldConfig.ts
|
|
632
851
|
var import_v43 = __toESM(require("zod/v4"));
|
|
633
852
|
|
|
634
|
-
// ../commons/src/events/Conditional.ts
|
|
635
|
-
var z7 = __toESM(require("zod/v4"));
|
|
636
|
-
var Conditional = z7.any().describe("JSONSchema").meta({
|
|
637
|
-
description: "JSON schema conditional configuration",
|
|
638
|
-
id: "Conditional"
|
|
639
|
-
});
|
|
640
|
-
var ConditionalType = {
|
|
641
|
-
SHOW: "SHOW",
|
|
642
|
-
ENABLE: "ENABLE",
|
|
643
|
-
DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
|
|
644
|
-
};
|
|
645
|
-
var ShowConditional = z7.object({
|
|
646
|
-
type: z7.literal(ConditionalType.SHOW),
|
|
647
|
-
conditional: Conditional
|
|
648
|
-
}).describe(
|
|
649
|
-
"If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
|
|
650
|
-
);
|
|
651
|
-
var EnableConditional = z7.object({
|
|
652
|
-
type: z7.literal(ConditionalType.ENABLE),
|
|
653
|
-
conditional: Conditional
|
|
654
|
-
}).describe(
|
|
655
|
-
"If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
|
|
656
|
-
);
|
|
657
|
-
var ActionConditional = z7.discriminatedUnion("type", [
|
|
658
|
-
// Action can be shown / hidden
|
|
659
|
-
ShowConditional,
|
|
660
|
-
// Action can be shown to the user in the list but as disabled
|
|
661
|
-
EnableConditional
|
|
662
|
-
]).meta({
|
|
663
|
-
id: "ActionConditional",
|
|
664
|
-
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."
|
|
665
|
-
});
|
|
666
|
-
var DisplayOnReviewConditional = z7.object({
|
|
667
|
-
type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
668
|
-
conditional: Conditional
|
|
669
|
-
}).describe(
|
|
670
|
-
"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."
|
|
671
|
-
);
|
|
672
|
-
var FieldConditional = z7.discriminatedUnion("type", [
|
|
673
|
-
// Field input can be shown / hidden
|
|
674
|
-
ShowConditional,
|
|
675
|
-
// Field input can be shown to the user but as disabled
|
|
676
|
-
EnableConditional,
|
|
677
|
-
// Field output can be shown / hidden on the review page
|
|
678
|
-
DisplayOnReviewConditional
|
|
679
|
-
]).meta({
|
|
680
|
-
id: "FieldConditional",
|
|
681
|
-
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."
|
|
682
|
-
});
|
|
683
|
-
|
|
684
853
|
// ../commons/src/events/FieldType.ts
|
|
685
|
-
var
|
|
854
|
+
var z9 = __toESM(require("zod/v4"));
|
|
686
855
|
var FieldType = {
|
|
687
856
|
NAME: "NAME",
|
|
688
857
|
PHONE: "PHONE",
|
|
@@ -746,7 +915,7 @@ var FieldType = {
|
|
|
746
915
|
*/
|
|
747
916
|
_EXPERIMENTAL_CUSTOM: "CUSTOM"
|
|
748
917
|
};
|
|
749
|
-
var FileFieldType =
|
|
918
|
+
var FileFieldType = z9.enum([
|
|
750
919
|
FieldType.FILE,
|
|
751
920
|
FieldType.FILE_WITH_OPTIONS,
|
|
752
921
|
FieldType.SIGNATURE
|
|
@@ -782,160 +951,164 @@ var HiddenFieldTypes = [
|
|
|
782
951
|
];
|
|
783
952
|
|
|
784
953
|
// ../commons/src/events/FieldValue.ts
|
|
785
|
-
var
|
|
954
|
+
var z13 = __toESM(require("zod/v4"));
|
|
786
955
|
|
|
787
956
|
// ../commons/src/documents.ts
|
|
788
|
-
var
|
|
789
|
-
var FullDocumentUrl =
|
|
957
|
+
var z10 = __toESM(require("zod/v4"));
|
|
958
|
+
var FullDocumentUrl = z10.string().brand("FullDocumentUrl").describe(
|
|
790
959
|
"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"
|
|
791
960
|
);
|
|
792
|
-
var FullDocumentPath =
|
|
961
|
+
var FullDocumentPath = z10.string().overwrite((val) => val.startsWith("/") ? val : `/${val}`).meta({ effectType: "input", type: "string" }).describe(
|
|
793
962
|
"A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
|
|
794
963
|
);
|
|
795
|
-
var DocumentPath =
|
|
964
|
+
var DocumentPath = z10.string().brand("DocumentPath").describe(
|
|
796
965
|
"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."
|
|
797
966
|
);
|
|
798
967
|
|
|
799
968
|
// ../commons/src/events/CompositeFieldValue.ts
|
|
800
|
-
var
|
|
969
|
+
var z11 = __toESM(require("zod/v4"));
|
|
801
970
|
var AddressType = {
|
|
802
971
|
DOMESTIC: "DOMESTIC",
|
|
803
972
|
INTERNATIONAL: "INTERNATIONAL"
|
|
804
973
|
};
|
|
805
|
-
var FileFieldValue =
|
|
974
|
+
var FileFieldValue = z11.object({
|
|
806
975
|
path: DocumentPath,
|
|
807
|
-
originalFilename:
|
|
808
|
-
type:
|
|
809
|
-
});
|
|
810
|
-
var NameFieldValue =
|
|
811
|
-
firstname:
|
|
812
|
-
surname:
|
|
813
|
-
middlename:
|
|
814
|
-
});
|
|
815
|
-
var NameFieldUpdateValue =
|
|
816
|
-
firstname:
|
|
817
|
-
surname:
|
|
818
|
-
middlename:
|
|
819
|
-
}).or(
|
|
820
|
-
var StreetLevelDetailsValue =
|
|
821
|
-
var StreetLevelDetailsUpdateValue =
|
|
822
|
-
var BaseAddressFieldValue =
|
|
823
|
-
country:
|
|
976
|
+
originalFilename: z11.string(),
|
|
977
|
+
type: z11.string()
|
|
978
|
+
});
|
|
979
|
+
var NameFieldValue = z11.object({
|
|
980
|
+
firstname: z11.string(),
|
|
981
|
+
surname: z11.string(),
|
|
982
|
+
middlename: z11.string().optional()
|
|
983
|
+
});
|
|
984
|
+
var NameFieldUpdateValue = z11.object({
|
|
985
|
+
firstname: z11.string().nullish(),
|
|
986
|
+
surname: z11.string().nullish(),
|
|
987
|
+
middlename: z11.string().nullish()
|
|
988
|
+
}).or(z11.null()).or(z11.undefined());
|
|
989
|
+
var StreetLevelDetailsValue = z11.record(z11.string(), z11.string()).optional();
|
|
990
|
+
var StreetLevelDetailsUpdateValue = z11.record(z11.string(), z11.string().nullable()).nullish();
|
|
991
|
+
var BaseAddressFieldValue = z11.object({
|
|
992
|
+
country: z11.string(),
|
|
824
993
|
streetLevelDetails: StreetLevelDetailsValue
|
|
825
994
|
});
|
|
826
|
-
var BaseAddressFieldUpdateValue =
|
|
827
|
-
country:
|
|
995
|
+
var BaseAddressFieldUpdateValue = z11.object({
|
|
996
|
+
country: z11.string().nullish(),
|
|
828
997
|
streetLevelDetails: StreetLevelDetailsUpdateValue
|
|
829
998
|
});
|
|
830
999
|
var DomesticAddressFieldValue = BaseAddressFieldValue.extend({
|
|
831
|
-
addressType:
|
|
832
|
-
administrativeArea:
|
|
1000
|
+
addressType: z11.literal(AddressType.DOMESTIC),
|
|
1001
|
+
administrativeArea: z11.string().uuid()
|
|
833
1002
|
});
|
|
834
1003
|
var InternationalAddressFieldValue = BaseAddressFieldValue.extend({
|
|
835
|
-
addressType:
|
|
1004
|
+
addressType: z11.literal(AddressType.INTERNATIONAL)
|
|
836
1005
|
});
|
|
837
|
-
var AddressFieldValue =
|
|
1006
|
+
var AddressFieldValue = z11.discriminatedUnion("addressType", [
|
|
838
1007
|
DomesticAddressFieldValue,
|
|
839
1008
|
InternationalAddressFieldValue
|
|
840
1009
|
]);
|
|
841
1010
|
var DomesticAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend({
|
|
842
|
-
addressType:
|
|
843
|
-
administrativeArea:
|
|
1011
|
+
addressType: z11.literal(AddressType.DOMESTIC),
|
|
1012
|
+
administrativeArea: z11.string().uuid().nullish()
|
|
844
1013
|
/* Leaf level admin structure */
|
|
845
1014
|
});
|
|
846
1015
|
var InternationalAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend(
|
|
847
1016
|
{
|
|
848
|
-
addressType:
|
|
1017
|
+
addressType: z11.literal(AddressType.INTERNATIONAL)
|
|
849
1018
|
}
|
|
850
1019
|
);
|
|
851
|
-
var AddressFieldUpdateValue =
|
|
1020
|
+
var AddressFieldUpdateValue = z11.discriminatedUnion("addressType", [
|
|
852
1021
|
DomesticAddressUpdateFieldValue,
|
|
853
1022
|
InternationalAddressUpdateFieldValue
|
|
854
1023
|
]).nullish();
|
|
855
|
-
var FileFieldValueWithOption =
|
|
1024
|
+
var FileFieldValueWithOption = z11.object({
|
|
856
1025
|
path: DocumentPath,
|
|
857
|
-
originalFilename:
|
|
858
|
-
type:
|
|
859
|
-
option:
|
|
860
|
-
});
|
|
861
|
-
var FileFieldWithOptionValue =
|
|
862
|
-
var HttpFieldValue =
|
|
863
|
-
loading:
|
|
864
|
-
error:
|
|
865
|
-
data:
|
|
866
|
-
});
|
|
867
|
-
var HttpFieldUpdateValue =
|
|
868
|
-
loading:
|
|
869
|
-
error:
|
|
870
|
-
data:
|
|
871
|
-
}).or(
|
|
872
|
-
var QueryParamReaderFieldValue =
|
|
873
|
-
data:
|
|
874
|
-
updatedAt:
|
|
1026
|
+
originalFilename: z11.string(),
|
|
1027
|
+
type: z11.string(),
|
|
1028
|
+
option: z11.string()
|
|
1029
|
+
});
|
|
1030
|
+
var FileFieldWithOptionValue = z11.array(FileFieldValueWithOption);
|
|
1031
|
+
var HttpFieldValue = z11.object({
|
|
1032
|
+
loading: z11.boolean(),
|
|
1033
|
+
error: z11.object({ statusCode: z11.number(), message: z11.string() }).nullish(),
|
|
1034
|
+
data: z11.any()
|
|
1035
|
+
});
|
|
1036
|
+
var HttpFieldUpdateValue = z11.object({
|
|
1037
|
+
loading: z11.boolean().nullish(),
|
|
1038
|
+
error: z11.object({ statusCode: z11.number(), message: z11.string() }).nullish(),
|
|
1039
|
+
data: z11.any().nullish()
|
|
1040
|
+
}).or(z11.null()).or(z11.undefined());
|
|
1041
|
+
var QueryParamReaderFieldValue = z11.object({
|
|
1042
|
+
data: z11.record(z11.string(), z11.string()),
|
|
1043
|
+
updatedAt: z11.iso.datetime()
|
|
875
1044
|
}).nullish();
|
|
876
|
-
var QueryParamReaderFieldUpdateValue =
|
|
877
|
-
data:
|
|
1045
|
+
var QueryParamReaderFieldUpdateValue = z11.object({
|
|
1046
|
+
data: z11.record(z11.string(), z11.string())
|
|
878
1047
|
});
|
|
879
|
-
var ReadDataValue =
|
|
880
|
-
data:
|
|
1048
|
+
var ReadDataValue = z11.object({
|
|
1049
|
+
data: z11.any()
|
|
881
1050
|
});
|
|
882
1051
|
var QrReaderFieldValue = ReadDataValue;
|
|
883
1052
|
var IdReaderFieldValue = ReadDataValue;
|
|
884
|
-
var NumberWithUnitFieldValue =
|
|
885
|
-
numericValue:
|
|
886
|
-
unit:
|
|
1053
|
+
var NumberWithUnitFieldValue = z11.object({
|
|
1054
|
+
numericValue: z11.number(),
|
|
1055
|
+
unit: z11.string()
|
|
887
1056
|
});
|
|
888
|
-
var NumberWithUnitFieldUpdateValue =
|
|
889
|
-
numericValue:
|
|
890
|
-
unit:
|
|
1057
|
+
var NumberWithUnitFieldUpdateValue = z11.object({
|
|
1058
|
+
numericValue: z11.number().optional(),
|
|
1059
|
+
unit: z11.string().optional()
|
|
891
1060
|
});
|
|
892
|
-
var CustomFieldValue =
|
|
1061
|
+
var CustomFieldValue = z11.unknown().brand("CustomFieldValue");
|
|
893
1062
|
|
|
894
1063
|
// ../commons/src/events/PlainDate.ts
|
|
895
1064
|
var import_zod = require("zod");
|
|
896
1065
|
var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date in the format YYYY-MM-DD");
|
|
1066
|
+
function plainDateToLocalDate(date) {
|
|
1067
|
+
const [year, month, day] = date.split("-").map(Number);
|
|
1068
|
+
return new Date(year, month - 1, day);
|
|
1069
|
+
}
|
|
897
1070
|
|
|
898
1071
|
// ../commons/src/events/FieldValue.ts
|
|
899
|
-
var TextValue =
|
|
900
|
-
var HiddenFieldValue =
|
|
901
|
-
var NonEmptyTextValue =
|
|
902
|
-
var DateValue =
|
|
903
|
-
var AgeValue =
|
|
904
|
-
age:
|
|
905
|
-
asOfDateRef:
|
|
1072
|
+
var TextValue = z13.string();
|
|
1073
|
+
var HiddenFieldValue = z13.string();
|
|
1074
|
+
var NonEmptyTextValue = z13.string().trim().min(1);
|
|
1075
|
+
var DateValue = z13.iso.date().describe("Date in the format YYYY-MM-DD");
|
|
1076
|
+
var AgeValue = z13.object({
|
|
1077
|
+
age: z13.number(),
|
|
1078
|
+
asOfDateRef: z13.string()
|
|
906
1079
|
});
|
|
907
1080
|
var AgeUpdateValue = AgeValue.optional().nullable();
|
|
908
|
-
var AutocompleteValue =
|
|
909
|
-
label:
|
|
910
|
-
value:
|
|
1081
|
+
var AutocompleteValue = z13.object({
|
|
1082
|
+
label: z13.string(),
|
|
1083
|
+
value: z13.string()
|
|
911
1084
|
});
|
|
912
1085
|
var AutocompleteUpdateValue = AutocompleteValue.optional().nullable();
|
|
913
|
-
var TimeValue =
|
|
914
|
-
var DatetimeValue =
|
|
915
|
-
var SelectDateRangeValue =
|
|
1086
|
+
var TimeValue = z13.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/);
|
|
1087
|
+
var DatetimeValue = z13.iso.datetime();
|
|
1088
|
+
var SelectDateRangeValue = z13.enum([
|
|
916
1089
|
"last7Days",
|
|
917
1090
|
"last30Days",
|
|
918
1091
|
"last90Days",
|
|
919
1092
|
"last365Days"
|
|
920
1093
|
]);
|
|
921
|
-
var DateRangeFieldValue =
|
|
1094
|
+
var DateRangeFieldValue = z13.object({
|
|
922
1095
|
start: PlainDate,
|
|
923
1096
|
end: PlainDate
|
|
924
1097
|
}).or(PlainDate).describe(
|
|
925
1098
|
"Date range with start and end dates in the format YYYY-MM-DD. Inclusive start, exclusive end."
|
|
926
1099
|
);
|
|
927
|
-
var EmailValue =
|
|
928
|
-
var CheckboxFieldValue =
|
|
929
|
-
var NumberFieldValue =
|
|
1100
|
+
var EmailValue = z13.email();
|
|
1101
|
+
var CheckboxFieldValue = z13.boolean();
|
|
1102
|
+
var NumberFieldValue = z13.number();
|
|
930
1103
|
var SignatureFieldValue = FileFieldValue;
|
|
931
|
-
var ButtonFieldValue =
|
|
932
|
-
var VerificationStatusValue =
|
|
1104
|
+
var ButtonFieldValue = z13.number();
|
|
1105
|
+
var VerificationStatusValue = z13.enum([
|
|
933
1106
|
"verified",
|
|
934
1107
|
"authenticated",
|
|
935
1108
|
"failed",
|
|
936
1109
|
"pending"
|
|
937
1110
|
]);
|
|
938
|
-
var LeafFieldValues =
|
|
1111
|
+
var LeafFieldValues = z13.union([
|
|
939
1112
|
AddressFieldValue,
|
|
940
1113
|
TextValue,
|
|
941
1114
|
PlainDate,
|
|
@@ -961,11 +1134,11 @@ var LeafFieldValues = z12.union([
|
|
|
961
1134
|
AutocompleteValue,
|
|
962
1135
|
AutocompleteUpdateValue
|
|
963
1136
|
]);
|
|
964
|
-
var FieldGroupValue =
|
|
965
|
-
var DataFieldValue =
|
|
966
|
-
data:
|
|
1137
|
+
var FieldGroupValue = z13.record(z13.string(), LeafFieldValues);
|
|
1138
|
+
var DataFieldValue = z13.object({
|
|
1139
|
+
data: z13.record(z13.string(), LeafFieldValues)
|
|
967
1140
|
}).nullish();
|
|
968
|
-
var FieldValue =
|
|
1141
|
+
var FieldValue = z13.union([
|
|
969
1142
|
LeafFieldValues,
|
|
970
1143
|
DataFieldValue,
|
|
971
1144
|
FieldGroupValue
|
|
@@ -999,7 +1172,7 @@ function safeUnion(schemas) {
|
|
|
999
1172
|
const sortedSchemas = [...schemas].sort(
|
|
1000
1173
|
(a, b) => schemaPriority(a) - schemaPriority(b)
|
|
1001
1174
|
);
|
|
1002
|
-
return
|
|
1175
|
+
return z13.any().superRefine((val, ctx) => {
|
|
1003
1176
|
for (const schema of sortedSchemas) {
|
|
1004
1177
|
if (schema.safeParse(val).success) {
|
|
1005
1178
|
return;
|
|
@@ -1038,9 +1211,9 @@ var FieldUpdateValue = safeUnion([
|
|
|
1038
1211
|
]);
|
|
1039
1212
|
|
|
1040
1213
|
// ../commons/src/events/serializers/user/serializer.ts
|
|
1041
|
-
var
|
|
1042
|
-
var SerializedUserField =
|
|
1043
|
-
$userField:
|
|
1214
|
+
var z14 = __toESM(require("zod/v4"));
|
|
1215
|
+
var SerializedUserField = z14.object({
|
|
1216
|
+
$userField: z14.enum([
|
|
1044
1217
|
"id",
|
|
1045
1218
|
"name",
|
|
1046
1219
|
"role",
|
|
@@ -1054,7 +1227,7 @@ var SerializedUserField = z13.object({
|
|
|
1054
1227
|
"primaryOfficeId",
|
|
1055
1228
|
"administrativeAreaId"
|
|
1056
1229
|
]),
|
|
1057
|
-
$location:
|
|
1230
|
+
$location: z14.string().optional()
|
|
1058
1231
|
});
|
|
1059
1232
|
function userSerializer(userField) {
|
|
1060
1233
|
return {
|
|
@@ -1080,27 +1253,22 @@ var import_v4 = require("zod/v4");
|
|
|
1080
1253
|
var z16 = __toESM(require("zod/v4"));
|
|
1081
1254
|
|
|
1082
1255
|
// ../commons/src/events/ActionDocument.ts
|
|
1083
|
-
var
|
|
1084
|
-
var ActionUpdate =
|
|
1256
|
+
var z15 = __toESM(require("zod/v4"));
|
|
1257
|
+
var ActionUpdate = z15.record(z15.string(), FieldUpdateValue).describe(
|
|
1085
1258
|
"Record of field-level changes made by an action. Supports partial updates and nullable values."
|
|
1086
1259
|
);
|
|
1087
|
-
var EventState =
|
|
1260
|
+
var EventState = z15.record(z15.string(), FieldValue).describe(
|
|
1088
1261
|
"Aggregate representation of event data after all actions have been applied, with all updates consolidated and null values removed."
|
|
1089
1262
|
);
|
|
1090
|
-
var
|
|
1091
|
-
Requested: "Requested",
|
|
1092
|
-
Accepted: "Accepted",
|
|
1093
|
-
Rejected: "Rejected"
|
|
1094
|
-
};
|
|
1095
|
-
var ActionBase = z14.object({
|
|
1263
|
+
var ActionBase = z15.object({
|
|
1096
1264
|
id: UUID.describe("Unique identifier of the action."),
|
|
1097
|
-
transactionId:
|
|
1265
|
+
transactionId: z15.string().describe("Unique identifier of the transaction."),
|
|
1098
1266
|
createdByUserType: TokenUserType.describe(
|
|
1099
1267
|
"Indicates whether the action was created by a human-user or by a system-user."
|
|
1100
1268
|
),
|
|
1101
|
-
createdAt:
|
|
1102
|
-
createdBy:
|
|
1103
|
-
createdByRole:
|
|
1269
|
+
createdAt: z15.string().datetime().describe("Timestamp indicating when the action was created."),
|
|
1270
|
+
createdBy: z15.string().describe("Identifier of the user who created the action."),
|
|
1271
|
+
createdByRole: z15.string().optional().describe("Role of the user who created the action."),
|
|
1104
1272
|
createdBySignature: DocumentPath.nullish().describe(
|
|
1105
1273
|
"Reference to the signature of the user who created the action."
|
|
1106
1274
|
),
|
|
@@ -1112,7 +1280,7 @@ var ActionBase = z14.object({
|
|
|
1112
1280
|
"Declaration data defined by the ActionConfig. Supports partial updates."
|
|
1113
1281
|
),
|
|
1114
1282
|
annotation: ActionUpdate.optional().nullable().describe("Action-specific metadata used to annotate the event."),
|
|
1115
|
-
status:
|
|
1283
|
+
status: z15.enum([
|
|
1116
1284
|
ActionStatus.Requested,
|
|
1117
1285
|
ActionStatus.Accepted,
|
|
1118
1286
|
ActionStatus.Rejected
|
|
@@ -1124,139 +1292,146 @@ var ActionBase = z14.object({
|
|
|
1124
1292
|
)
|
|
1125
1293
|
});
|
|
1126
1294
|
var AssignedAction = ActionBase.extend(
|
|
1127
|
-
|
|
1128
|
-
type:
|
|
1129
|
-
assignedTo:
|
|
1295
|
+
z15.object({
|
|
1296
|
+
type: z15.literal(ActionType.ASSIGN),
|
|
1297
|
+
assignedTo: z15.string().describe("Identifier of the user to whom the action is assigned.")
|
|
1130
1298
|
// TODO move into 'content' property
|
|
1131
1299
|
}).shape
|
|
1132
1300
|
);
|
|
1133
1301
|
var UnassignedAction = ActionBase.extend(
|
|
1134
|
-
|
|
1135
|
-
type:
|
|
1302
|
+
z15.object({
|
|
1303
|
+
type: z15.literal(ActionType.UNASSIGN)
|
|
1136
1304
|
}).shape
|
|
1137
1305
|
);
|
|
1138
1306
|
var RegisterAction = ActionBase.extend(
|
|
1139
|
-
|
|
1140
|
-
type:
|
|
1141
|
-
registrationNumber:
|
|
1307
|
+
z15.object({
|
|
1308
|
+
type: z15.literal(ActionType.REGISTER),
|
|
1309
|
+
registrationNumber: z15.string().optional().describe(
|
|
1142
1310
|
"Registration number of the event. Always present for accepted registrations."
|
|
1143
1311
|
)
|
|
1144
1312
|
// TODO move into 'content' property
|
|
1145
1313
|
}).shape
|
|
1146
1314
|
);
|
|
1147
1315
|
var DeclareAction = ActionBase.extend(
|
|
1148
|
-
|
|
1149
|
-
type:
|
|
1316
|
+
z15.object({
|
|
1317
|
+
type: z15.literal(ActionType.DECLARE)
|
|
1150
1318
|
}).shape
|
|
1151
1319
|
);
|
|
1152
|
-
var ReasonContent =
|
|
1153
|
-
reason:
|
|
1320
|
+
var ReasonContent = z15.object({
|
|
1321
|
+
reason: z15.string().min(1, { error: "Message cannot be empty" }).describe(
|
|
1154
1322
|
"Message describing the reason for rejecting or archiving the event."
|
|
1155
1323
|
)
|
|
1156
1324
|
});
|
|
1157
1325
|
var RejectAction = ActionBase.extend(
|
|
1158
|
-
|
|
1159
|
-
type:
|
|
1326
|
+
z15.object({
|
|
1327
|
+
type: z15.literal(ActionType.REJECT),
|
|
1160
1328
|
content: ReasonContent
|
|
1161
1329
|
}).shape
|
|
1162
1330
|
);
|
|
1163
|
-
var PotentialDuplicate =
|
|
1331
|
+
var PotentialDuplicate = z15.object({
|
|
1164
1332
|
id: UUID,
|
|
1165
|
-
trackingId:
|
|
1333
|
+
trackingId: z15.string()
|
|
1166
1334
|
});
|
|
1167
1335
|
var DuplicateDetectedAction = ActionBase.extend(
|
|
1168
|
-
|
|
1169
|
-
type:
|
|
1170
|
-
content:
|
|
1171
|
-
duplicates:
|
|
1336
|
+
z15.object({
|
|
1337
|
+
type: z15.literal(ActionType.DUPLICATE_DETECTED),
|
|
1338
|
+
content: z15.object({
|
|
1339
|
+
duplicates: z15.array(PotentialDuplicate)
|
|
1172
1340
|
})
|
|
1173
1341
|
}).shape
|
|
1174
1342
|
);
|
|
1175
1343
|
var MarkNotDuplicateAction = ActionBase.extend(
|
|
1176
|
-
|
|
1177
|
-
type:
|
|
1344
|
+
z15.object({
|
|
1345
|
+
type: z15.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
1178
1346
|
}).shape
|
|
1179
1347
|
);
|
|
1180
1348
|
var MarkAsDuplicateAction = ActionBase.extend(
|
|
1181
|
-
|
|
1182
|
-
type:
|
|
1183
|
-
content:
|
|
1349
|
+
z15.object({
|
|
1350
|
+
type: z15.literal(ActionType.MARK_AS_DUPLICATE),
|
|
1351
|
+
content: z15.object({
|
|
1184
1352
|
duplicateOf: UUID
|
|
1185
1353
|
}).optional()
|
|
1186
1354
|
}).shape
|
|
1187
1355
|
);
|
|
1188
1356
|
var ArchiveAction = ActionBase.extend(
|
|
1189
|
-
|
|
1190
|
-
type:
|
|
1357
|
+
z15.object({
|
|
1358
|
+
type: z15.literal(ActionType.ARCHIVE),
|
|
1191
1359
|
content: ReasonContent
|
|
1192
1360
|
}).shape
|
|
1193
1361
|
);
|
|
1362
|
+
var UnarchiveAction = ActionBase.extend(
|
|
1363
|
+
z15.object({
|
|
1364
|
+
type: z15.literal(ActionType.UNARCHIVE)
|
|
1365
|
+
}).shape
|
|
1366
|
+
);
|
|
1194
1367
|
var CreatedAction = ActionBase.extend(
|
|
1195
|
-
|
|
1196
|
-
type:
|
|
1368
|
+
z15.object({
|
|
1369
|
+
type: z15.literal(ActionType.CREATE)
|
|
1197
1370
|
}).shape
|
|
1198
1371
|
);
|
|
1199
1372
|
var NotifiedAction = ActionBase.extend(
|
|
1200
|
-
|
|
1201
|
-
type:
|
|
1373
|
+
z15.object({
|
|
1374
|
+
type: z15.literal(ActionType.NOTIFY)
|
|
1202
1375
|
}).shape
|
|
1203
1376
|
);
|
|
1204
1377
|
var EditAction = ActionBase.extend(
|
|
1205
|
-
|
|
1206
|
-
type:
|
|
1207
|
-
content
|
|
1208
|
-
|
|
1209
|
-
|
|
1378
|
+
z15.object({
|
|
1379
|
+
type: z15.literal(ActionType.EDIT),
|
|
1380
|
+
/** @deprecated New Edit-actions should no longer contain content. This is kept for old 2.0 edits. */
|
|
1381
|
+
content: z15.object({
|
|
1382
|
+
comment: z15.string().describe("Comment for the edit action.").optional()
|
|
1383
|
+
}).optional()
|
|
1210
1384
|
}).shape
|
|
1211
1385
|
);
|
|
1212
|
-
var PrintContent =
|
|
1213
|
-
templateId:
|
|
1386
|
+
var PrintContent = z15.object({
|
|
1387
|
+
templateId: z15.string().optional()
|
|
1214
1388
|
});
|
|
1215
1389
|
var PrintCertificateAction = ActionBase.extend(
|
|
1216
|
-
|
|
1217
|
-
type:
|
|
1390
|
+
z15.object({
|
|
1391
|
+
type: z15.literal(ActionType.PRINT_CERTIFICATE),
|
|
1218
1392
|
content: PrintContent.optional().nullable()
|
|
1219
1393
|
}).shape
|
|
1220
1394
|
);
|
|
1221
1395
|
var RequestedCorrectionAction = ActionBase.extend(
|
|
1222
|
-
|
|
1223
|
-
type:
|
|
1396
|
+
z15.object({
|
|
1397
|
+
type: z15.literal(ActionType.REQUEST_CORRECTION)
|
|
1224
1398
|
}).shape
|
|
1225
1399
|
);
|
|
1226
1400
|
var ApprovedCorrectionAction = ActionBase.extend(
|
|
1227
|
-
|
|
1228
|
-
type:
|
|
1229
|
-
requestId:
|
|
1401
|
+
z15.object({
|
|
1402
|
+
type: z15.literal(ActionType.APPROVE_CORRECTION),
|
|
1403
|
+
requestId: z15.string(),
|
|
1230
1404
|
// TODO move into 'content' property
|
|
1231
|
-
content:
|
|
1405
|
+
content: z15.object({ immediateCorrection: z15.boolean().optional() }).optional()
|
|
1232
1406
|
}).shape
|
|
1233
1407
|
);
|
|
1234
1408
|
var RejectedCorrectionAction = ActionBase.extend(
|
|
1235
|
-
|
|
1236
|
-
type:
|
|
1237
|
-
requestId:
|
|
1409
|
+
z15.object({
|
|
1410
|
+
type: z15.literal(ActionType.REJECT_CORRECTION),
|
|
1411
|
+
requestId: z15.string(),
|
|
1238
1412
|
// TODO move into 'content' property
|
|
1239
1413
|
content: ReasonContent
|
|
1240
1414
|
}).shape
|
|
1241
1415
|
);
|
|
1242
1416
|
var ReadAction = ActionBase.extend(
|
|
1243
|
-
|
|
1244
|
-
type:
|
|
1417
|
+
z15.object({
|
|
1418
|
+
type: z15.literal(ActionType.READ)
|
|
1245
1419
|
}).shape
|
|
1246
1420
|
);
|
|
1247
1421
|
var CustomAction = ActionBase.merge(
|
|
1248
|
-
|
|
1249
|
-
type:
|
|
1250
|
-
customActionType:
|
|
1422
|
+
z15.object({
|
|
1423
|
+
type: z15.literal(ActionType.CUSTOM),
|
|
1424
|
+
customActionType: z15.string()
|
|
1251
1425
|
})
|
|
1252
1426
|
);
|
|
1253
|
-
var ActionDocument =
|
|
1427
|
+
var ActionDocument = z15.discriminatedUnion("type", [
|
|
1254
1428
|
CreatedAction.meta({ id: "CreatedAction" }),
|
|
1255
1429
|
RejectAction.meta({ id: "RejectAction" }),
|
|
1256
1430
|
DuplicateDetectedAction.meta({ id: "DuplicateDetectedAction" }),
|
|
1257
1431
|
MarkNotDuplicateAction.meta({ id: "MarkNotDuplicateAction" }),
|
|
1258
1432
|
MarkAsDuplicateAction.meta({ id: "MarkAsDuplicateAction" }),
|
|
1259
1433
|
ArchiveAction.meta({ id: "ArchiveAction" }),
|
|
1434
|
+
UnarchiveAction.meta({ id: "UnarchiveAction" }),
|
|
1260
1435
|
NotifiedAction.meta({ id: "NotifiedAction" }),
|
|
1261
1436
|
RegisterAction.meta({ id: "RegisterAction" }),
|
|
1262
1437
|
DeclareAction.meta({ id: "DeclareAction" }),
|
|
@@ -1276,64 +1451,12 @@ var AsyncRejectActionDocument = ActionBase.omit({
|
|
|
1276
1451
|
declaration: true,
|
|
1277
1452
|
annotation: true
|
|
1278
1453
|
}).extend(
|
|
1279
|
-
|
|
1280
|
-
type:
|
|
1281
|
-
status:
|
|
1454
|
+
z15.object({
|
|
1455
|
+
type: z15.enum(ConfirmableActions),
|
|
1456
|
+
status: z15.literal(ActionStatus.Rejected)
|
|
1282
1457
|
}).shape
|
|
1283
1458
|
);
|
|
1284
|
-
var Action =
|
|
1285
|
-
|
|
1286
|
-
// ../commons/src/events/Flag.ts
|
|
1287
|
-
var z15 = __toESM(require("zod/v4"));
|
|
1288
|
-
var InherentFlags = {
|
|
1289
|
-
INCOMPLETE: "incomplete",
|
|
1290
|
-
REJECTED: "rejected",
|
|
1291
|
-
CORRECTION_REQUESTED: "correction-requested",
|
|
1292
|
-
POTENTIAL_DUPLICATE: "potential-duplicate",
|
|
1293
|
-
/**
|
|
1294
|
-
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
1295
|
-
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
1296
|
-
*
|
|
1297
|
-
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
1298
|
-
*/
|
|
1299
|
-
EDIT_IN_PROGRESS: "edit-in-progress"
|
|
1300
|
-
};
|
|
1301
|
-
var ActionFlag = z15.string().regex(
|
|
1302
|
-
new RegExp(
|
|
1303
|
-
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
1304
|
-
ActionStatus
|
|
1305
|
-
).join("|").toLowerCase()})$`
|
|
1306
|
-
),
|
|
1307
|
-
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
1308
|
-
);
|
|
1309
|
-
var CustomFlag = z15.string().refine((val) => !Object.values(InherentFlags).includes(val), {
|
|
1310
|
-
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
1311
|
-
InherentFlags
|
|
1312
|
-
).join(", ")}`
|
|
1313
|
-
}).refine((val) => !ActionFlag.safeParse(val).success, {
|
|
1314
|
-
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
1315
|
-
}).describe("Custom flag identifier defined by the country config.");
|
|
1316
|
-
var Flag = ActionFlag.or(z15.enum(InherentFlags)).or(CustomFlag);
|
|
1317
|
-
var FlagConfig = z15.object({
|
|
1318
|
-
id: CustomFlag,
|
|
1319
|
-
requiresAction: z15.boolean().describe(
|
|
1320
|
-
"Indicates if this flag expects an action to be performed to be cleared."
|
|
1321
|
-
),
|
|
1322
|
-
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1323
|
-
}).meta({
|
|
1324
|
-
id: "FlagConfig",
|
|
1325
|
-
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
1326
|
-
});
|
|
1327
|
-
var ActionFlagConfig = z15.object({
|
|
1328
|
-
id: Flag,
|
|
1329
|
-
operation: z15.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
1330
|
-
conditional: Conditional.optional().describe(
|
|
1331
|
-
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1332
|
-
)
|
|
1333
|
-
}).meta({
|
|
1334
|
-
id: "ActionFlagConfig",
|
|
1335
|
-
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
1336
|
-
});
|
|
1459
|
+
var Action = z15.union([ActionDocument, AsyncRejectActionDocument]);
|
|
1337
1460
|
|
|
1338
1461
|
// ../commons/src/events/EventMetadata.ts
|
|
1339
1462
|
var EventStatus = z16.enum([
|
|
@@ -1491,13 +1614,6 @@ var Range = import_v4.z.object({
|
|
|
1491
1614
|
}).meta({
|
|
1492
1615
|
id: "Range"
|
|
1493
1616
|
});
|
|
1494
|
-
var ContainsFlags = import_v4.z.object({
|
|
1495
|
-
anyOf: import_v4.z.array(Flag).optional(),
|
|
1496
|
-
noneOf: import_v4.z.array(Flag).optional(),
|
|
1497
|
-
allOf: import_v4.z.array(Flag).optional()
|
|
1498
|
-
}).meta({
|
|
1499
|
-
id: "ContainsFlags"
|
|
1500
|
-
});
|
|
1501
1617
|
var Within = import_v4.z.object({ type: import_v4.z.literal("within"), location: import_v4.z.string() }).meta({
|
|
1502
1618
|
id: "Within"
|
|
1503
1619
|
});
|
|
@@ -1724,8 +1840,8 @@ var BaseField = import_v43.default.object({
|
|
|
1724
1840
|
conditionals: import_v43.default.array(FieldConditional).default([]).optional().describe(
|
|
1725
1841
|
"Conditions determining when the field is shown or enabled. By default, the field is always shown and enabled."
|
|
1726
1842
|
),
|
|
1727
|
-
secured: import_v43.default.boolean().default(false).optional().describe(
|
|
1728
|
-
"Indicates whether the field is secured. Secured fields are not indexed for search and are only visible when explicitly assigned."
|
|
1843
|
+
secured: import_v43.default.union([import_v43.default.boolean(), Conditional]).default(false).optional().describe(
|
|
1844
|
+
"Indicates whether the field is secured, either always (boolean) or conditionally, evaluated against the event (a JSONSchema conditional, e.g. flag('sealed')). Secured fields are not indexed for search and are only visible when explicitly assigned."
|
|
1729
1845
|
),
|
|
1730
1846
|
placeholder: TranslationConfig.optional(),
|
|
1731
1847
|
validation: import_v43.default.array(ValidationConfig).default([]).optional().describe("Additional validation rules applied to the field."),
|
|
@@ -2123,7 +2239,13 @@ var AdministrativeAreaField = BaseField.extend({
|
|
|
2123
2239
|
configuration: import_v43.default.object({
|
|
2124
2240
|
partOf: FieldReference.optional().describe("Parent location"),
|
|
2125
2241
|
type: AdministrativeAreas,
|
|
2126
|
-
allowedLocations: AllowedLocations
|
|
2242
|
+
allowedLocations: AllowedLocations,
|
|
2243
|
+
listHistoricalNames: import_v43.default.boolean().optional().describe(
|
|
2244
|
+
"Advanced search: list every historical name a location has had as a separate, selectable option."
|
|
2245
|
+
),
|
|
2246
|
+
activeOnly: import_v43.default.boolean().optional().describe(
|
|
2247
|
+
"Advanced search: offer only currently-active locations; inactivated ones are excluded."
|
|
2248
|
+
)
|
|
2127
2249
|
}).describe("Administrative area options")
|
|
2128
2250
|
}).meta({
|
|
2129
2251
|
description: "Administrative area input field",
|
|
@@ -2134,7 +2256,10 @@ var LocationInput = BaseField.extend({
|
|
|
2134
2256
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
|
|
2135
2257
|
configuration: import_v43.default.object({
|
|
2136
2258
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
2137
|
-
allowedLocations: AllowedLocations
|
|
2259
|
+
allowedLocations: AllowedLocations,
|
|
2260
|
+
listHistoricalNames: import_v43.default.boolean().optional().describe(
|
|
2261
|
+
"Advanced search: list every historical name a location has had as a separate, selectable option."
|
|
2262
|
+
)
|
|
2138
2263
|
}).optional()
|
|
2139
2264
|
}).meta({
|
|
2140
2265
|
description: "A field for selecting a location",
|
|
@@ -2160,12 +2285,18 @@ var FileUploadWithOptions = BaseField.extend({
|
|
|
2160
2285
|
var Facility = BaseField.extend({
|
|
2161
2286
|
type: import_v43.default.literal(FieldType.FACILITY),
|
|
2162
2287
|
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
2163
|
-
configuration: import_v43.default.object({
|
|
2288
|
+
configuration: import_v43.default.object({
|
|
2289
|
+
allowedLocations: AllowedLocations,
|
|
2290
|
+
listHistoricalNames: import_v43.default.boolean().optional()
|
|
2291
|
+
}).optional()
|
|
2164
2292
|
}).describe("Input field for a facility");
|
|
2165
2293
|
var Office = BaseField.extend({
|
|
2166
2294
|
type: import_v43.default.literal(FieldType.OFFICE),
|
|
2167
2295
|
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
2168
|
-
configuration: import_v43.default.object({
|
|
2296
|
+
configuration: import_v43.default.object({
|
|
2297
|
+
allowedLocations: AllowedLocations,
|
|
2298
|
+
listHistoricalNames: import_v43.default.boolean().optional()
|
|
2299
|
+
}).optional()
|
|
2169
2300
|
}).describe("Input field for an office");
|
|
2170
2301
|
var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
|
|
2171
2302
|
administrativeArea: import_v43.default.union([UUID, SerializedUserField]).optional()
|
|
@@ -2198,7 +2329,13 @@ var Address = BaseField.extend({
|
|
|
2198
2329
|
parent: FieldReference.optional()
|
|
2199
2330
|
})
|
|
2200
2331
|
).optional(),
|
|
2201
|
-
allowedLocations: AllowedLocations
|
|
2332
|
+
allowedLocations: AllowedLocations,
|
|
2333
|
+
listHistoricalNames: import_v43.default.boolean().optional().describe(
|
|
2334
|
+
"Advanced search: list every historical name a location has had as a separate, selectable option. Propagated to the embedded admin-area selectors."
|
|
2335
|
+
),
|
|
2336
|
+
activeOnly: import_v43.default.boolean().optional().describe(
|
|
2337
|
+
"Advanced search: offer only currently-active admin areas; inactivated ones are excluded. Propagated to the embedded admin-area selectors."
|
|
2338
|
+
)
|
|
2202
2339
|
}).optional(),
|
|
2203
2340
|
defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
|
|
2204
2341
|
}).meta({
|
|
@@ -2681,6 +2818,9 @@ var ActionConfigBase = z24.object({
|
|
|
2681
2818
|
var DeclarationActionBase = ActionConfigBase.extend({
|
|
2682
2819
|
deduplication: DeduplicationConfig.optional()
|
|
2683
2820
|
});
|
|
2821
|
+
var actionConfirmationForm = z24.array(FieldConfig).optional().describe(
|
|
2822
|
+
"Fields rendered on the action confirmation dialog. Submitted values are stored in the action annotation and shown in the audit history."
|
|
2823
|
+
);
|
|
2684
2824
|
var ReadActionConfig = ActionConfigBase.extend(
|
|
2685
2825
|
z24.object({
|
|
2686
2826
|
type: z24.literal(ActionType.READ),
|
|
@@ -2692,7 +2832,54 @@ var ReadActionConfig = ActionConfigBase.extend(
|
|
|
2692
2832
|
);
|
|
2693
2833
|
var NotifyConfig = ActionConfigBase.extend(
|
|
2694
2834
|
z24.object({
|
|
2695
|
-
type: z24.literal(ActionType.NOTIFY)
|
|
2835
|
+
type: z24.literal(ActionType.NOTIFY),
|
|
2836
|
+
form: actionConfirmationForm
|
|
2837
|
+
}).shape
|
|
2838
|
+
);
|
|
2839
|
+
var DuplicateDetectedConfig = ActionConfigBase.extend(
|
|
2840
|
+
z24.object({
|
|
2841
|
+
type: z24.literal(ActionType.DUPLICATE_DETECTED),
|
|
2842
|
+
label: z24.never().optional().describe(
|
|
2843
|
+
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no label."
|
|
2844
|
+
),
|
|
2845
|
+
supportingCopy: z24.never().optional(),
|
|
2846
|
+
icon: z24.never().optional().describe(
|
|
2847
|
+
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no icon."
|
|
2848
|
+
),
|
|
2849
|
+
conditionals: z24.never().optional().describe(
|
|
2850
|
+
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it cannot be disabled or hidden with conditionals."
|
|
2851
|
+
)
|
|
2852
|
+
}).shape
|
|
2853
|
+
);
|
|
2854
|
+
var MarkAsDuplicateConfig = ActionConfigBase.extend(
|
|
2855
|
+
z24.object({
|
|
2856
|
+
type: z24.literal(ActionType.MARK_AS_DUPLICATE)
|
|
2857
|
+
}).shape
|
|
2858
|
+
);
|
|
2859
|
+
var MarkAsNotDuplicateConfig = ActionConfigBase.extend(
|
|
2860
|
+
z24.object({
|
|
2861
|
+
type: z24.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
2862
|
+
}).shape
|
|
2863
|
+
);
|
|
2864
|
+
var AssignConfig = ActionConfigBase.extend(
|
|
2865
|
+
z24.object({
|
|
2866
|
+
type: z24.literal(ActionType.ASSIGN),
|
|
2867
|
+
flags: z24.never().optional().describe(
|
|
2868
|
+
"ASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
|
|
2869
|
+
)
|
|
2870
|
+
}).shape
|
|
2871
|
+
);
|
|
2872
|
+
var UnassignConfig = ActionConfigBase.extend(
|
|
2873
|
+
z24.object({
|
|
2874
|
+
type: z24.literal(ActionType.UNASSIGN),
|
|
2875
|
+
flags: z24.never().optional().describe(
|
|
2876
|
+
"UNASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
|
|
2877
|
+
)
|
|
2878
|
+
}).shape
|
|
2879
|
+
);
|
|
2880
|
+
var DeleteConfig = ActionConfigBase.extend(
|
|
2881
|
+
z24.object({
|
|
2882
|
+
type: z24.literal(ActionType.DELETE)
|
|
2696
2883
|
}).shape
|
|
2697
2884
|
);
|
|
2698
2885
|
var DeclareConfig = DeclarationActionBase.extend(
|
|
@@ -2701,6 +2888,7 @@ var DeclareConfig = DeclarationActionBase.extend(
|
|
|
2701
2888
|
review: DeclarationReviewConfig.describe(
|
|
2702
2889
|
"Configuration of the review page fields."
|
|
2703
2890
|
),
|
|
2891
|
+
form: actionConfirmationForm,
|
|
2704
2892
|
dialogCopy: z24.object({
|
|
2705
2893
|
notify: TranslationConfig.describe(
|
|
2706
2894
|
"Confirmation text for the notify action"
|
|
@@ -2716,7 +2904,13 @@ var DeclareConfig = DeclarationActionBase.extend(
|
|
|
2716
2904
|
);
|
|
2717
2905
|
var ArchiveConfig = ActionConfigBase.extend(
|
|
2718
2906
|
z24.object({
|
|
2719
|
-
type: z24.literal(ActionType.ARCHIVE)
|
|
2907
|
+
type: z24.literal(ActionType.ARCHIVE),
|
|
2908
|
+
form: actionConfirmationForm
|
|
2909
|
+
}).shape
|
|
2910
|
+
);
|
|
2911
|
+
var UnarchiveConfig = ActionConfigBase.extend(
|
|
2912
|
+
z24.object({
|
|
2913
|
+
type: z24.literal(ActionType.UNARCHIVE)
|
|
2720
2914
|
}).shape
|
|
2721
2915
|
);
|
|
2722
2916
|
var EditActionConfig = ActionConfigBase.extend(
|
|
@@ -2737,12 +2931,14 @@ var EditActionConfig = ActionConfigBase.extend(
|
|
|
2737
2931
|
);
|
|
2738
2932
|
var RejectConfig = ActionConfigBase.extend(
|
|
2739
2933
|
z24.object({
|
|
2740
|
-
type: z24.literal(ActionType.REJECT)
|
|
2934
|
+
type: z24.literal(ActionType.REJECT),
|
|
2935
|
+
form: actionConfirmationForm
|
|
2741
2936
|
}).shape
|
|
2742
2937
|
);
|
|
2743
2938
|
var RegisterConfig = DeclarationActionBase.extend(
|
|
2744
2939
|
z24.object({
|
|
2745
|
-
type: z24.literal(ActionType.REGISTER)
|
|
2940
|
+
type: z24.literal(ActionType.REGISTER),
|
|
2941
|
+
form: actionConfirmationForm
|
|
2746
2942
|
}).shape
|
|
2747
2943
|
);
|
|
2748
2944
|
var PrintCertificateActionConfig = ActionConfigBase.extend(
|
|
@@ -2757,7 +2953,17 @@ var RequestCorrectionConfig = ActionConfigBase.extend(
|
|
|
2757
2953
|
correctionForm: ActionFormConfig
|
|
2758
2954
|
}).shape
|
|
2759
2955
|
);
|
|
2760
|
-
var
|
|
2956
|
+
var ApproveCorrectionConfig = ActionConfigBase.extend(
|
|
2957
|
+
z24.object({
|
|
2958
|
+
type: z24.literal(ActionType.APPROVE_CORRECTION)
|
|
2959
|
+
}).shape
|
|
2960
|
+
);
|
|
2961
|
+
var RejectCorrectionConfig = ActionConfigBase.extend(
|
|
2962
|
+
z24.object({
|
|
2963
|
+
type: z24.literal(ActionType.REJECT_CORRECTION)
|
|
2964
|
+
}).shape
|
|
2965
|
+
);
|
|
2966
|
+
var CustomActionConfig = ActionConfigBase.extend(
|
|
2761
2967
|
z24.object({
|
|
2762
2968
|
type: z24.literal(ActionType.CUSTOM),
|
|
2763
2969
|
customActionType: z24.string().describe("Type identifier of the custom action."),
|
|
@@ -2768,7 +2974,7 @@ var CustomActionConfig = ActionConfigBase.merge(
|
|
|
2768
2974
|
auditHistoryLabel: TranslationConfig.describe(
|
|
2769
2975
|
'The label to show in audit history for this action. For example "Approved".'
|
|
2770
2976
|
)
|
|
2771
|
-
})
|
|
2977
|
+
}).shape
|
|
2772
2978
|
);
|
|
2773
2979
|
var ActionConfig = z24.discriminatedUnion("type", [
|
|
2774
2980
|
/*
|
|
@@ -2779,6 +2985,18 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
2779
2985
|
id: "ReadActionConfig",
|
|
2780
2986
|
description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
|
|
2781
2987
|
}),
|
|
2988
|
+
AssignConfig.meta({
|
|
2989
|
+
id: "AssignActionConfig",
|
|
2990
|
+
description: "Configuration for assigning a record to the current user."
|
|
2991
|
+
}),
|
|
2992
|
+
UnassignConfig.meta({
|
|
2993
|
+
id: "UnassignActionConfig",
|
|
2994
|
+
description: "Configuration for unassigning a record from its current assignee."
|
|
2995
|
+
}),
|
|
2996
|
+
DeleteConfig.meta({
|
|
2997
|
+
id: "DeleteActionConfig",
|
|
2998
|
+
description: "Configuration for deleting a draft record."
|
|
2999
|
+
}),
|
|
2782
3000
|
NotifyConfig.meta({
|
|
2783
3001
|
id: "NotifyActionConfig",
|
|
2784
3002
|
description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
|
|
@@ -2787,6 +3005,18 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
2787
3005
|
id: "DeclareActionConfig",
|
|
2788
3006
|
description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
|
|
2789
3007
|
}),
|
|
3008
|
+
DuplicateDetectedConfig.meta({
|
|
3009
|
+
id: "DuplicateDetectedActionConfig",
|
|
3010
|
+
description: "Configuration for the system-generated duplicate-detection action. Never shown as a button, so it only supports flags \u2014 not label, icon, or conditionals."
|
|
3011
|
+
}),
|
|
3012
|
+
MarkAsDuplicateConfig.meta({
|
|
3013
|
+
id: "MarkAsDuplicateActionConfig",
|
|
3014
|
+
description: "Configuration for marking a record as a duplicate."
|
|
3015
|
+
}),
|
|
3016
|
+
MarkAsNotDuplicateConfig.meta({
|
|
3017
|
+
id: "MarkAsNotDuplicateActionConfig",
|
|
3018
|
+
description: "Configuration for marking a record as not a duplicate, after it was previously flagged as one."
|
|
3019
|
+
}),
|
|
2790
3020
|
RejectConfig.meta({
|
|
2791
3021
|
id: "RejectActionConfig",
|
|
2792
3022
|
description: "Configuration for rejecting a record before registration."
|
|
@@ -2803,6 +3033,14 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
2803
3033
|
id: "RequestCorrectionActionConfig",
|
|
2804
3034
|
description: "Configuration for requesting a correction on a registered record."
|
|
2805
3035
|
}),
|
|
3036
|
+
ApproveCorrectionConfig.meta({
|
|
3037
|
+
id: "ApproveCorrectionActionConfig",
|
|
3038
|
+
description: "Configuration for approving a requested correction."
|
|
3039
|
+
}),
|
|
3040
|
+
RejectCorrectionConfig.meta({
|
|
3041
|
+
id: "RejectCorrectionActionConfig",
|
|
3042
|
+
description: "Configuration for rejecting a requested correction."
|
|
3043
|
+
}),
|
|
2806
3044
|
EditActionConfig.meta({
|
|
2807
3045
|
id: "EditActionConfig",
|
|
2808
3046
|
description: "Configuration for editing a record before registration."
|
|
@@ -2811,6 +3049,10 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
2811
3049
|
id: "ArchiveActionConfig",
|
|
2812
3050
|
description: "Configuration for archiving a record."
|
|
2813
3051
|
}),
|
|
3052
|
+
UnarchiveConfig.meta({
|
|
3053
|
+
id: "UnarchiveActionConfig",
|
|
3054
|
+
description: "Configuration for unarchiving a record."
|
|
3055
|
+
}),
|
|
2814
3056
|
CustomActionConfig.meta({
|
|
2815
3057
|
id: "CustomActionConfig",
|
|
2816
3058
|
description: "Configuration for a country-defined custom action. An event may include any number of these."
|
|
@@ -2865,45 +3107,181 @@ var LanguageConfig = z26.object({
|
|
|
2865
3107
|
});
|
|
2866
3108
|
|
|
2867
3109
|
// ../commons/src/events/EventConfig.ts
|
|
2868
|
-
var
|
|
3110
|
+
var z34 = __toESM(require("zod/v4"));
|
|
2869
3111
|
|
|
2870
3112
|
// ../commons/src/events/SummaryConfig.ts
|
|
3113
|
+
var z28 = __toESM(require("zod/v4"));
|
|
3114
|
+
|
|
3115
|
+
// ../commons/src/icons.ts
|
|
2871
3116
|
var z27 = __toESM(require("zod/v4"));
|
|
2872
|
-
var
|
|
3117
|
+
var AvailableIcons = z27.enum([
|
|
3118
|
+
"Archived",
|
|
3119
|
+
"Assigned",
|
|
3120
|
+
"Briefcase",
|
|
3121
|
+
"Certified",
|
|
3122
|
+
"Close",
|
|
3123
|
+
"Collapse",
|
|
3124
|
+
"Draft",
|
|
3125
|
+
"DuplicateYellow",
|
|
3126
|
+
"Expand",
|
|
3127
|
+
"ExternalValidate",
|
|
3128
|
+
"FilledCheck",
|
|
3129
|
+
"InReview",
|
|
3130
|
+
"Offline",
|
|
3131
|
+
"Registered",
|
|
3132
|
+
"RequiresUpdates",
|
|
3133
|
+
"Sent",
|
|
3134
|
+
"Validated",
|
|
3135
|
+
"WaitingApproval",
|
|
3136
|
+
"ChartActivity",
|
|
3137
|
+
"Activity",
|
|
3138
|
+
"Archive",
|
|
3139
|
+
"ArchiveTray",
|
|
3140
|
+
"ArrowLeft",
|
|
3141
|
+
"ArrowRight",
|
|
3142
|
+
"Buildings",
|
|
3143
|
+
"Circle",
|
|
3144
|
+
"CaretDown",
|
|
3145
|
+
"CaretLeft",
|
|
3146
|
+
"CaretRight",
|
|
3147
|
+
"ChartBar",
|
|
3148
|
+
"ChartLine",
|
|
3149
|
+
"ChatCircle",
|
|
3150
|
+
"CheckSquare",
|
|
3151
|
+
"Compass",
|
|
3152
|
+
"Check",
|
|
3153
|
+
"Copy",
|
|
3154
|
+
"Database",
|
|
3155
|
+
"DotsThreeVertical",
|
|
3156
|
+
"ArrowCounterClockwise",
|
|
3157
|
+
"MagnifyingGlassMinus",
|
|
3158
|
+
"MagnifyingGlassPlus",
|
|
3159
|
+
"Export",
|
|
3160
|
+
"Eye",
|
|
3161
|
+
"EyeSlash",
|
|
3162
|
+
"Envelope",
|
|
3163
|
+
"File",
|
|
3164
|
+
"FileLock",
|
|
3165
|
+
"FileSearch",
|
|
3166
|
+
"FileMinus",
|
|
3167
|
+
"FilePlus",
|
|
3168
|
+
"FileText",
|
|
3169
|
+
"FileX",
|
|
3170
|
+
"Handshake",
|
|
3171
|
+
"Gear",
|
|
3172
|
+
"GitBranch",
|
|
3173
|
+
"IdentificationCard",
|
|
3174
|
+
"List",
|
|
3175
|
+
"ListBullets",
|
|
3176
|
+
"Lock",
|
|
3177
|
+
"MagnifyingGlass",
|
|
3178
|
+
"MapPin",
|
|
3179
|
+
"Medal",
|
|
3180
|
+
"NotePencil",
|
|
3181
|
+
"Paperclip",
|
|
3182
|
+
"PaperPlaneTilt",
|
|
3183
|
+
"Pen",
|
|
3184
|
+
"PenNib",
|
|
3185
|
+
"Pencil",
|
|
3186
|
+
"PencilSimpleLine",
|
|
3187
|
+
"Phone",
|
|
3188
|
+
"Plus",
|
|
3189
|
+
"Printer",
|
|
3190
|
+
"SignOut",
|
|
3191
|
+
"Stamp",
|
|
3192
|
+
"Star",
|
|
3193
|
+
"Target",
|
|
3194
|
+
"TextT",
|
|
3195
|
+
"Trash",
|
|
3196
|
+
"UploadSimple",
|
|
3197
|
+
"User",
|
|
3198
|
+
"UserPlus",
|
|
3199
|
+
"Users",
|
|
3200
|
+
"WarningCircle",
|
|
3201
|
+
"X",
|
|
3202
|
+
"ChatText",
|
|
3203
|
+
"CircleWavyCheck",
|
|
3204
|
+
"CircleWavyQuestion",
|
|
3205
|
+
"ArchiveBox",
|
|
3206
|
+
"ArrowCircleDown",
|
|
3207
|
+
"FileArrowUp",
|
|
3208
|
+
"FileDotted",
|
|
3209
|
+
"Files",
|
|
3210
|
+
"PencilLine",
|
|
3211
|
+
"PencilCircle",
|
|
3212
|
+
"UserCircle",
|
|
3213
|
+
"Clock",
|
|
3214
|
+
"QrCode",
|
|
3215
|
+
"Webcam",
|
|
3216
|
+
"Sun",
|
|
3217
|
+
"DeviceTabletCamera",
|
|
3218
|
+
"Globe",
|
|
3219
|
+
"Fingerprint",
|
|
3220
|
+
"PushPin",
|
|
3221
|
+
"Timer"
|
|
3222
|
+
]);
|
|
3223
|
+
|
|
3224
|
+
// ../commons/src/events/SummaryConfig.ts
|
|
3225
|
+
var InfoBox = z28.object({
|
|
3226
|
+
type: z28.enum(["info", "positive", "warning", "negative"]).describe(
|
|
3227
|
+
"Semantic tint of the icon block: info (blue), positive (green), warning (orange), negative (red)."
|
|
3228
|
+
),
|
|
3229
|
+
background: z28.enum(["tinted", "white"]).default("tinted").optional().describe(
|
|
3230
|
+
"tinted reads as a recessed empty state; white reads as a standalone card."
|
|
3231
|
+
),
|
|
3232
|
+
icon: AvailableIcons.optional().describe(
|
|
3233
|
+
"Icon displayed inside the icon block. Defaults to FileSearch."
|
|
3234
|
+
),
|
|
3235
|
+
heading: TranslationConfig.describe(
|
|
3236
|
+
"Primary message. Short, sentence-case."
|
|
3237
|
+
),
|
|
3238
|
+
description: TranslationConfig.optional().describe(
|
|
3239
|
+
"Secondary copy displayed below the heading, typically a suggested next step."
|
|
3240
|
+
),
|
|
3241
|
+
conditionals: z28.array(ShowConditional).default([]).optional().describe(
|
|
3242
|
+
"Conditions under which the info box is shown. When omitted, it is always shown."
|
|
3243
|
+
)
|
|
3244
|
+
}).describe(
|
|
3245
|
+
"A compact icon-block + heading + description block displayed above the summary fields in the event overview."
|
|
3246
|
+
);
|
|
3247
|
+
var BaseField2 = z28.object({
|
|
2873
3248
|
emptyValueMessage: TranslationConfig.optional().describe(
|
|
2874
3249
|
"Default message displayed when the field value is empty."
|
|
2875
3250
|
),
|
|
2876
|
-
conditionals:
|
|
3251
|
+
conditionals: z28.array(ShowConditional).default([]).optional()
|
|
2877
3252
|
});
|
|
2878
3253
|
var ReferenceField = BaseField2.extend({
|
|
2879
|
-
fieldId:
|
|
3254
|
+
fieldId: z28.string(),
|
|
2880
3255
|
label: TranslationConfig.optional().describe(
|
|
2881
3256
|
"Overrides the default label from the referenced field when provided."
|
|
2882
3257
|
)
|
|
2883
3258
|
}).describe("Field referencing existing event data by field ID.");
|
|
2884
3259
|
var Field = BaseField2.extend({
|
|
2885
|
-
id:
|
|
3260
|
+
id: z28.string().describe("Identifier of the summary field."),
|
|
2886
3261
|
value: TranslationConfig.describe(
|
|
2887
3262
|
'Field value template supporting variables from configuration and EventMetadata (e.g. "{informant.phoneNo} {informant.email}").'
|
|
2888
3263
|
),
|
|
2889
3264
|
label: TranslationConfig
|
|
2890
3265
|
}).describe("Custom field defined for the summary view.");
|
|
2891
|
-
var SummaryConfig =
|
|
2892
|
-
|
|
3266
|
+
var SummaryConfig = z28.object({
|
|
3267
|
+
banners: z28.array(InfoBox).default([]).optional().describe(
|
|
3268
|
+
"Info boxes displayed above the summary fields in the event overview."
|
|
3269
|
+
),
|
|
3270
|
+
fields: z28.array(z28.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
|
|
2893
3271
|
}).meta({
|
|
2894
3272
|
id: "SummaryConfig",
|
|
2895
3273
|
description: "Configuration of the event overview page. Defines which declaration fields appear in the record summary, optionally with custom labels, empty-value messages, and templated values."
|
|
2896
3274
|
});
|
|
2897
3275
|
|
|
2898
3276
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
|
2899
|
-
var
|
|
2900
|
-
var MatchType =
|
|
2901
|
-
var BaseField3 =
|
|
2902
|
-
config:
|
|
3277
|
+
var z29 = __toESM(require("zod/v4"));
|
|
3278
|
+
var MatchType = z29.enum(["fuzzy", "exact", "range", "within"]);
|
|
3279
|
+
var BaseField3 = z29.object({
|
|
3280
|
+
config: z29.object({
|
|
2903
3281
|
type: MatchType.describe(
|
|
2904
3282
|
"Determines the search type of field. How to match value."
|
|
2905
3283
|
),
|
|
2906
|
-
searchFields:
|
|
3284
|
+
searchFields: z29.array(z29.string()).optional().describe(
|
|
2907
3285
|
`
|
|
2908
3286
|
Defines multiple form fields that should be searched when this field has a value.
|
|
2909
3287
|
All specified fields will be combined using OR logic.
|
|
@@ -2913,7 +3291,7 @@ var BaseField3 = z28.object({
|
|
|
2913
3291
|
`
|
|
2914
3292
|
)
|
|
2915
3293
|
}),
|
|
2916
|
-
type:
|
|
3294
|
+
type: z29.nativeEnum(FieldType).optional().describe(
|
|
2917
3295
|
`
|
|
2918
3296
|
Explicitly specify the field type for searchFields.
|
|
2919
3297
|
This is required when searchFields is defined, to show the correct control in the UI.
|
|
@@ -2927,7 +3305,7 @@ var BaseField3 = z28.object({
|
|
|
2927
3305
|
This is required when searchFields is defined.
|
|
2928
3306
|
`
|
|
2929
3307
|
),
|
|
2930
|
-
options:
|
|
3308
|
+
options: z29.array(SelectOption).optional(),
|
|
2931
3309
|
searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
|
|
2932
3310
|
`
|
|
2933
3311
|
This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
|
|
@@ -2948,7 +3326,7 @@ var BaseField3 = z28.object({
|
|
|
2948
3326
|
in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
|
|
2949
3327
|
`
|
|
2950
3328
|
),
|
|
2951
|
-
conditionals:
|
|
3329
|
+
conditionals: z29.array(FieldConditional).optional().describe(
|
|
2952
3330
|
`
|
|
2953
3331
|
In advanced search, we sometimes need to override the default field visibility conditionals.
|
|
2954
3332
|
|
|
@@ -2962,23 +3340,23 @@ var BaseField3 = z28.object({
|
|
|
2962
3340
|
are always rendered in the advanced search form.
|
|
2963
3341
|
`
|
|
2964
3342
|
),
|
|
2965
|
-
validations:
|
|
3343
|
+
validations: z29.array(ValidationConfig).optional().describe(
|
|
2966
3344
|
`Option for overriding the field validations specifically for advanced search form.`
|
|
2967
3345
|
),
|
|
2968
3346
|
allowedLocations: JurisdictionReference.optional().describe(
|
|
2969
3347
|
`Override the allowedLocations for a location field in advanced search. Use this when the declaration form's allowedLocations references a scope (e.g. record.create) that search-only users don't have \u2014 specify record.search scope instead.`
|
|
2970
3348
|
)
|
|
2971
3349
|
});
|
|
2972
|
-
var SearchQueryParams =
|
|
2973
|
-
eventType:
|
|
3350
|
+
var SearchQueryParams = z29.object({
|
|
3351
|
+
eventType: z29.string().optional().describe(
|
|
2974
3352
|
"Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
|
|
2975
3353
|
)
|
|
2976
3354
|
}).catchall(FieldValue);
|
|
2977
3355
|
var FieldConfigSchema = BaseField3.extend({
|
|
2978
|
-
fieldId:
|
|
2979
|
-
fieldType:
|
|
3356
|
+
fieldId: z29.string(),
|
|
3357
|
+
fieldType: z29.literal("field")
|
|
2980
3358
|
});
|
|
2981
|
-
var EventFieldIdInput =
|
|
3359
|
+
var EventFieldIdInput = z29.enum([
|
|
2982
3360
|
"trackingId",
|
|
2983
3361
|
"status",
|
|
2984
3362
|
"legalStatuses.REGISTERED.acceptedAt",
|
|
@@ -2987,7 +3365,7 @@ var EventFieldIdInput = z28.enum([
|
|
|
2987
3365
|
"updatedAt"
|
|
2988
3366
|
]);
|
|
2989
3367
|
var METADATA_FIELD_PREFIX = "event.";
|
|
2990
|
-
var EventFieldId =
|
|
3368
|
+
var EventFieldId = z29.enum([
|
|
2991
3369
|
`${METADATA_FIELD_PREFIX}trackingId`,
|
|
2992
3370
|
`${METADATA_FIELD_PREFIX}status`,
|
|
2993
3371
|
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
|
|
@@ -2997,190 +3375,64 @@ var EventFieldId = z28.enum([
|
|
|
2997
3375
|
]);
|
|
2998
3376
|
var EventFieldConfigSchema = BaseField3.extend({
|
|
2999
3377
|
fieldId: EventFieldId,
|
|
3000
|
-
fieldType:
|
|
3378
|
+
fieldType: z29.literal("event")
|
|
3001
3379
|
});
|
|
3002
|
-
var AdvancedSearchField =
|
|
3380
|
+
var AdvancedSearchField = z29.discriminatedUnion("fieldType", [FieldConfigSchema, EventFieldConfigSchema]).superRefine((data, ctx) => {
|
|
3003
3381
|
if (data.config.searchFields && data.config.searchFields.length > 0) {
|
|
3004
3382
|
if (!data.label) {
|
|
3005
3383
|
ctx.addIssue({
|
|
3006
|
-
code:
|
|
3384
|
+
code: z29.ZodIssueCode.custom,
|
|
3007
3385
|
message: "label is required when config.searchFields is defined.",
|
|
3008
3386
|
path: ["label"]
|
|
3009
3387
|
});
|
|
3010
3388
|
}
|
|
3011
3389
|
if (!data.type) {
|
|
3012
3390
|
ctx.addIssue({
|
|
3013
|
-
code:
|
|
3391
|
+
code: z29.ZodIssueCode.custom,
|
|
3014
3392
|
message: "type is required when config.searchFields is defined.",
|
|
3015
3393
|
path: ["type"]
|
|
3016
3394
|
});
|
|
3017
3395
|
}
|
|
3018
3396
|
}
|
|
3019
3397
|
});
|
|
3020
|
-
var AdvancedSearchConfig =
|
|
3398
|
+
var AdvancedSearchConfig = z29.object({
|
|
3021
3399
|
title: TranslationConfig.describe("Advanced search tab title"),
|
|
3022
|
-
fields:
|
|
3400
|
+
fields: z29.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
|
|
3023
3401
|
}).meta({
|
|
3024
3402
|
id: "AdvancedSearchConfig",
|
|
3025
3403
|
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()`)."
|
|
3026
3404
|
});
|
|
3027
3405
|
|
|
3028
3406
|
// ../commons/src/events/utils.ts
|
|
3029
|
-
var
|
|
3407
|
+
var import_lodash4 = require("lodash");
|
|
3030
3408
|
|
|
3031
3409
|
// ../commons/src/conditionals/validate.ts
|
|
3032
3410
|
var import__ = __toESM(require("ajv/dist/2019"));
|
|
3033
3411
|
var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
3034
|
-
var
|
|
3035
|
-
var
|
|
3412
|
+
var z33 = __toESM(require("zod/v4"));
|
|
3413
|
+
var import_date_fns2 = require("date-fns");
|
|
3036
3414
|
|
|
3037
3415
|
// ../commons/src/events/FieldTypeMapping.ts
|
|
3038
|
-
var
|
|
3416
|
+
var z31 = __toESM(require("zod/v4"));
|
|
3039
3417
|
|
|
3040
3418
|
// ../commons/src/events/DynamicFieldValue.ts
|
|
3041
|
-
var
|
|
3419
|
+
var z30 = __toESM(require("zod/v4"));
|
|
3042
3420
|
|
|
3043
|
-
// ../commons/src/
|
|
3044
|
-
var
|
|
3045
|
-
$data: true,
|
|
3046
|
-
allowUnionTypes: true,
|
|
3047
|
-
strict: false
|
|
3048
|
-
// Allow minContains and other newer features
|
|
3049
|
-
});
|
|
3050
|
-
var DataContext = z31.object({
|
|
3051
|
-
rootData: z31.object({
|
|
3052
|
-
$leafAdminStructureLocationIds: z31.array(z31.object({ id: UUID }))
|
|
3053
|
-
})
|
|
3054
|
-
});
|
|
3055
|
-
function resolveDataPath(rootData, dataPath, instancePath) {
|
|
3056
|
-
const pathParts = dataPath.split("/");
|
|
3057
|
-
const levels = parseInt(pathParts[0], 10);
|
|
3058
|
-
const referencePath = pathParts.slice(1);
|
|
3059
|
-
const instanceParts = instancePath.split("/").filter(Boolean);
|
|
3060
|
-
const traversedParts = instanceParts.slice(0, -levels);
|
|
3061
|
-
let current = rootData;
|
|
3062
|
-
for (const part of traversedParts) {
|
|
3063
|
-
if (current === null || current === void 0) {
|
|
3064
|
-
return void 0;
|
|
3065
|
-
}
|
|
3066
|
-
current = current[part];
|
|
3067
|
-
}
|
|
3068
|
-
for (const part of referencePath) {
|
|
3069
|
-
if (current === null || current === void 0) {
|
|
3070
|
-
return void 0;
|
|
3071
|
-
}
|
|
3072
|
-
current = current[part];
|
|
3073
|
-
}
|
|
3074
|
-
return current;
|
|
3075
|
-
}
|
|
3076
|
-
function todayISO() {
|
|
3077
|
-
return (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
|
|
3078
|
-
}
|
|
3079
|
-
var compiledFunctionCache = /* @__PURE__ */ new Map();
|
|
3080
|
-
function compileClientFunction(code) {
|
|
3081
|
-
let fn = compiledFunctionCache.get(code);
|
|
3082
|
-
if (!fn) {
|
|
3083
|
-
fn = new Function(`return (${code})`)();
|
|
3084
|
-
compiledFunctionCache.set(code, fn);
|
|
3085
|
-
}
|
|
3086
|
-
return fn;
|
|
3087
|
-
}
|
|
3088
|
-
(0, import_ajv_formats.default)(ajv);
|
|
3089
|
-
function buildClientFunctionContext(input) {
|
|
3090
|
-
return {
|
|
3091
|
-
$form: input.form,
|
|
3092
|
-
$now: todayISO(),
|
|
3093
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
3094
|
-
$online: isOnline(),
|
|
3095
|
-
$user: input.validatorContext?.user,
|
|
3096
|
-
$event: input.validatorContext?.event,
|
|
3097
|
-
$leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
|
|
3098
|
-
user: input.systemVariables?.user,
|
|
3099
|
-
$window: input.systemVariables?.$window,
|
|
3100
|
-
locations: input.locations,
|
|
3101
|
-
adminLevelIds: input.adminLevelIds
|
|
3102
|
-
};
|
|
3103
|
-
}
|
|
3104
|
-
function runClientFunction(code, data, context) {
|
|
3105
|
-
return compileClientFunction(code)(data, context);
|
|
3106
|
-
}
|
|
3107
|
-
ajv.addKeyword({
|
|
3108
|
-
keyword: "daysFromDate",
|
|
3109
|
-
type: "string",
|
|
3110
|
-
schemaType: "object",
|
|
3111
|
-
$data: true,
|
|
3112
|
-
errors: true,
|
|
3113
|
-
validate(schema, data, _2, dataContext) {
|
|
3114
|
-
if (!(dataContext && dataContext.rootData && typeof dataContext.rootData === "object" && "$now" in dataContext.rootData && typeof dataContext.rootData.$now === "string")) {
|
|
3115
|
-
throw new Error("Validation context must contain $now");
|
|
3116
|
-
}
|
|
3117
|
-
const { days, clause } = schema;
|
|
3118
|
-
if (typeof data !== "string") {
|
|
3119
|
-
return false;
|
|
3120
|
-
}
|
|
3121
|
-
const date = new Date(data);
|
|
3122
|
-
if (isNaN(date.getTime())) {
|
|
3123
|
-
return false;
|
|
3124
|
-
}
|
|
3125
|
-
let referenceDate = schema.referenceDate;
|
|
3126
|
-
if (referenceDate && typeof referenceDate === "object" && "$data" in referenceDate) {
|
|
3127
|
-
referenceDate = resolveDataPath(
|
|
3128
|
-
dataContext.rootData,
|
|
3129
|
-
referenceDate.$data,
|
|
3130
|
-
dataContext.instancePath
|
|
3131
|
-
);
|
|
3132
|
-
}
|
|
3133
|
-
if (!referenceDate) {
|
|
3134
|
-
referenceDate = dataContext.rootData.$now;
|
|
3135
|
-
}
|
|
3136
|
-
const baseDate = new Date(referenceDate);
|
|
3137
|
-
if (isNaN(baseDate.getTime())) {
|
|
3138
|
-
return false;
|
|
3139
|
-
}
|
|
3140
|
-
const offsetDate = new Date(baseDate.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
3141
|
-
return clause === "after" ? (0, import_date_fns.isAfter)(date, offsetDate) : (0, import_date_fns.isBefore)(date, offsetDate);
|
|
3142
|
-
}
|
|
3143
|
-
});
|
|
3144
|
-
ajv.addKeyword({
|
|
3145
|
-
keyword: "isLeafLevelLocation",
|
|
3146
|
-
type: "string",
|
|
3147
|
-
schemaType: "boolean",
|
|
3148
|
-
$data: true,
|
|
3149
|
-
errors: true,
|
|
3150
|
-
// @ts-ignore -- Force type. We will move this away from AJV next. Parsing the array will take seconds and is only called by core.
|
|
3151
|
-
validate(_schema, data, _2, dataContext) {
|
|
3152
|
-
const locationIdInput = data;
|
|
3153
|
-
const locations = dataContext?.rootData.$leafAdminStructureLocationIds ?? [];
|
|
3154
|
-
return locations.some((location) => location.id === locationIdInput);
|
|
3155
|
-
}
|
|
3156
|
-
});
|
|
3157
|
-
ajv.addKeyword({
|
|
3158
|
-
keyword: "customClientValidator",
|
|
3159
|
-
schemaType: "object",
|
|
3160
|
-
errors: true,
|
|
3161
|
-
// @ts-expect-error -- AJV's public types don't expose `rootData`. All
|
|
3162
|
-
// `validate()` callers build root data via `buildClientFunctionContext`,
|
|
3163
|
-
// so the cast holds.
|
|
3164
|
-
validate(schema, data, _2, dataContext) {
|
|
3165
|
-
return Boolean(
|
|
3166
|
-
runClientFunction(
|
|
3167
|
-
schema.code,
|
|
3168
|
-
data,
|
|
3169
|
-
dataContext?.rootData ?? buildClientFunctionContext({ form: {} })
|
|
3170
|
-
)
|
|
3171
|
-
);
|
|
3172
|
-
}
|
|
3173
|
-
});
|
|
3174
|
-
function isOnline() {
|
|
3175
|
-
if (typeof window !== "undefined" && typeof navigator !== "undefined") {
|
|
3176
|
-
return navigator.onLine;
|
|
3177
|
-
}
|
|
3178
|
-
return true;
|
|
3179
|
-
}
|
|
3421
|
+
// ../commons/src/events/state/index.ts
|
|
3422
|
+
var import_lodash3 = require("lodash");
|
|
3180
3423
|
|
|
3181
3424
|
// ../commons/src/utils.ts
|
|
3182
3425
|
var z32 = __toESM(require("zod/v4"));
|
|
3183
3426
|
var _ = __toESM(require("lodash"));
|
|
3427
|
+
function getOrThrow(x, message) {
|
|
3428
|
+
if (x === void 0 || x === null) {
|
|
3429
|
+
throw new Error(message);
|
|
3430
|
+
}
|
|
3431
|
+
return x;
|
|
3432
|
+
}
|
|
3433
|
+
function joinValues(values, separator = " ") {
|
|
3434
|
+
return values.filter((value) => !!value).join(separator).trim();
|
|
3435
|
+
}
|
|
3184
3436
|
var FullNameV1 = z32.array(
|
|
3185
3437
|
z32.object({
|
|
3186
3438
|
use: z32.string(),
|
|
@@ -3204,40 +3456,262 @@ function omitKeyDeep(obj, keyToRemove) {
|
|
|
3204
3456
|
return newObj;
|
|
3205
3457
|
}
|
|
3206
3458
|
|
|
3207
|
-
// ../commons/src/events/utils.ts
|
|
3208
|
-
var
|
|
3209
|
-
function
|
|
3210
|
-
|
|
3459
|
+
// ../commons/src/events/state/utils.ts
|
|
3460
|
+
var import_lodash = require("lodash");
|
|
3461
|
+
function getActionRequests(actionType, actions) {
|
|
3462
|
+
const filtered = actions.filter((action) => action.type === actionType).reverse();
|
|
3463
|
+
const accept = filtered.find(
|
|
3464
|
+
(action) => action.status === ActionStatus.Accepted
|
|
3465
|
+
);
|
|
3466
|
+
const request = filtered.find(
|
|
3467
|
+
(action) => action.status === ActionStatus.Requested
|
|
3468
|
+
);
|
|
3469
|
+
const reject = filtered.find(
|
|
3470
|
+
(action) => action.status === ActionStatus.Rejected
|
|
3471
|
+
);
|
|
3472
|
+
return {
|
|
3473
|
+
reject,
|
|
3474
|
+
accept,
|
|
3475
|
+
request
|
|
3476
|
+
};
|
|
3211
3477
|
}
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3478
|
+
function getDeclarationActionCreationMetadata(actionType, actions) {
|
|
3479
|
+
const { accept: acceptAction, request: requestAction } = getActionRequests(
|
|
3480
|
+
actionType,
|
|
3481
|
+
actions
|
|
3482
|
+
);
|
|
3483
|
+
if (!acceptAction) {
|
|
3484
|
+
return null;
|
|
3215
3485
|
}
|
|
3216
|
-
|
|
3217
|
-
|
|
3486
|
+
const registrationNumber = acceptAction.type === ActionType.REGISTER ? acceptAction.registrationNumber : null;
|
|
3487
|
+
return {
|
|
3488
|
+
// When 3rd party API returns 200 OK, we assume that the request was accepted, and persist single 'accepted' action.
|
|
3489
|
+
createdAt: requestAction?.createdAt ?? acceptAction.createdAt,
|
|
3490
|
+
createdBy: requestAction?.createdBy ?? acceptAction.createdBy,
|
|
3491
|
+
createdByUserType: requestAction?.createdByUserType ?? acceptAction.createdByUserType,
|
|
3492
|
+
createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
|
|
3493
|
+
acceptedAt: acceptAction.createdAt,
|
|
3494
|
+
createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
|
|
3495
|
+
registrationNumber
|
|
3496
|
+
};
|
|
3497
|
+
}
|
|
3498
|
+
var updateActions = ActionTypes.extract([
|
|
3499
|
+
ActionType.CREATE,
|
|
3500
|
+
ActionType.NOTIFY,
|
|
3501
|
+
ActionType.EDIT,
|
|
3502
|
+
ActionType.DECLARE,
|
|
3503
|
+
ActionType.REGISTER,
|
|
3504
|
+
ActionType.REJECT,
|
|
3505
|
+
ActionType.ARCHIVE,
|
|
3506
|
+
ActionType.UNARCHIVE,
|
|
3507
|
+
ActionType.PRINT_CERTIFICATE,
|
|
3508
|
+
ActionType.REQUEST_CORRECTION,
|
|
3509
|
+
ActionType.APPROVE_CORRECTION,
|
|
3510
|
+
ActionType.REJECT_CORRECTION,
|
|
3511
|
+
ActionType.CUSTOM
|
|
3512
|
+
]);
|
|
3513
|
+
function getActionUpdateMetadata(actions) {
|
|
3514
|
+
const createAction = getOrThrow(
|
|
3515
|
+
actions.find((action) => action.type === ActionType.CREATE),
|
|
3516
|
+
`Event has no ${ActionType.CREATE} action`
|
|
3517
|
+
);
|
|
3518
|
+
const metadataFields = [
|
|
3519
|
+
"createdAt",
|
|
3520
|
+
"createdBy",
|
|
3521
|
+
"createdByUserType",
|
|
3522
|
+
"createdAtLocation",
|
|
3523
|
+
"createdByRole"
|
|
3524
|
+
];
|
|
3525
|
+
return actions.filter(({ type }) => updateActions.safeParse(type).success).reduce(
|
|
3526
|
+
(_2, action) => {
|
|
3527
|
+
if (action.originalActionId) {
|
|
3528
|
+
const originalAction = actions.find(({ id }) => id === action.originalActionId) ?? action;
|
|
3529
|
+
return (0, import_lodash.pick)(originalAction, metadataFields);
|
|
3530
|
+
}
|
|
3531
|
+
return (0, import_lodash.pick)(action, metadataFields);
|
|
3532
|
+
},
|
|
3533
|
+
(0, import_lodash.pick)(createAction, metadataFields)
|
|
3534
|
+
);
|
|
3535
|
+
}
|
|
3536
|
+
function getLegalStatuses(actions) {
|
|
3537
|
+
return {
|
|
3538
|
+
[EventStatus.enum.NOTIFIED]: getDeclarationActionCreationMetadata(
|
|
3539
|
+
ActionType.NOTIFY,
|
|
3540
|
+
actions
|
|
3541
|
+
),
|
|
3542
|
+
[EventStatus.enum.DECLARED]: getDeclarationActionCreationMetadata(
|
|
3543
|
+
ActionType.DECLARE,
|
|
3544
|
+
actions
|
|
3545
|
+
),
|
|
3546
|
+
[EventStatus.enum.REGISTERED]: getDeclarationActionCreationMetadata(
|
|
3547
|
+
ActionType.REGISTER,
|
|
3548
|
+
actions
|
|
3549
|
+
)
|
|
3550
|
+
};
|
|
3551
|
+
}
|
|
3552
|
+
|
|
3553
|
+
// ../commons/src/events/state/flags.ts
|
|
3554
|
+
var import_lodash2 = require("lodash");
|
|
3555
|
+
var import_date_fns = require("date-fns");
|
|
3556
|
+
function isFlagConditionMet(conditional, form, action) {
|
|
3557
|
+
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" });
|
|
3558
|
+
return validate(conditional, {
|
|
3559
|
+
$form: form,
|
|
3560
|
+
$now: now2,
|
|
3561
|
+
$online: true,
|
|
3562
|
+
$user: {
|
|
3563
|
+
sub: "",
|
|
3564
|
+
exp: "",
|
|
3565
|
+
role: action.createdByRole,
|
|
3566
|
+
algorithm: "",
|
|
3567
|
+
scope: [],
|
|
3568
|
+
userType: action.createdByUserType
|
|
3569
|
+
}
|
|
3570
|
+
});
|
|
3571
|
+
}
|
|
3572
|
+
function actionConfigRemovesFlag(action, flagId, actionsUpToAndIncluding, event2, eventConfiguration) {
|
|
3573
|
+
if (!isActionConfigType(action.type)) {
|
|
3574
|
+
return false;
|
|
3218
3575
|
}
|
|
3219
|
-
|
|
3220
|
-
|
|
3576
|
+
const actionConfig = getActionConfig({
|
|
3577
|
+
eventConfiguration,
|
|
3578
|
+
actionType: action.type,
|
|
3579
|
+
customActionType: "customActionType" in action ? action.customActionType : void 0
|
|
3580
|
+
});
|
|
3581
|
+
const removeOperations = (actionConfig?.flags ?? []).filter(
|
|
3582
|
+
({ id, operation }) => id === flagId && operation === "remove"
|
|
3583
|
+
);
|
|
3584
|
+
if (removeOperations.length === 0) {
|
|
3585
|
+
return false;
|
|
3221
3586
|
}
|
|
3222
|
-
|
|
3223
|
-
|
|
3587
|
+
const eventUpToThisAction = { ...event2, actions: actionsUpToAndIncluding };
|
|
3588
|
+
const declaration = aggregateActionDeclarations(eventUpToThisAction);
|
|
3589
|
+
const annotation = aggregateActionAnnotations(eventUpToThisAction);
|
|
3590
|
+
const form = { ...declaration, ...annotation };
|
|
3591
|
+
return removeOperations.some(
|
|
3592
|
+
({ conditional }) => conditional ? isFlagConditionMet(conditional, form, action) : true
|
|
3593
|
+
);
|
|
3594
|
+
}
|
|
3595
|
+
var INHERENT_FLAG_RULES = [
|
|
3596
|
+
{
|
|
3597
|
+
flag: InherentFlags.CORRECTION_REQUESTED,
|
|
3598
|
+
setOn: [ActionType.REQUEST_CORRECTION],
|
|
3599
|
+
resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
|
|
3600
|
+
},
|
|
3601
|
+
{
|
|
3602
|
+
// INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
|
|
3603
|
+
// other status-changing action (see getStatusFromActions). ARCHIVE/UNARCHIVE
|
|
3604
|
+
// are deliberately excluded so the flag freezes across an archive/unarchive
|
|
3605
|
+
// round trip and comes back exactly as it was.
|
|
3606
|
+
flag: InherentFlags.INCOMPLETE,
|
|
3607
|
+
setOn: [ActionType.NOTIFY],
|
|
3608
|
+
resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
|
|
3609
|
+
},
|
|
3610
|
+
{
|
|
3611
|
+
flag: InherentFlags.REJECTED,
|
|
3612
|
+
setOn: [ActionType.REJECT],
|
|
3613
|
+
resetOn: [
|
|
3614
|
+
ActionType.NOTIFY,
|
|
3615
|
+
ActionType.DECLARE,
|
|
3616
|
+
ActionType.EDIT,
|
|
3617
|
+
ActionType.REGISTER
|
|
3618
|
+
]
|
|
3619
|
+
},
|
|
3620
|
+
{
|
|
3621
|
+
flag: InherentFlags.POTENTIAL_DUPLICATE,
|
|
3622
|
+
setOn: [ActionType.DUPLICATE_DETECTED],
|
|
3623
|
+
resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
|
|
3624
|
+
},
|
|
3625
|
+
{
|
|
3626
|
+
flag: InherentFlags.EDIT_IN_PROGRESS,
|
|
3627
|
+
setOn: [ActionType.EDIT],
|
|
3628
|
+
resetOnAnyOtherAction: true
|
|
3224
3629
|
}
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3630
|
+
];
|
|
3631
|
+
function resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration) {
|
|
3632
|
+
return acceptedActions.reduce((present, action, idx) => {
|
|
3633
|
+
if (rule.setOn.includes(action.type)) {
|
|
3634
|
+
return true;
|
|
3635
|
+
}
|
|
3636
|
+
if (rule.resetOnAnyOtherAction || (rule.resetOn ?? []).includes(action.type)) {
|
|
3637
|
+
return false;
|
|
3638
|
+
}
|
|
3639
|
+
if (actionConfigRemovesFlag(
|
|
3640
|
+
action,
|
|
3641
|
+
rule.flag,
|
|
3642
|
+
acceptedActions.slice(0, idx + 1),
|
|
3643
|
+
event2,
|
|
3644
|
+
eventConfiguration
|
|
3645
|
+
)) {
|
|
3646
|
+
return false;
|
|
3647
|
+
}
|
|
3648
|
+
return present;
|
|
3649
|
+
}, false);
|
|
3650
|
+
}
|
|
3651
|
+
function resolveEventCustomFlags(event2, eventConfiguration) {
|
|
3652
|
+
const actions = getAcceptedActions(event2).filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
3653
|
+
return actions.reduce((acc, action, idx) => {
|
|
3654
|
+
let actionConfig;
|
|
3655
|
+
if (isActionConfigType(action.type)) {
|
|
3656
|
+
actionConfig = getActionConfig({
|
|
3657
|
+
eventConfiguration,
|
|
3658
|
+
actionType: action.type,
|
|
3659
|
+
customActionType: "customActionType" in action ? action.customActionType : void 0
|
|
3660
|
+
});
|
|
3661
|
+
}
|
|
3662
|
+
if (!actionConfig) {
|
|
3663
|
+
return acc;
|
|
3664
|
+
}
|
|
3665
|
+
const eventUpToThisAction = {
|
|
3666
|
+
...event2,
|
|
3667
|
+
actions: actions.slice(0, idx + 1)
|
|
3668
|
+
};
|
|
3669
|
+
const declaration = aggregateActionDeclarations(eventUpToThisAction);
|
|
3670
|
+
const annotation = aggregateActionAnnotations(eventUpToThisAction);
|
|
3671
|
+
const form = { ...declaration, ...annotation };
|
|
3672
|
+
const flagsWithMetConditions = (actionConfig.flags ?? []).filter(
|
|
3673
|
+
({ conditional }) => (
|
|
3674
|
+
// If conditional is not provided, the flag is resolved
|
|
3675
|
+
conditional ? isFlagConditionMet(conditional, form, action) : true
|
|
3676
|
+
)
|
|
3677
|
+
);
|
|
3678
|
+
const addedFlags = flagsWithMetConditions.filter(({ operation }) => operation === "add").map(({ id }) => id);
|
|
3679
|
+
const removedFlags = flagsWithMetConditions.filter(({ operation }) => operation === "remove").map(({ id }) => id);
|
|
3680
|
+
const flags = [...acc, ...addedFlags].filter(
|
|
3681
|
+
(flagId) => !removedFlags.includes(flagId)
|
|
3682
|
+
);
|
|
3683
|
+
return (0, import_lodash2.uniq)(flags);
|
|
3684
|
+
}, []);
|
|
3685
|
+
}
|
|
3686
|
+
function getActionStatusFlags(sortedActions) {
|
|
3687
|
+
const actionStatus = sortedActions.reduce(
|
|
3688
|
+
(actionStatuses, { type, status: status2 }) => ({
|
|
3689
|
+
...actionStatuses,
|
|
3690
|
+
[type]: status2
|
|
3691
|
+
}),
|
|
3692
|
+
{}
|
|
3693
|
+
);
|
|
3694
|
+
return Object.entries(actionStatus).filter(([, status2]) => status2 !== ActionStatus.Accepted).map(([type, status2]) => {
|
|
3695
|
+
const flag2 = joinValues([type, status2], ":").toLowerCase();
|
|
3696
|
+
return flag2;
|
|
3697
|
+
});
|
|
3698
|
+
}
|
|
3699
|
+
function getInherentFlags(sortedActions, event2, eventConfiguration) {
|
|
3700
|
+
const acceptedActions = sortedActions.filter(
|
|
3701
|
+
({ status: status2 }) => status2 === ActionStatus.Accepted
|
|
3702
|
+
);
|
|
3703
|
+
return INHERENT_FLAG_RULES.filter(
|
|
3704
|
+
(rule) => resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration)
|
|
3705
|
+
).map(({ flag: flag2 }) => flag2);
|
|
3706
|
+
}
|
|
3707
|
+
function getEventFlags(event2, config) {
|
|
3708
|
+
const sortedActions = event2.actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
3709
|
+
return [
|
|
3710
|
+
...getActionStatusFlags(sortedActions),
|
|
3711
|
+
...getInherentFlags(sortedActions, event2, config),
|
|
3712
|
+
...resolveEventCustomFlags(event2, config)
|
|
3713
|
+
];
|
|
3229
3714
|
}
|
|
3230
|
-
var findAllFields = (config) => {
|
|
3231
|
-
return (0, import_lodash.flattenDeep)([
|
|
3232
|
-
...getDeclarationFields(config),
|
|
3233
|
-
...getAllAnnotationFields(config)
|
|
3234
|
-
]);
|
|
3235
|
-
};
|
|
3236
|
-
var EXCLUDED_ACTIONS = [
|
|
3237
|
-
ActionType.REQUEST_CORRECTION,
|
|
3238
|
-
ActionType.PRINT_CERTIFICATE,
|
|
3239
|
-
ActionType.REJECT_CORRECTION
|
|
3240
|
-
];
|
|
3241
3715
|
|
|
3242
3716
|
// ../commons/src/conditionals/conditionals.ts
|
|
3243
3717
|
var objectHash = __toESM(require("object-hash"));
|
|
@@ -3445,6 +3919,33 @@ function defineComparison(field3, value, keyword) {
|
|
|
3445
3919
|
required: [field3.$$field]
|
|
3446
3920
|
});
|
|
3447
3921
|
}
|
|
3922
|
+
function flag(flagvalue) {
|
|
3923
|
+
return defineConditional({
|
|
3924
|
+
type: "object",
|
|
3925
|
+
properties: {
|
|
3926
|
+
$flags: {
|
|
3927
|
+
type: "array",
|
|
3928
|
+
contains: {
|
|
3929
|
+
type: "string",
|
|
3930
|
+
const: flagvalue
|
|
3931
|
+
}
|
|
3932
|
+
}
|
|
3933
|
+
},
|
|
3934
|
+
required: ["$flags"]
|
|
3935
|
+
});
|
|
3936
|
+
}
|
|
3937
|
+
function status(statusValue) {
|
|
3938
|
+
return defineConditional({
|
|
3939
|
+
type: "object",
|
|
3940
|
+
properties: {
|
|
3941
|
+
$status: {
|
|
3942
|
+
type: "string",
|
|
3943
|
+
const: statusValue
|
|
3944
|
+
}
|
|
3945
|
+
},
|
|
3946
|
+
required: ["$status"]
|
|
3947
|
+
});
|
|
3948
|
+
}
|
|
3448
3949
|
function createFieldConditionals(fieldId) {
|
|
3449
3950
|
const getDayRange = (field3, days, clause, referenceDate) => ({
|
|
3450
3951
|
type: "object",
|
|
@@ -3846,6 +4347,526 @@ function createFieldConditionals(fieldId) {
|
|
|
3846
4347
|
};
|
|
3847
4348
|
}
|
|
3848
4349
|
|
|
4350
|
+
// ../commons/src/events/state/index.ts
|
|
4351
|
+
function getStatusFromActions(actions) {
|
|
4352
|
+
const acceptedActions = actions.filter(
|
|
4353
|
+
({ status: status2 }) => status2 === ActionStatus.Accepted
|
|
4354
|
+
);
|
|
4355
|
+
const isCurrentlyArchived = acceptedActions.reduce(
|
|
4356
|
+
(archived, action) => {
|
|
4357
|
+
if (action.type === ActionType.ARCHIVE) {
|
|
4358
|
+
return true;
|
|
4359
|
+
}
|
|
4360
|
+
if (action.type === ActionType.UNARCHIVE) {
|
|
4361
|
+
return false;
|
|
4362
|
+
}
|
|
4363
|
+
return archived;
|
|
4364
|
+
},
|
|
4365
|
+
false
|
|
4366
|
+
);
|
|
4367
|
+
if (isCurrentlyArchived) {
|
|
4368
|
+
return EventStatus.enum.ARCHIVED;
|
|
4369
|
+
}
|
|
4370
|
+
return acceptedActions.filter(
|
|
4371
|
+
({ type }) => type !== ActionType.ARCHIVE && type !== ActionType.UNARCHIVE
|
|
4372
|
+
).reduce((status2, action) => {
|
|
4373
|
+
switch (action.type) {
|
|
4374
|
+
case ActionType.CREATE:
|
|
4375
|
+
return EventStatus.enum.CREATED;
|
|
4376
|
+
case ActionType.DECLARE:
|
|
4377
|
+
return EventStatus.enum.DECLARED;
|
|
4378
|
+
case ActionType.REGISTER:
|
|
4379
|
+
return EventStatus.enum.REGISTERED;
|
|
4380
|
+
case ActionType.NOTIFY:
|
|
4381
|
+
return EventStatus.enum.NOTIFIED;
|
|
4382
|
+
// Already filtered out above; listed here only to satisfy exhaustiveness.
|
|
4383
|
+
case ActionType.ARCHIVE:
|
|
4384
|
+
case ActionType.UNARCHIVE:
|
|
4385
|
+
case ActionType.CUSTOM:
|
|
4386
|
+
case ActionType.PRINT_CERTIFICATE:
|
|
4387
|
+
case ActionType.ASSIGN:
|
|
4388
|
+
case ActionType.UNASSIGN:
|
|
4389
|
+
case ActionType.REJECT:
|
|
4390
|
+
case ActionType.REQUEST_CORRECTION:
|
|
4391
|
+
case ActionType.APPROVE_CORRECTION:
|
|
4392
|
+
case ActionType.DUPLICATE_DETECTED:
|
|
4393
|
+
case ActionType.MARK_AS_NOT_DUPLICATE:
|
|
4394
|
+
case ActionType.MARK_AS_DUPLICATE:
|
|
4395
|
+
case ActionType.REJECT_CORRECTION:
|
|
4396
|
+
case ActionType.READ:
|
|
4397
|
+
case ActionType.EDIT:
|
|
4398
|
+
default:
|
|
4399
|
+
return status2;
|
|
4400
|
+
}
|
|
4401
|
+
}, EventStatus.enum.CREATED);
|
|
4402
|
+
}
|
|
4403
|
+
function getAssignedUserFromActions(actions) {
|
|
4404
|
+
return actions.reduce((user2, action) => {
|
|
4405
|
+
if (action.type === ActionType.ASSIGN) {
|
|
4406
|
+
return action.assignedTo;
|
|
4407
|
+
}
|
|
4408
|
+
if (action.type === ActionType.UNASSIGN) {
|
|
4409
|
+
return null;
|
|
4410
|
+
}
|
|
4411
|
+
return user2;
|
|
4412
|
+
}, null);
|
|
4413
|
+
}
|
|
4414
|
+
function deepDropNulls(obj) {
|
|
4415
|
+
if (Array.isArray(obj)) {
|
|
4416
|
+
return obj.map(deepDropNulls);
|
|
4417
|
+
}
|
|
4418
|
+
if (obj !== null && typeof obj === "object") {
|
|
4419
|
+
return Object.entries(obj).reduce((acc, [key, value]) => {
|
|
4420
|
+
const cleanedValue = deepDropNulls(value);
|
|
4421
|
+
if (cleanedValue !== null) {
|
|
4422
|
+
;
|
|
4423
|
+
acc[key] = cleanedValue;
|
|
4424
|
+
}
|
|
4425
|
+
return acc;
|
|
4426
|
+
}, {});
|
|
4427
|
+
}
|
|
4428
|
+
return obj;
|
|
4429
|
+
}
|
|
4430
|
+
var DEFAULT_DATE_OF_EVENT_PROPERTY = "createdAt";
|
|
4431
|
+
function extractDateString(dateTime) {
|
|
4432
|
+
return dateTime.split("T")[0];
|
|
4433
|
+
}
|
|
4434
|
+
function resolveDateOfEvent(eventIndex, declaration, config) {
|
|
4435
|
+
if (!config.dateOfEvent) {
|
|
4436
|
+
return extractDateString(eventIndex[DEFAULT_DATE_OF_EVENT_PROPERTY]);
|
|
4437
|
+
}
|
|
4438
|
+
const parsedDate = isFieldReference(config.dateOfEvent) ? ZodDate.safeParse(declaration[config.dateOfEvent.$$field]) : ZodDateTime.safeParse(
|
|
4439
|
+
getMixedPath(eventIndex, config.dateOfEvent.$$event)
|
|
4440
|
+
);
|
|
4441
|
+
return parsedDate.success ? extractDateString(parsedDate.data) : void 0;
|
|
4442
|
+
}
|
|
4443
|
+
var DEFAULT_PLACE_OF_EVENT_PROPERTY = "createdAtLocation";
|
|
4444
|
+
function getParsedUUID(value, oldValue) {
|
|
4445
|
+
const parsed = UUID.safeParse(value);
|
|
4446
|
+
return parsed.success ? parsed.data : oldValue;
|
|
4447
|
+
}
|
|
4448
|
+
function resolvePlaceOfEvent(eventMetadata, declaration, config) {
|
|
4449
|
+
let placeOfEvent = getParsedUUID(
|
|
4450
|
+
eventMetadata[DEFAULT_PLACE_OF_EVENT_PROPERTY]
|
|
4451
|
+
);
|
|
4452
|
+
if (config.placeOfEvent) {
|
|
4453
|
+
const addressFieldValue = AddressFieldValue.safeParse(
|
|
4454
|
+
declaration[config.placeOfEvent.$$field]
|
|
4455
|
+
);
|
|
4456
|
+
if (addressFieldValue.success && addressFieldValue.data.addressType === AddressType.DOMESTIC && addressFieldValue.data.administrativeArea) {
|
|
4457
|
+
placeOfEvent = getParsedUUID(
|
|
4458
|
+
addressFieldValue.data.administrativeArea,
|
|
4459
|
+
placeOfEvent
|
|
4460
|
+
);
|
|
4461
|
+
} else {
|
|
4462
|
+
placeOfEvent = getParsedUUID(
|
|
4463
|
+
declaration[config.placeOfEvent.$$field],
|
|
4464
|
+
placeOfEvent
|
|
4465
|
+
);
|
|
4466
|
+
}
|
|
4467
|
+
}
|
|
4468
|
+
return placeOfEvent;
|
|
4469
|
+
}
|
|
4470
|
+
function extractPotentialDuplicatesFromActions(actions) {
|
|
4471
|
+
return actions.reduce((duplicates, action) => {
|
|
4472
|
+
if (action.type === ActionType.DUPLICATE_DETECTED) {
|
|
4473
|
+
duplicates = action.content.duplicates;
|
|
4474
|
+
}
|
|
4475
|
+
if (action.type === ActionType.MARK_AS_NOT_DUPLICATE || action.type === ActionType.MARK_AS_DUPLICATE) {
|
|
4476
|
+
duplicates = [];
|
|
4477
|
+
}
|
|
4478
|
+
return duplicates;
|
|
4479
|
+
}, []);
|
|
4480
|
+
}
|
|
4481
|
+
function getCurrentEventState(event2, config) {
|
|
4482
|
+
const sortedActions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
4483
|
+
const creationAction = sortedActions.find(
|
|
4484
|
+
(action) => action.type === ActionType.CREATE
|
|
4485
|
+
);
|
|
4486
|
+
if (!creationAction) {
|
|
4487
|
+
throw new Error(`Event ${event2.id} has no creation action`);
|
|
4488
|
+
}
|
|
4489
|
+
const acceptedActions = getAcceptedActions(event2).sort(
|
|
4490
|
+
(a, b) => a.createdAt.localeCompare(b.createdAt)
|
|
4491
|
+
);
|
|
4492
|
+
const requestActionMetadata = getActionUpdateMetadata(sortedActions);
|
|
4493
|
+
const acceptedActionMetadata = getActionUpdateMetadata(acceptedActions);
|
|
4494
|
+
const declaration = aggregateActionDeclarations(event2);
|
|
4495
|
+
const status2 = getStatusFromActions(sortedActions);
|
|
4496
|
+
const legalStatuses = getLegalStatuses(sortedActions);
|
|
4497
|
+
const base = deepDropNulls({
|
|
4498
|
+
id: event2.id,
|
|
4499
|
+
type: event2.type,
|
|
4500
|
+
status: status2,
|
|
4501
|
+
legalStatuses,
|
|
4502
|
+
createdAt: creationAction.createdAt,
|
|
4503
|
+
createdBy: creationAction.createdBy,
|
|
4504
|
+
createdByUserType: creationAction.createdByUserType,
|
|
4505
|
+
createdAtLocation: creationAction.createdAtLocation,
|
|
4506
|
+
updatedAt: acceptedActionMetadata.createdAt,
|
|
4507
|
+
assignedTo: getAssignedUserFromActions(acceptedActions),
|
|
4508
|
+
updatedBy: requestActionMetadata.createdBy,
|
|
4509
|
+
updatedAtLocation: requestActionMetadata.createdAtLocation,
|
|
4510
|
+
declaration,
|
|
4511
|
+
trackingId: event2.trackingId,
|
|
4512
|
+
updatedByUserRole: requestActionMetadata.createdByRole,
|
|
4513
|
+
placeOfEvent: resolvePlaceOfEvent(
|
|
4514
|
+
{ createdAtLocation: creationAction.createdAtLocation },
|
|
4515
|
+
declaration,
|
|
4516
|
+
config
|
|
4517
|
+
),
|
|
4518
|
+
potentialDuplicates: extractPotentialDuplicatesFromActions(sortedActions),
|
|
4519
|
+
flags: getEventFlags(event2, config)
|
|
4520
|
+
});
|
|
4521
|
+
return deepDropNulls({
|
|
4522
|
+
...base,
|
|
4523
|
+
dateOfEvent: resolveDateOfEvent(base, declaration, config)
|
|
4524
|
+
});
|
|
4525
|
+
}
|
|
4526
|
+
|
|
4527
|
+
// ../commons/src/conditionals/validate.ts
|
|
4528
|
+
var ajv = new import__.default({
|
|
4529
|
+
$data: true,
|
|
4530
|
+
allowUnionTypes: true,
|
|
4531
|
+
strict: false
|
|
4532
|
+
// Allow minContains and other newer features
|
|
4533
|
+
});
|
|
4534
|
+
var DataContext = z33.object({
|
|
4535
|
+
rootData: z33.object({
|
|
4536
|
+
$leafAdminStructureLocationIds: z33.array(z33.object({ id: UUID }))
|
|
4537
|
+
})
|
|
4538
|
+
});
|
|
4539
|
+
function resolveDataPath(rootData, dataPath, instancePath) {
|
|
4540
|
+
const pathParts = dataPath.split("/");
|
|
4541
|
+
const levels = parseInt(pathParts[0], 10);
|
|
4542
|
+
const referencePath = pathParts.slice(1);
|
|
4543
|
+
const instanceParts = instancePath.split("/").filter(Boolean);
|
|
4544
|
+
const traversedParts = instanceParts.slice(0, -levels);
|
|
4545
|
+
let current = rootData;
|
|
4546
|
+
for (const part of traversedParts) {
|
|
4547
|
+
if (current === null || current === void 0) {
|
|
4548
|
+
return void 0;
|
|
4549
|
+
}
|
|
4550
|
+
current = current[part];
|
|
4551
|
+
}
|
|
4552
|
+
for (const part of referencePath) {
|
|
4553
|
+
if (current === null || current === void 0) {
|
|
4554
|
+
return void 0;
|
|
4555
|
+
}
|
|
4556
|
+
current = current[part];
|
|
4557
|
+
}
|
|
4558
|
+
return current;
|
|
4559
|
+
}
|
|
4560
|
+
function todayISO() {
|
|
4561
|
+
return (0, import_date_fns2.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
|
|
4562
|
+
}
|
|
4563
|
+
var compiledFunctionCache = /* @__PURE__ */ new Map();
|
|
4564
|
+
function compileClientFunction(code) {
|
|
4565
|
+
let fn = compiledFunctionCache.get(code);
|
|
4566
|
+
if (!fn) {
|
|
4567
|
+
fn = new Function(`return (${code})`)();
|
|
4568
|
+
compiledFunctionCache.set(code, fn);
|
|
4569
|
+
}
|
|
4570
|
+
return fn;
|
|
4571
|
+
}
|
|
4572
|
+
(0, import_ajv_formats.default)(ajv);
|
|
4573
|
+
var inMemoryEventStateCache = /* @__PURE__ */ new WeakMap();
|
|
4574
|
+
function getInMemoryEventState(event2, config) {
|
|
4575
|
+
let stateByConfig = inMemoryEventStateCache.get(event2);
|
|
4576
|
+
if (!stateByConfig) {
|
|
4577
|
+
stateByConfig = /* @__PURE__ */ new WeakMap();
|
|
4578
|
+
inMemoryEventStateCache.set(event2, stateByConfig);
|
|
4579
|
+
}
|
|
4580
|
+
let state = stateByConfig.get(config);
|
|
4581
|
+
if (!state) {
|
|
4582
|
+
state = getCurrentEventState(event2, config);
|
|
4583
|
+
stateByConfig.set(config, state);
|
|
4584
|
+
}
|
|
4585
|
+
return state;
|
|
4586
|
+
}
|
|
4587
|
+
function buildClientFunctionContext(input) {
|
|
4588
|
+
const flags = input.validatorContext?.event && input.validatorContext?.eventConfig ? getInMemoryEventState(
|
|
4589
|
+
input.validatorContext?.event,
|
|
4590
|
+
input.validatorContext?.eventConfig
|
|
4591
|
+
)?.flags : [];
|
|
4592
|
+
return {
|
|
4593
|
+
$form: input.form,
|
|
4594
|
+
$flags: flags,
|
|
4595
|
+
$now: todayISO(),
|
|
4596
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
4597
|
+
$online: isOnline(),
|
|
4598
|
+
$user: input.validatorContext?.user,
|
|
4599
|
+
$event: input.validatorContext?.event,
|
|
4600
|
+
$leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
|
|
4601
|
+
user: input.systemVariables?.user,
|
|
4602
|
+
$window: input.systemVariables?.$window,
|
|
4603
|
+
locations: input.locations,
|
|
4604
|
+
adminLevelIds: input.adminLevelIds
|
|
4605
|
+
};
|
|
4606
|
+
}
|
|
4607
|
+
function runClientFunction(code, data, context) {
|
|
4608
|
+
return compileClientFunction(code)(data, context);
|
|
4609
|
+
}
|
|
4610
|
+
ajv.addKeyword({
|
|
4611
|
+
keyword: "daysFromDate",
|
|
4612
|
+
type: "string",
|
|
4613
|
+
schemaType: "object",
|
|
4614
|
+
$data: true,
|
|
4615
|
+
errors: true,
|
|
4616
|
+
validate(schema, data, _2, dataContext) {
|
|
4617
|
+
if (!(dataContext && dataContext.rootData && typeof dataContext.rootData === "object" && "$now" in dataContext.rootData && typeof dataContext.rootData.$now === "string")) {
|
|
4618
|
+
throw new Error("Validation context must contain $now");
|
|
4619
|
+
}
|
|
4620
|
+
const { days, clause } = schema;
|
|
4621
|
+
if (typeof data !== "string") {
|
|
4622
|
+
return false;
|
|
4623
|
+
}
|
|
4624
|
+
const date = new Date(data);
|
|
4625
|
+
if (isNaN(date.getTime())) {
|
|
4626
|
+
return false;
|
|
4627
|
+
}
|
|
4628
|
+
let referenceDate = schema.referenceDate;
|
|
4629
|
+
if (referenceDate && typeof referenceDate === "object" && "$data" in referenceDate) {
|
|
4630
|
+
referenceDate = resolveDataPath(
|
|
4631
|
+
dataContext.rootData,
|
|
4632
|
+
referenceDate.$data,
|
|
4633
|
+
dataContext.instancePath
|
|
4634
|
+
);
|
|
4635
|
+
}
|
|
4636
|
+
if (!referenceDate) {
|
|
4637
|
+
referenceDate = dataContext.rootData.$now;
|
|
4638
|
+
}
|
|
4639
|
+
const baseDate = new Date(referenceDate);
|
|
4640
|
+
if (isNaN(baseDate.getTime())) {
|
|
4641
|
+
return false;
|
|
4642
|
+
}
|
|
4643
|
+
const offsetDate = new Date(baseDate.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
4644
|
+
return clause === "after" ? (0, import_date_fns2.isAfter)(date, offsetDate) : (0, import_date_fns2.isBefore)(date, offsetDate);
|
|
4645
|
+
}
|
|
4646
|
+
});
|
|
4647
|
+
ajv.addKeyword({
|
|
4648
|
+
keyword: "isLeafLevelLocation",
|
|
4649
|
+
type: "string",
|
|
4650
|
+
schemaType: "boolean",
|
|
4651
|
+
$data: true,
|
|
4652
|
+
errors: true,
|
|
4653
|
+
// @ts-ignore -- Force type. We will move this away from AJV next. Parsing the array will take seconds and is only called by core.
|
|
4654
|
+
validate(_schema, data, _2, dataContext) {
|
|
4655
|
+
const locationIdInput = data;
|
|
4656
|
+
const locations = dataContext?.rootData.$leafAdminStructureLocationIds ?? [];
|
|
4657
|
+
return locations.some((location) => location.id === locationIdInput);
|
|
4658
|
+
}
|
|
4659
|
+
});
|
|
4660
|
+
function isAgeValue(value) {
|
|
4661
|
+
return typeof value === "object" && value !== null && "age" in value && typeof value.age === "number";
|
|
4662
|
+
}
|
|
4663
|
+
ajv.addKeyword({
|
|
4664
|
+
keyword: "customClientValidator",
|
|
4665
|
+
schemaType: "object",
|
|
4666
|
+
errors: true,
|
|
4667
|
+
// @ts-expect-error -- AJV's public types don't expose `rootData`. All
|
|
4668
|
+
// `validate()` callers build root data via `buildClientFunctionContext`,
|
|
4669
|
+
// so the cast holds.
|
|
4670
|
+
validate(schema, data, _2, dataContext) {
|
|
4671
|
+
return Boolean(
|
|
4672
|
+
runClientFunction(
|
|
4673
|
+
schema.code,
|
|
4674
|
+
data,
|
|
4675
|
+
dataContext?.rootData ?? buildClientFunctionContext({ form: {} })
|
|
4676
|
+
)
|
|
4677
|
+
);
|
|
4678
|
+
}
|
|
4679
|
+
});
|
|
4680
|
+
function validate(schema, data) {
|
|
4681
|
+
const validator = ajv.getSchema(schema.$id) || ajv.compile(schema);
|
|
4682
|
+
if ("$form" in data) {
|
|
4683
|
+
const entries = Object.entries(data.$form).map(([key, value]) => {
|
|
4684
|
+
if (!isAgeValue(value)) {
|
|
4685
|
+
return [key, value];
|
|
4686
|
+
}
|
|
4687
|
+
const age = value.age;
|
|
4688
|
+
const maybeAsOfDate = PlainDate.safeParse(data.$form[value.asOfDateRef]);
|
|
4689
|
+
return [
|
|
4690
|
+
key,
|
|
4691
|
+
{
|
|
4692
|
+
age,
|
|
4693
|
+
dob: ageToDate(
|
|
4694
|
+
age,
|
|
4695
|
+
maybeAsOfDate.success ? maybeAsOfDate.data : PlainDate.parse(data.$now)
|
|
4696
|
+
)
|
|
4697
|
+
}
|
|
4698
|
+
];
|
|
4699
|
+
});
|
|
4700
|
+
data.$form = Object.fromEntries(entries);
|
|
4701
|
+
}
|
|
4702
|
+
const result = validator(data);
|
|
4703
|
+
return result;
|
|
4704
|
+
}
|
|
4705
|
+
function isOnline() {
|
|
4706
|
+
if (typeof window !== "undefined" && typeof navigator !== "undefined") {
|
|
4707
|
+
return navigator.onLine;
|
|
4708
|
+
}
|
|
4709
|
+
return true;
|
|
4710
|
+
}
|
|
4711
|
+
|
|
4712
|
+
// ../commons/src/events/utils.ts
|
|
4713
|
+
var import_date_fns3 = require("date-fns");
|
|
4714
|
+
function ageToDate(age, asOfDate) {
|
|
4715
|
+
const date = plainDateToLocalDate(asOfDate);
|
|
4716
|
+
return PlainDate.parse((0, import_date_fns3.format)((0, import_date_fns3.subYears)(date, age), "yyyy-MM-dd"));
|
|
4717
|
+
}
|
|
4718
|
+
function getDeclarationFields(configuration) {
|
|
4719
|
+
return configuration.declaration.pages.flatMap(({ fields }) => fields);
|
|
4720
|
+
}
|
|
4721
|
+
function isActionConfigType(type) {
|
|
4722
|
+
return actionConfigTypes.has(type);
|
|
4723
|
+
}
|
|
4724
|
+
function getActionConfig({
|
|
4725
|
+
eventConfiguration,
|
|
4726
|
+
actionType,
|
|
4727
|
+
customActionType
|
|
4728
|
+
}) {
|
|
4729
|
+
if (actionType === ActionType.NOTIFY) {
|
|
4730
|
+
return eventConfiguration.actions.find((a) => a.type === ActionType.NOTIFY) ?? eventConfiguration.actions.find((a) => a.type === ActionType.DECLARE);
|
|
4731
|
+
}
|
|
4732
|
+
return eventConfiguration.actions.find((a) => {
|
|
4733
|
+
if (a.type === ActionType.CUSTOM && customActionType) {
|
|
4734
|
+
return a.customActionType === customActionType;
|
|
4735
|
+
}
|
|
4736
|
+
return a.type === actionType;
|
|
4737
|
+
});
|
|
4738
|
+
}
|
|
4739
|
+
var getActionAnnotationFields = (actionConfig) => {
|
|
4740
|
+
if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
|
|
4741
|
+
return actionConfig.correctionForm.pages.flatMap(({ fields }) => fields);
|
|
4742
|
+
}
|
|
4743
|
+
if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
|
|
4744
|
+
return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
|
|
4745
|
+
}
|
|
4746
|
+
const reviewFields = "review" in actionConfig && actionConfig.review != null ? actionConfig.review.fields : [];
|
|
4747
|
+
const formFields = "form" in actionConfig && actionConfig.form != null ? actionConfig.form : [];
|
|
4748
|
+
return [...reviewFields, ...formFields];
|
|
4749
|
+
};
|
|
4750
|
+
function getAllAnnotationFields(config) {
|
|
4751
|
+
return (0, import_lodash4.flattenDeep)(config.actions.map(getActionAnnotationFields));
|
|
4752
|
+
}
|
|
4753
|
+
function deepMerge(currentDocument, actionDocument) {
|
|
4754
|
+
const currentDocumentClone = (0, import_lodash4.cloneDeep)(currentDocument);
|
|
4755
|
+
return (0, import_lodash4.mergeWith)(
|
|
4756
|
+
(0, import_lodash4.cloneDeep)(currentDocumentClone),
|
|
4757
|
+
actionDocument,
|
|
4758
|
+
(previousValue, incomingValue) => {
|
|
4759
|
+
if (incomingValue === void 0) {
|
|
4760
|
+
return previousValue;
|
|
4761
|
+
}
|
|
4762
|
+
if ((0, import_lodash4.isArray)(incomingValue)) {
|
|
4763
|
+
return incomingValue;
|
|
4764
|
+
}
|
|
4765
|
+
if ((0, import_lodash4.isObject)(previousValue) && (0, import_lodash4.isObject)(incomingValue)) {
|
|
4766
|
+
return void 0;
|
|
4767
|
+
}
|
|
4768
|
+
return incomingValue;
|
|
4769
|
+
}
|
|
4770
|
+
);
|
|
4771
|
+
}
|
|
4772
|
+
var findAllFields = (config) => {
|
|
4773
|
+
return (0, import_lodash4.flattenDeep)([
|
|
4774
|
+
...getDeclarationFields(config),
|
|
4775
|
+
...getAllAnnotationFields(config)
|
|
4776
|
+
]);
|
|
4777
|
+
};
|
|
4778
|
+
function getMixedPath(obj, path, defaultValue) {
|
|
4779
|
+
const parts = path.split(".");
|
|
4780
|
+
const resolve = (current, segments) => {
|
|
4781
|
+
if (current == null || segments.length === 0) {
|
|
4782
|
+
return current;
|
|
4783
|
+
}
|
|
4784
|
+
for (let i = segments.length; i > 0; i--) {
|
|
4785
|
+
const compoundKey = segments.slice(0, i).join(".");
|
|
4786
|
+
if ((0, import_lodash4.has)(current, compoundKey)) {
|
|
4787
|
+
const next = (0, import_lodash4.get)(current, compoundKey);
|
|
4788
|
+
return resolve(next, segments.slice(i));
|
|
4789
|
+
}
|
|
4790
|
+
}
|
|
4791
|
+
return void 0;
|
|
4792
|
+
};
|
|
4793
|
+
const result = resolve(obj, parts);
|
|
4794
|
+
return (0, import_lodash4.isNil)(result) ? defaultValue : result;
|
|
4795
|
+
}
|
|
4796
|
+
function isAcceptedAction(a) {
|
|
4797
|
+
return a.status === ActionStatus.Accepted;
|
|
4798
|
+
}
|
|
4799
|
+
function getCompleteActionAnnotation(event2, action) {
|
|
4800
|
+
if (action.originalActionId) {
|
|
4801
|
+
const originalAction = event2.actions.find(
|
|
4802
|
+
({ id }) => id === action.originalActionId
|
|
4803
|
+
);
|
|
4804
|
+
if (originalAction?.status === ActionStatus.Requested) {
|
|
4805
|
+
return deepMerge(originalAction.annotation ?? {}, action.annotation ?? {});
|
|
4806
|
+
}
|
|
4807
|
+
}
|
|
4808
|
+
return action.annotation ?? {};
|
|
4809
|
+
}
|
|
4810
|
+
function getCompleteActionDeclaration(declaration, event2, action) {
|
|
4811
|
+
if (action.originalActionId) {
|
|
4812
|
+
const originalAction = event2.actions.find(
|
|
4813
|
+
({ id }) => id === action.originalActionId
|
|
4814
|
+
);
|
|
4815
|
+
if (originalAction?.status === ActionStatus.Requested) {
|
|
4816
|
+
return deepMerge(
|
|
4817
|
+
deepMerge(declaration, originalAction.declaration),
|
|
4818
|
+
action.declaration
|
|
4819
|
+
);
|
|
4820
|
+
}
|
|
4821
|
+
}
|
|
4822
|
+
return deepMerge(declaration, action.declaration);
|
|
4823
|
+
}
|
|
4824
|
+
function getAcceptedActions(event2) {
|
|
4825
|
+
return event2.actions.filter(isAcceptedAction).map((action) => ({
|
|
4826
|
+
...action,
|
|
4827
|
+
declaration: getCompleteActionDeclaration({}, event2, action),
|
|
4828
|
+
annotation: getCompleteActionAnnotation(event2, action)
|
|
4829
|
+
}));
|
|
4830
|
+
}
|
|
4831
|
+
var EXCLUDED_ACTIONS = [
|
|
4832
|
+
ActionType.REQUEST_CORRECTION,
|
|
4833
|
+
ActionType.PRINT_CERTIFICATE,
|
|
4834
|
+
ActionType.REJECT_CORRECTION
|
|
4835
|
+
];
|
|
4836
|
+
function aggregateActionDeclarations(event2) {
|
|
4837
|
+
const allAcceptedActions = getAcceptedActions(event2);
|
|
4838
|
+
const aggregatedActions = allAcceptedActions.filter((a) => !EXCLUDED_ACTIONS.some((type) => type === a.type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
4839
|
+
return aggregatedActions.reduce((declaration, action) => {
|
|
4840
|
+
if (action.type === ActionType.APPROVE_CORRECTION) {
|
|
4841
|
+
const requestAction = allAcceptedActions.find(
|
|
4842
|
+
({ id }) => id === action.requestId
|
|
4843
|
+
);
|
|
4844
|
+
if (!requestAction) {
|
|
4845
|
+
return declaration;
|
|
4846
|
+
}
|
|
4847
|
+
const declarationWithApprovedCorrection = getCompleteActionDeclaration(
|
|
4848
|
+
declaration,
|
|
4849
|
+
event2,
|
|
4850
|
+
requestAction
|
|
4851
|
+
);
|
|
4852
|
+
return getCompleteActionDeclaration(
|
|
4853
|
+
declarationWithApprovedCorrection,
|
|
4854
|
+
event2,
|
|
4855
|
+
action
|
|
4856
|
+
);
|
|
4857
|
+
}
|
|
4858
|
+
return getCompleteActionDeclaration(declaration, event2, action);
|
|
4859
|
+
}, {});
|
|
4860
|
+
}
|
|
4861
|
+
function aggregateActionAnnotations(event2) {
|
|
4862
|
+
return event2.actions.reduce((ann, sortedAction) => {
|
|
4863
|
+
if (!("annotation" in sortedAction) || !sortedAction.annotation) {
|
|
4864
|
+
return ann;
|
|
4865
|
+
}
|
|
4866
|
+
return deepMerge(ann, sortedAction.annotation);
|
|
4867
|
+
}, {});
|
|
4868
|
+
}
|
|
4869
|
+
|
|
3849
4870
|
// ../commons/src/events/eventConfigValidation.ts
|
|
3850
4871
|
function validateAdvancedSearchConfig(event2, ctx) {
|
|
3851
4872
|
const allFields = findAllFields(event2);
|
|
@@ -3928,9 +4949,9 @@ function validatePlaceOfEvent(event2, ctx) {
|
|
|
3928
4949
|
}
|
|
3929
4950
|
function validateActionFlags(event2, ctx) {
|
|
3930
4951
|
const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
|
|
3931
|
-
const configuredFlagIds = event2.flags.map((
|
|
4952
|
+
const configuredFlagIds = event2.flags.map((flag2) => flag2.id);
|
|
3932
4953
|
const actionFlagIds = event2.actions.flatMap(
|
|
3933
|
-
(action) => action.flags.map((
|
|
4954
|
+
(action) => (action.flags ?? []).map((flag2) => flag2.id)
|
|
3934
4955
|
);
|
|
3935
4956
|
for (const actionFlagId of actionFlagIds) {
|
|
3936
4957
|
const isConfigured = configuredFlagIds.includes(actionFlagId);
|
|
@@ -3966,11 +4987,11 @@ function validateActionOrder(event2, ctx) {
|
|
|
3966
4987
|
}
|
|
3967
4988
|
|
|
3968
4989
|
// ../commons/src/events/EventConfig.ts
|
|
3969
|
-
var EventFieldReference =
|
|
4990
|
+
var EventFieldReference = z34.object({ $$event: EventMetadataDateFieldIdInput }).describe(
|
|
3970
4991
|
"Reference to a field defined in the event metadata, using the field id."
|
|
3971
4992
|
);
|
|
3972
|
-
var _EventConfigBase =
|
|
3973
|
-
id:
|
|
4993
|
+
var _EventConfigBase = z34.object({
|
|
4994
|
+
id: z34.string().describe(
|
|
3974
4995
|
'Machine-readable identifier of the event (e.g. "birth", "death").'
|
|
3975
4996
|
),
|
|
3976
4997
|
dateOfEvent: FieldReference.or(EventFieldReference).optional().describe(
|
|
@@ -3989,23 +5010,26 @@ var _EventConfigBase = z33.object({
|
|
|
3989
5010
|
"Summary information displayed in the event overview."
|
|
3990
5011
|
),
|
|
3991
5012
|
label: TranslationConfig.describe("Human-readable label for the event type."),
|
|
3992
|
-
actions:
|
|
5013
|
+
actions: z34.array(ActionConfig).describe(
|
|
3993
5014
|
"Configuration of core and custom actions associated with the event."
|
|
3994
5015
|
),
|
|
3995
|
-
actionOrder:
|
|
5016
|
+
actionOrder: z34.array(z34.string()).optional().describe(
|
|
3996
5017
|
"Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
|
|
3997
5018
|
),
|
|
3998
5019
|
declaration: DeclarationFormConfig.describe(
|
|
3999
5020
|
"Configuration of the form used to gather event data."
|
|
4000
5021
|
),
|
|
4001
|
-
advancedSearch:
|
|
5022
|
+
advancedSearch: z34.array(AdvancedSearchConfig).optional().default([]).describe(
|
|
4002
5023
|
"Configuration of fields available in the advanced search feature."
|
|
4003
5024
|
),
|
|
4004
|
-
flags:
|
|
5025
|
+
flags: z34.array(FlagConfig).optional().default([]).describe(
|
|
4005
5026
|
"Configuration of custom flags associated with the actions of this event type."
|
|
4006
5027
|
),
|
|
4007
|
-
analytics:
|
|
5028
|
+
analytics: z34.boolean().optional().default(true).describe(
|
|
4008
5029
|
"Indicates whether the records of this event type are included in analytics"
|
|
5030
|
+
),
|
|
5031
|
+
icon: z34.partialRecord(AvailableIcons, Conditional).optional().describe(
|
|
5032
|
+
'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.'
|
|
4009
5033
|
)
|
|
4010
5034
|
});
|
|
4011
5035
|
var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
|
|
@@ -4222,21 +5246,31 @@ var event = Object.assign(eventFn, {
|
|
|
4222
5246
|
return {
|
|
4223
5247
|
$event: field3
|
|
4224
5248
|
};
|
|
4225
|
-
}
|
|
5249
|
+
},
|
|
5250
|
+
/**
|
|
5251
|
+
* Checks if the event currently has the given status.
|
|
5252
|
+
* @param eventStatus - The status to check for.
|
|
5253
|
+
*/
|
|
5254
|
+
hasStatus: (eventStatus) => status(eventStatus),
|
|
5255
|
+
/**
|
|
5256
|
+
* Checks if the event currently carries the given flag.
|
|
5257
|
+
* @param flagValue - The flag to check for.
|
|
5258
|
+
*/
|
|
5259
|
+
hasFlag: (flagValue) => flag(flagValue)
|
|
4226
5260
|
});
|
|
4227
5261
|
|
|
4228
5262
|
// ../commons/src/events/WorkqueueColumnConfig.ts
|
|
4229
|
-
var
|
|
5263
|
+
var z35 = __toESM(require("zod/v4"));
|
|
4230
5264
|
var WorkqueueColumnKeysArray = [
|
|
4231
5265
|
...EventMetadataKeysArray,
|
|
4232
5266
|
"title",
|
|
4233
5267
|
"outbox"
|
|
4234
5268
|
];
|
|
4235
|
-
var WorkqueueColumnKeys =
|
|
4236
|
-
var WorkqueueColumnValue =
|
|
5269
|
+
var WorkqueueColumnKeys = z35.enum(WorkqueueColumnKeysArray);
|
|
5270
|
+
var WorkqueueColumnValue = z35.object({
|
|
4237
5271
|
$event: WorkqueueColumnKeys
|
|
4238
5272
|
});
|
|
4239
|
-
var WorkqueueColumn =
|
|
5273
|
+
var WorkqueueColumn = z35.object({
|
|
4240
5274
|
label: TranslationConfig,
|
|
4241
5275
|
value: WorkqueueColumnValue
|
|
4242
5276
|
}).meta({
|
|
@@ -4250,164 +5284,56 @@ function defineWorkqueuesColumns(workqueueColumns) {
|
|
|
4250
5284
|
}
|
|
4251
5285
|
|
|
4252
5286
|
// ../commons/src/events/CountryConfigQueryInput.ts
|
|
4253
|
-
var
|
|
4254
|
-
var SerializableExact =
|
|
4255
|
-
type:
|
|
4256
|
-
term:
|
|
4257
|
-
});
|
|
4258
|
-
var SerializableWithin =
|
|
4259
|
-
type:
|
|
4260
|
-
location:
|
|
4261
|
-
});
|
|
4262
|
-
var SerializedQueryExpression =
|
|
4263
|
-
eventType:
|
|
4264
|
-
status:
|
|
4265
|
-
createdAt:
|
|
4266
|
-
updatedAt:
|
|
4267
|
-
"legalStatuses.DECLARED.createdAtLocation":
|
|
4268
|
-
"legalStatuses.DECLARED.createdByRole":
|
|
4269
|
-
"legalStatuses.REGISTERED.createdAt":
|
|
4270
|
-
"legalStatuses.REGISTERED.createdAtLocation":
|
|
4271
|
-
"legalStatuses.REGISTERED.createdByRole":
|
|
4272
|
-
"legalStatuses.REGISTERED.registrationNumber":
|
|
4273
|
-
createdAtLocation:
|
|
4274
|
-
|
|
5287
|
+
var z36 = __toESM(require("zod/v4"));
|
|
5288
|
+
var SerializableExact = z36.object({
|
|
5289
|
+
type: z36.literal("exact"),
|
|
5290
|
+
term: z36.union([z36.string(), SerializedUserField])
|
|
5291
|
+
});
|
|
5292
|
+
var SerializableWithin = z36.object({
|
|
5293
|
+
type: z36.literal("within"),
|
|
5294
|
+
location: z36.union([z36.string(), SerializedUserField])
|
|
5295
|
+
});
|
|
5296
|
+
var SerializedQueryExpression = z36.object({
|
|
5297
|
+
eventType: z36.string(),
|
|
5298
|
+
status: z36.optional(z36.union([AnyOfStatus, ExactStatus])),
|
|
5299
|
+
createdAt: z36.optional(DateCondition),
|
|
5300
|
+
updatedAt: z36.optional(DateCondition),
|
|
5301
|
+
"legalStatuses.DECLARED.createdAtLocation": z36.optional(SerializableWithin),
|
|
5302
|
+
"legalStatuses.DECLARED.createdByRole": z36.optional(AnyOf),
|
|
5303
|
+
"legalStatuses.REGISTERED.createdAt": z36.optional(DateCondition),
|
|
5304
|
+
"legalStatuses.REGISTERED.createdAtLocation": z36.optional(SerializableWithin),
|
|
5305
|
+
"legalStatuses.REGISTERED.createdByRole": z36.optional(AnyOf),
|
|
5306
|
+
"legalStatuses.REGISTERED.registrationNumber": z36.optional(Exact),
|
|
5307
|
+
createdAtLocation: z36.optional(
|
|
5308
|
+
z36.union([SerializableWithin, SerializableExact])
|
|
4275
5309
|
),
|
|
4276
|
-
updatedAtLocation:
|
|
4277
|
-
|
|
5310
|
+
updatedAtLocation: z36.optional(
|
|
5311
|
+
z36.union([SerializableWithin, SerializableExact])
|
|
4278
5312
|
),
|
|
4279
|
-
updatedByUserRole:
|
|
4280
|
-
assignedTo:
|
|
4281
|
-
createdBy:
|
|
5313
|
+
updatedByUserRole: z36.optional(SerializableExact),
|
|
5314
|
+
assignedTo: z36.optional(SerializableExact),
|
|
5315
|
+
createdBy: z36.optional(SerializableExact),
|
|
4282
5316
|
createdByUserType: ExactUserType,
|
|
4283
|
-
updatedBy:
|
|
4284
|
-
trackingId:
|
|
4285
|
-
flags:
|
|
5317
|
+
updatedBy: z36.optional(SerializableExact),
|
|
5318
|
+
trackingId: z36.optional(Exact),
|
|
5319
|
+
flags: z36.optional(ContainsFlags),
|
|
4286
5320
|
data: QueryInput
|
|
4287
5321
|
}).partial();
|
|
4288
|
-
var Or2 =
|
|
4289
|
-
type:
|
|
4290
|
-
clauses:
|
|
5322
|
+
var Or2 = z36.object({
|
|
5323
|
+
type: z36.literal("or"),
|
|
5324
|
+
clauses: z36.array(SerializedQueryExpression)
|
|
4291
5325
|
});
|
|
4292
|
-
var And2 =
|
|
4293
|
-
type:
|
|
4294
|
-
clauses:
|
|
5326
|
+
var And2 = z36.object({
|
|
5327
|
+
type: z36.literal("and"),
|
|
5328
|
+
clauses: z36.array(SerializedQueryExpression)
|
|
4295
5329
|
});
|
|
4296
|
-
var CountryConfigQueryType =
|
|
4297
|
-
var CountryConfigQueryInputType =
|
|
5330
|
+
var CountryConfigQueryType = z36.discriminatedUnion("type", [And2, Or2]);
|
|
5331
|
+
var CountryConfigQueryInputType = z36.union([
|
|
4298
5332
|
SerializedQueryExpression,
|
|
4299
5333
|
And2,
|
|
4300
5334
|
Or2
|
|
4301
5335
|
]);
|
|
4302
5336
|
|
|
4303
|
-
// ../commons/src/icons.ts
|
|
4304
|
-
var z36 = __toESM(require("zod/v4"));
|
|
4305
|
-
var AvailableIcons = z36.enum([
|
|
4306
|
-
"Archived",
|
|
4307
|
-
"Assigned",
|
|
4308
|
-
"Briefcase",
|
|
4309
|
-
"Certified",
|
|
4310
|
-
"Close",
|
|
4311
|
-
"Collapse",
|
|
4312
|
-
"Draft",
|
|
4313
|
-
"DuplicateYellow",
|
|
4314
|
-
"Expand",
|
|
4315
|
-
"ExternalValidate",
|
|
4316
|
-
"FilledCheck",
|
|
4317
|
-
"InReview",
|
|
4318
|
-
"Offline",
|
|
4319
|
-
"Registered",
|
|
4320
|
-
"RequiresUpdates",
|
|
4321
|
-
"Sent",
|
|
4322
|
-
"Validated",
|
|
4323
|
-
"WaitingApproval",
|
|
4324
|
-
"ChartActivity",
|
|
4325
|
-
"Activity",
|
|
4326
|
-
"Archive",
|
|
4327
|
-
"ArchiveTray",
|
|
4328
|
-
"ArrowLeft",
|
|
4329
|
-
"ArrowRight",
|
|
4330
|
-
"Buildings",
|
|
4331
|
-
"Circle",
|
|
4332
|
-
"CaretDown",
|
|
4333
|
-
"CaretLeft",
|
|
4334
|
-
"CaretRight",
|
|
4335
|
-
"ChartBar",
|
|
4336
|
-
"ChartLine",
|
|
4337
|
-
"ChatCircle",
|
|
4338
|
-
"CheckSquare",
|
|
4339
|
-
"Compass",
|
|
4340
|
-
"Check",
|
|
4341
|
-
"Copy",
|
|
4342
|
-
"Database",
|
|
4343
|
-
"DotsThreeVertical",
|
|
4344
|
-
"ArrowCounterClockwise",
|
|
4345
|
-
"MagnifyingGlassMinus",
|
|
4346
|
-
"MagnifyingGlassPlus",
|
|
4347
|
-
"Export",
|
|
4348
|
-
"Eye",
|
|
4349
|
-
"EyeSlash",
|
|
4350
|
-
"Envelope",
|
|
4351
|
-
"File",
|
|
4352
|
-
"FileSearch",
|
|
4353
|
-
"FileMinus",
|
|
4354
|
-
"FilePlus",
|
|
4355
|
-
"FileText",
|
|
4356
|
-
"FileX",
|
|
4357
|
-
"Handshake",
|
|
4358
|
-
"Gear",
|
|
4359
|
-
"GitBranch",
|
|
4360
|
-
"IdentificationCard",
|
|
4361
|
-
"List",
|
|
4362
|
-
"ListBullets",
|
|
4363
|
-
"Lock",
|
|
4364
|
-
"MagnifyingGlass",
|
|
4365
|
-
"MapPin",
|
|
4366
|
-
"Medal",
|
|
4367
|
-
"NotePencil",
|
|
4368
|
-
"Paperclip",
|
|
4369
|
-
"PaperPlaneTilt",
|
|
4370
|
-
"Pen",
|
|
4371
|
-
"PenNib",
|
|
4372
|
-
"Pencil",
|
|
4373
|
-
"PencilSimpleLine",
|
|
4374
|
-
"Phone",
|
|
4375
|
-
"Plus",
|
|
4376
|
-
"Printer",
|
|
4377
|
-
"SignOut",
|
|
4378
|
-
"Stamp",
|
|
4379
|
-
"Star",
|
|
4380
|
-
"Target",
|
|
4381
|
-
"TextT",
|
|
4382
|
-
"Trash",
|
|
4383
|
-
"UploadSimple",
|
|
4384
|
-
"User",
|
|
4385
|
-
"UserPlus",
|
|
4386
|
-
"Users",
|
|
4387
|
-
"WarningCircle",
|
|
4388
|
-
"X",
|
|
4389
|
-
"ChatText",
|
|
4390
|
-
"CircleWavyCheck",
|
|
4391
|
-
"CircleWavyQuestion",
|
|
4392
|
-
"ArchiveBox",
|
|
4393
|
-
"ArrowCircleDown",
|
|
4394
|
-
"FileArrowUp",
|
|
4395
|
-
"FileDotted",
|
|
4396
|
-
"Files",
|
|
4397
|
-
"PencilLine",
|
|
4398
|
-
"PencilCircle",
|
|
4399
|
-
"UserCircle",
|
|
4400
|
-
"Clock",
|
|
4401
|
-
"QrCode",
|
|
4402
|
-
"Webcam",
|
|
4403
|
-
"Sun",
|
|
4404
|
-
"DeviceTabletCamera",
|
|
4405
|
-
"Globe",
|
|
4406
|
-
"Fingerprint",
|
|
4407
|
-
"PushPin",
|
|
4408
|
-
"Timer"
|
|
4409
|
-
]);
|
|
4410
|
-
|
|
4411
5337
|
// ../commons/src/events/WorkqueueConfig.ts
|
|
4412
5338
|
var mandatoryColumns = defineWorkqueuesColumns([
|
|
4413
5339
|
{
|
|
@@ -4538,10 +5464,7 @@ var DeclareActionInput = BaseActionInput.extend(
|
|
|
4538
5464
|
);
|
|
4539
5465
|
var EditActionInput = BaseActionInput.extend(
|
|
4540
5466
|
z38.object({
|
|
4541
|
-
type: z38.literal(ActionType.EDIT).default(ActionType.EDIT)
|
|
4542
|
-
content: z38.object({
|
|
4543
|
-
comment: z38.string().describe("Comment for the edit action.").optional()
|
|
4544
|
-
})
|
|
5467
|
+
type: z38.literal(ActionType.EDIT).default(ActionType.EDIT)
|
|
4545
5468
|
}).shape
|
|
4546
5469
|
);
|
|
4547
5470
|
var PrintCertificateActionInput = BaseActionInput.extend(
|
|
@@ -4583,6 +5506,11 @@ var ArchiveActionInput = BaseActionInput.extend(
|
|
|
4583
5506
|
content: ReasonContent
|
|
4584
5507
|
}).shape
|
|
4585
5508
|
);
|
|
5509
|
+
var UnarchiveActionInput = BaseActionInput.extend(
|
|
5510
|
+
z38.object({
|
|
5511
|
+
type: z38.literal(ActionType.UNARCHIVE).default(ActionType.UNARCHIVE)
|
|
5512
|
+
}).shape
|
|
5513
|
+
);
|
|
4586
5514
|
var AssignActionInput = BaseActionInput.extend(
|
|
4587
5515
|
z38.object({
|
|
4588
5516
|
type: z38.literal(ActionType.ASSIGN),
|
|
@@ -4644,6 +5572,7 @@ var ActionInput = z38.discriminatedUnion("type", [
|
|
|
4644
5572
|
id: "MarkNotDuplicateActionInput"
|
|
4645
5573
|
}),
|
|
4646
5574
|
ArchiveActionInput.meta({ id: "ArchiveActionInput" }),
|
|
5575
|
+
UnarchiveActionInput.meta({ id: "UnarchiveActionInput" }),
|
|
4647
5576
|
AssignActionInput.meta({ id: "AssignActionInput" }),
|
|
4648
5577
|
UnassignActionInput.meta({ id: "UnassignActionInput" }),
|
|
4649
5578
|
PrintCertificateActionInput.meta({ id: "PrintCertificateActionInput" }),
|
|
@@ -4684,14 +5613,14 @@ var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
|
|
|
4684
5613
|
|
|
4685
5614
|
// ../commons/src/events/EventInput.ts
|
|
4686
5615
|
var z40 = __toESM(require("zod/v4"));
|
|
4687
|
-
var
|
|
5616
|
+
var import_uuid11 = require("uuid");
|
|
4688
5617
|
var EventInput = z40.object({
|
|
4689
5618
|
transactionId: z40.string(),
|
|
4690
5619
|
type: z40.string(),
|
|
4691
5620
|
createdAtLocation: UUID.nullish().describe(
|
|
4692
5621
|
"Location where the event occurred. Required for system users."
|
|
4693
5622
|
)
|
|
4694
|
-
}).meta({ default: { transactionId: (0,
|
|
5623
|
+
}).meta({ default: { transactionId: (0, import_uuid11.v4)(), type: "birth" } });
|
|
4695
5624
|
|
|
4696
5625
|
// ../commons/src/events/EventDocument.ts
|
|
4697
5626
|
var z41 = __toESM(require("zod/v4"));
|
|
@@ -4708,69 +5637,6 @@ var EventDocument = z41.object({
|
|
|
4708
5637
|
)
|
|
4709
5638
|
}).meta({ id: "EventDocument" });
|
|
4710
5639
|
|
|
4711
|
-
// ../commons/src/events/state/index.ts
|
|
4712
|
-
var import_lodash4 = require("lodash");
|
|
4713
|
-
|
|
4714
|
-
// ../commons/src/events/state/utils.ts
|
|
4715
|
-
var import_lodash2 = require("lodash");
|
|
4716
|
-
var updateActions = ActionTypes.extract([
|
|
4717
|
-
ActionType.CREATE,
|
|
4718
|
-
ActionType.NOTIFY,
|
|
4719
|
-
ActionType.EDIT,
|
|
4720
|
-
ActionType.DECLARE,
|
|
4721
|
-
ActionType.REGISTER,
|
|
4722
|
-
ActionType.REJECT,
|
|
4723
|
-
ActionType.ARCHIVE,
|
|
4724
|
-
ActionType.PRINT_CERTIFICATE,
|
|
4725
|
-
ActionType.REQUEST_CORRECTION,
|
|
4726
|
-
ActionType.APPROVE_CORRECTION,
|
|
4727
|
-
ActionType.REJECT_CORRECTION,
|
|
4728
|
-
ActionType.CUSTOM
|
|
4729
|
-
]);
|
|
4730
|
-
|
|
4731
|
-
// ../commons/src/events/state/flags.ts
|
|
4732
|
-
var import_lodash3 = require("lodash");
|
|
4733
|
-
var import_date_fns3 = require("date-fns");
|
|
4734
|
-
var INHERENT_FLAG_RULES = [
|
|
4735
|
-
{
|
|
4736
|
-
flag: InherentFlags.CORRECTION_REQUESTED,
|
|
4737
|
-
setOn: [ActionType.REQUEST_CORRECTION],
|
|
4738
|
-
resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
|
|
4739
|
-
},
|
|
4740
|
-
{
|
|
4741
|
-
// INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
|
|
4742
|
-
// other status-changing action (see getStatusFromActions).
|
|
4743
|
-
flag: InherentFlags.INCOMPLETE,
|
|
4744
|
-
setOn: [ActionType.NOTIFY],
|
|
4745
|
-
resetOn: [
|
|
4746
|
-
ActionType.CREATE,
|
|
4747
|
-
ActionType.DECLARE,
|
|
4748
|
-
ActionType.REGISTER,
|
|
4749
|
-
ActionType.ARCHIVE
|
|
4750
|
-
]
|
|
4751
|
-
},
|
|
4752
|
-
{
|
|
4753
|
-
flag: InherentFlags.REJECTED,
|
|
4754
|
-
setOn: [ActionType.REJECT],
|
|
4755
|
-
resetOn: [
|
|
4756
|
-
ActionType.NOTIFY,
|
|
4757
|
-
ActionType.DECLARE,
|
|
4758
|
-
ActionType.EDIT,
|
|
4759
|
-
ActionType.REGISTER
|
|
4760
|
-
]
|
|
4761
|
-
},
|
|
4762
|
-
{
|
|
4763
|
-
flag: InherentFlags.POTENTIAL_DUPLICATE,
|
|
4764
|
-
setOn: [ActionType.DUPLICATE_DETECTED],
|
|
4765
|
-
resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
|
|
4766
|
-
},
|
|
4767
|
-
{
|
|
4768
|
-
flag: InherentFlags.EDIT_IN_PROGRESS,
|
|
4769
|
-
setOn: [ActionType.EDIT],
|
|
4770
|
-
resetOnAnyOtherAction: true
|
|
4771
|
-
}
|
|
4772
|
-
];
|
|
4773
|
-
|
|
4774
5640
|
// ../commons/src/events/defineConfig.ts
|
|
4775
5641
|
var IGNORED_EVENT_TYPES = [
|
|
4776
5642
|
"FOOTBALL_CLUB_MEMBERSHIP",
|
|
@@ -7243,21 +8109,69 @@ var LocationTypeV1 = z43.enum([
|
|
|
7243
8109
|
"CRVS_OFFICE",
|
|
7244
8110
|
"HEALTH_FACILITY"
|
|
7245
8111
|
]);
|
|
8112
|
+
var LocationStatus = z43.enum(["active", "inactive"]);
|
|
8113
|
+
var LocationVersion = z43.object({
|
|
8114
|
+
versionId: UUID,
|
|
8115
|
+
effectiveFrom: z43.iso.date(),
|
|
8116
|
+
name: z43.string(),
|
|
8117
|
+
externalId: z43.string().nullish(),
|
|
8118
|
+
status: LocationStatus
|
|
8119
|
+
});
|
|
7246
8120
|
var AdministrativeArea = z43.object({
|
|
7247
8121
|
id: UUID,
|
|
7248
8122
|
name: z43.string(),
|
|
7249
8123
|
externalId: z43.string().nullish(),
|
|
7250
8124
|
parentId: UUID.nullable(),
|
|
7251
|
-
|
|
8125
|
+
status: LocationStatus,
|
|
8126
|
+
versions: z43.array(LocationVersion)
|
|
7252
8127
|
});
|
|
7253
8128
|
var Location = z43.object({
|
|
7254
8129
|
id: UUID,
|
|
7255
8130
|
name: z43.string(),
|
|
7256
8131
|
externalId: z43.string().nullish(),
|
|
7257
8132
|
administrativeAreaId: UUID.nullable(),
|
|
7258
|
-
|
|
8133
|
+
locationType: z43.string().nullable(),
|
|
8134
|
+
status: LocationStatus,
|
|
8135
|
+
versions: z43.array(LocationVersion)
|
|
8136
|
+
});
|
|
8137
|
+
var ClientAdministrativeArea = AdministrativeArea.omit({
|
|
8138
|
+
name: true,
|
|
8139
|
+
status: true,
|
|
8140
|
+
externalId: true
|
|
8141
|
+
});
|
|
8142
|
+
var ClientLocation = Location.omit({
|
|
8143
|
+
name: true,
|
|
8144
|
+
status: true,
|
|
8145
|
+
externalId: true
|
|
8146
|
+
});
|
|
8147
|
+
function toClientLocation(location) {
|
|
8148
|
+
return {
|
|
8149
|
+
id: location.id,
|
|
8150
|
+
administrativeAreaId: location.administrativeAreaId,
|
|
8151
|
+
locationType: location.locationType,
|
|
8152
|
+
versions: location.versions
|
|
8153
|
+
};
|
|
8154
|
+
}
|
|
8155
|
+
function toClientAdministrativeArea(area) {
|
|
8156
|
+
return {
|
|
8157
|
+
id: area.id,
|
|
8158
|
+
parentId: area.parentId,
|
|
8159
|
+
versions: area.versions
|
|
8160
|
+
};
|
|
8161
|
+
}
|
|
8162
|
+
var SetLocationPayload = z43.object({
|
|
8163
|
+
id: UUID,
|
|
8164
|
+
name: z43.string(),
|
|
8165
|
+
externalId: z43.string().nullish(),
|
|
8166
|
+
administrativeAreaId: UUID.nullable(),
|
|
7259
8167
|
locationType: z43.string().nullable()
|
|
7260
8168
|
});
|
|
8169
|
+
var SetAdministrativeAreaPayload = z43.object({
|
|
8170
|
+
id: UUID,
|
|
8171
|
+
name: z43.string(),
|
|
8172
|
+
externalId: z43.string().nullish(),
|
|
8173
|
+
parentId: UUID.nullable()
|
|
8174
|
+
});
|
|
7261
8175
|
|
|
7262
8176
|
// ../commons/src/events/scopes.ts
|
|
7263
8177
|
var ACTION_SCOPE_MAP = {
|
|
@@ -7279,6 +8193,7 @@ var ACTION_SCOPE_MAP = {
|
|
|
7279
8193
|
[ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
|
|
7280
8194
|
[ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
|
|
7281
8195
|
[ActionType.ARCHIVE]: ["record.archive"],
|
|
8196
|
+
[ActionType.UNARCHIVE]: ["record.unarchive"],
|
|
7282
8197
|
[ActionType.REJECT]: ["record.reject"],
|
|
7283
8198
|
[ActionType.ASSIGN]: null,
|
|
7284
8199
|
[ActionType.UNASSIGN]: null,
|
|
@@ -7321,22 +8236,27 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
|
7321
8236
|
ActionType.CUSTOM,
|
|
7322
8237
|
ClientSpecificAction.REVIEW_CORRECTION_REQUEST
|
|
7323
8238
|
],
|
|
7324
|
-
[EventStatus.enum.ARCHIVED]: [
|
|
8239
|
+
[EventStatus.enum.ARCHIVED]: [
|
|
8240
|
+
ActionType.READ,
|
|
8241
|
+
ActionType.CUSTOM,
|
|
8242
|
+
ActionType.UNARCHIVE
|
|
8243
|
+
]
|
|
7325
8244
|
};
|
|
7326
8245
|
var ACTION_FILTERS = {
|
|
7327
|
-
[ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
7328
|
-
[ActionType.REQUEST_CORRECTION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
7329
|
-
[ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
7330
|
-
[ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
7331
|
-
[ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
7332
|
-
[ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((
|
|
7333
|
-
[ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((
|
|
7334
|
-
[ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((
|
|
7335
|
-
[ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((
|
|
7336
|
-
[ActionType.ARCHIVE]: (flags) => !flags.some((
|
|
7337
|
-
[ActionType.
|
|
7338
|
-
[ActionType.
|
|
7339
|
-
[ActionType.
|
|
8246
|
+
[ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8247
|
+
[ActionType.REQUEST_CORRECTION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8248
|
+
[ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8249
|
+
[ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8250
|
+
[ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8251
|
+
[ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8252
|
+
[ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8253
|
+
[ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8254
|
+
[ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8255
|
+
[ActionType.ARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8256
|
+
[ActionType.UNARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8257
|
+
[ActionType.ASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8258
|
+
[ActionType.UNASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8259
|
+
[ActionType.CUSTOM]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested"))
|
|
7340
8260
|
};
|
|
7341
8261
|
var REJECTED_ACTIONS = [
|
|
7342
8262
|
ActionType.READ,
|
|
@@ -7350,75 +8270,80 @@ var REJECTED_ACTIONS = [
|
|
|
7350
8270
|
var import_lodash7 = require("lodash");
|
|
7351
8271
|
|
|
7352
8272
|
// ../commons/src/events/mocks.test.utils.ts
|
|
7353
|
-
|
|
8273
|
+
function withVersionFields(entity) {
|
|
8274
|
+
return {
|
|
8275
|
+
...entity,
|
|
8276
|
+
status: "active",
|
|
8277
|
+
versions: [
|
|
8278
|
+
{
|
|
8279
|
+
versionId: entity.id,
|
|
8280
|
+
effectiveFrom: "0001-01-01",
|
|
8281
|
+
name: entity.name,
|
|
8282
|
+
externalId: entity.externalId ?? null,
|
|
8283
|
+
status: "active"
|
|
8284
|
+
}
|
|
8285
|
+
]
|
|
8286
|
+
};
|
|
8287
|
+
}
|
|
8288
|
+
var MOCK_ADMINISTRATIVE_AREAS_BASE = [
|
|
7354
8289
|
{
|
|
7355
8290
|
id: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
7356
8291
|
name: "Central",
|
|
7357
8292
|
parentId: null,
|
|
7358
|
-
validUntil: null,
|
|
7359
8293
|
externalId: "ydyJb1RAy4U1"
|
|
7360
8294
|
},
|
|
7361
8295
|
{
|
|
7362
8296
|
id: "c599b691-fd2d-45e1-abf4-d185de727fb5",
|
|
7363
8297
|
name: "Sulaka",
|
|
7364
8298
|
parentId: null,
|
|
7365
|
-
validUntil: null,
|
|
7366
8299
|
externalId: "pQ8nGxWmZ2Q3"
|
|
7367
8300
|
},
|
|
7368
8301
|
{
|
|
7369
8302
|
id: "7ef2b9c7-5e6d-49f6-ae05-656207d0fc64",
|
|
7370
8303
|
name: "Pualula",
|
|
7371
8304
|
parentId: null,
|
|
7372
|
-
validUntil: null,
|
|
7373
8305
|
externalId: "Aq91DweLmT8k"
|
|
7374
8306
|
},
|
|
7375
8307
|
{
|
|
7376
8308
|
id: "6d1a59df-988c-4021-a846-ccbc021931a7",
|
|
7377
8309
|
name: "Chuminga",
|
|
7378
8310
|
parentId: null,
|
|
7379
|
-
validUntil: null,
|
|
7380
8311
|
externalId: "Rw0fYNh2Xk9a"
|
|
7381
8312
|
},
|
|
7382
8313
|
{
|
|
7383
8314
|
id: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7384
8315
|
name: "Ibombo",
|
|
7385
8316
|
parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
7386
|
-
validUntil: null,
|
|
7387
8317
|
externalId: "k7DsP4vbN1Qe"
|
|
7388
8318
|
},
|
|
7389
8319
|
{
|
|
7390
8320
|
id: "27160bbd-32d1-4625-812f-860226bfb92a",
|
|
7391
8321
|
name: "Isango",
|
|
7392
8322
|
parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
7393
|
-
validUntil: null,
|
|
7394
8323
|
externalId: "Gm3Z9eQpHw4L"
|
|
7395
8324
|
},
|
|
7396
8325
|
{
|
|
7397
8326
|
id: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
7398
8327
|
name: "Isamba",
|
|
7399
8328
|
parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
7400
|
-
validUntil: null,
|
|
7401
8329
|
externalId: "sT0xVu1KqJ7r"
|
|
7402
8330
|
},
|
|
7403
8331
|
{
|
|
7404
8332
|
id: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
7405
8333
|
name: "Itambo",
|
|
7406
8334
|
parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
7407
|
-
validUntil: null,
|
|
7408
8335
|
externalId: "Nq6Bv2HpL9Te"
|
|
7409
8336
|
},
|
|
7410
8337
|
{
|
|
7411
8338
|
id: "d42ab2fe-e7ed-470e-8b31-4fb27f9b8250",
|
|
7412
8339
|
name: "Ezhi",
|
|
7413
8340
|
parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
7414
|
-
validUntil: null,
|
|
7415
8341
|
externalId: "xK8cQ0ZRy5Wd"
|
|
7416
8342
|
},
|
|
7417
8343
|
{
|
|
7418
8344
|
id: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
|
|
7419
8345
|
name: "Ilanga",
|
|
7420
8346
|
parentId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
|
|
7421
|
-
validUntil: null,
|
|
7422
8347
|
externalId: "Cq4Jm1XvN8Ls"
|
|
7423
8348
|
},
|
|
7424
8349
|
// Villages under Ibombo (62a0ccb4-880d-4f30-8882-f256007dfff9)
|
|
@@ -7426,49 +8351,42 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
|
|
|
7426
8351
|
id: "1d4e5f6a-7b8c-4912-8efa-345678901234",
|
|
7427
8352
|
name: "Klow",
|
|
7428
8353
|
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7429
|
-
validUntil: null,
|
|
7430
8354
|
externalId: "IkYcYBUcyY2"
|
|
7431
8355
|
},
|
|
7432
8356
|
{
|
|
7433
8357
|
id: "2e5f6a7b-8c9d-4a23-8fab-456789012345",
|
|
7434
8358
|
name: "Mbondo",
|
|
7435
8359
|
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7436
|
-
validUntil: null,
|
|
7437
8360
|
externalId: "Qhvv5hvo3mY"
|
|
7438
8361
|
},
|
|
7439
8362
|
{
|
|
7440
8363
|
id: "3f6a7b8c-9d0e-4b34-8abc-567890123456",
|
|
7441
8364
|
name: "Ndara",
|
|
7442
8365
|
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7443
|
-
validUntil: null,
|
|
7444
8366
|
externalId: "crXh068O9TR"
|
|
7445
8367
|
},
|
|
7446
8368
|
{
|
|
7447
8369
|
id: "4a7b8c9d-0e1f-4c45-abcd-678901234567",
|
|
7448
8370
|
name: "Olani",
|
|
7449
8371
|
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7450
|
-
validUntil: null,
|
|
7451
8372
|
externalId: "r00It8Tvvp7"
|
|
7452
8373
|
},
|
|
7453
8374
|
{
|
|
7454
8375
|
id: "5b8c9d0e-1f2a-4d56-bcde-789012345678",
|
|
7455
8376
|
name: "Pemba",
|
|
7456
8377
|
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7457
|
-
validUntil: null,
|
|
7458
8378
|
externalId: "ZnUWsbONIaH"
|
|
7459
8379
|
},
|
|
7460
8380
|
{
|
|
7461
8381
|
id: "6c9d0e1f-2a3b-4e67-8def-890123456789",
|
|
7462
8382
|
name: "Quanza",
|
|
7463
8383
|
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7464
|
-
validUntil: null,
|
|
7465
8384
|
externalId: "fDZycvQTa7l"
|
|
7466
8385
|
},
|
|
7467
8386
|
{
|
|
7468
8387
|
id: "7d0e1f2a-3b4c-4f78-8efa-901234567890",
|
|
7469
8388
|
name: "Rivka",
|
|
7470
8389
|
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7471
|
-
validUntil: null,
|
|
7472
8390
|
externalId: "KqswxCGTELa"
|
|
7473
8391
|
},
|
|
7474
8392
|
// Villages under Isamba (967032fd-3f81-478a-826c-30cb8fe121bd)
|
|
@@ -7476,35 +8394,30 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
|
|
|
7476
8394
|
id: "8e1f2a3b-4c5d-4089-8fab-012345678901",
|
|
7477
8395
|
name: "Mbula",
|
|
7478
8396
|
parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
7479
|
-
validUntil: null,
|
|
7480
8397
|
externalId: "osEbKjRc9Kg"
|
|
7481
8398
|
},
|
|
7482
8399
|
{
|
|
7483
8400
|
id: "9f2a3b4c-5d6e-4190-8abf-123456789012",
|
|
7484
8401
|
name: "Ndoki",
|
|
7485
8402
|
parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
7486
|
-
validUntil: null,
|
|
7487
8403
|
externalId: "aq4daBUAGr3"
|
|
7488
8404
|
},
|
|
7489
8405
|
{
|
|
7490
8406
|
id: "0a3b4c5d-6e7f-4201-abcd-234567890123",
|
|
7491
8407
|
name: "Tsanga",
|
|
7492
8408
|
parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
7493
|
-
validUntil: null,
|
|
7494
8409
|
externalId: "cqis6Y8trbJ"
|
|
7495
8410
|
},
|
|
7496
8411
|
{
|
|
7497
8412
|
id: "1b4c5d6e-7f8a-4312-bcde-345678901234",
|
|
7498
8413
|
name: "Waziri",
|
|
7499
8414
|
parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
7500
|
-
validUntil: null,
|
|
7501
8415
|
externalId: "LMijHPyyx6d"
|
|
7502
8416
|
},
|
|
7503
8417
|
{
|
|
7504
8418
|
id: "2c5d6e7f-8a9b-4423-8def-456789012345",
|
|
7505
8419
|
name: "Zimbi",
|
|
7506
8420
|
parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
7507
|
-
validUntil: null,
|
|
7508
8421
|
externalId: "pcQYbPuKGZ7"
|
|
7509
8422
|
},
|
|
7510
8423
|
// Villages under Itambo (89a33893-b17d-481d-a26d-6461e7ac1651)
|
|
@@ -7512,67 +8425,59 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
|
|
|
7512
8425
|
id: "3d6e7f8a-9b0c-4534-8efa-567890123456",
|
|
7513
8426
|
name: "Felani",
|
|
7514
8427
|
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
7515
|
-
validUntil: null,
|
|
7516
8428
|
externalId: "gSqpoCGdMXp"
|
|
7517
8429
|
},
|
|
7518
8430
|
{
|
|
7519
8431
|
id: "4e7f8a9b-0c1d-4645-8fab-678901234567",
|
|
7520
8432
|
name: "Goroma",
|
|
7521
8433
|
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
7522
|
-
validUntil: null,
|
|
7523
8434
|
externalId: "KvAAIaNqVrp"
|
|
7524
8435
|
},
|
|
7525
8436
|
{
|
|
7526
8437
|
id: "5f8a9b0c-1d2e-4756-8abc-789012345678",
|
|
7527
8438
|
name: "Halifu",
|
|
7528
8439
|
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
7529
|
-
validUntil: null,
|
|
7530
8440
|
externalId: "qe4UnEVt1hv"
|
|
7531
8441
|
},
|
|
7532
8442
|
{
|
|
7533
8443
|
id: "6a9b0c1d-2e3f-4867-abcd-890123456789",
|
|
7534
8444
|
name: "Jabari",
|
|
7535
8445
|
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
7536
|
-
validUntil: null,
|
|
7537
8446
|
externalId: "yHH9Nz4rLOt"
|
|
7538
8447
|
},
|
|
7539
8448
|
{
|
|
7540
8449
|
id: "7b0c1d2e-3f4a-4978-bcde-901234567890",
|
|
7541
8450
|
name: "Kifani",
|
|
7542
8451
|
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
7543
|
-
validUntil: null,
|
|
7544
8452
|
externalId: "eSWmXIGeu1I"
|
|
7545
8453
|
},
|
|
7546
8454
|
{
|
|
7547
8455
|
id: "8c1d2e3f-4a5b-4089-8def-012345678901",
|
|
7548
8456
|
name: "Lumela",
|
|
7549
8457
|
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
7550
|
-
validUntil: null,
|
|
7551
8458
|
externalId: "bh0b3aI1uP3"
|
|
7552
8459
|
}
|
|
7553
8460
|
];
|
|
7554
|
-
var
|
|
8461
|
+
var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = MOCK_ADMINISTRATIVE_AREAS_BASE.map(withVersionFields);
|
|
8462
|
+
var MOCK_LOCATIONS_BASE = [
|
|
7555
8463
|
{
|
|
7556
8464
|
id: "6f6186ce-cd5f-4a5f-810a-2d99e7c4ba12",
|
|
7557
8465
|
name: "Central Provincial Office",
|
|
7558
8466
|
locationType: "CRVS_OFFICE",
|
|
7559
8467
|
administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
7560
|
-
validUntil: null,
|
|
7561
8468
|
externalId: "Xr3Df8WpK6Ys"
|
|
7562
8469
|
},
|
|
7563
8470
|
{
|
|
7564
8471
|
id: "b1c2d3e4-f5a6-7890-bcde-f12345678901",
|
|
7565
8472
|
name: "Central Health Post",
|
|
7566
8473
|
locationType: "HEALTH_FACILITY",
|
|
7567
|
-
administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c"
|
|
7568
|
-
validUntil: null
|
|
8474
|
+
administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c"
|
|
7569
8475
|
},
|
|
7570
8476
|
{
|
|
7571
8477
|
id: "028d2c85-ca31-426d-b5d1-2cef545a4902",
|
|
7572
8478
|
name: "Ibombo District Office",
|
|
7573
8479
|
locationType: "CRVS_OFFICE",
|
|
7574
8480
|
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7575
|
-
validUntil: null,
|
|
7576
8481
|
externalId: "Sm4Nw7GrD2Vy"
|
|
7577
8482
|
},
|
|
7578
8483
|
{
|
|
@@ -7580,7 +8485,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7580
8485
|
name: "Isamba District Office",
|
|
7581
8486
|
locationType: "CRVS_OFFICE",
|
|
7582
8487
|
administrativeAreaId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
7583
|
-
validUntil: null,
|
|
7584
8488
|
externalId: "Vg1Bq5XeH9Lt"
|
|
7585
8489
|
},
|
|
7586
8490
|
{
|
|
@@ -7588,7 +8492,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7588
8492
|
name: "Isango District Office",
|
|
7589
8493
|
locationType: "CRVS_OFFICE",
|
|
7590
8494
|
administrativeAreaId: "27160bbd-32d1-4625-812f-860226bfb92a",
|
|
7591
|
-
validUntil: null,
|
|
7592
8495
|
externalId: "Je7Lm2XqN9Vz"
|
|
7593
8496
|
},
|
|
7594
8497
|
{
|
|
@@ -7596,7 +8499,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7596
8499
|
name: "Sulaka Provincial Office",
|
|
7597
8500
|
locationType: "CRVS_OFFICE",
|
|
7598
8501
|
administrativeAreaId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
|
|
7599
|
-
validUntil: null,
|
|
7600
8502
|
externalId: "Ht2Wp9KcX5Qv"
|
|
7601
8503
|
},
|
|
7602
8504
|
{
|
|
@@ -7604,7 +8506,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7604
8506
|
name: "Ilanga District Office",
|
|
7605
8507
|
locationType: "CRVS_OFFICE",
|
|
7606
8508
|
administrativeAreaId: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
|
|
7607
|
-
validUntil: null,
|
|
7608
8509
|
externalId: "Yp6Ds1WqN3Xz"
|
|
7609
8510
|
},
|
|
7610
8511
|
{
|
|
@@ -7612,7 +8513,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7612
8513
|
name: "Chamakubi Health Post",
|
|
7613
8514
|
locationType: "HEALTH_FACILITY",
|
|
7614
8515
|
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7615
|
-
validUntil: null,
|
|
7616
8516
|
externalId: "M1nFr8LbC2Qy"
|
|
7617
8517
|
},
|
|
7618
8518
|
{
|
|
@@ -7620,7 +8520,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7620
8520
|
name: "Ibombo Rural Health Centre",
|
|
7621
8521
|
locationType: "HEALTH_FACILITY",
|
|
7622
8522
|
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7623
|
-
validUntil: null,
|
|
7624
8523
|
externalId: "bT7pV6YrW0Xc"
|
|
7625
8524
|
},
|
|
7626
8525
|
{
|
|
@@ -7628,7 +8527,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7628
8527
|
name: "Chikobo Rural Health Centre",
|
|
7629
8528
|
locationType: "HEALTH_FACILITY",
|
|
7630
8529
|
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7631
|
-
validUntil: null,
|
|
7632
8530
|
externalId: "zE4qPn2SgJ5d"
|
|
7633
8531
|
},
|
|
7634
8532
|
{
|
|
@@ -7636,7 +8534,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7636
8534
|
name: "Chilochabalenje Health Post",
|
|
7637
8535
|
locationType: "HEALTH_FACILITY",
|
|
7638
8536
|
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7639
|
-
validUntil: null,
|
|
7640
8537
|
externalId: "H8vDs1MqR4Uf"
|
|
7641
8538
|
},
|
|
7642
8539
|
{
|
|
@@ -7644,7 +8541,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7644
8541
|
name: "Chipeso Rural Health Centre",
|
|
7645
8542
|
locationType: "HEALTH_FACILITY",
|
|
7646
8543
|
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7647
|
-
validUntil: null,
|
|
7648
8544
|
externalId: "Qw3uZ9KfX6Lm"
|
|
7649
8545
|
},
|
|
7650
8546
|
{
|
|
@@ -7652,7 +8548,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7652
8548
|
name: "Chisamba Rural Health Centre",
|
|
7653
8549
|
locationType: "HEALTH_FACILITY",
|
|
7654
8550
|
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7655
|
-
validUntil: null,
|
|
7656
8551
|
externalId: "Yr0pCg8LdM2s"
|
|
7657
8552
|
},
|
|
7658
8553
|
{
|
|
@@ -7660,7 +8555,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7660
8555
|
name: "Chitanda Rural Health Centre",
|
|
7661
8556
|
locationType: "HEALTH_FACILITY",
|
|
7662
8557
|
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7663
|
-
validUntil: null,
|
|
7664
8558
|
externalId: "tS9gJ4PwB1Qx"
|
|
7665
8559
|
},
|
|
7666
8560
|
{
|
|
@@ -7668,7 +8562,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7668
8562
|
name: "Golden Valley Rural Health Centre",
|
|
7669
8563
|
locationType: "HEALTH_FACILITY",
|
|
7670
8564
|
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7671
|
-
validUntil: null,
|
|
7672
8565
|
externalId: "Ld7Qm3XsA8Vr"
|
|
7673
8566
|
},
|
|
7674
8567
|
{
|
|
@@ -7676,7 +8569,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7676
8569
|
name: "Ipongo Rural Health Centre",
|
|
7677
8570
|
locationType: "HEALTH_FACILITY",
|
|
7678
8571
|
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7679
|
-
validUntil: null,
|
|
7680
8572
|
externalId: "kF2sW9DmH0Bt"
|
|
7681
8573
|
},
|
|
7682
8574
|
{
|
|
@@ -7684,7 +8576,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7684
8576
|
name: "Itumbwe Health Post",
|
|
7685
8577
|
locationType: "HEALTH_FACILITY",
|
|
7686
8578
|
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7687
|
-
validUntil: null,
|
|
7688
8579
|
externalId: "Ue5Xb3VaC7Pq"
|
|
7689
8580
|
},
|
|
7690
8581
|
{
|
|
@@ -7692,7 +8583,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7692
8583
|
name: "Kabangalala Rural Health Centre",
|
|
7693
8584
|
locationType: "HEALTH_FACILITY",
|
|
7694
8585
|
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7695
|
-
validUntil: null,
|
|
7696
8586
|
externalId: "Pz8Kc1TqH6Jn"
|
|
7697
8587
|
},
|
|
7698
8588
|
// Village offices
|
|
@@ -7701,19 +8591,76 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7701
8591
|
name: "Klow Village Office",
|
|
7702
8592
|
locationType: "CRVS_OFFICE",
|
|
7703
8593
|
administrativeAreaId: "1d4e5f6a-7b8c-4912-8efa-345678901234",
|
|
7704
|
-
validUntil: null,
|
|
7705
8594
|
externalId: "PmAyxAJkxiJ"
|
|
7706
8595
|
}
|
|
7707
8596
|
];
|
|
8597
|
+
var V2_DEFAULT_MOCK_LOCATIONS = MOCK_LOCATIONS_BASE.map(withVersionFields);
|
|
7708
8598
|
var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
|
|
7709
8599
|
V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, l])
|
|
7710
8600
|
);
|
|
7711
8601
|
var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
|
|
7712
8602
|
V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
|
|
7713
8603
|
);
|
|
8604
|
+
var V2_DEFAULT_MOCK_CLIENT_LOCATIONS_MAP = new Map(
|
|
8605
|
+
V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, toClientLocation(l)])
|
|
8606
|
+
);
|
|
8607
|
+
var V2_DEFAULT_MOCK_CLIENT_ADMINISTRATIVE_AREAS_MAP = new Map(
|
|
8608
|
+
V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [
|
|
8609
|
+
a.id,
|
|
8610
|
+
toClientAdministrativeArea(a)
|
|
8611
|
+
])
|
|
8612
|
+
);
|
|
7714
8613
|
|
|
7715
|
-
// ../commons/src/
|
|
8614
|
+
// ../commons/src/events/locationPayloads.ts
|
|
7716
8615
|
var z44 = __toESM(require("zod/v4"));
|
|
8616
|
+
var CreateLocationPayload = z44.object({
|
|
8617
|
+
id: UUID.optional(),
|
|
8618
|
+
versionId: UUID.optional(),
|
|
8619
|
+
name: z44.string(),
|
|
8620
|
+
externalId: z44.string().nullish(),
|
|
8621
|
+
administrativeAreaId: UUID.nullable(),
|
|
8622
|
+
locationType: z44.string().nullable(),
|
|
8623
|
+
effectiveFrom: z44.iso.date().optional(),
|
|
8624
|
+
status: LocationStatus.default("active")
|
|
8625
|
+
});
|
|
8626
|
+
var UpdateLocationPayload = z44.strictObject({
|
|
8627
|
+
id: UUID,
|
|
8628
|
+
versionId: UUID.optional(),
|
|
8629
|
+
name: z44.string(),
|
|
8630
|
+
externalId: z44.string().nullish(),
|
|
8631
|
+
status: LocationStatus,
|
|
8632
|
+
effectiveFrom: z44.iso.date().optional(),
|
|
8633
|
+
lastVersionId: UUID
|
|
8634
|
+
});
|
|
8635
|
+
var WithdrawLocationVersionPayload = z44.object({
|
|
8636
|
+
id: UUID,
|
|
8637
|
+
versionId: UUID
|
|
8638
|
+
});
|
|
8639
|
+
var CreateAdministrativeAreaPayload = z44.object({
|
|
8640
|
+
id: UUID.optional(),
|
|
8641
|
+
versionId: UUID.optional(),
|
|
8642
|
+
name: z44.string(),
|
|
8643
|
+
externalId: z44.string().nullish(),
|
|
8644
|
+
parentId: UUID.nullable(),
|
|
8645
|
+
effectiveFrom: z44.iso.date().optional(),
|
|
8646
|
+
status: LocationStatus.default("active")
|
|
8647
|
+
});
|
|
8648
|
+
var UpdateAdministrativeAreaPayload = z44.strictObject({
|
|
8649
|
+
id: UUID,
|
|
8650
|
+
versionId: UUID.optional(),
|
|
8651
|
+
name: z44.string(),
|
|
8652
|
+
externalId: z44.string().nullish(),
|
|
8653
|
+
status: LocationStatus,
|
|
8654
|
+
effectiveFrom: z44.iso.date().optional(),
|
|
8655
|
+
lastVersionId: UUID
|
|
8656
|
+
});
|
|
8657
|
+
var WithdrawAdministrativeAreaVersionPayload = z44.object({
|
|
8658
|
+
id: UUID,
|
|
8659
|
+
versionId: UUID
|
|
8660
|
+
});
|
|
8661
|
+
|
|
8662
|
+
// ../commons/src/notification/UserNotifications.ts
|
|
8663
|
+
var z45 = __toESM(require("zod/v4"));
|
|
7717
8664
|
var TriggerEvent = {
|
|
7718
8665
|
USER_CREATED: "user-created",
|
|
7719
8666
|
USER_UPDATED: "user-updated",
|
|
@@ -7726,54 +8673,54 @@ var TriggerEvent = {
|
|
|
7726
8673
|
CHANGE_PHONE_NUMBER: "change-phone-number",
|
|
7727
8674
|
CHANGE_EMAIL_ADDRESS: "change-email-address"
|
|
7728
8675
|
};
|
|
7729
|
-
var Recipient =
|
|
8676
|
+
var Recipient = z45.object({
|
|
7730
8677
|
name: NameFieldValue.optional(),
|
|
7731
|
-
mobile:
|
|
7732
|
-
email:
|
|
7733
|
-
bcc:
|
|
8678
|
+
mobile: z45.string().optional(),
|
|
8679
|
+
email: z45.string().optional(),
|
|
8680
|
+
bcc: z45.array(z45.string()).optional()
|
|
7734
8681
|
});
|
|
7735
|
-
var BasePayload =
|
|
8682
|
+
var BasePayload = z45.object({
|
|
7736
8683
|
recipient: Recipient
|
|
7737
8684
|
});
|
|
7738
8685
|
var TriggerPayload = {
|
|
7739
8686
|
[TriggerEvent.USER_CREATED]: BasePayload.extend({
|
|
7740
|
-
username:
|
|
7741
|
-
temporaryPassword:
|
|
8687
|
+
username: z45.string(),
|
|
8688
|
+
temporaryPassword: z45.string()
|
|
7742
8689
|
}),
|
|
7743
8690
|
[TriggerEvent.USER_UPDATED]: BasePayload.extend({
|
|
7744
|
-
oldUsername:
|
|
7745
|
-
newUsername:
|
|
8691
|
+
oldUsername: z45.string(),
|
|
8692
|
+
newUsername: z45.string()
|
|
7746
8693
|
}),
|
|
7747
8694
|
[TriggerEvent.USERNAME_REMINDER]: BasePayload.extend({
|
|
7748
|
-
username:
|
|
8695
|
+
username: z45.string()
|
|
7749
8696
|
}),
|
|
7750
8697
|
[TriggerEvent.RESET_PASSWORD]: BasePayload.extend({
|
|
7751
|
-
code:
|
|
8698
|
+
code: z45.string()
|
|
7752
8699
|
}),
|
|
7753
8700
|
[TriggerEvent.RESET_PASSWORD_BY_ADMIN]: BasePayload.extend({
|
|
7754
|
-
temporaryPassword:
|
|
7755
|
-
admin:
|
|
7756
|
-
id:
|
|
8701
|
+
temporaryPassword: z45.string(),
|
|
8702
|
+
admin: z45.object({
|
|
8703
|
+
id: z45.string(),
|
|
7757
8704
|
name: NameFieldValue,
|
|
7758
|
-
role:
|
|
8705
|
+
role: z45.string()
|
|
7759
8706
|
})
|
|
7760
8707
|
}),
|
|
7761
8708
|
[TriggerEvent.RESEND_INVITE]: BasePayload.extend({
|
|
7762
|
-
username:
|
|
7763
|
-
temporaryPassword:
|
|
8709
|
+
username: z45.string(),
|
|
8710
|
+
temporaryPassword: z45.string()
|
|
7764
8711
|
}),
|
|
7765
8712
|
[TriggerEvent.TWO_FA]: BasePayload.extend({
|
|
7766
|
-
code:
|
|
8713
|
+
code: z45.string()
|
|
7767
8714
|
}),
|
|
7768
8715
|
[TriggerEvent.ALL_USER_NOTIFICATION]: BasePayload.extend({
|
|
7769
|
-
subject:
|
|
7770
|
-
body:
|
|
8716
|
+
subject: z45.string(),
|
|
8717
|
+
body: z45.string()
|
|
7771
8718
|
}),
|
|
7772
8719
|
[TriggerEvent.CHANGE_PHONE_NUMBER]: BasePayload.extend({
|
|
7773
|
-
code:
|
|
8720
|
+
code: z45.string()
|
|
7774
8721
|
}),
|
|
7775
8722
|
[TriggerEvent.CHANGE_EMAIL_ADDRESS]: BasePayload.extend({
|
|
7776
|
-
code:
|
|
8723
|
+
code: z45.string()
|
|
7777
8724
|
})
|
|
7778
8725
|
};
|
|
7779
8726
|
async function triggerUserEventNotification({
|
|
@@ -7797,4 +8744,4 @@ function parseUserEventTrigger(event2, body) {
|
|
|
7797
8744
|
}
|
|
7798
8745
|
|
|
7799
8746
|
// src/notification/index.ts
|
|
7800
|
-
|
|
8747
|
+
z46.globalRegistry.clear();
|