@opencrvs/toolkit 1.9.13-rc.fc5374d → 2.0.0-rc.e0918cb
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/build.sh +13 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/application-config/index.d.ts +2 -0
- package/dist/application-config/index.d.ts.map +1 -0
- package/dist/application-config/index.js +2128 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +3633 -0
- package/dist/commons/api/router.d.ts +3438 -2300
- package/dist/commons/application-config/index.d.ts +84 -0
- package/dist/commons/conditionals/conditionals.d.ts +27 -3
- package/dist/commons/conditionals/validate.d.ts +13 -3
- package/dist/commons/events/ActionConfig.d.ts +415 -1555
- package/dist/commons/events/ActionDocument.d.ts +888 -1941
- package/dist/commons/events/ActionInput.d.ts +277 -1073
- package/dist/commons/events/ActionType.d.ts +91 -11
- package/dist/commons/events/AdvancedSearchConfig.d.ts +294 -1496
- package/dist/commons/events/AuditLog.d.ts +405 -0
- package/dist/commons/events/CompositeFieldValue.d.ts +30 -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 +1592 -4471
- package/dist/commons/events/DeduplicationConfig.d.ts +15 -171
- package/dist/commons/events/Draft.d.ts +72 -107
- package/dist/commons/events/DynamicFieldValue.d.ts +12 -78
- package/dist/commons/events/EventConfig.d.ts +37 -2420
- package/dist/commons/events/EventConfigInput.d.ts +0 -3
- package/dist/commons/events/EventDocument.d.ts +354 -1366
- package/dist/commons/events/EventIndex.d.ts +212 -1010
- package/dist/commons/events/EventInput.d.ts +3 -8
- package/dist/commons/events/EventMetadata.d.ts +130 -357
- package/dist/commons/events/FieldConfig.d.ts +2892 -12892
- package/dist/commons/events/FieldType.d.ts +26 -4
- package/dist/commons/events/FieldTypeMapping.d.ts +314 -906
- package/dist/commons/events/FieldValue.d.ts +149 -527
- package/dist/commons/events/FileUtils.d.ts +2 -2
- package/dist/commons/events/Flag.d.ts +67 -0
- package/dist/commons/events/FormConfig.d.ts +54 -721
- package/dist/commons/events/PageConfig.d.ts +58 -320
- package/dist/commons/events/PlainDate.d.ts +1 -1
- 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 +2208 -7553
- package/dist/commons/events/deduplication.d.ts +3 -3
- package/dist/commons/events/defineConfig.d.ts +2 -247
- package/dist/commons/events/eventConfigValidation.d.ts +8 -0
- package/dist/commons/events/index.d.ts +3 -0
- package/dist/commons/events/locations.d.ts +57 -20
- package/dist/commons/events/scopes.d.ts +36 -35
- package/dist/commons/events/state/availableActions.d.ts +7 -2
- package/dist/commons/events/state/flags.d.ts +21 -3
- package/dist/commons/events/state/index.d.ts +30 -27
- package/dist/commons/events/state/utils.d.ts +190 -172
- package/dist/commons/events/test.utils.d.ts +52 -11
- package/dist/commons/events/transactions.d.ts +1 -1
- package/dist/commons/events/utils.d.ts +373 -273
- package/dist/commons/notification/UserNotifications.d.ts +61 -637
- package/dist/conditionals/index.d.ts.map +1 -1
- package/dist/conditionals/index.js +302 -14
- package/dist/events/deduplication.d.ts +3 -3
- package/dist/events/index.js +2860 -2115
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts +3 -0
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -0
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +405 -0
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +3 -0
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -0
- package/dist/migrations/v2.0/checkout-upstream-files.js +143 -0
- package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts +2 -0
- package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +1 -0
- package/dist/migrations/v2.0/convert-config-files-to-ts.js +829 -0
- package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts +3 -0
- package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +1 -0
- package/dist/migrations/v2.0/convert-paragraph-to-heading.js +159 -0
- package/dist/migrations/v2.0/create-events-index.d.ts +3 -0
- package/dist/migrations/v2.0/create-events-index.d.ts.map +1 -0
- package/dist/migrations/v2.0/create-events-index.js +326 -0
- package/dist/migrations/v2.0/index.d.ts +7 -0
- package/dist/migrations/v2.0/index.d.ts.map +1 -0
- package/dist/migrations/v2.0/index.js +3572 -0
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts +3 -0
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -0
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +344 -0
- package/dist/migrations/v2.0/migrate-scopes.d.ts +3 -0
- package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -0
- package/dist/migrations/v2.0/migrate-scopes.js +282 -0
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts +3 -0
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +1 -0
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +268 -0
- package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts +3 -0
- package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -0
- package/dist/migrations/v2.0/migrate-workqueue-configs.js +237 -0
- package/dist/migrations/v2.0/remove-delete-actions.d.ts +3 -0
- package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-delete-actions.js +157 -0
- package/dist/migrations/v2.0/remove-demo-scope.d.ts +3 -0
- package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-demo-scope.js +75 -0
- package/dist/migrations/v2.0/remove-deprecated-imports.d.ts +3 -0
- package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-deprecated-imports.js +97 -0
- package/dist/migrations/v2.0/remove-hearth-migrations.d.ts +3 -0
- package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-hearth-migrations.js +78 -0
- package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts +3 -0
- package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-pending-certification-flag.js +110 -0
- package/dist/migrations/v2.0/remove-review-from-register-action.d.ts +3 -0
- package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-review-from-register-action.js +164 -0
- package/dist/migrations/v2.0/rename-api-paths.d.ts +3 -0
- package/dist/migrations/v2.0/rename-api-paths.d.ts.map +1 -0
- package/dist/migrations/v2.0/rename-api-paths.js +188 -0
- package/dist/migrations/v2.0/rename-location-parent-id.d.ts +3 -0
- package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +1 -0
- package/dist/migrations/v2.0/rename-location-parent-id.js +181 -0
- package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts +3 -0
- package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts.map +1 -0
- package/dist/migrations/v2.0/simplify-analytics-precalculations.js +196 -0
- package/dist/notification/index.d.ts.map +1 -1
- package/dist/notification/index.js +2076 -1767
- package/dist/scopes/index.d.ts +640 -353
- package/dist/scopes/index.d.ts.map +1 -1
- package/dist/scopes/index.js +340 -300
- package/opencrvs-toolkit-2.0.0-rc.e0918cb.tgz +0 -0
- package/package.json +18 -8
- package/tsconfig.json +12 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/commons/events/CreatedAtLocation.d.ts +0 -2
|
@@ -0,0 +1,2128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/application-config/index.ts
|
|
31
|
+
var application_config_exports = {};
|
|
32
|
+
__export(application_config_exports, {
|
|
33
|
+
ApplicationConfig: () => ApplicationConfig,
|
|
34
|
+
BackgroundConfig: () => BackgroundConfig,
|
|
35
|
+
ClientConfig: () => ClientConfig,
|
|
36
|
+
LoginConfig: () => LoginConfig,
|
|
37
|
+
SearchCriteria: () => SearchCriteria,
|
|
38
|
+
defineApplicationConfig: () => defineApplicationConfig,
|
|
39
|
+
defineClientConfig: () => defineClientConfig,
|
|
40
|
+
defineLoginConfig: () => defineLoginConfig
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(application_config_exports);
|
|
43
|
+
|
|
44
|
+
// ../commons/src/application-config.ts
|
|
45
|
+
var z20 = __toESM(require("zod/v4"));
|
|
46
|
+
|
|
47
|
+
// ../commons/src/events/FieldConfig.ts
|
|
48
|
+
var import_v43 = __toESM(require("zod/v4"));
|
|
49
|
+
|
|
50
|
+
// ../commons/src/events/Conditional.ts
|
|
51
|
+
var z = __toESM(require("zod/v4"));
|
|
52
|
+
var Conditional = z.any().describe("JSONSchema").meta({
|
|
53
|
+
description: "JSON schema conditional configuration",
|
|
54
|
+
id: "Conditional"
|
|
55
|
+
});
|
|
56
|
+
var ConditionalType = {
|
|
57
|
+
SHOW: "SHOW",
|
|
58
|
+
ENABLE: "ENABLE",
|
|
59
|
+
DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
|
|
60
|
+
};
|
|
61
|
+
var ShowConditional = z.object({
|
|
62
|
+
type: z.literal(ConditionalType.SHOW),
|
|
63
|
+
conditional: Conditional
|
|
64
|
+
}).describe(
|
|
65
|
+
"If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
|
|
66
|
+
);
|
|
67
|
+
var EnableConditional = z.object({
|
|
68
|
+
type: z.literal(ConditionalType.ENABLE),
|
|
69
|
+
conditional: Conditional
|
|
70
|
+
}).describe(
|
|
71
|
+
"If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
|
|
72
|
+
);
|
|
73
|
+
var ActionConditional = z.discriminatedUnion("type", [
|
|
74
|
+
// Action can be shown / hidden
|
|
75
|
+
ShowConditional,
|
|
76
|
+
// Action can be shown to the user in the list but as disabled
|
|
77
|
+
EnableConditional
|
|
78
|
+
]);
|
|
79
|
+
var DisplayOnReviewConditional = z.object({
|
|
80
|
+
type: z.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
81
|
+
conditional: Conditional
|
|
82
|
+
}).describe(
|
|
83
|
+
"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."
|
|
84
|
+
);
|
|
85
|
+
var FieldConditional = z.discriminatedUnion("type", [
|
|
86
|
+
// Field input can be shown / hidden
|
|
87
|
+
ShowConditional,
|
|
88
|
+
// Field input can be shown to the user but as disabled
|
|
89
|
+
EnableConditional,
|
|
90
|
+
// Field output can be shown / hidden on the review page
|
|
91
|
+
DisplayOnReviewConditional
|
|
92
|
+
]).meta({
|
|
93
|
+
description: "Field conditional configuration",
|
|
94
|
+
id: "FieldConditional"
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// ../commons/src/events/TranslationConfig.ts
|
|
98
|
+
var z2 = __toESM(require("zod/v4"));
|
|
99
|
+
var TranslationConfig = z2.object({
|
|
100
|
+
id: z2.string().describe(
|
|
101
|
+
"The identifier of the translation referred in translation CSV files"
|
|
102
|
+
),
|
|
103
|
+
defaultMessage: z2.string().describe("Default translation message"),
|
|
104
|
+
description: z2.string().describe(
|
|
105
|
+
"Describe the translation for a translator to be able to identify it."
|
|
106
|
+
)
|
|
107
|
+
}).meta({
|
|
108
|
+
description: "Translation configuration",
|
|
109
|
+
id: "TranslationConfig"
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
// ../commons/src/events/FieldType.ts
|
|
113
|
+
var z3 = __toESM(require("zod/v4"));
|
|
114
|
+
var FieldType = {
|
|
115
|
+
NAME: "NAME",
|
|
116
|
+
PHONE: "PHONE",
|
|
117
|
+
ID: "ID",
|
|
118
|
+
ADDRESS: "ADDRESS",
|
|
119
|
+
TEXT: "TEXT",
|
|
120
|
+
NUMBER: "NUMBER",
|
|
121
|
+
NUMBER_WITH_UNIT: "NUMBER_WITH_UNIT",
|
|
122
|
+
TEXTAREA: "TEXTAREA",
|
|
123
|
+
EMAIL: "EMAIL",
|
|
124
|
+
DATE: "DATE",
|
|
125
|
+
AGE: "AGE",
|
|
126
|
+
DATE_RANGE: "DATE_RANGE",
|
|
127
|
+
// // Internal use, only for search functionality
|
|
128
|
+
SELECT_DATE_RANGE: "SELECT_DATE_RANGE",
|
|
129
|
+
// Internal use, only for search functionality
|
|
130
|
+
TIME: "TIME",
|
|
131
|
+
IMAGE_VIEW: "IMAGE_VIEW",
|
|
132
|
+
PARAGRAPH: "PARAGRAPH",
|
|
133
|
+
HEADING: "HEADING",
|
|
134
|
+
PAGE_HEADER: "PAGE_HEADER",
|
|
135
|
+
RADIO_GROUP: "RADIO_GROUP",
|
|
136
|
+
FIELD_GROUP: "FIELD_GROUP",
|
|
137
|
+
FILE: "FILE",
|
|
138
|
+
FILE_WITH_OPTIONS: "FILE_WITH_OPTIONS",
|
|
139
|
+
BULLET_LIST: "BULLET_LIST",
|
|
140
|
+
CHECKBOX: "CHECKBOX",
|
|
141
|
+
SELECT: "SELECT",
|
|
142
|
+
COUNTRY: "COUNTRY",
|
|
143
|
+
LOCATION: "LOCATION",
|
|
144
|
+
DIVIDER: "DIVIDER",
|
|
145
|
+
ADMINISTRATIVE_AREA: "ADMINISTRATIVE_AREA",
|
|
146
|
+
/** @deprecated Use FieldType.LOCATION with locationTypes: ['HEALTH_FACILITY'] */
|
|
147
|
+
FACILITY: "FACILITY",
|
|
148
|
+
/** @deprecated Use FieldType.LOCATION with locationTypes: ['CRVS_OFFICE'] */
|
|
149
|
+
OFFICE: "OFFICE",
|
|
150
|
+
SIGNATURE: "SIGNATURE",
|
|
151
|
+
DATA: "DATA",
|
|
152
|
+
BUTTON: "BUTTON",
|
|
153
|
+
AUTOCOMPLETE: "AUTOCOMPLETE",
|
|
154
|
+
SEARCH: "SEARCH",
|
|
155
|
+
ALPHA_PRINT_BUTTON: "ALPHA_PRINT_BUTTON",
|
|
156
|
+
HTTP: "HTTP",
|
|
157
|
+
LINK_BUTTON: "LINK_BUTTON",
|
|
158
|
+
VERIFICATION_STATUS: "VERIFICATION_STATUS",
|
|
159
|
+
QUERY_PARAM_READER: "QUERY_PARAM_READER",
|
|
160
|
+
QR_READER: "QR_READER",
|
|
161
|
+
ID_READER: "ID_READER",
|
|
162
|
+
LOADER: "LOADER",
|
|
163
|
+
ALPHA_HIDDEN: "ALPHA_HIDDEN",
|
|
164
|
+
USER_ROLE: "USER_ROLE",
|
|
165
|
+
/**
|
|
166
|
+
* @internal
|
|
167
|
+
* @experimental
|
|
168
|
+
*
|
|
169
|
+
* Internal API used by the OpenCRVS core team for experimentation.
|
|
170
|
+
*
|
|
171
|
+
* This component is not part of the public, stable API.
|
|
172
|
+
* Its shape, behavior, or existence may change at any time or be removed
|
|
173
|
+
* entirely without notice.
|
|
174
|
+
*/
|
|
175
|
+
_EXPERIMENTAL_CUSTOM: "CUSTOM"
|
|
176
|
+
};
|
|
177
|
+
var FileFieldType = z3.enum([
|
|
178
|
+
FieldType.FILE,
|
|
179
|
+
FieldType.FILE_WITH_OPTIONS,
|
|
180
|
+
FieldType.SIGNATURE
|
|
181
|
+
]);
|
|
182
|
+
var fieldTypes = Object.values(FieldType);
|
|
183
|
+
var compositeFieldTypes = [
|
|
184
|
+
FieldType.NAME,
|
|
185
|
+
FieldType.DATE_RANGE,
|
|
186
|
+
FieldType.ADDRESS,
|
|
187
|
+
FieldType.FILE_WITH_OPTIONS,
|
|
188
|
+
FieldType.FILE,
|
|
189
|
+
FieldType.ID_READER,
|
|
190
|
+
FieldType.DATA
|
|
191
|
+
];
|
|
192
|
+
var FieldTypesToHideInReview = [
|
|
193
|
+
FieldType.BULLET_LIST,
|
|
194
|
+
FieldType.DIVIDER,
|
|
195
|
+
FieldType.PAGE_HEADER,
|
|
196
|
+
FieldType.IMAGE_VIEW,
|
|
197
|
+
FieldType.PARAGRAPH,
|
|
198
|
+
FieldType.ID_READER,
|
|
199
|
+
FieldType.LOADER,
|
|
200
|
+
FieldType.HTTP,
|
|
201
|
+
FieldType.QUERY_PARAM_READER,
|
|
202
|
+
FieldType.DATA,
|
|
203
|
+
FieldType.ALPHA_PRINT_BUTTON,
|
|
204
|
+
FieldType.ALPHA_HIDDEN
|
|
205
|
+
];
|
|
206
|
+
|
|
207
|
+
// ../commons/src/events/FieldValue.ts
|
|
208
|
+
var z7 = __toESM(require("zod/v4"));
|
|
209
|
+
|
|
210
|
+
// ../commons/src/documents.ts
|
|
211
|
+
var z4 = __toESM(require("zod/v4"));
|
|
212
|
+
var FullDocumentUrl = z4.string().brand("FullDocumentUrl").describe(
|
|
213
|
+
"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"
|
|
214
|
+
);
|
|
215
|
+
var FullDocumentPath = z4.string().overwrite((val) => val.startsWith("/") ? val : `/${val}`).meta({ effectType: "input", type: "string" }).describe(
|
|
216
|
+
"A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
|
|
217
|
+
);
|
|
218
|
+
var DocumentPath = z4.string().brand("DocumentPath").describe(
|
|
219
|
+
"A relative path within the S3 bucket, never starting with /. e.g. document-id.jpg or directory/document-id.jpg. The document service constructs the full /bucket/path internally."
|
|
220
|
+
);
|
|
221
|
+
|
|
222
|
+
// ../commons/src/events/CompositeFieldValue.ts
|
|
223
|
+
var z5 = __toESM(require("zod/v4"));
|
|
224
|
+
var AddressType = {
|
|
225
|
+
DOMESTIC: "DOMESTIC",
|
|
226
|
+
INTERNATIONAL: "INTERNATIONAL"
|
|
227
|
+
};
|
|
228
|
+
var FileFieldValue = z5.object({
|
|
229
|
+
path: DocumentPath,
|
|
230
|
+
originalFilename: z5.string(),
|
|
231
|
+
type: z5.string()
|
|
232
|
+
});
|
|
233
|
+
var NameFieldValue = z5.object({
|
|
234
|
+
firstname: z5.string(),
|
|
235
|
+
surname: z5.string(),
|
|
236
|
+
middlename: z5.string().optional()
|
|
237
|
+
});
|
|
238
|
+
var NameFieldUpdateValue = z5.object({
|
|
239
|
+
firstname: z5.string().nullish(),
|
|
240
|
+
surname: z5.string().nullish(),
|
|
241
|
+
middlename: z5.string().nullish()
|
|
242
|
+
}).or(z5.null()).or(z5.undefined());
|
|
243
|
+
var StreetLevelDetailsValue = z5.record(z5.string(), z5.string()).optional();
|
|
244
|
+
var StreetLevelDetailsUpdateValue = z5.record(z5.string(), z5.string().nullable()).nullish();
|
|
245
|
+
var BaseAddressFieldValue = z5.object({
|
|
246
|
+
country: z5.string(),
|
|
247
|
+
streetLevelDetails: StreetLevelDetailsValue
|
|
248
|
+
});
|
|
249
|
+
var BaseAddressFieldUpdateValue = z5.object({
|
|
250
|
+
country: z5.string().nullish(),
|
|
251
|
+
streetLevelDetails: StreetLevelDetailsUpdateValue
|
|
252
|
+
});
|
|
253
|
+
var DomesticAddressFieldValue = BaseAddressFieldValue.extend({
|
|
254
|
+
addressType: z5.literal(AddressType.DOMESTIC),
|
|
255
|
+
administrativeArea: z5.string().uuid()
|
|
256
|
+
});
|
|
257
|
+
var InternationalAddressFieldValue = BaseAddressFieldValue.extend({
|
|
258
|
+
addressType: z5.literal(AddressType.INTERNATIONAL)
|
|
259
|
+
});
|
|
260
|
+
var AddressFieldValue = z5.discriminatedUnion("addressType", [
|
|
261
|
+
DomesticAddressFieldValue,
|
|
262
|
+
InternationalAddressFieldValue
|
|
263
|
+
]);
|
|
264
|
+
var DomesticAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend({
|
|
265
|
+
addressType: z5.literal(AddressType.DOMESTIC),
|
|
266
|
+
administrativeArea: z5.string().uuid().nullish()
|
|
267
|
+
/* Leaf level admin structure */
|
|
268
|
+
});
|
|
269
|
+
var InternationalAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend(
|
|
270
|
+
{
|
|
271
|
+
addressType: z5.literal(AddressType.INTERNATIONAL)
|
|
272
|
+
}
|
|
273
|
+
);
|
|
274
|
+
var AddressFieldUpdateValue = z5.discriminatedUnion("addressType", [
|
|
275
|
+
DomesticAddressUpdateFieldValue,
|
|
276
|
+
InternationalAddressUpdateFieldValue
|
|
277
|
+
]).nullish();
|
|
278
|
+
var FileFieldValueWithOption = z5.object({
|
|
279
|
+
path: DocumentPath,
|
|
280
|
+
originalFilename: z5.string(),
|
|
281
|
+
type: z5.string(),
|
|
282
|
+
option: z5.string()
|
|
283
|
+
});
|
|
284
|
+
var FileFieldWithOptionValue = z5.array(FileFieldValueWithOption);
|
|
285
|
+
var HttpFieldValue = z5.object({
|
|
286
|
+
loading: z5.boolean(),
|
|
287
|
+
error: z5.object({ statusCode: z5.number(), message: z5.string() }).nullish(),
|
|
288
|
+
data: z5.any()
|
|
289
|
+
});
|
|
290
|
+
var HttpFieldUpdateValue = z5.object({
|
|
291
|
+
loading: z5.boolean().nullish(),
|
|
292
|
+
error: z5.object({ statusCode: z5.number(), message: z5.string() }).nullish(),
|
|
293
|
+
data: z5.any().nullish()
|
|
294
|
+
}).or(z5.null()).or(z5.undefined());
|
|
295
|
+
var QueryParamReaderFieldValue = z5.object({
|
|
296
|
+
data: z5.record(z5.string(), z5.string()),
|
|
297
|
+
updatedAt: z5.iso.datetime()
|
|
298
|
+
}).nullish();
|
|
299
|
+
var QueryParamReaderFieldUpdateValue = z5.object({
|
|
300
|
+
data: z5.record(z5.string(), z5.string())
|
|
301
|
+
});
|
|
302
|
+
var ReadDataValue = z5.object({
|
|
303
|
+
data: z5.any()
|
|
304
|
+
});
|
|
305
|
+
var QrReaderFieldValue = ReadDataValue;
|
|
306
|
+
var IdReaderFieldValue = ReadDataValue;
|
|
307
|
+
var NumberWithUnitFieldValue = z5.object({
|
|
308
|
+
numericValue: z5.number(),
|
|
309
|
+
unit: z5.string()
|
|
310
|
+
});
|
|
311
|
+
var NumberWithUnitFieldUpdateValue = z5.object({
|
|
312
|
+
numericValue: z5.number().optional(),
|
|
313
|
+
unit: z5.string().optional()
|
|
314
|
+
});
|
|
315
|
+
var CustomFieldValue = z5.unknown().brand("CustomFieldValue");
|
|
316
|
+
|
|
317
|
+
// ../commons/src/events/PlainDate.ts
|
|
318
|
+
var import_zod = require("zod");
|
|
319
|
+
var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date in the format YYYY-MM-DD");
|
|
320
|
+
|
|
321
|
+
// ../commons/src/events/FieldValue.ts
|
|
322
|
+
var TextValue = z7.string();
|
|
323
|
+
var HiddenFieldValue = z7.string();
|
|
324
|
+
var NonEmptyTextValue = TextValue.min(1);
|
|
325
|
+
var DateValue = z7.iso.date().describe("Date in the format YYYY-MM-DD");
|
|
326
|
+
var AgeValue = z7.object({
|
|
327
|
+
age: z7.number(),
|
|
328
|
+
asOfDateRef: z7.string()
|
|
329
|
+
});
|
|
330
|
+
var AgeUpdateValue = AgeValue.optional().nullable();
|
|
331
|
+
var AutocompleteValue = z7.object({
|
|
332
|
+
label: z7.string(),
|
|
333
|
+
value: z7.string()
|
|
334
|
+
});
|
|
335
|
+
var AutocompleteUpdateValue = AutocompleteValue.optional().nullable();
|
|
336
|
+
var TimeValue = z7.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/);
|
|
337
|
+
var DatetimeValue = z7.iso.datetime();
|
|
338
|
+
var SelectDateRangeValue = z7.enum([
|
|
339
|
+
"last7Days",
|
|
340
|
+
"last30Days",
|
|
341
|
+
"last90Days",
|
|
342
|
+
"last365Days"
|
|
343
|
+
]);
|
|
344
|
+
var DateRangeFieldValue = z7.object({
|
|
345
|
+
start: PlainDate,
|
|
346
|
+
end: PlainDate
|
|
347
|
+
}).or(PlainDate).describe(
|
|
348
|
+
"Date range with start and end dates in the format YYYY-MM-DD. Inclusive start, exclusive end."
|
|
349
|
+
);
|
|
350
|
+
var EmailValue = z7.email();
|
|
351
|
+
var CheckboxFieldValue = z7.boolean();
|
|
352
|
+
var NumberFieldValue = z7.number();
|
|
353
|
+
var ButtonFieldValue = z7.number();
|
|
354
|
+
var VerificationStatusValue = z7.enum([
|
|
355
|
+
"verified",
|
|
356
|
+
"authenticated",
|
|
357
|
+
"failed",
|
|
358
|
+
"pending"
|
|
359
|
+
]);
|
|
360
|
+
var LeafFieldValues = z7.union([
|
|
361
|
+
AddressFieldValue,
|
|
362
|
+
TextValue,
|
|
363
|
+
PlainDate,
|
|
364
|
+
AgeValue,
|
|
365
|
+
TimeValue,
|
|
366
|
+
DateRangeFieldValue,
|
|
367
|
+
SelectDateRangeValue,
|
|
368
|
+
CheckboxFieldValue,
|
|
369
|
+
NumberFieldValue,
|
|
370
|
+
FileFieldValue,
|
|
371
|
+
FileFieldWithOptionValue,
|
|
372
|
+
NameFieldValue,
|
|
373
|
+
NameFieldUpdateValue,
|
|
374
|
+
ButtonFieldValue,
|
|
375
|
+
HttpFieldValue,
|
|
376
|
+
VerificationStatusValue,
|
|
377
|
+
QueryParamReaderFieldValue,
|
|
378
|
+
QrReaderFieldValue,
|
|
379
|
+
IdReaderFieldValue,
|
|
380
|
+
NumberWithUnitFieldValue,
|
|
381
|
+
NumberWithUnitFieldUpdateValue,
|
|
382
|
+
CustomFieldValue,
|
|
383
|
+
AutocompleteValue,
|
|
384
|
+
AutocompleteUpdateValue
|
|
385
|
+
]);
|
|
386
|
+
var FieldGroupValue = z7.record(z7.string(), LeafFieldValues);
|
|
387
|
+
var DataFieldValue = z7.object({
|
|
388
|
+
data: z7.record(z7.string(), LeafFieldValues)
|
|
389
|
+
}).nullish();
|
|
390
|
+
var FieldValue = z7.union([
|
|
391
|
+
LeafFieldValues,
|
|
392
|
+
DataFieldValue,
|
|
393
|
+
FieldGroupValue
|
|
394
|
+
]);
|
|
395
|
+
var PRIORITY_ORDER = [
|
|
396
|
+
"NameFieldUpdateValue",
|
|
397
|
+
"DateRangeFieldValue",
|
|
398
|
+
"PlainDate",
|
|
399
|
+
"TextValue",
|
|
400
|
+
"TimeValue",
|
|
401
|
+
"AgeUpdateValue",
|
|
402
|
+
"AddressFieldUpdateValue",
|
|
403
|
+
"SelectDateRangeValue",
|
|
404
|
+
"CheckboxFieldValue",
|
|
405
|
+
"NumberFieldValue",
|
|
406
|
+
"NumberWithUnitFieldUpdateValue",
|
|
407
|
+
"FileFieldValue",
|
|
408
|
+
"FileFieldWithOptionValue",
|
|
409
|
+
"DataFieldValue",
|
|
410
|
+
"GroupFieldValue"
|
|
411
|
+
];
|
|
412
|
+
function schemaPriority(schema) {
|
|
413
|
+
const name = schema.description;
|
|
414
|
+
if (!name) {
|
|
415
|
+
return 9999;
|
|
416
|
+
}
|
|
417
|
+
const idx = PRIORITY_ORDER.indexOf(name);
|
|
418
|
+
return idx === -1 ? 9999 : idx;
|
|
419
|
+
}
|
|
420
|
+
function safeUnion(schemas) {
|
|
421
|
+
return z7.any().superRefine((val, ctx) => {
|
|
422
|
+
const successful = schemas.filter((s) => s.safeParse(val).success);
|
|
423
|
+
if (successful.length === 1) {
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
if (successful.length === 0) {
|
|
427
|
+
ctx.addIssue({
|
|
428
|
+
code: "invalid_type",
|
|
429
|
+
expected: "custom",
|
|
430
|
+
message: "Value does not match any schema"
|
|
431
|
+
});
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
|
|
435
|
+
const best = successful[0];
|
|
436
|
+
if (!best.safeParse(val).success) {
|
|
437
|
+
ctx.addIssue({
|
|
438
|
+
expected: "custom",
|
|
439
|
+
code: "invalid_type",
|
|
440
|
+
message: "Value did not match the best schema"
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
}).meta({
|
|
444
|
+
description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
var FieldUpdateValue = safeUnion([
|
|
448
|
+
TextValue.describe("TextValue"),
|
|
449
|
+
PlainDate.describe("PlainDate"),
|
|
450
|
+
TimeValue.describe("TimeValue"),
|
|
451
|
+
AgeUpdateValue.describe("AgeUpdateValue"),
|
|
452
|
+
AddressFieldUpdateValue.describe("AddressFieldUpdateValue"),
|
|
453
|
+
DateRangeFieldValue.describe("DateRangeFieldValue"),
|
|
454
|
+
SelectDateRangeValue.describe("SelectDateRangeValue"),
|
|
455
|
+
CheckboxFieldValue.describe("CheckboxFieldValue"),
|
|
456
|
+
NumberFieldValue.describe("NumberFieldValue"),
|
|
457
|
+
NumberWithUnitFieldUpdateValue.describe("NumberWithUnitFieldUpdateValue"),
|
|
458
|
+
FileFieldValue.describe("FileFieldValue"),
|
|
459
|
+
FileFieldWithOptionValue.describe("FileFieldWithOptionValue"),
|
|
460
|
+
DataFieldValue.describe("DataFieldValue"),
|
|
461
|
+
FieldGroupValue.describe("GroupFieldValue"),
|
|
462
|
+
NameFieldUpdateValue.describe("NameFieldUpdateValue"),
|
|
463
|
+
HttpFieldUpdateValue.describe("HttpFieldUpdateValue"),
|
|
464
|
+
QueryParamReaderFieldUpdateValue.describe("QueryParamReaderFieldUpdateValue"),
|
|
465
|
+
CustomFieldValue.describe("CustomFieldValue"),
|
|
466
|
+
HiddenFieldValue.describe("HiddenFieldValue"),
|
|
467
|
+
AutocompleteUpdateValue.describe("AutocompleteUpdateValue")
|
|
468
|
+
]);
|
|
469
|
+
|
|
470
|
+
// ../commons/src/uuid.ts
|
|
471
|
+
var import_uuid = require("uuid");
|
|
472
|
+
var z8 = __toESM(require("zod/v4"));
|
|
473
|
+
var UUID = z8.uuid().brand("UUID");
|
|
474
|
+
|
|
475
|
+
// ../commons/src/events/serializers/user/serializer.ts
|
|
476
|
+
var z9 = __toESM(require("zod/v4"));
|
|
477
|
+
var SerializedUserField = z9.object({
|
|
478
|
+
$userField: z9.enum([
|
|
479
|
+
"id",
|
|
480
|
+
"name",
|
|
481
|
+
"role",
|
|
482
|
+
"fullHonorificName",
|
|
483
|
+
"device",
|
|
484
|
+
"firstname",
|
|
485
|
+
"middlename",
|
|
486
|
+
"surname",
|
|
487
|
+
"signature",
|
|
488
|
+
"avatar",
|
|
489
|
+
"primaryOfficeId",
|
|
490
|
+
"administrativeAreaId"
|
|
491
|
+
]),
|
|
492
|
+
$location: z9.string().optional()
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
// ../commons/src/events/EventIndex.ts
|
|
496
|
+
var import_v4 = require("zod/v4");
|
|
497
|
+
|
|
498
|
+
// ../commons/src/events/EventMetadata.ts
|
|
499
|
+
var z15 = __toESM(require("zod/v4"));
|
|
500
|
+
|
|
501
|
+
// ../commons/src/events/ActionDocument.ts
|
|
502
|
+
var z13 = __toESM(require("zod/v4"));
|
|
503
|
+
|
|
504
|
+
// ../commons/src/events/ActionType.ts
|
|
505
|
+
var z10 = __toESM(require("zod/v4"));
|
|
506
|
+
var ActionType = {
|
|
507
|
+
// Pre-declaration actions
|
|
508
|
+
DELETE: "DELETE",
|
|
509
|
+
CREATE: "CREATE",
|
|
510
|
+
NOTIFY: "NOTIFY",
|
|
511
|
+
// Declaration actions
|
|
512
|
+
DECLARE: "DECLARE",
|
|
513
|
+
REGISTER: "REGISTER",
|
|
514
|
+
EDIT: "EDIT",
|
|
515
|
+
// Declaration system actions. Non-configurable.
|
|
516
|
+
DUPLICATE_DETECTED: "DUPLICATE_DETECTED",
|
|
517
|
+
REJECT: "REJECT",
|
|
518
|
+
// REJECT_DECLARATION
|
|
519
|
+
MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
|
|
520
|
+
MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
|
|
521
|
+
ARCHIVE: "ARCHIVE",
|
|
522
|
+
// Record actions
|
|
523
|
+
PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
|
|
524
|
+
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
|
525
|
+
REJECT_CORRECTION: "REJECT_CORRECTION",
|
|
526
|
+
APPROVE_CORRECTION: "APPROVE_CORRECTION",
|
|
527
|
+
// General actions
|
|
528
|
+
READ: "READ",
|
|
529
|
+
ASSIGN: "ASSIGN",
|
|
530
|
+
UNASSIGN: "UNASSIGN",
|
|
531
|
+
// Custom action
|
|
532
|
+
CUSTOM: "CUSTOM"
|
|
533
|
+
};
|
|
534
|
+
var ConfirmableActions = [
|
|
535
|
+
ActionType.NOTIFY,
|
|
536
|
+
ActionType.DECLARE,
|
|
537
|
+
ActionType.EDIT,
|
|
538
|
+
ActionType.REGISTER,
|
|
539
|
+
ActionType.REJECT,
|
|
540
|
+
ActionType.ARCHIVE,
|
|
541
|
+
ActionType.PRINT_CERTIFICATE,
|
|
542
|
+
ActionType.REQUEST_CORRECTION,
|
|
543
|
+
ActionType.APPROVE_CORRECTION,
|
|
544
|
+
ActionType.REJECT_CORRECTION,
|
|
545
|
+
ActionType.CUSTOM
|
|
546
|
+
];
|
|
547
|
+
var ActionTypes = z10.enum([
|
|
548
|
+
"DELETE",
|
|
549
|
+
"CREATE",
|
|
550
|
+
"NOTIFY",
|
|
551
|
+
"DECLARE",
|
|
552
|
+
"EDIT",
|
|
553
|
+
"REGISTER",
|
|
554
|
+
"DUPLICATE_DETECTED",
|
|
555
|
+
"REJECT",
|
|
556
|
+
"MARK_AS_DUPLICATE",
|
|
557
|
+
"MARK_AS_NOT_DUPLICATE",
|
|
558
|
+
"ARCHIVE",
|
|
559
|
+
"PRINT_CERTIFICATE",
|
|
560
|
+
"REQUEST_CORRECTION",
|
|
561
|
+
"REJECT_CORRECTION",
|
|
562
|
+
"APPROVE_CORRECTION",
|
|
563
|
+
"READ",
|
|
564
|
+
"ASSIGN",
|
|
565
|
+
"UNASSIGN",
|
|
566
|
+
"CUSTOM"
|
|
567
|
+
]);
|
|
568
|
+
var declarationActionValues = [
|
|
569
|
+
ActionTypes.enum.DECLARE,
|
|
570
|
+
ActionTypes.enum.EDIT,
|
|
571
|
+
ActionTypes.enum.REGISTER,
|
|
572
|
+
ActionTypes.enum.NOTIFY,
|
|
573
|
+
ActionTypes.enum.DUPLICATE_DETECTED
|
|
574
|
+
];
|
|
575
|
+
var DeclarationActions = ActionTypes.extract(declarationActionValues);
|
|
576
|
+
var declarationUpdateActionValues = [
|
|
577
|
+
...declarationActionValues,
|
|
578
|
+
ActionTypes.enum.REQUEST_CORRECTION
|
|
579
|
+
];
|
|
580
|
+
var DeclarationUpdateActions = ActionTypes.extract(
|
|
581
|
+
declarationUpdateActionValues
|
|
582
|
+
);
|
|
583
|
+
var annotationActions = ActionTypes.exclude(declarationActionValues);
|
|
584
|
+
var writeActions = ActionTypes.exclude([
|
|
585
|
+
ActionType.CREATE,
|
|
586
|
+
ActionType.READ,
|
|
587
|
+
ActionType.ASSIGN,
|
|
588
|
+
ActionType.UNASSIGN
|
|
589
|
+
]);
|
|
590
|
+
var WorkqueueActionType = ActionTypes.extract([
|
|
591
|
+
ActionType.READ,
|
|
592
|
+
ActionType.DELETE,
|
|
593
|
+
ActionType.DECLARE,
|
|
594
|
+
ActionType.REGISTER,
|
|
595
|
+
ActionType.EDIT,
|
|
596
|
+
ActionType.REJECT,
|
|
597
|
+
ActionType.MARK_AS_DUPLICATE,
|
|
598
|
+
ActionType.ARCHIVE,
|
|
599
|
+
ActionType.PRINT_CERTIFICATE,
|
|
600
|
+
ActionType.REQUEST_CORRECTION
|
|
601
|
+
]);
|
|
602
|
+
var META_ACTIONS = [
|
|
603
|
+
ActionType.ASSIGN,
|
|
604
|
+
ActionType.UNASSIGN,
|
|
605
|
+
ActionType.READ
|
|
606
|
+
];
|
|
607
|
+
|
|
608
|
+
// ../commons/src/authentication.ts
|
|
609
|
+
var import_jwt_decode = __toESM(require("jwt-decode"));
|
|
610
|
+
var z12 = __toESM(require("zod/v4"));
|
|
611
|
+
|
|
612
|
+
// ../commons/src/scopes.ts
|
|
613
|
+
var z11 = __toESM(require("zod/v4"));
|
|
614
|
+
var qs = __toESM(require("qs"));
|
|
615
|
+
var JurisdictionFilter = z11.enum(["administrativeArea", "location", "all"]).describe(
|
|
616
|
+
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
617
|
+
);
|
|
618
|
+
var UserFilter = z11.enum(["user"]).describe("Filters based on the user. Limits to self.");
|
|
619
|
+
var RecordScopeTypeV2 = z11.enum([
|
|
620
|
+
"record.search",
|
|
621
|
+
"record.create",
|
|
622
|
+
"record.read",
|
|
623
|
+
"record.declare",
|
|
624
|
+
"record.notify",
|
|
625
|
+
"record.edit",
|
|
626
|
+
"record.reject",
|
|
627
|
+
"record.archive",
|
|
628
|
+
"record.review-duplicates",
|
|
629
|
+
"record.register",
|
|
630
|
+
"record.print-certified-copies",
|
|
631
|
+
"record.request-correction",
|
|
632
|
+
"record.correct",
|
|
633
|
+
"record.unassign-others",
|
|
634
|
+
"record.custom-action"
|
|
635
|
+
]);
|
|
636
|
+
var PlainScopeType = z11.enum([
|
|
637
|
+
// Misc. system scopes
|
|
638
|
+
"bypassratelimit",
|
|
639
|
+
"record.reindex",
|
|
640
|
+
"user.data-seeding",
|
|
641
|
+
"integration.create",
|
|
642
|
+
"record.import",
|
|
643
|
+
"config.update-all",
|
|
644
|
+
"attachment.upload",
|
|
645
|
+
"profile.electronic-signature",
|
|
646
|
+
"user.read-only-my-audit",
|
|
647
|
+
// Performance dashboard
|
|
648
|
+
"performance.read",
|
|
649
|
+
"performance.read-dashboards",
|
|
650
|
+
"performance.vital-statistics-export",
|
|
651
|
+
// Scopes used exclusively by countryconfig integration token
|
|
652
|
+
"record.confirm-registration",
|
|
653
|
+
"record.reject-registration"
|
|
654
|
+
]);
|
|
655
|
+
var scopeByEvent = z11.preprocess(
|
|
656
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
657
|
+
z11.array(z11.string()).optional()
|
|
658
|
+
).describe("Event type, e.g. birth, death");
|
|
659
|
+
var scopeOptionsPlaceEvent = z11.object({
|
|
660
|
+
event: scopeByEvent,
|
|
661
|
+
placeOfEvent: JurisdictionFilter.optional()
|
|
662
|
+
}).describe("Options applicable to all record scopes.");
|
|
663
|
+
var scopeOptionsDeclared = scopeOptionsPlaceEvent.extend({
|
|
664
|
+
declaredIn: JurisdictionFilter.optional(),
|
|
665
|
+
declaredBy: UserFilter.optional()
|
|
666
|
+
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
667
|
+
var AllRecordScopeOptions = scopeOptionsDeclared.extend({
|
|
668
|
+
registeredIn: JurisdictionFilter.optional(),
|
|
669
|
+
registeredBy: UserFilter.optional()
|
|
670
|
+
}).describe(
|
|
671
|
+
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
672
|
+
);
|
|
673
|
+
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
674
|
+
customActionTypes: z11.preprocess(
|
|
675
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
676
|
+
z11.array(z11.string()).optional()
|
|
677
|
+
).describe("Allowed custom action types")
|
|
678
|
+
});
|
|
679
|
+
var AccessLevelOptions = z11.object({
|
|
680
|
+
accessLevel: JurisdictionFilter.optional()
|
|
681
|
+
});
|
|
682
|
+
var WorkqueueOrDashboardOptions = z11.object({
|
|
683
|
+
ids: z11.preprocess(
|
|
684
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
685
|
+
z11.array(z11.string())
|
|
686
|
+
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
687
|
+
});
|
|
688
|
+
var AllScopeOptions = z11.object({
|
|
689
|
+
...AllRecordScopeOptions.shape,
|
|
690
|
+
...AccessLevelOptions.shape,
|
|
691
|
+
...WorkqueueOrDashboardOptions.shape
|
|
692
|
+
});
|
|
693
|
+
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
694
|
+
var ResolvedScopeOptionsPlaceEvent = z11.object({
|
|
695
|
+
event: scopeByEvent,
|
|
696
|
+
placeOfEvent: UUID.nullish()
|
|
697
|
+
}).describe(
|
|
698
|
+
"Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
|
|
699
|
+
);
|
|
700
|
+
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
701
|
+
declaredIn: UUID.nullish(),
|
|
702
|
+
declaredBy: z11.string().optional()
|
|
703
|
+
}).describe(
|
|
704
|
+
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
705
|
+
);
|
|
706
|
+
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
707
|
+
registeredIn: UUID.nullish(),
|
|
708
|
+
registeredBy: z11.string().optional()
|
|
709
|
+
}).describe(
|
|
710
|
+
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
711
|
+
);
|
|
712
|
+
var ScopesWithPlaceEventOptions = RecordScopeTypeV2.extract([
|
|
713
|
+
"record.create",
|
|
714
|
+
"record.declare",
|
|
715
|
+
"record.notify"
|
|
716
|
+
]);
|
|
717
|
+
var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
718
|
+
"record.edit",
|
|
719
|
+
"record.reject",
|
|
720
|
+
"record.archive",
|
|
721
|
+
"record.review-duplicates",
|
|
722
|
+
"record.register"
|
|
723
|
+
]);
|
|
724
|
+
var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
725
|
+
"record.search",
|
|
726
|
+
"record.read",
|
|
727
|
+
"record.request-correction",
|
|
728
|
+
"record.correct",
|
|
729
|
+
"record.unassign-others"
|
|
730
|
+
]);
|
|
731
|
+
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
732
|
+
templates: z11.preprocess(
|
|
733
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
734
|
+
z11.array(z11.string()).optional()
|
|
735
|
+
).describe(
|
|
736
|
+
"Template IDs for certified copies. Controls which certificate templates are returned to the client via the config service. Certificate printing is a client-side operation \u2014 this option is not validated when the printCertificate action is submitted."
|
|
737
|
+
)
|
|
738
|
+
});
|
|
739
|
+
var RecordScopeV2 = z11.discriminatedUnion("type", [
|
|
740
|
+
z11.object({
|
|
741
|
+
type: ScopesWithPlaceEventOptions,
|
|
742
|
+
options: scopeOptionsPlaceEvent.optional()
|
|
743
|
+
}),
|
|
744
|
+
z11.object({
|
|
745
|
+
type: ScopesWithDeclaredOptions,
|
|
746
|
+
options: scopeOptionsDeclared.optional()
|
|
747
|
+
}),
|
|
748
|
+
z11.object({
|
|
749
|
+
type: ScopesWithFullOptions,
|
|
750
|
+
options: AllRecordScopeOptions.optional()
|
|
751
|
+
}),
|
|
752
|
+
z11.object({
|
|
753
|
+
type: z11.literal("record.custom-action"),
|
|
754
|
+
options: CustomActionScopeOptions.optional()
|
|
755
|
+
}),
|
|
756
|
+
z11.object({
|
|
757
|
+
type: z11.literal("record.print-certified-copies"),
|
|
758
|
+
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
759
|
+
})
|
|
760
|
+
]).describe(
|
|
761
|
+
"Scopes used to check user's permission to perform actions on a record."
|
|
762
|
+
);
|
|
763
|
+
var ResolvedRecordScopeV2 = z11.discriminatedUnion("type", [
|
|
764
|
+
z11.object({
|
|
765
|
+
type: ScopesWithPlaceEventOptions,
|
|
766
|
+
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
767
|
+
}),
|
|
768
|
+
z11.object({
|
|
769
|
+
type: ScopesWithDeclaredOptions,
|
|
770
|
+
options: ResolvedScopeOptionsDeclared.optional()
|
|
771
|
+
}),
|
|
772
|
+
z11.object({
|
|
773
|
+
type: ScopesWithFullOptions,
|
|
774
|
+
options: ResolvedScopeOptionsFull.optional()
|
|
775
|
+
}),
|
|
776
|
+
z11.object({
|
|
777
|
+
type: z11.literal("record.print-certified-copies"),
|
|
778
|
+
options: ResolvedScopeOptionsFull.extend({
|
|
779
|
+
templates: z11.array(z11.string()).optional()
|
|
780
|
+
}).optional()
|
|
781
|
+
})
|
|
782
|
+
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
783
|
+
var SystemScopeType = z11.enum([
|
|
784
|
+
"organisation.read-locations",
|
|
785
|
+
"user.read",
|
|
786
|
+
"user.create",
|
|
787
|
+
"user.edit"
|
|
788
|
+
]);
|
|
789
|
+
var Scope = z11.discriminatedUnion("type", [
|
|
790
|
+
z11.object({ type: PlainScopeType }),
|
|
791
|
+
...RecordScopeV2.options,
|
|
792
|
+
z11.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
|
|
793
|
+
z11.object({
|
|
794
|
+
type: z11.literal("workqueue"),
|
|
795
|
+
options: WorkqueueOrDashboardOptions
|
|
796
|
+
}),
|
|
797
|
+
z11.object({
|
|
798
|
+
type: z11.literal("dashboard.view"),
|
|
799
|
+
options: WorkqueueOrDashboardOptions
|
|
800
|
+
})
|
|
801
|
+
]);
|
|
802
|
+
var ScopeType = z11.enum([
|
|
803
|
+
...SystemScopeType.options,
|
|
804
|
+
...RecordScopeTypeV2.options,
|
|
805
|
+
...PlainScopeType.options,
|
|
806
|
+
"workqueue",
|
|
807
|
+
"dashboard.view"
|
|
808
|
+
]);
|
|
809
|
+
var EncodedScope = z11.string().brand("EncodedScope");
|
|
810
|
+
var DEFAULT_SCOPE_OPTIONS = {
|
|
811
|
+
placeOfEvent: JurisdictionFilter.enum.all,
|
|
812
|
+
accessLevel: JurisdictionFilter.enum.all
|
|
813
|
+
};
|
|
814
|
+
|
|
815
|
+
// ../commons/src/authentication.ts
|
|
816
|
+
var TokenUserType = z12.enum(["user", "system"]);
|
|
817
|
+
var TokenWithBearer = z12.string().regex(/^Bearer\s/);
|
|
818
|
+
|
|
819
|
+
// ../commons/src/events/ActionDocument.ts
|
|
820
|
+
var ActionUpdate = z13.record(z13.string(), FieldUpdateValue).describe(
|
|
821
|
+
"Record of field-level changes made by an action. Supports partial updates and nullable values."
|
|
822
|
+
);
|
|
823
|
+
var EventState = z13.record(z13.string(), FieldValue).describe(
|
|
824
|
+
"Aggregate representation of event data after all actions have been applied, with all updates consolidated and null values removed."
|
|
825
|
+
);
|
|
826
|
+
var ActionStatus = {
|
|
827
|
+
Requested: "Requested",
|
|
828
|
+
Accepted: "Accepted",
|
|
829
|
+
Rejected: "Rejected"
|
|
830
|
+
};
|
|
831
|
+
var ActionBase = z13.object({
|
|
832
|
+
id: UUID.describe("Unique identifier of the action."),
|
|
833
|
+
transactionId: z13.string().describe("Unique identifier of the transaction."),
|
|
834
|
+
createdByUserType: TokenUserType.describe(
|
|
835
|
+
"Indicates whether the action was created by a human-user or by a system-user."
|
|
836
|
+
),
|
|
837
|
+
createdAt: z13.string().datetime().describe("Timestamp indicating when the action was created."),
|
|
838
|
+
createdBy: z13.string().describe("Identifier of the user who created the action."),
|
|
839
|
+
createdByRole: z13.string().optional().describe("Role of the user who created the action."),
|
|
840
|
+
createdBySignature: DocumentPath.nullish().describe(
|
|
841
|
+
"Reference to the signature of the user who created the action."
|
|
842
|
+
),
|
|
843
|
+
// @TODO: createdAtLocation should be non-nullable in the future once all actions have this field populated.
|
|
844
|
+
createdAtLocation: UUID.nullish().describe(
|
|
845
|
+
"Reference to the location of the user who created the action."
|
|
846
|
+
),
|
|
847
|
+
declaration: ActionUpdate.describe(
|
|
848
|
+
"Declaration data defined by the ActionConfig. Supports partial updates."
|
|
849
|
+
),
|
|
850
|
+
annotation: ActionUpdate.optional().nullable().describe("Action-specific metadata used to annotate the event."),
|
|
851
|
+
status: z13.enum([
|
|
852
|
+
ActionStatus.Requested,
|
|
853
|
+
ActionStatus.Accepted,
|
|
854
|
+
ActionStatus.Rejected
|
|
855
|
+
]).describe(
|
|
856
|
+
"Current status of the action. Actions may be validated asynchronously by third-party integrations."
|
|
857
|
+
),
|
|
858
|
+
originalActionId: UUID.optional().nullable().describe(
|
|
859
|
+
"Reference to the original action asynchronously accepted or rejected by a third-party integration."
|
|
860
|
+
)
|
|
861
|
+
});
|
|
862
|
+
var AssignedAction = ActionBase.extend(
|
|
863
|
+
z13.object({
|
|
864
|
+
type: z13.literal(ActionType.ASSIGN),
|
|
865
|
+
assignedTo: z13.string().describe("Identifier of the user to whom the action is assigned.")
|
|
866
|
+
// TODO move into 'content' property
|
|
867
|
+
}).shape
|
|
868
|
+
);
|
|
869
|
+
var UnassignedAction = ActionBase.extend(
|
|
870
|
+
z13.object({
|
|
871
|
+
type: z13.literal(ActionType.UNASSIGN)
|
|
872
|
+
}).shape
|
|
873
|
+
);
|
|
874
|
+
var RegisterAction = ActionBase.extend(
|
|
875
|
+
z13.object({
|
|
876
|
+
type: z13.literal(ActionType.REGISTER),
|
|
877
|
+
registrationNumber: z13.string().optional().describe(
|
|
878
|
+
"Registration number of the event. Always present for accepted registrations."
|
|
879
|
+
)
|
|
880
|
+
// TODO move into 'content' property
|
|
881
|
+
}).shape
|
|
882
|
+
);
|
|
883
|
+
var DeclareAction = ActionBase.extend(
|
|
884
|
+
z13.object({
|
|
885
|
+
type: z13.literal(ActionType.DECLARE)
|
|
886
|
+
}).shape
|
|
887
|
+
);
|
|
888
|
+
var ReasonContent = z13.object({
|
|
889
|
+
reason: z13.string().min(1, { error: "Message cannot be empty" }).describe(
|
|
890
|
+
"Message describing the reason for rejecting or archiving the event."
|
|
891
|
+
)
|
|
892
|
+
});
|
|
893
|
+
var RejectAction = ActionBase.extend(
|
|
894
|
+
z13.object({
|
|
895
|
+
type: z13.literal(ActionType.REJECT),
|
|
896
|
+
content: ReasonContent
|
|
897
|
+
}).shape
|
|
898
|
+
);
|
|
899
|
+
var PotentialDuplicate = z13.object({
|
|
900
|
+
id: UUID,
|
|
901
|
+
trackingId: z13.string()
|
|
902
|
+
});
|
|
903
|
+
var DuplicateDetectedAction = ActionBase.extend(
|
|
904
|
+
z13.object({
|
|
905
|
+
type: z13.literal(ActionType.DUPLICATE_DETECTED),
|
|
906
|
+
content: z13.object({
|
|
907
|
+
duplicates: z13.array(PotentialDuplicate)
|
|
908
|
+
})
|
|
909
|
+
}).shape
|
|
910
|
+
);
|
|
911
|
+
var MarkNotDuplicateAction = ActionBase.extend(
|
|
912
|
+
z13.object({
|
|
913
|
+
type: z13.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
914
|
+
}).shape
|
|
915
|
+
);
|
|
916
|
+
var MarkAsDuplicateAction = ActionBase.extend(
|
|
917
|
+
z13.object({
|
|
918
|
+
type: z13.literal(ActionType.MARK_AS_DUPLICATE),
|
|
919
|
+
content: z13.object({
|
|
920
|
+
duplicateOf: UUID
|
|
921
|
+
}).optional()
|
|
922
|
+
}).shape
|
|
923
|
+
);
|
|
924
|
+
var ArchiveAction = ActionBase.extend(
|
|
925
|
+
z13.object({
|
|
926
|
+
type: z13.literal(ActionType.ARCHIVE),
|
|
927
|
+
content: ReasonContent
|
|
928
|
+
}).shape
|
|
929
|
+
);
|
|
930
|
+
var CreatedAction = ActionBase.extend(
|
|
931
|
+
z13.object({
|
|
932
|
+
type: z13.literal(ActionType.CREATE)
|
|
933
|
+
}).shape
|
|
934
|
+
);
|
|
935
|
+
var NotifiedAction = ActionBase.extend(
|
|
936
|
+
z13.object({
|
|
937
|
+
type: z13.literal(ActionType.NOTIFY)
|
|
938
|
+
}).shape
|
|
939
|
+
);
|
|
940
|
+
var EditAction = ActionBase.extend(
|
|
941
|
+
z13.object({
|
|
942
|
+
type: z13.literal(ActionType.EDIT),
|
|
943
|
+
content: z13.object({
|
|
944
|
+
comment: z13.string().describe("Comment for the edit action.").optional()
|
|
945
|
+
})
|
|
946
|
+
}).shape
|
|
947
|
+
);
|
|
948
|
+
var PrintContent = z13.object({
|
|
949
|
+
templateId: z13.string().optional()
|
|
950
|
+
});
|
|
951
|
+
var PrintCertificateAction = ActionBase.extend(
|
|
952
|
+
z13.object({
|
|
953
|
+
type: z13.literal(ActionType.PRINT_CERTIFICATE),
|
|
954
|
+
content: PrintContent.optional().nullable()
|
|
955
|
+
}).shape
|
|
956
|
+
);
|
|
957
|
+
var RequestedCorrectionAction = ActionBase.extend(
|
|
958
|
+
z13.object({
|
|
959
|
+
type: z13.literal(ActionType.REQUEST_CORRECTION)
|
|
960
|
+
}).shape
|
|
961
|
+
);
|
|
962
|
+
var ApprovedCorrectionAction = ActionBase.extend(
|
|
963
|
+
z13.object({
|
|
964
|
+
type: z13.literal(ActionType.APPROVE_CORRECTION),
|
|
965
|
+
requestId: z13.string()
|
|
966
|
+
// TODO move into 'content' property
|
|
967
|
+
}).shape
|
|
968
|
+
);
|
|
969
|
+
var RejectedCorrectionAction = ActionBase.extend(
|
|
970
|
+
z13.object({
|
|
971
|
+
type: z13.literal(ActionType.REJECT_CORRECTION),
|
|
972
|
+
requestId: z13.string(),
|
|
973
|
+
// TODO move into 'content' property
|
|
974
|
+
content: ReasonContent
|
|
975
|
+
}).shape
|
|
976
|
+
);
|
|
977
|
+
var ReadAction = ActionBase.extend(
|
|
978
|
+
z13.object({
|
|
979
|
+
type: z13.literal(ActionType.READ)
|
|
980
|
+
}).shape
|
|
981
|
+
);
|
|
982
|
+
var CustomAction = ActionBase.merge(
|
|
983
|
+
z13.object({
|
|
984
|
+
type: z13.literal(ActionType.CUSTOM),
|
|
985
|
+
customActionType: z13.string()
|
|
986
|
+
})
|
|
987
|
+
);
|
|
988
|
+
var ActionDocument = z13.discriminatedUnion("type", [
|
|
989
|
+
CreatedAction.meta({ id: "CreatedAction" }),
|
|
990
|
+
RejectAction.meta({ id: "RejectAction" }),
|
|
991
|
+
DuplicateDetectedAction.meta({ id: "DuplicateDetectedAction" }),
|
|
992
|
+
MarkNotDuplicateAction.meta({ id: "MarkNotDuplicateAction" }),
|
|
993
|
+
MarkAsDuplicateAction.meta({ id: "MarkAsDuplicateAction" }),
|
|
994
|
+
ArchiveAction.meta({ id: "ArchiveAction" }),
|
|
995
|
+
NotifiedAction.meta({ id: "NotifiedAction" }),
|
|
996
|
+
RegisterAction.meta({ id: "RegisterAction" }),
|
|
997
|
+
DeclareAction.meta({ id: "DeclareAction" }),
|
|
998
|
+
AssignedAction.meta({ id: "AssignedAction" }),
|
|
999
|
+
RequestedCorrectionAction.meta({ id: "RequestedCorrectionAction" }),
|
|
1000
|
+
ApprovedCorrectionAction.meta({ id: "ApprovedCorrectionAction" }),
|
|
1001
|
+
RejectedCorrectionAction.meta({ id: "RejectedCorrectionAction" }),
|
|
1002
|
+
UnassignedAction.meta({ id: "UnassignedAction" }),
|
|
1003
|
+
PrintCertificateAction.meta({ id: "PrintCertificateAction" }),
|
|
1004
|
+
ReadAction.meta({ id: "ReadAction" }),
|
|
1005
|
+
EditAction.meta({ id: "EditAction" }),
|
|
1006
|
+
CustomAction.meta({ id: "CustomAction" })
|
|
1007
|
+
]).meta({
|
|
1008
|
+
id: "ActionDocument"
|
|
1009
|
+
});
|
|
1010
|
+
var AsyncRejectActionDocument = ActionBase.omit({
|
|
1011
|
+
declaration: true,
|
|
1012
|
+
annotation: true
|
|
1013
|
+
}).extend(
|
|
1014
|
+
z13.object({
|
|
1015
|
+
type: z13.enum(ConfirmableActions),
|
|
1016
|
+
status: z13.literal(ActionStatus.Rejected)
|
|
1017
|
+
}).shape
|
|
1018
|
+
);
|
|
1019
|
+
var Action = z13.union([ActionDocument, AsyncRejectActionDocument]);
|
|
1020
|
+
|
|
1021
|
+
// ../commons/src/events/Flag.ts
|
|
1022
|
+
var z14 = __toESM(require("zod/v4"));
|
|
1023
|
+
var InherentFlags = {
|
|
1024
|
+
INCOMPLETE: "incomplete",
|
|
1025
|
+
REJECTED: "rejected",
|
|
1026
|
+
CORRECTION_REQUESTED: "correction-requested",
|
|
1027
|
+
POTENTIAL_DUPLICATE: "potential-duplicate",
|
|
1028
|
+
/**
|
|
1029
|
+
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
1030
|
+
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
1031
|
+
*
|
|
1032
|
+
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
1033
|
+
*/
|
|
1034
|
+
EDIT_IN_PROGRESS: "edit-in-progress"
|
|
1035
|
+
};
|
|
1036
|
+
var ActionFlag = z14.string().regex(
|
|
1037
|
+
new RegExp(
|
|
1038
|
+
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
1039
|
+
ActionStatus
|
|
1040
|
+
).join("|").toLowerCase()})$`
|
|
1041
|
+
),
|
|
1042
|
+
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
1043
|
+
);
|
|
1044
|
+
var CustomFlag = z14.string().refine((val) => !Object.values(InherentFlags).includes(val), {
|
|
1045
|
+
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
1046
|
+
InherentFlags
|
|
1047
|
+
).join(", ")}`
|
|
1048
|
+
}).refine((val) => !ActionFlag.safeParse(val).success, {
|
|
1049
|
+
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
1050
|
+
}).describe("Custom flag identifier defined by the country config.");
|
|
1051
|
+
var Flag = ActionFlag.or(z14.enum(InherentFlags)).or(CustomFlag);
|
|
1052
|
+
var FlagConfig = z14.object({
|
|
1053
|
+
id: CustomFlag,
|
|
1054
|
+
requiresAction: z14.boolean().describe(
|
|
1055
|
+
"Indicates if this flag expects an action to be performed to be cleared."
|
|
1056
|
+
),
|
|
1057
|
+
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1058
|
+
});
|
|
1059
|
+
var ActionFlagConfig = z14.object({
|
|
1060
|
+
id: Flag,
|
|
1061
|
+
operation: z14.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
1062
|
+
conditional: Conditional.optional().describe(
|
|
1063
|
+
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1064
|
+
)
|
|
1065
|
+
});
|
|
1066
|
+
|
|
1067
|
+
// ../commons/src/events/EventMetadata.ts
|
|
1068
|
+
var EventStatus = z15.enum([
|
|
1069
|
+
"CREATED",
|
|
1070
|
+
"NOTIFIED",
|
|
1071
|
+
"DECLARED",
|
|
1072
|
+
"REGISTERED",
|
|
1073
|
+
"ARCHIVED"
|
|
1074
|
+
]);
|
|
1075
|
+
var ZodDate = z15.iso.date();
|
|
1076
|
+
var ZodDateTime = z15.string().datetime();
|
|
1077
|
+
var ActionCreationMetadata = z15.object({
|
|
1078
|
+
createdAt: z15.iso.datetime().describe("The timestamp when the action request was created."),
|
|
1079
|
+
createdBy: z15.string().describe("ID of the user who created the action request."),
|
|
1080
|
+
// @TODO: createdAtLocation should be non-nullable in the future once all action requests have this field populated.
|
|
1081
|
+
createdAtLocation: UUID.nullish().describe(
|
|
1082
|
+
"Location of the user who created the action request."
|
|
1083
|
+
),
|
|
1084
|
+
createdByUserType: z15.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1085
|
+
acceptedAt: z15.iso.datetime().describe("Timestamp when the action request was accepted."),
|
|
1086
|
+
createdByRole: z15.string().optional().describe("Role of the user at the time of action request creation."),
|
|
1087
|
+
createdBySignature: z15.string().nullish().describe("Signature of the user who created the action request.")
|
|
1088
|
+
});
|
|
1089
|
+
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
1090
|
+
registrationNumber: z15.string().describe(
|
|
1091
|
+
"Registration number of the event. Always present for accepted registrations."
|
|
1092
|
+
)
|
|
1093
|
+
});
|
|
1094
|
+
var LegalStatuses = z15.object({
|
|
1095
|
+
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
|
1096
|
+
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
|
1097
|
+
});
|
|
1098
|
+
var EventMetadata = z15.object({
|
|
1099
|
+
id: UUID,
|
|
1100
|
+
type: z15.string().describe("The type of event, such as birth, death, or marriage."),
|
|
1101
|
+
status: EventStatus,
|
|
1102
|
+
legalStatuses: LegalStatuses.describe(
|
|
1103
|
+
"Metadata related to the legal registration of the event, such as who registered it and when."
|
|
1104
|
+
),
|
|
1105
|
+
createdAt: z15.iso.datetime().describe("The timestamp when the event was first created and saved."),
|
|
1106
|
+
dateOfEvent: ZodDate.nullish(),
|
|
1107
|
+
placeOfEvent: UUID.nullish(),
|
|
1108
|
+
createdBy: z15.string().describe("ID of the user who created the event."),
|
|
1109
|
+
createdByUserType: z15.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1110
|
+
updatedByUserRole: z15.string().nullish().describe("Role of the user who last changed the status."),
|
|
1111
|
+
// @TODO: createdAtLocation should be non-nullable in the future once all action requests have this field populated.
|
|
1112
|
+
createdAtLocation: UUID.nullish().describe(
|
|
1113
|
+
"Location of the user who created the event."
|
|
1114
|
+
),
|
|
1115
|
+
createdBySignature: DocumentPath.nullish().describe(
|
|
1116
|
+
"Signature of the user who created the event."
|
|
1117
|
+
),
|
|
1118
|
+
updatedAtLocation: UUID.nullish().describe(
|
|
1119
|
+
"Location of the user who last changed the status."
|
|
1120
|
+
),
|
|
1121
|
+
updatedAt: z15.iso.datetime().describe(
|
|
1122
|
+
"Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
|
|
1123
|
+
),
|
|
1124
|
+
assignedTo: z15.string().nullish().describe("ID of the user currently assigned to the event."),
|
|
1125
|
+
updatedBy: z15.string().nullish().describe("ID of the user who last changed the status."),
|
|
1126
|
+
trackingId: z15.string().describe(
|
|
1127
|
+
"System-generated tracking ID used by informants or registrars to look up the event."
|
|
1128
|
+
),
|
|
1129
|
+
potentialDuplicates: z15.array(PotentialDuplicate).describe(
|
|
1130
|
+
"List of event IDs and their tracking IDs that this event could be a duplicate of."
|
|
1131
|
+
),
|
|
1132
|
+
flags: z15.array(Flag)
|
|
1133
|
+
});
|
|
1134
|
+
var EventMetadataKeysArray = [
|
|
1135
|
+
"id",
|
|
1136
|
+
"type",
|
|
1137
|
+
"status",
|
|
1138
|
+
"createdAt",
|
|
1139
|
+
"dateOfEvent",
|
|
1140
|
+
"placeOfEvent",
|
|
1141
|
+
"createdBy",
|
|
1142
|
+
"createdByUserType",
|
|
1143
|
+
"updatedByUserRole",
|
|
1144
|
+
"createdAtLocation",
|
|
1145
|
+
"updatedAtLocation",
|
|
1146
|
+
"updatedAt",
|
|
1147
|
+
"assignedTo",
|
|
1148
|
+
"updatedBy",
|
|
1149
|
+
"trackingId",
|
|
1150
|
+
"legalStatuses",
|
|
1151
|
+
"flags"
|
|
1152
|
+
];
|
|
1153
|
+
var EventMetadataKeys = z15.enum(EventMetadataKeysArray);
|
|
1154
|
+
var EventMetadataDateFieldIdInput = z15.enum([
|
|
1155
|
+
"createdAt",
|
|
1156
|
+
"updatedAt",
|
|
1157
|
+
"legalStatuses.DECLARED.createdAt",
|
|
1158
|
+
"legalStatuses.DECLARED.acceptedAt",
|
|
1159
|
+
"legalStatuses.REGISTERED.createdAt",
|
|
1160
|
+
"legalStatuses.REGISTERED.acceptedAt"
|
|
1161
|
+
]);
|
|
1162
|
+
var EventMetadataDateFieldId = z15.enum([
|
|
1163
|
+
"event.createdAt",
|
|
1164
|
+
"event.updatedAt",
|
|
1165
|
+
"event.legalStatuses.DECLARED.createdAt",
|
|
1166
|
+
"event.legalStatuses.DECLARED.acceptedAt",
|
|
1167
|
+
"event.legalStatuses.REGISTERED.createdAt",
|
|
1168
|
+
"event.legalStatuses.REGISTERED.acceptedAt"
|
|
1169
|
+
]);
|
|
1170
|
+
|
|
1171
|
+
// ../commons/src/events/Constants.ts
|
|
1172
|
+
var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
|
|
1173
|
+
|
|
1174
|
+
// ../commons/src/events/EventIndex.ts
|
|
1175
|
+
var EventIndex = EventMetadata.extend({
|
|
1176
|
+
declaration: EventState
|
|
1177
|
+
}).meta({
|
|
1178
|
+
id: "EventIndex"
|
|
1179
|
+
});
|
|
1180
|
+
var EventSearchIndex = import_v4.z.record(import_v4.z.string(), import_v4.z.any()).and(
|
|
1181
|
+
import_v4.z.object({
|
|
1182
|
+
type: import_v4.z.string()
|
|
1183
|
+
// Ensures "type" (event-id) exists and is a string
|
|
1184
|
+
})
|
|
1185
|
+
).meta({
|
|
1186
|
+
id: "EventSearchIndex"
|
|
1187
|
+
});
|
|
1188
|
+
var Fuzzy = import_v4.z.object({ type: import_v4.z.literal("fuzzy"), term: import_v4.z.string() }).meta({
|
|
1189
|
+
id: "Fuzzy"
|
|
1190
|
+
});
|
|
1191
|
+
var Exact = import_v4.z.object({ type: import_v4.z.literal("exact"), term: import_v4.z.string() }).meta({
|
|
1192
|
+
id: "Exact"
|
|
1193
|
+
});
|
|
1194
|
+
var ExactStatus = import_v4.z.object({
|
|
1195
|
+
type: import_v4.z.literal("exact"),
|
|
1196
|
+
term: EventStatus
|
|
1197
|
+
}).meta({
|
|
1198
|
+
id: "ExactStatus"
|
|
1199
|
+
});
|
|
1200
|
+
var ExactUserType = import_v4.z.object({
|
|
1201
|
+
type: import_v4.z.literal("exact"),
|
|
1202
|
+
term: TokenUserType
|
|
1203
|
+
}).meta({
|
|
1204
|
+
id: "ExactUserType"
|
|
1205
|
+
});
|
|
1206
|
+
var AnyOf = import_v4.z.object({
|
|
1207
|
+
type: import_v4.z.literal("anyOf"),
|
|
1208
|
+
terms: import_v4.z.array(import_v4.z.string())
|
|
1209
|
+
}).meta({
|
|
1210
|
+
id: "AnyOf"
|
|
1211
|
+
});
|
|
1212
|
+
var AnyOfStatus = import_v4.z.object({
|
|
1213
|
+
type: import_v4.z.literal("anyOf"),
|
|
1214
|
+
terms: import_v4.z.array(EventStatus)
|
|
1215
|
+
}).meta({
|
|
1216
|
+
id: "AnyOfStatus"
|
|
1217
|
+
});
|
|
1218
|
+
var Range = import_v4.z.object({
|
|
1219
|
+
type: import_v4.z.literal("range"),
|
|
1220
|
+
gte: import_v4.z.string(),
|
|
1221
|
+
lte: import_v4.z.string()
|
|
1222
|
+
}).meta({
|
|
1223
|
+
id: "Range"
|
|
1224
|
+
});
|
|
1225
|
+
var ContainsFlags = import_v4.z.object({
|
|
1226
|
+
anyOf: import_v4.z.array(Flag).optional(),
|
|
1227
|
+
noneOf: import_v4.z.array(Flag).optional()
|
|
1228
|
+
}).meta({
|
|
1229
|
+
id: "ContainsFlags"
|
|
1230
|
+
});
|
|
1231
|
+
var Within = import_v4.z.object({ type: import_v4.z.literal("within"), location: import_v4.z.string() }).meta({
|
|
1232
|
+
id: "Within"
|
|
1233
|
+
});
|
|
1234
|
+
var RangeDate = import_v4.z.object({
|
|
1235
|
+
type: import_v4.z.literal("range"),
|
|
1236
|
+
gte: import_v4.z.iso.date().or(import_v4.z.iso.datetime()),
|
|
1237
|
+
lte: import_v4.z.iso.date().or(import_v4.z.iso.datetime())
|
|
1238
|
+
}).meta({ id: "RangeDate" });
|
|
1239
|
+
var ExactDate = Exact.extend({
|
|
1240
|
+
term: import_v4.z.iso.date().or(import_v4.z.iso.datetime())
|
|
1241
|
+
}).meta({
|
|
1242
|
+
id: "ExactDate"
|
|
1243
|
+
});
|
|
1244
|
+
var TimePeriod = import_v4.z.object({
|
|
1245
|
+
type: import_v4.z.literal("timePeriod"),
|
|
1246
|
+
term: SelectDateRangeValue
|
|
1247
|
+
}).meta({
|
|
1248
|
+
id: "TimePeriod"
|
|
1249
|
+
});
|
|
1250
|
+
var DateCondition = import_v4.z.union([ExactDate, RangeDate, TimePeriod]).meta({
|
|
1251
|
+
id: "DateCondition"
|
|
1252
|
+
});
|
|
1253
|
+
var QueryInput = import_v4.z.lazy(
|
|
1254
|
+
() => import_v4.z.union([
|
|
1255
|
+
import_v4.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf]),
|
|
1256
|
+
import_v4.z.record(import_v4.z.string(), QueryInput)
|
|
1257
|
+
])
|
|
1258
|
+
).meta({
|
|
1259
|
+
id: "QueryInput"
|
|
1260
|
+
});
|
|
1261
|
+
var QueryExpression = import_v4.z.object({
|
|
1262
|
+
id: import_v4.z.optional(import_v4.z.string()),
|
|
1263
|
+
eventType: import_v4.z.string(),
|
|
1264
|
+
status: import_v4.z.optional(import_v4.z.union([AnyOfStatus, ExactStatus])),
|
|
1265
|
+
createdAt: import_v4.z.optional(DateCondition),
|
|
1266
|
+
updatedAt: import_v4.z.optional(DateCondition),
|
|
1267
|
+
"legalStatuses.DECLARED.createdAtLocation": import_v4.z.optional(Within).nullable(),
|
|
1268
|
+
"legalStatuses.DECLARED.createdByRole": import_v4.z.optional(AnyOf),
|
|
1269
|
+
"legalStatuses.REGISTERED.acceptedAt": import_v4.z.optional(DateCondition),
|
|
1270
|
+
"legalStatuses.REGISTERED.createdAtLocation": import_v4.z.optional(Within).nullable(),
|
|
1271
|
+
"legalStatuses.REGISTERED.createdByRole": import_v4.z.optional(AnyOf),
|
|
1272
|
+
"legalStatuses.REGISTERED.registrationNumber": import_v4.z.optional(Exact),
|
|
1273
|
+
createdAtLocation: import_v4.z.optional(import_v4.z.union([Within, Exact])),
|
|
1274
|
+
updatedAtLocation: import_v4.z.optional(import_v4.z.union([Within, Exact])),
|
|
1275
|
+
assignedTo: import_v4.z.optional(Exact),
|
|
1276
|
+
createdByUserType: import_v4.z.optional(ExactUserType),
|
|
1277
|
+
updatedByUserRole: import_v4.z.optional(Exact),
|
|
1278
|
+
createdBy: import_v4.z.optional(Exact),
|
|
1279
|
+
updatedBy: import_v4.z.optional(Exact),
|
|
1280
|
+
trackingId: import_v4.z.optional(Exact),
|
|
1281
|
+
flags: import_v4.z.optional(ContainsFlags),
|
|
1282
|
+
// @todo: The type for this comes out as "any"
|
|
1283
|
+
data: QueryInput
|
|
1284
|
+
}).partial().refine((obj) => Object.values(obj).some((val) => val !== void 0), {
|
|
1285
|
+
error: "At least one query field must be specified."
|
|
1286
|
+
}).meta({
|
|
1287
|
+
id: "QueryExpression"
|
|
1288
|
+
});
|
|
1289
|
+
var QueryType = import_v4.z.lazy(
|
|
1290
|
+
() => import_v4.z.object({
|
|
1291
|
+
type: import_v4.z.literal("and").or(import_v4.z.literal("or")).meta({ default: "and" }),
|
|
1292
|
+
clauses: import_v4.z.array(import_v4.z.union([QueryExpression, QueryType])).nonempty("At least one clause is required.").meta({
|
|
1293
|
+
default: [
|
|
1294
|
+
{
|
|
1295
|
+
eventType: TENNIS_CLUB_MEMBERSHIP,
|
|
1296
|
+
status: {
|
|
1297
|
+
type: "anyOf",
|
|
1298
|
+
terms: EventStatus.options
|
|
1299
|
+
},
|
|
1300
|
+
updatedAt: {
|
|
1301
|
+
type: "range",
|
|
1302
|
+
gte: "2025-05-22",
|
|
1303
|
+
lte: "2025-05-29"
|
|
1304
|
+
},
|
|
1305
|
+
data: {}
|
|
1306
|
+
}
|
|
1307
|
+
]
|
|
1308
|
+
})
|
|
1309
|
+
})
|
|
1310
|
+
).meta({
|
|
1311
|
+
id: "QueryType"
|
|
1312
|
+
});
|
|
1313
|
+
function parseStringifiedQueryField(val) {
|
|
1314
|
+
if (typeof val === "string") {
|
|
1315
|
+
return JSON.parse(val);
|
|
1316
|
+
}
|
|
1317
|
+
return val;
|
|
1318
|
+
}
|
|
1319
|
+
var SearchQuery = import_v4.z.object({
|
|
1320
|
+
query: import_v4.z.preprocess(parseStringifiedQueryField, QueryType).meta({
|
|
1321
|
+
default: {
|
|
1322
|
+
type: "and",
|
|
1323
|
+
clauses: [
|
|
1324
|
+
{
|
|
1325
|
+
eventType: TENNIS_CLUB_MEMBERSHIP,
|
|
1326
|
+
status: {
|
|
1327
|
+
type: "anyOf",
|
|
1328
|
+
terms: EventStatus.options
|
|
1329
|
+
},
|
|
1330
|
+
updatedAt: {
|
|
1331
|
+
type: "range",
|
|
1332
|
+
gte: "2025-05-22",
|
|
1333
|
+
lte: "2025-05-29"
|
|
1334
|
+
},
|
|
1335
|
+
data: {}
|
|
1336
|
+
}
|
|
1337
|
+
]
|
|
1338
|
+
}
|
|
1339
|
+
}),
|
|
1340
|
+
limit: import_v4.z.number().optional().default(100),
|
|
1341
|
+
offset: import_v4.z.number().optional().default(0),
|
|
1342
|
+
sort: import_v4.z.preprocess(
|
|
1343
|
+
parseStringifiedQueryField,
|
|
1344
|
+
import_v4.z.array(
|
|
1345
|
+
import_v4.z.object({
|
|
1346
|
+
field: import_v4.z.string(),
|
|
1347
|
+
direction: import_v4.z.enum(["asc", "desc"]).default("asc")
|
|
1348
|
+
})
|
|
1349
|
+
)
|
|
1350
|
+
).optional()
|
|
1351
|
+
}).meta({
|
|
1352
|
+
id: "SearchQuery"
|
|
1353
|
+
});
|
|
1354
|
+
|
|
1355
|
+
// ../commons/src/events/serializers/date/serializer.ts
|
|
1356
|
+
var import_zod2 = require("zod");
|
|
1357
|
+
var SerializedNowDateTime = import_zod2.z.object({
|
|
1358
|
+
$$now: import_zod2.z.literal(true)
|
|
1359
|
+
});
|
|
1360
|
+
|
|
1361
|
+
// ../commons/src/users/userReferences.ts
|
|
1362
|
+
var import_v42 = __toESM(require("zod/v4"));
|
|
1363
|
+
var ScopeOptionReference = import_v42.default.object({
|
|
1364
|
+
$scope: ScopeType,
|
|
1365
|
+
$option: ScopeOptionKey
|
|
1366
|
+
});
|
|
1367
|
+
var JurisdictionReference = import_v42.default.object({
|
|
1368
|
+
$jurisdiction: JurisdictionFilter.or(ScopeOptionReference)
|
|
1369
|
+
});
|
|
1370
|
+
|
|
1371
|
+
// ../commons/src/events/FieldConfig.ts
|
|
1372
|
+
var FieldId = import_v43.default.string().superRefine((val, ctx) => {
|
|
1373
|
+
if (val.includes("_")) {
|
|
1374
|
+
ctx.addIssue({
|
|
1375
|
+
code: import_v43.default.ZodIssueCode.custom,
|
|
1376
|
+
message: `id: '${val}' must not contain underscores '_'`
|
|
1377
|
+
});
|
|
1378
|
+
}
|
|
1379
|
+
}).describe("Unique identifier for the field");
|
|
1380
|
+
var FieldReference = import_v43.default.object({
|
|
1381
|
+
$$field: FieldId,
|
|
1382
|
+
$$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
|
|
1383
|
+
'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
|
|
1384
|
+
)
|
|
1385
|
+
}).describe("Reference to a field by its ID");
|
|
1386
|
+
var ValidationConfig = import_v43.default.object({
|
|
1387
|
+
validator: Conditional,
|
|
1388
|
+
message: TranslationConfig
|
|
1389
|
+
});
|
|
1390
|
+
var requiredSchema = import_v43.default.union([
|
|
1391
|
+
import_v43.default.boolean(),
|
|
1392
|
+
import_v43.default.object({
|
|
1393
|
+
message: TranslationConfig.describe("Custom required validation message")
|
|
1394
|
+
})
|
|
1395
|
+
]).default(false).optional();
|
|
1396
|
+
var BaseField = import_v43.default.object({
|
|
1397
|
+
id: FieldId.describe("Unique identifier of the field."),
|
|
1398
|
+
label: TranslationConfig.describe("Human-readable label of the field."),
|
|
1399
|
+
parent: FieldReference.or(import_v43.default.array(FieldReference)).optional().describe(
|
|
1400
|
+
"Reference to the parent field or fields. When a parent field changes, this field is reset."
|
|
1401
|
+
),
|
|
1402
|
+
required: requiredSchema.describe(
|
|
1403
|
+
"Indicates whether the field is mandatory."
|
|
1404
|
+
),
|
|
1405
|
+
conditionals: import_v43.default.array(FieldConditional).default([]).optional().describe(
|
|
1406
|
+
"Conditions determining when the field is shown or enabled. By default, the field is always shown and enabled."
|
|
1407
|
+
),
|
|
1408
|
+
secured: import_v43.default.boolean().default(false).optional().describe(
|
|
1409
|
+
"Indicates whether the field is secured. Secured fields are not indexed for search and are only visible when explicitly assigned."
|
|
1410
|
+
),
|
|
1411
|
+
placeholder: TranslationConfig.optional(),
|
|
1412
|
+
validation: import_v43.default.array(ValidationConfig).default([]).optional().describe("Additional validation rules applied to the field."),
|
|
1413
|
+
helperText: TranslationConfig.optional(),
|
|
1414
|
+
hideLabel: import_v43.default.boolean().default(false).optional(),
|
|
1415
|
+
uncorrectable: import_v43.default.boolean().default(false).optional().describe(
|
|
1416
|
+
"Indicates whether the field can be modified during record correction."
|
|
1417
|
+
),
|
|
1418
|
+
value: FieldReference.or(import_v43.default.array(FieldReference)).optional().describe(
|
|
1419
|
+
"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."
|
|
1420
|
+
),
|
|
1421
|
+
analytics: import_v43.default.boolean().default(false).optional().describe(
|
|
1422
|
+
"Indicates whether the field is included in analytics. When enabled, its value becomes available in the analytics dashboard."
|
|
1423
|
+
)
|
|
1424
|
+
}).describe("Common properties shared across all field types.");
|
|
1425
|
+
var Divider = BaseField.extend({
|
|
1426
|
+
type: import_v43.default.literal(FieldType.DIVIDER)
|
|
1427
|
+
});
|
|
1428
|
+
var TextField = BaseField.extend({
|
|
1429
|
+
type: import_v43.default.literal(FieldType.TEXT),
|
|
1430
|
+
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
1431
|
+
configuration: import_v43.default.object({
|
|
1432
|
+
maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
|
|
1433
|
+
type: import_v43.default.enum(["text", "password"]).optional(),
|
|
1434
|
+
prefix: TranslationConfig.optional(),
|
|
1435
|
+
postfix: TranslationConfig.optional()
|
|
1436
|
+
}).default({ type: "text" }).optional()
|
|
1437
|
+
}).describe("Text input");
|
|
1438
|
+
var NumberField = BaseField.extend({
|
|
1439
|
+
type: import_v43.default.literal(FieldType.NUMBER),
|
|
1440
|
+
defaultValue: NumberFieldValue.optional(),
|
|
1441
|
+
configuration: import_v43.default.object({
|
|
1442
|
+
min: import_v43.default.number().optional().describe("Minimum value"),
|
|
1443
|
+
max: import_v43.default.number().optional().describe("Maximum value"),
|
|
1444
|
+
prefix: TranslationConfig.optional(),
|
|
1445
|
+
postfix: TranslationConfig.optional()
|
|
1446
|
+
}).optional()
|
|
1447
|
+
}).describe("Number input");
|
|
1448
|
+
var TextAreaField = BaseField.extend({
|
|
1449
|
+
type: import_v43.default.literal(FieldType.TEXTAREA),
|
|
1450
|
+
defaultValue: NonEmptyTextValue.optional(),
|
|
1451
|
+
configuration: import_v43.default.object({
|
|
1452
|
+
maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
|
|
1453
|
+
rows: import_v43.default.number().optional().describe("Number of visible text lines"),
|
|
1454
|
+
cols: import_v43.default.number().optional().describe("Number of visible columns"),
|
|
1455
|
+
prefix: TranslationConfig.optional(),
|
|
1456
|
+
postfix: TranslationConfig.optional()
|
|
1457
|
+
}).default({ rows: 4 }).optional()
|
|
1458
|
+
}).describe("Multiline text input");
|
|
1459
|
+
var ImageMimeType = import_v43.default.enum([
|
|
1460
|
+
"image/png",
|
|
1461
|
+
"image/jpg",
|
|
1462
|
+
"image/jpeg",
|
|
1463
|
+
"image/svg+xml"
|
|
1464
|
+
]);
|
|
1465
|
+
var DocumentMimeType = import_v43.default.enum([
|
|
1466
|
+
"application/pdf",
|
|
1467
|
+
"application/msword",
|
|
1468
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
1469
|
+
"application/vnd.oasis.opendocument.text"
|
|
1470
|
+
]);
|
|
1471
|
+
var MimeType = import_v43.default.enum([
|
|
1472
|
+
...ImageMimeType.options,
|
|
1473
|
+
...DocumentMimeType.options
|
|
1474
|
+
]);
|
|
1475
|
+
var DEFAULT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;
|
|
1476
|
+
var SignatureField = BaseField.extend({
|
|
1477
|
+
type: import_v43.default.literal(FieldType.SIGNATURE),
|
|
1478
|
+
signaturePromptLabel: TranslationConfig.describe(
|
|
1479
|
+
"Title of the signature modal"
|
|
1480
|
+
),
|
|
1481
|
+
defaultValue: FieldValue.optional(),
|
|
1482
|
+
configuration: import_v43.default.object({
|
|
1483
|
+
maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
|
1484
|
+
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
|
1485
|
+
}).default({
|
|
1486
|
+
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
1487
|
+
})
|
|
1488
|
+
}).describe("Signature input field");
|
|
1489
|
+
var EmailField = BaseField.extend({
|
|
1490
|
+
type: import_v43.default.literal(FieldType.EMAIL),
|
|
1491
|
+
configuration: import_v43.default.object({
|
|
1492
|
+
maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
|
|
1493
|
+
}).default({ maxLength: 255 }).optional(),
|
|
1494
|
+
defaultValue: NonEmptyTextValue.optional()
|
|
1495
|
+
});
|
|
1496
|
+
var DateField = BaseField.extend({
|
|
1497
|
+
type: import_v43.default.literal(FieldType.DATE),
|
|
1498
|
+
defaultValue: SerializedNowDateTime.or(PlainDate).optional().describe("Default date value(yyyy-MM-dd)"),
|
|
1499
|
+
configuration: import_v43.default.object({
|
|
1500
|
+
notice: TranslationConfig.describe(
|
|
1501
|
+
"Text to display above the date input"
|
|
1502
|
+
).optional()
|
|
1503
|
+
}).optional()
|
|
1504
|
+
}).describe("A single date input (yyyy-MM-dd)");
|
|
1505
|
+
var AgeField = BaseField.extend({
|
|
1506
|
+
type: import_v43.default.literal(FieldType.AGE),
|
|
1507
|
+
defaultValue: NumberFieldValue.optional(),
|
|
1508
|
+
configuration: import_v43.default.object({
|
|
1509
|
+
asOfDate: FieldReference,
|
|
1510
|
+
prefix: TranslationConfig.optional(),
|
|
1511
|
+
postfix: TranslationConfig.optional()
|
|
1512
|
+
})
|
|
1513
|
+
}).describe("An age input field which uses the current date as the asOfDate");
|
|
1514
|
+
var TimeField = BaseField.extend({
|
|
1515
|
+
type: import_v43.default.literal(FieldType.TIME),
|
|
1516
|
+
defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
|
|
1517
|
+
configuration: import_v43.default.object({
|
|
1518
|
+
use12HourFormat: import_v43.default.boolean().optional().describe("Whether to use 12-hour format"),
|
|
1519
|
+
notice: TranslationConfig.describe(
|
|
1520
|
+
"Text to display above the time input"
|
|
1521
|
+
).optional()
|
|
1522
|
+
}).optional()
|
|
1523
|
+
}).describe("A single date input (HH-mm)");
|
|
1524
|
+
var DateRangeField = BaseField.extend({
|
|
1525
|
+
type: import_v43.default.literal(FieldType.DATE_RANGE),
|
|
1526
|
+
defaultValue: DateRangeFieldValue.optional(),
|
|
1527
|
+
configuration: import_v43.default.object({
|
|
1528
|
+
notice: TranslationConfig.describe(
|
|
1529
|
+
"Text to display above the date input"
|
|
1530
|
+
).optional()
|
|
1531
|
+
}).optional()
|
|
1532
|
+
}).describe("A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })");
|
|
1533
|
+
var HtmlFontVariant = import_v43.default.enum([
|
|
1534
|
+
"reg12",
|
|
1535
|
+
"reg14",
|
|
1536
|
+
"reg16",
|
|
1537
|
+
"reg18",
|
|
1538
|
+
"h4",
|
|
1539
|
+
"h3",
|
|
1540
|
+
"h2",
|
|
1541
|
+
"h1"
|
|
1542
|
+
]);
|
|
1543
|
+
var ParagraphTextAlign = import_v43.default.enum(["left", "center", "right", "start", "end"]);
|
|
1544
|
+
var ParagraphConfiguration = import_v43.default.object({
|
|
1545
|
+
styles: import_v43.default.object({
|
|
1546
|
+
hint: import_v43.default.boolean().optional().describe("When true, paragraph is styled as a hint with grey color"),
|
|
1547
|
+
textAlign: ParagraphTextAlign.optional().describe(
|
|
1548
|
+
"Text alignment for the paragraph"
|
|
1549
|
+
)
|
|
1550
|
+
}).optional()
|
|
1551
|
+
}).default({});
|
|
1552
|
+
var HeadingFontVariant = HtmlFontVariant.exclude(["h1", "h2"]);
|
|
1553
|
+
var HeadingConfiguration = import_v43.default.object({
|
|
1554
|
+
styles: import_v43.default.object({
|
|
1555
|
+
fontVariant: HeadingFontVariant.optional().describe(
|
|
1556
|
+
"Font variant to use for the paragraph text"
|
|
1557
|
+
),
|
|
1558
|
+
textAlign: ParagraphTextAlign.optional().describe(
|
|
1559
|
+
"Text alignment for the paragraph"
|
|
1560
|
+
)
|
|
1561
|
+
}).optional()
|
|
1562
|
+
}).default({});
|
|
1563
|
+
var ImageConfiguration = import_v43.default.object({
|
|
1564
|
+
alt: import_v43.default.string().optional().describe("Alternative text for the image"),
|
|
1565
|
+
width: import_v43.default.string().optional().describe("CSS width value for the image"),
|
|
1566
|
+
height: import_v43.default.string().optional().describe("CSS height value for the image"),
|
|
1567
|
+
textAlign: ParagraphTextAlign.optional().describe(
|
|
1568
|
+
"Text alignment for positioning the image in its container"
|
|
1569
|
+
),
|
|
1570
|
+
objectFit: import_v43.default.enum(["contain", "cover", "fill", "none", "scale-down"]).optional().describe("How the image should be resized to fit the container")
|
|
1571
|
+
});
|
|
1572
|
+
var ImageViewField = BaseField.extend({
|
|
1573
|
+
type: import_v43.default.literal(FieldType.IMAGE_VIEW),
|
|
1574
|
+
defaultValue: NonEmptyTextValue.optional(),
|
|
1575
|
+
configuration: ImageConfiguration
|
|
1576
|
+
}).describe("A read-only image component for form pages");
|
|
1577
|
+
var Paragraph = BaseField.extend({
|
|
1578
|
+
type: import_v43.default.literal(FieldType.PARAGRAPH),
|
|
1579
|
+
configuration: ParagraphConfiguration
|
|
1580
|
+
}).describe("A read-only HTML <p> paragraph");
|
|
1581
|
+
var Heading = BaseField.extend({
|
|
1582
|
+
type: import_v43.default.literal(FieldType.HEADING),
|
|
1583
|
+
configuration: HeadingConfiguration
|
|
1584
|
+
}).describe("A read-only heading component for form pages");
|
|
1585
|
+
var PageHeader = BaseField.extend({
|
|
1586
|
+
type: import_v43.default.literal(FieldType.PAGE_HEADER)
|
|
1587
|
+
}).describe("A read-only header component for form pages");
|
|
1588
|
+
var File = BaseField.extend({
|
|
1589
|
+
type: import_v43.default.literal(FieldType.FILE),
|
|
1590
|
+
defaultValue: FileFieldValue.optional(),
|
|
1591
|
+
configuration: import_v43.default.object({
|
|
1592
|
+
maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
|
1593
|
+
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
|
|
1594
|
+
maxImageSize: import_v43.default.object({
|
|
1595
|
+
targetSize: import_v43.default.object({ width: import_v43.default.number(), height: import_v43.default.number() })
|
|
1596
|
+
}).optional(),
|
|
1597
|
+
style: import_v43.default.object({
|
|
1598
|
+
width: import_v43.default.enum(["full", "auto"]).optional().describe(
|
|
1599
|
+
"Whether the file upload button should take the full width of the container or not"
|
|
1600
|
+
)
|
|
1601
|
+
}).optional(),
|
|
1602
|
+
fileName: TranslationConfig.optional()
|
|
1603
|
+
}).default({
|
|
1604
|
+
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
1605
|
+
})
|
|
1606
|
+
}).describe("File upload");
|
|
1607
|
+
var SelectOption = import_v43.default.object({
|
|
1608
|
+
value: import_v43.default.string().describe("The value of the option"),
|
|
1609
|
+
label: import_v43.default.union([import_v43.default.string(), TranslationConfig]).describe("The label of the option"),
|
|
1610
|
+
conditionals: import_v43.default.array(ActionConditional).default([]).optional()
|
|
1611
|
+
});
|
|
1612
|
+
var NumberWithUnitField = BaseField.extend({
|
|
1613
|
+
type: import_v43.default.literal(FieldType.NUMBER_WITH_UNIT),
|
|
1614
|
+
defaultValue: NumberWithUnitFieldValue.optional(),
|
|
1615
|
+
options: import_v43.default.array(SelectOption).describe("A list of options for the unit select"),
|
|
1616
|
+
configuration: import_v43.default.object({
|
|
1617
|
+
min: import_v43.default.number().optional().describe("Minimum value of the number field"),
|
|
1618
|
+
max: import_v43.default.number().optional().describe("Maximum value of the number field"),
|
|
1619
|
+
numberFieldPlaceholder: TranslationConfig.optional().describe(
|
|
1620
|
+
"Placeholder for the number field"
|
|
1621
|
+
)
|
|
1622
|
+
}).optional()
|
|
1623
|
+
}).describe("Number with unit input");
|
|
1624
|
+
var RadioGroup = BaseField.extend({
|
|
1625
|
+
type: import_v43.default.literal(FieldType.RADIO_GROUP),
|
|
1626
|
+
defaultValue: TextValue.optional(),
|
|
1627
|
+
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
1628
|
+
configuration: import_v43.default.object({
|
|
1629
|
+
styles: import_v43.default.object({
|
|
1630
|
+
size: import_v43.default.enum(["NORMAL", "LARGE"]).optional()
|
|
1631
|
+
}).optional()
|
|
1632
|
+
}).optional()
|
|
1633
|
+
}).describe("Grouped radio options");
|
|
1634
|
+
var BulletList = BaseField.extend({
|
|
1635
|
+
type: import_v43.default.literal(FieldType.BULLET_LIST),
|
|
1636
|
+
items: import_v43.default.array(TranslationConfig).describe("A list of items"),
|
|
1637
|
+
configuration: import_v43.default.object({
|
|
1638
|
+
styles: import_v43.default.object({
|
|
1639
|
+
fontVariant: HtmlFontVariant.optional()
|
|
1640
|
+
}).optional()
|
|
1641
|
+
}).default({})
|
|
1642
|
+
}).describe("A list of bullet points");
|
|
1643
|
+
var Select = BaseField.extend({
|
|
1644
|
+
type: import_v43.default.literal(FieldType.SELECT),
|
|
1645
|
+
defaultValue: TextValue.optional(),
|
|
1646
|
+
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
1647
|
+
noOptionsMessage: TranslationConfig.optional().describe(
|
|
1648
|
+
`
|
|
1649
|
+
A translation configuration object used to display a message when no options are available.
|
|
1650
|
+
It must follow the shape: { id: string; defaultMessage: string; description?: string }.
|
|
1651
|
+
The message is rendered via intl.formatMessage(noOptionsMessage, { input }),
|
|
1652
|
+
where 'input' represents the text entered in the Select field.
|
|
1653
|
+
You can reference this variable in your message, for example:
|
|
1654
|
+
{ ..., defaultMessage: "'{input}' is not listed among the health facilities." }
|
|
1655
|
+
`
|
|
1656
|
+
)
|
|
1657
|
+
}).describe("Select input");
|
|
1658
|
+
var SelectDateRangeOption = import_v43.default.object({
|
|
1659
|
+
value: SelectDateRangeValue.describe("The value of the option"),
|
|
1660
|
+
label: TranslationConfig.describe("The label of the option")
|
|
1661
|
+
});
|
|
1662
|
+
var SelectDateRangeField = BaseField.extend({
|
|
1663
|
+
type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
|
|
1664
|
+
defaultValue: SelectDateRangeValue.optional(),
|
|
1665
|
+
options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
|
|
1666
|
+
}).describe("Select input with date range options");
|
|
1667
|
+
var NameConfig = import_v43.default.object({
|
|
1668
|
+
firstname: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
1669
|
+
middlename: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
1670
|
+
surname: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional()
|
|
1671
|
+
});
|
|
1672
|
+
var NameField = BaseField.extend({
|
|
1673
|
+
type: import_v43.default.literal(FieldType.NAME),
|
|
1674
|
+
defaultValue: import_v43.default.object({
|
|
1675
|
+
firstname: SerializedUserField.or(NonEmptyTextValue).optional(),
|
|
1676
|
+
middlename: SerializedUserField.or(NonEmptyTextValue).optional(),
|
|
1677
|
+
surname: SerializedUserField.or(NonEmptyTextValue).optional()
|
|
1678
|
+
}).optional(),
|
|
1679
|
+
configuration: import_v43.default.object({
|
|
1680
|
+
name: NameConfig.default({
|
|
1681
|
+
firstname: { required: true },
|
|
1682
|
+
surname: { required: true }
|
|
1683
|
+
}).optional(),
|
|
1684
|
+
order: import_v43.default.array(import_v43.default.enum(["firstname", "middlename", "surname"])).optional(),
|
|
1685
|
+
maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
|
|
1686
|
+
prefix: TranslationConfig.optional(),
|
|
1687
|
+
postfix: TranslationConfig.optional(),
|
|
1688
|
+
showParentFieldError: import_v43.default.boolean().default(false).optional().describe(
|
|
1689
|
+
`If true, shows the parent field error and hides the subfield error`
|
|
1690
|
+
)
|
|
1691
|
+
}).default({
|
|
1692
|
+
name: {
|
|
1693
|
+
firstname: { required: true },
|
|
1694
|
+
surname: { required: true }
|
|
1695
|
+
}
|
|
1696
|
+
}).optional()
|
|
1697
|
+
}).describe("Name input field");
|
|
1698
|
+
var PhoneField = BaseField.extend({
|
|
1699
|
+
defaultValue: NonEmptyTextValue.optional(),
|
|
1700
|
+
type: import_v43.default.literal(FieldType.PHONE)
|
|
1701
|
+
}).describe("Phone input field");
|
|
1702
|
+
var IdField = BaseField.extend({
|
|
1703
|
+
defaultValue: NonEmptyTextValue.optional(),
|
|
1704
|
+
type: import_v43.default.literal(FieldType.ID)
|
|
1705
|
+
}).describe("ID input field");
|
|
1706
|
+
var Checkbox = BaseField.extend({
|
|
1707
|
+
type: import_v43.default.literal(FieldType.CHECKBOX),
|
|
1708
|
+
defaultValue: CheckboxFieldValue.default(false)
|
|
1709
|
+
}).describe("Boolean checkbox field");
|
|
1710
|
+
var Country = BaseField.extend({
|
|
1711
|
+
type: import_v43.default.literal(FieldType.COUNTRY),
|
|
1712
|
+
defaultValue: NonEmptyTextValue.optional(),
|
|
1713
|
+
optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
|
|
1714
|
+
"Conditionals for specific countries. Countries not listed are always shown and enabled."
|
|
1715
|
+
)
|
|
1716
|
+
}).describe("Country select field");
|
|
1717
|
+
var AllowedLocations = JurisdictionReference.optional().describe(
|
|
1718
|
+
"Limits which location options are selectable depending on user jurisdiction and location."
|
|
1719
|
+
);
|
|
1720
|
+
var AdministrativeAreas = import_v43.default.enum([
|
|
1721
|
+
"ADMIN_STRUCTURE",
|
|
1722
|
+
"HEALTH_FACILITY",
|
|
1723
|
+
"CRVS_OFFICE"
|
|
1724
|
+
]);
|
|
1725
|
+
var AdministrativeAreaConfiguration = import_v43.default.object({
|
|
1726
|
+
partOf: FieldReference.optional().describe("Parent location"),
|
|
1727
|
+
type: AdministrativeAreas,
|
|
1728
|
+
allowedLocations: AllowedLocations
|
|
1729
|
+
}).describe("Administrative area options");
|
|
1730
|
+
var AdministrativeAreaField = BaseField.extend({
|
|
1731
|
+
type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
|
|
1732
|
+
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
1733
|
+
configuration: AdministrativeAreaConfiguration
|
|
1734
|
+
}).describe("Administrative area input field e.g. facility, office");
|
|
1735
|
+
var LocationInput = BaseField.extend({
|
|
1736
|
+
type: import_v43.default.literal(FieldType.LOCATION),
|
|
1737
|
+
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
1738
|
+
configuration: import_v43.default.object({
|
|
1739
|
+
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
1740
|
+
allowedLocations: AllowedLocations
|
|
1741
|
+
}).optional()
|
|
1742
|
+
}).describe("Input field for a location");
|
|
1743
|
+
var FileUploadWithOptions = BaseField.extend({
|
|
1744
|
+
type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
|
|
1745
|
+
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
1746
|
+
defaultValue: FileFieldWithOptionValue.optional(),
|
|
1747
|
+
configuration: import_v43.default.object({
|
|
1748
|
+
maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
|
1749
|
+
maxImageSize: import_v43.default.object({
|
|
1750
|
+
targetSize: import_v43.default.object({ width: import_v43.default.number(), height: import_v43.default.number() })
|
|
1751
|
+
}).optional(),
|
|
1752
|
+
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
|
1753
|
+
}).default({
|
|
1754
|
+
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
1755
|
+
})
|
|
1756
|
+
});
|
|
1757
|
+
var Facility = BaseField.extend({
|
|
1758
|
+
type: import_v43.default.literal(FieldType.FACILITY),
|
|
1759
|
+
defaultValue: NonEmptyTextValue.optional(),
|
|
1760
|
+
configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
|
|
1761
|
+
}).describe("Input field for a facility");
|
|
1762
|
+
var Office = BaseField.extend({
|
|
1763
|
+
type: import_v43.default.literal(FieldType.OFFICE),
|
|
1764
|
+
defaultValue: NonEmptyTextValue.optional(),
|
|
1765
|
+
configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
|
|
1766
|
+
}).describe("Input field for an office");
|
|
1767
|
+
var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
|
|
1768
|
+
administrativeArea: import_v43.default.union([UUID, SerializedUserField]).optional()
|
|
1769
|
+
});
|
|
1770
|
+
var commonDomesticFieldProps = {
|
|
1771
|
+
id: true,
|
|
1772
|
+
type: true,
|
|
1773
|
+
label: true,
|
|
1774
|
+
conditionals: true,
|
|
1775
|
+
required: true
|
|
1776
|
+
};
|
|
1777
|
+
var DomesticAddressField = Country.partial().pick({
|
|
1778
|
+
...commonDomesticFieldProps,
|
|
1779
|
+
optionOverrides: true
|
|
1780
|
+
}).required({ id: true, type: true }).or(
|
|
1781
|
+
AdministrativeAreaField.partial().pick(commonDomesticFieldProps).required({ id: true, type: true })
|
|
1782
|
+
);
|
|
1783
|
+
var Address = BaseField.extend({
|
|
1784
|
+
type: import_v43.default.literal(FieldType.ADDRESS),
|
|
1785
|
+
configuration: import_v43.default.object({
|
|
1786
|
+
lineSeparator: import_v43.default.string().optional(),
|
|
1787
|
+
fields: import_v43.default.array(DomesticAddressField).optional(),
|
|
1788
|
+
streetAddressForm: import_v43.default.array(
|
|
1789
|
+
import_v43.default.object({
|
|
1790
|
+
id: import_v43.default.string(),
|
|
1791
|
+
required: requiredSchema,
|
|
1792
|
+
label: TranslationConfig,
|
|
1793
|
+
type: import_v43.default.literal(FieldType.TEXT),
|
|
1794
|
+
conditionals: import_v43.default.array(FieldConditional).default([]).optional(),
|
|
1795
|
+
parent: FieldReference.optional()
|
|
1796
|
+
})
|
|
1797
|
+
).optional(),
|
|
1798
|
+
allowedLocations: AllowedLocations
|
|
1799
|
+
}).optional(),
|
|
1800
|
+
defaultValue: DefaultAddressFieldValue.optional()
|
|
1801
|
+
}).describe("Address input field \u2013 a combination of location and text fields");
|
|
1802
|
+
var StaticDataEntry = import_v43.default.object({
|
|
1803
|
+
id: import_v43.default.string().describe("ID for the data entry."),
|
|
1804
|
+
label: TranslationConfig,
|
|
1805
|
+
value: TranslationConfig.or(import_v43.default.string()).or(FieldReference)
|
|
1806
|
+
}).describe("Static data entry");
|
|
1807
|
+
var DataEntry = import_v43.default.union([StaticDataEntry, import_v43.default.object({ fieldId: import_v43.default.string() })]).describe(
|
|
1808
|
+
"Data entry can be either a static data entry, or a reference to another field in the current form or the declaration."
|
|
1809
|
+
);
|
|
1810
|
+
var DataField = BaseField.extend({
|
|
1811
|
+
type: import_v43.default.literal(FieldType.DATA),
|
|
1812
|
+
configuration: import_v43.default.object({
|
|
1813
|
+
subtitle: TranslationConfig.optional(),
|
|
1814
|
+
data: import_v43.default.array(DataEntry)
|
|
1815
|
+
})
|
|
1816
|
+
}).describe("Data field for displaying read-only data");
|
|
1817
|
+
var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
|
|
1818
|
+
var ButtonType = import_v43.default.enum([
|
|
1819
|
+
"primary",
|
|
1820
|
+
"secondary",
|
|
1821
|
+
"tertiary",
|
|
1822
|
+
"positive",
|
|
1823
|
+
"negative",
|
|
1824
|
+
"secondaryNegative",
|
|
1825
|
+
"icon",
|
|
1826
|
+
"iconPrimary"
|
|
1827
|
+
]);
|
|
1828
|
+
var TextColor = import_v43.default.enum(["primary", "copy"]);
|
|
1829
|
+
var TextVariant = import_v43.default.enum(["bold14", "reg14"]);
|
|
1830
|
+
var ButtonConfiguration = import_v43.default.object({
|
|
1831
|
+
icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit."),
|
|
1832
|
+
loading: import_v43.default.boolean().optional().describe("Whether the button is in a loading state and shows a spinner"),
|
|
1833
|
+
buttonSize: ButtonSize.optional().describe("Size of the button."),
|
|
1834
|
+
buttonType: ButtonType.optional().describe("Type of the button."),
|
|
1835
|
+
textColor: TextColor.optional().describe("Color of the text."),
|
|
1836
|
+
textVariant: TextVariant.optional().describe("Variant of the text."),
|
|
1837
|
+
text: TranslationConfig.describe("Text to display on the button")
|
|
1838
|
+
});
|
|
1839
|
+
var ButtonField = BaseField.extend({
|
|
1840
|
+
type: import_v43.default.literal(FieldType.BUTTON),
|
|
1841
|
+
defaultValue: ButtonFieldValue.optional(),
|
|
1842
|
+
configuration: ButtonConfiguration
|
|
1843
|
+
}).describe("Generic button without any built-in functionality");
|
|
1844
|
+
var FieldGroup = BaseField.extend({
|
|
1845
|
+
type: import_v43.default.literal(FieldType.FIELD_GROUP),
|
|
1846
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
1847
|
+
fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig))
|
|
1848
|
+
});
|
|
1849
|
+
var AlphaPrintButton = BaseField.extend({
|
|
1850
|
+
type: import_v43.default.literal(FieldType.ALPHA_PRINT_BUTTON),
|
|
1851
|
+
configuration: import_v43.default.object({
|
|
1852
|
+
template: import_v43.default.string().describe("Template ID from countryconfig templates to use for printing"),
|
|
1853
|
+
buttonLabel: TranslationConfig.optional().describe(
|
|
1854
|
+
"Label for the print button"
|
|
1855
|
+
)
|
|
1856
|
+
})
|
|
1857
|
+
}).describe("Print button field for printing certificates");
|
|
1858
|
+
var HttpField = BaseField.extend({
|
|
1859
|
+
type: import_v43.default.literal(FieldType.HTTP),
|
|
1860
|
+
defaultValue: HttpFieldValue.optional(),
|
|
1861
|
+
configuration: import_v43.default.object({
|
|
1862
|
+
trigger: FieldReference.optional().describe(
|
|
1863
|
+
"Reference to the field that triggers the HTTP request when its value changes. If not provided, the HTTP request is triggered once on component mount."
|
|
1864
|
+
),
|
|
1865
|
+
url: import_v43.default.string().describe("URL to send the HTTP request to"),
|
|
1866
|
+
method: import_v43.default.enum(["GET", "POST", "PUT", "DELETE"]),
|
|
1867
|
+
headers: import_v43.default.record(import_v43.default.string(), import_v43.default.string()).optional(),
|
|
1868
|
+
body: import_v43.default.record(import_v43.default.string(), import_v43.default.any()).optional(),
|
|
1869
|
+
errorValue: import_v43.default.any().optional().describe("Value to set if the request fails"),
|
|
1870
|
+
params: import_v43.default.record(import_v43.default.string(), import_v43.default.union([import_v43.default.string(), FieldReference])).optional(),
|
|
1871
|
+
timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
|
|
1872
|
+
})
|
|
1873
|
+
}).describe("HTTP request function triggered by a button click or other event");
|
|
1874
|
+
var AutocompleteField = BaseField.extend({
|
|
1875
|
+
type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
|
|
1876
|
+
configuration: import_v43.default.object({
|
|
1877
|
+
url: import_v43.default.string().describe("URL to fetch autocomplete suggestions from").optional(),
|
|
1878
|
+
method: import_v43.default.enum(["GET", "POST"]).default("GET").optional(),
|
|
1879
|
+
defaultOptions: import_v43.default.array(
|
|
1880
|
+
import_v43.default.object({
|
|
1881
|
+
label: import_v43.default.string(),
|
|
1882
|
+
value: import_v43.default.string()
|
|
1883
|
+
})
|
|
1884
|
+
).optional()
|
|
1885
|
+
})
|
|
1886
|
+
}).describe("Autocomplete input field");
|
|
1887
|
+
var SearchField = HttpField.extend({
|
|
1888
|
+
type: import_v43.default.literal(FieldType.SEARCH),
|
|
1889
|
+
configuration: SearchQuery.pick({
|
|
1890
|
+
query: true,
|
|
1891
|
+
limit: true,
|
|
1892
|
+
offset: true
|
|
1893
|
+
}).extend({
|
|
1894
|
+
validation: ValidationConfig,
|
|
1895
|
+
indicators: import_v43.default.object({
|
|
1896
|
+
loading: TranslationConfig.optional().describe(
|
|
1897
|
+
"Text to display while the search is in progress"
|
|
1898
|
+
),
|
|
1899
|
+
offline: TranslationConfig.optional().describe(
|
|
1900
|
+
"Text to display when the application is offline"
|
|
1901
|
+
),
|
|
1902
|
+
noResultsError: TranslationConfig.optional().describe(
|
|
1903
|
+
"Text to display when no results are found during the search"
|
|
1904
|
+
),
|
|
1905
|
+
httpError: TranslationConfig.optional().describe(
|
|
1906
|
+
"Text to display when there is an HTTP error during the search"
|
|
1907
|
+
),
|
|
1908
|
+
confirmButton: TranslationConfig.optional(),
|
|
1909
|
+
clearButton: TranslationConfig.optional(),
|
|
1910
|
+
clearModal: import_v43.default.object({
|
|
1911
|
+
title: TranslationConfig.optional(),
|
|
1912
|
+
description: TranslationConfig.optional(),
|
|
1913
|
+
cancel: TranslationConfig.optional(),
|
|
1914
|
+
confirm: TranslationConfig.optional()
|
|
1915
|
+
}).optional(),
|
|
1916
|
+
ok: TranslationConfig.optional()
|
|
1917
|
+
}).optional()
|
|
1918
|
+
})
|
|
1919
|
+
});
|
|
1920
|
+
var LinkButtonField = BaseField.extend({
|
|
1921
|
+
type: import_v43.default.literal(FieldType.LINK_BUTTON),
|
|
1922
|
+
configuration: import_v43.default.object({
|
|
1923
|
+
url: import_v43.default.string().describe("URL to open"),
|
|
1924
|
+
text: TranslationConfig.describe("Text to display on the button"),
|
|
1925
|
+
icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
|
|
1926
|
+
})
|
|
1927
|
+
}).describe("Button that opens a link");
|
|
1928
|
+
var VerificationStatus = BaseField.extend({
|
|
1929
|
+
type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
|
|
1930
|
+
defaultValue: VerificationStatusValue.optional(),
|
|
1931
|
+
configuration: import_v43.default.object({
|
|
1932
|
+
status: TranslationConfig.describe("Text to display on the status pill."),
|
|
1933
|
+
description: TranslationConfig.describe(
|
|
1934
|
+
"Explaining text on the banner in form."
|
|
1935
|
+
)
|
|
1936
|
+
})
|
|
1937
|
+
});
|
|
1938
|
+
var QueryParamReaderField = BaseField.extend({
|
|
1939
|
+
type: import_v43.default.literal(FieldType.QUERY_PARAM_READER),
|
|
1940
|
+
configuration: import_v43.default.object({
|
|
1941
|
+
pickParams: import_v43.default.array(import_v43.default.string()).describe("List of query parameters to read from the URL")
|
|
1942
|
+
})
|
|
1943
|
+
}).describe(
|
|
1944
|
+
"A field that maps URL query params into form values and clears them afterward"
|
|
1945
|
+
);
|
|
1946
|
+
var QrReaderField = BaseField.extend({
|
|
1947
|
+
type: import_v43.default.literal(FieldType.QR_READER),
|
|
1948
|
+
defaultValue: QrReaderFieldValue.optional(),
|
|
1949
|
+
configuration: import_v43.default.object({
|
|
1950
|
+
validator: import_v43.default.any().meta({
|
|
1951
|
+
description: "JSON Schema to validate the scanned QR code data against before populating the form fields.",
|
|
1952
|
+
id: "QrReaderFieldValidator"
|
|
1953
|
+
})
|
|
1954
|
+
}).optional()
|
|
1955
|
+
}).meta({
|
|
1956
|
+
description: "Configuration for QR code reader field, including optional JSON Schema validator.",
|
|
1957
|
+
id: "QrReaderField"
|
|
1958
|
+
});
|
|
1959
|
+
var IdReaderField = BaseField.extend({
|
|
1960
|
+
type: import_v43.default.literal(FieldType.ID_READER),
|
|
1961
|
+
defaultValue: IdReaderFieldValue.optional(),
|
|
1962
|
+
methods: import_v43.default.array(
|
|
1963
|
+
import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
|
|
1964
|
+
)
|
|
1965
|
+
});
|
|
1966
|
+
var CustomField = BaseField.extend({
|
|
1967
|
+
type: import_v43.default.literal(FieldType._EXPERIMENTAL_CUSTOM),
|
|
1968
|
+
defaultValue: CustomFieldValue.optional(),
|
|
1969
|
+
src: import_v43.default.string().describe("Module source path for the custom field component"),
|
|
1970
|
+
configuration: import_v43.default.unknown().optional()
|
|
1971
|
+
});
|
|
1972
|
+
var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
|
|
1973
|
+
var LoaderField = BaseField.extend({
|
|
1974
|
+
type: import_v43.default.literal(FieldType.LOADER),
|
|
1975
|
+
variant: FieldStyleVariant.default("default").optional(),
|
|
1976
|
+
hideLabel: import_v43.default.boolean().default(true).optional().describe("Loader field does not show a label by default"),
|
|
1977
|
+
configuration: import_v43.default.object({
|
|
1978
|
+
text: TranslationConfig.describe("Display text above the loading spinner")
|
|
1979
|
+
})
|
|
1980
|
+
}).describe(
|
|
1981
|
+
"A non-interactive field that indicates an in progress operation in form"
|
|
1982
|
+
);
|
|
1983
|
+
var HiddenField = BaseField.extend({
|
|
1984
|
+
type: import_v43.default.literal(FieldType.ALPHA_HIDDEN),
|
|
1985
|
+
required: import_v43.default.boolean().default(false).optional(),
|
|
1986
|
+
defaultValue: TextValue.optional()
|
|
1987
|
+
}).describe(
|
|
1988
|
+
"A non-interactive, hidden field that only hold a value in the form"
|
|
1989
|
+
);
|
|
1990
|
+
var UserRoleField = BaseField.extend({
|
|
1991
|
+
type: import_v43.default.literal(FieldType.USER_ROLE),
|
|
1992
|
+
defaultValue: TextValue.optional()
|
|
1993
|
+
}).describe(
|
|
1994
|
+
"A select dropdown that is automatically populated with available user roles"
|
|
1995
|
+
);
|
|
1996
|
+
var FieldConfig = import_v43.default.discriminatedUnion("type", [
|
|
1997
|
+
FieldGroup,
|
|
1998
|
+
Address,
|
|
1999
|
+
TextField,
|
|
2000
|
+
NumberField,
|
|
2001
|
+
NumberWithUnitField,
|
|
2002
|
+
TextAreaField,
|
|
2003
|
+
AgeField,
|
|
2004
|
+
DateField,
|
|
2005
|
+
TimeField,
|
|
2006
|
+
DateRangeField,
|
|
2007
|
+
SelectDateRangeField,
|
|
2008
|
+
ImageViewField,
|
|
2009
|
+
Paragraph,
|
|
2010
|
+
Heading,
|
|
2011
|
+
RadioGroup,
|
|
2012
|
+
BulletList,
|
|
2013
|
+
PageHeader,
|
|
2014
|
+
Select,
|
|
2015
|
+
NameField,
|
|
2016
|
+
PhoneField,
|
|
2017
|
+
IdField,
|
|
2018
|
+
Checkbox,
|
|
2019
|
+
File,
|
|
2020
|
+
Country,
|
|
2021
|
+
AdministrativeAreaField,
|
|
2022
|
+
Divider,
|
|
2023
|
+
LocationInput,
|
|
2024
|
+
Facility,
|
|
2025
|
+
Office,
|
|
2026
|
+
SignatureField,
|
|
2027
|
+
EmailField,
|
|
2028
|
+
FileUploadWithOptions,
|
|
2029
|
+
DataField,
|
|
2030
|
+
ButtonField,
|
|
2031
|
+
AlphaPrintButton,
|
|
2032
|
+
HttpField,
|
|
2033
|
+
AutocompleteField,
|
|
2034
|
+
LinkButtonField,
|
|
2035
|
+
VerificationStatus,
|
|
2036
|
+
QrReaderField,
|
|
2037
|
+
IdReaderField,
|
|
2038
|
+
QueryParamReaderField,
|
|
2039
|
+
LoaderField,
|
|
2040
|
+
SearchField,
|
|
2041
|
+
CustomField,
|
|
2042
|
+
HiddenField,
|
|
2043
|
+
UserRoleField
|
|
2044
|
+
]).meta({
|
|
2045
|
+
description: "Form field configuration",
|
|
2046
|
+
id: "FieldConfig"
|
|
2047
|
+
});
|
|
2048
|
+
var AnyFileField = import_v43.default.discriminatedUnion("type", [
|
|
2049
|
+
SignatureField,
|
|
2050
|
+
File,
|
|
2051
|
+
FileUploadWithOptions
|
|
2052
|
+
]);
|
|
2053
|
+
|
|
2054
|
+
// ../commons/src/application-config.ts
|
|
2055
|
+
var SearchCriteria = z20.enum([
|
|
2056
|
+
"TRACKING_ID",
|
|
2057
|
+
"REGISTRATION_NUMBER",
|
|
2058
|
+
"NATIONAL_ID",
|
|
2059
|
+
"NAME",
|
|
2060
|
+
"PHONE_NUMBER",
|
|
2061
|
+
"EMAIL"
|
|
2062
|
+
]);
|
|
2063
|
+
var ApplicationConfig = z20.object({
|
|
2064
|
+
APPLICATION_NAME: z20.string(),
|
|
2065
|
+
COUNTRY_LOGO: z20.object({
|
|
2066
|
+
fileName: z20.string(),
|
|
2067
|
+
file: z20.string()
|
|
2068
|
+
}),
|
|
2069
|
+
SYSTEM_IANA_TIMEZONE: z20.string(),
|
|
2070
|
+
CURRENCY: z20.object({
|
|
2071
|
+
languagesAndCountry: z20.array(z20.string()),
|
|
2072
|
+
isoCode: z20.string()
|
|
2073
|
+
}),
|
|
2074
|
+
ADMIN_STRUCTURE: z20.array(
|
|
2075
|
+
z20.object({
|
|
2076
|
+
id: z20.string(),
|
|
2077
|
+
label: TranslationConfig
|
|
2078
|
+
})
|
|
2079
|
+
),
|
|
2080
|
+
PHONE_NUMBER_PATTERN: z20.string().or(z20.instanceof(RegExp)),
|
|
2081
|
+
USER_NOTIFICATION_DELIVERY_METHOD: z20.string(),
|
|
2082
|
+
INFORMANT_NOTIFICATION_DELIVERY_METHOD: z20.string(),
|
|
2083
|
+
SEARCH_DEFAULT_CRITERIA: SearchCriteria.optional().default("TRACKING_ID"),
|
|
2084
|
+
ADDITIONAL_USER_FIELDS: z20.array(FieldConfig).optional().default([])
|
|
2085
|
+
});
|
|
2086
|
+
var defineApplicationConfig = (config) => {
|
|
2087
|
+
return ApplicationConfig.parse(config);
|
|
2088
|
+
};
|
|
2089
|
+
var BackgroundConfig = z20.object({
|
|
2090
|
+
backgroundColor: z20.string().optional(),
|
|
2091
|
+
backgroundImage: z20.string().optional(),
|
|
2092
|
+
imageFit: z20.string().optional()
|
|
2093
|
+
}).refine(
|
|
2094
|
+
(data) => !!(data.backgroundColor || data.backgroundImage),
|
|
2095
|
+
"backgroundColor and backgroundImage cannot be empty at the same time"
|
|
2096
|
+
);
|
|
2097
|
+
var LoginConfig = z20.object({
|
|
2098
|
+
COUNTRY: z20.string(),
|
|
2099
|
+
LANGUAGES: z20.array(z20.string()),
|
|
2100
|
+
USER_NOTIFICATION_DELIVERY_METHOD: z20.string(),
|
|
2101
|
+
INFORMANT_NOTIFICATION_DELIVERY_METHOD: z20.string(),
|
|
2102
|
+
PHONE_NUMBER_PATTERN: z20.string().or(z20.instanceof(RegExp)),
|
|
2103
|
+
LOGIN_BACKGROUND: BackgroundConfig,
|
|
2104
|
+
SENTRY: z20.string().optional()
|
|
2105
|
+
});
|
|
2106
|
+
var defineLoginConfig = (config) => {
|
|
2107
|
+
return LoginConfig.parse(config);
|
|
2108
|
+
};
|
|
2109
|
+
var ClientConfig = z20.object({
|
|
2110
|
+
COUNTRY: z20.string(),
|
|
2111
|
+
LANGUAGES: z20.array(z20.string()),
|
|
2112
|
+
SENTRY: z20.string().optional(),
|
|
2113
|
+
REGISTER_BACKGROUND: BackgroundConfig,
|
|
2114
|
+
DASHBOARDS: z20.array(
|
|
2115
|
+
z20.object({
|
|
2116
|
+
id: z20.string(),
|
|
2117
|
+
title: TranslationConfig,
|
|
2118
|
+
url: z20.string(),
|
|
2119
|
+
context: z20.object({
|
|
2120
|
+
auth: z20.literal("REQUEST_AUTH_TOKEN")
|
|
2121
|
+
}).optional()
|
|
2122
|
+
})
|
|
2123
|
+
),
|
|
2124
|
+
FEATURES: z20.object({ V2_EVENTS: z20.boolean().optional().default(true) }).optional().default({ V2_EVENTS: true })
|
|
2125
|
+
});
|
|
2126
|
+
var defineClientConfig = (config) => {
|
|
2127
|
+
return ClientConfig.parse(config);
|
|
2128
|
+
};
|