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