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