@opencrvs/toolkit 2.0.0-rc.a928ed6 → 2.0.0-rc.a95fd2a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/build.sh +3 -2
- package/create-countryconfig/index.js +50 -20
- package/create-countryconfig/package.json +12 -2
- package/dist/application-config/index.js +82 -49
- package/dist/cli.js +3254 -46
- package/dist/commons/api/router.d.ts +108 -20
- package/dist/commons/application-config/index.d.ts +1 -0
- package/dist/commons/conditionals/conditionals.d.ts +354 -4
- package/dist/commons/conditionals/validate.d.ts +51 -2
- package/dist/commons/events/ActionConfig.d.ts +28 -2
- package/dist/commons/events/ActionDocument.d.ts +6 -0
- package/dist/commons/events/ActionInput.d.ts +42 -36
- package/dist/commons/events/AdvancedSearchConfig.d.ts +342 -0
- package/dist/commons/events/CountryConfigQueryInput.d.ts +42 -0
- package/dist/commons/events/Draft.d.ts +2 -3
- package/dist/commons/events/EventDocument.d.ts +3 -0
- package/dist/commons/events/EventIndex.d.ts +14 -0
- package/dist/commons/events/FieldConfig.d.ts +378 -50
- package/dist/commons/events/FieldType.d.ts +1 -0
- package/dist/commons/events/FieldTypeMapping.d.ts +1 -1
- package/dist/commons/events/FieldValue.d.ts +6 -0
- package/dist/commons/events/WorkqueueConfig.d.ts +39 -0
- package/dist/commons/events/field.d.ts +53 -1
- package/dist/commons/events/index.d.ts +2 -0
- package/dist/commons/events/state/flags.d.ts +16 -0
- package/dist/commons/events/state/utils.d.ts +12 -287
- package/dist/commons/events/utils.d.ts +12 -1
- package/dist/conditionals/index.js +55 -2
- package/dist/environment/custom-types.d.ts +33 -0
- package/dist/environment/custom-types.d.ts.map +1 -0
- package/dist/environment/custom-types.js +12 -0
- package/dist/environment/derived-variables.d.ts +134 -0
- package/dist/environment/derived-variables.d.ts.map +1 -0
- package/dist/environment/derived-variables.js +169 -0
- package/dist/environment/editor-questions.d.ts +4 -0
- package/dist/environment/editor-questions.d.ts.map +1 -0
- package/dist/environment/editor-questions.js +67 -0
- package/dist/environment/git.d.ts +5 -0
- package/dist/environment/git.d.ts.map +1 -0
- package/dist/environment/git.js +38 -0
- package/dist/environment/github.d.ts +26 -0
- package/dist/environment/github.d.ts.map +1 -0
- package/dist/environment/github.js +247 -0
- package/dist/environment/index.d.ts +5 -0
- package/dist/environment/index.d.ts.map +1 -0
- package/dist/environment/index.js +71 -0
- package/dist/environment/logger.d.ts +15 -0
- package/dist/environment/logger.d.ts.map +1 -0
- package/dist/environment/logger.js +25 -0
- package/dist/environment/manage-users.d.ts +11 -0
- package/dist/environment/manage-users.d.ts.map +1 -0
- package/dist/environment/manage-users.js +497 -0
- package/dist/environment/questions-helper.d.ts +15 -0
- package/dist/environment/questions-helper.d.ts.map +1 -0
- package/dist/environment/questions-helper.js +70 -0
- package/dist/environment/questions.d.ts +199 -0
- package/dist/environment/questions.d.ts.map +1 -0
- package/dist/environment/questions.js +412 -0
- package/dist/environment/setup-environment.d.ts +2 -0
- package/dist/environment/setup-environment.d.ts.map +1 -0
- package/dist/environment/setup-environment.js +794 -0
- package/dist/environment/ssh-keygen.d.ts +5 -0
- package/dist/environment/ssh-keygen.d.ts.map +1 -0
- package/dist/environment/ssh-keygen.js +21 -0
- package/dist/environment/swarm-to-k8s.d.ts +2 -0
- package/dist/environment/swarm-to-k8s.d.ts.map +1 -0
- package/dist/environment/swarm-to-k8s.js +173 -0
- package/dist/environment/templates.d.ts +27 -0
- package/dist/environment/templates.d.ts.map +1 -0
- package/dist/environment/templates.js +162 -0
- package/dist/environment/update-workflows.d.ts +2 -0
- package/dist/environment/update-workflows.d.ts.map +1 -0
- package/dist/environment/update-workflows.js +169 -0
- package/dist/environment/users.d.ts +2 -0
- package/dist/environment/users.d.ts.map +1 -0
- package/dist/environment/users.js +112 -0
- package/dist/environment/utils.d.ts +18 -0
- package/dist/environment/utils.d.ts.map +1 -0
- package/dist/environment/utils.js +100 -0
- package/dist/events/index.js +867 -174
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.js +1 -1
- package/dist/migrations/v2.0/index.js +13 -5
- package/dist/notification/index.js +701 -72
- package/dist/scopes/index.d.ts +4 -6
- package/dist/scopes/index.js +12 -4
- package/dist/templates/charts-values/dependencies/values.override.yaml +4 -0
- package/dist/templates/charts-values/dependencies/values.yaml +83 -0
- package/dist/templates/charts-values/opencrvs-services/values.override.yaml +4 -0
- package/dist/templates/charts-values/opencrvs-services/values.yaml +80 -0
- package/dist/templates/charts-values/traefik/values.override.yaml +4 -0
- package/dist/templates/charts-values/traefik/values.yaml +115 -0
- package/dist/templates/inventory/inventory.template.yml +100 -0
- package/dist/templates/inventory/production.example.yml +77 -0
- package/dist/templates/inventory/qa.example.yml +48 -0
- package/opencrvs-toolkit-2.0.0-rc.a95fd2a.tgz +0 -0
- package/package.json +20 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.0.0-rc.a928ed6.tgz +0 -0
package/README.md
CHANGED
|
@@ -14,6 +14,21 @@ src/
|
|
|
14
14
|
|
|
15
15
|
## Getting started
|
|
16
16
|
|
|
17
|
+
### Manage GitHub environments
|
|
18
|
+
|
|
19
|
+
All commands should be executed within infrastructure repository.
|
|
20
|
+
|
|
21
|
+
Run `opencrvs environment init` from the root of a infrastructure
|
|
22
|
+
repository to create new GitHub environment. Command requires valid GitHub token.
|
|
23
|
+
|
|
24
|
+
Other environment operations are available as separate commands:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
opencrvs environment update-workflows
|
|
28
|
+
opencrvs environment users
|
|
29
|
+
opencrvs environment swarm-to-k8s
|
|
30
|
+
```
|
|
31
|
+
|
|
17
32
|
### Development using yarn link
|
|
18
33
|
|
|
19
34
|
```
|
package/build.sh
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
1
3
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
4
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
5
|
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
@@ -7,8 +9,6 @@
|
|
|
7
9
|
#
|
|
8
10
|
# Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
|
|
9
11
|
|
|
10
|
-
#!/bin/bash
|
|
11
|
-
|
|
12
12
|
set -e
|
|
13
13
|
|
|
14
14
|
rm -rf dist
|
|
@@ -64,6 +64,7 @@ fi
|
|
|
64
64
|
|
|
65
65
|
# Build CLI
|
|
66
66
|
npx esbuild src/cli.ts --bundle --format=cjs --outdir=./dist --allow-overwrite --packages=external --banner:js="#!/usr/bin/env node"
|
|
67
|
+
cp -R src/environment/templates dist/templates
|
|
67
68
|
chmod +x ./dist/cli.js
|
|
68
69
|
|
|
69
70
|
echo "Build completed successfully."
|
|
@@ -15,7 +15,10 @@ const { execSync } = require('child_process')
|
|
|
15
15
|
const path = require('path')
|
|
16
16
|
const fs = require('fs')
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const COUNTRYCONFIG_REPO_URL =
|
|
19
|
+
'https://github.com/opencrvs/opencrvs-countryconfig.git'
|
|
20
|
+
const INFRASTRUCTURE_REPO_URL =
|
|
21
|
+
'https://github.com/opencrvs/infrastructure.git'
|
|
19
22
|
|
|
20
23
|
const projectName = process.argv[2]
|
|
21
24
|
|
|
@@ -26,48 +29,75 @@ if (!projectName) {
|
|
|
26
29
|
process.exit(1)
|
|
27
30
|
}
|
|
28
31
|
|
|
29
|
-
const
|
|
32
|
+
const countryconfigDirName = projectName + '-countryconfig'
|
|
33
|
+
const infrastructureDirName = projectName + '-infrastructure'
|
|
30
34
|
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
const countryconfigTargetDir = path.resolve(process.cwd(), countryconfigDirName)
|
|
36
|
+
const infrastructureTargetDir = path.resolve(process.cwd(), infrastructureDirName)
|
|
37
|
+
|
|
38
|
+
if (fs.existsSync(countryconfigTargetDir)) {
|
|
39
|
+
console.error('Error: Directory "' + countryconfigDirName + '" already exists.')
|
|
40
|
+
process.exit(1)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (fs.existsSync(infrastructureTargetDir)) {
|
|
44
|
+
console.error('Error: Directory "' + infrastructureDirName + '" already exists.')
|
|
33
45
|
process.exit(1)
|
|
34
46
|
}
|
|
35
47
|
|
|
36
|
-
console.log(
|
|
48
|
+
console.log('\nScaffolding OpenCRVS country config in ./' + countryconfigDirName + '...\n')
|
|
37
49
|
|
|
38
50
|
try {
|
|
39
|
-
execSync(
|
|
40
|
-
stdio: 'inherit'
|
|
41
|
-
})
|
|
51
|
+
execSync('git clone --depth 1 ' + COUNTRYCONFIG_REPO_URL + ' ' + countryconfigDirName, { stdio: 'inherit' })
|
|
42
52
|
} catch (err) {
|
|
43
|
-
console.error('Failed to clone the repository:', err.message)
|
|
53
|
+
console.error('Failed to clone the country config repository:', err.message)
|
|
44
54
|
process.exit(1)
|
|
45
55
|
}
|
|
46
56
|
|
|
47
57
|
try {
|
|
48
|
-
fs.rmSync(path.join(
|
|
58
|
+
fs.rmSync(path.join(countryconfigTargetDir, '.git'), { recursive: true, force: true })
|
|
49
59
|
} catch (err) {
|
|
50
|
-
console.error('Failed to remove .git directory:', err.message)
|
|
60
|
+
console.error('Failed to remove .git directory from country config:', err.message)
|
|
51
61
|
process.exit(1)
|
|
52
62
|
}
|
|
53
63
|
|
|
54
|
-
const pkgPath = path.join(
|
|
64
|
+
const pkgPath = path.join(countryconfigTargetDir, 'package.json')
|
|
55
65
|
if (fs.existsSync(pkgPath)) {
|
|
56
66
|
try {
|
|
57
67
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'))
|
|
58
|
-
pkg.name =
|
|
68
|
+
pkg.name = countryconfigDirName
|
|
59
69
|
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n')
|
|
60
70
|
} catch (err) {
|
|
61
71
|
console.error('Failed to update package.json:', err.message)
|
|
62
72
|
process.exit(1)
|
|
63
73
|
}
|
|
64
74
|
} else {
|
|
65
|
-
console.warn(
|
|
66
|
-
|
|
67
|
-
|
|
75
|
+
console.warn('Warning: No package.json found in the cloned country config repository. Project name was not updated.')
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
console.log('\nScaffolding OpenCRVS infrastructure in ./' + infrastructureDirName + '...\n')
|
|
79
|
+
|
|
80
|
+
try {
|
|
81
|
+
execSync('git clone --depth 1 ' + INFRASTRUCTURE_REPO_URL + ' ' + infrastructureDirName, { stdio: 'inherit' })
|
|
82
|
+
} catch (err) {
|
|
83
|
+
console.error('Failed to clone the infrastructure repository:', err.message)
|
|
84
|
+
process.exit(1)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
try {
|
|
88
|
+
fs.rmSync(path.join(infrastructureTargetDir, '.git'), { recursive: true, force: true })
|
|
89
|
+
} catch (err) {
|
|
90
|
+
console.error('Failed to remove .git directory from infrastructure:', err.message)
|
|
91
|
+
process.exit(1)
|
|
68
92
|
}
|
|
69
93
|
|
|
70
|
-
console.log(
|
|
71
|
-
console.log(
|
|
72
|
-
console.log(
|
|
73
|
-
console.log(
|
|
94
|
+
console.log('\nDone! Your project has been set up in two directories:\n')
|
|
95
|
+
console.log(' ./' + countryconfigDirName + ' -- country configuration')
|
|
96
|
+
console.log(' ./' + infrastructureDirName + ' -- server infrastructure\n')
|
|
97
|
+
console.log('To get started with the country config:\n')
|
|
98
|
+
console.log(' cd ' + countryconfigDirName)
|
|
99
|
+
console.log(' git init')
|
|
100
|
+
console.log(' npm install\n')
|
|
101
|
+
console.log('To get started with the infrastructure:\n')
|
|
102
|
+
console.log(' cd ' + infrastructureDirName)
|
|
103
|
+
console.log(' git init\n')
|
|
@@ -5,7 +5,17 @@
|
|
|
5
5
|
"bin": {
|
|
6
6
|
"create-countryconfig": "./index.js"
|
|
7
7
|
},
|
|
8
|
-
"
|
|
9
|
-
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/opencrvs/opencrvs-core.git"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"index.js"
|
|
14
|
+
],
|
|
15
|
+
"keywords": [
|
|
16
|
+
"opencrvs",
|
|
17
|
+
"countryconfig",
|
|
18
|
+
"create"
|
|
19
|
+
],
|
|
10
20
|
"license": "MPL-2.0"
|
|
11
21
|
}
|
|
@@ -76,8 +76,8 @@ var ActionConditional = z.discriminatedUnion("type", [
|
|
|
76
76
|
// Action can be shown to the user in the list but as disabled
|
|
77
77
|
EnableConditional
|
|
78
78
|
]).meta({
|
|
79
|
-
|
|
80
|
-
|
|
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
81
|
});
|
|
82
82
|
var DisplayOnReviewConditional = z.object({
|
|
83
83
|
type: z.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
@@ -93,8 +93,8 @@ var FieldConditional = z.discriminatedUnion("type", [
|
|
|
93
93
|
// Field output can be shown / hidden on the review page
|
|
94
94
|
DisplayOnReviewConditional
|
|
95
95
|
]).meta({
|
|
96
|
-
|
|
97
|
-
|
|
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
98
|
});
|
|
99
99
|
|
|
100
100
|
// ../commons/src/events/TranslationConfig.ts
|
|
@@ -206,6 +206,11 @@ var FieldTypesToHideInReview = [
|
|
|
206
206
|
FieldType.ALPHA_PRINT_BUTTON,
|
|
207
207
|
FieldType.ALPHA_HIDDEN
|
|
208
208
|
];
|
|
209
|
+
var HiddenFieldTypes = [
|
|
210
|
+
FieldType.HTTP,
|
|
211
|
+
FieldType.QUERY_PARAM_READER,
|
|
212
|
+
FieldType.ALPHA_HIDDEN
|
|
213
|
+
];
|
|
209
214
|
|
|
210
215
|
// ../commons/src/events/FieldValue.ts
|
|
211
216
|
var z7 = __toESM(require("zod/v4"));
|
|
@@ -324,7 +329,7 @@ var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date i
|
|
|
324
329
|
// ../commons/src/events/FieldValue.ts
|
|
325
330
|
var TextValue = z7.string();
|
|
326
331
|
var HiddenFieldValue = z7.string();
|
|
327
|
-
var NonEmptyTextValue =
|
|
332
|
+
var NonEmptyTextValue = z7.string().trim().min(1);
|
|
328
333
|
var DateValue = z7.iso.date().describe("Date in the format YYYY-MM-DD");
|
|
329
334
|
var AgeValue = z7.object({
|
|
330
335
|
age: z7.number(),
|
|
@@ -353,6 +358,7 @@ var DateRangeFieldValue = z7.object({
|
|
|
353
358
|
var EmailValue = z7.email();
|
|
354
359
|
var CheckboxFieldValue = z7.boolean();
|
|
355
360
|
var NumberFieldValue = z7.number();
|
|
361
|
+
var SignatureFieldValue = FileFieldValue;
|
|
356
362
|
var ButtonFieldValue = z7.number();
|
|
357
363
|
var VerificationStatusValue = z7.enum([
|
|
358
364
|
"verified",
|
|
@@ -834,7 +840,9 @@ var ScopeType = z11.enum([
|
|
|
834
840
|
var EncodedScope = z11.string().brand("EncodedScope");
|
|
835
841
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
836
842
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
837
|
-
accessLevel: JurisdictionFilter.enum.all
|
|
843
|
+
accessLevel: JurisdictionFilter.enum.all,
|
|
844
|
+
registeredIn: JurisdictionFilter.enum.all,
|
|
845
|
+
declaredIn: JurisdictionFilter.enum.all
|
|
838
846
|
};
|
|
839
847
|
|
|
840
848
|
// ../commons/src/authentication.ts
|
|
@@ -987,8 +995,9 @@ var RequestedCorrectionAction = ActionBase.extend(
|
|
|
987
995
|
var ApprovedCorrectionAction = ActionBase.extend(
|
|
988
996
|
z13.object({
|
|
989
997
|
type: z13.literal(ActionType.APPROVE_CORRECTION),
|
|
990
|
-
requestId: z13.string()
|
|
998
|
+
requestId: z13.string(),
|
|
991
999
|
// TODO move into 'content' property
|
|
1000
|
+
content: z13.object({ immediateCorrection: z13.boolean().optional() }).optional()
|
|
992
1001
|
}).shape
|
|
993
1002
|
);
|
|
994
1003
|
var RejectedCorrectionAction = ActionBase.extend(
|
|
@@ -1081,8 +1090,8 @@ var FlagConfig = z14.object({
|
|
|
1081
1090
|
),
|
|
1082
1091
|
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1083
1092
|
}).meta({
|
|
1084
|
-
|
|
1085
|
-
|
|
1093
|
+
id: "FlagConfig",
|
|
1094
|
+
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
1086
1095
|
});
|
|
1087
1096
|
var ActionFlagConfig = z14.object({
|
|
1088
1097
|
id: Flag,
|
|
@@ -1091,8 +1100,8 @@ var ActionFlagConfig = z14.object({
|
|
|
1091
1100
|
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1092
1101
|
)
|
|
1093
1102
|
}).meta({
|
|
1094
|
-
|
|
1095
|
-
|
|
1103
|
+
id: "ActionFlagConfig",
|
|
1104
|
+
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
1096
1105
|
});
|
|
1097
1106
|
|
|
1098
1107
|
// ../commons/src/events/EventMetadata.ts
|
|
@@ -1251,7 +1260,8 @@ var Range = import_v4.z.object({
|
|
|
1251
1260
|
});
|
|
1252
1261
|
var ContainsFlags = import_v4.z.object({
|
|
1253
1262
|
anyOf: import_v4.z.array(Flag).optional(),
|
|
1254
|
-
noneOf: import_v4.z.array(Flag).optional()
|
|
1263
|
+
noneOf: import_v4.z.array(Flag).optional(),
|
|
1264
|
+
allOf: import_v4.z.array(Flag).optional()
|
|
1255
1265
|
}).meta({
|
|
1256
1266
|
id: "ContainsFlags"
|
|
1257
1267
|
});
|
|
@@ -1408,11 +1418,28 @@ var FieldReference = import_v43.default.object({
|
|
|
1408
1418
|
$$field: FieldId.describe("Id of the field to reference"),
|
|
1409
1419
|
$$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
|
|
1410
1420
|
'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
|
|
1421
|
+
),
|
|
1422
|
+
$$code: import_v43.default.string().optional().describe(
|
|
1423
|
+
"Serialised client-side function body. When present the expression is evaluated rather than dereferenced."
|
|
1411
1424
|
)
|
|
1412
|
-
}).describe(
|
|
1425
|
+
}).describe(
|
|
1426
|
+
"Reference to a field value, with an optional client-side computation applied."
|
|
1427
|
+
);
|
|
1428
|
+
var ComputedDefaultValue = import_v43.default.object({
|
|
1429
|
+
$$code: import_v43.default.string().describe(
|
|
1430
|
+
"Serialised client-side function body. Receives (undefined, context) where context includes $now, $online, and system variables."
|
|
1431
|
+
)
|
|
1432
|
+
}).describe("A context-only computation used as a field default value.");
|
|
1413
1433
|
var ValidationConfig = import_v43.default.object({
|
|
1414
|
-
validator: Conditional
|
|
1415
|
-
|
|
1434
|
+
validator: Conditional.describe(
|
|
1435
|
+
"Conditional expression that must hold for the field value to be considered valid."
|
|
1436
|
+
),
|
|
1437
|
+
message: TranslationConfig.describe(
|
|
1438
|
+
"Error message displayed when the validator does not hold."
|
|
1439
|
+
)
|
|
1440
|
+
}).meta({
|
|
1441
|
+
id: "ValidationConfig",
|
|
1442
|
+
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."
|
|
1416
1443
|
});
|
|
1417
1444
|
var requiredSchema = import_v43.default.union([
|
|
1418
1445
|
import_v43.default.boolean(),
|
|
@@ -1443,7 +1470,7 @@ var BaseField = import_v43.default.object({
|
|
|
1443
1470
|
"Indicates whether the field can be modified during record correction."
|
|
1444
1471
|
),
|
|
1445
1472
|
value: FieldReference.or(import_v43.default.array(FieldReference)).optional().describe(
|
|
1446
|
-
"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."
|
|
1473
|
+
"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."
|
|
1447
1474
|
),
|
|
1448
1475
|
analytics: import_v43.default.boolean().default(false).optional().describe(
|
|
1449
1476
|
"Indicates whether the field is included in analytics. When enabled, its value becomes available in the analytics dashboard."
|
|
@@ -1457,7 +1484,7 @@ var Divider = BaseField.extend({
|
|
|
1457
1484
|
});
|
|
1458
1485
|
var TextField = BaseField.extend({
|
|
1459
1486
|
type: import_v43.default.literal(FieldType.TEXT),
|
|
1460
|
-
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
1487
|
+
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
|
|
1461
1488
|
configuration: import_v43.default.object({
|
|
1462
1489
|
maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
|
|
1463
1490
|
type: import_v43.default.enum(["text", "password"]).optional(),
|
|
@@ -1470,10 +1497,11 @@ var TextField = BaseField.extend({
|
|
|
1470
1497
|
});
|
|
1471
1498
|
var NumberField = BaseField.extend({
|
|
1472
1499
|
type: import_v43.default.literal(FieldType.NUMBER),
|
|
1473
|
-
defaultValue: NumberFieldValue.optional(),
|
|
1500
|
+
defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
|
|
1474
1501
|
configuration: import_v43.default.object({
|
|
1475
1502
|
min: import_v43.default.number().optional().describe("Minimum value"),
|
|
1476
1503
|
max: import_v43.default.number().optional().describe("Maximum value"),
|
|
1504
|
+
integer: import_v43.default.boolean().optional().describe("When true, only whole numbers are allowed"),
|
|
1477
1505
|
prefix: TranslationConfig.optional(),
|
|
1478
1506
|
postfix: TranslationConfig.optional()
|
|
1479
1507
|
}).optional()
|
|
@@ -1483,7 +1511,7 @@ var NumberField = BaseField.extend({
|
|
|
1483
1511
|
});
|
|
1484
1512
|
var TextAreaField = BaseField.extend({
|
|
1485
1513
|
type: import_v43.default.literal(FieldType.TEXTAREA),
|
|
1486
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
1514
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1487
1515
|
configuration: import_v43.default.object({
|
|
1488
1516
|
maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
|
|
1489
1517
|
rows: import_v43.default.number().optional().describe("Number of visible text lines"),
|
|
@@ -1517,7 +1545,7 @@ var SignatureField = BaseField.extend({
|
|
|
1517
1545
|
signaturePromptLabel: TranslationConfig.describe(
|
|
1518
1546
|
"Title of the signature modal"
|
|
1519
1547
|
),
|
|
1520
|
-
defaultValue:
|
|
1548
|
+
defaultValue: SignatureFieldValue.or(ComputedDefaultValue).optional(),
|
|
1521
1549
|
configuration: import_v43.default.object({
|
|
1522
1550
|
maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
|
1523
1551
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
|
@@ -1533,14 +1561,14 @@ var EmailField = BaseField.extend({
|
|
|
1533
1561
|
configuration: import_v43.default.object({
|
|
1534
1562
|
maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
|
|
1535
1563
|
}).default({ maxLength: 255 }).optional(),
|
|
1536
|
-
defaultValue: NonEmptyTextValue.optional()
|
|
1564
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional()
|
|
1537
1565
|
}).meta({
|
|
1538
1566
|
description: "An email input field",
|
|
1539
1567
|
id: "EmailField"
|
|
1540
1568
|
});
|
|
1541
1569
|
var DateField = BaseField.extend({
|
|
1542
1570
|
type: import_v43.default.literal(FieldType.DATE),
|
|
1543
|
-
defaultValue: SerializedNowDateTime.or(PlainDate).optional().describe("Default date value(yyyy-MM-dd)"),
|
|
1571
|
+
defaultValue: SerializedNowDateTime.or(PlainDate).or(ComputedDefaultValue).optional().describe("Default date value(yyyy-MM-dd)"),
|
|
1544
1572
|
configuration: import_v43.default.object({
|
|
1545
1573
|
notice: TranslationConfig.describe(
|
|
1546
1574
|
"Text to display above the date input"
|
|
@@ -1552,7 +1580,7 @@ var DateField = BaseField.extend({
|
|
|
1552
1580
|
});
|
|
1553
1581
|
var AgeField = BaseField.extend({
|
|
1554
1582
|
type: import_v43.default.literal(FieldType.AGE),
|
|
1555
|
-
defaultValue: NumberFieldValue.optional(),
|
|
1583
|
+
defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
|
|
1556
1584
|
configuration: import_v43.default.object({
|
|
1557
1585
|
asOfDate: FieldReference,
|
|
1558
1586
|
prefix: TranslationConfig.optional(),
|
|
@@ -1564,7 +1592,7 @@ var AgeField = BaseField.extend({
|
|
|
1564
1592
|
});
|
|
1565
1593
|
var TimeField = BaseField.extend({
|
|
1566
1594
|
type: import_v43.default.literal(FieldType.TIME),
|
|
1567
|
-
defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
|
|
1595
|
+
defaultValue: SerializedNowDateTime.or(TimeValue).or(ComputedDefaultValue).optional().describe("Default time value (HH-mm)"),
|
|
1568
1596
|
configuration: import_v43.default.object({
|
|
1569
1597
|
use12HourFormat: import_v43.default.boolean().optional().describe("Whether to use 12-hour format"),
|
|
1570
1598
|
notice: TranslationConfig.describe(
|
|
@@ -1577,7 +1605,7 @@ var TimeField = BaseField.extend({
|
|
|
1577
1605
|
});
|
|
1578
1606
|
var DateRangeField = BaseField.extend({
|
|
1579
1607
|
type: import_v43.default.literal(FieldType.DATE_RANGE),
|
|
1580
|
-
defaultValue: DateRangeFieldValue.optional(),
|
|
1608
|
+
defaultValue: DateRangeFieldValue.or(ComputedDefaultValue).optional(),
|
|
1581
1609
|
configuration: import_v43.default.object({
|
|
1582
1610
|
notice: TranslationConfig.describe(
|
|
1583
1611
|
"Text to display above the date input"
|
|
@@ -1656,7 +1684,7 @@ var PageHeader = BaseField.extend({
|
|
|
1656
1684
|
});
|
|
1657
1685
|
var File = BaseField.extend({
|
|
1658
1686
|
type: import_v43.default.literal(FieldType.FILE),
|
|
1659
|
-
defaultValue: FileFieldValue.optional(),
|
|
1687
|
+
defaultValue: FileFieldValue.or(ComputedDefaultValue).optional(),
|
|
1660
1688
|
configuration: import_v43.default.object({
|
|
1661
1689
|
maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
|
1662
1690
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
|
|
@@ -1683,7 +1711,7 @@ var SelectOption = import_v43.default.object({
|
|
|
1683
1711
|
});
|
|
1684
1712
|
var NumberWithUnitField = BaseField.extend({
|
|
1685
1713
|
type: import_v43.default.literal(FieldType.NUMBER_WITH_UNIT),
|
|
1686
|
-
defaultValue: NumberWithUnitFieldValue.optional(),
|
|
1714
|
+
defaultValue: NumberWithUnitFieldValue.or(ComputedDefaultValue).optional(),
|
|
1687
1715
|
options: import_v43.default.array(SelectOption).describe("A list of options for the unit select"),
|
|
1688
1716
|
configuration: import_v43.default.object({
|
|
1689
1717
|
min: import_v43.default.number().optional().describe("Minimum value of the number field"),
|
|
@@ -1698,7 +1726,7 @@ var NumberWithUnitField = BaseField.extend({
|
|
|
1698
1726
|
});
|
|
1699
1727
|
var RadioGroup = BaseField.extend({
|
|
1700
1728
|
type: import_v43.default.literal(FieldType.RADIO_GROUP),
|
|
1701
|
-
defaultValue: TextValue.optional(),
|
|
1729
|
+
defaultValue: TextValue.or(ComputedDefaultValue).optional(),
|
|
1702
1730
|
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
1703
1731
|
configuration: import_v43.default.object({
|
|
1704
1732
|
styles: import_v43.default.object({
|
|
@@ -1723,7 +1751,7 @@ var BulletList = BaseField.extend({
|
|
|
1723
1751
|
});
|
|
1724
1752
|
var Select = BaseField.extend({
|
|
1725
1753
|
type: import_v43.default.literal(FieldType.SELECT),
|
|
1726
|
-
defaultValue: TextValue.optional(),
|
|
1754
|
+
defaultValue: TextValue.or(ComputedDefaultValue).optional(),
|
|
1727
1755
|
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
1728
1756
|
noOptionsMessage: TranslationConfig.optional().describe(
|
|
1729
1757
|
`
|
|
@@ -1745,7 +1773,7 @@ var SelectDateRangeOption = import_v43.default.object({
|
|
|
1745
1773
|
});
|
|
1746
1774
|
var SelectDateRangeField = BaseField.extend({
|
|
1747
1775
|
type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
|
|
1748
|
-
defaultValue: SelectDateRangeValue.optional(),
|
|
1776
|
+
defaultValue: SelectDateRangeValue.or(ComputedDefaultValue).optional(),
|
|
1749
1777
|
options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
|
|
1750
1778
|
}).meta({
|
|
1751
1779
|
description: "A date range selection field",
|
|
@@ -1762,7 +1790,7 @@ var NameField = BaseField.extend({
|
|
|
1762
1790
|
firstname: SerializedUserField.or(NonEmptyTextValue).optional(),
|
|
1763
1791
|
middlename: SerializedUserField.or(NonEmptyTextValue).optional(),
|
|
1764
1792
|
surname: SerializedUserField.or(NonEmptyTextValue).optional()
|
|
1765
|
-
}).optional(),
|
|
1793
|
+
}).or(ComputedDefaultValue).optional(),
|
|
1766
1794
|
configuration: import_v43.default.object({
|
|
1767
1795
|
name: NameConfig.default({
|
|
1768
1796
|
firstname: { required: true },
|
|
@@ -1786,14 +1814,14 @@ var NameField = BaseField.extend({
|
|
|
1786
1814
|
id: "NameField"
|
|
1787
1815
|
});
|
|
1788
1816
|
var PhoneField = BaseField.extend({
|
|
1789
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
1817
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1790
1818
|
type: import_v43.default.literal(FieldType.PHONE)
|
|
1791
1819
|
}).meta({
|
|
1792
1820
|
description: "A field for entering a phone number",
|
|
1793
1821
|
id: "PhoneField"
|
|
1794
1822
|
});
|
|
1795
1823
|
var IdField = BaseField.extend({
|
|
1796
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
1824
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1797
1825
|
type: import_v43.default.literal(FieldType.ID)
|
|
1798
1826
|
}).meta({
|
|
1799
1827
|
description: "A field for entering an ID",
|
|
@@ -1801,14 +1829,14 @@ var IdField = BaseField.extend({
|
|
|
1801
1829
|
});
|
|
1802
1830
|
var Checkbox = BaseField.extend({
|
|
1803
1831
|
type: import_v43.default.literal(FieldType.CHECKBOX),
|
|
1804
|
-
defaultValue: CheckboxFieldValue.default(false)
|
|
1832
|
+
defaultValue: CheckboxFieldValue.or(ComputedDefaultValue).default(false)
|
|
1805
1833
|
}).meta({
|
|
1806
1834
|
description: "A boolean checkbox field",
|
|
1807
1835
|
id: "Checkbox"
|
|
1808
1836
|
});
|
|
1809
1837
|
var Country = BaseField.extend({
|
|
1810
1838
|
type: import_v43.default.literal(FieldType.COUNTRY),
|
|
1811
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
1839
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1812
1840
|
optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
|
|
1813
1841
|
"Conditionals for specific countries. Countries not listed are always shown and enabled."
|
|
1814
1842
|
)
|
|
@@ -1826,7 +1854,7 @@ var AdministrativeAreas = import_v43.default.enum([
|
|
|
1826
1854
|
]);
|
|
1827
1855
|
var AdministrativeAreaField = BaseField.extend({
|
|
1828
1856
|
type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
|
|
1829
|
-
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
1857
|
+
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
|
|
1830
1858
|
configuration: import_v43.default.object({
|
|
1831
1859
|
partOf: FieldReference.optional().describe("Parent location"),
|
|
1832
1860
|
type: AdministrativeAreas,
|
|
@@ -1838,7 +1866,7 @@ var AdministrativeAreaField = BaseField.extend({
|
|
|
1838
1866
|
});
|
|
1839
1867
|
var LocationInput = BaseField.extend({
|
|
1840
1868
|
type: import_v43.default.literal(FieldType.LOCATION),
|
|
1841
|
-
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
1869
|
+
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
|
|
1842
1870
|
configuration: import_v43.default.object({
|
|
1843
1871
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
1844
1872
|
allowedLocations: AllowedLocations
|
|
@@ -1850,7 +1878,7 @@ var LocationInput = BaseField.extend({
|
|
|
1850
1878
|
var FileUploadWithOptions = BaseField.extend({
|
|
1851
1879
|
type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
|
|
1852
1880
|
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
1853
|
-
defaultValue: FileFieldWithOptionValue.optional(),
|
|
1881
|
+
defaultValue: FileFieldWithOptionValue.or(ComputedDefaultValue).optional(),
|
|
1854
1882
|
configuration: import_v43.default.object({
|
|
1855
1883
|
maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
|
1856
1884
|
maxImageSize: import_v43.default.object({
|
|
@@ -1866,12 +1894,12 @@ var FileUploadWithOptions = BaseField.extend({
|
|
|
1866
1894
|
});
|
|
1867
1895
|
var Facility = BaseField.extend({
|
|
1868
1896
|
type: import_v43.default.literal(FieldType.FACILITY),
|
|
1869
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
1897
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1870
1898
|
configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
|
|
1871
1899
|
}).describe("Input field for a facility");
|
|
1872
1900
|
var Office = BaseField.extend({
|
|
1873
1901
|
type: import_v43.default.literal(FieldType.OFFICE),
|
|
1874
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
1902
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1875
1903
|
configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
|
|
1876
1904
|
}).describe("Input field for an office");
|
|
1877
1905
|
var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
|
|
@@ -1907,7 +1935,7 @@ var Address = BaseField.extend({
|
|
|
1907
1935
|
).optional(),
|
|
1908
1936
|
allowedLocations: AllowedLocations
|
|
1909
1937
|
}).optional(),
|
|
1910
|
-
defaultValue: DefaultAddressFieldValue.optional()
|
|
1938
|
+
defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
|
|
1911
1939
|
}).meta({
|
|
1912
1940
|
description: "Address input field \u2013 a combination of location and text fields",
|
|
1913
1941
|
id: "Address"
|
|
@@ -1954,7 +1982,7 @@ var ButtonConfiguration = import_v43.default.object({
|
|
|
1954
1982
|
});
|
|
1955
1983
|
var ButtonField = BaseField.extend({
|
|
1956
1984
|
type: import_v43.default.literal(FieldType.BUTTON),
|
|
1957
|
-
defaultValue: ButtonFieldValue.optional(),
|
|
1985
|
+
defaultValue: ButtonFieldValue.or(ComputedDefaultValue).optional(),
|
|
1958
1986
|
configuration: ButtonConfiguration
|
|
1959
1987
|
}).meta({
|
|
1960
1988
|
description: "A generic button that can be used to trigger an action",
|
|
@@ -1982,7 +2010,7 @@ var AlphaPrintButton = BaseField.extend({
|
|
|
1982
2010
|
});
|
|
1983
2011
|
var HttpField = BaseField.extend({
|
|
1984
2012
|
type: import_v43.default.literal(FieldType.HTTP),
|
|
1985
|
-
defaultValue: HttpFieldValue.optional(),
|
|
2013
|
+
defaultValue: HttpFieldValue.or(ComputedDefaultValue).optional(),
|
|
1986
2014
|
configuration: import_v43.default.object({
|
|
1987
2015
|
trigger: FieldReference.optional().describe(
|
|
1988
2016
|
"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."
|
|
@@ -2002,17 +2030,21 @@ var HttpField = BaseField.extend({
|
|
|
2002
2030
|
var AutocompleteField = BaseField.extend({
|
|
2003
2031
|
type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
|
|
2004
2032
|
configuration: import_v43.default.object({
|
|
2005
|
-
url: import_v43.default.string().describe(
|
|
2033
|
+
url: import_v43.default.string().describe(
|
|
2034
|
+
"URL to fetch autocomplete suggestions from. This should be a country config server endpoint."
|
|
2035
|
+
).optional(),
|
|
2006
2036
|
method: import_v43.default.enum(["GET", "POST"]).default("GET").optional(),
|
|
2007
2037
|
defaultOptions: import_v43.default.array(
|
|
2008
2038
|
import_v43.default.object({
|
|
2009
2039
|
label: import_v43.default.string(),
|
|
2010
2040
|
value: import_v43.default.string()
|
|
2011
2041
|
})
|
|
2012
|
-
).optional()
|
|
2042
|
+
).optional().describe(
|
|
2043
|
+
"Manual entry is supported through configuration, allowing users to provide values not currently represented in the dataset."
|
|
2044
|
+
)
|
|
2013
2045
|
})
|
|
2014
2046
|
}).meta({
|
|
2015
|
-
description: "
|
|
2047
|
+
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.",
|
|
2016
2048
|
id: "AutocompleteField"
|
|
2017
2049
|
});
|
|
2018
2050
|
var SearchField = HttpField.extend({
|
|
@@ -2064,7 +2096,7 @@ var LinkButtonField = BaseField.extend({
|
|
|
2064
2096
|
});
|
|
2065
2097
|
var VerificationStatus = BaseField.extend({
|
|
2066
2098
|
type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
|
|
2067
|
-
defaultValue: VerificationStatusValue.optional(),
|
|
2099
|
+
defaultValue: VerificationStatusValue.or(ComputedDefaultValue).optional(),
|
|
2068
2100
|
configuration: import_v43.default.object({
|
|
2069
2101
|
status: TranslationConfig.describe("Text to display on the status pill."),
|
|
2070
2102
|
description: TranslationConfig.describe(
|
|
@@ -2086,7 +2118,7 @@ var QueryParamReaderField = BaseField.extend({
|
|
|
2086
2118
|
});
|
|
2087
2119
|
var QrReaderField = BaseField.extend({
|
|
2088
2120
|
type: import_v43.default.literal(FieldType.QR_READER),
|
|
2089
|
-
defaultValue: QrReaderFieldValue.optional(),
|
|
2121
|
+
defaultValue: QrReaderFieldValue.or(ComputedDefaultValue).optional(),
|
|
2090
2122
|
configuration: import_v43.default.object({
|
|
2091
2123
|
validator: import_v43.default.any().meta({
|
|
2092
2124
|
description: "JSON Schema to validate the scanned QR code data against before populating the form fields.",
|
|
@@ -2099,7 +2131,7 @@ var QrReaderField = BaseField.extend({
|
|
|
2099
2131
|
});
|
|
2100
2132
|
var IdReaderField = BaseField.extend({
|
|
2101
2133
|
type: import_v43.default.literal(FieldType.ID_READER),
|
|
2102
|
-
defaultValue: IdReaderFieldValue.optional(),
|
|
2134
|
+
defaultValue: IdReaderFieldValue.or(ComputedDefaultValue).optional(),
|
|
2103
2135
|
methods: import_v43.default.array(
|
|
2104
2136
|
import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
|
|
2105
2137
|
)
|
|
@@ -2260,6 +2292,7 @@ var ClientConfig = z20.object({
|
|
|
2260
2292
|
COUNTRY: z20.string(),
|
|
2261
2293
|
LANGUAGES: z20.array(z20.string()),
|
|
2262
2294
|
SENTRY: z20.string().optional(),
|
|
2295
|
+
LOGIN_URL: z20.string().optional(),
|
|
2263
2296
|
REGISTER_BACKGROUND: BackgroundConfig,
|
|
2264
2297
|
DASHBOARDS: z20.array(
|
|
2265
2298
|
z20.object({
|