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