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