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