@opencrvs/toolkit 2.1.0-rc.d04f6c3 → 2.1.0-rc.d078d1a
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/dist/application-config/index.js +200 -189
- package/dist/commons/api/router.d.ts +3350 -3246
- package/dist/commons/application-config/index.d.ts +6 -6
- package/dist/commons/conditionals/conditionals.d.ts +259 -2102
- package/dist/commons/conditionals/validate.d.ts +10 -1
- package/dist/commons/events/ActionConfig.d.ts +105 -105
- package/dist/commons/events/ActionDocument.d.ts +111 -117
- package/dist/commons/events/ActionStatus.d.ts +14 -0
- package/dist/commons/events/ActionType.d.ts +62 -62
- package/dist/commons/events/AdvancedSearchConfig.d.ts +519 -507
- package/dist/commons/events/AuditLog.d.ts +79 -42
- package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
- package/dist/commons/events/Conditional.d.ts +3 -3
- package/dist/commons/events/CountryConfigQueryInput.d.ts +590 -590
- package/dist/commons/events/Draft.d.ts +37 -37
- package/dist/commons/events/DynamicFieldValue.d.ts +9 -9
- package/dist/commons/events/EventConfig.d.ts +8 -5
- package/dist/commons/events/EventDocument.d.ts +46 -46
- package/dist/commons/events/EventIndex.d.ts +48 -71
- package/dist/commons/events/EventMetadata.d.ts +40 -40
- package/dist/commons/events/FieldConfig.d.ts +346 -336
- package/dist/commons/events/FieldType.d.ts +51 -51
- package/dist/commons/events/FieldTypeMapping.d.ts +91 -91
- package/dist/commons/events/FieldValue.d.ts +12 -12
- package/dist/commons/events/Flag.d.ts +57 -15
- package/dist/commons/events/TemplateConfig.d.ts +1 -1
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +40 -40
- package/dist/commons/events/WorkqueueConfig.d.ts +817 -814
- package/dist/commons/events/deduplication.d.ts +1 -1
- package/dist/commons/events/event.d.ts +14 -2
- package/dist/commons/events/field.d.ts +78 -895
- package/dist/commons/events/index.d.ts +1 -0
- package/dist/commons/events/locationPayloads.d.ts +95 -0
- package/dist/commons/events/locations.d.ts +103 -6
- package/dist/commons/events/mocks.test.utils.d.ts +18 -4
- package/dist/commons/events/scopes.d.ts +4 -4
- package/dist/commons/events/state/index.d.ts +17 -17
- package/dist/commons/events/state/utils.d.ts +7 -7
- package/dist/commons/events/test.utils.d.ts +40 -40
- package/dist/commons/events/utils.d.ts +114 -114
- package/dist/commons/notification/UserNotifications.d.ts +10 -10
- package/dist/conditionals/index.js +303 -55
- package/dist/environment/derived-variables.d.ts +119 -119
- package/dist/environment/derived-variables.d.ts.map +1 -1
- package/dist/environment/logger.d.ts.map +1 -1
- package/dist/environment/questions.d.ts +75 -74
- package/dist/environment/questions.d.ts.map +1 -1
- package/dist/environment/setup-environment.js +8 -14
- package/dist/environment/utils.d.ts +1 -1
- package/dist/events/deduplication.d.ts +1 -1
- package/dist/events/index.js +3463 -3297
- package/dist/migrations/v2.0/migrate-application-config-url.js +4 -3
- package/dist/notification/index.js +1709 -1039
- package/dist/scopes/index.d.ts +371 -146
- package/dist/scopes/index.js +304 -55
- package/opencrvs-toolkit-2.1.0-rc.d078d1a.tgz +0 -0
- package/package.json +5 -5
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.1.0-rc.d04f6c3.tgz +0 -0
|
@@ -38,7 +38,7 @@ __export(notification_exports, {
|
|
|
38
38
|
triggerUserEventNotification: () => triggerUserEventNotification
|
|
39
39
|
});
|
|
40
40
|
module.exports = __toCommonJS(notification_exports);
|
|
41
|
-
var
|
|
41
|
+
var z46 = __toESM(require("zod/v4"));
|
|
42
42
|
|
|
43
43
|
// ../commons/src/url.ts
|
|
44
44
|
function joinUrl(base, path) {
|
|
@@ -47,14 +47,14 @@ function joinUrl(base, path) {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
// ../commons/src/events/AuditLog.ts
|
|
50
|
-
var
|
|
50
|
+
var z8 = __toESM(require("zod/v4"));
|
|
51
51
|
|
|
52
52
|
// ../commons/src/authentication.ts
|
|
53
53
|
var import_jwt_decode = __toESM(require("jwt-decode"));
|
|
54
|
-
var
|
|
54
|
+
var z7 = __toESM(require("zod/v4"));
|
|
55
55
|
|
|
56
56
|
// ../commons/src/scopes.ts
|
|
57
|
-
var
|
|
57
|
+
var z6 = __toESM(require("zod/v4"));
|
|
58
58
|
var qs = __toESM(require("qs"));
|
|
59
59
|
|
|
60
60
|
// ../commons/src/uuid.ts
|
|
@@ -65,12 +65,263 @@ function getUUID() {
|
|
|
65
65
|
return (0, import_uuid.v4)();
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
// ../commons/src/events/ActionType.ts
|
|
69
|
+
var z2 = __toESM(require("zod/v4"));
|
|
70
|
+
var ActionType = {
|
|
71
|
+
// Pre-declaration actions
|
|
72
|
+
DELETE: "DELETE",
|
|
73
|
+
CREATE: "CREATE",
|
|
74
|
+
NOTIFY: "NOTIFY",
|
|
75
|
+
// Declaration actions
|
|
76
|
+
DECLARE: "DECLARE",
|
|
77
|
+
REGISTER: "REGISTER",
|
|
78
|
+
EDIT: "EDIT",
|
|
79
|
+
// Declaration system actions. Non-configurable.
|
|
80
|
+
DUPLICATE_DETECTED: "DUPLICATE_DETECTED",
|
|
81
|
+
REJECT: "REJECT",
|
|
82
|
+
// REJECT_DECLARATION
|
|
83
|
+
MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
|
|
84
|
+
MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
|
|
85
|
+
ARCHIVE: "ARCHIVE",
|
|
86
|
+
UNARCHIVE: "UNARCHIVE",
|
|
87
|
+
// Record actions
|
|
88
|
+
PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
|
|
89
|
+
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
|
90
|
+
REJECT_CORRECTION: "REJECT_CORRECTION",
|
|
91
|
+
APPROVE_CORRECTION: "APPROVE_CORRECTION",
|
|
92
|
+
// General actions
|
|
93
|
+
READ: "READ",
|
|
94
|
+
ASSIGN: "ASSIGN",
|
|
95
|
+
UNASSIGN: "UNASSIGN",
|
|
96
|
+
// Custom action
|
|
97
|
+
CUSTOM: "CUSTOM"
|
|
98
|
+
};
|
|
99
|
+
var ConfirmableActions = [
|
|
100
|
+
ActionType.NOTIFY,
|
|
101
|
+
ActionType.DECLARE,
|
|
102
|
+
ActionType.EDIT,
|
|
103
|
+
ActionType.REGISTER,
|
|
104
|
+
ActionType.REJECT,
|
|
105
|
+
ActionType.ARCHIVE,
|
|
106
|
+
ActionType.UNARCHIVE,
|
|
107
|
+
ActionType.PRINT_CERTIFICATE,
|
|
108
|
+
ActionType.REQUEST_CORRECTION,
|
|
109
|
+
ActionType.APPROVE_CORRECTION,
|
|
110
|
+
ActionType.REJECT_CORRECTION,
|
|
111
|
+
ActionType.CUSTOM
|
|
112
|
+
];
|
|
113
|
+
var ActionTypes = z2.enum([
|
|
114
|
+
"DELETE",
|
|
115
|
+
"CREATE",
|
|
116
|
+
"NOTIFY",
|
|
117
|
+
"DECLARE",
|
|
118
|
+
"EDIT",
|
|
119
|
+
"REGISTER",
|
|
120
|
+
"DUPLICATE_DETECTED",
|
|
121
|
+
"REJECT",
|
|
122
|
+
"MARK_AS_DUPLICATE",
|
|
123
|
+
"MARK_AS_NOT_DUPLICATE",
|
|
124
|
+
"ARCHIVE",
|
|
125
|
+
"UNARCHIVE",
|
|
126
|
+
"PRINT_CERTIFICATE",
|
|
127
|
+
"REQUEST_CORRECTION",
|
|
128
|
+
"REJECT_CORRECTION",
|
|
129
|
+
"APPROVE_CORRECTION",
|
|
130
|
+
"READ",
|
|
131
|
+
"ASSIGN",
|
|
132
|
+
"UNASSIGN",
|
|
133
|
+
"CUSTOM"
|
|
134
|
+
]);
|
|
135
|
+
var ClientSpecificAction = {
|
|
136
|
+
REVIEW_CORRECTION_REQUEST: "REVIEW_CORRECTION_REQUEST"
|
|
137
|
+
};
|
|
138
|
+
var declarationActionValues = [
|
|
139
|
+
ActionTypes.enum.DECLARE,
|
|
140
|
+
ActionTypes.enum.EDIT,
|
|
141
|
+
ActionTypes.enum.REGISTER,
|
|
142
|
+
ActionTypes.enum.NOTIFY,
|
|
143
|
+
ActionTypes.enum.DUPLICATE_DETECTED
|
|
144
|
+
];
|
|
145
|
+
var DeclarationActions = ActionTypes.extract(declarationActionValues);
|
|
146
|
+
var declarationUpdateActionValues = [
|
|
147
|
+
...declarationActionValues,
|
|
148
|
+
ActionTypes.enum.REQUEST_CORRECTION
|
|
149
|
+
];
|
|
150
|
+
var DeclarationUpdateActions = ActionTypes.extract(
|
|
151
|
+
declarationUpdateActionValues
|
|
152
|
+
);
|
|
153
|
+
var annotationActions = ActionTypes.exclude(declarationActionValues);
|
|
154
|
+
var writeActions = ActionTypes.exclude([
|
|
155
|
+
ActionType.CREATE,
|
|
156
|
+
ActionType.READ,
|
|
157
|
+
ActionType.ASSIGN,
|
|
158
|
+
ActionType.UNASSIGN
|
|
159
|
+
]);
|
|
160
|
+
var WorkqueueActionType = ActionTypes.extract([
|
|
161
|
+
ActionType.READ,
|
|
162
|
+
ActionType.DELETE,
|
|
163
|
+
ActionType.DECLARE,
|
|
164
|
+
ActionType.REGISTER,
|
|
165
|
+
ActionType.EDIT,
|
|
166
|
+
ActionType.REJECT,
|
|
167
|
+
ActionType.MARK_AS_DUPLICATE,
|
|
168
|
+
ActionType.ARCHIVE,
|
|
169
|
+
ActionType.UNARCHIVE,
|
|
170
|
+
ActionType.PRINT_CERTIFICATE,
|
|
171
|
+
ActionType.REQUEST_CORRECTION
|
|
172
|
+
]);
|
|
173
|
+
var META_ACTIONS = [
|
|
174
|
+
ActionType.ASSIGN,
|
|
175
|
+
ActionType.UNASSIGN,
|
|
176
|
+
ActionType.READ
|
|
177
|
+
];
|
|
178
|
+
function isMetaAction(actionType) {
|
|
179
|
+
return META_ACTIONS.includes(actionType);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// ../commons/src/events/ActionStatus.ts
|
|
183
|
+
var ActionStatus = {
|
|
184
|
+
Requested: "Requested",
|
|
185
|
+
Accepted: "Accepted",
|
|
186
|
+
Rejected: "Rejected"
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
// ../commons/src/events/Flag.ts
|
|
190
|
+
var z5 = __toESM(require("zod/v4"));
|
|
191
|
+
|
|
192
|
+
// ../commons/src/events/TranslationConfig.ts
|
|
193
|
+
var z3 = __toESM(require("zod/v4"));
|
|
194
|
+
var TranslationConfig = z3.object({
|
|
195
|
+
id: z3.string().describe(
|
|
196
|
+
"The identifier of the translation referred in translation CSV files"
|
|
197
|
+
),
|
|
198
|
+
defaultMessage: z3.string().describe("Default translation message"),
|
|
199
|
+
description: z3.string().describe(
|
|
200
|
+
"Describe the translation for a translator to be able to identify it."
|
|
201
|
+
)
|
|
202
|
+
}).meta({
|
|
203
|
+
description: "Translation configuration",
|
|
204
|
+
id: "TranslationConfig"
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
// ../commons/src/events/Conditional.ts
|
|
208
|
+
var z4 = __toESM(require("zod/v4"));
|
|
209
|
+
var Conditional = z4.any().describe("JSONSchema").meta({
|
|
210
|
+
description: "JSON schema conditional configuration",
|
|
211
|
+
id: "Conditional"
|
|
212
|
+
});
|
|
213
|
+
var ConditionalType = {
|
|
214
|
+
SHOW: "SHOW",
|
|
215
|
+
ENABLE: "ENABLE",
|
|
216
|
+
DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
|
|
217
|
+
};
|
|
218
|
+
var ShowConditional = z4.object({
|
|
219
|
+
type: z4.literal(ConditionalType.SHOW),
|
|
220
|
+
conditional: Conditional
|
|
221
|
+
}).describe(
|
|
222
|
+
"If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
|
|
223
|
+
);
|
|
224
|
+
var EnableConditional = z4.object({
|
|
225
|
+
type: z4.literal(ConditionalType.ENABLE),
|
|
226
|
+
conditional: Conditional
|
|
227
|
+
}).describe(
|
|
228
|
+
"If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
|
|
229
|
+
);
|
|
230
|
+
var ActionConditional = z4.discriminatedUnion("type", [
|
|
231
|
+
// Action can be shown / hidden
|
|
232
|
+
ShowConditional,
|
|
233
|
+
// Action can be shown to the user in the list but as disabled
|
|
234
|
+
EnableConditional
|
|
235
|
+
]).meta({
|
|
236
|
+
id: "ActionConditional",
|
|
237
|
+
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."
|
|
238
|
+
});
|
|
239
|
+
var DisplayOnReviewConditional = z4.object({
|
|
240
|
+
type: z4.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
241
|
+
conditional: Conditional
|
|
242
|
+
}).describe(
|
|
243
|
+
"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."
|
|
244
|
+
);
|
|
245
|
+
var FieldConditional = z4.discriminatedUnion("type", [
|
|
246
|
+
// Field input can be shown / hidden
|
|
247
|
+
ShowConditional,
|
|
248
|
+
// Field input can be shown to the user but as disabled
|
|
249
|
+
EnableConditional,
|
|
250
|
+
// Field output can be shown / hidden on the review page
|
|
251
|
+
DisplayOnReviewConditional
|
|
252
|
+
]).meta({
|
|
253
|
+
id: "FieldConditional",
|
|
254
|
+
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."
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
// ../commons/src/events/Flag.ts
|
|
258
|
+
var InherentFlags = {
|
|
259
|
+
INCOMPLETE: "incomplete",
|
|
260
|
+
REJECTED: "rejected",
|
|
261
|
+
CORRECTION_REQUESTED: "correction-requested",
|
|
262
|
+
POTENTIAL_DUPLICATE: "potential-duplicate",
|
|
263
|
+
/**
|
|
264
|
+
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
265
|
+
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
266
|
+
*
|
|
267
|
+
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
268
|
+
*/
|
|
269
|
+
EDIT_IN_PROGRESS: "edit-in-progress"
|
|
270
|
+
};
|
|
271
|
+
var actionFlagPattern;
|
|
272
|
+
function getActionFlagPattern() {
|
|
273
|
+
actionFlagPattern ??= new RegExp(
|
|
274
|
+
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
275
|
+
ActionStatus
|
|
276
|
+
).join("|").toLowerCase()})$`
|
|
277
|
+
);
|
|
278
|
+
return actionFlagPattern;
|
|
279
|
+
}
|
|
280
|
+
var ActionFlag = z5.string().refine((value) => getActionFlagPattern().test(value), {
|
|
281
|
+
message: "Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
282
|
+
});
|
|
283
|
+
var CustomFlag = z5.string().refine((val) => !Object.values(InherentFlags).includes(val), {
|
|
284
|
+
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
285
|
+
InherentFlags
|
|
286
|
+
).join(", ")}`
|
|
287
|
+
}).refine((val) => !ActionFlag.safeParse(val).success, {
|
|
288
|
+
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
289
|
+
}).describe("Custom flag identifier defined by the country config.");
|
|
290
|
+
var Flag = ActionFlag.or(z5.enum(InherentFlags)).or(CustomFlag);
|
|
291
|
+
var ContainsFlags = z5.object({
|
|
292
|
+
anyOf: z5.array(Flag).optional(),
|
|
293
|
+
noneOf: z5.array(Flag).optional(),
|
|
294
|
+
allOf: z5.array(Flag).optional()
|
|
295
|
+
}).meta({
|
|
296
|
+
id: "ContainsFlags"
|
|
297
|
+
});
|
|
298
|
+
var FlagConfig = z5.object({
|
|
299
|
+
id: CustomFlag,
|
|
300
|
+
requiresAction: z5.boolean().describe(
|
|
301
|
+
"Indicates if this flag expects an action to be performed to be cleared."
|
|
302
|
+
),
|
|
303
|
+
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
304
|
+
}).meta({
|
|
305
|
+
id: "FlagConfig",
|
|
306
|
+
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
307
|
+
});
|
|
308
|
+
var ActionFlagConfig = z5.object({
|
|
309
|
+
id: Flag,
|
|
310
|
+
operation: z5.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
311
|
+
conditional: Conditional.optional().describe(
|
|
312
|
+
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
313
|
+
)
|
|
314
|
+
}).meta({
|
|
315
|
+
id: "ActionFlagConfig",
|
|
316
|
+
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
317
|
+
});
|
|
318
|
+
|
|
68
319
|
// ../commons/src/scopes.ts
|
|
69
|
-
var JurisdictionFilter =
|
|
320
|
+
var JurisdictionFilter = z6.enum(["administrativeArea", "location", "all"]).describe(
|
|
70
321
|
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
71
322
|
);
|
|
72
|
-
var UserFilter =
|
|
73
|
-
var RecordScopeTypeV2 =
|
|
323
|
+
var UserFilter = z6.enum(["user"]).describe("Filters based on the user. Limits to self.");
|
|
324
|
+
var RecordScopeTypeV2 = z6.enum([
|
|
74
325
|
"record.search",
|
|
75
326
|
"record.create",
|
|
76
327
|
"record.read",
|
|
@@ -88,7 +339,7 @@ var RecordScopeTypeV2 = z2.enum([
|
|
|
88
339
|
"record.unassign-others",
|
|
89
340
|
"record.custom-action"
|
|
90
341
|
]);
|
|
91
|
-
var PlainScopeType =
|
|
342
|
+
var PlainScopeType = z6.enum([
|
|
92
343
|
// Misc. system scopes
|
|
93
344
|
"bypassratelimit",
|
|
94
345
|
"record.reindex",
|
|
@@ -96,6 +347,7 @@ var PlainScopeType = z2.enum([
|
|
|
96
347
|
"integration.create",
|
|
97
348
|
"record.import",
|
|
98
349
|
"config.update-all",
|
|
350
|
+
"location.edit",
|
|
99
351
|
"attachment.upload",
|
|
100
352
|
"profile.electronic-signature",
|
|
101
353
|
"user.read-only-my-audit",
|
|
@@ -107,15 +359,15 @@ var PlainScopeType = z2.enum([
|
|
|
107
359
|
"record.confirm-registration",
|
|
108
360
|
"record.reject-registration"
|
|
109
361
|
]);
|
|
110
|
-
var scopeByEvent =
|
|
362
|
+
var scopeByEvent = z6.preprocess(
|
|
111
363
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
112
|
-
|
|
364
|
+
z6.array(z6.string()).optional()
|
|
113
365
|
).describe("Event type, e.g. birth, death");
|
|
114
|
-
var userRole =
|
|
366
|
+
var userRole = z6.preprocess(
|
|
115
367
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
116
|
-
|
|
368
|
+
z6.array(z6.string()).optional()
|
|
117
369
|
).describe("User role, e.g. admin, field agent");
|
|
118
|
-
var scopeOptionsPlaceEvent =
|
|
370
|
+
var scopeOptionsPlaceEvent = z6.object({
|
|
119
371
|
event: scopeByEvent,
|
|
120
372
|
placeOfEvent: JurisdictionFilter.optional()
|
|
121
373
|
}).describe("Options applicable to all record scopes.");
|
|
@@ -127,36 +379,37 @@ var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
|
127
379
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
128
380
|
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
129
381
|
registeredIn: JurisdictionFilter.optional(),
|
|
130
|
-
registeredBy: UserFilter.optional()
|
|
382
|
+
registeredBy: UserFilter.optional(),
|
|
383
|
+
flags: ContainsFlags.optional()
|
|
131
384
|
}).describe(
|
|
132
385
|
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
133
386
|
);
|
|
134
387
|
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
135
|
-
customActionTypes:
|
|
388
|
+
customActionTypes: z6.preprocess(
|
|
136
389
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
137
|
-
|
|
390
|
+
z6.array(z6.string()).optional()
|
|
138
391
|
).describe("Allowed custom action types")
|
|
139
392
|
});
|
|
140
|
-
var AccessLevelOptions =
|
|
393
|
+
var AccessLevelOptions = z6.object({
|
|
141
394
|
accessLevel: JurisdictionFilter.optional()
|
|
142
395
|
});
|
|
143
396
|
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
144
397
|
role: userRole.optional()
|
|
145
398
|
});
|
|
146
|
-
var WorkqueueOrDashboardOptions =
|
|
147
|
-
ids:
|
|
399
|
+
var WorkqueueOrDashboardOptions = z6.object({
|
|
400
|
+
ids: z6.preprocess(
|
|
148
401
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
149
|
-
|
|
402
|
+
z6.array(z6.string())
|
|
150
403
|
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
151
404
|
});
|
|
152
|
-
var AllScopeOptions =
|
|
405
|
+
var AllScopeOptions = z6.object({
|
|
153
406
|
...AllRecordScopeOptions.shape,
|
|
154
407
|
...AccessLevelOptions.shape,
|
|
155
408
|
...AllUserScopeOptions.shape,
|
|
156
409
|
...WorkqueueOrDashboardOptions.shape
|
|
157
410
|
});
|
|
158
411
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
159
|
-
var ResolvedScopeOptionsPlaceEvent =
|
|
412
|
+
var ResolvedScopeOptionsPlaceEvent = z6.object({
|
|
160
413
|
event: scopeByEvent,
|
|
161
414
|
placeOfEvent: UUID.nullish()
|
|
162
415
|
}).describe(
|
|
@@ -164,15 +417,16 @@ var ResolvedScopeOptionsPlaceEvent = z2.object({
|
|
|
164
417
|
);
|
|
165
418
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
166
419
|
notifiedIn: UUID.nullish(),
|
|
167
|
-
notifiedBy:
|
|
420
|
+
notifiedBy: z6.string().optional(),
|
|
168
421
|
declaredIn: UUID.nullish(),
|
|
169
|
-
declaredBy:
|
|
422
|
+
declaredBy: z6.string().optional()
|
|
170
423
|
}).describe(
|
|
171
424
|
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
172
425
|
);
|
|
173
426
|
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
174
427
|
registeredIn: UUID.nullish(),
|
|
175
|
-
registeredBy:
|
|
428
|
+
registeredBy: z6.string().optional(),
|
|
429
|
+
flags: ContainsFlags.optional()
|
|
176
430
|
}).describe(
|
|
177
431
|
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
178
432
|
);
|
|
@@ -197,38 +451,38 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
|
197
451
|
"record.unassign-others"
|
|
198
452
|
]);
|
|
199
453
|
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
200
|
-
templates:
|
|
454
|
+
templates: z6.preprocess(
|
|
201
455
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
202
|
-
|
|
456
|
+
z6.array(z6.string()).optional()
|
|
203
457
|
).describe(
|
|
204
458
|
"Template IDs for certified copies. Controls which certificate templates are returned to the client via the config service. Certificate printing is a client-side operation \u2014 this option is not validated when the printCertificate action is submitted."
|
|
205
459
|
)
|
|
206
460
|
});
|
|
207
|
-
var RecordScopeV2 =
|
|
208
|
-
|
|
461
|
+
var RecordScopeV2 = z6.discriminatedUnion("type", [
|
|
462
|
+
z6.object({
|
|
209
463
|
type: ScopesWithPlaceEventOptions,
|
|
210
464
|
options: scopeOptionsPlaceEvent.optional()
|
|
211
465
|
}),
|
|
212
|
-
|
|
466
|
+
z6.object({
|
|
213
467
|
type: ScopesWithDeclaredOptions,
|
|
214
468
|
options: scopeOptionsDeclaredOrNotified.optional()
|
|
215
469
|
}),
|
|
216
|
-
|
|
470
|
+
z6.object({
|
|
217
471
|
type: ScopesWithFullOptions,
|
|
218
472
|
options: AllRecordScopeOptions.optional()
|
|
219
473
|
}),
|
|
220
|
-
|
|
221
|
-
type:
|
|
474
|
+
z6.object({
|
|
475
|
+
type: z6.literal("record.custom-action"),
|
|
222
476
|
options: CustomActionScopeOptions.optional()
|
|
223
477
|
}),
|
|
224
|
-
|
|
225
|
-
type:
|
|
478
|
+
z6.object({
|
|
479
|
+
type: z6.literal("record.print-certified-copies"),
|
|
226
480
|
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
227
481
|
})
|
|
228
482
|
]).describe(
|
|
229
483
|
"Scopes used to check user's permission to perform actions on a record."
|
|
230
484
|
);
|
|
231
|
-
var SystemScopeType =
|
|
485
|
+
var SystemScopeType = z6.enum([
|
|
232
486
|
"organisation.read-locations",
|
|
233
487
|
"user.read",
|
|
234
488
|
"user.create",
|
|
@@ -242,61 +496,61 @@ var UserScopeType = SystemScopeType.extract([
|
|
|
242
496
|
"user.search"
|
|
243
497
|
]);
|
|
244
498
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
245
|
-
var UserScopeV2 =
|
|
246
|
-
|
|
499
|
+
var UserScopeV2 = z6.discriminatedUnion("type", [
|
|
500
|
+
z6.object({
|
|
247
501
|
type: ScopesWithRoleOption,
|
|
248
502
|
options: AllUserScopeOptions.optional()
|
|
249
503
|
}),
|
|
250
|
-
|
|
504
|
+
z6.object({
|
|
251
505
|
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
252
506
|
options: AccessLevelOptions.optional()
|
|
253
507
|
})
|
|
254
508
|
]);
|
|
255
|
-
var ResolvedRecordScopeV2 =
|
|
256
|
-
|
|
509
|
+
var ResolvedRecordScopeV2 = z6.discriminatedUnion("type", [
|
|
510
|
+
z6.object({
|
|
257
511
|
type: ScopesWithPlaceEventOptions,
|
|
258
512
|
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
259
513
|
}),
|
|
260
|
-
|
|
514
|
+
z6.object({
|
|
261
515
|
type: ScopesWithDeclaredOptions,
|
|
262
516
|
options: ResolvedScopeOptionsDeclared.optional()
|
|
263
517
|
}),
|
|
264
|
-
|
|
518
|
+
z6.object({
|
|
265
519
|
type: ScopesWithFullOptions,
|
|
266
520
|
options: ResolvedScopeOptionsFull.optional()
|
|
267
521
|
}),
|
|
268
|
-
|
|
269
|
-
type:
|
|
522
|
+
z6.object({
|
|
523
|
+
type: z6.literal("record.print-certified-copies"),
|
|
270
524
|
options: ResolvedScopeOptionsFull.extend({
|
|
271
|
-
templates:
|
|
525
|
+
templates: z6.array(z6.string()).optional()
|
|
272
526
|
}).optional()
|
|
273
527
|
})
|
|
274
528
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
275
|
-
var Scope =
|
|
276
|
-
|
|
529
|
+
var Scope = z6.discriminatedUnion("type", [
|
|
530
|
+
z6.object({ type: PlainScopeType }),
|
|
277
531
|
...RecordScopeV2.options,
|
|
278
532
|
...UserScopeV2.options,
|
|
279
|
-
|
|
280
|
-
type:
|
|
533
|
+
z6.object({
|
|
534
|
+
type: z6.literal("organisation.read-locations"),
|
|
281
535
|
options: AccessLevelOptions.optional()
|
|
282
536
|
}),
|
|
283
|
-
|
|
284
|
-
type:
|
|
537
|
+
z6.object({
|
|
538
|
+
type: z6.literal("workqueue"),
|
|
285
539
|
options: WorkqueueOrDashboardOptions
|
|
286
540
|
}),
|
|
287
|
-
|
|
288
|
-
type:
|
|
541
|
+
z6.object({
|
|
542
|
+
type: z6.literal("dashboard.view"),
|
|
289
543
|
options: WorkqueueOrDashboardOptions
|
|
290
544
|
})
|
|
291
545
|
]);
|
|
292
|
-
var ScopeType =
|
|
546
|
+
var ScopeType = z6.enum([
|
|
293
547
|
...SystemScopeType.options,
|
|
294
548
|
...RecordScopeTypeV2.options,
|
|
295
549
|
...PlainScopeType.options,
|
|
296
550
|
"workqueue",
|
|
297
551
|
"dashboard.view"
|
|
298
552
|
]);
|
|
299
|
-
var EncodedScope =
|
|
553
|
+
var EncodedScope = z6.string().brand("EncodedScope");
|
|
300
554
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
301
555
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
302
556
|
accessLevel: JurisdictionFilter.enum.all,
|
|
@@ -306,162 +560,51 @@ var DEFAULT_SCOPE_OPTIONS = {
|
|
|
306
560
|
};
|
|
307
561
|
|
|
308
562
|
// ../commons/src/authentication.ts
|
|
309
|
-
var TokenUserType =
|
|
310
|
-
var TokenWithBearer =
|
|
311
|
-
|
|
312
|
-
// ../commons/src/events/ActionType.ts
|
|
313
|
-
var z4 = __toESM(require("zod/v4"));
|
|
314
|
-
var ActionType = {
|
|
315
|
-
// Pre-declaration actions
|
|
316
|
-
DELETE: "DELETE",
|
|
317
|
-
CREATE: "CREATE",
|
|
318
|
-
NOTIFY: "NOTIFY",
|
|
319
|
-
// Declaration actions
|
|
320
|
-
DECLARE: "DECLARE",
|
|
321
|
-
REGISTER: "REGISTER",
|
|
322
|
-
EDIT: "EDIT",
|
|
323
|
-
// Declaration system actions. Non-configurable.
|
|
324
|
-
DUPLICATE_DETECTED: "DUPLICATE_DETECTED",
|
|
325
|
-
REJECT: "REJECT",
|
|
326
|
-
// REJECT_DECLARATION
|
|
327
|
-
MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
|
|
328
|
-
MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
|
|
329
|
-
ARCHIVE: "ARCHIVE",
|
|
330
|
-
UNARCHIVE: "UNARCHIVE",
|
|
331
|
-
// Record actions
|
|
332
|
-
PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
|
|
333
|
-
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
|
334
|
-
REJECT_CORRECTION: "REJECT_CORRECTION",
|
|
335
|
-
APPROVE_CORRECTION: "APPROVE_CORRECTION",
|
|
336
|
-
// General actions
|
|
337
|
-
READ: "READ",
|
|
338
|
-
ASSIGN: "ASSIGN",
|
|
339
|
-
UNASSIGN: "UNASSIGN",
|
|
340
|
-
// Custom action
|
|
341
|
-
CUSTOM: "CUSTOM"
|
|
342
|
-
};
|
|
343
|
-
var ConfirmableActions = [
|
|
344
|
-
ActionType.NOTIFY,
|
|
345
|
-
ActionType.DECLARE,
|
|
346
|
-
ActionType.EDIT,
|
|
347
|
-
ActionType.REGISTER,
|
|
348
|
-
ActionType.REJECT,
|
|
349
|
-
ActionType.ARCHIVE,
|
|
350
|
-
ActionType.UNARCHIVE,
|
|
351
|
-
ActionType.PRINT_CERTIFICATE,
|
|
352
|
-
ActionType.REQUEST_CORRECTION,
|
|
353
|
-
ActionType.APPROVE_CORRECTION,
|
|
354
|
-
ActionType.REJECT_CORRECTION,
|
|
355
|
-
ActionType.CUSTOM
|
|
356
|
-
];
|
|
357
|
-
var ActionTypes = z4.enum([
|
|
358
|
-
"DELETE",
|
|
359
|
-
"CREATE",
|
|
360
|
-
"NOTIFY",
|
|
361
|
-
"DECLARE",
|
|
362
|
-
"EDIT",
|
|
363
|
-
"REGISTER",
|
|
364
|
-
"DUPLICATE_DETECTED",
|
|
365
|
-
"REJECT",
|
|
366
|
-
"MARK_AS_DUPLICATE",
|
|
367
|
-
"MARK_AS_NOT_DUPLICATE",
|
|
368
|
-
"ARCHIVE",
|
|
369
|
-
"UNARCHIVE",
|
|
370
|
-
"PRINT_CERTIFICATE",
|
|
371
|
-
"REQUEST_CORRECTION",
|
|
372
|
-
"REJECT_CORRECTION",
|
|
373
|
-
"APPROVE_CORRECTION",
|
|
374
|
-
"READ",
|
|
375
|
-
"ASSIGN",
|
|
376
|
-
"UNASSIGN",
|
|
377
|
-
"CUSTOM"
|
|
378
|
-
]);
|
|
379
|
-
var ClientSpecificAction = {
|
|
380
|
-
REVIEW_CORRECTION_REQUEST: "REVIEW_CORRECTION_REQUEST"
|
|
381
|
-
};
|
|
382
|
-
var declarationActionValues = [
|
|
383
|
-
ActionTypes.enum.DECLARE,
|
|
384
|
-
ActionTypes.enum.EDIT,
|
|
385
|
-
ActionTypes.enum.REGISTER,
|
|
386
|
-
ActionTypes.enum.NOTIFY,
|
|
387
|
-
ActionTypes.enum.DUPLICATE_DETECTED
|
|
388
|
-
];
|
|
389
|
-
var DeclarationActions = ActionTypes.extract(declarationActionValues);
|
|
390
|
-
var declarationUpdateActionValues = [
|
|
391
|
-
...declarationActionValues,
|
|
392
|
-
ActionTypes.enum.REQUEST_CORRECTION
|
|
393
|
-
];
|
|
394
|
-
var DeclarationUpdateActions = ActionTypes.extract(
|
|
395
|
-
declarationUpdateActionValues
|
|
396
|
-
);
|
|
397
|
-
var annotationActions = ActionTypes.exclude(declarationActionValues);
|
|
398
|
-
var writeActions = ActionTypes.exclude([
|
|
399
|
-
ActionType.CREATE,
|
|
400
|
-
ActionType.READ,
|
|
401
|
-
ActionType.ASSIGN,
|
|
402
|
-
ActionType.UNASSIGN
|
|
403
|
-
]);
|
|
404
|
-
var WorkqueueActionType = ActionTypes.extract([
|
|
405
|
-
ActionType.READ,
|
|
406
|
-
ActionType.DELETE,
|
|
407
|
-
ActionType.DECLARE,
|
|
408
|
-
ActionType.REGISTER,
|
|
409
|
-
ActionType.EDIT,
|
|
410
|
-
ActionType.REJECT,
|
|
411
|
-
ActionType.MARK_AS_DUPLICATE,
|
|
412
|
-
ActionType.ARCHIVE,
|
|
413
|
-
ActionType.UNARCHIVE,
|
|
414
|
-
ActionType.PRINT_CERTIFICATE,
|
|
415
|
-
ActionType.REQUEST_CORRECTION
|
|
416
|
-
]);
|
|
417
|
-
var META_ACTIONS = [
|
|
418
|
-
ActionType.ASSIGN,
|
|
419
|
-
ActionType.UNASSIGN,
|
|
420
|
-
ActionType.READ
|
|
421
|
-
];
|
|
563
|
+
var TokenUserType = z7.enum(["user", "system"]);
|
|
564
|
+
var TokenWithBearer = z7.string().regex(/^Bearer\s/);
|
|
422
565
|
|
|
423
566
|
// ../commons/src/events/AuditLog.ts
|
|
424
|
-
var AuditLogEntryBase =
|
|
425
|
-
id:
|
|
426
|
-
clientId:
|
|
567
|
+
var AuditLogEntryBase = z8.object({
|
|
568
|
+
id: z8.string(),
|
|
569
|
+
clientId: z8.string(),
|
|
427
570
|
clientType: TokenUserType,
|
|
428
|
-
createdAt:
|
|
571
|
+
createdAt: z8.string()
|
|
429
572
|
});
|
|
430
573
|
var EventCreateEntrySchema = AuditLogEntryBase.extend({
|
|
431
|
-
operation:
|
|
432
|
-
requestData:
|
|
433
|
-
transactionId:
|
|
434
|
-
type:
|
|
435
|
-
createdAtLocation:
|
|
574
|
+
operation: z8.literal("event.create"),
|
|
575
|
+
requestData: z8.object({
|
|
576
|
+
transactionId: z8.string(),
|
|
577
|
+
type: z8.string(),
|
|
578
|
+
createdAtLocation: z8.string().nullable()
|
|
436
579
|
}),
|
|
437
|
-
responseSummary:
|
|
438
|
-
eventId:
|
|
439
|
-
trackingId:
|
|
580
|
+
responseSummary: z8.object({
|
|
581
|
+
eventId: z8.string(),
|
|
582
|
+
trackingId: z8.string()
|
|
440
583
|
})
|
|
441
584
|
});
|
|
442
585
|
var EventGetEntrySchema = AuditLogEntryBase.extend({
|
|
443
|
-
operation:
|
|
444
|
-
requestData:
|
|
445
|
-
responseSummary:
|
|
446
|
-
eventType:
|
|
447
|
-
trackingId:
|
|
586
|
+
operation: z8.literal("event.get"),
|
|
587
|
+
requestData: z8.object({ eventId: z8.string() }),
|
|
588
|
+
responseSummary: z8.object({
|
|
589
|
+
eventType: z8.string(),
|
|
590
|
+
trackingId: z8.string()
|
|
448
591
|
})
|
|
449
592
|
});
|
|
450
593
|
var EventSearchEntrySchema = AuditLogEntryBase.extend({
|
|
451
|
-
operation:
|
|
452
|
-
clientType:
|
|
453
|
-
requestData:
|
|
454
|
-
query:
|
|
455
|
-
limit:
|
|
456
|
-
offset:
|
|
594
|
+
operation: z8.literal("event.search"),
|
|
595
|
+
clientType: z8.literal("system"),
|
|
596
|
+
requestData: z8.object({
|
|
597
|
+
query: z8.record(z8.string(), z8.unknown()).nullable(),
|
|
598
|
+
limit: z8.number().nullable(),
|
|
599
|
+
offset: z8.number().nullable()
|
|
457
600
|
}),
|
|
458
|
-
responseSummary:
|
|
459
|
-
total:
|
|
460
|
-
eventIds:
|
|
601
|
+
responseSummary: z8.object({
|
|
602
|
+
total: z8.number(),
|
|
603
|
+
eventIds: z8.array(z8.string())
|
|
461
604
|
})
|
|
462
605
|
});
|
|
463
606
|
var EventActionEntrySchema = AuditLogEntryBase.extend({
|
|
464
|
-
operation:
|
|
607
|
+
operation: z8.enum([
|
|
465
608
|
"event.actions.notify.request",
|
|
466
609
|
"event.actions.declare.request",
|
|
467
610
|
"event.actions.register.request",
|
|
@@ -481,83 +624,106 @@ var EventActionEntrySchema = AuditLogEntryBase.extend({
|
|
|
481
624
|
"event.actions.mark_as_duplicate.request",
|
|
482
625
|
"event.actions.mark_as_not_duplicate.request"
|
|
483
626
|
]),
|
|
484
|
-
requestData:
|
|
485
|
-
eventId:
|
|
486
|
-
actionType:
|
|
487
|
-
eventType:
|
|
488
|
-
trackingId:
|
|
489
|
-
transactionId:
|
|
627
|
+
requestData: z8.object({
|
|
628
|
+
eventId: z8.string(),
|
|
629
|
+
actionType: z8.string(),
|
|
630
|
+
eventType: z8.string(),
|
|
631
|
+
trackingId: z8.string(),
|
|
632
|
+
transactionId: z8.string()
|
|
490
633
|
})
|
|
491
634
|
});
|
|
492
635
|
var EventCustomActionEntrySchema = AuditLogEntryBase.extend({
|
|
493
|
-
operation:
|
|
494
|
-
requestData:
|
|
495
|
-
eventId:
|
|
496
|
-
actionType:
|
|
497
|
-
customAction:
|
|
498
|
-
eventType:
|
|
499
|
-
trackingId:
|
|
500
|
-
transactionId:
|
|
636
|
+
operation: z8.literal("event.actions.custom.request"),
|
|
637
|
+
requestData: z8.object({
|
|
638
|
+
eventId: z8.string(),
|
|
639
|
+
actionType: z8.literal(ActionType.CUSTOM),
|
|
640
|
+
customAction: z8.string(),
|
|
641
|
+
eventType: z8.string(),
|
|
642
|
+
trackingId: z8.string(),
|
|
643
|
+
transactionId: z8.string()
|
|
501
644
|
})
|
|
502
645
|
});
|
|
503
646
|
var IntegrationCreateEntrySchema = AuditLogEntryBase.extend({
|
|
504
|
-
operation:
|
|
505
|
-
requestData:
|
|
506
|
-
responseSummary:
|
|
647
|
+
operation: z8.literal("integrations.create"),
|
|
648
|
+
requestData: z8.object({ name: z8.string(), scopes: z8.array(z8.string()) }),
|
|
649
|
+
responseSummary: z8.object({ clientId: z8.string() })
|
|
507
650
|
});
|
|
508
651
|
var IntegrationRefreshTokenEntrySchema = AuditLogEntryBase.extend({
|
|
509
|
-
operation:
|
|
510
|
-
requestData:
|
|
511
|
-
responseSummary:
|
|
652
|
+
operation: z8.literal("integrations.refreshToken"),
|
|
653
|
+
requestData: z8.object({ clientId: z8.string() }),
|
|
654
|
+
responseSummary: z8.object({ clientId: z8.string() })
|
|
512
655
|
});
|
|
513
656
|
var IntegrationDeactivateEntrySchema = AuditLogEntryBase.extend({
|
|
514
|
-
operation:
|
|
515
|
-
requestData:
|
|
516
|
-
responseSummary:
|
|
657
|
+
operation: z8.literal("integrations.deactivate"),
|
|
658
|
+
requestData: z8.object({ id: z8.string() }),
|
|
659
|
+
responseSummary: z8.object({ id: z8.string(), status: z8.string() })
|
|
517
660
|
});
|
|
518
661
|
var IntegrationActivateEntrySchema = AuditLogEntryBase.extend({
|
|
519
|
-
operation:
|
|
520
|
-
requestData:
|
|
521
|
-
responseSummary:
|
|
662
|
+
operation: z8.literal("integrations.activate"),
|
|
663
|
+
requestData: z8.object({ id: z8.string() }),
|
|
664
|
+
responseSummary: z8.object({ id: z8.string(), status: z8.string() })
|
|
522
665
|
});
|
|
523
666
|
var IntegrationDeleteEntrySchema = AuditLogEntryBase.extend({
|
|
524
|
-
operation:
|
|
525
|
-
requestData:
|
|
526
|
-
responseSummary:
|
|
667
|
+
operation: z8.literal("integrations.delete"),
|
|
668
|
+
requestData: z8.object({ id: z8.string() }),
|
|
669
|
+
responseSummary: z8.object({ id: z8.string(), name: z8.string() })
|
|
527
670
|
});
|
|
528
671
|
var IntegrationRefreshSecretEntrySchema = AuditLogEntryBase.extend({
|
|
529
|
-
operation:
|
|
530
|
-
requestData:
|
|
531
|
-
responseSummary:
|
|
672
|
+
operation: z8.literal("integrations.refreshSecret"),
|
|
673
|
+
requestData: z8.object({ id: z8.string() }),
|
|
674
|
+
responseSummary: z8.object({ clientId: z8.string() })
|
|
675
|
+
});
|
|
676
|
+
var createdVersionFields = {
|
|
677
|
+
id: z8.string(),
|
|
678
|
+
versionId: z8.string(),
|
|
679
|
+
name: z8.string(),
|
|
680
|
+
externalId: z8.string().nullish(),
|
|
681
|
+
effectiveFrom: z8.string(),
|
|
682
|
+
status: z8.string()
|
|
683
|
+
};
|
|
684
|
+
var LocationCreateEntrySchema = AuditLogEntryBase.extend({
|
|
685
|
+
operation: z8.literal("locations.create"),
|
|
686
|
+
requestData: z8.object({
|
|
687
|
+
...createdVersionFields,
|
|
688
|
+
administrativeAreaId: z8.string().nullish(),
|
|
689
|
+
locationType: z8.string().nullish()
|
|
690
|
+
})
|
|
691
|
+
});
|
|
692
|
+
var AdministrativeAreaCreateEntrySchema = AuditLogEntryBase.extend({
|
|
693
|
+
operation: z8.literal("administrativeAreas.create"),
|
|
694
|
+
requestData: z8.object({
|
|
695
|
+
...createdVersionFields,
|
|
696
|
+
parentId: z8.string().nullish()
|
|
697
|
+
})
|
|
532
698
|
});
|
|
533
699
|
var AttachmentUploadEntrySchema = AuditLogEntryBase.extend({
|
|
534
|
-
operation:
|
|
535
|
-
requestData:
|
|
536
|
-
transactionId:
|
|
537
|
-
path:
|
|
700
|
+
operation: z8.literal("attachments.upload"),
|
|
701
|
+
requestData: z8.object({
|
|
702
|
+
transactionId: z8.string(),
|
|
703
|
+
path: z8.string().nullable()
|
|
538
704
|
}),
|
|
539
|
-
responseSummary:
|
|
705
|
+
responseSummary: z8.object({ fileUrl: z8.string() })
|
|
540
706
|
});
|
|
541
|
-
var subjectOnly =
|
|
542
|
-
var subjectWithReason =
|
|
543
|
-
subjectId:
|
|
544
|
-
reason:
|
|
545
|
-
comment:
|
|
707
|
+
var subjectOnly = z8.object({ subjectId: z8.string() });
|
|
708
|
+
var subjectWithReason = z8.object({
|
|
709
|
+
subjectId: z8.string(),
|
|
710
|
+
reason: z8.string(),
|
|
711
|
+
comment: z8.string().optional()
|
|
546
712
|
});
|
|
547
713
|
var UserCreateEntrySchema = AuditLogEntryBase.extend({
|
|
548
|
-
operation:
|
|
549
|
-
requestData:
|
|
550
|
-
subjectId:
|
|
551
|
-
role:
|
|
552
|
-
primaryOfficeId:
|
|
714
|
+
operation: z8.literal("user.create_user"),
|
|
715
|
+
requestData: z8.object({
|
|
716
|
+
subjectId: z8.string(),
|
|
717
|
+
role: z8.string(),
|
|
718
|
+
primaryOfficeId: z8.string()
|
|
553
719
|
})
|
|
554
720
|
});
|
|
555
721
|
var UserReasonEntrySchema = AuditLogEntryBase.extend({
|
|
556
|
-
operation:
|
|
722
|
+
operation: z8.enum(["user.deactivate", "user.reactivate"]),
|
|
557
723
|
requestData: subjectWithReason
|
|
558
724
|
});
|
|
559
725
|
var UserSubjectOnlyEntrySchema = AuditLogEntryBase.extend({
|
|
560
|
-
operation:
|
|
726
|
+
operation: z8.enum([
|
|
561
727
|
"user.edit_user",
|
|
562
728
|
"user.logged_in",
|
|
563
729
|
"user.logged_out",
|
|
@@ -571,14 +737,14 @@ var UserSubjectOnlyEntrySchema = AuditLogEntryBase.extend({
|
|
|
571
737
|
requestData: subjectOnly
|
|
572
738
|
});
|
|
573
739
|
var UserEmailChangedEntrySchema = AuditLogEntryBase.extend({
|
|
574
|
-
operation:
|
|
740
|
+
operation: z8.literal("user.email_address_changed"),
|
|
575
741
|
requestData: subjectOnly,
|
|
576
|
-
responseSummary:
|
|
742
|
+
responseSummary: z8.object({ email: z8.string() })
|
|
577
743
|
});
|
|
578
744
|
var UserPhoneChangedEntrySchema = AuditLogEntryBase.extend({
|
|
579
|
-
operation:
|
|
745
|
+
operation: z8.literal("user.phone_number_changed"),
|
|
580
746
|
requestData: subjectOnly,
|
|
581
|
-
responseSummary:
|
|
747
|
+
responseSummary: z8.object({ phoneNumber: z8.string() })
|
|
582
748
|
});
|
|
583
749
|
var userBaseOmit = {
|
|
584
750
|
id: true,
|
|
@@ -586,14 +752,14 @@ var userBaseOmit = {
|
|
|
586
752
|
clientType: true,
|
|
587
753
|
createdAt: true
|
|
588
754
|
};
|
|
589
|
-
var UserAuditRecordInput =
|
|
755
|
+
var UserAuditRecordInput = z8.discriminatedUnion("operation", [
|
|
590
756
|
UserCreateEntrySchema.omit(userBaseOmit),
|
|
591
757
|
UserReasonEntrySchema.omit(userBaseOmit),
|
|
592
758
|
UserSubjectOnlyEntrySchema.omit(userBaseOmit),
|
|
593
759
|
UserEmailChangedEntrySchema.omit(userBaseOmit),
|
|
594
760
|
UserPhoneChangedEntrySchema.omit(userBaseOmit)
|
|
595
761
|
]);
|
|
596
|
-
var AuditLogEntrySchema =
|
|
762
|
+
var AuditLogEntrySchema = z8.discriminatedUnion("operation", [
|
|
597
763
|
EventCreateEntrySchema,
|
|
598
764
|
EventGetEntrySchema,
|
|
599
765
|
EventSearchEntrySchema,
|
|
@@ -605,6 +771,8 @@ var AuditLogEntrySchema = z5.discriminatedUnion("operation", [
|
|
|
605
771
|
IntegrationActivateEntrySchema,
|
|
606
772
|
IntegrationDeleteEntrySchema,
|
|
607
773
|
IntegrationRefreshSecretEntrySchema,
|
|
774
|
+
LocationCreateEntrySchema,
|
|
775
|
+
AdministrativeAreaCreateEntrySchema,
|
|
608
776
|
AttachmentUploadEntrySchema,
|
|
609
777
|
UserCreateEntrySchema,
|
|
610
778
|
UserReasonEntrySchema,
|
|
@@ -620,76 +788,11 @@ var CHILD_ONBOARDING_EVENT = "child-onboarding";
|
|
|
620
788
|
// ../commons/src/events/ActionConfig.ts
|
|
621
789
|
var z24 = __toESM(require("zod/v4"));
|
|
622
790
|
|
|
623
|
-
// ../commons/src/events/TranslationConfig.ts
|
|
624
|
-
var z6 = __toESM(require("zod/v4"));
|
|
625
|
-
var TranslationConfig = z6.object({
|
|
626
|
-
id: z6.string().describe(
|
|
627
|
-
"The identifier of the translation referred in translation CSV files"
|
|
628
|
-
),
|
|
629
|
-
defaultMessage: z6.string().describe("Default translation message"),
|
|
630
|
-
description: z6.string().describe(
|
|
631
|
-
"Describe the translation for a translator to be able to identify it."
|
|
632
|
-
)
|
|
633
|
-
}).meta({
|
|
634
|
-
description: "Translation configuration",
|
|
635
|
-
id: "TranslationConfig"
|
|
636
|
-
});
|
|
637
|
-
|
|
638
791
|
// ../commons/src/events/FieldConfig.ts
|
|
639
792
|
var import_v43 = __toESM(require("zod/v4"));
|
|
640
793
|
|
|
641
|
-
// ../commons/src/events/Conditional.ts
|
|
642
|
-
var z7 = __toESM(require("zod/v4"));
|
|
643
|
-
var Conditional = z7.any().describe("JSONSchema").meta({
|
|
644
|
-
description: "JSON schema conditional configuration",
|
|
645
|
-
id: "Conditional"
|
|
646
|
-
});
|
|
647
|
-
var ConditionalType = {
|
|
648
|
-
SHOW: "SHOW",
|
|
649
|
-
ENABLE: "ENABLE",
|
|
650
|
-
DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
|
|
651
|
-
};
|
|
652
|
-
var ShowConditional = z7.object({
|
|
653
|
-
type: z7.literal(ConditionalType.SHOW),
|
|
654
|
-
conditional: Conditional
|
|
655
|
-
}).describe(
|
|
656
|
-
"If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
|
|
657
|
-
);
|
|
658
|
-
var EnableConditional = z7.object({
|
|
659
|
-
type: z7.literal(ConditionalType.ENABLE),
|
|
660
|
-
conditional: Conditional
|
|
661
|
-
}).describe(
|
|
662
|
-
"If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
|
|
663
|
-
);
|
|
664
|
-
var ActionConditional = z7.discriminatedUnion("type", [
|
|
665
|
-
// Action can be shown / hidden
|
|
666
|
-
ShowConditional,
|
|
667
|
-
// Action can be shown to the user in the list but as disabled
|
|
668
|
-
EnableConditional
|
|
669
|
-
]).meta({
|
|
670
|
-
id: "ActionConditional",
|
|
671
|
-
description: "Conditional gating whether an action is shown (SHOW) or enabled (ENABLE). When omitted from an action, the action is shown and enabled for everyone."
|
|
672
|
-
});
|
|
673
|
-
var DisplayOnReviewConditional = z7.object({
|
|
674
|
-
type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
675
|
-
conditional: Conditional
|
|
676
|
-
}).describe(
|
|
677
|
-
"If 'DISPLAY_ON_REVIEW' conditional is defined, the component is shown on the review page only if both the 'DISPLAY_ON_REVIEW' and 'SHOW' conditions are met. This should only be used for fields within declaration forms, as they are the only ones with review pages."
|
|
678
|
-
);
|
|
679
|
-
var FieldConditional = z7.discriminatedUnion("type", [
|
|
680
|
-
// Field input can be shown / hidden
|
|
681
|
-
ShowConditional,
|
|
682
|
-
// Field input can be shown to the user but as disabled
|
|
683
|
-
EnableConditional,
|
|
684
|
-
// Field output can be shown / hidden on the review page
|
|
685
|
-
DisplayOnReviewConditional
|
|
686
|
-
]).meta({
|
|
687
|
-
id: "FieldConditional",
|
|
688
|
-
description: "Conditional gating whether a form field is shown (SHOW), enabled (ENABLE), or displayed on the review page (DISPLAY_ON_REVIEW). When omitted, the field is shown and enabled for everyone, and is displayed on review whenever it has a value."
|
|
689
|
-
});
|
|
690
|
-
|
|
691
794
|
// ../commons/src/events/FieldType.ts
|
|
692
|
-
var
|
|
795
|
+
var z9 = __toESM(require("zod/v4"));
|
|
693
796
|
var FieldType = {
|
|
694
797
|
NAME: "NAME",
|
|
695
798
|
PHONE: "PHONE",
|
|
@@ -753,7 +856,7 @@ var FieldType = {
|
|
|
753
856
|
*/
|
|
754
857
|
_EXPERIMENTAL_CUSTOM: "CUSTOM"
|
|
755
858
|
};
|
|
756
|
-
var FileFieldType =
|
|
859
|
+
var FileFieldType = z9.enum([
|
|
757
860
|
FieldType.FILE,
|
|
758
861
|
FieldType.FILE_WITH_OPTIONS,
|
|
759
862
|
FieldType.SIGNATURE
|
|
@@ -789,160 +892,164 @@ var HiddenFieldTypes = [
|
|
|
789
892
|
];
|
|
790
893
|
|
|
791
894
|
// ../commons/src/events/FieldValue.ts
|
|
792
|
-
var
|
|
895
|
+
var z13 = __toESM(require("zod/v4"));
|
|
793
896
|
|
|
794
897
|
// ../commons/src/documents.ts
|
|
795
|
-
var
|
|
796
|
-
var FullDocumentUrl =
|
|
898
|
+
var z10 = __toESM(require("zod/v4"));
|
|
899
|
+
var FullDocumentUrl = z10.string().brand("FullDocumentUrl").describe(
|
|
797
900
|
"A full url with protocol, host, bucket name, starting from the root of the S3 server, https://minio.opencrvs.com/bucket-name/document-id.jpg"
|
|
798
901
|
);
|
|
799
|
-
var FullDocumentPath =
|
|
902
|
+
var FullDocumentPath = z10.string().overwrite((val) => val.startsWith("/") ? val : `/${val}`).meta({ effectType: "input", type: "string" }).describe(
|
|
800
903
|
"A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
|
|
801
904
|
);
|
|
802
|
-
var DocumentPath =
|
|
905
|
+
var DocumentPath = z10.string().brand("DocumentPath").describe(
|
|
803
906
|
"A relative path within the S3 bucket, never starting with /. e.g. document-id.jpg or directory/document-id.jpg. The document service constructs the full /bucket/path internally."
|
|
804
907
|
);
|
|
805
908
|
|
|
806
909
|
// ../commons/src/events/CompositeFieldValue.ts
|
|
807
|
-
var
|
|
910
|
+
var z11 = __toESM(require("zod/v4"));
|
|
808
911
|
var AddressType = {
|
|
809
912
|
DOMESTIC: "DOMESTIC",
|
|
810
913
|
INTERNATIONAL: "INTERNATIONAL"
|
|
811
914
|
};
|
|
812
|
-
var FileFieldValue =
|
|
915
|
+
var FileFieldValue = z11.object({
|
|
813
916
|
path: DocumentPath,
|
|
814
|
-
originalFilename:
|
|
815
|
-
type:
|
|
816
|
-
});
|
|
817
|
-
var NameFieldValue =
|
|
818
|
-
firstname:
|
|
819
|
-
surname:
|
|
820
|
-
middlename:
|
|
821
|
-
});
|
|
822
|
-
var NameFieldUpdateValue =
|
|
823
|
-
firstname:
|
|
824
|
-
surname:
|
|
825
|
-
middlename:
|
|
826
|
-
}).or(
|
|
827
|
-
var StreetLevelDetailsValue =
|
|
828
|
-
var StreetLevelDetailsUpdateValue =
|
|
829
|
-
var BaseAddressFieldValue =
|
|
830
|
-
country:
|
|
917
|
+
originalFilename: z11.string(),
|
|
918
|
+
type: z11.string()
|
|
919
|
+
});
|
|
920
|
+
var NameFieldValue = z11.object({
|
|
921
|
+
firstname: z11.string(),
|
|
922
|
+
surname: z11.string(),
|
|
923
|
+
middlename: z11.string().optional()
|
|
924
|
+
});
|
|
925
|
+
var NameFieldUpdateValue = z11.object({
|
|
926
|
+
firstname: z11.string().nullish(),
|
|
927
|
+
surname: z11.string().nullish(),
|
|
928
|
+
middlename: z11.string().nullish()
|
|
929
|
+
}).or(z11.null()).or(z11.undefined());
|
|
930
|
+
var StreetLevelDetailsValue = z11.record(z11.string(), z11.string()).optional();
|
|
931
|
+
var StreetLevelDetailsUpdateValue = z11.record(z11.string(), z11.string().nullable()).nullish();
|
|
932
|
+
var BaseAddressFieldValue = z11.object({
|
|
933
|
+
country: z11.string(),
|
|
831
934
|
streetLevelDetails: StreetLevelDetailsValue
|
|
832
935
|
});
|
|
833
|
-
var BaseAddressFieldUpdateValue =
|
|
834
|
-
country:
|
|
936
|
+
var BaseAddressFieldUpdateValue = z11.object({
|
|
937
|
+
country: z11.string().nullish(),
|
|
835
938
|
streetLevelDetails: StreetLevelDetailsUpdateValue
|
|
836
939
|
});
|
|
837
940
|
var DomesticAddressFieldValue = BaseAddressFieldValue.extend({
|
|
838
|
-
addressType:
|
|
839
|
-
administrativeArea:
|
|
941
|
+
addressType: z11.literal(AddressType.DOMESTIC),
|
|
942
|
+
administrativeArea: z11.string().uuid()
|
|
840
943
|
});
|
|
841
944
|
var InternationalAddressFieldValue = BaseAddressFieldValue.extend({
|
|
842
|
-
addressType:
|
|
945
|
+
addressType: z11.literal(AddressType.INTERNATIONAL)
|
|
843
946
|
});
|
|
844
|
-
var AddressFieldValue =
|
|
947
|
+
var AddressFieldValue = z11.discriminatedUnion("addressType", [
|
|
845
948
|
DomesticAddressFieldValue,
|
|
846
949
|
InternationalAddressFieldValue
|
|
847
950
|
]);
|
|
848
951
|
var DomesticAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend({
|
|
849
|
-
addressType:
|
|
850
|
-
administrativeArea:
|
|
952
|
+
addressType: z11.literal(AddressType.DOMESTIC),
|
|
953
|
+
administrativeArea: z11.string().uuid().nullish()
|
|
851
954
|
/* Leaf level admin structure */
|
|
852
955
|
});
|
|
853
956
|
var InternationalAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend(
|
|
854
957
|
{
|
|
855
|
-
addressType:
|
|
958
|
+
addressType: z11.literal(AddressType.INTERNATIONAL)
|
|
856
959
|
}
|
|
857
960
|
);
|
|
858
|
-
var AddressFieldUpdateValue =
|
|
961
|
+
var AddressFieldUpdateValue = z11.discriminatedUnion("addressType", [
|
|
859
962
|
DomesticAddressUpdateFieldValue,
|
|
860
963
|
InternationalAddressUpdateFieldValue
|
|
861
964
|
]).nullish();
|
|
862
|
-
var FileFieldValueWithOption =
|
|
965
|
+
var FileFieldValueWithOption = z11.object({
|
|
863
966
|
path: DocumentPath,
|
|
864
|
-
originalFilename:
|
|
865
|
-
type:
|
|
866
|
-
option:
|
|
867
|
-
});
|
|
868
|
-
var FileFieldWithOptionValue =
|
|
869
|
-
var HttpFieldValue =
|
|
870
|
-
loading:
|
|
871
|
-
error:
|
|
872
|
-
data:
|
|
873
|
-
});
|
|
874
|
-
var HttpFieldUpdateValue =
|
|
875
|
-
loading:
|
|
876
|
-
error:
|
|
877
|
-
data:
|
|
878
|
-
}).or(
|
|
879
|
-
var QueryParamReaderFieldValue =
|
|
880
|
-
data:
|
|
881
|
-
updatedAt:
|
|
967
|
+
originalFilename: z11.string(),
|
|
968
|
+
type: z11.string(),
|
|
969
|
+
option: z11.string()
|
|
970
|
+
});
|
|
971
|
+
var FileFieldWithOptionValue = z11.array(FileFieldValueWithOption);
|
|
972
|
+
var HttpFieldValue = z11.object({
|
|
973
|
+
loading: z11.boolean(),
|
|
974
|
+
error: z11.object({ statusCode: z11.number(), message: z11.string() }).nullish(),
|
|
975
|
+
data: z11.any()
|
|
976
|
+
});
|
|
977
|
+
var HttpFieldUpdateValue = z11.object({
|
|
978
|
+
loading: z11.boolean().nullish(),
|
|
979
|
+
error: z11.object({ statusCode: z11.number(), message: z11.string() }).nullish(),
|
|
980
|
+
data: z11.any().nullish()
|
|
981
|
+
}).or(z11.null()).or(z11.undefined());
|
|
982
|
+
var QueryParamReaderFieldValue = z11.object({
|
|
983
|
+
data: z11.record(z11.string(), z11.string()),
|
|
984
|
+
updatedAt: z11.iso.datetime()
|
|
882
985
|
}).nullish();
|
|
883
|
-
var QueryParamReaderFieldUpdateValue =
|
|
884
|
-
data:
|
|
986
|
+
var QueryParamReaderFieldUpdateValue = z11.object({
|
|
987
|
+
data: z11.record(z11.string(), z11.string())
|
|
885
988
|
});
|
|
886
|
-
var ReadDataValue =
|
|
887
|
-
data:
|
|
989
|
+
var ReadDataValue = z11.object({
|
|
990
|
+
data: z11.any()
|
|
888
991
|
});
|
|
889
992
|
var QrReaderFieldValue = ReadDataValue;
|
|
890
993
|
var IdReaderFieldValue = ReadDataValue;
|
|
891
|
-
var NumberWithUnitFieldValue =
|
|
892
|
-
numericValue:
|
|
893
|
-
unit:
|
|
994
|
+
var NumberWithUnitFieldValue = z11.object({
|
|
995
|
+
numericValue: z11.number(),
|
|
996
|
+
unit: z11.string()
|
|
894
997
|
});
|
|
895
|
-
var NumberWithUnitFieldUpdateValue =
|
|
896
|
-
numericValue:
|
|
897
|
-
unit:
|
|
998
|
+
var NumberWithUnitFieldUpdateValue = z11.object({
|
|
999
|
+
numericValue: z11.number().optional(),
|
|
1000
|
+
unit: z11.string().optional()
|
|
898
1001
|
});
|
|
899
|
-
var CustomFieldValue =
|
|
1002
|
+
var CustomFieldValue = z11.unknown().brand("CustomFieldValue");
|
|
900
1003
|
|
|
901
1004
|
// ../commons/src/events/PlainDate.ts
|
|
902
1005
|
var import_zod = require("zod");
|
|
903
1006
|
var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date in the format YYYY-MM-DD");
|
|
1007
|
+
function plainDateToLocalDate(date) {
|
|
1008
|
+
const [year, month, day] = date.split("-").map(Number);
|
|
1009
|
+
return new Date(year, month - 1, day);
|
|
1010
|
+
}
|
|
904
1011
|
|
|
905
1012
|
// ../commons/src/events/FieldValue.ts
|
|
906
|
-
var TextValue =
|
|
907
|
-
var HiddenFieldValue =
|
|
908
|
-
var NonEmptyTextValue =
|
|
909
|
-
var DateValue =
|
|
910
|
-
var AgeValue =
|
|
911
|
-
age:
|
|
912
|
-
asOfDateRef:
|
|
1013
|
+
var TextValue = z13.string();
|
|
1014
|
+
var HiddenFieldValue = z13.string();
|
|
1015
|
+
var NonEmptyTextValue = z13.string().trim().min(1);
|
|
1016
|
+
var DateValue = z13.iso.date().describe("Date in the format YYYY-MM-DD");
|
|
1017
|
+
var AgeValue = z13.object({
|
|
1018
|
+
age: z13.number(),
|
|
1019
|
+
asOfDateRef: z13.string()
|
|
913
1020
|
});
|
|
914
1021
|
var AgeUpdateValue = AgeValue.optional().nullable();
|
|
915
|
-
var AutocompleteValue =
|
|
916
|
-
label:
|
|
917
|
-
value:
|
|
1022
|
+
var AutocompleteValue = z13.object({
|
|
1023
|
+
label: z13.string(),
|
|
1024
|
+
value: z13.string()
|
|
918
1025
|
});
|
|
919
1026
|
var AutocompleteUpdateValue = AutocompleteValue.optional().nullable();
|
|
920
|
-
var TimeValue =
|
|
921
|
-
var DatetimeValue =
|
|
922
|
-
var SelectDateRangeValue =
|
|
1027
|
+
var TimeValue = z13.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/);
|
|
1028
|
+
var DatetimeValue = z13.iso.datetime();
|
|
1029
|
+
var SelectDateRangeValue = z13.enum([
|
|
923
1030
|
"last7Days",
|
|
924
1031
|
"last30Days",
|
|
925
1032
|
"last90Days",
|
|
926
1033
|
"last365Days"
|
|
927
1034
|
]);
|
|
928
|
-
var DateRangeFieldValue =
|
|
1035
|
+
var DateRangeFieldValue = z13.object({
|
|
929
1036
|
start: PlainDate,
|
|
930
1037
|
end: PlainDate
|
|
931
1038
|
}).or(PlainDate).describe(
|
|
932
1039
|
"Date range with start and end dates in the format YYYY-MM-DD. Inclusive start, exclusive end."
|
|
933
1040
|
);
|
|
934
|
-
var EmailValue =
|
|
935
|
-
var CheckboxFieldValue =
|
|
936
|
-
var NumberFieldValue =
|
|
1041
|
+
var EmailValue = z13.email();
|
|
1042
|
+
var CheckboxFieldValue = z13.boolean();
|
|
1043
|
+
var NumberFieldValue = z13.number();
|
|
937
1044
|
var SignatureFieldValue = FileFieldValue;
|
|
938
|
-
var ButtonFieldValue =
|
|
939
|
-
var VerificationStatusValue =
|
|
1045
|
+
var ButtonFieldValue = z13.number();
|
|
1046
|
+
var VerificationStatusValue = z13.enum([
|
|
940
1047
|
"verified",
|
|
941
1048
|
"authenticated",
|
|
942
1049
|
"failed",
|
|
943
1050
|
"pending"
|
|
944
1051
|
]);
|
|
945
|
-
var LeafFieldValues =
|
|
1052
|
+
var LeafFieldValues = z13.union([
|
|
946
1053
|
AddressFieldValue,
|
|
947
1054
|
TextValue,
|
|
948
1055
|
PlainDate,
|
|
@@ -968,11 +1075,11 @@ var LeafFieldValues = z12.union([
|
|
|
968
1075
|
AutocompleteValue,
|
|
969
1076
|
AutocompleteUpdateValue
|
|
970
1077
|
]);
|
|
971
|
-
var FieldGroupValue =
|
|
972
|
-
var DataFieldValue =
|
|
973
|
-
data:
|
|
1078
|
+
var FieldGroupValue = z13.record(z13.string(), LeafFieldValues);
|
|
1079
|
+
var DataFieldValue = z13.object({
|
|
1080
|
+
data: z13.record(z13.string(), LeafFieldValues)
|
|
974
1081
|
}).nullish();
|
|
975
|
-
var FieldValue =
|
|
1082
|
+
var FieldValue = z13.union([
|
|
976
1083
|
LeafFieldValues,
|
|
977
1084
|
DataFieldValue,
|
|
978
1085
|
FieldGroupValue
|
|
@@ -1006,7 +1113,7 @@ function safeUnion(schemas) {
|
|
|
1006
1113
|
const sortedSchemas = [...schemas].sort(
|
|
1007
1114
|
(a, b) => schemaPriority(a) - schemaPriority(b)
|
|
1008
1115
|
);
|
|
1009
|
-
return
|
|
1116
|
+
return z13.any().superRefine((val, ctx) => {
|
|
1010
1117
|
for (const schema of sortedSchemas) {
|
|
1011
1118
|
if (schema.safeParse(val).success) {
|
|
1012
1119
|
return;
|
|
@@ -1045,9 +1152,9 @@ var FieldUpdateValue = safeUnion([
|
|
|
1045
1152
|
]);
|
|
1046
1153
|
|
|
1047
1154
|
// ../commons/src/events/serializers/user/serializer.ts
|
|
1048
|
-
var
|
|
1049
|
-
var SerializedUserField =
|
|
1050
|
-
$userField:
|
|
1155
|
+
var z14 = __toESM(require("zod/v4"));
|
|
1156
|
+
var SerializedUserField = z14.object({
|
|
1157
|
+
$userField: z14.enum([
|
|
1051
1158
|
"id",
|
|
1052
1159
|
"name",
|
|
1053
1160
|
"role",
|
|
@@ -1061,7 +1168,7 @@ var SerializedUserField = z13.object({
|
|
|
1061
1168
|
"primaryOfficeId",
|
|
1062
1169
|
"administrativeAreaId"
|
|
1063
1170
|
]),
|
|
1064
|
-
$location:
|
|
1171
|
+
$location: z14.string().optional()
|
|
1065
1172
|
});
|
|
1066
1173
|
function userSerializer(userField) {
|
|
1067
1174
|
return {
|
|
@@ -1087,27 +1194,22 @@ var import_v4 = require("zod/v4");
|
|
|
1087
1194
|
var z16 = __toESM(require("zod/v4"));
|
|
1088
1195
|
|
|
1089
1196
|
// ../commons/src/events/ActionDocument.ts
|
|
1090
|
-
var
|
|
1091
|
-
var ActionUpdate =
|
|
1197
|
+
var z15 = __toESM(require("zod/v4"));
|
|
1198
|
+
var ActionUpdate = z15.record(z15.string(), FieldUpdateValue).describe(
|
|
1092
1199
|
"Record of field-level changes made by an action. Supports partial updates and nullable values."
|
|
1093
1200
|
);
|
|
1094
|
-
var EventState =
|
|
1201
|
+
var EventState = z15.record(z15.string(), FieldValue).describe(
|
|
1095
1202
|
"Aggregate representation of event data after all actions have been applied, with all updates consolidated and null values removed."
|
|
1096
1203
|
);
|
|
1097
|
-
var
|
|
1098
|
-
Requested: "Requested",
|
|
1099
|
-
Accepted: "Accepted",
|
|
1100
|
-
Rejected: "Rejected"
|
|
1101
|
-
};
|
|
1102
|
-
var ActionBase = z14.object({
|
|
1204
|
+
var ActionBase = z15.object({
|
|
1103
1205
|
id: UUID.describe("Unique identifier of the action."),
|
|
1104
|
-
transactionId:
|
|
1206
|
+
transactionId: z15.string().describe("Unique identifier of the transaction."),
|
|
1105
1207
|
createdByUserType: TokenUserType.describe(
|
|
1106
1208
|
"Indicates whether the action was created by a human-user or by a system-user."
|
|
1107
1209
|
),
|
|
1108
|
-
createdAt:
|
|
1109
|
-
createdBy:
|
|
1110
|
-
createdByRole:
|
|
1210
|
+
createdAt: z15.string().datetime().describe("Timestamp indicating when the action was created."),
|
|
1211
|
+
createdBy: z15.string().describe("Identifier of the user who created the action."),
|
|
1212
|
+
createdByRole: z15.string().optional().describe("Role of the user who created the action."),
|
|
1111
1213
|
createdBySignature: DocumentPath.nullish().describe(
|
|
1112
1214
|
"Reference to the signature of the user who created the action."
|
|
1113
1215
|
),
|
|
@@ -1119,7 +1221,7 @@ var ActionBase = z14.object({
|
|
|
1119
1221
|
"Declaration data defined by the ActionConfig. Supports partial updates."
|
|
1120
1222
|
),
|
|
1121
1223
|
annotation: ActionUpdate.optional().nullable().describe("Action-specific metadata used to annotate the event."),
|
|
1122
|
-
status:
|
|
1224
|
+
status: z15.enum([
|
|
1123
1225
|
ActionStatus.Requested,
|
|
1124
1226
|
ActionStatus.Accepted,
|
|
1125
1227
|
ActionStatus.Rejected
|
|
@@ -1131,139 +1233,139 @@ var ActionBase = z14.object({
|
|
|
1131
1233
|
)
|
|
1132
1234
|
});
|
|
1133
1235
|
var AssignedAction = ActionBase.extend(
|
|
1134
|
-
|
|
1135
|
-
type:
|
|
1136
|
-
assignedTo:
|
|
1236
|
+
z15.object({
|
|
1237
|
+
type: z15.literal(ActionType.ASSIGN),
|
|
1238
|
+
assignedTo: z15.string().describe("Identifier of the user to whom the action is assigned.")
|
|
1137
1239
|
// TODO move into 'content' property
|
|
1138
1240
|
}).shape
|
|
1139
1241
|
);
|
|
1140
1242
|
var UnassignedAction = ActionBase.extend(
|
|
1141
|
-
|
|
1142
|
-
type:
|
|
1243
|
+
z15.object({
|
|
1244
|
+
type: z15.literal(ActionType.UNASSIGN)
|
|
1143
1245
|
}).shape
|
|
1144
1246
|
);
|
|
1145
1247
|
var RegisterAction = ActionBase.extend(
|
|
1146
|
-
|
|
1147
|
-
type:
|
|
1148
|
-
registrationNumber:
|
|
1248
|
+
z15.object({
|
|
1249
|
+
type: z15.literal(ActionType.REGISTER),
|
|
1250
|
+
registrationNumber: z15.string().optional().describe(
|
|
1149
1251
|
"Registration number of the event. Always present for accepted registrations."
|
|
1150
1252
|
)
|
|
1151
1253
|
// TODO move into 'content' property
|
|
1152
1254
|
}).shape
|
|
1153
1255
|
);
|
|
1154
1256
|
var DeclareAction = ActionBase.extend(
|
|
1155
|
-
|
|
1156
|
-
type:
|
|
1257
|
+
z15.object({
|
|
1258
|
+
type: z15.literal(ActionType.DECLARE)
|
|
1157
1259
|
}).shape
|
|
1158
1260
|
);
|
|
1159
|
-
var ReasonContent =
|
|
1160
|
-
reason:
|
|
1261
|
+
var ReasonContent = z15.object({
|
|
1262
|
+
reason: z15.string().min(1, { error: "Message cannot be empty" }).describe(
|
|
1161
1263
|
"Message describing the reason for rejecting or archiving the event."
|
|
1162
1264
|
)
|
|
1163
1265
|
});
|
|
1164
1266
|
var RejectAction = ActionBase.extend(
|
|
1165
|
-
|
|
1166
|
-
type:
|
|
1267
|
+
z15.object({
|
|
1268
|
+
type: z15.literal(ActionType.REJECT),
|
|
1167
1269
|
content: ReasonContent
|
|
1168
1270
|
}).shape
|
|
1169
1271
|
);
|
|
1170
|
-
var PotentialDuplicate =
|
|
1272
|
+
var PotentialDuplicate = z15.object({
|
|
1171
1273
|
id: UUID,
|
|
1172
|
-
trackingId:
|
|
1274
|
+
trackingId: z15.string()
|
|
1173
1275
|
});
|
|
1174
1276
|
var DuplicateDetectedAction = ActionBase.extend(
|
|
1175
|
-
|
|
1176
|
-
type:
|
|
1177
|
-
content:
|
|
1178
|
-
duplicates:
|
|
1277
|
+
z15.object({
|
|
1278
|
+
type: z15.literal(ActionType.DUPLICATE_DETECTED),
|
|
1279
|
+
content: z15.object({
|
|
1280
|
+
duplicates: z15.array(PotentialDuplicate)
|
|
1179
1281
|
})
|
|
1180
1282
|
}).shape
|
|
1181
1283
|
);
|
|
1182
1284
|
var MarkNotDuplicateAction = ActionBase.extend(
|
|
1183
|
-
|
|
1184
|
-
type:
|
|
1285
|
+
z15.object({
|
|
1286
|
+
type: z15.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
1185
1287
|
}).shape
|
|
1186
1288
|
);
|
|
1187
1289
|
var MarkAsDuplicateAction = ActionBase.extend(
|
|
1188
|
-
|
|
1189
|
-
type:
|
|
1190
|
-
content:
|
|
1290
|
+
z15.object({
|
|
1291
|
+
type: z15.literal(ActionType.MARK_AS_DUPLICATE),
|
|
1292
|
+
content: z15.object({
|
|
1191
1293
|
duplicateOf: UUID
|
|
1192
1294
|
}).optional()
|
|
1193
1295
|
}).shape
|
|
1194
1296
|
);
|
|
1195
1297
|
var ArchiveAction = ActionBase.extend(
|
|
1196
|
-
|
|
1197
|
-
type:
|
|
1298
|
+
z15.object({
|
|
1299
|
+
type: z15.literal(ActionType.ARCHIVE),
|
|
1198
1300
|
content: ReasonContent
|
|
1199
1301
|
}).shape
|
|
1200
1302
|
);
|
|
1201
1303
|
var UnarchiveAction = ActionBase.extend(
|
|
1202
|
-
|
|
1203
|
-
type:
|
|
1304
|
+
z15.object({
|
|
1305
|
+
type: z15.literal(ActionType.UNARCHIVE)
|
|
1204
1306
|
}).shape
|
|
1205
1307
|
);
|
|
1206
1308
|
var CreatedAction = ActionBase.extend(
|
|
1207
|
-
|
|
1208
|
-
type:
|
|
1309
|
+
z15.object({
|
|
1310
|
+
type: z15.literal(ActionType.CREATE)
|
|
1209
1311
|
}).shape
|
|
1210
1312
|
);
|
|
1211
1313
|
var NotifiedAction = ActionBase.extend(
|
|
1212
|
-
|
|
1213
|
-
type:
|
|
1314
|
+
z15.object({
|
|
1315
|
+
type: z15.literal(ActionType.NOTIFY)
|
|
1214
1316
|
}).shape
|
|
1215
1317
|
);
|
|
1216
1318
|
var EditAction = ActionBase.extend(
|
|
1217
|
-
|
|
1218
|
-
type:
|
|
1319
|
+
z15.object({
|
|
1320
|
+
type: z15.literal(ActionType.EDIT),
|
|
1219
1321
|
/** @deprecated New Edit-actions should no longer contain content. This is kept for old 2.0 edits. */
|
|
1220
|
-
content:
|
|
1221
|
-
comment:
|
|
1322
|
+
content: z15.object({
|
|
1323
|
+
comment: z15.string().describe("Comment for the edit action.").optional()
|
|
1222
1324
|
}).optional()
|
|
1223
1325
|
}).shape
|
|
1224
1326
|
);
|
|
1225
|
-
var PrintContent =
|
|
1226
|
-
templateId:
|
|
1327
|
+
var PrintContent = z15.object({
|
|
1328
|
+
templateId: z15.string().optional()
|
|
1227
1329
|
});
|
|
1228
1330
|
var PrintCertificateAction = ActionBase.extend(
|
|
1229
|
-
|
|
1230
|
-
type:
|
|
1331
|
+
z15.object({
|
|
1332
|
+
type: z15.literal(ActionType.PRINT_CERTIFICATE),
|
|
1231
1333
|
content: PrintContent.optional().nullable()
|
|
1232
1334
|
}).shape
|
|
1233
1335
|
);
|
|
1234
1336
|
var RequestedCorrectionAction = ActionBase.extend(
|
|
1235
|
-
|
|
1236
|
-
type:
|
|
1337
|
+
z15.object({
|
|
1338
|
+
type: z15.literal(ActionType.REQUEST_CORRECTION)
|
|
1237
1339
|
}).shape
|
|
1238
1340
|
);
|
|
1239
1341
|
var ApprovedCorrectionAction = ActionBase.extend(
|
|
1240
|
-
|
|
1241
|
-
type:
|
|
1242
|
-
requestId:
|
|
1342
|
+
z15.object({
|
|
1343
|
+
type: z15.literal(ActionType.APPROVE_CORRECTION),
|
|
1344
|
+
requestId: z15.string(),
|
|
1243
1345
|
// TODO move into 'content' property
|
|
1244
|
-
content:
|
|
1346
|
+
content: z15.object({ immediateCorrection: z15.boolean().optional() }).optional()
|
|
1245
1347
|
}).shape
|
|
1246
1348
|
);
|
|
1247
1349
|
var RejectedCorrectionAction = ActionBase.extend(
|
|
1248
|
-
|
|
1249
|
-
type:
|
|
1250
|
-
requestId:
|
|
1350
|
+
z15.object({
|
|
1351
|
+
type: z15.literal(ActionType.REJECT_CORRECTION),
|
|
1352
|
+
requestId: z15.string(),
|
|
1251
1353
|
// TODO move into 'content' property
|
|
1252
1354
|
content: ReasonContent
|
|
1253
1355
|
}).shape
|
|
1254
1356
|
);
|
|
1255
1357
|
var ReadAction = ActionBase.extend(
|
|
1256
|
-
|
|
1257
|
-
type:
|
|
1358
|
+
z15.object({
|
|
1359
|
+
type: z15.literal(ActionType.READ)
|
|
1258
1360
|
}).shape
|
|
1259
1361
|
);
|
|
1260
1362
|
var CustomAction = ActionBase.merge(
|
|
1261
|
-
|
|
1262
|
-
type:
|
|
1263
|
-
customActionType:
|
|
1363
|
+
z15.object({
|
|
1364
|
+
type: z15.literal(ActionType.CUSTOM),
|
|
1365
|
+
customActionType: z15.string()
|
|
1264
1366
|
})
|
|
1265
1367
|
);
|
|
1266
|
-
var ActionDocument =
|
|
1368
|
+
var ActionDocument = z15.discriminatedUnion("type", [
|
|
1267
1369
|
CreatedAction.meta({ id: "CreatedAction" }),
|
|
1268
1370
|
RejectAction.meta({ id: "RejectAction" }),
|
|
1269
1371
|
DuplicateDetectedAction.meta({ id: "DuplicateDetectedAction" }),
|
|
@@ -1290,64 +1392,12 @@ var AsyncRejectActionDocument = ActionBase.omit({
|
|
|
1290
1392
|
declaration: true,
|
|
1291
1393
|
annotation: true
|
|
1292
1394
|
}).extend(
|
|
1293
|
-
|
|
1294
|
-
type:
|
|
1295
|
-
status:
|
|
1395
|
+
z15.object({
|
|
1396
|
+
type: z15.enum(ConfirmableActions),
|
|
1397
|
+
status: z15.literal(ActionStatus.Rejected)
|
|
1296
1398
|
}).shape
|
|
1297
1399
|
);
|
|
1298
|
-
var Action =
|
|
1299
|
-
|
|
1300
|
-
// ../commons/src/events/Flag.ts
|
|
1301
|
-
var z15 = __toESM(require("zod/v4"));
|
|
1302
|
-
var InherentFlags = {
|
|
1303
|
-
INCOMPLETE: "incomplete",
|
|
1304
|
-
REJECTED: "rejected",
|
|
1305
|
-
CORRECTION_REQUESTED: "correction-requested",
|
|
1306
|
-
POTENTIAL_DUPLICATE: "potential-duplicate",
|
|
1307
|
-
/**
|
|
1308
|
-
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
1309
|
-
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
1310
|
-
*
|
|
1311
|
-
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
1312
|
-
*/
|
|
1313
|
-
EDIT_IN_PROGRESS: "edit-in-progress"
|
|
1314
|
-
};
|
|
1315
|
-
var ActionFlag = z15.string().regex(
|
|
1316
|
-
new RegExp(
|
|
1317
|
-
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
1318
|
-
ActionStatus
|
|
1319
|
-
).join("|").toLowerCase()})$`
|
|
1320
|
-
),
|
|
1321
|
-
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
1322
|
-
);
|
|
1323
|
-
var CustomFlag = z15.string().refine((val) => !Object.values(InherentFlags).includes(val), {
|
|
1324
|
-
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
1325
|
-
InherentFlags
|
|
1326
|
-
).join(", ")}`
|
|
1327
|
-
}).refine((val) => !ActionFlag.safeParse(val).success, {
|
|
1328
|
-
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
1329
|
-
}).describe("Custom flag identifier defined by the country config.");
|
|
1330
|
-
var Flag = ActionFlag.or(z15.enum(InherentFlags)).or(CustomFlag);
|
|
1331
|
-
var FlagConfig = z15.object({
|
|
1332
|
-
id: CustomFlag,
|
|
1333
|
-
requiresAction: z15.boolean().describe(
|
|
1334
|
-
"Indicates if this flag expects an action to be performed to be cleared."
|
|
1335
|
-
),
|
|
1336
|
-
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1337
|
-
}).meta({
|
|
1338
|
-
id: "FlagConfig",
|
|
1339
|
-
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
1340
|
-
});
|
|
1341
|
-
var ActionFlagConfig = z15.object({
|
|
1342
|
-
id: Flag,
|
|
1343
|
-
operation: z15.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
1344
|
-
conditional: Conditional.optional().describe(
|
|
1345
|
-
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1346
|
-
)
|
|
1347
|
-
}).meta({
|
|
1348
|
-
id: "ActionFlagConfig",
|
|
1349
|
-
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
1350
|
-
});
|
|
1400
|
+
var Action = z15.union([ActionDocument, AsyncRejectActionDocument]);
|
|
1351
1401
|
|
|
1352
1402
|
// ../commons/src/events/EventMetadata.ts
|
|
1353
1403
|
var EventStatus = z16.enum([
|
|
@@ -1505,13 +1555,6 @@ var Range = import_v4.z.object({
|
|
|
1505
1555
|
}).meta({
|
|
1506
1556
|
id: "Range"
|
|
1507
1557
|
});
|
|
1508
|
-
var ContainsFlags = import_v4.z.object({
|
|
1509
|
-
anyOf: import_v4.z.array(Flag).optional(),
|
|
1510
|
-
noneOf: import_v4.z.array(Flag).optional(),
|
|
1511
|
-
allOf: import_v4.z.array(Flag).optional()
|
|
1512
|
-
}).meta({
|
|
1513
|
-
id: "ContainsFlags"
|
|
1514
|
-
});
|
|
1515
1558
|
var Within = import_v4.z.object({ type: import_v4.z.literal("within"), location: import_v4.z.string() }).meta({
|
|
1516
1559
|
id: "Within"
|
|
1517
1560
|
});
|
|
@@ -2984,7 +3027,7 @@ var LanguageConfig = z26.object({
|
|
|
2984
3027
|
});
|
|
2985
3028
|
|
|
2986
3029
|
// ../commons/src/events/EventConfig.ts
|
|
2987
|
-
var
|
|
3030
|
+
var z34 = __toESM(require("zod/v4"));
|
|
2988
3031
|
|
|
2989
3032
|
// ../commons/src/events/SummaryConfig.ts
|
|
2990
3033
|
var z27 = __toESM(require("zod/v4"));
|
|
@@ -3144,162 +3187,145 @@ var AdvancedSearchConfig = z28.object({
|
|
|
3144
3187
|
description: "Configuration of one advanced search tab. Each tab has a title and a list of searchable fields \u2014 either declaration fields (via `field()`) or event metadata (via `event()`)."
|
|
3145
3188
|
});
|
|
3146
3189
|
|
|
3147
|
-
// ../commons/src/
|
|
3148
|
-
var import_lodash = require("lodash");
|
|
3149
|
-
|
|
3150
|
-
// ../commons/src/conditionals/validate.ts
|
|
3151
|
-
var import__ = __toESM(require("ajv/dist/2019"));
|
|
3152
|
-
var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
3153
|
-
var z31 = __toESM(require("zod/v4"));
|
|
3154
|
-
var import_date_fns = require("date-fns");
|
|
3155
|
-
|
|
3156
|
-
// ../commons/src/events/FieldTypeMapping.ts
|
|
3157
|
-
var z30 = __toESM(require("zod/v4"));
|
|
3158
|
-
|
|
3159
|
-
// ../commons/src/events/DynamicFieldValue.ts
|
|
3190
|
+
// ../commons/src/icons.ts
|
|
3160
3191
|
var z29 = __toESM(require("zod/v4"));
|
|
3192
|
+
var AvailableIcons = z29.enum([
|
|
3193
|
+
"Archived",
|
|
3194
|
+
"Assigned",
|
|
3195
|
+
"Briefcase",
|
|
3196
|
+
"Certified",
|
|
3197
|
+
"Close",
|
|
3198
|
+
"Collapse",
|
|
3199
|
+
"Draft",
|
|
3200
|
+
"DuplicateYellow",
|
|
3201
|
+
"Expand",
|
|
3202
|
+
"ExternalValidate",
|
|
3203
|
+
"FilledCheck",
|
|
3204
|
+
"InReview",
|
|
3205
|
+
"Offline",
|
|
3206
|
+
"Registered",
|
|
3207
|
+
"RequiresUpdates",
|
|
3208
|
+
"Sent",
|
|
3209
|
+
"Validated",
|
|
3210
|
+
"WaitingApproval",
|
|
3211
|
+
"ChartActivity",
|
|
3212
|
+
"Activity",
|
|
3213
|
+
"Archive",
|
|
3214
|
+
"ArchiveTray",
|
|
3215
|
+
"ArrowLeft",
|
|
3216
|
+
"ArrowRight",
|
|
3217
|
+
"Buildings",
|
|
3218
|
+
"Circle",
|
|
3219
|
+
"CaretDown",
|
|
3220
|
+
"CaretLeft",
|
|
3221
|
+
"CaretRight",
|
|
3222
|
+
"ChartBar",
|
|
3223
|
+
"ChartLine",
|
|
3224
|
+
"ChatCircle",
|
|
3225
|
+
"CheckSquare",
|
|
3226
|
+
"Compass",
|
|
3227
|
+
"Check",
|
|
3228
|
+
"Copy",
|
|
3229
|
+
"Database",
|
|
3230
|
+
"DotsThreeVertical",
|
|
3231
|
+
"ArrowCounterClockwise",
|
|
3232
|
+
"MagnifyingGlassMinus",
|
|
3233
|
+
"MagnifyingGlassPlus",
|
|
3234
|
+
"Export",
|
|
3235
|
+
"Eye",
|
|
3236
|
+
"EyeSlash",
|
|
3237
|
+
"Envelope",
|
|
3238
|
+
"File",
|
|
3239
|
+
"FileLock",
|
|
3240
|
+
"FileSearch",
|
|
3241
|
+
"FileMinus",
|
|
3242
|
+
"FilePlus",
|
|
3243
|
+
"FileText",
|
|
3244
|
+
"FileX",
|
|
3245
|
+
"Handshake",
|
|
3246
|
+
"Gear",
|
|
3247
|
+
"GitBranch",
|
|
3248
|
+
"IdentificationCard",
|
|
3249
|
+
"List",
|
|
3250
|
+
"ListBullets",
|
|
3251
|
+
"Lock",
|
|
3252
|
+
"MagnifyingGlass",
|
|
3253
|
+
"MapPin",
|
|
3254
|
+
"Medal",
|
|
3255
|
+
"NotePencil",
|
|
3256
|
+
"Paperclip",
|
|
3257
|
+
"PaperPlaneTilt",
|
|
3258
|
+
"Pen",
|
|
3259
|
+
"PenNib",
|
|
3260
|
+
"Pencil",
|
|
3261
|
+
"PencilSimpleLine",
|
|
3262
|
+
"Phone",
|
|
3263
|
+
"Plus",
|
|
3264
|
+
"Printer",
|
|
3265
|
+
"SignOut",
|
|
3266
|
+
"Stamp",
|
|
3267
|
+
"Star",
|
|
3268
|
+
"Target",
|
|
3269
|
+
"TextT",
|
|
3270
|
+
"Trash",
|
|
3271
|
+
"UploadSimple",
|
|
3272
|
+
"User",
|
|
3273
|
+
"UserPlus",
|
|
3274
|
+
"Users",
|
|
3275
|
+
"WarningCircle",
|
|
3276
|
+
"X",
|
|
3277
|
+
"ChatText",
|
|
3278
|
+
"CircleWavyCheck",
|
|
3279
|
+
"CircleWavyQuestion",
|
|
3280
|
+
"ArchiveBox",
|
|
3281
|
+
"ArrowCircleDown",
|
|
3282
|
+
"FileArrowUp",
|
|
3283
|
+
"FileDotted",
|
|
3284
|
+
"Files",
|
|
3285
|
+
"PencilLine",
|
|
3286
|
+
"PencilCircle",
|
|
3287
|
+
"UserCircle",
|
|
3288
|
+
"Clock",
|
|
3289
|
+
"QrCode",
|
|
3290
|
+
"Webcam",
|
|
3291
|
+
"Sun",
|
|
3292
|
+
"DeviceTabletCamera",
|
|
3293
|
+
"Globe",
|
|
3294
|
+
"Fingerprint",
|
|
3295
|
+
"PushPin",
|
|
3296
|
+
"Timer"
|
|
3297
|
+
]);
|
|
3298
|
+
|
|
3299
|
+
// ../commons/src/events/utils.ts
|
|
3300
|
+
var import_lodash4 = require("lodash");
|
|
3301
|
+
|
|
3302
|
+
// ../commons/src/conditionals/validate.ts
|
|
3303
|
+
var import__ = __toESM(require("ajv/dist/2019"));
|
|
3304
|
+
var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
3305
|
+
var z33 = __toESM(require("zod/v4"));
|
|
3306
|
+
var import_date_fns2 = require("date-fns");
|
|
3307
|
+
|
|
3308
|
+
// ../commons/src/events/FieldTypeMapping.ts
|
|
3309
|
+
var z31 = __toESM(require("zod/v4"));
|
|
3310
|
+
|
|
3311
|
+
// ../commons/src/events/DynamicFieldValue.ts
|
|
3312
|
+
var z30 = __toESM(require("zod/v4"));
|
|
3313
|
+
|
|
3314
|
+
// ../commons/src/events/state/index.ts
|
|
3315
|
+
var import_lodash3 = require("lodash");
|
|
3161
3316
|
|
|
3162
|
-
// ../commons/src/conditionals/validate.ts
|
|
3163
|
-
var ajv = new import__.default({
|
|
3164
|
-
$data: true,
|
|
3165
|
-
allowUnionTypes: true,
|
|
3166
|
-
strict: false
|
|
3167
|
-
// Allow minContains and other newer features
|
|
3168
|
-
});
|
|
3169
|
-
var DataContext = z31.object({
|
|
3170
|
-
rootData: z31.object({
|
|
3171
|
-
$leafAdminStructureLocationIds: z31.array(z31.object({ id: UUID }))
|
|
3172
|
-
})
|
|
3173
|
-
});
|
|
3174
|
-
function resolveDataPath(rootData, dataPath, instancePath) {
|
|
3175
|
-
const pathParts = dataPath.split("/");
|
|
3176
|
-
const levels = parseInt(pathParts[0], 10);
|
|
3177
|
-
const referencePath = pathParts.slice(1);
|
|
3178
|
-
const instanceParts = instancePath.split("/").filter(Boolean);
|
|
3179
|
-
const traversedParts = instanceParts.slice(0, -levels);
|
|
3180
|
-
let current = rootData;
|
|
3181
|
-
for (const part of traversedParts) {
|
|
3182
|
-
if (current === null || current === void 0) {
|
|
3183
|
-
return void 0;
|
|
3184
|
-
}
|
|
3185
|
-
current = current[part];
|
|
3186
|
-
}
|
|
3187
|
-
for (const part of referencePath) {
|
|
3188
|
-
if (current === null || current === void 0) {
|
|
3189
|
-
return void 0;
|
|
3190
|
-
}
|
|
3191
|
-
current = current[part];
|
|
3192
|
-
}
|
|
3193
|
-
return current;
|
|
3194
|
-
}
|
|
3195
|
-
function todayISO() {
|
|
3196
|
-
return (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
|
|
3197
|
-
}
|
|
3198
|
-
var compiledFunctionCache = /* @__PURE__ */ new Map();
|
|
3199
|
-
function compileClientFunction(code) {
|
|
3200
|
-
let fn = compiledFunctionCache.get(code);
|
|
3201
|
-
if (!fn) {
|
|
3202
|
-
fn = new Function(`return (${code})`)();
|
|
3203
|
-
compiledFunctionCache.set(code, fn);
|
|
3204
|
-
}
|
|
3205
|
-
return fn;
|
|
3206
|
-
}
|
|
3207
|
-
(0, import_ajv_formats.default)(ajv);
|
|
3208
|
-
function buildClientFunctionContext(input) {
|
|
3209
|
-
return {
|
|
3210
|
-
$form: input.form,
|
|
3211
|
-
$now: todayISO(),
|
|
3212
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
3213
|
-
$online: isOnline(),
|
|
3214
|
-
$user: input.validatorContext?.user,
|
|
3215
|
-
$event: input.validatorContext?.event,
|
|
3216
|
-
$leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
|
|
3217
|
-
user: input.systemVariables?.user,
|
|
3218
|
-
$window: input.systemVariables?.$window,
|
|
3219
|
-
locations: input.locations,
|
|
3220
|
-
adminLevelIds: input.adminLevelIds
|
|
3221
|
-
};
|
|
3222
|
-
}
|
|
3223
|
-
function runClientFunction(code, data, context) {
|
|
3224
|
-
return compileClientFunction(code)(data, context);
|
|
3225
|
-
}
|
|
3226
|
-
ajv.addKeyword({
|
|
3227
|
-
keyword: "daysFromDate",
|
|
3228
|
-
type: "string",
|
|
3229
|
-
schemaType: "object",
|
|
3230
|
-
$data: true,
|
|
3231
|
-
errors: true,
|
|
3232
|
-
validate(schema, data, _2, dataContext) {
|
|
3233
|
-
if (!(dataContext && dataContext.rootData && typeof dataContext.rootData === "object" && "$now" in dataContext.rootData && typeof dataContext.rootData.$now === "string")) {
|
|
3234
|
-
throw new Error("Validation context must contain $now");
|
|
3235
|
-
}
|
|
3236
|
-
const { days, clause } = schema;
|
|
3237
|
-
if (typeof data !== "string") {
|
|
3238
|
-
return false;
|
|
3239
|
-
}
|
|
3240
|
-
const date = new Date(data);
|
|
3241
|
-
if (isNaN(date.getTime())) {
|
|
3242
|
-
return false;
|
|
3243
|
-
}
|
|
3244
|
-
let referenceDate = schema.referenceDate;
|
|
3245
|
-
if (referenceDate && typeof referenceDate === "object" && "$data" in referenceDate) {
|
|
3246
|
-
referenceDate = resolveDataPath(
|
|
3247
|
-
dataContext.rootData,
|
|
3248
|
-
referenceDate.$data,
|
|
3249
|
-
dataContext.instancePath
|
|
3250
|
-
);
|
|
3251
|
-
}
|
|
3252
|
-
if (!referenceDate) {
|
|
3253
|
-
referenceDate = dataContext.rootData.$now;
|
|
3254
|
-
}
|
|
3255
|
-
const baseDate = new Date(referenceDate);
|
|
3256
|
-
if (isNaN(baseDate.getTime())) {
|
|
3257
|
-
return false;
|
|
3258
|
-
}
|
|
3259
|
-
const offsetDate = new Date(baseDate.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
3260
|
-
return clause === "after" ? (0, import_date_fns.isAfter)(date, offsetDate) : (0, import_date_fns.isBefore)(date, offsetDate);
|
|
3261
|
-
}
|
|
3262
|
-
});
|
|
3263
|
-
ajv.addKeyword({
|
|
3264
|
-
keyword: "isLeafLevelLocation",
|
|
3265
|
-
type: "string",
|
|
3266
|
-
schemaType: "boolean",
|
|
3267
|
-
$data: true,
|
|
3268
|
-
errors: true,
|
|
3269
|
-
// @ts-ignore -- Force type. We will move this away from AJV next. Parsing the array will take seconds and is only called by core.
|
|
3270
|
-
validate(_schema, data, _2, dataContext) {
|
|
3271
|
-
const locationIdInput = data;
|
|
3272
|
-
const locations = dataContext?.rootData.$leafAdminStructureLocationIds ?? [];
|
|
3273
|
-
return locations.some((location) => location.id === locationIdInput);
|
|
3274
|
-
}
|
|
3275
|
-
});
|
|
3276
|
-
ajv.addKeyword({
|
|
3277
|
-
keyword: "customClientValidator",
|
|
3278
|
-
schemaType: "object",
|
|
3279
|
-
errors: true,
|
|
3280
|
-
// @ts-expect-error -- AJV's public types don't expose `rootData`. All
|
|
3281
|
-
// `validate()` callers build root data via `buildClientFunctionContext`,
|
|
3282
|
-
// so the cast holds.
|
|
3283
|
-
validate(schema, data, _2, dataContext) {
|
|
3284
|
-
return Boolean(
|
|
3285
|
-
runClientFunction(
|
|
3286
|
-
schema.code,
|
|
3287
|
-
data,
|
|
3288
|
-
dataContext?.rootData ?? buildClientFunctionContext({ form: {} })
|
|
3289
|
-
)
|
|
3290
|
-
);
|
|
3291
|
-
}
|
|
3292
|
-
});
|
|
3293
|
-
function isOnline() {
|
|
3294
|
-
if (typeof window !== "undefined" && typeof navigator !== "undefined") {
|
|
3295
|
-
return navigator.onLine;
|
|
3296
|
-
}
|
|
3297
|
-
return true;
|
|
3298
|
-
}
|
|
3299
|
-
|
|
3300
3317
|
// ../commons/src/utils.ts
|
|
3301
3318
|
var z32 = __toESM(require("zod/v4"));
|
|
3302
3319
|
var _ = __toESM(require("lodash"));
|
|
3320
|
+
function getOrThrow(x, message) {
|
|
3321
|
+
if (x === void 0 || x === null) {
|
|
3322
|
+
throw new Error(message);
|
|
3323
|
+
}
|
|
3324
|
+
return x;
|
|
3325
|
+
}
|
|
3326
|
+
function joinValues(values, separator = " ") {
|
|
3327
|
+
return values.filter((value) => !!value).join(separator).trim();
|
|
3328
|
+
}
|
|
3303
3329
|
var FullNameV1 = z32.array(
|
|
3304
3330
|
z32.object({
|
|
3305
3331
|
use: z32.string(),
|
|
@@ -3322,37 +3348,263 @@ function omitKeyDeep(obj, keyToRemove) {
|
|
|
3322
3348
|
}
|
|
3323
3349
|
return newObj;
|
|
3324
3350
|
}
|
|
3325
|
-
|
|
3326
|
-
// ../commons/src/events/utils.ts
|
|
3327
|
-
var
|
|
3328
|
-
function
|
|
3329
|
-
|
|
3351
|
+
|
|
3352
|
+
// ../commons/src/events/state/utils.ts
|
|
3353
|
+
var import_lodash = require("lodash");
|
|
3354
|
+
function getActionRequests(actionType, actions) {
|
|
3355
|
+
const filtered = actions.filter((action) => action.type === actionType).reverse();
|
|
3356
|
+
const accept = filtered.find(
|
|
3357
|
+
(action) => action.status === ActionStatus.Accepted
|
|
3358
|
+
);
|
|
3359
|
+
const request = filtered.find(
|
|
3360
|
+
(action) => action.status === ActionStatus.Requested
|
|
3361
|
+
);
|
|
3362
|
+
const reject = filtered.find(
|
|
3363
|
+
(action) => action.status === ActionStatus.Rejected
|
|
3364
|
+
);
|
|
3365
|
+
return {
|
|
3366
|
+
reject,
|
|
3367
|
+
accept,
|
|
3368
|
+
request
|
|
3369
|
+
};
|
|
3370
|
+
}
|
|
3371
|
+
function getDeclarationActionCreationMetadata(actionType, actions) {
|
|
3372
|
+
const { accept: acceptAction, request: requestAction } = getActionRequests(
|
|
3373
|
+
actionType,
|
|
3374
|
+
actions
|
|
3375
|
+
);
|
|
3376
|
+
if (!acceptAction) {
|
|
3377
|
+
return null;
|
|
3378
|
+
}
|
|
3379
|
+
const registrationNumber = acceptAction.type === ActionType.REGISTER ? acceptAction.registrationNumber : null;
|
|
3380
|
+
return {
|
|
3381
|
+
// When 3rd party API returns 200 OK, we assume that the request was accepted, and persist single 'accepted' action.
|
|
3382
|
+
createdAt: requestAction?.createdAt ?? acceptAction.createdAt,
|
|
3383
|
+
createdBy: requestAction?.createdBy ?? acceptAction.createdBy,
|
|
3384
|
+
createdByUserType: requestAction?.createdByUserType ?? acceptAction.createdByUserType,
|
|
3385
|
+
createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
|
|
3386
|
+
acceptedAt: acceptAction.createdAt,
|
|
3387
|
+
createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
|
|
3388
|
+
registrationNumber
|
|
3389
|
+
};
|
|
3390
|
+
}
|
|
3391
|
+
var updateActions = ActionTypes.extract([
|
|
3392
|
+
ActionType.CREATE,
|
|
3393
|
+
ActionType.NOTIFY,
|
|
3394
|
+
ActionType.EDIT,
|
|
3395
|
+
ActionType.DECLARE,
|
|
3396
|
+
ActionType.REGISTER,
|
|
3397
|
+
ActionType.REJECT,
|
|
3398
|
+
ActionType.ARCHIVE,
|
|
3399
|
+
ActionType.UNARCHIVE,
|
|
3400
|
+
ActionType.PRINT_CERTIFICATE,
|
|
3401
|
+
ActionType.REQUEST_CORRECTION,
|
|
3402
|
+
ActionType.APPROVE_CORRECTION,
|
|
3403
|
+
ActionType.REJECT_CORRECTION,
|
|
3404
|
+
ActionType.CUSTOM
|
|
3405
|
+
]);
|
|
3406
|
+
function getActionUpdateMetadata(actions) {
|
|
3407
|
+
const createAction = getOrThrow(
|
|
3408
|
+
actions.find((action) => action.type === ActionType.CREATE),
|
|
3409
|
+
`Event has no ${ActionType.CREATE} action`
|
|
3410
|
+
);
|
|
3411
|
+
const metadataFields = [
|
|
3412
|
+
"createdAt",
|
|
3413
|
+
"createdBy",
|
|
3414
|
+
"createdByUserType",
|
|
3415
|
+
"createdAtLocation",
|
|
3416
|
+
"createdByRole"
|
|
3417
|
+
];
|
|
3418
|
+
return actions.filter(({ type }) => updateActions.safeParse(type).success).reduce(
|
|
3419
|
+
(_2, action) => {
|
|
3420
|
+
if (action.originalActionId) {
|
|
3421
|
+
const originalAction = actions.find(({ id }) => id === action.originalActionId) ?? action;
|
|
3422
|
+
return (0, import_lodash.pick)(originalAction, metadataFields);
|
|
3423
|
+
}
|
|
3424
|
+
return (0, import_lodash.pick)(action, metadataFields);
|
|
3425
|
+
},
|
|
3426
|
+
(0, import_lodash.pick)(createAction, metadataFields)
|
|
3427
|
+
);
|
|
3428
|
+
}
|
|
3429
|
+
function getLegalStatuses(actions) {
|
|
3430
|
+
return {
|
|
3431
|
+
[EventStatus.enum.NOTIFIED]: getDeclarationActionCreationMetadata(
|
|
3432
|
+
ActionType.NOTIFY,
|
|
3433
|
+
actions
|
|
3434
|
+
),
|
|
3435
|
+
[EventStatus.enum.DECLARED]: getDeclarationActionCreationMetadata(
|
|
3436
|
+
ActionType.DECLARE,
|
|
3437
|
+
actions
|
|
3438
|
+
),
|
|
3439
|
+
[EventStatus.enum.REGISTERED]: getDeclarationActionCreationMetadata(
|
|
3440
|
+
ActionType.REGISTER,
|
|
3441
|
+
actions
|
|
3442
|
+
)
|
|
3443
|
+
};
|
|
3444
|
+
}
|
|
3445
|
+
|
|
3446
|
+
// ../commons/src/events/state/flags.ts
|
|
3447
|
+
var import_lodash2 = require("lodash");
|
|
3448
|
+
var import_date_fns = require("date-fns");
|
|
3449
|
+
function isFlagConditionMet(conditional, form, action) {
|
|
3450
|
+
const now2 = (0, import_date_fns.isValid)((0, import_date_fns.parseISO)(action.createdAt)) ? (0, import_date_fns.formatISO)((0, import_date_fns.parseISO)(action.createdAt), { representation: "date" }) : (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
|
|
3451
|
+
return validate(conditional, {
|
|
3452
|
+
$form: form,
|
|
3453
|
+
$now: now2,
|
|
3454
|
+
$online: true,
|
|
3455
|
+
$user: {
|
|
3456
|
+
sub: "",
|
|
3457
|
+
exp: "",
|
|
3458
|
+
role: action.createdByRole,
|
|
3459
|
+
algorithm: "",
|
|
3460
|
+
scope: [],
|
|
3461
|
+
userType: action.createdByUserType
|
|
3462
|
+
}
|
|
3463
|
+
});
|
|
3464
|
+
}
|
|
3465
|
+
function actionConfigRemovesFlag(action, flagId, actionsUpToAndIncluding, event2, eventConfiguration) {
|
|
3466
|
+
if (!isActionConfigType(action.type)) {
|
|
3467
|
+
return false;
|
|
3468
|
+
}
|
|
3469
|
+
const actionConfig = getActionConfig({
|
|
3470
|
+
eventConfiguration,
|
|
3471
|
+
actionType: action.type,
|
|
3472
|
+
customActionType: "customActionType" in action ? action.customActionType : void 0
|
|
3473
|
+
});
|
|
3474
|
+
const removeOperations = (actionConfig?.flags ?? []).filter(
|
|
3475
|
+
({ id, operation }) => id === flagId && operation === "remove"
|
|
3476
|
+
);
|
|
3477
|
+
if (removeOperations.length === 0) {
|
|
3478
|
+
return false;
|
|
3479
|
+
}
|
|
3480
|
+
const eventUpToThisAction = { ...event2, actions: actionsUpToAndIncluding };
|
|
3481
|
+
const declaration = aggregateActionDeclarations(eventUpToThisAction);
|
|
3482
|
+
const annotation = aggregateActionAnnotations(eventUpToThisAction);
|
|
3483
|
+
const form = { ...declaration, ...annotation };
|
|
3484
|
+
return removeOperations.some(
|
|
3485
|
+
({ conditional }) => conditional ? isFlagConditionMet(conditional, form, action) : true
|
|
3486
|
+
);
|
|
3487
|
+
}
|
|
3488
|
+
var INHERENT_FLAG_RULES = [
|
|
3489
|
+
{
|
|
3490
|
+
flag: InherentFlags.CORRECTION_REQUESTED,
|
|
3491
|
+
setOn: [ActionType.REQUEST_CORRECTION],
|
|
3492
|
+
resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
|
|
3493
|
+
},
|
|
3494
|
+
{
|
|
3495
|
+
// INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
|
|
3496
|
+
// other status-changing action (see getStatusFromActions). ARCHIVE/UNARCHIVE
|
|
3497
|
+
// are deliberately excluded so the flag freezes across an archive/unarchive
|
|
3498
|
+
// round trip and comes back exactly as it was.
|
|
3499
|
+
flag: InherentFlags.INCOMPLETE,
|
|
3500
|
+
setOn: [ActionType.NOTIFY],
|
|
3501
|
+
resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
|
|
3502
|
+
},
|
|
3503
|
+
{
|
|
3504
|
+
flag: InherentFlags.REJECTED,
|
|
3505
|
+
setOn: [ActionType.REJECT],
|
|
3506
|
+
resetOn: [
|
|
3507
|
+
ActionType.NOTIFY,
|
|
3508
|
+
ActionType.DECLARE,
|
|
3509
|
+
ActionType.EDIT,
|
|
3510
|
+
ActionType.REGISTER
|
|
3511
|
+
]
|
|
3512
|
+
},
|
|
3513
|
+
{
|
|
3514
|
+
flag: InherentFlags.POTENTIAL_DUPLICATE,
|
|
3515
|
+
setOn: [ActionType.DUPLICATE_DETECTED],
|
|
3516
|
+
resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
|
|
3517
|
+
},
|
|
3518
|
+
{
|
|
3519
|
+
flag: InherentFlags.EDIT_IN_PROGRESS,
|
|
3520
|
+
setOn: [ActionType.EDIT],
|
|
3521
|
+
resetOnAnyOtherAction: true
|
|
3522
|
+
}
|
|
3523
|
+
];
|
|
3524
|
+
function resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration) {
|
|
3525
|
+
return acceptedActions.reduce((present, action, idx) => {
|
|
3526
|
+
if (rule.setOn.includes(action.type)) {
|
|
3527
|
+
return true;
|
|
3528
|
+
}
|
|
3529
|
+
if (rule.resetOnAnyOtherAction || (rule.resetOn ?? []).includes(action.type)) {
|
|
3530
|
+
return false;
|
|
3531
|
+
}
|
|
3532
|
+
if (actionConfigRemovesFlag(
|
|
3533
|
+
action,
|
|
3534
|
+
rule.flag,
|
|
3535
|
+
acceptedActions.slice(0, idx + 1),
|
|
3536
|
+
event2,
|
|
3537
|
+
eventConfiguration
|
|
3538
|
+
)) {
|
|
3539
|
+
return false;
|
|
3540
|
+
}
|
|
3541
|
+
return present;
|
|
3542
|
+
}, false);
|
|
3543
|
+
}
|
|
3544
|
+
function resolveEventCustomFlags(event2, eventConfiguration) {
|
|
3545
|
+
const actions = getAcceptedActions(event2).filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
3546
|
+
return actions.reduce((acc, action, idx) => {
|
|
3547
|
+
let actionConfig;
|
|
3548
|
+
if (isActionConfigType(action.type)) {
|
|
3549
|
+
actionConfig = getActionConfig({
|
|
3550
|
+
eventConfiguration,
|
|
3551
|
+
actionType: action.type,
|
|
3552
|
+
customActionType: "customActionType" in action ? action.customActionType : void 0
|
|
3553
|
+
});
|
|
3554
|
+
}
|
|
3555
|
+
if (!actionConfig) {
|
|
3556
|
+
return acc;
|
|
3557
|
+
}
|
|
3558
|
+
const eventUpToThisAction = {
|
|
3559
|
+
...event2,
|
|
3560
|
+
actions: actions.slice(0, idx + 1)
|
|
3561
|
+
};
|
|
3562
|
+
const declaration = aggregateActionDeclarations(eventUpToThisAction);
|
|
3563
|
+
const annotation = aggregateActionAnnotations(eventUpToThisAction);
|
|
3564
|
+
const form = { ...declaration, ...annotation };
|
|
3565
|
+
const flagsWithMetConditions = (actionConfig.flags ?? []).filter(
|
|
3566
|
+
({ conditional }) => (
|
|
3567
|
+
// If conditional is not provided, the flag is resolved
|
|
3568
|
+
conditional ? isFlagConditionMet(conditional, form, action) : true
|
|
3569
|
+
)
|
|
3570
|
+
);
|
|
3571
|
+
const addedFlags = flagsWithMetConditions.filter(({ operation }) => operation === "add").map(({ id }) => id);
|
|
3572
|
+
const removedFlags = flagsWithMetConditions.filter(({ operation }) => operation === "remove").map(({ id }) => id);
|
|
3573
|
+
const flags = [...acc, ...addedFlags].filter(
|
|
3574
|
+
(flagId) => !removedFlags.includes(flagId)
|
|
3575
|
+
);
|
|
3576
|
+
return (0, import_lodash2.uniq)(flags);
|
|
3577
|
+
}, []);
|
|
3578
|
+
}
|
|
3579
|
+
function getActionStatusFlags(sortedActions) {
|
|
3580
|
+
const actionStatus = sortedActions.reduce(
|
|
3581
|
+
(actionStatuses, { type, status: status2 }) => ({
|
|
3582
|
+
...actionStatuses,
|
|
3583
|
+
[type]: status2
|
|
3584
|
+
}),
|
|
3585
|
+
{}
|
|
3586
|
+
);
|
|
3587
|
+
return Object.entries(actionStatus).filter(([, status2]) => status2 !== ActionStatus.Accepted).map(([type, status2]) => {
|
|
3588
|
+
const flag2 = joinValues([type, status2], ":").toLowerCase();
|
|
3589
|
+
return flag2;
|
|
3590
|
+
});
|
|
3330
3591
|
}
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
}
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3592
|
+
function getInherentFlags(sortedActions, event2, eventConfiguration) {
|
|
3593
|
+
const acceptedActions = sortedActions.filter(
|
|
3594
|
+
({ status: status2 }) => status2 === ActionStatus.Accepted
|
|
3595
|
+
);
|
|
3596
|
+
return INHERENT_FLAG_RULES.filter(
|
|
3597
|
+
(rule) => resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration)
|
|
3598
|
+
).map(({ flag: flag2 }) => flag2);
|
|
3599
|
+
}
|
|
3600
|
+
function getEventFlags(event2, config) {
|
|
3601
|
+
const sortedActions = event2.actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
3602
|
+
return [
|
|
3603
|
+
...getActionStatusFlags(sortedActions),
|
|
3604
|
+
...getInherentFlags(sortedActions, event2, config),
|
|
3605
|
+
...resolveEventCustomFlags(event2, config)
|
|
3606
|
+
];
|
|
3344
3607
|
}
|
|
3345
|
-
var findAllFields = (config) => {
|
|
3346
|
-
return (0, import_lodash.flattenDeep)([
|
|
3347
|
-
...getDeclarationFields(config),
|
|
3348
|
-
...getAllAnnotationFields(config)
|
|
3349
|
-
]);
|
|
3350
|
-
};
|
|
3351
|
-
var EXCLUDED_ACTIONS = [
|
|
3352
|
-
ActionType.REQUEST_CORRECTION,
|
|
3353
|
-
ActionType.PRINT_CERTIFICATE,
|
|
3354
|
-
ActionType.REJECT_CORRECTION
|
|
3355
|
-
];
|
|
3356
3608
|
|
|
3357
3609
|
// ../commons/src/conditionals/conditionals.ts
|
|
3358
3610
|
var objectHash = __toESM(require("object-hash"));
|
|
@@ -3560,6 +3812,33 @@ function defineComparison(field3, value, keyword) {
|
|
|
3560
3812
|
required: [field3.$$field]
|
|
3561
3813
|
});
|
|
3562
3814
|
}
|
|
3815
|
+
function flag(flagvalue) {
|
|
3816
|
+
return defineConditional({
|
|
3817
|
+
type: "object",
|
|
3818
|
+
properties: {
|
|
3819
|
+
$flags: {
|
|
3820
|
+
type: "array",
|
|
3821
|
+
contains: {
|
|
3822
|
+
type: "string",
|
|
3823
|
+
const: flagvalue
|
|
3824
|
+
}
|
|
3825
|
+
}
|
|
3826
|
+
},
|
|
3827
|
+
required: ["$flags"]
|
|
3828
|
+
});
|
|
3829
|
+
}
|
|
3830
|
+
function status(statusValue) {
|
|
3831
|
+
return defineConditional({
|
|
3832
|
+
type: "object",
|
|
3833
|
+
properties: {
|
|
3834
|
+
$status: {
|
|
3835
|
+
type: "string",
|
|
3836
|
+
const: statusValue
|
|
3837
|
+
}
|
|
3838
|
+
},
|
|
3839
|
+
required: ["$status"]
|
|
3840
|
+
});
|
|
3841
|
+
}
|
|
3563
3842
|
function createFieldConditionals(fieldId) {
|
|
3564
3843
|
const getDayRange = (field3, days, clause, referenceDate) => ({
|
|
3565
3844
|
type: "object",
|
|
@@ -3961,6 +4240,512 @@ function createFieldConditionals(fieldId) {
|
|
|
3961
4240
|
};
|
|
3962
4241
|
}
|
|
3963
4242
|
|
|
4243
|
+
// ../commons/src/events/state/index.ts
|
|
4244
|
+
function getStatusFromActions(actions) {
|
|
4245
|
+
const acceptedActions = actions.filter(
|
|
4246
|
+
({ status: status2 }) => status2 === ActionStatus.Accepted
|
|
4247
|
+
);
|
|
4248
|
+
const isCurrentlyArchived = acceptedActions.reduce(
|
|
4249
|
+
(archived, action) => {
|
|
4250
|
+
if (action.type === ActionType.ARCHIVE) {
|
|
4251
|
+
return true;
|
|
4252
|
+
}
|
|
4253
|
+
if (action.type === ActionType.UNARCHIVE) {
|
|
4254
|
+
return false;
|
|
4255
|
+
}
|
|
4256
|
+
return archived;
|
|
4257
|
+
},
|
|
4258
|
+
false
|
|
4259
|
+
);
|
|
4260
|
+
if (isCurrentlyArchived) {
|
|
4261
|
+
return EventStatus.enum.ARCHIVED;
|
|
4262
|
+
}
|
|
4263
|
+
return acceptedActions.filter(
|
|
4264
|
+
({ type }) => type !== ActionType.ARCHIVE && type !== ActionType.UNARCHIVE
|
|
4265
|
+
).reduce((status2, action) => {
|
|
4266
|
+
switch (action.type) {
|
|
4267
|
+
case ActionType.CREATE:
|
|
4268
|
+
return EventStatus.enum.CREATED;
|
|
4269
|
+
case ActionType.DECLARE:
|
|
4270
|
+
return EventStatus.enum.DECLARED;
|
|
4271
|
+
case ActionType.REGISTER:
|
|
4272
|
+
return EventStatus.enum.REGISTERED;
|
|
4273
|
+
case ActionType.NOTIFY:
|
|
4274
|
+
return EventStatus.enum.NOTIFIED;
|
|
4275
|
+
// Already filtered out above; listed here only to satisfy exhaustiveness.
|
|
4276
|
+
case ActionType.ARCHIVE:
|
|
4277
|
+
case ActionType.UNARCHIVE:
|
|
4278
|
+
case ActionType.CUSTOM:
|
|
4279
|
+
case ActionType.PRINT_CERTIFICATE:
|
|
4280
|
+
case ActionType.ASSIGN:
|
|
4281
|
+
case ActionType.UNASSIGN:
|
|
4282
|
+
case ActionType.REJECT:
|
|
4283
|
+
case ActionType.REQUEST_CORRECTION:
|
|
4284
|
+
case ActionType.APPROVE_CORRECTION:
|
|
4285
|
+
case ActionType.DUPLICATE_DETECTED:
|
|
4286
|
+
case ActionType.MARK_AS_NOT_DUPLICATE:
|
|
4287
|
+
case ActionType.MARK_AS_DUPLICATE:
|
|
4288
|
+
case ActionType.REJECT_CORRECTION:
|
|
4289
|
+
case ActionType.READ:
|
|
4290
|
+
case ActionType.EDIT:
|
|
4291
|
+
default:
|
|
4292
|
+
return status2;
|
|
4293
|
+
}
|
|
4294
|
+
}, EventStatus.enum.CREATED);
|
|
4295
|
+
}
|
|
4296
|
+
function getAssignedUserFromActions(actions) {
|
|
4297
|
+
return actions.reduce((user2, action) => {
|
|
4298
|
+
if (action.type === ActionType.ASSIGN) {
|
|
4299
|
+
return action.assignedTo;
|
|
4300
|
+
}
|
|
4301
|
+
if (action.type === ActionType.UNASSIGN) {
|
|
4302
|
+
return null;
|
|
4303
|
+
}
|
|
4304
|
+
return user2;
|
|
4305
|
+
}, null);
|
|
4306
|
+
}
|
|
4307
|
+
function deepDropNulls(obj) {
|
|
4308
|
+
if (Array.isArray(obj)) {
|
|
4309
|
+
return obj.map(deepDropNulls);
|
|
4310
|
+
}
|
|
4311
|
+
if (obj !== null && typeof obj === "object") {
|
|
4312
|
+
return Object.entries(obj).reduce((acc, [key, value]) => {
|
|
4313
|
+
const cleanedValue = deepDropNulls(value);
|
|
4314
|
+
if (cleanedValue !== null) {
|
|
4315
|
+
;
|
|
4316
|
+
acc[key] = cleanedValue;
|
|
4317
|
+
}
|
|
4318
|
+
return acc;
|
|
4319
|
+
}, {});
|
|
4320
|
+
}
|
|
4321
|
+
return obj;
|
|
4322
|
+
}
|
|
4323
|
+
var DEFAULT_DATE_OF_EVENT_PROPERTY = "createdAt";
|
|
4324
|
+
function extractDateString(dateTime) {
|
|
4325
|
+
return dateTime.split("T")[0];
|
|
4326
|
+
}
|
|
4327
|
+
function resolveDateOfEvent(eventIndex, declaration, config) {
|
|
4328
|
+
if (!config.dateOfEvent) {
|
|
4329
|
+
return extractDateString(eventIndex[DEFAULT_DATE_OF_EVENT_PROPERTY]);
|
|
4330
|
+
}
|
|
4331
|
+
const parsedDate = isFieldReference(config.dateOfEvent) ? ZodDate.safeParse(declaration[config.dateOfEvent.$$field]) : ZodDateTime.safeParse(
|
|
4332
|
+
getMixedPath(eventIndex, config.dateOfEvent.$$event)
|
|
4333
|
+
);
|
|
4334
|
+
return parsedDate.success ? extractDateString(parsedDate.data) : void 0;
|
|
4335
|
+
}
|
|
4336
|
+
var DEFAULT_PLACE_OF_EVENT_PROPERTY = "createdAtLocation";
|
|
4337
|
+
function getParsedUUID(value, oldValue) {
|
|
4338
|
+
const parsed = UUID.safeParse(value);
|
|
4339
|
+
return parsed.success ? parsed.data : oldValue;
|
|
4340
|
+
}
|
|
4341
|
+
function resolvePlaceOfEvent(eventMetadata, declaration, config) {
|
|
4342
|
+
let placeOfEvent = getParsedUUID(
|
|
4343
|
+
eventMetadata[DEFAULT_PLACE_OF_EVENT_PROPERTY]
|
|
4344
|
+
);
|
|
4345
|
+
if (config.placeOfEvent) {
|
|
4346
|
+
const addressFieldValue = AddressFieldValue.safeParse(
|
|
4347
|
+
declaration[config.placeOfEvent.$$field]
|
|
4348
|
+
);
|
|
4349
|
+
if (addressFieldValue.success && addressFieldValue.data.addressType === AddressType.DOMESTIC && addressFieldValue.data.administrativeArea) {
|
|
4350
|
+
placeOfEvent = getParsedUUID(
|
|
4351
|
+
addressFieldValue.data.administrativeArea,
|
|
4352
|
+
placeOfEvent
|
|
4353
|
+
);
|
|
4354
|
+
} else {
|
|
4355
|
+
placeOfEvent = getParsedUUID(
|
|
4356
|
+
declaration[config.placeOfEvent.$$field],
|
|
4357
|
+
placeOfEvent
|
|
4358
|
+
);
|
|
4359
|
+
}
|
|
4360
|
+
}
|
|
4361
|
+
return placeOfEvent;
|
|
4362
|
+
}
|
|
4363
|
+
function extractPotentialDuplicatesFromActions(actions) {
|
|
4364
|
+
return actions.reduce((duplicates, action) => {
|
|
4365
|
+
if (action.type === ActionType.DUPLICATE_DETECTED) {
|
|
4366
|
+
duplicates = action.content.duplicates;
|
|
4367
|
+
}
|
|
4368
|
+
if (action.type === ActionType.MARK_AS_NOT_DUPLICATE || action.type === ActionType.MARK_AS_DUPLICATE) {
|
|
4369
|
+
duplicates = [];
|
|
4370
|
+
}
|
|
4371
|
+
return duplicates;
|
|
4372
|
+
}, []);
|
|
4373
|
+
}
|
|
4374
|
+
function getCurrentEventState(event2, config) {
|
|
4375
|
+
const sortedActions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
4376
|
+
const creationAction = sortedActions.find(
|
|
4377
|
+
(action) => action.type === ActionType.CREATE
|
|
4378
|
+
);
|
|
4379
|
+
if (!creationAction) {
|
|
4380
|
+
throw new Error(`Event ${event2.id} has no creation action`);
|
|
4381
|
+
}
|
|
4382
|
+
const acceptedActions = getAcceptedActions(event2).sort(
|
|
4383
|
+
(a, b) => a.createdAt.localeCompare(b.createdAt)
|
|
4384
|
+
);
|
|
4385
|
+
const requestActionMetadata = getActionUpdateMetadata(sortedActions);
|
|
4386
|
+
const acceptedActionMetadata = getActionUpdateMetadata(acceptedActions);
|
|
4387
|
+
const declaration = aggregateActionDeclarations(event2);
|
|
4388
|
+
const status2 = getStatusFromActions(sortedActions);
|
|
4389
|
+
const legalStatuses = getLegalStatuses(sortedActions);
|
|
4390
|
+
const base = deepDropNulls({
|
|
4391
|
+
id: event2.id,
|
|
4392
|
+
type: event2.type,
|
|
4393
|
+
status: status2,
|
|
4394
|
+
legalStatuses,
|
|
4395
|
+
createdAt: creationAction.createdAt,
|
|
4396
|
+
createdBy: creationAction.createdBy,
|
|
4397
|
+
createdByUserType: creationAction.createdByUserType,
|
|
4398
|
+
createdAtLocation: creationAction.createdAtLocation,
|
|
4399
|
+
updatedAt: acceptedActionMetadata.createdAt,
|
|
4400
|
+
assignedTo: getAssignedUserFromActions(acceptedActions),
|
|
4401
|
+
updatedBy: requestActionMetadata.createdBy,
|
|
4402
|
+
updatedAtLocation: requestActionMetadata.createdAtLocation,
|
|
4403
|
+
declaration,
|
|
4404
|
+
trackingId: event2.trackingId,
|
|
4405
|
+
updatedByUserRole: requestActionMetadata.createdByRole,
|
|
4406
|
+
placeOfEvent: resolvePlaceOfEvent(
|
|
4407
|
+
{ createdAtLocation: creationAction.createdAtLocation },
|
|
4408
|
+
declaration,
|
|
4409
|
+
config
|
|
4410
|
+
),
|
|
4411
|
+
potentialDuplicates: extractPotentialDuplicatesFromActions(sortedActions),
|
|
4412
|
+
flags: getEventFlags(event2, config)
|
|
4413
|
+
});
|
|
4414
|
+
return deepDropNulls({
|
|
4415
|
+
...base,
|
|
4416
|
+
dateOfEvent: resolveDateOfEvent(base, declaration, config)
|
|
4417
|
+
});
|
|
4418
|
+
}
|
|
4419
|
+
|
|
4420
|
+
// ../commons/src/conditionals/validate.ts
|
|
4421
|
+
var ajv = new import__.default({
|
|
4422
|
+
$data: true,
|
|
4423
|
+
allowUnionTypes: true,
|
|
4424
|
+
strict: false
|
|
4425
|
+
// Allow minContains and other newer features
|
|
4426
|
+
});
|
|
4427
|
+
var DataContext = z33.object({
|
|
4428
|
+
rootData: z33.object({
|
|
4429
|
+
$leafAdminStructureLocationIds: z33.array(z33.object({ id: UUID }))
|
|
4430
|
+
})
|
|
4431
|
+
});
|
|
4432
|
+
function resolveDataPath(rootData, dataPath, instancePath) {
|
|
4433
|
+
const pathParts = dataPath.split("/");
|
|
4434
|
+
const levels = parseInt(pathParts[0], 10);
|
|
4435
|
+
const referencePath = pathParts.slice(1);
|
|
4436
|
+
const instanceParts = instancePath.split("/").filter(Boolean);
|
|
4437
|
+
const traversedParts = instanceParts.slice(0, -levels);
|
|
4438
|
+
let current = rootData;
|
|
4439
|
+
for (const part of traversedParts) {
|
|
4440
|
+
if (current === null || current === void 0) {
|
|
4441
|
+
return void 0;
|
|
4442
|
+
}
|
|
4443
|
+
current = current[part];
|
|
4444
|
+
}
|
|
4445
|
+
for (const part of referencePath) {
|
|
4446
|
+
if (current === null || current === void 0) {
|
|
4447
|
+
return void 0;
|
|
4448
|
+
}
|
|
4449
|
+
current = current[part];
|
|
4450
|
+
}
|
|
4451
|
+
return current;
|
|
4452
|
+
}
|
|
4453
|
+
function todayISO() {
|
|
4454
|
+
return (0, import_date_fns2.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
|
|
4455
|
+
}
|
|
4456
|
+
var compiledFunctionCache = /* @__PURE__ */ new Map();
|
|
4457
|
+
function compileClientFunction(code) {
|
|
4458
|
+
let fn = compiledFunctionCache.get(code);
|
|
4459
|
+
if (!fn) {
|
|
4460
|
+
fn = new Function(`return (${code})`)();
|
|
4461
|
+
compiledFunctionCache.set(code, fn);
|
|
4462
|
+
}
|
|
4463
|
+
return fn;
|
|
4464
|
+
}
|
|
4465
|
+
(0, import_ajv_formats.default)(ajv);
|
|
4466
|
+
function buildClientFunctionContext(input) {
|
|
4467
|
+
const flags = input.validatorContext?.event && input.validatorContext?.eventConfig ? getCurrentEventState(
|
|
4468
|
+
input.validatorContext?.event,
|
|
4469
|
+
input.validatorContext?.eventConfig
|
|
4470
|
+
)?.flags : [];
|
|
4471
|
+
return {
|
|
4472
|
+
$form: input.form,
|
|
4473
|
+
$flags: flags,
|
|
4474
|
+
$now: todayISO(),
|
|
4475
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
4476
|
+
$online: isOnline(),
|
|
4477
|
+
$user: input.validatorContext?.user,
|
|
4478
|
+
$event: input.validatorContext?.event,
|
|
4479
|
+
$leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
|
|
4480
|
+
user: input.systemVariables?.user,
|
|
4481
|
+
$window: input.systemVariables?.$window,
|
|
4482
|
+
locations: input.locations,
|
|
4483
|
+
adminLevelIds: input.adminLevelIds
|
|
4484
|
+
};
|
|
4485
|
+
}
|
|
4486
|
+
function runClientFunction(code, data, context) {
|
|
4487
|
+
return compileClientFunction(code)(data, context);
|
|
4488
|
+
}
|
|
4489
|
+
ajv.addKeyword({
|
|
4490
|
+
keyword: "daysFromDate",
|
|
4491
|
+
type: "string",
|
|
4492
|
+
schemaType: "object",
|
|
4493
|
+
$data: true,
|
|
4494
|
+
errors: true,
|
|
4495
|
+
validate(schema, data, _2, dataContext) {
|
|
4496
|
+
if (!(dataContext && dataContext.rootData && typeof dataContext.rootData === "object" && "$now" in dataContext.rootData && typeof dataContext.rootData.$now === "string")) {
|
|
4497
|
+
throw new Error("Validation context must contain $now");
|
|
4498
|
+
}
|
|
4499
|
+
const { days, clause } = schema;
|
|
4500
|
+
if (typeof data !== "string") {
|
|
4501
|
+
return false;
|
|
4502
|
+
}
|
|
4503
|
+
const date = new Date(data);
|
|
4504
|
+
if (isNaN(date.getTime())) {
|
|
4505
|
+
return false;
|
|
4506
|
+
}
|
|
4507
|
+
let referenceDate = schema.referenceDate;
|
|
4508
|
+
if (referenceDate && typeof referenceDate === "object" && "$data" in referenceDate) {
|
|
4509
|
+
referenceDate = resolveDataPath(
|
|
4510
|
+
dataContext.rootData,
|
|
4511
|
+
referenceDate.$data,
|
|
4512
|
+
dataContext.instancePath
|
|
4513
|
+
);
|
|
4514
|
+
}
|
|
4515
|
+
if (!referenceDate) {
|
|
4516
|
+
referenceDate = dataContext.rootData.$now;
|
|
4517
|
+
}
|
|
4518
|
+
const baseDate = new Date(referenceDate);
|
|
4519
|
+
if (isNaN(baseDate.getTime())) {
|
|
4520
|
+
return false;
|
|
4521
|
+
}
|
|
4522
|
+
const offsetDate = new Date(baseDate.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
4523
|
+
return clause === "after" ? (0, import_date_fns2.isAfter)(date, offsetDate) : (0, import_date_fns2.isBefore)(date, offsetDate);
|
|
4524
|
+
}
|
|
4525
|
+
});
|
|
4526
|
+
ajv.addKeyword({
|
|
4527
|
+
keyword: "isLeafLevelLocation",
|
|
4528
|
+
type: "string",
|
|
4529
|
+
schemaType: "boolean",
|
|
4530
|
+
$data: true,
|
|
4531
|
+
errors: true,
|
|
4532
|
+
// @ts-ignore -- Force type. We will move this away from AJV next. Parsing the array will take seconds and is only called by core.
|
|
4533
|
+
validate(_schema, data, _2, dataContext) {
|
|
4534
|
+
const locationIdInput = data;
|
|
4535
|
+
const locations = dataContext?.rootData.$leafAdminStructureLocationIds ?? [];
|
|
4536
|
+
return locations.some((location) => location.id === locationIdInput);
|
|
4537
|
+
}
|
|
4538
|
+
});
|
|
4539
|
+
function isAgeValue(value) {
|
|
4540
|
+
return typeof value === "object" && value !== null && "age" in value && typeof value.age === "number";
|
|
4541
|
+
}
|
|
4542
|
+
ajv.addKeyword({
|
|
4543
|
+
keyword: "customClientValidator",
|
|
4544
|
+
schemaType: "object",
|
|
4545
|
+
errors: true,
|
|
4546
|
+
// @ts-expect-error -- AJV's public types don't expose `rootData`. All
|
|
4547
|
+
// `validate()` callers build root data via `buildClientFunctionContext`,
|
|
4548
|
+
// so the cast holds.
|
|
4549
|
+
validate(schema, data, _2, dataContext) {
|
|
4550
|
+
return Boolean(
|
|
4551
|
+
runClientFunction(
|
|
4552
|
+
schema.code,
|
|
4553
|
+
data,
|
|
4554
|
+
dataContext?.rootData ?? buildClientFunctionContext({ form: {} })
|
|
4555
|
+
)
|
|
4556
|
+
);
|
|
4557
|
+
}
|
|
4558
|
+
});
|
|
4559
|
+
function validate(schema, data) {
|
|
4560
|
+
const validator = ajv.getSchema(schema.$id) || ajv.compile(schema);
|
|
4561
|
+
if ("$form" in data) {
|
|
4562
|
+
const entries = Object.entries(data.$form).map(([key, value]) => {
|
|
4563
|
+
if (!isAgeValue(value)) {
|
|
4564
|
+
return [key, value];
|
|
4565
|
+
}
|
|
4566
|
+
const age = value.age;
|
|
4567
|
+
const maybeAsOfDate = PlainDate.safeParse(data.$form[value.asOfDateRef]);
|
|
4568
|
+
return [
|
|
4569
|
+
key,
|
|
4570
|
+
{
|
|
4571
|
+
age,
|
|
4572
|
+
dob: ageToDate(
|
|
4573
|
+
age,
|
|
4574
|
+
maybeAsOfDate.success ? maybeAsOfDate.data : PlainDate.parse(data.$now)
|
|
4575
|
+
)
|
|
4576
|
+
}
|
|
4577
|
+
];
|
|
4578
|
+
});
|
|
4579
|
+
data.$form = Object.fromEntries(entries);
|
|
4580
|
+
}
|
|
4581
|
+
const result = validator(data);
|
|
4582
|
+
return result;
|
|
4583
|
+
}
|
|
4584
|
+
function isOnline() {
|
|
4585
|
+
if (typeof window !== "undefined" && typeof navigator !== "undefined") {
|
|
4586
|
+
return navigator.onLine;
|
|
4587
|
+
}
|
|
4588
|
+
return true;
|
|
4589
|
+
}
|
|
4590
|
+
|
|
4591
|
+
// ../commons/src/events/utils.ts
|
|
4592
|
+
var import_date_fns3 = require("date-fns");
|
|
4593
|
+
function ageToDate(age, asOfDate) {
|
|
4594
|
+
const date = plainDateToLocalDate(asOfDate);
|
|
4595
|
+
return PlainDate.parse((0, import_date_fns3.format)((0, import_date_fns3.subYears)(date, age), "yyyy-MM-dd"));
|
|
4596
|
+
}
|
|
4597
|
+
function getDeclarationFields(configuration) {
|
|
4598
|
+
return configuration.declaration.pages.flatMap(({ fields }) => fields);
|
|
4599
|
+
}
|
|
4600
|
+
function isActionConfigType(type) {
|
|
4601
|
+
return actionConfigTypes.has(type);
|
|
4602
|
+
}
|
|
4603
|
+
function getActionConfig({
|
|
4604
|
+
eventConfiguration,
|
|
4605
|
+
actionType,
|
|
4606
|
+
customActionType
|
|
4607
|
+
}) {
|
|
4608
|
+
if (actionType === ActionType.NOTIFY) {
|
|
4609
|
+
return eventConfiguration.actions.find((a) => a.type === ActionType.NOTIFY) ?? eventConfiguration.actions.find((a) => a.type === ActionType.DECLARE);
|
|
4610
|
+
}
|
|
4611
|
+
return eventConfiguration.actions.find((a) => {
|
|
4612
|
+
if (a.type === ActionType.CUSTOM && customActionType) {
|
|
4613
|
+
return a.customActionType === customActionType;
|
|
4614
|
+
}
|
|
4615
|
+
return a.type === actionType;
|
|
4616
|
+
});
|
|
4617
|
+
}
|
|
4618
|
+
var getActionAnnotationFields = (actionConfig) => {
|
|
4619
|
+
if (actionConfig.type === ActionType.REQUEST_CORRECTION) {
|
|
4620
|
+
return actionConfig.correctionForm.pages.flatMap(({ fields }) => fields);
|
|
4621
|
+
}
|
|
4622
|
+
if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
|
|
4623
|
+
return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
|
|
4624
|
+
}
|
|
4625
|
+
const reviewFields = "review" in actionConfig && actionConfig.review != null ? actionConfig.review.fields : [];
|
|
4626
|
+
const formFields = "form" in actionConfig && actionConfig.form != null ? actionConfig.form : [];
|
|
4627
|
+
return [...reviewFields, ...formFields];
|
|
4628
|
+
};
|
|
4629
|
+
function getAllAnnotationFields(config) {
|
|
4630
|
+
return (0, import_lodash4.flattenDeep)(config.actions.map(getActionAnnotationFields));
|
|
4631
|
+
}
|
|
4632
|
+
function deepMerge(currentDocument, actionDocument) {
|
|
4633
|
+
const currentDocumentClone = (0, import_lodash4.cloneDeep)(currentDocument);
|
|
4634
|
+
return (0, import_lodash4.mergeWith)(
|
|
4635
|
+
(0, import_lodash4.cloneDeep)(currentDocumentClone),
|
|
4636
|
+
actionDocument,
|
|
4637
|
+
(previousValue, incomingValue) => {
|
|
4638
|
+
if (incomingValue === void 0) {
|
|
4639
|
+
return previousValue;
|
|
4640
|
+
}
|
|
4641
|
+
if ((0, import_lodash4.isArray)(incomingValue)) {
|
|
4642
|
+
return incomingValue;
|
|
4643
|
+
}
|
|
4644
|
+
if ((0, import_lodash4.isObject)(previousValue) && (0, import_lodash4.isObject)(incomingValue)) {
|
|
4645
|
+
return void 0;
|
|
4646
|
+
}
|
|
4647
|
+
return incomingValue;
|
|
4648
|
+
}
|
|
4649
|
+
);
|
|
4650
|
+
}
|
|
4651
|
+
var findAllFields = (config) => {
|
|
4652
|
+
return (0, import_lodash4.flattenDeep)([
|
|
4653
|
+
...getDeclarationFields(config),
|
|
4654
|
+
...getAllAnnotationFields(config)
|
|
4655
|
+
]);
|
|
4656
|
+
};
|
|
4657
|
+
function getMixedPath(obj, path, defaultValue) {
|
|
4658
|
+
const parts = path.split(".");
|
|
4659
|
+
const resolve = (current, segments) => {
|
|
4660
|
+
if (current == null || segments.length === 0) {
|
|
4661
|
+
return current;
|
|
4662
|
+
}
|
|
4663
|
+
for (let i = segments.length; i > 0; i--) {
|
|
4664
|
+
const compoundKey = segments.slice(0, i).join(".");
|
|
4665
|
+
if ((0, import_lodash4.has)(current, compoundKey)) {
|
|
4666
|
+
const next = (0, import_lodash4.get)(current, compoundKey);
|
|
4667
|
+
return resolve(next, segments.slice(i));
|
|
4668
|
+
}
|
|
4669
|
+
}
|
|
4670
|
+
return void 0;
|
|
4671
|
+
};
|
|
4672
|
+
const result = resolve(obj, parts);
|
|
4673
|
+
return (0, import_lodash4.isNil)(result) ? defaultValue : result;
|
|
4674
|
+
}
|
|
4675
|
+
function isAcceptedAction(a) {
|
|
4676
|
+
return a.status === ActionStatus.Accepted;
|
|
4677
|
+
}
|
|
4678
|
+
function getCompleteActionAnnotation(event2, action) {
|
|
4679
|
+
if (action.originalActionId) {
|
|
4680
|
+
const originalAction = event2.actions.find(
|
|
4681
|
+
({ id }) => id === action.originalActionId
|
|
4682
|
+
);
|
|
4683
|
+
if (originalAction?.status === ActionStatus.Requested) {
|
|
4684
|
+
return deepMerge(originalAction.annotation ?? {}, action.annotation ?? {});
|
|
4685
|
+
}
|
|
4686
|
+
}
|
|
4687
|
+
return action.annotation ?? {};
|
|
4688
|
+
}
|
|
4689
|
+
function getCompleteActionDeclaration(declaration, event2, action) {
|
|
4690
|
+
if (action.originalActionId) {
|
|
4691
|
+
const originalAction = event2.actions.find(
|
|
4692
|
+
({ id }) => id === action.originalActionId
|
|
4693
|
+
);
|
|
4694
|
+
if (originalAction?.status === ActionStatus.Requested) {
|
|
4695
|
+
return deepMerge(
|
|
4696
|
+
deepMerge(declaration, originalAction.declaration),
|
|
4697
|
+
action.declaration
|
|
4698
|
+
);
|
|
4699
|
+
}
|
|
4700
|
+
}
|
|
4701
|
+
return deepMerge(declaration, action.declaration);
|
|
4702
|
+
}
|
|
4703
|
+
function getAcceptedActions(event2) {
|
|
4704
|
+
return event2.actions.filter(isAcceptedAction).map((action) => ({
|
|
4705
|
+
...action,
|
|
4706
|
+
declaration: getCompleteActionDeclaration({}, event2, action),
|
|
4707
|
+
annotation: getCompleteActionAnnotation(event2, action)
|
|
4708
|
+
}));
|
|
4709
|
+
}
|
|
4710
|
+
var EXCLUDED_ACTIONS = [
|
|
4711
|
+
ActionType.REQUEST_CORRECTION,
|
|
4712
|
+
ActionType.PRINT_CERTIFICATE,
|
|
4713
|
+
ActionType.REJECT_CORRECTION
|
|
4714
|
+
];
|
|
4715
|
+
function aggregateActionDeclarations(event2) {
|
|
4716
|
+
const allAcceptedActions = getAcceptedActions(event2);
|
|
4717
|
+
const aggregatedActions = allAcceptedActions.filter((a) => !EXCLUDED_ACTIONS.some((type) => type === a.type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
4718
|
+
return aggregatedActions.reduce((declaration, action) => {
|
|
4719
|
+
if (action.type === ActionType.APPROVE_CORRECTION) {
|
|
4720
|
+
const requestAction = allAcceptedActions.find(
|
|
4721
|
+
({ id }) => id === action.requestId
|
|
4722
|
+
);
|
|
4723
|
+
if (!requestAction) {
|
|
4724
|
+
return declaration;
|
|
4725
|
+
}
|
|
4726
|
+
const declarationWithApprovedCorrection = getCompleteActionDeclaration(
|
|
4727
|
+
declaration,
|
|
4728
|
+
event2,
|
|
4729
|
+
requestAction
|
|
4730
|
+
);
|
|
4731
|
+
return getCompleteActionDeclaration(
|
|
4732
|
+
declarationWithApprovedCorrection,
|
|
4733
|
+
event2,
|
|
4734
|
+
action
|
|
4735
|
+
);
|
|
4736
|
+
}
|
|
4737
|
+
return getCompleteActionDeclaration(declaration, event2, action);
|
|
4738
|
+
}, {});
|
|
4739
|
+
}
|
|
4740
|
+
function aggregateActionAnnotations(event2) {
|
|
4741
|
+
return event2.actions.reduce((ann, sortedAction) => {
|
|
4742
|
+
if (!("annotation" in sortedAction) || !sortedAction.annotation) {
|
|
4743
|
+
return ann;
|
|
4744
|
+
}
|
|
4745
|
+
return deepMerge(ann, sortedAction.annotation);
|
|
4746
|
+
}, {});
|
|
4747
|
+
}
|
|
4748
|
+
|
|
3964
4749
|
// ../commons/src/events/eventConfigValidation.ts
|
|
3965
4750
|
function validateAdvancedSearchConfig(event2, ctx) {
|
|
3966
4751
|
const allFields = findAllFields(event2);
|
|
@@ -4043,9 +4828,9 @@ function validatePlaceOfEvent(event2, ctx) {
|
|
|
4043
4828
|
}
|
|
4044
4829
|
function validateActionFlags(event2, ctx) {
|
|
4045
4830
|
const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
|
|
4046
|
-
const configuredFlagIds = event2.flags.map((
|
|
4831
|
+
const configuredFlagIds = event2.flags.map((flag2) => flag2.id);
|
|
4047
4832
|
const actionFlagIds = event2.actions.flatMap(
|
|
4048
|
-
(action) => (action.flags ?? []).map((
|
|
4833
|
+
(action) => (action.flags ?? []).map((flag2) => flag2.id)
|
|
4049
4834
|
);
|
|
4050
4835
|
for (const actionFlagId of actionFlagIds) {
|
|
4051
4836
|
const isConfigured = configuredFlagIds.includes(actionFlagId);
|
|
@@ -4081,11 +4866,11 @@ function validateActionOrder(event2, ctx) {
|
|
|
4081
4866
|
}
|
|
4082
4867
|
|
|
4083
4868
|
// ../commons/src/events/EventConfig.ts
|
|
4084
|
-
var EventFieldReference =
|
|
4869
|
+
var EventFieldReference = z34.object({ $$event: EventMetadataDateFieldIdInput }).describe(
|
|
4085
4870
|
"Reference to a field defined in the event metadata, using the field id."
|
|
4086
4871
|
);
|
|
4087
|
-
var _EventConfigBase =
|
|
4088
|
-
id:
|
|
4872
|
+
var _EventConfigBase = z34.object({
|
|
4873
|
+
id: z34.string().describe(
|
|
4089
4874
|
'Machine-readable identifier of the event (e.g. "birth", "death").'
|
|
4090
4875
|
),
|
|
4091
4876
|
dateOfEvent: FieldReference.or(EventFieldReference).optional().describe(
|
|
@@ -4104,23 +4889,26 @@ var _EventConfigBase = z33.object({
|
|
|
4104
4889
|
"Summary information displayed in the event overview."
|
|
4105
4890
|
),
|
|
4106
4891
|
label: TranslationConfig.describe("Human-readable label for the event type."),
|
|
4107
|
-
actions:
|
|
4892
|
+
actions: z34.array(ActionConfig).describe(
|
|
4108
4893
|
"Configuration of core and custom actions associated with the event."
|
|
4109
4894
|
),
|
|
4110
|
-
actionOrder:
|
|
4895
|
+
actionOrder: z34.array(z34.string()).optional().describe(
|
|
4111
4896
|
"Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
|
|
4112
4897
|
),
|
|
4113
4898
|
declaration: DeclarationFormConfig.describe(
|
|
4114
4899
|
"Configuration of the form used to gather event data."
|
|
4115
4900
|
),
|
|
4116
|
-
advancedSearch:
|
|
4901
|
+
advancedSearch: z34.array(AdvancedSearchConfig).optional().default([]).describe(
|
|
4117
4902
|
"Configuration of fields available in the advanced search feature."
|
|
4118
4903
|
),
|
|
4119
|
-
flags:
|
|
4904
|
+
flags: z34.array(FlagConfig).optional().default([]).describe(
|
|
4120
4905
|
"Configuration of custom flags associated with the actions of this event type."
|
|
4121
4906
|
),
|
|
4122
|
-
analytics:
|
|
4907
|
+
analytics: z34.boolean().optional().default(true).describe(
|
|
4123
4908
|
"Indicates whether the records of this event type are included in analytics"
|
|
4909
|
+
),
|
|
4910
|
+
icon: z34.partialRecord(AvailableIcons, Conditional).optional().describe(
|
|
4911
|
+
'Maps an icon name to a conditional. The icon of the first entry (in definition order) whose conditional matches the event is used when rendering it (e.g. in the "iconWithName"/"iconWithNameEvent" workqueue columns). Falls back to the default status-based icon when unset or when no conditional matches.'
|
|
4124
4912
|
)
|
|
4125
4913
|
});
|
|
4126
4914
|
var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
|
|
@@ -4337,21 +5125,31 @@ var event = Object.assign(eventFn, {
|
|
|
4337
5125
|
return {
|
|
4338
5126
|
$event: field3
|
|
4339
5127
|
};
|
|
4340
|
-
}
|
|
5128
|
+
},
|
|
5129
|
+
/**
|
|
5130
|
+
* Checks if the event currently has the given status.
|
|
5131
|
+
* @param eventStatus - The status to check for.
|
|
5132
|
+
*/
|
|
5133
|
+
hasStatus: (eventStatus) => status(eventStatus),
|
|
5134
|
+
/**
|
|
5135
|
+
* Checks if the event currently carries the given flag.
|
|
5136
|
+
* @param flagValue - The flag to check for.
|
|
5137
|
+
*/
|
|
5138
|
+
hasFlag: (flagValue) => flag(flagValue)
|
|
4341
5139
|
});
|
|
4342
5140
|
|
|
4343
5141
|
// ../commons/src/events/WorkqueueColumnConfig.ts
|
|
4344
|
-
var
|
|
5142
|
+
var z35 = __toESM(require("zod/v4"));
|
|
4345
5143
|
var WorkqueueColumnKeysArray = [
|
|
4346
5144
|
...EventMetadataKeysArray,
|
|
4347
5145
|
"title",
|
|
4348
5146
|
"outbox"
|
|
4349
5147
|
];
|
|
4350
|
-
var WorkqueueColumnKeys =
|
|
4351
|
-
var WorkqueueColumnValue =
|
|
5148
|
+
var WorkqueueColumnKeys = z35.enum(WorkqueueColumnKeysArray);
|
|
5149
|
+
var WorkqueueColumnValue = z35.object({
|
|
4352
5150
|
$event: WorkqueueColumnKeys
|
|
4353
5151
|
});
|
|
4354
|
-
var WorkqueueColumn =
|
|
5152
|
+
var WorkqueueColumn = z35.object({
|
|
4355
5153
|
label: TranslationConfig,
|
|
4356
5154
|
value: WorkqueueColumnValue
|
|
4357
5155
|
}).meta({
|
|
@@ -4365,164 +5163,56 @@ function defineWorkqueuesColumns(workqueueColumns) {
|
|
|
4365
5163
|
}
|
|
4366
5164
|
|
|
4367
5165
|
// ../commons/src/events/CountryConfigQueryInput.ts
|
|
4368
|
-
var
|
|
4369
|
-
var SerializableExact =
|
|
4370
|
-
type:
|
|
4371
|
-
term:
|
|
4372
|
-
});
|
|
4373
|
-
var SerializableWithin =
|
|
4374
|
-
type:
|
|
4375
|
-
location:
|
|
4376
|
-
});
|
|
4377
|
-
var SerializedQueryExpression =
|
|
4378
|
-
eventType:
|
|
4379
|
-
status:
|
|
4380
|
-
createdAt:
|
|
4381
|
-
updatedAt:
|
|
4382
|
-
"legalStatuses.DECLARED.createdAtLocation":
|
|
4383
|
-
"legalStatuses.DECLARED.createdByRole":
|
|
4384
|
-
"legalStatuses.REGISTERED.createdAt":
|
|
4385
|
-
"legalStatuses.REGISTERED.createdAtLocation":
|
|
4386
|
-
"legalStatuses.REGISTERED.createdByRole":
|
|
4387
|
-
"legalStatuses.REGISTERED.registrationNumber":
|
|
4388
|
-
createdAtLocation:
|
|
4389
|
-
|
|
5166
|
+
var z36 = __toESM(require("zod/v4"));
|
|
5167
|
+
var SerializableExact = z36.object({
|
|
5168
|
+
type: z36.literal("exact"),
|
|
5169
|
+
term: z36.union([z36.string(), SerializedUserField])
|
|
5170
|
+
});
|
|
5171
|
+
var SerializableWithin = z36.object({
|
|
5172
|
+
type: z36.literal("within"),
|
|
5173
|
+
location: z36.union([z36.string(), SerializedUserField])
|
|
5174
|
+
});
|
|
5175
|
+
var SerializedQueryExpression = z36.object({
|
|
5176
|
+
eventType: z36.string(),
|
|
5177
|
+
status: z36.optional(z36.union([AnyOfStatus, ExactStatus])),
|
|
5178
|
+
createdAt: z36.optional(DateCondition),
|
|
5179
|
+
updatedAt: z36.optional(DateCondition),
|
|
5180
|
+
"legalStatuses.DECLARED.createdAtLocation": z36.optional(SerializableWithin),
|
|
5181
|
+
"legalStatuses.DECLARED.createdByRole": z36.optional(AnyOf),
|
|
5182
|
+
"legalStatuses.REGISTERED.createdAt": z36.optional(DateCondition),
|
|
5183
|
+
"legalStatuses.REGISTERED.createdAtLocation": z36.optional(SerializableWithin),
|
|
5184
|
+
"legalStatuses.REGISTERED.createdByRole": z36.optional(AnyOf),
|
|
5185
|
+
"legalStatuses.REGISTERED.registrationNumber": z36.optional(Exact),
|
|
5186
|
+
createdAtLocation: z36.optional(
|
|
5187
|
+
z36.union([SerializableWithin, SerializableExact])
|
|
4390
5188
|
),
|
|
4391
|
-
updatedAtLocation:
|
|
4392
|
-
|
|
5189
|
+
updatedAtLocation: z36.optional(
|
|
5190
|
+
z36.union([SerializableWithin, SerializableExact])
|
|
4393
5191
|
),
|
|
4394
|
-
updatedByUserRole:
|
|
4395
|
-
assignedTo:
|
|
4396
|
-
createdBy:
|
|
5192
|
+
updatedByUserRole: z36.optional(SerializableExact),
|
|
5193
|
+
assignedTo: z36.optional(SerializableExact),
|
|
5194
|
+
createdBy: z36.optional(SerializableExact),
|
|
4397
5195
|
createdByUserType: ExactUserType,
|
|
4398
|
-
updatedBy:
|
|
4399
|
-
trackingId:
|
|
4400
|
-
flags:
|
|
5196
|
+
updatedBy: z36.optional(SerializableExact),
|
|
5197
|
+
trackingId: z36.optional(Exact),
|
|
5198
|
+
flags: z36.optional(ContainsFlags),
|
|
4401
5199
|
data: QueryInput
|
|
4402
5200
|
}).partial();
|
|
4403
|
-
var Or2 =
|
|
4404
|
-
type:
|
|
4405
|
-
clauses:
|
|
5201
|
+
var Or2 = z36.object({
|
|
5202
|
+
type: z36.literal("or"),
|
|
5203
|
+
clauses: z36.array(SerializedQueryExpression)
|
|
4406
5204
|
});
|
|
4407
|
-
var And2 =
|
|
4408
|
-
type:
|
|
4409
|
-
clauses:
|
|
5205
|
+
var And2 = z36.object({
|
|
5206
|
+
type: z36.literal("and"),
|
|
5207
|
+
clauses: z36.array(SerializedQueryExpression)
|
|
4410
5208
|
});
|
|
4411
|
-
var CountryConfigQueryType =
|
|
4412
|
-
var CountryConfigQueryInputType =
|
|
5209
|
+
var CountryConfigQueryType = z36.discriminatedUnion("type", [And2, Or2]);
|
|
5210
|
+
var CountryConfigQueryInputType = z36.union([
|
|
4413
5211
|
SerializedQueryExpression,
|
|
4414
5212
|
And2,
|
|
4415
5213
|
Or2
|
|
4416
5214
|
]);
|
|
4417
5215
|
|
|
4418
|
-
// ../commons/src/icons.ts
|
|
4419
|
-
var z36 = __toESM(require("zod/v4"));
|
|
4420
|
-
var AvailableIcons = z36.enum([
|
|
4421
|
-
"Archived",
|
|
4422
|
-
"Assigned",
|
|
4423
|
-
"Briefcase",
|
|
4424
|
-
"Certified",
|
|
4425
|
-
"Close",
|
|
4426
|
-
"Collapse",
|
|
4427
|
-
"Draft",
|
|
4428
|
-
"DuplicateYellow",
|
|
4429
|
-
"Expand",
|
|
4430
|
-
"ExternalValidate",
|
|
4431
|
-
"FilledCheck",
|
|
4432
|
-
"InReview",
|
|
4433
|
-
"Offline",
|
|
4434
|
-
"Registered",
|
|
4435
|
-
"RequiresUpdates",
|
|
4436
|
-
"Sent",
|
|
4437
|
-
"Validated",
|
|
4438
|
-
"WaitingApproval",
|
|
4439
|
-
"ChartActivity",
|
|
4440
|
-
"Activity",
|
|
4441
|
-
"Archive",
|
|
4442
|
-
"ArchiveTray",
|
|
4443
|
-
"ArrowLeft",
|
|
4444
|
-
"ArrowRight",
|
|
4445
|
-
"Buildings",
|
|
4446
|
-
"Circle",
|
|
4447
|
-
"CaretDown",
|
|
4448
|
-
"CaretLeft",
|
|
4449
|
-
"CaretRight",
|
|
4450
|
-
"ChartBar",
|
|
4451
|
-
"ChartLine",
|
|
4452
|
-
"ChatCircle",
|
|
4453
|
-
"CheckSquare",
|
|
4454
|
-
"Compass",
|
|
4455
|
-
"Check",
|
|
4456
|
-
"Copy",
|
|
4457
|
-
"Database",
|
|
4458
|
-
"DotsThreeVertical",
|
|
4459
|
-
"ArrowCounterClockwise",
|
|
4460
|
-
"MagnifyingGlassMinus",
|
|
4461
|
-
"MagnifyingGlassPlus",
|
|
4462
|
-
"Export",
|
|
4463
|
-
"Eye",
|
|
4464
|
-
"EyeSlash",
|
|
4465
|
-
"Envelope",
|
|
4466
|
-
"File",
|
|
4467
|
-
"FileSearch",
|
|
4468
|
-
"FileMinus",
|
|
4469
|
-
"FilePlus",
|
|
4470
|
-
"FileText",
|
|
4471
|
-
"FileX",
|
|
4472
|
-
"Handshake",
|
|
4473
|
-
"Gear",
|
|
4474
|
-
"GitBranch",
|
|
4475
|
-
"IdentificationCard",
|
|
4476
|
-
"List",
|
|
4477
|
-
"ListBullets",
|
|
4478
|
-
"Lock",
|
|
4479
|
-
"MagnifyingGlass",
|
|
4480
|
-
"MapPin",
|
|
4481
|
-
"Medal",
|
|
4482
|
-
"NotePencil",
|
|
4483
|
-
"Paperclip",
|
|
4484
|
-
"PaperPlaneTilt",
|
|
4485
|
-
"Pen",
|
|
4486
|
-
"PenNib",
|
|
4487
|
-
"Pencil",
|
|
4488
|
-
"PencilSimpleLine",
|
|
4489
|
-
"Phone",
|
|
4490
|
-
"Plus",
|
|
4491
|
-
"Printer",
|
|
4492
|
-
"SignOut",
|
|
4493
|
-
"Stamp",
|
|
4494
|
-
"Star",
|
|
4495
|
-
"Target",
|
|
4496
|
-
"TextT",
|
|
4497
|
-
"Trash",
|
|
4498
|
-
"UploadSimple",
|
|
4499
|
-
"User",
|
|
4500
|
-
"UserPlus",
|
|
4501
|
-
"Users",
|
|
4502
|
-
"WarningCircle",
|
|
4503
|
-
"X",
|
|
4504
|
-
"ChatText",
|
|
4505
|
-
"CircleWavyCheck",
|
|
4506
|
-
"CircleWavyQuestion",
|
|
4507
|
-
"ArchiveBox",
|
|
4508
|
-
"ArrowCircleDown",
|
|
4509
|
-
"FileArrowUp",
|
|
4510
|
-
"FileDotted",
|
|
4511
|
-
"Files",
|
|
4512
|
-
"PencilLine",
|
|
4513
|
-
"PencilCircle",
|
|
4514
|
-
"UserCircle",
|
|
4515
|
-
"Clock",
|
|
4516
|
-
"QrCode",
|
|
4517
|
-
"Webcam",
|
|
4518
|
-
"Sun",
|
|
4519
|
-
"DeviceTabletCamera",
|
|
4520
|
-
"Globe",
|
|
4521
|
-
"Fingerprint",
|
|
4522
|
-
"PushPin",
|
|
4523
|
-
"Timer"
|
|
4524
|
-
]);
|
|
4525
|
-
|
|
4526
5216
|
// ../commons/src/events/WorkqueueConfig.ts
|
|
4527
5217
|
var mandatoryColumns = defineWorkqueuesColumns([
|
|
4528
5218
|
{
|
|
@@ -4802,14 +5492,14 @@ var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
|
|
|
4802
5492
|
|
|
4803
5493
|
// ../commons/src/events/EventInput.ts
|
|
4804
5494
|
var z40 = __toESM(require("zod/v4"));
|
|
4805
|
-
var
|
|
5495
|
+
var import_uuid11 = require("uuid");
|
|
4806
5496
|
var EventInput = z40.object({
|
|
4807
5497
|
transactionId: z40.string(),
|
|
4808
5498
|
type: z40.string(),
|
|
4809
5499
|
createdAtLocation: UUID.nullish().describe(
|
|
4810
5500
|
"Location where the event occurred. Required for system users."
|
|
4811
5501
|
)
|
|
4812
|
-
}).meta({ default: { transactionId: (0,
|
|
5502
|
+
}).meta({ default: { transactionId: (0, import_uuid11.v4)(), type: "birth" } });
|
|
4813
5503
|
|
|
4814
5504
|
// ../commons/src/events/EventDocument.ts
|
|
4815
5505
|
var z41 = __toESM(require("zod/v4"));
|
|
@@ -4826,67 +5516,6 @@ var EventDocument = z41.object({
|
|
|
4826
5516
|
)
|
|
4827
5517
|
}).meta({ id: "EventDocument" });
|
|
4828
5518
|
|
|
4829
|
-
// ../commons/src/events/state/index.ts
|
|
4830
|
-
var import_lodash4 = require("lodash");
|
|
4831
|
-
|
|
4832
|
-
// ../commons/src/events/state/utils.ts
|
|
4833
|
-
var import_lodash2 = require("lodash");
|
|
4834
|
-
var updateActions = ActionTypes.extract([
|
|
4835
|
-
ActionType.CREATE,
|
|
4836
|
-
ActionType.NOTIFY,
|
|
4837
|
-
ActionType.EDIT,
|
|
4838
|
-
ActionType.DECLARE,
|
|
4839
|
-
ActionType.REGISTER,
|
|
4840
|
-
ActionType.REJECT,
|
|
4841
|
-
ActionType.ARCHIVE,
|
|
4842
|
-
ActionType.UNARCHIVE,
|
|
4843
|
-
ActionType.PRINT_CERTIFICATE,
|
|
4844
|
-
ActionType.REQUEST_CORRECTION,
|
|
4845
|
-
ActionType.APPROVE_CORRECTION,
|
|
4846
|
-
ActionType.REJECT_CORRECTION,
|
|
4847
|
-
ActionType.CUSTOM
|
|
4848
|
-
]);
|
|
4849
|
-
|
|
4850
|
-
// ../commons/src/events/state/flags.ts
|
|
4851
|
-
var import_lodash3 = require("lodash");
|
|
4852
|
-
var import_date_fns3 = require("date-fns");
|
|
4853
|
-
var INHERENT_FLAG_RULES = [
|
|
4854
|
-
{
|
|
4855
|
-
flag: InherentFlags.CORRECTION_REQUESTED,
|
|
4856
|
-
setOn: [ActionType.REQUEST_CORRECTION],
|
|
4857
|
-
resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
|
|
4858
|
-
},
|
|
4859
|
-
{
|
|
4860
|
-
// INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
|
|
4861
|
-
// other status-changing action (see getStatusFromActions). ARCHIVE/UNARCHIVE
|
|
4862
|
-
// are deliberately excluded so the flag freezes across an archive/unarchive
|
|
4863
|
-
// round trip and comes back exactly as it was.
|
|
4864
|
-
flag: InherentFlags.INCOMPLETE,
|
|
4865
|
-
setOn: [ActionType.NOTIFY],
|
|
4866
|
-
resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
|
|
4867
|
-
},
|
|
4868
|
-
{
|
|
4869
|
-
flag: InherentFlags.REJECTED,
|
|
4870
|
-
setOn: [ActionType.REJECT],
|
|
4871
|
-
resetOn: [
|
|
4872
|
-
ActionType.NOTIFY,
|
|
4873
|
-
ActionType.DECLARE,
|
|
4874
|
-
ActionType.EDIT,
|
|
4875
|
-
ActionType.REGISTER
|
|
4876
|
-
]
|
|
4877
|
-
},
|
|
4878
|
-
{
|
|
4879
|
-
flag: InherentFlags.POTENTIAL_DUPLICATE,
|
|
4880
|
-
setOn: [ActionType.DUPLICATE_DETECTED],
|
|
4881
|
-
resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
|
|
4882
|
-
},
|
|
4883
|
-
{
|
|
4884
|
-
flag: InherentFlags.EDIT_IN_PROGRESS,
|
|
4885
|
-
setOn: [ActionType.EDIT],
|
|
4886
|
-
resetOnAnyOtherAction: true
|
|
4887
|
-
}
|
|
4888
|
-
];
|
|
4889
|
-
|
|
4890
5519
|
// ../commons/src/events/defineConfig.ts
|
|
4891
5520
|
var IGNORED_EVENT_TYPES = [
|
|
4892
5521
|
"FOOTBALL_CLUB_MEMBERSHIP",
|
|
@@ -7359,21 +7988,44 @@ var LocationTypeV1 = z43.enum([
|
|
|
7359
7988
|
"CRVS_OFFICE",
|
|
7360
7989
|
"HEALTH_FACILITY"
|
|
7361
7990
|
]);
|
|
7991
|
+
var LocationStatus = z43.enum(["active", "inactive"]);
|
|
7992
|
+
var LocationVersion = z43.object({
|
|
7993
|
+
versionId: UUID,
|
|
7994
|
+
effectiveFrom: z43.iso.date(),
|
|
7995
|
+
name: z43.string(),
|
|
7996
|
+
externalId: z43.string().nullish(),
|
|
7997
|
+
status: LocationStatus
|
|
7998
|
+
});
|
|
7362
7999
|
var AdministrativeArea = z43.object({
|
|
7363
8000
|
id: UUID,
|
|
7364
8001
|
name: z43.string(),
|
|
7365
8002
|
externalId: z43.string().nullish(),
|
|
7366
8003
|
parentId: UUID.nullable(),
|
|
7367
|
-
|
|
8004
|
+
status: LocationStatus,
|
|
8005
|
+
versions: z43.array(LocationVersion)
|
|
7368
8006
|
});
|
|
7369
8007
|
var Location = z43.object({
|
|
7370
8008
|
id: UUID,
|
|
7371
8009
|
name: z43.string(),
|
|
7372
8010
|
externalId: z43.string().nullish(),
|
|
7373
8011
|
administrativeAreaId: UUID.nullable(),
|
|
7374
|
-
|
|
8012
|
+
locationType: z43.string().nullable(),
|
|
8013
|
+
status: LocationStatus,
|
|
8014
|
+
versions: z43.array(LocationVersion)
|
|
8015
|
+
});
|
|
8016
|
+
var SetLocationPayload = z43.object({
|
|
8017
|
+
id: UUID,
|
|
8018
|
+
name: z43.string(),
|
|
8019
|
+
externalId: z43.string().nullish(),
|
|
8020
|
+
administrativeAreaId: UUID.nullable(),
|
|
7375
8021
|
locationType: z43.string().nullable()
|
|
7376
8022
|
});
|
|
8023
|
+
var SetAdministrativeAreaPayload = z43.object({
|
|
8024
|
+
id: UUID,
|
|
8025
|
+
name: z43.string(),
|
|
8026
|
+
externalId: z43.string().nullish(),
|
|
8027
|
+
parentId: UUID.nullable()
|
|
8028
|
+
});
|
|
7377
8029
|
|
|
7378
8030
|
// ../commons/src/events/scopes.ts
|
|
7379
8031
|
var ACTION_SCOPE_MAP = {
|
|
@@ -7445,20 +8097,20 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
|
7445
8097
|
]
|
|
7446
8098
|
};
|
|
7447
8099
|
var ACTION_FILTERS = {
|
|
7448
|
-
[ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
7449
|
-
[ActionType.REQUEST_CORRECTION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
7450
|
-
[ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
7451
|
-
[ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
7452
|
-
[ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((
|
|
7453
|
-
[ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((
|
|
7454
|
-
[ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((
|
|
7455
|
-
[ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((
|
|
7456
|
-
[ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((
|
|
7457
|
-
[ActionType.ARCHIVE]: (flags) => !flags.some((
|
|
7458
|
-
[ActionType.UNARCHIVE]: (flags) => !flags.some((
|
|
7459
|
-
[ActionType.ASSIGN]: (flags) => !flags.some((
|
|
7460
|
-
[ActionType.UNASSIGN]: (flags) => !flags.some((
|
|
7461
|
-
[ActionType.CUSTOM]: (flags) => !flags.some((
|
|
8100
|
+
[ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8101
|
+
[ActionType.REQUEST_CORRECTION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8102
|
+
[ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8103
|
+
[ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8104
|
+
[ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8105
|
+
[ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8106
|
+
[ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8107
|
+
[ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8108
|
+
[ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8109
|
+
[ActionType.ARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8110
|
+
[ActionType.UNARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8111
|
+
[ActionType.ASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8112
|
+
[ActionType.UNASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8113
|
+
[ActionType.CUSTOM]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested"))
|
|
7462
8114
|
};
|
|
7463
8115
|
var REJECTED_ACTIONS = [
|
|
7464
8116
|
ActionType.READ,
|
|
@@ -7472,75 +8124,80 @@ var REJECTED_ACTIONS = [
|
|
|
7472
8124
|
var import_lodash7 = require("lodash");
|
|
7473
8125
|
|
|
7474
8126
|
// ../commons/src/events/mocks.test.utils.ts
|
|
7475
|
-
|
|
8127
|
+
function withVersionFields(entity) {
|
|
8128
|
+
return {
|
|
8129
|
+
...entity,
|
|
8130
|
+
status: "active",
|
|
8131
|
+
versions: [
|
|
8132
|
+
{
|
|
8133
|
+
versionId: entity.id,
|
|
8134
|
+
effectiveFrom: "0001-01-01",
|
|
8135
|
+
name: entity.name,
|
|
8136
|
+
externalId: entity.externalId ?? null,
|
|
8137
|
+
status: "active"
|
|
8138
|
+
}
|
|
8139
|
+
]
|
|
8140
|
+
};
|
|
8141
|
+
}
|
|
8142
|
+
var MOCK_ADMINISTRATIVE_AREAS_BASE = [
|
|
7476
8143
|
{
|
|
7477
8144
|
id: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
7478
8145
|
name: "Central",
|
|
7479
8146
|
parentId: null,
|
|
7480
|
-
validUntil: null,
|
|
7481
8147
|
externalId: "ydyJb1RAy4U1"
|
|
7482
8148
|
},
|
|
7483
8149
|
{
|
|
7484
8150
|
id: "c599b691-fd2d-45e1-abf4-d185de727fb5",
|
|
7485
8151
|
name: "Sulaka",
|
|
7486
8152
|
parentId: null,
|
|
7487
|
-
validUntil: null,
|
|
7488
8153
|
externalId: "pQ8nGxWmZ2Q3"
|
|
7489
8154
|
},
|
|
7490
8155
|
{
|
|
7491
8156
|
id: "7ef2b9c7-5e6d-49f6-ae05-656207d0fc64",
|
|
7492
8157
|
name: "Pualula",
|
|
7493
8158
|
parentId: null,
|
|
7494
|
-
validUntil: null,
|
|
7495
8159
|
externalId: "Aq91DweLmT8k"
|
|
7496
8160
|
},
|
|
7497
8161
|
{
|
|
7498
8162
|
id: "6d1a59df-988c-4021-a846-ccbc021931a7",
|
|
7499
8163
|
name: "Chuminga",
|
|
7500
8164
|
parentId: null,
|
|
7501
|
-
validUntil: null,
|
|
7502
8165
|
externalId: "Rw0fYNh2Xk9a"
|
|
7503
8166
|
},
|
|
7504
8167
|
{
|
|
7505
8168
|
id: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7506
8169
|
name: "Ibombo",
|
|
7507
8170
|
parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
7508
|
-
validUntil: null,
|
|
7509
8171
|
externalId: "k7DsP4vbN1Qe"
|
|
7510
8172
|
},
|
|
7511
8173
|
{
|
|
7512
8174
|
id: "27160bbd-32d1-4625-812f-860226bfb92a",
|
|
7513
8175
|
name: "Isango",
|
|
7514
8176
|
parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
7515
|
-
validUntil: null,
|
|
7516
8177
|
externalId: "Gm3Z9eQpHw4L"
|
|
7517
8178
|
},
|
|
7518
8179
|
{
|
|
7519
8180
|
id: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
7520
8181
|
name: "Isamba",
|
|
7521
8182
|
parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
7522
|
-
validUntil: null,
|
|
7523
8183
|
externalId: "sT0xVu1KqJ7r"
|
|
7524
8184
|
},
|
|
7525
8185
|
{
|
|
7526
8186
|
id: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
7527
8187
|
name: "Itambo",
|
|
7528
8188
|
parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
7529
|
-
validUntil: null,
|
|
7530
8189
|
externalId: "Nq6Bv2HpL9Te"
|
|
7531
8190
|
},
|
|
7532
8191
|
{
|
|
7533
8192
|
id: "d42ab2fe-e7ed-470e-8b31-4fb27f9b8250",
|
|
7534
8193
|
name: "Ezhi",
|
|
7535
8194
|
parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
7536
|
-
validUntil: null,
|
|
7537
8195
|
externalId: "xK8cQ0ZRy5Wd"
|
|
7538
8196
|
},
|
|
7539
8197
|
{
|
|
7540
8198
|
id: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
|
|
7541
8199
|
name: "Ilanga",
|
|
7542
8200
|
parentId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
|
|
7543
|
-
validUntil: null,
|
|
7544
8201
|
externalId: "Cq4Jm1XvN8Ls"
|
|
7545
8202
|
},
|
|
7546
8203
|
// Villages under Ibombo (62a0ccb4-880d-4f30-8882-f256007dfff9)
|
|
@@ -7548,49 +8205,42 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
|
|
|
7548
8205
|
id: "1d4e5f6a-7b8c-4912-8efa-345678901234",
|
|
7549
8206
|
name: "Klow",
|
|
7550
8207
|
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7551
|
-
validUntil: null,
|
|
7552
8208
|
externalId: "IkYcYBUcyY2"
|
|
7553
8209
|
},
|
|
7554
8210
|
{
|
|
7555
8211
|
id: "2e5f6a7b-8c9d-4a23-8fab-456789012345",
|
|
7556
8212
|
name: "Mbondo",
|
|
7557
8213
|
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7558
|
-
validUntil: null,
|
|
7559
8214
|
externalId: "Qhvv5hvo3mY"
|
|
7560
8215
|
},
|
|
7561
8216
|
{
|
|
7562
8217
|
id: "3f6a7b8c-9d0e-4b34-8abc-567890123456",
|
|
7563
8218
|
name: "Ndara",
|
|
7564
8219
|
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7565
|
-
validUntil: null,
|
|
7566
8220
|
externalId: "crXh068O9TR"
|
|
7567
8221
|
},
|
|
7568
8222
|
{
|
|
7569
8223
|
id: "4a7b8c9d-0e1f-4c45-abcd-678901234567",
|
|
7570
8224
|
name: "Olani",
|
|
7571
8225
|
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7572
|
-
validUntil: null,
|
|
7573
8226
|
externalId: "r00It8Tvvp7"
|
|
7574
8227
|
},
|
|
7575
8228
|
{
|
|
7576
8229
|
id: "5b8c9d0e-1f2a-4d56-bcde-789012345678",
|
|
7577
8230
|
name: "Pemba",
|
|
7578
8231
|
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7579
|
-
validUntil: null,
|
|
7580
8232
|
externalId: "ZnUWsbONIaH"
|
|
7581
8233
|
},
|
|
7582
8234
|
{
|
|
7583
8235
|
id: "6c9d0e1f-2a3b-4e67-8def-890123456789",
|
|
7584
8236
|
name: "Quanza",
|
|
7585
8237
|
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7586
|
-
validUntil: null,
|
|
7587
8238
|
externalId: "fDZycvQTa7l"
|
|
7588
8239
|
},
|
|
7589
8240
|
{
|
|
7590
8241
|
id: "7d0e1f2a-3b4c-4f78-8efa-901234567890",
|
|
7591
8242
|
name: "Rivka",
|
|
7592
8243
|
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7593
|
-
validUntil: null,
|
|
7594
8244
|
externalId: "KqswxCGTELa"
|
|
7595
8245
|
},
|
|
7596
8246
|
// Villages under Isamba (967032fd-3f81-478a-826c-30cb8fe121bd)
|
|
@@ -7598,35 +8248,30 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
|
|
|
7598
8248
|
id: "8e1f2a3b-4c5d-4089-8fab-012345678901",
|
|
7599
8249
|
name: "Mbula",
|
|
7600
8250
|
parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
7601
|
-
validUntil: null,
|
|
7602
8251
|
externalId: "osEbKjRc9Kg"
|
|
7603
8252
|
},
|
|
7604
8253
|
{
|
|
7605
8254
|
id: "9f2a3b4c-5d6e-4190-8abf-123456789012",
|
|
7606
8255
|
name: "Ndoki",
|
|
7607
8256
|
parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
7608
|
-
validUntil: null,
|
|
7609
8257
|
externalId: "aq4daBUAGr3"
|
|
7610
8258
|
},
|
|
7611
8259
|
{
|
|
7612
8260
|
id: "0a3b4c5d-6e7f-4201-abcd-234567890123",
|
|
7613
8261
|
name: "Tsanga",
|
|
7614
8262
|
parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
7615
|
-
validUntil: null,
|
|
7616
8263
|
externalId: "cqis6Y8trbJ"
|
|
7617
8264
|
},
|
|
7618
8265
|
{
|
|
7619
8266
|
id: "1b4c5d6e-7f8a-4312-bcde-345678901234",
|
|
7620
8267
|
name: "Waziri",
|
|
7621
8268
|
parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
7622
|
-
validUntil: null,
|
|
7623
8269
|
externalId: "LMijHPyyx6d"
|
|
7624
8270
|
},
|
|
7625
8271
|
{
|
|
7626
8272
|
id: "2c5d6e7f-8a9b-4423-8def-456789012345",
|
|
7627
8273
|
name: "Zimbi",
|
|
7628
8274
|
parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
7629
|
-
validUntil: null,
|
|
7630
8275
|
externalId: "pcQYbPuKGZ7"
|
|
7631
8276
|
},
|
|
7632
8277
|
// Villages under Itambo (89a33893-b17d-481d-a26d-6461e7ac1651)
|
|
@@ -7634,67 +8279,59 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
|
|
|
7634
8279
|
id: "3d6e7f8a-9b0c-4534-8efa-567890123456",
|
|
7635
8280
|
name: "Felani",
|
|
7636
8281
|
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
7637
|
-
validUntil: null,
|
|
7638
8282
|
externalId: "gSqpoCGdMXp"
|
|
7639
8283
|
},
|
|
7640
8284
|
{
|
|
7641
8285
|
id: "4e7f8a9b-0c1d-4645-8fab-678901234567",
|
|
7642
8286
|
name: "Goroma",
|
|
7643
8287
|
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
7644
|
-
validUntil: null,
|
|
7645
8288
|
externalId: "KvAAIaNqVrp"
|
|
7646
8289
|
},
|
|
7647
8290
|
{
|
|
7648
8291
|
id: "5f8a9b0c-1d2e-4756-8abc-789012345678",
|
|
7649
8292
|
name: "Halifu",
|
|
7650
8293
|
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
7651
|
-
validUntil: null,
|
|
7652
8294
|
externalId: "qe4UnEVt1hv"
|
|
7653
8295
|
},
|
|
7654
8296
|
{
|
|
7655
8297
|
id: "6a9b0c1d-2e3f-4867-abcd-890123456789",
|
|
7656
8298
|
name: "Jabari",
|
|
7657
8299
|
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
7658
|
-
validUntil: null,
|
|
7659
8300
|
externalId: "yHH9Nz4rLOt"
|
|
7660
8301
|
},
|
|
7661
8302
|
{
|
|
7662
8303
|
id: "7b0c1d2e-3f4a-4978-bcde-901234567890",
|
|
7663
8304
|
name: "Kifani",
|
|
7664
8305
|
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
7665
|
-
validUntil: null,
|
|
7666
8306
|
externalId: "eSWmXIGeu1I"
|
|
7667
8307
|
},
|
|
7668
8308
|
{
|
|
7669
8309
|
id: "8c1d2e3f-4a5b-4089-8def-012345678901",
|
|
7670
8310
|
name: "Lumela",
|
|
7671
8311
|
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
7672
|
-
validUntil: null,
|
|
7673
8312
|
externalId: "bh0b3aI1uP3"
|
|
7674
8313
|
}
|
|
7675
8314
|
];
|
|
7676
|
-
var
|
|
8315
|
+
var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = MOCK_ADMINISTRATIVE_AREAS_BASE.map(withVersionFields);
|
|
8316
|
+
var MOCK_LOCATIONS_BASE = [
|
|
7677
8317
|
{
|
|
7678
8318
|
id: "6f6186ce-cd5f-4a5f-810a-2d99e7c4ba12",
|
|
7679
8319
|
name: "Central Provincial Office",
|
|
7680
8320
|
locationType: "CRVS_OFFICE",
|
|
7681
8321
|
administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
7682
|
-
validUntil: null,
|
|
7683
8322
|
externalId: "Xr3Df8WpK6Ys"
|
|
7684
8323
|
},
|
|
7685
8324
|
{
|
|
7686
8325
|
id: "b1c2d3e4-f5a6-7890-bcde-f12345678901",
|
|
7687
8326
|
name: "Central Health Post",
|
|
7688
8327
|
locationType: "HEALTH_FACILITY",
|
|
7689
|
-
administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c"
|
|
7690
|
-
validUntil: null
|
|
8328
|
+
administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c"
|
|
7691
8329
|
},
|
|
7692
8330
|
{
|
|
7693
8331
|
id: "028d2c85-ca31-426d-b5d1-2cef545a4902",
|
|
7694
8332
|
name: "Ibombo District Office",
|
|
7695
8333
|
locationType: "CRVS_OFFICE",
|
|
7696
8334
|
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7697
|
-
validUntil: null,
|
|
7698
8335
|
externalId: "Sm4Nw7GrD2Vy"
|
|
7699
8336
|
},
|
|
7700
8337
|
{
|
|
@@ -7702,7 +8339,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7702
8339
|
name: "Isamba District Office",
|
|
7703
8340
|
locationType: "CRVS_OFFICE",
|
|
7704
8341
|
administrativeAreaId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
7705
|
-
validUntil: null,
|
|
7706
8342
|
externalId: "Vg1Bq5XeH9Lt"
|
|
7707
8343
|
},
|
|
7708
8344
|
{
|
|
@@ -7710,7 +8346,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7710
8346
|
name: "Isango District Office",
|
|
7711
8347
|
locationType: "CRVS_OFFICE",
|
|
7712
8348
|
administrativeAreaId: "27160bbd-32d1-4625-812f-860226bfb92a",
|
|
7713
|
-
validUntil: null,
|
|
7714
8349
|
externalId: "Je7Lm2XqN9Vz"
|
|
7715
8350
|
},
|
|
7716
8351
|
{
|
|
@@ -7718,7 +8353,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7718
8353
|
name: "Sulaka Provincial Office",
|
|
7719
8354
|
locationType: "CRVS_OFFICE",
|
|
7720
8355
|
administrativeAreaId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
|
|
7721
|
-
validUntil: null,
|
|
7722
8356
|
externalId: "Ht2Wp9KcX5Qv"
|
|
7723
8357
|
},
|
|
7724
8358
|
{
|
|
@@ -7726,7 +8360,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7726
8360
|
name: "Ilanga District Office",
|
|
7727
8361
|
locationType: "CRVS_OFFICE",
|
|
7728
8362
|
administrativeAreaId: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
|
|
7729
|
-
validUntil: null,
|
|
7730
8363
|
externalId: "Yp6Ds1WqN3Xz"
|
|
7731
8364
|
},
|
|
7732
8365
|
{
|
|
@@ -7734,7 +8367,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7734
8367
|
name: "Chamakubi Health Post",
|
|
7735
8368
|
locationType: "HEALTH_FACILITY",
|
|
7736
8369
|
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7737
|
-
validUntil: null,
|
|
7738
8370
|
externalId: "M1nFr8LbC2Qy"
|
|
7739
8371
|
},
|
|
7740
8372
|
{
|
|
@@ -7742,7 +8374,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7742
8374
|
name: "Ibombo Rural Health Centre",
|
|
7743
8375
|
locationType: "HEALTH_FACILITY",
|
|
7744
8376
|
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7745
|
-
validUntil: null,
|
|
7746
8377
|
externalId: "bT7pV6YrW0Xc"
|
|
7747
8378
|
},
|
|
7748
8379
|
{
|
|
@@ -7750,7 +8381,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7750
8381
|
name: "Chikobo Rural Health Centre",
|
|
7751
8382
|
locationType: "HEALTH_FACILITY",
|
|
7752
8383
|
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7753
|
-
validUntil: null,
|
|
7754
8384
|
externalId: "zE4qPn2SgJ5d"
|
|
7755
8385
|
},
|
|
7756
8386
|
{
|
|
@@ -7758,7 +8388,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7758
8388
|
name: "Chilochabalenje Health Post",
|
|
7759
8389
|
locationType: "HEALTH_FACILITY",
|
|
7760
8390
|
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7761
|
-
validUntil: null,
|
|
7762
8391
|
externalId: "H8vDs1MqR4Uf"
|
|
7763
8392
|
},
|
|
7764
8393
|
{
|
|
@@ -7766,7 +8395,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7766
8395
|
name: "Chipeso Rural Health Centre",
|
|
7767
8396
|
locationType: "HEALTH_FACILITY",
|
|
7768
8397
|
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7769
|
-
validUntil: null,
|
|
7770
8398
|
externalId: "Qw3uZ9KfX6Lm"
|
|
7771
8399
|
},
|
|
7772
8400
|
{
|
|
@@ -7774,7 +8402,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7774
8402
|
name: "Chisamba Rural Health Centre",
|
|
7775
8403
|
locationType: "HEALTH_FACILITY",
|
|
7776
8404
|
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7777
|
-
validUntil: null,
|
|
7778
8405
|
externalId: "Yr0pCg8LdM2s"
|
|
7779
8406
|
},
|
|
7780
8407
|
{
|
|
@@ -7782,7 +8409,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7782
8409
|
name: "Chitanda Rural Health Centre",
|
|
7783
8410
|
locationType: "HEALTH_FACILITY",
|
|
7784
8411
|
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7785
|
-
validUntil: null,
|
|
7786
8412
|
externalId: "tS9gJ4PwB1Qx"
|
|
7787
8413
|
},
|
|
7788
8414
|
{
|
|
@@ -7790,7 +8416,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7790
8416
|
name: "Golden Valley Rural Health Centre",
|
|
7791
8417
|
locationType: "HEALTH_FACILITY",
|
|
7792
8418
|
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7793
|
-
validUntil: null,
|
|
7794
8419
|
externalId: "Ld7Qm3XsA8Vr"
|
|
7795
8420
|
},
|
|
7796
8421
|
{
|
|
@@ -7798,7 +8423,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7798
8423
|
name: "Ipongo Rural Health Centre",
|
|
7799
8424
|
locationType: "HEALTH_FACILITY",
|
|
7800
8425
|
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7801
|
-
validUntil: null,
|
|
7802
8426
|
externalId: "kF2sW9DmH0Bt"
|
|
7803
8427
|
},
|
|
7804
8428
|
{
|
|
@@ -7806,7 +8430,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7806
8430
|
name: "Itumbwe Health Post",
|
|
7807
8431
|
locationType: "HEALTH_FACILITY",
|
|
7808
8432
|
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7809
|
-
validUntil: null,
|
|
7810
8433
|
externalId: "Ue5Xb3VaC7Pq"
|
|
7811
8434
|
},
|
|
7812
8435
|
{
|
|
@@ -7814,7 +8437,6 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7814
8437
|
name: "Kabangalala Rural Health Centre",
|
|
7815
8438
|
locationType: "HEALTH_FACILITY",
|
|
7816
8439
|
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7817
|
-
validUntil: null,
|
|
7818
8440
|
externalId: "Pz8Kc1TqH6Jn"
|
|
7819
8441
|
},
|
|
7820
8442
|
// Village offices
|
|
@@ -7823,10 +8445,10 @@ var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
|
7823
8445
|
name: "Klow Village Office",
|
|
7824
8446
|
locationType: "CRVS_OFFICE",
|
|
7825
8447
|
administrativeAreaId: "1d4e5f6a-7b8c-4912-8efa-345678901234",
|
|
7826
|
-
validUntil: null,
|
|
7827
8448
|
externalId: "PmAyxAJkxiJ"
|
|
7828
8449
|
}
|
|
7829
8450
|
];
|
|
8451
|
+
var V2_DEFAULT_MOCK_LOCATIONS = MOCK_LOCATIONS_BASE.map(withVersionFields);
|
|
7830
8452
|
var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
|
|
7831
8453
|
V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, l])
|
|
7832
8454
|
);
|
|
@@ -7834,8 +8456,56 @@ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
|
|
|
7834
8456
|
V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
|
|
7835
8457
|
);
|
|
7836
8458
|
|
|
7837
|
-
// ../commons/src/
|
|
8459
|
+
// ../commons/src/events/locationPayloads.ts
|
|
7838
8460
|
var z44 = __toESM(require("zod/v4"));
|
|
8461
|
+
var CreateLocationPayload = z44.object({
|
|
8462
|
+
id: UUID.optional(),
|
|
8463
|
+
versionId: UUID.optional(),
|
|
8464
|
+
name: z44.string(),
|
|
8465
|
+
externalId: z44.string().nullish(),
|
|
8466
|
+
administrativeAreaId: UUID.nullable(),
|
|
8467
|
+
locationType: z44.string().nullable(),
|
|
8468
|
+
effectiveFrom: z44.iso.date().optional(),
|
|
8469
|
+
status: LocationStatus.default("active")
|
|
8470
|
+
});
|
|
8471
|
+
var UpdateLocationPayload = z44.strictObject({
|
|
8472
|
+
id: UUID,
|
|
8473
|
+
versionId: UUID.optional(),
|
|
8474
|
+
name: z44.string(),
|
|
8475
|
+
externalId: z44.string().nullish(),
|
|
8476
|
+
status: LocationStatus,
|
|
8477
|
+
effectiveFrom: z44.iso.date().optional(),
|
|
8478
|
+
lastVersionId: UUID
|
|
8479
|
+
});
|
|
8480
|
+
var WithdrawLocationVersionPayload = z44.object({
|
|
8481
|
+
id: UUID,
|
|
8482
|
+
versionId: UUID
|
|
8483
|
+
});
|
|
8484
|
+
var CreateAdministrativeAreaPayload = z44.object({
|
|
8485
|
+
id: UUID.optional(),
|
|
8486
|
+
versionId: UUID.optional(),
|
|
8487
|
+
name: z44.string(),
|
|
8488
|
+
externalId: z44.string().nullish(),
|
|
8489
|
+
parentId: UUID.nullable(),
|
|
8490
|
+
effectiveFrom: z44.iso.date().optional(),
|
|
8491
|
+
status: LocationStatus.default("active")
|
|
8492
|
+
});
|
|
8493
|
+
var UpdateAdministrativeAreaPayload = z44.strictObject({
|
|
8494
|
+
id: UUID,
|
|
8495
|
+
versionId: UUID.optional(),
|
|
8496
|
+
name: z44.string(),
|
|
8497
|
+
externalId: z44.string().nullish(),
|
|
8498
|
+
status: LocationStatus,
|
|
8499
|
+
effectiveFrom: z44.iso.date().optional(),
|
|
8500
|
+
lastVersionId: UUID
|
|
8501
|
+
});
|
|
8502
|
+
var WithdrawAdministrativeAreaVersionPayload = z44.object({
|
|
8503
|
+
id: UUID,
|
|
8504
|
+
versionId: UUID
|
|
8505
|
+
});
|
|
8506
|
+
|
|
8507
|
+
// ../commons/src/notification/UserNotifications.ts
|
|
8508
|
+
var z45 = __toESM(require("zod/v4"));
|
|
7839
8509
|
var TriggerEvent = {
|
|
7840
8510
|
USER_CREATED: "user-created",
|
|
7841
8511
|
USER_UPDATED: "user-updated",
|
|
@@ -7848,54 +8518,54 @@ var TriggerEvent = {
|
|
|
7848
8518
|
CHANGE_PHONE_NUMBER: "change-phone-number",
|
|
7849
8519
|
CHANGE_EMAIL_ADDRESS: "change-email-address"
|
|
7850
8520
|
};
|
|
7851
|
-
var Recipient =
|
|
8521
|
+
var Recipient = z45.object({
|
|
7852
8522
|
name: NameFieldValue.optional(),
|
|
7853
|
-
mobile:
|
|
7854
|
-
email:
|
|
7855
|
-
bcc:
|
|
8523
|
+
mobile: z45.string().optional(),
|
|
8524
|
+
email: z45.string().optional(),
|
|
8525
|
+
bcc: z45.array(z45.string()).optional()
|
|
7856
8526
|
});
|
|
7857
|
-
var BasePayload =
|
|
8527
|
+
var BasePayload = z45.object({
|
|
7858
8528
|
recipient: Recipient
|
|
7859
8529
|
});
|
|
7860
8530
|
var TriggerPayload = {
|
|
7861
8531
|
[TriggerEvent.USER_CREATED]: BasePayload.extend({
|
|
7862
|
-
username:
|
|
7863
|
-
temporaryPassword:
|
|
8532
|
+
username: z45.string(),
|
|
8533
|
+
temporaryPassword: z45.string()
|
|
7864
8534
|
}),
|
|
7865
8535
|
[TriggerEvent.USER_UPDATED]: BasePayload.extend({
|
|
7866
|
-
oldUsername:
|
|
7867
|
-
newUsername:
|
|
8536
|
+
oldUsername: z45.string(),
|
|
8537
|
+
newUsername: z45.string()
|
|
7868
8538
|
}),
|
|
7869
8539
|
[TriggerEvent.USERNAME_REMINDER]: BasePayload.extend({
|
|
7870
|
-
username:
|
|
8540
|
+
username: z45.string()
|
|
7871
8541
|
}),
|
|
7872
8542
|
[TriggerEvent.RESET_PASSWORD]: BasePayload.extend({
|
|
7873
|
-
code:
|
|
8543
|
+
code: z45.string()
|
|
7874
8544
|
}),
|
|
7875
8545
|
[TriggerEvent.RESET_PASSWORD_BY_ADMIN]: BasePayload.extend({
|
|
7876
|
-
temporaryPassword:
|
|
7877
|
-
admin:
|
|
7878
|
-
id:
|
|
8546
|
+
temporaryPassword: z45.string(),
|
|
8547
|
+
admin: z45.object({
|
|
8548
|
+
id: z45.string(),
|
|
7879
8549
|
name: NameFieldValue,
|
|
7880
|
-
role:
|
|
8550
|
+
role: z45.string()
|
|
7881
8551
|
})
|
|
7882
8552
|
}),
|
|
7883
8553
|
[TriggerEvent.RESEND_INVITE]: BasePayload.extend({
|
|
7884
|
-
username:
|
|
7885
|
-
temporaryPassword:
|
|
8554
|
+
username: z45.string(),
|
|
8555
|
+
temporaryPassword: z45.string()
|
|
7886
8556
|
}),
|
|
7887
8557
|
[TriggerEvent.TWO_FA]: BasePayload.extend({
|
|
7888
|
-
code:
|
|
8558
|
+
code: z45.string()
|
|
7889
8559
|
}),
|
|
7890
8560
|
[TriggerEvent.ALL_USER_NOTIFICATION]: BasePayload.extend({
|
|
7891
|
-
subject:
|
|
7892
|
-
body:
|
|
8561
|
+
subject: z45.string(),
|
|
8562
|
+
body: z45.string()
|
|
7893
8563
|
}),
|
|
7894
8564
|
[TriggerEvent.CHANGE_PHONE_NUMBER]: BasePayload.extend({
|
|
7895
|
-
code:
|
|
8565
|
+
code: z45.string()
|
|
7896
8566
|
}),
|
|
7897
8567
|
[TriggerEvent.CHANGE_EMAIL_ADDRESS]: BasePayload.extend({
|
|
7898
|
-
code:
|
|
8568
|
+
code: z45.string()
|
|
7899
8569
|
})
|
|
7900
8570
|
};
|
|
7901
8571
|
async function triggerUserEventNotification({
|
|
@@ -7919,4 +8589,4 @@ function parseUserEventTrigger(event2, body) {
|
|
|
7919
8589
|
}
|
|
7920
8590
|
|
|
7921
8591
|
// src/notification/index.ts
|
|
7922
|
-
|
|
8592
|
+
z46.globalRegistry.clear();
|