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