@opencrvs/toolkit 1.9.8-rc.0cafd28 → 1.9.8-rc.0cf339f
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/commons/api/router.d.ts +31001 -2467
- package/dist/commons/conditionals/conditionals.d.ts +1037 -1
- package/dist/commons/conditionals/validate.d.ts +11 -4
- package/dist/commons/events/ActionConfig.d.ts +26853 -1552
- package/dist/commons/events/ActionDocument.d.ts +846 -1899
- package/dist/commons/events/ActionInput.d.ts +277 -1073
- package/dist/commons/events/ActionType.d.ts +86 -9
- package/dist/commons/events/AdvancedSearchConfig.d.ts +228 -1238
- package/dist/commons/events/CompositeFieldValue.d.ts +29 -190
- package/dist/commons/events/Conditional.d.ts +26 -38
- package/dist/commons/events/Constants.d.ts +1 -1
- package/dist/commons/events/CountryConfigQueryInput.d.ts +1195 -4223
- package/dist/commons/events/DeduplicationConfig.d.ts +15 -171
- package/dist/commons/events/Draft.d.ts +71 -106
- package/dist/commons/events/DynamicFieldValue.d.ts +7 -91
- package/dist/commons/events/EventConfig.d.ts +21436 -2120
- package/dist/commons/events/EventConfigInput.d.ts +1 -1
- package/dist/commons/events/EventDocument.d.ts +337 -1349
- package/dist/commons/events/EventIndex.d.ts +196 -983
- package/dist/commons/events/EventInput.d.ts +3 -8
- package/dist/commons/events/EventMetadata.d.ts +113 -354
- package/dist/commons/events/FieldConfig.d.ts +4974 -12346
- package/dist/commons/events/FieldType.d.ts +20 -4
- package/dist/commons/events/FieldTypeMapping.d.ts +193 -897
- package/dist/commons/events/FieldValue.d.ts +87 -396
- package/dist/commons/events/Flag.d.ts +67 -0
- package/dist/commons/events/FormConfig.d.ts +15108 -721
- package/dist/commons/events/PageConfig.d.ts +10092 -319
- package/dist/commons/events/SummaryConfig.d.ts +14 -161
- package/dist/commons/events/TemplateConfig.d.ts +2 -3
- package/dist/commons/events/TranslationConfig.d.ts +2 -2
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +74 -37
- package/dist/commons/events/WorkqueueConfig.d.ts +1865 -7177
- package/dist/commons/events/deduplication.d.ts +3 -3
- package/dist/commons/events/defineConfig.d.ts +28019 -147
- package/dist/commons/events/eventConfigValidation.d.ts +8 -0
- package/dist/commons/events/field.d.ts +154 -0
- package/dist/commons/events/index.d.ts +1 -0
- package/dist/commons/events/locations.d.ts +26 -19
- package/dist/commons/events/scopes.d.ts +5 -4
- package/dist/commons/events/state/availableActions.d.ts +0 -2
- package/dist/commons/events/state/flags.d.ts +21 -3
- package/dist/commons/events/state/index.d.ts +24 -21
- package/dist/commons/events/state/utils.d.ts +150 -132
- package/dist/commons/events/test.utils.d.ts +31 -8
- package/dist/commons/events/transactions.d.ts +1 -1
- package/dist/commons/events/utils.d.ts +56079 -370
- package/dist/commons/notification/UserNotifications.d.ts +55 -636
- package/dist/conditionals/index.d.ts.map +1 -1
- package/dist/conditionals/index.js +155 -11
- package/dist/events/deduplication.d.ts +3 -3
- package/dist/events/index.js +2210 -1734
- package/dist/notification/index.d.ts.map +1 -1
- package/dist/notification/index.js +1802 -1571
- package/dist/scopes/index.d.ts +169 -133
- package/dist/scopes/index.d.ts.map +1 -1
- package/dist/scopes/index.js +135 -94
- package/package.json +5 -5
- package/dist/commons/events/CreatedAtLocation.d.ts +0 -2
|
@@ -38,6 +38,7 @@ __export(notification_exports, {
|
|
|
38
38
|
triggerUserEventNotification: () => triggerUserEventNotification
|
|
39
39
|
});
|
|
40
40
|
module.exports = __toCommonJS(notification_exports);
|
|
41
|
+
var z41 = __toESM(require("zod/v4"));
|
|
41
42
|
|
|
42
43
|
// ../commons/src/url.ts
|
|
43
44
|
function joinUrl(base, path) {
|
|
@@ -47,30 +48,28 @@ function joinUrl(base, path) {
|
|
|
47
48
|
|
|
48
49
|
// ../commons/src/events/Constants.ts
|
|
49
50
|
var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
|
|
50
|
-
var
|
|
51
|
+
var CHILD_ONBOARDING_EVENT = "child-onboarding";
|
|
51
52
|
|
|
52
53
|
// ../commons/src/events/ActionConfig.ts
|
|
53
|
-
var
|
|
54
|
+
var z22 = __toESM(require("zod/v4"));
|
|
54
55
|
|
|
55
56
|
// ../commons/src/events/TranslationConfig.ts
|
|
56
|
-
var
|
|
57
|
-
var
|
|
58
|
-
|
|
59
|
-
var TranslationConfig = import_zod.z.object({
|
|
60
|
-
id: import_zod.z.string().describe(
|
|
57
|
+
var z = __toESM(require("zod/v4"));
|
|
58
|
+
var TranslationConfig = z.object({
|
|
59
|
+
id: z.string().describe(
|
|
61
60
|
"The identifier of the translation referred in translation CSV files"
|
|
62
61
|
),
|
|
63
|
-
defaultMessage:
|
|
64
|
-
description:
|
|
62
|
+
defaultMessage: z.string().describe("Default translation message"),
|
|
63
|
+
description: z.string().describe(
|
|
65
64
|
"Describe the translation for a translator to be able to identify it."
|
|
66
65
|
)
|
|
67
|
-
}).
|
|
66
|
+
}).meta({
|
|
68
67
|
description: "Translation configuration",
|
|
69
|
-
|
|
68
|
+
id: "TranslationConfig"
|
|
70
69
|
});
|
|
71
70
|
|
|
72
71
|
// ../commons/src/events/ActionType.ts
|
|
73
|
-
var
|
|
72
|
+
var z2 = __toESM(require("zod/v4"));
|
|
74
73
|
var ActionType = {
|
|
75
74
|
// Pre-declaration actions
|
|
76
75
|
DELETE: "DELETE",
|
|
@@ -78,8 +77,8 @@ var ActionType = {
|
|
|
78
77
|
NOTIFY: "NOTIFY",
|
|
79
78
|
// Declaration actions
|
|
80
79
|
DECLARE: "DECLARE",
|
|
81
|
-
VALIDATE: "VALIDATE",
|
|
82
80
|
REGISTER: "REGISTER",
|
|
81
|
+
EDIT: "EDIT",
|
|
83
82
|
// Declaration system actions. Non-configurable.
|
|
84
83
|
DUPLICATE_DETECTED: "DUPLICATE_DETECTED",
|
|
85
84
|
REJECT: "REJECT",
|
|
@@ -95,26 +94,29 @@ var ActionType = {
|
|
|
95
94
|
// General actions
|
|
96
95
|
READ: "READ",
|
|
97
96
|
ASSIGN: "ASSIGN",
|
|
98
|
-
UNASSIGN: "UNASSIGN"
|
|
97
|
+
UNASSIGN: "UNASSIGN",
|
|
98
|
+
// Custom action
|
|
99
|
+
CUSTOM: "CUSTOM"
|
|
99
100
|
};
|
|
100
101
|
var ConfirmableActions = [
|
|
101
102
|
ActionType.NOTIFY,
|
|
102
103
|
ActionType.DECLARE,
|
|
103
|
-
ActionType.
|
|
104
|
+
ActionType.EDIT,
|
|
104
105
|
ActionType.REGISTER,
|
|
105
106
|
ActionType.REJECT,
|
|
106
107
|
ActionType.ARCHIVE,
|
|
107
108
|
ActionType.PRINT_CERTIFICATE,
|
|
108
109
|
ActionType.REQUEST_CORRECTION,
|
|
109
110
|
ActionType.APPROVE_CORRECTION,
|
|
110
|
-
ActionType.REJECT_CORRECTION
|
|
111
|
+
ActionType.REJECT_CORRECTION,
|
|
112
|
+
ActionType.CUSTOM
|
|
111
113
|
];
|
|
112
|
-
var ActionTypes =
|
|
114
|
+
var ActionTypes = z2.enum([
|
|
113
115
|
"DELETE",
|
|
114
116
|
"CREATE",
|
|
115
117
|
"NOTIFY",
|
|
116
118
|
"DECLARE",
|
|
117
|
-
"
|
|
119
|
+
"EDIT",
|
|
118
120
|
"REGISTER",
|
|
119
121
|
"DUPLICATE_DETECTED",
|
|
120
122
|
"REJECT",
|
|
@@ -127,14 +129,15 @@ var ActionTypes = import_zod2.z.enum([
|
|
|
127
129
|
"APPROVE_CORRECTION",
|
|
128
130
|
"READ",
|
|
129
131
|
"ASSIGN",
|
|
130
|
-
"UNASSIGN"
|
|
132
|
+
"UNASSIGN",
|
|
133
|
+
"CUSTOM"
|
|
131
134
|
]);
|
|
132
135
|
var ClientSpecificAction = {
|
|
133
136
|
REVIEW_CORRECTION_REQUEST: "REVIEW_CORRECTION_REQUEST"
|
|
134
137
|
};
|
|
135
138
|
var declarationActionValues = [
|
|
136
139
|
ActionTypes.enum.DECLARE,
|
|
137
|
-
ActionTypes.enum.
|
|
140
|
+
ActionTypes.enum.EDIT,
|
|
138
141
|
ActionTypes.enum.REGISTER,
|
|
139
142
|
ActionTypes.enum.NOTIFY,
|
|
140
143
|
ActionTypes.enum.DUPLICATE_DETECTED
|
|
@@ -155,13 +158,14 @@ var writeActions = ActionTypes.exclude([
|
|
|
155
158
|
ActionType.UNASSIGN
|
|
156
159
|
]);
|
|
157
160
|
var workqueueActions = ActionTypes.exclude([
|
|
161
|
+
ActionType.READ,
|
|
158
162
|
ActionType.CREATE,
|
|
159
163
|
ActionType.NOTIFY,
|
|
160
164
|
ActionType.DUPLICATE_DETECTED,
|
|
161
|
-
ActionType.REJECT,
|
|
162
165
|
ActionType.MARK_AS_NOT_DUPLICATE,
|
|
163
166
|
ActionType.REJECT_CORRECTION,
|
|
164
|
-
ActionType.APPROVE_CORRECTION
|
|
167
|
+
ActionType.APPROVE_CORRECTION,
|
|
168
|
+
ActionType.CUSTOM
|
|
165
169
|
]);
|
|
166
170
|
var META_ACTIONS = [
|
|
167
171
|
ActionType.ASSIGN,
|
|
@@ -170,59 +174,57 @@ var META_ACTIONS = [
|
|
|
170
174
|
];
|
|
171
175
|
|
|
172
176
|
// ../commons/src/events/FieldConfig.ts
|
|
173
|
-
var
|
|
177
|
+
var z17 = __toESM(require("zod/v4"));
|
|
174
178
|
|
|
175
179
|
// ../commons/src/events/Conditional.ts
|
|
176
|
-
var
|
|
177
|
-
var
|
|
178
|
-
(0, import_zod_openapi2.extendZodWithOpenApi)(import_zod3.z);
|
|
179
|
-
var Conditional = import_zod3.z.custom((val) => typeof val === "object" && val !== null).openapi({
|
|
180
|
+
var z3 = __toESM(require("zod/v4"));
|
|
181
|
+
var Conditional = z3.any().describe("JSONSchema").meta({
|
|
180
182
|
description: "JSON schema conditional configuration",
|
|
181
|
-
|
|
183
|
+
id: "Conditional"
|
|
182
184
|
});
|
|
183
185
|
var ConditionalType = {
|
|
184
186
|
SHOW: "SHOW",
|
|
185
187
|
ENABLE: "ENABLE",
|
|
186
188
|
DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
|
|
187
189
|
};
|
|
188
|
-
var ShowConditional =
|
|
189
|
-
type:
|
|
190
|
+
var ShowConditional = z3.object({
|
|
191
|
+
type: z3.literal(ConditionalType.SHOW),
|
|
190
192
|
conditional: Conditional
|
|
191
193
|
}).describe(
|
|
192
194
|
"If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
|
|
193
195
|
);
|
|
194
|
-
var EnableConditional =
|
|
195
|
-
type:
|
|
196
|
+
var EnableConditional = z3.object({
|
|
197
|
+
type: z3.literal(ConditionalType.ENABLE),
|
|
196
198
|
conditional: Conditional
|
|
197
199
|
}).describe(
|
|
198
200
|
"If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
|
|
199
201
|
);
|
|
200
|
-
var ActionConditional =
|
|
202
|
+
var ActionConditional = z3.discriminatedUnion("type", [
|
|
201
203
|
// Action can be shown / hidden
|
|
202
204
|
ShowConditional,
|
|
203
205
|
// Action can be shown to the user in the list but as disabled
|
|
204
206
|
EnableConditional
|
|
205
207
|
]);
|
|
206
|
-
var DisplayOnReviewConditional =
|
|
207
|
-
type:
|
|
208
|
+
var DisplayOnReviewConditional = z3.object({
|
|
209
|
+
type: z3.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
208
210
|
conditional: Conditional
|
|
209
211
|
}).describe(
|
|
210
212
|
"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."
|
|
211
213
|
);
|
|
212
|
-
var FieldConditional =
|
|
214
|
+
var FieldConditional = z3.discriminatedUnion("type", [
|
|
213
215
|
// Field input can be shown / hidden
|
|
214
216
|
ShowConditional,
|
|
215
217
|
// Field input can be shown to the user but as disabled
|
|
216
218
|
EnableConditional,
|
|
217
219
|
// Field output can be shown / hidden on the review page
|
|
218
220
|
DisplayOnReviewConditional
|
|
219
|
-
]).
|
|
221
|
+
]).meta({
|
|
220
222
|
description: "Field conditional configuration",
|
|
221
|
-
|
|
223
|
+
id: "FieldConditional"
|
|
222
224
|
});
|
|
223
225
|
|
|
224
226
|
// ../commons/src/events/FieldType.ts
|
|
225
|
-
var
|
|
227
|
+
var z4 = __toESM(require("zod/v4"));
|
|
226
228
|
var FieldType = {
|
|
227
229
|
NAME: "NAME",
|
|
228
230
|
PHONE: "PHONE",
|
|
@@ -265,9 +267,21 @@ var FieldType = {
|
|
|
265
267
|
QUERY_PARAM_READER: "QUERY_PARAM_READER",
|
|
266
268
|
QR_READER: "QR_READER",
|
|
267
269
|
ID_READER: "ID_READER",
|
|
268
|
-
LOADER: "LOADER"
|
|
270
|
+
LOADER: "LOADER",
|
|
271
|
+
ALPHA_HIDDEN: "ALPHA_HIDDEN",
|
|
272
|
+
/**
|
|
273
|
+
* @internal
|
|
274
|
+
* @experimental
|
|
275
|
+
*
|
|
276
|
+
* Internal API used by the OpenCRVS core team for experimentation.
|
|
277
|
+
*
|
|
278
|
+
* This component is not part of the public, stable API.
|
|
279
|
+
* Its shape, behavior, or existence may change at any time or be removed
|
|
280
|
+
* entirely without notice.
|
|
281
|
+
*/
|
|
282
|
+
_EXPERIMENTAL_CUSTOM: "CUSTOM"
|
|
269
283
|
};
|
|
270
|
-
var FileFieldType =
|
|
284
|
+
var FileFieldType = z4.enum([
|
|
271
285
|
FieldType.FILE,
|
|
272
286
|
FieldType.FILE_WITH_OPTIONS,
|
|
273
287
|
FieldType.SIGNATURE
|
|
@@ -291,154 +305,155 @@ var FieldTypesToHideInReview = [
|
|
|
291
305
|
FieldType.LOADER,
|
|
292
306
|
FieldType.HTTP,
|
|
293
307
|
FieldType.QUERY_PARAM_READER,
|
|
294
|
-
FieldType.DATA
|
|
308
|
+
FieldType.DATA,
|
|
309
|
+
FieldType.ALPHA_HIDDEN
|
|
295
310
|
];
|
|
296
311
|
|
|
297
312
|
// ../commons/src/events/FieldValue.ts
|
|
298
|
-
var
|
|
313
|
+
var z7 = __toESM(require("zod/v4"));
|
|
299
314
|
|
|
300
315
|
// ../commons/src/documents.ts
|
|
301
|
-
var
|
|
302
|
-
var
|
|
303
|
-
(0, import_zod_openapi3.extendZodWithOpenApi)(import_zod5.z);
|
|
304
|
-
var FullDocumentUrl = import_zod5.z.string().brand("FullDocumentUrl").describe(
|
|
316
|
+
var z5 = __toESM(require("zod/v4"));
|
|
317
|
+
var FullDocumentUrl = z5.string().brand("FullDocumentUrl").describe(
|
|
305
318
|
"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"
|
|
306
319
|
);
|
|
307
|
-
var FullDocumentPath =
|
|
320
|
+
var FullDocumentPath = z5.string().overwrite((val) => val.startsWith("/") ? val : `/${val}`).meta({ effectType: "input", type: "string" }).describe(
|
|
308
321
|
"A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
|
|
309
322
|
);
|
|
310
|
-
var DocumentPath =
|
|
323
|
+
var DocumentPath = z5.string().brand("DocumentPath").describe(
|
|
311
324
|
"A full identifier starting from the root of the S3 bucket, e.g. /document-id.jpg or /directory/document-id.jpg but never /bucket-name/document-id.jpg"
|
|
312
325
|
);
|
|
313
326
|
|
|
314
327
|
// ../commons/src/events/CompositeFieldValue.ts
|
|
315
|
-
var
|
|
328
|
+
var z6 = __toESM(require("zod/v4"));
|
|
316
329
|
var AddressType = {
|
|
317
330
|
DOMESTIC: "DOMESTIC",
|
|
318
331
|
INTERNATIONAL: "INTERNATIONAL"
|
|
319
332
|
};
|
|
320
|
-
var FileFieldValue =
|
|
333
|
+
var FileFieldValue = z6.object({
|
|
321
334
|
path: FullDocumentPath,
|
|
322
|
-
originalFilename:
|
|
323
|
-
type:
|
|
324
|
-
});
|
|
325
|
-
var NameFieldValue =
|
|
326
|
-
firstname:
|
|
327
|
-
surname:
|
|
328
|
-
middlename:
|
|
329
|
-
});
|
|
330
|
-
var NameFieldUpdateValue =
|
|
331
|
-
firstname:
|
|
332
|
-
surname:
|
|
333
|
-
middlename:
|
|
334
|
-
}).or(
|
|
335
|
-
var StreetLevelDetailsValue =
|
|
336
|
-
var StreetLevelDetailsUpdateValue =
|
|
337
|
-
var BaseAddressFieldValue =
|
|
338
|
-
country:
|
|
335
|
+
originalFilename: z6.string(),
|
|
336
|
+
type: z6.string()
|
|
337
|
+
});
|
|
338
|
+
var NameFieldValue = z6.object({
|
|
339
|
+
firstname: z6.string(),
|
|
340
|
+
surname: z6.string(),
|
|
341
|
+
middlename: z6.string().optional()
|
|
342
|
+
});
|
|
343
|
+
var NameFieldUpdateValue = z6.object({
|
|
344
|
+
firstname: z6.string().nullish(),
|
|
345
|
+
surname: z6.string().nullish(),
|
|
346
|
+
middlename: z6.string().nullish()
|
|
347
|
+
}).or(z6.null()).or(z6.undefined());
|
|
348
|
+
var StreetLevelDetailsValue = z6.record(z6.string(), z6.string()).optional();
|
|
349
|
+
var StreetLevelDetailsUpdateValue = z6.record(z6.string(), z6.string().nullable()).nullish();
|
|
350
|
+
var BaseAddressFieldValue = z6.object({
|
|
351
|
+
country: z6.string(),
|
|
339
352
|
streetLevelDetails: StreetLevelDetailsValue
|
|
340
353
|
});
|
|
341
|
-
var BaseAddressFieldUpdateValue =
|
|
342
|
-
country:
|
|
354
|
+
var BaseAddressFieldUpdateValue = z6.object({
|
|
355
|
+
country: z6.string().nullish(),
|
|
343
356
|
streetLevelDetails: StreetLevelDetailsUpdateValue
|
|
344
357
|
});
|
|
345
358
|
var DomesticAddressFieldValue = BaseAddressFieldValue.extend({
|
|
346
|
-
addressType:
|
|
347
|
-
administrativeArea:
|
|
359
|
+
addressType: z6.literal(AddressType.DOMESTIC),
|
|
360
|
+
administrativeArea: z6.string().uuid()
|
|
348
361
|
});
|
|
349
362
|
var InternationalAddressFieldValue = BaseAddressFieldValue.extend({
|
|
350
|
-
addressType:
|
|
363
|
+
addressType: z6.literal(AddressType.INTERNATIONAL)
|
|
351
364
|
});
|
|
352
|
-
var AddressFieldValue =
|
|
365
|
+
var AddressFieldValue = z6.discriminatedUnion("addressType", [
|
|
353
366
|
DomesticAddressFieldValue,
|
|
354
367
|
InternationalAddressFieldValue
|
|
355
368
|
]);
|
|
356
369
|
var DomesticAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend({
|
|
357
|
-
addressType:
|
|
358
|
-
administrativeArea:
|
|
370
|
+
addressType: z6.literal(AddressType.DOMESTIC),
|
|
371
|
+
administrativeArea: z6.string().uuid().nullish()
|
|
359
372
|
/* Leaf level admin structure */
|
|
360
373
|
});
|
|
361
374
|
var InternationalAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend(
|
|
362
375
|
{
|
|
363
|
-
addressType:
|
|
376
|
+
addressType: z6.literal(AddressType.INTERNATIONAL)
|
|
364
377
|
}
|
|
365
378
|
);
|
|
366
|
-
var AddressFieldUpdateValue =
|
|
379
|
+
var AddressFieldUpdateValue = z6.discriminatedUnion("addressType", [
|
|
367
380
|
DomesticAddressUpdateFieldValue,
|
|
368
381
|
InternationalAddressUpdateFieldValue
|
|
369
382
|
]).nullish();
|
|
370
|
-
var FileFieldValueWithOption =
|
|
383
|
+
var FileFieldValueWithOption = z6.object({
|
|
371
384
|
path: FullDocumentPath,
|
|
372
|
-
originalFilename:
|
|
373
|
-
type:
|
|
374
|
-
option:
|
|
375
|
-
});
|
|
376
|
-
var FileFieldWithOptionValue =
|
|
377
|
-
var HttpFieldValue =
|
|
378
|
-
loading:
|
|
379
|
-
error:
|
|
380
|
-
data:
|
|
381
|
-
});
|
|
382
|
-
var HttpFieldUpdateValue =
|
|
383
|
-
loading:
|
|
384
|
-
error:
|
|
385
|
-
data:
|
|
386
|
-
}).or(
|
|
387
|
-
var QueryParamReaderFieldValue =
|
|
388
|
-
data:
|
|
385
|
+
originalFilename: z6.string(),
|
|
386
|
+
type: z6.string(),
|
|
387
|
+
option: z6.string()
|
|
388
|
+
});
|
|
389
|
+
var FileFieldWithOptionValue = z6.array(FileFieldValueWithOption);
|
|
390
|
+
var HttpFieldValue = z6.object({
|
|
391
|
+
loading: z6.boolean(),
|
|
392
|
+
error: z6.object({ statusCode: z6.number(), message: z6.string() }).nullish(),
|
|
393
|
+
data: z6.any()
|
|
394
|
+
});
|
|
395
|
+
var HttpFieldUpdateValue = z6.object({
|
|
396
|
+
loading: z6.boolean().nullish(),
|
|
397
|
+
error: z6.object({ statusCode: z6.number(), message: z6.string() }).nullish(),
|
|
398
|
+
data: z6.any().nullish()
|
|
399
|
+
}).or(z6.null()).or(z6.undefined());
|
|
400
|
+
var QueryParamReaderFieldValue = z6.object({
|
|
401
|
+
data: z6.record(z6.string(), z6.string())
|
|
389
402
|
}).nullish();
|
|
390
|
-
var QueryParamReaderFieldUpdateValue =
|
|
391
|
-
data:
|
|
403
|
+
var QueryParamReaderFieldUpdateValue = z6.object({
|
|
404
|
+
data: z6.record(z6.string(), z6.string())
|
|
392
405
|
});
|
|
393
|
-
var ReadDataValue =
|
|
394
|
-
data:
|
|
406
|
+
var ReadDataValue = z6.object({
|
|
407
|
+
data: z6.any()
|
|
395
408
|
});
|
|
396
409
|
var QrReaderFieldValue = ReadDataValue;
|
|
397
410
|
var IdReaderFieldValue = ReadDataValue;
|
|
398
|
-
var NumberWithUnitFieldValue =
|
|
399
|
-
numericValue:
|
|
400
|
-
unit:
|
|
411
|
+
var NumberWithUnitFieldValue = z6.object({
|
|
412
|
+
numericValue: z6.number(),
|
|
413
|
+
unit: z6.string()
|
|
401
414
|
});
|
|
402
|
-
var NumberWithUnitFieldUpdateValue =
|
|
403
|
-
numericValue:
|
|
404
|
-
unit:
|
|
415
|
+
var NumberWithUnitFieldUpdateValue = z6.object({
|
|
416
|
+
numericValue: z6.number().optional(),
|
|
417
|
+
unit: z6.string().optional()
|
|
405
418
|
});
|
|
419
|
+
var CustomFieldValue = z6.unknown().brand("CustomFieldValue");
|
|
406
420
|
|
|
407
421
|
// ../commons/src/events/FieldValue.ts
|
|
408
|
-
var TextValue =
|
|
422
|
+
var TextValue = z7.string();
|
|
423
|
+
var HiddenFieldValue = z7.string();
|
|
409
424
|
var NonEmptyTextValue = TextValue.min(1);
|
|
410
|
-
var DateValue =
|
|
411
|
-
var AgeValue =
|
|
412
|
-
age:
|
|
413
|
-
asOfDateRef:
|
|
425
|
+
var DateValue = z7.iso.date().describe("Date in the format YYYY-MM-DD");
|
|
426
|
+
var AgeValue = z7.object({
|
|
427
|
+
age: z7.number(),
|
|
428
|
+
asOfDateRef: z7.string()
|
|
414
429
|
});
|
|
415
430
|
var AgeUpdateValue = AgeValue.optional().nullable();
|
|
416
|
-
var TimeValue =
|
|
417
|
-
var DatetimeValue =
|
|
418
|
-
var SelectDateRangeValue =
|
|
431
|
+
var TimeValue = z7.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/);
|
|
432
|
+
var DatetimeValue = z7.iso.datetime();
|
|
433
|
+
var SelectDateRangeValue = z7.enum([
|
|
419
434
|
"last7Days",
|
|
420
435
|
"last30Days",
|
|
421
436
|
"last90Days",
|
|
422
437
|
"last365Days"
|
|
423
438
|
]);
|
|
424
|
-
var DateRangeFieldValue =
|
|
439
|
+
var DateRangeFieldValue = z7.object({
|
|
425
440
|
start: DateValue,
|
|
426
441
|
end: DateValue
|
|
427
442
|
}).or(DateValue).describe(
|
|
428
443
|
"Date range with start and end dates in the format YYYY-MM-DD. Inclusive start, exclusive end."
|
|
429
444
|
);
|
|
430
|
-
var EmailValue =
|
|
431
|
-
var CheckboxFieldValue =
|
|
432
|
-
var NumberFieldValue =
|
|
433
|
-
var SignatureFieldValue =
|
|
434
|
-
var ButtonFieldValue =
|
|
435
|
-
var VerificationStatusValue =
|
|
445
|
+
var EmailValue = z7.email();
|
|
446
|
+
var CheckboxFieldValue = z7.boolean();
|
|
447
|
+
var NumberFieldValue = z7.number();
|
|
448
|
+
var SignatureFieldValue = z7.string();
|
|
449
|
+
var ButtonFieldValue = z7.number();
|
|
450
|
+
var VerificationStatusValue = z7.enum([
|
|
436
451
|
"verified",
|
|
437
452
|
"authenticated",
|
|
438
453
|
"failed",
|
|
439
454
|
"pending"
|
|
440
455
|
]);
|
|
441
|
-
var FieldValuesWithoutDataField =
|
|
456
|
+
var FieldValuesWithoutDataField = z7.union([
|
|
442
457
|
AddressFieldValue,
|
|
443
458
|
TextValue,
|
|
444
459
|
DateValue,
|
|
@@ -459,12 +474,13 @@ var FieldValuesWithoutDataField = import_zod7.z.union([
|
|
|
459
474
|
QrReaderFieldValue,
|
|
460
475
|
IdReaderFieldValue,
|
|
461
476
|
NumberWithUnitFieldValue,
|
|
462
|
-
NumberWithUnitFieldUpdateValue
|
|
477
|
+
NumberWithUnitFieldUpdateValue,
|
|
478
|
+
CustomFieldValue
|
|
463
479
|
]);
|
|
464
|
-
var DataFieldValue =
|
|
465
|
-
data:
|
|
480
|
+
var DataFieldValue = z7.object({
|
|
481
|
+
data: z7.record(z7.string(), FieldValuesWithoutDataField)
|
|
466
482
|
}).nullish();
|
|
467
|
-
var FieldValue =
|
|
483
|
+
var FieldValue = z7.union([
|
|
468
484
|
FieldValuesWithoutDataField,
|
|
469
485
|
DataFieldValue
|
|
470
486
|
]);
|
|
@@ -485,22 +501,38 @@ var PRIORITY_ORDER = [
|
|
|
485
501
|
"DataFieldValue"
|
|
486
502
|
];
|
|
487
503
|
function schemaPriority(schema) {
|
|
488
|
-
const name = schema.
|
|
504
|
+
const name = schema.description;
|
|
505
|
+
if (!name) {
|
|
506
|
+
return 9999;
|
|
507
|
+
}
|
|
489
508
|
const idx = PRIORITY_ORDER.indexOf(name);
|
|
490
509
|
return idx === -1 ? 9999 : idx;
|
|
491
510
|
}
|
|
492
511
|
function safeUnion(schemas) {
|
|
493
|
-
return
|
|
512
|
+
return z7.any().superRefine((val, ctx) => {
|
|
494
513
|
const successful = schemas.filter((s) => s.safeParse(val).success);
|
|
495
514
|
if (successful.length === 1) {
|
|
496
|
-
return
|
|
515
|
+
return;
|
|
497
516
|
}
|
|
498
517
|
if (successful.length === 0) {
|
|
499
|
-
|
|
518
|
+
ctx.addIssue({
|
|
519
|
+
code: "invalid_type",
|
|
520
|
+
expected: "custom",
|
|
521
|
+
message: "Value does not match any schema"
|
|
522
|
+
});
|
|
523
|
+
return;
|
|
500
524
|
}
|
|
501
525
|
successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
|
|
502
526
|
const best = successful[0];
|
|
503
|
-
|
|
527
|
+
if (!best.safeParse(val).success) {
|
|
528
|
+
ctx.addIssue({
|
|
529
|
+
expected: "custom",
|
|
530
|
+
code: "invalid_type",
|
|
531
|
+
message: "Value did not match the best schema"
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
}).meta({
|
|
535
|
+
description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
|
|
504
536
|
});
|
|
505
537
|
}
|
|
506
538
|
var FieldUpdateValue = safeUnion([
|
|
@@ -519,24 +551,23 @@ var FieldUpdateValue = safeUnion([
|
|
|
519
551
|
DataFieldValue.describe("DataFieldValue"),
|
|
520
552
|
NameFieldUpdateValue.describe("NameFieldUpdateValue"),
|
|
521
553
|
HttpFieldUpdateValue.describe("HttpFieldUpdateValue"),
|
|
522
|
-
QueryParamReaderFieldUpdateValue.describe("QueryParamReaderFieldUpdateValue")
|
|
554
|
+
QueryParamReaderFieldUpdateValue.describe("QueryParamReaderFieldUpdateValue"),
|
|
555
|
+
CustomFieldValue.describe("CustomFieldValue"),
|
|
556
|
+
HiddenFieldValue.describe("HiddenFieldValue")
|
|
523
557
|
]);
|
|
524
558
|
|
|
525
|
-
// ../commons/src/events/FieldConfig.ts
|
|
526
|
-
var import_zod_openapi6 = require("zod-openapi");
|
|
527
|
-
|
|
528
559
|
// ../commons/src/uuid.ts
|
|
529
560
|
var import_uuid = require("uuid");
|
|
530
|
-
var
|
|
531
|
-
var UUID =
|
|
561
|
+
var z8 = __toESM(require("zod/v4"));
|
|
562
|
+
var UUID = z8.uuid().brand("UUID");
|
|
532
563
|
function getUUID() {
|
|
533
564
|
return (0, import_uuid.v4)();
|
|
534
565
|
}
|
|
535
566
|
|
|
536
567
|
// ../commons/src/events/serializers/user/serializer.ts
|
|
537
|
-
var
|
|
538
|
-
var SerializedUserField =
|
|
539
|
-
$userField:
|
|
568
|
+
var z9 = __toESM(require("zod/v4"));
|
|
569
|
+
var SerializedUserField = z9.object({
|
|
570
|
+
$userField: z9.enum([
|
|
540
571
|
"id",
|
|
541
572
|
"name",
|
|
542
573
|
"role",
|
|
@@ -545,11 +576,12 @@ var SerializedUserField = import_zod9.z.object({
|
|
|
545
576
|
"firstname",
|
|
546
577
|
"middlename",
|
|
547
578
|
"surname",
|
|
548
|
-
"
|
|
549
|
-
"
|
|
550
|
-
"primaryOfficeId"
|
|
579
|
+
"signature",
|
|
580
|
+
"avatar",
|
|
581
|
+
"primaryOfficeId",
|
|
582
|
+
"administrativeAreaId"
|
|
551
583
|
]),
|
|
552
|
-
$location:
|
|
584
|
+
$location: z9.string().optional()
|
|
553
585
|
});
|
|
554
586
|
function userSerializer(userField) {
|
|
555
587
|
return {
|
|
@@ -569,24 +601,20 @@ function userSerializer(userField) {
|
|
|
569
601
|
}
|
|
570
602
|
|
|
571
603
|
// ../commons/src/events/EventIndex.ts
|
|
572
|
-
var
|
|
604
|
+
var import_v4 = require("zod/v4");
|
|
573
605
|
|
|
574
606
|
// ../commons/src/events/EventMetadata.ts
|
|
575
|
-
var
|
|
607
|
+
var z14 = __toESM(require("zod/v4"));
|
|
576
608
|
|
|
577
609
|
// ../commons/src/events/ActionDocument.ts
|
|
578
|
-
var
|
|
579
|
-
var import_zod_openapi4 = require("zod-openapi");
|
|
580
|
-
|
|
581
|
-
// ../commons/src/events/CreatedAtLocation.ts
|
|
582
|
-
var CreatedAtLocation = UUID.nullish();
|
|
610
|
+
var z12 = __toESM(require("zod/v4"));
|
|
583
611
|
|
|
584
612
|
// ../commons/src/authentication.ts
|
|
585
613
|
var import_jwt_decode = __toESM(require("jwt-decode"));
|
|
586
|
-
var
|
|
614
|
+
var z11 = __toESM(require("zod/v4"));
|
|
587
615
|
|
|
588
616
|
// ../commons/src/scopes.ts
|
|
589
|
-
var
|
|
617
|
+
var z10 = __toESM(require("zod/v4"));
|
|
590
618
|
var SCOPES = {
|
|
591
619
|
// TODO v1.8 legacy scopes
|
|
592
620
|
BYPASSRATELIMIT: "bypassratelimit",
|
|
@@ -601,6 +629,7 @@ var SCOPES = {
|
|
|
601
629
|
RECORD_IMPORT: "record.import",
|
|
602
630
|
RECORD_EXPORT: "record.export",
|
|
603
631
|
RECORD_REINDEX: "record.reindex",
|
|
632
|
+
INTEGRATION_CREATE: "integration.create",
|
|
604
633
|
// declare
|
|
605
634
|
RECORD_DECLARE_BIRTH: "record.declare-birth",
|
|
606
635
|
RECORD_DECLARE_BIRTH_MY_JURISDICTION: "record.declare-birth:my-jurisdiction",
|
|
@@ -665,91 +694,92 @@ var SCOPES = {
|
|
|
665
694
|
// data seeding
|
|
666
695
|
USER_DATA_SEEDING: "user.data-seeding"
|
|
667
696
|
};
|
|
668
|
-
var LegacyScopes =
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
697
|
+
var LegacyScopes = z10.union([
|
|
698
|
+
z10.literal(SCOPES.BYPASSRATELIMIT),
|
|
699
|
+
z10.literal(SCOPES.REGISTER),
|
|
700
|
+
z10.literal(SCOPES.DEMO),
|
|
701
|
+
z10.literal(SCOPES.CONFIG)
|
|
673
702
|
]);
|
|
674
|
-
var IntegrationScopes =
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
703
|
+
var IntegrationScopes = z10.union([
|
|
704
|
+
z10.literal(SCOPES.WEBHOOK),
|
|
705
|
+
z10.literal(SCOPES.NATIONALID),
|
|
706
|
+
z10.literal(SCOPES.NOTIFICATION_API),
|
|
707
|
+
z10.literal(SCOPES.RECORDSEARCH),
|
|
708
|
+
z10.literal(SCOPES.INTEGRATION_CREATE)
|
|
679
709
|
]);
|
|
680
|
-
var InternalOperationsScopes =
|
|
681
|
-
|
|
682
|
-
|
|
710
|
+
var InternalOperationsScopes = z10.union([
|
|
711
|
+
z10.literal(SCOPES.RECORD_REINDEX),
|
|
712
|
+
z10.literal(SCOPES.RECORD_IMPORT)
|
|
683
713
|
]);
|
|
684
|
-
var DeclareScopes =
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
714
|
+
var DeclareScopes = z10.union([
|
|
715
|
+
z10.literal(SCOPES.RECORD_DECLARE_BIRTH),
|
|
716
|
+
z10.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
|
|
717
|
+
z10.literal(SCOPES.RECORD_DECLARE_DEATH),
|
|
718
|
+
z10.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
|
|
719
|
+
z10.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
|
|
720
|
+
z10.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
|
|
721
|
+
z10.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
|
|
722
|
+
z10.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW)
|
|
693
723
|
]);
|
|
694
|
-
var UnassignScope =
|
|
695
|
-
var ValidateScopes =
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
724
|
+
var UnassignScope = z10.literal(SCOPES.RECORD_UNASSIGN_OTHERS);
|
|
725
|
+
var ValidateScopes = z10.union([
|
|
726
|
+
z10.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
|
|
727
|
+
z10.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
|
|
728
|
+
z10.literal(SCOPES.RECORD_DECLARATION_EDIT),
|
|
729
|
+
z10.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
|
|
730
|
+
z10.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
|
|
731
|
+
z10.literal(SCOPES.RECORD_DECLARATION_REINSTATE)
|
|
702
732
|
]);
|
|
703
|
-
var RegisterScope =
|
|
704
|
-
var CorrectionScopes =
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
733
|
+
var RegisterScope = z10.literal(SCOPES.RECORD_REGISTER);
|
|
734
|
+
var CorrectionScopes = z10.union([
|
|
735
|
+
z10.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
|
|
736
|
+
z10.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
|
|
737
|
+
z10.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
|
|
738
|
+
z10.literal(SCOPES.RECORD_REJECT_REGISTRATION)
|
|
709
739
|
]);
|
|
710
|
-
var SearchScopes =
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
740
|
+
var SearchScopes = z10.union([
|
|
741
|
+
z10.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
|
|
742
|
+
z10.literal(SCOPES.SEARCH_BIRTH),
|
|
743
|
+
z10.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
|
|
744
|
+
z10.literal(SCOPES.SEARCH_DEATH),
|
|
745
|
+
z10.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
|
|
746
|
+
z10.literal(SCOPES.SEARCH_MARRIAGE)
|
|
717
747
|
]);
|
|
718
|
-
var AuditScopes =
|
|
719
|
-
var PerformanceScopes =
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
748
|
+
var AuditScopes = z10.literal(SCOPES.RECORD_READ);
|
|
749
|
+
var PerformanceScopes = z10.union([
|
|
750
|
+
z10.literal(SCOPES.PERFORMANCE_READ),
|
|
751
|
+
z10.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
|
|
752
|
+
z10.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS)
|
|
723
753
|
]);
|
|
724
|
-
var OrganisationScopes =
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
754
|
+
var OrganisationScopes = z10.union([
|
|
755
|
+
z10.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
|
|
756
|
+
z10.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
|
|
757
|
+
z10.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION)
|
|
728
758
|
]);
|
|
729
|
-
var UserScopes =
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
759
|
+
var UserScopes = z10.union([
|
|
760
|
+
z10.literal(SCOPES.USER_READ),
|
|
761
|
+
z10.literal(SCOPES.USER_READ_MY_OFFICE),
|
|
762
|
+
z10.literal(SCOPES.USER_READ_MY_JURISDICTION),
|
|
763
|
+
z10.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
|
|
764
|
+
z10.literal(SCOPES.USER_CREATE),
|
|
765
|
+
z10.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
|
|
766
|
+
z10.literal(SCOPES.USER_UPDATE),
|
|
767
|
+
z10.literal(SCOPES.USER_UPDATE_MY_JURISDICTION)
|
|
738
768
|
]);
|
|
739
|
-
var ConfigScope =
|
|
740
|
-
var DataSeedingScope =
|
|
741
|
-
var LiteralScopes =
|
|
769
|
+
var ConfigScope = z10.literal(SCOPES.CONFIG_UPDATE_ALL);
|
|
770
|
+
var DataSeedingScope = z10.literal(SCOPES.USER_DATA_SEEDING);
|
|
771
|
+
var LiteralScopes = z10.union([
|
|
742
772
|
LegacyScopes,
|
|
743
773
|
IntegrationScopes,
|
|
744
774
|
UnassignScope,
|
|
745
775
|
DeclareScopes,
|
|
746
776
|
ValidateScopes,
|
|
747
777
|
RegisterScope,
|
|
748
|
-
|
|
778
|
+
z10.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
|
|
749
779
|
CorrectionScopes,
|
|
750
780
|
SearchScopes,
|
|
751
781
|
AuditScopes,
|
|
752
|
-
|
|
782
|
+
z10.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE),
|
|
753
783
|
PerformanceScopes,
|
|
754
784
|
OrganisationScopes,
|
|
755
785
|
UserScopes,
|
|
@@ -758,38 +788,38 @@ var LiteralScopes = import_zod10.z.union([
|
|
|
758
788
|
InternalOperationsScopes
|
|
759
789
|
]);
|
|
760
790
|
var rawConfigurableScopeRegex = /^([a-zA-Z][a-zA-Z0-9.-]*(?:\.[a-zA-Z0-9.-]+)*)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
|
|
761
|
-
var rawConfigurableScope =
|
|
762
|
-
var CreateUserScope =
|
|
763
|
-
type:
|
|
764
|
-
options:
|
|
765
|
-
role:
|
|
791
|
+
var rawConfigurableScope = z10.string().regex(rawConfigurableScopeRegex);
|
|
792
|
+
var CreateUserScope = z10.object({
|
|
793
|
+
type: z10.literal("user.create"),
|
|
794
|
+
options: z10.object({
|
|
795
|
+
role: z10.array(z10.string())
|
|
766
796
|
})
|
|
767
797
|
});
|
|
768
|
-
var EditUserScope =
|
|
769
|
-
type:
|
|
770
|
-
options:
|
|
771
|
-
role:
|
|
798
|
+
var EditUserScope = z10.object({
|
|
799
|
+
type: z10.literal("user.edit"),
|
|
800
|
+
options: z10.object({
|
|
801
|
+
role: z10.array(z10.string())
|
|
772
802
|
})
|
|
773
803
|
});
|
|
774
|
-
var WorkqueueScope =
|
|
775
|
-
type:
|
|
776
|
-
options:
|
|
777
|
-
id:
|
|
804
|
+
var WorkqueueScope = z10.object({
|
|
805
|
+
type: z10.literal("workqueue"),
|
|
806
|
+
options: z10.object({
|
|
807
|
+
id: z10.array(z10.string())
|
|
778
808
|
})
|
|
779
809
|
});
|
|
780
|
-
var SearchScope =
|
|
781
|
-
type:
|
|
782
|
-
options:
|
|
783
|
-
event:
|
|
784
|
-
access:
|
|
810
|
+
var SearchScope = z10.object({
|
|
811
|
+
type: z10.literal("search"),
|
|
812
|
+
options: z10.object({
|
|
813
|
+
event: z10.array(z10.string()).length(1),
|
|
814
|
+
access: z10.array(z10.enum(["my-jurisdiction", "all"])).length(1)
|
|
785
815
|
})
|
|
786
816
|
});
|
|
787
|
-
var RecordScopeType =
|
|
817
|
+
var RecordScopeType = z10.enum([
|
|
788
818
|
"record.create",
|
|
789
819
|
"record.read",
|
|
790
820
|
"record.declare",
|
|
791
821
|
"record.notify",
|
|
792
|
-
"record.declared.
|
|
822
|
+
"record.declared.edit",
|
|
793
823
|
"record.declared.reject",
|
|
794
824
|
"record.declared.archive",
|
|
795
825
|
"record.declared.review-duplicates",
|
|
@@ -799,27 +829,40 @@ var RecordScopeType = import_zod10.z.enum([
|
|
|
799
829
|
"record.registered.correct",
|
|
800
830
|
"record.unassign-others"
|
|
801
831
|
]);
|
|
802
|
-
var RecordScope =
|
|
832
|
+
var RecordScope = z10.object({
|
|
803
833
|
type: RecordScopeType,
|
|
804
|
-
options:
|
|
805
|
-
event:
|
|
834
|
+
options: z10.object({
|
|
835
|
+
event: z10.array(z10.string()).describe("Event type, e.g. birth, death")
|
|
806
836
|
})
|
|
807
837
|
}).describe(
|
|
808
838
|
"Scopes used to check user's permission to perform actions on a record."
|
|
809
839
|
);
|
|
810
|
-
var
|
|
840
|
+
var CustomActionScope = z10.object({
|
|
841
|
+
type: z10.literal("record.custom-action"),
|
|
842
|
+
options: z10.object({
|
|
843
|
+
event: z10.array(z10.string()).describe("Allowed event type, e.g. birth, death"),
|
|
844
|
+
customActionType: z10.array(z10.string()).describe("Allowed custom action types")
|
|
845
|
+
})
|
|
846
|
+
});
|
|
847
|
+
var ConfigurableRawScopes = z10.discriminatedUnion("type", [
|
|
811
848
|
SearchScope,
|
|
812
849
|
CreateUserScope,
|
|
813
850
|
EditUserScope,
|
|
814
851
|
WorkqueueScope,
|
|
815
|
-
RecordScope
|
|
852
|
+
RecordScope,
|
|
853
|
+
CustomActionScope
|
|
854
|
+
]);
|
|
855
|
+
var ConfigurableActionScopes = z10.discriminatedUnion("type", [
|
|
856
|
+
// @TODO - Record scope holds non-action scopes as well e.g., `record.read`
|
|
857
|
+
RecordScope,
|
|
858
|
+
CustomActionScope
|
|
816
859
|
]);
|
|
817
860
|
var scopes = Object.values(SCOPES);
|
|
818
|
-
var ActionScopes =
|
|
861
|
+
var ActionScopes = z10.union([
|
|
819
862
|
DeclareScopes,
|
|
820
863
|
ValidateScopes,
|
|
821
864
|
RegisterScope,
|
|
822
|
-
|
|
865
|
+
z10.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
|
|
823
866
|
CorrectionScopes
|
|
824
867
|
]);
|
|
825
868
|
|
|
@@ -953,15 +996,14 @@ var DEFAULT_ROLES_DEFINITION = [
|
|
|
953
996
|
]
|
|
954
997
|
}
|
|
955
998
|
];
|
|
956
|
-
var TokenUserType =
|
|
957
|
-
var TokenWithBearer =
|
|
999
|
+
var TokenUserType = z11.enum(["user", "system"]);
|
|
1000
|
+
var TokenWithBearer = z11.string().regex(/^Bearer\s/);
|
|
958
1001
|
|
|
959
1002
|
// ../commons/src/events/ActionDocument.ts
|
|
960
|
-
(
|
|
961
|
-
var ActionUpdate = import_zod12.z.record(import_zod12.z.string(), FieldUpdateValue).describe(
|
|
1003
|
+
var ActionUpdate = z12.record(z12.string(), FieldUpdateValue).describe(
|
|
962
1004
|
"Record of field-level changes made by an action. Supports partial updates and nullable values."
|
|
963
1005
|
);
|
|
964
|
-
var EventState =
|
|
1006
|
+
var EventState = z12.record(z12.string(), FieldValue).describe(
|
|
965
1007
|
"Aggregate representation of event data after all actions have been applied, with all updates consolidated and null values removed."
|
|
966
1008
|
);
|
|
967
1009
|
var ActionStatus = {
|
|
@@ -969,24 +1011,25 @@ var ActionStatus = {
|
|
|
969
1011
|
Accepted: "Accepted",
|
|
970
1012
|
Rejected: "Rejected"
|
|
971
1013
|
};
|
|
972
|
-
var ActionBase =
|
|
1014
|
+
var ActionBase = z12.object({
|
|
973
1015
|
id: UUID.describe("Unique identifier of the action."),
|
|
974
|
-
transactionId:
|
|
1016
|
+
transactionId: z12.string().describe("Unique identifier of the transaction."),
|
|
975
1017
|
createdByUserType: TokenUserType.describe(
|
|
976
1018
|
"Indicates whether the action was created by a human-user or by a system-user."
|
|
977
1019
|
),
|
|
978
|
-
createdAt:
|
|
979
|
-
createdBy:
|
|
980
|
-
createdByRole:
|
|
981
|
-
createdBySignature:
|
|
982
|
-
|
|
1020
|
+
createdAt: z12.string().datetime().describe("Timestamp indicating when the action was created."),
|
|
1021
|
+
createdBy: z12.string().describe("Identifier of the user who created the action."),
|
|
1022
|
+
createdByRole: z12.string().optional().describe("Role of the user who created the action."),
|
|
1023
|
+
createdBySignature: z12.string().nullish().describe("Reference to the signature of the user who created the action."),
|
|
1024
|
+
// @TODO: createdAtLocation should be non-nullable in the future once all actions have this field populated.
|
|
1025
|
+
createdAtLocation: UUID.nullish().describe(
|
|
983
1026
|
"Reference to the location of the user who created the action."
|
|
984
1027
|
),
|
|
985
1028
|
declaration: ActionUpdate.describe(
|
|
986
1029
|
"Declaration data defined by the ActionConfig. Supports partial updates."
|
|
987
1030
|
),
|
|
988
1031
|
annotation: ActionUpdate.optional().nullable().describe("Action-specific metadata used to annotate the event."),
|
|
989
|
-
status:
|
|
1032
|
+
status: z12.enum([
|
|
990
1033
|
ActionStatus.Requested,
|
|
991
1034
|
ActionStatus.Accepted,
|
|
992
1035
|
ActionStatus.Rejected
|
|
@@ -997,172 +1040,181 @@ var ActionBase = import_zod12.z.object({
|
|
|
997
1040
|
"Reference to the original action asynchronously accepted or rejected by a third-party integration."
|
|
998
1041
|
)
|
|
999
1042
|
});
|
|
1000
|
-
var AssignedAction = ActionBase.
|
|
1001
|
-
|
|
1002
|
-
type:
|
|
1003
|
-
assignedTo:
|
|
1043
|
+
var AssignedAction = ActionBase.extend(
|
|
1044
|
+
z12.object({
|
|
1045
|
+
type: z12.literal(ActionType.ASSIGN),
|
|
1046
|
+
assignedTo: z12.string().describe("Identifier of the user to whom the action is assigned.")
|
|
1004
1047
|
// TODO move into 'content' property
|
|
1005
|
-
})
|
|
1048
|
+
}).shape
|
|
1006
1049
|
);
|
|
1007
|
-
var UnassignedAction = ActionBase.
|
|
1008
|
-
|
|
1009
|
-
type:
|
|
1010
|
-
})
|
|
1050
|
+
var UnassignedAction = ActionBase.extend(
|
|
1051
|
+
z12.object({
|
|
1052
|
+
type: z12.literal(ActionType.UNASSIGN)
|
|
1053
|
+
}).shape
|
|
1011
1054
|
);
|
|
1012
|
-
var RegisterAction = ActionBase.
|
|
1013
|
-
|
|
1014
|
-
type:
|
|
1015
|
-
registrationNumber:
|
|
1055
|
+
var RegisterAction = ActionBase.extend(
|
|
1056
|
+
z12.object({
|
|
1057
|
+
type: z12.literal(ActionType.REGISTER),
|
|
1058
|
+
registrationNumber: z12.string().optional().describe(
|
|
1016
1059
|
"Registration number of the event. Always present for accepted registrations."
|
|
1017
1060
|
)
|
|
1018
1061
|
// TODO move into 'content' property
|
|
1019
|
-
})
|
|
1062
|
+
}).shape
|
|
1020
1063
|
);
|
|
1021
|
-
var DeclareAction = ActionBase.
|
|
1022
|
-
|
|
1023
|
-
type:
|
|
1024
|
-
})
|
|
1025
|
-
);
|
|
1026
|
-
var ValidateAction = ActionBase.merge(
|
|
1027
|
-
import_zod12.z.object({
|
|
1028
|
-
type: import_zod12.z.literal(ActionType.VALIDATE)
|
|
1029
|
-
})
|
|
1064
|
+
var DeclareAction = ActionBase.extend(
|
|
1065
|
+
z12.object({
|
|
1066
|
+
type: z12.literal(ActionType.DECLARE)
|
|
1067
|
+
}).shape
|
|
1030
1068
|
);
|
|
1031
|
-
var ReasonContent =
|
|
1032
|
-
reason:
|
|
1069
|
+
var ReasonContent = z12.object({
|
|
1070
|
+
reason: z12.string().min(1, { error: "Message cannot be empty" }).describe(
|
|
1033
1071
|
"Message describing the reason for rejecting or archiving the event."
|
|
1034
1072
|
)
|
|
1035
1073
|
});
|
|
1036
|
-
var RejectAction = ActionBase.
|
|
1037
|
-
|
|
1038
|
-
type:
|
|
1074
|
+
var RejectAction = ActionBase.extend(
|
|
1075
|
+
z12.object({
|
|
1076
|
+
type: z12.literal(ActionType.REJECT),
|
|
1039
1077
|
content: ReasonContent
|
|
1040
|
-
})
|
|
1078
|
+
}).shape
|
|
1041
1079
|
);
|
|
1042
|
-
var PotentialDuplicate =
|
|
1080
|
+
var PotentialDuplicate = z12.object({
|
|
1043
1081
|
id: UUID,
|
|
1044
|
-
trackingId:
|
|
1082
|
+
trackingId: z12.string()
|
|
1045
1083
|
});
|
|
1046
|
-
var DuplicateDetectedAction = ActionBase.
|
|
1047
|
-
|
|
1048
|
-
type:
|
|
1049
|
-
content:
|
|
1050
|
-
duplicates:
|
|
1084
|
+
var DuplicateDetectedAction = ActionBase.extend(
|
|
1085
|
+
z12.object({
|
|
1086
|
+
type: z12.literal(ActionType.DUPLICATE_DETECTED),
|
|
1087
|
+
content: z12.object({
|
|
1088
|
+
duplicates: z12.array(PotentialDuplicate)
|
|
1051
1089
|
})
|
|
1052
|
-
})
|
|
1090
|
+
}).shape
|
|
1053
1091
|
);
|
|
1054
|
-
var MarkNotDuplicateAction = ActionBase.
|
|
1055
|
-
|
|
1056
|
-
type:
|
|
1057
|
-
})
|
|
1092
|
+
var MarkNotDuplicateAction = ActionBase.extend(
|
|
1093
|
+
z12.object({
|
|
1094
|
+
type: z12.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
1095
|
+
}).shape
|
|
1058
1096
|
);
|
|
1059
|
-
var MarkAsDuplicateAction = ActionBase.
|
|
1060
|
-
|
|
1061
|
-
type:
|
|
1062
|
-
content:
|
|
1097
|
+
var MarkAsDuplicateAction = ActionBase.extend(
|
|
1098
|
+
z12.object({
|
|
1099
|
+
type: z12.literal(ActionType.MARK_AS_DUPLICATE),
|
|
1100
|
+
content: z12.object({
|
|
1063
1101
|
duplicateOf: UUID
|
|
1064
1102
|
}).optional()
|
|
1065
|
-
})
|
|
1103
|
+
}).shape
|
|
1066
1104
|
);
|
|
1067
|
-
var ArchiveAction = ActionBase.
|
|
1068
|
-
|
|
1069
|
-
type:
|
|
1105
|
+
var ArchiveAction = ActionBase.extend(
|
|
1106
|
+
z12.object({
|
|
1107
|
+
type: z12.literal(ActionType.ARCHIVE),
|
|
1070
1108
|
content: ReasonContent
|
|
1071
|
-
})
|
|
1109
|
+
}).shape
|
|
1072
1110
|
);
|
|
1073
|
-
var CreatedAction = ActionBase.
|
|
1074
|
-
|
|
1075
|
-
type:
|
|
1076
|
-
})
|
|
1111
|
+
var CreatedAction = ActionBase.extend(
|
|
1112
|
+
z12.object({
|
|
1113
|
+
type: z12.literal(ActionType.CREATE)
|
|
1114
|
+
}).shape
|
|
1077
1115
|
);
|
|
1078
|
-
var NotifiedAction = ActionBase.
|
|
1079
|
-
|
|
1080
|
-
type:
|
|
1081
|
-
})
|
|
1116
|
+
var NotifiedAction = ActionBase.extend(
|
|
1117
|
+
z12.object({
|
|
1118
|
+
type: z12.literal(ActionType.NOTIFY)
|
|
1119
|
+
}).shape
|
|
1120
|
+
);
|
|
1121
|
+
var EditAction = ActionBase.extend(
|
|
1122
|
+
z12.object({
|
|
1123
|
+
type: z12.literal(ActionType.EDIT),
|
|
1124
|
+
content: z12.object({
|
|
1125
|
+
comment: z12.string().describe("Comment for the edit action.").optional()
|
|
1126
|
+
})
|
|
1127
|
+
}).shape
|
|
1082
1128
|
);
|
|
1083
|
-
var PrintContent =
|
|
1084
|
-
templateId:
|
|
1129
|
+
var PrintContent = z12.object({
|
|
1130
|
+
templateId: z12.string().optional()
|
|
1085
1131
|
});
|
|
1086
|
-
var PrintCertificateAction = ActionBase.
|
|
1087
|
-
|
|
1088
|
-
type:
|
|
1132
|
+
var PrintCertificateAction = ActionBase.extend(
|
|
1133
|
+
z12.object({
|
|
1134
|
+
type: z12.literal(ActionType.PRINT_CERTIFICATE),
|
|
1089
1135
|
content: PrintContent.optional().nullable()
|
|
1090
|
-
})
|
|
1136
|
+
}).shape
|
|
1091
1137
|
);
|
|
1092
|
-
var RequestedCorrectionAction = ActionBase.
|
|
1093
|
-
|
|
1094
|
-
type:
|
|
1095
|
-
})
|
|
1138
|
+
var RequestedCorrectionAction = ActionBase.extend(
|
|
1139
|
+
z12.object({
|
|
1140
|
+
type: z12.literal(ActionType.REQUEST_CORRECTION)
|
|
1141
|
+
}).shape
|
|
1096
1142
|
);
|
|
1097
|
-
var ApprovedCorrectionAction = ActionBase.
|
|
1098
|
-
|
|
1099
|
-
type:
|
|
1100
|
-
requestId:
|
|
1143
|
+
var ApprovedCorrectionAction = ActionBase.extend(
|
|
1144
|
+
z12.object({
|
|
1145
|
+
type: z12.literal(ActionType.APPROVE_CORRECTION),
|
|
1146
|
+
requestId: z12.string()
|
|
1101
1147
|
// TODO move into 'content' property
|
|
1102
|
-
})
|
|
1148
|
+
}).shape
|
|
1103
1149
|
);
|
|
1104
|
-
var RejectedCorrectionAction = ActionBase.
|
|
1105
|
-
|
|
1106
|
-
type:
|
|
1107
|
-
requestId:
|
|
1150
|
+
var RejectedCorrectionAction = ActionBase.extend(
|
|
1151
|
+
z12.object({
|
|
1152
|
+
type: z12.literal(ActionType.REJECT_CORRECTION),
|
|
1153
|
+
requestId: z12.string(),
|
|
1108
1154
|
// TODO move into 'content' property
|
|
1109
1155
|
content: ReasonContent
|
|
1110
|
-
})
|
|
1156
|
+
}).shape
|
|
1111
1157
|
);
|
|
1112
|
-
var ReadAction = ActionBase.
|
|
1113
|
-
|
|
1114
|
-
type:
|
|
1158
|
+
var ReadAction = ActionBase.extend(
|
|
1159
|
+
z12.object({
|
|
1160
|
+
type: z12.literal(ActionType.READ)
|
|
1161
|
+
}).shape
|
|
1162
|
+
);
|
|
1163
|
+
var CustomAction = ActionBase.merge(
|
|
1164
|
+
z12.object({
|
|
1165
|
+
type: z12.literal(ActionType.CUSTOM),
|
|
1166
|
+
customActionType: z12.string()
|
|
1115
1167
|
})
|
|
1116
1168
|
);
|
|
1117
|
-
var ActionDocument =
|
|
1118
|
-
CreatedAction.
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1169
|
+
var ActionDocument = z12.discriminatedUnion("type", [
|
|
1170
|
+
CreatedAction.meta({ id: "CreatedAction" }),
|
|
1171
|
+
RejectAction.meta({ id: "RejectAction" }),
|
|
1172
|
+
DuplicateDetectedAction.meta({ id: "DuplicateDetectedAction" }),
|
|
1173
|
+
MarkNotDuplicateAction.meta({ id: "MarkNotDuplicateAction" }),
|
|
1174
|
+
MarkAsDuplicateAction.meta({ id: "MarkAsDuplicateAction" }),
|
|
1175
|
+
ArchiveAction.meta({ id: "ArchiveAction" }),
|
|
1176
|
+
NotifiedAction.meta({ id: "NotifiedAction" }),
|
|
1177
|
+
RegisterAction.meta({ id: "RegisterAction" }),
|
|
1178
|
+
DeclareAction.meta({ id: "DeclareAction" }),
|
|
1179
|
+
AssignedAction.meta({ id: "AssignedAction" }),
|
|
1180
|
+
RequestedCorrectionAction.meta({ id: "RequestedCorrectionAction" }),
|
|
1181
|
+
ApprovedCorrectionAction.meta({ id: "ApprovedCorrectionAction" }),
|
|
1182
|
+
RejectedCorrectionAction.meta({ id: "RejectedCorrectionAction" }),
|
|
1183
|
+
UnassignedAction.meta({ id: "UnassignedAction" }),
|
|
1184
|
+
PrintCertificateAction.meta({ id: "PrintCertificateAction" }),
|
|
1185
|
+
ReadAction.meta({ id: "ReadAction" }),
|
|
1186
|
+
EditAction.meta({ id: "EditAction" }),
|
|
1187
|
+
CustomAction.meta({ id: "CustomAction" })
|
|
1188
|
+
]).meta({
|
|
1189
|
+
id: "ActionDocument"
|
|
1137
1190
|
});
|
|
1138
1191
|
var AsyncRejectActionDocument = ActionBase.omit({
|
|
1139
1192
|
declaration: true,
|
|
1140
1193
|
annotation: true
|
|
1141
|
-
}).
|
|
1142
|
-
|
|
1143
|
-
type:
|
|
1144
|
-
status:
|
|
1145
|
-
})
|
|
1194
|
+
}).extend(
|
|
1195
|
+
z12.object({
|
|
1196
|
+
type: z12.enum(ConfirmableActions),
|
|
1197
|
+
status: z12.literal(ActionStatus.Rejected)
|
|
1198
|
+
}).shape
|
|
1146
1199
|
);
|
|
1147
|
-
var Action =
|
|
1200
|
+
var Action = z12.union([ActionDocument, AsyncRejectActionDocument]);
|
|
1148
1201
|
|
|
1149
|
-
// ../commons/src/events/
|
|
1150
|
-
var
|
|
1151
|
-
"CREATED",
|
|
1152
|
-
"NOTIFIED",
|
|
1153
|
-
"DECLARED",
|
|
1154
|
-
"VALIDATED",
|
|
1155
|
-
"REGISTERED",
|
|
1156
|
-
"ARCHIVED"
|
|
1157
|
-
]);
|
|
1202
|
+
// ../commons/src/events/Flag.ts
|
|
1203
|
+
var z13 = __toESM(require("zod/v4"));
|
|
1158
1204
|
var InherentFlags = {
|
|
1159
|
-
PENDING_CERTIFICATION: "pending-certification",
|
|
1160
1205
|
INCOMPLETE: "incomplete",
|
|
1161
1206
|
REJECTED: "rejected",
|
|
1162
1207
|
CORRECTION_REQUESTED: "correction-requested",
|
|
1163
|
-
POTENTIAL_DUPLICATE: "potential-duplicate"
|
|
1208
|
+
POTENTIAL_DUPLICATE: "potential-duplicate",
|
|
1209
|
+
/**
|
|
1210
|
+
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
1211
|
+
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
1212
|
+
*
|
|
1213
|
+
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
1214
|
+
*/
|
|
1215
|
+
EDIT_IN_PROGRESS: "edit-in-progress"
|
|
1164
1216
|
};
|
|
1165
|
-
var ActionFlag =
|
|
1217
|
+
var ActionFlag = z13.string().regex(
|
|
1166
1218
|
new RegExp(
|
|
1167
1219
|
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
1168
1220
|
ActionStatus
|
|
@@ -1170,59 +1222,92 @@ var ActionFlag = import_zod13.z.string().regex(
|
|
|
1170
1222
|
),
|
|
1171
1223
|
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
1172
1224
|
);
|
|
1173
|
-
var
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1225
|
+
var CustomFlag = z13.string().refine((val) => !Object.values(InherentFlags).includes(val), {
|
|
1226
|
+
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
1227
|
+
InherentFlags
|
|
1228
|
+
).join(", ")}`
|
|
1229
|
+
}).refine((val) => !ActionFlag.safeParse(val).success, {
|
|
1230
|
+
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
1231
|
+
}).describe("Custom flag identifier defined by the country config.");
|
|
1232
|
+
var Flag = ActionFlag.or(z13.enum(InherentFlags)).or(CustomFlag);
|
|
1233
|
+
var FlagConfig = z13.object({
|
|
1234
|
+
id: CustomFlag,
|
|
1235
|
+
requiresAction: z13.boolean().describe(
|
|
1236
|
+
"Indicates if this flag expects an action to be performed to be cleared."
|
|
1237
|
+
),
|
|
1238
|
+
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1239
|
+
});
|
|
1240
|
+
var ActionFlagConfig = z13.object({
|
|
1241
|
+
id: Flag,
|
|
1242
|
+
operation: z13.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
1243
|
+
conditional: Conditional.optional().describe(
|
|
1244
|
+
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1245
|
+
)
|
|
1246
|
+
});
|
|
1247
|
+
|
|
1248
|
+
// ../commons/src/events/EventMetadata.ts
|
|
1249
|
+
var EventStatus = z14.enum([
|
|
1250
|
+
"CREATED",
|
|
1251
|
+
"NOTIFIED",
|
|
1252
|
+
"DECLARED",
|
|
1253
|
+
"REGISTERED",
|
|
1254
|
+
"ARCHIVED"
|
|
1255
|
+
]);
|
|
1256
|
+
var ZodDate = z14.iso.date();
|
|
1257
|
+
var ActionCreationMetadata = z14.object({
|
|
1258
|
+
createdAt: z14.iso.datetime().describe("The timestamp when the action request was created."),
|
|
1259
|
+
createdBy: z14.string().describe("ID of the user who created the action request."),
|
|
1260
|
+
// @TODO: createdAtLocation should be non-nullable in the future once all action requests have this field populated.
|
|
1261
|
+
createdAtLocation: UUID.nullish().describe(
|
|
1179
1262
|
"Location of the user who created the action request."
|
|
1180
1263
|
),
|
|
1181
|
-
createdByUserType:
|
|
1182
|
-
acceptedAt:
|
|
1183
|
-
createdByRole:
|
|
1184
|
-
createdBySignature:
|
|
1264
|
+
createdByUserType: z14.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1265
|
+
acceptedAt: z14.iso.datetime().describe("Timestamp when the action request was accepted."),
|
|
1266
|
+
createdByRole: z14.string().optional().describe("Role of the user at the time of action request creation."),
|
|
1267
|
+
createdBySignature: z14.string().nullish().describe("Signature of the user who created the action request.")
|
|
1185
1268
|
});
|
|
1186
1269
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
1187
|
-
registrationNumber:
|
|
1270
|
+
registrationNumber: z14.string().describe(
|
|
1188
1271
|
"Registration number of the event. Always present for accepted registrations."
|
|
1189
1272
|
)
|
|
1190
1273
|
});
|
|
1191
|
-
var LegalStatuses =
|
|
1274
|
+
var LegalStatuses = z14.object({
|
|
1192
1275
|
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
|
1193
1276
|
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
|
1194
1277
|
});
|
|
1195
|
-
var EventMetadata =
|
|
1278
|
+
var EventMetadata = z14.object({
|
|
1196
1279
|
id: UUID,
|
|
1197
|
-
type:
|
|
1280
|
+
type: z14.string().describe("The type of event, such as birth, death, or marriage."),
|
|
1198
1281
|
status: EventStatus,
|
|
1199
1282
|
legalStatuses: LegalStatuses.describe(
|
|
1200
1283
|
"Metadata related to the legal registration of the event, such as who registered it and when."
|
|
1201
1284
|
),
|
|
1202
|
-
createdAt:
|
|
1285
|
+
createdAt: z14.iso.datetime().describe("The timestamp when the event was first created and saved."),
|
|
1203
1286
|
dateOfEvent: ZodDate.nullish(),
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1287
|
+
placeOfEvent: UUID.nullish(),
|
|
1288
|
+
createdBy: z14.string().describe("ID of the user who created the event."),
|
|
1289
|
+
createdByUserType: z14.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1290
|
+
updatedByUserRole: z14.string().nullish().describe("Role of the user who last changed the status."),
|
|
1291
|
+
// @TODO: createdAtLocation should be non-nullable in the future once all action requests have this field populated.
|
|
1292
|
+
createdAtLocation: UUID.nullish().describe(
|
|
1208
1293
|
"Location of the user who created the event."
|
|
1209
1294
|
),
|
|
1210
|
-
createdBySignature:
|
|
1295
|
+
createdBySignature: z14.string().nullish().describe("Signature of the user who created the event."),
|
|
1211
1296
|
updatedAtLocation: UUID.nullish().describe(
|
|
1212
1297
|
"Location of the user who last changed the status."
|
|
1213
1298
|
),
|
|
1214
|
-
updatedAt:
|
|
1299
|
+
updatedAt: z14.iso.datetime().describe(
|
|
1215
1300
|
"Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
|
|
1216
1301
|
),
|
|
1217
|
-
assignedTo:
|
|
1218
|
-
updatedBy:
|
|
1219
|
-
trackingId:
|
|
1302
|
+
assignedTo: z14.string().nullish().describe("ID of the user currently assigned to the event."),
|
|
1303
|
+
updatedBy: z14.string().nullish().describe("ID of the user who last changed the status."),
|
|
1304
|
+
trackingId: z14.string().describe(
|
|
1220
1305
|
"System-generated tracking ID used by informants or registrars to look up the event."
|
|
1221
1306
|
),
|
|
1222
|
-
potentialDuplicates:
|
|
1307
|
+
potentialDuplicates: z14.array(PotentialDuplicate).describe(
|
|
1223
1308
|
"List of event IDs and their tracking IDs that this event could be a duplicate of."
|
|
1224
1309
|
),
|
|
1225
|
-
flags:
|
|
1310
|
+
flags: z14.array(Flag)
|
|
1226
1311
|
});
|
|
1227
1312
|
var EventMetadataKeysArray = [
|
|
1228
1313
|
"id",
|
|
@@ -1230,6 +1315,7 @@ var EventMetadataKeysArray = [
|
|
|
1230
1315
|
"status",
|
|
1231
1316
|
"createdAt",
|
|
1232
1317
|
"dateOfEvent",
|
|
1318
|
+
"placeOfEvent",
|
|
1233
1319
|
"createdBy",
|
|
1234
1320
|
"createdByUserType",
|
|
1235
1321
|
"updatedByUserRole",
|
|
@@ -1242,130 +1328,124 @@ var EventMetadataKeysArray = [
|
|
|
1242
1328
|
"legalStatuses",
|
|
1243
1329
|
"flags"
|
|
1244
1330
|
];
|
|
1245
|
-
var EventMetadataKeys =
|
|
1331
|
+
var EventMetadataKeys = z14.enum(EventMetadataKeysArray);
|
|
1246
1332
|
|
|
1247
1333
|
// ../commons/src/events/EventIndex.ts
|
|
1248
|
-
var import_zod_openapi5 = require("zod-openapi");
|
|
1249
|
-
(0, import_zod_openapi5.extendZodWithOpenApi)(import_zod14.z);
|
|
1250
1334
|
var EventIndex = EventMetadata.extend({
|
|
1251
1335
|
declaration: EventState
|
|
1252
|
-
}).
|
|
1253
|
-
|
|
1336
|
+
}).meta({
|
|
1337
|
+
id: "EventIndex"
|
|
1254
1338
|
});
|
|
1255
|
-
var EventSearchIndex =
|
|
1256
|
-
|
|
1257
|
-
type:
|
|
1339
|
+
var EventSearchIndex = import_v4.z.record(import_v4.z.string(), import_v4.z.any()).and(
|
|
1340
|
+
import_v4.z.object({
|
|
1341
|
+
type: import_v4.z.string()
|
|
1258
1342
|
// Ensures "type" (event-id) exists and is a string
|
|
1259
1343
|
})
|
|
1260
|
-
).
|
|
1261
|
-
|
|
1344
|
+
).meta({
|
|
1345
|
+
id: "EventSearchIndex"
|
|
1262
1346
|
});
|
|
1263
|
-
var Fuzzy =
|
|
1264
|
-
|
|
1347
|
+
var Fuzzy = import_v4.z.object({ type: import_v4.z.literal("fuzzy"), term: import_v4.z.string() }).meta({
|
|
1348
|
+
id: "Fuzzy"
|
|
1265
1349
|
});
|
|
1266
|
-
var Exact =
|
|
1267
|
-
|
|
1350
|
+
var Exact = import_v4.z.object({ type: import_v4.z.literal("exact"), term: import_v4.z.string() }).meta({
|
|
1351
|
+
id: "Exact"
|
|
1268
1352
|
});
|
|
1269
|
-
var ExactStatus =
|
|
1270
|
-
type:
|
|
1353
|
+
var ExactStatus = import_v4.z.object({
|
|
1354
|
+
type: import_v4.z.literal("exact"),
|
|
1271
1355
|
term: EventStatus
|
|
1272
|
-
}).
|
|
1273
|
-
|
|
1356
|
+
}).meta({
|
|
1357
|
+
id: "ExactStatus"
|
|
1274
1358
|
});
|
|
1275
|
-
var ExactUserType =
|
|
1276
|
-
type:
|
|
1359
|
+
var ExactUserType = import_v4.z.object({
|
|
1360
|
+
type: import_v4.z.literal("exact"),
|
|
1277
1361
|
term: TokenUserType
|
|
1278
|
-
}).
|
|
1279
|
-
|
|
1280
|
-
});
|
|
1281
|
-
var AnyOf =
|
|
1282
|
-
type:
|
|
1283
|
-
terms:
|
|
1284
|
-
}).
|
|
1285
|
-
|
|
1286
|
-
});
|
|
1287
|
-
var AnyOfStatus =
|
|
1288
|
-
type:
|
|
1289
|
-
terms:
|
|
1290
|
-
}).
|
|
1291
|
-
|
|
1292
|
-
});
|
|
1293
|
-
var Range =
|
|
1294
|
-
type:
|
|
1295
|
-
gte:
|
|
1296
|
-
lte:
|
|
1297
|
-
}).
|
|
1298
|
-
|
|
1299
|
-
});
|
|
1300
|
-
var ContainsFlags =
|
|
1301
|
-
anyOf:
|
|
1302
|
-
noneOf:
|
|
1303
|
-
}).
|
|
1304
|
-
|
|
1305
|
-
});
|
|
1306
|
-
var Within =
|
|
1307
|
-
|
|
1308
|
-
});
|
|
1309
|
-
var RangeDate =
|
|
1310
|
-
type:
|
|
1311
|
-
gte:
|
|
1312
|
-
lte:
|
|
1313
|
-
}).
|
|
1362
|
+
}).meta({
|
|
1363
|
+
id: "ExactUserType"
|
|
1364
|
+
});
|
|
1365
|
+
var AnyOf = import_v4.z.object({
|
|
1366
|
+
type: import_v4.z.literal("anyOf"),
|
|
1367
|
+
terms: import_v4.z.array(import_v4.z.string())
|
|
1368
|
+
}).meta({
|
|
1369
|
+
id: "AnyOf"
|
|
1370
|
+
});
|
|
1371
|
+
var AnyOfStatus = import_v4.z.object({
|
|
1372
|
+
type: import_v4.z.literal("anyOf"),
|
|
1373
|
+
terms: import_v4.z.array(EventStatus)
|
|
1374
|
+
}).meta({
|
|
1375
|
+
id: "AnyOfStatus"
|
|
1376
|
+
});
|
|
1377
|
+
var Range = import_v4.z.object({
|
|
1378
|
+
type: import_v4.z.literal("range"),
|
|
1379
|
+
gte: import_v4.z.string(),
|
|
1380
|
+
lte: import_v4.z.string()
|
|
1381
|
+
}).meta({
|
|
1382
|
+
id: "Range"
|
|
1383
|
+
});
|
|
1384
|
+
var ContainsFlags = import_v4.z.object({
|
|
1385
|
+
anyOf: import_v4.z.array(Flag).optional(),
|
|
1386
|
+
noneOf: import_v4.z.array(Flag).optional()
|
|
1387
|
+
}).meta({
|
|
1388
|
+
id: "ContainsFlags"
|
|
1389
|
+
});
|
|
1390
|
+
var Within = import_v4.z.object({ type: import_v4.z.literal("within"), location: import_v4.z.string() }).meta({
|
|
1391
|
+
id: "Within"
|
|
1392
|
+
});
|
|
1393
|
+
var RangeDate = import_v4.z.object({
|
|
1394
|
+
type: import_v4.z.literal("range"),
|
|
1395
|
+
gte: import_v4.z.iso.date().or(import_v4.z.iso.datetime()),
|
|
1396
|
+
lte: import_v4.z.iso.date().or(import_v4.z.iso.datetime())
|
|
1397
|
+
}).meta({ id: "RangeDate" });
|
|
1314
1398
|
var ExactDate = Exact.extend({
|
|
1315
|
-
term:
|
|
1316
|
-
}).
|
|
1317
|
-
|
|
1399
|
+
term: import_v4.z.iso.date().or(import_v4.z.iso.datetime())
|
|
1400
|
+
}).meta({
|
|
1401
|
+
id: "ExactDate"
|
|
1318
1402
|
});
|
|
1319
|
-
var TimePeriod =
|
|
1320
|
-
type:
|
|
1403
|
+
var TimePeriod = import_v4.z.object({
|
|
1404
|
+
type: import_v4.z.literal("timePeriod"),
|
|
1321
1405
|
term: SelectDateRangeValue
|
|
1322
|
-
}).
|
|
1323
|
-
|
|
1406
|
+
}).meta({
|
|
1407
|
+
id: "TimePeriod"
|
|
1324
1408
|
});
|
|
1325
|
-
var DateCondition =
|
|
1326
|
-
|
|
1409
|
+
var DateCondition = import_v4.z.union([ExactDate, RangeDate, TimePeriod]).meta({
|
|
1410
|
+
id: "DateCondition"
|
|
1327
1411
|
});
|
|
1328
|
-
var QueryInput =
|
|
1329
|
-
() =>
|
|
1330
|
-
|
|
1331
|
-
|
|
1412
|
+
var QueryInput = import_v4.z.lazy(
|
|
1413
|
+
() => import_v4.z.union([
|
|
1414
|
+
import_v4.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf]),
|
|
1415
|
+
import_v4.z.record(import_v4.z.string(), QueryInput)
|
|
1332
1416
|
])
|
|
1333
|
-
).
|
|
1334
|
-
|
|
1335
|
-
});
|
|
1336
|
-
var QueryExpression =
|
|
1337
|
-
id:
|
|
1338
|
-
eventType:
|
|
1339
|
-
status:
|
|
1340
|
-
createdAt:
|
|
1341
|
-
updatedAt:
|
|
1342
|
-
"legalStatuses.REGISTERED.acceptedAt":
|
|
1343
|
-
"legalStatuses.DECLARED.createdAtLocation":
|
|
1344
|
-
|
|
1345
|
-
),
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
),
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
createdBy: import_zod14.z.optional(Exact),
|
|
1355
|
-
updatedBy: import_zod14.z.optional(Exact),
|
|
1356
|
-
trackingId: import_zod14.z.optional(Exact),
|
|
1357
|
-
flags: import_zod14.z.optional(ContainsFlags),
|
|
1417
|
+
).meta({
|
|
1418
|
+
id: "QueryInput"
|
|
1419
|
+
});
|
|
1420
|
+
var QueryExpression = import_v4.z.object({
|
|
1421
|
+
id: import_v4.z.optional(import_v4.z.string()),
|
|
1422
|
+
eventType: import_v4.z.string(),
|
|
1423
|
+
status: import_v4.z.optional(import_v4.z.union([AnyOfStatus, ExactStatus])),
|
|
1424
|
+
createdAt: import_v4.z.optional(DateCondition),
|
|
1425
|
+
updatedAt: import_v4.z.optional(DateCondition),
|
|
1426
|
+
"legalStatuses.REGISTERED.acceptedAt": import_v4.z.optional(DateCondition),
|
|
1427
|
+
"legalStatuses.DECLARED.createdAtLocation": import_v4.z.optional(Within).nullable(),
|
|
1428
|
+
"legalStatuses.REGISTERED.createdAtLocation": import_v4.z.optional(Within).nullable(),
|
|
1429
|
+
"legalStatuses.REGISTERED.registrationNumber": import_v4.z.optional(Exact),
|
|
1430
|
+
createdAtLocation: import_v4.z.optional(Within),
|
|
1431
|
+
updatedAtLocation: import_v4.z.optional(Within),
|
|
1432
|
+
assignedTo: import_v4.z.optional(Exact),
|
|
1433
|
+
createdByUserType: import_v4.z.optional(ExactUserType),
|
|
1434
|
+
createdBy: import_v4.z.optional(Exact),
|
|
1435
|
+
updatedBy: import_v4.z.optional(Exact),
|
|
1436
|
+
trackingId: import_v4.z.optional(Exact),
|
|
1437
|
+
flags: import_v4.z.optional(ContainsFlags),
|
|
1358
1438
|
// @todo: The type for this comes out as "any"
|
|
1359
1439
|
data: QueryInput
|
|
1360
1440
|
}).partial().refine((obj) => Object.values(obj).some((val) => val !== void 0), {
|
|
1361
|
-
|
|
1362
|
-
}).
|
|
1363
|
-
|
|
1364
|
-
});
|
|
1365
|
-
var QueryType =
|
|
1366
|
-
() =>
|
|
1367
|
-
type:
|
|
1368
|
-
clauses:
|
|
1441
|
+
error: "At least one query field must be specified."
|
|
1442
|
+
}).meta({
|
|
1443
|
+
id: "QueryExpression"
|
|
1444
|
+
});
|
|
1445
|
+
var QueryType = import_v4.z.lazy(
|
|
1446
|
+
() => import_v4.z.object({
|
|
1447
|
+
type: import_v4.z.literal("and").or(import_v4.z.literal("or")).meta({ default: "and" }),
|
|
1448
|
+
clauses: import_v4.z.array(import_v4.z.union([QueryExpression, QueryType])).nonempty("At least one clause is required.").meta({
|
|
1369
1449
|
default: [
|
|
1370
1450
|
{
|
|
1371
1451
|
eventType: TENNIS_CLUB_MEMBERSHIP,
|
|
@@ -1383,8 +1463,8 @@ var QueryType = import_zod14.z.lazy(
|
|
|
1383
1463
|
]
|
|
1384
1464
|
})
|
|
1385
1465
|
})
|
|
1386
|
-
).
|
|
1387
|
-
|
|
1466
|
+
).meta({
|
|
1467
|
+
id: "QueryType"
|
|
1388
1468
|
});
|
|
1389
1469
|
function parseStringifiedQueryField(val) {
|
|
1390
1470
|
if (typeof val === "string") {
|
|
@@ -1392,8 +1472,8 @@ function parseStringifiedQueryField(val) {
|
|
|
1392
1472
|
}
|
|
1393
1473
|
return val;
|
|
1394
1474
|
}
|
|
1395
|
-
var SearchQuery =
|
|
1396
|
-
query:
|
|
1475
|
+
var SearchQuery = import_v4.z.object({
|
|
1476
|
+
query: import_v4.z.preprocess(parseStringifiedQueryField, QueryType).meta({
|
|
1397
1477
|
default: {
|
|
1398
1478
|
type: "and",
|
|
1399
1479
|
clauses: [
|
|
@@ -1413,199 +1493,198 @@ var SearchQuery = import_zod14.z.object({
|
|
|
1413
1493
|
]
|
|
1414
1494
|
}
|
|
1415
1495
|
}),
|
|
1416
|
-
limit:
|
|
1417
|
-
offset:
|
|
1418
|
-
sort:
|
|
1496
|
+
limit: import_v4.z.number().optional().default(100),
|
|
1497
|
+
offset: import_v4.z.number().optional().default(0),
|
|
1498
|
+
sort: import_v4.z.preprocess(
|
|
1419
1499
|
parseStringifiedQueryField,
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
field:
|
|
1423
|
-
direction:
|
|
1500
|
+
import_v4.z.array(
|
|
1501
|
+
import_v4.z.object({
|
|
1502
|
+
field: import_v4.z.string(),
|
|
1503
|
+
direction: import_v4.z.enum(["asc", "desc"]).default("asc")
|
|
1424
1504
|
})
|
|
1425
1505
|
)
|
|
1426
1506
|
).optional()
|
|
1427
|
-
}).
|
|
1428
|
-
|
|
1507
|
+
}).meta({
|
|
1508
|
+
id: "SearchQuery"
|
|
1429
1509
|
});
|
|
1430
1510
|
|
|
1431
1511
|
// ../commons/src/events/serializers/date/serializer.ts
|
|
1432
|
-
var
|
|
1433
|
-
var SerializedNowDateTime =
|
|
1434
|
-
$$now:
|
|
1512
|
+
var import_zod = require("zod");
|
|
1513
|
+
var SerializedNowDateTime = import_zod.z.object({
|
|
1514
|
+
$$now: import_zod.z.literal(true)
|
|
1435
1515
|
});
|
|
1436
1516
|
function todayDateTimeValueSerializer() {
|
|
1437
1517
|
return { $$now: true };
|
|
1438
1518
|
}
|
|
1439
1519
|
|
|
1440
1520
|
// ../commons/src/events/FieldConfig.ts
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
(val) => !val.includes("_"),
|
|
1451
|
-
(val) => ({
|
|
1452
|
-
message: `id: '${val}' must not contain underscores '_'`
|
|
1453
|
-
})
|
|
1454
|
-
).describe("Unique identifier for the field");
|
|
1455
|
-
var FieldReference = import_zod16.z.object({
|
|
1521
|
+
var FieldId = z17.string().superRefine((val, ctx) => {
|
|
1522
|
+
if (val.includes("_")) {
|
|
1523
|
+
ctx.addIssue({
|
|
1524
|
+
code: z17.ZodIssueCode.custom,
|
|
1525
|
+
message: `id: '${val}' must not contain underscores '_'`
|
|
1526
|
+
});
|
|
1527
|
+
}
|
|
1528
|
+
}).describe("Unique identifier for the field");
|
|
1529
|
+
var FieldReference = z17.object({
|
|
1456
1530
|
$$field: FieldId,
|
|
1457
|
-
$$subfield:
|
|
1531
|
+
$$subfield: z17.array(z17.string()).optional().describe(
|
|
1458
1532
|
'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
|
|
1459
1533
|
)
|
|
1460
1534
|
}).describe("Reference to a field by its ID");
|
|
1461
|
-
var
|
|
1535
|
+
var CodeToEvaluate = z17.object({
|
|
1536
|
+
$$code: z17.string().describe(
|
|
1537
|
+
"Serialized function string that will be evaluated at runtime with the field value and context"
|
|
1538
|
+
)
|
|
1539
|
+
}).describe("Custom evaluation function for computed field values");
|
|
1540
|
+
var ValidationConfig = z17.object({
|
|
1462
1541
|
validator: Conditional,
|
|
1463
1542
|
message: TranslationConfig
|
|
1464
1543
|
});
|
|
1465
|
-
var requiredSchema =
|
|
1466
|
-
|
|
1467
|
-
|
|
1544
|
+
var requiredSchema = z17.union([
|
|
1545
|
+
z17.boolean(),
|
|
1546
|
+
z17.object({
|
|
1468
1547
|
message: TranslationConfig.describe("Custom required validation message")
|
|
1469
1548
|
})
|
|
1470
1549
|
]).default(false).optional();
|
|
1471
|
-
var BaseField =
|
|
1550
|
+
var BaseField = z17.object({
|
|
1472
1551
|
id: FieldId.describe("Unique identifier of the field."),
|
|
1473
1552
|
label: TranslationConfig.describe("Human-readable label of the field."),
|
|
1474
|
-
parent: FieldReference.or(
|
|
1553
|
+
parent: FieldReference.or(z17.array(FieldReference)).optional().describe(
|
|
1475
1554
|
"Reference to the parent field or fields. When a parent field changes, this field is reset."
|
|
1476
1555
|
),
|
|
1477
1556
|
required: requiredSchema.describe(
|
|
1478
1557
|
"Indicates whether the field is mandatory."
|
|
1479
1558
|
),
|
|
1480
|
-
conditionals:
|
|
1559
|
+
conditionals: z17.array(FieldConditional).default([]).optional().describe(
|
|
1481
1560
|
"Conditions determining when the field is shown or enabled. By default, the field is always shown and enabled."
|
|
1482
1561
|
),
|
|
1483
|
-
secured:
|
|
1562
|
+
secured: z17.boolean().default(false).optional().describe(
|
|
1484
1563
|
"Indicates whether the field is secured. Secured fields are not indexed for search and are only visible when explicitly assigned."
|
|
1485
1564
|
),
|
|
1486
1565
|
placeholder: TranslationConfig.optional(),
|
|
1487
|
-
validation:
|
|
1566
|
+
validation: z17.array(ValidationConfig).default([]).optional().describe("Additional validation rules applied to the field."),
|
|
1488
1567
|
helperText: TranslationConfig.optional(),
|
|
1489
|
-
hideLabel:
|
|
1490
|
-
uncorrectable:
|
|
1568
|
+
hideLabel: z17.boolean().default(false).optional(),
|
|
1569
|
+
uncorrectable: z17.boolean().default(false).optional().describe(
|
|
1491
1570
|
"Indicates whether the field can be modified during record correction."
|
|
1492
1571
|
),
|
|
1493
|
-
value: FieldReference.or(
|
|
1572
|
+
value: FieldReference.or(CodeToEvaluate).or(z17.array(FieldReference.or(CodeToEvaluate))).optional().describe(
|
|
1494
1573
|
"Reference to the source field or fields. When a value is defined, it is copied from the parent field when changed. If multiple references are provided, the first truthy value is used."
|
|
1495
1574
|
),
|
|
1496
|
-
analytics:
|
|
1575
|
+
analytics: z17.boolean().default(false).optional().describe(
|
|
1497
1576
|
"Indicates whether the field is included in analytics. When enabled, its value becomes available in the analytics dashboard."
|
|
1498
1577
|
)
|
|
1499
1578
|
}).describe("Common properties shared across all field types.");
|
|
1500
1579
|
var Divider = BaseField.extend({
|
|
1501
|
-
type:
|
|
1580
|
+
type: z17.literal(FieldType.DIVIDER)
|
|
1502
1581
|
});
|
|
1503
1582
|
var TextField = BaseField.extend({
|
|
1504
|
-
type:
|
|
1505
|
-
defaultValue:
|
|
1506
|
-
configuration:
|
|
1507
|
-
maxLength:
|
|
1508
|
-
type:
|
|
1583
|
+
type: z17.literal(FieldType.TEXT),
|
|
1584
|
+
defaultValue: z17.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
1585
|
+
configuration: z17.object({
|
|
1586
|
+
maxLength: z17.number().optional().describe("Maximum length of the text"),
|
|
1587
|
+
type: z17.enum(["text", "password"]).optional(),
|
|
1509
1588
|
prefix: TranslationConfig.optional(),
|
|
1510
1589
|
postfix: TranslationConfig.optional()
|
|
1511
1590
|
}).default({ type: "text" }).optional()
|
|
1512
1591
|
}).describe("Text input");
|
|
1513
1592
|
var NumberField = BaseField.extend({
|
|
1514
|
-
type:
|
|
1593
|
+
type: z17.literal(FieldType.NUMBER),
|
|
1515
1594
|
defaultValue: NumberFieldValue.optional(),
|
|
1516
|
-
configuration:
|
|
1517
|
-
min:
|
|
1518
|
-
max:
|
|
1595
|
+
configuration: z17.object({
|
|
1596
|
+
min: z17.number().optional().describe("Minimum value"),
|
|
1597
|
+
max: z17.number().optional().describe("Maximum value"),
|
|
1519
1598
|
prefix: TranslationConfig.optional(),
|
|
1520
1599
|
postfix: TranslationConfig.optional()
|
|
1521
1600
|
}).optional()
|
|
1522
1601
|
}).describe("Number input");
|
|
1523
1602
|
var TextAreaField = BaseField.extend({
|
|
1524
|
-
type:
|
|
1603
|
+
type: z17.literal(FieldType.TEXTAREA),
|
|
1525
1604
|
defaultValue: NonEmptyTextValue.optional(),
|
|
1526
|
-
configuration:
|
|
1527
|
-
maxLength:
|
|
1528
|
-
rows:
|
|
1529
|
-
cols:
|
|
1605
|
+
configuration: z17.object({
|
|
1606
|
+
maxLength: z17.number().optional().describe("Maximum length of the text"),
|
|
1607
|
+
rows: z17.number().optional().describe("Number of visible text lines"),
|
|
1608
|
+
cols: z17.number().optional().describe("Number of visible columns"),
|
|
1530
1609
|
prefix: TranslationConfig.optional(),
|
|
1531
1610
|
postfix: TranslationConfig.optional()
|
|
1532
1611
|
}).default({ rows: 4 }).optional()
|
|
1533
1612
|
}).describe("Multiline text input");
|
|
1534
|
-
var ImageMimeType =
|
|
1613
|
+
var ImageMimeType = z17.enum([
|
|
1535
1614
|
"image/png",
|
|
1536
1615
|
"image/jpg",
|
|
1537
1616
|
"image/jpeg",
|
|
1538
1617
|
"image/svg+xml"
|
|
1539
1618
|
]);
|
|
1540
|
-
var DocumentMimeType =
|
|
1619
|
+
var DocumentMimeType = z17.enum([
|
|
1541
1620
|
"application/pdf",
|
|
1542
1621
|
"application/msword",
|
|
1543
1622
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
1544
1623
|
"application/vnd.oasis.opendocument.text"
|
|
1545
1624
|
]);
|
|
1546
|
-
var MimeType =
|
|
1625
|
+
var MimeType = z17.enum([
|
|
1547
1626
|
...ImageMimeType.options,
|
|
1548
1627
|
...DocumentMimeType.options
|
|
1549
1628
|
]);
|
|
1550
1629
|
var DEFAULT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;
|
|
1551
1630
|
var SignatureField = BaseField.extend({
|
|
1552
|
-
type:
|
|
1631
|
+
type: z17.literal(FieldType.SIGNATURE),
|
|
1553
1632
|
signaturePromptLabel: TranslationConfig.describe(
|
|
1554
1633
|
"Title of the signature modal"
|
|
1555
1634
|
),
|
|
1556
1635
|
defaultValue: SignatureFieldValue.optional(),
|
|
1557
|
-
configuration:
|
|
1558
|
-
maxFileSize:
|
|
1636
|
+
configuration: z17.object({
|
|
1637
|
+
maxFileSize: z17.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
|
1559
1638
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
|
1560
1639
|
}).default({
|
|
1561
1640
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
1562
1641
|
})
|
|
1563
1642
|
}).describe("Signature input field");
|
|
1564
1643
|
var EmailField = BaseField.extend({
|
|
1565
|
-
type:
|
|
1566
|
-
configuration:
|
|
1567
|
-
maxLength:
|
|
1568
|
-
}).default({ maxLength:
|
|
1644
|
+
type: z17.literal(FieldType.EMAIL),
|
|
1645
|
+
configuration: z17.object({
|
|
1646
|
+
maxLength: z17.number().optional().describe("Maximum length of the text")
|
|
1647
|
+
}).default({ maxLength: 255 }).optional(),
|
|
1569
1648
|
defaultValue: NonEmptyTextValue.optional()
|
|
1570
1649
|
});
|
|
1571
1650
|
var DateField = BaseField.extend({
|
|
1572
|
-
type:
|
|
1573
|
-
defaultValue: SerializedNowDateTime.or(DateValue).optional().
|
|
1574
|
-
configuration:
|
|
1651
|
+
type: z17.literal(FieldType.DATE),
|
|
1652
|
+
defaultValue: SerializedNowDateTime.or(DateValue).optional().describe("Default date value(yyyy-MM-dd)"),
|
|
1653
|
+
configuration: z17.object({
|
|
1575
1654
|
notice: TranslationConfig.describe(
|
|
1576
1655
|
"Text to display above the date input"
|
|
1577
1656
|
).optional()
|
|
1578
1657
|
}).optional()
|
|
1579
1658
|
}).describe("A single date input (yyyy-MM-dd)");
|
|
1580
1659
|
var AgeField = BaseField.extend({
|
|
1581
|
-
type:
|
|
1660
|
+
type: z17.literal(FieldType.AGE),
|
|
1582
1661
|
defaultValue: NumberFieldValue.optional(),
|
|
1583
|
-
configuration:
|
|
1662
|
+
configuration: z17.object({
|
|
1584
1663
|
asOfDate: FieldReference,
|
|
1585
1664
|
prefix: TranslationConfig.optional(),
|
|
1586
1665
|
postfix: TranslationConfig.optional()
|
|
1587
1666
|
})
|
|
1588
1667
|
}).describe("An age input field which uses the current date as the asOfDate");
|
|
1589
1668
|
var TimeField = BaseField.extend({
|
|
1590
|
-
type:
|
|
1591
|
-
defaultValue: SerializedNowDateTime.or(TimeValue).optional().
|
|
1592
|
-
configuration:
|
|
1593
|
-
use12HourFormat:
|
|
1669
|
+
type: z17.literal(FieldType.TIME),
|
|
1670
|
+
defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
|
|
1671
|
+
configuration: z17.object({
|
|
1672
|
+
use12HourFormat: z17.boolean().optional().describe("Whether to use 12-hour format"),
|
|
1594
1673
|
notice: TranslationConfig.describe(
|
|
1595
1674
|
"Text to display above the time input"
|
|
1596
1675
|
).optional()
|
|
1597
1676
|
}).optional()
|
|
1598
1677
|
}).describe("A single date input (HH-mm)");
|
|
1599
1678
|
var DateRangeField = BaseField.extend({
|
|
1600
|
-
type:
|
|
1679
|
+
type: z17.literal(FieldType.DATE_RANGE),
|
|
1601
1680
|
defaultValue: DateRangeFieldValue.optional(),
|
|
1602
|
-
configuration:
|
|
1681
|
+
configuration: z17.object({
|
|
1603
1682
|
notice: TranslationConfig.describe(
|
|
1604
1683
|
"Text to display above the date input"
|
|
1605
1684
|
).optional()
|
|
1606
1685
|
}).optional()
|
|
1607
1686
|
}).describe("A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })");
|
|
1608
|
-
var HtmlFontVariant =
|
|
1687
|
+
var HtmlFontVariant = z17.enum([
|
|
1609
1688
|
"reg12",
|
|
1610
1689
|
"reg14",
|
|
1611
1690
|
"reg16",
|
|
@@ -1615,34 +1694,38 @@ var HtmlFontVariant = import_zod16.z.enum([
|
|
|
1615
1694
|
"h2",
|
|
1616
1695
|
"h1"
|
|
1617
1696
|
]);
|
|
1618
|
-
var
|
|
1619
|
-
|
|
1697
|
+
var ParagraphTextAlign = z17.enum(["left", "center", "right", "start", "end"]);
|
|
1698
|
+
var ParagraphConfiguration = z17.object({
|
|
1699
|
+
styles: z17.object({
|
|
1620
1700
|
fontVariant: HtmlFontVariant.optional().describe(
|
|
1621
1701
|
"Font variant to use for the paragraph text"
|
|
1622
1702
|
),
|
|
1623
|
-
hint:
|
|
1703
|
+
hint: z17.boolean().optional().describe("When true, paragraph is styled as a hint with grey color"),
|
|
1704
|
+
textAlign: ParagraphTextAlign.optional().describe(
|
|
1705
|
+
"Text alignment for the paragraph"
|
|
1706
|
+
)
|
|
1624
1707
|
}).optional()
|
|
1625
1708
|
}).default({});
|
|
1626
1709
|
var Paragraph = BaseField.extend({
|
|
1627
|
-
type:
|
|
1710
|
+
type: z17.literal(FieldType.PARAGRAPH),
|
|
1628
1711
|
defaultValue: NonEmptyTextValue.optional(),
|
|
1629
1712
|
configuration: ParagraphConfiguration
|
|
1630
1713
|
}).describe("A read-only HTML <p> paragraph");
|
|
1631
1714
|
var PageHeader = BaseField.extend({
|
|
1632
|
-
type:
|
|
1715
|
+
type: z17.literal(FieldType.PAGE_HEADER),
|
|
1633
1716
|
defaultValue: NonEmptyTextValue.optional()
|
|
1634
1717
|
}).describe("A read-only header component for form pages");
|
|
1635
1718
|
var File = BaseField.extend({
|
|
1636
|
-
type:
|
|
1719
|
+
type: z17.literal(FieldType.FILE),
|
|
1637
1720
|
defaultValue: FileFieldValue.optional(),
|
|
1638
|
-
configuration:
|
|
1639
|
-
maxFileSize:
|
|
1721
|
+
configuration: z17.object({
|
|
1722
|
+
maxFileSize: z17.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
|
1640
1723
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
|
|
1641
|
-
maxImageSize:
|
|
1642
|
-
targetSize:
|
|
1724
|
+
maxImageSize: z17.object({
|
|
1725
|
+
targetSize: z17.object({ width: z17.number(), height: z17.number() })
|
|
1643
1726
|
}).optional(),
|
|
1644
|
-
style:
|
|
1645
|
-
width:
|
|
1727
|
+
style: z17.object({
|
|
1728
|
+
width: z17.enum(["full", "auto"]).optional().describe(
|
|
1646
1729
|
"Whether the file upload button should take the full width of the container or not"
|
|
1647
1730
|
)
|
|
1648
1731
|
}).optional(),
|
|
@@ -1651,46 +1734,46 @@ var File = BaseField.extend({
|
|
|
1651
1734
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
1652
1735
|
})
|
|
1653
1736
|
}).describe("File upload");
|
|
1654
|
-
var SelectOption =
|
|
1655
|
-
value:
|
|
1656
|
-
label:
|
|
1737
|
+
var SelectOption = z17.object({
|
|
1738
|
+
value: z17.string().describe("The value of the option"),
|
|
1739
|
+
label: z17.union([z17.string(), TranslationConfig]).describe("The label of the option")
|
|
1657
1740
|
});
|
|
1658
1741
|
var NumberWithUnitField = BaseField.extend({
|
|
1659
|
-
type:
|
|
1742
|
+
type: z17.literal(FieldType.NUMBER_WITH_UNIT),
|
|
1660
1743
|
defaultValue: NumberWithUnitFieldValue.optional(),
|
|
1661
|
-
options:
|
|
1662
|
-
configuration:
|
|
1663
|
-
min:
|
|
1664
|
-
max:
|
|
1744
|
+
options: z17.array(SelectOption).describe("A list of options for the unit select"),
|
|
1745
|
+
configuration: z17.object({
|
|
1746
|
+
min: z17.number().optional().describe("Minimum value of the number field"),
|
|
1747
|
+
max: z17.number().optional().describe("Maximum value of the number field"),
|
|
1665
1748
|
numberFieldPlaceholder: TranslationConfig.optional().describe(
|
|
1666
1749
|
"Placeholder for the number field"
|
|
1667
1750
|
)
|
|
1668
1751
|
}).optional()
|
|
1669
1752
|
}).describe("Number with unit input");
|
|
1670
1753
|
var RadioGroup = BaseField.extend({
|
|
1671
|
-
type:
|
|
1754
|
+
type: z17.literal(FieldType.RADIO_GROUP),
|
|
1672
1755
|
defaultValue: TextValue.optional(),
|
|
1673
|
-
options:
|
|
1674
|
-
configuration:
|
|
1675
|
-
styles:
|
|
1676
|
-
size:
|
|
1756
|
+
options: z17.array(SelectOption).describe("A list of options"),
|
|
1757
|
+
configuration: z17.object({
|
|
1758
|
+
styles: z17.object({
|
|
1759
|
+
size: z17.enum(["NORMAL", "LARGE"]).optional()
|
|
1677
1760
|
}).optional()
|
|
1678
1761
|
}).optional()
|
|
1679
1762
|
}).describe("Grouped radio options");
|
|
1680
1763
|
var BulletList = BaseField.extend({
|
|
1681
|
-
type:
|
|
1764
|
+
type: z17.literal(FieldType.BULLET_LIST),
|
|
1682
1765
|
defaultValue: TextValue.optional(),
|
|
1683
|
-
items:
|
|
1684
|
-
configuration:
|
|
1685
|
-
styles:
|
|
1766
|
+
items: z17.array(TranslationConfig).describe("A list of items"),
|
|
1767
|
+
configuration: z17.object({
|
|
1768
|
+
styles: z17.object({
|
|
1686
1769
|
fontVariant: HtmlFontVariant.optional()
|
|
1687
1770
|
}).optional()
|
|
1688
1771
|
}).default({})
|
|
1689
1772
|
}).describe("A list of bullet points");
|
|
1690
1773
|
var Select = BaseField.extend({
|
|
1691
|
-
type:
|
|
1774
|
+
type: z17.literal(FieldType.SELECT),
|
|
1692
1775
|
defaultValue: TextValue.optional(),
|
|
1693
|
-
options:
|
|
1776
|
+
options: z17.array(SelectOption).describe("A list of options"),
|
|
1694
1777
|
noOptionsMessage: TranslationConfig.optional().describe(
|
|
1695
1778
|
`
|
|
1696
1779
|
A translation configuration object used to display a message when no options are available.
|
|
@@ -1702,36 +1785,39 @@ var Select = BaseField.extend({
|
|
|
1702
1785
|
`
|
|
1703
1786
|
)
|
|
1704
1787
|
}).describe("Select input");
|
|
1705
|
-
var SelectDateRangeOption =
|
|
1788
|
+
var SelectDateRangeOption = z17.object({
|
|
1706
1789
|
value: SelectDateRangeValue.describe("The value of the option"),
|
|
1707
1790
|
label: TranslationConfig.describe("The label of the option")
|
|
1708
1791
|
});
|
|
1709
1792
|
var SelectDateRangeField = BaseField.extend({
|
|
1710
|
-
type:
|
|
1793
|
+
type: z17.literal(FieldType.SELECT_DATE_RANGE),
|
|
1711
1794
|
defaultValue: SelectDateRangeValue.optional(),
|
|
1712
|
-
options:
|
|
1795
|
+
options: z17.array(SelectDateRangeOption).describe("A list of options")
|
|
1713
1796
|
}).describe("Select input with date range options");
|
|
1714
|
-
var NameConfig =
|
|
1715
|
-
firstname:
|
|
1716
|
-
middlename:
|
|
1717
|
-
surname:
|
|
1797
|
+
var NameConfig = z17.object({
|
|
1798
|
+
firstname: z17.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
1799
|
+
middlename: z17.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
1800
|
+
surname: z17.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional()
|
|
1718
1801
|
});
|
|
1719
1802
|
var NameField = BaseField.extend({
|
|
1720
|
-
type:
|
|
1721
|
-
defaultValue:
|
|
1803
|
+
type: z17.literal(FieldType.NAME),
|
|
1804
|
+
defaultValue: z17.object({
|
|
1722
1805
|
firstname: SerializedUserField.or(NonEmptyTextValue).optional(),
|
|
1723
1806
|
middlename: SerializedUserField.or(NonEmptyTextValue).optional(),
|
|
1724
1807
|
surname: SerializedUserField.or(NonEmptyTextValue).optional()
|
|
1725
1808
|
}).optional(),
|
|
1726
|
-
configuration:
|
|
1809
|
+
configuration: z17.object({
|
|
1727
1810
|
name: NameConfig.default({
|
|
1728
1811
|
firstname: { required: true },
|
|
1729
1812
|
surname: { required: true }
|
|
1730
1813
|
}).optional(),
|
|
1731
|
-
order:
|
|
1732
|
-
maxLength:
|
|
1814
|
+
order: z17.array(z17.enum(["firstname", "middlename", "surname"])).optional(),
|
|
1815
|
+
maxLength: z17.number().optional().describe("Maximum length of the text"),
|
|
1733
1816
|
prefix: TranslationConfig.optional(),
|
|
1734
|
-
postfix: TranslationConfig.optional()
|
|
1817
|
+
postfix: TranslationConfig.optional(),
|
|
1818
|
+
showParentFieldError: z17.boolean().default(false).optional().describe(
|
|
1819
|
+
`If true, shows the parent field error and hides the subfield error`
|
|
1820
|
+
)
|
|
1735
1821
|
}).default({
|
|
1736
1822
|
name: {
|
|
1737
1823
|
firstname: { required: true },
|
|
@@ -1741,51 +1827,51 @@ var NameField = BaseField.extend({
|
|
|
1741
1827
|
}).describe("Name input field");
|
|
1742
1828
|
var PhoneField = BaseField.extend({
|
|
1743
1829
|
defaultValue: NonEmptyTextValue.optional(),
|
|
1744
|
-
type:
|
|
1830
|
+
type: z17.literal(FieldType.PHONE)
|
|
1745
1831
|
}).describe("Phone input field");
|
|
1746
1832
|
var IdField = BaseField.extend({
|
|
1747
1833
|
defaultValue: NonEmptyTextValue.optional(),
|
|
1748
|
-
type:
|
|
1834
|
+
type: z17.literal(FieldType.ID)
|
|
1749
1835
|
}).describe("ID input field");
|
|
1750
1836
|
var Checkbox = BaseField.extend({
|
|
1751
|
-
type:
|
|
1837
|
+
type: z17.literal(FieldType.CHECKBOX),
|
|
1752
1838
|
defaultValue: CheckboxFieldValue.default(false)
|
|
1753
1839
|
}).describe("Boolean checkbox field");
|
|
1754
1840
|
var Country = BaseField.extend({
|
|
1755
|
-
type:
|
|
1841
|
+
type: z17.literal(FieldType.COUNTRY),
|
|
1756
1842
|
defaultValue: NonEmptyTextValue.optional()
|
|
1757
1843
|
}).describe("Country select field");
|
|
1758
|
-
var AdministrativeAreas =
|
|
1844
|
+
var AdministrativeAreas = z17.enum([
|
|
1759
1845
|
"ADMIN_STRUCTURE",
|
|
1760
1846
|
"HEALTH_FACILITY",
|
|
1761
1847
|
"CRVS_OFFICE"
|
|
1762
1848
|
]);
|
|
1763
|
-
var AdministrativeAreaConfiguration =
|
|
1764
|
-
partOf:
|
|
1765
|
-
$declaration:
|
|
1849
|
+
var AdministrativeAreaConfiguration = z17.object({
|
|
1850
|
+
partOf: z17.object({
|
|
1851
|
+
$declaration: z17.string()
|
|
1766
1852
|
}).optional().describe("Parent location"),
|
|
1767
1853
|
type: AdministrativeAreas
|
|
1768
1854
|
}).describe("Administrative area options");
|
|
1769
|
-
var
|
|
1770
|
-
type:
|
|
1855
|
+
var AdministrativeAreaField = BaseField.extend({
|
|
1856
|
+
type: z17.literal(FieldType.ADMINISTRATIVE_AREA),
|
|
1771
1857
|
defaultValue: NonEmptyTextValue.optional(),
|
|
1772
1858
|
configuration: AdministrativeAreaConfiguration
|
|
1773
1859
|
}).describe("Administrative area input field e.g. facility, office");
|
|
1774
1860
|
var LocationInput = BaseField.extend({
|
|
1775
|
-
type:
|
|
1861
|
+
type: z17.literal(FieldType.LOCATION),
|
|
1776
1862
|
defaultValue: NonEmptyTextValue.optional(),
|
|
1777
|
-
configuration:
|
|
1778
|
-
searchableResource:
|
|
1863
|
+
configuration: z17.object({
|
|
1864
|
+
searchableResource: z17.array(z17.enum(["locations", "facilities", "offices"]))
|
|
1779
1865
|
})
|
|
1780
1866
|
}).describe("Input field for a location");
|
|
1781
1867
|
var FileUploadWithOptions = BaseField.extend({
|
|
1782
|
-
type:
|
|
1783
|
-
options:
|
|
1868
|
+
type: z17.literal(FieldType.FILE_WITH_OPTIONS),
|
|
1869
|
+
options: z17.array(SelectOption).describe("A list of options"),
|
|
1784
1870
|
defaultValue: FileFieldWithOptionValue.optional(),
|
|
1785
|
-
configuration:
|
|
1786
|
-
maxFileSize:
|
|
1787
|
-
maxImageSize:
|
|
1788
|
-
targetSize:
|
|
1871
|
+
configuration: z17.object({
|
|
1872
|
+
maxFileSize: z17.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
|
1873
|
+
maxImageSize: z17.object({
|
|
1874
|
+
targetSize: z17.object({ width: z17.number(), height: z17.number() })
|
|
1789
1875
|
}).optional(),
|
|
1790
1876
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
|
1791
1877
|
}).default({
|
|
@@ -1793,93 +1879,93 @@ var FileUploadWithOptions = BaseField.extend({
|
|
|
1793
1879
|
})
|
|
1794
1880
|
});
|
|
1795
1881
|
var Facility = BaseField.extend({
|
|
1796
|
-
type:
|
|
1882
|
+
type: z17.literal(FieldType.FACILITY),
|
|
1797
1883
|
defaultValue: NonEmptyTextValue.optional()
|
|
1798
1884
|
}).describe("Input field for a facility");
|
|
1799
1885
|
var Office = BaseField.extend({
|
|
1800
|
-
type:
|
|
1886
|
+
type: z17.literal(FieldType.OFFICE),
|
|
1801
1887
|
defaultValue: NonEmptyTextValue.optional()
|
|
1802
1888
|
}).describe("Input field for an office");
|
|
1803
1889
|
var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
|
|
1804
|
-
administrativeArea:
|
|
1890
|
+
administrativeArea: z17.union([UUID, SerializedUserField]).optional()
|
|
1805
1891
|
});
|
|
1806
1892
|
var Address = BaseField.extend({
|
|
1807
|
-
type:
|
|
1808
|
-
configuration:
|
|
1809
|
-
lineSeparator:
|
|
1810
|
-
fields:
|
|
1811
|
-
administrativeLevels:
|
|
1812
|
-
streetAddressForm:
|
|
1813
|
-
|
|
1814
|
-
id:
|
|
1893
|
+
type: z17.literal(FieldType.ADDRESS),
|
|
1894
|
+
configuration: z17.object({
|
|
1895
|
+
lineSeparator: z17.string().optional(),
|
|
1896
|
+
fields: z17.array(z17.enum(["country", "administrativeArea"])).optional(),
|
|
1897
|
+
administrativeLevels: z17.array(z17.string()).optional(),
|
|
1898
|
+
streetAddressForm: z17.array(
|
|
1899
|
+
z17.object({
|
|
1900
|
+
id: z17.string(),
|
|
1815
1901
|
required: requiredSchema,
|
|
1816
1902
|
label: TranslationConfig,
|
|
1817
|
-
type:
|
|
1818
|
-
conditionals:
|
|
1903
|
+
type: z17.literal(FieldType.TEXT),
|
|
1904
|
+
conditionals: z17.array(FieldConditional).default([]).optional(),
|
|
1819
1905
|
parent: FieldReference.optional()
|
|
1820
1906
|
})
|
|
1821
1907
|
).optional()
|
|
1822
1908
|
}).optional(),
|
|
1823
1909
|
defaultValue: DefaultAddressFieldValue.optional()
|
|
1824
1910
|
}).describe("Address input field \u2013 a combination of location and text fields");
|
|
1825
|
-
var StaticDataEntry =
|
|
1826
|
-
id:
|
|
1911
|
+
var StaticDataEntry = z17.object({
|
|
1912
|
+
id: z17.string().describe("ID for the data entry."),
|
|
1827
1913
|
label: TranslationConfig,
|
|
1828
|
-
value: TranslationConfig.or(
|
|
1914
|
+
value: TranslationConfig.or(z17.string()).or(FieldReference).or(CodeToEvaluate)
|
|
1829
1915
|
}).describe("Static data entry");
|
|
1830
|
-
var DataEntry =
|
|
1916
|
+
var DataEntry = z17.union([StaticDataEntry, z17.object({ fieldId: z17.string() })]).describe(
|
|
1831
1917
|
"Data entry can be either a static data entry, or a reference to another field in the current form or the declaration."
|
|
1832
1918
|
);
|
|
1833
1919
|
var DataField = BaseField.extend({
|
|
1834
|
-
type:
|
|
1835
|
-
configuration:
|
|
1920
|
+
type: z17.literal(FieldType.DATA),
|
|
1921
|
+
configuration: z17.object({
|
|
1836
1922
|
subtitle: TranslationConfig.optional(),
|
|
1837
|
-
data:
|
|
1923
|
+
data: z17.array(DataEntry)
|
|
1838
1924
|
})
|
|
1839
1925
|
}).describe("Data field for displaying read-only data");
|
|
1840
1926
|
var ButtonField = BaseField.extend({
|
|
1841
|
-
type:
|
|
1927
|
+
type: z17.literal(FieldType.BUTTON),
|
|
1842
1928
|
defaultValue: ButtonFieldValue.optional(),
|
|
1843
|
-
configuration:
|
|
1844
|
-
icon:
|
|
1929
|
+
configuration: z17.object({
|
|
1930
|
+
icon: z17.string().optional().describe(
|
|
1845
1931
|
"Icon for the button. You can find icons from OpenCRVS UI-Kit."
|
|
1846
1932
|
),
|
|
1847
|
-
loading:
|
|
1933
|
+
loading: z17.boolean().optional().describe("Whether the button is in a loading state and shows a spinner"),
|
|
1848
1934
|
text: TranslationConfig.describe("Text to display on the button")
|
|
1849
1935
|
})
|
|
1850
1936
|
}).describe("Generic button without any built-in functionality");
|
|
1851
1937
|
var AlphaPrintButton = BaseField.extend({
|
|
1852
|
-
type:
|
|
1853
|
-
configuration:
|
|
1854
|
-
template:
|
|
1938
|
+
type: z17.literal(FieldType.ALPHA_PRINT_BUTTON),
|
|
1939
|
+
configuration: z17.object({
|
|
1940
|
+
template: z17.string().describe("Template ID from countryconfig templates to use for printing"),
|
|
1855
1941
|
buttonLabel: TranslationConfig.optional().describe(
|
|
1856
1942
|
"Label for the print button"
|
|
1857
1943
|
)
|
|
1858
1944
|
})
|
|
1859
1945
|
}).describe("Print button field for printing certificates");
|
|
1860
1946
|
var HttpField = BaseField.extend({
|
|
1861
|
-
type:
|
|
1947
|
+
type: z17.literal(FieldType.HTTP),
|
|
1862
1948
|
defaultValue: HttpFieldValue.optional(),
|
|
1863
|
-
configuration:
|
|
1949
|
+
configuration: z17.object({
|
|
1864
1950
|
trigger: FieldReference,
|
|
1865
|
-
url:
|
|
1866
|
-
method:
|
|
1867
|
-
headers:
|
|
1868
|
-
body:
|
|
1869
|
-
errorValue:
|
|
1870
|
-
params:
|
|
1871
|
-
timeout:
|
|
1951
|
+
url: z17.string().describe("URL to send the HTTP request to"),
|
|
1952
|
+
method: z17.enum(["GET", "POST", "PUT", "DELETE"]),
|
|
1953
|
+
headers: z17.record(z17.string(), z17.string()).optional(),
|
|
1954
|
+
body: z17.record(z17.string(), z17.any()).optional(),
|
|
1955
|
+
errorValue: z17.any().optional().describe("Value to set if the request fails"),
|
|
1956
|
+
params: z17.record(z17.string(), z17.union([z17.string(), FieldReference, CodeToEvaluate])).optional(),
|
|
1957
|
+
timeout: z17.number().default(15e3).describe("Request timeout in milliseconds")
|
|
1872
1958
|
})
|
|
1873
1959
|
}).describe("HTTP request function triggered by a button click or other event");
|
|
1874
1960
|
var SearchField = HttpField.extend({
|
|
1875
|
-
type:
|
|
1961
|
+
type: z17.literal(FieldType.SEARCH),
|
|
1876
1962
|
configuration: SearchQuery.pick({
|
|
1877
1963
|
query: true,
|
|
1878
1964
|
limit: true,
|
|
1879
1965
|
offset: true
|
|
1880
1966
|
}).extend({
|
|
1881
1967
|
validation: ValidationConfig,
|
|
1882
|
-
indicators:
|
|
1968
|
+
indicators: z17.object({
|
|
1883
1969
|
loading: TranslationConfig.optional().describe(
|
|
1884
1970
|
"Text to display while the search is in progress"
|
|
1885
1971
|
),
|
|
@@ -1894,7 +1980,7 @@ var SearchField = HttpField.extend({
|
|
|
1894
1980
|
),
|
|
1895
1981
|
confirmButton: TranslationConfig.optional(),
|
|
1896
1982
|
clearButton: TranslationConfig.optional(),
|
|
1897
|
-
clearModal:
|
|
1983
|
+
clearModal: z17.object({
|
|
1898
1984
|
title: TranslationConfig.optional(),
|
|
1899
1985
|
description: TranslationConfig.optional(),
|
|
1900
1986
|
cancel: TranslationConfig.optional(),
|
|
@@ -1905,17 +1991,17 @@ var SearchField = HttpField.extend({
|
|
|
1905
1991
|
})
|
|
1906
1992
|
});
|
|
1907
1993
|
var LinkButtonField = BaseField.extend({
|
|
1908
|
-
type:
|
|
1909
|
-
configuration:
|
|
1910
|
-
url:
|
|
1994
|
+
type: z17.literal(FieldType.LINK_BUTTON),
|
|
1995
|
+
configuration: z17.object({
|
|
1996
|
+
url: z17.string().describe("URL to open"),
|
|
1911
1997
|
text: TranslationConfig.describe("Text to display on the button"),
|
|
1912
|
-
icon:
|
|
1998
|
+
icon: z17.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
|
|
1913
1999
|
})
|
|
1914
2000
|
}).describe("Button that opens a link");
|
|
1915
2001
|
var VerificationStatus = BaseField.extend({
|
|
1916
|
-
type:
|
|
2002
|
+
type: z17.literal(FieldType.VERIFICATION_STATUS),
|
|
1917
2003
|
defaultValue: VerificationStatusValue.optional(),
|
|
1918
|
-
configuration:
|
|
2004
|
+
configuration: z17.object({
|
|
1919
2005
|
status: TranslationConfig.describe("Text to display on the status pill."),
|
|
1920
2006
|
description: TranslationConfig.describe(
|
|
1921
2007
|
"Explaining text on the banner in form."
|
|
@@ -1923,38 +2009,55 @@ var VerificationStatus = BaseField.extend({
|
|
|
1923
2009
|
})
|
|
1924
2010
|
});
|
|
1925
2011
|
var QueryParamReaderField = BaseField.extend({
|
|
1926
|
-
type:
|
|
1927
|
-
configuration:
|
|
1928
|
-
pickParams:
|
|
2012
|
+
type: z17.literal(FieldType.QUERY_PARAM_READER),
|
|
2013
|
+
configuration: z17.object({
|
|
2014
|
+
pickParams: z17.array(z17.string()).describe("List of query parameters to read from the URL")
|
|
1929
2015
|
})
|
|
1930
2016
|
}).describe(
|
|
1931
2017
|
"A field that maps URL query params into form values and clears them afterward"
|
|
1932
2018
|
);
|
|
1933
2019
|
var QrReaderField = BaseField.extend({
|
|
1934
|
-
type:
|
|
2020
|
+
type: z17.literal(FieldType.QR_READER),
|
|
1935
2021
|
defaultValue: QrReaderFieldValue.optional(),
|
|
1936
|
-
configuration:
|
|
1937
|
-
validator:
|
|
1938
|
-
|
|
1939
|
-
|
|
2022
|
+
configuration: z17.object({
|
|
2023
|
+
validator: z17.any().meta({
|
|
2024
|
+
description: "JSON Schema to validate the scanned QR code data against before populating the form fields.",
|
|
2025
|
+
id: "QrReaderFieldValidator"
|
|
2026
|
+
})
|
|
1940
2027
|
}).optional()
|
|
2028
|
+
}).meta({
|
|
2029
|
+
description: "Configuration for QR code reader field, including optional JSON Schema validator.",
|
|
2030
|
+
id: "QrReaderField"
|
|
1941
2031
|
});
|
|
1942
2032
|
var IdReaderField = BaseField.extend({
|
|
1943
|
-
type:
|
|
2033
|
+
type: z17.literal(FieldType.ID_READER),
|
|
1944
2034
|
defaultValue: IdReaderFieldValue.optional(),
|
|
1945
|
-
methods:
|
|
1946
|
-
|
|
2035
|
+
methods: z17.array(
|
|
2036
|
+
z17.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
|
|
1947
2037
|
)
|
|
1948
2038
|
});
|
|
2039
|
+
var CustomField = BaseField.extend({
|
|
2040
|
+
type: z17.literal(FieldType._EXPERIMENTAL_CUSTOM),
|
|
2041
|
+
defaultValue: CustomFieldValue.optional(),
|
|
2042
|
+
src: z17.string().describe("Module source path for the custom field component"),
|
|
2043
|
+
configuration: z17.unknown().optional()
|
|
2044
|
+
});
|
|
1949
2045
|
var LoaderField = BaseField.extend({
|
|
1950
|
-
type:
|
|
1951
|
-
configuration:
|
|
2046
|
+
type: z17.literal(FieldType.LOADER),
|
|
2047
|
+
configuration: z17.object({
|
|
1952
2048
|
text: TranslationConfig.describe("Display text above the loading spinner")
|
|
1953
2049
|
})
|
|
1954
2050
|
}).describe(
|
|
1955
2051
|
"A non-interactive field that indicates an in progress operation in form"
|
|
1956
2052
|
);
|
|
1957
|
-
var
|
|
2053
|
+
var HiddenField = BaseField.extend({
|
|
2054
|
+
type: z17.literal(FieldType.ALPHA_HIDDEN),
|
|
2055
|
+
required: z17.boolean().default(false).optional(),
|
|
2056
|
+
defaultValue: TextValue.optional()
|
|
2057
|
+
}).describe(
|
|
2058
|
+
"A non-interactive, hidden field that only hold a value in the form"
|
|
2059
|
+
);
|
|
2060
|
+
var FieldConfig = z17.discriminatedUnion("type", [
|
|
1958
2061
|
Address,
|
|
1959
2062
|
TextField,
|
|
1960
2063
|
NumberField,
|
|
@@ -1976,7 +2079,7 @@ var FieldConfig = import_zod16.z.discriminatedUnion("type", [
|
|
|
1976
2079
|
Checkbox,
|
|
1977
2080
|
File,
|
|
1978
2081
|
Country,
|
|
1979
|
-
|
|
2082
|
+
AdministrativeAreaField,
|
|
1980
2083
|
Divider,
|
|
1981
2084
|
LocationInput,
|
|
1982
2085
|
Facility,
|
|
@@ -1994,83 +2097,81 @@ var FieldConfig = import_zod16.z.discriminatedUnion("type", [
|
|
|
1994
2097
|
IdReaderField,
|
|
1995
2098
|
QueryParamReaderField,
|
|
1996
2099
|
LoaderField,
|
|
1997
|
-
SearchField
|
|
1998
|
-
|
|
2100
|
+
SearchField,
|
|
2101
|
+
CustomField,
|
|
2102
|
+
HiddenField
|
|
2103
|
+
]).meta({
|
|
1999
2104
|
description: "Form field configuration",
|
|
2000
|
-
|
|
2105
|
+
id: "FieldConfig"
|
|
2001
2106
|
});
|
|
2002
|
-
var AnyFileField =
|
|
2107
|
+
var AnyFileField = z17.discriminatedUnion("type", [
|
|
2003
2108
|
SignatureField,
|
|
2004
2109
|
File,
|
|
2005
2110
|
FileUploadWithOptions
|
|
2006
2111
|
]);
|
|
2007
2112
|
|
|
2008
2113
|
// ../commons/src/events/FormConfig.ts
|
|
2009
|
-
var
|
|
2114
|
+
var z19 = __toESM(require("zod/v4"));
|
|
2010
2115
|
|
|
2011
2116
|
// ../commons/src/events/PageConfig.ts
|
|
2012
|
-
var
|
|
2013
|
-
var
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
var PageConfigBase = import_zod17.z.object({
|
|
2017
|
-
id: import_zod17.z.string().describe("Unique identifier for the page"),
|
|
2117
|
+
var z18 = __toESM(require("zod/v4"));
|
|
2118
|
+
var PageTypes = z18.enum(["FORM", "VERIFICATION"]);
|
|
2119
|
+
var PageConfigBase = z18.object({
|
|
2120
|
+
id: z18.string().describe("Unique identifier for the page"),
|
|
2018
2121
|
title: TranslationConfig.describe("Header title of the page"),
|
|
2019
|
-
requireCompletionToContinue:
|
|
2122
|
+
requireCompletionToContinue: z18.boolean().default(false).describe(
|
|
2020
2123
|
"If true, all required fields must be filled before continuing to the next page"
|
|
2021
2124
|
),
|
|
2022
|
-
fields:
|
|
2125
|
+
fields: z18.array(FieldConfig).describe("Fields to be rendered on the page"),
|
|
2023
2126
|
conditional: Conditional.optional().describe(
|
|
2024
2127
|
"Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
|
|
2025
2128
|
)
|
|
2026
|
-
}).
|
|
2129
|
+
}).meta({
|
|
2027
2130
|
description: "Form page configuration",
|
|
2028
|
-
|
|
2131
|
+
id: "FormPageConfig"
|
|
2029
2132
|
});
|
|
2030
2133
|
var FormPageConfig = PageConfigBase.extend({
|
|
2031
|
-
type:
|
|
2134
|
+
type: z18.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
|
|
2032
2135
|
});
|
|
2033
|
-
var VerificationActionConfig =
|
|
2034
|
-
verify:
|
|
2035
|
-
cancel:
|
|
2136
|
+
var VerificationActionConfig = z18.object({
|
|
2137
|
+
verify: z18.object({ label: TranslationConfig }),
|
|
2138
|
+
cancel: z18.object({
|
|
2036
2139
|
label: TranslationConfig,
|
|
2037
|
-
confirmation:
|
|
2140
|
+
confirmation: z18.object({
|
|
2038
2141
|
title: TranslationConfig,
|
|
2039
2142
|
body: TranslationConfig
|
|
2040
2143
|
})
|
|
2041
2144
|
})
|
|
2042
|
-
}).describe("Actions available on the verification page").
|
|
2145
|
+
}).describe("Actions available on the verification page").meta({
|
|
2043
2146
|
description: "Verification action configuration",
|
|
2044
|
-
|
|
2147
|
+
id: "VerificationActionConfig"
|
|
2045
2148
|
});
|
|
2046
2149
|
var VerificationPageConfig = FormPageConfig.extend({
|
|
2047
|
-
type:
|
|
2150
|
+
type: z18.literal(PageTypes.enum.VERIFICATION),
|
|
2048
2151
|
actions: VerificationActionConfig
|
|
2049
2152
|
});
|
|
2050
|
-
var PageConfig =
|
|
2153
|
+
var PageConfig = z18.discriminatedUnion("type", [
|
|
2051
2154
|
FormPageConfig,
|
|
2052
2155
|
VerificationPageConfig
|
|
2053
2156
|
]);
|
|
2054
2157
|
|
|
2055
2158
|
// ../commons/src/events/FormConfig.ts
|
|
2056
|
-
var DeclarationFormConfig =
|
|
2159
|
+
var DeclarationFormConfig = z19.object({
|
|
2057
2160
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
2058
|
-
pages:
|
|
2161
|
+
pages: z19.array(FormPageConfig)
|
|
2059
2162
|
}).describe("Configuration of the declaration form.");
|
|
2060
|
-
var ActionFormConfig =
|
|
2163
|
+
var ActionFormConfig = z19.object({
|
|
2061
2164
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
2062
|
-
pages:
|
|
2165
|
+
pages: z19.array(PageConfig)
|
|
2063
2166
|
}).describe(
|
|
2064
2167
|
"Configuration of the form used for system actions beyond declaration, supporting a wider range of page types."
|
|
2065
2168
|
);
|
|
2066
|
-
var FormConfig =
|
|
2169
|
+
var FormConfig = z19.union([DeclarationFormConfig, ActionFormConfig]);
|
|
2067
2170
|
|
|
2068
2171
|
// ../commons/src/events/DeduplicationConfig.ts
|
|
2069
|
-
var
|
|
2070
|
-
var
|
|
2071
|
-
|
|
2072
|
-
var FieldReference2 = import_zod19.z.string();
|
|
2073
|
-
var Matcher = import_zod19.z.object({
|
|
2172
|
+
var z20 = __toESM(require("zod/v4"));
|
|
2173
|
+
var FieldReference2 = z20.string();
|
|
2174
|
+
var Matcher = z20.object({
|
|
2074
2175
|
/**
|
|
2075
2176
|
* Reference to the field used in matching.
|
|
2076
2177
|
*
|
|
@@ -2078,23 +2179,23 @@ var Matcher = import_zod19.z.object({
|
|
|
2078
2179
|
* be used as the origin date to calculate the distance from.
|
|
2079
2180
|
*/
|
|
2080
2181
|
fieldId: FieldReference2,
|
|
2081
|
-
options:
|
|
2082
|
-
boost:
|
|
2182
|
+
options: z20.object({
|
|
2183
|
+
boost: z20.number().optional(),
|
|
2083
2184
|
matchAgainst: FieldReference2.optional()
|
|
2084
2185
|
}).optional().default({
|
|
2085
2186
|
boost: 1
|
|
2086
2187
|
})
|
|
2087
2188
|
});
|
|
2088
2189
|
var FuzzyMatcher = Matcher.extend({
|
|
2089
|
-
type:
|
|
2090
|
-
options:
|
|
2190
|
+
type: z20.literal("fuzzy"),
|
|
2191
|
+
options: z20.object({
|
|
2091
2192
|
/**
|
|
2092
2193
|
* Names of length 3 or less characters = 0 edits allowed
|
|
2093
2194
|
* Names of length 4 - 6 characters = 1 edit allowed
|
|
2094
2195
|
* Names of length >7 characters = 2 edits allowed
|
|
2095
2196
|
*/
|
|
2096
|
-
fuzziness:
|
|
2097
|
-
boost:
|
|
2197
|
+
fuzziness: z20.union([z20.string(), z20.number()]).optional().default("AUTO:4,7"),
|
|
2198
|
+
boost: z20.number().optional().default(1),
|
|
2098
2199
|
matchAgainst: FieldReference2.optional()
|
|
2099
2200
|
}).optional().default({
|
|
2100
2201
|
fuzziness: "AUTO:4,7",
|
|
@@ -2102,48 +2203,48 @@ var FuzzyMatcher = Matcher.extend({
|
|
|
2102
2203
|
})
|
|
2103
2204
|
});
|
|
2104
2205
|
var StrictMatcher = Matcher.extend({
|
|
2105
|
-
type:
|
|
2106
|
-
options:
|
|
2107
|
-
boost:
|
|
2206
|
+
type: z20.literal("strict"),
|
|
2207
|
+
options: z20.object({
|
|
2208
|
+
boost: z20.number().optional().default(1),
|
|
2108
2209
|
/**
|
|
2109
2210
|
* The constant value to be present in the field for both records
|
|
2110
2211
|
*/
|
|
2111
|
-
value:
|
|
2212
|
+
value: z20.string().optional(),
|
|
2112
2213
|
matchAgainst: FieldReference2.optional()
|
|
2113
2214
|
}).optional().default({
|
|
2114
2215
|
boost: 1
|
|
2115
2216
|
})
|
|
2116
2217
|
});
|
|
2117
2218
|
var DateRangeMatcher = Matcher.extend({
|
|
2118
|
-
type:
|
|
2119
|
-
options:
|
|
2219
|
+
type: z20.literal("dateRange"),
|
|
2220
|
+
options: z20.object({
|
|
2120
2221
|
/**
|
|
2121
2222
|
* The distance pivot in days. Distance from the origin (the value of
|
|
2122
2223
|
* fieldId) at which relevance scores receive half of the boost value
|
|
2123
2224
|
*/
|
|
2124
|
-
pivot:
|
|
2125
|
-
days:
|
|
2126
|
-
boost:
|
|
2225
|
+
pivot: z20.number().optional(),
|
|
2226
|
+
days: z20.number(),
|
|
2227
|
+
boost: z20.number().optional().default(1),
|
|
2127
2228
|
matchAgainst: FieldReference2.optional()
|
|
2128
2229
|
})
|
|
2129
2230
|
});
|
|
2130
|
-
var Not =
|
|
2131
|
-
type:
|
|
2231
|
+
var Not = z20.object({
|
|
2232
|
+
type: z20.literal("not"),
|
|
2132
2233
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2133
|
-
clause:
|
|
2234
|
+
clause: z20.lazy(() => Clause)
|
|
2134
2235
|
});
|
|
2135
|
-
var And =
|
|
2136
|
-
type:
|
|
2236
|
+
var And = z20.object({
|
|
2237
|
+
type: z20.literal("and"),
|
|
2137
2238
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2138
|
-
clauses:
|
|
2239
|
+
clauses: z20.lazy(() => Clause.array())
|
|
2139
2240
|
});
|
|
2140
|
-
var Or =
|
|
2141
|
-
type:
|
|
2241
|
+
var Or = z20.object({
|
|
2242
|
+
type: z20.literal("or"),
|
|
2142
2243
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2143
|
-
clauses:
|
|
2244
|
+
clauses: z20.lazy(() => Clause.array())
|
|
2144
2245
|
});
|
|
2145
|
-
var Clause =
|
|
2146
|
-
() =>
|
|
2246
|
+
var Clause = z20.lazy(
|
|
2247
|
+
() => z20.discriminatedUnion("type", [
|
|
2147
2248
|
Not,
|
|
2148
2249
|
And,
|
|
2149
2250
|
Or,
|
|
@@ -2151,193 +2252,328 @@ var Clause = import_zod19.z.lazy(
|
|
|
2151
2252
|
StrictMatcher,
|
|
2152
2253
|
DateRangeMatcher
|
|
2153
2254
|
])
|
|
2154
|
-
).
|
|
2155
|
-
|
|
2255
|
+
).meta({
|
|
2256
|
+
id: "Clause"
|
|
2156
2257
|
});
|
|
2157
|
-
var DeduplicationConfig =
|
|
2158
|
-
id:
|
|
2258
|
+
var DeduplicationConfig = z20.object({
|
|
2259
|
+
id: z20.string(),
|
|
2159
2260
|
label: TranslationConfig,
|
|
2160
2261
|
query: Clause
|
|
2161
2262
|
});
|
|
2162
2263
|
|
|
2264
|
+
// ../commons/src/icons.ts
|
|
2265
|
+
var z21 = __toESM(require("zod/v4"));
|
|
2266
|
+
var AvailableIcons = z21.enum([
|
|
2267
|
+
"Archived",
|
|
2268
|
+
"Assigned",
|
|
2269
|
+
"Briefcase",
|
|
2270
|
+
"Certified",
|
|
2271
|
+
"Close",
|
|
2272
|
+
"Collapse",
|
|
2273
|
+
"Draft",
|
|
2274
|
+
"DuplicateYellow",
|
|
2275
|
+
"Expand",
|
|
2276
|
+
"ExternalValidate",
|
|
2277
|
+
"FilledCheck",
|
|
2278
|
+
"InReview",
|
|
2279
|
+
"Offline",
|
|
2280
|
+
"Registered",
|
|
2281
|
+
"RequiresUpdates",
|
|
2282
|
+
"Sent",
|
|
2283
|
+
"Validated",
|
|
2284
|
+
"WaitingApproval",
|
|
2285
|
+
"ChartActivity",
|
|
2286
|
+
"Activity",
|
|
2287
|
+
"Archive",
|
|
2288
|
+
"ArchiveTray",
|
|
2289
|
+
"ArrowLeft",
|
|
2290
|
+
"ArrowRight",
|
|
2291
|
+
"Buildings",
|
|
2292
|
+
"Circle",
|
|
2293
|
+
"CaretDown",
|
|
2294
|
+
"CaretLeft",
|
|
2295
|
+
"CaretRight",
|
|
2296
|
+
"ChartBar",
|
|
2297
|
+
"ChartLine",
|
|
2298
|
+
"ChatCircle",
|
|
2299
|
+
"CheckSquare",
|
|
2300
|
+
"Compass",
|
|
2301
|
+
"Check",
|
|
2302
|
+
"Copy",
|
|
2303
|
+
"Database",
|
|
2304
|
+
"DotsThreeVertical",
|
|
2305
|
+
"ArrowCounterClockwise",
|
|
2306
|
+
"MagnifyingGlassMinus",
|
|
2307
|
+
"MagnifyingGlassPlus",
|
|
2308
|
+
"Export",
|
|
2309
|
+
"Eye",
|
|
2310
|
+
"EyeSlash",
|
|
2311
|
+
"Envelope",
|
|
2312
|
+
"File",
|
|
2313
|
+
"FileSearch",
|
|
2314
|
+
"FileMinus",
|
|
2315
|
+
"FilePlus",
|
|
2316
|
+
"FileText",
|
|
2317
|
+
"FileX",
|
|
2318
|
+
"Handshake",
|
|
2319
|
+
"Gear",
|
|
2320
|
+
"GitBranch",
|
|
2321
|
+
"IdentificationCard",
|
|
2322
|
+
"List",
|
|
2323
|
+
"ListBullets",
|
|
2324
|
+
"Lock",
|
|
2325
|
+
"MagnifyingGlass",
|
|
2326
|
+
"MapPin",
|
|
2327
|
+
"Medal",
|
|
2328
|
+
"NotePencil",
|
|
2329
|
+
"Paperclip",
|
|
2330
|
+
"PaperPlaneTilt",
|
|
2331
|
+
"Pen",
|
|
2332
|
+
"PenNib",
|
|
2333
|
+
"Pencil",
|
|
2334
|
+
"PencilSimpleLine",
|
|
2335
|
+
"Phone",
|
|
2336
|
+
"Plus",
|
|
2337
|
+
"Printer",
|
|
2338
|
+
"SignOut",
|
|
2339
|
+
"Stamp",
|
|
2340
|
+
"Star",
|
|
2341
|
+
"Target",
|
|
2342
|
+
"TextT",
|
|
2343
|
+
"Trash",
|
|
2344
|
+
"UploadSimple",
|
|
2345
|
+
"User",
|
|
2346
|
+
"UserPlus",
|
|
2347
|
+
"Users",
|
|
2348
|
+
"WarningCircle",
|
|
2349
|
+
"X",
|
|
2350
|
+
"ChatText",
|
|
2351
|
+
"CircleWavyCheck",
|
|
2352
|
+
"CircleWavyQuestion",
|
|
2353
|
+
"ArchiveBox",
|
|
2354
|
+
"ArrowCircleDown",
|
|
2355
|
+
"FileArrowUp",
|
|
2356
|
+
"FileDotted",
|
|
2357
|
+
"Files",
|
|
2358
|
+
"PencilLine",
|
|
2359
|
+
"PencilCircle",
|
|
2360
|
+
"UserCircle",
|
|
2361
|
+
"Clock",
|
|
2362
|
+
"QrCode",
|
|
2363
|
+
"Webcam",
|
|
2364
|
+
"Sun",
|
|
2365
|
+
"DeviceTabletCamera",
|
|
2366
|
+
"Globe",
|
|
2367
|
+
"Fingerprint",
|
|
2368
|
+
"PushPin",
|
|
2369
|
+
"Timer"
|
|
2370
|
+
]);
|
|
2371
|
+
|
|
2163
2372
|
// ../commons/src/events/ActionConfig.ts
|
|
2164
|
-
var
|
|
2165
|
-
(0, import_zod_openapi9.extendZodWithOpenApi)(import_zod20.z);
|
|
2166
|
-
var DeclarationReviewConfig = import_zod20.z.object({
|
|
2373
|
+
var DeclarationReviewConfig = z22.object({
|
|
2167
2374
|
title: TranslationConfig.describe("Title of the review page"),
|
|
2168
|
-
fields:
|
|
2375
|
+
fields: z22.array(FieldConfig).describe("Fields displayed on the review page for annotations.")
|
|
2169
2376
|
}).describe(
|
|
2170
2377
|
"Configuration of the declaration review page for collecting event-related metadata."
|
|
2171
2378
|
);
|
|
2172
|
-
var ActionConfigBase =
|
|
2173
|
-
label: TranslationConfig.describe("Human readable description of the action")
|
|
2379
|
+
var ActionConfigBase = z22.object({
|
|
2380
|
+
label: TranslationConfig.describe("Human readable description of the action"),
|
|
2381
|
+
flags: z22.array(ActionFlagConfig).optional().default([]).describe("Flag actions which are executed when the action is performed."),
|
|
2382
|
+
supportingCopy: TranslationConfig.optional().describe(
|
|
2383
|
+
"Text displayed on the confirmation dialog"
|
|
2384
|
+
),
|
|
2385
|
+
icon: AvailableIcons.describe("Icon representing the action").optional(),
|
|
2386
|
+
conditionals: z22.array(ActionConditional).optional().describe("Conditionals which can disable or hide actions.")
|
|
2174
2387
|
});
|
|
2175
2388
|
var DeclarationActionBase = ActionConfigBase.extend({
|
|
2176
|
-
review: DeclarationReviewConfig,
|
|
2177
2389
|
deduplication: DeduplicationConfig.optional()
|
|
2178
2390
|
});
|
|
2179
|
-
var ReadActionConfig = ActionConfigBase.
|
|
2180
|
-
|
|
2181
|
-
type:
|
|
2391
|
+
var ReadActionConfig = ActionConfigBase.extend(
|
|
2392
|
+
z22.object({
|
|
2393
|
+
type: z22.literal(ActionType.READ),
|
|
2182
2394
|
review: DeclarationReviewConfig.describe(
|
|
2183
2395
|
"Configuration of the review page for read-only view."
|
|
2184
|
-
)
|
|
2185
|
-
|
|
2186
|
-
)
|
|
2187
|
-
var DeclareConfig = DeclarationActionBase.merge(
|
|
2188
|
-
import_zod20.z.object({
|
|
2189
|
-
type: import_zod20.z.literal(ActionType.DECLARE)
|
|
2190
|
-
})
|
|
2396
|
+
),
|
|
2397
|
+
conditionals: z22.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
|
|
2398
|
+
}).shape
|
|
2191
2399
|
);
|
|
2192
|
-
var
|
|
2193
|
-
|
|
2194
|
-
type:
|
|
2195
|
-
|
|
2400
|
+
var DeclareConfig = DeclarationActionBase.extend(
|
|
2401
|
+
z22.object({
|
|
2402
|
+
type: z22.literal(ActionType.DECLARE),
|
|
2403
|
+
review: DeclarationReviewConfig.describe(
|
|
2404
|
+
"Configuration of the review page fields."
|
|
2405
|
+
),
|
|
2406
|
+
dialogCopy: z22.object({
|
|
2407
|
+
notify: TranslationConfig.describe(
|
|
2408
|
+
"Confirmation text for the notify action"
|
|
2409
|
+
),
|
|
2410
|
+
declare: TranslationConfig.describe(
|
|
2411
|
+
"Confirmation text for the declare action"
|
|
2412
|
+
),
|
|
2413
|
+
register: TranslationConfig.describe(
|
|
2414
|
+
"Confirmation text for the register action"
|
|
2415
|
+
)
|
|
2416
|
+
}).optional()
|
|
2417
|
+
}).shape
|
|
2196
2418
|
);
|
|
2197
|
-
var
|
|
2198
|
-
|
|
2199
|
-
type:
|
|
2200
|
-
})
|
|
2419
|
+
var ArchiveConfig = ActionConfigBase.extend(
|
|
2420
|
+
z22.object({
|
|
2421
|
+
type: z22.literal(ActionType.ARCHIVE)
|
|
2422
|
+
}).shape
|
|
2201
2423
|
);
|
|
2202
|
-
var
|
|
2203
|
-
|
|
2204
|
-
type:
|
|
2205
|
-
|
|
2424
|
+
var EditActionConfig = ActionConfigBase.extend(
|
|
2425
|
+
z22.object({
|
|
2426
|
+
type: z22.literal(ActionType.EDIT),
|
|
2427
|
+
dialogCopy: z22.object({
|
|
2428
|
+
notify: TranslationConfig.describe(
|
|
2429
|
+
"Confirmation text for the notify with edits action"
|
|
2430
|
+
),
|
|
2431
|
+
declare: TranslationConfig.describe(
|
|
2432
|
+
"Confirmation text for the declare with edits action"
|
|
2433
|
+
),
|
|
2434
|
+
register: TranslationConfig.describe(
|
|
2435
|
+
"Confirmation text for the register with edits action"
|
|
2436
|
+
)
|
|
2437
|
+
})
|
|
2438
|
+
}).shape
|
|
2206
2439
|
);
|
|
2207
|
-
var
|
|
2208
|
-
|
|
2209
|
-
type:
|
|
2210
|
-
})
|
|
2440
|
+
var RejectConfig = ActionConfigBase.extend(
|
|
2441
|
+
z22.object({
|
|
2442
|
+
type: z22.literal(ActionType.REJECT)
|
|
2443
|
+
}).shape
|
|
2211
2444
|
);
|
|
2212
|
-
var
|
|
2213
|
-
|
|
2214
|
-
type:
|
|
2215
|
-
})
|
|
2445
|
+
var RegisterConfig = DeclarationActionBase.extend(
|
|
2446
|
+
z22.object({
|
|
2447
|
+
type: z22.literal(ActionType.REGISTER)
|
|
2448
|
+
}).shape
|
|
2216
2449
|
);
|
|
2217
|
-
var PrintCertificateActionConfig = ActionConfigBase.
|
|
2218
|
-
|
|
2219
|
-
type:
|
|
2450
|
+
var PrintCertificateActionConfig = ActionConfigBase.extend(
|
|
2451
|
+
z22.object({
|
|
2452
|
+
type: z22.literal(ActionType.PRINT_CERTIFICATE),
|
|
2220
2453
|
printForm: ActionFormConfig
|
|
2221
|
-
})
|
|
2454
|
+
}).shape
|
|
2222
2455
|
);
|
|
2223
|
-
var RequestCorrectionConfig = ActionConfigBase.
|
|
2224
|
-
|
|
2225
|
-
type:
|
|
2456
|
+
var RequestCorrectionConfig = ActionConfigBase.extend(
|
|
2457
|
+
z22.object({
|
|
2458
|
+
type: z22.literal(ActionType.REQUEST_CORRECTION),
|
|
2226
2459
|
correctionForm: ActionFormConfig
|
|
2227
|
-
})
|
|
2460
|
+
}).shape
|
|
2228
2461
|
);
|
|
2229
|
-
var
|
|
2230
|
-
|
|
2231
|
-
type:
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2462
|
+
var CustomActionConfig = ActionConfigBase.merge(
|
|
2463
|
+
z22.object({
|
|
2464
|
+
type: z22.literal(ActionType.CUSTOM),
|
|
2465
|
+
customActionType: z22.string().describe("Type identifier of the custom action."),
|
|
2466
|
+
/** Custom action form configuration supports a simple array of field configs, which should be rendered on the action modal. In the future, we might add support for pages etc. */
|
|
2467
|
+
form: z22.array(FieldConfig).describe(
|
|
2468
|
+
"Form configuration for the custom action. The form configured here will be used on the custom action confirmation modal."
|
|
2469
|
+
),
|
|
2470
|
+
auditHistoryLabel: TranslationConfig.describe(
|
|
2471
|
+
'The label to show in audit history for this action. For example "Approved".'
|
|
2472
|
+
)
|
|
2237
2473
|
})
|
|
2238
2474
|
);
|
|
2239
|
-
var ActionConfig =
|
|
2475
|
+
var ActionConfig = z22.discriminatedUnion("type", [
|
|
2240
2476
|
/*
|
|
2241
2477
|
* OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
|
|
2242
2478
|
* and treat them as "models" instead of duplicating the data structure in each endpoint.
|
|
2243
2479
|
*/
|
|
2244
|
-
ReadActionConfig.
|
|
2245
|
-
DeclareConfig.
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
DeleteConfig.openapi({ ref: "DeleteActionConfig" }),
|
|
2251
|
-
PrintCertificateActionConfig.openapi({
|
|
2252
|
-
ref: "PrintCertificateActionConfig"
|
|
2480
|
+
ReadActionConfig.meta({ id: "ReadActionConfig" }),
|
|
2481
|
+
DeclareConfig.meta({ id: "DeclareActionConfig" }),
|
|
2482
|
+
RejectConfig.meta({ id: "RejectActionConfig" }),
|
|
2483
|
+
RegisterConfig.meta({ id: "RegisterActionConfig" }),
|
|
2484
|
+
PrintCertificateActionConfig.meta({
|
|
2485
|
+
id: "PrintCertificateActionConfig"
|
|
2253
2486
|
}),
|
|
2254
|
-
RequestCorrectionConfig.
|
|
2255
|
-
|
|
2256
|
-
|
|
2487
|
+
RequestCorrectionConfig.meta({ id: "RequestCorrectionActionConfig" }),
|
|
2488
|
+
EditActionConfig.meta({ id: "EditActionConfig" }),
|
|
2489
|
+
ArchiveConfig.meta({ id: "ArchiveActionConfig" }),
|
|
2490
|
+
CustomActionConfig.meta({ id: "CustomActionConfig" })
|
|
2257
2491
|
]).describe(
|
|
2258
2492
|
"Configuration of an action available for an event. Data collected depends on the action type and is accessible through the annotation property in ActionDocument."
|
|
2259
|
-
).
|
|
2260
|
-
var
|
|
2493
|
+
).meta({ id: "ActionConfig" });
|
|
2494
|
+
var actionConfigTypes = new Set(
|
|
2495
|
+
ActionConfig.options.map((opt) => opt.shape.type.value)
|
|
2496
|
+
);
|
|
2497
|
+
var DeclarationActionConfig = z22.discriminatedUnion("type", [
|
|
2261
2498
|
DeclareConfig,
|
|
2262
|
-
ValidateConfig,
|
|
2263
2499
|
RegisterConfig
|
|
2264
2500
|
]);
|
|
2265
2501
|
|
|
2266
2502
|
// ../commons/src/events/offline/CertificateConfig.ts
|
|
2267
|
-
var
|
|
2268
|
-
var FontFamily =
|
|
2269
|
-
normal:
|
|
2270
|
-
bold:
|
|
2271
|
-
italics:
|
|
2272
|
-
bolditalics:
|
|
2273
|
-
});
|
|
2274
|
-
var CertificateConfig =
|
|
2275
|
-
id:
|
|
2276
|
-
event:
|
|
2277
|
-
isV2Template:
|
|
2503
|
+
var z23 = __toESM(require("zod/v4"));
|
|
2504
|
+
var FontFamily = z23.object({
|
|
2505
|
+
normal: z23.string(),
|
|
2506
|
+
bold: z23.string(),
|
|
2507
|
+
italics: z23.string(),
|
|
2508
|
+
bolditalics: z23.string()
|
|
2509
|
+
});
|
|
2510
|
+
var CertificateConfig = z23.object({
|
|
2511
|
+
id: z23.string(),
|
|
2512
|
+
event: z23.string(),
|
|
2513
|
+
isV2Template: z23.boolean().optional(),
|
|
2278
2514
|
label: TranslationConfig,
|
|
2279
|
-
isDefault:
|
|
2280
|
-
fee:
|
|
2281
|
-
onTime:
|
|
2282
|
-
late:
|
|
2283
|
-
delayed:
|
|
2515
|
+
isDefault: z23.boolean(),
|
|
2516
|
+
fee: z23.object({
|
|
2517
|
+
onTime: z23.number(),
|
|
2518
|
+
late: z23.number(),
|
|
2519
|
+
delayed: z23.number()
|
|
2284
2520
|
}),
|
|
2285
|
-
svgUrl:
|
|
2286
|
-
fonts:
|
|
2287
|
-
conditionals:
|
|
2521
|
+
svgUrl: z23.string(),
|
|
2522
|
+
fonts: z23.record(z23.string(), FontFamily).optional(),
|
|
2523
|
+
conditionals: z23.array(ShowConditional).optional()
|
|
2288
2524
|
});
|
|
2289
2525
|
var CertificateTemplateConfig = CertificateConfig.extend({
|
|
2290
|
-
hash:
|
|
2291
|
-
svg:
|
|
2526
|
+
hash: z23.string().optional(),
|
|
2527
|
+
svg: z23.string()
|
|
2292
2528
|
});
|
|
2293
2529
|
|
|
2294
2530
|
// ../commons/src/events/offline/LanguageConfig.ts
|
|
2295
|
-
var
|
|
2296
|
-
var LanguageConfig =
|
|
2297
|
-
lang:
|
|
2531
|
+
var z24 = __toESM(require("zod/v4"));
|
|
2532
|
+
var LanguageConfig = z24.object({
|
|
2533
|
+
lang: z24.string(),
|
|
2298
2534
|
/**
|
|
2299
2535
|
* client.csv contents
|
|
2300
2536
|
*/
|
|
2301
|
-
messages:
|
|
2537
|
+
messages: z24.record(z24.string(), z24.string())
|
|
2302
2538
|
});
|
|
2303
2539
|
|
|
2304
2540
|
// ../commons/src/events/EventConfig.ts
|
|
2305
|
-
var
|
|
2541
|
+
var z30 = __toESM(require("zod/v4"));
|
|
2306
2542
|
|
|
2307
2543
|
// ../commons/src/events/SummaryConfig.ts
|
|
2308
|
-
var
|
|
2309
|
-
var BaseField2 =
|
|
2544
|
+
var z25 = __toESM(require("zod/v4"));
|
|
2545
|
+
var BaseField2 = z25.object({
|
|
2310
2546
|
emptyValueMessage: TranslationConfig.optional().describe(
|
|
2311
2547
|
"Default message displayed when the field value is empty."
|
|
2312
2548
|
),
|
|
2313
|
-
conditionals:
|
|
2549
|
+
conditionals: z25.array(ShowConditional).default([]).optional()
|
|
2314
2550
|
});
|
|
2315
2551
|
var ReferenceField = BaseField2.extend({
|
|
2316
|
-
fieldId:
|
|
2552
|
+
fieldId: z25.string(),
|
|
2317
2553
|
label: TranslationConfig.optional().describe(
|
|
2318
2554
|
"Overrides the default label from the referenced field when provided."
|
|
2319
2555
|
)
|
|
2320
2556
|
}).describe("Field referencing existing event data by field ID.");
|
|
2321
2557
|
var Field = BaseField2.extend({
|
|
2322
|
-
id:
|
|
2558
|
+
id: z25.string().describe("Identifier of the summary field."),
|
|
2323
2559
|
value: TranslationConfig.describe(
|
|
2324
2560
|
'Field value template supporting variables from configuration and EventMetadata (e.g. "{informant.phoneNo} {informant.email}").'
|
|
2325
2561
|
),
|
|
2326
2562
|
label: TranslationConfig
|
|
2327
2563
|
}).describe("Custom field defined for the summary view.");
|
|
2328
|
-
var SummaryConfig =
|
|
2329
|
-
fields:
|
|
2564
|
+
var SummaryConfig = z25.object({
|
|
2565
|
+
fields: z25.array(z25.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
|
|
2330
2566
|
}).describe("Configuration of the event summary section.");
|
|
2331
2567
|
|
|
2332
2568
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
|
2333
|
-
var
|
|
2334
|
-
var MatchType =
|
|
2335
|
-
var BaseField3 =
|
|
2336
|
-
config:
|
|
2569
|
+
var z26 = __toESM(require("zod/v4"));
|
|
2570
|
+
var MatchType = z26.enum(["fuzzy", "exact", "range", "within"]);
|
|
2571
|
+
var BaseField3 = z26.object({
|
|
2572
|
+
config: z26.object({
|
|
2337
2573
|
type: MatchType.describe(
|
|
2338
2574
|
"Determines the search type of field. How to match value."
|
|
2339
2575
|
),
|
|
2340
|
-
searchFields:
|
|
2576
|
+
searchFields: z26.array(z26.string()).optional().describe(
|
|
2341
2577
|
`
|
|
2342
2578
|
Defines multiple form fields that should be searched when this field has a value.
|
|
2343
2579
|
All specified fields will be combined using OR logic.
|
|
@@ -2347,7 +2583,7 @@ var BaseField3 = import_zod24.z.object({
|
|
|
2347
2583
|
`
|
|
2348
2584
|
)
|
|
2349
2585
|
}),
|
|
2350
|
-
type:
|
|
2586
|
+
type: z26.nativeEnum(FieldType).optional().describe(
|
|
2351
2587
|
`
|
|
2352
2588
|
Explicitly specify the field type for searchFields.
|
|
2353
2589
|
This is required when searchFields is defined, to show the correct control in the UI.
|
|
@@ -2361,7 +2597,7 @@ var BaseField3 = import_zod24.z.object({
|
|
|
2361
2597
|
This is required when searchFields is defined.
|
|
2362
2598
|
`
|
|
2363
2599
|
),
|
|
2364
|
-
options:
|
|
2600
|
+
options: z26.array(SelectOption).optional(),
|
|
2365
2601
|
searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
|
|
2366
2602
|
`
|
|
2367
2603
|
This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
|
|
@@ -2382,7 +2618,7 @@ var BaseField3 = import_zod24.z.object({
|
|
|
2382
2618
|
in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
|
|
2383
2619
|
`
|
|
2384
2620
|
),
|
|
2385
|
-
conditionals:
|
|
2621
|
+
conditionals: z26.array(FieldConditional).optional().describe(
|
|
2386
2622
|
`
|
|
2387
2623
|
In advanced search, we sometimes need to override the default field visibility conditionals.
|
|
2388
2624
|
|
|
@@ -2396,20 +2632,20 @@ var BaseField3 = import_zod24.z.object({
|
|
|
2396
2632
|
are always rendered in the advanced search form.
|
|
2397
2633
|
`
|
|
2398
2634
|
),
|
|
2399
|
-
validations:
|
|
2635
|
+
validations: z26.array(ValidationConfig).optional().describe(
|
|
2400
2636
|
`Option for overriding the field validations specifically for advanced search form.`
|
|
2401
2637
|
)
|
|
2402
2638
|
});
|
|
2403
|
-
var SearchQueryParams =
|
|
2404
|
-
eventType:
|
|
2639
|
+
var SearchQueryParams = z26.object({
|
|
2640
|
+
eventType: z26.string().optional().describe(
|
|
2405
2641
|
"Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
|
|
2406
2642
|
)
|
|
2407
2643
|
}).catchall(FieldValue);
|
|
2408
2644
|
var FieldConfigSchema = BaseField3.extend({
|
|
2409
|
-
fieldId:
|
|
2410
|
-
fieldType:
|
|
2645
|
+
fieldId: z26.string(),
|
|
2646
|
+
fieldType: z26.literal("field")
|
|
2411
2647
|
});
|
|
2412
|
-
var EventFieldIdInput =
|
|
2648
|
+
var EventFieldIdInput = z26.enum([
|
|
2413
2649
|
"trackingId",
|
|
2414
2650
|
"status",
|
|
2415
2651
|
"legalStatuses.REGISTERED.acceptedAt",
|
|
@@ -2418,7 +2654,7 @@ var EventFieldIdInput = import_zod24.z.enum([
|
|
|
2418
2654
|
"updatedAt"
|
|
2419
2655
|
]);
|
|
2420
2656
|
var METADATA_FIELD_PREFIX = "event.";
|
|
2421
|
-
var EventFieldId =
|
|
2657
|
+
var EventFieldId = z26.enum([
|
|
2422
2658
|
`${METADATA_FIELD_PREFIX}trackingId`,
|
|
2423
2659
|
`${METADATA_FIELD_PREFIX}status`,
|
|
2424
2660
|
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
|
|
@@ -2428,29 +2664,29 @@ var EventFieldId = import_zod24.z.enum([
|
|
|
2428
2664
|
]);
|
|
2429
2665
|
var EventFieldConfigSchema = BaseField3.extend({
|
|
2430
2666
|
fieldId: EventFieldId,
|
|
2431
|
-
fieldType:
|
|
2667
|
+
fieldType: z26.literal("event")
|
|
2432
2668
|
});
|
|
2433
|
-
var AdvancedSearchField =
|
|
2669
|
+
var AdvancedSearchField = z26.discriminatedUnion("fieldType", [FieldConfigSchema, EventFieldConfigSchema]).superRefine((data, ctx) => {
|
|
2434
2670
|
if (data.config.searchFields && data.config.searchFields.length > 0) {
|
|
2435
2671
|
if (!data.label) {
|
|
2436
2672
|
ctx.addIssue({
|
|
2437
|
-
code:
|
|
2673
|
+
code: z26.ZodIssueCode.custom,
|
|
2438
2674
|
message: "label is required when config.searchFields is defined.",
|
|
2439
2675
|
path: ["label"]
|
|
2440
2676
|
});
|
|
2441
2677
|
}
|
|
2442
2678
|
if (!data.type) {
|
|
2443
2679
|
ctx.addIssue({
|
|
2444
|
-
code:
|
|
2680
|
+
code: z26.ZodIssueCode.custom,
|
|
2445
2681
|
message: "type is required when config.searchFields is defined.",
|
|
2446
2682
|
path: ["type"]
|
|
2447
2683
|
});
|
|
2448
2684
|
}
|
|
2449
2685
|
}
|
|
2450
2686
|
});
|
|
2451
|
-
var AdvancedSearchConfig =
|
|
2687
|
+
var AdvancedSearchConfig = z26.object({
|
|
2452
2688
|
title: TranslationConfig.describe("Advanced search tab title"),
|
|
2453
|
-
fields:
|
|
2689
|
+
fields: z26.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
|
|
2454
2690
|
});
|
|
2455
2691
|
|
|
2456
2692
|
// ../commons/src/events/utils.ts
|
|
@@ -2459,11 +2695,11 @@ var import_lodash = require("lodash");
|
|
|
2459
2695
|
// ../commons/src/conditionals/validate.ts
|
|
2460
2696
|
var import__ = __toESM(require("ajv/dist/2019"));
|
|
2461
2697
|
var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
2462
|
-
var
|
|
2698
|
+
var z28 = __toESM(require("zod/v4"));
|
|
2463
2699
|
var import_date_fns = require("date-fns");
|
|
2464
2700
|
|
|
2465
2701
|
// ../commons/src/events/DynamicFieldValue.ts
|
|
2466
|
-
var
|
|
2702
|
+
var z27 = __toESM(require("zod/v4"));
|
|
2467
2703
|
|
|
2468
2704
|
// ../commons/src/conditionals/validate.ts
|
|
2469
2705
|
var ajv = new import__.default({
|
|
@@ -2472,9 +2708,9 @@ var ajv = new import__.default({
|
|
|
2472
2708
|
strict: false
|
|
2473
2709
|
// Allow minContains and other newer features
|
|
2474
2710
|
});
|
|
2475
|
-
var DataContext =
|
|
2476
|
-
rootData:
|
|
2477
|
-
$leafAdminStructureLocationIds:
|
|
2711
|
+
var DataContext = z28.object({
|
|
2712
|
+
rootData: z28.object({
|
|
2713
|
+
$leafAdminStructureLocationIds: z28.array(z28.object({ id: UUID }))
|
|
2478
2714
|
})
|
|
2479
2715
|
});
|
|
2480
2716
|
function resolveDataPath(rootData, dataPath, instancePath) {
|
|
@@ -2549,14 +2785,41 @@ ajv.addKeyword({
|
|
|
2549
2785
|
return locations.some((location) => location.id === locationIdInput);
|
|
2550
2786
|
}
|
|
2551
2787
|
});
|
|
2788
|
+
ajv.addKeyword({
|
|
2789
|
+
keyword: "customClientValidator",
|
|
2790
|
+
type: ["string", "number", "boolean", "object", "array", "null"],
|
|
2791
|
+
schemaType: "string",
|
|
2792
|
+
$data: false,
|
|
2793
|
+
errors: false,
|
|
2794
|
+
validate(schema, data, _, dataContext) {
|
|
2795
|
+
if (!schema || typeof schema !== "string") {
|
|
2796
|
+
return true;
|
|
2797
|
+
}
|
|
2798
|
+
if (typeof window === "undefined") {
|
|
2799
|
+
return true;
|
|
2800
|
+
}
|
|
2801
|
+
try {
|
|
2802
|
+
const validatorFn = new Function(
|
|
2803
|
+
"value",
|
|
2804
|
+
"context",
|
|
2805
|
+
`return (${schema})(value, context)`
|
|
2806
|
+
);
|
|
2807
|
+
const context = dataContext?.rootData || {};
|
|
2808
|
+
const result = validatorFn(data, context);
|
|
2809
|
+
return Boolean(result);
|
|
2810
|
+
} catch (error) {
|
|
2811
|
+
return false;
|
|
2812
|
+
}
|
|
2813
|
+
}
|
|
2814
|
+
});
|
|
2552
2815
|
|
|
2553
2816
|
// ../commons/src/utils.ts
|
|
2554
|
-
var
|
|
2555
|
-
var FullNameV1 =
|
|
2556
|
-
|
|
2557
|
-
use:
|
|
2558
|
-
family:
|
|
2559
|
-
given:
|
|
2817
|
+
var z29 = __toESM(require("zod/v4"));
|
|
2818
|
+
var FullNameV1 = z29.array(
|
|
2819
|
+
z29.object({
|
|
2820
|
+
use: z29.string(),
|
|
2821
|
+
family: z29.string(),
|
|
2822
|
+
given: z29.array(z29.string())
|
|
2560
2823
|
})
|
|
2561
2824
|
);
|
|
2562
2825
|
function omitKeyDeep(obj, keyToRemove) {
|
|
@@ -2577,9 +2840,6 @@ function omitKeyDeep(obj, keyToRemove) {
|
|
|
2577
2840
|
|
|
2578
2841
|
// ../commons/src/events/utils.ts
|
|
2579
2842
|
var import_date_fns2 = require("date-fns");
|
|
2580
|
-
function isDeclarationActionConfig(action) {
|
|
2581
|
-
return DeclarationActions.safeParse(action.type).success;
|
|
2582
|
-
}
|
|
2583
2843
|
function getDeclarationFields(configuration) {
|
|
2584
2844
|
return configuration.declaration.pages.flatMap(({ fields }) => fields);
|
|
2585
2845
|
}
|
|
@@ -2590,7 +2850,10 @@ var getActionAnnotationFields = (actionConfig) => {
|
|
|
2590
2850
|
if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
|
|
2591
2851
|
return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
|
|
2592
2852
|
}
|
|
2593
|
-
if (
|
|
2853
|
+
if (actionConfig.type === ActionType.CUSTOM) {
|
|
2854
|
+
return actionConfig.form;
|
|
2855
|
+
}
|
|
2856
|
+
if ("review" in actionConfig) {
|
|
2594
2857
|
return actionConfig.review.fields;
|
|
2595
2858
|
}
|
|
2596
2859
|
return [];
|
|
@@ -2610,38 +2873,8 @@ var EXCLUDED_ACTIONS = [
|
|
|
2610
2873
|
ActionType.REJECT_CORRECTION
|
|
2611
2874
|
];
|
|
2612
2875
|
|
|
2613
|
-
// ../commons/src/events/
|
|
2614
|
-
|
|
2615
|
-
(0, import_zod_openapi10.extendZodWithOpenApi)(import_zod27.z);
|
|
2616
|
-
var EventConfig = import_zod27.z.object({
|
|
2617
|
-
id: import_zod27.z.string().describe(
|
|
2618
|
-
'Machine-readable identifier of the event (e.g. "birth", "death").'
|
|
2619
|
-
),
|
|
2620
|
-
dateOfEvent: FieldReference.optional().describe(
|
|
2621
|
-
"Reference to the field capturing the date of the event (e.g. date of birth). Defaults to the event creation date if unspecified."
|
|
2622
|
-
),
|
|
2623
|
-
title: TranslationConfig.describe(
|
|
2624
|
-
'Title template for the singular event, supporting variables (e.g. "{applicant.name.firstname} {applicant.name.surname}").'
|
|
2625
|
-
),
|
|
2626
|
-
fallbackTitle: TranslationConfig.optional().describe(
|
|
2627
|
-
"Fallback title shown when the main title resolves to an empty value."
|
|
2628
|
-
),
|
|
2629
|
-
summary: SummaryConfig.describe(
|
|
2630
|
-
"Summary information displayed in the event overview."
|
|
2631
|
-
),
|
|
2632
|
-
label: TranslationConfig.describe(
|
|
2633
|
-
"Human-readable label for the event type."
|
|
2634
|
-
),
|
|
2635
|
-
actions: import_zod27.z.array(ActionConfig).describe(
|
|
2636
|
-
"Configuration of system-defined actions associated with the event."
|
|
2637
|
-
),
|
|
2638
|
-
declaration: DeclarationFormConfig.describe(
|
|
2639
|
-
"Configuration of the form used to gather event data."
|
|
2640
|
-
),
|
|
2641
|
-
advancedSearch: import_zod27.z.array(AdvancedSearchConfig).optional().default([]).describe(
|
|
2642
|
-
"Configuration of fields available in the advanced search feature."
|
|
2643
|
-
)
|
|
2644
|
-
}).superRefine((event2, ctx) => {
|
|
2876
|
+
// ../commons/src/events/eventConfigValidation.ts
|
|
2877
|
+
function validateAdvancedSearchConfig(event2, ctx) {
|
|
2645
2878
|
const allFields = findAllFields(event2);
|
|
2646
2879
|
const fieldIds = allFields.map((field3) => field3.id);
|
|
2647
2880
|
const advancedSearchFields = event2.advancedSearch.flatMap(
|
|
@@ -2668,10 +2901,12 @@ var EventConfig = import_zod27.z.object({
|
|
|
2668
2901
|
ctx.addIssue({
|
|
2669
2902
|
code: "custom",
|
|
2670
2903
|
message: `Advanced search id must match a field id of form fields or pre-defined metadata fields.
|
|
2671
|
-
|
|
2904
|
+
Invalid AdvancedSearch field IDs for event ${event2.id}: ${invalidFields.map((f) => f.fieldId).join(", ")}`,
|
|
2672
2905
|
path: ["advancedSearch"]
|
|
2673
2906
|
});
|
|
2674
2907
|
}
|
|
2908
|
+
}
|
|
2909
|
+
function validateDateOfEvent(event2, ctx) {
|
|
2675
2910
|
if (event2.dateOfEvent) {
|
|
2676
2911
|
const eventDateFieldId = getDeclarationFields(event2).find(
|
|
2677
2912
|
({ id }) => id === event2.dateOfEvent?.$$field
|
|
@@ -2680,7 +2915,7 @@ var EventConfig = import_zod27.z.object({
|
|
|
2680
2915
|
ctx.addIssue({
|
|
2681
2916
|
code: "custom",
|
|
2682
2917
|
message: `Date of event field id must match a field id in fields array.
|
|
2683
|
-
|
|
2918
|
+
Invalid date of event field ID for event ${event2.id}: ${event2.dateOfEvent.$$field}`,
|
|
2684
2919
|
path: ["dateOfEvent"]
|
|
2685
2920
|
});
|
|
2686
2921
|
} else if (eventDateFieldId.type !== FieldType.DATE) {
|
|
@@ -2691,8 +2926,105 @@ var EventConfig = import_zod27.z.object({
|
|
|
2691
2926
|
});
|
|
2692
2927
|
}
|
|
2693
2928
|
}
|
|
2694
|
-
}
|
|
2695
|
-
|
|
2929
|
+
}
|
|
2930
|
+
function validatePlaceOfEvent(event2, ctx) {
|
|
2931
|
+
if (event2.placeOfEvent) {
|
|
2932
|
+
const eventPlaceFieldId = getDeclarationFields(event2).find(
|
|
2933
|
+
({ id }) => id === event2.placeOfEvent?.$$field
|
|
2934
|
+
);
|
|
2935
|
+
if (!eventPlaceFieldId) {
|
|
2936
|
+
ctx.addIssue({
|
|
2937
|
+
code: "custom",
|
|
2938
|
+
message: `Place of event field id must match a field id in the event.declaration fields.
|
|
2939
|
+
Invalid place of event field ID for event ${event2.id}: ${event2.placeOfEvent.$$field}`,
|
|
2940
|
+
path: ["placeOfEvent"]
|
|
2941
|
+
});
|
|
2942
|
+
}
|
|
2943
|
+
}
|
|
2944
|
+
}
|
|
2945
|
+
function validateActionFlags(event2, ctx) {
|
|
2946
|
+
const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
|
|
2947
|
+
const configuredFlagIds = event2.flags.map((flag) => flag.id);
|
|
2948
|
+
const actionFlagIds = event2.actions.flatMap(
|
|
2949
|
+
(action) => action.flags.map((flag) => flag.id)
|
|
2950
|
+
);
|
|
2951
|
+
for (const actionFlagId of actionFlagIds) {
|
|
2952
|
+
const isConfigured = configuredFlagIds.includes(actionFlagId);
|
|
2953
|
+
const isInherent = isInherentFlag(actionFlagId);
|
|
2954
|
+
if (!isConfigured && !isInherent) {
|
|
2955
|
+
ctx.addIssue({
|
|
2956
|
+
code: "custom",
|
|
2957
|
+
message: `Action flag id must match an inherent flag or a configured flag in the flags array. Invalid action flag ID for event '${event2.id}': '${actionFlagId}'`,
|
|
2958
|
+
path: ["actions"]
|
|
2959
|
+
});
|
|
2960
|
+
}
|
|
2961
|
+
}
|
|
2962
|
+
}
|
|
2963
|
+
function validateActionOrder(event2, ctx) {
|
|
2964
|
+
if (event2.actionOrder) {
|
|
2965
|
+
const customActionTypes = event2.actions.filter((action) => action.type === ActionType.CUSTOM).map((action) => action.customActionType);
|
|
2966
|
+
const validActionTypes = [
|
|
2967
|
+
...workqueueActions.options,
|
|
2968
|
+
...customActionTypes
|
|
2969
|
+
];
|
|
2970
|
+
for (const actionType of event2.actionOrder) {
|
|
2971
|
+
if (!validActionTypes.includes(actionType)) {
|
|
2972
|
+
ctx.addIssue({
|
|
2973
|
+
code: "custom",
|
|
2974
|
+
message: `Invalid action type in action order: ${actionType}`,
|
|
2975
|
+
path: ["actionOrder"]
|
|
2976
|
+
});
|
|
2977
|
+
}
|
|
2978
|
+
}
|
|
2979
|
+
}
|
|
2980
|
+
}
|
|
2981
|
+
|
|
2982
|
+
// ../commons/src/events/EventConfig.ts
|
|
2983
|
+
var EventConfig = z30.object({
|
|
2984
|
+
id: z30.string().describe(
|
|
2985
|
+
'Machine-readable identifier of the event (e.g. "birth", "death").'
|
|
2986
|
+
),
|
|
2987
|
+
dateOfEvent: FieldReference.optional().describe(
|
|
2988
|
+
"Reference to the field capturing the date of the event (e.g. date of birth). Defaults to the event creation date if unspecified."
|
|
2989
|
+
),
|
|
2990
|
+
placeOfEvent: FieldReference.optional().describe(
|
|
2991
|
+
"Reference to the field capturing the place of the event (e.g. place of birth). Defaults to the meta.createdAtLocation if unspecified."
|
|
2992
|
+
),
|
|
2993
|
+
title: TranslationConfig.describe(
|
|
2994
|
+
'Title template for the singular event, supporting variables (e.g. "{applicant.name.firstname} {applicant.name.surname}").'
|
|
2995
|
+
),
|
|
2996
|
+
fallbackTitle: TranslationConfig.optional().describe(
|
|
2997
|
+
"Fallback title shown when the main title resolves to an empty value."
|
|
2998
|
+
),
|
|
2999
|
+
summary: SummaryConfig.describe(
|
|
3000
|
+
"Summary information displayed in the event overview."
|
|
3001
|
+
),
|
|
3002
|
+
label: TranslationConfig.describe(
|
|
3003
|
+
"Human-readable label for the event type."
|
|
3004
|
+
),
|
|
3005
|
+
actions: z30.array(ActionConfig).describe(
|
|
3006
|
+
"Configuration of system-defined actions associated with the event."
|
|
3007
|
+
),
|
|
3008
|
+
actionOrder: z30.array(z30.string()).optional().describe(
|
|
3009
|
+
"Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
|
|
3010
|
+
),
|
|
3011
|
+
declaration: DeclarationFormConfig.describe(
|
|
3012
|
+
"Configuration of the form used to gather event data."
|
|
3013
|
+
),
|
|
3014
|
+
advancedSearch: z30.array(AdvancedSearchConfig).optional().default([]).describe(
|
|
3015
|
+
"Configuration of fields available in the advanced search feature."
|
|
3016
|
+
),
|
|
3017
|
+
flags: z30.array(FlagConfig).optional().default([]).describe(
|
|
3018
|
+
"Configuration of flags associated with the actions of this event type."
|
|
3019
|
+
)
|
|
3020
|
+
}).superRefine((event2, ctx) => {
|
|
3021
|
+
validateAdvancedSearchConfig(event2, ctx);
|
|
3022
|
+
validateDateOfEvent(event2, ctx);
|
|
3023
|
+
validatePlaceOfEvent(event2, ctx);
|
|
3024
|
+
validateActionFlags(event2, ctx);
|
|
3025
|
+
validateActionOrder(event2, ctx);
|
|
3026
|
+
}).meta({
|
|
3027
|
+
id: "EventConfig"
|
|
2696
3028
|
}).describe("Configuration defining an event type.");
|
|
2697
3029
|
|
|
2698
3030
|
// ../commons/src/events/EventConfigInput.ts
|
|
@@ -2701,7 +3033,7 @@ var defineActionForm = (actionForm) => ActionFormConfig.parse(actionForm);
|
|
|
2701
3033
|
var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
|
|
2702
3034
|
|
|
2703
3035
|
// ../commons/src/events/WorkqueueConfig.ts
|
|
2704
|
-
var
|
|
3036
|
+
var z33 = __toESM(require("zod/v4"));
|
|
2705
3037
|
|
|
2706
3038
|
// ../commons/src/conditionals/conditionals.ts
|
|
2707
3039
|
var objectHash = __toESM(require("object-hash"));
|
|
@@ -2739,7 +3071,7 @@ function not(condition) {
|
|
|
2739
3071
|
required: []
|
|
2740
3072
|
});
|
|
2741
3073
|
}
|
|
2742
|
-
function
|
|
3074
|
+
function never2() {
|
|
2743
3075
|
return not(alwaysTrue());
|
|
2744
3076
|
}
|
|
2745
3077
|
function jsonFieldPath(field3) {
|
|
@@ -3235,6 +3567,112 @@ function createFieldConditionals(fieldId) {
|
|
|
3235
3567
|
required: [fieldId]
|
|
3236
3568
|
});
|
|
3237
3569
|
},
|
|
3570
|
+
/**
|
|
3571
|
+
* Executes a custom validation function defined by country configuration.
|
|
3572
|
+
*
|
|
3573
|
+
* **Use this as a last resort when predefined toolkit methods are insufficient.**
|
|
3574
|
+
*
|
|
3575
|
+
* The function is serialized via toString() and transmitted as part of the JSON Schema.
|
|
3576
|
+
* It is deserialized just-in-time during validation on the client.
|
|
3577
|
+
*
|
|
3578
|
+
* @param fn - Validation function that receives the field value and form context.
|
|
3579
|
+
* Must return true if valid, false if invalid.
|
|
3580
|
+
*
|
|
3581
|
+
* @returns JSONSchema conditional for AJV validation
|
|
3582
|
+
*
|
|
3583
|
+
* @example
|
|
3584
|
+
* // Simple age validation
|
|
3585
|
+
* field('age').customClientValidator((value, ctx) => {
|
|
3586
|
+
* return value >= 18
|
|
3587
|
+
* })
|
|
3588
|
+
*
|
|
3589
|
+
* @example
|
|
3590
|
+
* // Cross-field validation: child DOB must be after mother DOB
|
|
3591
|
+
* field('child.dob').customClientValidator((value, ctx) => {
|
|
3592
|
+
* const motherDob = ctx.$form['mother.dob']
|
|
3593
|
+
* if (!motherDob || !value) return false
|
|
3594
|
+
* return new Date(value) > new Date(motherDob)
|
|
3595
|
+
* })
|
|
3596
|
+
*
|
|
3597
|
+
* @example
|
|
3598
|
+
* // Two number fields validated together
|
|
3599
|
+
* field('fieldA').customClientValidator((value, ctx) => {
|
|
3600
|
+
* const fieldB = ctx.$form['fieldB']
|
|
3601
|
+
* if (!fieldB) return false
|
|
3602
|
+
* return value + fieldB > 100
|
|
3603
|
+
* })
|
|
3604
|
+
*
|
|
3605
|
+
* @remarks
|
|
3606
|
+
* Limitations:
|
|
3607
|
+
* - Client-side only. For backend validation, use country config event triggers.
|
|
3608
|
+
* - Cannot reference external libraries (lodash, etc.)
|
|
3609
|
+
* - Function must be pure — no side effects, no closures over external state
|
|
3610
|
+
* - Function must be serialisable via toString()
|
|
3611
|
+
* - Receives (value, context) parameters where context contains $form, $now, $online, etc.
|
|
3612
|
+
* - Must return boolean: true = valid, false = invalid
|
|
3613
|
+
*
|
|
3614
|
+
* @see https://github.com/opencrvs/opencrvs-core/issues/11653
|
|
3615
|
+
*/
|
|
3616
|
+
customClientValidator(fn) {
|
|
3617
|
+
const serializedFn = fn.toString();
|
|
3618
|
+
return defineFormConditional({
|
|
3619
|
+
type: "object",
|
|
3620
|
+
properties: {
|
|
3621
|
+
[fieldId]: wrapToPath(
|
|
3622
|
+
{
|
|
3623
|
+
customClientValidator: serializedFn
|
|
3624
|
+
},
|
|
3625
|
+
this.$$subfield
|
|
3626
|
+
)
|
|
3627
|
+
},
|
|
3628
|
+
required: [fieldId]
|
|
3629
|
+
});
|
|
3630
|
+
},
|
|
3631
|
+
/**
|
|
3632
|
+
* Defines a client-side computation function for dynamic field values.
|
|
3633
|
+
*
|
|
3634
|
+
* **Use this as a last resort when predefined toolkit methods are insufficient.**
|
|
3635
|
+
*
|
|
3636
|
+
* The function is serialized via toString() and transmitted to the client,
|
|
3637
|
+
* where it is deserialized and executed to compute field values dynamically.
|
|
3638
|
+
*
|
|
3639
|
+
* @param fn - Computation function that receives the field value and form context.
|
|
3640
|
+
* Returns the computed value (any type).
|
|
3641
|
+
*
|
|
3642
|
+
* @returns CodeToEvaluate object for client-side execution
|
|
3643
|
+
*
|
|
3644
|
+
* @example
|
|
3645
|
+
* // Concatenate first and last name
|
|
3646
|
+
* field('fullName').customClientEvaluation((value, ctx) => {
|
|
3647
|
+
* return `${ctx.$form.firstName} ${ctx.$form.lastName}`
|
|
3648
|
+
* })
|
|
3649
|
+
*
|
|
3650
|
+
* @example
|
|
3651
|
+
* // Calculate age from date of birth
|
|
3652
|
+
* field('childAge').customClientEvaluation((value, ctx) => {
|
|
3653
|
+
* const dob = ctx.$form['child.dob']
|
|
3654
|
+
* if (!dob) return undefined
|
|
3655
|
+
* const age = Math.floor((new Date(ctx.$now) - new Date(dob)) / (365.25 * 24 * 60 * 60 * 1000))
|
|
3656
|
+
* return age
|
|
3657
|
+
* })
|
|
3658
|
+
*
|
|
3659
|
+
* @remarks
|
|
3660
|
+
* Limitations:
|
|
3661
|
+
* - Client-side only. For backend computation, use country config event triggers.
|
|
3662
|
+
* - Cannot reference external libraries (lodash, etc.)
|
|
3663
|
+
* - Function must be pure — no side effects, no closures over external state
|
|
3664
|
+
* - Function must be serialisable via toString()
|
|
3665
|
+
* - Receives (value, context) parameters where context contains $form, $now, $online, etc.
|
|
3666
|
+
* - Should return the computed value (any type)
|
|
3667
|
+
*
|
|
3668
|
+
* @see https://github.com/opencrvs/opencrvs-core/issues/11653
|
|
3669
|
+
*/
|
|
3670
|
+
customClientEvaluation(fn) {
|
|
3671
|
+
const serializedFn = fn.toString();
|
|
3672
|
+
return {
|
|
3673
|
+
$$code: serializedFn
|
|
3674
|
+
};
|
|
3675
|
+
},
|
|
3238
3676
|
getId: () => ({ fieldId }),
|
|
3239
3677
|
/**
|
|
3240
3678
|
* @deprecated
|
|
@@ -3409,217 +3847,108 @@ var event = Object.assign(eventFn, {
|
|
|
3409
3847
|
return {
|
|
3410
3848
|
/**
|
|
3411
3849
|
* Creates a conditional that checks if the event contains a specific action type
|
|
3412
|
-
* with a minimum count of occurrences.
|
|
3413
|
-
*
|
|
3414
|
-
* @param minCount - The minimum number of actions required.
|
|
3415
|
-
*/
|
|
3416
|
-
minCount: (minCount) => createCountConditional("minContains", minCount, additionalFields),
|
|
3417
|
-
/**
|
|
3418
|
-
* Builds a conditional that sets a maximum count for the number of actions.
|
|
3419
|
-
* This is useful for limiting the number of actions of a specific type in a single event.
|
|
3420
|
-
*/
|
|
3421
|
-
maxCount: (maxCount) => createCountConditional("maxContains", maxCount, additionalFields)
|
|
3422
|
-
};
|
|
3423
|
-
};
|
|
3424
|
-
const chainableMethods = {
|
|
3425
|
-
/**
|
|
3426
|
-
* Adds additional field constraints to the action matching.
|
|
3427
|
-
*
|
|
3428
|
-
* @param fields - Object containing additional fields to match on the action.
|
|
3429
|
-
*/
|
|
3430
|
-
withFields: (fields) => withMinMax(fields),
|
|
3431
|
-
/**
|
|
3432
|
-
* Adds template ID constraint to the action matching.
|
|
3433
|
-
* This is a convenience method that adds content.templateId to the fields.
|
|
3434
|
-
*
|
|
3435
|
-
* @param id - The template ID to match against.
|
|
3436
|
-
*/
|
|
3437
|
-
withTemplate: (id) => withMinMax({
|
|
3438
|
-
content: { templateId: id }
|
|
3439
|
-
}),
|
|
3440
|
-
...withMinMax()
|
|
3441
|
-
};
|
|
3442
|
-
return { ...basicConditional, ...chainableMethods };
|
|
3443
|
-
},
|
|
3444
|
-
field(field3) {
|
|
3445
|
-
return {
|
|
3446
|
-
$event: field3
|
|
3447
|
-
};
|
|
3448
|
-
}
|
|
3449
|
-
});
|
|
3450
|
-
|
|
3451
|
-
// ../commons/src/events/WorkqueueColumnConfig.ts
|
|
3452
|
-
var
|
|
3453
|
-
var WorkqueueColumnKeysArray = [
|
|
3454
|
-
...EventMetadataKeysArray,
|
|
3455
|
-
"title",
|
|
3456
|
-
"outbox"
|
|
3457
|
-
];
|
|
3458
|
-
var WorkqueueColumnKeys =
|
|
3459
|
-
var WorkqueueColumnValue =
|
|
3460
|
-
$event: WorkqueueColumnKeys
|
|
3461
|
-
});
|
|
3462
|
-
var WorkqueueColumn =
|
|
3463
|
-
label: TranslationConfig,
|
|
3464
|
-
value: WorkqueueColumnValue
|
|
3465
|
-
});
|
|
3466
|
-
function defineWorkqueuesColumns(workqueueColumns) {
|
|
3467
|
-
return workqueueColumns.map(
|
|
3468
|
-
(workqueueColumn) => WorkqueueColumn.parse(workqueueColumn)
|
|
3469
|
-
);
|
|
3470
|
-
}
|
|
3471
|
-
|
|
3472
|
-
// ../commons/src/events/CountryConfigQueryInput.ts
|
|
3473
|
-
var
|
|
3474
|
-
var SerializableExact =
|
|
3475
|
-
type:
|
|
3476
|
-
term:
|
|
3477
|
-
});
|
|
3478
|
-
var SerializableWithin =
|
|
3479
|
-
type:
|
|
3480
|
-
location:
|
|
3481
|
-
});
|
|
3482
|
-
var SerializedQueryExpression =
|
|
3483
|
-
eventType:
|
|
3484
|
-
status:
|
|
3485
|
-
createdAt:
|
|
3486
|
-
updatedAt:
|
|
3487
|
-
"legalStatuses.REGISTERED.createdAt":
|
|
3488
|
-
"legalStatuses.
|
|
3489
|
-
|
|
3490
|
-
),
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
),
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
),
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
var
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
var CountryConfigQueryType = import_zod29.z.discriminatedUnion("type", [And2, Or2]);
|
|
3515
|
-
var CountryConfigQueryInputType = import_zod29.z.union([
|
|
3516
|
-
SerializedQueryExpression,
|
|
3517
|
-
And2,
|
|
3518
|
-
Or2
|
|
3519
|
-
]);
|
|
3520
|
-
|
|
3521
|
-
// ../commons/src/icons.ts
|
|
3522
|
-
var import_zod30 = require("zod");
|
|
3523
|
-
var AvailableIcons = import_zod30.z.enum([
|
|
3524
|
-
"Archived",
|
|
3525
|
-
"Assigned",
|
|
3526
|
-
"Certified",
|
|
3527
|
-
"Close",
|
|
3528
|
-
"Collapse",
|
|
3529
|
-
"Draft",
|
|
3530
|
-
"DuplicateYellow",
|
|
3531
|
-
"Expand",
|
|
3532
|
-
"ExternalValidate",
|
|
3533
|
-
"FilledCheck",
|
|
3534
|
-
"InReview",
|
|
3535
|
-
"Offline",
|
|
3536
|
-
"Registered",
|
|
3537
|
-
"RequiresUpdates",
|
|
3538
|
-
"Sent",
|
|
3539
|
-
"Validated",
|
|
3540
|
-
"WaitingApproval",
|
|
3541
|
-
"ChartActivity",
|
|
3542
|
-
"Activity",
|
|
3543
|
-
"Archive",
|
|
3544
|
-
"ArchiveTray",
|
|
3545
|
-
"ArrowLeft",
|
|
3546
|
-
"ArrowRight",
|
|
3547
|
-
"Buildings",
|
|
3548
|
-
"Circle",
|
|
3549
|
-
"CaretDown",
|
|
3550
|
-
"CaretLeft",
|
|
3551
|
-
"CaretRight",
|
|
3552
|
-
"ChartBar",
|
|
3553
|
-
"ChartLine",
|
|
3554
|
-
"ChatCircle",
|
|
3555
|
-
"CheckSquare",
|
|
3556
|
-
"Compass",
|
|
3557
|
-
"Check",
|
|
3558
|
-
"Copy",
|
|
3559
|
-
"Database",
|
|
3560
|
-
"DotsThreeVertical",
|
|
3561
|
-
"ArrowCounterClockwise",
|
|
3562
|
-
"MagnifyingGlassMinus",
|
|
3563
|
-
"MagnifyingGlassPlus",
|
|
3564
|
-
"Export",
|
|
3565
|
-
"Eye",
|
|
3566
|
-
"EyeSlash",
|
|
3567
|
-
"Envelope",
|
|
3568
|
-
"File",
|
|
3569
|
-
"FileSearch",
|
|
3570
|
-
"FileMinus",
|
|
3571
|
-
"FilePlus",
|
|
3572
|
-
"FileText",
|
|
3573
|
-
"FileX",
|
|
3574
|
-
"Handshake",
|
|
3575
|
-
"Gear",
|
|
3576
|
-
"GitBranch",
|
|
3577
|
-
"IdentificationCard",
|
|
3578
|
-
"List",
|
|
3579
|
-
"ListBullets",
|
|
3580
|
-
"Lock",
|
|
3581
|
-
"MagnifyingGlass",
|
|
3582
|
-
"MapPin",
|
|
3583
|
-
"Medal",
|
|
3584
|
-
"NotePencil",
|
|
3585
|
-
"Paperclip",
|
|
3586
|
-
"PaperPlaneTilt",
|
|
3587
|
-
"Pen",
|
|
3588
|
-
"Pencil",
|
|
3589
|
-
"PencilSimpleLine",
|
|
3590
|
-
"Phone",
|
|
3591
|
-
"Plus",
|
|
3592
|
-
"Printer",
|
|
3593
|
-
"SignOut",
|
|
3594
|
-
"Star",
|
|
3595
|
-
"Target",
|
|
3596
|
-
"TextT",
|
|
3597
|
-
"Trash",
|
|
3598
|
-
"UploadSimple",
|
|
3599
|
-
"User",
|
|
3600
|
-
"UserPlus",
|
|
3601
|
-
"Users",
|
|
3602
|
-
"WarningCircle",
|
|
3603
|
-
"X",
|
|
3604
|
-
"CircleWavyCheck",
|
|
3605
|
-
"CircleWavyQuestion",
|
|
3606
|
-
"ArchiveBox",
|
|
3607
|
-
"ArrowCircleDown",
|
|
3608
|
-
"FileArrowUp",
|
|
3609
|
-
"FileDotted",
|
|
3610
|
-
"Files",
|
|
3611
|
-
"PencilLine",
|
|
3612
|
-
"PencilCircle",
|
|
3613
|
-
"UserCircle",
|
|
3614
|
-
"Clock",
|
|
3615
|
-
"QrCode",
|
|
3616
|
-
"Webcam",
|
|
3617
|
-
"Sun",
|
|
3618
|
-
"DeviceTabletCamera",
|
|
3619
|
-
"Globe",
|
|
3620
|
-
"Fingerprint",
|
|
3621
|
-
"PushPin",
|
|
3622
|
-
"Timer"
|
|
3850
|
+
* with a minimum count of occurrences.
|
|
3851
|
+
*
|
|
3852
|
+
* @param minCount - The minimum number of actions required.
|
|
3853
|
+
*/
|
|
3854
|
+
minCount: (minCount) => createCountConditional("minContains", minCount, additionalFields),
|
|
3855
|
+
/**
|
|
3856
|
+
* Builds a conditional that sets a maximum count for the number of actions.
|
|
3857
|
+
* This is useful for limiting the number of actions of a specific type in a single event.
|
|
3858
|
+
*/
|
|
3859
|
+
maxCount: (maxCount) => createCountConditional("maxContains", maxCount, additionalFields)
|
|
3860
|
+
};
|
|
3861
|
+
};
|
|
3862
|
+
const chainableMethods = {
|
|
3863
|
+
/**
|
|
3864
|
+
* Adds additional field constraints to the action matching.
|
|
3865
|
+
*
|
|
3866
|
+
* @param fields - Object containing additional fields to match on the action.
|
|
3867
|
+
*/
|
|
3868
|
+
withFields: (fields) => withMinMax(fields),
|
|
3869
|
+
/**
|
|
3870
|
+
* Adds template ID constraint to the action matching.
|
|
3871
|
+
* This is a convenience method that adds content.templateId to the fields.
|
|
3872
|
+
*
|
|
3873
|
+
* @param id - The template ID to match against.
|
|
3874
|
+
*/
|
|
3875
|
+
withTemplate: (id) => withMinMax({
|
|
3876
|
+
content: { templateId: id }
|
|
3877
|
+
}),
|
|
3878
|
+
...withMinMax()
|
|
3879
|
+
};
|
|
3880
|
+
return { ...basicConditional, ...chainableMethods };
|
|
3881
|
+
},
|
|
3882
|
+
field(field3) {
|
|
3883
|
+
return {
|
|
3884
|
+
$event: field3
|
|
3885
|
+
};
|
|
3886
|
+
}
|
|
3887
|
+
});
|
|
3888
|
+
|
|
3889
|
+
// ../commons/src/events/WorkqueueColumnConfig.ts
|
|
3890
|
+
var z31 = __toESM(require("zod/v4"));
|
|
3891
|
+
var WorkqueueColumnKeysArray = [
|
|
3892
|
+
...EventMetadataKeysArray,
|
|
3893
|
+
"title",
|
|
3894
|
+
"outbox"
|
|
3895
|
+
];
|
|
3896
|
+
var WorkqueueColumnKeys = z31.enum(WorkqueueColumnKeysArray);
|
|
3897
|
+
var WorkqueueColumnValue = z31.object({
|
|
3898
|
+
$event: WorkqueueColumnKeys
|
|
3899
|
+
});
|
|
3900
|
+
var WorkqueueColumn = z31.object({
|
|
3901
|
+
label: TranslationConfig,
|
|
3902
|
+
value: WorkqueueColumnValue
|
|
3903
|
+
});
|
|
3904
|
+
function defineWorkqueuesColumns(workqueueColumns) {
|
|
3905
|
+
return workqueueColumns.map(
|
|
3906
|
+
(workqueueColumn) => WorkqueueColumn.parse(workqueueColumn)
|
|
3907
|
+
);
|
|
3908
|
+
}
|
|
3909
|
+
|
|
3910
|
+
// ../commons/src/events/CountryConfigQueryInput.ts
|
|
3911
|
+
var z32 = __toESM(require("zod/v4"));
|
|
3912
|
+
var SerializableExact = z32.object({
|
|
3913
|
+
type: z32.literal("exact"),
|
|
3914
|
+
term: z32.union([z32.string(), SerializedUserField])
|
|
3915
|
+
});
|
|
3916
|
+
var SerializableWithin = z32.object({
|
|
3917
|
+
type: z32.literal("within"),
|
|
3918
|
+
location: z32.union([z32.string(), SerializedUserField])
|
|
3919
|
+
});
|
|
3920
|
+
var SerializedQueryExpression = z32.object({
|
|
3921
|
+
eventType: z32.string(),
|
|
3922
|
+
status: z32.optional(z32.union([AnyOfStatus, ExactStatus])),
|
|
3923
|
+
createdAt: z32.optional(DateCondition),
|
|
3924
|
+
updatedAt: z32.optional(DateCondition),
|
|
3925
|
+
"legalStatuses.REGISTERED.createdAt": z32.optional(DateCondition),
|
|
3926
|
+
"legalStatuses.DECLARED.createdAtLocation": z32.optional(SerializableWithin),
|
|
3927
|
+
"legalStatuses.REGISTERED.createdAtLocation": z32.optional(SerializableWithin),
|
|
3928
|
+
"legalStatuses.REGISTERED.registrationNumber": z32.optional(Exact),
|
|
3929
|
+
createdAtLocation: z32.optional(SerializableWithin),
|
|
3930
|
+
updatedAtLocation: z32.optional(SerializableWithin),
|
|
3931
|
+
assignedTo: z32.optional(SerializableExact),
|
|
3932
|
+
createdBy: z32.optional(SerializableExact),
|
|
3933
|
+
createdByUserType: ExactUserType,
|
|
3934
|
+
updatedBy: z32.optional(SerializableExact),
|
|
3935
|
+
trackingId: z32.optional(Exact),
|
|
3936
|
+
flags: z32.optional(ContainsFlags),
|
|
3937
|
+
data: QueryInput
|
|
3938
|
+
}).partial();
|
|
3939
|
+
var Or2 = z32.object({
|
|
3940
|
+
type: z32.literal("or"),
|
|
3941
|
+
clauses: z32.array(SerializedQueryExpression)
|
|
3942
|
+
});
|
|
3943
|
+
var And2 = z32.object({
|
|
3944
|
+
type: z32.literal("and"),
|
|
3945
|
+
clauses: z32.array(SerializedQueryExpression)
|
|
3946
|
+
});
|
|
3947
|
+
var CountryConfigQueryType = z32.discriminatedUnion("type", [And2, Or2]);
|
|
3948
|
+
var CountryConfigQueryInputType = z32.union([
|
|
3949
|
+
SerializedQueryExpression,
|
|
3950
|
+
And2,
|
|
3951
|
+
Or2
|
|
3623
3952
|
]);
|
|
3624
3953
|
|
|
3625
3954
|
// ../commons/src/events/WorkqueueConfig.ts
|
|
@@ -3641,23 +3970,17 @@ var mandatoryColumns = defineWorkqueuesColumns([
|
|
|
3641
3970
|
value: event.field("updatedAt")
|
|
3642
3971
|
}
|
|
3643
3972
|
]);
|
|
3644
|
-
var
|
|
3645
|
-
|
|
3646
|
-
"
|
|
3647
|
-
]);
|
|
3648
|
-
var WorkqueueConfig = import_zod31.z.object({
|
|
3649
|
-
slug: import_zod31.z.string().describe("Determines the url of the workqueue."),
|
|
3973
|
+
var CtaActionType = z33.enum([...workqueueActions.options, ActionType.READ]);
|
|
3974
|
+
var WorkqueueConfig = z33.object({
|
|
3975
|
+
slug: z33.string().describe("Determines the url of the workqueue."),
|
|
3650
3976
|
name: TranslationConfig.describe(
|
|
3651
3977
|
"Title of the workflow (both in navigation and on the page)"
|
|
3652
3978
|
),
|
|
3653
3979
|
query: CountryConfigQueryType,
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
})
|
|
3659
|
-
),
|
|
3660
|
-
columns: import_zod31.z.array(WorkqueueColumn).default(mandatoryColumns),
|
|
3980
|
+
/** This action object used to contain a conditionals option, but it was not used anywhere.
|
|
3981
|
+
* It's also debatable whether it should be an array, or just a single action. */
|
|
3982
|
+
actions: z33.array(z33.object({ type: CtaActionType })).describe("Workqueue call-to-action button configuration."),
|
|
3983
|
+
columns: z33.array(WorkqueueColumn).default(mandatoryColumns),
|
|
3661
3984
|
icon: AvailableIcons,
|
|
3662
3985
|
emptyMessage: TranslationConfig.optional()
|
|
3663
3986
|
}).describe("Configuration for workqueue.");
|
|
@@ -3665,26 +3988,21 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
|
|
|
3665
3988
|
query: true,
|
|
3666
3989
|
columns: true
|
|
3667
3990
|
});
|
|
3668
|
-
var WorkqueueConfigInput =
|
|
3669
|
-
slug:
|
|
3991
|
+
var WorkqueueConfigInput = z33.object({
|
|
3992
|
+
slug: z33.string().describe("Determines the url of the workqueue."),
|
|
3670
3993
|
name: TranslationConfig.describe(
|
|
3671
3994
|
"Title of the workflow (both in navigation and on the page)"
|
|
3672
3995
|
),
|
|
3673
3996
|
query: CountryConfigQueryInputType,
|
|
3674
|
-
actions:
|
|
3675
|
-
|
|
3676
|
-
type: WorkqueueActionsWithDefault,
|
|
3677
|
-
conditionals: import_zod31.z.array(Conditional).optional()
|
|
3678
|
-
})
|
|
3679
|
-
),
|
|
3680
|
-
columns: import_zod31.z.array(WorkqueueColumn).default(mandatoryColumns),
|
|
3997
|
+
actions: z33.array(z33.object({ type: CtaActionType })).describe("Workqueue call-to-action button configuration."),
|
|
3998
|
+
columns: z33.array(WorkqueueColumn).default(mandatoryColumns),
|
|
3681
3999
|
icon: AvailableIcons,
|
|
3682
4000
|
emptyMessage: TranslationConfig.optional()
|
|
3683
4001
|
});
|
|
3684
|
-
var WorkqueueCountInput =
|
|
3685
|
-
|
|
4002
|
+
var WorkqueueCountInput = z33.array(
|
|
4003
|
+
z33.object({ slug: z33.string(), query: QueryType })
|
|
3686
4004
|
);
|
|
3687
|
-
var WorkqueueCountOutput =
|
|
4005
|
+
var WorkqueueCountOutput = z33.record(z33.string(), z33.number());
|
|
3688
4006
|
|
|
3689
4007
|
// ../commons/src/events/workqueueDefaultColumns.ts
|
|
3690
4008
|
var defaultWorkqueueColumns = [
|
|
@@ -3707,47 +4025,48 @@ var defaultWorkqueueColumns = [
|
|
|
3707
4025
|
];
|
|
3708
4026
|
|
|
3709
4027
|
// ../commons/src/events/Draft.ts
|
|
3710
|
-
var
|
|
4028
|
+
var z35 = __toESM(require("zod/v4"));
|
|
3711
4029
|
|
|
3712
4030
|
// ../commons/src/events/ActionInput.ts
|
|
3713
|
-
var
|
|
3714
|
-
var
|
|
3715
|
-
(0, import_zod_openapi11.extendZodWithOpenApi)(import_zod32.z);
|
|
3716
|
-
var BaseActionInput = import_zod32.z.object({
|
|
4031
|
+
var z34 = __toESM(require("zod/v4"));
|
|
4032
|
+
var BaseActionInput = z34.object({
|
|
3717
4033
|
eventId: UUID,
|
|
3718
|
-
transactionId:
|
|
4034
|
+
transactionId: z34.string(),
|
|
3719
4035
|
declaration: ActionUpdate.default({}),
|
|
3720
4036
|
annotation: ActionUpdate.optional(),
|
|
3721
4037
|
originalActionId: UUID.optional(),
|
|
3722
4038
|
// should not be part of base action.
|
|
3723
|
-
keepAssignment:
|
|
4039
|
+
keepAssignment: z34.boolean().optional(),
|
|
3724
4040
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
3725
|
-
|
|
4041
|
+
// @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
|
|
4042
|
+
createdAtLocation: UUID.nullish().describe(
|
|
3726
4043
|
"A valid office location ID. This is required for system users performing actions. The provided location must be a leaf-location, i.e. it must not have any children locations."
|
|
3727
4044
|
)
|
|
3728
4045
|
});
|
|
3729
|
-
var CreateActionInput = BaseActionInput.
|
|
3730
|
-
|
|
3731
|
-
type:
|
|
3732
|
-
createdAtLocation
|
|
3733
|
-
|
|
4046
|
+
var CreateActionInput = BaseActionInput.extend(
|
|
4047
|
+
z34.object({
|
|
4048
|
+
type: z34.literal(ActionType.CREATE).default(ActionType.CREATE),
|
|
4049
|
+
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
4050
|
+
createdAtLocation: UUID.nullish().describe(
|
|
4051
|
+
"A valid office location ID. This is required for system users performing actions. The provided location must be a leaf-location, i.e. it must not have any children locations."
|
|
4052
|
+
)
|
|
4053
|
+
}).shape
|
|
3734
4054
|
);
|
|
3735
|
-
var RegisterActionInput = BaseActionInput.
|
|
3736
|
-
|
|
3737
|
-
type:
|
|
3738
|
-
registrationNumber:
|
|
3739
|
-
})
|
|
3740
|
-
).strict();
|
|
3741
|
-
var ValidateActionInput = BaseActionInput.merge(
|
|
3742
|
-
import_zod32.z.object({
|
|
3743
|
-
type: import_zod32.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE)
|
|
3744
|
-
})
|
|
4055
|
+
var RegisterActionInput = BaseActionInput.extend(
|
|
4056
|
+
z34.strictObject({
|
|
4057
|
+
type: z34.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
|
4058
|
+
registrationNumber: z34.string().optional()
|
|
4059
|
+
}).shape
|
|
3745
4060
|
);
|
|
3746
|
-
var NotifyActionInput = BaseActionInput.
|
|
3747
|
-
|
|
3748
|
-
type:
|
|
3749
|
-
|
|
3750
|
-
).
|
|
4061
|
+
var NotifyActionInput = BaseActionInput.extend(
|
|
4062
|
+
z34.object({
|
|
4063
|
+
type: z34.literal(ActionType.NOTIFY).default(ActionType.NOTIFY),
|
|
4064
|
+
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
4065
|
+
createdAtLocation: UUID.nullish().describe(
|
|
4066
|
+
"A valid office location ID. This is required for system users performing actions. The provided location must be a leaf-location, i.e. it must not have any children locations."
|
|
4067
|
+
)
|
|
4068
|
+
}).shape
|
|
4069
|
+
).meta({
|
|
3751
4070
|
default: {
|
|
3752
4071
|
eventId: "<event-id-here>",
|
|
3753
4072
|
transactionId: getUUID(),
|
|
@@ -3756,135 +4075,150 @@ var NotifyActionInput = BaseActionInput.merge(
|
|
|
3756
4075
|
type: ActionType.NOTIFY
|
|
3757
4076
|
}
|
|
3758
4077
|
});
|
|
3759
|
-
var DeclareActionInput = BaseActionInput.
|
|
3760
|
-
|
|
3761
|
-
type:
|
|
3762
|
-
})
|
|
4078
|
+
var DeclareActionInput = BaseActionInput.extend(
|
|
4079
|
+
z34.object({
|
|
4080
|
+
type: z34.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
|
4081
|
+
}).shape
|
|
4082
|
+
);
|
|
4083
|
+
var EditActionInput = BaseActionInput.extend(
|
|
4084
|
+
z34.object({
|
|
4085
|
+
type: z34.literal(ActionType.EDIT).default(ActionType.EDIT),
|
|
4086
|
+
content: z34.object({
|
|
4087
|
+
comment: z34.string().describe("Comment for the edit action.").optional()
|
|
4088
|
+
})
|
|
4089
|
+
}).shape
|
|
3763
4090
|
);
|
|
3764
|
-
var PrintCertificateActionInput = BaseActionInput.
|
|
3765
|
-
|
|
3766
|
-
type:
|
|
4091
|
+
var PrintCertificateActionInput = BaseActionInput.extend(
|
|
4092
|
+
z34.object({
|
|
4093
|
+
type: z34.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
|
|
3767
4094
|
content: PrintContent.optional()
|
|
3768
|
-
})
|
|
4095
|
+
}).shape
|
|
3769
4096
|
);
|
|
3770
|
-
var RejectDeclarationActionInput = BaseActionInput.
|
|
3771
|
-
|
|
3772
|
-
type:
|
|
4097
|
+
var RejectDeclarationActionInput = BaseActionInput.extend(
|
|
4098
|
+
z34.object({
|
|
4099
|
+
type: z34.literal(ActionType.REJECT).default(ActionType.REJECT),
|
|
3773
4100
|
content: ReasonContent
|
|
3774
|
-
})
|
|
4101
|
+
}).shape
|
|
3775
4102
|
);
|
|
3776
|
-
var DuplicateDetectedActionInput = BaseActionInput.
|
|
3777
|
-
|
|
3778
|
-
type:
|
|
3779
|
-
content:
|
|
3780
|
-
duplicates:
|
|
4103
|
+
var DuplicateDetectedActionInput = BaseActionInput.extend(
|
|
4104
|
+
z34.object({
|
|
4105
|
+
type: z34.literal(ActionType.DUPLICATE_DETECTED).default(ActionType.DUPLICATE_DETECTED),
|
|
4106
|
+
content: z34.object({
|
|
4107
|
+
duplicates: z34.array(PotentialDuplicate)
|
|
3781
4108
|
})
|
|
3782
|
-
})
|
|
4109
|
+
}).shape
|
|
3783
4110
|
);
|
|
3784
|
-
var MarkAsDuplicateActionInput = BaseActionInput.
|
|
3785
|
-
|
|
3786
|
-
type:
|
|
3787
|
-
content:
|
|
4111
|
+
var MarkAsDuplicateActionInput = BaseActionInput.extend(
|
|
4112
|
+
z34.object({
|
|
4113
|
+
type: z34.literal(ActionType.MARK_AS_DUPLICATE).default(ActionType.MARK_AS_DUPLICATE),
|
|
4114
|
+
content: z34.object({
|
|
3788
4115
|
duplicateOf: UUID
|
|
3789
4116
|
}).optional()
|
|
3790
|
-
})
|
|
4117
|
+
}).shape
|
|
3791
4118
|
);
|
|
3792
|
-
var MarkNotDuplicateActionInput = BaseActionInput.
|
|
3793
|
-
|
|
3794
|
-
type:
|
|
3795
|
-
})
|
|
4119
|
+
var MarkNotDuplicateActionInput = BaseActionInput.extend(
|
|
4120
|
+
z34.object({
|
|
4121
|
+
type: z34.literal(ActionType.MARK_AS_NOT_DUPLICATE).default(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
4122
|
+
}).shape
|
|
3796
4123
|
);
|
|
3797
|
-
var ArchiveActionInput = BaseActionInput.
|
|
3798
|
-
|
|
3799
|
-
type:
|
|
4124
|
+
var ArchiveActionInput = BaseActionInput.extend(
|
|
4125
|
+
z34.object({
|
|
4126
|
+
type: z34.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
|
|
3800
4127
|
content: ReasonContent
|
|
3801
|
-
})
|
|
4128
|
+
}).shape
|
|
3802
4129
|
);
|
|
3803
|
-
var AssignActionInput = BaseActionInput.
|
|
3804
|
-
|
|
3805
|
-
type:
|
|
3806
|
-
assignedTo:
|
|
3807
|
-
})
|
|
4130
|
+
var AssignActionInput = BaseActionInput.extend(
|
|
4131
|
+
z34.object({
|
|
4132
|
+
type: z34.literal(ActionType.ASSIGN),
|
|
4133
|
+
assignedTo: z34.string()
|
|
4134
|
+
}).shape
|
|
3808
4135
|
);
|
|
3809
|
-
var UnassignActionInput = BaseActionInput.
|
|
3810
|
-
|
|
3811
|
-
type:
|
|
3812
|
-
assignedTo:
|
|
3813
|
-
})
|
|
4136
|
+
var UnassignActionInput = BaseActionInput.extend(
|
|
4137
|
+
z34.object({
|
|
4138
|
+
type: z34.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
|
|
4139
|
+
assignedTo: z34.literal(null).default(null)
|
|
4140
|
+
}).shape
|
|
3814
4141
|
);
|
|
3815
|
-
var RequestCorrectionActionInput = BaseActionInput.
|
|
3816
|
-
|
|
3817
|
-
type:
|
|
3818
|
-
})
|
|
4142
|
+
var RequestCorrectionActionInput = BaseActionInput.extend(
|
|
4143
|
+
z34.object({
|
|
4144
|
+
type: z34.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
|
4145
|
+
}).shape
|
|
3819
4146
|
);
|
|
3820
|
-
var RejectCorrectionActionInput = BaseActionInput.
|
|
3821
|
-
|
|
3822
|
-
requestId:
|
|
3823
|
-
type:
|
|
4147
|
+
var RejectCorrectionActionInput = BaseActionInput.extend(
|
|
4148
|
+
z34.object({
|
|
4149
|
+
requestId: z34.string(),
|
|
4150
|
+
type: z34.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION),
|
|
3824
4151
|
content: ReasonContent
|
|
3825
|
-
})
|
|
4152
|
+
}).shape
|
|
3826
4153
|
);
|
|
3827
|
-
var ApproveCorrectionActionInput = BaseActionInput.
|
|
3828
|
-
|
|
3829
|
-
requestId:
|
|
3830
|
-
type:
|
|
3831
|
-
})
|
|
4154
|
+
var ApproveCorrectionActionInput = BaseActionInput.extend(
|
|
4155
|
+
z34.object({
|
|
4156
|
+
requestId: z34.string(),
|
|
4157
|
+
type: z34.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
|
4158
|
+
}).shape
|
|
3832
4159
|
);
|
|
3833
|
-
var ReadActionInput = BaseActionInput.
|
|
3834
|
-
|
|
3835
|
-
type:
|
|
3836
|
-
})
|
|
4160
|
+
var ReadActionInput = BaseActionInput.extend(
|
|
4161
|
+
z34.object({
|
|
4162
|
+
type: z34.literal(ActionType.READ).default(ActionType.READ)
|
|
4163
|
+
}).shape
|
|
4164
|
+
);
|
|
4165
|
+
var DeleteActionInput = z34.object({ eventId: UUID });
|
|
4166
|
+
var CustomActionInput = BaseActionInput.extend(
|
|
4167
|
+
z34.object({
|
|
4168
|
+
type: z34.literal(ActionType.CUSTOM).default(ActionType.CUSTOM),
|
|
4169
|
+
customActionType: z34.string().describe("Name of the custom action.")
|
|
4170
|
+
}).shape
|
|
3837
4171
|
);
|
|
3838
|
-
var
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
RejectDeclarationActionInput.openapi({
|
|
3846
|
-
ref: "RejectDeclarationActionInput"
|
|
4172
|
+
var ActionInput = z34.discriminatedUnion("type", [
|
|
4173
|
+
CreateActionInput.meta({ id: "CreateActionInput" }),
|
|
4174
|
+
RegisterActionInput.meta({ id: "RegisterActionInput" }),
|
|
4175
|
+
NotifyActionInput.meta({ id: "NotifyActionInput" }),
|
|
4176
|
+
DeclareActionInput.meta({ id: "DeclareActionInput" }),
|
|
4177
|
+
RejectDeclarationActionInput.meta({
|
|
4178
|
+
id: "RejectDeclarationActionInput"
|
|
3847
4179
|
}),
|
|
3848
|
-
DuplicateDetectedActionInput.
|
|
3849
|
-
|
|
4180
|
+
DuplicateDetectedActionInput.meta({
|
|
4181
|
+
id: "DuplicateDetectedActionInput"
|
|
3850
4182
|
}),
|
|
3851
|
-
MarkAsDuplicateActionInput.
|
|
3852
|
-
|
|
4183
|
+
MarkAsDuplicateActionInput.meta({
|
|
4184
|
+
id: "MarkAsDuplicateActionInput"
|
|
3853
4185
|
}),
|
|
3854
|
-
MarkNotDuplicateActionInput.
|
|
3855
|
-
|
|
4186
|
+
MarkNotDuplicateActionInput.meta({
|
|
4187
|
+
id: "MarkNotDuplicateActionInput"
|
|
3856
4188
|
}),
|
|
3857
|
-
ArchiveActionInput.
|
|
3858
|
-
AssignActionInput.
|
|
3859
|
-
UnassignActionInput.
|
|
3860
|
-
PrintCertificateActionInput.
|
|
3861
|
-
RequestCorrectionActionInput.
|
|
3862
|
-
|
|
4189
|
+
ArchiveActionInput.meta({ id: "ArchiveActionInput" }),
|
|
4190
|
+
AssignActionInput.meta({ id: "AssignActionInput" }),
|
|
4191
|
+
UnassignActionInput.meta({ id: "UnassignActionInput" }),
|
|
4192
|
+
PrintCertificateActionInput.meta({ id: "PrintCertificateActionInput" }),
|
|
4193
|
+
RequestCorrectionActionInput.meta({
|
|
4194
|
+
id: "RequestCorrectionActionInput"
|
|
3863
4195
|
}),
|
|
3864
|
-
RejectCorrectionActionInput.
|
|
3865
|
-
ApproveCorrectionActionInput.
|
|
3866
|
-
|
|
4196
|
+
RejectCorrectionActionInput.meta({ id: "RejectCorrectionActionInput" }),
|
|
4197
|
+
ApproveCorrectionActionInput.meta({
|
|
4198
|
+
id: "ApproveCorrectionActionInput"
|
|
3867
4199
|
}),
|
|
3868
|
-
ReadActionInput.
|
|
3869
|
-
|
|
3870
|
-
|
|
4200
|
+
ReadActionInput.meta({ id: "ReadActionInput" }),
|
|
4201
|
+
CustomActionInput.meta({ id: "CustomActionInput" }),
|
|
4202
|
+
EditActionInput.meta({ id: "EditActionInput" })
|
|
4203
|
+
]).meta({
|
|
4204
|
+
id: "ActionInput"
|
|
3871
4205
|
});
|
|
3872
4206
|
|
|
3873
4207
|
// ../commons/src/events/Draft.ts
|
|
3874
|
-
var Draft =
|
|
4208
|
+
var Draft = z35.object({
|
|
3875
4209
|
id: UUID,
|
|
3876
4210
|
eventId: UUID,
|
|
3877
|
-
transactionId:
|
|
3878
|
-
createdAt:
|
|
4211
|
+
transactionId: z35.string(),
|
|
4212
|
+
createdAt: z35.string().datetime(),
|
|
3879
4213
|
action: ActionBase.extend({
|
|
3880
|
-
type: ActionTypes.exclude([ActionTypes.
|
|
4214
|
+
type: ActionTypes.exclude([ActionTypes.enum.DELETE])
|
|
3881
4215
|
}).omit({ id: true, createdAtLocation: true })
|
|
3882
4216
|
}).describe(
|
|
3883
4217
|
"A temporary storage for an action. Stored with details of the event, creator and creation time."
|
|
3884
4218
|
);
|
|
3885
4219
|
var DraftInput = BaseActionInput.extend({
|
|
3886
|
-
type: ActionTypes.exclude([ActionTypes.
|
|
3887
|
-
status:
|
|
4220
|
+
type: ActionTypes.exclude([ActionTypes.enum.DELETE]),
|
|
4221
|
+
status: z35.enum([
|
|
3888
4222
|
ActionStatus.Requested,
|
|
3889
4223
|
ActionStatus.Accepted,
|
|
3890
4224
|
ActionStatus.Rejected
|
|
@@ -3892,32 +4226,33 @@ var DraftInput = BaseActionInput.extend({
|
|
|
3892
4226
|
});
|
|
3893
4227
|
|
|
3894
4228
|
// ../commons/src/events/EventInput.ts
|
|
3895
|
-
var
|
|
3896
|
-
var
|
|
3897
|
-
var EventInput =
|
|
3898
|
-
transactionId:
|
|
3899
|
-
type:
|
|
3900
|
-
|
|
4229
|
+
var z36 = __toESM(require("zod/v4"));
|
|
4230
|
+
var import_uuid9 = require("uuid");
|
|
4231
|
+
var EventInput = z36.object({
|
|
4232
|
+
transactionId: z36.string(),
|
|
4233
|
+
type: z36.string(),
|
|
4234
|
+
createdAtLocation: UUID.nullish().describe(
|
|
4235
|
+
"Location where the event occurred. Required for system users."
|
|
4236
|
+
)
|
|
4237
|
+
}).meta({ default: { transactionId: (0, import_uuid9.v4)(), type: "birth" } });
|
|
3901
4238
|
|
|
3902
4239
|
// ../commons/src/events/EventDocument.ts
|
|
3903
|
-
var
|
|
3904
|
-
var
|
|
3905
|
-
(0, import_zod_openapi12.extendZodWithOpenApi)(import_zod35.z);
|
|
3906
|
-
var EventDocument = import_zod35.z.object({
|
|
4240
|
+
var z37 = __toESM(require("zod/v4"));
|
|
4241
|
+
var EventDocument = z37.object({
|
|
3907
4242
|
id: UUID.describe("Unique identifier of the event."),
|
|
3908
|
-
type:
|
|
3909
|
-
createdAt:
|
|
3910
|
-
updatedAt:
|
|
4243
|
+
type: z37.string().describe("Type of the event (e.g. birth, death, marriage)."),
|
|
4244
|
+
createdAt: z37.string().datetime().describe("Timestamp indicating when the event was created."),
|
|
4245
|
+
updatedAt: z37.string().datetime().describe(
|
|
3911
4246
|
"Timestamp of the last update, excluding changes from actions."
|
|
3912
4247
|
),
|
|
3913
|
-
actions:
|
|
3914
|
-
trackingId:
|
|
4248
|
+
actions: z37.array(Action).describe("Ordered list of actions associated with the event."),
|
|
4249
|
+
trackingId: z37.string().describe(
|
|
3915
4250
|
"System-generated tracking identifier used to look up the event."
|
|
3916
4251
|
)
|
|
3917
|
-
}).
|
|
4252
|
+
}).meta({ id: "EventDocument" });
|
|
3918
4253
|
|
|
3919
4254
|
// ../commons/src/events/state/index.ts
|
|
3920
|
-
var
|
|
4255
|
+
var import_lodash4 = require("lodash");
|
|
3921
4256
|
|
|
3922
4257
|
// ../commons/src/events/state/utils.ts
|
|
3923
4258
|
var import_lodash2 = require("lodash");
|
|
@@ -3925,14 +4260,18 @@ var updateActions = ActionTypes.extract([
|
|
|
3925
4260
|
ActionType.CREATE,
|
|
3926
4261
|
ActionType.NOTIFY,
|
|
3927
4262
|
ActionType.DECLARE,
|
|
3928
|
-
ActionType.VALIDATE,
|
|
3929
4263
|
ActionType.REGISTER,
|
|
3930
4264
|
ActionType.REJECT,
|
|
3931
4265
|
ActionType.ARCHIVE,
|
|
3932
4266
|
ActionType.PRINT_CERTIFICATE,
|
|
3933
|
-
ActionType.REQUEST_CORRECTION
|
|
4267
|
+
ActionType.REQUEST_CORRECTION,
|
|
4268
|
+
ActionType.CUSTOM
|
|
3934
4269
|
]);
|
|
3935
4270
|
|
|
4271
|
+
// ../commons/src/events/state/flags.ts
|
|
4272
|
+
var import_lodash3 = require("lodash");
|
|
4273
|
+
var import_date_fns3 = require("date-fns");
|
|
4274
|
+
|
|
3936
4275
|
// ../commons/src/events/defineConfig.ts
|
|
3937
4276
|
var defineConfig = (config) => {
|
|
3938
4277
|
const input = EventConfig.parse(config);
|
|
@@ -3940,7 +4279,7 @@ var defineConfig = (config) => {
|
|
|
3940
4279
|
};
|
|
3941
4280
|
|
|
3942
4281
|
// ../commons/src/events/test.utils.ts
|
|
3943
|
-
var
|
|
4282
|
+
var import_lodash5 = require("lodash");
|
|
3944
4283
|
var import_date_fns4 = require("date-fns");
|
|
3945
4284
|
|
|
3946
4285
|
// ../commons/src/field-config/field-configuration.ts
|
|
@@ -3962,7 +4301,6 @@ function field(fieldId, options = {}) {
|
|
|
3962
4301
|
}
|
|
3963
4302
|
|
|
3964
4303
|
// ../commons/src/fixtures/forms.ts
|
|
3965
|
-
var import_date_fns3 = require("date-fns");
|
|
3966
4304
|
var PRINT_CERTIFICATE_FORM = defineActionForm({
|
|
3967
4305
|
label: {
|
|
3968
4306
|
id: "event.tennis-club-membership.action.certificate.form.label",
|
|
@@ -4762,7 +5100,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
|
|
4762
5100
|
conditionals: [
|
|
4763
5101
|
{
|
|
4764
5102
|
type: ConditionalType.DISPLAY_ON_REVIEW,
|
|
4765
|
-
conditional:
|
|
5103
|
+
conditional: never2()
|
|
4766
5104
|
}
|
|
4767
5105
|
]
|
|
4768
5106
|
},
|
|
@@ -5145,119 +5483,16 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
|
|
5145
5483
|
}
|
|
5146
5484
|
}
|
|
5147
5485
|
],
|
|
5148
|
-
conditional: not(
|
|
5486
|
+
conditional: not(never2())
|
|
5149
5487
|
// Intentional always-true page conditional to exercise interactions between page-level and field-level conditionals in tests
|
|
5150
5488
|
}
|
|
5151
5489
|
]
|
|
5152
5490
|
});
|
|
5153
|
-
var statusOptions = [
|
|
5154
|
-
{
|
|
5155
|
-
value: "ALL",
|
|
5156
|
-
label: {
|
|
5157
|
-
defaultMessage: "Any status",
|
|
5158
|
-
description: "Option for form field: status of record",
|
|
5159
|
-
id: "advancedSearch.form.recordStatusAny"
|
|
5160
|
-
}
|
|
5161
|
-
},
|
|
5162
|
-
{
|
|
5163
|
-
value: EventStatus.enum.CREATED,
|
|
5164
|
-
label: {
|
|
5165
|
-
defaultMessage: "Draft",
|
|
5166
|
-
description: "Option for form field: status of record",
|
|
5167
|
-
id: "advancedSearch.form.recordStatusCreated"
|
|
5168
|
-
}
|
|
5169
|
-
},
|
|
5170
|
-
{
|
|
5171
|
-
value: EventStatus.enum.NOTIFIED,
|
|
5172
|
-
label: {
|
|
5173
|
-
defaultMessage: "Notified",
|
|
5174
|
-
description: "Option for form field: status of record",
|
|
5175
|
-
id: "advancedSearch.form.recordStatusNotified"
|
|
5176
|
-
}
|
|
5177
|
-
},
|
|
5178
|
-
{
|
|
5179
|
-
value: EventStatus.enum.DECLARED,
|
|
5180
|
-
label: {
|
|
5181
|
-
defaultMessage: "Declared",
|
|
5182
|
-
description: "Option for form field: status of record",
|
|
5183
|
-
id: "advancedSearch.form.recordStatusDeclared"
|
|
5184
|
-
}
|
|
5185
|
-
},
|
|
5186
|
-
{
|
|
5187
|
-
value: EventStatus.enum.VALIDATED,
|
|
5188
|
-
label: {
|
|
5189
|
-
defaultMessage: "Validated",
|
|
5190
|
-
description: "Option for form field: status of record",
|
|
5191
|
-
id: "advancedSearch.form.recordStatusValidated"
|
|
5192
|
-
}
|
|
5193
|
-
},
|
|
5194
|
-
{
|
|
5195
|
-
value: EventStatus.enum.REGISTERED,
|
|
5196
|
-
label: {
|
|
5197
|
-
defaultMessage: "Registered",
|
|
5198
|
-
description: "Option for form field: status of record",
|
|
5199
|
-
id: "advancedSearch.form.recordStatusRegistered"
|
|
5200
|
-
}
|
|
5201
|
-
},
|
|
5202
|
-
{
|
|
5203
|
-
value: EventStatus.enum.ARCHIVED,
|
|
5204
|
-
label: {
|
|
5205
|
-
defaultMessage: "Archived",
|
|
5206
|
-
description: "Option for form field: status of record",
|
|
5207
|
-
id: "advancedSearch.form.recordStatusArchived"
|
|
5208
|
-
}
|
|
5209
|
-
}
|
|
5210
|
-
];
|
|
5211
|
-
var timePeriodOptions = [
|
|
5212
|
-
{
|
|
5213
|
-
label: {
|
|
5214
|
-
defaultMessage: "Last 7 days",
|
|
5215
|
-
description: "Label for option of time period select: last 7 days",
|
|
5216
|
-
id: "form.section.label.timePeriodLast7Days"
|
|
5217
|
-
},
|
|
5218
|
-
value: `${(0, import_date_fns3.format)((0, import_date_fns3.subDays)(/* @__PURE__ */ new Date(), 7), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
|
|
5219
|
-
/* @__PURE__ */ new Date(),
|
|
5220
|
-
"yyyy-MM-dd"
|
|
5221
|
-
)}`
|
|
5222
|
-
},
|
|
5223
|
-
{
|
|
5224
|
-
label: {
|
|
5225
|
-
defaultMessage: "Last 30 days",
|
|
5226
|
-
description: "Label for option of time period select: last 30 days",
|
|
5227
|
-
id: "form.section.label.timePeriodLast30Days"
|
|
5228
|
-
},
|
|
5229
|
-
value: `${(0, import_date_fns3.format)((0, import_date_fns3.subMonths)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
|
|
5230
|
-
/* @__PURE__ */ new Date(),
|
|
5231
|
-
"yyyy-MM-dd"
|
|
5232
|
-
)}`
|
|
5233
|
-
},
|
|
5234
|
-
{
|
|
5235
|
-
label: {
|
|
5236
|
-
defaultMessage: "Last 90 days",
|
|
5237
|
-
description: "Label for option of time period select: last 90 days",
|
|
5238
|
-
id: "form.section.label.timePeriodLast90Days"
|
|
5239
|
-
},
|
|
5240
|
-
value: `${(0, import_date_fns3.format)((0, import_date_fns3.subQuarters)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
|
|
5241
|
-
/* @__PURE__ */ new Date(),
|
|
5242
|
-
"yyyy-MM-dd"
|
|
5243
|
-
)}`
|
|
5244
|
-
},
|
|
5245
|
-
{
|
|
5246
|
-
label: {
|
|
5247
|
-
defaultMessage: "Last year",
|
|
5248
|
-
description: "Label for option of time period select: last year",
|
|
5249
|
-
id: "form.section.label.timePeriodLastYear"
|
|
5250
|
-
},
|
|
5251
|
-
value: `${(0, import_date_fns3.format)((0, import_date_fns3.subYears)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
|
|
5252
|
-
/* @__PURE__ */ new Date(),
|
|
5253
|
-
"yyyy-MM-dd"
|
|
5254
|
-
)}`
|
|
5255
|
-
}
|
|
5256
|
-
];
|
|
5257
5491
|
|
|
5258
5492
|
// ../commons/src/fixtures/tennis-club-membership-event.ts
|
|
5259
5493
|
var tennisClubMembershipEvent = defineConfig({
|
|
5260
5494
|
id: TENNIS_CLUB_MEMBERSHIP,
|
|
5495
|
+
declaration: TENNIS_CLUB_DECLARATION_FORM,
|
|
5261
5496
|
label: {
|
|
5262
5497
|
defaultMessage: "Tennis club membership application",
|
|
5263
5498
|
description: "This is what this event is referred as in the system",
|
|
@@ -5308,13 +5543,12 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
5308
5543
|
review: TENNIS_CLUB_DECLARATION_REVIEW
|
|
5309
5544
|
},
|
|
5310
5545
|
{
|
|
5311
|
-
type: ActionType.
|
|
5546
|
+
type: ActionType.REJECT,
|
|
5312
5547
|
label: {
|
|
5313
|
-
defaultMessage: "
|
|
5548
|
+
defaultMessage: "Reject",
|
|
5314
5549
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
|
5315
|
-
id: "event.tennis-club-membership.action.
|
|
5316
|
-
}
|
|
5317
|
-
review: TENNIS_CLUB_DECLARATION_REVIEW
|
|
5550
|
+
id: "event.tennis-club-membership.action.reject.label"
|
|
5551
|
+
}
|
|
5318
5552
|
},
|
|
5319
5553
|
{
|
|
5320
5554
|
type: ActionType.REGISTER,
|
|
@@ -5322,8 +5556,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
5322
5556
|
defaultMessage: "Register",
|
|
5323
5557
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
|
5324
5558
|
id: "event.tennis-club-membership.action.register.label"
|
|
5325
|
-
}
|
|
5326
|
-
review: TENNIS_CLUB_DECLARATION_REVIEW
|
|
5559
|
+
}
|
|
5327
5560
|
},
|
|
5328
5561
|
{
|
|
5329
5562
|
type: ActionType.REQUEST_CORRECTION,
|
|
@@ -5526,14 +5759,6 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
5526
5759
|
]
|
|
5527
5760
|
}
|
|
5528
5761
|
},
|
|
5529
|
-
{
|
|
5530
|
-
type: ActionType.APPROVE_CORRECTION,
|
|
5531
|
-
label: {
|
|
5532
|
-
defaultMessage: "Approve correction",
|
|
5533
|
-
description: "This is shown as the action name anywhere the user can trigger the action from",
|
|
5534
|
-
id: "event.tennis-club-membership.action.correction.approve.label"
|
|
5535
|
-
}
|
|
5536
|
-
},
|
|
5537
5762
|
{
|
|
5538
5763
|
type: ActionType.PRINT_CERTIFICATE,
|
|
5539
5764
|
label: {
|
|
@@ -5542,22 +5767,6 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
5542
5767
|
description: "This is shown as the action name anywhere the user can trigger the action from"
|
|
5543
5768
|
},
|
|
5544
5769
|
printForm: PRINT_CERTIFICATE_FORM
|
|
5545
|
-
},
|
|
5546
|
-
{
|
|
5547
|
-
type: ActionType.ARCHIVE,
|
|
5548
|
-
label: {
|
|
5549
|
-
id: "event.tennis-club-membership.action.archive.label",
|
|
5550
|
-
defaultMessage: "Archive",
|
|
5551
|
-
description: "This is shown as the action name anywhere the user can trigger the action from"
|
|
5552
|
-
}
|
|
5553
|
-
},
|
|
5554
|
-
{
|
|
5555
|
-
type: ActionType.REJECT,
|
|
5556
|
-
label: {
|
|
5557
|
-
id: "event.tennis-club-membership.action.reject.label",
|
|
5558
|
-
defaultMessage: "Reject",
|
|
5559
|
-
description: "This is shown as the action name anywhere the user can trigger the action from"
|
|
5560
|
-
}
|
|
5561
5770
|
}
|
|
5562
5771
|
],
|
|
5563
5772
|
advancedSearch: [
|
|
@@ -5594,8 +5803,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
5594
5803
|
},
|
|
5595
5804
|
fields: [field("recommender.name").fuzzy()]
|
|
5596
5805
|
}
|
|
5597
|
-
]
|
|
5598
|
-
declaration: TENNIS_CLUB_DECLARATION_FORM
|
|
5806
|
+
]
|
|
5599
5807
|
});
|
|
5600
5808
|
|
|
5601
5809
|
// ../commons/src/fixtures/football-club-membership-event.ts
|
|
@@ -5663,23 +5871,13 @@ var footballClubMembershipEvent = defineConfig({
|
|
|
5663
5871
|
},
|
|
5664
5872
|
review: TENNIS_CLUB_DECLARATION_REVIEW
|
|
5665
5873
|
},
|
|
5666
|
-
{
|
|
5667
|
-
type: ActionType.VALIDATE,
|
|
5668
|
-
label: {
|
|
5669
|
-
defaultMessage: "Validate",
|
|
5670
|
-
description: "This is shown as the action name anywhere the user can trigger the action from",
|
|
5671
|
-
id: "event.football-club-membership.action.validate.label"
|
|
5672
|
-
},
|
|
5673
|
-
review: TENNIS_CLUB_DECLARATION_REVIEW
|
|
5674
|
-
},
|
|
5675
5874
|
{
|
|
5676
5875
|
type: ActionType.REGISTER,
|
|
5677
5876
|
label: {
|
|
5678
5877
|
defaultMessage: "Register",
|
|
5679
5878
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
|
5680
5879
|
id: "event.football-club-membership.action.register.label"
|
|
5681
|
-
}
|
|
5682
|
-
review: TENNIS_CLUB_DECLARATION_REVIEW
|
|
5880
|
+
}
|
|
5683
5881
|
},
|
|
5684
5882
|
{
|
|
5685
5883
|
type: ActionType.REQUEST_CORRECTION,
|
|
@@ -5885,14 +6083,6 @@ var footballClubMembershipEvent = defineConfig({
|
|
|
5885
6083
|
]
|
|
5886
6084
|
}
|
|
5887
6085
|
},
|
|
5888
|
-
{
|
|
5889
|
-
type: ActionType.APPROVE_CORRECTION,
|
|
5890
|
-
label: {
|
|
5891
|
-
defaultMessage: "Approve correction",
|
|
5892
|
-
description: "This is shown as the action name anywhere the user can trigger the action from",
|
|
5893
|
-
id: "event.football-club-membership.action.correction.approve.label"
|
|
5894
|
-
}
|
|
5895
|
-
},
|
|
5896
6086
|
{
|
|
5897
6087
|
type: ActionType.PRINT_CERTIFICATE,
|
|
5898
6088
|
label: {
|
|
@@ -5901,22 +6091,6 @@ var footballClubMembershipEvent = defineConfig({
|
|
|
5901
6091
|
description: "This is shown as the action name anywhere the user can trigger the action from"
|
|
5902
6092
|
},
|
|
5903
6093
|
printForm: PRINT_CERTIFICATE_FORM
|
|
5904
|
-
},
|
|
5905
|
-
{
|
|
5906
|
-
type: ActionType.ARCHIVE,
|
|
5907
|
-
label: {
|
|
5908
|
-
id: "event.football-club-membership.action.archive.label",
|
|
5909
|
-
defaultMessage: "Archive",
|
|
5910
|
-
description: "This is shown as the action name anywhere the user can trigger the action from"
|
|
5911
|
-
}
|
|
5912
|
-
},
|
|
5913
|
-
{
|
|
5914
|
-
type: ActionType.REJECT,
|
|
5915
|
-
label: {
|
|
5916
|
-
id: "event.football-club-membership.action.reject.label",
|
|
5917
|
-
defaultMessage: "Reject",
|
|
5918
|
-
description: "This is shown as the action name anywhere the user can trigger the action from"
|
|
5919
|
-
}
|
|
5920
6094
|
}
|
|
5921
6095
|
],
|
|
5922
6096
|
advancedSearch: [
|
|
@@ -6016,7 +6190,7 @@ var libraryMembershipEvent = defineConfig({
|
|
|
6016
6190
|
declaration: libraryMembershipForm
|
|
6017
6191
|
});
|
|
6018
6192
|
|
|
6019
|
-
// ../commons/src/fixtures/
|
|
6193
|
+
// ../commons/src/fixtures/child-onboarding-event.ts
|
|
6020
6194
|
function generateTranslationConfig(message) {
|
|
6021
6195
|
return {
|
|
6022
6196
|
defaultMessage: message,
|
|
@@ -6045,6 +6219,61 @@ var child = defineFormPage({
|
|
|
6045
6219
|
secured: true,
|
|
6046
6220
|
validation: [],
|
|
6047
6221
|
label: generateTranslationConfig("Date of birth")
|
|
6222
|
+
},
|
|
6223
|
+
{
|
|
6224
|
+
id: "child.placeOfBirth",
|
|
6225
|
+
analytics: true,
|
|
6226
|
+
type: FieldType.SELECT,
|
|
6227
|
+
required: true,
|
|
6228
|
+
secured: true,
|
|
6229
|
+
label: {
|
|
6230
|
+
defaultMessage: "Place of delivery",
|
|
6231
|
+
description: "This is the label for the field",
|
|
6232
|
+
id: "event.birth.action.declare.form.section.child.field.placeOfBirth.label"
|
|
6233
|
+
},
|
|
6234
|
+
options: [
|
|
6235
|
+
{
|
|
6236
|
+
value: "child.placeOfBirth-SELECT-2",
|
|
6237
|
+
label: generateTranslationConfig("Health Institution")
|
|
6238
|
+
},
|
|
6239
|
+
{
|
|
6240
|
+
value: "PRIVATE_HOME",
|
|
6241
|
+
label: generateTranslationConfig("Residential address")
|
|
6242
|
+
}
|
|
6243
|
+
]
|
|
6244
|
+
},
|
|
6245
|
+
{
|
|
6246
|
+
id: "child.birthLocation",
|
|
6247
|
+
analytics: true,
|
|
6248
|
+
type: "FACILITY",
|
|
6249
|
+
required: true,
|
|
6250
|
+
secured: true,
|
|
6251
|
+
label: generateTranslationConfig("Health Institution"),
|
|
6252
|
+
conditionals: [
|
|
6253
|
+
{
|
|
6254
|
+
type: "SHOW",
|
|
6255
|
+
conditional: field("child.placeOfBirth").isEqualTo(
|
|
6256
|
+
"child.placeOfBirth-SELECT-2"
|
|
6257
|
+
)
|
|
6258
|
+
}
|
|
6259
|
+
]
|
|
6260
|
+
},
|
|
6261
|
+
{
|
|
6262
|
+
id: "child.birthLocation.privateHome",
|
|
6263
|
+
analytics: true,
|
|
6264
|
+
type: FieldType.ADDRESS,
|
|
6265
|
+
secured: true,
|
|
6266
|
+
hideLabel: true,
|
|
6267
|
+
label: generateTranslationConfig("Child's address"),
|
|
6268
|
+
conditionals: [
|
|
6269
|
+
{
|
|
6270
|
+
type: "SHOW",
|
|
6271
|
+
conditional: field("child.placeOfBirth").isEqualTo("PRIVATE_HOME")
|
|
6272
|
+
}
|
|
6273
|
+
],
|
|
6274
|
+
configuration: {
|
|
6275
|
+
streetAddressForm: []
|
|
6276
|
+
}
|
|
6048
6277
|
}
|
|
6049
6278
|
]
|
|
6050
6279
|
});
|
|
@@ -6148,7 +6377,7 @@ var mother = defineFormPage({
|
|
|
6148
6377
|
}
|
|
6149
6378
|
]
|
|
6150
6379
|
});
|
|
6151
|
-
var
|
|
6380
|
+
var CHILD_ONBOARDING_DECLARATION_REVIEW = {
|
|
6152
6381
|
title: generateTranslationConfig(
|
|
6153
6382
|
"{child.name.firstname, select, __EMPTY__ {Birth declaration} other {{child.name.surname, select, __EMPTY__ {Birth declaration for {child.name.firstname}} other {Birth declaration for {child.name.firstname} {child.name.surname}}}}}"
|
|
6154
6383
|
),
|
|
@@ -6168,12 +6397,12 @@ var BIRTH_DECLARATION_REVIEW = {
|
|
|
6168
6397
|
}
|
|
6169
6398
|
]
|
|
6170
6399
|
};
|
|
6171
|
-
var
|
|
6400
|
+
var CHILD_ONBOARDING_DECLARATION_FORM = defineDeclarationForm({
|
|
6172
6401
|
label: generateTranslationConfig("Birth decalration form"),
|
|
6173
6402
|
pages: [child, mother]
|
|
6174
6403
|
});
|
|
6175
|
-
var
|
|
6176
|
-
id:
|
|
6404
|
+
var ChildOnboardingEvent = defineConfig({
|
|
6405
|
+
id: CHILD_ONBOARDING_EVENT,
|
|
6177
6406
|
title: generateTranslationConfig(
|
|
6178
6407
|
"{child.name.firstname} {child.name.surname}"
|
|
6179
6408
|
),
|
|
@@ -6181,27 +6410,21 @@ var v2BirthEvent = defineConfig({
|
|
|
6181
6410
|
summary: {
|
|
6182
6411
|
fields: []
|
|
6183
6412
|
},
|
|
6184
|
-
declaration:
|
|
6413
|
+
declaration: CHILD_ONBOARDING_DECLARATION_FORM,
|
|
6185
6414
|
actions: [
|
|
6186
6415
|
{
|
|
6187
6416
|
type: ActionType.READ,
|
|
6188
6417
|
label: generateTranslationConfig("Read"),
|
|
6189
|
-
review:
|
|
6418
|
+
review: CHILD_ONBOARDING_DECLARATION_REVIEW
|
|
6190
6419
|
},
|
|
6191
6420
|
{
|
|
6192
6421
|
type: ActionType.DECLARE,
|
|
6193
6422
|
label: generateTranslationConfig("Declare"),
|
|
6194
|
-
review:
|
|
6195
|
-
},
|
|
6196
|
-
{
|
|
6197
|
-
type: ActionType.VALIDATE,
|
|
6198
|
-
label: generateTranslationConfig("Validate"),
|
|
6199
|
-
review: BIRTH_DECLARATION_REVIEW
|
|
6423
|
+
review: CHILD_ONBOARDING_DECLARATION_REVIEW
|
|
6200
6424
|
},
|
|
6201
6425
|
{
|
|
6202
6426
|
type: ActionType.REGISTER,
|
|
6203
|
-
label: generateTranslationConfig("Register")
|
|
6204
|
-
review: BIRTH_DECLARATION_REVIEW
|
|
6427
|
+
label: generateTranslationConfig("Register")
|
|
6205
6428
|
}
|
|
6206
6429
|
],
|
|
6207
6430
|
advancedSearch: []
|
|
@@ -6289,7 +6512,7 @@ var PRINT_DIGITAL_ID_CERTIFICATE_FORM = defineActionForm({
|
|
|
6289
6512
|
conditionals: [
|
|
6290
6513
|
{
|
|
6291
6514
|
type: ConditionalType.ENABLE,
|
|
6292
|
-
conditional:
|
|
6515
|
+
conditional: never2()
|
|
6293
6516
|
},
|
|
6294
6517
|
{
|
|
6295
6518
|
type: ConditionalType.SHOW,
|
|
@@ -6316,7 +6539,7 @@ var PRINT_DIGITAL_ID_CERTIFICATE_FORM = defineActionForm({
|
|
|
6316
6539
|
conditionals: [
|
|
6317
6540
|
{
|
|
6318
6541
|
type: ConditionalType.ENABLE,
|
|
6319
|
-
conditional:
|
|
6542
|
+
conditional: never2()
|
|
6320
6543
|
},
|
|
6321
6544
|
{
|
|
6322
6545
|
type: ConditionalType.SHOW,
|
|
@@ -6344,7 +6567,7 @@ var PRINT_DIGITAL_ID_CERTIFICATE_FORM = defineActionForm({
|
|
|
6344
6567
|
conditionals: [
|
|
6345
6568
|
{
|
|
6346
6569
|
type: ConditionalType.ENABLE,
|
|
6347
|
-
conditional:
|
|
6570
|
+
conditional: never2()
|
|
6348
6571
|
}
|
|
6349
6572
|
],
|
|
6350
6573
|
value: field("identity.http-fetch").get("data.certificateId")
|
|
@@ -6422,8 +6645,8 @@ var digitalIdentityEvent = defineConfig({
|
|
|
6422
6645
|
});
|
|
6423
6646
|
|
|
6424
6647
|
// ../commons/src/events/test.utils.ts
|
|
6425
|
-
var
|
|
6426
|
-
var TestUserRole =
|
|
6648
|
+
var z38 = __toESM(require("zod/v4"));
|
|
6649
|
+
var TestUserRole = z38.enum([
|
|
6427
6650
|
"FIELD_AGENT",
|
|
6428
6651
|
"LOCAL_REGISTRAR",
|
|
6429
6652
|
"LOCAL_SYSTEM_ADMIN",
|
|
@@ -6434,18 +6657,14 @@ var TestUserRole = import_zod36.z.enum([
|
|
|
6434
6657
|
]);
|
|
6435
6658
|
|
|
6436
6659
|
// ../commons/src/events/scopes.ts
|
|
6437
|
-
var
|
|
6660
|
+
var import_lodash6 = require("lodash");
|
|
6438
6661
|
var ACTION_SCOPE_MAP = {
|
|
6439
6662
|
[ActionType.READ]: ["record.read"],
|
|
6440
6663
|
[ActionType.CREATE]: ["record.create"],
|
|
6441
6664
|
[ActionType.NOTIFY]: ["record.notify"],
|
|
6442
|
-
[ActionType.DECLARE]: [
|
|
6443
|
-
|
|
6444
|
-
"record.declared.validate",
|
|
6445
|
-
"record.register"
|
|
6446
|
-
],
|
|
6665
|
+
[ActionType.DECLARE]: ["record.declare", "record.register"],
|
|
6666
|
+
[ActionType.EDIT]: ["record.declared.edit"],
|
|
6447
6667
|
[ActionType.DELETE]: ["record.declare"],
|
|
6448
|
-
[ActionType.VALIDATE]: ["record.declared.validate", "record.register"],
|
|
6449
6668
|
[ActionType.REGISTER]: ["record.register"],
|
|
6450
6669
|
[ActionType.PRINT_CERTIFICATE]: ["record.registered.print-certified-copies"],
|
|
6451
6670
|
[ActionType.REQUEST_CORRECTION]: [
|
|
@@ -6463,7 +6682,8 @@ var ACTION_SCOPE_MAP = {
|
|
|
6463
6682
|
[ActionType.REJECT]: ["record.declared.reject"],
|
|
6464
6683
|
[ActionType.ASSIGN]: null,
|
|
6465
6684
|
[ActionType.UNASSIGN]: null,
|
|
6466
|
-
[ActionType.DUPLICATE_DETECTED]: []
|
|
6685
|
+
[ActionType.DUPLICATE_DETECTED]: [],
|
|
6686
|
+
[ActionType.CUSTOM]: []
|
|
6467
6687
|
};
|
|
6468
6688
|
|
|
6469
6689
|
// ../commons/src/events/state/availableActions.ts
|
|
@@ -6472,28 +6692,25 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
|
6472
6692
|
ActionType.READ,
|
|
6473
6693
|
ActionType.DECLARE,
|
|
6474
6694
|
ActionType.NOTIFY,
|
|
6475
|
-
ActionType.DELETE
|
|
6695
|
+
ActionType.DELETE,
|
|
6696
|
+
ActionType.CUSTOM
|
|
6476
6697
|
],
|
|
6477
6698
|
[EventStatus.enum.NOTIFIED]: [
|
|
6478
6699
|
ActionType.READ,
|
|
6479
|
-
ActionType.
|
|
6700
|
+
ActionType.EDIT,
|
|
6480
6701
|
ActionType.MARK_AS_DUPLICATE,
|
|
6481
6702
|
ActionType.ARCHIVE,
|
|
6482
|
-
ActionType.REJECT
|
|
6703
|
+
ActionType.REJECT,
|
|
6704
|
+
ActionType.CUSTOM
|
|
6483
6705
|
],
|
|
6484
6706
|
[EventStatus.enum.DECLARED]: [
|
|
6485
|
-
ActionType.READ,
|
|
6486
|
-
ActionType.VALIDATE,
|
|
6487
|
-
ActionType.MARK_AS_DUPLICATE,
|
|
6488
|
-
ActionType.ARCHIVE,
|
|
6489
|
-
ActionType.REJECT
|
|
6490
|
-
],
|
|
6491
|
-
[EventStatus.enum.VALIDATED]: [
|
|
6492
6707
|
ActionType.READ,
|
|
6493
6708
|
ActionType.REGISTER,
|
|
6494
6709
|
ActionType.MARK_AS_DUPLICATE,
|
|
6495
6710
|
ActionType.ARCHIVE,
|
|
6496
|
-
ActionType.REJECT
|
|
6711
|
+
ActionType.REJECT,
|
|
6712
|
+
ActionType.CUSTOM,
|
|
6713
|
+
ActionType.EDIT
|
|
6497
6714
|
],
|
|
6498
6715
|
[EventStatus.enum.REGISTERED]: [
|
|
6499
6716
|
ActionType.READ,
|
|
@@ -6501,12 +6718,14 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
|
6501
6718
|
ActionType.REQUEST_CORRECTION,
|
|
6502
6719
|
ActionType.APPROVE_CORRECTION,
|
|
6503
6720
|
ActionType.REJECT_CORRECTION,
|
|
6721
|
+
ActionType.CUSTOM,
|
|
6504
6722
|
ClientSpecificAction.REVIEW_CORRECTION_REQUEST
|
|
6505
6723
|
],
|
|
6506
6724
|
[EventStatus.enum.ARCHIVED]: [
|
|
6507
6725
|
ActionType.READ,
|
|
6508
6726
|
ActionType.ASSIGN,
|
|
6509
|
-
ActionType.UNASSIGN
|
|
6727
|
+
ActionType.UNASSIGN,
|
|
6728
|
+
ActionType.CUSTOM
|
|
6510
6729
|
]
|
|
6511
6730
|
};
|
|
6512
6731
|
var ACTION_FILTERS = {
|
|
@@ -6516,32 +6735,41 @@ var ACTION_FILTERS = {
|
|
|
6516
6735
|
[ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
6517
6736
|
[ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
6518
6737
|
[ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
6519
|
-
[ActionType.
|
|
6738
|
+
[ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
6520
6739
|
[ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
6521
6740
|
[ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag) => flag.endsWith(":requested")),
|
|
6522
6741
|
[ActionType.ARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))
|
|
6523
6742
|
};
|
|
6524
6743
|
|
|
6525
6744
|
// ../commons/src/events/FileUtils.ts
|
|
6526
|
-
var
|
|
6745
|
+
var import_lodash7 = require("lodash");
|
|
6527
6746
|
|
|
6528
6747
|
// ../commons/src/events/locations.ts
|
|
6529
|
-
var
|
|
6530
|
-
var
|
|
6748
|
+
var z39 = __toESM(require("zod/v4"));
|
|
6749
|
+
var LocationTypeV1 = z39.enum([
|
|
6531
6750
|
"ADMIN_STRUCTURE",
|
|
6532
6751
|
"CRVS_OFFICE",
|
|
6533
6752
|
"HEALTH_FACILITY"
|
|
6534
6753
|
]);
|
|
6535
|
-
var
|
|
6754
|
+
var LocationType = z39.enum(["CRVS_OFFICE", "HEALTH_FACILITY"]);
|
|
6755
|
+
var AdministrativeArea = z39.object({
|
|
6536
6756
|
id: UUID,
|
|
6537
|
-
name:
|
|
6757
|
+
name: z39.string(),
|
|
6758
|
+
externalId: z39.string().nullish(),
|
|
6538
6759
|
parentId: UUID.nullable(),
|
|
6539
|
-
validUntil:
|
|
6540
|
-
|
|
6760
|
+
validUntil: z39.iso.datetime().nullable()
|
|
6761
|
+
});
|
|
6762
|
+
var Location = z39.object({
|
|
6763
|
+
id: UUID,
|
|
6764
|
+
name: z39.string(),
|
|
6765
|
+
externalId: z39.string().nullish(),
|
|
6766
|
+
administrativeAreaId: UUID.nullable(),
|
|
6767
|
+
validUntil: z39.iso.datetime().nullable(),
|
|
6768
|
+
locationType: z39.string().nullable()
|
|
6541
6769
|
});
|
|
6542
6770
|
|
|
6543
6771
|
// ../commons/src/notification/UserNotifications.ts
|
|
6544
|
-
var
|
|
6772
|
+
var z40 = __toESM(require("zod/v4"));
|
|
6545
6773
|
var TriggerEvent = {
|
|
6546
6774
|
USER_CREATED: "user-created",
|
|
6547
6775
|
USER_UPDATED: "user-updated",
|
|
@@ -6553,50 +6781,50 @@ var TriggerEvent = {
|
|
|
6553
6781
|
CHANGE_PHONE_NUMBER: "change-phone-number",
|
|
6554
6782
|
CHANGE_EMAIL_ADDRESS: "change-email-address"
|
|
6555
6783
|
};
|
|
6556
|
-
var Recipient =
|
|
6784
|
+
var Recipient = z40.object({
|
|
6557
6785
|
name: NameFieldValue.optional(),
|
|
6558
|
-
mobile:
|
|
6559
|
-
email:
|
|
6560
|
-
bcc:
|
|
6786
|
+
mobile: z40.string().optional(),
|
|
6787
|
+
email: z40.string().optional(),
|
|
6788
|
+
bcc: z40.array(z40.string()).optional()
|
|
6561
6789
|
});
|
|
6562
|
-
var BasePayload =
|
|
6790
|
+
var BasePayload = z40.object({
|
|
6563
6791
|
recipient: Recipient
|
|
6564
6792
|
});
|
|
6565
6793
|
var TriggerPayload = {
|
|
6566
6794
|
[TriggerEvent.USER_CREATED]: BasePayload.extend({
|
|
6567
|
-
username:
|
|
6568
|
-
temporaryPassword:
|
|
6795
|
+
username: z40.string(),
|
|
6796
|
+
temporaryPassword: z40.string()
|
|
6569
6797
|
}),
|
|
6570
6798
|
[TriggerEvent.USER_UPDATED]: BasePayload.extend({
|
|
6571
|
-
oldUsername:
|
|
6572
|
-
newUsername:
|
|
6799
|
+
oldUsername: z40.string(),
|
|
6800
|
+
newUsername: z40.string()
|
|
6573
6801
|
}),
|
|
6574
6802
|
[TriggerEvent.USERNAME_REMINDER]: BasePayload.extend({
|
|
6575
|
-
username:
|
|
6803
|
+
username: z40.string()
|
|
6576
6804
|
}),
|
|
6577
6805
|
[TriggerEvent.RESET_PASSWORD]: BasePayload.extend({
|
|
6578
|
-
code:
|
|
6806
|
+
code: z40.string()
|
|
6579
6807
|
}),
|
|
6580
6808
|
[TriggerEvent.RESET_PASSWORD_BY_ADMIN]: BasePayload.extend({
|
|
6581
|
-
temporaryPassword:
|
|
6582
|
-
admin:
|
|
6583
|
-
id:
|
|
6809
|
+
temporaryPassword: z40.string(),
|
|
6810
|
+
admin: z40.object({
|
|
6811
|
+
id: z40.string(),
|
|
6584
6812
|
name: NameFieldValue,
|
|
6585
|
-
role:
|
|
6813
|
+
role: z40.string()
|
|
6586
6814
|
})
|
|
6587
6815
|
}),
|
|
6588
6816
|
[TriggerEvent.TWO_FA]: BasePayload.extend({
|
|
6589
|
-
code:
|
|
6817
|
+
code: z40.string()
|
|
6590
6818
|
}),
|
|
6591
6819
|
[TriggerEvent.ALL_USER_NOTIFICATION]: BasePayload.extend({
|
|
6592
|
-
subject:
|
|
6593
|
-
body:
|
|
6820
|
+
subject: z40.string(),
|
|
6821
|
+
body: z40.string()
|
|
6594
6822
|
}),
|
|
6595
6823
|
[TriggerEvent.CHANGE_PHONE_NUMBER]: BasePayload.extend({
|
|
6596
|
-
code:
|
|
6824
|
+
code: z40.string()
|
|
6597
6825
|
}),
|
|
6598
6826
|
[TriggerEvent.CHANGE_EMAIL_ADDRESS]: BasePayload.extend({
|
|
6599
|
-
code:
|
|
6827
|
+
code: z40.string()
|
|
6600
6828
|
})
|
|
6601
6829
|
};
|
|
6602
6830
|
async function triggerUserEventNotification({
|
|
@@ -6618,3 +6846,6 @@ function parseUserEventTrigger(event2, body) {
|
|
|
6618
6846
|
const schema = TriggerPayload[event2];
|
|
6619
6847
|
return schema.parse(body);
|
|
6620
6848
|
}
|
|
6849
|
+
|
|
6850
|
+
// src/notification/index.ts
|
|
6851
|
+
z41.globalRegistry.clear();
|