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