@opencrvs/toolkit 2.1.0-rc.76bdaaf → 2.1.0-rc.7737766
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/build.sh +9 -1
- package/create-countryconfig/index.js +412 -59
- package/create-countryconfig/node_modules/.bin/degit +21 -0
- package/create-countryconfig/package.json +4 -1
- package/dist/application-config/index.js +347 -276
- package/dist/authentication/index.d.ts +67 -0
- package/dist/authentication/index.d.ts.map +1 -0
- package/dist/authentication/index.js +754 -0
- package/dist/cli.js +1782 -113
- package/dist/commons/api/router.d.ts +697 -78
- package/dist/commons/conditionals/conditionals.d.ts +6 -6
- package/dist/commons/conditionals/validate.d.ts +16 -5
- package/dist/commons/events/ActionConfig.d.ts +4 -0
- package/dist/commons/events/ActionDocument.d.ts +5 -11
- package/dist/commons/events/ActionInput.d.ts +4 -4
- package/dist/commons/events/ActionStatus.d.ts +14 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +36 -0
- package/dist/commons/events/AuditLog.d.ts +147 -0
- package/dist/commons/events/EventConfig.d.ts +3 -0
- package/dist/commons/events/EventDocument.d.ts +470 -2
- package/dist/commons/events/EventIndex.d.ts +3 -26
- package/dist/commons/events/EventMetadata.d.ts +1 -11
- package/dist/commons/events/EventStatus.d.ts +19 -0
- package/dist/commons/events/FieldConfig.d.ts +98 -53
- package/dist/commons/events/FieldTypeMapping.d.ts +27 -27
- package/dist/commons/events/FieldValue.d.ts +2 -2
- package/dist/commons/events/Flag.d.ts +42 -0
- package/dist/commons/events/FormConfig.d.ts +6 -0
- package/dist/commons/events/PageConfig.d.ts +4 -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/index.d.ts +1 -0
- package/dist/commons/events/locationPayloads.d.ts +95 -0
- package/dist/commons/events/locations.d.ts +169 -26
- package/dist/commons/events/mocks.test.utils.d.ts +30 -0
- package/dist/commons/events/test.utils.d.ts +25 -4
- package/dist/commons/events/utils.d.ts +17 -2
- package/dist/commons/notification/UserNotifications.d.ts +28 -13
- package/dist/commons/notification/dispatch.d.ts +10 -0
- package/dist/commons/notification/index.d.ts +1 -0
- package/dist/conditionals/index.js +334 -60
- package/dist/csv.d.ts +25 -0
- package/dist/csv.d.ts.map +1 -0
- package/dist/csv.js +120 -0
- 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 +15 -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/questions.d.ts.map +1 -1
- package/dist/environment/questions.js +20 -14
- package/dist/environment/setup-environment.js +28 -7
- package/dist/environment/templates.d.ts.map +1 -1
- package/dist/environment/templates.js +2 -1
- package/dist/environment/update-workflows.d.ts.map +1 -1
- package/dist/environment/update-workflows.js +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 +7660 -7151
- 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/migrations/v2.0/merge-infrastructure-directory.js +3 -3
- package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts +3 -0
- package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts.map +1 -0
- package/dist/migrations/v2.1/add-recovery-link-notifications.js +511 -0
- package/dist/migrations/v2.1/add-translations.d.ts +9 -0
- package/dist/migrations/v2.1/add-translations.d.ts.map +1 -0
- package/dist/migrations/v2.1/add-translations.js +213 -0
- package/dist/migrations/v2.1/enable-telemetry.d.ts +3 -0
- package/dist/migrations/v2.1/enable-telemetry.d.ts.map +1 -0
- package/dist/migrations/v2.1/enable-telemetry.js +438 -0
- package/dist/migrations/v2.1/index.d.ts.map +1 -1
- package/dist/migrations/v2.1/index.js +1058 -0
- package/dist/notification/index.js +1835 -1420
- package/dist/scopes/index.d.ts +435 -32
- package/dist/scopes/index.js +335 -60
- package/dist/telemetry/index.d.ts +45 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +39 -0
- package/dist/templates/charts-values/dependencies/values.yaml +2 -0
- package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -3
- package/dist/templates/charts-values/opentelemetry/values.yaml +95 -0
- package/dist/templates/charts-values/traefik/values.yaml +23 -9
- package/dist/templates/inventory/inventory.template.yml +1 -3
- package/dist/translations/check.d.ts +21 -0
- package/dist/translations/check.d.ts.map +1 -0
- package/dist/translations/check.js +132 -0
- package/dist/verify/endpoints.d.ts +2 -0
- package/dist/verify/endpoints.d.ts.map +1 -0
- package/dist/verify/endpoints.js +345 -0
- package/opencrvs-toolkit-2.1.0-rc.7737766.tgz +0 -0
- package/package.json +12 -7
- package/tsconfig.build.json +11 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +3 -0
- package/dist/templates/inventory/production.example.yml +0 -77
- package/dist/templates/inventory/qa.example.yml +0 -48
- package/opencrvs-toolkit-2.1.0-rc.76bdaaf.tgz +0 -0
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -38,23 +38,17 @@ __export(notification_exports, {
|
|
|
38
38
|
triggerUserEventNotification: () => triggerUserEventNotification
|
|
39
39
|
});
|
|
40
40
|
module.exports = __toCommonJS(notification_exports);
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
// ../commons/src/url.ts
|
|
44
|
-
function joinUrl(base, path) {
|
|
45
|
-
const baseWithSlash = base.endsWith("/") ? base : base + "/";
|
|
46
|
-
return new URL(path, baseWithSlash);
|
|
47
|
-
}
|
|
41
|
+
var z47 = __toESM(require("zod/v4"));
|
|
48
42
|
|
|
49
43
|
// ../commons/src/events/AuditLog.ts
|
|
50
|
-
var
|
|
44
|
+
var z9 = __toESM(require("zod/v4"));
|
|
51
45
|
|
|
52
46
|
// ../commons/src/authentication.ts
|
|
53
47
|
var import_jwt_decode = __toESM(require("jwt-decode"));
|
|
54
|
-
var
|
|
48
|
+
var z8 = __toESM(require("zod/v4"));
|
|
55
49
|
|
|
56
50
|
// ../commons/src/scopes.ts
|
|
57
|
-
var
|
|
51
|
+
var z7 = __toESM(require("zod/v4"));
|
|
58
52
|
var qs = __toESM(require("qs"));
|
|
59
53
|
|
|
60
54
|
// ../commons/src/uuid.ts
|
|
@@ -65,12 +59,270 @@ function getUUID() {
|
|
|
65
59
|
return (0, import_uuid.v4)();
|
|
66
60
|
}
|
|
67
61
|
|
|
62
|
+
// ../commons/src/events/ActionType.ts
|
|
63
|
+
var z2 = __toESM(require("zod/v4"));
|
|
64
|
+
var ActionType = {
|
|
65
|
+
// Pre-declaration actions
|
|
66
|
+
DELETE: "DELETE",
|
|
67
|
+
CREATE: "CREATE",
|
|
68
|
+
NOTIFY: "NOTIFY",
|
|
69
|
+
// Declaration actions
|
|
70
|
+
DECLARE: "DECLARE",
|
|
71
|
+
REGISTER: "REGISTER",
|
|
72
|
+
EDIT: "EDIT",
|
|
73
|
+
// Declaration system actions. Non-configurable.
|
|
74
|
+
DUPLICATE_DETECTED: "DUPLICATE_DETECTED",
|
|
75
|
+
REJECT: "REJECT",
|
|
76
|
+
// REJECT_DECLARATION
|
|
77
|
+
MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
|
|
78
|
+
MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
|
|
79
|
+
ARCHIVE: "ARCHIVE",
|
|
80
|
+
UNARCHIVE: "UNARCHIVE",
|
|
81
|
+
// Record actions
|
|
82
|
+
PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
|
|
83
|
+
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
|
84
|
+
REJECT_CORRECTION: "REJECT_CORRECTION",
|
|
85
|
+
APPROVE_CORRECTION: "APPROVE_CORRECTION",
|
|
86
|
+
// General actions
|
|
87
|
+
READ: "READ",
|
|
88
|
+
ASSIGN: "ASSIGN",
|
|
89
|
+
UNASSIGN: "UNASSIGN",
|
|
90
|
+
// Custom action
|
|
91
|
+
CUSTOM: "CUSTOM"
|
|
92
|
+
};
|
|
93
|
+
var ConfirmableActions = [
|
|
94
|
+
ActionType.NOTIFY,
|
|
95
|
+
ActionType.DECLARE,
|
|
96
|
+
ActionType.EDIT,
|
|
97
|
+
ActionType.REGISTER,
|
|
98
|
+
ActionType.REJECT,
|
|
99
|
+
ActionType.ARCHIVE,
|
|
100
|
+
ActionType.UNARCHIVE,
|
|
101
|
+
ActionType.PRINT_CERTIFICATE,
|
|
102
|
+
ActionType.REQUEST_CORRECTION,
|
|
103
|
+
ActionType.APPROVE_CORRECTION,
|
|
104
|
+
ActionType.REJECT_CORRECTION,
|
|
105
|
+
ActionType.CUSTOM
|
|
106
|
+
];
|
|
107
|
+
var ActionTypes = z2.enum([
|
|
108
|
+
"DELETE",
|
|
109
|
+
"CREATE",
|
|
110
|
+
"NOTIFY",
|
|
111
|
+
"DECLARE",
|
|
112
|
+
"EDIT",
|
|
113
|
+
"REGISTER",
|
|
114
|
+
"DUPLICATE_DETECTED",
|
|
115
|
+
"REJECT",
|
|
116
|
+
"MARK_AS_DUPLICATE",
|
|
117
|
+
"MARK_AS_NOT_DUPLICATE",
|
|
118
|
+
"ARCHIVE",
|
|
119
|
+
"UNARCHIVE",
|
|
120
|
+
"PRINT_CERTIFICATE",
|
|
121
|
+
"REQUEST_CORRECTION",
|
|
122
|
+
"REJECT_CORRECTION",
|
|
123
|
+
"APPROVE_CORRECTION",
|
|
124
|
+
"READ",
|
|
125
|
+
"ASSIGN",
|
|
126
|
+
"UNASSIGN",
|
|
127
|
+
"CUSTOM"
|
|
128
|
+
]);
|
|
129
|
+
var ClientSpecificAction = {
|
|
130
|
+
REVIEW_CORRECTION_REQUEST: "REVIEW_CORRECTION_REQUEST"
|
|
131
|
+
};
|
|
132
|
+
var declarationActionValues = [
|
|
133
|
+
ActionTypes.enum.DECLARE,
|
|
134
|
+
ActionTypes.enum.EDIT,
|
|
135
|
+
ActionTypes.enum.REGISTER,
|
|
136
|
+
ActionTypes.enum.NOTIFY,
|
|
137
|
+
ActionTypes.enum.DUPLICATE_DETECTED
|
|
138
|
+
];
|
|
139
|
+
var DeclarationActions = ActionTypes.extract(declarationActionValues);
|
|
140
|
+
var declarationUpdateActionValues = [
|
|
141
|
+
...declarationActionValues,
|
|
142
|
+
ActionTypes.enum.REQUEST_CORRECTION
|
|
143
|
+
];
|
|
144
|
+
var DeclarationUpdateActions = ActionTypes.extract(
|
|
145
|
+
declarationUpdateActionValues
|
|
146
|
+
);
|
|
147
|
+
var annotationActions = ActionTypes.exclude(declarationActionValues);
|
|
148
|
+
var writeActions = ActionTypes.exclude([
|
|
149
|
+
ActionType.CREATE,
|
|
150
|
+
ActionType.READ,
|
|
151
|
+
ActionType.ASSIGN,
|
|
152
|
+
ActionType.UNASSIGN
|
|
153
|
+
]);
|
|
154
|
+
var WorkqueueActionType = ActionTypes.extract([
|
|
155
|
+
ActionType.READ,
|
|
156
|
+
ActionType.DELETE,
|
|
157
|
+
ActionType.DECLARE,
|
|
158
|
+
ActionType.REGISTER,
|
|
159
|
+
ActionType.EDIT,
|
|
160
|
+
ActionType.REJECT,
|
|
161
|
+
ActionType.MARK_AS_DUPLICATE,
|
|
162
|
+
ActionType.ARCHIVE,
|
|
163
|
+
ActionType.UNARCHIVE,
|
|
164
|
+
ActionType.PRINT_CERTIFICATE,
|
|
165
|
+
ActionType.REQUEST_CORRECTION
|
|
166
|
+
]);
|
|
167
|
+
var META_ACTIONS = [
|
|
168
|
+
ActionType.ASSIGN,
|
|
169
|
+
ActionType.UNASSIGN,
|
|
170
|
+
ActionType.READ
|
|
171
|
+
];
|
|
172
|
+
|
|
173
|
+
// ../commons/src/events/ActionStatus.ts
|
|
174
|
+
var ActionStatus = {
|
|
175
|
+
Requested: "Requested",
|
|
176
|
+
Accepted: "Accepted",
|
|
177
|
+
Rejected: "Rejected"
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
// ../commons/src/events/Flag.ts
|
|
181
|
+
var z5 = __toESM(require("zod/v4"));
|
|
182
|
+
|
|
183
|
+
// ../commons/src/events/TranslationConfig.ts
|
|
184
|
+
var z3 = __toESM(require("zod/v4"));
|
|
185
|
+
var TranslationConfig = z3.object({
|
|
186
|
+
id: z3.string().describe(
|
|
187
|
+
"The identifier of the translation referred in translation CSV files"
|
|
188
|
+
),
|
|
189
|
+
defaultMessage: z3.string().describe("Default translation message"),
|
|
190
|
+
description: z3.string().describe(
|
|
191
|
+
"Describe the translation for a translator to be able to identify it."
|
|
192
|
+
)
|
|
193
|
+
}).meta({
|
|
194
|
+
description: "Translation configuration",
|
|
195
|
+
id: "TranslationConfig"
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
// ../commons/src/events/Conditional.ts
|
|
199
|
+
var z4 = __toESM(require("zod/v4"));
|
|
200
|
+
var Conditional = z4.any().describe("JSONSchema").meta({
|
|
201
|
+
description: "JSON schema conditional configuration",
|
|
202
|
+
id: "Conditional"
|
|
203
|
+
});
|
|
204
|
+
var ConditionalType = {
|
|
205
|
+
SHOW: "SHOW",
|
|
206
|
+
ENABLE: "ENABLE",
|
|
207
|
+
DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
|
|
208
|
+
};
|
|
209
|
+
var ShowConditional = z4.object({
|
|
210
|
+
type: z4.literal(ConditionalType.SHOW),
|
|
211
|
+
conditional: Conditional
|
|
212
|
+
}).describe(
|
|
213
|
+
"If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
|
|
214
|
+
);
|
|
215
|
+
var EnableConditional = z4.object({
|
|
216
|
+
type: z4.literal(ConditionalType.ENABLE),
|
|
217
|
+
conditional: Conditional
|
|
218
|
+
}).describe(
|
|
219
|
+
"If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
|
|
220
|
+
);
|
|
221
|
+
var ActionConditional = z4.discriminatedUnion("type", [
|
|
222
|
+
// Action can be shown / hidden
|
|
223
|
+
ShowConditional,
|
|
224
|
+
// Action can be shown to the user in the list but as disabled
|
|
225
|
+
EnableConditional
|
|
226
|
+
]).meta({
|
|
227
|
+
id: "ActionConditional",
|
|
228
|
+
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."
|
|
229
|
+
});
|
|
230
|
+
var DisplayOnReviewConditional = z4.object({
|
|
231
|
+
type: z4.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
232
|
+
conditional: Conditional
|
|
233
|
+
}).describe(
|
|
234
|
+
"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."
|
|
235
|
+
);
|
|
236
|
+
var FieldConditional = z4.discriminatedUnion("type", [
|
|
237
|
+
// Field input can be shown / hidden
|
|
238
|
+
ShowConditional,
|
|
239
|
+
// Field input can be shown to the user but as disabled
|
|
240
|
+
EnableConditional,
|
|
241
|
+
// Field output can be shown / hidden on the review page
|
|
242
|
+
DisplayOnReviewConditional
|
|
243
|
+
]).meta({
|
|
244
|
+
id: "FieldConditional",
|
|
245
|
+
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."
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
// ../commons/src/events/Flag.ts
|
|
249
|
+
var InherentFlags = {
|
|
250
|
+
INCOMPLETE: "incomplete",
|
|
251
|
+
REJECTED: "rejected",
|
|
252
|
+
CORRECTION_REQUESTED: "correction-requested",
|
|
253
|
+
POTENTIAL_DUPLICATE: "potential-duplicate",
|
|
254
|
+
/**
|
|
255
|
+
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
256
|
+
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
257
|
+
*
|
|
258
|
+
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
259
|
+
*/
|
|
260
|
+
EDIT_IN_PROGRESS: "edit-in-progress"
|
|
261
|
+
};
|
|
262
|
+
var actionFlagPattern;
|
|
263
|
+
function getActionFlagPattern() {
|
|
264
|
+
actionFlagPattern ??= new RegExp(
|
|
265
|
+
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
266
|
+
ActionStatus
|
|
267
|
+
).join("|").toLowerCase()})$`
|
|
268
|
+
);
|
|
269
|
+
return actionFlagPattern;
|
|
270
|
+
}
|
|
271
|
+
var ActionFlag = z5.string().refine((value) => getActionFlagPattern().test(value), {
|
|
272
|
+
message: "Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
273
|
+
});
|
|
274
|
+
var CustomFlag = z5.string().refine((val) => !Object.values(InherentFlags).includes(val), {
|
|
275
|
+
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
276
|
+
InherentFlags
|
|
277
|
+
).join(", ")}`
|
|
278
|
+
}).refine((val) => !ActionFlag.safeParse(val).success, {
|
|
279
|
+
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
280
|
+
}).describe("Custom flag identifier defined by the country config.");
|
|
281
|
+
var Flag = ActionFlag.or(z5.enum(InherentFlags)).or(CustomFlag);
|
|
282
|
+
var ContainsFlags = z5.object({
|
|
283
|
+
anyOf: z5.array(Flag).optional(),
|
|
284
|
+
noneOf: z5.array(Flag).optional(),
|
|
285
|
+
allOf: z5.array(Flag).optional()
|
|
286
|
+
}).meta({
|
|
287
|
+
id: "ContainsFlags"
|
|
288
|
+
});
|
|
289
|
+
var FlagConfig = z5.object({
|
|
290
|
+
id: CustomFlag,
|
|
291
|
+
requiresAction: z5.boolean().describe(
|
|
292
|
+
"Indicates if this flag expects an action to be performed to be cleared."
|
|
293
|
+
),
|
|
294
|
+
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
295
|
+
}).meta({
|
|
296
|
+
id: "FlagConfig",
|
|
297
|
+
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
298
|
+
});
|
|
299
|
+
var ActionFlagConfig = z5.object({
|
|
300
|
+
id: Flag,
|
|
301
|
+
operation: z5.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
302
|
+
conditional: Conditional.optional().describe(
|
|
303
|
+
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
304
|
+
)
|
|
305
|
+
}).meta({
|
|
306
|
+
id: "ActionFlagConfig",
|
|
307
|
+
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
// ../commons/src/events/EventStatus.ts
|
|
311
|
+
var z6 = __toESM(require("zod/v4"));
|
|
312
|
+
var EventStatus = z6.enum([
|
|
313
|
+
"CREATED",
|
|
314
|
+
"NOTIFIED",
|
|
315
|
+
"DECLARED",
|
|
316
|
+
"REGISTERED",
|
|
317
|
+
"ARCHIVED"
|
|
318
|
+
]);
|
|
319
|
+
|
|
68
320
|
// ../commons/src/scopes.ts
|
|
69
|
-
var JurisdictionFilter =
|
|
321
|
+
var JurisdictionFilter = z7.enum(["administrativeArea", "location", "all"]).describe(
|
|
70
322
|
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
71
323
|
);
|
|
72
|
-
var UserFilter =
|
|
73
|
-
var RecordScopeTypeV2 =
|
|
324
|
+
var UserFilter = z7.enum(["user"]).describe("Filters based on the user. Limits to self.");
|
|
325
|
+
var RecordScopeTypeV2 = z7.enum([
|
|
74
326
|
"record.search",
|
|
75
327
|
"record.create",
|
|
76
328
|
"record.read",
|
|
@@ -88,14 +340,20 @@ var RecordScopeTypeV2 = z2.enum([
|
|
|
88
340
|
"record.unassign-others",
|
|
89
341
|
"record.custom-action"
|
|
90
342
|
]);
|
|
91
|
-
var PlainScopeType =
|
|
343
|
+
var PlainScopeType = z7.enum([
|
|
92
344
|
// Misc. system scopes
|
|
93
345
|
"bypassratelimit",
|
|
94
346
|
"record.reindex",
|
|
95
347
|
"user.data-seeding",
|
|
96
348
|
"integration.create",
|
|
349
|
+
// Reading an integration's audit log. Deliberately separate from
|
|
350
|
+
// 'integration.create' so read-only oversight can be granted on its own, and
|
|
351
|
+
// deliberately option-less: system clients have no office and no
|
|
352
|
+
// administrative area, so jurisdiction options would have nothing to bind to.
|
|
353
|
+
"integration.audit.read",
|
|
97
354
|
"record.import",
|
|
98
355
|
"config.update-all",
|
|
356
|
+
"location.edit",
|
|
99
357
|
"attachment.upload",
|
|
100
358
|
"profile.electronic-signature",
|
|
101
359
|
"user.read-only-my-audit",
|
|
@@ -107,72 +365,85 @@ var PlainScopeType = z2.enum([
|
|
|
107
365
|
"record.confirm-registration",
|
|
108
366
|
"record.reject-registration"
|
|
109
367
|
]);
|
|
110
|
-
var scopeByEvent =
|
|
368
|
+
var scopeByEvent = z7.preprocess(
|
|
111
369
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
112
|
-
|
|
370
|
+
z7.array(z7.string()).optional()
|
|
113
371
|
).describe("Event type, e.g. birth, death");
|
|
114
|
-
var
|
|
372
|
+
var scopeByStatus = z7.preprocess(
|
|
373
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
374
|
+
z7.array(EventStatus).optional()
|
|
375
|
+
).describe(
|
|
376
|
+
"Restricts the scope to records currently in one of these statuses."
|
|
377
|
+
);
|
|
378
|
+
var userRole = z7.preprocess(
|
|
115
379
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
116
|
-
|
|
380
|
+
z7.array(z7.string()).optional()
|
|
117
381
|
).describe("User role, e.g. admin, field agent");
|
|
118
|
-
var scopeOptionsPlaceEvent =
|
|
382
|
+
var scopeOptionsPlaceEvent = z7.object({
|
|
119
383
|
event: scopeByEvent,
|
|
120
|
-
placeOfEvent: JurisdictionFilter.optional()
|
|
384
|
+
placeOfEvent: JurisdictionFilter.optional(),
|
|
385
|
+
createdBy: UserFilter.optional(),
|
|
386
|
+
createdIn: JurisdictionFilter.optional()
|
|
121
387
|
}).describe("Options applicable to all record scopes.");
|
|
122
388
|
var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
123
389
|
notifiedIn: JurisdictionFilter.optional(),
|
|
124
390
|
notifiedBy: UserFilter.optional(),
|
|
125
391
|
declaredIn: JurisdictionFilter.optional(),
|
|
126
|
-
declaredBy: UserFilter.optional()
|
|
392
|
+
declaredBy: UserFilter.optional(),
|
|
393
|
+
status: scopeByStatus
|
|
127
394
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
128
395
|
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
129
396
|
registeredIn: JurisdictionFilter.optional(),
|
|
130
|
-
registeredBy: UserFilter.optional()
|
|
397
|
+
registeredBy: UserFilter.optional(),
|
|
398
|
+
flags: ContainsFlags.optional()
|
|
131
399
|
}).describe(
|
|
132
400
|
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
133
401
|
);
|
|
134
402
|
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
135
|
-
customActionTypes:
|
|
403
|
+
customActionTypes: z7.preprocess(
|
|
136
404
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
137
|
-
|
|
405
|
+
z7.array(z7.string()).optional()
|
|
138
406
|
).describe("Allowed custom action types")
|
|
139
407
|
});
|
|
140
|
-
var AccessLevelOptions =
|
|
408
|
+
var AccessLevelOptions = z7.object({
|
|
141
409
|
accessLevel: JurisdictionFilter.optional()
|
|
142
410
|
});
|
|
143
411
|
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
144
412
|
role: userRole.optional()
|
|
145
413
|
});
|
|
146
|
-
var WorkqueueOrDashboardOptions =
|
|
147
|
-
ids:
|
|
414
|
+
var WorkqueueOrDashboardOptions = z7.object({
|
|
415
|
+
ids: z7.preprocess(
|
|
148
416
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
149
|
-
|
|
417
|
+
z7.array(z7.string())
|
|
150
418
|
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
151
419
|
});
|
|
152
|
-
var AllScopeOptions =
|
|
420
|
+
var AllScopeOptions = z7.object({
|
|
153
421
|
...AllRecordScopeOptions.shape,
|
|
154
422
|
...AccessLevelOptions.shape,
|
|
155
423
|
...AllUserScopeOptions.shape,
|
|
156
424
|
...WorkqueueOrDashboardOptions.shape
|
|
157
425
|
});
|
|
158
426
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
159
|
-
var ResolvedScopeOptionsPlaceEvent =
|
|
427
|
+
var ResolvedScopeOptionsPlaceEvent = z7.object({
|
|
160
428
|
event: scopeByEvent,
|
|
161
|
-
placeOfEvent: UUID.nullish()
|
|
429
|
+
placeOfEvent: UUID.nullish(),
|
|
430
|
+
createdBy: z7.string().optional(),
|
|
431
|
+
createdIn: UUID.nullish()
|
|
162
432
|
}).describe(
|
|
163
433
|
"Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
|
|
164
434
|
);
|
|
165
435
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
166
436
|
notifiedIn: UUID.nullish(),
|
|
167
|
-
notifiedBy:
|
|
437
|
+
notifiedBy: z7.string().optional(),
|
|
168
438
|
declaredIn: UUID.nullish(),
|
|
169
|
-
declaredBy:
|
|
439
|
+
declaredBy: z7.string().optional()
|
|
170
440
|
}).describe(
|
|
171
441
|
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
172
442
|
);
|
|
173
443
|
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
174
444
|
registeredIn: UUID.nullish(),
|
|
175
|
-
registeredBy:
|
|
445
|
+
registeredBy: z7.string().optional(),
|
|
446
|
+
flags: ContainsFlags.optional()
|
|
176
447
|
}).describe(
|
|
177
448
|
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
178
449
|
);
|
|
@@ -186,7 +457,6 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
|
186
457
|
"record.reject",
|
|
187
458
|
"record.archive",
|
|
188
459
|
"record.unarchive",
|
|
189
|
-
"record.review-duplicates",
|
|
190
460
|
"record.register"
|
|
191
461
|
]);
|
|
192
462
|
var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
@@ -194,41 +464,42 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
|
194
464
|
"record.read",
|
|
195
465
|
"record.request-correction",
|
|
196
466
|
"record.correct",
|
|
197
|
-
"record.unassign-others"
|
|
467
|
+
"record.unassign-others",
|
|
468
|
+
"record.review-duplicates"
|
|
198
469
|
]);
|
|
199
470
|
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
200
|
-
templates:
|
|
471
|
+
templates: z7.preprocess(
|
|
201
472
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
202
|
-
|
|
473
|
+
z7.array(z7.string()).optional()
|
|
203
474
|
).describe(
|
|
204
475
|
"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."
|
|
205
476
|
)
|
|
206
477
|
});
|
|
207
|
-
var RecordScopeV2 =
|
|
208
|
-
|
|
478
|
+
var RecordScopeV2 = z7.discriminatedUnion("type", [
|
|
479
|
+
z7.object({
|
|
209
480
|
type: ScopesWithPlaceEventOptions,
|
|
210
481
|
options: scopeOptionsPlaceEvent.optional()
|
|
211
482
|
}),
|
|
212
|
-
|
|
483
|
+
z7.object({
|
|
213
484
|
type: ScopesWithDeclaredOptions,
|
|
214
485
|
options: scopeOptionsDeclaredOrNotified.optional()
|
|
215
486
|
}),
|
|
216
|
-
|
|
487
|
+
z7.object({
|
|
217
488
|
type: ScopesWithFullOptions,
|
|
218
489
|
options: AllRecordScopeOptions.optional()
|
|
219
490
|
}),
|
|
220
|
-
|
|
221
|
-
type:
|
|
491
|
+
z7.object({
|
|
492
|
+
type: z7.literal("record.custom-action"),
|
|
222
493
|
options: CustomActionScopeOptions.optional()
|
|
223
494
|
}),
|
|
224
|
-
|
|
225
|
-
type:
|
|
495
|
+
z7.object({
|
|
496
|
+
type: z7.literal("record.print-certified-copies"),
|
|
226
497
|
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
227
498
|
})
|
|
228
499
|
]).describe(
|
|
229
500
|
"Scopes used to check user's permission to perform actions on a record."
|
|
230
501
|
);
|
|
231
|
-
var SystemScopeType =
|
|
502
|
+
var SystemScopeType = z7.enum([
|
|
232
503
|
"organisation.read-locations",
|
|
233
504
|
"user.read",
|
|
234
505
|
"user.create",
|
|
@@ -242,61 +513,61 @@ var UserScopeType = SystemScopeType.extract([
|
|
|
242
513
|
"user.search"
|
|
243
514
|
]);
|
|
244
515
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
245
|
-
var UserScopeV2 =
|
|
246
|
-
|
|
516
|
+
var UserScopeV2 = z7.discriminatedUnion("type", [
|
|
517
|
+
z7.object({
|
|
247
518
|
type: ScopesWithRoleOption,
|
|
248
519
|
options: AllUserScopeOptions.optional()
|
|
249
520
|
}),
|
|
250
|
-
|
|
521
|
+
z7.object({
|
|
251
522
|
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
252
523
|
options: AccessLevelOptions.optional()
|
|
253
524
|
})
|
|
254
525
|
]);
|
|
255
|
-
var ResolvedRecordScopeV2 =
|
|
256
|
-
|
|
526
|
+
var ResolvedRecordScopeV2 = z7.discriminatedUnion("type", [
|
|
527
|
+
z7.object({
|
|
257
528
|
type: ScopesWithPlaceEventOptions,
|
|
258
529
|
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
259
530
|
}),
|
|
260
|
-
|
|
531
|
+
z7.object({
|
|
261
532
|
type: ScopesWithDeclaredOptions,
|
|
262
533
|
options: ResolvedScopeOptionsDeclared.optional()
|
|
263
534
|
}),
|
|
264
|
-
|
|
535
|
+
z7.object({
|
|
265
536
|
type: ScopesWithFullOptions,
|
|
266
537
|
options: ResolvedScopeOptionsFull.optional()
|
|
267
538
|
}),
|
|
268
|
-
|
|
269
|
-
type:
|
|
539
|
+
z7.object({
|
|
540
|
+
type: z7.literal("record.print-certified-copies"),
|
|
270
541
|
options: ResolvedScopeOptionsFull.extend({
|
|
271
|
-
templates:
|
|
542
|
+
templates: z7.array(z7.string()).optional()
|
|
272
543
|
}).optional()
|
|
273
544
|
})
|
|
274
545
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
275
|
-
var Scope =
|
|
276
|
-
|
|
546
|
+
var Scope = z7.discriminatedUnion("type", [
|
|
547
|
+
z7.object({ type: PlainScopeType }),
|
|
277
548
|
...RecordScopeV2.options,
|
|
278
549
|
...UserScopeV2.options,
|
|
279
|
-
|
|
280
|
-
type:
|
|
550
|
+
z7.object({
|
|
551
|
+
type: z7.literal("organisation.read-locations"),
|
|
281
552
|
options: AccessLevelOptions.optional()
|
|
282
553
|
}),
|
|
283
|
-
|
|
284
|
-
type:
|
|
554
|
+
z7.object({
|
|
555
|
+
type: z7.literal("workqueue"),
|
|
285
556
|
options: WorkqueueOrDashboardOptions
|
|
286
557
|
}),
|
|
287
|
-
|
|
288
|
-
type:
|
|
558
|
+
z7.object({
|
|
559
|
+
type: z7.literal("dashboard.view"),
|
|
289
560
|
options: WorkqueueOrDashboardOptions
|
|
290
561
|
})
|
|
291
562
|
]);
|
|
292
|
-
var ScopeType =
|
|
563
|
+
var ScopeType = z7.enum([
|
|
293
564
|
...SystemScopeType.options,
|
|
294
565
|
...RecordScopeTypeV2.options,
|
|
295
566
|
...PlainScopeType.options,
|
|
296
567
|
"workqueue",
|
|
297
568
|
"dashboard.view"
|
|
298
569
|
]);
|
|
299
|
-
var EncodedScope =
|
|
570
|
+
var EncodedScope = z7.string().brand("EncodedScope");
|
|
300
571
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
301
572
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
302
573
|
accessLevel: JurisdictionFilter.enum.all,
|
|
@@ -306,162 +577,51 @@ var DEFAULT_SCOPE_OPTIONS = {
|
|
|
306
577
|
};
|
|
307
578
|
|
|
308
579
|
// ../commons/src/authentication.ts
|
|
309
|
-
var TokenUserType =
|
|
310
|
-
var TokenWithBearer =
|
|
311
|
-
|
|
312
|
-
// ../commons/src/events/ActionType.ts
|
|
313
|
-
var z4 = __toESM(require("zod/v4"));
|
|
314
|
-
var ActionType = {
|
|
315
|
-
// Pre-declaration actions
|
|
316
|
-
DELETE: "DELETE",
|
|
317
|
-
CREATE: "CREATE",
|
|
318
|
-
NOTIFY: "NOTIFY",
|
|
319
|
-
// Declaration actions
|
|
320
|
-
DECLARE: "DECLARE",
|
|
321
|
-
REGISTER: "REGISTER",
|
|
322
|
-
EDIT: "EDIT",
|
|
323
|
-
// Declaration system actions. Non-configurable.
|
|
324
|
-
DUPLICATE_DETECTED: "DUPLICATE_DETECTED",
|
|
325
|
-
REJECT: "REJECT",
|
|
326
|
-
// REJECT_DECLARATION
|
|
327
|
-
MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
|
|
328
|
-
MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
|
|
329
|
-
ARCHIVE: "ARCHIVE",
|
|
330
|
-
UNARCHIVE: "UNARCHIVE",
|
|
331
|
-
// Record actions
|
|
332
|
-
PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
|
|
333
|
-
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
|
334
|
-
REJECT_CORRECTION: "REJECT_CORRECTION",
|
|
335
|
-
APPROVE_CORRECTION: "APPROVE_CORRECTION",
|
|
336
|
-
// General actions
|
|
337
|
-
READ: "READ",
|
|
338
|
-
ASSIGN: "ASSIGN",
|
|
339
|
-
UNASSIGN: "UNASSIGN",
|
|
340
|
-
// Custom action
|
|
341
|
-
CUSTOM: "CUSTOM"
|
|
342
|
-
};
|
|
343
|
-
var ConfirmableActions = [
|
|
344
|
-
ActionType.NOTIFY,
|
|
345
|
-
ActionType.DECLARE,
|
|
346
|
-
ActionType.EDIT,
|
|
347
|
-
ActionType.REGISTER,
|
|
348
|
-
ActionType.REJECT,
|
|
349
|
-
ActionType.ARCHIVE,
|
|
350
|
-
ActionType.UNARCHIVE,
|
|
351
|
-
ActionType.PRINT_CERTIFICATE,
|
|
352
|
-
ActionType.REQUEST_CORRECTION,
|
|
353
|
-
ActionType.APPROVE_CORRECTION,
|
|
354
|
-
ActionType.REJECT_CORRECTION,
|
|
355
|
-
ActionType.CUSTOM
|
|
356
|
-
];
|
|
357
|
-
var ActionTypes = z4.enum([
|
|
358
|
-
"DELETE",
|
|
359
|
-
"CREATE",
|
|
360
|
-
"NOTIFY",
|
|
361
|
-
"DECLARE",
|
|
362
|
-
"EDIT",
|
|
363
|
-
"REGISTER",
|
|
364
|
-
"DUPLICATE_DETECTED",
|
|
365
|
-
"REJECT",
|
|
366
|
-
"MARK_AS_DUPLICATE",
|
|
367
|
-
"MARK_AS_NOT_DUPLICATE",
|
|
368
|
-
"ARCHIVE",
|
|
369
|
-
"UNARCHIVE",
|
|
370
|
-
"PRINT_CERTIFICATE",
|
|
371
|
-
"REQUEST_CORRECTION",
|
|
372
|
-
"REJECT_CORRECTION",
|
|
373
|
-
"APPROVE_CORRECTION",
|
|
374
|
-
"READ",
|
|
375
|
-
"ASSIGN",
|
|
376
|
-
"UNASSIGN",
|
|
377
|
-
"CUSTOM"
|
|
378
|
-
]);
|
|
379
|
-
var ClientSpecificAction = {
|
|
380
|
-
REVIEW_CORRECTION_REQUEST: "REVIEW_CORRECTION_REQUEST"
|
|
381
|
-
};
|
|
382
|
-
var declarationActionValues = [
|
|
383
|
-
ActionTypes.enum.DECLARE,
|
|
384
|
-
ActionTypes.enum.EDIT,
|
|
385
|
-
ActionTypes.enum.REGISTER,
|
|
386
|
-
ActionTypes.enum.NOTIFY,
|
|
387
|
-
ActionTypes.enum.DUPLICATE_DETECTED
|
|
388
|
-
];
|
|
389
|
-
var DeclarationActions = ActionTypes.extract(declarationActionValues);
|
|
390
|
-
var declarationUpdateActionValues = [
|
|
391
|
-
...declarationActionValues,
|
|
392
|
-
ActionTypes.enum.REQUEST_CORRECTION
|
|
393
|
-
];
|
|
394
|
-
var DeclarationUpdateActions = ActionTypes.extract(
|
|
395
|
-
declarationUpdateActionValues
|
|
396
|
-
);
|
|
397
|
-
var annotationActions = ActionTypes.exclude(declarationActionValues);
|
|
398
|
-
var writeActions = ActionTypes.exclude([
|
|
399
|
-
ActionType.CREATE,
|
|
400
|
-
ActionType.READ,
|
|
401
|
-
ActionType.ASSIGN,
|
|
402
|
-
ActionType.UNASSIGN
|
|
403
|
-
]);
|
|
404
|
-
var WorkqueueActionType = ActionTypes.extract([
|
|
405
|
-
ActionType.READ,
|
|
406
|
-
ActionType.DELETE,
|
|
407
|
-
ActionType.DECLARE,
|
|
408
|
-
ActionType.REGISTER,
|
|
409
|
-
ActionType.EDIT,
|
|
410
|
-
ActionType.REJECT,
|
|
411
|
-
ActionType.MARK_AS_DUPLICATE,
|
|
412
|
-
ActionType.ARCHIVE,
|
|
413
|
-
ActionType.UNARCHIVE,
|
|
414
|
-
ActionType.PRINT_CERTIFICATE,
|
|
415
|
-
ActionType.REQUEST_CORRECTION
|
|
416
|
-
]);
|
|
417
|
-
var META_ACTIONS = [
|
|
418
|
-
ActionType.ASSIGN,
|
|
419
|
-
ActionType.UNASSIGN,
|
|
420
|
-
ActionType.READ
|
|
421
|
-
];
|
|
580
|
+
var TokenUserType = z8.enum(["user", "system"]);
|
|
581
|
+
var TokenWithBearer = z8.string().regex(/^Bearer\s/);
|
|
422
582
|
|
|
423
583
|
// ../commons/src/events/AuditLog.ts
|
|
424
|
-
var AuditLogEntryBase =
|
|
425
|
-
id:
|
|
426
|
-
clientId:
|
|
584
|
+
var AuditLogEntryBase = z9.object({
|
|
585
|
+
id: z9.string(),
|
|
586
|
+
clientId: z9.string(),
|
|
427
587
|
clientType: TokenUserType,
|
|
428
|
-
createdAt:
|
|
588
|
+
createdAt: z9.string()
|
|
429
589
|
});
|
|
430
590
|
var EventCreateEntrySchema = AuditLogEntryBase.extend({
|
|
431
|
-
operation:
|
|
432
|
-
requestData:
|
|
433
|
-
transactionId:
|
|
434
|
-
type:
|
|
435
|
-
createdAtLocation:
|
|
591
|
+
operation: z9.literal("event.create"),
|
|
592
|
+
requestData: z9.object({
|
|
593
|
+
transactionId: z9.string(),
|
|
594
|
+
type: z9.string(),
|
|
595
|
+
createdAtLocation: z9.string().nullable()
|
|
436
596
|
}),
|
|
437
|
-
responseSummary:
|
|
438
|
-
eventId:
|
|
439
|
-
trackingId:
|
|
597
|
+
responseSummary: z9.object({
|
|
598
|
+
eventId: z9.string(),
|
|
599
|
+
trackingId: z9.string()
|
|
440
600
|
})
|
|
441
601
|
});
|
|
442
602
|
var EventGetEntrySchema = AuditLogEntryBase.extend({
|
|
443
|
-
operation:
|
|
444
|
-
requestData:
|
|
445
|
-
responseSummary:
|
|
446
|
-
eventType:
|
|
447
|
-
trackingId:
|
|
603
|
+
operation: z9.literal("event.get"),
|
|
604
|
+
requestData: z9.object({ eventId: z9.string() }),
|
|
605
|
+
responseSummary: z9.object({
|
|
606
|
+
eventType: z9.string(),
|
|
607
|
+
trackingId: z9.string()
|
|
448
608
|
})
|
|
449
609
|
});
|
|
450
610
|
var EventSearchEntrySchema = AuditLogEntryBase.extend({
|
|
451
|
-
operation:
|
|
452
|
-
clientType:
|
|
453
|
-
requestData:
|
|
454
|
-
query:
|
|
455
|
-
limit:
|
|
456
|
-
offset:
|
|
611
|
+
operation: z9.literal("event.search"),
|
|
612
|
+
clientType: z9.literal("system"),
|
|
613
|
+
requestData: z9.object({
|
|
614
|
+
query: z9.record(z9.string(), z9.unknown()).nullable(),
|
|
615
|
+
limit: z9.number().nullable(),
|
|
616
|
+
offset: z9.number().nullable()
|
|
457
617
|
}),
|
|
458
|
-
responseSummary:
|
|
459
|
-
total:
|
|
460
|
-
eventIds:
|
|
618
|
+
responseSummary: z9.object({
|
|
619
|
+
total: z9.number(),
|
|
620
|
+
eventIds: z9.array(z9.string())
|
|
461
621
|
})
|
|
462
622
|
});
|
|
463
623
|
var EventActionEntrySchema = AuditLogEntryBase.extend({
|
|
464
|
-
operation:
|
|
624
|
+
operation: z9.enum([
|
|
465
625
|
"event.actions.notify.request",
|
|
466
626
|
"event.actions.declare.request",
|
|
467
627
|
"event.actions.register.request",
|
|
@@ -481,83 +641,159 @@ var EventActionEntrySchema = AuditLogEntryBase.extend({
|
|
|
481
641
|
"event.actions.mark_as_duplicate.request",
|
|
482
642
|
"event.actions.mark_as_not_duplicate.request"
|
|
483
643
|
]),
|
|
484
|
-
requestData:
|
|
485
|
-
eventId:
|
|
486
|
-
actionType:
|
|
487
|
-
eventType:
|
|
488
|
-
trackingId:
|
|
489
|
-
transactionId:
|
|
644
|
+
requestData: z9.object({
|
|
645
|
+
eventId: z9.string(),
|
|
646
|
+
actionType: z9.string(),
|
|
647
|
+
eventType: z9.string(),
|
|
648
|
+
trackingId: z9.string(),
|
|
649
|
+
transactionId: z9.string()
|
|
490
650
|
})
|
|
491
651
|
});
|
|
492
652
|
var EventCustomActionEntrySchema = AuditLogEntryBase.extend({
|
|
493
|
-
operation:
|
|
494
|
-
requestData:
|
|
495
|
-
eventId:
|
|
496
|
-
actionType:
|
|
497
|
-
customAction:
|
|
498
|
-
eventType:
|
|
499
|
-
trackingId:
|
|
500
|
-
transactionId:
|
|
653
|
+
operation: z9.literal("event.actions.custom.request"),
|
|
654
|
+
requestData: z9.object({
|
|
655
|
+
eventId: z9.string(),
|
|
656
|
+
actionType: z9.literal(ActionType.CUSTOM),
|
|
657
|
+
customAction: z9.string(),
|
|
658
|
+
eventType: z9.string(),
|
|
659
|
+
trackingId: z9.string(),
|
|
660
|
+
transactionId: z9.string()
|
|
501
661
|
})
|
|
502
662
|
});
|
|
503
663
|
var IntegrationCreateEntrySchema = AuditLogEntryBase.extend({
|
|
504
|
-
operation:
|
|
505
|
-
requestData:
|
|
506
|
-
responseSummary:
|
|
664
|
+
operation: z9.literal("integrations.create"),
|
|
665
|
+
requestData: z9.object({ name: z9.string(), scopes: z9.array(z9.string()) }),
|
|
666
|
+
responseSummary: z9.object({ clientId: z9.string() })
|
|
507
667
|
});
|
|
508
668
|
var IntegrationRefreshTokenEntrySchema = AuditLogEntryBase.extend({
|
|
509
|
-
operation:
|
|
510
|
-
requestData:
|
|
511
|
-
responseSummary:
|
|
669
|
+
operation: z9.literal("integrations.refreshToken"),
|
|
670
|
+
requestData: z9.object({ clientId: z9.string() }),
|
|
671
|
+
responseSummary: z9.object({ clientId: z9.string() })
|
|
512
672
|
});
|
|
513
673
|
var IntegrationDeactivateEntrySchema = AuditLogEntryBase.extend({
|
|
514
|
-
operation:
|
|
515
|
-
requestData:
|
|
516
|
-
responseSummary:
|
|
674
|
+
operation: z9.literal("integrations.deactivate"),
|
|
675
|
+
requestData: z9.object({ id: z9.string() }),
|
|
676
|
+
responseSummary: z9.object({ id: z9.string(), status: z9.string() })
|
|
517
677
|
});
|
|
518
678
|
var IntegrationActivateEntrySchema = AuditLogEntryBase.extend({
|
|
519
|
-
operation:
|
|
520
|
-
requestData:
|
|
521
|
-
responseSummary:
|
|
679
|
+
operation: z9.literal("integrations.activate"),
|
|
680
|
+
requestData: z9.object({ id: z9.string() }),
|
|
681
|
+
responseSummary: z9.object({ id: z9.string(), status: z9.string() })
|
|
522
682
|
});
|
|
523
683
|
var IntegrationDeleteEntrySchema = AuditLogEntryBase.extend({
|
|
524
|
-
operation:
|
|
525
|
-
requestData:
|
|
526
|
-
responseSummary:
|
|
684
|
+
operation: z9.literal("integrations.delete"),
|
|
685
|
+
requestData: z9.object({ id: z9.string() }),
|
|
686
|
+
responseSummary: z9.object({ id: z9.string(), name: z9.string() })
|
|
527
687
|
});
|
|
528
688
|
var IntegrationRefreshSecretEntrySchema = AuditLogEntryBase.extend({
|
|
529
|
-
operation:
|
|
530
|
-
requestData:
|
|
531
|
-
responseSummary:
|
|
689
|
+
operation: z9.literal("integrations.refreshSecret"),
|
|
690
|
+
requestData: z9.object({ id: z9.string() }),
|
|
691
|
+
responseSummary: z9.object({ clientId: z9.string() })
|
|
692
|
+
});
|
|
693
|
+
var createdVersionFields = {
|
|
694
|
+
id: z9.string(),
|
|
695
|
+
versionId: z9.string(),
|
|
696
|
+
name: z9.string(),
|
|
697
|
+
externalId: z9.string().nullish(),
|
|
698
|
+
effectiveFrom: z9.string(),
|
|
699
|
+
status: z9.string()
|
|
700
|
+
};
|
|
701
|
+
var LocationCreateEntrySchema = AuditLogEntryBase.extend({
|
|
702
|
+
operation: z9.literal("locations.create"),
|
|
703
|
+
requestData: z9.object({
|
|
704
|
+
...createdVersionFields,
|
|
705
|
+
administrativeAreaId: z9.string().nullish(),
|
|
706
|
+
locationType: z9.string().nullish()
|
|
707
|
+
})
|
|
708
|
+
});
|
|
709
|
+
var AdministrativeAreaCreateEntrySchema = AuditLogEntryBase.extend({
|
|
710
|
+
operation: z9.literal("administrativeAreas.create"),
|
|
711
|
+
requestData: z9.object({
|
|
712
|
+
...createdVersionFields,
|
|
713
|
+
parentId: z9.string().nullish()
|
|
714
|
+
})
|
|
715
|
+
});
|
|
716
|
+
var ChangedStringField = z9.object({ from: z9.string(), to: z9.string() });
|
|
717
|
+
var ChangedNullableStringField = z9.object({
|
|
718
|
+
from: z9.string().nullable(),
|
|
719
|
+
to: z9.string().nullable()
|
|
720
|
+
});
|
|
721
|
+
var updatedVersionRequestData = z9.object({
|
|
722
|
+
id: z9.string(),
|
|
723
|
+
versionId: z9.string(),
|
|
724
|
+
name: z9.string(),
|
|
725
|
+
externalId: z9.string().nullish(),
|
|
726
|
+
status: z9.string(),
|
|
727
|
+
effectiveFrom: z9.string(),
|
|
728
|
+
lastVersionId: z9.string()
|
|
729
|
+
});
|
|
730
|
+
var updatedVersionResponseSummary = z9.object({
|
|
731
|
+
previousVersionId: z9.string(),
|
|
732
|
+
versionId: z9.string(),
|
|
733
|
+
changed: z9.object({
|
|
734
|
+
name: ChangedStringField.optional(),
|
|
735
|
+
externalId: ChangedNullableStringField.optional(),
|
|
736
|
+
status: ChangedStringField.optional()
|
|
737
|
+
})
|
|
738
|
+
});
|
|
739
|
+
var LocationUpdateEntrySchema = AuditLogEntryBase.extend({
|
|
740
|
+
operation: z9.literal("locations.update"),
|
|
741
|
+
requestData: updatedVersionRequestData,
|
|
742
|
+
responseSummary: updatedVersionResponseSummary
|
|
743
|
+
});
|
|
744
|
+
var AdministrativeAreaUpdateEntrySchema = AuditLogEntryBase.extend({
|
|
745
|
+
operation: z9.literal("administrativeAreas.update"),
|
|
746
|
+
requestData: updatedVersionRequestData,
|
|
747
|
+
responseSummary: updatedVersionResponseSummary
|
|
748
|
+
});
|
|
749
|
+
var withdrawVersionRequestData = z9.object({
|
|
750
|
+
id: z9.string(),
|
|
751
|
+
versionId: z9.string()
|
|
752
|
+
});
|
|
753
|
+
var withdrawVersionResponseSummary = z9.object({
|
|
754
|
+
effectiveFrom: z9.string(),
|
|
755
|
+
name: z9.string(),
|
|
756
|
+
externalId: z9.string().nullish(),
|
|
757
|
+
status: z9.string()
|
|
758
|
+
});
|
|
759
|
+
var LocationWithdrawEntrySchema = AuditLogEntryBase.extend({
|
|
760
|
+
operation: z9.literal("locations.withdrawVersion"),
|
|
761
|
+
requestData: withdrawVersionRequestData,
|
|
762
|
+
responseSummary: withdrawVersionResponseSummary
|
|
763
|
+
});
|
|
764
|
+
var AdministrativeAreaWithdrawEntrySchema = AuditLogEntryBase.extend({
|
|
765
|
+
operation: z9.literal("administrativeAreas.withdrawVersion"),
|
|
766
|
+
requestData: withdrawVersionRequestData,
|
|
767
|
+
responseSummary: withdrawVersionResponseSummary
|
|
532
768
|
});
|
|
533
769
|
var AttachmentUploadEntrySchema = AuditLogEntryBase.extend({
|
|
534
|
-
operation:
|
|
535
|
-
requestData:
|
|
536
|
-
transactionId:
|
|
537
|
-
path:
|
|
770
|
+
operation: z9.literal("attachments.upload"),
|
|
771
|
+
requestData: z9.object({
|
|
772
|
+
transactionId: z9.string(),
|
|
773
|
+
path: z9.string().nullable()
|
|
538
774
|
}),
|
|
539
|
-
responseSummary:
|
|
775
|
+
responseSummary: z9.object({ fileUrl: z9.string() })
|
|
540
776
|
});
|
|
541
|
-
var subjectOnly =
|
|
542
|
-
var subjectWithReason =
|
|
543
|
-
subjectId:
|
|
544
|
-
reason:
|
|
545
|
-
comment:
|
|
777
|
+
var subjectOnly = z9.object({ subjectId: z9.string() });
|
|
778
|
+
var subjectWithReason = z9.object({
|
|
779
|
+
subjectId: z9.string(),
|
|
780
|
+
reason: z9.string(),
|
|
781
|
+
comment: z9.string().optional()
|
|
546
782
|
});
|
|
547
783
|
var UserCreateEntrySchema = AuditLogEntryBase.extend({
|
|
548
|
-
operation:
|
|
549
|
-
requestData:
|
|
550
|
-
subjectId:
|
|
551
|
-
role:
|
|
552
|
-
primaryOfficeId:
|
|
784
|
+
operation: z9.literal("user.create_user"),
|
|
785
|
+
requestData: z9.object({
|
|
786
|
+
subjectId: z9.string(),
|
|
787
|
+
role: z9.string(),
|
|
788
|
+
primaryOfficeId: z9.string()
|
|
553
789
|
})
|
|
554
790
|
});
|
|
555
791
|
var UserReasonEntrySchema = AuditLogEntryBase.extend({
|
|
556
|
-
operation:
|
|
792
|
+
operation: z9.enum(["user.deactivate", "user.reactivate"]),
|
|
557
793
|
requestData: subjectWithReason
|
|
558
794
|
});
|
|
559
795
|
var UserSubjectOnlyEntrySchema = AuditLogEntryBase.extend({
|
|
560
|
-
operation:
|
|
796
|
+
operation: z9.enum([
|
|
561
797
|
"user.edit_user",
|
|
562
798
|
"user.logged_in",
|
|
563
799
|
"user.logged_out",
|
|
@@ -571,14 +807,14 @@ var UserSubjectOnlyEntrySchema = AuditLogEntryBase.extend({
|
|
|
571
807
|
requestData: subjectOnly
|
|
572
808
|
});
|
|
573
809
|
var UserEmailChangedEntrySchema = AuditLogEntryBase.extend({
|
|
574
|
-
operation:
|
|
810
|
+
operation: z9.literal("user.email_address_changed"),
|
|
575
811
|
requestData: subjectOnly,
|
|
576
|
-
responseSummary:
|
|
812
|
+
responseSummary: z9.object({ email: z9.string() })
|
|
577
813
|
});
|
|
578
814
|
var UserPhoneChangedEntrySchema = AuditLogEntryBase.extend({
|
|
579
|
-
operation:
|
|
815
|
+
operation: z9.literal("user.phone_number_changed"),
|
|
580
816
|
requestData: subjectOnly,
|
|
581
|
-
responseSummary:
|
|
817
|
+
responseSummary: z9.object({ phoneNumber: z9.string() })
|
|
582
818
|
});
|
|
583
819
|
var userBaseOmit = {
|
|
584
820
|
id: true,
|
|
@@ -586,14 +822,14 @@ var userBaseOmit = {
|
|
|
586
822
|
clientType: true,
|
|
587
823
|
createdAt: true
|
|
588
824
|
};
|
|
589
|
-
var UserAuditRecordInput =
|
|
825
|
+
var UserAuditRecordInput = z9.discriminatedUnion("operation", [
|
|
590
826
|
UserCreateEntrySchema.omit(userBaseOmit),
|
|
591
827
|
UserReasonEntrySchema.omit(userBaseOmit),
|
|
592
828
|
UserSubjectOnlyEntrySchema.omit(userBaseOmit),
|
|
593
829
|
UserEmailChangedEntrySchema.omit(userBaseOmit),
|
|
594
830
|
UserPhoneChangedEntrySchema.omit(userBaseOmit)
|
|
595
831
|
]);
|
|
596
|
-
var AuditLogEntrySchema =
|
|
832
|
+
var AuditLogEntrySchema = z9.discriminatedUnion("operation", [
|
|
597
833
|
EventCreateEntrySchema,
|
|
598
834
|
EventGetEntrySchema,
|
|
599
835
|
EventSearchEntrySchema,
|
|
@@ -605,6 +841,12 @@ var AuditLogEntrySchema = z5.discriminatedUnion("operation", [
|
|
|
605
841
|
IntegrationActivateEntrySchema,
|
|
606
842
|
IntegrationDeleteEntrySchema,
|
|
607
843
|
IntegrationRefreshSecretEntrySchema,
|
|
844
|
+
LocationCreateEntrySchema,
|
|
845
|
+
LocationUpdateEntrySchema,
|
|
846
|
+
AdministrativeAreaUpdateEntrySchema,
|
|
847
|
+
LocationWithdrawEntrySchema,
|
|
848
|
+
AdministrativeAreaWithdrawEntrySchema,
|
|
849
|
+
AdministrativeAreaCreateEntrySchema,
|
|
608
850
|
AttachmentUploadEntrySchema,
|
|
609
851
|
UserCreateEntrySchema,
|
|
610
852
|
UserReasonEntrySchema,
|
|
@@ -618,78 +860,13 @@ var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
|
|
|
618
860
|
var CHILD_ONBOARDING_EVENT = "child-onboarding";
|
|
619
861
|
|
|
620
862
|
// ../commons/src/events/ActionConfig.ts
|
|
621
|
-
var
|
|
622
|
-
|
|
623
|
-
// ../commons/src/events/TranslationConfig.ts
|
|
624
|
-
var z6 = __toESM(require("zod/v4"));
|
|
625
|
-
var TranslationConfig = z6.object({
|
|
626
|
-
id: z6.string().describe(
|
|
627
|
-
"The identifier of the translation referred in translation CSV files"
|
|
628
|
-
),
|
|
629
|
-
defaultMessage: z6.string().describe("Default translation message"),
|
|
630
|
-
description: z6.string().describe(
|
|
631
|
-
"Describe the translation for a translator to be able to identify it."
|
|
632
|
-
)
|
|
633
|
-
}).meta({
|
|
634
|
-
description: "Translation configuration",
|
|
635
|
-
id: "TranslationConfig"
|
|
636
|
-
});
|
|
863
|
+
var z25 = __toESM(require("zod/v4"));
|
|
637
864
|
|
|
638
865
|
// ../commons/src/events/FieldConfig.ts
|
|
639
866
|
var import_v43 = __toESM(require("zod/v4"));
|
|
640
867
|
|
|
641
|
-
// ../commons/src/events/Conditional.ts
|
|
642
|
-
var z7 = __toESM(require("zod/v4"));
|
|
643
|
-
var Conditional = z7.any().describe("JSONSchema").meta({
|
|
644
|
-
description: "JSON schema conditional configuration",
|
|
645
|
-
id: "Conditional"
|
|
646
|
-
});
|
|
647
|
-
var ConditionalType = {
|
|
648
|
-
SHOW: "SHOW",
|
|
649
|
-
ENABLE: "ENABLE",
|
|
650
|
-
DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
|
|
651
|
-
};
|
|
652
|
-
var ShowConditional = z7.object({
|
|
653
|
-
type: z7.literal(ConditionalType.SHOW),
|
|
654
|
-
conditional: Conditional
|
|
655
|
-
}).describe(
|
|
656
|
-
"If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
|
|
657
|
-
);
|
|
658
|
-
var EnableConditional = z7.object({
|
|
659
|
-
type: z7.literal(ConditionalType.ENABLE),
|
|
660
|
-
conditional: Conditional
|
|
661
|
-
}).describe(
|
|
662
|
-
"If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
|
|
663
|
-
);
|
|
664
|
-
var ActionConditional = z7.discriminatedUnion("type", [
|
|
665
|
-
// Action can be shown / hidden
|
|
666
|
-
ShowConditional,
|
|
667
|
-
// Action can be shown to the user in the list but as disabled
|
|
668
|
-
EnableConditional
|
|
669
|
-
]).meta({
|
|
670
|
-
id: "ActionConditional",
|
|
671
|
-
description: "Conditional gating whether an action is shown (SHOW) or enabled (ENABLE). When omitted from an action, the action is shown and enabled for everyone."
|
|
672
|
-
});
|
|
673
|
-
var DisplayOnReviewConditional = z7.object({
|
|
674
|
-
type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
675
|
-
conditional: Conditional
|
|
676
|
-
}).describe(
|
|
677
|
-
"If 'DISPLAY_ON_REVIEW' conditional is defined, the component is shown on the review page only if both the 'DISPLAY_ON_REVIEW' and 'SHOW' conditions are met. This should only be used for fields within declaration forms, as they are the only ones with review pages."
|
|
678
|
-
);
|
|
679
|
-
var FieldConditional = z7.discriminatedUnion("type", [
|
|
680
|
-
// Field input can be shown / hidden
|
|
681
|
-
ShowConditional,
|
|
682
|
-
// Field input can be shown to the user but as disabled
|
|
683
|
-
EnableConditional,
|
|
684
|
-
// Field output can be shown / hidden on the review page
|
|
685
|
-
DisplayOnReviewConditional
|
|
686
|
-
]).meta({
|
|
687
|
-
id: "FieldConditional",
|
|
688
|
-
description: "Conditional gating whether a form field is shown (SHOW), enabled (ENABLE), or displayed on the review page (DISPLAY_ON_REVIEW). When omitted, the field is shown and enabled for everyone, and is displayed on review whenever it has a value."
|
|
689
|
-
});
|
|
690
|
-
|
|
691
868
|
// ../commons/src/events/FieldType.ts
|
|
692
|
-
var
|
|
869
|
+
var z10 = __toESM(require("zod/v4"));
|
|
693
870
|
var FieldType = {
|
|
694
871
|
NAME: "NAME",
|
|
695
872
|
PHONE: "PHONE",
|
|
@@ -753,7 +930,7 @@ var FieldType = {
|
|
|
753
930
|
*/
|
|
754
931
|
_EXPERIMENTAL_CUSTOM: "CUSTOM"
|
|
755
932
|
};
|
|
756
|
-
var FileFieldType =
|
|
933
|
+
var FileFieldType = z10.enum([
|
|
757
934
|
FieldType.FILE,
|
|
758
935
|
FieldType.FILE_WITH_OPTIONS,
|
|
759
936
|
FieldType.SIGNATURE
|
|
@@ -789,160 +966,160 @@ var HiddenFieldTypes = [
|
|
|
789
966
|
];
|
|
790
967
|
|
|
791
968
|
// ../commons/src/events/FieldValue.ts
|
|
792
|
-
var
|
|
969
|
+
var z14 = __toESM(require("zod/v4"));
|
|
793
970
|
|
|
794
971
|
// ../commons/src/documents.ts
|
|
795
|
-
var
|
|
796
|
-
var FullDocumentUrl =
|
|
972
|
+
var z11 = __toESM(require("zod/v4"));
|
|
973
|
+
var FullDocumentUrl = z11.string().brand("FullDocumentUrl").describe(
|
|
797
974
|
"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"
|
|
798
975
|
);
|
|
799
|
-
var FullDocumentPath =
|
|
976
|
+
var FullDocumentPath = z11.string().overwrite((val) => val.startsWith("/") ? val : `/${val}`).meta({ effectType: "input", type: "string" }).describe(
|
|
800
977
|
"A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
|
|
801
978
|
);
|
|
802
|
-
var DocumentPath =
|
|
979
|
+
var DocumentPath = z11.string().brand("DocumentPath").describe(
|
|
803
980
|
"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."
|
|
804
981
|
);
|
|
805
982
|
|
|
806
983
|
// ../commons/src/events/CompositeFieldValue.ts
|
|
807
|
-
var
|
|
984
|
+
var z12 = __toESM(require("zod/v4"));
|
|
808
985
|
var AddressType = {
|
|
809
986
|
DOMESTIC: "DOMESTIC",
|
|
810
987
|
INTERNATIONAL: "INTERNATIONAL"
|
|
811
988
|
};
|
|
812
|
-
var FileFieldValue =
|
|
989
|
+
var FileFieldValue = z12.object({
|
|
813
990
|
path: DocumentPath,
|
|
814
|
-
originalFilename:
|
|
815
|
-
type:
|
|
816
|
-
});
|
|
817
|
-
var NameFieldValue =
|
|
818
|
-
firstname:
|
|
819
|
-
surname:
|
|
820
|
-
middlename:
|
|
821
|
-
});
|
|
822
|
-
var NameFieldUpdateValue =
|
|
823
|
-
firstname:
|
|
824
|
-
surname:
|
|
825
|
-
middlename:
|
|
826
|
-
}).or(
|
|
827
|
-
var StreetLevelDetailsValue =
|
|
828
|
-
var StreetLevelDetailsUpdateValue =
|
|
829
|
-
var BaseAddressFieldValue =
|
|
830
|
-
country:
|
|
991
|
+
originalFilename: z12.string(),
|
|
992
|
+
type: z12.string()
|
|
993
|
+
});
|
|
994
|
+
var NameFieldValue = z12.object({
|
|
995
|
+
firstname: z12.string(),
|
|
996
|
+
surname: z12.string(),
|
|
997
|
+
middlename: z12.string().optional()
|
|
998
|
+
});
|
|
999
|
+
var NameFieldUpdateValue = z12.object({
|
|
1000
|
+
firstname: z12.string().nullish(),
|
|
1001
|
+
surname: z12.string().nullish(),
|
|
1002
|
+
middlename: z12.string().nullish()
|
|
1003
|
+
}).or(z12.null()).or(z12.undefined());
|
|
1004
|
+
var StreetLevelDetailsValue = z12.record(z12.string(), z12.string()).optional();
|
|
1005
|
+
var StreetLevelDetailsUpdateValue = z12.record(z12.string(), z12.string().nullable()).nullish();
|
|
1006
|
+
var BaseAddressFieldValue = z12.object({
|
|
1007
|
+
country: z12.string(),
|
|
831
1008
|
streetLevelDetails: StreetLevelDetailsValue
|
|
832
1009
|
});
|
|
833
|
-
var BaseAddressFieldUpdateValue =
|
|
834
|
-
country:
|
|
1010
|
+
var BaseAddressFieldUpdateValue = z12.object({
|
|
1011
|
+
country: z12.string().nullish(),
|
|
835
1012
|
streetLevelDetails: StreetLevelDetailsUpdateValue
|
|
836
1013
|
});
|
|
837
1014
|
var DomesticAddressFieldValue = BaseAddressFieldValue.extend({
|
|
838
|
-
addressType:
|
|
839
|
-
administrativeArea:
|
|
1015
|
+
addressType: z12.literal(AddressType.DOMESTIC),
|
|
1016
|
+
administrativeArea: z12.string().uuid()
|
|
840
1017
|
});
|
|
841
1018
|
var InternationalAddressFieldValue = BaseAddressFieldValue.extend({
|
|
842
|
-
addressType:
|
|
1019
|
+
addressType: z12.literal(AddressType.INTERNATIONAL)
|
|
843
1020
|
});
|
|
844
|
-
var AddressFieldValue =
|
|
1021
|
+
var AddressFieldValue = z12.discriminatedUnion("addressType", [
|
|
845
1022
|
DomesticAddressFieldValue,
|
|
846
1023
|
InternationalAddressFieldValue
|
|
847
1024
|
]);
|
|
848
1025
|
var DomesticAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend({
|
|
849
|
-
addressType:
|
|
850
|
-
administrativeArea:
|
|
1026
|
+
addressType: z12.literal(AddressType.DOMESTIC),
|
|
1027
|
+
administrativeArea: z12.string().uuid().nullish()
|
|
851
1028
|
/* Leaf level admin structure */
|
|
852
1029
|
});
|
|
853
1030
|
var InternationalAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend(
|
|
854
1031
|
{
|
|
855
|
-
addressType:
|
|
1032
|
+
addressType: z12.literal(AddressType.INTERNATIONAL)
|
|
856
1033
|
}
|
|
857
1034
|
);
|
|
858
|
-
var AddressFieldUpdateValue =
|
|
1035
|
+
var AddressFieldUpdateValue = z12.discriminatedUnion("addressType", [
|
|
859
1036
|
DomesticAddressUpdateFieldValue,
|
|
860
1037
|
InternationalAddressUpdateFieldValue
|
|
861
1038
|
]).nullish();
|
|
862
|
-
var FileFieldValueWithOption =
|
|
1039
|
+
var FileFieldValueWithOption = z12.object({
|
|
863
1040
|
path: DocumentPath,
|
|
864
|
-
originalFilename:
|
|
865
|
-
type:
|
|
866
|
-
option:
|
|
867
|
-
});
|
|
868
|
-
var FileFieldWithOptionValue =
|
|
869
|
-
var HttpFieldValue =
|
|
870
|
-
loading:
|
|
871
|
-
error:
|
|
872
|
-
data:
|
|
873
|
-
});
|
|
874
|
-
var HttpFieldUpdateValue =
|
|
875
|
-
loading:
|
|
876
|
-
error:
|
|
877
|
-
data:
|
|
878
|
-
}).or(
|
|
879
|
-
var QueryParamReaderFieldValue =
|
|
880
|
-
data:
|
|
881
|
-
updatedAt:
|
|
1041
|
+
originalFilename: z12.string(),
|
|
1042
|
+
type: z12.string(),
|
|
1043
|
+
option: z12.string()
|
|
1044
|
+
});
|
|
1045
|
+
var FileFieldWithOptionValue = z12.array(FileFieldValueWithOption);
|
|
1046
|
+
var HttpFieldValue = z12.object({
|
|
1047
|
+
loading: z12.boolean(),
|
|
1048
|
+
error: z12.object({ statusCode: z12.number(), message: z12.string() }).nullish(),
|
|
1049
|
+
data: z12.any()
|
|
1050
|
+
});
|
|
1051
|
+
var HttpFieldUpdateValue = z12.object({
|
|
1052
|
+
loading: z12.boolean().nullish(),
|
|
1053
|
+
error: z12.object({ statusCode: z12.number(), message: z12.string() }).nullish(),
|
|
1054
|
+
data: z12.any().nullish()
|
|
1055
|
+
}).or(z12.null()).or(z12.undefined());
|
|
1056
|
+
var QueryParamReaderFieldValue = z12.object({
|
|
1057
|
+
data: z12.record(z12.string(), z12.string()),
|
|
1058
|
+
updatedAt: z12.iso.datetime()
|
|
882
1059
|
}).nullish();
|
|
883
|
-
var QueryParamReaderFieldUpdateValue =
|
|
884
|
-
data:
|
|
1060
|
+
var QueryParamReaderFieldUpdateValue = z12.object({
|
|
1061
|
+
data: z12.record(z12.string(), z12.string())
|
|
885
1062
|
});
|
|
886
|
-
var ReadDataValue =
|
|
887
|
-
data:
|
|
1063
|
+
var ReadDataValue = z12.object({
|
|
1064
|
+
data: z12.any()
|
|
888
1065
|
});
|
|
889
1066
|
var QrReaderFieldValue = ReadDataValue;
|
|
890
1067
|
var IdReaderFieldValue = ReadDataValue;
|
|
891
|
-
var NumberWithUnitFieldValue =
|
|
892
|
-
numericValue:
|
|
893
|
-
unit:
|
|
1068
|
+
var NumberWithUnitFieldValue = z12.object({
|
|
1069
|
+
numericValue: z12.number(),
|
|
1070
|
+
unit: z12.string()
|
|
894
1071
|
});
|
|
895
|
-
var NumberWithUnitFieldUpdateValue =
|
|
896
|
-
numericValue:
|
|
897
|
-
unit:
|
|
1072
|
+
var NumberWithUnitFieldUpdateValue = z12.object({
|
|
1073
|
+
numericValue: z12.number().optional(),
|
|
1074
|
+
unit: z12.string().optional()
|
|
898
1075
|
});
|
|
899
|
-
var CustomFieldValue =
|
|
1076
|
+
var CustomFieldValue = z12.unknown().brand("CustomFieldValue");
|
|
900
1077
|
|
|
901
1078
|
// ../commons/src/events/PlainDate.ts
|
|
902
1079
|
var import_zod = require("zod");
|
|
903
1080
|
var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date in the format YYYY-MM-DD");
|
|
904
1081
|
|
|
905
1082
|
// ../commons/src/events/FieldValue.ts
|
|
906
|
-
var TextValue =
|
|
907
|
-
var HiddenFieldValue =
|
|
908
|
-
var NonEmptyTextValue =
|
|
909
|
-
var DateValue =
|
|
910
|
-
var AgeValue =
|
|
911
|
-
age:
|
|
912
|
-
asOfDateRef:
|
|
1083
|
+
var TextValue = z14.string();
|
|
1084
|
+
var HiddenFieldValue = z14.string();
|
|
1085
|
+
var NonEmptyTextValue = z14.string().trim().min(1);
|
|
1086
|
+
var DateValue = z14.iso.date().describe("Date in the format YYYY-MM-DD");
|
|
1087
|
+
var AgeValue = z14.object({
|
|
1088
|
+
age: z14.number(),
|
|
1089
|
+
asOfDateRef: z14.string()
|
|
913
1090
|
});
|
|
914
1091
|
var AgeUpdateValue = AgeValue.optional().nullable();
|
|
915
|
-
var AutocompleteValue =
|
|
916
|
-
label:
|
|
917
|
-
value:
|
|
1092
|
+
var AutocompleteValue = z14.object({
|
|
1093
|
+
label: z14.string(),
|
|
1094
|
+
value: z14.string()
|
|
918
1095
|
});
|
|
919
1096
|
var AutocompleteUpdateValue = AutocompleteValue.optional().nullable();
|
|
920
|
-
var TimeValue =
|
|
921
|
-
var DatetimeValue =
|
|
922
|
-
var SelectDateRangeValue =
|
|
1097
|
+
var TimeValue = z14.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/);
|
|
1098
|
+
var DatetimeValue = z14.iso.datetime();
|
|
1099
|
+
var SelectDateRangeValue = z14.enum([
|
|
923
1100
|
"last7Days",
|
|
924
1101
|
"last30Days",
|
|
925
1102
|
"last90Days",
|
|
926
1103
|
"last365Days"
|
|
927
1104
|
]);
|
|
928
|
-
var DateRangeFieldValue =
|
|
1105
|
+
var DateRangeFieldValue = z14.object({
|
|
929
1106
|
start: PlainDate,
|
|
930
1107
|
end: PlainDate
|
|
931
1108
|
}).or(PlainDate).describe(
|
|
932
1109
|
"Date range with start and end dates in the format YYYY-MM-DD. Inclusive start, exclusive end."
|
|
933
1110
|
);
|
|
934
|
-
var EmailValue =
|
|
935
|
-
var CheckboxFieldValue =
|
|
936
|
-
var NumberFieldValue =
|
|
1111
|
+
var EmailValue = z14.email();
|
|
1112
|
+
var CheckboxFieldValue = z14.boolean();
|
|
1113
|
+
var NumberFieldValue = z14.number();
|
|
937
1114
|
var SignatureFieldValue = FileFieldValue;
|
|
938
|
-
var ButtonFieldValue =
|
|
939
|
-
var VerificationStatusValue =
|
|
1115
|
+
var ButtonFieldValue = z14.number();
|
|
1116
|
+
var VerificationStatusValue = z14.enum([
|
|
940
1117
|
"verified",
|
|
941
1118
|
"authenticated",
|
|
942
1119
|
"failed",
|
|
943
1120
|
"pending"
|
|
944
1121
|
]);
|
|
945
|
-
var LeafFieldValues =
|
|
1122
|
+
var LeafFieldValues = z14.union([
|
|
946
1123
|
AddressFieldValue,
|
|
947
1124
|
TextValue,
|
|
948
1125
|
PlainDate,
|
|
@@ -968,11 +1145,11 @@ var LeafFieldValues = z12.union([
|
|
|
968
1145
|
AutocompleteValue,
|
|
969
1146
|
AutocompleteUpdateValue
|
|
970
1147
|
]);
|
|
971
|
-
var FieldGroupValue =
|
|
972
|
-
var DataFieldValue =
|
|
973
|
-
data:
|
|
1148
|
+
var FieldGroupValue = z14.record(z14.string(), LeafFieldValues);
|
|
1149
|
+
var DataFieldValue = z14.object({
|
|
1150
|
+
data: z14.record(z14.string(), LeafFieldValues)
|
|
974
1151
|
}).nullish();
|
|
975
|
-
var FieldValue =
|
|
1152
|
+
var FieldValue = z14.union([
|
|
976
1153
|
LeafFieldValues,
|
|
977
1154
|
DataFieldValue,
|
|
978
1155
|
FieldGroupValue
|
|
@@ -1006,7 +1183,7 @@ function safeUnion(schemas) {
|
|
|
1006
1183
|
const sortedSchemas = [...schemas].sort(
|
|
1007
1184
|
(a, b) => schemaPriority(a) - schemaPriority(b)
|
|
1008
1185
|
);
|
|
1009
|
-
return
|
|
1186
|
+
return z14.any().superRefine((val, ctx) => {
|
|
1010
1187
|
for (const schema of sortedSchemas) {
|
|
1011
1188
|
if (schema.safeParse(val).success) {
|
|
1012
1189
|
return;
|
|
@@ -1045,9 +1222,9 @@ var FieldUpdateValue = safeUnion([
|
|
|
1045
1222
|
]);
|
|
1046
1223
|
|
|
1047
1224
|
// ../commons/src/events/serializers/user/serializer.ts
|
|
1048
|
-
var
|
|
1049
|
-
var SerializedUserField =
|
|
1050
|
-
$userField:
|
|
1225
|
+
var z15 = __toESM(require("zod/v4"));
|
|
1226
|
+
var SerializedUserField = z15.object({
|
|
1227
|
+
$userField: z15.enum([
|
|
1051
1228
|
"id",
|
|
1052
1229
|
"name",
|
|
1053
1230
|
"role",
|
|
@@ -1061,7 +1238,7 @@ var SerializedUserField = z13.object({
|
|
|
1061
1238
|
"primaryOfficeId",
|
|
1062
1239
|
"administrativeAreaId"
|
|
1063
1240
|
]),
|
|
1064
|
-
$location:
|
|
1241
|
+
$location: z15.string().optional()
|
|
1065
1242
|
});
|
|
1066
1243
|
function userSerializer(userField) {
|
|
1067
1244
|
return {
|
|
@@ -1084,30 +1261,25 @@ function userSerializer(userField) {
|
|
|
1084
1261
|
var import_v4 = require("zod/v4");
|
|
1085
1262
|
|
|
1086
1263
|
// ../commons/src/events/EventMetadata.ts
|
|
1087
|
-
var
|
|
1264
|
+
var z17 = __toESM(require("zod/v4"));
|
|
1088
1265
|
|
|
1089
1266
|
// ../commons/src/events/ActionDocument.ts
|
|
1090
|
-
var
|
|
1091
|
-
var ActionUpdate =
|
|
1267
|
+
var z16 = __toESM(require("zod/v4"));
|
|
1268
|
+
var ActionUpdate = z16.record(z16.string(), FieldUpdateValue).describe(
|
|
1092
1269
|
"Record of field-level changes made by an action. Supports partial updates and nullable values."
|
|
1093
1270
|
);
|
|
1094
|
-
var EventState =
|
|
1271
|
+
var EventState = z16.record(z16.string(), FieldValue).describe(
|
|
1095
1272
|
"Aggregate representation of event data after all actions have been applied, with all updates consolidated and null values removed."
|
|
1096
1273
|
);
|
|
1097
|
-
var
|
|
1098
|
-
Requested: "Requested",
|
|
1099
|
-
Accepted: "Accepted",
|
|
1100
|
-
Rejected: "Rejected"
|
|
1101
|
-
};
|
|
1102
|
-
var ActionBase = z14.object({
|
|
1274
|
+
var ActionBase = z16.object({
|
|
1103
1275
|
id: UUID.describe("Unique identifier of the action."),
|
|
1104
|
-
transactionId:
|
|
1276
|
+
transactionId: z16.string().describe("Unique identifier of the transaction."),
|
|
1105
1277
|
createdByUserType: TokenUserType.describe(
|
|
1106
1278
|
"Indicates whether the action was created by a human-user or by a system-user."
|
|
1107
1279
|
),
|
|
1108
|
-
createdAt:
|
|
1109
|
-
createdBy:
|
|
1110
|
-
createdByRole:
|
|
1280
|
+
createdAt: z16.string().datetime().describe("Timestamp indicating when the action was created."),
|
|
1281
|
+
createdBy: z16.string().describe("Identifier of the user who created the action."),
|
|
1282
|
+
createdByRole: z16.string().optional().describe("Role of the user who created the action."),
|
|
1111
1283
|
createdBySignature: DocumentPath.nullish().describe(
|
|
1112
1284
|
"Reference to the signature of the user who created the action."
|
|
1113
1285
|
),
|
|
@@ -1119,7 +1291,7 @@ var ActionBase = z14.object({
|
|
|
1119
1291
|
"Declaration data defined by the ActionConfig. Supports partial updates."
|
|
1120
1292
|
),
|
|
1121
1293
|
annotation: ActionUpdate.optional().nullable().describe("Action-specific metadata used to annotate the event."),
|
|
1122
|
-
status:
|
|
1294
|
+
status: z16.enum([
|
|
1123
1295
|
ActionStatus.Requested,
|
|
1124
1296
|
ActionStatus.Accepted,
|
|
1125
1297
|
ActionStatus.Rejected
|
|
@@ -1131,139 +1303,143 @@ var ActionBase = z14.object({
|
|
|
1131
1303
|
)
|
|
1132
1304
|
});
|
|
1133
1305
|
var AssignedAction = ActionBase.extend(
|
|
1134
|
-
|
|
1135
|
-
type:
|
|
1136
|
-
assignedTo:
|
|
1306
|
+
z16.object({
|
|
1307
|
+
type: z16.literal(ActionType.ASSIGN),
|
|
1308
|
+
assignedTo: z16.string().describe("Identifier of the user to whom the action is assigned.")
|
|
1137
1309
|
// TODO move into 'content' property
|
|
1138
1310
|
}).shape
|
|
1139
1311
|
);
|
|
1140
1312
|
var UnassignedAction = ActionBase.extend(
|
|
1141
|
-
|
|
1142
|
-
type:
|
|
1313
|
+
z16.object({
|
|
1314
|
+
type: z16.literal(ActionType.UNASSIGN)
|
|
1143
1315
|
}).shape
|
|
1144
1316
|
);
|
|
1145
1317
|
var RegisterAction = ActionBase.extend(
|
|
1146
|
-
|
|
1147
|
-
type:
|
|
1148
|
-
registrationNumber:
|
|
1318
|
+
z16.object({
|
|
1319
|
+
type: z16.literal(ActionType.REGISTER),
|
|
1320
|
+
registrationNumber: z16.string().optional().describe(
|
|
1149
1321
|
"Registration number of the event. Always present for accepted registrations."
|
|
1150
1322
|
)
|
|
1151
1323
|
// TODO move into 'content' property
|
|
1152
1324
|
}).shape
|
|
1153
1325
|
);
|
|
1154
1326
|
var DeclareAction = ActionBase.extend(
|
|
1155
|
-
|
|
1156
|
-
type:
|
|
1327
|
+
z16.object({
|
|
1328
|
+
type: z16.literal(ActionType.DECLARE)
|
|
1157
1329
|
}).shape
|
|
1158
1330
|
);
|
|
1159
|
-
var ReasonContent =
|
|
1160
|
-
reason:
|
|
1331
|
+
var ReasonContent = z16.object({
|
|
1332
|
+
reason: z16.string().min(1, { error: "Message cannot be empty" }).describe(
|
|
1161
1333
|
"Message describing the reason for rejecting or archiving the event."
|
|
1162
1334
|
)
|
|
1163
1335
|
});
|
|
1164
1336
|
var RejectAction = ActionBase.extend(
|
|
1165
|
-
|
|
1166
|
-
type:
|
|
1337
|
+
z16.object({
|
|
1338
|
+
type: z16.literal(ActionType.REJECT),
|
|
1167
1339
|
content: ReasonContent
|
|
1168
1340
|
}).shape
|
|
1169
1341
|
);
|
|
1170
|
-
var PotentialDuplicate =
|
|
1342
|
+
var PotentialDuplicate = z16.object({
|
|
1171
1343
|
id: UUID,
|
|
1172
|
-
trackingId:
|
|
1344
|
+
trackingId: z16.string()
|
|
1173
1345
|
});
|
|
1174
1346
|
var DuplicateDetectedAction = ActionBase.extend(
|
|
1175
|
-
|
|
1176
|
-
type:
|
|
1177
|
-
content:
|
|
1178
|
-
duplicates:
|
|
1347
|
+
z16.object({
|
|
1348
|
+
type: z16.literal(ActionType.DUPLICATE_DETECTED),
|
|
1349
|
+
content: z16.object({
|
|
1350
|
+
duplicates: z16.array(PotentialDuplicate)
|
|
1179
1351
|
})
|
|
1180
1352
|
}).shape
|
|
1181
1353
|
);
|
|
1182
1354
|
var MarkNotDuplicateAction = ActionBase.extend(
|
|
1183
|
-
|
|
1184
|
-
type:
|
|
1355
|
+
z16.object({
|
|
1356
|
+
type: z16.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
1185
1357
|
}).shape
|
|
1186
1358
|
);
|
|
1187
1359
|
var MarkAsDuplicateAction = ActionBase.extend(
|
|
1188
|
-
|
|
1189
|
-
type:
|
|
1190
|
-
content:
|
|
1360
|
+
z16.object({
|
|
1361
|
+
type: z16.literal(ActionType.MARK_AS_DUPLICATE),
|
|
1362
|
+
content: z16.object({
|
|
1191
1363
|
duplicateOf: UUID
|
|
1192
1364
|
}).optional()
|
|
1193
1365
|
}).shape
|
|
1194
1366
|
);
|
|
1195
1367
|
var ArchiveAction = ActionBase.extend(
|
|
1196
|
-
|
|
1197
|
-
type:
|
|
1198
|
-
|
|
1368
|
+
z16.object({
|
|
1369
|
+
type: z16.literal(ActionType.ARCHIVE),
|
|
1370
|
+
/**
|
|
1371
|
+
* Archiving does not collect a reason on its own. Only the
|
|
1372
|
+
* "mark as duplicate" flow archives with a reason attached.
|
|
1373
|
+
*/
|
|
1374
|
+
content: ReasonContent.optional()
|
|
1199
1375
|
}).shape
|
|
1200
1376
|
);
|
|
1201
1377
|
var UnarchiveAction = ActionBase.extend(
|
|
1202
|
-
|
|
1203
|
-
type:
|
|
1378
|
+
z16.object({
|
|
1379
|
+
type: z16.literal(ActionType.UNARCHIVE)
|
|
1204
1380
|
}).shape
|
|
1205
1381
|
);
|
|
1206
1382
|
var CreatedAction = ActionBase.extend(
|
|
1207
|
-
|
|
1208
|
-
type:
|
|
1383
|
+
z16.object({
|
|
1384
|
+
type: z16.literal(ActionType.CREATE)
|
|
1209
1385
|
}).shape
|
|
1210
1386
|
);
|
|
1211
1387
|
var NotifiedAction = ActionBase.extend(
|
|
1212
|
-
|
|
1213
|
-
type:
|
|
1388
|
+
z16.object({
|
|
1389
|
+
type: z16.literal(ActionType.NOTIFY)
|
|
1214
1390
|
}).shape
|
|
1215
1391
|
);
|
|
1216
1392
|
var EditAction = ActionBase.extend(
|
|
1217
|
-
|
|
1218
|
-
type:
|
|
1393
|
+
z16.object({
|
|
1394
|
+
type: z16.literal(ActionType.EDIT),
|
|
1219
1395
|
/** @deprecated New Edit-actions should no longer contain content. This is kept for old 2.0 edits. */
|
|
1220
|
-
content:
|
|
1221
|
-
comment:
|
|
1396
|
+
content: z16.object({
|
|
1397
|
+
comment: z16.string().describe("Comment for the edit action.").optional()
|
|
1222
1398
|
}).optional()
|
|
1223
1399
|
}).shape
|
|
1224
1400
|
);
|
|
1225
|
-
var PrintContent =
|
|
1226
|
-
templateId:
|
|
1401
|
+
var PrintContent = z16.object({
|
|
1402
|
+
templateId: z16.string().optional()
|
|
1227
1403
|
});
|
|
1228
1404
|
var PrintCertificateAction = ActionBase.extend(
|
|
1229
|
-
|
|
1230
|
-
type:
|
|
1405
|
+
z16.object({
|
|
1406
|
+
type: z16.literal(ActionType.PRINT_CERTIFICATE),
|
|
1231
1407
|
content: PrintContent.optional().nullable()
|
|
1232
1408
|
}).shape
|
|
1233
1409
|
);
|
|
1234
1410
|
var RequestedCorrectionAction = ActionBase.extend(
|
|
1235
|
-
|
|
1236
|
-
type:
|
|
1411
|
+
z16.object({
|
|
1412
|
+
type: z16.literal(ActionType.REQUEST_CORRECTION)
|
|
1237
1413
|
}).shape
|
|
1238
1414
|
);
|
|
1239
1415
|
var ApprovedCorrectionAction = ActionBase.extend(
|
|
1240
|
-
|
|
1241
|
-
type:
|
|
1242
|
-
requestId:
|
|
1416
|
+
z16.object({
|
|
1417
|
+
type: z16.literal(ActionType.APPROVE_CORRECTION),
|
|
1418
|
+
requestId: z16.string(),
|
|
1243
1419
|
// TODO move into 'content' property
|
|
1244
|
-
content:
|
|
1420
|
+
content: z16.object({ immediateCorrection: z16.boolean().optional() }).optional()
|
|
1245
1421
|
}).shape
|
|
1246
1422
|
);
|
|
1247
1423
|
var RejectedCorrectionAction = ActionBase.extend(
|
|
1248
|
-
|
|
1249
|
-
type:
|
|
1250
|
-
requestId:
|
|
1424
|
+
z16.object({
|
|
1425
|
+
type: z16.literal(ActionType.REJECT_CORRECTION),
|
|
1426
|
+
requestId: z16.string(),
|
|
1251
1427
|
// TODO move into 'content' property
|
|
1252
1428
|
content: ReasonContent
|
|
1253
1429
|
}).shape
|
|
1254
1430
|
);
|
|
1255
1431
|
var ReadAction = ActionBase.extend(
|
|
1256
|
-
|
|
1257
|
-
type:
|
|
1432
|
+
z16.object({
|
|
1433
|
+
type: z16.literal(ActionType.READ)
|
|
1258
1434
|
}).shape
|
|
1259
1435
|
);
|
|
1260
1436
|
var CustomAction = ActionBase.merge(
|
|
1261
|
-
|
|
1262
|
-
type:
|
|
1263
|
-
customActionType:
|
|
1437
|
+
z16.object({
|
|
1438
|
+
type: z16.literal(ActionType.CUSTOM),
|
|
1439
|
+
customActionType: z16.string()
|
|
1264
1440
|
})
|
|
1265
1441
|
);
|
|
1266
|
-
var ActionDocument =
|
|
1442
|
+
var ActionDocument = z16.discriminatedUnion("type", [
|
|
1267
1443
|
CreatedAction.meta({ id: "CreatedAction" }),
|
|
1268
1444
|
RejectAction.meta({ id: "RejectAction" }),
|
|
1269
1445
|
DuplicateDetectedAction.meta({ id: "DuplicateDetectedAction" }),
|
|
@@ -1290,109 +1466,50 @@ var AsyncRejectActionDocument = ActionBase.omit({
|
|
|
1290
1466
|
declaration: true,
|
|
1291
1467
|
annotation: true
|
|
1292
1468
|
}).extend(
|
|
1293
|
-
|
|
1294
|
-
type:
|
|
1295
|
-
status:
|
|
1469
|
+
z16.object({
|
|
1470
|
+
type: z16.enum(ConfirmableActions),
|
|
1471
|
+
status: z16.literal(ActionStatus.Rejected)
|
|
1296
1472
|
}).shape
|
|
1297
1473
|
);
|
|
1298
|
-
var Action =
|
|
1299
|
-
|
|
1300
|
-
// ../commons/src/events/Flag.ts
|
|
1301
|
-
var z15 = __toESM(require("zod/v4"));
|
|
1302
|
-
var InherentFlags = {
|
|
1303
|
-
INCOMPLETE: "incomplete",
|
|
1304
|
-
REJECTED: "rejected",
|
|
1305
|
-
CORRECTION_REQUESTED: "correction-requested",
|
|
1306
|
-
POTENTIAL_DUPLICATE: "potential-duplicate",
|
|
1307
|
-
/**
|
|
1308
|
-
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
1309
|
-
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
1310
|
-
*
|
|
1311
|
-
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
1312
|
-
*/
|
|
1313
|
-
EDIT_IN_PROGRESS: "edit-in-progress"
|
|
1314
|
-
};
|
|
1315
|
-
var ActionFlag = z15.string().regex(
|
|
1316
|
-
new RegExp(
|
|
1317
|
-
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
1318
|
-
ActionStatus
|
|
1319
|
-
).join("|").toLowerCase()})$`
|
|
1320
|
-
),
|
|
1321
|
-
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
1322
|
-
);
|
|
1323
|
-
var CustomFlag = z15.string().refine((val) => !Object.values(InherentFlags).includes(val), {
|
|
1324
|
-
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
1325
|
-
InherentFlags
|
|
1326
|
-
).join(", ")}`
|
|
1327
|
-
}).refine((val) => !ActionFlag.safeParse(val).success, {
|
|
1328
|
-
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
1329
|
-
}).describe("Custom flag identifier defined by the country config.");
|
|
1330
|
-
var Flag = ActionFlag.or(z15.enum(InherentFlags)).or(CustomFlag);
|
|
1331
|
-
var FlagConfig = z15.object({
|
|
1332
|
-
id: CustomFlag,
|
|
1333
|
-
requiresAction: z15.boolean().describe(
|
|
1334
|
-
"Indicates if this flag expects an action to be performed to be cleared."
|
|
1335
|
-
),
|
|
1336
|
-
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1337
|
-
}).meta({
|
|
1338
|
-
id: "FlagConfig",
|
|
1339
|
-
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
1340
|
-
});
|
|
1341
|
-
var ActionFlagConfig = z15.object({
|
|
1342
|
-
id: Flag,
|
|
1343
|
-
operation: z15.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
1344
|
-
conditional: Conditional.optional().describe(
|
|
1345
|
-
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1346
|
-
)
|
|
1347
|
-
}).meta({
|
|
1348
|
-
id: "ActionFlagConfig",
|
|
1349
|
-
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
1350
|
-
});
|
|
1474
|
+
var Action = z16.union([ActionDocument, AsyncRejectActionDocument]);
|
|
1351
1475
|
|
|
1352
1476
|
// ../commons/src/events/EventMetadata.ts
|
|
1353
|
-
var
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
"
|
|
1357
|
-
"
|
|
1358
|
-
"ARCHIVED"
|
|
1359
|
-
]);
|
|
1360
|
-
var ZodDate = z16.iso.date();
|
|
1361
|
-
var ZodDateTime = z16.string().datetime();
|
|
1362
|
-
var ActionCreationMetadata = z16.object({
|
|
1363
|
-
createdAt: z16.iso.datetime().describe("The timestamp when the action request was created."),
|
|
1364
|
-
createdBy: z16.string().describe("ID of the user who created the action request."),
|
|
1477
|
+
var ZodDate = z17.iso.date();
|
|
1478
|
+
var ZodDateTime = z17.string().datetime();
|
|
1479
|
+
var ActionCreationMetadata = z17.object({
|
|
1480
|
+
createdAt: z17.iso.datetime().describe("The timestamp when the action request was created."),
|
|
1481
|
+
createdBy: z17.string().describe("ID of the user who created the action request."),
|
|
1365
1482
|
// @TODO: createdAtLocation should be non-nullable in the future once all action requests have this field populated.
|
|
1366
1483
|
createdAtLocation: UUID.nullish().describe(
|
|
1367
1484
|
"Location of the user who created the action request."
|
|
1368
1485
|
),
|
|
1369
|
-
createdByUserType:
|
|
1370
|
-
acceptedAt:
|
|
1371
|
-
createdByRole:
|
|
1486
|
+
createdByUserType: z17.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1487
|
+
acceptedAt: z17.iso.datetime().describe("Timestamp when the action request was accepted."),
|
|
1488
|
+
createdByRole: z17.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1372
1489
|
});
|
|
1373
1490
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
1374
|
-
registrationNumber:
|
|
1491
|
+
registrationNumber: z17.string().describe(
|
|
1375
1492
|
"Registration number of the event. Always present for accepted registrations."
|
|
1376
1493
|
)
|
|
1377
1494
|
});
|
|
1378
|
-
var LegalStatuses =
|
|
1495
|
+
var LegalStatuses = z17.object({
|
|
1379
1496
|
[EventStatus.enum.NOTIFIED]: ActionCreationMetadata.nullish(),
|
|
1380
1497
|
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
|
1381
1498
|
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
|
1382
1499
|
});
|
|
1383
|
-
var EventMetadata =
|
|
1500
|
+
var EventMetadata = z17.object({
|
|
1384
1501
|
id: UUID,
|
|
1385
|
-
type:
|
|
1502
|
+
type: z17.string().describe("The type of event, such as birth, death, or marriage."),
|
|
1386
1503
|
status: EventStatus,
|
|
1387
1504
|
legalStatuses: LegalStatuses.describe(
|
|
1388
1505
|
"Metadata related to the legal registration of the event, such as who registered it and when."
|
|
1389
1506
|
),
|
|
1390
|
-
createdAt:
|
|
1507
|
+
createdAt: z17.iso.datetime().describe("The timestamp when the event was first created and saved."),
|
|
1391
1508
|
dateOfEvent: ZodDate.nullish(),
|
|
1392
1509
|
placeOfEvent: UUID.nullish(),
|
|
1393
|
-
createdBy:
|
|
1394
|
-
createdByUserType:
|
|
1395
|
-
updatedByUserRole:
|
|
1510
|
+
createdBy: z17.string().describe("ID of the user who created the event."),
|
|
1511
|
+
createdByUserType: z17.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1512
|
+
updatedByUserRole: z17.string().nullish().describe("Role of the user who last changed the status."),
|
|
1396
1513
|
// @TODO: createdAtLocation should be non-nullable in the future once all action requests have this field populated.
|
|
1397
1514
|
createdAtLocation: UUID.nullish().describe(
|
|
1398
1515
|
"Location of the user who created the event."
|
|
@@ -1400,18 +1517,18 @@ var EventMetadata = z16.object({
|
|
|
1400
1517
|
updatedAtLocation: UUID.nullish().describe(
|
|
1401
1518
|
"Location of the user who last changed the status."
|
|
1402
1519
|
),
|
|
1403
|
-
updatedAt:
|
|
1520
|
+
updatedAt: z17.iso.datetime().describe(
|
|
1404
1521
|
"Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
|
|
1405
1522
|
),
|
|
1406
|
-
assignedTo:
|
|
1407
|
-
updatedBy:
|
|
1408
|
-
trackingId:
|
|
1523
|
+
assignedTo: z17.string().nullish().describe("ID of the user currently assigned to the event."),
|
|
1524
|
+
updatedBy: z17.string().nullish().describe("ID of the user who last changed the status."),
|
|
1525
|
+
trackingId: z17.string().describe(
|
|
1409
1526
|
"System-generated tracking ID used by informants or registrars to look up the event."
|
|
1410
1527
|
),
|
|
1411
|
-
potentialDuplicates:
|
|
1528
|
+
potentialDuplicates: z17.array(PotentialDuplicate).describe(
|
|
1412
1529
|
"List of event IDs and their tracking IDs that this event could be a duplicate of."
|
|
1413
1530
|
),
|
|
1414
|
-
flags:
|
|
1531
|
+
flags: z17.array(Flag)
|
|
1415
1532
|
});
|
|
1416
1533
|
var EventMetadataKeysArray = [
|
|
1417
1534
|
"id",
|
|
@@ -1432,8 +1549,8 @@ var EventMetadataKeysArray = [
|
|
|
1432
1549
|
"legalStatuses",
|
|
1433
1550
|
"flags"
|
|
1434
1551
|
];
|
|
1435
|
-
var EventMetadataKeys =
|
|
1436
|
-
var EventMetadataDateFieldIdInput =
|
|
1552
|
+
var EventMetadataKeys = z17.enum(EventMetadataKeysArray);
|
|
1553
|
+
var EventMetadataDateFieldIdInput = z17.enum([
|
|
1437
1554
|
"createdAt",
|
|
1438
1555
|
"updatedAt",
|
|
1439
1556
|
"legalStatuses.NOTIFIED.createdAt",
|
|
@@ -1443,7 +1560,7 @@ var EventMetadataDateFieldIdInput = z16.enum([
|
|
|
1443
1560
|
"legalStatuses.REGISTERED.createdAt",
|
|
1444
1561
|
"legalStatuses.REGISTERED.acceptedAt"
|
|
1445
1562
|
]);
|
|
1446
|
-
var EventMetadataDateFieldId =
|
|
1563
|
+
var EventMetadataDateFieldId = z17.enum([
|
|
1447
1564
|
"event.createdAt",
|
|
1448
1565
|
"event.updatedAt",
|
|
1449
1566
|
"event.legalStatuses.NOTIFIED.createdAt",
|
|
@@ -1505,13 +1622,6 @@ var Range = import_v4.z.object({
|
|
|
1505
1622
|
}).meta({
|
|
1506
1623
|
id: "Range"
|
|
1507
1624
|
});
|
|
1508
|
-
var ContainsFlags = import_v4.z.object({
|
|
1509
|
-
anyOf: import_v4.z.array(Flag).optional(),
|
|
1510
|
-
noneOf: import_v4.z.array(Flag).optional(),
|
|
1511
|
-
allOf: import_v4.z.array(Flag).optional()
|
|
1512
|
-
}).meta({
|
|
1513
|
-
id: "ContainsFlags"
|
|
1514
|
-
});
|
|
1515
1625
|
var Within = import_v4.z.object({ type: import_v4.z.literal("within"), location: import_v4.z.string() }).meta({
|
|
1516
1626
|
id: "Within"
|
|
1517
1627
|
});
|
|
@@ -1738,8 +1848,8 @@ var BaseField = import_v43.default.object({
|
|
|
1738
1848
|
conditionals: import_v43.default.array(FieldConditional).default([]).optional().describe(
|
|
1739
1849
|
"Conditions determining when the field is shown or enabled. By default, the field is always shown and enabled."
|
|
1740
1850
|
),
|
|
1741
|
-
secured: import_v43.default.boolean().default(false).optional().describe(
|
|
1742
|
-
"Indicates whether the field is secured. Secured fields are not indexed for search and are only visible when explicitly assigned."
|
|
1851
|
+
secured: import_v43.default.union([import_v43.default.boolean(), Conditional]).default(false).optional().describe(
|
|
1852
|
+
"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."
|
|
1743
1853
|
),
|
|
1744
1854
|
placeholder: TranslationConfig.optional(),
|
|
1745
1855
|
validation: import_v43.default.array(ValidationConfig).default([]).optional().describe("Additional validation rules applied to the field."),
|
|
@@ -2137,7 +2247,16 @@ var AdministrativeAreaField = BaseField.extend({
|
|
|
2137
2247
|
configuration: import_v43.default.object({
|
|
2138
2248
|
partOf: FieldReference.optional().describe("Parent location"),
|
|
2139
2249
|
type: AdministrativeAreas,
|
|
2140
|
-
allowedLocations: AllowedLocations
|
|
2250
|
+
allowedLocations: AllowedLocations,
|
|
2251
|
+
listHistoricalNames: import_v43.default.boolean().optional().describe(
|
|
2252
|
+
"List every historical name a location has had as a separate, selectable option."
|
|
2253
|
+
),
|
|
2254
|
+
activeOnly: import_v43.default.boolean().optional().describe(
|
|
2255
|
+
"Offer only locations that are active at the resolved anchor date (today, or the date of event when anchorToDateOfEvent is set); inactive or not-yet-effective versions are excluded."
|
|
2256
|
+
),
|
|
2257
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional().describe(
|
|
2258
|
+
"Resolve selectable/displayed versions against the event's date of event (falling back to the record's creation date when empty) instead of today. Does not by itself exclude inactive versions; combine with activeOnly for that."
|
|
2259
|
+
)
|
|
2141
2260
|
}).describe("Administrative area options")
|
|
2142
2261
|
}).meta({
|
|
2143
2262
|
description: "Administrative area input field",
|
|
@@ -2148,7 +2267,16 @@ var LocationInput = BaseField.extend({
|
|
|
2148
2267
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
|
|
2149
2268
|
configuration: import_v43.default.object({
|
|
2150
2269
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
2151
|
-
allowedLocations: AllowedLocations
|
|
2270
|
+
allowedLocations: AllowedLocations,
|
|
2271
|
+
listHistoricalNames: import_v43.default.boolean().optional().describe(
|
|
2272
|
+
"List every historical name a location has had as a separate, selectable option."
|
|
2273
|
+
),
|
|
2274
|
+
activeOnly: import_v43.default.boolean().optional().describe(
|
|
2275
|
+
"Offer only locations that are active at the resolved anchor date (today, or the date of event when anchorToDateOfEvent is set); inactive or not-yet-effective versions are excluded."
|
|
2276
|
+
),
|
|
2277
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional().describe(
|
|
2278
|
+
"Resolve selectable/displayed versions against the event's date of event (falling back to the record's creation date when empty) instead of today. Does not by itself exclude inactive versions; combine with activeOnly for that."
|
|
2279
|
+
)
|
|
2152
2280
|
}).optional()
|
|
2153
2281
|
}).meta({
|
|
2154
2282
|
description: "A field for selecting a location",
|
|
@@ -2174,12 +2302,22 @@ var FileUploadWithOptions = BaseField.extend({
|
|
|
2174
2302
|
var Facility = BaseField.extend({
|
|
2175
2303
|
type: import_v43.default.literal(FieldType.FACILITY),
|
|
2176
2304
|
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
2177
|
-
configuration: import_v43.default.object({
|
|
2305
|
+
configuration: import_v43.default.object({
|
|
2306
|
+
allowedLocations: AllowedLocations,
|
|
2307
|
+
listHistoricalNames: import_v43.default.boolean().optional(),
|
|
2308
|
+
activeOnly: import_v43.default.boolean().optional(),
|
|
2309
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional()
|
|
2310
|
+
}).optional()
|
|
2178
2311
|
}).describe("Input field for a facility");
|
|
2179
2312
|
var Office = BaseField.extend({
|
|
2180
2313
|
type: import_v43.default.literal(FieldType.OFFICE),
|
|
2181
2314
|
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
2182
|
-
configuration: import_v43.default.object({
|
|
2315
|
+
configuration: import_v43.default.object({
|
|
2316
|
+
allowedLocations: AllowedLocations,
|
|
2317
|
+
listHistoricalNames: import_v43.default.boolean().optional(),
|
|
2318
|
+
activeOnly: import_v43.default.boolean().optional(),
|
|
2319
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional()
|
|
2320
|
+
}).optional()
|
|
2183
2321
|
}).describe("Input field for an office");
|
|
2184
2322
|
var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
|
|
2185
2323
|
administrativeArea: import_v43.default.union([UUID, SerializedUserField]).optional()
|
|
@@ -2212,7 +2350,16 @@ var Address = BaseField.extend({
|
|
|
2212
2350
|
parent: FieldReference.optional()
|
|
2213
2351
|
})
|
|
2214
2352
|
).optional(),
|
|
2215
|
-
allowedLocations: AllowedLocations
|
|
2353
|
+
allowedLocations: AllowedLocations,
|
|
2354
|
+
listHistoricalNames: import_v43.default.boolean().optional().describe(
|
|
2355
|
+
"List every historical name a location has had as a separate, selectable option. Propagated to the embedded admin-area selectors."
|
|
2356
|
+
),
|
|
2357
|
+
activeOnly: import_v43.default.boolean().optional().describe(
|
|
2358
|
+
"Offer only admin areas that are active at the resolved anchor date (today, or the date of event when anchorToDateOfEvent is set); inactive or not-yet-effective versions are excluded. Propagated to the embedded admin-area selectors."
|
|
2359
|
+
),
|
|
2360
|
+
anchorToDateOfEvent: import_v43.default.boolean().optional().describe(
|
|
2361
|
+
"Resolve selectable/displayed versions against the event's date of event (falling back to the record's creation date when empty) instead of today. Does not by itself exclude inactive versions; combine with activeOnly for that. Propagated to the embedded admin-area selectors."
|
|
2362
|
+
)
|
|
2216
2363
|
}).optional(),
|
|
2217
2364
|
defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
|
|
2218
2365
|
}).meta({
|
|
@@ -2513,18 +2660,21 @@ var AnyFileField = import_v43.default.discriminatedUnion("type", [
|
|
|
2513
2660
|
]);
|
|
2514
2661
|
|
|
2515
2662
|
// ../commons/src/events/FormConfig.ts
|
|
2516
|
-
var
|
|
2663
|
+
var z23 = __toESM(require("zod/v4"));
|
|
2517
2664
|
|
|
2518
2665
|
// ../commons/src/events/PageConfig.ts
|
|
2519
|
-
var
|
|
2520
|
-
var PageTypes =
|
|
2521
|
-
var PageConfigBase =
|
|
2522
|
-
id:
|
|
2666
|
+
var z22 = __toESM(require("zod/v4"));
|
|
2667
|
+
var PageTypes = z22.enum(["FORM", "VERIFICATION"]);
|
|
2668
|
+
var PageConfigBase = z22.object({
|
|
2669
|
+
id: z22.string().describe("Unique identifier for the page"),
|
|
2523
2670
|
title: TranslationConfig.describe("Header title of the page"),
|
|
2524
|
-
requireCompletionToContinue:
|
|
2671
|
+
requireCompletionToContinue: z22.boolean().default(false).describe(
|
|
2525
2672
|
"If true, all required fields must be filled before continuing to the next page"
|
|
2526
2673
|
),
|
|
2527
|
-
|
|
2674
|
+
showClearButton: z22.boolean().optional().describe(
|
|
2675
|
+
'If true, a "Clear" button is shown at the top of the page allowing the user to reset all fields on the page to their default state'
|
|
2676
|
+
),
|
|
2677
|
+
fields: z22.array(FieldConfig).describe("Fields to be rendered on the page"),
|
|
2528
2678
|
conditional: Conditional.optional().describe(
|
|
2529
2679
|
"Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
|
|
2530
2680
|
)
|
|
@@ -2533,13 +2683,13 @@ var PageConfigBase = z21.object({
|
|
|
2533
2683
|
id: "FormPageConfig"
|
|
2534
2684
|
});
|
|
2535
2685
|
var FormPageConfig = PageConfigBase.extend({
|
|
2536
|
-
type:
|
|
2686
|
+
type: z22.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
|
|
2537
2687
|
});
|
|
2538
|
-
var VerificationActionConfig =
|
|
2539
|
-
verify:
|
|
2540
|
-
cancel:
|
|
2688
|
+
var VerificationActionConfig = z22.object({
|
|
2689
|
+
verify: z22.object({ label: TranslationConfig }),
|
|
2690
|
+
cancel: z22.object({
|
|
2541
2691
|
label: TranslationConfig,
|
|
2542
|
-
confirmation:
|
|
2692
|
+
confirmation: z22.object({
|
|
2543
2693
|
title: TranslationConfig,
|
|
2544
2694
|
body: TranslationConfig
|
|
2545
2695
|
})
|
|
@@ -2549,34 +2699,34 @@ var VerificationActionConfig = z21.object({
|
|
|
2549
2699
|
id: "VerificationActionConfig"
|
|
2550
2700
|
});
|
|
2551
2701
|
var VerificationPageConfig = FormPageConfig.extend({
|
|
2552
|
-
type:
|
|
2702
|
+
type: z22.literal(PageTypes.enum.VERIFICATION),
|
|
2553
2703
|
actions: VerificationActionConfig
|
|
2554
2704
|
});
|
|
2555
|
-
var PageConfig =
|
|
2705
|
+
var PageConfig = z22.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
|
|
2556
2706
|
id: "PageConfig",
|
|
2557
2707
|
description: "Configuration for a single page in a form. Either a form page with fields and a continue button, or a verification page with verify/cancel options."
|
|
2558
2708
|
});
|
|
2559
2709
|
|
|
2560
2710
|
// ../commons/src/events/FormConfig.ts
|
|
2561
|
-
var DeclarationFormConfig =
|
|
2711
|
+
var DeclarationFormConfig = z23.object({
|
|
2562
2712
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
2563
|
-
pages:
|
|
2713
|
+
pages: z23.array(FormPageConfig)
|
|
2564
2714
|
}).meta({
|
|
2565
2715
|
id: "DeclarationFormConfig",
|
|
2566
2716
|
description: "Configuration of the declaration form."
|
|
2567
2717
|
});
|
|
2568
|
-
var ActionFormConfig =
|
|
2718
|
+
var ActionFormConfig = z23.object({
|
|
2569
2719
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
2570
|
-
pages:
|
|
2720
|
+
pages: z23.array(PageConfig)
|
|
2571
2721
|
}).describe(
|
|
2572
2722
|
"Configuration of the form used for system actions beyond declaration, supporting a wider range of page types."
|
|
2573
2723
|
);
|
|
2574
|
-
var FormConfig =
|
|
2724
|
+
var FormConfig = z23.union([DeclarationFormConfig, ActionFormConfig]);
|
|
2575
2725
|
|
|
2576
2726
|
// ../commons/src/events/DeduplicationConfig.ts
|
|
2577
|
-
var
|
|
2578
|
-
var FieldReference2 =
|
|
2579
|
-
var Matcher =
|
|
2727
|
+
var z24 = __toESM(require("zod/v4"));
|
|
2728
|
+
var FieldReference2 = z24.string();
|
|
2729
|
+
var Matcher = z24.object({
|
|
2580
2730
|
/**
|
|
2581
2731
|
* Reference to the field used in matching.
|
|
2582
2732
|
*
|
|
@@ -2584,23 +2734,23 @@ var Matcher = z23.object({
|
|
|
2584
2734
|
* be used as the origin date to calculate the distance from.
|
|
2585
2735
|
*/
|
|
2586
2736
|
fieldId: FieldReference2,
|
|
2587
|
-
options:
|
|
2588
|
-
boost:
|
|
2737
|
+
options: z24.object({
|
|
2738
|
+
boost: z24.number().optional(),
|
|
2589
2739
|
matchAgainst: FieldReference2.optional()
|
|
2590
2740
|
}).optional().default({
|
|
2591
2741
|
boost: 1
|
|
2592
2742
|
})
|
|
2593
2743
|
});
|
|
2594
2744
|
var FuzzyMatcher = Matcher.extend({
|
|
2595
|
-
type:
|
|
2596
|
-
options:
|
|
2745
|
+
type: z24.literal("fuzzy"),
|
|
2746
|
+
options: z24.object({
|
|
2597
2747
|
/**
|
|
2598
2748
|
* Names of length 3 or less characters = 0 edits allowed
|
|
2599
2749
|
* Names of length 4 - 6 characters = 1 edit allowed
|
|
2600
2750
|
* Names of length >7 characters = 2 edits allowed
|
|
2601
2751
|
*/
|
|
2602
|
-
fuzziness:
|
|
2603
|
-
boost:
|
|
2752
|
+
fuzziness: z24.union([z24.string(), z24.number()]).optional().default("AUTO:4,7"),
|
|
2753
|
+
boost: z24.number().optional().default(1),
|
|
2604
2754
|
matchAgainst: FieldReference2.optional()
|
|
2605
2755
|
}).optional().default({
|
|
2606
2756
|
fuzziness: "AUTO:4,7",
|
|
@@ -2608,48 +2758,48 @@ var FuzzyMatcher = Matcher.extend({
|
|
|
2608
2758
|
})
|
|
2609
2759
|
});
|
|
2610
2760
|
var StrictMatcher = Matcher.extend({
|
|
2611
|
-
type:
|
|
2612
|
-
options:
|
|
2613
|
-
boost:
|
|
2761
|
+
type: z24.literal("strict"),
|
|
2762
|
+
options: z24.object({
|
|
2763
|
+
boost: z24.number().optional().default(1),
|
|
2614
2764
|
/**
|
|
2615
2765
|
* The constant value to be present in the field for both records
|
|
2616
2766
|
*/
|
|
2617
|
-
value:
|
|
2767
|
+
value: z24.string().optional(),
|
|
2618
2768
|
matchAgainst: FieldReference2.optional()
|
|
2619
2769
|
}).optional().default({
|
|
2620
2770
|
boost: 1
|
|
2621
2771
|
})
|
|
2622
2772
|
});
|
|
2623
2773
|
var DateRangeMatcher = Matcher.extend({
|
|
2624
|
-
type:
|
|
2625
|
-
options:
|
|
2774
|
+
type: z24.literal("dateRange"),
|
|
2775
|
+
options: z24.object({
|
|
2626
2776
|
/**
|
|
2627
2777
|
* The distance pivot in days. Distance from the origin (the value of
|
|
2628
2778
|
* fieldId) at which relevance scores receive half of the boost value
|
|
2629
2779
|
*/
|
|
2630
|
-
pivot:
|
|
2631
|
-
days:
|
|
2632
|
-
boost:
|
|
2780
|
+
pivot: z24.number().optional(),
|
|
2781
|
+
days: z24.number(),
|
|
2782
|
+
boost: z24.number().optional().default(1),
|
|
2633
2783
|
matchAgainst: FieldReference2.optional()
|
|
2634
2784
|
})
|
|
2635
2785
|
});
|
|
2636
|
-
var Not =
|
|
2637
|
-
type:
|
|
2786
|
+
var Not = z24.object({
|
|
2787
|
+
type: z24.literal("not"),
|
|
2638
2788
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2639
|
-
clause:
|
|
2789
|
+
clause: z24.lazy(() => Clause)
|
|
2640
2790
|
});
|
|
2641
|
-
var And =
|
|
2642
|
-
type:
|
|
2791
|
+
var And = z24.object({
|
|
2792
|
+
type: z24.literal("and"),
|
|
2643
2793
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2644
|
-
clauses:
|
|
2794
|
+
clauses: z24.lazy(() => Clause.array())
|
|
2645
2795
|
});
|
|
2646
|
-
var Or =
|
|
2647
|
-
type:
|
|
2796
|
+
var Or = z24.object({
|
|
2797
|
+
type: z24.literal("or"),
|
|
2648
2798
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2649
|
-
clauses:
|
|
2799
|
+
clauses: z24.lazy(() => Clause.array())
|
|
2650
2800
|
});
|
|
2651
|
-
var Clause =
|
|
2652
|
-
() =>
|
|
2801
|
+
var Clause = z24.lazy(
|
|
2802
|
+
() => z24.discriminatedUnion("type", [
|
|
2653
2803
|
Not,
|
|
2654
2804
|
And,
|
|
2655
2805
|
Or,
|
|
@@ -2660,8 +2810,8 @@ var Clause = z23.lazy(
|
|
|
2660
2810
|
).meta({
|
|
2661
2811
|
id: "Clause"
|
|
2662
2812
|
});
|
|
2663
|
-
var DeduplicationConfig =
|
|
2664
|
-
id:
|
|
2813
|
+
var DeduplicationConfig = z24.object({
|
|
2814
|
+
id: z24.string(),
|
|
2665
2815
|
label: TranslationConfig,
|
|
2666
2816
|
query: Clause
|
|
2667
2817
|
}).meta({
|
|
@@ -2670,15 +2820,15 @@ var DeduplicationConfig = z23.object({
|
|
|
2670
2820
|
});
|
|
2671
2821
|
|
|
2672
2822
|
// ../commons/src/events/ActionConfig.ts
|
|
2673
|
-
var DeclarationReviewConfig =
|
|
2823
|
+
var DeclarationReviewConfig = z25.object({
|
|
2674
2824
|
title: TranslationConfig.describe("Title of the review page"),
|
|
2675
|
-
fields:
|
|
2825
|
+
fields: z25.array(FieldConfig).describe("Fields displayed on the review page for annotations.")
|
|
2676
2826
|
}).describe(
|
|
2677
2827
|
"Configuration of the declaration review page for collecting event-related metadata."
|
|
2678
2828
|
);
|
|
2679
|
-
var ActionConfigBase =
|
|
2829
|
+
var ActionConfigBase = z25.object({
|
|
2680
2830
|
label: TranslationConfig.describe("Human readable description of the action"),
|
|
2681
|
-
flags:
|
|
2831
|
+
flags: z25.array(ActionFlagConfig).optional().default([]).describe("Flag actions which are executed when the action is performed."),
|
|
2682
2832
|
supportingCopy: TranslationConfig.optional().describe(
|
|
2683
2833
|
"Text displayed on the confirmation dialog"
|
|
2684
2834
|
),
|
|
@@ -2689,84 +2839,84 @@ var ActionConfigBase = z24.object({
|
|
|
2689
2839
|
* "The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed."
|
|
2690
2840
|
* for EventConfig.d.ts.
|
|
2691
2841
|
*/
|
|
2692
|
-
icon:
|
|
2693
|
-
conditionals:
|
|
2842
|
+
icon: z25.string().describe("Icon representing the action").optional(),
|
|
2843
|
+
conditionals: z25.array(ActionConditional).optional().describe("Conditionals which can disable or hide actions.")
|
|
2694
2844
|
});
|
|
2695
2845
|
var DeclarationActionBase = ActionConfigBase.extend({
|
|
2696
2846
|
deduplication: DeduplicationConfig.optional()
|
|
2697
2847
|
});
|
|
2698
|
-
var actionConfirmationForm =
|
|
2848
|
+
var actionConfirmationForm = z25.array(FieldConfig).optional().describe(
|
|
2699
2849
|
"Fields rendered on the action confirmation dialog. Submitted values are stored in the action annotation and shown in the audit history."
|
|
2700
2850
|
);
|
|
2701
2851
|
var ReadActionConfig = ActionConfigBase.extend(
|
|
2702
|
-
|
|
2703
|
-
type:
|
|
2852
|
+
z25.object({
|
|
2853
|
+
type: z25.literal(ActionType.READ),
|
|
2704
2854
|
review: DeclarationReviewConfig.describe(
|
|
2705
2855
|
"Configuration of the review page for read-only view."
|
|
2706
2856
|
),
|
|
2707
|
-
conditionals:
|
|
2857
|
+
conditionals: z25.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
|
|
2708
2858
|
}).shape
|
|
2709
2859
|
);
|
|
2710
2860
|
var NotifyConfig = ActionConfigBase.extend(
|
|
2711
|
-
|
|
2712
|
-
type:
|
|
2861
|
+
z25.object({
|
|
2862
|
+
type: z25.literal(ActionType.NOTIFY),
|
|
2713
2863
|
form: actionConfirmationForm
|
|
2714
2864
|
}).shape
|
|
2715
2865
|
);
|
|
2716
2866
|
var DuplicateDetectedConfig = ActionConfigBase.extend(
|
|
2717
|
-
|
|
2718
|
-
type:
|
|
2719
|
-
label:
|
|
2867
|
+
z25.object({
|
|
2868
|
+
type: z25.literal(ActionType.DUPLICATE_DETECTED),
|
|
2869
|
+
label: z25.never().optional().describe(
|
|
2720
2870
|
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no label."
|
|
2721
2871
|
),
|
|
2722
|
-
supportingCopy:
|
|
2723
|
-
icon:
|
|
2872
|
+
supportingCopy: z25.never().optional(),
|
|
2873
|
+
icon: z25.never().optional().describe(
|
|
2724
2874
|
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no icon."
|
|
2725
2875
|
),
|
|
2726
|
-
conditionals:
|
|
2876
|
+
conditionals: z25.never().optional().describe(
|
|
2727
2877
|
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it cannot be disabled or hidden with conditionals."
|
|
2728
2878
|
)
|
|
2729
2879
|
}).shape
|
|
2730
2880
|
);
|
|
2731
2881
|
var MarkAsDuplicateConfig = ActionConfigBase.extend(
|
|
2732
|
-
|
|
2733
|
-
type:
|
|
2882
|
+
z25.object({
|
|
2883
|
+
type: z25.literal(ActionType.MARK_AS_DUPLICATE)
|
|
2734
2884
|
}).shape
|
|
2735
2885
|
);
|
|
2736
2886
|
var MarkAsNotDuplicateConfig = ActionConfigBase.extend(
|
|
2737
|
-
|
|
2738
|
-
type:
|
|
2887
|
+
z25.object({
|
|
2888
|
+
type: z25.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
2739
2889
|
}).shape
|
|
2740
2890
|
);
|
|
2741
2891
|
var AssignConfig = ActionConfigBase.extend(
|
|
2742
|
-
|
|
2743
|
-
type:
|
|
2744
|
-
flags:
|
|
2892
|
+
z25.object({
|
|
2893
|
+
type: z25.literal(ActionType.ASSIGN),
|
|
2894
|
+
flags: z25.never().optional().describe(
|
|
2745
2895
|
"ASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
|
|
2746
2896
|
)
|
|
2747
2897
|
}).shape
|
|
2748
2898
|
);
|
|
2749
2899
|
var UnassignConfig = ActionConfigBase.extend(
|
|
2750
|
-
|
|
2751
|
-
type:
|
|
2752
|
-
flags:
|
|
2900
|
+
z25.object({
|
|
2901
|
+
type: z25.literal(ActionType.UNASSIGN),
|
|
2902
|
+
flags: z25.never().optional().describe(
|
|
2753
2903
|
"UNASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
|
|
2754
2904
|
)
|
|
2755
2905
|
}).shape
|
|
2756
2906
|
);
|
|
2757
2907
|
var DeleteConfig = ActionConfigBase.extend(
|
|
2758
|
-
|
|
2759
|
-
type:
|
|
2908
|
+
z25.object({
|
|
2909
|
+
type: z25.literal(ActionType.DELETE)
|
|
2760
2910
|
}).shape
|
|
2761
2911
|
);
|
|
2762
2912
|
var DeclareConfig = DeclarationActionBase.extend(
|
|
2763
|
-
|
|
2764
|
-
type:
|
|
2913
|
+
z25.object({
|
|
2914
|
+
type: z25.literal(ActionType.DECLARE),
|
|
2765
2915
|
review: DeclarationReviewConfig.describe(
|
|
2766
2916
|
"Configuration of the review page fields."
|
|
2767
2917
|
),
|
|
2768
2918
|
form: actionConfirmationForm,
|
|
2769
|
-
dialogCopy:
|
|
2919
|
+
dialogCopy: z25.object({
|
|
2770
2920
|
notify: TranslationConfig.describe(
|
|
2771
2921
|
"Confirmation text for the notify action"
|
|
2772
2922
|
),
|
|
@@ -2780,20 +2930,20 @@ var DeclareConfig = DeclarationActionBase.extend(
|
|
|
2780
2930
|
}).shape
|
|
2781
2931
|
);
|
|
2782
2932
|
var ArchiveConfig = ActionConfigBase.extend(
|
|
2783
|
-
|
|
2784
|
-
type:
|
|
2933
|
+
z25.object({
|
|
2934
|
+
type: z25.literal(ActionType.ARCHIVE),
|
|
2785
2935
|
form: actionConfirmationForm
|
|
2786
2936
|
}).shape
|
|
2787
2937
|
);
|
|
2788
2938
|
var UnarchiveConfig = ActionConfigBase.extend(
|
|
2789
|
-
|
|
2790
|
-
type:
|
|
2939
|
+
z25.object({
|
|
2940
|
+
type: z25.literal(ActionType.UNARCHIVE)
|
|
2791
2941
|
}).shape
|
|
2792
2942
|
);
|
|
2793
2943
|
var EditActionConfig = ActionConfigBase.extend(
|
|
2794
|
-
|
|
2795
|
-
type:
|
|
2796
|
-
dialogCopy:
|
|
2944
|
+
z25.object({
|
|
2945
|
+
type: z25.literal(ActionType.EDIT),
|
|
2946
|
+
dialogCopy: z25.object({
|
|
2797
2947
|
notify: TranslationConfig.describe(
|
|
2798
2948
|
"Confirmation text for the notify with edits action"
|
|
2799
2949
|
),
|
|
@@ -2807,45 +2957,45 @@ var EditActionConfig = ActionConfigBase.extend(
|
|
|
2807
2957
|
}).shape
|
|
2808
2958
|
);
|
|
2809
2959
|
var RejectConfig = ActionConfigBase.extend(
|
|
2810
|
-
|
|
2811
|
-
type:
|
|
2960
|
+
z25.object({
|
|
2961
|
+
type: z25.literal(ActionType.REJECT),
|
|
2812
2962
|
form: actionConfirmationForm
|
|
2813
2963
|
}).shape
|
|
2814
2964
|
);
|
|
2815
2965
|
var RegisterConfig = DeclarationActionBase.extend(
|
|
2816
|
-
|
|
2817
|
-
type:
|
|
2966
|
+
z25.object({
|
|
2967
|
+
type: z25.literal(ActionType.REGISTER),
|
|
2818
2968
|
form: actionConfirmationForm
|
|
2819
2969
|
}).shape
|
|
2820
2970
|
);
|
|
2821
2971
|
var PrintCertificateActionConfig = ActionConfigBase.extend(
|
|
2822
|
-
|
|
2823
|
-
type:
|
|
2972
|
+
z25.object({
|
|
2973
|
+
type: z25.literal(ActionType.PRINT_CERTIFICATE),
|
|
2824
2974
|
printForm: ActionFormConfig
|
|
2825
2975
|
}).shape
|
|
2826
2976
|
);
|
|
2827
2977
|
var RequestCorrectionConfig = ActionConfigBase.extend(
|
|
2828
|
-
|
|
2829
|
-
type:
|
|
2978
|
+
z25.object({
|
|
2979
|
+
type: z25.literal(ActionType.REQUEST_CORRECTION),
|
|
2830
2980
|
correctionForm: ActionFormConfig
|
|
2831
2981
|
}).shape
|
|
2832
2982
|
);
|
|
2833
2983
|
var ApproveCorrectionConfig = ActionConfigBase.extend(
|
|
2834
|
-
|
|
2835
|
-
type:
|
|
2984
|
+
z25.object({
|
|
2985
|
+
type: z25.literal(ActionType.APPROVE_CORRECTION)
|
|
2836
2986
|
}).shape
|
|
2837
2987
|
);
|
|
2838
2988
|
var RejectCorrectionConfig = ActionConfigBase.extend(
|
|
2839
|
-
|
|
2840
|
-
type:
|
|
2989
|
+
z25.object({
|
|
2990
|
+
type: z25.literal(ActionType.REJECT_CORRECTION)
|
|
2841
2991
|
}).shape
|
|
2842
2992
|
);
|
|
2843
2993
|
var CustomActionConfig = ActionConfigBase.extend(
|
|
2844
|
-
|
|
2845
|
-
type:
|
|
2846
|
-
customActionType:
|
|
2994
|
+
z25.object({
|
|
2995
|
+
type: z25.literal(ActionType.CUSTOM),
|
|
2996
|
+
customActionType: z25.string().describe("Type identifier of the custom action."),
|
|
2847
2997
|
/** Custom action form configuration supports a simple array of field configs, which should be rendered on the action modal. In the future, we might add support for pages etc. */
|
|
2848
|
-
form:
|
|
2998
|
+
form: z25.array(FieldConfig).describe(
|
|
2849
2999
|
"Form configuration for the custom action. The form configured here will be used on the custom action confirmation modal."
|
|
2850
3000
|
),
|
|
2851
3001
|
auditHistoryLabel: TranslationConfig.describe(
|
|
@@ -2853,7 +3003,7 @@ var CustomActionConfig = ActionConfigBase.extend(
|
|
|
2853
3003
|
)
|
|
2854
3004
|
}).shape
|
|
2855
3005
|
);
|
|
2856
|
-
var ActionConfig =
|
|
3006
|
+
var ActionConfig = z25.discriminatedUnion("type", [
|
|
2857
3007
|
/*
|
|
2858
3008
|
* OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
|
|
2859
3009
|
* and treat them as "models" instead of duplicating the data structure in each endpoint.
|
|
@@ -2940,89 +3090,225 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
2940
3090
|
var actionConfigTypes = new Set(
|
|
2941
3091
|
ActionConfig.options.map((opt) => opt.shape.type.value)
|
|
2942
3092
|
);
|
|
2943
|
-
var DeclarationActionConfig =
|
|
3093
|
+
var DeclarationActionConfig = z25.discriminatedUnion("type", [
|
|
2944
3094
|
DeclareConfig,
|
|
2945
3095
|
RegisterConfig
|
|
2946
3096
|
]);
|
|
2947
3097
|
|
|
2948
3098
|
// ../commons/src/events/offline/CertificateConfig.ts
|
|
2949
|
-
var
|
|
2950
|
-
var FontFamily =
|
|
2951
|
-
normal:
|
|
2952
|
-
bold:
|
|
2953
|
-
italics:
|
|
2954
|
-
bolditalics:
|
|
2955
|
-
});
|
|
2956
|
-
var CertificateConfig =
|
|
2957
|
-
id:
|
|
2958
|
-
event:
|
|
2959
|
-
isV2Template:
|
|
3099
|
+
var z26 = __toESM(require("zod/v4"));
|
|
3100
|
+
var FontFamily = z26.object({
|
|
3101
|
+
normal: z26.string(),
|
|
3102
|
+
bold: z26.string(),
|
|
3103
|
+
italics: z26.string(),
|
|
3104
|
+
bolditalics: z26.string()
|
|
3105
|
+
});
|
|
3106
|
+
var CertificateConfig = z26.object({
|
|
3107
|
+
id: z26.string(),
|
|
3108
|
+
event: z26.string(),
|
|
3109
|
+
isV2Template: z26.boolean().optional(),
|
|
2960
3110
|
label: TranslationConfig,
|
|
2961
|
-
isDefault:
|
|
2962
|
-
fee:
|
|
2963
|
-
onTime:
|
|
2964
|
-
late:
|
|
2965
|
-
delayed:
|
|
3111
|
+
isDefault: z26.boolean(),
|
|
3112
|
+
fee: z26.object({
|
|
3113
|
+
onTime: z26.number(),
|
|
3114
|
+
late: z26.number(),
|
|
3115
|
+
delayed: z26.number()
|
|
2966
3116
|
}),
|
|
2967
|
-
svgUrl:
|
|
2968
|
-
fonts:
|
|
2969
|
-
conditionals:
|
|
3117
|
+
svgUrl: z26.string(),
|
|
3118
|
+
fonts: z26.record(z26.string(), FontFamily).optional(),
|
|
3119
|
+
conditionals: z26.array(ShowConditional).optional()
|
|
2970
3120
|
});
|
|
2971
3121
|
var CertificateTemplateConfig = CertificateConfig.extend({
|
|
2972
|
-
hash:
|
|
2973
|
-
svg:
|
|
3122
|
+
hash: z26.string().optional(),
|
|
3123
|
+
svg: z26.string()
|
|
2974
3124
|
});
|
|
2975
3125
|
|
|
2976
3126
|
// ../commons/src/events/offline/LanguageConfig.ts
|
|
2977
|
-
var
|
|
2978
|
-
var LanguageConfig =
|
|
2979
|
-
lang:
|
|
3127
|
+
var z27 = __toESM(require("zod/v4"));
|
|
3128
|
+
var LanguageConfig = z27.object({
|
|
3129
|
+
lang: z27.string(),
|
|
2980
3130
|
/**
|
|
2981
3131
|
* client.csv contents
|
|
2982
3132
|
*/
|
|
2983
|
-
messages:
|
|
3133
|
+
messages: z27.record(z27.string(), z27.string())
|
|
2984
3134
|
});
|
|
2985
3135
|
|
|
2986
3136
|
// ../commons/src/events/EventConfig.ts
|
|
2987
|
-
var
|
|
3137
|
+
var z35 = __toESM(require("zod/v4"));
|
|
2988
3138
|
|
|
2989
3139
|
// ../commons/src/events/SummaryConfig.ts
|
|
2990
|
-
var
|
|
2991
|
-
|
|
3140
|
+
var z29 = __toESM(require("zod/v4"));
|
|
3141
|
+
|
|
3142
|
+
// ../commons/src/icons.ts
|
|
3143
|
+
var z28 = __toESM(require("zod/v4"));
|
|
3144
|
+
var AvailableIcons = z28.enum([
|
|
3145
|
+
"Archived",
|
|
3146
|
+
"Assigned",
|
|
3147
|
+
"Briefcase",
|
|
3148
|
+
"Certified",
|
|
3149
|
+
"Close",
|
|
3150
|
+
"Collapse",
|
|
3151
|
+
"Draft",
|
|
3152
|
+
"DuplicateYellow",
|
|
3153
|
+
"Expand",
|
|
3154
|
+
"ExternalValidate",
|
|
3155
|
+
"FilledCheck",
|
|
3156
|
+
"InReview",
|
|
3157
|
+
"Offline",
|
|
3158
|
+
"Registered",
|
|
3159
|
+
"RequiresUpdates",
|
|
3160
|
+
"Sent",
|
|
3161
|
+
"Validated",
|
|
3162
|
+
"WaitingApproval",
|
|
3163
|
+
"ChartActivity",
|
|
3164
|
+
"Activity",
|
|
3165
|
+
"Archive",
|
|
3166
|
+
"ArchiveTray",
|
|
3167
|
+
"ArrowLeft",
|
|
3168
|
+
"ArrowRight",
|
|
3169
|
+
"Buildings",
|
|
3170
|
+
"Circle",
|
|
3171
|
+
"CaretDown",
|
|
3172
|
+
"CaretLeft",
|
|
3173
|
+
"CaretRight",
|
|
3174
|
+
"ChartBar",
|
|
3175
|
+
"ChartLine",
|
|
3176
|
+
"ChatCircle",
|
|
3177
|
+
"CheckSquare",
|
|
3178
|
+
"Compass",
|
|
3179
|
+
"Check",
|
|
3180
|
+
"Copy",
|
|
3181
|
+
"Database",
|
|
3182
|
+
"DotsThreeVertical",
|
|
3183
|
+
"ArrowCounterClockwise",
|
|
3184
|
+
"MagnifyingGlassMinus",
|
|
3185
|
+
"MagnifyingGlassPlus",
|
|
3186
|
+
"Export",
|
|
3187
|
+
"Eye",
|
|
3188
|
+
"EyeSlash",
|
|
3189
|
+
"Envelope",
|
|
3190
|
+
"File",
|
|
3191
|
+
"FileLock",
|
|
3192
|
+
"FileSearch",
|
|
3193
|
+
"FileMinus",
|
|
3194
|
+
"FilePlus",
|
|
3195
|
+
"FileText",
|
|
3196
|
+
"FileX",
|
|
3197
|
+
"Handshake",
|
|
3198
|
+
"Gear",
|
|
3199
|
+
"GitBranch",
|
|
3200
|
+
"IdentificationCard",
|
|
3201
|
+
"List",
|
|
3202
|
+
"ListBullets",
|
|
3203
|
+
"Lock",
|
|
3204
|
+
"MagnifyingGlass",
|
|
3205
|
+
"MapPin",
|
|
3206
|
+
"Medal",
|
|
3207
|
+
"NotePencil",
|
|
3208
|
+
"Paperclip",
|
|
3209
|
+
"PaperPlaneTilt",
|
|
3210
|
+
"Pen",
|
|
3211
|
+
"PenNib",
|
|
3212
|
+
"Pencil",
|
|
3213
|
+
"PencilSimpleLine",
|
|
3214
|
+
"Phone",
|
|
3215
|
+
"Plus",
|
|
3216
|
+
"Printer",
|
|
3217
|
+
"SignOut",
|
|
3218
|
+
"Stamp",
|
|
3219
|
+
"Star",
|
|
3220
|
+
"Target",
|
|
3221
|
+
"TextT",
|
|
3222
|
+
"Trash",
|
|
3223
|
+
"UploadSimple",
|
|
3224
|
+
"User",
|
|
3225
|
+
"UserPlus",
|
|
3226
|
+
"Users",
|
|
3227
|
+
"WarningCircle",
|
|
3228
|
+
"X",
|
|
3229
|
+
"ChatText",
|
|
3230
|
+
"CircleWavyCheck",
|
|
3231
|
+
"CircleWavyQuestion",
|
|
3232
|
+
"ArchiveBox",
|
|
3233
|
+
"ArrowCircleDown",
|
|
3234
|
+
"FileArrowUp",
|
|
3235
|
+
"FileDotted",
|
|
3236
|
+
"Files",
|
|
3237
|
+
"PencilLine",
|
|
3238
|
+
"PencilCircle",
|
|
3239
|
+
"UserCircle",
|
|
3240
|
+
"Clock",
|
|
3241
|
+
"QrCode",
|
|
3242
|
+
"Webcam",
|
|
3243
|
+
"Sun",
|
|
3244
|
+
"DeviceTabletCamera",
|
|
3245
|
+
"Globe",
|
|
3246
|
+
"Fingerprint",
|
|
3247
|
+
"PushPin",
|
|
3248
|
+
"Timer"
|
|
3249
|
+
]);
|
|
3250
|
+
|
|
3251
|
+
// ../commons/src/events/SummaryConfig.ts
|
|
3252
|
+
var InfoBox = z29.object({
|
|
3253
|
+
type: z29.enum(["info", "positive", "warning", "negative"]).describe(
|
|
3254
|
+
"Semantic tint of the icon block: info (blue), positive (green), warning (orange), negative (red)."
|
|
3255
|
+
),
|
|
3256
|
+
background: z29.enum(["tinted", "white"]).default("tinted").optional().describe(
|
|
3257
|
+
"tinted reads as a recessed empty state; white reads as a standalone card."
|
|
3258
|
+
),
|
|
3259
|
+
icon: AvailableIcons.optional().describe(
|
|
3260
|
+
"Icon displayed inside the icon block. Defaults to FileSearch."
|
|
3261
|
+
),
|
|
3262
|
+
heading: TranslationConfig.describe(
|
|
3263
|
+
"Primary message. Short, sentence-case."
|
|
3264
|
+
),
|
|
3265
|
+
description: TranslationConfig.optional().describe(
|
|
3266
|
+
"Secondary copy displayed below the heading, typically a suggested next step."
|
|
3267
|
+
),
|
|
3268
|
+
conditionals: z29.array(ShowConditional).default([]).optional().describe(
|
|
3269
|
+
"Conditions under which the info box is shown. When omitted, it is always shown."
|
|
3270
|
+
)
|
|
3271
|
+
}).describe(
|
|
3272
|
+
"A compact icon-block + heading + description block displayed above the summary fields in the event overview."
|
|
3273
|
+
);
|
|
3274
|
+
var BaseField2 = z29.object({
|
|
2992
3275
|
emptyValueMessage: TranslationConfig.optional().describe(
|
|
2993
3276
|
"Default message displayed when the field value is empty."
|
|
2994
3277
|
),
|
|
2995
|
-
conditionals:
|
|
3278
|
+
conditionals: z29.array(ShowConditional).default([]).optional()
|
|
2996
3279
|
});
|
|
2997
3280
|
var ReferenceField = BaseField2.extend({
|
|
2998
|
-
fieldId:
|
|
3281
|
+
fieldId: z29.string(),
|
|
2999
3282
|
label: TranslationConfig.optional().describe(
|
|
3000
3283
|
"Overrides the default label from the referenced field when provided."
|
|
3001
3284
|
)
|
|
3002
3285
|
}).describe("Field referencing existing event data by field ID.");
|
|
3003
3286
|
var Field = BaseField2.extend({
|
|
3004
|
-
id:
|
|
3287
|
+
id: z29.string().describe("Identifier of the summary field."),
|
|
3005
3288
|
value: TranslationConfig.describe(
|
|
3006
3289
|
'Field value template supporting variables from configuration and EventMetadata (e.g. "{informant.phoneNo} {informant.email}").'
|
|
3007
3290
|
),
|
|
3008
3291
|
label: TranslationConfig
|
|
3009
3292
|
}).describe("Custom field defined for the summary view.");
|
|
3010
|
-
var SummaryConfig =
|
|
3011
|
-
|
|
3293
|
+
var SummaryConfig = z29.object({
|
|
3294
|
+
banners: z29.array(InfoBox).default([]).optional().describe(
|
|
3295
|
+
"Info boxes displayed above the summary fields in the event overview."
|
|
3296
|
+
),
|
|
3297
|
+
fields: z29.array(z29.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
|
|
3012
3298
|
}).meta({
|
|
3013
3299
|
id: "SummaryConfig",
|
|
3014
3300
|
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."
|
|
3015
3301
|
});
|
|
3016
3302
|
|
|
3017
3303
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
|
3018
|
-
var
|
|
3019
|
-
var MatchType =
|
|
3020
|
-
var BaseField3 =
|
|
3021
|
-
config:
|
|
3304
|
+
var z30 = __toESM(require("zod/v4"));
|
|
3305
|
+
var MatchType = z30.enum(["fuzzy", "exact", "range", "within"]);
|
|
3306
|
+
var BaseField3 = z30.object({
|
|
3307
|
+
config: z30.object({
|
|
3022
3308
|
type: MatchType.describe(
|
|
3023
3309
|
"Determines the search type of field. How to match value."
|
|
3024
3310
|
),
|
|
3025
|
-
searchFields:
|
|
3311
|
+
searchFields: z30.array(z30.string()).optional().describe(
|
|
3026
3312
|
`
|
|
3027
3313
|
Defines multiple form fields that should be searched when this field has a value.
|
|
3028
3314
|
All specified fields will be combined using OR logic.
|
|
@@ -3032,7 +3318,7 @@ var BaseField3 = z28.object({
|
|
|
3032
3318
|
`
|
|
3033
3319
|
)
|
|
3034
3320
|
}),
|
|
3035
|
-
type:
|
|
3321
|
+
type: z30.nativeEnum(FieldType).optional().describe(
|
|
3036
3322
|
`
|
|
3037
3323
|
Explicitly specify the field type for searchFields.
|
|
3038
3324
|
This is required when searchFields is defined, to show the correct control in the UI.
|
|
@@ -3046,7 +3332,7 @@ var BaseField3 = z28.object({
|
|
|
3046
3332
|
This is required when searchFields is defined.
|
|
3047
3333
|
`
|
|
3048
3334
|
),
|
|
3049
|
-
options:
|
|
3335
|
+
options: z30.array(SelectOption).optional(),
|
|
3050
3336
|
searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
|
|
3051
3337
|
`
|
|
3052
3338
|
This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
|
|
@@ -3067,7 +3353,7 @@ var BaseField3 = z28.object({
|
|
|
3067
3353
|
in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
|
|
3068
3354
|
`
|
|
3069
3355
|
),
|
|
3070
|
-
conditionals:
|
|
3356
|
+
conditionals: z30.array(FieldConditional).optional().describe(
|
|
3071
3357
|
`
|
|
3072
3358
|
In advanced search, we sometimes need to override the default field visibility conditionals.
|
|
3073
3359
|
|
|
@@ -3081,23 +3367,23 @@ var BaseField3 = z28.object({
|
|
|
3081
3367
|
are always rendered in the advanced search form.
|
|
3082
3368
|
`
|
|
3083
3369
|
),
|
|
3084
|
-
validations:
|
|
3370
|
+
validations: z30.array(ValidationConfig).optional().describe(
|
|
3085
3371
|
`Option for overriding the field validations specifically for advanced search form.`
|
|
3086
3372
|
),
|
|
3087
3373
|
allowedLocations: JurisdictionReference.optional().describe(
|
|
3088
3374
|
`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.`
|
|
3089
3375
|
)
|
|
3090
3376
|
});
|
|
3091
|
-
var SearchQueryParams =
|
|
3092
|
-
eventType:
|
|
3377
|
+
var SearchQueryParams = z30.object({
|
|
3378
|
+
eventType: z30.string().optional().describe(
|
|
3093
3379
|
"Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
|
|
3094
3380
|
)
|
|
3095
3381
|
}).catchall(FieldValue);
|
|
3096
3382
|
var FieldConfigSchema = BaseField3.extend({
|
|
3097
|
-
fieldId:
|
|
3098
|
-
fieldType:
|
|
3383
|
+
fieldId: z30.string(),
|
|
3384
|
+
fieldType: z30.literal("field")
|
|
3099
3385
|
});
|
|
3100
|
-
var EventFieldIdInput =
|
|
3386
|
+
var EventFieldIdInput = z30.enum([
|
|
3101
3387
|
"trackingId",
|
|
3102
3388
|
"status",
|
|
3103
3389
|
"legalStatuses.REGISTERED.acceptedAt",
|
|
@@ -3106,7 +3392,7 @@ var EventFieldIdInput = z28.enum([
|
|
|
3106
3392
|
"updatedAt"
|
|
3107
3393
|
]);
|
|
3108
3394
|
var METADATA_FIELD_PREFIX = "event.";
|
|
3109
|
-
var EventFieldId =
|
|
3395
|
+
var EventFieldId = z30.enum([
|
|
3110
3396
|
`${METADATA_FIELD_PREFIX}trackingId`,
|
|
3111
3397
|
`${METADATA_FIELD_PREFIX}status`,
|
|
3112
3398
|
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
|
|
@@ -3116,195 +3402,60 @@ var EventFieldId = z28.enum([
|
|
|
3116
3402
|
]);
|
|
3117
3403
|
var EventFieldConfigSchema = BaseField3.extend({
|
|
3118
3404
|
fieldId: EventFieldId,
|
|
3119
|
-
fieldType:
|
|
3405
|
+
fieldType: z30.literal("event")
|
|
3120
3406
|
});
|
|
3121
|
-
var AdvancedSearchField =
|
|
3407
|
+
var AdvancedSearchField = z30.discriminatedUnion("fieldType", [FieldConfigSchema, EventFieldConfigSchema]).superRefine((data, ctx) => {
|
|
3122
3408
|
if (data.config.searchFields && data.config.searchFields.length > 0) {
|
|
3123
|
-
if (!data.label) {
|
|
3124
|
-
ctx.addIssue({
|
|
3125
|
-
code:
|
|
3126
|
-
message: "label is required when config.searchFields is defined.",
|
|
3127
|
-
path: ["label"]
|
|
3128
|
-
});
|
|
3129
|
-
}
|
|
3130
|
-
if (!data.type) {
|
|
3131
|
-
ctx.addIssue({
|
|
3132
|
-
code:
|
|
3133
|
-
message: "type is required when config.searchFields is defined.",
|
|
3134
|
-
path: ["type"]
|
|
3135
|
-
});
|
|
3136
|
-
}
|
|
3137
|
-
}
|
|
3138
|
-
});
|
|
3139
|
-
var AdvancedSearchConfig = z28.object({
|
|
3140
|
-
title: TranslationConfig.describe("Advanced search tab title"),
|
|
3141
|
-
fields: z28.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
|
|
3142
|
-
}).meta({
|
|
3143
|
-
id: "AdvancedSearchConfig",
|
|
3144
|
-
description: "Configuration of one advanced search tab. Each tab has a title and a list of searchable fields \u2014 either declaration fields (via `field()`) or event metadata (via `event()`)."
|
|
3145
|
-
});
|
|
3146
|
-
|
|
3147
|
-
// ../commons/src/events/utils.ts
|
|
3148
|
-
var import_lodash = require("lodash");
|
|
3149
|
-
|
|
3150
|
-
// ../commons/src/conditionals/validate.ts
|
|
3151
|
-
var import__ = __toESM(require("ajv/dist/2019"));
|
|
3152
|
-
var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
3153
|
-
var z31 = __toESM(require("zod/v4"));
|
|
3154
|
-
var import_date_fns = require("date-fns");
|
|
3155
|
-
|
|
3156
|
-
// ../commons/src/events/FieldTypeMapping.ts
|
|
3157
|
-
var z30 = __toESM(require("zod/v4"));
|
|
3158
|
-
|
|
3159
|
-
// ../commons/src/events/DynamicFieldValue.ts
|
|
3160
|
-
var z29 = __toESM(require("zod/v4"));
|
|
3161
|
-
|
|
3162
|
-
// ../commons/src/conditionals/validate.ts
|
|
3163
|
-
var ajv = new import__.default({
|
|
3164
|
-
$data: true,
|
|
3165
|
-
allowUnionTypes: true,
|
|
3166
|
-
strict: false
|
|
3167
|
-
// Allow minContains and other newer features
|
|
3168
|
-
});
|
|
3169
|
-
var DataContext = z31.object({
|
|
3170
|
-
rootData: z31.object({
|
|
3171
|
-
$leafAdminStructureLocationIds: z31.array(z31.object({ id: UUID }))
|
|
3172
|
-
})
|
|
3173
|
-
});
|
|
3174
|
-
function resolveDataPath(rootData, dataPath, instancePath) {
|
|
3175
|
-
const pathParts = dataPath.split("/");
|
|
3176
|
-
const levels = parseInt(pathParts[0], 10);
|
|
3177
|
-
const referencePath = pathParts.slice(1);
|
|
3178
|
-
const instanceParts = instancePath.split("/").filter(Boolean);
|
|
3179
|
-
const traversedParts = instanceParts.slice(0, -levels);
|
|
3180
|
-
let current = rootData;
|
|
3181
|
-
for (const part of traversedParts) {
|
|
3182
|
-
if (current === null || current === void 0) {
|
|
3183
|
-
return void 0;
|
|
3184
|
-
}
|
|
3185
|
-
current = current[part];
|
|
3186
|
-
}
|
|
3187
|
-
for (const part of referencePath) {
|
|
3188
|
-
if (current === null || current === void 0) {
|
|
3189
|
-
return void 0;
|
|
3190
|
-
}
|
|
3191
|
-
current = current[part];
|
|
3192
|
-
}
|
|
3193
|
-
return current;
|
|
3194
|
-
}
|
|
3195
|
-
function todayISO() {
|
|
3196
|
-
return (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
|
|
3197
|
-
}
|
|
3198
|
-
var compiledFunctionCache = /* @__PURE__ */ new Map();
|
|
3199
|
-
function compileClientFunction(code) {
|
|
3200
|
-
let fn = compiledFunctionCache.get(code);
|
|
3201
|
-
if (!fn) {
|
|
3202
|
-
fn = new Function(`return (${code})`)();
|
|
3203
|
-
compiledFunctionCache.set(code, fn);
|
|
3204
|
-
}
|
|
3205
|
-
return fn;
|
|
3206
|
-
}
|
|
3207
|
-
(0, import_ajv_formats.default)(ajv);
|
|
3208
|
-
function buildClientFunctionContext(input) {
|
|
3209
|
-
return {
|
|
3210
|
-
$form: input.form,
|
|
3211
|
-
$now: todayISO(),
|
|
3212
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
3213
|
-
$online: isOnline(),
|
|
3214
|
-
$user: input.validatorContext?.user,
|
|
3215
|
-
$event: input.validatorContext?.event,
|
|
3216
|
-
$leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
|
|
3217
|
-
user: input.systemVariables?.user,
|
|
3218
|
-
$window: input.systemVariables?.$window,
|
|
3219
|
-
locations: input.locations,
|
|
3220
|
-
adminLevelIds: input.adminLevelIds
|
|
3221
|
-
};
|
|
3222
|
-
}
|
|
3223
|
-
function runClientFunction(code, data, context) {
|
|
3224
|
-
return compileClientFunction(code)(data, context);
|
|
3225
|
-
}
|
|
3226
|
-
ajv.addKeyword({
|
|
3227
|
-
keyword: "daysFromDate",
|
|
3228
|
-
type: "string",
|
|
3229
|
-
schemaType: "object",
|
|
3230
|
-
$data: true,
|
|
3231
|
-
errors: true,
|
|
3232
|
-
validate(schema, data, _2, dataContext) {
|
|
3233
|
-
if (!(dataContext && dataContext.rootData && typeof dataContext.rootData === "object" && "$now" in dataContext.rootData && typeof dataContext.rootData.$now === "string")) {
|
|
3234
|
-
throw new Error("Validation context must contain $now");
|
|
3235
|
-
}
|
|
3236
|
-
const { days, clause } = schema;
|
|
3237
|
-
if (typeof data !== "string") {
|
|
3238
|
-
return false;
|
|
3239
|
-
}
|
|
3240
|
-
const date = new Date(data);
|
|
3241
|
-
if (isNaN(date.getTime())) {
|
|
3242
|
-
return false;
|
|
3243
|
-
}
|
|
3244
|
-
let referenceDate = schema.referenceDate;
|
|
3245
|
-
if (referenceDate && typeof referenceDate === "object" && "$data" in referenceDate) {
|
|
3246
|
-
referenceDate = resolveDataPath(
|
|
3247
|
-
dataContext.rootData,
|
|
3248
|
-
referenceDate.$data,
|
|
3249
|
-
dataContext.instancePath
|
|
3250
|
-
);
|
|
3251
|
-
}
|
|
3252
|
-
if (!referenceDate) {
|
|
3253
|
-
referenceDate = dataContext.rootData.$now;
|
|
3254
|
-
}
|
|
3255
|
-
const baseDate = new Date(referenceDate);
|
|
3256
|
-
if (isNaN(baseDate.getTime())) {
|
|
3257
|
-
return false;
|
|
3258
|
-
}
|
|
3259
|
-
const offsetDate = new Date(baseDate.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
3260
|
-
return clause === "after" ? (0, import_date_fns.isAfter)(date, offsetDate) : (0, import_date_fns.isBefore)(date, offsetDate);
|
|
3261
|
-
}
|
|
3262
|
-
});
|
|
3263
|
-
ajv.addKeyword({
|
|
3264
|
-
keyword: "isLeafLevelLocation",
|
|
3265
|
-
type: "string",
|
|
3266
|
-
schemaType: "boolean",
|
|
3267
|
-
$data: true,
|
|
3268
|
-
errors: true,
|
|
3269
|
-
// @ts-ignore -- Force type. We will move this away from AJV next. Parsing the array will take seconds and is only called by core.
|
|
3270
|
-
validate(_schema, data, _2, dataContext) {
|
|
3271
|
-
const locationIdInput = data;
|
|
3272
|
-
const locations = dataContext?.rootData.$leafAdminStructureLocationIds ?? [];
|
|
3273
|
-
return locations.some((location) => location.id === locationIdInput);
|
|
3274
|
-
}
|
|
3275
|
-
});
|
|
3276
|
-
ajv.addKeyword({
|
|
3277
|
-
keyword: "customClientValidator",
|
|
3278
|
-
schemaType: "object",
|
|
3279
|
-
errors: true,
|
|
3280
|
-
// @ts-expect-error -- AJV's public types don't expose `rootData`. All
|
|
3281
|
-
// `validate()` callers build root data via `buildClientFunctionContext`,
|
|
3282
|
-
// so the cast holds.
|
|
3283
|
-
validate(schema, data, _2, dataContext) {
|
|
3284
|
-
return Boolean(
|
|
3285
|
-
runClientFunction(
|
|
3286
|
-
schema.code,
|
|
3287
|
-
data,
|
|
3288
|
-
dataContext?.rootData ?? buildClientFunctionContext({ form: {} })
|
|
3289
|
-
)
|
|
3290
|
-
);
|
|
3409
|
+
if (!data.label) {
|
|
3410
|
+
ctx.addIssue({
|
|
3411
|
+
code: z30.ZodIssueCode.custom,
|
|
3412
|
+
message: "label is required when config.searchFields is defined.",
|
|
3413
|
+
path: ["label"]
|
|
3414
|
+
});
|
|
3415
|
+
}
|
|
3416
|
+
if (!data.type) {
|
|
3417
|
+
ctx.addIssue({
|
|
3418
|
+
code: z30.ZodIssueCode.custom,
|
|
3419
|
+
message: "type is required when config.searchFields is defined.",
|
|
3420
|
+
path: ["type"]
|
|
3421
|
+
});
|
|
3422
|
+
}
|
|
3291
3423
|
}
|
|
3292
3424
|
});
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3425
|
+
var AdvancedSearchConfig = z30.object({
|
|
3426
|
+
title: TranslationConfig.describe("Advanced search tab title"),
|
|
3427
|
+
fields: z30.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
|
|
3428
|
+
}).meta({
|
|
3429
|
+
id: "AdvancedSearchConfig",
|
|
3430
|
+
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()`)."
|
|
3431
|
+
});
|
|
3299
3432
|
|
|
3300
|
-
// ../commons/src/utils.ts
|
|
3433
|
+
// ../commons/src/events/utils.ts
|
|
3434
|
+
var import_lodash4 = require("lodash");
|
|
3435
|
+
|
|
3436
|
+
// ../commons/src/conditionals/validate.ts
|
|
3437
|
+
var import__ = __toESM(require("ajv/dist/2019"));
|
|
3438
|
+
var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
3439
|
+
var z34 = __toESM(require("zod/v4"));
|
|
3440
|
+
var import_date_fns2 = require("date-fns");
|
|
3441
|
+
|
|
3442
|
+
// ../commons/src/events/FieldTypeMapping.ts
|
|
3301
3443
|
var z32 = __toESM(require("zod/v4"));
|
|
3444
|
+
|
|
3445
|
+
// ../commons/src/events/DynamicFieldValue.ts
|
|
3446
|
+
var z31 = __toESM(require("zod/v4"));
|
|
3447
|
+
|
|
3448
|
+
// ../commons/src/events/state/index.ts
|
|
3449
|
+
var import_lodash3 = require("lodash");
|
|
3450
|
+
|
|
3451
|
+
// ../commons/src/utils.ts
|
|
3452
|
+
var z33 = __toESM(require("zod/v4"));
|
|
3302
3453
|
var _ = __toESM(require("lodash"));
|
|
3303
|
-
var FullNameV1 =
|
|
3304
|
-
|
|
3305
|
-
use:
|
|
3306
|
-
family:
|
|
3307
|
-
given:
|
|
3454
|
+
var FullNameV1 = z33.array(
|
|
3455
|
+
z33.object({
|
|
3456
|
+
use: z33.string(),
|
|
3457
|
+
family: z33.string(),
|
|
3458
|
+
given: z33.array(z33.string())
|
|
3308
3459
|
})
|
|
3309
3460
|
);
|
|
3310
3461
|
function omitKeyDeep(obj, keyToRemove) {
|
|
@@ -3323,35 +3474,62 @@ function omitKeyDeep(obj, keyToRemove) {
|
|
|
3323
3474
|
return newObj;
|
|
3324
3475
|
}
|
|
3325
3476
|
|
|
3326
|
-
// ../commons/src/events/utils.ts
|
|
3327
|
-
var
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
}
|
|
3338
|
-
const reviewFields = "review" in actionConfig && actionConfig.review != null ? actionConfig.review.fields : [];
|
|
3339
|
-
const formFields = "form" in actionConfig && actionConfig.form != null ? actionConfig.form : [];
|
|
3340
|
-
return [...reviewFields, ...formFields];
|
|
3341
|
-
};
|
|
3342
|
-
function getAllAnnotationFields(config) {
|
|
3343
|
-
return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
|
|
3344
|
-
}
|
|
3345
|
-
var findAllFields = (config) => {
|
|
3346
|
-
return (0, import_lodash.flattenDeep)([
|
|
3347
|
-
...getDeclarationFields(config),
|
|
3348
|
-
...getAllAnnotationFields(config)
|
|
3349
|
-
]);
|
|
3350
|
-
};
|
|
3351
|
-
var EXCLUDED_ACTIONS = [
|
|
3352
|
-
ActionType.REQUEST_CORRECTION,
|
|
3477
|
+
// ../commons/src/events/state/utils.ts
|
|
3478
|
+
var import_lodash = require("lodash");
|
|
3479
|
+
var updateActions = ActionTypes.extract([
|
|
3480
|
+
ActionType.CREATE,
|
|
3481
|
+
ActionType.NOTIFY,
|
|
3482
|
+
ActionType.EDIT,
|
|
3483
|
+
ActionType.DECLARE,
|
|
3484
|
+
ActionType.REGISTER,
|
|
3485
|
+
ActionType.REJECT,
|
|
3486
|
+
ActionType.ARCHIVE,
|
|
3487
|
+
ActionType.UNARCHIVE,
|
|
3353
3488
|
ActionType.PRINT_CERTIFICATE,
|
|
3354
|
-
ActionType.
|
|
3489
|
+
ActionType.REQUEST_CORRECTION,
|
|
3490
|
+
ActionType.APPROVE_CORRECTION,
|
|
3491
|
+
ActionType.REJECT_CORRECTION,
|
|
3492
|
+
ActionType.CUSTOM
|
|
3493
|
+
]);
|
|
3494
|
+
|
|
3495
|
+
// ../commons/src/events/state/flags.ts
|
|
3496
|
+
var import_lodash2 = require("lodash");
|
|
3497
|
+
var import_date_fns = require("date-fns");
|
|
3498
|
+
var INHERENT_FLAG_RULES = [
|
|
3499
|
+
{
|
|
3500
|
+
flag: InherentFlags.CORRECTION_REQUESTED,
|
|
3501
|
+
setOn: [ActionType.REQUEST_CORRECTION],
|
|
3502
|
+
resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
|
|
3503
|
+
},
|
|
3504
|
+
{
|
|
3505
|
+
// INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
|
|
3506
|
+
// other status-changing action (see getStatusFromActions). ARCHIVE/UNARCHIVE
|
|
3507
|
+
// are deliberately excluded so the flag freezes across an archive/unarchive
|
|
3508
|
+
// round trip and comes back exactly as it was.
|
|
3509
|
+
flag: InherentFlags.INCOMPLETE,
|
|
3510
|
+
setOn: [ActionType.NOTIFY],
|
|
3511
|
+
resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
|
|
3512
|
+
},
|
|
3513
|
+
{
|
|
3514
|
+
flag: InherentFlags.REJECTED,
|
|
3515
|
+
setOn: [ActionType.REJECT],
|
|
3516
|
+
resetOn: [
|
|
3517
|
+
ActionType.NOTIFY,
|
|
3518
|
+
ActionType.DECLARE,
|
|
3519
|
+
ActionType.EDIT,
|
|
3520
|
+
ActionType.REGISTER
|
|
3521
|
+
]
|
|
3522
|
+
},
|
|
3523
|
+
{
|
|
3524
|
+
flag: InherentFlags.POTENTIAL_DUPLICATE,
|
|
3525
|
+
setOn: [ActionType.DUPLICATE_DETECTED],
|
|
3526
|
+
resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
|
|
3527
|
+
},
|
|
3528
|
+
{
|
|
3529
|
+
flag: InherentFlags.EDIT_IN_PROGRESS,
|
|
3530
|
+
setOn: [ActionType.EDIT],
|
|
3531
|
+
resetOnAnyOtherAction: true
|
|
3532
|
+
}
|
|
3355
3533
|
];
|
|
3356
3534
|
|
|
3357
3535
|
// ../commons/src/conditionals/conditionals.ts
|
|
@@ -3560,6 +3738,33 @@ function defineComparison(field3, value, keyword) {
|
|
|
3560
3738
|
required: [field3.$$field]
|
|
3561
3739
|
});
|
|
3562
3740
|
}
|
|
3741
|
+
function flag(flagvalue) {
|
|
3742
|
+
return defineConditional({
|
|
3743
|
+
type: "object",
|
|
3744
|
+
properties: {
|
|
3745
|
+
$flags: {
|
|
3746
|
+
type: "array",
|
|
3747
|
+
contains: {
|
|
3748
|
+
type: "string",
|
|
3749
|
+
const: flagvalue
|
|
3750
|
+
}
|
|
3751
|
+
}
|
|
3752
|
+
},
|
|
3753
|
+
required: ["$flags"]
|
|
3754
|
+
});
|
|
3755
|
+
}
|
|
3756
|
+
function status(statusValue) {
|
|
3757
|
+
return defineConditional({
|
|
3758
|
+
type: "object",
|
|
3759
|
+
properties: {
|
|
3760
|
+
$status: {
|
|
3761
|
+
type: "string",
|
|
3762
|
+
const: statusValue
|
|
3763
|
+
}
|
|
3764
|
+
},
|
|
3765
|
+
required: ["$status"]
|
|
3766
|
+
});
|
|
3767
|
+
}
|
|
3563
3768
|
function createFieldConditionals(fieldId) {
|
|
3564
3769
|
const getDayRange = (field3, days, clause, referenceDate) => ({
|
|
3565
3770
|
type: "object",
|
|
@@ -3961,6 +4166,176 @@ function createFieldConditionals(fieldId) {
|
|
|
3961
4166
|
};
|
|
3962
4167
|
}
|
|
3963
4168
|
|
|
4169
|
+
// ../commons/src/conditionals/validate.ts
|
|
4170
|
+
var ajv = new import__.default({
|
|
4171
|
+
$data: true,
|
|
4172
|
+
allowUnionTypes: true,
|
|
4173
|
+
strict: false
|
|
4174
|
+
// Allow minContains and other newer features
|
|
4175
|
+
});
|
|
4176
|
+
var DataContext = z34.object({
|
|
4177
|
+
rootData: z34.object({
|
|
4178
|
+
$leafAdminStructureLocationIds: z34.array(z34.object({ id: UUID }))
|
|
4179
|
+
})
|
|
4180
|
+
});
|
|
4181
|
+
function resolveDataPath(rootData, dataPath, instancePath) {
|
|
4182
|
+
const pathParts = dataPath.split("/");
|
|
4183
|
+
const levels = parseInt(pathParts[0], 10);
|
|
4184
|
+
const referencePath = pathParts.slice(1);
|
|
4185
|
+
const instanceParts = instancePath.split("/").filter(Boolean);
|
|
4186
|
+
const traversedParts = instanceParts.slice(0, -levels);
|
|
4187
|
+
let current = rootData;
|
|
4188
|
+
for (const part of traversedParts) {
|
|
4189
|
+
if (current === null || current === void 0) {
|
|
4190
|
+
return void 0;
|
|
4191
|
+
}
|
|
4192
|
+
current = current[part];
|
|
4193
|
+
}
|
|
4194
|
+
for (const part of referencePath) {
|
|
4195
|
+
if (current === null || current === void 0) {
|
|
4196
|
+
return void 0;
|
|
4197
|
+
}
|
|
4198
|
+
current = current[part];
|
|
4199
|
+
}
|
|
4200
|
+
return current;
|
|
4201
|
+
}
|
|
4202
|
+
function todayISO() {
|
|
4203
|
+
return (0, import_date_fns2.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
|
|
4204
|
+
}
|
|
4205
|
+
var compiledFunctionCache = /* @__PURE__ */ new Map();
|
|
4206
|
+
function compileClientFunction(code) {
|
|
4207
|
+
let fn = compiledFunctionCache.get(code);
|
|
4208
|
+
if (!fn) {
|
|
4209
|
+
fn = new Function(`return (${code})`)();
|
|
4210
|
+
compiledFunctionCache.set(code, fn);
|
|
4211
|
+
}
|
|
4212
|
+
return fn;
|
|
4213
|
+
}
|
|
4214
|
+
(0, import_ajv_formats.default)(ajv);
|
|
4215
|
+
function buildClientFunctionContext(input) {
|
|
4216
|
+
return {
|
|
4217
|
+
$form: input.form,
|
|
4218
|
+
$flags: input.validatorContext?.event?.state.flags ?? [],
|
|
4219
|
+
$now: todayISO(),
|
|
4220
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
4221
|
+
$online: isOnline(),
|
|
4222
|
+
$user: input.validatorContext?.user,
|
|
4223
|
+
$event: input.validatorContext?.event?.document,
|
|
4224
|
+
$leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
|
|
4225
|
+
user: input.systemVariables?.user,
|
|
4226
|
+
$window: input.systemVariables?.$window,
|
|
4227
|
+
locations: input.locations,
|
|
4228
|
+
adminLevelIds: input.adminLevelIds
|
|
4229
|
+
};
|
|
4230
|
+
}
|
|
4231
|
+
function runClientFunction(code, data, context) {
|
|
4232
|
+
return compileClientFunction(code)(data, context);
|
|
4233
|
+
}
|
|
4234
|
+
ajv.addKeyword({
|
|
4235
|
+
keyword: "daysFromDate",
|
|
4236
|
+
type: "string",
|
|
4237
|
+
schemaType: "object",
|
|
4238
|
+
$data: true,
|
|
4239
|
+
errors: true,
|
|
4240
|
+
validate(schema, data, _2, dataContext) {
|
|
4241
|
+
if (!(dataContext && dataContext.rootData && typeof dataContext.rootData === "object" && "$now" in dataContext.rootData && typeof dataContext.rootData.$now === "string")) {
|
|
4242
|
+
throw new Error("Validation context must contain $now");
|
|
4243
|
+
}
|
|
4244
|
+
const { days, clause } = schema;
|
|
4245
|
+
if (typeof data !== "string") {
|
|
4246
|
+
return false;
|
|
4247
|
+
}
|
|
4248
|
+
const date = new Date(data);
|
|
4249
|
+
if (isNaN(date.getTime())) {
|
|
4250
|
+
return false;
|
|
4251
|
+
}
|
|
4252
|
+
let referenceDate = schema.referenceDate;
|
|
4253
|
+
if (referenceDate && typeof referenceDate === "object" && "$data" in referenceDate) {
|
|
4254
|
+
referenceDate = resolveDataPath(
|
|
4255
|
+
dataContext.rootData,
|
|
4256
|
+
referenceDate.$data,
|
|
4257
|
+
dataContext.instancePath
|
|
4258
|
+
);
|
|
4259
|
+
}
|
|
4260
|
+
if (!referenceDate) {
|
|
4261
|
+
referenceDate = dataContext.rootData.$now;
|
|
4262
|
+
}
|
|
4263
|
+
const baseDate = new Date(referenceDate);
|
|
4264
|
+
if (isNaN(baseDate.getTime())) {
|
|
4265
|
+
return false;
|
|
4266
|
+
}
|
|
4267
|
+
const offsetDate = new Date(baseDate.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
4268
|
+
return clause === "after" ? (0, import_date_fns2.isAfter)(date, offsetDate) : (0, import_date_fns2.isBefore)(date, offsetDate);
|
|
4269
|
+
}
|
|
4270
|
+
});
|
|
4271
|
+
ajv.addKeyword({
|
|
4272
|
+
keyword: "isLeafLevelLocation",
|
|
4273
|
+
type: "string",
|
|
4274
|
+
schemaType: "boolean",
|
|
4275
|
+
$data: true,
|
|
4276
|
+
errors: true,
|
|
4277
|
+
// @ts-ignore -- Force type. We will move this away from AJV next. Parsing the array will take seconds and is only called by core.
|
|
4278
|
+
validate(_schema, data, _2, dataContext) {
|
|
4279
|
+
const locationIdInput = data;
|
|
4280
|
+
const locations = dataContext?.rootData.$leafAdminStructureLocationIds ?? [];
|
|
4281
|
+
return locations.some((location) => location.id === locationIdInput);
|
|
4282
|
+
}
|
|
4283
|
+
});
|
|
4284
|
+
ajv.addKeyword({
|
|
4285
|
+
keyword: "customClientValidator",
|
|
4286
|
+
schemaType: "object",
|
|
4287
|
+
errors: true,
|
|
4288
|
+
// @ts-expect-error -- AJV's public types don't expose `rootData`. All
|
|
4289
|
+
// `validate()` callers build root data via `buildClientFunctionContext`,
|
|
4290
|
+
// so the cast holds.
|
|
4291
|
+
validate(schema, data, _2, dataContext) {
|
|
4292
|
+
return Boolean(
|
|
4293
|
+
runClientFunction(
|
|
4294
|
+
schema.code,
|
|
4295
|
+
data,
|
|
4296
|
+
dataContext?.rootData ?? buildClientFunctionContext({ form: {} })
|
|
4297
|
+
)
|
|
4298
|
+
);
|
|
4299
|
+
}
|
|
4300
|
+
});
|
|
4301
|
+
function isOnline() {
|
|
4302
|
+
if (typeof window !== "undefined" && typeof navigator !== "undefined") {
|
|
4303
|
+
return navigator.onLine;
|
|
4304
|
+
}
|
|
4305
|
+
return true;
|
|
4306
|
+
}
|
|
4307
|
+
|
|
4308
|
+
// ../commons/src/events/utils.ts
|
|
4309
|
+
var import_date_fns3 = require("date-fns");
|
|
4310
|
+
function getDeclarationFields(configuration) {
|
|
4311
|
+
return configuration.declaration.pages.flatMap(({ fields }) => fields);
|
|
4312
|
+
}
|
|
4313
|
+
var getActionAnnotationFields = (actionConfig) => {
|
|
4314
|
+
if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
|
|
4315
|
+
return actionConfig.correctionForm.pages.flatMap(({ fields }) => fields);
|
|
4316
|
+
}
|
|
4317
|
+
if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
|
|
4318
|
+
return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
|
|
4319
|
+
}
|
|
4320
|
+
const reviewFields = "review" in actionConfig && actionConfig.review != null ? actionConfig.review.fields : [];
|
|
4321
|
+
const formFields = "form" in actionConfig && actionConfig.form != null ? actionConfig.form : [];
|
|
4322
|
+
return [...reviewFields, ...formFields];
|
|
4323
|
+
};
|
|
4324
|
+
function getAllAnnotationFields(config) {
|
|
4325
|
+
return (0, import_lodash4.flattenDeep)(config.actions.map(getActionAnnotationFields));
|
|
4326
|
+
}
|
|
4327
|
+
var findAllFields = (config) => {
|
|
4328
|
+
return (0, import_lodash4.flattenDeep)([
|
|
4329
|
+
...getDeclarationFields(config),
|
|
4330
|
+
...getAllAnnotationFields(config)
|
|
4331
|
+
]);
|
|
4332
|
+
};
|
|
4333
|
+
var EXCLUDED_ACTIONS = [
|
|
4334
|
+
ActionType.REQUEST_CORRECTION,
|
|
4335
|
+
ActionType.PRINT_CERTIFICATE,
|
|
4336
|
+
ActionType.REJECT_CORRECTION
|
|
4337
|
+
];
|
|
4338
|
+
|
|
3964
4339
|
// ../commons/src/events/eventConfigValidation.ts
|
|
3965
4340
|
function validateAdvancedSearchConfig(event2, ctx) {
|
|
3966
4341
|
const allFields = findAllFields(event2);
|
|
@@ -4043,9 +4418,9 @@ function validatePlaceOfEvent(event2, ctx) {
|
|
|
4043
4418
|
}
|
|
4044
4419
|
function validateActionFlags(event2, ctx) {
|
|
4045
4420
|
const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
|
|
4046
|
-
const configuredFlagIds = event2.flags.map((
|
|
4421
|
+
const configuredFlagIds = event2.flags.map((flag2) => flag2.id);
|
|
4047
4422
|
const actionFlagIds = event2.actions.flatMap(
|
|
4048
|
-
(action) => (action.flags ?? []).map((
|
|
4423
|
+
(action) => (action.flags ?? []).map((flag2) => flag2.id)
|
|
4049
4424
|
);
|
|
4050
4425
|
for (const actionFlagId of actionFlagIds) {
|
|
4051
4426
|
const isConfigured = configuredFlagIds.includes(actionFlagId);
|
|
@@ -4081,11 +4456,11 @@ function validateActionOrder(event2, ctx) {
|
|
|
4081
4456
|
}
|
|
4082
4457
|
|
|
4083
4458
|
// ../commons/src/events/EventConfig.ts
|
|
4084
|
-
var EventFieldReference =
|
|
4459
|
+
var EventFieldReference = z35.object({ $$event: EventMetadataDateFieldIdInput }).describe(
|
|
4085
4460
|
"Reference to a field defined in the event metadata, using the field id."
|
|
4086
4461
|
);
|
|
4087
|
-
var _EventConfigBase =
|
|
4088
|
-
id:
|
|
4462
|
+
var _EventConfigBase = z35.object({
|
|
4463
|
+
id: z35.string().describe(
|
|
4089
4464
|
'Machine-readable identifier of the event (e.g. "birth", "death").'
|
|
4090
4465
|
),
|
|
4091
4466
|
dateOfEvent: FieldReference.or(EventFieldReference).optional().describe(
|
|
@@ -4104,23 +4479,26 @@ var _EventConfigBase = z33.object({
|
|
|
4104
4479
|
"Summary information displayed in the event overview."
|
|
4105
4480
|
),
|
|
4106
4481
|
label: TranslationConfig.describe("Human-readable label for the event type."),
|
|
4107
|
-
actions:
|
|
4482
|
+
actions: z35.array(ActionConfig).describe(
|
|
4108
4483
|
"Configuration of core and custom actions associated with the event."
|
|
4109
4484
|
),
|
|
4110
|
-
actionOrder:
|
|
4485
|
+
actionOrder: z35.array(z35.string()).optional().describe(
|
|
4111
4486
|
"Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
|
|
4112
4487
|
),
|
|
4113
4488
|
declaration: DeclarationFormConfig.describe(
|
|
4114
4489
|
"Configuration of the form used to gather event data."
|
|
4115
4490
|
),
|
|
4116
|
-
advancedSearch:
|
|
4491
|
+
advancedSearch: z35.array(AdvancedSearchConfig).optional().default([]).describe(
|
|
4117
4492
|
"Configuration of fields available in the advanced search feature."
|
|
4118
4493
|
),
|
|
4119
|
-
flags:
|
|
4494
|
+
flags: z35.array(FlagConfig).optional().default([]).describe(
|
|
4120
4495
|
"Configuration of custom flags associated with the actions of this event type."
|
|
4121
4496
|
),
|
|
4122
|
-
analytics:
|
|
4497
|
+
analytics: z35.boolean().optional().default(true).describe(
|
|
4123
4498
|
"Indicates whether the records of this event type are included in analytics"
|
|
4499
|
+
),
|
|
4500
|
+
icon: z35.partialRecord(AvailableIcons, Conditional).optional().describe(
|
|
4501
|
+
'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.'
|
|
4124
4502
|
)
|
|
4125
4503
|
});
|
|
4126
4504
|
var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
|
|
@@ -4140,7 +4518,7 @@ var defineActionForm = (actionForm) => ActionFormConfig.parse(actionForm);
|
|
|
4140
4518
|
var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
|
|
4141
4519
|
|
|
4142
4520
|
// ../commons/src/events/WorkqueueConfig.ts
|
|
4143
|
-
var
|
|
4521
|
+
var z38 = __toESM(require("zod/v4"));
|
|
4144
4522
|
|
|
4145
4523
|
// ../commons/src/searchConfigs.ts
|
|
4146
4524
|
function createSearchConfig(baseField) {
|
|
@@ -4337,21 +4715,31 @@ var event = Object.assign(eventFn, {
|
|
|
4337
4715
|
return {
|
|
4338
4716
|
$event: field3
|
|
4339
4717
|
};
|
|
4340
|
-
}
|
|
4718
|
+
},
|
|
4719
|
+
/**
|
|
4720
|
+
* Checks if the event currently has the given status.
|
|
4721
|
+
* @param eventStatus - The status to check for.
|
|
4722
|
+
*/
|
|
4723
|
+
hasStatus: (eventStatus) => status(eventStatus),
|
|
4724
|
+
/**
|
|
4725
|
+
* Checks if the event currently carries the given flag.
|
|
4726
|
+
* @param flagValue - The flag to check for.
|
|
4727
|
+
*/
|
|
4728
|
+
hasFlag: (flagValue) => flag(flagValue)
|
|
4341
4729
|
});
|
|
4342
4730
|
|
|
4343
4731
|
// ../commons/src/events/WorkqueueColumnConfig.ts
|
|
4344
|
-
var
|
|
4732
|
+
var z36 = __toESM(require("zod/v4"));
|
|
4345
4733
|
var WorkqueueColumnKeysArray = [
|
|
4346
4734
|
...EventMetadataKeysArray,
|
|
4347
4735
|
"title",
|
|
4348
4736
|
"outbox"
|
|
4349
4737
|
];
|
|
4350
|
-
var WorkqueueColumnKeys =
|
|
4351
|
-
var WorkqueueColumnValue =
|
|
4738
|
+
var WorkqueueColumnKeys = z36.enum(WorkqueueColumnKeysArray);
|
|
4739
|
+
var WorkqueueColumnValue = z36.object({
|
|
4352
4740
|
$event: WorkqueueColumnKeys
|
|
4353
4741
|
});
|
|
4354
|
-
var WorkqueueColumn =
|
|
4742
|
+
var WorkqueueColumn = z36.object({
|
|
4355
4743
|
label: TranslationConfig,
|
|
4356
4744
|
value: WorkqueueColumnValue
|
|
4357
4745
|
}).meta({
|
|
@@ -4365,164 +4753,56 @@ function defineWorkqueuesColumns(workqueueColumns) {
|
|
|
4365
4753
|
}
|
|
4366
4754
|
|
|
4367
4755
|
// ../commons/src/events/CountryConfigQueryInput.ts
|
|
4368
|
-
var
|
|
4369
|
-
var SerializableExact =
|
|
4370
|
-
type:
|
|
4371
|
-
term:
|
|
4372
|
-
});
|
|
4373
|
-
var SerializableWithin =
|
|
4374
|
-
type:
|
|
4375
|
-
location:
|
|
4376
|
-
});
|
|
4377
|
-
var SerializedQueryExpression =
|
|
4378
|
-
eventType:
|
|
4379
|
-
status:
|
|
4380
|
-
createdAt:
|
|
4381
|
-
updatedAt:
|
|
4382
|
-
"legalStatuses.DECLARED.createdAtLocation":
|
|
4383
|
-
"legalStatuses.DECLARED.createdByRole":
|
|
4384
|
-
"legalStatuses.REGISTERED.createdAt":
|
|
4385
|
-
"legalStatuses.REGISTERED.createdAtLocation":
|
|
4386
|
-
"legalStatuses.REGISTERED.createdByRole":
|
|
4387
|
-
"legalStatuses.REGISTERED.registrationNumber":
|
|
4388
|
-
createdAtLocation:
|
|
4389
|
-
|
|
4756
|
+
var z37 = __toESM(require("zod/v4"));
|
|
4757
|
+
var SerializableExact = z37.object({
|
|
4758
|
+
type: z37.literal("exact"),
|
|
4759
|
+
term: z37.union([z37.string(), SerializedUserField])
|
|
4760
|
+
});
|
|
4761
|
+
var SerializableWithin = z37.object({
|
|
4762
|
+
type: z37.literal("within"),
|
|
4763
|
+
location: z37.union([z37.string(), SerializedUserField])
|
|
4764
|
+
});
|
|
4765
|
+
var SerializedQueryExpression = z37.object({
|
|
4766
|
+
eventType: z37.string(),
|
|
4767
|
+
status: z37.optional(z37.union([AnyOfStatus, ExactStatus])),
|
|
4768
|
+
createdAt: z37.optional(DateCondition),
|
|
4769
|
+
updatedAt: z37.optional(DateCondition),
|
|
4770
|
+
"legalStatuses.DECLARED.createdAtLocation": z37.optional(SerializableWithin),
|
|
4771
|
+
"legalStatuses.DECLARED.createdByRole": z37.optional(AnyOf),
|
|
4772
|
+
"legalStatuses.REGISTERED.createdAt": z37.optional(DateCondition),
|
|
4773
|
+
"legalStatuses.REGISTERED.createdAtLocation": z37.optional(SerializableWithin),
|
|
4774
|
+
"legalStatuses.REGISTERED.createdByRole": z37.optional(AnyOf),
|
|
4775
|
+
"legalStatuses.REGISTERED.registrationNumber": z37.optional(Exact),
|
|
4776
|
+
createdAtLocation: z37.optional(
|
|
4777
|
+
z37.union([SerializableWithin, SerializableExact])
|
|
4390
4778
|
),
|
|
4391
|
-
updatedAtLocation:
|
|
4392
|
-
|
|
4779
|
+
updatedAtLocation: z37.optional(
|
|
4780
|
+
z37.union([SerializableWithin, SerializableExact])
|
|
4393
4781
|
),
|
|
4394
|
-
updatedByUserRole:
|
|
4395
|
-
assignedTo:
|
|
4396
|
-
createdBy:
|
|
4782
|
+
updatedByUserRole: z37.optional(SerializableExact),
|
|
4783
|
+
assignedTo: z37.optional(SerializableExact),
|
|
4784
|
+
createdBy: z37.optional(SerializableExact),
|
|
4397
4785
|
createdByUserType: ExactUserType,
|
|
4398
|
-
updatedBy:
|
|
4399
|
-
trackingId:
|
|
4400
|
-
flags:
|
|
4786
|
+
updatedBy: z37.optional(SerializableExact),
|
|
4787
|
+
trackingId: z37.optional(Exact),
|
|
4788
|
+
flags: z37.optional(ContainsFlags),
|
|
4401
4789
|
data: QueryInput
|
|
4402
4790
|
}).partial();
|
|
4403
|
-
var Or2 =
|
|
4404
|
-
type:
|
|
4405
|
-
clauses:
|
|
4791
|
+
var Or2 = z37.object({
|
|
4792
|
+
type: z37.literal("or"),
|
|
4793
|
+
clauses: z37.array(SerializedQueryExpression)
|
|
4406
4794
|
});
|
|
4407
|
-
var And2 =
|
|
4408
|
-
type:
|
|
4409
|
-
clauses:
|
|
4795
|
+
var And2 = z37.object({
|
|
4796
|
+
type: z37.literal("and"),
|
|
4797
|
+
clauses: z37.array(SerializedQueryExpression)
|
|
4410
4798
|
});
|
|
4411
|
-
var CountryConfigQueryType =
|
|
4412
|
-
var CountryConfigQueryInputType =
|
|
4799
|
+
var CountryConfigQueryType = z37.discriminatedUnion("type", [And2, Or2]);
|
|
4800
|
+
var CountryConfigQueryInputType = z37.union([
|
|
4413
4801
|
SerializedQueryExpression,
|
|
4414
4802
|
And2,
|
|
4415
4803
|
Or2
|
|
4416
4804
|
]);
|
|
4417
4805
|
|
|
4418
|
-
// ../commons/src/icons.ts
|
|
4419
|
-
var z36 = __toESM(require("zod/v4"));
|
|
4420
|
-
var AvailableIcons = z36.enum([
|
|
4421
|
-
"Archived",
|
|
4422
|
-
"Assigned",
|
|
4423
|
-
"Briefcase",
|
|
4424
|
-
"Certified",
|
|
4425
|
-
"Close",
|
|
4426
|
-
"Collapse",
|
|
4427
|
-
"Draft",
|
|
4428
|
-
"DuplicateYellow",
|
|
4429
|
-
"Expand",
|
|
4430
|
-
"ExternalValidate",
|
|
4431
|
-
"FilledCheck",
|
|
4432
|
-
"InReview",
|
|
4433
|
-
"Offline",
|
|
4434
|
-
"Registered",
|
|
4435
|
-
"RequiresUpdates",
|
|
4436
|
-
"Sent",
|
|
4437
|
-
"Validated",
|
|
4438
|
-
"WaitingApproval",
|
|
4439
|
-
"ChartActivity",
|
|
4440
|
-
"Activity",
|
|
4441
|
-
"Archive",
|
|
4442
|
-
"ArchiveTray",
|
|
4443
|
-
"ArrowLeft",
|
|
4444
|
-
"ArrowRight",
|
|
4445
|
-
"Buildings",
|
|
4446
|
-
"Circle",
|
|
4447
|
-
"CaretDown",
|
|
4448
|
-
"CaretLeft",
|
|
4449
|
-
"CaretRight",
|
|
4450
|
-
"ChartBar",
|
|
4451
|
-
"ChartLine",
|
|
4452
|
-
"ChatCircle",
|
|
4453
|
-
"CheckSquare",
|
|
4454
|
-
"Compass",
|
|
4455
|
-
"Check",
|
|
4456
|
-
"Copy",
|
|
4457
|
-
"Database",
|
|
4458
|
-
"DotsThreeVertical",
|
|
4459
|
-
"ArrowCounterClockwise",
|
|
4460
|
-
"MagnifyingGlassMinus",
|
|
4461
|
-
"MagnifyingGlassPlus",
|
|
4462
|
-
"Export",
|
|
4463
|
-
"Eye",
|
|
4464
|
-
"EyeSlash",
|
|
4465
|
-
"Envelope",
|
|
4466
|
-
"File",
|
|
4467
|
-
"FileSearch",
|
|
4468
|
-
"FileMinus",
|
|
4469
|
-
"FilePlus",
|
|
4470
|
-
"FileText",
|
|
4471
|
-
"FileX",
|
|
4472
|
-
"Handshake",
|
|
4473
|
-
"Gear",
|
|
4474
|
-
"GitBranch",
|
|
4475
|
-
"IdentificationCard",
|
|
4476
|
-
"List",
|
|
4477
|
-
"ListBullets",
|
|
4478
|
-
"Lock",
|
|
4479
|
-
"MagnifyingGlass",
|
|
4480
|
-
"MapPin",
|
|
4481
|
-
"Medal",
|
|
4482
|
-
"NotePencil",
|
|
4483
|
-
"Paperclip",
|
|
4484
|
-
"PaperPlaneTilt",
|
|
4485
|
-
"Pen",
|
|
4486
|
-
"PenNib",
|
|
4487
|
-
"Pencil",
|
|
4488
|
-
"PencilSimpleLine",
|
|
4489
|
-
"Phone",
|
|
4490
|
-
"Plus",
|
|
4491
|
-
"Printer",
|
|
4492
|
-
"SignOut",
|
|
4493
|
-
"Stamp",
|
|
4494
|
-
"Star",
|
|
4495
|
-
"Target",
|
|
4496
|
-
"TextT",
|
|
4497
|
-
"Trash",
|
|
4498
|
-
"UploadSimple",
|
|
4499
|
-
"User",
|
|
4500
|
-
"UserPlus",
|
|
4501
|
-
"Users",
|
|
4502
|
-
"WarningCircle",
|
|
4503
|
-
"X",
|
|
4504
|
-
"ChatText",
|
|
4505
|
-
"CircleWavyCheck",
|
|
4506
|
-
"CircleWavyQuestion",
|
|
4507
|
-
"ArchiveBox",
|
|
4508
|
-
"ArrowCircleDown",
|
|
4509
|
-
"FileArrowUp",
|
|
4510
|
-
"FileDotted",
|
|
4511
|
-
"Files",
|
|
4512
|
-
"PencilLine",
|
|
4513
|
-
"PencilCircle",
|
|
4514
|
-
"UserCircle",
|
|
4515
|
-
"Clock",
|
|
4516
|
-
"QrCode",
|
|
4517
|
-
"Webcam",
|
|
4518
|
-
"Sun",
|
|
4519
|
-
"DeviceTabletCamera",
|
|
4520
|
-
"Globe",
|
|
4521
|
-
"Fingerprint",
|
|
4522
|
-
"PushPin",
|
|
4523
|
-
"Timer"
|
|
4524
|
-
]);
|
|
4525
|
-
|
|
4526
4806
|
// ../commons/src/events/WorkqueueConfig.ts
|
|
4527
4807
|
var mandatoryColumns = defineWorkqueuesColumns([
|
|
4528
4808
|
{
|
|
@@ -4542,16 +4822,16 @@ var mandatoryColumns = defineWorkqueuesColumns([
|
|
|
4542
4822
|
value: event.field("updatedAt")
|
|
4543
4823
|
}
|
|
4544
4824
|
]);
|
|
4545
|
-
var WorkqueueConfig =
|
|
4546
|
-
slug:
|
|
4825
|
+
var WorkqueueConfig = z38.object({
|
|
4826
|
+
slug: z38.string().describe("Determines the url of the workqueue."),
|
|
4547
4827
|
name: TranslationConfig.describe(
|
|
4548
4828
|
"Title of the workflow (both in navigation and on the page)"
|
|
4549
4829
|
),
|
|
4550
4830
|
query: CountryConfigQueryType,
|
|
4551
|
-
action:
|
|
4831
|
+
action: z38.object({ type: WorkqueueActionType }).optional().describe(
|
|
4552
4832
|
"Workqueue call-to-action button configuration. This determines the quick action button shown on each event card and the action taken when the button is clicked."
|
|
4553
4833
|
),
|
|
4554
|
-
columns:
|
|
4834
|
+
columns: z38.array(WorkqueueColumn).default(mandatoryColumns),
|
|
4555
4835
|
icon: AvailableIcons,
|
|
4556
4836
|
emptyMessage: TranslationConfig.optional()
|
|
4557
4837
|
}).describe("Configuration for workqueue.");
|
|
@@ -4565,10 +4845,10 @@ var WorkqueueConfigInput = WorkqueueConfig.extend({
|
|
|
4565
4845
|
id: "WorkqueueConfig",
|
|
4566
4846
|
description: "Configuration for a single workqueue. Defines the filter applied to the event index, the quick-action button, the columns shown on each row, and the message rendered when the queue is empty."
|
|
4567
4847
|
});
|
|
4568
|
-
var WorkqueueCountInput =
|
|
4569
|
-
|
|
4848
|
+
var WorkqueueCountInput = z38.array(
|
|
4849
|
+
z38.object({ slug: z38.string(), query: QueryType })
|
|
4570
4850
|
);
|
|
4571
|
-
var WorkqueueCountOutput =
|
|
4851
|
+
var WorkqueueCountOutput = z38.record(z38.string(), z38.number());
|
|
4572
4852
|
|
|
4573
4853
|
// ../commons/src/events/workqueueDefaultColumns.ts
|
|
4574
4854
|
var defaultWorkqueueColumns = [
|
|
@@ -4591,21 +4871,21 @@ var defaultWorkqueueColumns = [
|
|
|
4591
4871
|
];
|
|
4592
4872
|
|
|
4593
4873
|
// ../commons/src/events/Draft.ts
|
|
4594
|
-
var
|
|
4874
|
+
var z40 = __toESM(require("zod/v4"));
|
|
4595
4875
|
|
|
4596
4876
|
// ../commons/src/events/ActionInput.ts
|
|
4597
|
-
var
|
|
4598
|
-
var BaseActionInput =
|
|
4877
|
+
var z39 = __toESM(require("zod/v4"));
|
|
4878
|
+
var BaseActionInput = z39.object({
|
|
4599
4879
|
eventId: UUID,
|
|
4600
|
-
transactionId:
|
|
4880
|
+
transactionId: z39.string(),
|
|
4601
4881
|
declaration: ActionUpdate.default({}),
|
|
4602
4882
|
annotation: ActionUpdate.optional(),
|
|
4603
4883
|
originalActionId: UUID.optional(),
|
|
4604
4884
|
// should not be part of base action.
|
|
4605
|
-
keepAssignment:
|
|
4606
|
-
keepAssignmentIfAccepted:
|
|
4607
|
-
keepAssignmentIfRejected:
|
|
4608
|
-
waitFor:
|
|
4885
|
+
keepAssignment: z39.boolean().optional(),
|
|
4886
|
+
keepAssignmentIfAccepted: z39.boolean().optional(),
|
|
4887
|
+
keepAssignmentIfRejected: z39.boolean().optional(),
|
|
4888
|
+
waitFor: z39.boolean().default(true).describe(
|
|
4609
4889
|
"Whether action waits for the indexing before returning. Defaults to true. Setting this to to false completes faster but might lead to stale data in the client if the client tries to read the event immediately after performing the action. Use with care."
|
|
4610
4890
|
),
|
|
4611
4891
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
@@ -4615,8 +4895,8 @@ var BaseActionInput = z38.object({
|
|
|
4615
4895
|
)
|
|
4616
4896
|
});
|
|
4617
4897
|
var CreateActionInput = BaseActionInput.extend(
|
|
4618
|
-
|
|
4619
|
-
type:
|
|
4898
|
+
z39.object({
|
|
4899
|
+
type: z39.literal(ActionType.CREATE).default(ActionType.CREATE),
|
|
4620
4900
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
4621
4901
|
createdAtLocation: UUID.nullish().describe(
|
|
4622
4902
|
"A valid office location ID. This is required for system users performing actions. The provided location must be a leaf-location, i.e. it must not have any children locations."
|
|
@@ -4624,14 +4904,14 @@ var CreateActionInput = BaseActionInput.extend(
|
|
|
4624
4904
|
}).shape
|
|
4625
4905
|
);
|
|
4626
4906
|
var RegisterActionInput = BaseActionInput.extend(
|
|
4627
|
-
|
|
4628
|
-
type:
|
|
4629
|
-
registrationNumber:
|
|
4907
|
+
z39.strictObject({
|
|
4908
|
+
type: z39.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
|
4909
|
+
registrationNumber: z39.string().optional()
|
|
4630
4910
|
}).shape
|
|
4631
4911
|
);
|
|
4632
4912
|
var NotifyActionInput = BaseActionInput.extend(
|
|
4633
|
-
|
|
4634
|
-
type:
|
|
4913
|
+
z39.object({
|
|
4914
|
+
type: z39.literal(ActionType.NOTIFY).default(ActionType.NOTIFY),
|
|
4635
4915
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
4636
4916
|
createdAtLocation: UUID.nullish().describe(
|
|
4637
4917
|
"A valid office location ID. This is required for system users performing actions. The provided location must be a leaf-location, i.e. it must not have any children locations."
|
|
@@ -4647,103 +4927,107 @@ var NotifyActionInput = BaseActionInput.extend(
|
|
|
4647
4927
|
}
|
|
4648
4928
|
});
|
|
4649
4929
|
var DeclareActionInput = BaseActionInput.extend(
|
|
4650
|
-
|
|
4651
|
-
type:
|
|
4930
|
+
z39.object({
|
|
4931
|
+
type: z39.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
|
4652
4932
|
}).shape
|
|
4653
4933
|
);
|
|
4654
4934
|
var EditActionInput = BaseActionInput.extend(
|
|
4655
|
-
|
|
4656
|
-
type:
|
|
4935
|
+
z39.object({
|
|
4936
|
+
type: z39.literal(ActionType.EDIT).default(ActionType.EDIT)
|
|
4657
4937
|
}).shape
|
|
4658
4938
|
);
|
|
4659
4939
|
var PrintCertificateActionInput = BaseActionInput.extend(
|
|
4660
|
-
|
|
4661
|
-
type:
|
|
4940
|
+
z39.object({
|
|
4941
|
+
type: z39.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
|
|
4662
4942
|
content: PrintContent.optional()
|
|
4663
4943
|
}).shape
|
|
4664
4944
|
);
|
|
4665
4945
|
var RejectDeclarationActionInput = BaseActionInput.extend(
|
|
4666
|
-
|
|
4667
|
-
type:
|
|
4946
|
+
z39.object({
|
|
4947
|
+
type: z39.literal(ActionType.REJECT).default(ActionType.REJECT),
|
|
4668
4948
|
content: ReasonContent
|
|
4669
4949
|
}).shape
|
|
4670
4950
|
);
|
|
4671
4951
|
var DuplicateDetectedActionInput = BaseActionInput.extend(
|
|
4672
|
-
|
|
4673
|
-
type:
|
|
4674
|
-
content:
|
|
4675
|
-
duplicates:
|
|
4952
|
+
z39.object({
|
|
4953
|
+
type: z39.literal(ActionType.DUPLICATE_DETECTED).default(ActionType.DUPLICATE_DETECTED),
|
|
4954
|
+
content: z39.object({
|
|
4955
|
+
duplicates: z39.array(PotentialDuplicate)
|
|
4676
4956
|
})
|
|
4677
4957
|
}).shape
|
|
4678
4958
|
);
|
|
4679
4959
|
var MarkAsDuplicateActionInput = BaseActionInput.extend(
|
|
4680
|
-
|
|
4681
|
-
type:
|
|
4682
|
-
content:
|
|
4960
|
+
z39.object({
|
|
4961
|
+
type: z39.literal(ActionType.MARK_AS_DUPLICATE).default(ActionType.MARK_AS_DUPLICATE),
|
|
4962
|
+
content: z39.object({
|
|
4683
4963
|
duplicateOf: UUID
|
|
4684
4964
|
}).optional()
|
|
4685
4965
|
}).shape
|
|
4686
4966
|
);
|
|
4687
4967
|
var MarkNotDuplicateActionInput = BaseActionInput.extend(
|
|
4688
|
-
|
|
4689
|
-
type:
|
|
4968
|
+
z39.object({
|
|
4969
|
+
type: z39.literal(ActionType.MARK_AS_NOT_DUPLICATE).default(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
4690
4970
|
}).shape
|
|
4691
4971
|
);
|
|
4692
4972
|
var ArchiveActionInput = BaseActionInput.extend(
|
|
4693
|
-
|
|
4694
|
-
type:
|
|
4695
|
-
|
|
4973
|
+
z39.object({
|
|
4974
|
+
type: z39.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
|
|
4975
|
+
/**
|
|
4976
|
+
* Archiving does not collect a reason on its own. Only the
|
|
4977
|
+
* "mark as duplicate" flow archives with a reason attached.
|
|
4978
|
+
*/
|
|
4979
|
+
content: ReasonContent.optional()
|
|
4696
4980
|
}).shape
|
|
4697
4981
|
);
|
|
4698
4982
|
var UnarchiveActionInput = BaseActionInput.extend(
|
|
4699
|
-
|
|
4700
|
-
type:
|
|
4983
|
+
z39.object({
|
|
4984
|
+
type: z39.literal(ActionType.UNARCHIVE).default(ActionType.UNARCHIVE)
|
|
4701
4985
|
}).shape
|
|
4702
4986
|
);
|
|
4703
4987
|
var AssignActionInput = BaseActionInput.extend(
|
|
4704
|
-
|
|
4705
|
-
type:
|
|
4706
|
-
assignedTo:
|
|
4988
|
+
z39.object({
|
|
4989
|
+
type: z39.literal(ActionType.ASSIGN),
|
|
4990
|
+
assignedTo: z39.string()
|
|
4707
4991
|
}).shape
|
|
4708
4992
|
);
|
|
4709
4993
|
var UnassignActionInput = BaseActionInput.extend(
|
|
4710
|
-
|
|
4711
|
-
type:
|
|
4712
|
-
assignedTo:
|
|
4994
|
+
z39.object({
|
|
4995
|
+
type: z39.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
|
|
4996
|
+
assignedTo: z39.literal(null).default(null)
|
|
4713
4997
|
}).shape
|
|
4714
4998
|
);
|
|
4715
4999
|
var RequestCorrectionActionInput = BaseActionInput.extend(
|
|
4716
|
-
|
|
4717
|
-
type:
|
|
5000
|
+
z39.object({
|
|
5001
|
+
type: z39.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
|
4718
5002
|
}).shape
|
|
4719
5003
|
);
|
|
4720
5004
|
var RejectCorrectionActionInput = BaseActionInput.extend(
|
|
4721
|
-
|
|
4722
|
-
requestId:
|
|
4723
|
-
type:
|
|
5005
|
+
z39.object({
|
|
5006
|
+
requestId: z39.string(),
|
|
5007
|
+
type: z39.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION),
|
|
4724
5008
|
content: ReasonContent
|
|
4725
5009
|
}).shape
|
|
4726
5010
|
);
|
|
4727
5011
|
var ApproveCorrectionActionInput = BaseActionInput.extend(
|
|
4728
|
-
|
|
4729
|
-
requestId:
|
|
4730
|
-
type:
|
|
4731
|
-
content:
|
|
5012
|
+
z39.object({
|
|
5013
|
+
requestId: z39.string(),
|
|
5014
|
+
type: z39.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION),
|
|
5015
|
+
content: z39.object({ immediateCorrection: z39.boolean().optional() }).optional()
|
|
4732
5016
|
}).shape
|
|
4733
5017
|
);
|
|
4734
5018
|
var ReadActionInput = BaseActionInput.extend(
|
|
4735
|
-
|
|
4736
|
-
type:
|
|
5019
|
+
z39.object({
|
|
5020
|
+
type: z39.literal(ActionType.READ).default(ActionType.READ)
|
|
4737
5021
|
}).shape
|
|
4738
5022
|
);
|
|
4739
|
-
var DeleteActionInput =
|
|
5023
|
+
var DeleteActionInput = z39.object({ eventId: UUID });
|
|
4740
5024
|
var CustomActionInput = BaseActionInput.extend(
|
|
4741
|
-
|
|
4742
|
-
type:
|
|
4743
|
-
customActionType:
|
|
5025
|
+
z39.object({
|
|
5026
|
+
type: z39.literal(ActionType.CUSTOM).default(ActionType.CUSTOM),
|
|
5027
|
+
customActionType: z39.string().describe("Name of the custom action.")
|
|
4744
5028
|
}).shape
|
|
4745
5029
|
);
|
|
4746
|
-
var ActionInput =
|
|
5030
|
+
var ActionInput = z39.discriminatedUnion("type", [
|
|
4747
5031
|
CreateActionInput.meta({ id: "CreateActionInput" }),
|
|
4748
5032
|
RegisterActionInput.meta({ id: "RegisterActionInput" }),
|
|
4749
5033
|
NotifyActionInput.meta({ id: "NotifyActionInput" }),
|
|
@@ -4780,11 +5064,11 @@ var ActionInput = z38.discriminatedUnion("type", [
|
|
|
4780
5064
|
});
|
|
4781
5065
|
|
|
4782
5066
|
// ../commons/src/events/Draft.ts
|
|
4783
|
-
var Draft =
|
|
5067
|
+
var Draft = z40.object({
|
|
4784
5068
|
id: UUID,
|
|
4785
5069
|
eventId: UUID,
|
|
4786
|
-
transactionId:
|
|
4787
|
-
createdAt:
|
|
5070
|
+
transactionId: z40.string(),
|
|
5071
|
+
createdAt: z40.string().datetime(),
|
|
4788
5072
|
action: ActionBase.extend({
|
|
4789
5073
|
type: ActionTypes.exclude([ActionTypes.enum.DELETE])
|
|
4790
5074
|
}).omit({ id: true, createdAtLocation: true })
|
|
@@ -4793,7 +5077,7 @@ var Draft = z39.object({
|
|
|
4793
5077
|
);
|
|
4794
5078
|
var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
|
|
4795
5079
|
type: ActionTypes.exclude([ActionTypes.enum.DELETE]),
|
|
4796
|
-
status:
|
|
5080
|
+
status: z40.enum([
|
|
4797
5081
|
ActionStatus.Requested,
|
|
4798
5082
|
ActionStatus.Accepted,
|
|
4799
5083
|
ActionStatus.Rejected
|
|
@@ -4801,91 +5085,33 @@ var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
|
|
|
4801
5085
|
});
|
|
4802
5086
|
|
|
4803
5087
|
// ../commons/src/events/EventInput.ts
|
|
4804
|
-
var
|
|
4805
|
-
var
|
|
4806
|
-
var EventInput =
|
|
4807
|
-
transactionId:
|
|
4808
|
-
type:
|
|
5088
|
+
var z41 = __toESM(require("zod/v4"));
|
|
5089
|
+
var import_uuid11 = require("uuid");
|
|
5090
|
+
var EventInput = z41.object({
|
|
5091
|
+
transactionId: z41.string(),
|
|
5092
|
+
type: z41.string(),
|
|
4809
5093
|
createdAtLocation: UUID.nullish().describe(
|
|
4810
5094
|
"Location where the event occurred. Required for system users."
|
|
4811
5095
|
)
|
|
4812
|
-
}).meta({ default: { transactionId: (0,
|
|
5096
|
+
}).meta({ default: { transactionId: (0, import_uuid11.v4)(), type: "birth" } });
|
|
4813
5097
|
|
|
4814
5098
|
// ../commons/src/events/EventDocument.ts
|
|
4815
|
-
var
|
|
4816
|
-
var EventDocument =
|
|
5099
|
+
var z42 = __toESM(require("zod/v4"));
|
|
5100
|
+
var EventDocument = z42.object({
|
|
4817
5101
|
id: UUID.describe("Unique identifier of the event."),
|
|
4818
|
-
type:
|
|
4819
|
-
createdAt:
|
|
4820
|
-
updatedAt:
|
|
5102
|
+
type: z42.string().describe("Type of the event (e.g. birth, death, marriage)."),
|
|
5103
|
+
createdAt: z42.string().datetime().describe("Timestamp indicating when the event was created."),
|
|
5104
|
+
updatedAt: z42.string().datetime().describe(
|
|
4821
5105
|
"Timestamp of the last update, excluding changes from actions."
|
|
4822
5106
|
),
|
|
4823
|
-
actions:
|
|
4824
|
-
trackingId:
|
|
5107
|
+
actions: z42.array(Action).describe("Ordered list of actions associated with the event."),
|
|
5108
|
+
trackingId: z42.string().describe(
|
|
4825
5109
|
"System-generated tracking identifier used to look up the event."
|
|
4826
5110
|
)
|
|
4827
5111
|
}).meta({ id: "EventDocument" });
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
// ../commons/src/events/state/utils.ts
|
|
4833
|
-
var import_lodash2 = require("lodash");
|
|
4834
|
-
var updateActions = ActionTypes.extract([
|
|
4835
|
-
ActionType.CREATE,
|
|
4836
|
-
ActionType.NOTIFY,
|
|
4837
|
-
ActionType.EDIT,
|
|
4838
|
-
ActionType.DECLARE,
|
|
4839
|
-
ActionType.REGISTER,
|
|
4840
|
-
ActionType.REJECT,
|
|
4841
|
-
ActionType.ARCHIVE,
|
|
4842
|
-
ActionType.UNARCHIVE,
|
|
4843
|
-
ActionType.PRINT_CERTIFICATE,
|
|
4844
|
-
ActionType.REQUEST_CORRECTION,
|
|
4845
|
-
ActionType.APPROVE_CORRECTION,
|
|
4846
|
-
ActionType.REJECT_CORRECTION,
|
|
4847
|
-
ActionType.CUSTOM
|
|
4848
|
-
]);
|
|
4849
|
-
|
|
4850
|
-
// ../commons/src/events/state/flags.ts
|
|
4851
|
-
var import_lodash3 = require("lodash");
|
|
4852
|
-
var import_date_fns3 = require("date-fns");
|
|
4853
|
-
var INHERENT_FLAG_RULES = [
|
|
4854
|
-
{
|
|
4855
|
-
flag: InherentFlags.CORRECTION_REQUESTED,
|
|
4856
|
-
setOn: [ActionType.REQUEST_CORRECTION],
|
|
4857
|
-
resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
|
|
4858
|
-
},
|
|
4859
|
-
{
|
|
4860
|
-
// INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
|
|
4861
|
-
// other status-changing action (see getStatusFromActions). ARCHIVE/UNARCHIVE
|
|
4862
|
-
// are deliberately excluded so the flag freezes across an archive/unarchive
|
|
4863
|
-
// round trip and comes back exactly as it was.
|
|
4864
|
-
flag: InherentFlags.INCOMPLETE,
|
|
4865
|
-
setOn: [ActionType.NOTIFY],
|
|
4866
|
-
resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
|
|
4867
|
-
},
|
|
4868
|
-
{
|
|
4869
|
-
flag: InherentFlags.REJECTED,
|
|
4870
|
-
setOn: [ActionType.REJECT],
|
|
4871
|
-
resetOn: [
|
|
4872
|
-
ActionType.NOTIFY,
|
|
4873
|
-
ActionType.DECLARE,
|
|
4874
|
-
ActionType.EDIT,
|
|
4875
|
-
ActionType.REGISTER
|
|
4876
|
-
]
|
|
4877
|
-
},
|
|
4878
|
-
{
|
|
4879
|
-
flag: InherentFlags.POTENTIAL_DUPLICATE,
|
|
4880
|
-
setOn: [ActionType.DUPLICATE_DETECTED],
|
|
4881
|
-
resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
|
|
4882
|
-
},
|
|
4883
|
-
{
|
|
4884
|
-
flag: InherentFlags.EDIT_IN_PROGRESS,
|
|
4885
|
-
setOn: [ActionType.EDIT],
|
|
4886
|
-
resetOnAnyOtherAction: true
|
|
4887
|
-
}
|
|
4888
|
-
];
|
|
5112
|
+
var EventDocumentOnlyLastAction = EventDocument.extend({
|
|
5113
|
+
actions: z42.array(Action).max(1).describe("Only the last action associated with the event.")
|
|
5114
|
+
}).brand("EventDocumentOnlyLastAction");
|
|
4889
5115
|
|
|
4890
5116
|
// ../commons/src/events/defineConfig.ts
|
|
4891
5117
|
var IGNORED_EVENT_TYPES = [
|
|
@@ -5666,6 +5892,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
|
|
5666
5892
|
defaultMessage: "Who is applying for the membership?",
|
|
5667
5893
|
description: "This is the title of the section"
|
|
5668
5894
|
},
|
|
5895
|
+
showClearButton: true,
|
|
5669
5896
|
fields: [
|
|
5670
5897
|
{
|
|
5671
5898
|
id: "applicant.name",
|
|
@@ -7332,25 +7559,11 @@ var digitalIdentityEvent = defineConfig({
|
|
|
7332
7559
|
printForm: PRINT_DIGITAL_ID_CERTIFICATE_FORM
|
|
7333
7560
|
}
|
|
7334
7561
|
],
|
|
7335
|
-
declaration: digitalIdentityForm
|
|
7336
|
-
});
|
|
7337
|
-
|
|
7338
|
-
// ../commons/src/events/test.utils.ts
|
|
7339
|
-
var z42 = __toESM(require("zod/v4"));
|
|
7340
|
-
var TestUserRole = z42.enum([
|
|
7341
|
-
"FIELD_AGENT",
|
|
7342
|
-
"LOCAL_REGISTRAR",
|
|
7343
|
-
"LOCAL_SYSTEM_ADMIN",
|
|
7344
|
-
"NATIONAL_REGISTRAR",
|
|
7345
|
-
"REGISTRATION_AGENT",
|
|
7346
|
-
"NATIONAL_SYSTEM_ADMIN",
|
|
7347
|
-
"SOCIAL_WORKER",
|
|
7348
|
-
"COMMUNITY_LEADER",
|
|
7349
|
-
"PROVINCIAL_REGISTRAR"
|
|
7350
|
-
]);
|
|
7562
|
+
declaration: digitalIdentityForm
|
|
7563
|
+
});
|
|
7351
7564
|
|
|
7352
|
-
// ../commons/src/events/
|
|
7353
|
-
var
|
|
7565
|
+
// ../commons/src/events/test.utils.ts
|
|
7566
|
+
var z44 = __toESM(require("zod/v4"));
|
|
7354
7567
|
|
|
7355
7568
|
// ../commons/src/events/locations.ts
|
|
7356
7569
|
var z43 = __toESM(require("zod/v4"));
|
|
@@ -7384,116 +7597,65 @@ var Location = z43.object({
|
|
|
7384
7597
|
status: LocationStatus,
|
|
7385
7598
|
versions: z43.array(LocationVersion)
|
|
7386
7599
|
});
|
|
7600
|
+
var ClientAdministrativeArea = AdministrativeArea.omit({
|
|
7601
|
+
name: true,
|
|
7602
|
+
status: true,
|
|
7603
|
+
externalId: true
|
|
7604
|
+
});
|
|
7605
|
+
var ClientLocation = Location.omit({
|
|
7606
|
+
name: true,
|
|
7607
|
+
status: true,
|
|
7608
|
+
externalId: true
|
|
7609
|
+
});
|
|
7610
|
+
function toClientLocation(location) {
|
|
7611
|
+
return {
|
|
7612
|
+
id: location.id,
|
|
7613
|
+
administrativeAreaId: location.administrativeAreaId,
|
|
7614
|
+
locationType: location.locationType,
|
|
7615
|
+
versions: location.versions
|
|
7616
|
+
};
|
|
7617
|
+
}
|
|
7618
|
+
function toClientAdministrativeArea(area) {
|
|
7619
|
+
return {
|
|
7620
|
+
id: area.id,
|
|
7621
|
+
parentId: area.parentId,
|
|
7622
|
+
versions: area.versions
|
|
7623
|
+
};
|
|
7624
|
+
}
|
|
7625
|
+
function validateAscendingDates(versions, ctx) {
|
|
7626
|
+
const ascending = versions.every(
|
|
7627
|
+
(version, index) => index === 0 || versions[index - 1].effectiveFrom < version.effectiveFrom
|
|
7628
|
+
);
|
|
7629
|
+
if (!ascending) {
|
|
7630
|
+
ctx.addIssue("versions must be strictly ascending by effectiveFrom");
|
|
7631
|
+
}
|
|
7632
|
+
}
|
|
7633
|
+
function validateUniqueIds(versions, ctx) {
|
|
7634
|
+
const versionIds = new Set(versions.map((version) => version.versionId));
|
|
7635
|
+
if (versionIds.size !== versions.length) {
|
|
7636
|
+
ctx.addIssue("versions must not repeat a versionId");
|
|
7637
|
+
}
|
|
7638
|
+
}
|
|
7639
|
+
var SeededLocationVersions = z43.array(LocationVersion).min(1).superRefine((versions, ctx) => {
|
|
7640
|
+
validateAscendingDates(versions, ctx);
|
|
7641
|
+
validateUniqueIds(versions, ctx);
|
|
7642
|
+
});
|
|
7387
7643
|
var SetLocationPayload = z43.object({
|
|
7388
7644
|
id: UUID,
|
|
7389
7645
|
name: z43.string(),
|
|
7390
7646
|
externalId: z43.string().nullish(),
|
|
7391
7647
|
administrativeAreaId: UUID.nullable(),
|
|
7392
|
-
locationType: z43.string().nullable()
|
|
7648
|
+
locationType: z43.string().nullable(),
|
|
7649
|
+
versions: SeededLocationVersions.optional()
|
|
7393
7650
|
});
|
|
7394
7651
|
var SetAdministrativeAreaPayload = z43.object({
|
|
7395
7652
|
id: UUID,
|
|
7396
7653
|
name: z43.string(),
|
|
7397
7654
|
externalId: z43.string().nullish(),
|
|
7398
|
-
parentId: UUID.nullable()
|
|
7655
|
+
parentId: UUID.nullable(),
|
|
7656
|
+
versions: SeededLocationVersions.optional()
|
|
7399
7657
|
});
|
|
7400
7658
|
|
|
7401
|
-
// ../commons/src/events/scopes.ts
|
|
7402
|
-
var ACTION_SCOPE_MAP = {
|
|
7403
|
-
[ActionType.READ]: ["record.read"],
|
|
7404
|
-
[ActionType.CREATE]: ["record.create"],
|
|
7405
|
-
[ActionType.NOTIFY]: ["record.notify"],
|
|
7406
|
-
[ActionType.DECLARE]: ["record.declare", "record.register"],
|
|
7407
|
-
[ActionType.EDIT]: ["record.edit"],
|
|
7408
|
-
[ActionType.DELETE]: ["record.declare", "record.notify"],
|
|
7409
|
-
[ActionType.REGISTER]: ["record.register"],
|
|
7410
|
-
[ActionType.PRINT_CERTIFICATE]: ["record.print-certified-copies"],
|
|
7411
|
-
[ActionType.REQUEST_CORRECTION]: [
|
|
7412
|
-
"record.request-correction",
|
|
7413
|
-
"record.correct"
|
|
7414
|
-
],
|
|
7415
|
-
[ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: ["record.correct"],
|
|
7416
|
-
[ActionType.REJECT_CORRECTION]: ["record.correct"],
|
|
7417
|
-
[ActionType.APPROVE_CORRECTION]: ["record.correct"],
|
|
7418
|
-
[ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
|
|
7419
|
-
[ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
|
|
7420
|
-
[ActionType.ARCHIVE]: ["record.archive"],
|
|
7421
|
-
[ActionType.UNARCHIVE]: ["record.unarchive"],
|
|
7422
|
-
[ActionType.REJECT]: ["record.reject"],
|
|
7423
|
-
[ActionType.ASSIGN]: null,
|
|
7424
|
-
[ActionType.UNASSIGN]: null,
|
|
7425
|
-
[ActionType.DUPLICATE_DETECTED]: [],
|
|
7426
|
-
[ActionType.CUSTOM]: []
|
|
7427
|
-
};
|
|
7428
|
-
|
|
7429
|
-
// ../commons/src/events/state/availableActions.ts
|
|
7430
|
-
var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
7431
|
-
[EventStatus.enum.CREATED]: [
|
|
7432
|
-
ActionType.READ,
|
|
7433
|
-
ActionType.DECLARE,
|
|
7434
|
-
ActionType.NOTIFY,
|
|
7435
|
-
ActionType.DELETE,
|
|
7436
|
-
ActionType.CUSTOM
|
|
7437
|
-
],
|
|
7438
|
-
[EventStatus.enum.NOTIFIED]: [
|
|
7439
|
-
ActionType.READ,
|
|
7440
|
-
ActionType.EDIT,
|
|
7441
|
-
ActionType.MARK_AS_DUPLICATE,
|
|
7442
|
-
ActionType.ARCHIVE,
|
|
7443
|
-
ActionType.REJECT,
|
|
7444
|
-
ActionType.CUSTOM
|
|
7445
|
-
],
|
|
7446
|
-
[EventStatus.enum.DECLARED]: [
|
|
7447
|
-
ActionType.READ,
|
|
7448
|
-
ActionType.REGISTER,
|
|
7449
|
-
ActionType.MARK_AS_DUPLICATE,
|
|
7450
|
-
ActionType.ARCHIVE,
|
|
7451
|
-
ActionType.REJECT,
|
|
7452
|
-
ActionType.CUSTOM,
|
|
7453
|
-
ActionType.EDIT
|
|
7454
|
-
],
|
|
7455
|
-
[EventStatus.enum.REGISTERED]: [
|
|
7456
|
-
ActionType.READ,
|
|
7457
|
-
ActionType.PRINT_CERTIFICATE,
|
|
7458
|
-
ActionType.REQUEST_CORRECTION,
|
|
7459
|
-
ActionType.APPROVE_CORRECTION,
|
|
7460
|
-
ActionType.REJECT_CORRECTION,
|
|
7461
|
-
ActionType.CUSTOM,
|
|
7462
|
-
ClientSpecificAction.REVIEW_CORRECTION_REQUEST
|
|
7463
|
-
],
|
|
7464
|
-
[EventStatus.enum.ARCHIVED]: [
|
|
7465
|
-
ActionType.READ,
|
|
7466
|
-
ActionType.CUSTOM,
|
|
7467
|
-
ActionType.UNARCHIVE
|
|
7468
|
-
]
|
|
7469
|
-
};
|
|
7470
|
-
var ACTION_FILTERS = {
|
|
7471
|
-
[ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
7472
|
-
[ActionType.REQUEST_CORRECTION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
7473
|
-
[ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
7474
|
-
[ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
7475
|
-
[ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
7476
|
-
[ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
7477
|
-
[ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
7478
|
-
[ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
7479
|
-
[ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
7480
|
-
[ActionType.ARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
|
|
7481
|
-
[ActionType.UNARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
|
|
7482
|
-
[ActionType.ASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
|
|
7483
|
-
[ActionType.UNASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
|
|
7484
|
-
[ActionType.CUSTOM]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))
|
|
7485
|
-
};
|
|
7486
|
-
var REJECTED_ACTIONS = [
|
|
7487
|
-
ActionType.READ,
|
|
7488
|
-
ActionType.NOTIFY,
|
|
7489
|
-
ActionType.CUSTOM,
|
|
7490
|
-
ActionType.EDIT,
|
|
7491
|
-
ActionType.ARCHIVE
|
|
7492
|
-
];
|
|
7493
|
-
|
|
7494
|
-
// ../commons/src/events/FileUtils.ts
|
|
7495
|
-
var import_lodash7 = require("lodash");
|
|
7496
|
-
|
|
7497
7659
|
// ../commons/src/events/mocks.test.utils.ts
|
|
7498
7660
|
function withVersionFields(entity) {
|
|
7499
7661
|
return {
|
|
@@ -7826,90 +7988,343 @@ var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
|
|
|
7826
7988
|
var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
|
|
7827
7989
|
V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
|
|
7828
7990
|
);
|
|
7991
|
+
var V2_DEFAULT_MOCK_CLIENT_LOCATIONS_MAP = new Map(
|
|
7992
|
+
V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, toClientLocation(l)])
|
|
7993
|
+
);
|
|
7994
|
+
var V2_DEFAULT_MOCK_CLIENT_ADMINISTRATIVE_AREAS_MAP = new Map(
|
|
7995
|
+
V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [
|
|
7996
|
+
a.id,
|
|
7997
|
+
toClientAdministrativeArea(a)
|
|
7998
|
+
])
|
|
7999
|
+
);
|
|
8000
|
+
|
|
8001
|
+
// ../commons/src/events/test.utils.ts
|
|
8002
|
+
var TestUserRole = z44.enum([
|
|
8003
|
+
"FIELD_AGENT",
|
|
8004
|
+
"LOCAL_REGISTRAR",
|
|
8005
|
+
"LOCAL_SYSTEM_ADMIN",
|
|
8006
|
+
"NATIONAL_REGISTRAR",
|
|
8007
|
+
"REGISTRATION_AGENT",
|
|
8008
|
+
"NATIONAL_SYSTEM_ADMIN",
|
|
8009
|
+
"SOCIAL_WORKER",
|
|
8010
|
+
"COMMUNITY_LEADER",
|
|
8011
|
+
"PROVINCIAL_REGISTRAR"
|
|
8012
|
+
]);
|
|
8013
|
+
|
|
8014
|
+
// ../commons/src/events/scopes.ts
|
|
8015
|
+
var import_lodash6 = require("lodash");
|
|
8016
|
+
var ACTION_SCOPE_MAP = {
|
|
8017
|
+
[ActionType.READ]: ["record.read"],
|
|
8018
|
+
[ActionType.CREATE]: ["record.create"],
|
|
8019
|
+
[ActionType.NOTIFY]: ["record.notify"],
|
|
8020
|
+
[ActionType.DECLARE]: ["record.declare", "record.register"],
|
|
8021
|
+
[ActionType.EDIT]: ["record.edit"],
|
|
8022
|
+
[ActionType.DELETE]: ["record.declare", "record.notify"],
|
|
8023
|
+
[ActionType.REGISTER]: ["record.register"],
|
|
8024
|
+
[ActionType.PRINT_CERTIFICATE]: ["record.print-certified-copies"],
|
|
8025
|
+
[ActionType.REQUEST_CORRECTION]: [
|
|
8026
|
+
"record.request-correction",
|
|
8027
|
+
"record.correct"
|
|
8028
|
+
],
|
|
8029
|
+
[ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: ["record.correct"],
|
|
8030
|
+
[ActionType.REJECT_CORRECTION]: ["record.correct"],
|
|
8031
|
+
[ActionType.APPROVE_CORRECTION]: ["record.correct"],
|
|
8032
|
+
[ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
|
|
8033
|
+
[ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
|
|
8034
|
+
[ActionType.ARCHIVE]: ["record.archive"],
|
|
8035
|
+
[ActionType.UNARCHIVE]: ["record.unarchive"],
|
|
8036
|
+
[ActionType.REJECT]: ["record.reject"],
|
|
8037
|
+
[ActionType.ASSIGN]: null,
|
|
8038
|
+
[ActionType.UNASSIGN]: null,
|
|
8039
|
+
[ActionType.DUPLICATE_DETECTED]: [],
|
|
8040
|
+
[ActionType.CUSTOM]: []
|
|
8041
|
+
};
|
|
8042
|
+
|
|
8043
|
+
// ../commons/src/events/state/availableActions.ts
|
|
8044
|
+
var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
8045
|
+
[EventStatus.enum.CREATED]: [
|
|
8046
|
+
ActionType.READ,
|
|
8047
|
+
ActionType.DECLARE,
|
|
8048
|
+
ActionType.NOTIFY,
|
|
8049
|
+
ActionType.DELETE
|
|
8050
|
+
],
|
|
8051
|
+
[EventStatus.enum.NOTIFIED]: [
|
|
8052
|
+
ActionType.READ,
|
|
8053
|
+
ActionType.EDIT,
|
|
8054
|
+
ActionType.MARK_AS_DUPLICATE,
|
|
8055
|
+
ActionType.ARCHIVE,
|
|
8056
|
+
ActionType.REJECT,
|
|
8057
|
+
ActionType.CUSTOM
|
|
8058
|
+
],
|
|
8059
|
+
[EventStatus.enum.DECLARED]: [
|
|
8060
|
+
ActionType.READ,
|
|
8061
|
+
ActionType.REGISTER,
|
|
8062
|
+
ActionType.MARK_AS_DUPLICATE,
|
|
8063
|
+
ActionType.ARCHIVE,
|
|
8064
|
+
ActionType.REJECT,
|
|
8065
|
+
ActionType.CUSTOM,
|
|
8066
|
+
ActionType.EDIT
|
|
8067
|
+
],
|
|
8068
|
+
[EventStatus.enum.REGISTERED]: [
|
|
8069
|
+
ActionType.READ,
|
|
8070
|
+
ActionType.PRINT_CERTIFICATE,
|
|
8071
|
+
ActionType.REQUEST_CORRECTION,
|
|
8072
|
+
ActionType.APPROVE_CORRECTION,
|
|
8073
|
+
ActionType.REJECT_CORRECTION,
|
|
8074
|
+
ActionType.CUSTOM,
|
|
8075
|
+
ClientSpecificAction.REVIEW_CORRECTION_REQUEST
|
|
8076
|
+
],
|
|
8077
|
+
[EventStatus.enum.ARCHIVED]: [
|
|
8078
|
+
ActionType.READ,
|
|
8079
|
+
ActionType.CUSTOM,
|
|
8080
|
+
ActionType.UNARCHIVE
|
|
8081
|
+
]
|
|
8082
|
+
};
|
|
8083
|
+
var ACTION_FILTERS = {
|
|
8084
|
+
[ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8085
|
+
[ActionType.REQUEST_CORRECTION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8086
|
+
[ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8087
|
+
[ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8088
|
+
[ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8089
|
+
[ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8090
|
+
[ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8091
|
+
[ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8092
|
+
[ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8093
|
+
[ActionType.ARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8094
|
+
[ActionType.UNARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8095
|
+
[ActionType.ASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8096
|
+
[ActionType.UNASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8097
|
+
[ActionType.CUSTOM]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested"))
|
|
8098
|
+
};
|
|
8099
|
+
var REJECTED_ACTIONS = [
|
|
8100
|
+
ActionType.READ,
|
|
8101
|
+
ActionType.NOTIFY,
|
|
8102
|
+
ActionType.CUSTOM,
|
|
8103
|
+
ActionType.EDIT,
|
|
8104
|
+
ActionType.ARCHIVE
|
|
8105
|
+
];
|
|
8106
|
+
|
|
8107
|
+
// ../commons/src/events/FileUtils.ts
|
|
8108
|
+
var import_lodash7 = require("lodash");
|
|
8109
|
+
|
|
8110
|
+
// ../commons/src/events/locationPayloads.ts
|
|
8111
|
+
var z45 = __toESM(require("zod/v4"));
|
|
8112
|
+
var CreateLocationPayload = z45.object({
|
|
8113
|
+
id: UUID.optional(),
|
|
8114
|
+
versionId: UUID.optional(),
|
|
8115
|
+
name: z45.string(),
|
|
8116
|
+
externalId: z45.string().nullish(),
|
|
8117
|
+
administrativeAreaId: UUID.nullable(),
|
|
8118
|
+
locationType: z45.string().nullable(),
|
|
8119
|
+
effectiveFrom: z45.iso.date().optional(),
|
|
8120
|
+
status: LocationStatus.default("active")
|
|
8121
|
+
});
|
|
8122
|
+
var UpdateLocationPayload = z45.strictObject({
|
|
8123
|
+
id: UUID,
|
|
8124
|
+
versionId: UUID.optional(),
|
|
8125
|
+
name: z45.string(),
|
|
8126
|
+
externalId: z45.string().nullish(),
|
|
8127
|
+
status: LocationStatus,
|
|
8128
|
+
effectiveFrom: z45.iso.date().optional(),
|
|
8129
|
+
lastVersionId: UUID
|
|
8130
|
+
});
|
|
8131
|
+
var WithdrawLocationVersionPayload = z45.object({
|
|
8132
|
+
id: UUID,
|
|
8133
|
+
versionId: UUID
|
|
8134
|
+
});
|
|
8135
|
+
var CreateAdministrativeAreaPayload = z45.object({
|
|
8136
|
+
id: UUID.optional(),
|
|
8137
|
+
versionId: UUID.optional(),
|
|
8138
|
+
name: z45.string(),
|
|
8139
|
+
externalId: z45.string().nullish(),
|
|
8140
|
+
parentId: UUID.nullable(),
|
|
8141
|
+
effectiveFrom: z45.iso.date().optional(),
|
|
8142
|
+
status: LocationStatus.default("active")
|
|
8143
|
+
});
|
|
8144
|
+
var UpdateAdministrativeAreaPayload = z45.strictObject({
|
|
8145
|
+
id: UUID,
|
|
8146
|
+
versionId: UUID.optional(),
|
|
8147
|
+
name: z45.string(),
|
|
8148
|
+
externalId: z45.string().nullish(),
|
|
8149
|
+
status: LocationStatus,
|
|
8150
|
+
effectiveFrom: z45.iso.date().optional(),
|
|
8151
|
+
lastVersionId: UUID
|
|
8152
|
+
});
|
|
8153
|
+
var WithdrawAdministrativeAreaVersionPayload = z45.object({
|
|
8154
|
+
id: UUID,
|
|
8155
|
+
versionId: UUID
|
|
8156
|
+
});
|
|
7829
8157
|
|
|
7830
8158
|
// ../commons/src/notification/UserNotifications.ts
|
|
7831
|
-
var
|
|
8159
|
+
var z46 = __toESM(require("zod/v4"));
|
|
7832
8160
|
var TriggerEvent = {
|
|
7833
8161
|
USER_CREATED: "user-created",
|
|
7834
8162
|
USER_UPDATED: "user-updated",
|
|
7835
8163
|
USERNAME_REMINDER: "username-reminder",
|
|
7836
8164
|
RESET_PASSWORD: "reset-password",
|
|
7837
8165
|
RESET_PASSWORD_BY_ADMIN: "reset-password-by-admin",
|
|
8166
|
+
PASSWORD_RESET_LINK: "password-reset-link",
|
|
8167
|
+
USERNAME_REMINDER_LINK: "username-reminder-link",
|
|
7838
8168
|
RESEND_INVITE: "resend-invite",
|
|
7839
8169
|
TWO_FA: "2fa",
|
|
7840
8170
|
ALL_USER_NOTIFICATION: "all-user-notification",
|
|
7841
8171
|
CHANGE_PHONE_NUMBER: "change-phone-number",
|
|
7842
8172
|
CHANGE_EMAIL_ADDRESS: "change-email-address"
|
|
7843
8173
|
};
|
|
7844
|
-
var Recipient =
|
|
8174
|
+
var Recipient = z46.object({
|
|
7845
8175
|
name: NameFieldValue.optional(),
|
|
7846
|
-
mobile:
|
|
7847
|
-
email:
|
|
7848
|
-
bcc:
|
|
8176
|
+
mobile: z46.string().optional(),
|
|
8177
|
+
email: z46.string().optional(),
|
|
8178
|
+
bcc: z46.array(z46.string()).optional()
|
|
7849
8179
|
});
|
|
7850
|
-
var BasePayload =
|
|
8180
|
+
var BasePayload = z46.object({
|
|
7851
8181
|
recipient: Recipient
|
|
7852
8182
|
});
|
|
7853
8183
|
var TriggerPayload = {
|
|
7854
8184
|
[TriggerEvent.USER_CREATED]: BasePayload.extend({
|
|
7855
|
-
username:
|
|
7856
|
-
temporaryPassword:
|
|
8185
|
+
username: z46.string(),
|
|
8186
|
+
temporaryPassword: z46.string()
|
|
7857
8187
|
}),
|
|
7858
8188
|
[TriggerEvent.USER_UPDATED]: BasePayload.extend({
|
|
7859
|
-
oldUsername:
|
|
7860
|
-
newUsername:
|
|
8189
|
+
oldUsername: z46.string(),
|
|
8190
|
+
newUsername: z46.string()
|
|
7861
8191
|
}),
|
|
7862
8192
|
[TriggerEvent.USERNAME_REMINDER]: BasePayload.extend({
|
|
7863
|
-
username:
|
|
8193
|
+
username: z46.string()
|
|
7864
8194
|
}),
|
|
7865
8195
|
[TriggerEvent.RESET_PASSWORD]: BasePayload.extend({
|
|
7866
|
-
code:
|
|
8196
|
+
code: z46.string()
|
|
7867
8197
|
}),
|
|
7868
8198
|
[TriggerEvent.RESET_PASSWORD_BY_ADMIN]: BasePayload.extend({
|
|
7869
|
-
temporaryPassword:
|
|
7870
|
-
admin:
|
|
7871
|
-
id:
|
|
8199
|
+
temporaryPassword: z46.string(),
|
|
8200
|
+
admin: z46.object({
|
|
8201
|
+
id: z46.string(),
|
|
7872
8202
|
name: NameFieldValue,
|
|
7873
|
-
role:
|
|
8203
|
+
role: z46.string()
|
|
7874
8204
|
})
|
|
7875
8205
|
}),
|
|
8206
|
+
[TriggerEvent.PASSWORD_RESET_LINK]: BasePayload.extend({
|
|
8207
|
+
token: z46.string()
|
|
8208
|
+
}),
|
|
8209
|
+
[TriggerEvent.USERNAME_REMINDER_LINK]: BasePayload.extend({
|
|
8210
|
+
token: z46.string()
|
|
8211
|
+
}),
|
|
7876
8212
|
[TriggerEvent.RESEND_INVITE]: BasePayload.extend({
|
|
7877
|
-
username:
|
|
7878
|
-
temporaryPassword:
|
|
8213
|
+
username: z46.string(),
|
|
8214
|
+
temporaryPassword: z46.string()
|
|
7879
8215
|
}),
|
|
7880
8216
|
[TriggerEvent.TWO_FA]: BasePayload.extend({
|
|
7881
|
-
code:
|
|
8217
|
+
code: z46.string()
|
|
7882
8218
|
}),
|
|
7883
8219
|
[TriggerEvent.ALL_USER_NOTIFICATION]: BasePayload.extend({
|
|
7884
|
-
subject:
|
|
7885
|
-
body:
|
|
8220
|
+
subject: z46.string(),
|
|
8221
|
+
body: z46.string()
|
|
7886
8222
|
}),
|
|
7887
8223
|
[TriggerEvent.CHANGE_PHONE_NUMBER]: BasePayload.extend({
|
|
7888
|
-
code:
|
|
8224
|
+
code: z46.string()
|
|
7889
8225
|
}),
|
|
7890
8226
|
[TriggerEvent.CHANGE_EMAIL_ADDRESS]: BasePayload.extend({
|
|
7891
|
-
code:
|
|
8227
|
+
code: z46.string()
|
|
7892
8228
|
})
|
|
7893
8229
|
};
|
|
8230
|
+
function parseUserEventTrigger(event2, body) {
|
|
8231
|
+
const schema = TriggerPayload[event2];
|
|
8232
|
+
return schema.parse(body);
|
|
8233
|
+
}
|
|
8234
|
+
|
|
8235
|
+
// ../commons/src/url.ts
|
|
8236
|
+
function joinUrl(base, path) {
|
|
8237
|
+
const baseWithSlash = base.endsWith("/") ? base : base + "/";
|
|
8238
|
+
return new URL(path, baseWithSlash);
|
|
8239
|
+
}
|
|
8240
|
+
|
|
8241
|
+
// ../commons/src/logger.ts
|
|
8242
|
+
var import_pino = __toESM(require("pino"));
|
|
8243
|
+
function normalizeLogArgs(args) {
|
|
8244
|
+
const [first, ...rest] = args;
|
|
8245
|
+
if (typeof first !== "string" || rest.length === 0) {
|
|
8246
|
+
return args;
|
|
8247
|
+
}
|
|
8248
|
+
const mergingObject = {};
|
|
8249
|
+
const primitives = [];
|
|
8250
|
+
for (const arg of rest) {
|
|
8251
|
+
if (arg instanceof Error) {
|
|
8252
|
+
mergingObject.err = import_pino.default.stdSerializers.err(arg);
|
|
8253
|
+
} else if (arg !== null && typeof arg === "object") {
|
|
8254
|
+
Object.assign(mergingObject, arg);
|
|
8255
|
+
} else {
|
|
8256
|
+
primitives.push(arg);
|
|
8257
|
+
}
|
|
8258
|
+
}
|
|
8259
|
+
const message = primitives.length ? `${first} ${primitives.join(" ")}` : first;
|
|
8260
|
+
return Object.keys(mergingObject).length ? [mergingObject, message] : [message];
|
|
8261
|
+
}
|
|
8262
|
+
function filterHealthCheckLogs(args, method) {
|
|
8263
|
+
const logger2 = this;
|
|
8264
|
+
for (const arg of args) {
|
|
8265
|
+
if (typeof arg === "string" && arg.includes("get /ping 200")) {
|
|
8266
|
+
if (logger2.debug) {
|
|
8267
|
+
return logger2.debug(...args);
|
|
8268
|
+
}
|
|
8269
|
+
}
|
|
8270
|
+
}
|
|
8271
|
+
return method.apply(this, normalizeLogArgs(args));
|
|
8272
|
+
}
|
|
8273
|
+
function buildLoggerOptions() {
|
|
8274
|
+
return {
|
|
8275
|
+
serializers: { err: import_pino.default.stdSerializers.err },
|
|
8276
|
+
hooks: { logMethod: filterHealthCheckLogs }
|
|
8277
|
+
};
|
|
8278
|
+
}
|
|
8279
|
+
var logger = false ? (0, import_pino.default)({
|
|
8280
|
+
level: "info",
|
|
8281
|
+
redact: [
|
|
8282
|
+
"req.headers.authorization",
|
|
8283
|
+
"req.remoteAddress",
|
|
8284
|
+
"req.headers['x-real-ip']"
|
|
8285
|
+
],
|
|
8286
|
+
...buildLoggerOptions()
|
|
8287
|
+
}) : (0, import_pino.default)({
|
|
8288
|
+
level: "debug",
|
|
8289
|
+
transport: {
|
|
8290
|
+
target: "pino-pretty",
|
|
8291
|
+
options: {
|
|
8292
|
+
colorize: true,
|
|
8293
|
+
ignore: "pid,hostname"
|
|
8294
|
+
}
|
|
8295
|
+
},
|
|
8296
|
+
...buildLoggerOptions()
|
|
8297
|
+
});
|
|
8298
|
+
var level = false ? "silent" : process.env.LOG_LEVEL;
|
|
8299
|
+
if (level) {
|
|
8300
|
+
logger.level = level;
|
|
8301
|
+
}
|
|
8302
|
+
|
|
8303
|
+
// ../commons/src/notification/dispatch.ts
|
|
7894
8304
|
async function triggerUserEventNotification({
|
|
7895
8305
|
event: event2,
|
|
7896
8306
|
payload,
|
|
7897
8307
|
countryConfigUrl,
|
|
7898
8308
|
authHeader
|
|
7899
8309
|
}) {
|
|
7900
|
-
|
|
7901
|
-
|
|
7902
|
-
|
|
7903
|
-
|
|
7904
|
-
|
|
7905
|
-
|
|
8310
|
+
const response = await fetch(
|
|
8311
|
+
joinUrl(countryConfigUrl, `triggers/user/${event2}`),
|
|
8312
|
+
{
|
|
8313
|
+
method: "POST",
|
|
8314
|
+
body: JSON.stringify(payload),
|
|
8315
|
+
headers: {
|
|
8316
|
+
"Content-Type": "application/json",
|
|
8317
|
+
...authHeader
|
|
8318
|
+
}
|
|
7906
8319
|
}
|
|
7907
|
-
|
|
7908
|
-
|
|
7909
|
-
|
|
7910
|
-
|
|
7911
|
-
|
|
8320
|
+
);
|
|
8321
|
+
if (!response.ok) {
|
|
8322
|
+
logger.error(
|
|
8323
|
+
`triggerUserEventNotification: dispatch failed for event "${event2}" with status ${response.status}`
|
|
8324
|
+
);
|
|
8325
|
+
}
|
|
8326
|
+
return response;
|
|
7912
8327
|
}
|
|
7913
8328
|
|
|
7914
8329
|
// src/notification/index.ts
|
|
7915
|
-
|
|
8330
|
+
z47.globalRegistry.clear();
|