@opencrvs/toolkit 2.1.0-rc.6a144d4 → 2.1.0-rc.6bae709
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 +114 -66
- package/create-countryconfig/node_modules/.bin/degit +21 -0
- package/create-countryconfig/package.json +4 -1
- package/dist/application-config/index.js +227 -196
- package/dist/cli.js +174 -58
- package/dist/commons/api/router.d.ts +76 -22
- 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 +38 -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 +3480 -3272
- 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 +1795 -1074
- 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.6bae709.tgz +0 -0
- package/package.json +5 -5
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.1.0-rc.6a144d4.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,139 +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()
|
|
555
697
|
})
|
|
556
698
|
});
|
|
557
|
-
var ChangedStringField =
|
|
558
|
-
var ChangedNullableStringField =
|
|
559
|
-
from:
|
|
560
|
-
to:
|
|
561
|
-
});
|
|
562
|
-
var updatedVersionRequestData =
|
|
563
|
-
id:
|
|
564
|
-
versionId:
|
|
565
|
-
name:
|
|
566
|
-
externalId:
|
|
567
|
-
status:
|
|
568
|
-
effectiveFrom:
|
|
569
|
-
lastVersionId:
|
|
570
|
-
});
|
|
571
|
-
var updatedVersionResponseSummary =
|
|
572
|
-
previousVersionId:
|
|
573
|
-
versionId:
|
|
574
|
-
changed:
|
|
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({
|
|
575
717
|
name: ChangedStringField.optional(),
|
|
576
718
|
externalId: ChangedNullableStringField.optional(),
|
|
577
719
|
status: ChangedStringField.optional()
|
|
578
720
|
})
|
|
579
721
|
});
|
|
580
722
|
var LocationUpdateEntrySchema = AuditLogEntryBase.extend({
|
|
581
|
-
operation:
|
|
723
|
+
operation: z8.literal("locations.update"),
|
|
582
724
|
requestData: updatedVersionRequestData,
|
|
583
725
|
responseSummary: updatedVersionResponseSummary
|
|
584
726
|
});
|
|
585
727
|
var AdministrativeAreaUpdateEntrySchema = AuditLogEntryBase.extend({
|
|
586
|
-
operation:
|
|
728
|
+
operation: z8.literal("administrativeAreas.update"),
|
|
587
729
|
requestData: updatedVersionRequestData,
|
|
588
730
|
responseSummary: updatedVersionResponseSummary
|
|
589
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
|
+
});
|
|
590
752
|
var AttachmentUploadEntrySchema = AuditLogEntryBase.extend({
|
|
591
|
-
operation:
|
|
592
|
-
requestData:
|
|
593
|
-
transactionId:
|
|
594
|
-
path:
|
|
753
|
+
operation: z8.literal("attachments.upload"),
|
|
754
|
+
requestData: z8.object({
|
|
755
|
+
transactionId: z8.string(),
|
|
756
|
+
path: z8.string().nullable()
|
|
595
757
|
}),
|
|
596
|
-
responseSummary:
|
|
758
|
+
responseSummary: z8.object({ fileUrl: z8.string() })
|
|
597
759
|
});
|
|
598
|
-
var subjectOnly =
|
|
599
|
-
var subjectWithReason =
|
|
600
|
-
subjectId:
|
|
601
|
-
reason:
|
|
602
|
-
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()
|
|
603
765
|
});
|
|
604
766
|
var UserCreateEntrySchema = AuditLogEntryBase.extend({
|
|
605
|
-
operation:
|
|
606
|
-
requestData:
|
|
607
|
-
subjectId:
|
|
608
|
-
role:
|
|
609
|
-
primaryOfficeId:
|
|
767
|
+
operation: z8.literal("user.create_user"),
|
|
768
|
+
requestData: z8.object({
|
|
769
|
+
subjectId: z8.string(),
|
|
770
|
+
role: z8.string(),
|
|
771
|
+
primaryOfficeId: z8.string()
|
|
610
772
|
})
|
|
611
773
|
});
|
|
612
774
|
var UserReasonEntrySchema = AuditLogEntryBase.extend({
|
|
613
|
-
operation:
|
|
775
|
+
operation: z8.enum(["user.deactivate", "user.reactivate"]),
|
|
614
776
|
requestData: subjectWithReason
|
|
615
777
|
});
|
|
616
778
|
var UserSubjectOnlyEntrySchema = AuditLogEntryBase.extend({
|
|
617
|
-
operation:
|
|
779
|
+
operation: z8.enum([
|
|
618
780
|
"user.edit_user",
|
|
619
781
|
"user.logged_in",
|
|
620
782
|
"user.logged_out",
|
|
@@ -628,14 +790,14 @@ var UserSubjectOnlyEntrySchema = AuditLogEntryBase.extend({
|
|
|
628
790
|
requestData: subjectOnly
|
|
629
791
|
});
|
|
630
792
|
var UserEmailChangedEntrySchema = AuditLogEntryBase.extend({
|
|
631
|
-
operation:
|
|
793
|
+
operation: z8.literal("user.email_address_changed"),
|
|
632
794
|
requestData: subjectOnly,
|
|
633
|
-
responseSummary:
|
|
795
|
+
responseSummary: z8.object({ email: z8.string() })
|
|
634
796
|
});
|
|
635
797
|
var UserPhoneChangedEntrySchema = AuditLogEntryBase.extend({
|
|
636
|
-
operation:
|
|
798
|
+
operation: z8.literal("user.phone_number_changed"),
|
|
637
799
|
requestData: subjectOnly,
|
|
638
|
-
responseSummary:
|
|
800
|
+
responseSummary: z8.object({ phoneNumber: z8.string() })
|
|
639
801
|
});
|
|
640
802
|
var userBaseOmit = {
|
|
641
803
|
id: true,
|
|
@@ -643,14 +805,14 @@ var userBaseOmit = {
|
|
|
643
805
|
clientType: true,
|
|
644
806
|
createdAt: true
|
|
645
807
|
};
|
|
646
|
-
var UserAuditRecordInput =
|
|
808
|
+
var UserAuditRecordInput = z8.discriminatedUnion("operation", [
|
|
647
809
|
UserCreateEntrySchema.omit(userBaseOmit),
|
|
648
810
|
UserReasonEntrySchema.omit(userBaseOmit),
|
|
649
811
|
UserSubjectOnlyEntrySchema.omit(userBaseOmit),
|
|
650
812
|
UserEmailChangedEntrySchema.omit(userBaseOmit),
|
|
651
813
|
UserPhoneChangedEntrySchema.omit(userBaseOmit)
|
|
652
814
|
]);
|
|
653
|
-
var AuditLogEntrySchema =
|
|
815
|
+
var AuditLogEntrySchema = z8.discriminatedUnion("operation", [
|
|
654
816
|
EventCreateEntrySchema,
|
|
655
817
|
EventGetEntrySchema,
|
|
656
818
|
EventSearchEntrySchema,
|
|
@@ -665,6 +827,8 @@ var AuditLogEntrySchema = z5.discriminatedUnion("operation", [
|
|
|
665
827
|
LocationCreateEntrySchema,
|
|
666
828
|
LocationUpdateEntrySchema,
|
|
667
829
|
AdministrativeAreaUpdateEntrySchema,
|
|
830
|
+
LocationWithdrawEntrySchema,
|
|
831
|
+
AdministrativeAreaWithdrawEntrySchema,
|
|
668
832
|
AdministrativeAreaCreateEntrySchema,
|
|
669
833
|
AttachmentUploadEntrySchema,
|
|
670
834
|
UserCreateEntrySchema,
|
|
@@ -681,76 +845,11 @@ var CHILD_ONBOARDING_EVENT = "child-onboarding";
|
|
|
681
845
|
// ../commons/src/events/ActionConfig.ts
|
|
682
846
|
var z24 = __toESM(require("zod/v4"));
|
|
683
847
|
|
|
684
|
-
// ../commons/src/events/TranslationConfig.ts
|
|
685
|
-
var z6 = __toESM(require("zod/v4"));
|
|
686
|
-
var TranslationConfig = z6.object({
|
|
687
|
-
id: z6.string().describe(
|
|
688
|
-
"The identifier of the translation referred in translation CSV files"
|
|
689
|
-
),
|
|
690
|
-
defaultMessage: z6.string().describe("Default translation message"),
|
|
691
|
-
description: z6.string().describe(
|
|
692
|
-
"Describe the translation for a translator to be able to identify it."
|
|
693
|
-
)
|
|
694
|
-
}).meta({
|
|
695
|
-
description: "Translation configuration",
|
|
696
|
-
id: "TranslationConfig"
|
|
697
|
-
});
|
|
698
|
-
|
|
699
848
|
// ../commons/src/events/FieldConfig.ts
|
|
700
849
|
var import_v43 = __toESM(require("zod/v4"));
|
|
701
850
|
|
|
702
|
-
// ../commons/src/events/Conditional.ts
|
|
703
|
-
var z7 = __toESM(require("zod/v4"));
|
|
704
|
-
var Conditional = z7.any().describe("JSONSchema").meta({
|
|
705
|
-
description: "JSON schema conditional configuration",
|
|
706
|
-
id: "Conditional"
|
|
707
|
-
});
|
|
708
|
-
var ConditionalType = {
|
|
709
|
-
SHOW: "SHOW",
|
|
710
|
-
ENABLE: "ENABLE",
|
|
711
|
-
DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
|
|
712
|
-
};
|
|
713
|
-
var ShowConditional = z7.object({
|
|
714
|
-
type: z7.literal(ConditionalType.SHOW),
|
|
715
|
-
conditional: Conditional
|
|
716
|
-
}).describe(
|
|
717
|
-
"If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
|
|
718
|
-
);
|
|
719
|
-
var EnableConditional = z7.object({
|
|
720
|
-
type: z7.literal(ConditionalType.ENABLE),
|
|
721
|
-
conditional: Conditional
|
|
722
|
-
}).describe(
|
|
723
|
-
"If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
|
|
724
|
-
);
|
|
725
|
-
var ActionConditional = z7.discriminatedUnion("type", [
|
|
726
|
-
// Action can be shown / hidden
|
|
727
|
-
ShowConditional,
|
|
728
|
-
// Action can be shown to the user in the list but as disabled
|
|
729
|
-
EnableConditional
|
|
730
|
-
]).meta({
|
|
731
|
-
id: "ActionConditional",
|
|
732
|
-
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."
|
|
733
|
-
});
|
|
734
|
-
var DisplayOnReviewConditional = z7.object({
|
|
735
|
-
type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
736
|
-
conditional: Conditional
|
|
737
|
-
}).describe(
|
|
738
|
-
"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."
|
|
739
|
-
);
|
|
740
|
-
var FieldConditional = z7.discriminatedUnion("type", [
|
|
741
|
-
// Field input can be shown / hidden
|
|
742
|
-
ShowConditional,
|
|
743
|
-
// Field input can be shown to the user but as disabled
|
|
744
|
-
EnableConditional,
|
|
745
|
-
// Field output can be shown / hidden on the review page
|
|
746
|
-
DisplayOnReviewConditional
|
|
747
|
-
]).meta({
|
|
748
|
-
id: "FieldConditional",
|
|
749
|
-
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."
|
|
750
|
-
});
|
|
751
|
-
|
|
752
851
|
// ../commons/src/events/FieldType.ts
|
|
753
|
-
var
|
|
852
|
+
var z9 = __toESM(require("zod/v4"));
|
|
754
853
|
var FieldType = {
|
|
755
854
|
NAME: "NAME",
|
|
756
855
|
PHONE: "PHONE",
|
|
@@ -814,7 +913,7 @@ var FieldType = {
|
|
|
814
913
|
*/
|
|
815
914
|
_EXPERIMENTAL_CUSTOM: "CUSTOM"
|
|
816
915
|
};
|
|
817
|
-
var FileFieldType =
|
|
916
|
+
var FileFieldType = z9.enum([
|
|
818
917
|
FieldType.FILE,
|
|
819
918
|
FieldType.FILE_WITH_OPTIONS,
|
|
820
919
|
FieldType.SIGNATURE
|
|
@@ -850,160 +949,164 @@ var HiddenFieldTypes = [
|
|
|
850
949
|
];
|
|
851
950
|
|
|
852
951
|
// ../commons/src/events/FieldValue.ts
|
|
853
|
-
var
|
|
952
|
+
var z13 = __toESM(require("zod/v4"));
|
|
854
953
|
|
|
855
954
|
// ../commons/src/documents.ts
|
|
856
|
-
var
|
|
857
|
-
var FullDocumentUrl =
|
|
955
|
+
var z10 = __toESM(require("zod/v4"));
|
|
956
|
+
var FullDocumentUrl = z10.string().brand("FullDocumentUrl").describe(
|
|
858
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"
|
|
859
958
|
);
|
|
860
|
-
var FullDocumentPath =
|
|
959
|
+
var FullDocumentPath = z10.string().overwrite((val) => val.startsWith("/") ? val : `/${val}`).meta({ effectType: "input", type: "string" }).describe(
|
|
861
960
|
"A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
|
|
862
961
|
);
|
|
863
|
-
var DocumentPath =
|
|
962
|
+
var DocumentPath = z10.string().brand("DocumentPath").describe(
|
|
864
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."
|
|
865
964
|
);
|
|
866
965
|
|
|
867
966
|
// ../commons/src/events/CompositeFieldValue.ts
|
|
868
|
-
var
|
|
967
|
+
var z11 = __toESM(require("zod/v4"));
|
|
869
968
|
var AddressType = {
|
|
870
969
|
DOMESTIC: "DOMESTIC",
|
|
871
970
|
INTERNATIONAL: "INTERNATIONAL"
|
|
872
971
|
};
|
|
873
|
-
var FileFieldValue =
|
|
972
|
+
var FileFieldValue = z11.object({
|
|
874
973
|
path: DocumentPath,
|
|
875
|
-
originalFilename:
|
|
876
|
-
type:
|
|
877
|
-
});
|
|
878
|
-
var NameFieldValue =
|
|
879
|
-
firstname:
|
|
880
|
-
surname:
|
|
881
|
-
middlename:
|
|
882
|
-
});
|
|
883
|
-
var NameFieldUpdateValue =
|
|
884
|
-
firstname:
|
|
885
|
-
surname:
|
|
886
|
-
middlename:
|
|
887
|
-
}).or(
|
|
888
|
-
var StreetLevelDetailsValue =
|
|
889
|
-
var StreetLevelDetailsUpdateValue =
|
|
890
|
-
var BaseAddressFieldValue =
|
|
891
|
-
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(),
|
|
892
991
|
streetLevelDetails: StreetLevelDetailsValue
|
|
893
992
|
});
|
|
894
|
-
var BaseAddressFieldUpdateValue =
|
|
895
|
-
country:
|
|
993
|
+
var BaseAddressFieldUpdateValue = z11.object({
|
|
994
|
+
country: z11.string().nullish(),
|
|
896
995
|
streetLevelDetails: StreetLevelDetailsUpdateValue
|
|
897
996
|
});
|
|
898
997
|
var DomesticAddressFieldValue = BaseAddressFieldValue.extend({
|
|
899
|
-
addressType:
|
|
900
|
-
administrativeArea:
|
|
998
|
+
addressType: z11.literal(AddressType.DOMESTIC),
|
|
999
|
+
administrativeArea: z11.string().uuid()
|
|
901
1000
|
});
|
|
902
1001
|
var InternationalAddressFieldValue = BaseAddressFieldValue.extend({
|
|
903
|
-
addressType:
|
|
1002
|
+
addressType: z11.literal(AddressType.INTERNATIONAL)
|
|
904
1003
|
});
|
|
905
|
-
var AddressFieldValue =
|
|
1004
|
+
var AddressFieldValue = z11.discriminatedUnion("addressType", [
|
|
906
1005
|
DomesticAddressFieldValue,
|
|
907
1006
|
InternationalAddressFieldValue
|
|
908
1007
|
]);
|
|
909
1008
|
var DomesticAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend({
|
|
910
|
-
addressType:
|
|
911
|
-
administrativeArea:
|
|
1009
|
+
addressType: z11.literal(AddressType.DOMESTIC),
|
|
1010
|
+
administrativeArea: z11.string().uuid().nullish()
|
|
912
1011
|
/* Leaf level admin structure */
|
|
913
1012
|
});
|
|
914
1013
|
var InternationalAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend(
|
|
915
1014
|
{
|
|
916
|
-
addressType:
|
|
1015
|
+
addressType: z11.literal(AddressType.INTERNATIONAL)
|
|
917
1016
|
}
|
|
918
1017
|
);
|
|
919
|
-
var AddressFieldUpdateValue =
|
|
1018
|
+
var AddressFieldUpdateValue = z11.discriminatedUnion("addressType", [
|
|
920
1019
|
DomesticAddressUpdateFieldValue,
|
|
921
1020
|
InternationalAddressUpdateFieldValue
|
|
922
1021
|
]).nullish();
|
|
923
|
-
var FileFieldValueWithOption =
|
|
1022
|
+
var FileFieldValueWithOption = z11.object({
|
|
924
1023
|
path: DocumentPath,
|
|
925
|
-
originalFilename:
|
|
926
|
-
type:
|
|
927
|
-
option:
|
|
928
|
-
});
|
|
929
|
-
var FileFieldWithOptionValue =
|
|
930
|
-
var HttpFieldValue =
|
|
931
|
-
loading:
|
|
932
|
-
error:
|
|
933
|
-
data:
|
|
934
|
-
});
|
|
935
|
-
var HttpFieldUpdateValue =
|
|
936
|
-
loading:
|
|
937
|
-
error:
|
|
938
|
-
data:
|
|
939
|
-
}).or(
|
|
940
|
-
var QueryParamReaderFieldValue =
|
|
941
|
-
data:
|
|
942
|
-
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()
|
|
943
1042
|
}).nullish();
|
|
944
|
-
var QueryParamReaderFieldUpdateValue =
|
|
945
|
-
data:
|
|
1043
|
+
var QueryParamReaderFieldUpdateValue = z11.object({
|
|
1044
|
+
data: z11.record(z11.string(), z11.string())
|
|
946
1045
|
});
|
|
947
|
-
var ReadDataValue =
|
|
948
|
-
data:
|
|
1046
|
+
var ReadDataValue = z11.object({
|
|
1047
|
+
data: z11.any()
|
|
949
1048
|
});
|
|
950
1049
|
var QrReaderFieldValue = ReadDataValue;
|
|
951
1050
|
var IdReaderFieldValue = ReadDataValue;
|
|
952
|
-
var NumberWithUnitFieldValue =
|
|
953
|
-
numericValue:
|
|
954
|
-
unit:
|
|
1051
|
+
var NumberWithUnitFieldValue = z11.object({
|
|
1052
|
+
numericValue: z11.number(),
|
|
1053
|
+
unit: z11.string()
|
|
955
1054
|
});
|
|
956
|
-
var NumberWithUnitFieldUpdateValue =
|
|
957
|
-
numericValue:
|
|
958
|
-
unit:
|
|
1055
|
+
var NumberWithUnitFieldUpdateValue = z11.object({
|
|
1056
|
+
numericValue: z11.number().optional(),
|
|
1057
|
+
unit: z11.string().optional()
|
|
959
1058
|
});
|
|
960
|
-
var CustomFieldValue =
|
|
1059
|
+
var CustomFieldValue = z11.unknown().brand("CustomFieldValue");
|
|
961
1060
|
|
|
962
1061
|
// ../commons/src/events/PlainDate.ts
|
|
963
1062
|
var import_zod = require("zod");
|
|
964
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
|
+
}
|
|
965
1068
|
|
|
966
1069
|
// ../commons/src/events/FieldValue.ts
|
|
967
|
-
var TextValue =
|
|
968
|
-
var HiddenFieldValue =
|
|
969
|
-
var NonEmptyTextValue =
|
|
970
|
-
var DateValue =
|
|
971
|
-
var AgeValue =
|
|
972
|
-
age:
|
|
973
|
-
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()
|
|
974
1077
|
});
|
|
975
1078
|
var AgeUpdateValue = AgeValue.optional().nullable();
|
|
976
|
-
var AutocompleteValue =
|
|
977
|
-
label:
|
|
978
|
-
value:
|
|
1079
|
+
var AutocompleteValue = z13.object({
|
|
1080
|
+
label: z13.string(),
|
|
1081
|
+
value: z13.string()
|
|
979
1082
|
});
|
|
980
1083
|
var AutocompleteUpdateValue = AutocompleteValue.optional().nullable();
|
|
981
|
-
var TimeValue =
|
|
982
|
-
var DatetimeValue =
|
|
983
|
-
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([
|
|
984
1087
|
"last7Days",
|
|
985
1088
|
"last30Days",
|
|
986
1089
|
"last90Days",
|
|
987
1090
|
"last365Days"
|
|
988
1091
|
]);
|
|
989
|
-
var DateRangeFieldValue =
|
|
1092
|
+
var DateRangeFieldValue = z13.object({
|
|
990
1093
|
start: PlainDate,
|
|
991
1094
|
end: PlainDate
|
|
992
1095
|
}).or(PlainDate).describe(
|
|
993
1096
|
"Date range with start and end dates in the format YYYY-MM-DD. Inclusive start, exclusive end."
|
|
994
1097
|
);
|
|
995
|
-
var EmailValue =
|
|
996
|
-
var CheckboxFieldValue =
|
|
997
|
-
var NumberFieldValue =
|
|
1098
|
+
var EmailValue = z13.email();
|
|
1099
|
+
var CheckboxFieldValue = z13.boolean();
|
|
1100
|
+
var NumberFieldValue = z13.number();
|
|
998
1101
|
var SignatureFieldValue = FileFieldValue;
|
|
999
|
-
var ButtonFieldValue =
|
|
1000
|
-
var VerificationStatusValue =
|
|
1102
|
+
var ButtonFieldValue = z13.number();
|
|
1103
|
+
var VerificationStatusValue = z13.enum([
|
|
1001
1104
|
"verified",
|
|
1002
1105
|
"authenticated",
|
|
1003
1106
|
"failed",
|
|
1004
1107
|
"pending"
|
|
1005
1108
|
]);
|
|
1006
|
-
var LeafFieldValues =
|
|
1109
|
+
var LeafFieldValues = z13.union([
|
|
1007
1110
|
AddressFieldValue,
|
|
1008
1111
|
TextValue,
|
|
1009
1112
|
PlainDate,
|
|
@@ -1029,11 +1132,11 @@ var LeafFieldValues = z12.union([
|
|
|
1029
1132
|
AutocompleteValue,
|
|
1030
1133
|
AutocompleteUpdateValue
|
|
1031
1134
|
]);
|
|
1032
|
-
var FieldGroupValue =
|
|
1033
|
-
var DataFieldValue =
|
|
1034
|
-
data:
|
|
1135
|
+
var FieldGroupValue = z13.record(z13.string(), LeafFieldValues);
|
|
1136
|
+
var DataFieldValue = z13.object({
|
|
1137
|
+
data: z13.record(z13.string(), LeafFieldValues)
|
|
1035
1138
|
}).nullish();
|
|
1036
|
-
var FieldValue =
|
|
1139
|
+
var FieldValue = z13.union([
|
|
1037
1140
|
LeafFieldValues,
|
|
1038
1141
|
DataFieldValue,
|
|
1039
1142
|
FieldGroupValue
|
|
@@ -1067,7 +1170,7 @@ function safeUnion(schemas) {
|
|
|
1067
1170
|
const sortedSchemas = [...schemas].sort(
|
|
1068
1171
|
(a, b) => schemaPriority(a) - schemaPriority(b)
|
|
1069
1172
|
);
|
|
1070
|
-
return
|
|
1173
|
+
return z13.any().superRefine((val, ctx) => {
|
|
1071
1174
|
for (const schema of sortedSchemas) {
|
|
1072
1175
|
if (schema.safeParse(val).success) {
|
|
1073
1176
|
return;
|
|
@@ -1106,9 +1209,9 @@ var FieldUpdateValue = safeUnion([
|
|
|
1106
1209
|
]);
|
|
1107
1210
|
|
|
1108
1211
|
// ../commons/src/events/serializers/user/serializer.ts
|
|
1109
|
-
var
|
|
1110
|
-
var SerializedUserField =
|
|
1111
|
-
$userField:
|
|
1212
|
+
var z14 = __toESM(require("zod/v4"));
|
|
1213
|
+
var SerializedUserField = z14.object({
|
|
1214
|
+
$userField: z14.enum([
|
|
1112
1215
|
"id",
|
|
1113
1216
|
"name",
|
|
1114
1217
|
"role",
|
|
@@ -1122,7 +1225,7 @@ var SerializedUserField = z13.object({
|
|
|
1122
1225
|
"primaryOfficeId",
|
|
1123
1226
|
"administrativeAreaId"
|
|
1124
1227
|
]),
|
|
1125
|
-
$location:
|
|
1228
|
+
$location: z14.string().optional()
|
|
1126
1229
|
});
|
|
1127
1230
|
function userSerializer(userField) {
|
|
1128
1231
|
return {
|
|
@@ -1148,27 +1251,22 @@ var import_v4 = require("zod/v4");
|
|
|
1148
1251
|
var z16 = __toESM(require("zod/v4"));
|
|
1149
1252
|
|
|
1150
1253
|
// ../commons/src/events/ActionDocument.ts
|
|
1151
|
-
var
|
|
1152
|
-
var ActionUpdate =
|
|
1254
|
+
var z15 = __toESM(require("zod/v4"));
|
|
1255
|
+
var ActionUpdate = z15.record(z15.string(), FieldUpdateValue).describe(
|
|
1153
1256
|
"Record of field-level changes made by an action. Supports partial updates and nullable values."
|
|
1154
1257
|
);
|
|
1155
|
-
var EventState =
|
|
1258
|
+
var EventState = z15.record(z15.string(), FieldValue).describe(
|
|
1156
1259
|
"Aggregate representation of event data after all actions have been applied, with all updates consolidated and null values removed."
|
|
1157
1260
|
);
|
|
1158
|
-
var
|
|
1159
|
-
Requested: "Requested",
|
|
1160
|
-
Accepted: "Accepted",
|
|
1161
|
-
Rejected: "Rejected"
|
|
1162
|
-
};
|
|
1163
|
-
var ActionBase = z14.object({
|
|
1261
|
+
var ActionBase = z15.object({
|
|
1164
1262
|
id: UUID.describe("Unique identifier of the action."),
|
|
1165
|
-
transactionId:
|
|
1263
|
+
transactionId: z15.string().describe("Unique identifier of the transaction."),
|
|
1166
1264
|
createdByUserType: TokenUserType.describe(
|
|
1167
1265
|
"Indicates whether the action was created by a human-user or by a system-user."
|
|
1168
1266
|
),
|
|
1169
|
-
createdAt:
|
|
1170
|
-
createdBy:
|
|
1171
|
-
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."),
|
|
1172
1270
|
createdBySignature: DocumentPath.nullish().describe(
|
|
1173
1271
|
"Reference to the signature of the user who created the action."
|
|
1174
1272
|
),
|
|
@@ -1180,7 +1278,7 @@ var ActionBase = z14.object({
|
|
|
1180
1278
|
"Declaration data defined by the ActionConfig. Supports partial updates."
|
|
1181
1279
|
),
|
|
1182
1280
|
annotation: ActionUpdate.optional().nullable().describe("Action-specific metadata used to annotate the event."),
|
|
1183
|
-
status:
|
|
1281
|
+
status: z15.enum([
|
|
1184
1282
|
ActionStatus.Requested,
|
|
1185
1283
|
ActionStatus.Accepted,
|
|
1186
1284
|
ActionStatus.Rejected
|
|
@@ -1192,139 +1290,139 @@ var ActionBase = z14.object({
|
|
|
1192
1290
|
)
|
|
1193
1291
|
});
|
|
1194
1292
|
var AssignedAction = ActionBase.extend(
|
|
1195
|
-
|
|
1196
|
-
type:
|
|
1197
|
-
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.")
|
|
1198
1296
|
// TODO move into 'content' property
|
|
1199
1297
|
}).shape
|
|
1200
1298
|
);
|
|
1201
1299
|
var UnassignedAction = ActionBase.extend(
|
|
1202
|
-
|
|
1203
|
-
type:
|
|
1300
|
+
z15.object({
|
|
1301
|
+
type: z15.literal(ActionType.UNASSIGN)
|
|
1204
1302
|
}).shape
|
|
1205
1303
|
);
|
|
1206
1304
|
var RegisterAction = ActionBase.extend(
|
|
1207
|
-
|
|
1208
|
-
type:
|
|
1209
|
-
registrationNumber:
|
|
1305
|
+
z15.object({
|
|
1306
|
+
type: z15.literal(ActionType.REGISTER),
|
|
1307
|
+
registrationNumber: z15.string().optional().describe(
|
|
1210
1308
|
"Registration number of the event. Always present for accepted registrations."
|
|
1211
1309
|
)
|
|
1212
1310
|
// TODO move into 'content' property
|
|
1213
1311
|
}).shape
|
|
1214
1312
|
);
|
|
1215
1313
|
var DeclareAction = ActionBase.extend(
|
|
1216
|
-
|
|
1217
|
-
type:
|
|
1314
|
+
z15.object({
|
|
1315
|
+
type: z15.literal(ActionType.DECLARE)
|
|
1218
1316
|
}).shape
|
|
1219
1317
|
);
|
|
1220
|
-
var ReasonContent =
|
|
1221
|
-
reason:
|
|
1318
|
+
var ReasonContent = z15.object({
|
|
1319
|
+
reason: z15.string().min(1, { error: "Message cannot be empty" }).describe(
|
|
1222
1320
|
"Message describing the reason for rejecting or archiving the event."
|
|
1223
1321
|
)
|
|
1224
1322
|
});
|
|
1225
1323
|
var RejectAction = ActionBase.extend(
|
|
1226
|
-
|
|
1227
|
-
type:
|
|
1324
|
+
z15.object({
|
|
1325
|
+
type: z15.literal(ActionType.REJECT),
|
|
1228
1326
|
content: ReasonContent
|
|
1229
1327
|
}).shape
|
|
1230
1328
|
);
|
|
1231
|
-
var PotentialDuplicate =
|
|
1329
|
+
var PotentialDuplicate = z15.object({
|
|
1232
1330
|
id: UUID,
|
|
1233
|
-
trackingId:
|
|
1331
|
+
trackingId: z15.string()
|
|
1234
1332
|
});
|
|
1235
1333
|
var DuplicateDetectedAction = ActionBase.extend(
|
|
1236
|
-
|
|
1237
|
-
type:
|
|
1238
|
-
content:
|
|
1239
|
-
duplicates:
|
|
1334
|
+
z15.object({
|
|
1335
|
+
type: z15.literal(ActionType.DUPLICATE_DETECTED),
|
|
1336
|
+
content: z15.object({
|
|
1337
|
+
duplicates: z15.array(PotentialDuplicate)
|
|
1240
1338
|
})
|
|
1241
1339
|
}).shape
|
|
1242
1340
|
);
|
|
1243
1341
|
var MarkNotDuplicateAction = ActionBase.extend(
|
|
1244
|
-
|
|
1245
|
-
type:
|
|
1342
|
+
z15.object({
|
|
1343
|
+
type: z15.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
1246
1344
|
}).shape
|
|
1247
1345
|
);
|
|
1248
1346
|
var MarkAsDuplicateAction = ActionBase.extend(
|
|
1249
|
-
|
|
1250
|
-
type:
|
|
1251
|
-
content:
|
|
1347
|
+
z15.object({
|
|
1348
|
+
type: z15.literal(ActionType.MARK_AS_DUPLICATE),
|
|
1349
|
+
content: z15.object({
|
|
1252
1350
|
duplicateOf: UUID
|
|
1253
1351
|
}).optional()
|
|
1254
1352
|
}).shape
|
|
1255
1353
|
);
|
|
1256
1354
|
var ArchiveAction = ActionBase.extend(
|
|
1257
|
-
|
|
1258
|
-
type:
|
|
1355
|
+
z15.object({
|
|
1356
|
+
type: z15.literal(ActionType.ARCHIVE),
|
|
1259
1357
|
content: ReasonContent
|
|
1260
1358
|
}).shape
|
|
1261
1359
|
);
|
|
1262
1360
|
var UnarchiveAction = ActionBase.extend(
|
|
1263
|
-
|
|
1264
|
-
type:
|
|
1361
|
+
z15.object({
|
|
1362
|
+
type: z15.literal(ActionType.UNARCHIVE)
|
|
1265
1363
|
}).shape
|
|
1266
1364
|
);
|
|
1267
1365
|
var CreatedAction = ActionBase.extend(
|
|
1268
|
-
|
|
1269
|
-
type:
|
|
1366
|
+
z15.object({
|
|
1367
|
+
type: z15.literal(ActionType.CREATE)
|
|
1270
1368
|
}).shape
|
|
1271
1369
|
);
|
|
1272
1370
|
var NotifiedAction = ActionBase.extend(
|
|
1273
|
-
|
|
1274
|
-
type:
|
|
1371
|
+
z15.object({
|
|
1372
|
+
type: z15.literal(ActionType.NOTIFY)
|
|
1275
1373
|
}).shape
|
|
1276
1374
|
);
|
|
1277
1375
|
var EditAction = ActionBase.extend(
|
|
1278
|
-
|
|
1279
|
-
type:
|
|
1376
|
+
z15.object({
|
|
1377
|
+
type: z15.literal(ActionType.EDIT),
|
|
1280
1378
|
/** @deprecated New Edit-actions should no longer contain content. This is kept for old 2.0 edits. */
|
|
1281
|
-
content:
|
|
1282
|
-
comment:
|
|
1379
|
+
content: z15.object({
|
|
1380
|
+
comment: z15.string().describe("Comment for the edit action.").optional()
|
|
1283
1381
|
}).optional()
|
|
1284
1382
|
}).shape
|
|
1285
1383
|
);
|
|
1286
|
-
var PrintContent =
|
|
1287
|
-
templateId:
|
|
1384
|
+
var PrintContent = z15.object({
|
|
1385
|
+
templateId: z15.string().optional()
|
|
1288
1386
|
});
|
|
1289
1387
|
var PrintCertificateAction = ActionBase.extend(
|
|
1290
|
-
|
|
1291
|
-
type:
|
|
1388
|
+
z15.object({
|
|
1389
|
+
type: z15.literal(ActionType.PRINT_CERTIFICATE),
|
|
1292
1390
|
content: PrintContent.optional().nullable()
|
|
1293
1391
|
}).shape
|
|
1294
1392
|
);
|
|
1295
1393
|
var RequestedCorrectionAction = ActionBase.extend(
|
|
1296
|
-
|
|
1297
|
-
type:
|
|
1394
|
+
z15.object({
|
|
1395
|
+
type: z15.literal(ActionType.REQUEST_CORRECTION)
|
|
1298
1396
|
}).shape
|
|
1299
1397
|
);
|
|
1300
1398
|
var ApprovedCorrectionAction = ActionBase.extend(
|
|
1301
|
-
|
|
1302
|
-
type:
|
|
1303
|
-
requestId:
|
|
1399
|
+
z15.object({
|
|
1400
|
+
type: z15.literal(ActionType.APPROVE_CORRECTION),
|
|
1401
|
+
requestId: z15.string(),
|
|
1304
1402
|
// TODO move into 'content' property
|
|
1305
|
-
content:
|
|
1403
|
+
content: z15.object({ immediateCorrection: z15.boolean().optional() }).optional()
|
|
1306
1404
|
}).shape
|
|
1307
1405
|
);
|
|
1308
1406
|
var RejectedCorrectionAction = ActionBase.extend(
|
|
1309
|
-
|
|
1310
|
-
type:
|
|
1311
|
-
requestId:
|
|
1407
|
+
z15.object({
|
|
1408
|
+
type: z15.literal(ActionType.REJECT_CORRECTION),
|
|
1409
|
+
requestId: z15.string(),
|
|
1312
1410
|
// TODO move into 'content' property
|
|
1313
1411
|
content: ReasonContent
|
|
1314
1412
|
}).shape
|
|
1315
1413
|
);
|
|
1316
1414
|
var ReadAction = ActionBase.extend(
|
|
1317
|
-
|
|
1318
|
-
type:
|
|
1415
|
+
z15.object({
|
|
1416
|
+
type: z15.literal(ActionType.READ)
|
|
1319
1417
|
}).shape
|
|
1320
1418
|
);
|
|
1321
1419
|
var CustomAction = ActionBase.merge(
|
|
1322
|
-
|
|
1323
|
-
type:
|
|
1324
|
-
customActionType:
|
|
1420
|
+
z15.object({
|
|
1421
|
+
type: z15.literal(ActionType.CUSTOM),
|
|
1422
|
+
customActionType: z15.string()
|
|
1325
1423
|
})
|
|
1326
1424
|
);
|
|
1327
|
-
var ActionDocument =
|
|
1425
|
+
var ActionDocument = z15.discriminatedUnion("type", [
|
|
1328
1426
|
CreatedAction.meta({ id: "CreatedAction" }),
|
|
1329
1427
|
RejectAction.meta({ id: "RejectAction" }),
|
|
1330
1428
|
DuplicateDetectedAction.meta({ id: "DuplicateDetectedAction" }),
|
|
@@ -1351,64 +1449,12 @@ var AsyncRejectActionDocument = ActionBase.omit({
|
|
|
1351
1449
|
declaration: true,
|
|
1352
1450
|
annotation: true
|
|
1353
1451
|
}).extend(
|
|
1354
|
-
|
|
1355
|
-
type:
|
|
1356
|
-
status:
|
|
1452
|
+
z15.object({
|
|
1453
|
+
type: z15.enum(ConfirmableActions),
|
|
1454
|
+
status: z15.literal(ActionStatus.Rejected)
|
|
1357
1455
|
}).shape
|
|
1358
1456
|
);
|
|
1359
|
-
var Action =
|
|
1360
|
-
|
|
1361
|
-
// ../commons/src/events/Flag.ts
|
|
1362
|
-
var z15 = __toESM(require("zod/v4"));
|
|
1363
|
-
var InherentFlags = {
|
|
1364
|
-
INCOMPLETE: "incomplete",
|
|
1365
|
-
REJECTED: "rejected",
|
|
1366
|
-
CORRECTION_REQUESTED: "correction-requested",
|
|
1367
|
-
POTENTIAL_DUPLICATE: "potential-duplicate",
|
|
1368
|
-
/**
|
|
1369
|
-
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
1370
|
-
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
1371
|
-
*
|
|
1372
|
-
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
1373
|
-
*/
|
|
1374
|
-
EDIT_IN_PROGRESS: "edit-in-progress"
|
|
1375
|
-
};
|
|
1376
|
-
var ActionFlag = z15.string().regex(
|
|
1377
|
-
new RegExp(
|
|
1378
|
-
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
1379
|
-
ActionStatus
|
|
1380
|
-
).join("|").toLowerCase()})$`
|
|
1381
|
-
),
|
|
1382
|
-
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
1383
|
-
);
|
|
1384
|
-
var CustomFlag = z15.string().refine((val) => !Object.values(InherentFlags).includes(val), {
|
|
1385
|
-
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
1386
|
-
InherentFlags
|
|
1387
|
-
).join(", ")}`
|
|
1388
|
-
}).refine((val) => !ActionFlag.safeParse(val).success, {
|
|
1389
|
-
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
1390
|
-
}).describe("Custom flag identifier defined by the country config.");
|
|
1391
|
-
var Flag = ActionFlag.or(z15.enum(InherentFlags)).or(CustomFlag);
|
|
1392
|
-
var FlagConfig = z15.object({
|
|
1393
|
-
id: CustomFlag,
|
|
1394
|
-
requiresAction: z15.boolean().describe(
|
|
1395
|
-
"Indicates if this flag expects an action to be performed to be cleared."
|
|
1396
|
-
),
|
|
1397
|
-
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1398
|
-
}).meta({
|
|
1399
|
-
id: "FlagConfig",
|
|
1400
|
-
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
1401
|
-
});
|
|
1402
|
-
var ActionFlagConfig = z15.object({
|
|
1403
|
-
id: Flag,
|
|
1404
|
-
operation: z15.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
1405
|
-
conditional: Conditional.optional().describe(
|
|
1406
|
-
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1407
|
-
)
|
|
1408
|
-
}).meta({
|
|
1409
|
-
id: "ActionFlagConfig",
|
|
1410
|
-
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
1411
|
-
});
|
|
1457
|
+
var Action = z15.union([ActionDocument, AsyncRejectActionDocument]);
|
|
1412
1458
|
|
|
1413
1459
|
// ../commons/src/events/EventMetadata.ts
|
|
1414
1460
|
var EventStatus = z16.enum([
|
|
@@ -1566,13 +1612,6 @@ var Range = import_v4.z.object({
|
|
|
1566
1612
|
}).meta({
|
|
1567
1613
|
id: "Range"
|
|
1568
1614
|
});
|
|
1569
|
-
var ContainsFlags = import_v4.z.object({
|
|
1570
|
-
anyOf: import_v4.z.array(Flag).optional(),
|
|
1571
|
-
noneOf: import_v4.z.array(Flag).optional(),
|
|
1572
|
-
allOf: import_v4.z.array(Flag).optional()
|
|
1573
|
-
}).meta({
|
|
1574
|
-
id: "ContainsFlags"
|
|
1575
|
-
});
|
|
1576
1615
|
var Within = import_v4.z.object({ type: import_v4.z.literal("within"), location: import_v4.z.string() }).meta({
|
|
1577
1616
|
id: "Within"
|
|
1578
1617
|
});
|
|
@@ -1799,8 +1838,8 @@ var BaseField = import_v43.default.object({
|
|
|
1799
1838
|
conditionals: import_v43.default.array(FieldConditional).default([]).optional().describe(
|
|
1800
1839
|
"Conditions determining when the field is shown or enabled. By default, the field is always shown and enabled."
|
|
1801
1840
|
),
|
|
1802
|
-
secured: import_v43.default.boolean().default(false).optional().describe(
|
|
1803
|
-
"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."
|
|
1804
1843
|
),
|
|
1805
1844
|
placeholder: TranslationConfig.optional(),
|
|
1806
1845
|
validation: import_v43.default.array(ValidationConfig).default([]).optional().describe("Additional validation rules applied to the field."),
|
|
@@ -2198,7 +2237,13 @@ var AdministrativeAreaField = BaseField.extend({
|
|
|
2198
2237
|
configuration: import_v43.default.object({
|
|
2199
2238
|
partOf: FieldReference.optional().describe("Parent location"),
|
|
2200
2239
|
type: AdministrativeAreas,
|
|
2201
|
-
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
|
+
)
|
|
2202
2247
|
}).describe("Administrative area options")
|
|
2203
2248
|
}).meta({
|
|
2204
2249
|
description: "Administrative area input field",
|
|
@@ -2209,7 +2254,10 @@ var LocationInput = BaseField.extend({
|
|
|
2209
2254
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
|
|
2210
2255
|
configuration: import_v43.default.object({
|
|
2211
2256
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
2212
|
-
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
|
+
)
|
|
2213
2261
|
}).optional()
|
|
2214
2262
|
}).meta({
|
|
2215
2263
|
description: "A field for selecting a location",
|
|
@@ -2235,12 +2283,18 @@ var FileUploadWithOptions = BaseField.extend({
|
|
|
2235
2283
|
var Facility = BaseField.extend({
|
|
2236
2284
|
type: import_v43.default.literal(FieldType.FACILITY),
|
|
2237
2285
|
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
2238
|
-
configuration: import_v43.default.object({
|
|
2286
|
+
configuration: import_v43.default.object({
|
|
2287
|
+
allowedLocations: AllowedLocations,
|
|
2288
|
+
listHistoricalNames: import_v43.default.boolean().optional()
|
|
2289
|
+
}).optional()
|
|
2239
2290
|
}).describe("Input field for a facility");
|
|
2240
2291
|
var Office = BaseField.extend({
|
|
2241
2292
|
type: import_v43.default.literal(FieldType.OFFICE),
|
|
2242
2293
|
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
2243
|
-
configuration: import_v43.default.object({
|
|
2294
|
+
configuration: import_v43.default.object({
|
|
2295
|
+
allowedLocations: AllowedLocations,
|
|
2296
|
+
listHistoricalNames: import_v43.default.boolean().optional()
|
|
2297
|
+
}).optional()
|
|
2244
2298
|
}).describe("Input field for an office");
|
|
2245
2299
|
var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
|
|
2246
2300
|
administrativeArea: import_v43.default.union([UUID, SerializedUserField]).optional()
|
|
@@ -2273,7 +2327,13 @@ var Address = BaseField.extend({
|
|
|
2273
2327
|
parent: FieldReference.optional()
|
|
2274
2328
|
})
|
|
2275
2329
|
).optional(),
|
|
2276
|
-
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
|
+
)
|
|
2277
2337
|
}).optional(),
|
|
2278
2338
|
defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
|
|
2279
2339
|
}).meta({
|
|
@@ -3045,72 +3105,208 @@ var LanguageConfig = z26.object({
|
|
|
3045
3105
|
});
|
|
3046
3106
|
|
|
3047
3107
|
// ../commons/src/events/EventConfig.ts
|
|
3048
|
-
var
|
|
3108
|
+
var z34 = __toESM(require("zod/v4"));
|
|
3049
3109
|
|
|
3050
3110
|
// ../commons/src/events/SummaryConfig.ts
|
|
3051
|
-
var z27 = __toESM(require("zod/v4"));
|
|
3052
|
-
var BaseField2 = z27.object({
|
|
3053
|
-
emptyValueMessage: TranslationConfig.optional().describe(
|
|
3054
|
-
"Default message displayed when the field value is empty."
|
|
3055
|
-
),
|
|
3056
|
-
conditionals: z27.array(ShowConditional).default([]).optional()
|
|
3057
|
-
});
|
|
3058
|
-
var ReferenceField = BaseField2.extend({
|
|
3059
|
-
fieldId: z27.string(),
|
|
3060
|
-
label: TranslationConfig.optional().describe(
|
|
3061
|
-
"Overrides the default label from the referenced field when provided."
|
|
3062
|
-
)
|
|
3063
|
-
}).describe("Field referencing existing event data by field ID.");
|
|
3064
|
-
var Field = BaseField2.extend({
|
|
3065
|
-
id: z27.string().describe("Identifier of the summary field."),
|
|
3066
|
-
value: TranslationConfig.describe(
|
|
3067
|
-
'Field value template supporting variables from configuration and EventMetadata (e.g. "{informant.phoneNo} {informant.email}").'
|
|
3068
|
-
),
|
|
3069
|
-
label: TranslationConfig
|
|
3070
|
-
}).describe("Custom field defined for the summary view.");
|
|
3071
|
-
var SummaryConfig = z27.object({
|
|
3072
|
-
fields: z27.array(z27.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
|
|
3073
|
-
}).meta({
|
|
3074
|
-
id: "SummaryConfig",
|
|
3075
|
-
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."
|
|
3076
|
-
});
|
|
3077
|
-
|
|
3078
|
-
// ../commons/src/events/AdvancedSearchConfig.ts
|
|
3079
3111
|
var z28 = __toESM(require("zod/v4"));
|
|
3080
|
-
var MatchType = z28.enum(["fuzzy", "exact", "range", "within"]);
|
|
3081
|
-
var BaseField3 = z28.object({
|
|
3082
|
-
config: z28.object({
|
|
3083
|
-
type: MatchType.describe(
|
|
3084
|
-
"Determines the search type of field. How to match value."
|
|
3085
|
-
),
|
|
3086
|
-
searchFields: z28.array(z28.string()).optional().describe(
|
|
3087
|
-
`
|
|
3088
|
-
Defines multiple form fields that should be searched when this field has a value.
|
|
3089
|
-
All specified fields will be combined using OR logic.
|
|
3090
3112
|
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
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."
|
|
3248
|
+
),
|
|
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(),
|
|
3307
|
+
searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
|
|
3308
|
+
`
|
|
3309
|
+
This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
|
|
3114
3310
|
when rendering search parameter labels \u2014 for example, in the search results page to indicate which fields were used in the search.
|
|
3115
3311
|
|
|
3116
3312
|
For example, a field config like { id: "child.name.firstname", label: { defaultMessage: "First Name(s)" } } would render as "First Name(s)" by default.
|
|
@@ -3128,7 +3324,7 @@ var BaseField3 = z28.object({
|
|
|
3128
3324
|
in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
|
|
3129
3325
|
`
|
|
3130
3326
|
),
|
|
3131
|
-
conditionals:
|
|
3327
|
+
conditionals: z29.array(FieldConditional).optional().describe(
|
|
3132
3328
|
`
|
|
3133
3329
|
In advanced search, we sometimes need to override the default field visibility conditionals.
|
|
3134
3330
|
|
|
@@ -3142,23 +3338,23 @@ var BaseField3 = z28.object({
|
|
|
3142
3338
|
are always rendered in the advanced search form.
|
|
3143
3339
|
`
|
|
3144
3340
|
),
|
|
3145
|
-
validations:
|
|
3341
|
+
validations: z29.array(ValidationConfig).optional().describe(
|
|
3146
3342
|
`Option for overriding the field validations specifically for advanced search form.`
|
|
3147
3343
|
),
|
|
3148
3344
|
allowedLocations: JurisdictionReference.optional().describe(
|
|
3149
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.`
|
|
3150
3346
|
)
|
|
3151
3347
|
});
|
|
3152
|
-
var SearchQueryParams =
|
|
3153
|
-
eventType:
|
|
3348
|
+
var SearchQueryParams = z29.object({
|
|
3349
|
+
eventType: z29.string().optional().describe(
|
|
3154
3350
|
"Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
|
|
3155
3351
|
)
|
|
3156
3352
|
}).catchall(FieldValue);
|
|
3157
3353
|
var FieldConfigSchema = BaseField3.extend({
|
|
3158
|
-
fieldId:
|
|
3159
|
-
fieldType:
|
|
3354
|
+
fieldId: z29.string(),
|
|
3355
|
+
fieldType: z29.literal("field")
|
|
3160
3356
|
});
|
|
3161
|
-
var EventFieldIdInput =
|
|
3357
|
+
var EventFieldIdInput = z29.enum([
|
|
3162
3358
|
"trackingId",
|
|
3163
3359
|
"status",
|
|
3164
3360
|
"legalStatuses.REGISTERED.acceptedAt",
|
|
@@ -3167,7 +3363,7 @@ var EventFieldIdInput = z28.enum([
|
|
|
3167
3363
|
"updatedAt"
|
|
3168
3364
|
]);
|
|
3169
3365
|
var METADATA_FIELD_PREFIX = "event.";
|
|
3170
|
-
var EventFieldId =
|
|
3366
|
+
var EventFieldId = z29.enum([
|
|
3171
3367
|
`${METADATA_FIELD_PREFIX}trackingId`,
|
|
3172
3368
|
`${METADATA_FIELD_PREFIX}status`,
|
|
3173
3369
|
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
|
|
@@ -3177,190 +3373,64 @@ var EventFieldId = z28.enum([
|
|
|
3177
3373
|
]);
|
|
3178
3374
|
var EventFieldConfigSchema = BaseField3.extend({
|
|
3179
3375
|
fieldId: EventFieldId,
|
|
3180
|
-
fieldType:
|
|
3376
|
+
fieldType: z29.literal("event")
|
|
3181
3377
|
});
|
|
3182
|
-
var AdvancedSearchField =
|
|
3378
|
+
var AdvancedSearchField = z29.discriminatedUnion("fieldType", [FieldConfigSchema, EventFieldConfigSchema]).superRefine((data, ctx) => {
|
|
3183
3379
|
if (data.config.searchFields && data.config.searchFields.length > 0) {
|
|
3184
3380
|
if (!data.label) {
|
|
3185
3381
|
ctx.addIssue({
|
|
3186
|
-
code:
|
|
3382
|
+
code: z29.ZodIssueCode.custom,
|
|
3187
3383
|
message: "label is required when config.searchFields is defined.",
|
|
3188
3384
|
path: ["label"]
|
|
3189
3385
|
});
|
|
3190
3386
|
}
|
|
3191
3387
|
if (!data.type) {
|
|
3192
3388
|
ctx.addIssue({
|
|
3193
|
-
code:
|
|
3389
|
+
code: z29.ZodIssueCode.custom,
|
|
3194
3390
|
message: "type is required when config.searchFields is defined.",
|
|
3195
3391
|
path: ["type"]
|
|
3196
3392
|
});
|
|
3197
3393
|
}
|
|
3198
3394
|
}
|
|
3199
3395
|
});
|
|
3200
|
-
var AdvancedSearchConfig =
|
|
3396
|
+
var AdvancedSearchConfig = z29.object({
|
|
3201
3397
|
title: TranslationConfig.describe("Advanced search tab title"),
|
|
3202
|
-
fields:
|
|
3398
|
+
fields: z29.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
|
|
3203
3399
|
}).meta({
|
|
3204
3400
|
id: "AdvancedSearchConfig",
|
|
3205
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()`)."
|
|
3206
3402
|
});
|
|
3207
3403
|
|
|
3208
3404
|
// ../commons/src/events/utils.ts
|
|
3209
|
-
var
|
|
3405
|
+
var import_lodash4 = require("lodash");
|
|
3210
3406
|
|
|
3211
3407
|
// ../commons/src/conditionals/validate.ts
|
|
3212
3408
|
var import__ = __toESM(require("ajv/dist/2019"));
|
|
3213
3409
|
var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
3214
|
-
var
|
|
3215
|
-
var
|
|
3410
|
+
var z33 = __toESM(require("zod/v4"));
|
|
3411
|
+
var import_date_fns2 = require("date-fns");
|
|
3216
3412
|
|
|
3217
3413
|
// ../commons/src/events/FieldTypeMapping.ts
|
|
3218
|
-
var
|
|
3414
|
+
var z31 = __toESM(require("zod/v4"));
|
|
3219
3415
|
|
|
3220
3416
|
// ../commons/src/events/DynamicFieldValue.ts
|
|
3221
|
-
var
|
|
3417
|
+
var z30 = __toESM(require("zod/v4"));
|
|
3222
3418
|
|
|
3223
|
-
// ../commons/src/
|
|
3224
|
-
var
|
|
3225
|
-
$data: true,
|
|
3226
|
-
allowUnionTypes: true,
|
|
3227
|
-
strict: false
|
|
3228
|
-
// Allow minContains and other newer features
|
|
3229
|
-
});
|
|
3230
|
-
var DataContext = z31.object({
|
|
3231
|
-
rootData: z31.object({
|
|
3232
|
-
$leafAdminStructureLocationIds: z31.array(z31.object({ id: UUID }))
|
|
3233
|
-
})
|
|
3234
|
-
});
|
|
3235
|
-
function resolveDataPath(rootData, dataPath, instancePath) {
|
|
3236
|
-
const pathParts = dataPath.split("/");
|
|
3237
|
-
const levels = parseInt(pathParts[0], 10);
|
|
3238
|
-
const referencePath = pathParts.slice(1);
|
|
3239
|
-
const instanceParts = instancePath.split("/").filter(Boolean);
|
|
3240
|
-
const traversedParts = instanceParts.slice(0, -levels);
|
|
3241
|
-
let current = rootData;
|
|
3242
|
-
for (const part of traversedParts) {
|
|
3243
|
-
if (current === null || current === void 0) {
|
|
3244
|
-
return void 0;
|
|
3245
|
-
}
|
|
3246
|
-
current = current[part];
|
|
3247
|
-
}
|
|
3248
|
-
for (const part of referencePath) {
|
|
3249
|
-
if (current === null || current === void 0) {
|
|
3250
|
-
return void 0;
|
|
3251
|
-
}
|
|
3252
|
-
current = current[part];
|
|
3253
|
-
}
|
|
3254
|
-
return current;
|
|
3255
|
-
}
|
|
3256
|
-
function todayISO() {
|
|
3257
|
-
return (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
|
|
3258
|
-
}
|
|
3259
|
-
var compiledFunctionCache = /* @__PURE__ */ new Map();
|
|
3260
|
-
function compileClientFunction(code) {
|
|
3261
|
-
let fn = compiledFunctionCache.get(code);
|
|
3262
|
-
if (!fn) {
|
|
3263
|
-
fn = new Function(`return (${code})`)();
|
|
3264
|
-
compiledFunctionCache.set(code, fn);
|
|
3265
|
-
}
|
|
3266
|
-
return fn;
|
|
3267
|
-
}
|
|
3268
|
-
(0, import_ajv_formats.default)(ajv);
|
|
3269
|
-
function buildClientFunctionContext(input) {
|
|
3270
|
-
return {
|
|
3271
|
-
$form: input.form,
|
|
3272
|
-
$now: todayISO(),
|
|
3273
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
3274
|
-
$online: isOnline(),
|
|
3275
|
-
$user: input.validatorContext?.user,
|
|
3276
|
-
$event: input.validatorContext?.event,
|
|
3277
|
-
$leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
|
|
3278
|
-
user: input.systemVariables?.user,
|
|
3279
|
-
$window: input.systemVariables?.$window,
|
|
3280
|
-
locations: input.locations,
|
|
3281
|
-
adminLevelIds: input.adminLevelIds
|
|
3282
|
-
};
|
|
3283
|
-
}
|
|
3284
|
-
function runClientFunction(code, data, context) {
|
|
3285
|
-
return compileClientFunction(code)(data, context);
|
|
3286
|
-
}
|
|
3287
|
-
ajv.addKeyword({
|
|
3288
|
-
keyword: "daysFromDate",
|
|
3289
|
-
type: "string",
|
|
3290
|
-
schemaType: "object",
|
|
3291
|
-
$data: true,
|
|
3292
|
-
errors: true,
|
|
3293
|
-
validate(schema, data, _2, dataContext) {
|
|
3294
|
-
if (!(dataContext && dataContext.rootData && typeof dataContext.rootData === "object" && "$now" in dataContext.rootData && typeof dataContext.rootData.$now === "string")) {
|
|
3295
|
-
throw new Error("Validation context must contain $now");
|
|
3296
|
-
}
|
|
3297
|
-
const { days, clause } = schema;
|
|
3298
|
-
if (typeof data !== "string") {
|
|
3299
|
-
return false;
|
|
3300
|
-
}
|
|
3301
|
-
const date = new Date(data);
|
|
3302
|
-
if (isNaN(date.getTime())) {
|
|
3303
|
-
return false;
|
|
3304
|
-
}
|
|
3305
|
-
let referenceDate = schema.referenceDate;
|
|
3306
|
-
if (referenceDate && typeof referenceDate === "object" && "$data" in referenceDate) {
|
|
3307
|
-
referenceDate = resolveDataPath(
|
|
3308
|
-
dataContext.rootData,
|
|
3309
|
-
referenceDate.$data,
|
|
3310
|
-
dataContext.instancePath
|
|
3311
|
-
);
|
|
3312
|
-
}
|
|
3313
|
-
if (!referenceDate) {
|
|
3314
|
-
referenceDate = dataContext.rootData.$now;
|
|
3315
|
-
}
|
|
3316
|
-
const baseDate = new Date(referenceDate);
|
|
3317
|
-
if (isNaN(baseDate.getTime())) {
|
|
3318
|
-
return false;
|
|
3319
|
-
}
|
|
3320
|
-
const offsetDate = new Date(baseDate.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
3321
|
-
return clause === "after" ? (0, import_date_fns.isAfter)(date, offsetDate) : (0, import_date_fns.isBefore)(date, offsetDate);
|
|
3322
|
-
}
|
|
3323
|
-
});
|
|
3324
|
-
ajv.addKeyword({
|
|
3325
|
-
keyword: "isLeafLevelLocation",
|
|
3326
|
-
type: "string",
|
|
3327
|
-
schemaType: "boolean",
|
|
3328
|
-
$data: true,
|
|
3329
|
-
errors: true,
|
|
3330
|
-
// @ts-ignore -- Force type. We will move this away from AJV next. Parsing the array will take seconds and is only called by core.
|
|
3331
|
-
validate(_schema, data, _2, dataContext) {
|
|
3332
|
-
const locationIdInput = data;
|
|
3333
|
-
const locations = dataContext?.rootData.$leafAdminStructureLocationIds ?? [];
|
|
3334
|
-
return locations.some((location) => location.id === locationIdInput);
|
|
3335
|
-
}
|
|
3336
|
-
});
|
|
3337
|
-
ajv.addKeyword({
|
|
3338
|
-
keyword: "customClientValidator",
|
|
3339
|
-
schemaType: "object",
|
|
3340
|
-
errors: true,
|
|
3341
|
-
// @ts-expect-error -- AJV's public types don't expose `rootData`. All
|
|
3342
|
-
// `validate()` callers build root data via `buildClientFunctionContext`,
|
|
3343
|
-
// so the cast holds.
|
|
3344
|
-
validate(schema, data, _2, dataContext) {
|
|
3345
|
-
return Boolean(
|
|
3346
|
-
runClientFunction(
|
|
3347
|
-
schema.code,
|
|
3348
|
-
data,
|
|
3349
|
-
dataContext?.rootData ?? buildClientFunctionContext({ form: {} })
|
|
3350
|
-
)
|
|
3351
|
-
);
|
|
3352
|
-
}
|
|
3353
|
-
});
|
|
3354
|
-
function isOnline() {
|
|
3355
|
-
if (typeof window !== "undefined" && typeof navigator !== "undefined") {
|
|
3356
|
-
return navigator.onLine;
|
|
3357
|
-
}
|
|
3358
|
-
return true;
|
|
3359
|
-
}
|
|
3419
|
+
// ../commons/src/events/state/index.ts
|
|
3420
|
+
var import_lodash3 = require("lodash");
|
|
3360
3421
|
|
|
3361
3422
|
// ../commons/src/utils.ts
|
|
3362
3423
|
var z32 = __toESM(require("zod/v4"));
|
|
3363
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
|
+
}
|
|
3364
3434
|
var FullNameV1 = z32.array(
|
|
3365
3435
|
z32.object({
|
|
3366
3436
|
use: z32.string(),
|
|
@@ -3375,45 +3445,271 @@ function omitKeyDeep(obj, keyToRemove) {
|
|
|
3375
3445
|
if (obj === null || typeof obj !== "object") {
|
|
3376
3446
|
return obj;
|
|
3377
3447
|
}
|
|
3378
|
-
const newObj = {};
|
|
3379
|
-
for (const key of Object.keys(obj)) {
|
|
3380
|
-
if (key !== keyToRemove) {
|
|
3381
|
-
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;
|
|
3382
3633
|
}
|
|
3383
|
-
|
|
3384
|
-
|
|
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);
|
|
3385
3648
|
}
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
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
|
+
}, []);
|
|
3391
3683
|
}
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
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
|
+
];
|
|
3405
3712
|
}
|
|
3406
|
-
var findAllFields = (config) => {
|
|
3407
|
-
return (0, import_lodash.flattenDeep)([
|
|
3408
|
-
...getDeclarationFields(config),
|
|
3409
|
-
...getAllAnnotationFields(config)
|
|
3410
|
-
]);
|
|
3411
|
-
};
|
|
3412
|
-
var EXCLUDED_ACTIONS = [
|
|
3413
|
-
ActionType.REQUEST_CORRECTION,
|
|
3414
|
-
ActionType.PRINT_CERTIFICATE,
|
|
3415
|
-
ActionType.REJECT_CORRECTION
|
|
3416
|
-
];
|
|
3417
3713
|
|
|
3418
3714
|
// ../commons/src/conditionals/conditionals.ts
|
|
3419
3715
|
var objectHash = __toESM(require("object-hash"));
|
|
@@ -3621,6 +3917,33 @@ function defineComparison(field3, value, keyword) {
|
|
|
3621
3917
|
required: [field3.$$field]
|
|
3622
3918
|
});
|
|
3623
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
|
+
}
|
|
3624
3947
|
function createFieldConditionals(fieldId) {
|
|
3625
3948
|
const getDayRange = (field3, days, clause, referenceDate) => ({
|
|
3626
3949
|
type: "object",
|
|
@@ -4022,6 +4345,526 @@ function createFieldConditionals(fieldId) {
|
|
|
4022
4345
|
};
|
|
4023
4346
|
}
|
|
4024
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
|
+
|
|
4025
4868
|
// ../commons/src/events/eventConfigValidation.ts
|
|
4026
4869
|
function validateAdvancedSearchConfig(event2, ctx) {
|
|
4027
4870
|
const allFields = findAllFields(event2);
|
|
@@ -4104,9 +4947,9 @@ function validatePlaceOfEvent(event2, ctx) {
|
|
|
4104
4947
|
}
|
|
4105
4948
|
function validateActionFlags(event2, ctx) {
|
|
4106
4949
|
const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
|
|
4107
|
-
const configuredFlagIds = event2.flags.map((
|
|
4950
|
+
const configuredFlagIds = event2.flags.map((flag2) => flag2.id);
|
|
4108
4951
|
const actionFlagIds = event2.actions.flatMap(
|
|
4109
|
-
(action) => (action.flags ?? []).map((
|
|
4952
|
+
(action) => (action.flags ?? []).map((flag2) => flag2.id)
|
|
4110
4953
|
);
|
|
4111
4954
|
for (const actionFlagId of actionFlagIds) {
|
|
4112
4955
|
const isConfigured = configuredFlagIds.includes(actionFlagId);
|
|
@@ -4142,11 +4985,11 @@ function validateActionOrder(event2, ctx) {
|
|
|
4142
4985
|
}
|
|
4143
4986
|
|
|
4144
4987
|
// ../commons/src/events/EventConfig.ts
|
|
4145
|
-
var EventFieldReference =
|
|
4988
|
+
var EventFieldReference = z34.object({ $$event: EventMetadataDateFieldIdInput }).describe(
|
|
4146
4989
|
"Reference to a field defined in the event metadata, using the field id."
|
|
4147
4990
|
);
|
|
4148
|
-
var _EventConfigBase =
|
|
4149
|
-
id:
|
|
4991
|
+
var _EventConfigBase = z34.object({
|
|
4992
|
+
id: z34.string().describe(
|
|
4150
4993
|
'Machine-readable identifier of the event (e.g. "birth", "death").'
|
|
4151
4994
|
),
|
|
4152
4995
|
dateOfEvent: FieldReference.or(EventFieldReference).optional().describe(
|
|
@@ -4165,23 +5008,26 @@ var _EventConfigBase = z33.object({
|
|
|
4165
5008
|
"Summary information displayed in the event overview."
|
|
4166
5009
|
),
|
|
4167
5010
|
label: TranslationConfig.describe("Human-readable label for the event type."),
|
|
4168
|
-
actions:
|
|
5011
|
+
actions: z34.array(ActionConfig).describe(
|
|
4169
5012
|
"Configuration of core and custom actions associated with the event."
|
|
4170
5013
|
),
|
|
4171
|
-
actionOrder:
|
|
5014
|
+
actionOrder: z34.array(z34.string()).optional().describe(
|
|
4172
5015
|
"Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
|
|
4173
5016
|
),
|
|
4174
5017
|
declaration: DeclarationFormConfig.describe(
|
|
4175
5018
|
"Configuration of the form used to gather event data."
|
|
4176
5019
|
),
|
|
4177
|
-
advancedSearch:
|
|
5020
|
+
advancedSearch: z34.array(AdvancedSearchConfig).optional().default([]).describe(
|
|
4178
5021
|
"Configuration of fields available in the advanced search feature."
|
|
4179
5022
|
),
|
|
4180
|
-
flags:
|
|
5023
|
+
flags: z34.array(FlagConfig).optional().default([]).describe(
|
|
4181
5024
|
"Configuration of custom flags associated with the actions of this event type."
|
|
4182
5025
|
),
|
|
4183
|
-
analytics:
|
|
5026
|
+
analytics: z34.boolean().optional().default(true).describe(
|
|
4184
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.'
|
|
4185
5031
|
)
|
|
4186
5032
|
});
|
|
4187
5033
|
var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
|
|
@@ -4398,21 +5244,31 @@ var event = Object.assign(eventFn, {
|
|
|
4398
5244
|
return {
|
|
4399
5245
|
$event: field3
|
|
4400
5246
|
};
|
|
4401
|
-
}
|
|
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)
|
|
4402
5258
|
});
|
|
4403
5259
|
|
|
4404
5260
|
// ../commons/src/events/WorkqueueColumnConfig.ts
|
|
4405
|
-
var
|
|
5261
|
+
var z35 = __toESM(require("zod/v4"));
|
|
4406
5262
|
var WorkqueueColumnKeysArray = [
|
|
4407
5263
|
...EventMetadataKeysArray,
|
|
4408
5264
|
"title",
|
|
4409
5265
|
"outbox"
|
|
4410
5266
|
];
|
|
4411
|
-
var WorkqueueColumnKeys =
|
|
4412
|
-
var WorkqueueColumnValue =
|
|
5267
|
+
var WorkqueueColumnKeys = z35.enum(WorkqueueColumnKeysArray);
|
|
5268
|
+
var WorkqueueColumnValue = z35.object({
|
|
4413
5269
|
$event: WorkqueueColumnKeys
|
|
4414
5270
|
});
|
|
4415
|
-
var WorkqueueColumn =
|
|
5271
|
+
var WorkqueueColumn = z35.object({
|
|
4416
5272
|
label: TranslationConfig,
|
|
4417
5273
|
value: WorkqueueColumnValue
|
|
4418
5274
|
}).meta({
|
|
@@ -4426,164 +5282,56 @@ function defineWorkqueuesColumns(workqueueColumns) {
|
|
|
4426
5282
|
}
|
|
4427
5283
|
|
|
4428
5284
|
// ../commons/src/events/CountryConfigQueryInput.ts
|
|
4429
|
-
var
|
|
4430
|
-
var SerializableExact =
|
|
4431
|
-
type:
|
|
4432
|
-
term:
|
|
4433
|
-
});
|
|
4434
|
-
var SerializableWithin =
|
|
4435
|
-
type:
|
|
4436
|
-
location:
|
|
4437
|
-
});
|
|
4438
|
-
var SerializedQueryExpression =
|
|
4439
|
-
eventType:
|
|
4440
|
-
status:
|
|
4441
|
-
createdAt:
|
|
4442
|
-
updatedAt:
|
|
4443
|
-
"legalStatuses.DECLARED.createdAtLocation":
|
|
4444
|
-
"legalStatuses.DECLARED.createdByRole":
|
|
4445
|
-
"legalStatuses.REGISTERED.createdAt":
|
|
4446
|
-
"legalStatuses.REGISTERED.createdAtLocation":
|
|
4447
|
-
"legalStatuses.REGISTERED.createdByRole":
|
|
4448
|
-
"legalStatuses.REGISTERED.registrationNumber":
|
|
4449
|
-
createdAtLocation:
|
|
4450
|
-
|
|
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])
|
|
4451
5307
|
),
|
|
4452
|
-
updatedAtLocation:
|
|
4453
|
-
|
|
5308
|
+
updatedAtLocation: z36.optional(
|
|
5309
|
+
z36.union([SerializableWithin, SerializableExact])
|
|
4454
5310
|
),
|
|
4455
|
-
updatedByUserRole:
|
|
4456
|
-
assignedTo:
|
|
4457
|
-
createdBy:
|
|
5311
|
+
updatedByUserRole: z36.optional(SerializableExact),
|
|
5312
|
+
assignedTo: z36.optional(SerializableExact),
|
|
5313
|
+
createdBy: z36.optional(SerializableExact),
|
|
4458
5314
|
createdByUserType: ExactUserType,
|
|
4459
|
-
updatedBy:
|
|
4460
|
-
trackingId:
|
|
4461
|
-
flags:
|
|
5315
|
+
updatedBy: z36.optional(SerializableExact),
|
|
5316
|
+
trackingId: z36.optional(Exact),
|
|
5317
|
+
flags: z36.optional(ContainsFlags),
|
|
4462
5318
|
data: QueryInput
|
|
4463
5319
|
}).partial();
|
|
4464
|
-
var Or2 =
|
|
4465
|
-
type:
|
|
4466
|
-
clauses:
|
|
5320
|
+
var Or2 = z36.object({
|
|
5321
|
+
type: z36.literal("or"),
|
|
5322
|
+
clauses: z36.array(SerializedQueryExpression)
|
|
4467
5323
|
});
|
|
4468
|
-
var And2 =
|
|
4469
|
-
type:
|
|
4470
|
-
clauses:
|
|
5324
|
+
var And2 = z36.object({
|
|
5325
|
+
type: z36.literal("and"),
|
|
5326
|
+
clauses: z36.array(SerializedQueryExpression)
|
|
4471
5327
|
});
|
|
4472
|
-
var CountryConfigQueryType =
|
|
4473
|
-
var CountryConfigQueryInputType =
|
|
5328
|
+
var CountryConfigQueryType = z36.discriminatedUnion("type", [And2, Or2]);
|
|
5329
|
+
var CountryConfigQueryInputType = z36.union([
|
|
4474
5330
|
SerializedQueryExpression,
|
|
4475
5331
|
And2,
|
|
4476
5332
|
Or2
|
|
4477
5333
|
]);
|
|
4478
5334
|
|
|
4479
|
-
// ../commons/src/icons.ts
|
|
4480
|
-
var z36 = __toESM(require("zod/v4"));
|
|
4481
|
-
var AvailableIcons = z36.enum([
|
|
4482
|
-
"Archived",
|
|
4483
|
-
"Assigned",
|
|
4484
|
-
"Briefcase",
|
|
4485
|
-
"Certified",
|
|
4486
|
-
"Close",
|
|
4487
|
-
"Collapse",
|
|
4488
|
-
"Draft",
|
|
4489
|
-
"DuplicateYellow",
|
|
4490
|
-
"Expand",
|
|
4491
|
-
"ExternalValidate",
|
|
4492
|
-
"FilledCheck",
|
|
4493
|
-
"InReview",
|
|
4494
|
-
"Offline",
|
|
4495
|
-
"Registered",
|
|
4496
|
-
"RequiresUpdates",
|
|
4497
|
-
"Sent",
|
|
4498
|
-
"Validated",
|
|
4499
|
-
"WaitingApproval",
|
|
4500
|
-
"ChartActivity",
|
|
4501
|
-
"Activity",
|
|
4502
|
-
"Archive",
|
|
4503
|
-
"ArchiveTray",
|
|
4504
|
-
"ArrowLeft",
|
|
4505
|
-
"ArrowRight",
|
|
4506
|
-
"Buildings",
|
|
4507
|
-
"Circle",
|
|
4508
|
-
"CaretDown",
|
|
4509
|
-
"CaretLeft",
|
|
4510
|
-
"CaretRight",
|
|
4511
|
-
"ChartBar",
|
|
4512
|
-
"ChartLine",
|
|
4513
|
-
"ChatCircle",
|
|
4514
|
-
"CheckSquare",
|
|
4515
|
-
"Compass",
|
|
4516
|
-
"Check",
|
|
4517
|
-
"Copy",
|
|
4518
|
-
"Database",
|
|
4519
|
-
"DotsThreeVertical",
|
|
4520
|
-
"ArrowCounterClockwise",
|
|
4521
|
-
"MagnifyingGlassMinus",
|
|
4522
|
-
"MagnifyingGlassPlus",
|
|
4523
|
-
"Export",
|
|
4524
|
-
"Eye",
|
|
4525
|
-
"EyeSlash",
|
|
4526
|
-
"Envelope",
|
|
4527
|
-
"File",
|
|
4528
|
-
"FileSearch",
|
|
4529
|
-
"FileMinus",
|
|
4530
|
-
"FilePlus",
|
|
4531
|
-
"FileText",
|
|
4532
|
-
"FileX",
|
|
4533
|
-
"Handshake",
|
|
4534
|
-
"Gear",
|
|
4535
|
-
"GitBranch",
|
|
4536
|
-
"IdentificationCard",
|
|
4537
|
-
"List",
|
|
4538
|
-
"ListBullets",
|
|
4539
|
-
"Lock",
|
|
4540
|
-
"MagnifyingGlass",
|
|
4541
|
-
"MapPin",
|
|
4542
|
-
"Medal",
|
|
4543
|
-
"NotePencil",
|
|
4544
|
-
"Paperclip",
|
|
4545
|
-
"PaperPlaneTilt",
|
|
4546
|
-
"Pen",
|
|
4547
|
-
"PenNib",
|
|
4548
|
-
"Pencil",
|
|
4549
|
-
"PencilSimpleLine",
|
|
4550
|
-
"Phone",
|
|
4551
|
-
"Plus",
|
|
4552
|
-
"Printer",
|
|
4553
|
-
"SignOut",
|
|
4554
|
-
"Stamp",
|
|
4555
|
-
"Star",
|
|
4556
|
-
"Target",
|
|
4557
|
-
"TextT",
|
|
4558
|
-
"Trash",
|
|
4559
|
-
"UploadSimple",
|
|
4560
|
-
"User",
|
|
4561
|
-
"UserPlus",
|
|
4562
|
-
"Users",
|
|
4563
|
-
"WarningCircle",
|
|
4564
|
-
"X",
|
|
4565
|
-
"ChatText",
|
|
4566
|
-
"CircleWavyCheck",
|
|
4567
|
-
"CircleWavyQuestion",
|
|
4568
|
-
"ArchiveBox",
|
|
4569
|
-
"ArrowCircleDown",
|
|
4570
|
-
"FileArrowUp",
|
|
4571
|
-
"FileDotted",
|
|
4572
|
-
"Files",
|
|
4573
|
-
"PencilLine",
|
|
4574
|
-
"PencilCircle",
|
|
4575
|
-
"UserCircle",
|
|
4576
|
-
"Clock",
|
|
4577
|
-
"QrCode",
|
|
4578
|
-
"Webcam",
|
|
4579
|
-
"Sun",
|
|
4580
|
-
"DeviceTabletCamera",
|
|
4581
|
-
"Globe",
|
|
4582
|
-
"Fingerprint",
|
|
4583
|
-
"PushPin",
|
|
4584
|
-
"Timer"
|
|
4585
|
-
]);
|
|
4586
|
-
|
|
4587
5335
|
// ../commons/src/events/WorkqueueConfig.ts
|
|
4588
5336
|
var mandatoryColumns = defineWorkqueuesColumns([
|
|
4589
5337
|
{
|
|
@@ -4863,14 +5611,14 @@ var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
|
|
|
4863
5611
|
|
|
4864
5612
|
// ../commons/src/events/EventInput.ts
|
|
4865
5613
|
var z40 = __toESM(require("zod/v4"));
|
|
4866
|
-
var
|
|
5614
|
+
var import_uuid11 = require("uuid");
|
|
4867
5615
|
var EventInput = z40.object({
|
|
4868
5616
|
transactionId: z40.string(),
|
|
4869
5617
|
type: z40.string(),
|
|
4870
5618
|
createdAtLocation: UUID.nullish().describe(
|
|
4871
5619
|
"Location where the event occurred. Required for system users."
|
|
4872
5620
|
)
|
|
4873
|
-
}).meta({ default: { transactionId: (0,
|
|
5621
|
+
}).meta({ default: { transactionId: (0, import_uuid11.v4)(), type: "birth" } });
|
|
4874
5622
|
|
|
4875
5623
|
// ../commons/src/events/EventDocument.ts
|
|
4876
5624
|
var z41 = __toESM(require("zod/v4"));
|
|
@@ -4887,67 +5635,6 @@ var EventDocument = z41.object({
|
|
|
4887
5635
|
)
|
|
4888
5636
|
}).meta({ id: "EventDocument" });
|
|
4889
5637
|
|
|
4890
|
-
// ../commons/src/events/state/index.ts
|
|
4891
|
-
var import_lodash4 = require("lodash");
|
|
4892
|
-
|
|
4893
|
-
// ../commons/src/events/state/utils.ts
|
|
4894
|
-
var import_lodash2 = require("lodash");
|
|
4895
|
-
var updateActions = ActionTypes.extract([
|
|
4896
|
-
ActionType.CREATE,
|
|
4897
|
-
ActionType.NOTIFY,
|
|
4898
|
-
ActionType.EDIT,
|
|
4899
|
-
ActionType.DECLARE,
|
|
4900
|
-
ActionType.REGISTER,
|
|
4901
|
-
ActionType.REJECT,
|
|
4902
|
-
ActionType.ARCHIVE,
|
|
4903
|
-
ActionType.UNARCHIVE,
|
|
4904
|
-
ActionType.PRINT_CERTIFICATE,
|
|
4905
|
-
ActionType.REQUEST_CORRECTION,
|
|
4906
|
-
ActionType.APPROVE_CORRECTION,
|
|
4907
|
-
ActionType.REJECT_CORRECTION,
|
|
4908
|
-
ActionType.CUSTOM
|
|
4909
|
-
]);
|
|
4910
|
-
|
|
4911
|
-
// ../commons/src/events/state/flags.ts
|
|
4912
|
-
var import_lodash3 = require("lodash");
|
|
4913
|
-
var import_date_fns3 = require("date-fns");
|
|
4914
|
-
var INHERENT_FLAG_RULES = [
|
|
4915
|
-
{
|
|
4916
|
-
flag: InherentFlags.CORRECTION_REQUESTED,
|
|
4917
|
-
setOn: [ActionType.REQUEST_CORRECTION],
|
|
4918
|
-
resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
|
|
4919
|
-
},
|
|
4920
|
-
{
|
|
4921
|
-
// INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
|
|
4922
|
-
// other status-changing action (see getStatusFromActions). ARCHIVE/UNARCHIVE
|
|
4923
|
-
// are deliberately excluded so the flag freezes across an archive/unarchive
|
|
4924
|
-
// round trip and comes back exactly as it was.
|
|
4925
|
-
flag: InherentFlags.INCOMPLETE,
|
|
4926
|
-
setOn: [ActionType.NOTIFY],
|
|
4927
|
-
resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
|
|
4928
|
-
},
|
|
4929
|
-
{
|
|
4930
|
-
flag: InherentFlags.REJECTED,
|
|
4931
|
-
setOn: [ActionType.REJECT],
|
|
4932
|
-
resetOn: [
|
|
4933
|
-
ActionType.NOTIFY,
|
|
4934
|
-
ActionType.DECLARE,
|
|
4935
|
-
ActionType.EDIT,
|
|
4936
|
-
ActionType.REGISTER
|
|
4937
|
-
]
|
|
4938
|
-
},
|
|
4939
|
-
{
|
|
4940
|
-
flag: InherentFlags.POTENTIAL_DUPLICATE,
|
|
4941
|
-
setOn: [ActionType.DUPLICATE_DETECTED],
|
|
4942
|
-
resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
|
|
4943
|
-
},
|
|
4944
|
-
{
|
|
4945
|
-
flag: InherentFlags.EDIT_IN_PROGRESS,
|
|
4946
|
-
setOn: [ActionType.EDIT],
|
|
4947
|
-
resetOnAnyOtherAction: true
|
|
4948
|
-
}
|
|
4949
|
-
];
|
|
4950
|
-
|
|
4951
5638
|
// ../commons/src/events/defineConfig.ts
|
|
4952
5639
|
var IGNORED_EVENT_TYPES = [
|
|
4953
5640
|
"FOOTBALL_CLUB_MEMBERSHIP",
|
|
@@ -7445,6 +8132,31 @@ var Location = z43.object({
|
|
|
7445
8132
|
status: LocationStatus,
|
|
7446
8133
|
versions: z43.array(LocationVersion)
|
|
7447
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
|
+
}
|
|
7448
8160
|
var SetLocationPayload = z43.object({
|
|
7449
8161
|
id: UUID,
|
|
7450
8162
|
name: z43.string(),
|
|
@@ -7529,20 +8241,20 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
|
7529
8241
|
]
|
|
7530
8242
|
};
|
|
7531
8243
|
var ACTION_FILTERS = {
|
|
7532
|
-
[ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
7533
|
-
[ActionType.REQUEST_CORRECTION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
7534
|
-
[ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
7535
|
-
[ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
7536
|
-
[ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
7537
|
-
[ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((
|
|
7538
|
-
[ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((
|
|
7539
|
-
[ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((
|
|
7540
|
-
[ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((
|
|
7541
|
-
[ActionType.ARCHIVE]: (flags) => !flags.some((
|
|
7542
|
-
[ActionType.UNARCHIVE]: (flags) => !flags.some((
|
|
7543
|
-
[ActionType.ASSIGN]: (flags) => !flags.some((
|
|
7544
|
-
[ActionType.UNASSIGN]: (flags) => !flags.some((
|
|
7545
|
-
[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"))
|
|
7546
8258
|
};
|
|
7547
8259
|
var REJECTED_ACTIONS = [
|
|
7548
8260
|
ActionType.READ,
|
|
@@ -7887,6 +8599,15 @@ var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
|
|
|
7887
8599
|
var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
|
|
7888
8600
|
V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
|
|
7889
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
|
+
);
|
|
7890
8611
|
|
|
7891
8612
|
// ../commons/src/events/locationPayloads.ts
|
|
7892
8613
|
var z44 = __toESM(require("zod/v4"));
|