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