@opencrvs/toolkit 2.0.0-rc.4844c26 → 2.0.0-rc.484c28e
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/create-countryconfig/index.js +50 -20
- package/create-countryconfig/package.json +12 -2
- package/dist/application-config/index.js +70 -44
- package/dist/cli.js +9 -3
- package/dist/commons/api/router.d.ts +101 -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/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/Draft.d.ts +2 -3
- package/dist/commons/events/EventDocument.d.ts +3 -0
- package/dist/commons/events/FieldConfig.d.ts +378 -50
- package/dist/commons/events/FieldType.d.ts +1 -0
- package/dist/commons/events/FieldValue.d.ts +6 -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 +52 -1
- package/dist/events/index.js +729 -148
- package/dist/migrations/v2.0/index.js +9 -3
- package/dist/notification/index.js +586 -66
- package/dist/scopes/index.d.ts +4 -6
- package/dist/scopes/index.js +9 -3
- package/opencrvs-toolkit-2.0.0-rc.484c28e.tgz +0 -0
- package/package.json +6 -2
- package/opencrvs-toolkit-2.0.0-rc.4844c26.tgz +0 -0
|
@@ -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",
|
|
@@ -989,8 +995,9 @@ var RequestedCorrectionAction = ActionBase.extend(
|
|
|
989
995
|
var ApprovedCorrectionAction = ActionBase.extend(
|
|
990
996
|
z13.object({
|
|
991
997
|
type: z13.literal(ActionType.APPROVE_CORRECTION),
|
|
992
|
-
requestId: z13.string()
|
|
998
|
+
requestId: z13.string(),
|
|
993
999
|
// TODO move into 'content' property
|
|
1000
|
+
content: z13.object({ immediateCorrection: z13.boolean().optional() }).optional()
|
|
994
1001
|
}).shape
|
|
995
1002
|
);
|
|
996
1003
|
var RejectedCorrectionAction = ActionBase.extend(
|
|
@@ -1083,8 +1090,8 @@ var FlagConfig = z14.object({
|
|
|
1083
1090
|
),
|
|
1084
1091
|
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1085
1092
|
}).meta({
|
|
1086
|
-
|
|
1087
|
-
|
|
1093
|
+
id: "FlagConfig",
|
|
1094
|
+
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
1088
1095
|
});
|
|
1089
1096
|
var ActionFlagConfig = z14.object({
|
|
1090
1097
|
id: Flag,
|
|
@@ -1093,8 +1100,8 @@ var ActionFlagConfig = z14.object({
|
|
|
1093
1100
|
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1094
1101
|
)
|
|
1095
1102
|
}).meta({
|
|
1096
|
-
|
|
1097
|
-
|
|
1103
|
+
id: "ActionFlagConfig",
|
|
1104
|
+
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
1098
1105
|
});
|
|
1099
1106
|
|
|
1100
1107
|
// ../commons/src/events/EventMetadata.ts
|
|
@@ -1410,11 +1417,28 @@ var FieldReference = import_v43.default.object({
|
|
|
1410
1417
|
$$field: FieldId.describe("Id of the field to reference"),
|
|
1411
1418
|
$$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
|
|
1412
1419
|
'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
|
|
1420
|
+
),
|
|
1421
|
+
$$code: import_v43.default.string().optional().describe(
|
|
1422
|
+
"Serialised client-side function body. When present the expression is evaluated rather than dereferenced."
|
|
1413
1423
|
)
|
|
1414
|
-
}).describe(
|
|
1424
|
+
}).describe(
|
|
1425
|
+
"Reference to a field value, with an optional client-side computation applied."
|
|
1426
|
+
);
|
|
1427
|
+
var ComputedDefaultValue = import_v43.default.object({
|
|
1428
|
+
$$code: import_v43.default.string().describe(
|
|
1429
|
+
"Serialised client-side function body. Receives (undefined, context) where context includes $now, $online, and system variables."
|
|
1430
|
+
)
|
|
1431
|
+
}).describe("A context-only computation used as a field default value.");
|
|
1415
1432
|
var ValidationConfig = import_v43.default.object({
|
|
1416
|
-
validator: Conditional
|
|
1417
|
-
|
|
1433
|
+
validator: Conditional.describe(
|
|
1434
|
+
"Conditional expression that must hold for the field value to be considered valid."
|
|
1435
|
+
),
|
|
1436
|
+
message: TranslationConfig.describe(
|
|
1437
|
+
"Error message displayed when the validator does not hold."
|
|
1438
|
+
)
|
|
1439
|
+
}).meta({
|
|
1440
|
+
id: "ValidationConfig",
|
|
1441
|
+
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."
|
|
1418
1442
|
});
|
|
1419
1443
|
var requiredSchema = import_v43.default.union([
|
|
1420
1444
|
import_v43.default.boolean(),
|
|
@@ -1445,7 +1469,7 @@ var BaseField = import_v43.default.object({
|
|
|
1445
1469
|
"Indicates whether the field can be modified during record correction."
|
|
1446
1470
|
),
|
|
1447
1471
|
value: FieldReference.or(import_v43.default.array(FieldReference)).optional().describe(
|
|
1448
|
-
"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."
|
|
1472
|
+
"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."
|
|
1449
1473
|
),
|
|
1450
1474
|
analytics: import_v43.default.boolean().default(false).optional().describe(
|
|
1451
1475
|
"Indicates whether the field is included in analytics. When enabled, its value becomes available in the analytics dashboard."
|
|
@@ -1459,7 +1483,7 @@ var Divider = BaseField.extend({
|
|
|
1459
1483
|
});
|
|
1460
1484
|
var TextField = BaseField.extend({
|
|
1461
1485
|
type: import_v43.default.literal(FieldType.TEXT),
|
|
1462
|
-
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
1486
|
+
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
|
|
1463
1487
|
configuration: import_v43.default.object({
|
|
1464
1488
|
maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
|
|
1465
1489
|
type: import_v43.default.enum(["text", "password"]).optional(),
|
|
@@ -1472,10 +1496,11 @@ var TextField = BaseField.extend({
|
|
|
1472
1496
|
});
|
|
1473
1497
|
var NumberField = BaseField.extend({
|
|
1474
1498
|
type: import_v43.default.literal(FieldType.NUMBER),
|
|
1475
|
-
defaultValue: NumberFieldValue.optional(),
|
|
1499
|
+
defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
|
|
1476
1500
|
configuration: import_v43.default.object({
|
|
1477
1501
|
min: import_v43.default.number().optional().describe("Minimum value"),
|
|
1478
1502
|
max: import_v43.default.number().optional().describe("Maximum value"),
|
|
1503
|
+
integer: import_v43.default.boolean().optional().describe("When true, only whole numbers are allowed"),
|
|
1479
1504
|
prefix: TranslationConfig.optional(),
|
|
1480
1505
|
postfix: TranslationConfig.optional()
|
|
1481
1506
|
}).optional()
|
|
@@ -1485,7 +1510,7 @@ var NumberField = BaseField.extend({
|
|
|
1485
1510
|
});
|
|
1486
1511
|
var TextAreaField = BaseField.extend({
|
|
1487
1512
|
type: import_v43.default.literal(FieldType.TEXTAREA),
|
|
1488
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
1513
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1489
1514
|
configuration: import_v43.default.object({
|
|
1490
1515
|
maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
|
|
1491
1516
|
rows: import_v43.default.number().optional().describe("Number of visible text lines"),
|
|
@@ -1519,7 +1544,7 @@ var SignatureField = BaseField.extend({
|
|
|
1519
1544
|
signaturePromptLabel: TranslationConfig.describe(
|
|
1520
1545
|
"Title of the signature modal"
|
|
1521
1546
|
),
|
|
1522
|
-
defaultValue:
|
|
1547
|
+
defaultValue: SignatureFieldValue.or(ComputedDefaultValue).optional(),
|
|
1523
1548
|
configuration: import_v43.default.object({
|
|
1524
1549
|
maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
|
1525
1550
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
|
@@ -1535,14 +1560,14 @@ var EmailField = BaseField.extend({
|
|
|
1535
1560
|
configuration: import_v43.default.object({
|
|
1536
1561
|
maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
|
|
1537
1562
|
}).default({ maxLength: 255 }).optional(),
|
|
1538
|
-
defaultValue: NonEmptyTextValue.optional()
|
|
1563
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional()
|
|
1539
1564
|
}).meta({
|
|
1540
1565
|
description: "An email input field",
|
|
1541
1566
|
id: "EmailField"
|
|
1542
1567
|
});
|
|
1543
1568
|
var DateField = BaseField.extend({
|
|
1544
1569
|
type: import_v43.default.literal(FieldType.DATE),
|
|
1545
|
-
defaultValue: SerializedNowDateTime.or(PlainDate).optional().describe("Default date value(yyyy-MM-dd)"),
|
|
1570
|
+
defaultValue: SerializedNowDateTime.or(PlainDate).or(ComputedDefaultValue).optional().describe("Default date value(yyyy-MM-dd)"),
|
|
1546
1571
|
configuration: import_v43.default.object({
|
|
1547
1572
|
notice: TranslationConfig.describe(
|
|
1548
1573
|
"Text to display above the date input"
|
|
@@ -1554,7 +1579,7 @@ var DateField = BaseField.extend({
|
|
|
1554
1579
|
});
|
|
1555
1580
|
var AgeField = BaseField.extend({
|
|
1556
1581
|
type: import_v43.default.literal(FieldType.AGE),
|
|
1557
|
-
defaultValue: NumberFieldValue.optional(),
|
|
1582
|
+
defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
|
|
1558
1583
|
configuration: import_v43.default.object({
|
|
1559
1584
|
asOfDate: FieldReference,
|
|
1560
1585
|
prefix: TranslationConfig.optional(),
|
|
@@ -1566,7 +1591,7 @@ var AgeField = BaseField.extend({
|
|
|
1566
1591
|
});
|
|
1567
1592
|
var TimeField = BaseField.extend({
|
|
1568
1593
|
type: import_v43.default.literal(FieldType.TIME),
|
|
1569
|
-
defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
|
|
1594
|
+
defaultValue: SerializedNowDateTime.or(TimeValue).or(ComputedDefaultValue).optional().describe("Default time value (HH-mm)"),
|
|
1570
1595
|
configuration: import_v43.default.object({
|
|
1571
1596
|
use12HourFormat: import_v43.default.boolean().optional().describe("Whether to use 12-hour format"),
|
|
1572
1597
|
notice: TranslationConfig.describe(
|
|
@@ -1579,7 +1604,7 @@ var TimeField = BaseField.extend({
|
|
|
1579
1604
|
});
|
|
1580
1605
|
var DateRangeField = BaseField.extend({
|
|
1581
1606
|
type: import_v43.default.literal(FieldType.DATE_RANGE),
|
|
1582
|
-
defaultValue: DateRangeFieldValue.optional(),
|
|
1607
|
+
defaultValue: DateRangeFieldValue.or(ComputedDefaultValue).optional(),
|
|
1583
1608
|
configuration: import_v43.default.object({
|
|
1584
1609
|
notice: TranslationConfig.describe(
|
|
1585
1610
|
"Text to display above the date input"
|
|
@@ -1658,7 +1683,7 @@ var PageHeader = BaseField.extend({
|
|
|
1658
1683
|
});
|
|
1659
1684
|
var File = BaseField.extend({
|
|
1660
1685
|
type: import_v43.default.literal(FieldType.FILE),
|
|
1661
|
-
defaultValue: FileFieldValue.optional(),
|
|
1686
|
+
defaultValue: FileFieldValue.or(ComputedDefaultValue).optional(),
|
|
1662
1687
|
configuration: import_v43.default.object({
|
|
1663
1688
|
maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
|
1664
1689
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
|
|
@@ -1685,7 +1710,7 @@ var SelectOption = import_v43.default.object({
|
|
|
1685
1710
|
});
|
|
1686
1711
|
var NumberWithUnitField = BaseField.extend({
|
|
1687
1712
|
type: import_v43.default.literal(FieldType.NUMBER_WITH_UNIT),
|
|
1688
|
-
defaultValue: NumberWithUnitFieldValue.optional(),
|
|
1713
|
+
defaultValue: NumberWithUnitFieldValue.or(ComputedDefaultValue).optional(),
|
|
1689
1714
|
options: import_v43.default.array(SelectOption).describe("A list of options for the unit select"),
|
|
1690
1715
|
configuration: import_v43.default.object({
|
|
1691
1716
|
min: import_v43.default.number().optional().describe("Minimum value of the number field"),
|
|
@@ -1700,7 +1725,7 @@ var NumberWithUnitField = BaseField.extend({
|
|
|
1700
1725
|
});
|
|
1701
1726
|
var RadioGroup = BaseField.extend({
|
|
1702
1727
|
type: import_v43.default.literal(FieldType.RADIO_GROUP),
|
|
1703
|
-
defaultValue: TextValue.optional(),
|
|
1728
|
+
defaultValue: TextValue.or(ComputedDefaultValue).optional(),
|
|
1704
1729
|
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
1705
1730
|
configuration: import_v43.default.object({
|
|
1706
1731
|
styles: import_v43.default.object({
|
|
@@ -1725,7 +1750,7 @@ var BulletList = BaseField.extend({
|
|
|
1725
1750
|
});
|
|
1726
1751
|
var Select = BaseField.extend({
|
|
1727
1752
|
type: import_v43.default.literal(FieldType.SELECT),
|
|
1728
|
-
defaultValue: TextValue.optional(),
|
|
1753
|
+
defaultValue: TextValue.or(ComputedDefaultValue).optional(),
|
|
1729
1754
|
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
1730
1755
|
noOptionsMessage: TranslationConfig.optional().describe(
|
|
1731
1756
|
`
|
|
@@ -1747,7 +1772,7 @@ var SelectDateRangeOption = import_v43.default.object({
|
|
|
1747
1772
|
});
|
|
1748
1773
|
var SelectDateRangeField = BaseField.extend({
|
|
1749
1774
|
type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
|
|
1750
|
-
defaultValue: SelectDateRangeValue.optional(),
|
|
1775
|
+
defaultValue: SelectDateRangeValue.or(ComputedDefaultValue).optional(),
|
|
1751
1776
|
options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
|
|
1752
1777
|
}).meta({
|
|
1753
1778
|
description: "A date range selection field",
|
|
@@ -1764,7 +1789,7 @@ var NameField = BaseField.extend({
|
|
|
1764
1789
|
firstname: SerializedUserField.or(NonEmptyTextValue).optional(),
|
|
1765
1790
|
middlename: SerializedUserField.or(NonEmptyTextValue).optional(),
|
|
1766
1791
|
surname: SerializedUserField.or(NonEmptyTextValue).optional()
|
|
1767
|
-
}).optional(),
|
|
1792
|
+
}).or(ComputedDefaultValue).optional(),
|
|
1768
1793
|
configuration: import_v43.default.object({
|
|
1769
1794
|
name: NameConfig.default({
|
|
1770
1795
|
firstname: { required: true },
|
|
@@ -1788,14 +1813,14 @@ var NameField = BaseField.extend({
|
|
|
1788
1813
|
id: "NameField"
|
|
1789
1814
|
});
|
|
1790
1815
|
var PhoneField = BaseField.extend({
|
|
1791
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
1816
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1792
1817
|
type: import_v43.default.literal(FieldType.PHONE)
|
|
1793
1818
|
}).meta({
|
|
1794
1819
|
description: "A field for entering a phone number",
|
|
1795
1820
|
id: "PhoneField"
|
|
1796
1821
|
});
|
|
1797
1822
|
var IdField = BaseField.extend({
|
|
1798
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
1823
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1799
1824
|
type: import_v43.default.literal(FieldType.ID)
|
|
1800
1825
|
}).meta({
|
|
1801
1826
|
description: "A field for entering an ID",
|
|
@@ -1803,14 +1828,14 @@ var IdField = BaseField.extend({
|
|
|
1803
1828
|
});
|
|
1804
1829
|
var Checkbox = BaseField.extend({
|
|
1805
1830
|
type: import_v43.default.literal(FieldType.CHECKBOX),
|
|
1806
|
-
defaultValue: CheckboxFieldValue.default(false)
|
|
1831
|
+
defaultValue: CheckboxFieldValue.or(ComputedDefaultValue).default(false)
|
|
1807
1832
|
}).meta({
|
|
1808
1833
|
description: "A boolean checkbox field",
|
|
1809
1834
|
id: "Checkbox"
|
|
1810
1835
|
});
|
|
1811
1836
|
var Country = BaseField.extend({
|
|
1812
1837
|
type: import_v43.default.literal(FieldType.COUNTRY),
|
|
1813
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
1838
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1814
1839
|
optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
|
|
1815
1840
|
"Conditionals for specific countries. Countries not listed are always shown and enabled."
|
|
1816
1841
|
)
|
|
@@ -1828,7 +1853,7 @@ var AdministrativeAreas = import_v43.default.enum([
|
|
|
1828
1853
|
]);
|
|
1829
1854
|
var AdministrativeAreaField = BaseField.extend({
|
|
1830
1855
|
type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
|
|
1831
|
-
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
1856
|
+
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
|
|
1832
1857
|
configuration: import_v43.default.object({
|
|
1833
1858
|
partOf: FieldReference.optional().describe("Parent location"),
|
|
1834
1859
|
type: AdministrativeAreas,
|
|
@@ -1840,7 +1865,7 @@ var AdministrativeAreaField = BaseField.extend({
|
|
|
1840
1865
|
});
|
|
1841
1866
|
var LocationInput = BaseField.extend({
|
|
1842
1867
|
type: import_v43.default.literal(FieldType.LOCATION),
|
|
1843
|
-
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
1868
|
+
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
|
|
1844
1869
|
configuration: import_v43.default.object({
|
|
1845
1870
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
1846
1871
|
allowedLocations: AllowedLocations
|
|
@@ -1852,7 +1877,7 @@ var LocationInput = BaseField.extend({
|
|
|
1852
1877
|
var FileUploadWithOptions = BaseField.extend({
|
|
1853
1878
|
type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
|
|
1854
1879
|
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
1855
|
-
defaultValue: FileFieldWithOptionValue.optional(),
|
|
1880
|
+
defaultValue: FileFieldWithOptionValue.or(ComputedDefaultValue).optional(),
|
|
1856
1881
|
configuration: import_v43.default.object({
|
|
1857
1882
|
maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
|
1858
1883
|
maxImageSize: import_v43.default.object({
|
|
@@ -1868,12 +1893,12 @@ var FileUploadWithOptions = BaseField.extend({
|
|
|
1868
1893
|
});
|
|
1869
1894
|
var Facility = BaseField.extend({
|
|
1870
1895
|
type: import_v43.default.literal(FieldType.FACILITY),
|
|
1871
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
1896
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1872
1897
|
configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
|
|
1873
1898
|
}).describe("Input field for a facility");
|
|
1874
1899
|
var Office = BaseField.extend({
|
|
1875
1900
|
type: import_v43.default.literal(FieldType.OFFICE),
|
|
1876
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
1901
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1877
1902
|
configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
|
|
1878
1903
|
}).describe("Input field for an office");
|
|
1879
1904
|
var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
|
|
@@ -1909,7 +1934,7 @@ var Address = BaseField.extend({
|
|
|
1909
1934
|
).optional(),
|
|
1910
1935
|
allowedLocations: AllowedLocations
|
|
1911
1936
|
}).optional(),
|
|
1912
|
-
defaultValue: DefaultAddressFieldValue.optional()
|
|
1937
|
+
defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
|
|
1913
1938
|
}).meta({
|
|
1914
1939
|
description: "Address input field \u2013 a combination of location and text fields",
|
|
1915
1940
|
id: "Address"
|
|
@@ -1956,7 +1981,7 @@ var ButtonConfiguration = import_v43.default.object({
|
|
|
1956
1981
|
});
|
|
1957
1982
|
var ButtonField = BaseField.extend({
|
|
1958
1983
|
type: import_v43.default.literal(FieldType.BUTTON),
|
|
1959
|
-
defaultValue: ButtonFieldValue.optional(),
|
|
1984
|
+
defaultValue: ButtonFieldValue.or(ComputedDefaultValue).optional(),
|
|
1960
1985
|
configuration: ButtonConfiguration
|
|
1961
1986
|
}).meta({
|
|
1962
1987
|
description: "A generic button that can be used to trigger an action",
|
|
@@ -1984,7 +2009,7 @@ var AlphaPrintButton = BaseField.extend({
|
|
|
1984
2009
|
});
|
|
1985
2010
|
var HttpField = BaseField.extend({
|
|
1986
2011
|
type: import_v43.default.literal(FieldType.HTTP),
|
|
1987
|
-
defaultValue: HttpFieldValue.optional(),
|
|
2012
|
+
defaultValue: HttpFieldValue.or(ComputedDefaultValue).optional(),
|
|
1988
2013
|
configuration: import_v43.default.object({
|
|
1989
2014
|
trigger: FieldReference.optional().describe(
|
|
1990
2015
|
"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."
|
|
@@ -2070,7 +2095,7 @@ var LinkButtonField = BaseField.extend({
|
|
|
2070
2095
|
});
|
|
2071
2096
|
var VerificationStatus = BaseField.extend({
|
|
2072
2097
|
type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
|
|
2073
|
-
defaultValue: VerificationStatusValue.optional(),
|
|
2098
|
+
defaultValue: VerificationStatusValue.or(ComputedDefaultValue).optional(),
|
|
2074
2099
|
configuration: import_v43.default.object({
|
|
2075
2100
|
status: TranslationConfig.describe("Text to display on the status pill."),
|
|
2076
2101
|
description: TranslationConfig.describe(
|
|
@@ -2092,7 +2117,7 @@ var QueryParamReaderField = BaseField.extend({
|
|
|
2092
2117
|
});
|
|
2093
2118
|
var QrReaderField = BaseField.extend({
|
|
2094
2119
|
type: import_v43.default.literal(FieldType.QR_READER),
|
|
2095
|
-
defaultValue: QrReaderFieldValue.optional(),
|
|
2120
|
+
defaultValue: QrReaderFieldValue.or(ComputedDefaultValue).optional(),
|
|
2096
2121
|
configuration: import_v43.default.object({
|
|
2097
2122
|
validator: import_v43.default.any().meta({
|
|
2098
2123
|
description: "JSON Schema to validate the scanned QR code data against before populating the form fields.",
|
|
@@ -2105,7 +2130,7 @@ var QrReaderField = BaseField.extend({
|
|
|
2105
2130
|
});
|
|
2106
2131
|
var IdReaderField = BaseField.extend({
|
|
2107
2132
|
type: import_v43.default.literal(FieldType.ID_READER),
|
|
2108
|
-
defaultValue: IdReaderFieldValue.optional(),
|
|
2133
|
+
defaultValue: IdReaderFieldValue.or(ComputedDefaultValue).optional(),
|
|
2109
2134
|
methods: import_v43.default.array(
|
|
2110
2135
|
import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
|
|
2111
2136
|
)
|
|
@@ -2266,6 +2291,7 @@ var ClientConfig = z20.object({
|
|
|
2266
2291
|
COUNTRY: z20.string(),
|
|
2267
2292
|
LANGUAGES: z20.array(z20.string()),
|
|
2268
2293
|
SENTRY: z20.string().optional(),
|
|
2294
|
+
LOGIN_URL: z20.string().optional(),
|
|
2269
2295
|
REGISTER_BACKGROUND: BackgroundConfig,
|
|
2270
2296
|
DASHBOARDS: z20.array(
|
|
2271
2297
|
z20.object({
|
package/dist/cli.js
CHANGED
|
@@ -2382,14 +2382,20 @@ var encodeScope = (scope) => {
|
|
|
2382
2382
|
encode: false
|
|
2383
2383
|
});
|
|
2384
2384
|
};
|
|
2385
|
-
var
|
|
2386
|
-
|
|
2385
|
+
var decodedScopeCache = /* @__PURE__ */ new Map();
|
|
2386
|
+
var decodeScope = (encodedScope) => {
|
|
2387
|
+
if (decodedScopeCache.has(encodedScope)) {
|
|
2388
|
+
return decodedScopeCache.get(encodedScope);
|
|
2389
|
+
}
|
|
2390
|
+
const scope = qs.parse(encodedScope, {
|
|
2387
2391
|
ignoreQueryPrefix: true,
|
|
2388
2392
|
comma: true,
|
|
2389
2393
|
allowDots: true
|
|
2390
2394
|
});
|
|
2391
2395
|
const unflattenedScope = unflattenScope(scope);
|
|
2392
|
-
|
|
2396
|
+
const result = Scope2.safeParse(unflattenedScope)?.data;
|
|
2397
|
+
decodedScopeCache.set(encodedScope, result);
|
|
2398
|
+
return result;
|
|
2393
2399
|
};
|
|
2394
2400
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
2395
2401
|
placeOfEvent: JurisdictionFilter.enum.all,
|