@opencrvs/toolkit 2.1.0-rc.9e444d5 → 2.1.0-rc.a434ca3
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/create-countryconfig/index.js +59 -24
- package/dist/application-config/index.js +227 -196
- package/dist/cli.js +174 -58
- package/dist/commons/api/router.d.ts +193 -20
- package/dist/commons/conditionals/conditionals.d.ts +3 -3
- package/dist/commons/conditionals/validate.d.ts +11 -4
- package/dist/commons/events/ActionDocument.d.ts +1 -7
- package/dist/commons/events/ActionStatus.d.ts +14 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +6 -0
- package/dist/commons/events/AuditLog.d.ts +110 -0
- package/dist/commons/events/EventConfig.d.ts +3 -0
- package/dist/commons/events/EventIndex.d.ts +3 -26
- package/dist/commons/events/FieldConfig.d.ts +65 -53
- package/dist/commons/events/FieldTypeMapping.d.ts +19 -19
- package/dist/commons/events/FieldValue.d.ts +2 -2
- package/dist/commons/events/Flag.d.ts +42 -0
- package/dist/commons/events/PlainDate.d.ts +8 -0
- package/dist/commons/events/SummaryConfig.d.ts +249 -0
- package/dist/commons/events/WorkqueueConfig.d.ts +17 -14
- package/dist/commons/events/event.d.ts +12 -0
- package/dist/commons/events/locations.d.ts +99 -16
- package/dist/commons/events/mocks.test.utils.d.ts +30 -0
- package/dist/conditionals/index.js +302 -55
- 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 +12 -3
- package/dist/environment/logger.d.ts.map +1 -1
- package/dist/environment/paths.d.ts +7 -0
- package/dist/environment/paths.d.ts.map +1 -0
- package/dist/environment/paths.js +72 -0
- package/dist/environment/setup-environment.js +2 -1
- 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 +17 -5
- package/dist/environment/upgrade.d.ts +2 -0
- package/dist/environment/upgrade.d.ts.map +1 -0
- package/dist/environment/upgrade.js +82 -0
- package/dist/environment/users.js +11 -13
- package/dist/events/index.js +3493 -3250
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +2 -2
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.js +2 -2
- package/dist/notification/index.js +1806 -1050
- package/dist/scopes/index.d.ts +248 -25
- package/dist/scopes/index.js +303 -55
- package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -3
- package/dist/templates/charts-values/opentelemetry/values.yaml +73 -0
- package/opencrvs-toolkit-2.1.0-rc.a434ca3.tgz +0 -0
- package/package.json +5 -5
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.1.0-rc.9e444d5.tgz +0 -0
|
@@ -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",
|
|
@@ -88,7 +339,7 @@ var RecordScopeTypeV2 = z2.enum([
|
|
|
88
339
|
"record.unassign-others",
|
|
89
340
|
"record.custom-action"
|
|
90
341
|
]);
|
|
91
|
-
var PlainScopeType =
|
|
342
|
+
var PlainScopeType = z6.enum([
|
|
92
343
|
// Misc. system scopes
|
|
93
344
|
"bypassratelimit",
|
|
94
345
|
"record.reindex",
|
|
@@ -108,15 +359,15 @@ var PlainScopeType = z2.enum([
|
|
|
108
359
|
"record.confirm-registration",
|
|
109
360
|
"record.reject-registration"
|
|
110
361
|
]);
|
|
111
|
-
var scopeByEvent =
|
|
362
|
+
var scopeByEvent = z6.preprocess(
|
|
112
363
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
113
|
-
|
|
364
|
+
z6.array(z6.string()).optional()
|
|
114
365
|
).describe("Event type, e.g. birth, death");
|
|
115
|
-
var userRole =
|
|
366
|
+
var userRole = z6.preprocess(
|
|
116
367
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
117
|
-
|
|
368
|
+
z6.array(z6.string()).optional()
|
|
118
369
|
).describe("User role, e.g. admin, field agent");
|
|
119
|
-
var scopeOptionsPlaceEvent =
|
|
370
|
+
var scopeOptionsPlaceEvent = z6.object({
|
|
120
371
|
event: scopeByEvent,
|
|
121
372
|
placeOfEvent: JurisdictionFilter.optional()
|
|
122
373
|
}).describe("Options applicable to all record scopes.");
|
|
@@ -128,36 +379,37 @@ var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
|
128
379
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
129
380
|
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
130
381
|
registeredIn: JurisdictionFilter.optional(),
|
|
131
|
-
registeredBy: UserFilter.optional()
|
|
382
|
+
registeredBy: UserFilter.optional(),
|
|
383
|
+
flags: ContainsFlags.optional()
|
|
132
384
|
}).describe(
|
|
133
385
|
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
134
386
|
);
|
|
135
387
|
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
136
|
-
customActionTypes:
|
|
388
|
+
customActionTypes: z6.preprocess(
|
|
137
389
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
138
|
-
|
|
390
|
+
z6.array(z6.string()).optional()
|
|
139
391
|
).describe("Allowed custom action types")
|
|
140
392
|
});
|
|
141
|
-
var AccessLevelOptions =
|
|
393
|
+
var AccessLevelOptions = z6.object({
|
|
142
394
|
accessLevel: JurisdictionFilter.optional()
|
|
143
395
|
});
|
|
144
396
|
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
145
397
|
role: userRole.optional()
|
|
146
398
|
});
|
|
147
|
-
var WorkqueueOrDashboardOptions =
|
|
148
|
-
ids:
|
|
399
|
+
var WorkqueueOrDashboardOptions = z6.object({
|
|
400
|
+
ids: z6.preprocess(
|
|
149
401
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
150
|
-
|
|
402
|
+
z6.array(z6.string())
|
|
151
403
|
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
152
404
|
});
|
|
153
|
-
var AllScopeOptions =
|
|
405
|
+
var AllScopeOptions = z6.object({
|
|
154
406
|
...AllRecordScopeOptions.shape,
|
|
155
407
|
...AccessLevelOptions.shape,
|
|
156
408
|
...AllUserScopeOptions.shape,
|
|
157
409
|
...WorkqueueOrDashboardOptions.shape
|
|
158
410
|
});
|
|
159
411
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
160
|
-
var ResolvedScopeOptionsPlaceEvent =
|
|
412
|
+
var ResolvedScopeOptionsPlaceEvent = z6.object({
|
|
161
413
|
event: scopeByEvent,
|
|
162
414
|
placeOfEvent: UUID.nullish()
|
|
163
415
|
}).describe(
|
|
@@ -165,15 +417,16 @@ var ResolvedScopeOptionsPlaceEvent = z2.object({
|
|
|
165
417
|
);
|
|
166
418
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
167
419
|
notifiedIn: UUID.nullish(),
|
|
168
|
-
notifiedBy:
|
|
420
|
+
notifiedBy: z6.string().optional(),
|
|
169
421
|
declaredIn: UUID.nullish(),
|
|
170
|
-
declaredBy:
|
|
422
|
+
declaredBy: z6.string().optional()
|
|
171
423
|
}).describe(
|
|
172
424
|
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
173
425
|
);
|
|
174
426
|
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
175
427
|
registeredIn: UUID.nullish(),
|
|
176
|
-
registeredBy:
|
|
428
|
+
registeredBy: z6.string().optional(),
|
|
429
|
+
flags: ContainsFlags.optional()
|
|
177
430
|
}).describe(
|
|
178
431
|
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
179
432
|
);
|
|
@@ -198,38 +451,38 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
|
198
451
|
"record.unassign-others"
|
|
199
452
|
]);
|
|
200
453
|
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
201
|
-
templates:
|
|
454
|
+
templates: z6.preprocess(
|
|
202
455
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
203
|
-
|
|
456
|
+
z6.array(z6.string()).optional()
|
|
204
457
|
).describe(
|
|
205
458
|
"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."
|
|
206
459
|
)
|
|
207
460
|
});
|
|
208
|
-
var RecordScopeV2 =
|
|
209
|
-
|
|
461
|
+
var RecordScopeV2 = z6.discriminatedUnion("type", [
|
|
462
|
+
z6.object({
|
|
210
463
|
type: ScopesWithPlaceEventOptions,
|
|
211
464
|
options: scopeOptionsPlaceEvent.optional()
|
|
212
465
|
}),
|
|
213
|
-
|
|
466
|
+
z6.object({
|
|
214
467
|
type: ScopesWithDeclaredOptions,
|
|
215
468
|
options: scopeOptionsDeclaredOrNotified.optional()
|
|
216
469
|
}),
|
|
217
|
-
|
|
470
|
+
z6.object({
|
|
218
471
|
type: ScopesWithFullOptions,
|
|
219
472
|
options: AllRecordScopeOptions.optional()
|
|
220
473
|
}),
|
|
221
|
-
|
|
222
|
-
type:
|
|
474
|
+
z6.object({
|
|
475
|
+
type: z6.literal("record.custom-action"),
|
|
223
476
|
options: CustomActionScopeOptions.optional()
|
|
224
477
|
}),
|
|
225
|
-
|
|
226
|
-
type:
|
|
478
|
+
z6.object({
|
|
479
|
+
type: z6.literal("record.print-certified-copies"),
|
|
227
480
|
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
228
481
|
})
|
|
229
482
|
]).describe(
|
|
230
483
|
"Scopes used to check user's permission to perform actions on a record."
|
|
231
484
|
);
|
|
232
|
-
var SystemScopeType =
|
|
485
|
+
var SystemScopeType = z6.enum([
|
|
233
486
|
"organisation.read-locations",
|
|
234
487
|
"user.read",
|
|
235
488
|
"user.create",
|
|
@@ -243,61 +496,61 @@ var UserScopeType = SystemScopeType.extract([
|
|
|
243
496
|
"user.search"
|
|
244
497
|
]);
|
|
245
498
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
246
|
-
var UserScopeV2 =
|
|
247
|
-
|
|
499
|
+
var UserScopeV2 = z6.discriminatedUnion("type", [
|
|
500
|
+
z6.object({
|
|
248
501
|
type: ScopesWithRoleOption,
|
|
249
502
|
options: AllUserScopeOptions.optional()
|
|
250
503
|
}),
|
|
251
|
-
|
|
504
|
+
z6.object({
|
|
252
505
|
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
253
506
|
options: AccessLevelOptions.optional()
|
|
254
507
|
})
|
|
255
508
|
]);
|
|
256
|
-
var ResolvedRecordScopeV2 =
|
|
257
|
-
|
|
509
|
+
var ResolvedRecordScopeV2 = z6.discriminatedUnion("type", [
|
|
510
|
+
z6.object({
|
|
258
511
|
type: ScopesWithPlaceEventOptions,
|
|
259
512
|
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
260
513
|
}),
|
|
261
|
-
|
|
514
|
+
z6.object({
|
|
262
515
|
type: ScopesWithDeclaredOptions,
|
|
263
516
|
options: ResolvedScopeOptionsDeclared.optional()
|
|
264
517
|
}),
|
|
265
|
-
|
|
518
|
+
z6.object({
|
|
266
519
|
type: ScopesWithFullOptions,
|
|
267
520
|
options: ResolvedScopeOptionsFull.optional()
|
|
268
521
|
}),
|
|
269
|
-
|
|
270
|
-
type:
|
|
522
|
+
z6.object({
|
|
523
|
+
type: z6.literal("record.print-certified-copies"),
|
|
271
524
|
options: ResolvedScopeOptionsFull.extend({
|
|
272
|
-
templates:
|
|
525
|
+
templates: z6.array(z6.string()).optional()
|
|
273
526
|
}).optional()
|
|
274
527
|
})
|
|
275
528
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
276
|
-
var Scope =
|
|
277
|
-
|
|
529
|
+
var Scope = z6.discriminatedUnion("type", [
|
|
530
|
+
z6.object({ type: PlainScopeType }),
|
|
278
531
|
...RecordScopeV2.options,
|
|
279
532
|
...UserScopeV2.options,
|
|
280
|
-
|
|
281
|
-
type:
|
|
533
|
+
z6.object({
|
|
534
|
+
type: z6.literal("organisation.read-locations"),
|
|
282
535
|
options: AccessLevelOptions.optional()
|
|
283
536
|
}),
|
|
284
|
-
|
|
285
|
-
type:
|
|
537
|
+
z6.object({
|
|
538
|
+
type: z6.literal("workqueue"),
|
|
286
539
|
options: WorkqueueOrDashboardOptions
|
|
287
540
|
}),
|
|
288
|
-
|
|
289
|
-
type:
|
|
541
|
+
z6.object({
|
|
542
|
+
type: z6.literal("dashboard.view"),
|
|
290
543
|
options: WorkqueueOrDashboardOptions
|
|
291
544
|
})
|
|
292
545
|
]);
|
|
293
|
-
var ScopeType =
|
|
546
|
+
var ScopeType = z6.enum([
|
|
294
547
|
...SystemScopeType.options,
|
|
295
548
|
...RecordScopeTypeV2.options,
|
|
296
549
|
...PlainScopeType.options,
|
|
297
550
|
"workqueue",
|
|
298
551
|
"dashboard.view"
|
|
299
552
|
]);
|
|
300
|
-
var EncodedScope =
|
|
553
|
+
var EncodedScope = z6.string().brand("EncodedScope");
|
|
301
554
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
302
555
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
303
556
|
accessLevel: JurisdictionFilter.enum.all,
|
|
@@ -307,162 +560,51 @@ var DEFAULT_SCOPE_OPTIONS = {
|
|
|
307
560
|
};
|
|
308
561
|
|
|
309
562
|
// ../commons/src/authentication.ts
|
|
310
|
-
var TokenUserType =
|
|
311
|
-
var TokenWithBearer =
|
|
312
|
-
|
|
313
|
-
// ../commons/src/events/ActionType.ts
|
|
314
|
-
var z4 = __toESM(require("zod/v4"));
|
|
315
|
-
var ActionType = {
|
|
316
|
-
// Pre-declaration actions
|
|
317
|
-
DELETE: "DELETE",
|
|
318
|
-
CREATE: "CREATE",
|
|
319
|
-
NOTIFY: "NOTIFY",
|
|
320
|
-
// Declaration actions
|
|
321
|
-
DECLARE: "DECLARE",
|
|
322
|
-
REGISTER: "REGISTER",
|
|
323
|
-
EDIT: "EDIT",
|
|
324
|
-
// Declaration system actions. Non-configurable.
|
|
325
|
-
DUPLICATE_DETECTED: "DUPLICATE_DETECTED",
|
|
326
|
-
REJECT: "REJECT",
|
|
327
|
-
// REJECT_DECLARATION
|
|
328
|
-
MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
|
|
329
|
-
MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
|
|
330
|
-
ARCHIVE: "ARCHIVE",
|
|
331
|
-
UNARCHIVE: "UNARCHIVE",
|
|
332
|
-
// Record actions
|
|
333
|
-
PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
|
|
334
|
-
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
|
335
|
-
REJECT_CORRECTION: "REJECT_CORRECTION",
|
|
336
|
-
APPROVE_CORRECTION: "APPROVE_CORRECTION",
|
|
337
|
-
// General actions
|
|
338
|
-
READ: "READ",
|
|
339
|
-
ASSIGN: "ASSIGN",
|
|
340
|
-
UNASSIGN: "UNASSIGN",
|
|
341
|
-
// Custom action
|
|
342
|
-
CUSTOM: "CUSTOM"
|
|
343
|
-
};
|
|
344
|
-
var ConfirmableActions = [
|
|
345
|
-
ActionType.NOTIFY,
|
|
346
|
-
ActionType.DECLARE,
|
|
347
|
-
ActionType.EDIT,
|
|
348
|
-
ActionType.REGISTER,
|
|
349
|
-
ActionType.REJECT,
|
|
350
|
-
ActionType.ARCHIVE,
|
|
351
|
-
ActionType.UNARCHIVE,
|
|
352
|
-
ActionType.PRINT_CERTIFICATE,
|
|
353
|
-
ActionType.REQUEST_CORRECTION,
|
|
354
|
-
ActionType.APPROVE_CORRECTION,
|
|
355
|
-
ActionType.REJECT_CORRECTION,
|
|
356
|
-
ActionType.CUSTOM
|
|
357
|
-
];
|
|
358
|
-
var ActionTypes = z4.enum([
|
|
359
|
-
"DELETE",
|
|
360
|
-
"CREATE",
|
|
361
|
-
"NOTIFY",
|
|
362
|
-
"DECLARE",
|
|
363
|
-
"EDIT",
|
|
364
|
-
"REGISTER",
|
|
365
|
-
"DUPLICATE_DETECTED",
|
|
366
|
-
"REJECT",
|
|
367
|
-
"MARK_AS_DUPLICATE",
|
|
368
|
-
"MARK_AS_NOT_DUPLICATE",
|
|
369
|
-
"ARCHIVE",
|
|
370
|
-
"UNARCHIVE",
|
|
371
|
-
"PRINT_CERTIFICATE",
|
|
372
|
-
"REQUEST_CORRECTION",
|
|
373
|
-
"REJECT_CORRECTION",
|
|
374
|
-
"APPROVE_CORRECTION",
|
|
375
|
-
"READ",
|
|
376
|
-
"ASSIGN",
|
|
377
|
-
"UNASSIGN",
|
|
378
|
-
"CUSTOM"
|
|
379
|
-
]);
|
|
380
|
-
var ClientSpecificAction = {
|
|
381
|
-
REVIEW_CORRECTION_REQUEST: "REVIEW_CORRECTION_REQUEST"
|
|
382
|
-
};
|
|
383
|
-
var declarationActionValues = [
|
|
384
|
-
ActionTypes.enum.DECLARE,
|
|
385
|
-
ActionTypes.enum.EDIT,
|
|
386
|
-
ActionTypes.enum.REGISTER,
|
|
387
|
-
ActionTypes.enum.NOTIFY,
|
|
388
|
-
ActionTypes.enum.DUPLICATE_DETECTED
|
|
389
|
-
];
|
|
390
|
-
var DeclarationActions = ActionTypes.extract(declarationActionValues);
|
|
391
|
-
var declarationUpdateActionValues = [
|
|
392
|
-
...declarationActionValues,
|
|
393
|
-
ActionTypes.enum.REQUEST_CORRECTION
|
|
394
|
-
];
|
|
395
|
-
var DeclarationUpdateActions = ActionTypes.extract(
|
|
396
|
-
declarationUpdateActionValues
|
|
397
|
-
);
|
|
398
|
-
var annotationActions = ActionTypes.exclude(declarationActionValues);
|
|
399
|
-
var writeActions = ActionTypes.exclude([
|
|
400
|
-
ActionType.CREATE,
|
|
401
|
-
ActionType.READ,
|
|
402
|
-
ActionType.ASSIGN,
|
|
403
|
-
ActionType.UNASSIGN
|
|
404
|
-
]);
|
|
405
|
-
var WorkqueueActionType = ActionTypes.extract([
|
|
406
|
-
ActionType.READ,
|
|
407
|
-
ActionType.DELETE,
|
|
408
|
-
ActionType.DECLARE,
|
|
409
|
-
ActionType.REGISTER,
|
|
410
|
-
ActionType.EDIT,
|
|
411
|
-
ActionType.REJECT,
|
|
412
|
-
ActionType.MARK_AS_DUPLICATE,
|
|
413
|
-
ActionType.ARCHIVE,
|
|
414
|
-
ActionType.UNARCHIVE,
|
|
415
|
-
ActionType.PRINT_CERTIFICATE,
|
|
416
|
-
ActionType.REQUEST_CORRECTION
|
|
417
|
-
]);
|
|
418
|
-
var META_ACTIONS = [
|
|
419
|
-
ActionType.ASSIGN,
|
|
420
|
-
ActionType.UNASSIGN,
|
|
421
|
-
ActionType.READ
|
|
422
|
-
];
|
|
563
|
+
var TokenUserType = z7.enum(["user", "system"]);
|
|
564
|
+
var TokenWithBearer = z7.string().regex(/^Bearer\s/);
|
|
423
565
|
|
|
424
566
|
// ../commons/src/events/AuditLog.ts
|
|
425
|
-
var AuditLogEntryBase =
|
|
426
|
-
id:
|
|
427
|
-
clientId:
|
|
567
|
+
var AuditLogEntryBase = z8.object({
|
|
568
|
+
id: z8.string(),
|
|
569
|
+
clientId: z8.string(),
|
|
428
570
|
clientType: TokenUserType,
|
|
429
|
-
createdAt:
|
|
571
|
+
createdAt: z8.string()
|
|
430
572
|
});
|
|
431
573
|
var EventCreateEntrySchema = AuditLogEntryBase.extend({
|
|
432
|
-
operation:
|
|
433
|
-
requestData:
|
|
434
|
-
transactionId:
|
|
435
|
-
type:
|
|
436
|
-
createdAtLocation:
|
|
574
|
+
operation: z8.literal("event.create"),
|
|
575
|
+
requestData: z8.object({
|
|
576
|
+
transactionId: z8.string(),
|
|
577
|
+
type: z8.string(),
|
|
578
|
+
createdAtLocation: z8.string().nullable()
|
|
437
579
|
}),
|
|
438
|
-
responseSummary:
|
|
439
|
-
eventId:
|
|
440
|
-
trackingId:
|
|
580
|
+
responseSummary: z8.object({
|
|
581
|
+
eventId: z8.string(),
|
|
582
|
+
trackingId: z8.string()
|
|
441
583
|
})
|
|
442
584
|
});
|
|
443
585
|
var EventGetEntrySchema = AuditLogEntryBase.extend({
|
|
444
|
-
operation:
|
|
445
|
-
requestData:
|
|
446
|
-
responseSummary:
|
|
447
|
-
eventType:
|
|
448
|
-
trackingId:
|
|
586
|
+
operation: z8.literal("event.get"),
|
|
587
|
+
requestData: z8.object({ eventId: z8.string() }),
|
|
588
|
+
responseSummary: z8.object({
|
|
589
|
+
eventType: z8.string(),
|
|
590
|
+
trackingId: z8.string()
|
|
449
591
|
})
|
|
450
592
|
});
|
|
451
593
|
var EventSearchEntrySchema = AuditLogEntryBase.extend({
|
|
452
|
-
operation:
|
|
453
|
-
clientType:
|
|
454
|
-
requestData:
|
|
455
|
-
query:
|
|
456
|
-
limit:
|
|
457
|
-
offset:
|
|
594
|
+
operation: z8.literal("event.search"),
|
|
595
|
+
clientType: z8.literal("system"),
|
|
596
|
+
requestData: z8.object({
|
|
597
|
+
query: z8.record(z8.string(), z8.unknown()).nullable(),
|
|
598
|
+
limit: z8.number().nullable(),
|
|
599
|
+
offset: z8.number().nullable()
|
|
458
600
|
}),
|
|
459
|
-
responseSummary:
|
|
460
|
-
total:
|
|
461
|
-
eventIds:
|
|
601
|
+
responseSummary: z8.object({
|
|
602
|
+
total: z8.number(),
|
|
603
|
+
eventIds: z8.array(z8.string())
|
|
462
604
|
})
|
|
463
605
|
});
|
|
464
606
|
var EventActionEntrySchema = AuditLogEntryBase.extend({
|
|
465
|
-
operation:
|
|
607
|
+
operation: z8.enum([
|
|
466
608
|
"event.actions.notify.request",
|
|
467
609
|
"event.actions.declare.request",
|
|
468
610
|
"event.actions.register.request",
|
|
@@ -482,106 +624,159 @@ var EventActionEntrySchema = AuditLogEntryBase.extend({
|
|
|
482
624
|
"event.actions.mark_as_duplicate.request",
|
|
483
625
|
"event.actions.mark_as_not_duplicate.request"
|
|
484
626
|
]),
|
|
485
|
-
requestData:
|
|
486
|
-
eventId:
|
|
487
|
-
actionType:
|
|
488
|
-
eventType:
|
|
489
|
-
trackingId:
|
|
490
|
-
transactionId:
|
|
627
|
+
requestData: z8.object({
|
|
628
|
+
eventId: z8.string(),
|
|
629
|
+
actionType: z8.string(),
|
|
630
|
+
eventType: z8.string(),
|
|
631
|
+
trackingId: z8.string(),
|
|
632
|
+
transactionId: z8.string()
|
|
491
633
|
})
|
|
492
634
|
});
|
|
493
635
|
var EventCustomActionEntrySchema = AuditLogEntryBase.extend({
|
|
494
|
-
operation:
|
|
495
|
-
requestData:
|
|
496
|
-
eventId:
|
|
497
|
-
actionType:
|
|
498
|
-
customAction:
|
|
499
|
-
eventType:
|
|
500
|
-
trackingId:
|
|
501
|
-
transactionId:
|
|
636
|
+
operation: z8.literal("event.actions.custom.request"),
|
|
637
|
+
requestData: z8.object({
|
|
638
|
+
eventId: z8.string(),
|
|
639
|
+
actionType: z8.literal(ActionType.CUSTOM),
|
|
640
|
+
customAction: z8.string(),
|
|
641
|
+
eventType: z8.string(),
|
|
642
|
+
trackingId: z8.string(),
|
|
643
|
+
transactionId: z8.string()
|
|
502
644
|
})
|
|
503
645
|
});
|
|
504
646
|
var IntegrationCreateEntrySchema = AuditLogEntryBase.extend({
|
|
505
|
-
operation:
|
|
506
|
-
requestData:
|
|
507
|
-
responseSummary:
|
|
647
|
+
operation: z8.literal("integrations.create"),
|
|
648
|
+
requestData: z8.object({ name: z8.string(), scopes: z8.array(z8.string()) }),
|
|
649
|
+
responseSummary: z8.object({ clientId: z8.string() })
|
|
508
650
|
});
|
|
509
651
|
var IntegrationRefreshTokenEntrySchema = AuditLogEntryBase.extend({
|
|
510
|
-
operation:
|
|
511
|
-
requestData:
|
|
512
|
-
responseSummary:
|
|
652
|
+
operation: z8.literal("integrations.refreshToken"),
|
|
653
|
+
requestData: z8.object({ clientId: z8.string() }),
|
|
654
|
+
responseSummary: z8.object({ clientId: z8.string() })
|
|
513
655
|
});
|
|
514
656
|
var IntegrationDeactivateEntrySchema = AuditLogEntryBase.extend({
|
|
515
|
-
operation:
|
|
516
|
-
requestData:
|
|
517
|
-
responseSummary:
|
|
657
|
+
operation: z8.literal("integrations.deactivate"),
|
|
658
|
+
requestData: z8.object({ id: z8.string() }),
|
|
659
|
+
responseSummary: z8.object({ id: z8.string(), status: z8.string() })
|
|
518
660
|
});
|
|
519
661
|
var IntegrationActivateEntrySchema = AuditLogEntryBase.extend({
|
|
520
|
-
operation:
|
|
521
|
-
requestData:
|
|
522
|
-
responseSummary:
|
|
662
|
+
operation: z8.literal("integrations.activate"),
|
|
663
|
+
requestData: z8.object({ id: z8.string() }),
|
|
664
|
+
responseSummary: z8.object({ id: z8.string(), status: z8.string() })
|
|
523
665
|
});
|
|
524
666
|
var IntegrationDeleteEntrySchema = AuditLogEntryBase.extend({
|
|
525
|
-
operation:
|
|
526
|
-
requestData:
|
|
527
|
-
responseSummary:
|
|
667
|
+
operation: z8.literal("integrations.delete"),
|
|
668
|
+
requestData: z8.object({ id: z8.string() }),
|
|
669
|
+
responseSummary: z8.object({ id: z8.string(), name: z8.string() })
|
|
528
670
|
});
|
|
529
671
|
var IntegrationRefreshSecretEntrySchema = AuditLogEntryBase.extend({
|
|
530
|
-
operation:
|
|
531
|
-
requestData:
|
|
532
|
-
responseSummary:
|
|
672
|
+
operation: z8.literal("integrations.refreshSecret"),
|
|
673
|
+
requestData: z8.object({ id: z8.string() }),
|
|
674
|
+
responseSummary: z8.object({ clientId: z8.string() })
|
|
533
675
|
});
|
|
534
676
|
var createdVersionFields = {
|
|
535
|
-
id:
|
|
536
|
-
versionId:
|
|
537
|
-
name:
|
|
538
|
-
externalId:
|
|
539
|
-
effectiveFrom:
|
|
540
|
-
status:
|
|
677
|
+
id: z8.string(),
|
|
678
|
+
versionId: z8.string(),
|
|
679
|
+
name: z8.string(),
|
|
680
|
+
externalId: z8.string().nullish(),
|
|
681
|
+
effectiveFrom: z8.string(),
|
|
682
|
+
status: z8.string()
|
|
541
683
|
};
|
|
542
684
|
var LocationCreateEntrySchema = AuditLogEntryBase.extend({
|
|
543
|
-
operation:
|
|
544
|
-
requestData:
|
|
685
|
+
operation: z8.literal("locations.create"),
|
|
686
|
+
requestData: z8.object({
|
|
545
687
|
...createdVersionFields,
|
|
546
|
-
administrativeAreaId:
|
|
547
|
-
locationType:
|
|
688
|
+
administrativeAreaId: z8.string().nullish(),
|
|
689
|
+
locationType: z8.string().nullish()
|
|
548
690
|
})
|
|
549
691
|
});
|
|
550
692
|
var AdministrativeAreaCreateEntrySchema = AuditLogEntryBase.extend({
|
|
551
|
-
operation:
|
|
552
|
-
requestData:
|
|
693
|
+
operation: z8.literal("administrativeAreas.create"),
|
|
694
|
+
requestData: z8.object({
|
|
553
695
|
...createdVersionFields,
|
|
554
|
-
parentId:
|
|
696
|
+
parentId: z8.string().nullish()
|
|
697
|
+
})
|
|
698
|
+
});
|
|
699
|
+
var ChangedStringField = z8.object({ from: z8.string(), to: z8.string() });
|
|
700
|
+
var ChangedNullableStringField = z8.object({
|
|
701
|
+
from: z8.string().nullable(),
|
|
702
|
+
to: z8.string().nullable()
|
|
703
|
+
});
|
|
704
|
+
var updatedVersionRequestData = z8.object({
|
|
705
|
+
id: z8.string(),
|
|
706
|
+
versionId: z8.string(),
|
|
707
|
+
name: z8.string(),
|
|
708
|
+
externalId: z8.string().nullish(),
|
|
709
|
+
status: z8.string(),
|
|
710
|
+
effectiveFrom: z8.string(),
|
|
711
|
+
lastVersionId: z8.string()
|
|
712
|
+
});
|
|
713
|
+
var updatedVersionResponseSummary = z8.object({
|
|
714
|
+
previousVersionId: z8.string(),
|
|
715
|
+
versionId: z8.string(),
|
|
716
|
+
changed: z8.object({
|
|
717
|
+
name: ChangedStringField.optional(),
|
|
718
|
+
externalId: ChangedNullableStringField.optional(),
|
|
719
|
+
status: ChangedStringField.optional()
|
|
555
720
|
})
|
|
556
721
|
});
|
|
722
|
+
var LocationUpdateEntrySchema = AuditLogEntryBase.extend({
|
|
723
|
+
operation: z8.literal("locations.update"),
|
|
724
|
+
requestData: updatedVersionRequestData,
|
|
725
|
+
responseSummary: updatedVersionResponseSummary
|
|
726
|
+
});
|
|
727
|
+
var AdministrativeAreaUpdateEntrySchema = AuditLogEntryBase.extend({
|
|
728
|
+
operation: z8.literal("administrativeAreas.update"),
|
|
729
|
+
requestData: updatedVersionRequestData,
|
|
730
|
+
responseSummary: updatedVersionResponseSummary
|
|
731
|
+
});
|
|
732
|
+
var withdrawVersionRequestData = z8.object({
|
|
733
|
+
id: z8.string(),
|
|
734
|
+
versionId: z8.string()
|
|
735
|
+
});
|
|
736
|
+
var withdrawVersionResponseSummary = z8.object({
|
|
737
|
+
effectiveFrom: z8.string(),
|
|
738
|
+
name: z8.string(),
|
|
739
|
+
externalId: z8.string().nullish(),
|
|
740
|
+
status: z8.string()
|
|
741
|
+
});
|
|
742
|
+
var LocationWithdrawEntrySchema = AuditLogEntryBase.extend({
|
|
743
|
+
operation: z8.literal("locations.withdrawVersion"),
|
|
744
|
+
requestData: withdrawVersionRequestData,
|
|
745
|
+
responseSummary: withdrawVersionResponseSummary
|
|
746
|
+
});
|
|
747
|
+
var AdministrativeAreaWithdrawEntrySchema = AuditLogEntryBase.extend({
|
|
748
|
+
operation: z8.literal("administrativeAreas.withdrawVersion"),
|
|
749
|
+
requestData: withdrawVersionRequestData,
|
|
750
|
+
responseSummary: withdrawVersionResponseSummary
|
|
751
|
+
});
|
|
557
752
|
var AttachmentUploadEntrySchema = AuditLogEntryBase.extend({
|
|
558
|
-
operation:
|
|
559
|
-
requestData:
|
|
560
|
-
transactionId:
|
|
561
|
-
path:
|
|
753
|
+
operation: z8.literal("attachments.upload"),
|
|
754
|
+
requestData: z8.object({
|
|
755
|
+
transactionId: z8.string(),
|
|
756
|
+
path: z8.string().nullable()
|
|
562
757
|
}),
|
|
563
|
-
responseSummary:
|
|
758
|
+
responseSummary: z8.object({ fileUrl: z8.string() })
|
|
564
759
|
});
|
|
565
|
-
var subjectOnly =
|
|
566
|
-
var subjectWithReason =
|
|
567
|
-
subjectId:
|
|
568
|
-
reason:
|
|
569
|
-
comment:
|
|
760
|
+
var subjectOnly = z8.object({ subjectId: z8.string() });
|
|
761
|
+
var subjectWithReason = z8.object({
|
|
762
|
+
subjectId: z8.string(),
|
|
763
|
+
reason: z8.string(),
|
|
764
|
+
comment: z8.string().optional()
|
|
570
765
|
});
|
|
571
766
|
var UserCreateEntrySchema = AuditLogEntryBase.extend({
|
|
572
|
-
operation:
|
|
573
|
-
requestData:
|
|
574
|
-
subjectId:
|
|
575
|
-
role:
|
|
576
|
-
primaryOfficeId:
|
|
767
|
+
operation: z8.literal("user.create_user"),
|
|
768
|
+
requestData: z8.object({
|
|
769
|
+
subjectId: z8.string(),
|
|
770
|
+
role: z8.string(),
|
|
771
|
+
primaryOfficeId: z8.string()
|
|
577
772
|
})
|
|
578
773
|
});
|
|
579
774
|
var UserReasonEntrySchema = AuditLogEntryBase.extend({
|
|
580
|
-
operation:
|
|
775
|
+
operation: z8.enum(["user.deactivate", "user.reactivate"]),
|
|
581
776
|
requestData: subjectWithReason
|
|
582
777
|
});
|
|
583
778
|
var UserSubjectOnlyEntrySchema = AuditLogEntryBase.extend({
|
|
584
|
-
operation:
|
|
779
|
+
operation: z8.enum([
|
|
585
780
|
"user.edit_user",
|
|
586
781
|
"user.logged_in",
|
|
587
782
|
"user.logged_out",
|
|
@@ -595,14 +790,14 @@ var UserSubjectOnlyEntrySchema = AuditLogEntryBase.extend({
|
|
|
595
790
|
requestData: subjectOnly
|
|
596
791
|
});
|
|
597
792
|
var UserEmailChangedEntrySchema = AuditLogEntryBase.extend({
|
|
598
|
-
operation:
|
|
793
|
+
operation: z8.literal("user.email_address_changed"),
|
|
599
794
|
requestData: subjectOnly,
|
|
600
|
-
responseSummary:
|
|
795
|
+
responseSummary: z8.object({ email: z8.string() })
|
|
601
796
|
});
|
|
602
797
|
var UserPhoneChangedEntrySchema = AuditLogEntryBase.extend({
|
|
603
|
-
operation:
|
|
798
|
+
operation: z8.literal("user.phone_number_changed"),
|
|
604
799
|
requestData: subjectOnly,
|
|
605
|
-
responseSummary:
|
|
800
|
+
responseSummary: z8.object({ phoneNumber: z8.string() })
|
|
606
801
|
});
|
|
607
802
|
var userBaseOmit = {
|
|
608
803
|
id: true,
|
|
@@ -610,14 +805,14 @@ var userBaseOmit = {
|
|
|
610
805
|
clientType: true,
|
|
611
806
|
createdAt: true
|
|
612
807
|
};
|
|
613
|
-
var UserAuditRecordInput =
|
|
808
|
+
var UserAuditRecordInput = z8.discriminatedUnion("operation", [
|
|
614
809
|
UserCreateEntrySchema.omit(userBaseOmit),
|
|
615
810
|
UserReasonEntrySchema.omit(userBaseOmit),
|
|
616
811
|
UserSubjectOnlyEntrySchema.omit(userBaseOmit),
|
|
617
812
|
UserEmailChangedEntrySchema.omit(userBaseOmit),
|
|
618
813
|
UserPhoneChangedEntrySchema.omit(userBaseOmit)
|
|
619
814
|
]);
|
|
620
|
-
var AuditLogEntrySchema =
|
|
815
|
+
var AuditLogEntrySchema = z8.discriminatedUnion("operation", [
|
|
621
816
|
EventCreateEntrySchema,
|
|
622
817
|
EventGetEntrySchema,
|
|
623
818
|
EventSearchEntrySchema,
|
|
@@ -630,6 +825,10 @@ var AuditLogEntrySchema = z5.discriminatedUnion("operation", [
|
|
|
630
825
|
IntegrationDeleteEntrySchema,
|
|
631
826
|
IntegrationRefreshSecretEntrySchema,
|
|
632
827
|
LocationCreateEntrySchema,
|
|
828
|
+
LocationUpdateEntrySchema,
|
|
829
|
+
AdministrativeAreaUpdateEntrySchema,
|
|
830
|
+
LocationWithdrawEntrySchema,
|
|
831
|
+
AdministrativeAreaWithdrawEntrySchema,
|
|
633
832
|
AdministrativeAreaCreateEntrySchema,
|
|
634
833
|
AttachmentUploadEntrySchema,
|
|
635
834
|
UserCreateEntrySchema,
|
|
@@ -646,76 +845,11 @@ var CHILD_ONBOARDING_EVENT = "child-onboarding";
|
|
|
646
845
|
// ../commons/src/events/ActionConfig.ts
|
|
647
846
|
var z24 = __toESM(require("zod/v4"));
|
|
648
847
|
|
|
649
|
-
// ../commons/src/events/TranslationConfig.ts
|
|
650
|
-
var z6 = __toESM(require("zod/v4"));
|
|
651
|
-
var TranslationConfig = z6.object({
|
|
652
|
-
id: z6.string().describe(
|
|
653
|
-
"The identifier of the translation referred in translation CSV files"
|
|
654
|
-
),
|
|
655
|
-
defaultMessage: z6.string().describe("Default translation message"),
|
|
656
|
-
description: z6.string().describe(
|
|
657
|
-
"Describe the translation for a translator to be able to identify it."
|
|
658
|
-
)
|
|
659
|
-
}).meta({
|
|
660
|
-
description: "Translation configuration",
|
|
661
|
-
id: "TranslationConfig"
|
|
662
|
-
});
|
|
663
|
-
|
|
664
848
|
// ../commons/src/events/FieldConfig.ts
|
|
665
849
|
var import_v43 = __toESM(require("zod/v4"));
|
|
666
850
|
|
|
667
|
-
// ../commons/src/events/Conditional.ts
|
|
668
|
-
var z7 = __toESM(require("zod/v4"));
|
|
669
|
-
var Conditional = z7.any().describe("JSONSchema").meta({
|
|
670
|
-
description: "JSON schema conditional configuration",
|
|
671
|
-
id: "Conditional"
|
|
672
|
-
});
|
|
673
|
-
var ConditionalType = {
|
|
674
|
-
SHOW: "SHOW",
|
|
675
|
-
ENABLE: "ENABLE",
|
|
676
|
-
DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
|
|
677
|
-
};
|
|
678
|
-
var ShowConditional = z7.object({
|
|
679
|
-
type: z7.literal(ConditionalType.SHOW),
|
|
680
|
-
conditional: Conditional
|
|
681
|
-
}).describe(
|
|
682
|
-
"If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
|
|
683
|
-
);
|
|
684
|
-
var EnableConditional = z7.object({
|
|
685
|
-
type: z7.literal(ConditionalType.ENABLE),
|
|
686
|
-
conditional: Conditional
|
|
687
|
-
}).describe(
|
|
688
|
-
"If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
|
|
689
|
-
);
|
|
690
|
-
var ActionConditional = z7.discriminatedUnion("type", [
|
|
691
|
-
// Action can be shown / hidden
|
|
692
|
-
ShowConditional,
|
|
693
|
-
// Action can be shown to the user in the list but as disabled
|
|
694
|
-
EnableConditional
|
|
695
|
-
]).meta({
|
|
696
|
-
id: "ActionConditional",
|
|
697
|
-
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."
|
|
698
|
-
});
|
|
699
|
-
var DisplayOnReviewConditional = z7.object({
|
|
700
|
-
type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
701
|
-
conditional: Conditional
|
|
702
|
-
}).describe(
|
|
703
|
-
"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."
|
|
704
|
-
);
|
|
705
|
-
var FieldConditional = z7.discriminatedUnion("type", [
|
|
706
|
-
// Field input can be shown / hidden
|
|
707
|
-
ShowConditional,
|
|
708
|
-
// Field input can be shown to the user but as disabled
|
|
709
|
-
EnableConditional,
|
|
710
|
-
// Field output can be shown / hidden on the review page
|
|
711
|
-
DisplayOnReviewConditional
|
|
712
|
-
]).meta({
|
|
713
|
-
id: "FieldConditional",
|
|
714
|
-
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."
|
|
715
|
-
});
|
|
716
|
-
|
|
717
851
|
// ../commons/src/events/FieldType.ts
|
|
718
|
-
var
|
|
852
|
+
var z9 = __toESM(require("zod/v4"));
|
|
719
853
|
var FieldType = {
|
|
720
854
|
NAME: "NAME",
|
|
721
855
|
PHONE: "PHONE",
|
|
@@ -779,7 +913,7 @@ var FieldType = {
|
|
|
779
913
|
*/
|
|
780
914
|
_EXPERIMENTAL_CUSTOM: "CUSTOM"
|
|
781
915
|
};
|
|
782
|
-
var FileFieldType =
|
|
916
|
+
var FileFieldType = z9.enum([
|
|
783
917
|
FieldType.FILE,
|
|
784
918
|
FieldType.FILE_WITH_OPTIONS,
|
|
785
919
|
FieldType.SIGNATURE
|
|
@@ -815,160 +949,164 @@ var HiddenFieldTypes = [
|
|
|
815
949
|
];
|
|
816
950
|
|
|
817
951
|
// ../commons/src/events/FieldValue.ts
|
|
818
|
-
var
|
|
952
|
+
var z13 = __toESM(require("zod/v4"));
|
|
819
953
|
|
|
820
954
|
// ../commons/src/documents.ts
|
|
821
|
-
var
|
|
822
|
-
var FullDocumentUrl =
|
|
955
|
+
var z10 = __toESM(require("zod/v4"));
|
|
956
|
+
var FullDocumentUrl = z10.string().brand("FullDocumentUrl").describe(
|
|
823
957
|
"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"
|
|
824
958
|
);
|
|
825
|
-
var FullDocumentPath =
|
|
959
|
+
var FullDocumentPath = z10.string().overwrite((val) => val.startsWith("/") ? val : `/${val}`).meta({ effectType: "input", type: "string" }).describe(
|
|
826
960
|
"A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
|
|
827
961
|
);
|
|
828
|
-
var DocumentPath =
|
|
962
|
+
var DocumentPath = z10.string().brand("DocumentPath").describe(
|
|
829
963
|
"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."
|
|
830
964
|
);
|
|
831
965
|
|
|
832
966
|
// ../commons/src/events/CompositeFieldValue.ts
|
|
833
|
-
var
|
|
967
|
+
var z11 = __toESM(require("zod/v4"));
|
|
834
968
|
var AddressType = {
|
|
835
969
|
DOMESTIC: "DOMESTIC",
|
|
836
970
|
INTERNATIONAL: "INTERNATIONAL"
|
|
837
971
|
};
|
|
838
|
-
var FileFieldValue =
|
|
972
|
+
var FileFieldValue = z11.object({
|
|
839
973
|
path: DocumentPath,
|
|
840
|
-
originalFilename:
|
|
841
|
-
type:
|
|
842
|
-
});
|
|
843
|
-
var NameFieldValue =
|
|
844
|
-
firstname:
|
|
845
|
-
surname:
|
|
846
|
-
middlename:
|
|
847
|
-
});
|
|
848
|
-
var NameFieldUpdateValue =
|
|
849
|
-
firstname:
|
|
850
|
-
surname:
|
|
851
|
-
middlename:
|
|
852
|
-
}).or(
|
|
853
|
-
var StreetLevelDetailsValue =
|
|
854
|
-
var StreetLevelDetailsUpdateValue =
|
|
855
|
-
var BaseAddressFieldValue =
|
|
856
|
-
country:
|
|
974
|
+
originalFilename: z11.string(),
|
|
975
|
+
type: z11.string()
|
|
976
|
+
});
|
|
977
|
+
var NameFieldValue = z11.object({
|
|
978
|
+
firstname: z11.string(),
|
|
979
|
+
surname: z11.string(),
|
|
980
|
+
middlename: z11.string().optional()
|
|
981
|
+
});
|
|
982
|
+
var NameFieldUpdateValue = z11.object({
|
|
983
|
+
firstname: z11.string().nullish(),
|
|
984
|
+
surname: z11.string().nullish(),
|
|
985
|
+
middlename: z11.string().nullish()
|
|
986
|
+
}).or(z11.null()).or(z11.undefined());
|
|
987
|
+
var StreetLevelDetailsValue = z11.record(z11.string(), z11.string()).optional();
|
|
988
|
+
var StreetLevelDetailsUpdateValue = z11.record(z11.string(), z11.string().nullable()).nullish();
|
|
989
|
+
var BaseAddressFieldValue = z11.object({
|
|
990
|
+
country: z11.string(),
|
|
857
991
|
streetLevelDetails: StreetLevelDetailsValue
|
|
858
992
|
});
|
|
859
|
-
var BaseAddressFieldUpdateValue =
|
|
860
|
-
country:
|
|
993
|
+
var BaseAddressFieldUpdateValue = z11.object({
|
|
994
|
+
country: z11.string().nullish(),
|
|
861
995
|
streetLevelDetails: StreetLevelDetailsUpdateValue
|
|
862
996
|
});
|
|
863
997
|
var DomesticAddressFieldValue = BaseAddressFieldValue.extend({
|
|
864
|
-
addressType:
|
|
865
|
-
administrativeArea:
|
|
998
|
+
addressType: z11.literal(AddressType.DOMESTIC),
|
|
999
|
+
administrativeArea: z11.string().uuid()
|
|
866
1000
|
});
|
|
867
1001
|
var InternationalAddressFieldValue = BaseAddressFieldValue.extend({
|
|
868
|
-
addressType:
|
|
1002
|
+
addressType: z11.literal(AddressType.INTERNATIONAL)
|
|
869
1003
|
});
|
|
870
|
-
var AddressFieldValue =
|
|
1004
|
+
var AddressFieldValue = z11.discriminatedUnion("addressType", [
|
|
871
1005
|
DomesticAddressFieldValue,
|
|
872
1006
|
InternationalAddressFieldValue
|
|
873
1007
|
]);
|
|
874
1008
|
var DomesticAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend({
|
|
875
|
-
addressType:
|
|
876
|
-
administrativeArea:
|
|
1009
|
+
addressType: z11.literal(AddressType.DOMESTIC),
|
|
1010
|
+
administrativeArea: z11.string().uuid().nullish()
|
|
877
1011
|
/* Leaf level admin structure */
|
|
878
1012
|
});
|
|
879
1013
|
var InternationalAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend(
|
|
880
1014
|
{
|
|
881
|
-
addressType:
|
|
1015
|
+
addressType: z11.literal(AddressType.INTERNATIONAL)
|
|
882
1016
|
}
|
|
883
1017
|
);
|
|
884
|
-
var AddressFieldUpdateValue =
|
|
1018
|
+
var AddressFieldUpdateValue = z11.discriminatedUnion("addressType", [
|
|
885
1019
|
DomesticAddressUpdateFieldValue,
|
|
886
1020
|
InternationalAddressUpdateFieldValue
|
|
887
1021
|
]).nullish();
|
|
888
|
-
var FileFieldValueWithOption =
|
|
1022
|
+
var FileFieldValueWithOption = z11.object({
|
|
889
1023
|
path: DocumentPath,
|
|
890
|
-
originalFilename:
|
|
891
|
-
type:
|
|
892
|
-
option:
|
|
893
|
-
});
|
|
894
|
-
var FileFieldWithOptionValue =
|
|
895
|
-
var HttpFieldValue =
|
|
896
|
-
loading:
|
|
897
|
-
error:
|
|
898
|
-
data:
|
|
899
|
-
});
|
|
900
|
-
var HttpFieldUpdateValue =
|
|
901
|
-
loading:
|
|
902
|
-
error:
|
|
903
|
-
data:
|
|
904
|
-
}).or(
|
|
905
|
-
var QueryParamReaderFieldValue =
|
|
906
|
-
data:
|
|
907
|
-
updatedAt:
|
|
1024
|
+
originalFilename: z11.string(),
|
|
1025
|
+
type: z11.string(),
|
|
1026
|
+
option: z11.string()
|
|
1027
|
+
});
|
|
1028
|
+
var FileFieldWithOptionValue = z11.array(FileFieldValueWithOption);
|
|
1029
|
+
var HttpFieldValue = z11.object({
|
|
1030
|
+
loading: z11.boolean(),
|
|
1031
|
+
error: z11.object({ statusCode: z11.number(), message: z11.string() }).nullish(),
|
|
1032
|
+
data: z11.any()
|
|
1033
|
+
});
|
|
1034
|
+
var HttpFieldUpdateValue = z11.object({
|
|
1035
|
+
loading: z11.boolean().nullish(),
|
|
1036
|
+
error: z11.object({ statusCode: z11.number(), message: z11.string() }).nullish(),
|
|
1037
|
+
data: z11.any().nullish()
|
|
1038
|
+
}).or(z11.null()).or(z11.undefined());
|
|
1039
|
+
var QueryParamReaderFieldValue = z11.object({
|
|
1040
|
+
data: z11.record(z11.string(), z11.string()),
|
|
1041
|
+
updatedAt: z11.iso.datetime()
|
|
908
1042
|
}).nullish();
|
|
909
|
-
var QueryParamReaderFieldUpdateValue =
|
|
910
|
-
data:
|
|
1043
|
+
var QueryParamReaderFieldUpdateValue = z11.object({
|
|
1044
|
+
data: z11.record(z11.string(), z11.string())
|
|
911
1045
|
});
|
|
912
|
-
var ReadDataValue =
|
|
913
|
-
data:
|
|
1046
|
+
var ReadDataValue = z11.object({
|
|
1047
|
+
data: z11.any()
|
|
914
1048
|
});
|
|
915
1049
|
var QrReaderFieldValue = ReadDataValue;
|
|
916
1050
|
var IdReaderFieldValue = ReadDataValue;
|
|
917
|
-
var NumberWithUnitFieldValue =
|
|
918
|
-
numericValue:
|
|
919
|
-
unit:
|
|
1051
|
+
var NumberWithUnitFieldValue = z11.object({
|
|
1052
|
+
numericValue: z11.number(),
|
|
1053
|
+
unit: z11.string()
|
|
920
1054
|
});
|
|
921
|
-
var NumberWithUnitFieldUpdateValue =
|
|
922
|
-
numericValue:
|
|
923
|
-
unit:
|
|
1055
|
+
var NumberWithUnitFieldUpdateValue = z11.object({
|
|
1056
|
+
numericValue: z11.number().optional(),
|
|
1057
|
+
unit: z11.string().optional()
|
|
924
1058
|
});
|
|
925
|
-
var CustomFieldValue =
|
|
1059
|
+
var CustomFieldValue = z11.unknown().brand("CustomFieldValue");
|
|
926
1060
|
|
|
927
1061
|
// ../commons/src/events/PlainDate.ts
|
|
928
1062
|
var import_zod = require("zod");
|
|
929
1063
|
var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date in the format YYYY-MM-DD");
|
|
1064
|
+
function plainDateToLocalDate(date) {
|
|
1065
|
+
const [year, month, day] = date.split("-").map(Number);
|
|
1066
|
+
return new Date(year, month - 1, day);
|
|
1067
|
+
}
|
|
930
1068
|
|
|
931
1069
|
// ../commons/src/events/FieldValue.ts
|
|
932
|
-
var TextValue =
|
|
933
|
-
var HiddenFieldValue =
|
|
934
|
-
var NonEmptyTextValue =
|
|
935
|
-
var DateValue =
|
|
936
|
-
var AgeValue =
|
|
937
|
-
age:
|
|
938
|
-
asOfDateRef:
|
|
1070
|
+
var TextValue = z13.string();
|
|
1071
|
+
var HiddenFieldValue = z13.string();
|
|
1072
|
+
var NonEmptyTextValue = z13.string().trim().min(1);
|
|
1073
|
+
var DateValue = z13.iso.date().describe("Date in the format YYYY-MM-DD");
|
|
1074
|
+
var AgeValue = z13.object({
|
|
1075
|
+
age: z13.number(),
|
|
1076
|
+
asOfDateRef: z13.string()
|
|
939
1077
|
});
|
|
940
1078
|
var AgeUpdateValue = AgeValue.optional().nullable();
|
|
941
|
-
var AutocompleteValue =
|
|
942
|
-
label:
|
|
943
|
-
value:
|
|
1079
|
+
var AutocompleteValue = z13.object({
|
|
1080
|
+
label: z13.string(),
|
|
1081
|
+
value: z13.string()
|
|
944
1082
|
});
|
|
945
1083
|
var AutocompleteUpdateValue = AutocompleteValue.optional().nullable();
|
|
946
|
-
var TimeValue =
|
|
947
|
-
var DatetimeValue =
|
|
948
|
-
var SelectDateRangeValue =
|
|
1084
|
+
var TimeValue = z13.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/);
|
|
1085
|
+
var DatetimeValue = z13.iso.datetime();
|
|
1086
|
+
var SelectDateRangeValue = z13.enum([
|
|
949
1087
|
"last7Days",
|
|
950
1088
|
"last30Days",
|
|
951
1089
|
"last90Days",
|
|
952
1090
|
"last365Days"
|
|
953
1091
|
]);
|
|
954
|
-
var DateRangeFieldValue =
|
|
1092
|
+
var DateRangeFieldValue = z13.object({
|
|
955
1093
|
start: PlainDate,
|
|
956
1094
|
end: PlainDate
|
|
957
1095
|
}).or(PlainDate).describe(
|
|
958
1096
|
"Date range with start and end dates in the format YYYY-MM-DD. Inclusive start, exclusive end."
|
|
959
1097
|
);
|
|
960
|
-
var EmailValue =
|
|
961
|
-
var CheckboxFieldValue =
|
|
962
|
-
var NumberFieldValue =
|
|
1098
|
+
var EmailValue = z13.email();
|
|
1099
|
+
var CheckboxFieldValue = z13.boolean();
|
|
1100
|
+
var NumberFieldValue = z13.number();
|
|
963
1101
|
var SignatureFieldValue = FileFieldValue;
|
|
964
|
-
var ButtonFieldValue =
|
|
965
|
-
var VerificationStatusValue =
|
|
1102
|
+
var ButtonFieldValue = z13.number();
|
|
1103
|
+
var VerificationStatusValue = z13.enum([
|
|
966
1104
|
"verified",
|
|
967
1105
|
"authenticated",
|
|
968
1106
|
"failed",
|
|
969
1107
|
"pending"
|
|
970
1108
|
]);
|
|
971
|
-
var LeafFieldValues =
|
|
1109
|
+
var LeafFieldValues = z13.union([
|
|
972
1110
|
AddressFieldValue,
|
|
973
1111
|
TextValue,
|
|
974
1112
|
PlainDate,
|
|
@@ -994,11 +1132,11 @@ var LeafFieldValues = z12.union([
|
|
|
994
1132
|
AutocompleteValue,
|
|
995
1133
|
AutocompleteUpdateValue
|
|
996
1134
|
]);
|
|
997
|
-
var FieldGroupValue =
|
|
998
|
-
var DataFieldValue =
|
|
999
|
-
data:
|
|
1135
|
+
var FieldGroupValue = z13.record(z13.string(), LeafFieldValues);
|
|
1136
|
+
var DataFieldValue = z13.object({
|
|
1137
|
+
data: z13.record(z13.string(), LeafFieldValues)
|
|
1000
1138
|
}).nullish();
|
|
1001
|
-
var FieldValue =
|
|
1139
|
+
var FieldValue = z13.union([
|
|
1002
1140
|
LeafFieldValues,
|
|
1003
1141
|
DataFieldValue,
|
|
1004
1142
|
FieldGroupValue
|
|
@@ -1032,7 +1170,7 @@ function safeUnion(schemas) {
|
|
|
1032
1170
|
const sortedSchemas = [...schemas].sort(
|
|
1033
1171
|
(a, b) => schemaPriority(a) - schemaPriority(b)
|
|
1034
1172
|
);
|
|
1035
|
-
return
|
|
1173
|
+
return z13.any().superRefine((val, ctx) => {
|
|
1036
1174
|
for (const schema of sortedSchemas) {
|
|
1037
1175
|
if (schema.safeParse(val).success) {
|
|
1038
1176
|
return;
|
|
@@ -1071,9 +1209,9 @@ var FieldUpdateValue = safeUnion([
|
|
|
1071
1209
|
]);
|
|
1072
1210
|
|
|
1073
1211
|
// ../commons/src/events/serializers/user/serializer.ts
|
|
1074
|
-
var
|
|
1075
|
-
var SerializedUserField =
|
|
1076
|
-
$userField:
|
|
1212
|
+
var z14 = __toESM(require("zod/v4"));
|
|
1213
|
+
var SerializedUserField = z14.object({
|
|
1214
|
+
$userField: z14.enum([
|
|
1077
1215
|
"id",
|
|
1078
1216
|
"name",
|
|
1079
1217
|
"role",
|
|
@@ -1087,7 +1225,7 @@ var SerializedUserField = z13.object({
|
|
|
1087
1225
|
"primaryOfficeId",
|
|
1088
1226
|
"administrativeAreaId"
|
|
1089
1227
|
]),
|
|
1090
|
-
$location:
|
|
1228
|
+
$location: z14.string().optional()
|
|
1091
1229
|
});
|
|
1092
1230
|
function userSerializer(userField) {
|
|
1093
1231
|
return {
|
|
@@ -1113,27 +1251,22 @@ var import_v4 = require("zod/v4");
|
|
|
1113
1251
|
var z16 = __toESM(require("zod/v4"));
|
|
1114
1252
|
|
|
1115
1253
|
// ../commons/src/events/ActionDocument.ts
|
|
1116
|
-
var
|
|
1117
|
-
var ActionUpdate =
|
|
1254
|
+
var z15 = __toESM(require("zod/v4"));
|
|
1255
|
+
var ActionUpdate = z15.record(z15.string(), FieldUpdateValue).describe(
|
|
1118
1256
|
"Record of field-level changes made by an action. Supports partial updates and nullable values."
|
|
1119
1257
|
);
|
|
1120
|
-
var EventState =
|
|
1258
|
+
var EventState = z15.record(z15.string(), FieldValue).describe(
|
|
1121
1259
|
"Aggregate representation of event data after all actions have been applied, with all updates consolidated and null values removed."
|
|
1122
1260
|
);
|
|
1123
|
-
var
|
|
1124
|
-
Requested: "Requested",
|
|
1125
|
-
Accepted: "Accepted",
|
|
1126
|
-
Rejected: "Rejected"
|
|
1127
|
-
};
|
|
1128
|
-
var ActionBase = z14.object({
|
|
1261
|
+
var ActionBase = z15.object({
|
|
1129
1262
|
id: UUID.describe("Unique identifier of the action."),
|
|
1130
|
-
transactionId:
|
|
1263
|
+
transactionId: z15.string().describe("Unique identifier of the transaction."),
|
|
1131
1264
|
createdByUserType: TokenUserType.describe(
|
|
1132
1265
|
"Indicates whether the action was created by a human-user or by a system-user."
|
|
1133
1266
|
),
|
|
1134
|
-
createdAt:
|
|
1135
|
-
createdBy:
|
|
1136
|
-
createdByRole:
|
|
1267
|
+
createdAt: z15.string().datetime().describe("Timestamp indicating when the action was created."),
|
|
1268
|
+
createdBy: z15.string().describe("Identifier of the user who created the action."),
|
|
1269
|
+
createdByRole: z15.string().optional().describe("Role of the user who created the action."),
|
|
1137
1270
|
createdBySignature: DocumentPath.nullish().describe(
|
|
1138
1271
|
"Reference to the signature of the user who created the action."
|
|
1139
1272
|
),
|
|
@@ -1145,7 +1278,7 @@ var ActionBase = z14.object({
|
|
|
1145
1278
|
"Declaration data defined by the ActionConfig. Supports partial updates."
|
|
1146
1279
|
),
|
|
1147
1280
|
annotation: ActionUpdate.optional().nullable().describe("Action-specific metadata used to annotate the event."),
|
|
1148
|
-
status:
|
|
1281
|
+
status: z15.enum([
|
|
1149
1282
|
ActionStatus.Requested,
|
|
1150
1283
|
ActionStatus.Accepted,
|
|
1151
1284
|
ActionStatus.Rejected
|
|
@@ -1157,139 +1290,139 @@ var ActionBase = z14.object({
|
|
|
1157
1290
|
)
|
|
1158
1291
|
});
|
|
1159
1292
|
var AssignedAction = ActionBase.extend(
|
|
1160
|
-
|
|
1161
|
-
type:
|
|
1162
|
-
assignedTo:
|
|
1293
|
+
z15.object({
|
|
1294
|
+
type: z15.literal(ActionType.ASSIGN),
|
|
1295
|
+
assignedTo: z15.string().describe("Identifier of the user to whom the action is assigned.")
|
|
1163
1296
|
// TODO move into 'content' property
|
|
1164
1297
|
}).shape
|
|
1165
1298
|
);
|
|
1166
1299
|
var UnassignedAction = ActionBase.extend(
|
|
1167
|
-
|
|
1168
|
-
type:
|
|
1300
|
+
z15.object({
|
|
1301
|
+
type: z15.literal(ActionType.UNASSIGN)
|
|
1169
1302
|
}).shape
|
|
1170
1303
|
);
|
|
1171
1304
|
var RegisterAction = ActionBase.extend(
|
|
1172
|
-
|
|
1173
|
-
type:
|
|
1174
|
-
registrationNumber:
|
|
1305
|
+
z15.object({
|
|
1306
|
+
type: z15.literal(ActionType.REGISTER),
|
|
1307
|
+
registrationNumber: z15.string().optional().describe(
|
|
1175
1308
|
"Registration number of the event. Always present for accepted registrations."
|
|
1176
1309
|
)
|
|
1177
1310
|
// TODO move into 'content' property
|
|
1178
1311
|
}).shape
|
|
1179
1312
|
);
|
|
1180
1313
|
var DeclareAction = ActionBase.extend(
|
|
1181
|
-
|
|
1182
|
-
type:
|
|
1314
|
+
z15.object({
|
|
1315
|
+
type: z15.literal(ActionType.DECLARE)
|
|
1183
1316
|
}).shape
|
|
1184
1317
|
);
|
|
1185
|
-
var ReasonContent =
|
|
1186
|
-
reason:
|
|
1318
|
+
var ReasonContent = z15.object({
|
|
1319
|
+
reason: z15.string().min(1, { error: "Message cannot be empty" }).describe(
|
|
1187
1320
|
"Message describing the reason for rejecting or archiving the event."
|
|
1188
1321
|
)
|
|
1189
1322
|
});
|
|
1190
1323
|
var RejectAction = ActionBase.extend(
|
|
1191
|
-
|
|
1192
|
-
type:
|
|
1324
|
+
z15.object({
|
|
1325
|
+
type: z15.literal(ActionType.REJECT),
|
|
1193
1326
|
content: ReasonContent
|
|
1194
1327
|
}).shape
|
|
1195
1328
|
);
|
|
1196
|
-
var PotentialDuplicate =
|
|
1329
|
+
var PotentialDuplicate = z15.object({
|
|
1197
1330
|
id: UUID,
|
|
1198
|
-
trackingId:
|
|
1331
|
+
trackingId: z15.string()
|
|
1199
1332
|
});
|
|
1200
1333
|
var DuplicateDetectedAction = ActionBase.extend(
|
|
1201
|
-
|
|
1202
|
-
type:
|
|
1203
|
-
content:
|
|
1204
|
-
duplicates:
|
|
1334
|
+
z15.object({
|
|
1335
|
+
type: z15.literal(ActionType.DUPLICATE_DETECTED),
|
|
1336
|
+
content: z15.object({
|
|
1337
|
+
duplicates: z15.array(PotentialDuplicate)
|
|
1205
1338
|
})
|
|
1206
1339
|
}).shape
|
|
1207
1340
|
);
|
|
1208
1341
|
var MarkNotDuplicateAction = ActionBase.extend(
|
|
1209
|
-
|
|
1210
|
-
type:
|
|
1342
|
+
z15.object({
|
|
1343
|
+
type: z15.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
1211
1344
|
}).shape
|
|
1212
1345
|
);
|
|
1213
1346
|
var MarkAsDuplicateAction = ActionBase.extend(
|
|
1214
|
-
|
|
1215
|
-
type:
|
|
1216
|
-
content:
|
|
1347
|
+
z15.object({
|
|
1348
|
+
type: z15.literal(ActionType.MARK_AS_DUPLICATE),
|
|
1349
|
+
content: z15.object({
|
|
1217
1350
|
duplicateOf: UUID
|
|
1218
1351
|
}).optional()
|
|
1219
1352
|
}).shape
|
|
1220
1353
|
);
|
|
1221
1354
|
var ArchiveAction = ActionBase.extend(
|
|
1222
|
-
|
|
1223
|
-
type:
|
|
1355
|
+
z15.object({
|
|
1356
|
+
type: z15.literal(ActionType.ARCHIVE),
|
|
1224
1357
|
content: ReasonContent
|
|
1225
1358
|
}).shape
|
|
1226
1359
|
);
|
|
1227
1360
|
var UnarchiveAction = ActionBase.extend(
|
|
1228
|
-
|
|
1229
|
-
type:
|
|
1361
|
+
z15.object({
|
|
1362
|
+
type: z15.literal(ActionType.UNARCHIVE)
|
|
1230
1363
|
}).shape
|
|
1231
1364
|
);
|
|
1232
1365
|
var CreatedAction = ActionBase.extend(
|
|
1233
|
-
|
|
1234
|
-
type:
|
|
1366
|
+
z15.object({
|
|
1367
|
+
type: z15.literal(ActionType.CREATE)
|
|
1235
1368
|
}).shape
|
|
1236
1369
|
);
|
|
1237
1370
|
var NotifiedAction = ActionBase.extend(
|
|
1238
|
-
|
|
1239
|
-
type:
|
|
1371
|
+
z15.object({
|
|
1372
|
+
type: z15.literal(ActionType.NOTIFY)
|
|
1240
1373
|
}).shape
|
|
1241
1374
|
);
|
|
1242
1375
|
var EditAction = ActionBase.extend(
|
|
1243
|
-
|
|
1244
|
-
type:
|
|
1376
|
+
z15.object({
|
|
1377
|
+
type: z15.literal(ActionType.EDIT),
|
|
1245
1378
|
/** @deprecated New Edit-actions should no longer contain content. This is kept for old 2.0 edits. */
|
|
1246
|
-
content:
|
|
1247
|
-
comment:
|
|
1379
|
+
content: z15.object({
|
|
1380
|
+
comment: z15.string().describe("Comment for the edit action.").optional()
|
|
1248
1381
|
}).optional()
|
|
1249
1382
|
}).shape
|
|
1250
1383
|
);
|
|
1251
|
-
var PrintContent =
|
|
1252
|
-
templateId:
|
|
1384
|
+
var PrintContent = z15.object({
|
|
1385
|
+
templateId: z15.string().optional()
|
|
1253
1386
|
});
|
|
1254
1387
|
var PrintCertificateAction = ActionBase.extend(
|
|
1255
|
-
|
|
1256
|
-
type:
|
|
1388
|
+
z15.object({
|
|
1389
|
+
type: z15.literal(ActionType.PRINT_CERTIFICATE),
|
|
1257
1390
|
content: PrintContent.optional().nullable()
|
|
1258
1391
|
}).shape
|
|
1259
1392
|
);
|
|
1260
1393
|
var RequestedCorrectionAction = ActionBase.extend(
|
|
1261
|
-
|
|
1262
|
-
type:
|
|
1394
|
+
z15.object({
|
|
1395
|
+
type: z15.literal(ActionType.REQUEST_CORRECTION)
|
|
1263
1396
|
}).shape
|
|
1264
1397
|
);
|
|
1265
1398
|
var ApprovedCorrectionAction = ActionBase.extend(
|
|
1266
|
-
|
|
1267
|
-
type:
|
|
1268
|
-
requestId:
|
|
1399
|
+
z15.object({
|
|
1400
|
+
type: z15.literal(ActionType.APPROVE_CORRECTION),
|
|
1401
|
+
requestId: z15.string(),
|
|
1269
1402
|
// TODO move into 'content' property
|
|
1270
|
-
content:
|
|
1403
|
+
content: z15.object({ immediateCorrection: z15.boolean().optional() }).optional()
|
|
1271
1404
|
}).shape
|
|
1272
1405
|
);
|
|
1273
1406
|
var RejectedCorrectionAction = ActionBase.extend(
|
|
1274
|
-
|
|
1275
|
-
type:
|
|
1276
|
-
requestId:
|
|
1407
|
+
z15.object({
|
|
1408
|
+
type: z15.literal(ActionType.REJECT_CORRECTION),
|
|
1409
|
+
requestId: z15.string(),
|
|
1277
1410
|
// TODO move into 'content' property
|
|
1278
1411
|
content: ReasonContent
|
|
1279
1412
|
}).shape
|
|
1280
1413
|
);
|
|
1281
1414
|
var ReadAction = ActionBase.extend(
|
|
1282
|
-
|
|
1283
|
-
type:
|
|
1415
|
+
z15.object({
|
|
1416
|
+
type: z15.literal(ActionType.READ)
|
|
1284
1417
|
}).shape
|
|
1285
1418
|
);
|
|
1286
1419
|
var CustomAction = ActionBase.merge(
|
|
1287
|
-
|
|
1288
|
-
type:
|
|
1289
|
-
customActionType:
|
|
1420
|
+
z15.object({
|
|
1421
|
+
type: z15.literal(ActionType.CUSTOM),
|
|
1422
|
+
customActionType: z15.string()
|
|
1290
1423
|
})
|
|
1291
1424
|
);
|
|
1292
|
-
var ActionDocument =
|
|
1425
|
+
var ActionDocument = z15.discriminatedUnion("type", [
|
|
1293
1426
|
CreatedAction.meta({ id: "CreatedAction" }),
|
|
1294
1427
|
RejectAction.meta({ id: "RejectAction" }),
|
|
1295
1428
|
DuplicateDetectedAction.meta({ id: "DuplicateDetectedAction" }),
|
|
@@ -1316,64 +1449,12 @@ var AsyncRejectActionDocument = ActionBase.omit({
|
|
|
1316
1449
|
declaration: true,
|
|
1317
1450
|
annotation: true
|
|
1318
1451
|
}).extend(
|
|
1319
|
-
|
|
1320
|
-
type:
|
|
1321
|
-
status:
|
|
1452
|
+
z15.object({
|
|
1453
|
+
type: z15.enum(ConfirmableActions),
|
|
1454
|
+
status: z15.literal(ActionStatus.Rejected)
|
|
1322
1455
|
}).shape
|
|
1323
1456
|
);
|
|
1324
|
-
var Action =
|
|
1325
|
-
|
|
1326
|
-
// ../commons/src/events/Flag.ts
|
|
1327
|
-
var z15 = __toESM(require("zod/v4"));
|
|
1328
|
-
var InherentFlags = {
|
|
1329
|
-
INCOMPLETE: "incomplete",
|
|
1330
|
-
REJECTED: "rejected",
|
|
1331
|
-
CORRECTION_REQUESTED: "correction-requested",
|
|
1332
|
-
POTENTIAL_DUPLICATE: "potential-duplicate",
|
|
1333
|
-
/**
|
|
1334
|
-
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
1335
|
-
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
1336
|
-
*
|
|
1337
|
-
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
1338
|
-
*/
|
|
1339
|
-
EDIT_IN_PROGRESS: "edit-in-progress"
|
|
1340
|
-
};
|
|
1341
|
-
var ActionFlag = z15.string().regex(
|
|
1342
|
-
new RegExp(
|
|
1343
|
-
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
1344
|
-
ActionStatus
|
|
1345
|
-
).join("|").toLowerCase()})$`
|
|
1346
|
-
),
|
|
1347
|
-
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
1348
|
-
);
|
|
1349
|
-
var CustomFlag = z15.string().refine((val) => !Object.values(InherentFlags).includes(val), {
|
|
1350
|
-
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
1351
|
-
InherentFlags
|
|
1352
|
-
).join(", ")}`
|
|
1353
|
-
}).refine((val) => !ActionFlag.safeParse(val).success, {
|
|
1354
|
-
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
1355
|
-
}).describe("Custom flag identifier defined by the country config.");
|
|
1356
|
-
var Flag = ActionFlag.or(z15.enum(InherentFlags)).or(CustomFlag);
|
|
1357
|
-
var FlagConfig = z15.object({
|
|
1358
|
-
id: CustomFlag,
|
|
1359
|
-
requiresAction: z15.boolean().describe(
|
|
1360
|
-
"Indicates if this flag expects an action to be performed to be cleared."
|
|
1361
|
-
),
|
|
1362
|
-
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1363
|
-
}).meta({
|
|
1364
|
-
id: "FlagConfig",
|
|
1365
|
-
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
1366
|
-
});
|
|
1367
|
-
var ActionFlagConfig = z15.object({
|
|
1368
|
-
id: Flag,
|
|
1369
|
-
operation: z15.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
1370
|
-
conditional: Conditional.optional().describe(
|
|
1371
|
-
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1372
|
-
)
|
|
1373
|
-
}).meta({
|
|
1374
|
-
id: "ActionFlagConfig",
|
|
1375
|
-
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
1376
|
-
});
|
|
1457
|
+
var Action = z15.union([ActionDocument, AsyncRejectActionDocument]);
|
|
1377
1458
|
|
|
1378
1459
|
// ../commons/src/events/EventMetadata.ts
|
|
1379
1460
|
var EventStatus = z16.enum([
|
|
@@ -1531,13 +1612,6 @@ var Range = import_v4.z.object({
|
|
|
1531
1612
|
}).meta({
|
|
1532
1613
|
id: "Range"
|
|
1533
1614
|
});
|
|
1534
|
-
var ContainsFlags = import_v4.z.object({
|
|
1535
|
-
anyOf: import_v4.z.array(Flag).optional(),
|
|
1536
|
-
noneOf: import_v4.z.array(Flag).optional(),
|
|
1537
|
-
allOf: import_v4.z.array(Flag).optional()
|
|
1538
|
-
}).meta({
|
|
1539
|
-
id: "ContainsFlags"
|
|
1540
|
-
});
|
|
1541
1615
|
var Within = import_v4.z.object({ type: import_v4.z.literal("within"), location: import_v4.z.string() }).meta({
|
|
1542
1616
|
id: "Within"
|
|
1543
1617
|
});
|
|
@@ -1764,8 +1838,8 @@ var BaseField = import_v43.default.object({
|
|
|
1764
1838
|
conditionals: import_v43.default.array(FieldConditional).default([]).optional().describe(
|
|
1765
1839
|
"Conditions determining when the field is shown or enabled. By default, the field is always shown and enabled."
|
|
1766
1840
|
),
|
|
1767
|
-
secured: import_v43.default.boolean().default(false).optional().describe(
|
|
1768
|
-
"Indicates whether the field is secured. Secured fields are not indexed for search and are only visible when explicitly assigned."
|
|
1841
|
+
secured: import_v43.default.union([import_v43.default.boolean(), Conditional]).default(false).optional().describe(
|
|
1842
|
+
"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."
|
|
1769
1843
|
),
|
|
1770
1844
|
placeholder: TranslationConfig.optional(),
|
|
1771
1845
|
validation: import_v43.default.array(ValidationConfig).default([]).optional().describe("Additional validation rules applied to the field."),
|
|
@@ -2163,7 +2237,13 @@ var AdministrativeAreaField = BaseField.extend({
|
|
|
2163
2237
|
configuration: import_v43.default.object({
|
|
2164
2238
|
partOf: FieldReference.optional().describe("Parent location"),
|
|
2165
2239
|
type: AdministrativeAreas,
|
|
2166
|
-
allowedLocations: AllowedLocations
|
|
2240
|
+
allowedLocations: AllowedLocations,
|
|
2241
|
+
listHistoricalNames: import_v43.default.boolean().optional().describe(
|
|
2242
|
+
"Advanced search: list every historical name a location has had as a separate, selectable option."
|
|
2243
|
+
),
|
|
2244
|
+
activeOnly: import_v43.default.boolean().optional().describe(
|
|
2245
|
+
"Advanced search: offer only currently-active locations; inactivated ones are excluded."
|
|
2246
|
+
)
|
|
2167
2247
|
}).describe("Administrative area options")
|
|
2168
2248
|
}).meta({
|
|
2169
2249
|
description: "Administrative area input field",
|
|
@@ -2174,7 +2254,10 @@ var LocationInput = BaseField.extend({
|
|
|
2174
2254
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
|
|
2175
2255
|
configuration: import_v43.default.object({
|
|
2176
2256
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
2177
|
-
allowedLocations: AllowedLocations
|
|
2257
|
+
allowedLocations: AllowedLocations,
|
|
2258
|
+
listHistoricalNames: import_v43.default.boolean().optional().describe(
|
|
2259
|
+
"Advanced search: list every historical name a location has had as a separate, selectable option."
|
|
2260
|
+
)
|
|
2178
2261
|
}).optional()
|
|
2179
2262
|
}).meta({
|
|
2180
2263
|
description: "A field for selecting a location",
|
|
@@ -2200,12 +2283,18 @@ var FileUploadWithOptions = BaseField.extend({
|
|
|
2200
2283
|
var Facility = BaseField.extend({
|
|
2201
2284
|
type: import_v43.default.literal(FieldType.FACILITY),
|
|
2202
2285
|
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
2203
|
-
configuration: import_v43.default.object({
|
|
2286
|
+
configuration: import_v43.default.object({
|
|
2287
|
+
allowedLocations: AllowedLocations,
|
|
2288
|
+
listHistoricalNames: import_v43.default.boolean().optional()
|
|
2289
|
+
}).optional()
|
|
2204
2290
|
}).describe("Input field for a facility");
|
|
2205
2291
|
var Office = BaseField.extend({
|
|
2206
2292
|
type: import_v43.default.literal(FieldType.OFFICE),
|
|
2207
2293
|
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
2208
|
-
configuration: import_v43.default.object({
|
|
2294
|
+
configuration: import_v43.default.object({
|
|
2295
|
+
allowedLocations: AllowedLocations,
|
|
2296
|
+
listHistoricalNames: import_v43.default.boolean().optional()
|
|
2297
|
+
}).optional()
|
|
2209
2298
|
}).describe("Input field for an office");
|
|
2210
2299
|
var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
|
|
2211
2300
|
administrativeArea: import_v43.default.union([UUID, SerializedUserField]).optional()
|
|
@@ -2238,7 +2327,13 @@ var Address = BaseField.extend({
|
|
|
2238
2327
|
parent: FieldReference.optional()
|
|
2239
2328
|
})
|
|
2240
2329
|
).optional(),
|
|
2241
|
-
allowedLocations: AllowedLocations
|
|
2330
|
+
allowedLocations: AllowedLocations,
|
|
2331
|
+
listHistoricalNames: import_v43.default.boolean().optional().describe(
|
|
2332
|
+
"Advanced search: list every historical name a location has had as a separate, selectable option. Propagated to the embedded admin-area selectors."
|
|
2333
|
+
),
|
|
2334
|
+
activeOnly: import_v43.default.boolean().optional().describe(
|
|
2335
|
+
"Advanced search: offer only currently-active admin areas; inactivated ones are excluded. Propagated to the embedded admin-area selectors."
|
|
2336
|
+
)
|
|
2242
2337
|
}).optional(),
|
|
2243
2338
|
defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
|
|
2244
2339
|
}).meta({
|
|
@@ -3010,69 +3105,205 @@ var LanguageConfig = z26.object({
|
|
|
3010
3105
|
});
|
|
3011
3106
|
|
|
3012
3107
|
// ../commons/src/events/EventConfig.ts
|
|
3013
|
-
var
|
|
3108
|
+
var z34 = __toESM(require("zod/v4"));
|
|
3014
3109
|
|
|
3015
3110
|
// ../commons/src/events/SummaryConfig.ts
|
|
3016
|
-
var z27 = __toESM(require("zod/v4"));
|
|
3017
|
-
var BaseField2 = z27.object({
|
|
3018
|
-
emptyValueMessage: TranslationConfig.optional().describe(
|
|
3019
|
-
"Default message displayed when the field value is empty."
|
|
3020
|
-
),
|
|
3021
|
-
conditionals: z27.array(ShowConditional).default([]).optional()
|
|
3022
|
-
});
|
|
3023
|
-
var ReferenceField = BaseField2.extend({
|
|
3024
|
-
fieldId: z27.string(),
|
|
3025
|
-
label: TranslationConfig.optional().describe(
|
|
3026
|
-
"Overrides the default label from the referenced field when provided."
|
|
3027
|
-
)
|
|
3028
|
-
}).describe("Field referencing existing event data by field ID.");
|
|
3029
|
-
var Field = BaseField2.extend({
|
|
3030
|
-
id: z27.string().describe("Identifier of the summary field."),
|
|
3031
|
-
value: TranslationConfig.describe(
|
|
3032
|
-
'Field value template supporting variables from configuration and EventMetadata (e.g. "{informant.phoneNo} {informant.email}").'
|
|
3033
|
-
),
|
|
3034
|
-
label: TranslationConfig
|
|
3035
|
-
}).describe("Custom field defined for the summary view.");
|
|
3036
|
-
var SummaryConfig = z27.object({
|
|
3037
|
-
fields: z27.array(z27.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
|
|
3038
|
-
}).meta({
|
|
3039
|
-
id: "SummaryConfig",
|
|
3040
|
-
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."
|
|
3041
|
-
});
|
|
3042
|
-
|
|
3043
|
-
// ../commons/src/events/AdvancedSearchConfig.ts
|
|
3044
3111
|
var z28 = __toESM(require("zod/v4"));
|
|
3045
|
-
var MatchType = z28.enum(["fuzzy", "exact", "range", "within"]);
|
|
3046
|
-
var BaseField3 = z28.object({
|
|
3047
|
-
config: z28.object({
|
|
3048
|
-
type: MatchType.describe(
|
|
3049
|
-
"Determines the search type of field. How to match value."
|
|
3050
|
-
),
|
|
3051
|
-
searchFields: z28.array(z28.string()).optional().describe(
|
|
3052
|
-
`
|
|
3053
|
-
Defines multiple form fields that should be searched when this field has a value.
|
|
3054
|
-
All specified fields will be combined using OR logic.
|
|
3055
3112
|
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3113
|
+
// ../commons/src/icons.ts
|
|
3114
|
+
var z27 = __toESM(require("zod/v4"));
|
|
3115
|
+
var AvailableIcons = z27.enum([
|
|
3116
|
+
"Archived",
|
|
3117
|
+
"Assigned",
|
|
3118
|
+
"Briefcase",
|
|
3119
|
+
"Certified",
|
|
3120
|
+
"Close",
|
|
3121
|
+
"Collapse",
|
|
3122
|
+
"Draft",
|
|
3123
|
+
"DuplicateYellow",
|
|
3124
|
+
"Expand",
|
|
3125
|
+
"ExternalValidate",
|
|
3126
|
+
"FilledCheck",
|
|
3127
|
+
"InReview",
|
|
3128
|
+
"Offline",
|
|
3129
|
+
"Registered",
|
|
3130
|
+
"RequiresUpdates",
|
|
3131
|
+
"Sent",
|
|
3132
|
+
"Validated",
|
|
3133
|
+
"WaitingApproval",
|
|
3134
|
+
"ChartActivity",
|
|
3135
|
+
"Activity",
|
|
3136
|
+
"Archive",
|
|
3137
|
+
"ArchiveTray",
|
|
3138
|
+
"ArrowLeft",
|
|
3139
|
+
"ArrowRight",
|
|
3140
|
+
"Buildings",
|
|
3141
|
+
"Circle",
|
|
3142
|
+
"CaretDown",
|
|
3143
|
+
"CaretLeft",
|
|
3144
|
+
"CaretRight",
|
|
3145
|
+
"ChartBar",
|
|
3146
|
+
"ChartLine",
|
|
3147
|
+
"ChatCircle",
|
|
3148
|
+
"CheckSquare",
|
|
3149
|
+
"Compass",
|
|
3150
|
+
"Check",
|
|
3151
|
+
"Copy",
|
|
3152
|
+
"Database",
|
|
3153
|
+
"DotsThreeVertical",
|
|
3154
|
+
"ArrowCounterClockwise",
|
|
3155
|
+
"MagnifyingGlassMinus",
|
|
3156
|
+
"MagnifyingGlassPlus",
|
|
3157
|
+
"Export",
|
|
3158
|
+
"Eye",
|
|
3159
|
+
"EyeSlash",
|
|
3160
|
+
"Envelope",
|
|
3161
|
+
"File",
|
|
3162
|
+
"FileLock",
|
|
3163
|
+
"FileSearch",
|
|
3164
|
+
"FileMinus",
|
|
3165
|
+
"FilePlus",
|
|
3166
|
+
"FileText",
|
|
3167
|
+
"FileX",
|
|
3168
|
+
"Handshake",
|
|
3169
|
+
"Gear",
|
|
3170
|
+
"GitBranch",
|
|
3171
|
+
"IdentificationCard",
|
|
3172
|
+
"List",
|
|
3173
|
+
"ListBullets",
|
|
3174
|
+
"Lock",
|
|
3175
|
+
"MagnifyingGlass",
|
|
3176
|
+
"MapPin",
|
|
3177
|
+
"Medal",
|
|
3178
|
+
"NotePencil",
|
|
3179
|
+
"Paperclip",
|
|
3180
|
+
"PaperPlaneTilt",
|
|
3181
|
+
"Pen",
|
|
3182
|
+
"PenNib",
|
|
3183
|
+
"Pencil",
|
|
3184
|
+
"PencilSimpleLine",
|
|
3185
|
+
"Phone",
|
|
3186
|
+
"Plus",
|
|
3187
|
+
"Printer",
|
|
3188
|
+
"SignOut",
|
|
3189
|
+
"Stamp",
|
|
3190
|
+
"Star",
|
|
3191
|
+
"Target",
|
|
3192
|
+
"TextT",
|
|
3193
|
+
"Trash",
|
|
3194
|
+
"UploadSimple",
|
|
3195
|
+
"User",
|
|
3196
|
+
"UserPlus",
|
|
3197
|
+
"Users",
|
|
3198
|
+
"WarningCircle",
|
|
3199
|
+
"X",
|
|
3200
|
+
"ChatText",
|
|
3201
|
+
"CircleWavyCheck",
|
|
3202
|
+
"CircleWavyQuestion",
|
|
3203
|
+
"ArchiveBox",
|
|
3204
|
+
"ArrowCircleDown",
|
|
3205
|
+
"FileArrowUp",
|
|
3206
|
+
"FileDotted",
|
|
3207
|
+
"Files",
|
|
3208
|
+
"PencilLine",
|
|
3209
|
+
"PencilCircle",
|
|
3210
|
+
"UserCircle",
|
|
3211
|
+
"Clock",
|
|
3212
|
+
"QrCode",
|
|
3213
|
+
"Webcam",
|
|
3214
|
+
"Sun",
|
|
3215
|
+
"DeviceTabletCamera",
|
|
3216
|
+
"Globe",
|
|
3217
|
+
"Fingerprint",
|
|
3218
|
+
"PushPin",
|
|
3219
|
+
"Timer"
|
|
3220
|
+
]);
|
|
3221
|
+
|
|
3222
|
+
// ../commons/src/events/SummaryConfig.ts
|
|
3223
|
+
var InfoBox = z28.object({
|
|
3224
|
+
type: z28.enum(["info", "positive", "warning", "negative"]).describe(
|
|
3225
|
+
"Semantic tint of the icon block: info (blue), positive (green), warning (orange), negative (red)."
|
|
3226
|
+
),
|
|
3227
|
+
background: z28.enum(["tinted", "white"]).default("tinted").optional().describe(
|
|
3228
|
+
"tinted reads as a recessed empty state; white reads as a standalone card."
|
|
3229
|
+
),
|
|
3230
|
+
icon: AvailableIcons.optional().describe(
|
|
3231
|
+
"Icon displayed inside the icon block. Defaults to FileSearch."
|
|
3232
|
+
),
|
|
3233
|
+
heading: TranslationConfig.describe(
|
|
3234
|
+
"Primary message. Short, sentence-case."
|
|
3235
|
+
),
|
|
3236
|
+
description: TranslationConfig.optional().describe(
|
|
3237
|
+
"Secondary copy displayed below the heading, typically a suggested next step."
|
|
3238
|
+
),
|
|
3239
|
+
conditionals: z28.array(ShowConditional).default([]).optional().describe(
|
|
3240
|
+
"Conditions under which the info box is shown. When omitted, it is always shown."
|
|
3241
|
+
)
|
|
3242
|
+
}).describe(
|
|
3243
|
+
"A compact icon-block + heading + description block displayed above the summary fields in the event overview."
|
|
3244
|
+
);
|
|
3245
|
+
var BaseField2 = z28.object({
|
|
3246
|
+
emptyValueMessage: TranslationConfig.optional().describe(
|
|
3247
|
+
"Default message displayed when the field value is empty."
|
|
3074
3248
|
),
|
|
3075
|
-
|
|
3249
|
+
conditionals: z28.array(ShowConditional).default([]).optional()
|
|
3250
|
+
});
|
|
3251
|
+
var ReferenceField = BaseField2.extend({
|
|
3252
|
+
fieldId: z28.string(),
|
|
3253
|
+
label: TranslationConfig.optional().describe(
|
|
3254
|
+
"Overrides the default label from the referenced field when provided."
|
|
3255
|
+
)
|
|
3256
|
+
}).describe("Field referencing existing event data by field ID.");
|
|
3257
|
+
var Field = BaseField2.extend({
|
|
3258
|
+
id: z28.string().describe("Identifier of the summary field."),
|
|
3259
|
+
value: TranslationConfig.describe(
|
|
3260
|
+
'Field value template supporting variables from configuration and EventMetadata (e.g. "{informant.phoneNo} {informant.email}").'
|
|
3261
|
+
),
|
|
3262
|
+
label: TranslationConfig
|
|
3263
|
+
}).describe("Custom field defined for the summary view.");
|
|
3264
|
+
var SummaryConfig = z28.object({
|
|
3265
|
+
banners: z28.array(InfoBox).default([]).optional().describe(
|
|
3266
|
+
"Info boxes displayed above the summary fields in the event overview."
|
|
3267
|
+
),
|
|
3268
|
+
fields: z28.array(z28.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
|
|
3269
|
+
}).meta({
|
|
3270
|
+
id: "SummaryConfig",
|
|
3271
|
+
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."
|
|
3272
|
+
});
|
|
3273
|
+
|
|
3274
|
+
// ../commons/src/events/AdvancedSearchConfig.ts
|
|
3275
|
+
var z29 = __toESM(require("zod/v4"));
|
|
3276
|
+
var MatchType = z29.enum(["fuzzy", "exact", "range", "within"]);
|
|
3277
|
+
var BaseField3 = z29.object({
|
|
3278
|
+
config: z29.object({
|
|
3279
|
+
type: MatchType.describe(
|
|
3280
|
+
"Determines the search type of field. How to match value."
|
|
3281
|
+
),
|
|
3282
|
+
searchFields: z29.array(z29.string()).optional().describe(
|
|
3283
|
+
`
|
|
3284
|
+
Defines multiple form fields that should be searched when this field has a value.
|
|
3285
|
+
All specified fields will be combined using OR logic.
|
|
3286
|
+
|
|
3287
|
+
Example: { searchFields: ['mother.name', 'father.name', 'informant.name'] }
|
|
3288
|
+
Will search all fields and return a record if any of the fields match the search value.
|
|
3289
|
+
`
|
|
3290
|
+
)
|
|
3291
|
+
}),
|
|
3292
|
+
type: z29.nativeEnum(FieldType).optional().describe(
|
|
3293
|
+
`
|
|
3294
|
+
Explicitly specify the field type for searchFields.
|
|
3295
|
+
This is required when searchFields is defined, to show the correct control in the UI.
|
|
3296
|
+
|
|
3297
|
+
Example: FieldType.NAME for name fields, FieldType.TEXT for text fields, FieldType.DATE for date fields, etc.
|
|
3298
|
+
`
|
|
3299
|
+
),
|
|
3300
|
+
label: TranslationConfig.optional().describe(
|
|
3301
|
+
`
|
|
3302
|
+
Explicitly specify the label for searchFields.
|
|
3303
|
+
This is required when searchFields is defined.
|
|
3304
|
+
`
|
|
3305
|
+
),
|
|
3306
|
+
options: z29.array(SelectOption).optional(),
|
|
3076
3307
|
searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
|
|
3077
3308
|
`
|
|
3078
3309
|
This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
|
|
@@ -3093,7 +3324,7 @@ var BaseField3 = z28.object({
|
|
|
3093
3324
|
in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
|
|
3094
3325
|
`
|
|
3095
3326
|
),
|
|
3096
|
-
conditionals:
|
|
3327
|
+
conditionals: z29.array(FieldConditional).optional().describe(
|
|
3097
3328
|
`
|
|
3098
3329
|
In advanced search, we sometimes need to override the default field visibility conditionals.
|
|
3099
3330
|
|
|
@@ -3107,23 +3338,23 @@ var BaseField3 = z28.object({
|
|
|
3107
3338
|
are always rendered in the advanced search form.
|
|
3108
3339
|
`
|
|
3109
3340
|
),
|
|
3110
|
-
validations:
|
|
3341
|
+
validations: z29.array(ValidationConfig).optional().describe(
|
|
3111
3342
|
`Option for overriding the field validations specifically for advanced search form.`
|
|
3112
3343
|
),
|
|
3113
3344
|
allowedLocations: JurisdictionReference.optional().describe(
|
|
3114
3345
|
`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.`
|
|
3115
3346
|
)
|
|
3116
3347
|
});
|
|
3117
|
-
var SearchQueryParams =
|
|
3118
|
-
eventType:
|
|
3348
|
+
var SearchQueryParams = z29.object({
|
|
3349
|
+
eventType: z29.string().optional().describe(
|
|
3119
3350
|
"Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
|
|
3120
3351
|
)
|
|
3121
3352
|
}).catchall(FieldValue);
|
|
3122
3353
|
var FieldConfigSchema = BaseField3.extend({
|
|
3123
|
-
fieldId:
|
|
3124
|
-
fieldType:
|
|
3354
|
+
fieldId: z29.string(),
|
|
3355
|
+
fieldType: z29.literal("field")
|
|
3125
3356
|
});
|
|
3126
|
-
var EventFieldIdInput =
|
|
3357
|
+
var EventFieldIdInput = z29.enum([
|
|
3127
3358
|
"trackingId",
|
|
3128
3359
|
"status",
|
|
3129
3360
|
"legalStatuses.REGISTERED.acceptedAt",
|
|
@@ -3132,7 +3363,7 @@ var EventFieldIdInput = z28.enum([
|
|
|
3132
3363
|
"updatedAt"
|
|
3133
3364
|
]);
|
|
3134
3365
|
var METADATA_FIELD_PREFIX = "event.";
|
|
3135
|
-
var EventFieldId =
|
|
3366
|
+
var EventFieldId = z29.enum([
|
|
3136
3367
|
`${METADATA_FIELD_PREFIX}trackingId`,
|
|
3137
3368
|
`${METADATA_FIELD_PREFIX}status`,
|
|
3138
3369
|
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
|
|
@@ -3142,190 +3373,64 @@ var EventFieldId = z28.enum([
|
|
|
3142
3373
|
]);
|
|
3143
3374
|
var EventFieldConfigSchema = BaseField3.extend({
|
|
3144
3375
|
fieldId: EventFieldId,
|
|
3145
|
-
fieldType:
|
|
3376
|
+
fieldType: z29.literal("event")
|
|
3146
3377
|
});
|
|
3147
|
-
var AdvancedSearchField =
|
|
3378
|
+
var AdvancedSearchField = z29.discriminatedUnion("fieldType", [FieldConfigSchema, EventFieldConfigSchema]).superRefine((data, ctx) => {
|
|
3148
3379
|
if (data.config.searchFields && data.config.searchFields.length > 0) {
|
|
3149
3380
|
if (!data.label) {
|
|
3150
3381
|
ctx.addIssue({
|
|
3151
|
-
code:
|
|
3382
|
+
code: z29.ZodIssueCode.custom,
|
|
3152
3383
|
message: "label is required when config.searchFields is defined.",
|
|
3153
3384
|
path: ["label"]
|
|
3154
3385
|
});
|
|
3155
3386
|
}
|
|
3156
3387
|
if (!data.type) {
|
|
3157
3388
|
ctx.addIssue({
|
|
3158
|
-
code:
|
|
3389
|
+
code: z29.ZodIssueCode.custom,
|
|
3159
3390
|
message: "type is required when config.searchFields is defined.",
|
|
3160
3391
|
path: ["type"]
|
|
3161
3392
|
});
|
|
3162
3393
|
}
|
|
3163
3394
|
}
|
|
3164
3395
|
});
|
|
3165
|
-
var AdvancedSearchConfig =
|
|
3396
|
+
var AdvancedSearchConfig = z29.object({
|
|
3166
3397
|
title: TranslationConfig.describe("Advanced search tab title"),
|
|
3167
|
-
fields:
|
|
3398
|
+
fields: z29.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
|
|
3168
3399
|
}).meta({
|
|
3169
3400
|
id: "AdvancedSearchConfig",
|
|
3170
3401
|
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()`)."
|
|
3171
3402
|
});
|
|
3172
3403
|
|
|
3173
3404
|
// ../commons/src/events/utils.ts
|
|
3174
|
-
var
|
|
3405
|
+
var import_lodash4 = require("lodash");
|
|
3175
3406
|
|
|
3176
3407
|
// ../commons/src/conditionals/validate.ts
|
|
3177
3408
|
var import__ = __toESM(require("ajv/dist/2019"));
|
|
3178
3409
|
var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
3179
|
-
var
|
|
3180
|
-
var
|
|
3410
|
+
var z33 = __toESM(require("zod/v4"));
|
|
3411
|
+
var import_date_fns2 = require("date-fns");
|
|
3181
3412
|
|
|
3182
3413
|
// ../commons/src/events/FieldTypeMapping.ts
|
|
3183
|
-
var
|
|
3414
|
+
var z31 = __toESM(require("zod/v4"));
|
|
3184
3415
|
|
|
3185
3416
|
// ../commons/src/events/DynamicFieldValue.ts
|
|
3186
|
-
var
|
|
3417
|
+
var z30 = __toESM(require("zod/v4"));
|
|
3187
3418
|
|
|
3188
|
-
// ../commons/src/
|
|
3189
|
-
var
|
|
3190
|
-
$data: true,
|
|
3191
|
-
allowUnionTypes: true,
|
|
3192
|
-
strict: false
|
|
3193
|
-
// Allow minContains and other newer features
|
|
3194
|
-
});
|
|
3195
|
-
var DataContext = z31.object({
|
|
3196
|
-
rootData: z31.object({
|
|
3197
|
-
$leafAdminStructureLocationIds: z31.array(z31.object({ id: UUID }))
|
|
3198
|
-
})
|
|
3199
|
-
});
|
|
3200
|
-
function resolveDataPath(rootData, dataPath, instancePath) {
|
|
3201
|
-
const pathParts = dataPath.split("/");
|
|
3202
|
-
const levels = parseInt(pathParts[0], 10);
|
|
3203
|
-
const referencePath = pathParts.slice(1);
|
|
3204
|
-
const instanceParts = instancePath.split("/").filter(Boolean);
|
|
3205
|
-
const traversedParts = instanceParts.slice(0, -levels);
|
|
3206
|
-
let current = rootData;
|
|
3207
|
-
for (const part of traversedParts) {
|
|
3208
|
-
if (current === null || current === void 0) {
|
|
3209
|
-
return void 0;
|
|
3210
|
-
}
|
|
3211
|
-
current = current[part];
|
|
3212
|
-
}
|
|
3213
|
-
for (const part of referencePath) {
|
|
3214
|
-
if (current === null || current === void 0) {
|
|
3215
|
-
return void 0;
|
|
3216
|
-
}
|
|
3217
|
-
current = current[part];
|
|
3218
|
-
}
|
|
3219
|
-
return current;
|
|
3220
|
-
}
|
|
3221
|
-
function todayISO() {
|
|
3222
|
-
return (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
|
|
3223
|
-
}
|
|
3224
|
-
var compiledFunctionCache = /* @__PURE__ */ new Map();
|
|
3225
|
-
function compileClientFunction(code) {
|
|
3226
|
-
let fn = compiledFunctionCache.get(code);
|
|
3227
|
-
if (!fn) {
|
|
3228
|
-
fn = new Function(`return (${code})`)();
|
|
3229
|
-
compiledFunctionCache.set(code, fn);
|
|
3230
|
-
}
|
|
3231
|
-
return fn;
|
|
3232
|
-
}
|
|
3233
|
-
(0, import_ajv_formats.default)(ajv);
|
|
3234
|
-
function buildClientFunctionContext(input) {
|
|
3235
|
-
return {
|
|
3236
|
-
$form: input.form,
|
|
3237
|
-
$now: todayISO(),
|
|
3238
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
3239
|
-
$online: isOnline(),
|
|
3240
|
-
$user: input.validatorContext?.user,
|
|
3241
|
-
$event: input.validatorContext?.event,
|
|
3242
|
-
$leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
|
|
3243
|
-
user: input.systemVariables?.user,
|
|
3244
|
-
$window: input.systemVariables?.$window,
|
|
3245
|
-
locations: input.locations,
|
|
3246
|
-
adminLevelIds: input.adminLevelIds
|
|
3247
|
-
};
|
|
3248
|
-
}
|
|
3249
|
-
function runClientFunction(code, data, context) {
|
|
3250
|
-
return compileClientFunction(code)(data, context);
|
|
3251
|
-
}
|
|
3252
|
-
ajv.addKeyword({
|
|
3253
|
-
keyword: "daysFromDate",
|
|
3254
|
-
type: "string",
|
|
3255
|
-
schemaType: "object",
|
|
3256
|
-
$data: true,
|
|
3257
|
-
errors: true,
|
|
3258
|
-
validate(schema, data, _2, dataContext) {
|
|
3259
|
-
if (!(dataContext && dataContext.rootData && typeof dataContext.rootData === "object" && "$now" in dataContext.rootData && typeof dataContext.rootData.$now === "string")) {
|
|
3260
|
-
throw new Error("Validation context must contain $now");
|
|
3261
|
-
}
|
|
3262
|
-
const { days, clause } = schema;
|
|
3263
|
-
if (typeof data !== "string") {
|
|
3264
|
-
return false;
|
|
3265
|
-
}
|
|
3266
|
-
const date = new Date(data);
|
|
3267
|
-
if (isNaN(date.getTime())) {
|
|
3268
|
-
return false;
|
|
3269
|
-
}
|
|
3270
|
-
let referenceDate = schema.referenceDate;
|
|
3271
|
-
if (referenceDate && typeof referenceDate === "object" && "$data" in referenceDate) {
|
|
3272
|
-
referenceDate = resolveDataPath(
|
|
3273
|
-
dataContext.rootData,
|
|
3274
|
-
referenceDate.$data,
|
|
3275
|
-
dataContext.instancePath
|
|
3276
|
-
);
|
|
3277
|
-
}
|
|
3278
|
-
if (!referenceDate) {
|
|
3279
|
-
referenceDate = dataContext.rootData.$now;
|
|
3280
|
-
}
|
|
3281
|
-
const baseDate = new Date(referenceDate);
|
|
3282
|
-
if (isNaN(baseDate.getTime())) {
|
|
3283
|
-
return false;
|
|
3284
|
-
}
|
|
3285
|
-
const offsetDate = new Date(baseDate.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
3286
|
-
return clause === "after" ? (0, import_date_fns.isAfter)(date, offsetDate) : (0, import_date_fns.isBefore)(date, offsetDate);
|
|
3287
|
-
}
|
|
3288
|
-
});
|
|
3289
|
-
ajv.addKeyword({
|
|
3290
|
-
keyword: "isLeafLevelLocation",
|
|
3291
|
-
type: "string",
|
|
3292
|
-
schemaType: "boolean",
|
|
3293
|
-
$data: true,
|
|
3294
|
-
errors: true,
|
|
3295
|
-
// @ts-ignore -- Force type. We will move this away from AJV next. Parsing the array will take seconds and is only called by core.
|
|
3296
|
-
validate(_schema, data, _2, dataContext) {
|
|
3297
|
-
const locationIdInput = data;
|
|
3298
|
-
const locations = dataContext?.rootData.$leafAdminStructureLocationIds ?? [];
|
|
3299
|
-
return locations.some((location) => location.id === locationIdInput);
|
|
3300
|
-
}
|
|
3301
|
-
});
|
|
3302
|
-
ajv.addKeyword({
|
|
3303
|
-
keyword: "customClientValidator",
|
|
3304
|
-
schemaType: "object",
|
|
3305
|
-
errors: true,
|
|
3306
|
-
// @ts-expect-error -- AJV's public types don't expose `rootData`. All
|
|
3307
|
-
// `validate()` callers build root data via `buildClientFunctionContext`,
|
|
3308
|
-
// so the cast holds.
|
|
3309
|
-
validate(schema, data, _2, dataContext) {
|
|
3310
|
-
return Boolean(
|
|
3311
|
-
runClientFunction(
|
|
3312
|
-
schema.code,
|
|
3313
|
-
data,
|
|
3314
|
-
dataContext?.rootData ?? buildClientFunctionContext({ form: {} })
|
|
3315
|
-
)
|
|
3316
|
-
);
|
|
3317
|
-
}
|
|
3318
|
-
});
|
|
3319
|
-
function isOnline() {
|
|
3320
|
-
if (typeof window !== "undefined" && typeof navigator !== "undefined") {
|
|
3321
|
-
return navigator.onLine;
|
|
3322
|
-
}
|
|
3323
|
-
return true;
|
|
3324
|
-
}
|
|
3419
|
+
// ../commons/src/events/state/index.ts
|
|
3420
|
+
var import_lodash3 = require("lodash");
|
|
3325
3421
|
|
|
3326
3422
|
// ../commons/src/utils.ts
|
|
3327
3423
|
var z32 = __toESM(require("zod/v4"));
|
|
3328
3424
|
var _ = __toESM(require("lodash"));
|
|
3425
|
+
function getOrThrow(x, message) {
|
|
3426
|
+
if (x === void 0 || x === null) {
|
|
3427
|
+
throw new Error(message);
|
|
3428
|
+
}
|
|
3429
|
+
return x;
|
|
3430
|
+
}
|
|
3431
|
+
function joinValues(values, separator = " ") {
|
|
3432
|
+
return values.filter((value) => !!value).join(separator).trim();
|
|
3433
|
+
}
|
|
3329
3434
|
var FullNameV1 = z32.array(
|
|
3330
3435
|
z32.object({
|
|
3331
3436
|
use: z32.string(),
|
|
@@ -3340,45 +3445,271 @@ function omitKeyDeep(obj, keyToRemove) {
|
|
|
3340
3445
|
if (obj === null || typeof obj !== "object") {
|
|
3341
3446
|
return obj;
|
|
3342
3447
|
}
|
|
3343
|
-
const newObj = {};
|
|
3344
|
-
for (const key of Object.keys(obj)) {
|
|
3345
|
-
if (key !== keyToRemove) {
|
|
3346
|
-
newObj[key] = omitKeyDeep(obj[key], keyToRemove);
|
|
3448
|
+
const newObj = {};
|
|
3449
|
+
for (const key of Object.keys(obj)) {
|
|
3450
|
+
if (key !== keyToRemove) {
|
|
3451
|
+
newObj[key] = omitKeyDeep(obj[key], keyToRemove);
|
|
3452
|
+
}
|
|
3453
|
+
}
|
|
3454
|
+
return newObj;
|
|
3455
|
+
}
|
|
3456
|
+
|
|
3457
|
+
// ../commons/src/events/state/utils.ts
|
|
3458
|
+
var import_lodash = require("lodash");
|
|
3459
|
+
function getActionRequests(actionType, actions) {
|
|
3460
|
+
const filtered = actions.filter((action) => action.type === actionType).reverse();
|
|
3461
|
+
const accept = filtered.find(
|
|
3462
|
+
(action) => action.status === ActionStatus.Accepted
|
|
3463
|
+
);
|
|
3464
|
+
const request = filtered.find(
|
|
3465
|
+
(action) => action.status === ActionStatus.Requested
|
|
3466
|
+
);
|
|
3467
|
+
const reject = filtered.find(
|
|
3468
|
+
(action) => action.status === ActionStatus.Rejected
|
|
3469
|
+
);
|
|
3470
|
+
return {
|
|
3471
|
+
reject,
|
|
3472
|
+
accept,
|
|
3473
|
+
request
|
|
3474
|
+
};
|
|
3475
|
+
}
|
|
3476
|
+
function getDeclarationActionCreationMetadata(actionType, actions) {
|
|
3477
|
+
const { accept: acceptAction, request: requestAction } = getActionRequests(
|
|
3478
|
+
actionType,
|
|
3479
|
+
actions
|
|
3480
|
+
);
|
|
3481
|
+
if (!acceptAction) {
|
|
3482
|
+
return null;
|
|
3483
|
+
}
|
|
3484
|
+
const registrationNumber = acceptAction.type === ActionType.REGISTER ? acceptAction.registrationNumber : null;
|
|
3485
|
+
return {
|
|
3486
|
+
// When 3rd party API returns 200 OK, we assume that the request was accepted, and persist single 'accepted' action.
|
|
3487
|
+
createdAt: requestAction?.createdAt ?? acceptAction.createdAt,
|
|
3488
|
+
createdBy: requestAction?.createdBy ?? acceptAction.createdBy,
|
|
3489
|
+
createdByUserType: requestAction?.createdByUserType ?? acceptAction.createdByUserType,
|
|
3490
|
+
createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
|
|
3491
|
+
acceptedAt: acceptAction.createdAt,
|
|
3492
|
+
createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
|
|
3493
|
+
registrationNumber
|
|
3494
|
+
};
|
|
3495
|
+
}
|
|
3496
|
+
var updateActions = ActionTypes.extract([
|
|
3497
|
+
ActionType.CREATE,
|
|
3498
|
+
ActionType.NOTIFY,
|
|
3499
|
+
ActionType.EDIT,
|
|
3500
|
+
ActionType.DECLARE,
|
|
3501
|
+
ActionType.REGISTER,
|
|
3502
|
+
ActionType.REJECT,
|
|
3503
|
+
ActionType.ARCHIVE,
|
|
3504
|
+
ActionType.UNARCHIVE,
|
|
3505
|
+
ActionType.PRINT_CERTIFICATE,
|
|
3506
|
+
ActionType.REQUEST_CORRECTION,
|
|
3507
|
+
ActionType.APPROVE_CORRECTION,
|
|
3508
|
+
ActionType.REJECT_CORRECTION,
|
|
3509
|
+
ActionType.CUSTOM
|
|
3510
|
+
]);
|
|
3511
|
+
function getActionUpdateMetadata(actions) {
|
|
3512
|
+
const createAction = getOrThrow(
|
|
3513
|
+
actions.find((action) => action.type === ActionType.CREATE),
|
|
3514
|
+
`Event has no ${ActionType.CREATE} action`
|
|
3515
|
+
);
|
|
3516
|
+
const metadataFields = [
|
|
3517
|
+
"createdAt",
|
|
3518
|
+
"createdBy",
|
|
3519
|
+
"createdByUserType",
|
|
3520
|
+
"createdAtLocation",
|
|
3521
|
+
"createdByRole"
|
|
3522
|
+
];
|
|
3523
|
+
return actions.filter(({ type }) => updateActions.safeParse(type).success).reduce(
|
|
3524
|
+
(_2, action) => {
|
|
3525
|
+
if (action.originalActionId) {
|
|
3526
|
+
const originalAction = actions.find(({ id }) => id === action.originalActionId) ?? action;
|
|
3527
|
+
return (0, import_lodash.pick)(originalAction, metadataFields);
|
|
3528
|
+
}
|
|
3529
|
+
return (0, import_lodash.pick)(action, metadataFields);
|
|
3530
|
+
},
|
|
3531
|
+
(0, import_lodash.pick)(createAction, metadataFields)
|
|
3532
|
+
);
|
|
3533
|
+
}
|
|
3534
|
+
function getLegalStatuses(actions) {
|
|
3535
|
+
return {
|
|
3536
|
+
[EventStatus.enum.NOTIFIED]: getDeclarationActionCreationMetadata(
|
|
3537
|
+
ActionType.NOTIFY,
|
|
3538
|
+
actions
|
|
3539
|
+
),
|
|
3540
|
+
[EventStatus.enum.DECLARED]: getDeclarationActionCreationMetadata(
|
|
3541
|
+
ActionType.DECLARE,
|
|
3542
|
+
actions
|
|
3543
|
+
),
|
|
3544
|
+
[EventStatus.enum.REGISTERED]: getDeclarationActionCreationMetadata(
|
|
3545
|
+
ActionType.REGISTER,
|
|
3546
|
+
actions
|
|
3547
|
+
)
|
|
3548
|
+
};
|
|
3549
|
+
}
|
|
3550
|
+
|
|
3551
|
+
// ../commons/src/events/state/flags.ts
|
|
3552
|
+
var import_lodash2 = require("lodash");
|
|
3553
|
+
var import_date_fns = require("date-fns");
|
|
3554
|
+
function isFlagConditionMet(conditional, form, action) {
|
|
3555
|
+
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" });
|
|
3556
|
+
return validate(conditional, {
|
|
3557
|
+
$form: form,
|
|
3558
|
+
$now: now2,
|
|
3559
|
+
$online: true,
|
|
3560
|
+
$user: {
|
|
3561
|
+
sub: "",
|
|
3562
|
+
exp: "",
|
|
3563
|
+
role: action.createdByRole,
|
|
3564
|
+
algorithm: "",
|
|
3565
|
+
scope: [],
|
|
3566
|
+
userType: action.createdByUserType
|
|
3567
|
+
}
|
|
3568
|
+
});
|
|
3569
|
+
}
|
|
3570
|
+
function actionConfigRemovesFlag(action, flagId, actionsUpToAndIncluding, event2, eventConfiguration) {
|
|
3571
|
+
if (!isActionConfigType(action.type)) {
|
|
3572
|
+
return false;
|
|
3573
|
+
}
|
|
3574
|
+
const actionConfig = getActionConfig({
|
|
3575
|
+
eventConfiguration,
|
|
3576
|
+
actionType: action.type,
|
|
3577
|
+
customActionType: "customActionType" in action ? action.customActionType : void 0
|
|
3578
|
+
});
|
|
3579
|
+
const removeOperations = (actionConfig?.flags ?? []).filter(
|
|
3580
|
+
({ id, operation }) => id === flagId && operation === "remove"
|
|
3581
|
+
);
|
|
3582
|
+
if (removeOperations.length === 0) {
|
|
3583
|
+
return false;
|
|
3584
|
+
}
|
|
3585
|
+
const eventUpToThisAction = { ...event2, actions: actionsUpToAndIncluding };
|
|
3586
|
+
const declaration = aggregateActionDeclarations(eventUpToThisAction);
|
|
3587
|
+
const annotation = aggregateActionAnnotations(eventUpToThisAction);
|
|
3588
|
+
const form = { ...declaration, ...annotation };
|
|
3589
|
+
return removeOperations.some(
|
|
3590
|
+
({ conditional }) => conditional ? isFlagConditionMet(conditional, form, action) : true
|
|
3591
|
+
);
|
|
3592
|
+
}
|
|
3593
|
+
var INHERENT_FLAG_RULES = [
|
|
3594
|
+
{
|
|
3595
|
+
flag: InherentFlags.CORRECTION_REQUESTED,
|
|
3596
|
+
setOn: [ActionType.REQUEST_CORRECTION],
|
|
3597
|
+
resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
|
|
3598
|
+
},
|
|
3599
|
+
{
|
|
3600
|
+
// INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
|
|
3601
|
+
// other status-changing action (see getStatusFromActions). ARCHIVE/UNARCHIVE
|
|
3602
|
+
// are deliberately excluded so the flag freezes across an archive/unarchive
|
|
3603
|
+
// round trip and comes back exactly as it was.
|
|
3604
|
+
flag: InherentFlags.INCOMPLETE,
|
|
3605
|
+
setOn: [ActionType.NOTIFY],
|
|
3606
|
+
resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
|
|
3607
|
+
},
|
|
3608
|
+
{
|
|
3609
|
+
flag: InherentFlags.REJECTED,
|
|
3610
|
+
setOn: [ActionType.REJECT],
|
|
3611
|
+
resetOn: [
|
|
3612
|
+
ActionType.NOTIFY,
|
|
3613
|
+
ActionType.DECLARE,
|
|
3614
|
+
ActionType.EDIT,
|
|
3615
|
+
ActionType.REGISTER
|
|
3616
|
+
]
|
|
3617
|
+
},
|
|
3618
|
+
{
|
|
3619
|
+
flag: InherentFlags.POTENTIAL_DUPLICATE,
|
|
3620
|
+
setOn: [ActionType.DUPLICATE_DETECTED],
|
|
3621
|
+
resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
|
|
3622
|
+
},
|
|
3623
|
+
{
|
|
3624
|
+
flag: InherentFlags.EDIT_IN_PROGRESS,
|
|
3625
|
+
setOn: [ActionType.EDIT],
|
|
3626
|
+
resetOnAnyOtherAction: true
|
|
3627
|
+
}
|
|
3628
|
+
];
|
|
3629
|
+
function resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration) {
|
|
3630
|
+
return acceptedActions.reduce((present, action, idx) => {
|
|
3631
|
+
if (rule.setOn.includes(action.type)) {
|
|
3632
|
+
return true;
|
|
3347
3633
|
}
|
|
3348
|
-
|
|
3349
|
-
|
|
3634
|
+
if (rule.resetOnAnyOtherAction || (rule.resetOn ?? []).includes(action.type)) {
|
|
3635
|
+
return false;
|
|
3636
|
+
}
|
|
3637
|
+
if (actionConfigRemovesFlag(
|
|
3638
|
+
action,
|
|
3639
|
+
rule.flag,
|
|
3640
|
+
acceptedActions.slice(0, idx + 1),
|
|
3641
|
+
event2,
|
|
3642
|
+
eventConfiguration
|
|
3643
|
+
)) {
|
|
3644
|
+
return false;
|
|
3645
|
+
}
|
|
3646
|
+
return present;
|
|
3647
|
+
}, false);
|
|
3350
3648
|
}
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3649
|
+
function resolveEventCustomFlags(event2, eventConfiguration) {
|
|
3650
|
+
const actions = getAcceptedActions(event2).filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
3651
|
+
return actions.reduce((acc, action, idx) => {
|
|
3652
|
+
let actionConfig;
|
|
3653
|
+
if (isActionConfigType(action.type)) {
|
|
3654
|
+
actionConfig = getActionConfig({
|
|
3655
|
+
eventConfiguration,
|
|
3656
|
+
actionType: action.type,
|
|
3657
|
+
customActionType: "customActionType" in action ? action.customActionType : void 0
|
|
3658
|
+
});
|
|
3659
|
+
}
|
|
3660
|
+
if (!actionConfig) {
|
|
3661
|
+
return acc;
|
|
3662
|
+
}
|
|
3663
|
+
const eventUpToThisAction = {
|
|
3664
|
+
...event2,
|
|
3665
|
+
actions: actions.slice(0, idx + 1)
|
|
3666
|
+
};
|
|
3667
|
+
const declaration = aggregateActionDeclarations(eventUpToThisAction);
|
|
3668
|
+
const annotation = aggregateActionAnnotations(eventUpToThisAction);
|
|
3669
|
+
const form = { ...declaration, ...annotation };
|
|
3670
|
+
const flagsWithMetConditions = (actionConfig.flags ?? []).filter(
|
|
3671
|
+
({ conditional }) => (
|
|
3672
|
+
// If conditional is not provided, the flag is resolved
|
|
3673
|
+
conditional ? isFlagConditionMet(conditional, form, action) : true
|
|
3674
|
+
)
|
|
3675
|
+
);
|
|
3676
|
+
const addedFlags = flagsWithMetConditions.filter(({ operation }) => operation === "add").map(({ id }) => id);
|
|
3677
|
+
const removedFlags = flagsWithMetConditions.filter(({ operation }) => operation === "remove").map(({ id }) => id);
|
|
3678
|
+
const flags = [...acc, ...addedFlags].filter(
|
|
3679
|
+
(flagId) => !removedFlags.includes(flagId)
|
|
3680
|
+
);
|
|
3681
|
+
return (0, import_lodash2.uniq)(flags);
|
|
3682
|
+
}, []);
|
|
3356
3683
|
}
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3684
|
+
function getActionStatusFlags(sortedActions) {
|
|
3685
|
+
const actionStatus = sortedActions.reduce(
|
|
3686
|
+
(actionStatuses, { type, status: status2 }) => ({
|
|
3687
|
+
...actionStatuses,
|
|
3688
|
+
[type]: status2
|
|
3689
|
+
}),
|
|
3690
|
+
{}
|
|
3691
|
+
);
|
|
3692
|
+
return Object.entries(actionStatus).filter(([, status2]) => status2 !== ActionStatus.Accepted).map(([type, status2]) => {
|
|
3693
|
+
const flag2 = joinValues([type, status2], ":").toLowerCase();
|
|
3694
|
+
return flag2;
|
|
3695
|
+
});
|
|
3696
|
+
}
|
|
3697
|
+
function getInherentFlags(sortedActions, event2, eventConfiguration) {
|
|
3698
|
+
const acceptedActions = sortedActions.filter(
|
|
3699
|
+
({ status: status2 }) => status2 === ActionStatus.Accepted
|
|
3700
|
+
);
|
|
3701
|
+
return INHERENT_FLAG_RULES.filter(
|
|
3702
|
+
(rule) => resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration)
|
|
3703
|
+
).map(({ flag: flag2 }) => flag2);
|
|
3704
|
+
}
|
|
3705
|
+
function getEventFlags(event2, config) {
|
|
3706
|
+
const sortedActions = event2.actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
3707
|
+
return [
|
|
3708
|
+
...getActionStatusFlags(sortedActions),
|
|
3709
|
+
...getInherentFlags(sortedActions, event2, config),
|
|
3710
|
+
...resolveEventCustomFlags(event2, config)
|
|
3711
|
+
];
|
|
3370
3712
|
}
|
|
3371
|
-
var findAllFields = (config) => {
|
|
3372
|
-
return (0, import_lodash.flattenDeep)([
|
|
3373
|
-
...getDeclarationFields(config),
|
|
3374
|
-
...getAllAnnotationFields(config)
|
|
3375
|
-
]);
|
|
3376
|
-
};
|
|
3377
|
-
var EXCLUDED_ACTIONS = [
|
|
3378
|
-
ActionType.REQUEST_CORRECTION,
|
|
3379
|
-
ActionType.PRINT_CERTIFICATE,
|
|
3380
|
-
ActionType.REJECT_CORRECTION
|
|
3381
|
-
];
|
|
3382
3713
|
|
|
3383
3714
|
// ../commons/src/conditionals/conditionals.ts
|
|
3384
3715
|
var objectHash = __toESM(require("object-hash"));
|
|
@@ -3586,6 +3917,33 @@ function defineComparison(field3, value, keyword) {
|
|
|
3586
3917
|
required: [field3.$$field]
|
|
3587
3918
|
});
|
|
3588
3919
|
}
|
|
3920
|
+
function flag(flagvalue) {
|
|
3921
|
+
return defineConditional({
|
|
3922
|
+
type: "object",
|
|
3923
|
+
properties: {
|
|
3924
|
+
$flags: {
|
|
3925
|
+
type: "array",
|
|
3926
|
+
contains: {
|
|
3927
|
+
type: "string",
|
|
3928
|
+
const: flagvalue
|
|
3929
|
+
}
|
|
3930
|
+
}
|
|
3931
|
+
},
|
|
3932
|
+
required: ["$flags"]
|
|
3933
|
+
});
|
|
3934
|
+
}
|
|
3935
|
+
function status(statusValue) {
|
|
3936
|
+
return defineConditional({
|
|
3937
|
+
type: "object",
|
|
3938
|
+
properties: {
|
|
3939
|
+
$status: {
|
|
3940
|
+
type: "string",
|
|
3941
|
+
const: statusValue
|
|
3942
|
+
}
|
|
3943
|
+
},
|
|
3944
|
+
required: ["$status"]
|
|
3945
|
+
});
|
|
3946
|
+
}
|
|
3589
3947
|
function createFieldConditionals(fieldId) {
|
|
3590
3948
|
const getDayRange = (field3, days, clause, referenceDate) => ({
|
|
3591
3949
|
type: "object",
|
|
@@ -3987,6 +4345,526 @@ function createFieldConditionals(fieldId) {
|
|
|
3987
4345
|
};
|
|
3988
4346
|
}
|
|
3989
4347
|
|
|
4348
|
+
// ../commons/src/events/state/index.ts
|
|
4349
|
+
function getStatusFromActions(actions) {
|
|
4350
|
+
const acceptedActions = actions.filter(
|
|
4351
|
+
({ status: status2 }) => status2 === ActionStatus.Accepted
|
|
4352
|
+
);
|
|
4353
|
+
const isCurrentlyArchived = acceptedActions.reduce(
|
|
4354
|
+
(archived, action) => {
|
|
4355
|
+
if (action.type === ActionType.ARCHIVE) {
|
|
4356
|
+
return true;
|
|
4357
|
+
}
|
|
4358
|
+
if (action.type === ActionType.UNARCHIVE) {
|
|
4359
|
+
return false;
|
|
4360
|
+
}
|
|
4361
|
+
return archived;
|
|
4362
|
+
},
|
|
4363
|
+
false
|
|
4364
|
+
);
|
|
4365
|
+
if (isCurrentlyArchived) {
|
|
4366
|
+
return EventStatus.enum.ARCHIVED;
|
|
4367
|
+
}
|
|
4368
|
+
return acceptedActions.filter(
|
|
4369
|
+
({ type }) => type !== ActionType.ARCHIVE && type !== ActionType.UNARCHIVE
|
|
4370
|
+
).reduce((status2, action) => {
|
|
4371
|
+
switch (action.type) {
|
|
4372
|
+
case ActionType.CREATE:
|
|
4373
|
+
return EventStatus.enum.CREATED;
|
|
4374
|
+
case ActionType.DECLARE:
|
|
4375
|
+
return EventStatus.enum.DECLARED;
|
|
4376
|
+
case ActionType.REGISTER:
|
|
4377
|
+
return EventStatus.enum.REGISTERED;
|
|
4378
|
+
case ActionType.NOTIFY:
|
|
4379
|
+
return EventStatus.enum.NOTIFIED;
|
|
4380
|
+
// Already filtered out above; listed here only to satisfy exhaustiveness.
|
|
4381
|
+
case ActionType.ARCHIVE:
|
|
4382
|
+
case ActionType.UNARCHIVE:
|
|
4383
|
+
case ActionType.CUSTOM:
|
|
4384
|
+
case ActionType.PRINT_CERTIFICATE:
|
|
4385
|
+
case ActionType.ASSIGN:
|
|
4386
|
+
case ActionType.UNASSIGN:
|
|
4387
|
+
case ActionType.REJECT:
|
|
4388
|
+
case ActionType.REQUEST_CORRECTION:
|
|
4389
|
+
case ActionType.APPROVE_CORRECTION:
|
|
4390
|
+
case ActionType.DUPLICATE_DETECTED:
|
|
4391
|
+
case ActionType.MARK_AS_NOT_DUPLICATE:
|
|
4392
|
+
case ActionType.MARK_AS_DUPLICATE:
|
|
4393
|
+
case ActionType.REJECT_CORRECTION:
|
|
4394
|
+
case ActionType.READ:
|
|
4395
|
+
case ActionType.EDIT:
|
|
4396
|
+
default:
|
|
4397
|
+
return status2;
|
|
4398
|
+
}
|
|
4399
|
+
}, EventStatus.enum.CREATED);
|
|
4400
|
+
}
|
|
4401
|
+
function getAssignedUserFromActions(actions) {
|
|
4402
|
+
return actions.reduce((user2, action) => {
|
|
4403
|
+
if (action.type === ActionType.ASSIGN) {
|
|
4404
|
+
return action.assignedTo;
|
|
4405
|
+
}
|
|
4406
|
+
if (action.type === ActionType.UNASSIGN) {
|
|
4407
|
+
return null;
|
|
4408
|
+
}
|
|
4409
|
+
return user2;
|
|
4410
|
+
}, null);
|
|
4411
|
+
}
|
|
4412
|
+
function deepDropNulls(obj) {
|
|
4413
|
+
if (Array.isArray(obj)) {
|
|
4414
|
+
return obj.map(deepDropNulls);
|
|
4415
|
+
}
|
|
4416
|
+
if (obj !== null && typeof obj === "object") {
|
|
4417
|
+
return Object.entries(obj).reduce((acc, [key, value]) => {
|
|
4418
|
+
const cleanedValue = deepDropNulls(value);
|
|
4419
|
+
if (cleanedValue !== null) {
|
|
4420
|
+
;
|
|
4421
|
+
acc[key] = cleanedValue;
|
|
4422
|
+
}
|
|
4423
|
+
return acc;
|
|
4424
|
+
}, {});
|
|
4425
|
+
}
|
|
4426
|
+
return obj;
|
|
4427
|
+
}
|
|
4428
|
+
var DEFAULT_DATE_OF_EVENT_PROPERTY = "createdAt";
|
|
4429
|
+
function extractDateString(dateTime) {
|
|
4430
|
+
return dateTime.split("T")[0];
|
|
4431
|
+
}
|
|
4432
|
+
function resolveDateOfEvent(eventIndex, declaration, config) {
|
|
4433
|
+
if (!config.dateOfEvent) {
|
|
4434
|
+
return extractDateString(eventIndex[DEFAULT_DATE_OF_EVENT_PROPERTY]);
|
|
4435
|
+
}
|
|
4436
|
+
const parsedDate = isFieldReference(config.dateOfEvent) ? ZodDate.safeParse(declaration[config.dateOfEvent.$$field]) : ZodDateTime.safeParse(
|
|
4437
|
+
getMixedPath(eventIndex, config.dateOfEvent.$$event)
|
|
4438
|
+
);
|
|
4439
|
+
return parsedDate.success ? extractDateString(parsedDate.data) : void 0;
|
|
4440
|
+
}
|
|
4441
|
+
var DEFAULT_PLACE_OF_EVENT_PROPERTY = "createdAtLocation";
|
|
4442
|
+
function getParsedUUID(value, oldValue) {
|
|
4443
|
+
const parsed = UUID.safeParse(value);
|
|
4444
|
+
return parsed.success ? parsed.data : oldValue;
|
|
4445
|
+
}
|
|
4446
|
+
function resolvePlaceOfEvent(eventMetadata, declaration, config) {
|
|
4447
|
+
let placeOfEvent = getParsedUUID(
|
|
4448
|
+
eventMetadata[DEFAULT_PLACE_OF_EVENT_PROPERTY]
|
|
4449
|
+
);
|
|
4450
|
+
if (config.placeOfEvent) {
|
|
4451
|
+
const addressFieldValue = AddressFieldValue.safeParse(
|
|
4452
|
+
declaration[config.placeOfEvent.$$field]
|
|
4453
|
+
);
|
|
4454
|
+
if (addressFieldValue.success && addressFieldValue.data.addressType === AddressType.DOMESTIC && addressFieldValue.data.administrativeArea) {
|
|
4455
|
+
placeOfEvent = getParsedUUID(
|
|
4456
|
+
addressFieldValue.data.administrativeArea,
|
|
4457
|
+
placeOfEvent
|
|
4458
|
+
);
|
|
4459
|
+
} else {
|
|
4460
|
+
placeOfEvent = getParsedUUID(
|
|
4461
|
+
declaration[config.placeOfEvent.$$field],
|
|
4462
|
+
placeOfEvent
|
|
4463
|
+
);
|
|
4464
|
+
}
|
|
4465
|
+
}
|
|
4466
|
+
return placeOfEvent;
|
|
4467
|
+
}
|
|
4468
|
+
function extractPotentialDuplicatesFromActions(actions) {
|
|
4469
|
+
return actions.reduce((duplicates, action) => {
|
|
4470
|
+
if (action.type === ActionType.DUPLICATE_DETECTED) {
|
|
4471
|
+
duplicates = action.content.duplicates;
|
|
4472
|
+
}
|
|
4473
|
+
if (action.type === ActionType.MARK_AS_NOT_DUPLICATE || action.type === ActionType.MARK_AS_DUPLICATE) {
|
|
4474
|
+
duplicates = [];
|
|
4475
|
+
}
|
|
4476
|
+
return duplicates;
|
|
4477
|
+
}, []);
|
|
4478
|
+
}
|
|
4479
|
+
function getCurrentEventState(event2, config) {
|
|
4480
|
+
const sortedActions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
4481
|
+
const creationAction = sortedActions.find(
|
|
4482
|
+
(action) => action.type === ActionType.CREATE
|
|
4483
|
+
);
|
|
4484
|
+
if (!creationAction) {
|
|
4485
|
+
throw new Error(`Event ${event2.id} has no creation action`);
|
|
4486
|
+
}
|
|
4487
|
+
const acceptedActions = getAcceptedActions(event2).sort(
|
|
4488
|
+
(a, b) => a.createdAt.localeCompare(b.createdAt)
|
|
4489
|
+
);
|
|
4490
|
+
const requestActionMetadata = getActionUpdateMetadata(sortedActions);
|
|
4491
|
+
const acceptedActionMetadata = getActionUpdateMetadata(acceptedActions);
|
|
4492
|
+
const declaration = aggregateActionDeclarations(event2);
|
|
4493
|
+
const status2 = getStatusFromActions(sortedActions);
|
|
4494
|
+
const legalStatuses = getLegalStatuses(sortedActions);
|
|
4495
|
+
const base = deepDropNulls({
|
|
4496
|
+
id: event2.id,
|
|
4497
|
+
type: event2.type,
|
|
4498
|
+
status: status2,
|
|
4499
|
+
legalStatuses,
|
|
4500
|
+
createdAt: creationAction.createdAt,
|
|
4501
|
+
createdBy: creationAction.createdBy,
|
|
4502
|
+
createdByUserType: creationAction.createdByUserType,
|
|
4503
|
+
createdAtLocation: creationAction.createdAtLocation,
|
|
4504
|
+
updatedAt: acceptedActionMetadata.createdAt,
|
|
4505
|
+
assignedTo: getAssignedUserFromActions(acceptedActions),
|
|
4506
|
+
updatedBy: requestActionMetadata.createdBy,
|
|
4507
|
+
updatedAtLocation: requestActionMetadata.createdAtLocation,
|
|
4508
|
+
declaration,
|
|
4509
|
+
trackingId: event2.trackingId,
|
|
4510
|
+
updatedByUserRole: requestActionMetadata.createdByRole,
|
|
4511
|
+
placeOfEvent: resolvePlaceOfEvent(
|
|
4512
|
+
{ createdAtLocation: creationAction.createdAtLocation },
|
|
4513
|
+
declaration,
|
|
4514
|
+
config
|
|
4515
|
+
),
|
|
4516
|
+
potentialDuplicates: extractPotentialDuplicatesFromActions(sortedActions),
|
|
4517
|
+
flags: getEventFlags(event2, config)
|
|
4518
|
+
});
|
|
4519
|
+
return deepDropNulls({
|
|
4520
|
+
...base,
|
|
4521
|
+
dateOfEvent: resolveDateOfEvent(base, declaration, config)
|
|
4522
|
+
});
|
|
4523
|
+
}
|
|
4524
|
+
|
|
4525
|
+
// ../commons/src/conditionals/validate.ts
|
|
4526
|
+
var ajv = new import__.default({
|
|
4527
|
+
$data: true,
|
|
4528
|
+
allowUnionTypes: true,
|
|
4529
|
+
strict: false
|
|
4530
|
+
// Allow minContains and other newer features
|
|
4531
|
+
});
|
|
4532
|
+
var DataContext = z33.object({
|
|
4533
|
+
rootData: z33.object({
|
|
4534
|
+
$leafAdminStructureLocationIds: z33.array(z33.object({ id: UUID }))
|
|
4535
|
+
})
|
|
4536
|
+
});
|
|
4537
|
+
function resolveDataPath(rootData, dataPath, instancePath) {
|
|
4538
|
+
const pathParts = dataPath.split("/");
|
|
4539
|
+
const levels = parseInt(pathParts[0], 10);
|
|
4540
|
+
const referencePath = pathParts.slice(1);
|
|
4541
|
+
const instanceParts = instancePath.split("/").filter(Boolean);
|
|
4542
|
+
const traversedParts = instanceParts.slice(0, -levels);
|
|
4543
|
+
let current = rootData;
|
|
4544
|
+
for (const part of traversedParts) {
|
|
4545
|
+
if (current === null || current === void 0) {
|
|
4546
|
+
return void 0;
|
|
4547
|
+
}
|
|
4548
|
+
current = current[part];
|
|
4549
|
+
}
|
|
4550
|
+
for (const part of referencePath) {
|
|
4551
|
+
if (current === null || current === void 0) {
|
|
4552
|
+
return void 0;
|
|
4553
|
+
}
|
|
4554
|
+
current = current[part];
|
|
4555
|
+
}
|
|
4556
|
+
return current;
|
|
4557
|
+
}
|
|
4558
|
+
function todayISO() {
|
|
4559
|
+
return (0, import_date_fns2.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
|
|
4560
|
+
}
|
|
4561
|
+
var compiledFunctionCache = /* @__PURE__ */ new Map();
|
|
4562
|
+
function compileClientFunction(code) {
|
|
4563
|
+
let fn = compiledFunctionCache.get(code);
|
|
4564
|
+
if (!fn) {
|
|
4565
|
+
fn = new Function(`return (${code})`)();
|
|
4566
|
+
compiledFunctionCache.set(code, fn);
|
|
4567
|
+
}
|
|
4568
|
+
return fn;
|
|
4569
|
+
}
|
|
4570
|
+
(0, import_ajv_formats.default)(ajv);
|
|
4571
|
+
var inMemoryEventStateCache = /* @__PURE__ */ new WeakMap();
|
|
4572
|
+
function getInMemoryEventState(event2, config) {
|
|
4573
|
+
let stateByConfig = inMemoryEventStateCache.get(event2);
|
|
4574
|
+
if (!stateByConfig) {
|
|
4575
|
+
stateByConfig = /* @__PURE__ */ new WeakMap();
|
|
4576
|
+
inMemoryEventStateCache.set(event2, stateByConfig);
|
|
4577
|
+
}
|
|
4578
|
+
let state = stateByConfig.get(config);
|
|
4579
|
+
if (!state) {
|
|
4580
|
+
state = getCurrentEventState(event2, config);
|
|
4581
|
+
stateByConfig.set(config, state);
|
|
4582
|
+
}
|
|
4583
|
+
return state;
|
|
4584
|
+
}
|
|
4585
|
+
function buildClientFunctionContext(input) {
|
|
4586
|
+
const flags = input.validatorContext?.event && input.validatorContext?.eventConfig ? getInMemoryEventState(
|
|
4587
|
+
input.validatorContext?.event,
|
|
4588
|
+
input.validatorContext?.eventConfig
|
|
4589
|
+
)?.flags : [];
|
|
4590
|
+
return {
|
|
4591
|
+
$form: input.form,
|
|
4592
|
+
$flags: flags,
|
|
4593
|
+
$now: todayISO(),
|
|
4594
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
4595
|
+
$online: isOnline(),
|
|
4596
|
+
$user: input.validatorContext?.user,
|
|
4597
|
+
$event: input.validatorContext?.event,
|
|
4598
|
+
$leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
|
|
4599
|
+
user: input.systemVariables?.user,
|
|
4600
|
+
$window: input.systemVariables?.$window,
|
|
4601
|
+
locations: input.locations,
|
|
4602
|
+
adminLevelIds: input.adminLevelIds
|
|
4603
|
+
};
|
|
4604
|
+
}
|
|
4605
|
+
function runClientFunction(code, data, context) {
|
|
4606
|
+
return compileClientFunction(code)(data, context);
|
|
4607
|
+
}
|
|
4608
|
+
ajv.addKeyword({
|
|
4609
|
+
keyword: "daysFromDate",
|
|
4610
|
+
type: "string",
|
|
4611
|
+
schemaType: "object",
|
|
4612
|
+
$data: true,
|
|
4613
|
+
errors: true,
|
|
4614
|
+
validate(schema, data, _2, dataContext) {
|
|
4615
|
+
if (!(dataContext && dataContext.rootData && typeof dataContext.rootData === "object" && "$now" in dataContext.rootData && typeof dataContext.rootData.$now === "string")) {
|
|
4616
|
+
throw new Error("Validation context must contain $now");
|
|
4617
|
+
}
|
|
4618
|
+
const { days, clause } = schema;
|
|
4619
|
+
if (typeof data !== "string") {
|
|
4620
|
+
return false;
|
|
4621
|
+
}
|
|
4622
|
+
const date = new Date(data);
|
|
4623
|
+
if (isNaN(date.getTime())) {
|
|
4624
|
+
return false;
|
|
4625
|
+
}
|
|
4626
|
+
let referenceDate = schema.referenceDate;
|
|
4627
|
+
if (referenceDate && typeof referenceDate === "object" && "$data" in referenceDate) {
|
|
4628
|
+
referenceDate = resolveDataPath(
|
|
4629
|
+
dataContext.rootData,
|
|
4630
|
+
referenceDate.$data,
|
|
4631
|
+
dataContext.instancePath
|
|
4632
|
+
);
|
|
4633
|
+
}
|
|
4634
|
+
if (!referenceDate) {
|
|
4635
|
+
referenceDate = dataContext.rootData.$now;
|
|
4636
|
+
}
|
|
4637
|
+
const baseDate = new Date(referenceDate);
|
|
4638
|
+
if (isNaN(baseDate.getTime())) {
|
|
4639
|
+
return false;
|
|
4640
|
+
}
|
|
4641
|
+
const offsetDate = new Date(baseDate.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
4642
|
+
return clause === "after" ? (0, import_date_fns2.isAfter)(date, offsetDate) : (0, import_date_fns2.isBefore)(date, offsetDate);
|
|
4643
|
+
}
|
|
4644
|
+
});
|
|
4645
|
+
ajv.addKeyword({
|
|
4646
|
+
keyword: "isLeafLevelLocation",
|
|
4647
|
+
type: "string",
|
|
4648
|
+
schemaType: "boolean",
|
|
4649
|
+
$data: true,
|
|
4650
|
+
errors: true,
|
|
4651
|
+
// @ts-ignore -- Force type. We will move this away from AJV next. Parsing the array will take seconds and is only called by core.
|
|
4652
|
+
validate(_schema, data, _2, dataContext) {
|
|
4653
|
+
const locationIdInput = data;
|
|
4654
|
+
const locations = dataContext?.rootData.$leafAdminStructureLocationIds ?? [];
|
|
4655
|
+
return locations.some((location) => location.id === locationIdInput);
|
|
4656
|
+
}
|
|
4657
|
+
});
|
|
4658
|
+
function isAgeValue(value) {
|
|
4659
|
+
return typeof value === "object" && value !== null && "age" in value && typeof value.age === "number";
|
|
4660
|
+
}
|
|
4661
|
+
ajv.addKeyword({
|
|
4662
|
+
keyword: "customClientValidator",
|
|
4663
|
+
schemaType: "object",
|
|
4664
|
+
errors: true,
|
|
4665
|
+
// @ts-expect-error -- AJV's public types don't expose `rootData`. All
|
|
4666
|
+
// `validate()` callers build root data via `buildClientFunctionContext`,
|
|
4667
|
+
// so the cast holds.
|
|
4668
|
+
validate(schema, data, _2, dataContext) {
|
|
4669
|
+
return Boolean(
|
|
4670
|
+
runClientFunction(
|
|
4671
|
+
schema.code,
|
|
4672
|
+
data,
|
|
4673
|
+
dataContext?.rootData ?? buildClientFunctionContext({ form: {} })
|
|
4674
|
+
)
|
|
4675
|
+
);
|
|
4676
|
+
}
|
|
4677
|
+
});
|
|
4678
|
+
function validate(schema, data) {
|
|
4679
|
+
const validator = ajv.getSchema(schema.$id) || ajv.compile(schema);
|
|
4680
|
+
if ("$form" in data) {
|
|
4681
|
+
const entries = Object.entries(data.$form).map(([key, value]) => {
|
|
4682
|
+
if (!isAgeValue(value)) {
|
|
4683
|
+
return [key, value];
|
|
4684
|
+
}
|
|
4685
|
+
const age = value.age;
|
|
4686
|
+
const maybeAsOfDate = PlainDate.safeParse(data.$form[value.asOfDateRef]);
|
|
4687
|
+
return [
|
|
4688
|
+
key,
|
|
4689
|
+
{
|
|
4690
|
+
age,
|
|
4691
|
+
dob: ageToDate(
|
|
4692
|
+
age,
|
|
4693
|
+
maybeAsOfDate.success ? maybeAsOfDate.data : PlainDate.parse(data.$now)
|
|
4694
|
+
)
|
|
4695
|
+
}
|
|
4696
|
+
];
|
|
4697
|
+
});
|
|
4698
|
+
data.$form = Object.fromEntries(entries);
|
|
4699
|
+
}
|
|
4700
|
+
const result = validator(data);
|
|
4701
|
+
return result;
|
|
4702
|
+
}
|
|
4703
|
+
function isOnline() {
|
|
4704
|
+
if (typeof window !== "undefined" && typeof navigator !== "undefined") {
|
|
4705
|
+
return navigator.onLine;
|
|
4706
|
+
}
|
|
4707
|
+
return true;
|
|
4708
|
+
}
|
|
4709
|
+
|
|
4710
|
+
// ../commons/src/events/utils.ts
|
|
4711
|
+
var import_date_fns3 = require("date-fns");
|
|
4712
|
+
function ageToDate(age, asOfDate) {
|
|
4713
|
+
const date = plainDateToLocalDate(asOfDate);
|
|
4714
|
+
return PlainDate.parse((0, import_date_fns3.format)((0, import_date_fns3.subYears)(date, age), "yyyy-MM-dd"));
|
|
4715
|
+
}
|
|
4716
|
+
function getDeclarationFields(configuration) {
|
|
4717
|
+
return configuration.declaration.pages.flatMap(({ fields }) => fields);
|
|
4718
|
+
}
|
|
4719
|
+
function isActionConfigType(type) {
|
|
4720
|
+
return actionConfigTypes.has(type);
|
|
4721
|
+
}
|
|
4722
|
+
function getActionConfig({
|
|
4723
|
+
eventConfiguration,
|
|
4724
|
+
actionType,
|
|
4725
|
+
customActionType
|
|
4726
|
+
}) {
|
|
4727
|
+
if (actionType === ActionType.NOTIFY) {
|
|
4728
|
+
return eventConfiguration.actions.find((a) => a.type === ActionType.NOTIFY) ?? eventConfiguration.actions.find((a) => a.type === ActionType.DECLARE);
|
|
4729
|
+
}
|
|
4730
|
+
return eventConfiguration.actions.find((a) => {
|
|
4731
|
+
if (a.type === ActionType.CUSTOM && customActionType) {
|
|
4732
|
+
return a.customActionType === customActionType;
|
|
4733
|
+
}
|
|
4734
|
+
return a.type === actionType;
|
|
4735
|
+
});
|
|
4736
|
+
}
|
|
4737
|
+
var getActionAnnotationFields = (actionConfig) => {
|
|
4738
|
+
if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
|
|
4739
|
+
return actionConfig.correctionForm.pages.flatMap(({ fields }) => fields);
|
|
4740
|
+
}
|
|
4741
|
+
if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
|
|
4742
|
+
return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
|
|
4743
|
+
}
|
|
4744
|
+
const reviewFields = "review" in actionConfig && actionConfig.review != null ? actionConfig.review.fields : [];
|
|
4745
|
+
const formFields = "form" in actionConfig && actionConfig.form != null ? actionConfig.form : [];
|
|
4746
|
+
return [...reviewFields, ...formFields];
|
|
4747
|
+
};
|
|
4748
|
+
function getAllAnnotationFields(config) {
|
|
4749
|
+
return (0, import_lodash4.flattenDeep)(config.actions.map(getActionAnnotationFields));
|
|
4750
|
+
}
|
|
4751
|
+
function deepMerge(currentDocument, actionDocument) {
|
|
4752
|
+
const currentDocumentClone = (0, import_lodash4.cloneDeep)(currentDocument);
|
|
4753
|
+
return (0, import_lodash4.mergeWith)(
|
|
4754
|
+
(0, import_lodash4.cloneDeep)(currentDocumentClone),
|
|
4755
|
+
actionDocument,
|
|
4756
|
+
(previousValue, incomingValue) => {
|
|
4757
|
+
if (incomingValue === void 0) {
|
|
4758
|
+
return previousValue;
|
|
4759
|
+
}
|
|
4760
|
+
if ((0, import_lodash4.isArray)(incomingValue)) {
|
|
4761
|
+
return incomingValue;
|
|
4762
|
+
}
|
|
4763
|
+
if ((0, import_lodash4.isObject)(previousValue) && (0, import_lodash4.isObject)(incomingValue)) {
|
|
4764
|
+
return void 0;
|
|
4765
|
+
}
|
|
4766
|
+
return incomingValue;
|
|
4767
|
+
}
|
|
4768
|
+
);
|
|
4769
|
+
}
|
|
4770
|
+
var findAllFields = (config) => {
|
|
4771
|
+
return (0, import_lodash4.flattenDeep)([
|
|
4772
|
+
...getDeclarationFields(config),
|
|
4773
|
+
...getAllAnnotationFields(config)
|
|
4774
|
+
]);
|
|
4775
|
+
};
|
|
4776
|
+
function getMixedPath(obj, path, defaultValue) {
|
|
4777
|
+
const parts = path.split(".");
|
|
4778
|
+
const resolve = (current, segments) => {
|
|
4779
|
+
if (current == null || segments.length === 0) {
|
|
4780
|
+
return current;
|
|
4781
|
+
}
|
|
4782
|
+
for (let i = segments.length; i > 0; i--) {
|
|
4783
|
+
const compoundKey = segments.slice(0, i).join(".");
|
|
4784
|
+
if ((0, import_lodash4.has)(current, compoundKey)) {
|
|
4785
|
+
const next = (0, import_lodash4.get)(current, compoundKey);
|
|
4786
|
+
return resolve(next, segments.slice(i));
|
|
4787
|
+
}
|
|
4788
|
+
}
|
|
4789
|
+
return void 0;
|
|
4790
|
+
};
|
|
4791
|
+
const result = resolve(obj, parts);
|
|
4792
|
+
return (0, import_lodash4.isNil)(result) ? defaultValue : result;
|
|
4793
|
+
}
|
|
4794
|
+
function isAcceptedAction(a) {
|
|
4795
|
+
return a.status === ActionStatus.Accepted;
|
|
4796
|
+
}
|
|
4797
|
+
function getCompleteActionAnnotation(event2, action) {
|
|
4798
|
+
if (action.originalActionId) {
|
|
4799
|
+
const originalAction = event2.actions.find(
|
|
4800
|
+
({ id }) => id === action.originalActionId
|
|
4801
|
+
);
|
|
4802
|
+
if (originalAction?.status === ActionStatus.Requested) {
|
|
4803
|
+
return deepMerge(originalAction.annotation ?? {}, action.annotation ?? {});
|
|
4804
|
+
}
|
|
4805
|
+
}
|
|
4806
|
+
return action.annotation ?? {};
|
|
4807
|
+
}
|
|
4808
|
+
function getCompleteActionDeclaration(declaration, event2, action) {
|
|
4809
|
+
if (action.originalActionId) {
|
|
4810
|
+
const originalAction = event2.actions.find(
|
|
4811
|
+
({ id }) => id === action.originalActionId
|
|
4812
|
+
);
|
|
4813
|
+
if (originalAction?.status === ActionStatus.Requested) {
|
|
4814
|
+
return deepMerge(
|
|
4815
|
+
deepMerge(declaration, originalAction.declaration),
|
|
4816
|
+
action.declaration
|
|
4817
|
+
);
|
|
4818
|
+
}
|
|
4819
|
+
}
|
|
4820
|
+
return deepMerge(declaration, action.declaration);
|
|
4821
|
+
}
|
|
4822
|
+
function getAcceptedActions(event2) {
|
|
4823
|
+
return event2.actions.filter(isAcceptedAction).map((action) => ({
|
|
4824
|
+
...action,
|
|
4825
|
+
declaration: getCompleteActionDeclaration({}, event2, action),
|
|
4826
|
+
annotation: getCompleteActionAnnotation(event2, action)
|
|
4827
|
+
}));
|
|
4828
|
+
}
|
|
4829
|
+
var EXCLUDED_ACTIONS = [
|
|
4830
|
+
ActionType.REQUEST_CORRECTION,
|
|
4831
|
+
ActionType.PRINT_CERTIFICATE,
|
|
4832
|
+
ActionType.REJECT_CORRECTION
|
|
4833
|
+
];
|
|
4834
|
+
function aggregateActionDeclarations(event2) {
|
|
4835
|
+
const allAcceptedActions = getAcceptedActions(event2);
|
|
4836
|
+
const aggregatedActions = allAcceptedActions.filter((a) => !EXCLUDED_ACTIONS.some((type) => type === a.type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
4837
|
+
return aggregatedActions.reduce((declaration, action) => {
|
|
4838
|
+
if (action.type === ActionType.APPROVE_CORRECTION) {
|
|
4839
|
+
const requestAction = allAcceptedActions.find(
|
|
4840
|
+
({ id }) => id === action.requestId
|
|
4841
|
+
);
|
|
4842
|
+
if (!requestAction) {
|
|
4843
|
+
return declaration;
|
|
4844
|
+
}
|
|
4845
|
+
const declarationWithApprovedCorrection = getCompleteActionDeclaration(
|
|
4846
|
+
declaration,
|
|
4847
|
+
event2,
|
|
4848
|
+
requestAction
|
|
4849
|
+
);
|
|
4850
|
+
return getCompleteActionDeclaration(
|
|
4851
|
+
declarationWithApprovedCorrection,
|
|
4852
|
+
event2,
|
|
4853
|
+
action
|
|
4854
|
+
);
|
|
4855
|
+
}
|
|
4856
|
+
return getCompleteActionDeclaration(declaration, event2, action);
|
|
4857
|
+
}, {});
|
|
4858
|
+
}
|
|
4859
|
+
function aggregateActionAnnotations(event2) {
|
|
4860
|
+
return event2.actions.reduce((ann, sortedAction) => {
|
|
4861
|
+
if (!("annotation" in sortedAction) || !sortedAction.annotation) {
|
|
4862
|
+
return ann;
|
|
4863
|
+
}
|
|
4864
|
+
return deepMerge(ann, sortedAction.annotation);
|
|
4865
|
+
}, {});
|
|
4866
|
+
}
|
|
4867
|
+
|
|
3990
4868
|
// ../commons/src/events/eventConfigValidation.ts
|
|
3991
4869
|
function validateAdvancedSearchConfig(event2, ctx) {
|
|
3992
4870
|
const allFields = findAllFields(event2);
|
|
@@ -4069,9 +4947,9 @@ function validatePlaceOfEvent(event2, ctx) {
|
|
|
4069
4947
|
}
|
|
4070
4948
|
function validateActionFlags(event2, ctx) {
|
|
4071
4949
|
const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
|
|
4072
|
-
const configuredFlagIds = event2.flags.map((
|
|
4950
|
+
const configuredFlagIds = event2.flags.map((flag2) => flag2.id);
|
|
4073
4951
|
const actionFlagIds = event2.actions.flatMap(
|
|
4074
|
-
(action) => (action.flags ?? []).map((
|
|
4952
|
+
(action) => (action.flags ?? []).map((flag2) => flag2.id)
|
|
4075
4953
|
);
|
|
4076
4954
|
for (const actionFlagId of actionFlagIds) {
|
|
4077
4955
|
const isConfigured = configuredFlagIds.includes(actionFlagId);
|
|
@@ -4107,11 +4985,11 @@ function validateActionOrder(event2, ctx) {
|
|
|
4107
4985
|
}
|
|
4108
4986
|
|
|
4109
4987
|
// ../commons/src/events/EventConfig.ts
|
|
4110
|
-
var EventFieldReference =
|
|
4988
|
+
var EventFieldReference = z34.object({ $$event: EventMetadataDateFieldIdInput }).describe(
|
|
4111
4989
|
"Reference to a field defined in the event metadata, using the field id."
|
|
4112
4990
|
);
|
|
4113
|
-
var _EventConfigBase =
|
|
4114
|
-
id:
|
|
4991
|
+
var _EventConfigBase = z34.object({
|
|
4992
|
+
id: z34.string().describe(
|
|
4115
4993
|
'Machine-readable identifier of the event (e.g. "birth", "death").'
|
|
4116
4994
|
),
|
|
4117
4995
|
dateOfEvent: FieldReference.or(EventFieldReference).optional().describe(
|
|
@@ -4130,23 +5008,26 @@ var _EventConfigBase = z33.object({
|
|
|
4130
5008
|
"Summary information displayed in the event overview."
|
|
4131
5009
|
),
|
|
4132
5010
|
label: TranslationConfig.describe("Human-readable label for the event type."),
|
|
4133
|
-
actions:
|
|
5011
|
+
actions: z34.array(ActionConfig).describe(
|
|
4134
5012
|
"Configuration of core and custom actions associated with the event."
|
|
4135
5013
|
),
|
|
4136
|
-
actionOrder:
|
|
5014
|
+
actionOrder: z34.array(z34.string()).optional().describe(
|
|
4137
5015
|
"Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
|
|
4138
5016
|
),
|
|
4139
5017
|
declaration: DeclarationFormConfig.describe(
|
|
4140
5018
|
"Configuration of the form used to gather event data."
|
|
4141
5019
|
),
|
|
4142
|
-
advancedSearch:
|
|
5020
|
+
advancedSearch: z34.array(AdvancedSearchConfig).optional().default([]).describe(
|
|
4143
5021
|
"Configuration of fields available in the advanced search feature."
|
|
4144
5022
|
),
|
|
4145
|
-
flags:
|
|
5023
|
+
flags: z34.array(FlagConfig).optional().default([]).describe(
|
|
4146
5024
|
"Configuration of custom flags associated with the actions of this event type."
|
|
4147
5025
|
),
|
|
4148
|
-
analytics:
|
|
5026
|
+
analytics: z34.boolean().optional().default(true).describe(
|
|
4149
5027
|
"Indicates whether the records of this event type are included in analytics"
|
|
5028
|
+
),
|
|
5029
|
+
icon: z34.partialRecord(AvailableIcons, Conditional).optional().describe(
|
|
5030
|
+
'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.'
|
|
4150
5031
|
)
|
|
4151
5032
|
});
|
|
4152
5033
|
var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
|
|
@@ -4363,21 +5244,31 @@ var event = Object.assign(eventFn, {
|
|
|
4363
5244
|
return {
|
|
4364
5245
|
$event: field3
|
|
4365
5246
|
};
|
|
4366
|
-
}
|
|
5247
|
+
},
|
|
5248
|
+
/**
|
|
5249
|
+
* Checks if the event currently has the given status.
|
|
5250
|
+
* @param eventStatus - The status to check for.
|
|
5251
|
+
*/
|
|
5252
|
+
hasStatus: (eventStatus) => status(eventStatus),
|
|
5253
|
+
/**
|
|
5254
|
+
* Checks if the event currently carries the given flag.
|
|
5255
|
+
* @param flagValue - The flag to check for.
|
|
5256
|
+
*/
|
|
5257
|
+
hasFlag: (flagValue) => flag(flagValue)
|
|
4367
5258
|
});
|
|
4368
5259
|
|
|
4369
5260
|
// ../commons/src/events/WorkqueueColumnConfig.ts
|
|
4370
|
-
var
|
|
5261
|
+
var z35 = __toESM(require("zod/v4"));
|
|
4371
5262
|
var WorkqueueColumnKeysArray = [
|
|
4372
5263
|
...EventMetadataKeysArray,
|
|
4373
5264
|
"title",
|
|
4374
5265
|
"outbox"
|
|
4375
5266
|
];
|
|
4376
|
-
var WorkqueueColumnKeys =
|
|
4377
|
-
var WorkqueueColumnValue =
|
|
5267
|
+
var WorkqueueColumnKeys = z35.enum(WorkqueueColumnKeysArray);
|
|
5268
|
+
var WorkqueueColumnValue = z35.object({
|
|
4378
5269
|
$event: WorkqueueColumnKeys
|
|
4379
5270
|
});
|
|
4380
|
-
var WorkqueueColumn =
|
|
5271
|
+
var WorkqueueColumn = z35.object({
|
|
4381
5272
|
label: TranslationConfig,
|
|
4382
5273
|
value: WorkqueueColumnValue
|
|
4383
5274
|
}).meta({
|
|
@@ -4391,164 +5282,56 @@ function defineWorkqueuesColumns(workqueueColumns) {
|
|
|
4391
5282
|
}
|
|
4392
5283
|
|
|
4393
5284
|
// ../commons/src/events/CountryConfigQueryInput.ts
|
|
4394
|
-
var
|
|
4395
|
-
var SerializableExact =
|
|
4396
|
-
type:
|
|
4397
|
-
term:
|
|
4398
|
-
});
|
|
4399
|
-
var SerializableWithin =
|
|
4400
|
-
type:
|
|
4401
|
-
location:
|
|
4402
|
-
});
|
|
4403
|
-
var SerializedQueryExpression =
|
|
4404
|
-
eventType:
|
|
4405
|
-
status:
|
|
4406
|
-
createdAt:
|
|
4407
|
-
updatedAt:
|
|
4408
|
-
"legalStatuses.DECLARED.createdAtLocation":
|
|
4409
|
-
"legalStatuses.DECLARED.createdByRole":
|
|
4410
|
-
"legalStatuses.REGISTERED.createdAt":
|
|
4411
|
-
"legalStatuses.REGISTERED.createdAtLocation":
|
|
4412
|
-
"legalStatuses.REGISTERED.createdByRole":
|
|
4413
|
-
"legalStatuses.REGISTERED.registrationNumber":
|
|
4414
|
-
createdAtLocation:
|
|
4415
|
-
|
|
5285
|
+
var z36 = __toESM(require("zod/v4"));
|
|
5286
|
+
var SerializableExact = z36.object({
|
|
5287
|
+
type: z36.literal("exact"),
|
|
5288
|
+
term: z36.union([z36.string(), SerializedUserField])
|
|
5289
|
+
});
|
|
5290
|
+
var SerializableWithin = z36.object({
|
|
5291
|
+
type: z36.literal("within"),
|
|
5292
|
+
location: z36.union([z36.string(), SerializedUserField])
|
|
5293
|
+
});
|
|
5294
|
+
var SerializedQueryExpression = z36.object({
|
|
5295
|
+
eventType: z36.string(),
|
|
5296
|
+
status: z36.optional(z36.union([AnyOfStatus, ExactStatus])),
|
|
5297
|
+
createdAt: z36.optional(DateCondition),
|
|
5298
|
+
updatedAt: z36.optional(DateCondition),
|
|
5299
|
+
"legalStatuses.DECLARED.createdAtLocation": z36.optional(SerializableWithin),
|
|
5300
|
+
"legalStatuses.DECLARED.createdByRole": z36.optional(AnyOf),
|
|
5301
|
+
"legalStatuses.REGISTERED.createdAt": z36.optional(DateCondition),
|
|
5302
|
+
"legalStatuses.REGISTERED.createdAtLocation": z36.optional(SerializableWithin),
|
|
5303
|
+
"legalStatuses.REGISTERED.createdByRole": z36.optional(AnyOf),
|
|
5304
|
+
"legalStatuses.REGISTERED.registrationNumber": z36.optional(Exact),
|
|
5305
|
+
createdAtLocation: z36.optional(
|
|
5306
|
+
z36.union([SerializableWithin, SerializableExact])
|
|
4416
5307
|
),
|
|
4417
|
-
updatedAtLocation:
|
|
4418
|
-
|
|
5308
|
+
updatedAtLocation: z36.optional(
|
|
5309
|
+
z36.union([SerializableWithin, SerializableExact])
|
|
4419
5310
|
),
|
|
4420
|
-
updatedByUserRole:
|
|
4421
|
-
assignedTo:
|
|
4422
|
-
createdBy:
|
|
5311
|
+
updatedByUserRole: z36.optional(SerializableExact),
|
|
5312
|
+
assignedTo: z36.optional(SerializableExact),
|
|
5313
|
+
createdBy: z36.optional(SerializableExact),
|
|
4423
5314
|
createdByUserType: ExactUserType,
|
|
4424
|
-
updatedBy:
|
|
4425
|
-
trackingId:
|
|
4426
|
-
flags:
|
|
5315
|
+
updatedBy: z36.optional(SerializableExact),
|
|
5316
|
+
trackingId: z36.optional(Exact),
|
|
5317
|
+
flags: z36.optional(ContainsFlags),
|
|
4427
5318
|
data: QueryInput
|
|
4428
5319
|
}).partial();
|
|
4429
|
-
var Or2 =
|
|
4430
|
-
type:
|
|
4431
|
-
clauses:
|
|
5320
|
+
var Or2 = z36.object({
|
|
5321
|
+
type: z36.literal("or"),
|
|
5322
|
+
clauses: z36.array(SerializedQueryExpression)
|
|
4432
5323
|
});
|
|
4433
|
-
var And2 =
|
|
4434
|
-
type:
|
|
4435
|
-
clauses:
|
|
5324
|
+
var And2 = z36.object({
|
|
5325
|
+
type: z36.literal("and"),
|
|
5326
|
+
clauses: z36.array(SerializedQueryExpression)
|
|
4436
5327
|
});
|
|
4437
|
-
var CountryConfigQueryType =
|
|
4438
|
-
var CountryConfigQueryInputType =
|
|
5328
|
+
var CountryConfigQueryType = z36.discriminatedUnion("type", [And2, Or2]);
|
|
5329
|
+
var CountryConfigQueryInputType = z36.union([
|
|
4439
5330
|
SerializedQueryExpression,
|
|
4440
5331
|
And2,
|
|
4441
5332
|
Or2
|
|
4442
5333
|
]);
|
|
4443
5334
|
|
|
4444
|
-
// ../commons/src/icons.ts
|
|
4445
|
-
var z36 = __toESM(require("zod/v4"));
|
|
4446
|
-
var AvailableIcons = z36.enum([
|
|
4447
|
-
"Archived",
|
|
4448
|
-
"Assigned",
|
|
4449
|
-
"Briefcase",
|
|
4450
|
-
"Certified",
|
|
4451
|
-
"Close",
|
|
4452
|
-
"Collapse",
|
|
4453
|
-
"Draft",
|
|
4454
|
-
"DuplicateYellow",
|
|
4455
|
-
"Expand",
|
|
4456
|
-
"ExternalValidate",
|
|
4457
|
-
"FilledCheck",
|
|
4458
|
-
"InReview",
|
|
4459
|
-
"Offline",
|
|
4460
|
-
"Registered",
|
|
4461
|
-
"RequiresUpdates",
|
|
4462
|
-
"Sent",
|
|
4463
|
-
"Validated",
|
|
4464
|
-
"WaitingApproval",
|
|
4465
|
-
"ChartActivity",
|
|
4466
|
-
"Activity",
|
|
4467
|
-
"Archive",
|
|
4468
|
-
"ArchiveTray",
|
|
4469
|
-
"ArrowLeft",
|
|
4470
|
-
"ArrowRight",
|
|
4471
|
-
"Buildings",
|
|
4472
|
-
"Circle",
|
|
4473
|
-
"CaretDown",
|
|
4474
|
-
"CaretLeft",
|
|
4475
|
-
"CaretRight",
|
|
4476
|
-
"ChartBar",
|
|
4477
|
-
"ChartLine",
|
|
4478
|
-
"ChatCircle",
|
|
4479
|
-
"CheckSquare",
|
|
4480
|
-
"Compass",
|
|
4481
|
-
"Check",
|
|
4482
|
-
"Copy",
|
|
4483
|
-
"Database",
|
|
4484
|
-
"DotsThreeVertical",
|
|
4485
|
-
"ArrowCounterClockwise",
|
|
4486
|
-
"MagnifyingGlassMinus",
|
|
4487
|
-
"MagnifyingGlassPlus",
|
|
4488
|
-
"Export",
|
|
4489
|
-
"Eye",
|
|
4490
|
-
"EyeSlash",
|
|
4491
|
-
"Envelope",
|
|
4492
|
-
"File",
|
|
4493
|
-
"FileSearch",
|
|
4494
|
-
"FileMinus",
|
|
4495
|
-
"FilePlus",
|
|
4496
|
-
"FileText",
|
|
4497
|
-
"FileX",
|
|
4498
|
-
"Handshake",
|
|
4499
|
-
"Gear",
|
|
4500
|
-
"GitBranch",
|
|
4501
|
-
"IdentificationCard",
|
|
4502
|
-
"List",
|
|
4503
|
-
"ListBullets",
|
|
4504
|
-
"Lock",
|
|
4505
|
-
"MagnifyingGlass",
|
|
4506
|
-
"MapPin",
|
|
4507
|
-
"Medal",
|
|
4508
|
-
"NotePencil",
|
|
4509
|
-
"Paperclip",
|
|
4510
|
-
"PaperPlaneTilt",
|
|
4511
|
-
"Pen",
|
|
4512
|
-
"PenNib",
|
|
4513
|
-
"Pencil",
|
|
4514
|
-
"PencilSimpleLine",
|
|
4515
|
-
"Phone",
|
|
4516
|
-
"Plus",
|
|
4517
|
-
"Printer",
|
|
4518
|
-
"SignOut",
|
|
4519
|
-
"Stamp",
|
|
4520
|
-
"Star",
|
|
4521
|
-
"Target",
|
|
4522
|
-
"TextT",
|
|
4523
|
-
"Trash",
|
|
4524
|
-
"UploadSimple",
|
|
4525
|
-
"User",
|
|
4526
|
-
"UserPlus",
|
|
4527
|
-
"Users",
|
|
4528
|
-
"WarningCircle",
|
|
4529
|
-
"X",
|
|
4530
|
-
"ChatText",
|
|
4531
|
-
"CircleWavyCheck",
|
|
4532
|
-
"CircleWavyQuestion",
|
|
4533
|
-
"ArchiveBox",
|
|
4534
|
-
"ArrowCircleDown",
|
|
4535
|
-
"FileArrowUp",
|
|
4536
|
-
"FileDotted",
|
|
4537
|
-
"Files",
|
|
4538
|
-
"PencilLine",
|
|
4539
|
-
"PencilCircle",
|
|
4540
|
-
"UserCircle",
|
|
4541
|
-
"Clock",
|
|
4542
|
-
"QrCode",
|
|
4543
|
-
"Webcam",
|
|
4544
|
-
"Sun",
|
|
4545
|
-
"DeviceTabletCamera",
|
|
4546
|
-
"Globe",
|
|
4547
|
-
"Fingerprint",
|
|
4548
|
-
"PushPin",
|
|
4549
|
-
"Timer"
|
|
4550
|
-
]);
|
|
4551
|
-
|
|
4552
5335
|
// ../commons/src/events/WorkqueueConfig.ts
|
|
4553
5336
|
var mandatoryColumns = defineWorkqueuesColumns([
|
|
4554
5337
|
{
|
|
@@ -4828,14 +5611,14 @@ var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
|
|
|
4828
5611
|
|
|
4829
5612
|
// ../commons/src/events/EventInput.ts
|
|
4830
5613
|
var z40 = __toESM(require("zod/v4"));
|
|
4831
|
-
var
|
|
5614
|
+
var import_uuid11 = require("uuid");
|
|
4832
5615
|
var EventInput = z40.object({
|
|
4833
5616
|
transactionId: z40.string(),
|
|
4834
5617
|
type: z40.string(),
|
|
4835
5618
|
createdAtLocation: UUID.nullish().describe(
|
|
4836
5619
|
"Location where the event occurred. Required for system users."
|
|
4837
5620
|
)
|
|
4838
|
-
}).meta({ default: { transactionId: (0,
|
|
5621
|
+
}).meta({ default: { transactionId: (0, import_uuid11.v4)(), type: "birth" } });
|
|
4839
5622
|
|
|
4840
5623
|
// ../commons/src/events/EventDocument.ts
|
|
4841
5624
|
var z41 = __toESM(require("zod/v4"));
|
|
@@ -4852,67 +5635,6 @@ var EventDocument = z41.object({
|
|
|
4852
5635
|
)
|
|
4853
5636
|
}).meta({ id: "EventDocument" });
|
|
4854
5637
|
|
|
4855
|
-
// ../commons/src/events/state/index.ts
|
|
4856
|
-
var import_lodash4 = require("lodash");
|
|
4857
|
-
|
|
4858
|
-
// ../commons/src/events/state/utils.ts
|
|
4859
|
-
var import_lodash2 = require("lodash");
|
|
4860
|
-
var updateActions = ActionTypes.extract([
|
|
4861
|
-
ActionType.CREATE,
|
|
4862
|
-
ActionType.NOTIFY,
|
|
4863
|
-
ActionType.EDIT,
|
|
4864
|
-
ActionType.DECLARE,
|
|
4865
|
-
ActionType.REGISTER,
|
|
4866
|
-
ActionType.REJECT,
|
|
4867
|
-
ActionType.ARCHIVE,
|
|
4868
|
-
ActionType.UNARCHIVE,
|
|
4869
|
-
ActionType.PRINT_CERTIFICATE,
|
|
4870
|
-
ActionType.REQUEST_CORRECTION,
|
|
4871
|
-
ActionType.APPROVE_CORRECTION,
|
|
4872
|
-
ActionType.REJECT_CORRECTION,
|
|
4873
|
-
ActionType.CUSTOM
|
|
4874
|
-
]);
|
|
4875
|
-
|
|
4876
|
-
// ../commons/src/events/state/flags.ts
|
|
4877
|
-
var import_lodash3 = require("lodash");
|
|
4878
|
-
var import_date_fns3 = require("date-fns");
|
|
4879
|
-
var INHERENT_FLAG_RULES = [
|
|
4880
|
-
{
|
|
4881
|
-
flag: InherentFlags.CORRECTION_REQUESTED,
|
|
4882
|
-
setOn: [ActionType.REQUEST_CORRECTION],
|
|
4883
|
-
resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
|
|
4884
|
-
},
|
|
4885
|
-
{
|
|
4886
|
-
// INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
|
|
4887
|
-
// other status-changing action (see getStatusFromActions). ARCHIVE/UNARCHIVE
|
|
4888
|
-
// are deliberately excluded so the flag freezes across an archive/unarchive
|
|
4889
|
-
// round trip and comes back exactly as it was.
|
|
4890
|
-
flag: InherentFlags.INCOMPLETE,
|
|
4891
|
-
setOn: [ActionType.NOTIFY],
|
|
4892
|
-
resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
|
|
4893
|
-
},
|
|
4894
|
-
{
|
|
4895
|
-
flag: InherentFlags.REJECTED,
|
|
4896
|
-
setOn: [ActionType.REJECT],
|
|
4897
|
-
resetOn: [
|
|
4898
|
-
ActionType.NOTIFY,
|
|
4899
|
-
ActionType.DECLARE,
|
|
4900
|
-
ActionType.EDIT,
|
|
4901
|
-
ActionType.REGISTER
|
|
4902
|
-
]
|
|
4903
|
-
},
|
|
4904
|
-
{
|
|
4905
|
-
flag: InherentFlags.POTENTIAL_DUPLICATE,
|
|
4906
|
-
setOn: [ActionType.DUPLICATE_DETECTED],
|
|
4907
|
-
resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
|
|
4908
|
-
},
|
|
4909
|
-
{
|
|
4910
|
-
flag: InherentFlags.EDIT_IN_PROGRESS,
|
|
4911
|
-
setOn: [ActionType.EDIT],
|
|
4912
|
-
resetOnAnyOtherAction: true
|
|
4913
|
-
}
|
|
4914
|
-
];
|
|
4915
|
-
|
|
4916
5638
|
// ../commons/src/events/defineConfig.ts
|
|
4917
5639
|
var IGNORED_EVENT_TYPES = [
|
|
4918
5640
|
"FOOTBALL_CLUB_MEMBERSHIP",
|
|
@@ -7410,6 +8132,31 @@ var Location = z43.object({
|
|
|
7410
8132
|
status: LocationStatus,
|
|
7411
8133
|
versions: z43.array(LocationVersion)
|
|
7412
8134
|
});
|
|
8135
|
+
var ClientAdministrativeArea = AdministrativeArea.omit({
|
|
8136
|
+
name: true,
|
|
8137
|
+
status: true,
|
|
8138
|
+
externalId: true
|
|
8139
|
+
});
|
|
8140
|
+
var ClientLocation = Location.omit({
|
|
8141
|
+
name: true,
|
|
8142
|
+
status: true,
|
|
8143
|
+
externalId: true
|
|
8144
|
+
});
|
|
8145
|
+
function toClientLocation(location) {
|
|
8146
|
+
return {
|
|
8147
|
+
id: location.id,
|
|
8148
|
+
administrativeAreaId: location.administrativeAreaId,
|
|
8149
|
+
locationType: location.locationType,
|
|
8150
|
+
versions: location.versions
|
|
8151
|
+
};
|
|
8152
|
+
}
|
|
8153
|
+
function toClientAdministrativeArea(area) {
|
|
8154
|
+
return {
|
|
8155
|
+
id: area.id,
|
|
8156
|
+
parentId: area.parentId,
|
|
8157
|
+
versions: area.versions
|
|
8158
|
+
};
|
|
8159
|
+
}
|
|
7413
8160
|
var SetLocationPayload = z43.object({
|
|
7414
8161
|
id: UUID,
|
|
7415
8162
|
name: z43.string(),
|
|
@@ -7494,20 +8241,20 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
|
7494
8241
|
]
|
|
7495
8242
|
};
|
|
7496
8243
|
var ACTION_FILTERS = {
|
|
7497
|
-
[ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
7498
|
-
[ActionType.REQUEST_CORRECTION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
7499
|
-
[ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
7500
|
-
[ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
7501
|
-
[ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
7502
|
-
[ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((
|
|
7503
|
-
[ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((
|
|
7504
|
-
[ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((
|
|
7505
|
-
[ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((
|
|
7506
|
-
[ActionType.ARCHIVE]: (flags) => !flags.some((
|
|
7507
|
-
[ActionType.UNARCHIVE]: (flags) => !flags.some((
|
|
7508
|
-
[ActionType.ASSIGN]: (flags) => !flags.some((
|
|
7509
|
-
[ActionType.UNASSIGN]: (flags) => !flags.some((
|
|
7510
|
-
[ActionType.CUSTOM]: (flags) => !flags.some((
|
|
8244
|
+
[ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8245
|
+
[ActionType.REQUEST_CORRECTION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8246
|
+
[ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8247
|
+
[ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8248
|
+
[ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8249
|
+
[ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8250
|
+
[ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8251
|
+
[ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8252
|
+
[ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8253
|
+
[ActionType.ARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8254
|
+
[ActionType.UNARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8255
|
+
[ActionType.ASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8256
|
+
[ActionType.UNASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8257
|
+
[ActionType.CUSTOM]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested"))
|
|
7511
8258
|
};
|
|
7512
8259
|
var REJECTED_ACTIONS = [
|
|
7513
8260
|
ActionType.READ,
|
|
@@ -7852,6 +8599,15 @@ var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
|
|
|
7852
8599
|
var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
|
|
7853
8600
|
V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
|
|
7854
8601
|
);
|
|
8602
|
+
var V2_DEFAULT_MOCK_CLIENT_LOCATIONS_MAP = new Map(
|
|
8603
|
+
V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, toClientLocation(l)])
|
|
8604
|
+
);
|
|
8605
|
+
var V2_DEFAULT_MOCK_CLIENT_ADMINISTRATIVE_AREAS_MAP = new Map(
|
|
8606
|
+
V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [
|
|
8607
|
+
a.id,
|
|
8608
|
+
toClientAdministrativeArea(a)
|
|
8609
|
+
])
|
|
8610
|
+
);
|
|
7855
8611
|
|
|
7856
8612
|
// ../commons/src/events/locationPayloads.ts
|
|
7857
8613
|
var z44 = __toESM(require("zod/v4"));
|