@opencrvs/toolkit 2.0.0-rc.e9457a7 → 2.0.0-rc.e9eb54d
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 +5 -4
- package/create-countryconfig/index.js +50 -20
- package/dist/application-config/index.js +70 -40
- package/dist/cli.js +3186 -4915
- package/dist/commons/api/router.d.ts +102 -17
- package/dist/commons/application-config/index.d.ts +1 -0
- package/dist/commons/conditionals/conditionals.d.ts +357 -7
- package/dist/commons/conditionals/validate.d.ts +51 -2
- package/dist/commons/events/ActionConfig.d.ts +204 -2
- package/dist/commons/events/ActionDocument.d.ts +6 -0
- package/dist/commons/events/ActionInput.d.ts +6 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +354 -0
- package/dist/commons/events/CountryConfigQueryInput.d.ts +42 -0
- package/dist/commons/events/EventConfig.d.ts +2 -0
- package/dist/commons/events/EventDocument.d.ts +3 -0
- package/dist/commons/events/EventIndex.d.ts +25 -0
- package/dist/commons/events/EventMetadata.d.ts +26 -0
- package/dist/commons/events/FieldConfig.d.ts +388 -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/locations.d.ts +1 -0
- package/dist/commons/events/state/flags.d.ts +16 -0
- package/dist/commons/events/state/index.d.ts +8 -0
- package/dist/commons/events/state/utils.d.ts +21 -287
- package/dist/commons/events/utils.d.ts +12 -1
- package/dist/conditionals/index.js +62 -6
- 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 +163 -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 +909 -154
- 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 +88 -5133
- package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts +3 -0
- package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts.map +1 -0
- package/dist/migrations/v2.1/add-explicit-correction-flags.js +234 -0
- package/dist/migrations/v2.1/index.d.ts +6 -0
- package/dist/migrations/v2.1/index.d.ts.map +1 -0
- package/dist/migrations/v2.1/index.js +218 -0
- package/dist/notification/index.js +719 -48
- package/dist/scopes/index.d.ts +93 -7
- package/dist/scopes/index.js +19 -8
- 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 +81 -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.e9eb54d.tgz +0 -0
- package/package.json +16 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.0.0-rc.e9457a7.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
|
|
@@ -51,8 +51,8 @@ mkdir -p ./dist/commons/application-config
|
|
|
51
51
|
cp -r ../commons/build/dist/common/application-config.d.ts ./dist/commons/application-config/index.d.ts
|
|
52
52
|
|
|
53
53
|
# Build migration CLI
|
|
54
|
-
npx esbuild src/migrations/v2.
|
|
55
|
-
chmod +x ./dist/migrations/v2.
|
|
54
|
+
npx esbuild src/migrations/v2.1/index.ts --bundle --format=cjs --outdir=./dist/migrations/v2.1 --allow-overwrite --packages=external --banner:js="#!/usr/bin/env node"
|
|
55
|
+
chmod +x ./dist/migrations/v2.1/index.js
|
|
56
56
|
|
|
57
57
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
58
58
|
sed -i '' 's|@opencrvs/events/build/types|../commons/api|g' dist/api/index.d.ts
|
|
@@ -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')
|
|
@@ -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",
|
|
@@ -659,11 +665,13 @@ var scopeOptionsPlaceEvent = z11.object({
|
|
|
659
665
|
event: scopeByEvent,
|
|
660
666
|
placeOfEvent: JurisdictionFilter.optional()
|
|
661
667
|
}).describe("Options applicable to all record scopes.");
|
|
662
|
-
var
|
|
668
|
+
var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
669
|
+
notifiedIn: JurisdictionFilter.optional(),
|
|
670
|
+
notifiedBy: UserFilter.optional(),
|
|
663
671
|
declaredIn: JurisdictionFilter.optional(),
|
|
664
672
|
declaredBy: UserFilter.optional()
|
|
665
673
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
666
|
-
var AllRecordScopeOptions =
|
|
674
|
+
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
667
675
|
registeredIn: JurisdictionFilter.optional(),
|
|
668
676
|
registeredBy: UserFilter.optional()
|
|
669
677
|
}).describe(
|
|
@@ -701,6 +709,8 @@ var ResolvedScopeOptionsPlaceEvent = z11.object({
|
|
|
701
709
|
"Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
|
|
702
710
|
);
|
|
703
711
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
712
|
+
notifiedIn: UUID.nullish(),
|
|
713
|
+
notifiedBy: z11.string().optional(),
|
|
704
714
|
declaredIn: UUID.nullish(),
|
|
705
715
|
declaredBy: z11.string().optional()
|
|
706
716
|
}).describe(
|
|
@@ -746,7 +756,7 @@ var RecordScopeV2 = z11.discriminatedUnion("type", [
|
|
|
746
756
|
}),
|
|
747
757
|
z11.object({
|
|
748
758
|
type: ScopesWithDeclaredOptions,
|
|
749
|
-
options:
|
|
759
|
+
options: scopeOptionsDeclaredOrNotified.optional()
|
|
750
760
|
}),
|
|
751
761
|
z11.object({
|
|
752
762
|
type: ScopesWithFullOptions,
|
|
@@ -835,8 +845,9 @@ var EncodedScope = z11.string().brand("EncodedScope");
|
|
|
835
845
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
836
846
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
837
847
|
accessLevel: JurisdictionFilter.enum.all,
|
|
838
|
-
|
|
839
|
-
declaredIn: JurisdictionFilter.enum.all
|
|
848
|
+
notifiedIn: JurisdictionFilter.enum.all,
|
|
849
|
+
declaredIn: JurisdictionFilter.enum.all,
|
|
850
|
+
registeredIn: JurisdictionFilter.enum.all
|
|
840
851
|
};
|
|
841
852
|
|
|
842
853
|
// ../commons/src/authentication.ts
|
|
@@ -989,8 +1000,9 @@ var RequestedCorrectionAction = ActionBase.extend(
|
|
|
989
1000
|
var ApprovedCorrectionAction = ActionBase.extend(
|
|
990
1001
|
z13.object({
|
|
991
1002
|
type: z13.literal(ActionType.APPROVE_CORRECTION),
|
|
992
|
-
requestId: z13.string()
|
|
1003
|
+
requestId: z13.string(),
|
|
993
1004
|
// TODO move into 'content' property
|
|
1005
|
+
content: z13.object({ immediateCorrection: z13.boolean().optional() }).optional()
|
|
994
1006
|
}).shape
|
|
995
1007
|
);
|
|
996
1008
|
var RejectedCorrectionAction = ActionBase.extend(
|
|
@@ -1124,6 +1136,7 @@ var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
|
1124
1136
|
)
|
|
1125
1137
|
});
|
|
1126
1138
|
var LegalStatuses = z15.object({
|
|
1139
|
+
[EventStatus.enum.NOTIFIED]: ActionCreationMetadata.nullish(),
|
|
1127
1140
|
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
|
1128
1141
|
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
|
1129
1142
|
});
|
|
@@ -1183,6 +1196,8 @@ var EventMetadataKeys = z15.enum(EventMetadataKeysArray);
|
|
|
1183
1196
|
var EventMetadataDateFieldIdInput = z15.enum([
|
|
1184
1197
|
"createdAt",
|
|
1185
1198
|
"updatedAt",
|
|
1199
|
+
"legalStatuses.NOTIFIED.createdAt",
|
|
1200
|
+
"legalStatuses.NOTIFIED.acceptedAt",
|
|
1186
1201
|
"legalStatuses.DECLARED.createdAt",
|
|
1187
1202
|
"legalStatuses.DECLARED.acceptedAt",
|
|
1188
1203
|
"legalStatuses.REGISTERED.createdAt",
|
|
@@ -1191,6 +1206,8 @@ var EventMetadataDateFieldIdInput = z15.enum([
|
|
|
1191
1206
|
var EventMetadataDateFieldId = z15.enum([
|
|
1192
1207
|
"event.createdAt",
|
|
1193
1208
|
"event.updatedAt",
|
|
1209
|
+
"event.legalStatuses.NOTIFIED.createdAt",
|
|
1210
|
+
"event.legalStatuses.NOTIFIED.acceptedAt",
|
|
1194
1211
|
"event.legalStatuses.DECLARED.createdAt",
|
|
1195
1212
|
"event.legalStatuses.DECLARED.acceptedAt",
|
|
1196
1213
|
"event.legalStatuses.REGISTERED.createdAt",
|
|
@@ -1253,7 +1270,8 @@ var Range = import_v4.z.object({
|
|
|
1253
1270
|
});
|
|
1254
1271
|
var ContainsFlags = import_v4.z.object({
|
|
1255
1272
|
anyOf: import_v4.z.array(Flag).optional(),
|
|
1256
|
-
noneOf: import_v4.z.array(Flag).optional()
|
|
1273
|
+
noneOf: import_v4.z.array(Flag).optional(),
|
|
1274
|
+
allOf: import_v4.z.array(Flag).optional()
|
|
1257
1275
|
}).meta({
|
|
1258
1276
|
id: "ContainsFlags"
|
|
1259
1277
|
});
|
|
@@ -1410,8 +1428,18 @@ var FieldReference = import_v43.default.object({
|
|
|
1410
1428
|
$$field: FieldId.describe("Id of the field to reference"),
|
|
1411
1429
|
$$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
|
|
1412
1430
|
'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
|
|
1431
|
+
),
|
|
1432
|
+
$$code: import_v43.default.string().optional().describe(
|
|
1433
|
+
"Serialised client-side function body. When present the expression is evaluated rather than dereferenced."
|
|
1434
|
+
)
|
|
1435
|
+
}).describe(
|
|
1436
|
+
"Reference to a field value, with an optional client-side computation applied."
|
|
1437
|
+
);
|
|
1438
|
+
var ComputedDefaultValue = import_v43.default.object({
|
|
1439
|
+
$$code: import_v43.default.string().describe(
|
|
1440
|
+
"Serialised client-side function body. Receives (undefined, context) where context includes $now, $online, and system variables."
|
|
1413
1441
|
)
|
|
1414
|
-
}).describe("
|
|
1442
|
+
}).describe("A context-only computation used as a field default value.");
|
|
1415
1443
|
var ValidationConfig = import_v43.default.object({
|
|
1416
1444
|
validator: Conditional.describe(
|
|
1417
1445
|
"Conditional expression that must hold for the field value to be considered valid."
|
|
@@ -1452,7 +1480,7 @@ var BaseField = import_v43.default.object({
|
|
|
1452
1480
|
"Indicates whether the field can be modified during record correction."
|
|
1453
1481
|
),
|
|
1454
1482
|
value: FieldReference.or(import_v43.default.array(FieldReference)).optional().describe(
|
|
1455
|
-
"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."
|
|
1483
|
+
"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."
|
|
1456
1484
|
),
|
|
1457
1485
|
analytics: import_v43.default.boolean().default(false).optional().describe(
|
|
1458
1486
|
"Indicates whether the field is included in analytics. When enabled, its value becomes available in the analytics dashboard."
|
|
@@ -1466,7 +1494,7 @@ var Divider = BaseField.extend({
|
|
|
1466
1494
|
});
|
|
1467
1495
|
var TextField = BaseField.extend({
|
|
1468
1496
|
type: import_v43.default.literal(FieldType.TEXT),
|
|
1469
|
-
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
1497
|
+
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
|
|
1470
1498
|
configuration: import_v43.default.object({
|
|
1471
1499
|
maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
|
|
1472
1500
|
type: import_v43.default.enum(["text", "password"]).optional(),
|
|
@@ -1479,10 +1507,11 @@ var TextField = BaseField.extend({
|
|
|
1479
1507
|
});
|
|
1480
1508
|
var NumberField = BaseField.extend({
|
|
1481
1509
|
type: import_v43.default.literal(FieldType.NUMBER),
|
|
1482
|
-
defaultValue: NumberFieldValue.optional(),
|
|
1510
|
+
defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
|
|
1483
1511
|
configuration: import_v43.default.object({
|
|
1484
1512
|
min: import_v43.default.number().optional().describe("Minimum value"),
|
|
1485
1513
|
max: import_v43.default.number().optional().describe("Maximum value"),
|
|
1514
|
+
integer: import_v43.default.boolean().optional().describe("When true, only whole numbers are allowed"),
|
|
1486
1515
|
prefix: TranslationConfig.optional(),
|
|
1487
1516
|
postfix: TranslationConfig.optional()
|
|
1488
1517
|
}).optional()
|
|
@@ -1492,7 +1521,7 @@ var NumberField = BaseField.extend({
|
|
|
1492
1521
|
});
|
|
1493
1522
|
var TextAreaField = BaseField.extend({
|
|
1494
1523
|
type: import_v43.default.literal(FieldType.TEXTAREA),
|
|
1495
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
1524
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1496
1525
|
configuration: import_v43.default.object({
|
|
1497
1526
|
maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
|
|
1498
1527
|
rows: import_v43.default.number().optional().describe("Number of visible text lines"),
|
|
@@ -1526,7 +1555,7 @@ var SignatureField = BaseField.extend({
|
|
|
1526
1555
|
signaturePromptLabel: TranslationConfig.describe(
|
|
1527
1556
|
"Title of the signature modal"
|
|
1528
1557
|
),
|
|
1529
|
-
defaultValue:
|
|
1558
|
+
defaultValue: SignatureFieldValue.or(ComputedDefaultValue).optional(),
|
|
1530
1559
|
configuration: import_v43.default.object({
|
|
1531
1560
|
maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
|
1532
1561
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
|
@@ -1542,14 +1571,14 @@ var EmailField = BaseField.extend({
|
|
|
1542
1571
|
configuration: import_v43.default.object({
|
|
1543
1572
|
maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
|
|
1544
1573
|
}).default({ maxLength: 255 }).optional(),
|
|
1545
|
-
defaultValue: NonEmptyTextValue.optional()
|
|
1574
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional()
|
|
1546
1575
|
}).meta({
|
|
1547
1576
|
description: "An email input field",
|
|
1548
1577
|
id: "EmailField"
|
|
1549
1578
|
});
|
|
1550
1579
|
var DateField = BaseField.extend({
|
|
1551
1580
|
type: import_v43.default.literal(FieldType.DATE),
|
|
1552
|
-
defaultValue: SerializedNowDateTime.or(PlainDate).optional().describe("Default date value(yyyy-MM-dd)"),
|
|
1581
|
+
defaultValue: SerializedNowDateTime.or(PlainDate).or(ComputedDefaultValue).optional().describe("Default date value(yyyy-MM-dd)"),
|
|
1553
1582
|
configuration: import_v43.default.object({
|
|
1554
1583
|
notice: TranslationConfig.describe(
|
|
1555
1584
|
"Text to display above the date input"
|
|
@@ -1561,7 +1590,7 @@ var DateField = BaseField.extend({
|
|
|
1561
1590
|
});
|
|
1562
1591
|
var AgeField = BaseField.extend({
|
|
1563
1592
|
type: import_v43.default.literal(FieldType.AGE),
|
|
1564
|
-
defaultValue: NumberFieldValue.optional(),
|
|
1593
|
+
defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
|
|
1565
1594
|
configuration: import_v43.default.object({
|
|
1566
1595
|
asOfDate: FieldReference,
|
|
1567
1596
|
prefix: TranslationConfig.optional(),
|
|
@@ -1573,7 +1602,7 @@ var AgeField = BaseField.extend({
|
|
|
1573
1602
|
});
|
|
1574
1603
|
var TimeField = BaseField.extend({
|
|
1575
1604
|
type: import_v43.default.literal(FieldType.TIME),
|
|
1576
|
-
defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
|
|
1605
|
+
defaultValue: SerializedNowDateTime.or(TimeValue).or(ComputedDefaultValue).optional().describe("Default time value (HH-mm)"),
|
|
1577
1606
|
configuration: import_v43.default.object({
|
|
1578
1607
|
use12HourFormat: import_v43.default.boolean().optional().describe("Whether to use 12-hour format"),
|
|
1579
1608
|
notice: TranslationConfig.describe(
|
|
@@ -1586,7 +1615,7 @@ var TimeField = BaseField.extend({
|
|
|
1586
1615
|
});
|
|
1587
1616
|
var DateRangeField = BaseField.extend({
|
|
1588
1617
|
type: import_v43.default.literal(FieldType.DATE_RANGE),
|
|
1589
|
-
defaultValue: DateRangeFieldValue.optional(),
|
|
1618
|
+
defaultValue: DateRangeFieldValue.or(ComputedDefaultValue).optional(),
|
|
1590
1619
|
configuration: import_v43.default.object({
|
|
1591
1620
|
notice: TranslationConfig.describe(
|
|
1592
1621
|
"Text to display above the date input"
|
|
@@ -1665,7 +1694,7 @@ var PageHeader = BaseField.extend({
|
|
|
1665
1694
|
});
|
|
1666
1695
|
var File = BaseField.extend({
|
|
1667
1696
|
type: import_v43.default.literal(FieldType.FILE),
|
|
1668
|
-
defaultValue: FileFieldValue.optional(),
|
|
1697
|
+
defaultValue: FileFieldValue.or(ComputedDefaultValue).optional(),
|
|
1669
1698
|
configuration: import_v43.default.object({
|
|
1670
1699
|
maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
|
1671
1700
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
|
|
@@ -1692,7 +1721,7 @@ var SelectOption = import_v43.default.object({
|
|
|
1692
1721
|
});
|
|
1693
1722
|
var NumberWithUnitField = BaseField.extend({
|
|
1694
1723
|
type: import_v43.default.literal(FieldType.NUMBER_WITH_UNIT),
|
|
1695
|
-
defaultValue: NumberWithUnitFieldValue.optional(),
|
|
1724
|
+
defaultValue: NumberWithUnitFieldValue.or(ComputedDefaultValue).optional(),
|
|
1696
1725
|
options: import_v43.default.array(SelectOption).describe("A list of options for the unit select"),
|
|
1697
1726
|
configuration: import_v43.default.object({
|
|
1698
1727
|
min: import_v43.default.number().optional().describe("Minimum value of the number field"),
|
|
@@ -1707,7 +1736,7 @@ var NumberWithUnitField = BaseField.extend({
|
|
|
1707
1736
|
});
|
|
1708
1737
|
var RadioGroup = BaseField.extend({
|
|
1709
1738
|
type: import_v43.default.literal(FieldType.RADIO_GROUP),
|
|
1710
|
-
defaultValue: TextValue.optional(),
|
|
1739
|
+
defaultValue: TextValue.or(ComputedDefaultValue).optional(),
|
|
1711
1740
|
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
1712
1741
|
configuration: import_v43.default.object({
|
|
1713
1742
|
styles: import_v43.default.object({
|
|
@@ -1732,7 +1761,7 @@ var BulletList = BaseField.extend({
|
|
|
1732
1761
|
});
|
|
1733
1762
|
var Select = BaseField.extend({
|
|
1734
1763
|
type: import_v43.default.literal(FieldType.SELECT),
|
|
1735
|
-
defaultValue: TextValue.optional(),
|
|
1764
|
+
defaultValue: TextValue.or(ComputedDefaultValue).optional(),
|
|
1736
1765
|
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
1737
1766
|
noOptionsMessage: TranslationConfig.optional().describe(
|
|
1738
1767
|
`
|
|
@@ -1754,7 +1783,7 @@ var SelectDateRangeOption = import_v43.default.object({
|
|
|
1754
1783
|
});
|
|
1755
1784
|
var SelectDateRangeField = BaseField.extend({
|
|
1756
1785
|
type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
|
|
1757
|
-
defaultValue: SelectDateRangeValue.optional(),
|
|
1786
|
+
defaultValue: SelectDateRangeValue.or(ComputedDefaultValue).optional(),
|
|
1758
1787
|
options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
|
|
1759
1788
|
}).meta({
|
|
1760
1789
|
description: "A date range selection field",
|
|
@@ -1771,7 +1800,7 @@ var NameField = BaseField.extend({
|
|
|
1771
1800
|
firstname: SerializedUserField.or(NonEmptyTextValue).optional(),
|
|
1772
1801
|
middlename: SerializedUserField.or(NonEmptyTextValue).optional(),
|
|
1773
1802
|
surname: SerializedUserField.or(NonEmptyTextValue).optional()
|
|
1774
|
-
}).optional(),
|
|
1803
|
+
}).or(ComputedDefaultValue).optional(),
|
|
1775
1804
|
configuration: import_v43.default.object({
|
|
1776
1805
|
name: NameConfig.default({
|
|
1777
1806
|
firstname: { required: true },
|
|
@@ -1795,14 +1824,14 @@ var NameField = BaseField.extend({
|
|
|
1795
1824
|
id: "NameField"
|
|
1796
1825
|
});
|
|
1797
1826
|
var PhoneField = BaseField.extend({
|
|
1798
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
1827
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1799
1828
|
type: import_v43.default.literal(FieldType.PHONE)
|
|
1800
1829
|
}).meta({
|
|
1801
1830
|
description: "A field for entering a phone number",
|
|
1802
1831
|
id: "PhoneField"
|
|
1803
1832
|
});
|
|
1804
1833
|
var IdField = BaseField.extend({
|
|
1805
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
1834
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1806
1835
|
type: import_v43.default.literal(FieldType.ID)
|
|
1807
1836
|
}).meta({
|
|
1808
1837
|
description: "A field for entering an ID",
|
|
@@ -1810,14 +1839,14 @@ var IdField = BaseField.extend({
|
|
|
1810
1839
|
});
|
|
1811
1840
|
var Checkbox = BaseField.extend({
|
|
1812
1841
|
type: import_v43.default.literal(FieldType.CHECKBOX),
|
|
1813
|
-
defaultValue: CheckboxFieldValue.default(false)
|
|
1842
|
+
defaultValue: CheckboxFieldValue.or(ComputedDefaultValue).default(false)
|
|
1814
1843
|
}).meta({
|
|
1815
1844
|
description: "A boolean checkbox field",
|
|
1816
1845
|
id: "Checkbox"
|
|
1817
1846
|
});
|
|
1818
1847
|
var Country = BaseField.extend({
|
|
1819
1848
|
type: import_v43.default.literal(FieldType.COUNTRY),
|
|
1820
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
1849
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1821
1850
|
optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
|
|
1822
1851
|
"Conditionals for specific countries. Countries not listed are always shown and enabled."
|
|
1823
1852
|
)
|
|
@@ -1835,7 +1864,7 @@ var AdministrativeAreas = import_v43.default.enum([
|
|
|
1835
1864
|
]);
|
|
1836
1865
|
var AdministrativeAreaField = BaseField.extend({
|
|
1837
1866
|
type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
|
|
1838
|
-
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
1867
|
+
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
|
|
1839
1868
|
configuration: import_v43.default.object({
|
|
1840
1869
|
partOf: FieldReference.optional().describe("Parent location"),
|
|
1841
1870
|
type: AdministrativeAreas,
|
|
@@ -1847,7 +1876,7 @@ var AdministrativeAreaField = BaseField.extend({
|
|
|
1847
1876
|
});
|
|
1848
1877
|
var LocationInput = BaseField.extend({
|
|
1849
1878
|
type: import_v43.default.literal(FieldType.LOCATION),
|
|
1850
|
-
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
1879
|
+
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
|
|
1851
1880
|
configuration: import_v43.default.object({
|
|
1852
1881
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
1853
1882
|
allowedLocations: AllowedLocations
|
|
@@ -1859,7 +1888,7 @@ var LocationInput = BaseField.extend({
|
|
|
1859
1888
|
var FileUploadWithOptions = BaseField.extend({
|
|
1860
1889
|
type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
|
|
1861
1890
|
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
1862
|
-
defaultValue: FileFieldWithOptionValue.optional(),
|
|
1891
|
+
defaultValue: FileFieldWithOptionValue.or(ComputedDefaultValue).optional(),
|
|
1863
1892
|
configuration: import_v43.default.object({
|
|
1864
1893
|
maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
|
1865
1894
|
maxImageSize: import_v43.default.object({
|
|
@@ -1875,12 +1904,12 @@ var FileUploadWithOptions = BaseField.extend({
|
|
|
1875
1904
|
});
|
|
1876
1905
|
var Facility = BaseField.extend({
|
|
1877
1906
|
type: import_v43.default.literal(FieldType.FACILITY),
|
|
1878
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
1907
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1879
1908
|
configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
|
|
1880
1909
|
}).describe("Input field for a facility");
|
|
1881
1910
|
var Office = BaseField.extend({
|
|
1882
1911
|
type: import_v43.default.literal(FieldType.OFFICE),
|
|
1883
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
1912
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1884
1913
|
configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
|
|
1885
1914
|
}).describe("Input field for an office");
|
|
1886
1915
|
var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
|
|
@@ -1916,7 +1945,7 @@ var Address = BaseField.extend({
|
|
|
1916
1945
|
).optional(),
|
|
1917
1946
|
allowedLocations: AllowedLocations
|
|
1918
1947
|
}).optional(),
|
|
1919
|
-
defaultValue: DefaultAddressFieldValue.optional()
|
|
1948
|
+
defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
|
|
1920
1949
|
}).meta({
|
|
1921
1950
|
description: "Address input field \u2013 a combination of location and text fields",
|
|
1922
1951
|
id: "Address"
|
|
@@ -1963,7 +1992,7 @@ var ButtonConfiguration = import_v43.default.object({
|
|
|
1963
1992
|
});
|
|
1964
1993
|
var ButtonField = BaseField.extend({
|
|
1965
1994
|
type: import_v43.default.literal(FieldType.BUTTON),
|
|
1966
|
-
defaultValue: ButtonFieldValue.optional(),
|
|
1995
|
+
defaultValue: ButtonFieldValue.or(ComputedDefaultValue).optional(),
|
|
1967
1996
|
configuration: ButtonConfiguration
|
|
1968
1997
|
}).meta({
|
|
1969
1998
|
description: "A generic button that can be used to trigger an action",
|
|
@@ -1991,7 +2020,7 @@ var AlphaPrintButton = BaseField.extend({
|
|
|
1991
2020
|
});
|
|
1992
2021
|
var HttpField = BaseField.extend({
|
|
1993
2022
|
type: import_v43.default.literal(FieldType.HTTP),
|
|
1994
|
-
defaultValue: HttpFieldValue.optional(),
|
|
2023
|
+
defaultValue: HttpFieldValue.or(ComputedDefaultValue).optional(),
|
|
1995
2024
|
configuration: import_v43.default.object({
|
|
1996
2025
|
trigger: FieldReference.optional().describe(
|
|
1997
2026
|
"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."
|
|
@@ -2077,7 +2106,7 @@ var LinkButtonField = BaseField.extend({
|
|
|
2077
2106
|
});
|
|
2078
2107
|
var VerificationStatus = BaseField.extend({
|
|
2079
2108
|
type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
|
|
2080
|
-
defaultValue: VerificationStatusValue.optional(),
|
|
2109
|
+
defaultValue: VerificationStatusValue.or(ComputedDefaultValue).optional(),
|
|
2081
2110
|
configuration: import_v43.default.object({
|
|
2082
2111
|
status: TranslationConfig.describe("Text to display on the status pill."),
|
|
2083
2112
|
description: TranslationConfig.describe(
|
|
@@ -2099,7 +2128,7 @@ var QueryParamReaderField = BaseField.extend({
|
|
|
2099
2128
|
});
|
|
2100
2129
|
var QrReaderField = BaseField.extend({
|
|
2101
2130
|
type: import_v43.default.literal(FieldType.QR_READER),
|
|
2102
|
-
defaultValue: QrReaderFieldValue.optional(),
|
|
2131
|
+
defaultValue: QrReaderFieldValue.or(ComputedDefaultValue).optional(),
|
|
2103
2132
|
configuration: import_v43.default.object({
|
|
2104
2133
|
validator: import_v43.default.any().meta({
|
|
2105
2134
|
description: "JSON Schema to validate the scanned QR code data against before populating the form fields.",
|
|
@@ -2112,7 +2141,7 @@ var QrReaderField = BaseField.extend({
|
|
|
2112
2141
|
});
|
|
2113
2142
|
var IdReaderField = BaseField.extend({
|
|
2114
2143
|
type: import_v43.default.literal(FieldType.ID_READER),
|
|
2115
|
-
defaultValue: IdReaderFieldValue.optional(),
|
|
2144
|
+
defaultValue: IdReaderFieldValue.or(ComputedDefaultValue).optional(),
|
|
2116
2145
|
methods: import_v43.default.array(
|
|
2117
2146
|
import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
|
|
2118
2147
|
)
|
|
@@ -2273,6 +2302,7 @@ var ClientConfig = z20.object({
|
|
|
2273
2302
|
COUNTRY: z20.string(),
|
|
2274
2303
|
LANGUAGES: z20.array(z20.string()),
|
|
2275
2304
|
SENTRY: z20.string().optional(),
|
|
2305
|
+
LOGIN_URL: z20.string().optional(),
|
|
2276
2306
|
REGISTER_BACKGROUND: BackgroundConfig,
|
|
2277
2307
|
DASHBOARDS: z20.array(
|
|
2278
2308
|
z20.object({
|