@opencrvs/toolkit 2.0.0-rc.e1f588f → 2.0.0-rc.e260b0b
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 +73 -0
- package/create-countryconfig/package.json +21 -0
- package/dist/application-config/index.js +259 -96
- package/dist/cli.js +539 -175
- package/dist/commons/api/router.d.ts +3344 -270
- package/dist/commons/application-config/index.d.ts +16 -4
- package/dist/commons/conditionals/conditionals.d.ts +6 -6
- package/dist/commons/conditionals/validate.d.ts +1 -0
- package/dist/commons/events/ActionInput.d.ts +108 -0
- package/dist/commons/events/Draft.d.ts +4 -2
- package/dist/commons/events/EventIndex.d.ts +0 -3
- package/dist/commons/events/EventMetadata.d.ts +0 -7
- package/dist/commons/events/FieldConfig.d.ts +10 -0
- package/dist/commons/events/WorkqueueConfig.d.ts +150 -150
- package/dist/commons/events/locations.d.ts +38 -1
- package/dist/commons/events/mocks.test.utils.d.ts +19 -0
- package/dist/commons/events/scopes.d.ts +24 -1
- package/dist/commons/events/state/index.d.ts +0 -4
- package/dist/commons/events/state/utils.d.ts +0 -2
- package/dist/commons/events/utils.d.ts +1 -1
- package/dist/conditionals/index.js +40 -8
- package/dist/events/index.js +432 -154
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -1
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +60 -35
- 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 -2
- package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +9 -1
- package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -1
- package/dist/migrations/v2.0/delete-infrastructure-directory.js +66 -20
- package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +3 -0
- package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +1 -0
- package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +110 -0
- package/dist/migrations/v2.0/index.d.ts +5 -3
- package/dist/migrations/v2.0/index.d.ts.map +1 -1
- package/dist/migrations/v2.0/index.js +537 -173
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -1
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +90 -1
- package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +11 -1
- package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -1
- package/dist/migrations/v2.0/merge-infrastructure-directory.js +17 -16
- package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
- package/dist/migrations/v2.0/migrate-scopes.js +54 -30
- package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
- package/dist/migrations/v2.0/migrate-workqueue-configs.js +140 -59
- package/dist/notification/index.js +326 -124
- package/dist/scopes/index.d.ts +87 -10
- package/dist/scopes/index.js +46 -9
- package/opencrvs-toolkit-2.0.0-rc.e260b0b.tgz +0 -0
- package/package.json +5 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.0.0-rc.e1f588f.tgz +0 -0
package/dist/events/index.js
CHANGED
|
@@ -243,6 +243,8 @@ __export(events_exports, {
|
|
|
243
243
|
areConditionsMet: () => areConditionsMet,
|
|
244
244
|
buildFormState: () => buildFormState,
|
|
245
245
|
canAccessEventWithScope: () => canAccessEventWithScope,
|
|
246
|
+
canAccessOtherUserWithScopes: () => canAccessOtherUserWithScopes,
|
|
247
|
+
canAccessUserWithScope: () => canAccessUserWithScope,
|
|
246
248
|
compositeFieldTypes: () => compositeFieldTypes,
|
|
247
249
|
createEmptyDraft: () => createEmptyDraft,
|
|
248
250
|
createFieldConditionals: () => createFieldConditionals,
|
|
@@ -300,12 +302,13 @@ __export(events_exports, {
|
|
|
300
302
|
getActionConfig: () => getActionConfig,
|
|
301
303
|
getActionReview: () => getActionReview,
|
|
302
304
|
getActionReviewFields: () => getActionReviewFields,
|
|
305
|
+
getAdministrativeAreaHierarchy: () => getAdministrativeAreaHierarchy,
|
|
303
306
|
getAllUniqueFields: () => getAllUniqueFields,
|
|
304
307
|
getAnnotationFromDrafts: () => getAnnotationFromDrafts,
|
|
305
308
|
getAssignedUserFromActions: () => getAssignedUserFromActions,
|
|
306
|
-
getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
|
|
307
309
|
getAssignmentStatus: () => getAssignmentStatus,
|
|
308
310
|
getAvailableActionsForEvent: () => getAvailableActionsForEvent,
|
|
311
|
+
getAvailableRolesForUserUpdatePayload: () => getAvailableRolesForUserUpdatePayload,
|
|
309
312
|
getCompleteActionAnnotation: () => getCompleteActionAnnotation,
|
|
310
313
|
getCompleteActionDeclaration: () => getCompleteActionDeclaration,
|
|
311
314
|
getCurrentEventState: () => getCurrentEventState,
|
|
@@ -316,6 +319,7 @@ __export(events_exports, {
|
|
|
316
319
|
getDeclarationPages: () => getDeclarationPages,
|
|
317
320
|
getEventConfigById: () => getEventConfigById,
|
|
318
321
|
getFilePathsFromEvent: () => getFilePathsFromEvent,
|
|
322
|
+
getLocationHierarchy: () => getLocationHierarchy,
|
|
319
323
|
getMixedPath: () => getMixedPath,
|
|
320
324
|
getPendingAction: () => getPendingAction,
|
|
321
325
|
getPrintCertificatePages: () => getPrintCertificatePages,
|
|
@@ -489,6 +493,10 @@ var scopeByEvent = z2.preprocess(
|
|
|
489
493
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
490
494
|
z2.array(z2.string()).optional()
|
|
491
495
|
).describe("Event type, e.g. birth, death");
|
|
496
|
+
var userRole = z2.preprocess(
|
|
497
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
498
|
+
z2.array(z2.string()).optional()
|
|
499
|
+
).describe("User role, e.g. admin, field agent");
|
|
492
500
|
var scopeOptionsPlaceEvent = z2.object({
|
|
493
501
|
event: scopeByEvent,
|
|
494
502
|
placeOfEvent: JurisdictionFilter.optional()
|
|
@@ -512,6 +520,9 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
|
512
520
|
var AccessLevelOptions = z2.object({
|
|
513
521
|
accessLevel: JurisdictionFilter.optional()
|
|
514
522
|
});
|
|
523
|
+
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
524
|
+
role: userRole.optional()
|
|
525
|
+
});
|
|
515
526
|
var WorkqueueOrDashboardOptions = z2.object({
|
|
516
527
|
ids: z2.preprocess(
|
|
517
528
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
@@ -521,6 +532,7 @@ var WorkqueueOrDashboardOptions = z2.object({
|
|
|
521
532
|
var AllScopeOptions = z2.object({
|
|
522
533
|
...AllRecordScopeOptions.shape,
|
|
523
534
|
...AccessLevelOptions.shape,
|
|
535
|
+
...AllUserScopeOptions.shape,
|
|
524
536
|
...WorkqueueOrDashboardOptions.shape
|
|
525
537
|
});
|
|
526
538
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
@@ -593,6 +605,33 @@ var RecordScopeV2 = z2.discriminatedUnion("type", [
|
|
|
593
605
|
]).describe(
|
|
594
606
|
"Scopes used to check user's permission to perform actions on a record."
|
|
595
607
|
);
|
|
608
|
+
var SystemScopeType = z2.enum([
|
|
609
|
+
"organisation.read-locations",
|
|
610
|
+
"user.read",
|
|
611
|
+
"user.create",
|
|
612
|
+
"user.edit",
|
|
613
|
+
"user.search"
|
|
614
|
+
]);
|
|
615
|
+
var UserScopeType = SystemScopeType.extract([
|
|
616
|
+
"user.read",
|
|
617
|
+
"user.create",
|
|
618
|
+
"user.edit",
|
|
619
|
+
"user.search"
|
|
620
|
+
]);
|
|
621
|
+
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
622
|
+
var UserScopeV2 = z2.discriminatedUnion("type", [
|
|
623
|
+
z2.object({
|
|
624
|
+
type: ScopesWithRoleOption,
|
|
625
|
+
options: AllUserScopeOptions.optional()
|
|
626
|
+
}),
|
|
627
|
+
z2.object({
|
|
628
|
+
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
629
|
+
options: AccessLevelOptions.optional()
|
|
630
|
+
})
|
|
631
|
+
]);
|
|
632
|
+
function scopeUsesRoleOptions(scope) {
|
|
633
|
+
return ScopesWithRoleOption?.options.some((opt) => opt === scope.type);
|
|
634
|
+
}
|
|
596
635
|
function scopeUsesDeclaredOptions(scope) {
|
|
597
636
|
return !ScopesWithPlaceEventOptions.options.some((opt) => opt === scope.type);
|
|
598
637
|
}
|
|
@@ -625,16 +664,14 @@ var ResolvedRecordScopeV2 = z2.discriminatedUnion("type", [
|
|
|
625
664
|
}).optional()
|
|
626
665
|
})
|
|
627
666
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
628
|
-
var SystemScopeType = z2.enum([
|
|
629
|
-
"organisation.read-locations",
|
|
630
|
-
"user.read",
|
|
631
|
-
"user.create",
|
|
632
|
-
"user.edit"
|
|
633
|
-
]);
|
|
634
667
|
var Scope = z2.discriminatedUnion("type", [
|
|
635
668
|
z2.object({ type: PlainScopeType }),
|
|
636
669
|
...RecordScopeV2.options,
|
|
637
|
-
|
|
670
|
+
...UserScopeV2.options,
|
|
671
|
+
z2.object({
|
|
672
|
+
type: z2.literal("organisation.read-locations"),
|
|
673
|
+
options: AccessLevelOptions.optional()
|
|
674
|
+
}),
|
|
638
675
|
z2.object({
|
|
639
676
|
type: z2.literal("workqueue"),
|
|
640
677
|
options: WorkqueueOrDashboardOptions
|
|
@@ -667,7 +704,9 @@ var decodeScope = (query) => {
|
|
|
667
704
|
};
|
|
668
705
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
669
706
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
670
|
-
accessLevel: JurisdictionFilter.enum.all
|
|
707
|
+
accessLevel: JurisdictionFilter.enum.all,
|
|
708
|
+
registeredIn: JurisdictionFilter.enum.all,
|
|
709
|
+
declaredIn: JurisdictionFilter.enum.all
|
|
671
710
|
};
|
|
672
711
|
function getAcceptedScopesByType({
|
|
673
712
|
acceptedScopes,
|
|
@@ -1040,7 +1079,10 @@ var ActionConditional = z7.discriminatedUnion("type", [
|
|
|
1040
1079
|
ShowConditional,
|
|
1041
1080
|
// Action can be shown to the user in the list but as disabled
|
|
1042
1081
|
EnableConditional
|
|
1043
|
-
])
|
|
1082
|
+
]).meta({
|
|
1083
|
+
id: "ActionConditional",
|
|
1084
|
+
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."
|
|
1085
|
+
});
|
|
1044
1086
|
var DisplayOnReviewConditional = z7.object({
|
|
1045
1087
|
type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
1046
1088
|
conditional: Conditional
|
|
@@ -1055,8 +1097,8 @@ var FieldConditional = z7.discriminatedUnion("type", [
|
|
|
1055
1097
|
// Field output can be shown / hidden on the review page
|
|
1056
1098
|
DisplayOnReviewConditional
|
|
1057
1099
|
]).meta({
|
|
1058
|
-
|
|
1059
|
-
|
|
1100
|
+
id: "FieldConditional",
|
|
1101
|
+
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."
|
|
1060
1102
|
});
|
|
1061
1103
|
|
|
1062
1104
|
// ../commons/src/events/FieldType.ts
|
|
@@ -1376,28 +1418,20 @@ function schemaPriority(schema) {
|
|
|
1376
1418
|
return idx === -1 ? 9999 : idx;
|
|
1377
1419
|
}
|
|
1378
1420
|
function safeUnion(schemas) {
|
|
1421
|
+
const sortedSchemas = [...schemas].sort(
|
|
1422
|
+
(a, b) => schemaPriority(a) - schemaPriority(b)
|
|
1423
|
+
);
|
|
1379
1424
|
return z12.any().superRefine((val, ctx) => {
|
|
1380
|
-
const
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
if (successful.length === 0) {
|
|
1385
|
-
ctx.addIssue({
|
|
1386
|
-
code: "invalid_type",
|
|
1387
|
-
expected: "custom",
|
|
1388
|
-
message: "Value does not match any schema"
|
|
1389
|
-
});
|
|
1390
|
-
return;
|
|
1391
|
-
}
|
|
1392
|
-
successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
|
|
1393
|
-
const best = successful[0];
|
|
1394
|
-
if (!best.safeParse(val).success) {
|
|
1395
|
-
ctx.addIssue({
|
|
1396
|
-
expected: "custom",
|
|
1397
|
-
code: "invalid_type",
|
|
1398
|
-
message: "Value did not match the best schema"
|
|
1399
|
-
});
|
|
1425
|
+
for (const schema of sortedSchemas) {
|
|
1426
|
+
if (schema.safeParse(val).success) {
|
|
1427
|
+
return;
|
|
1428
|
+
}
|
|
1400
1429
|
}
|
|
1430
|
+
ctx.addIssue({
|
|
1431
|
+
code: "invalid_type",
|
|
1432
|
+
expected: "custom",
|
|
1433
|
+
message: "Value does not match any schema"
|
|
1434
|
+
});
|
|
1401
1435
|
}).meta({
|
|
1402
1436
|
description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
|
|
1403
1437
|
});
|
|
@@ -1707,6 +1741,9 @@ var FlagConfig = z15.object({
|
|
|
1707
1741
|
"Indicates if this flag expects an action to be performed to be cleared."
|
|
1708
1742
|
),
|
|
1709
1743
|
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1744
|
+
}).meta({
|
|
1745
|
+
id: "FlagConfig",
|
|
1746
|
+
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
1710
1747
|
});
|
|
1711
1748
|
var ActionFlagConfig = z15.object({
|
|
1712
1749
|
id: Flag,
|
|
@@ -1714,6 +1751,9 @@ var ActionFlagConfig = z15.object({
|
|
|
1714
1751
|
conditional: Conditional.optional().describe(
|
|
1715
1752
|
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1716
1753
|
)
|
|
1754
|
+
}).meta({
|
|
1755
|
+
id: "ActionFlagConfig",
|
|
1756
|
+
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
1717
1757
|
});
|
|
1718
1758
|
|
|
1719
1759
|
// ../commons/src/events/EventMetadata.ts
|
|
@@ -1735,8 +1775,7 @@ var ActionCreationMetadata = z16.object({
|
|
|
1735
1775
|
),
|
|
1736
1776
|
createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1737
1777
|
acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
|
|
1738
|
-
createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1739
|
-
createdBySignature: z16.string().nullish().describe("Signature of the user who created the action request.")
|
|
1778
|
+
createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1740
1779
|
});
|
|
1741
1780
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
1742
1781
|
registrationNumber: z16.string().describe(
|
|
@@ -1764,9 +1803,6 @@ var EventMetadata = z16.object({
|
|
|
1764
1803
|
createdAtLocation: UUID.nullish().describe(
|
|
1765
1804
|
"Location of the user who created the event."
|
|
1766
1805
|
),
|
|
1767
|
-
createdBySignature: DocumentPath.nullish().describe(
|
|
1768
|
-
"Signature of the user who created the event."
|
|
1769
|
-
),
|
|
1770
1806
|
updatedAtLocation: UUID.nullish().describe(
|
|
1771
1807
|
"Location of the user who last changed the status."
|
|
1772
1808
|
),
|
|
@@ -2141,14 +2177,21 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
|
|
|
2141
2177
|
}
|
|
2142
2178
|
}).describe("Unique identifier for the field");
|
|
2143
2179
|
var FieldReference = import_v43.default.object({
|
|
2144
|
-
$$field: FieldId,
|
|
2180
|
+
$$field: FieldId.describe("Id of the field to reference"),
|
|
2145
2181
|
$$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
|
|
2146
2182
|
'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
|
|
2147
2183
|
)
|
|
2148
2184
|
}).describe("Reference to a field by its ID");
|
|
2149
2185
|
var ValidationConfig = import_v43.default.object({
|
|
2150
|
-
validator: Conditional
|
|
2151
|
-
|
|
2186
|
+
validator: Conditional.describe(
|
|
2187
|
+
"Conditional expression that must hold for the field value to be considered valid."
|
|
2188
|
+
),
|
|
2189
|
+
message: TranslationConfig.describe(
|
|
2190
|
+
"Error message displayed when the validator does not hold."
|
|
2191
|
+
)
|
|
2192
|
+
}).meta({
|
|
2193
|
+
id: "ValidationConfig",
|
|
2194
|
+
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."
|
|
2152
2195
|
});
|
|
2153
2196
|
var requiredSchema = import_v43.default.union([
|
|
2154
2197
|
import_v43.default.boolean(),
|
|
@@ -2187,6 +2230,9 @@ var BaseField = import_v43.default.object({
|
|
|
2187
2230
|
}).describe("Common properties shared across all field types.");
|
|
2188
2231
|
var Divider = BaseField.extend({
|
|
2189
2232
|
type: import_v43.default.literal(FieldType.DIVIDER)
|
|
2233
|
+
}).meta({
|
|
2234
|
+
description: "A horizontal line divider",
|
|
2235
|
+
id: "Divider"
|
|
2190
2236
|
});
|
|
2191
2237
|
var TextField = BaseField.extend({
|
|
2192
2238
|
type: import_v43.default.literal(FieldType.TEXT),
|
|
@@ -2197,7 +2243,10 @@ var TextField = BaseField.extend({
|
|
|
2197
2243
|
prefix: TranslationConfig.optional(),
|
|
2198
2244
|
postfix: TranslationConfig.optional()
|
|
2199
2245
|
}).default({ type: "text" }).optional()
|
|
2200
|
-
}).
|
|
2246
|
+
}).meta({
|
|
2247
|
+
description: "A text input field",
|
|
2248
|
+
id: "TextField"
|
|
2249
|
+
});
|
|
2201
2250
|
var NumberField = BaseField.extend({
|
|
2202
2251
|
type: import_v43.default.literal(FieldType.NUMBER),
|
|
2203
2252
|
defaultValue: NumberFieldValue.optional(),
|
|
@@ -2207,7 +2256,10 @@ var NumberField = BaseField.extend({
|
|
|
2207
2256
|
prefix: TranslationConfig.optional(),
|
|
2208
2257
|
postfix: TranslationConfig.optional()
|
|
2209
2258
|
}).optional()
|
|
2210
|
-
}).
|
|
2259
|
+
}).meta({
|
|
2260
|
+
description: "A number input field",
|
|
2261
|
+
id: "NumberField"
|
|
2262
|
+
});
|
|
2211
2263
|
var TextAreaField = BaseField.extend({
|
|
2212
2264
|
type: import_v43.default.literal(FieldType.TEXTAREA),
|
|
2213
2265
|
defaultValue: NonEmptyTextValue.optional(),
|
|
@@ -2218,7 +2270,10 @@ var TextAreaField = BaseField.extend({
|
|
|
2218
2270
|
prefix: TranslationConfig.optional(),
|
|
2219
2271
|
postfix: TranslationConfig.optional()
|
|
2220
2272
|
}).default({ rows: 4 }).optional()
|
|
2221
|
-
}).
|
|
2273
|
+
}).meta({
|
|
2274
|
+
description: "A multiline text input",
|
|
2275
|
+
id: "TextAreaField"
|
|
2276
|
+
});
|
|
2222
2277
|
var ImageMimeType = import_v43.default.enum([
|
|
2223
2278
|
"image/png",
|
|
2224
2279
|
"image/jpg",
|
|
@@ -2248,13 +2303,19 @@ var SignatureField = BaseField.extend({
|
|
|
2248
2303
|
}).default({
|
|
2249
2304
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2250
2305
|
})
|
|
2251
|
-
}).
|
|
2306
|
+
}).meta({
|
|
2307
|
+
description: "A signature input field",
|
|
2308
|
+
id: "SignatureField"
|
|
2309
|
+
});
|
|
2252
2310
|
var EmailField = BaseField.extend({
|
|
2253
2311
|
type: import_v43.default.literal(FieldType.EMAIL),
|
|
2254
2312
|
configuration: import_v43.default.object({
|
|
2255
2313
|
maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
|
|
2256
2314
|
}).default({ maxLength: 255 }).optional(),
|
|
2257
2315
|
defaultValue: NonEmptyTextValue.optional()
|
|
2316
|
+
}).meta({
|
|
2317
|
+
description: "An email input field",
|
|
2318
|
+
id: "EmailField"
|
|
2258
2319
|
});
|
|
2259
2320
|
var DateField = BaseField.extend({
|
|
2260
2321
|
type: import_v43.default.literal(FieldType.DATE),
|
|
@@ -2264,7 +2325,10 @@ var DateField = BaseField.extend({
|
|
|
2264
2325
|
"Text to display above the date input"
|
|
2265
2326
|
).optional()
|
|
2266
2327
|
}).optional()
|
|
2267
|
-
}).
|
|
2328
|
+
}).meta({
|
|
2329
|
+
description: "A date input (yyyy-MM-dd)",
|
|
2330
|
+
id: "DateField"
|
|
2331
|
+
});
|
|
2268
2332
|
var AgeField = BaseField.extend({
|
|
2269
2333
|
type: import_v43.default.literal(FieldType.AGE),
|
|
2270
2334
|
defaultValue: NumberFieldValue.optional(),
|
|
@@ -2273,7 +2337,10 @@ var AgeField = BaseField.extend({
|
|
|
2273
2337
|
prefix: TranslationConfig.optional(),
|
|
2274
2338
|
postfix: TranslationConfig.optional()
|
|
2275
2339
|
})
|
|
2276
|
-
}).
|
|
2340
|
+
}).meta({
|
|
2341
|
+
description: "An age input field which uses the current date as the asOfDate",
|
|
2342
|
+
id: "AgeField"
|
|
2343
|
+
});
|
|
2277
2344
|
var TimeField = BaseField.extend({
|
|
2278
2345
|
type: import_v43.default.literal(FieldType.TIME),
|
|
2279
2346
|
defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
|
|
@@ -2283,7 +2350,10 @@ var TimeField = BaseField.extend({
|
|
|
2283
2350
|
"Text to display above the time input"
|
|
2284
2351
|
).optional()
|
|
2285
2352
|
}).optional()
|
|
2286
|
-
}).
|
|
2353
|
+
}).meta({
|
|
2354
|
+
description: "A single time input (HH-mm)",
|
|
2355
|
+
id: "TimeField"
|
|
2356
|
+
});
|
|
2287
2357
|
var DateRangeField = BaseField.extend({
|
|
2288
2358
|
type: import_v43.default.literal(FieldType.DATE_RANGE),
|
|
2289
2359
|
defaultValue: DateRangeFieldValue.optional(),
|
|
@@ -2292,7 +2362,10 @@ var DateRangeField = BaseField.extend({
|
|
|
2292
2362
|
"Text to display above the date input"
|
|
2293
2363
|
).optional()
|
|
2294
2364
|
}).optional()
|
|
2295
|
-
}).
|
|
2365
|
+
}).meta({
|
|
2366
|
+
description: "A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })",
|
|
2367
|
+
id: "DateRangeField"
|
|
2368
|
+
});
|
|
2296
2369
|
var HtmlFontVariant = import_v43.default.enum([
|
|
2297
2370
|
"reg12",
|
|
2298
2371
|
"reg14",
|
|
@@ -2336,18 +2409,30 @@ var ImageViewField = BaseField.extend({
|
|
|
2336
2409
|
type: import_v43.default.literal(FieldType.IMAGE_VIEW),
|
|
2337
2410
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2338
2411
|
configuration: ImageConfiguration
|
|
2339
|
-
}).
|
|
2412
|
+
}).meta({
|
|
2413
|
+
description: "A read-only image component for form pages",
|
|
2414
|
+
id: "ImageViewField"
|
|
2415
|
+
});
|
|
2340
2416
|
var Paragraph = BaseField.extend({
|
|
2341
2417
|
type: import_v43.default.literal(FieldType.PARAGRAPH),
|
|
2342
2418
|
configuration: ParagraphConfiguration
|
|
2343
|
-
}).
|
|
2419
|
+
}).meta({
|
|
2420
|
+
description: "A read-only HTML <p> paragraph",
|
|
2421
|
+
id: "Paragraph"
|
|
2422
|
+
});
|
|
2344
2423
|
var Heading = BaseField.extend({
|
|
2345
2424
|
type: import_v43.default.literal(FieldType.HEADING),
|
|
2346
2425
|
configuration: HeadingConfiguration
|
|
2347
|
-
}).
|
|
2426
|
+
}).meta({
|
|
2427
|
+
description: "A read-only heading component for form pages",
|
|
2428
|
+
id: "Heading"
|
|
2429
|
+
});
|
|
2348
2430
|
var PageHeader = BaseField.extend({
|
|
2349
2431
|
type: import_v43.default.literal(FieldType.PAGE_HEADER)
|
|
2350
|
-
}).
|
|
2432
|
+
}).meta({
|
|
2433
|
+
description: "A read-only header component for form pages",
|
|
2434
|
+
id: "PageHeader"
|
|
2435
|
+
});
|
|
2351
2436
|
var File = BaseField.extend({
|
|
2352
2437
|
type: import_v43.default.literal(FieldType.FILE),
|
|
2353
2438
|
defaultValue: FileFieldValue.optional(),
|
|
@@ -2366,7 +2451,10 @@ var File = BaseField.extend({
|
|
|
2366
2451
|
}).default({
|
|
2367
2452
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2368
2453
|
})
|
|
2369
|
-
}).
|
|
2454
|
+
}).meta({
|
|
2455
|
+
description: "A file upload field",
|
|
2456
|
+
id: "File"
|
|
2457
|
+
});
|
|
2370
2458
|
var SelectOption = import_v43.default.object({
|
|
2371
2459
|
value: import_v43.default.string().describe("The value of the option"),
|
|
2372
2460
|
label: import_v43.default.union([import_v43.default.string(), TranslationConfig]).describe("The label of the option"),
|
|
@@ -2383,7 +2471,10 @@ var NumberWithUnitField = BaseField.extend({
|
|
|
2383
2471
|
"Placeholder for the number field"
|
|
2384
2472
|
)
|
|
2385
2473
|
}).optional()
|
|
2386
|
-
}).
|
|
2474
|
+
}).meta({
|
|
2475
|
+
description: "A number with unit input field",
|
|
2476
|
+
id: "NumberWithUnitField"
|
|
2477
|
+
});
|
|
2387
2478
|
var RadioGroup = BaseField.extend({
|
|
2388
2479
|
type: import_v43.default.literal(FieldType.RADIO_GROUP),
|
|
2389
2480
|
defaultValue: TextValue.optional(),
|
|
@@ -2393,7 +2484,10 @@ var RadioGroup = BaseField.extend({
|
|
|
2393
2484
|
size: import_v43.default.enum(["NORMAL", "LARGE"]).optional()
|
|
2394
2485
|
}).optional()
|
|
2395
2486
|
}).optional()
|
|
2396
|
-
}).
|
|
2487
|
+
}).meta({
|
|
2488
|
+
description: "A grouped radio button field",
|
|
2489
|
+
id: "RadioGroup"
|
|
2490
|
+
});
|
|
2397
2491
|
var BulletList = BaseField.extend({
|
|
2398
2492
|
type: import_v43.default.literal(FieldType.BULLET_LIST),
|
|
2399
2493
|
items: import_v43.default.array(TranslationConfig).describe("A list of items"),
|
|
@@ -2402,7 +2496,10 @@ var BulletList = BaseField.extend({
|
|
|
2402
2496
|
fontVariant: HtmlFontVariant.optional()
|
|
2403
2497
|
}).optional()
|
|
2404
2498
|
}).default({})
|
|
2405
|
-
}).
|
|
2499
|
+
}).meta({
|
|
2500
|
+
description: "A list of bullet points",
|
|
2501
|
+
id: "BulletList"
|
|
2502
|
+
});
|
|
2406
2503
|
var Select = BaseField.extend({
|
|
2407
2504
|
type: import_v43.default.literal(FieldType.SELECT),
|
|
2408
2505
|
defaultValue: TextValue.optional(),
|
|
@@ -2417,7 +2514,10 @@ var Select = BaseField.extend({
|
|
|
2417
2514
|
{ ..., defaultMessage: "'{input}' is not listed among the health facilities." }
|
|
2418
2515
|
`
|
|
2419
2516
|
)
|
|
2420
|
-
}).
|
|
2517
|
+
}).meta({
|
|
2518
|
+
description: "A select input field",
|
|
2519
|
+
id: "Select"
|
|
2520
|
+
});
|
|
2421
2521
|
var SelectDateRangeOption = import_v43.default.object({
|
|
2422
2522
|
value: SelectDateRangeValue.describe("The value of the option"),
|
|
2423
2523
|
label: TranslationConfig.describe("The label of the option")
|
|
@@ -2426,7 +2526,10 @@ var SelectDateRangeField = BaseField.extend({
|
|
|
2426
2526
|
type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
|
|
2427
2527
|
defaultValue: SelectDateRangeValue.optional(),
|
|
2428
2528
|
options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
|
|
2429
|
-
}).
|
|
2529
|
+
}).meta({
|
|
2530
|
+
description: "A date range selection field",
|
|
2531
|
+
id: "SelectDateRangeField"
|
|
2532
|
+
});
|
|
2430
2533
|
var NameConfig = import_v43.default.object({
|
|
2431
2534
|
firstname: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
2432
2535
|
middlename: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
@@ -2457,26 +2560,41 @@ var NameField = BaseField.extend({
|
|
|
2457
2560
|
surname: { required: true }
|
|
2458
2561
|
}
|
|
2459
2562
|
}).optional()
|
|
2460
|
-
}).
|
|
2563
|
+
}).meta({
|
|
2564
|
+
description: "A field for entering a persons name",
|
|
2565
|
+
id: "NameField"
|
|
2566
|
+
});
|
|
2461
2567
|
var PhoneField = BaseField.extend({
|
|
2462
2568
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2463
2569
|
type: import_v43.default.literal(FieldType.PHONE)
|
|
2464
|
-
}).
|
|
2570
|
+
}).meta({
|
|
2571
|
+
description: "A field for entering a phone number",
|
|
2572
|
+
id: "PhoneField"
|
|
2573
|
+
});
|
|
2465
2574
|
var IdField = BaseField.extend({
|
|
2466
2575
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2467
2576
|
type: import_v43.default.literal(FieldType.ID)
|
|
2468
|
-
}).
|
|
2577
|
+
}).meta({
|
|
2578
|
+
description: "A field for entering an ID",
|
|
2579
|
+
id: "IdField"
|
|
2580
|
+
});
|
|
2469
2581
|
var Checkbox = BaseField.extend({
|
|
2470
2582
|
type: import_v43.default.literal(FieldType.CHECKBOX),
|
|
2471
2583
|
defaultValue: CheckboxFieldValue.default(false)
|
|
2472
|
-
}).
|
|
2584
|
+
}).meta({
|
|
2585
|
+
description: "A boolean checkbox field",
|
|
2586
|
+
id: "Checkbox"
|
|
2587
|
+
});
|
|
2473
2588
|
var Country = BaseField.extend({
|
|
2474
2589
|
type: import_v43.default.literal(FieldType.COUNTRY),
|
|
2475
2590
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2476
2591
|
optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
|
|
2477
2592
|
"Conditionals for specific countries. Countries not listed are always shown and enabled."
|
|
2478
2593
|
)
|
|
2479
|
-
}).
|
|
2594
|
+
}).meta({
|
|
2595
|
+
description: "A field for selecting a country",
|
|
2596
|
+
id: "Country"
|
|
2597
|
+
});
|
|
2480
2598
|
var AllowedLocations = JurisdictionReference.optional().describe(
|
|
2481
2599
|
"Limits which location options are selectable depending on user jurisdiction and location."
|
|
2482
2600
|
);
|
|
@@ -2485,16 +2603,18 @@ var AdministrativeAreas = import_v43.default.enum([
|
|
|
2485
2603
|
"HEALTH_FACILITY",
|
|
2486
2604
|
"CRVS_OFFICE"
|
|
2487
2605
|
]);
|
|
2488
|
-
var AdministrativeAreaConfiguration = import_v43.default.object({
|
|
2489
|
-
partOf: FieldReference.optional().describe("Parent location"),
|
|
2490
|
-
type: AdministrativeAreas,
|
|
2491
|
-
allowedLocations: AllowedLocations
|
|
2492
|
-
}).describe("Administrative area options");
|
|
2493
2606
|
var AdministrativeAreaField = BaseField.extend({
|
|
2494
2607
|
type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
|
|
2495
2608
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
2496
|
-
configuration:
|
|
2497
|
-
|
|
2609
|
+
configuration: import_v43.default.object({
|
|
2610
|
+
partOf: FieldReference.optional().describe("Parent location"),
|
|
2611
|
+
type: AdministrativeAreas,
|
|
2612
|
+
allowedLocations: AllowedLocations
|
|
2613
|
+
}).describe("Administrative area options")
|
|
2614
|
+
}).meta({
|
|
2615
|
+
description: "Administrative area input field",
|
|
2616
|
+
id: "AdministrativeAreaField"
|
|
2617
|
+
});
|
|
2498
2618
|
var LocationInput = BaseField.extend({
|
|
2499
2619
|
type: import_v43.default.literal(FieldType.LOCATION),
|
|
2500
2620
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
@@ -2502,7 +2622,10 @@ var LocationInput = BaseField.extend({
|
|
|
2502
2622
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
2503
2623
|
allowedLocations: AllowedLocations
|
|
2504
2624
|
}).optional()
|
|
2505
|
-
}).
|
|
2625
|
+
}).meta({
|
|
2626
|
+
description: "A field for selecting a location",
|
|
2627
|
+
id: "LocationInput"
|
|
2628
|
+
});
|
|
2506
2629
|
var FileUploadWithOptions = BaseField.extend({
|
|
2507
2630
|
type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
|
|
2508
2631
|
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
@@ -2516,6 +2639,9 @@ var FileUploadWithOptions = BaseField.extend({
|
|
|
2516
2639
|
}).default({
|
|
2517
2640
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2518
2641
|
})
|
|
2642
|
+
}).meta({
|
|
2643
|
+
description: "A field for uploading files with file type options",
|
|
2644
|
+
id: "FileUploadWithOptions"
|
|
2519
2645
|
});
|
|
2520
2646
|
var Facility = BaseField.extend({
|
|
2521
2647
|
type: import_v43.default.literal(FieldType.FACILITY),
|
|
@@ -2561,7 +2687,10 @@ var Address = BaseField.extend({
|
|
|
2561
2687
|
allowedLocations: AllowedLocations
|
|
2562
2688
|
}).optional(),
|
|
2563
2689
|
defaultValue: DefaultAddressFieldValue.optional()
|
|
2564
|
-
}).
|
|
2690
|
+
}).meta({
|
|
2691
|
+
description: "Address input field \u2013 a combination of location and text fields",
|
|
2692
|
+
id: "Address"
|
|
2693
|
+
});
|
|
2565
2694
|
var StaticDataEntry = import_v43.default.object({
|
|
2566
2695
|
id: import_v43.default.string().describe("ID for the data entry."),
|
|
2567
2696
|
label: TranslationConfig,
|
|
@@ -2576,7 +2705,10 @@ var DataField = BaseField.extend({
|
|
|
2576
2705
|
subtitle: TranslationConfig.optional(),
|
|
2577
2706
|
data: import_v43.default.array(DataEntry)
|
|
2578
2707
|
})
|
|
2579
|
-
}).
|
|
2708
|
+
}).meta({
|
|
2709
|
+
description: "A field for displaying a table of read-only data",
|
|
2710
|
+
id: "DataField"
|
|
2711
|
+
});
|
|
2580
2712
|
var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
|
|
2581
2713
|
var ButtonType = import_v43.default.enum([
|
|
2582
2714
|
"primary",
|
|
@@ -2603,11 +2735,17 @@ var ButtonField = BaseField.extend({
|
|
|
2603
2735
|
type: import_v43.default.literal(FieldType.BUTTON),
|
|
2604
2736
|
defaultValue: ButtonFieldValue.optional(),
|
|
2605
2737
|
configuration: ButtonConfiguration
|
|
2606
|
-
}).
|
|
2738
|
+
}).meta({
|
|
2739
|
+
description: "A generic button that can be used to trigger an action",
|
|
2740
|
+
id: "ButtonField"
|
|
2741
|
+
});
|
|
2607
2742
|
var FieldGroup = BaseField.extend({
|
|
2608
2743
|
type: import_v43.default.literal(FieldType.FIELD_GROUP),
|
|
2609
2744
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2610
2745
|
fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig))
|
|
2746
|
+
}).meta({
|
|
2747
|
+
description: "A group of fields that are displayed together",
|
|
2748
|
+
id: "FieldGroup"
|
|
2611
2749
|
});
|
|
2612
2750
|
var AlphaPrintButton = BaseField.extend({
|
|
2613
2751
|
type: import_v43.default.literal(FieldType.ALPHA_PRINT_BUTTON),
|
|
@@ -2617,7 +2755,10 @@ var AlphaPrintButton = BaseField.extend({
|
|
|
2617
2755
|
"Label for the print button"
|
|
2618
2756
|
)
|
|
2619
2757
|
})
|
|
2620
|
-
}).
|
|
2758
|
+
}).meta({
|
|
2759
|
+
description: "An experimental print button field for printing certificates during the declaration process",
|
|
2760
|
+
id: "AlphaPrintButton"
|
|
2761
|
+
});
|
|
2621
2762
|
var HttpField = BaseField.extend({
|
|
2622
2763
|
type: import_v43.default.literal(FieldType.HTTP),
|
|
2623
2764
|
defaultValue: HttpFieldValue.optional(),
|
|
@@ -2633,20 +2774,30 @@ var HttpField = BaseField.extend({
|
|
|
2633
2774
|
params: import_v43.default.record(import_v43.default.string(), import_v43.default.union([import_v43.default.string(), FieldReference])).optional(),
|
|
2634
2775
|
timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
|
|
2635
2776
|
})
|
|
2636
|
-
}).
|
|
2777
|
+
}).meta({
|
|
2778
|
+
description: "Makes a background HTTP request to an external service and stores the response so other fields can use it. Has no visible UI \u2014 pair with LOADER to show request status.",
|
|
2779
|
+
id: "HttpField"
|
|
2780
|
+
});
|
|
2637
2781
|
var AutocompleteField = BaseField.extend({
|
|
2638
2782
|
type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
|
|
2639
2783
|
configuration: import_v43.default.object({
|
|
2640
|
-
url: import_v43.default.string().describe(
|
|
2784
|
+
url: import_v43.default.string().describe(
|
|
2785
|
+
"URL to fetch autocomplete suggestions from. This should be a country config server endpoint."
|
|
2786
|
+
).optional(),
|
|
2641
2787
|
method: import_v43.default.enum(["GET", "POST"]).default("GET").optional(),
|
|
2642
2788
|
defaultOptions: import_v43.default.array(
|
|
2643
2789
|
import_v43.default.object({
|
|
2644
2790
|
label: import_v43.default.string(),
|
|
2645
2791
|
value: import_v43.default.string()
|
|
2646
2792
|
})
|
|
2647
|
-
).optional()
|
|
2793
|
+
).optional().describe(
|
|
2794
|
+
"Manual entry is supported through configuration, allowing users to provide values not currently represented in the dataset."
|
|
2795
|
+
)
|
|
2648
2796
|
})
|
|
2649
|
-
}).
|
|
2797
|
+
}).meta({
|
|
2798
|
+
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.",
|
|
2799
|
+
id: "AutocompleteField"
|
|
2800
|
+
});
|
|
2650
2801
|
var SearchField = HttpField.extend({
|
|
2651
2802
|
type: import_v43.default.literal(FieldType.SEARCH),
|
|
2652
2803
|
configuration: SearchQuery.pick({
|
|
@@ -2679,6 +2830,9 @@ var SearchField = HttpField.extend({
|
|
|
2679
2830
|
ok: TranslationConfig.optional()
|
|
2680
2831
|
}).optional()
|
|
2681
2832
|
})
|
|
2833
|
+
}).meta({
|
|
2834
|
+
description: "A search input field",
|
|
2835
|
+
id: "SearchField"
|
|
2682
2836
|
});
|
|
2683
2837
|
var LinkButtonField = BaseField.extend({
|
|
2684
2838
|
type: import_v43.default.literal(FieldType.LINK_BUTTON),
|
|
@@ -2687,7 +2841,10 @@ var LinkButtonField = BaseField.extend({
|
|
|
2687
2841
|
text: TranslationConfig.describe("Text to display on the button"),
|
|
2688
2842
|
icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
|
|
2689
2843
|
})
|
|
2690
|
-
}).
|
|
2844
|
+
}).meta({
|
|
2845
|
+
description: "A button that opens a URL link",
|
|
2846
|
+
id: "LinkButtonField"
|
|
2847
|
+
});
|
|
2691
2848
|
var VerificationStatus = BaseField.extend({
|
|
2692
2849
|
type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
|
|
2693
2850
|
defaultValue: VerificationStatusValue.optional(),
|
|
@@ -2697,15 +2854,19 @@ var VerificationStatus = BaseField.extend({
|
|
|
2697
2854
|
"Explaining text on the banner in form."
|
|
2698
2855
|
)
|
|
2699
2856
|
})
|
|
2857
|
+
}).meta({
|
|
2858
|
+
description: "Displays a verification state (e.g. ID verified / pending). Often paired with ID_READER \u2014 it can read its value off an ID_READER rather than holding its own.",
|
|
2859
|
+
id: "VerificationStatus"
|
|
2700
2860
|
});
|
|
2701
2861
|
var QueryParamReaderField = BaseField.extend({
|
|
2702
2862
|
type: import_v43.default.literal(FieldType.QUERY_PARAM_READER),
|
|
2703
2863
|
configuration: import_v43.default.object({
|
|
2704
2864
|
pickParams: import_v43.default.array(import_v43.default.string()).describe("List of query parameters to read from the URL")
|
|
2705
2865
|
})
|
|
2706
|
-
}).
|
|
2707
|
-
"A field that maps URL query params into form values and clears them afterward"
|
|
2708
|
-
|
|
2866
|
+
}).meta({
|
|
2867
|
+
description: "A field that maps URL query params into form values and clears them afterward",
|
|
2868
|
+
id: "QueryParamReaderField"
|
|
2869
|
+
});
|
|
2709
2870
|
var QrReaderField = BaseField.extend({
|
|
2710
2871
|
type: import_v43.default.literal(FieldType.QR_READER),
|
|
2711
2872
|
defaultValue: QrReaderFieldValue.optional(),
|
|
@@ -2716,7 +2877,7 @@ var QrReaderField = BaseField.extend({
|
|
|
2716
2877
|
})
|
|
2717
2878
|
}).optional()
|
|
2718
2879
|
}).meta({
|
|
2719
|
-
description: "
|
|
2880
|
+
description: "QR code reader field, including optional JSON Schema validator.",
|
|
2720
2881
|
id: "QrReaderField"
|
|
2721
2882
|
});
|
|
2722
2883
|
var IdReaderField = BaseField.extend({
|
|
@@ -2725,12 +2886,18 @@ var IdReaderField = BaseField.extend({
|
|
|
2725
2886
|
methods: import_v43.default.array(
|
|
2726
2887
|
import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
|
|
2727
2888
|
)
|
|
2889
|
+
}).meta({
|
|
2890
|
+
description: "A wrapper around nested form fields, specifically QR_READER and LINK_BUTTON. It can hold the QR_READERs value.",
|
|
2891
|
+
id: "IdReaderField"
|
|
2728
2892
|
});
|
|
2729
2893
|
var CustomField = BaseField.extend({
|
|
2730
2894
|
type: import_v43.default.literal(FieldType._EXPERIMENTAL_CUSTOM),
|
|
2731
2895
|
defaultValue: CustomFieldValue.optional(),
|
|
2732
2896
|
src: import_v43.default.string().describe("Module source path for the custom field component"),
|
|
2733
2897
|
configuration: import_v43.default.unknown().optional()
|
|
2898
|
+
}).meta({
|
|
2899
|
+
description: "An expiremental custom field that is defined by a module source path",
|
|
2900
|
+
id: "CustomField"
|
|
2734
2901
|
});
|
|
2735
2902
|
var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
|
|
2736
2903
|
var LoaderField = BaseField.extend({
|
|
@@ -2740,22 +2907,25 @@ var LoaderField = BaseField.extend({
|
|
|
2740
2907
|
configuration: import_v43.default.object({
|
|
2741
2908
|
text: TranslationConfig.describe("Display text above the loading spinner")
|
|
2742
2909
|
})
|
|
2743
|
-
}).
|
|
2744
|
-
"A non-interactive field that indicates an in progress operation in form"
|
|
2745
|
-
|
|
2910
|
+
}).meta({
|
|
2911
|
+
description: "A non-interactive field that indicates an in progress operation in form",
|
|
2912
|
+
id: "LoaderField"
|
|
2913
|
+
});
|
|
2746
2914
|
var HiddenField = BaseField.extend({
|
|
2747
2915
|
type: import_v43.default.literal(FieldType.ALPHA_HIDDEN),
|
|
2748
2916
|
required: import_v43.default.boolean().default(false).optional(),
|
|
2749
2917
|
defaultValue: TextValue.optional()
|
|
2750
|
-
}).
|
|
2751
|
-
"A non-interactive, hidden field that only hold a value in the form"
|
|
2752
|
-
|
|
2918
|
+
}).meta({
|
|
2919
|
+
description: "A non-interactive, hidden field that only hold a value in the form",
|
|
2920
|
+
id: "HiddenField"
|
|
2921
|
+
});
|
|
2753
2922
|
var UserRoleField = BaseField.extend({
|
|
2754
2923
|
type: import_v43.default.literal(FieldType.USER_ROLE),
|
|
2755
2924
|
defaultValue: TextValue.optional()
|
|
2756
|
-
}).
|
|
2757
|
-
"A select dropdown that is automatically populated with available user roles"
|
|
2758
|
-
|
|
2925
|
+
}).meta({
|
|
2926
|
+
description: "A select dropdown that is automatically populated with available user roles",
|
|
2927
|
+
id: "UserRoleField"
|
|
2928
|
+
});
|
|
2759
2929
|
var FieldConfig = import_v43.default.discriminatedUnion("type", [
|
|
2760
2930
|
FieldGroup,
|
|
2761
2931
|
Address,
|
|
@@ -2854,16 +3024,19 @@ var VerificationPageConfig = FormPageConfig.extend({
|
|
|
2854
3024
|
type: z21.literal(PageTypes.enum.VERIFICATION),
|
|
2855
3025
|
actions: VerificationActionConfig
|
|
2856
3026
|
});
|
|
2857
|
-
var PageConfig = z21.discriminatedUnion("type", [
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
3027
|
+
var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
|
|
3028
|
+
id: "PageConfig",
|
|
3029
|
+
description: "Configuration for a single page in a form. Either a form page with fields and a continue button, or a verification page with verify/cancel options."
|
|
3030
|
+
});
|
|
2861
3031
|
|
|
2862
3032
|
// ../commons/src/events/FormConfig.ts
|
|
2863
3033
|
var DeclarationFormConfig = z22.object({
|
|
2864
3034
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
2865
3035
|
pages: z22.array(FormPageConfig)
|
|
2866
|
-
}).
|
|
3036
|
+
}).meta({
|
|
3037
|
+
id: "DeclarationFormConfig",
|
|
3038
|
+
description: "Configuration of the declaration form."
|
|
3039
|
+
});
|
|
2867
3040
|
var ActionFormConfig = z22.object({
|
|
2868
3041
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
2869
3042
|
pages: z22.array(PageConfig)
|
|
@@ -2963,6 +3136,9 @@ var DeduplicationConfig = z23.object({
|
|
|
2963
3136
|
id: z23.string(),
|
|
2964
3137
|
label: TranslationConfig,
|
|
2965
3138
|
query: Clause
|
|
3139
|
+
}).meta({
|
|
3140
|
+
id: "DeduplicationConfig",
|
|
3141
|
+
description: "Configuration for duplicate detection on a declare or register action. The query is built from fuzzy / strict / date-range matchers combined with and/or/not."
|
|
2966
3142
|
});
|
|
2967
3143
|
|
|
2968
3144
|
// ../commons/src/events/ActionConfig.ts
|
|
@@ -3080,17 +3256,42 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3080
3256
|
* OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
|
|
3081
3257
|
* and treat them as "models" instead of duplicating the data structure in each endpoint.
|
|
3082
3258
|
*/
|
|
3083
|
-
ReadActionConfig.meta({
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3259
|
+
ReadActionConfig.meta({
|
|
3260
|
+
id: "ReadActionConfig",
|
|
3261
|
+
description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
|
|
3262
|
+
}),
|
|
3263
|
+
DeclareConfig.meta({
|
|
3264
|
+
id: "DeclareActionConfig",
|
|
3265
|
+
description: "Configuration for the declare action. Includes review-page fields. Shared with the notify action (ActionType.NOTIFY)."
|
|
3266
|
+
}),
|
|
3267
|
+
RejectConfig.meta({
|
|
3268
|
+
id: "RejectActionConfig",
|
|
3269
|
+
description: "Configuration for rejecting a record before registration."
|
|
3270
|
+
}),
|
|
3271
|
+
RegisterConfig.meta({
|
|
3272
|
+
id: "RegisterActionConfig",
|
|
3273
|
+
description: "Configuration for registering a record."
|
|
3274
|
+
}),
|
|
3087
3275
|
PrintCertificateActionConfig.meta({
|
|
3088
|
-
id: "PrintCertificateActionConfig"
|
|
3276
|
+
id: "PrintCertificateActionConfig",
|
|
3277
|
+
description: "Configuration for printing a certificate of a registered record."
|
|
3278
|
+
}),
|
|
3279
|
+
RequestCorrectionConfig.meta({
|
|
3280
|
+
id: "RequestCorrectionActionConfig",
|
|
3281
|
+
description: "Configuration for requesting a correction on a registered record."
|
|
3282
|
+
}),
|
|
3283
|
+
EditActionConfig.meta({
|
|
3284
|
+
id: "EditActionConfig",
|
|
3285
|
+
description: "Configuration for editing a record before registration."
|
|
3089
3286
|
}),
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3287
|
+
ArchiveConfig.meta({
|
|
3288
|
+
id: "ArchiveActionConfig",
|
|
3289
|
+
description: "Configuration for archiving a record."
|
|
3290
|
+
}),
|
|
3291
|
+
CustomActionConfig.meta({
|
|
3292
|
+
id: "CustomActionConfig",
|
|
3293
|
+
description: "Configuration for a country-defined custom action. An event may include any number of these."
|
|
3294
|
+
})
|
|
3094
3295
|
]).describe(
|
|
3095
3296
|
"Configuration of an action available for an event. Data collected depends on the action type and is accessible through the annotation property in ActionDocument."
|
|
3096
3297
|
).meta({ id: "ActionConfig" });
|
|
@@ -3166,7 +3367,10 @@ var Field = BaseField2.extend({
|
|
|
3166
3367
|
}).describe("Custom field defined for the summary view.");
|
|
3167
3368
|
var SummaryConfig = z27.object({
|
|
3168
3369
|
fields: z27.array(z27.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
|
|
3169
|
-
}).
|
|
3370
|
+
}).meta({
|
|
3371
|
+
id: "SummaryConfig",
|
|
3372
|
+
description: "Configuration of the event overview page. Defines which declaration fields appear in the record summary, optionally with custom labels, empty-value messages, and templated values."
|
|
3373
|
+
});
|
|
3170
3374
|
|
|
3171
3375
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
|
3172
3376
|
var z28 = __toESM(require("zod/v4"));
|
|
@@ -3290,6 +3494,9 @@ var AdvancedSearchField = z28.discriminatedUnion("fieldType", [FieldConfigSchema
|
|
|
3290
3494
|
var AdvancedSearchConfig = z28.object({
|
|
3291
3495
|
title: TranslationConfig.describe("Advanced search tab title"),
|
|
3292
3496
|
fields: z28.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
|
|
3497
|
+
}).meta({
|
|
3498
|
+
id: "AdvancedSearchConfig",
|
|
3499
|
+
description: "Configuration of one advanced search tab. Each tab has a title and a list of searchable fields \u2014 either declaration fields (via `field()`) or event metadata (via `event()`)."
|
|
3293
3500
|
});
|
|
3294
3501
|
|
|
3295
3502
|
// ../commons/src/events/utils.ts
|
|
@@ -3766,6 +3973,9 @@ function precompileActionSchemas(eventConfigurations) {
|
|
|
3766
3973
|
function isAgeValue(value) {
|
|
3767
3974
|
return typeof value === "object" && value !== null && "age" in value && typeof value.age === "number";
|
|
3768
3975
|
}
|
|
3976
|
+
function mergeWithBaseFormState(values, context) {
|
|
3977
|
+
return { ...context.baseFormState, ...values };
|
|
3978
|
+
}
|
|
3769
3979
|
function validate(schema, data) {
|
|
3770
3980
|
const validator = ajv.getSchema(schema.$id) || ajv.compile(schema);
|
|
3771
3981
|
if ("$form" in data) {
|
|
@@ -3804,7 +4014,7 @@ function isOnline() {
|
|
|
3804
4014
|
}
|
|
3805
4015
|
function isConditionMet(conditional, values, context, eventIndex) {
|
|
3806
4016
|
return validate(conditional, {
|
|
3807
|
-
$form: values,
|
|
4017
|
+
$form: mergeWithBaseFormState(values, context),
|
|
3808
4018
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
3809
4019
|
$online: isOnline(),
|
|
3810
4020
|
$user: context.user,
|
|
@@ -3833,7 +4043,7 @@ function isFieldConditionMet(field3, form, conditionalType, context) {
|
|
|
3833
4043
|
return true;
|
|
3834
4044
|
}
|
|
3835
4045
|
const validConditionals = getConditionalActionsForField(field3, {
|
|
3836
|
-
$form: form,
|
|
4046
|
+
$form: mergeWithBaseFormState(form, context),
|
|
3837
4047
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
3838
4048
|
$online: isOnline(),
|
|
3839
4049
|
$user: context.user,
|
|
@@ -4025,7 +4235,7 @@ function runFieldValidations({
|
|
|
4025
4235
|
return [];
|
|
4026
4236
|
}
|
|
4027
4237
|
const conditionalParameters = {
|
|
4028
|
-
$form: form,
|
|
4238
|
+
$form: mergeWithBaseFormState(form, context),
|
|
4029
4239
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
4030
4240
|
/**
|
|
4031
4241
|
* In real use cases, there can be hundreds of thousands of locations.
|
|
@@ -4269,17 +4479,16 @@ function isPageVisible(page, formValues, context) {
|
|
|
4269
4479
|
}
|
|
4270
4480
|
return isConditionMet(page.conditional, formValues, context);
|
|
4271
4481
|
}
|
|
4272
|
-
function omitHiddenFields(fields, formValues, validatorContext, includeHiddenFieldsWithNullValues = false
|
|
4482
|
+
function omitHiddenFields(fields, formValues, validatorContext, includeHiddenFieldsWithNullValues = false) {
|
|
4273
4483
|
const base = (0, import_lodash.cloneDeep)(formValues);
|
|
4274
4484
|
function fn(prevVisibilityContext) {
|
|
4275
|
-
const visibilityForm = declarationContext ? { ...declarationContext, ...prevVisibilityContext } : prevVisibilityContext;
|
|
4276
4485
|
const cleaned = (0, import_lodash.omitBy)(base, (value, fieldId) => {
|
|
4277
4486
|
const fieldConfig = fields.filter((f) => f.id === fieldId);
|
|
4278
4487
|
if (!fieldConfig.length) {
|
|
4279
4488
|
return false;
|
|
4280
4489
|
}
|
|
4281
4490
|
const isHidden = fieldConfig.every(
|
|
4282
|
-
(f) => !isFieldVisible(f,
|
|
4491
|
+
(f) => !isFieldVisible(f, prevVisibilityContext, validatorContext)
|
|
4283
4492
|
);
|
|
4284
4493
|
if (!isHidden) {
|
|
4285
4494
|
return false;
|
|
@@ -4297,7 +4506,7 @@ function omitHiddenPaginatedFields(formConfig, values, validatorContext, include
|
|
|
4297
4506
|
const visibleFields = formConfig.pages.filter((p) => isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
|
|
4298
4507
|
const hiddenFields = formConfig.pages.filter((p) => !isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
|
|
4299
4508
|
const valuesExceptHiddenPage = (0, import_lodash.omitBy)(values, (_2, fieldId) => {
|
|
4300
|
-
return hiddenFields.some((f) => f.id === fieldId);
|
|
4509
|
+
return hiddenFields.some((f) => f.id === fieldId) && !visibleFields.some((f) => f.id === fieldId);
|
|
4301
4510
|
});
|
|
4302
4511
|
return omitHiddenFields(
|
|
4303
4512
|
visibleFields,
|
|
@@ -4344,13 +4553,10 @@ function getVisibleVerificationPageIds(pages, annotation, context) {
|
|
|
4344
4553
|
}
|
|
4345
4554
|
function omitHiddenAnnotationFields(actionConfig, declaration, annotation, context) {
|
|
4346
4555
|
const annotationFields = getActionAnnotationFields(actionConfig);
|
|
4347
|
-
return omitHiddenFields(
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
false,
|
|
4352
|
-
declaration
|
|
4353
|
-
);
|
|
4556
|
+
return omitHiddenFields(annotationFields, annotation, {
|
|
4557
|
+
...context,
|
|
4558
|
+
baseFormState: declaration
|
|
4559
|
+
});
|
|
4354
4560
|
}
|
|
4355
4561
|
function deepMerge(currentDocument, actionDocument) {
|
|
4356
4562
|
const currentDocumentClone = (0, import_lodash.cloneDeep)(currentDocument);
|
|
@@ -5339,7 +5545,7 @@ var _EventConfigBase = z33.object({
|
|
|
5339
5545
|
),
|
|
5340
5546
|
label: TranslationConfig.describe("Human-readable label for the event type."),
|
|
5341
5547
|
actions: z33.array(ActionConfig).describe(
|
|
5342
|
-
"Configuration of
|
|
5548
|
+
"Configuration of core and custom actions associated with the event."
|
|
5343
5549
|
),
|
|
5344
5550
|
actionOrder: z33.array(z33.string()).optional().describe(
|
|
5345
5551
|
"Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
|
|
@@ -5351,7 +5557,7 @@ var _EventConfigBase = z33.object({
|
|
|
5351
5557
|
"Configuration of fields available in the advanced search feature."
|
|
5352
5558
|
),
|
|
5353
5559
|
flags: z33.array(FlagConfig).optional().default([]).describe(
|
|
5354
|
-
"Configuration of flags associated with the actions of this event type."
|
|
5560
|
+
"Configuration of custom flags associated with the actions of this event type."
|
|
5355
5561
|
),
|
|
5356
5562
|
analytics: z33.boolean().optional().default(true).describe(
|
|
5357
5563
|
"Indicates whether the records of this event type are included in analytics"
|
|
@@ -5364,8 +5570,9 @@ var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
|
|
|
5364
5570
|
validateActionFlags(event2, ctx);
|
|
5365
5571
|
validateActionOrder(event2, ctx);
|
|
5366
5572
|
}).meta({
|
|
5367
|
-
id: "EventConfig"
|
|
5368
|
-
|
|
5573
|
+
id: "EventConfig",
|
|
5574
|
+
description: "Configuration defining an event type registered in OpenCRVS (for example birth or death)."
|
|
5575
|
+
});
|
|
5369
5576
|
|
|
5370
5577
|
// ../commons/src/events/EventConfigInput.ts
|
|
5371
5578
|
var defineDeclarationForm = (form) => DeclarationFormConfig.parse(form);
|
|
@@ -5588,6 +5795,9 @@ var WorkqueueColumnValue = z34.object({
|
|
|
5588
5795
|
var WorkqueueColumn = z34.object({
|
|
5589
5796
|
label: TranslationConfig,
|
|
5590
5797
|
value: WorkqueueColumnValue
|
|
5798
|
+
}).meta({
|
|
5799
|
+
id: "WorkqueueColumn",
|
|
5800
|
+
description: "Configuration for a single workqueue column. The value references an event metadata key (e.g. `dateOfEvent`, `status`, `trackingId`)."
|
|
5591
5801
|
});
|
|
5592
5802
|
function defineWorkqueuesColumns(workqueueColumns) {
|
|
5593
5803
|
return workqueueColumns.map(
|
|
@@ -5790,18 +6000,11 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
|
|
|
5790
6000
|
query: true,
|
|
5791
6001
|
columns: true
|
|
5792
6002
|
});
|
|
5793
|
-
var WorkqueueConfigInput =
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
query: CountryConfigQueryInputType,
|
|
5799
|
-
action: z37.object({ type: WorkqueueActionType }).optional().describe(
|
|
5800
|
-
"Workqueue call-to-action button configuration. This determines the quick action button shown on each event card and the action taken when the button is clicked."
|
|
5801
|
-
),
|
|
5802
|
-
columns: z37.array(WorkqueueColumn).default(mandatoryColumns),
|
|
5803
|
-
icon: AvailableIcons,
|
|
5804
|
-
emptyMessage: TranslationConfig.optional()
|
|
6003
|
+
var WorkqueueConfigInput = WorkqueueConfig.extend({
|
|
6004
|
+
query: CountryConfigQueryInputType
|
|
6005
|
+
}).meta({
|
|
6006
|
+
id: "WorkqueueConfig",
|
|
6007
|
+
description: "Configuration for a single workqueue. Defines the filter applied to the event index, the quick-action button, the columns shown on each row, and the message rendered when the queue is empty."
|
|
5805
6008
|
});
|
|
5806
6009
|
function defineWorkqueue(workqueueInput) {
|
|
5807
6010
|
const queryInput = workqueueInput.query;
|
|
@@ -5862,6 +6065,11 @@ var BaseActionInput = z38.object({
|
|
|
5862
6065
|
originalActionId: UUID.optional(),
|
|
5863
6066
|
// should not be part of base action.
|
|
5864
6067
|
keepAssignment: z38.boolean().optional(),
|
|
6068
|
+
keepAssignmentIfAccepted: z38.boolean().optional(),
|
|
6069
|
+
keepAssignmentIfRejected: z38.boolean().optional(),
|
|
6070
|
+
waitFor: z38.boolean().default(true).describe(
|
|
6071
|
+
"Whether action waits for the indexing before returning. Defaults to true. Setting this to to false completes faster but might lead to stale data in the client if the client tries to read the event immediately after performing the action. Use with care."
|
|
6072
|
+
),
|
|
5865
6073
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
5866
6074
|
// @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
|
|
5867
6075
|
createdAtLocation: UUID.nullish().describe(
|
|
@@ -6041,7 +6249,7 @@ var Draft = z39.object({
|
|
|
6041
6249
|
}).describe(
|
|
6042
6250
|
"A temporary storage for an action. Stored with details of the event, creator and creation time."
|
|
6043
6251
|
);
|
|
6044
|
-
var DraftInput = BaseActionInput.extend({
|
|
6252
|
+
var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
|
|
6045
6253
|
type: ActionTypes.exclude([ActionTypes.enum.DELETE]),
|
|
6046
6254
|
status: z39.enum([
|
|
6047
6255
|
ActionStatus.Requested,
|
|
@@ -6115,7 +6323,6 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
|
|
|
6115
6323
|
createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
|
|
6116
6324
|
acceptedAt: acceptAction.createdAt,
|
|
6117
6325
|
createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
|
|
6118
|
-
createdBySignature: requestAction?.createdBySignature ?? acceptAction.createdBySignature,
|
|
6119
6326
|
registrationNumber
|
|
6120
6327
|
};
|
|
6121
6328
|
}
|
|
@@ -6329,17 +6536,6 @@ function getAssignedUserFromActions(actions) {
|
|
|
6329
6536
|
return user2;
|
|
6330
6537
|
}, null);
|
|
6331
6538
|
}
|
|
6332
|
-
function getAssignedUserSignatureFromActions(actions) {
|
|
6333
|
-
return actions.reduce((signature, action) => {
|
|
6334
|
-
if (action.type === ActionType.ASSIGN) {
|
|
6335
|
-
return action.createdBySignature || null;
|
|
6336
|
-
}
|
|
6337
|
-
if (action.type === ActionType.UNASSIGN) {
|
|
6338
|
-
return null;
|
|
6339
|
-
}
|
|
6340
|
-
return signature;
|
|
6341
|
-
}, null);
|
|
6342
|
-
}
|
|
6343
6539
|
function deepDropNulls(obj) {
|
|
6344
6540
|
if (Array.isArray(obj)) {
|
|
6345
6541
|
return obj.map(deepDropNulls);
|
|
@@ -6435,10 +6631,8 @@ function getCurrentEventState(event2, config) {
|
|
|
6435
6631
|
createdBy: creationAction.createdBy,
|
|
6436
6632
|
createdByUserType: creationAction.createdByUserType,
|
|
6437
6633
|
createdAtLocation: creationAction.createdAtLocation,
|
|
6438
|
-
createdBySignature: creationAction.createdBySignature,
|
|
6439
6634
|
updatedAt: acceptedActionMetadata.createdAt,
|
|
6440
6635
|
assignedTo: getAssignedUserFromActions(acceptedActions),
|
|
6441
|
-
assignedToSignature: getAssignedUserSignatureFromActions(acceptedActions),
|
|
6442
6636
|
updatedBy: requestActionMetadata.createdBy,
|
|
6443
6637
|
updatedAtLocation: requestActionMetadata.createdAtLocation,
|
|
6444
6638
|
declaration,
|
|
@@ -9697,7 +9891,6 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
|
|
|
9697
9891
|
createdBy: overrides.createdBy ?? generateUuid(rng),
|
|
9698
9892
|
createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
|
|
9699
9893
|
updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
|
|
9700
|
-
createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
|
|
9701
9894
|
updatedAt: overrides.updatedAt ?? (0, import_date_fns4.addDays)(new Date(createdAt), 1).toISOString(),
|
|
9702
9895
|
assignedTo: overrides.assignedTo ?? null,
|
|
9703
9896
|
updatedBy: overrides.updatedBy ?? generateUuid(rng),
|
|
@@ -9930,11 +10123,77 @@ function canAccessEventWithScope(event2, scope, user2, customActionType) {
|
|
|
9930
10123
|
}
|
|
9931
10124
|
return true;
|
|
9932
10125
|
}
|
|
10126
|
+
function canAccessUserWithScope({
|
|
10127
|
+
userToAccess,
|
|
10128
|
+
scope,
|
|
10129
|
+
user: user2
|
|
10130
|
+
}) {
|
|
10131
|
+
const opts = scope.options;
|
|
10132
|
+
const hasSameOffice = user2.primaryOfficeId === userToAccess.primaryOfficeId;
|
|
10133
|
+
if (opts?.accessLevel === JurisdictionFilter.enum.location && !hasSameOffice) {
|
|
10134
|
+
return false;
|
|
10135
|
+
}
|
|
10136
|
+
const hasAdministrativeAreaInHierarchy = userToAccess.administrativeHierarchy.some(
|
|
10137
|
+
(id) => user2.administrativeAreaId === id
|
|
10138
|
+
) || user2.administrativeAreaId === null;
|
|
10139
|
+
if (opts?.accessLevel === JurisdictionFilter.enum.administrativeArea && !hasAdministrativeAreaInHierarchy) {
|
|
10140
|
+
return false;
|
|
10141
|
+
}
|
|
10142
|
+
if (scopeUsesRoleOptions(scope)) {
|
|
10143
|
+
const { options } = scope;
|
|
10144
|
+
if (options?.role && !options.role.includes(userToAccess.role)) {
|
|
10145
|
+
return false;
|
|
10146
|
+
}
|
|
10147
|
+
}
|
|
10148
|
+
return true;
|
|
10149
|
+
}
|
|
10150
|
+
function canAccessOtherUserWithScopes({
|
|
10151
|
+
scopes,
|
|
10152
|
+
userToAccess,
|
|
10153
|
+
user: user2
|
|
10154
|
+
}) {
|
|
10155
|
+
return scopes.some(
|
|
10156
|
+
(scope) => canAccessUserWithScope({ userToAccess, scope, user: user2 })
|
|
10157
|
+
);
|
|
10158
|
+
}
|
|
9933
10159
|
function userCanAccessEventWithScopes(event2, scopes, user2, customActionType) {
|
|
9934
10160
|
return scopes.some(
|
|
9935
10161
|
(scope) => canAccessEventWithScope(event2, scope, user2, customActionType)
|
|
9936
10162
|
);
|
|
9937
10163
|
}
|
|
10164
|
+
function getAdministrativeAreaHierarchy(administrativeAreaId, administrativeAreas) {
|
|
10165
|
+
const collectedLocations = [];
|
|
10166
|
+
const parsedAdministrativeAreaId = administrativeAreaId && UUID.safeParse(administrativeAreaId).data;
|
|
10167
|
+
let current = parsedAdministrativeAreaId ? administrativeAreas.get(parsedAdministrativeAreaId) : null;
|
|
10168
|
+
while (current) {
|
|
10169
|
+
collectedLocations.push(current);
|
|
10170
|
+
if (!current.parentId) {
|
|
10171
|
+
break;
|
|
10172
|
+
}
|
|
10173
|
+
const parentId = current.parentId;
|
|
10174
|
+
current = administrativeAreas.get(parentId);
|
|
10175
|
+
}
|
|
10176
|
+
return collectedLocations;
|
|
10177
|
+
}
|
|
10178
|
+
function getLocationHierarchy(selectedId, context) {
|
|
10179
|
+
const { administrativeAreas, locations } = context;
|
|
10180
|
+
const loc = locations.get(selectedId);
|
|
10181
|
+
if (loc) {
|
|
10182
|
+
if (loc.administrativeAreaId) {
|
|
10183
|
+
const hierarchy2 = getAdministrativeAreaHierarchy(
|
|
10184
|
+
loc.administrativeAreaId,
|
|
10185
|
+
administrativeAreas
|
|
10186
|
+
);
|
|
10187
|
+
return [...hierarchy2.reverse().map((area) => area.id), loc.id];
|
|
10188
|
+
}
|
|
10189
|
+
return [loc.id];
|
|
10190
|
+
}
|
|
10191
|
+
const hierarchy = getAdministrativeAreaHierarchy(
|
|
10192
|
+
selectedId,
|
|
10193
|
+
administrativeAreas
|
|
10194
|
+
);
|
|
10195
|
+
return hierarchy.reverse().map((area) => area.id);
|
|
10196
|
+
}
|
|
9938
10197
|
|
|
9939
10198
|
// ../commons/src/events/scopes.ts
|
|
9940
10199
|
var ACTION_SCOPE_MAP = {
|
|
@@ -10009,6 +10268,25 @@ function isActionInScope({
|
|
|
10009
10268
|
);
|
|
10010
10269
|
return canAccess;
|
|
10011
10270
|
}
|
|
10271
|
+
function getAvailableRolesForUserUpdatePayload({
|
|
10272
|
+
allRoles,
|
|
10273
|
+
userLocation,
|
|
10274
|
+
acceptedScopes,
|
|
10275
|
+
userRequesting
|
|
10276
|
+
}) {
|
|
10277
|
+
const availableRoles = allRoles.filter((role) => {
|
|
10278
|
+
const canAccess = canAccessOtherUserWithScopes({
|
|
10279
|
+
userToAccess: {
|
|
10280
|
+
...userLocation,
|
|
10281
|
+
role
|
|
10282
|
+
},
|
|
10283
|
+
user: userRequesting,
|
|
10284
|
+
scopes: acceptedScopes
|
|
10285
|
+
});
|
|
10286
|
+
return canAccess;
|
|
10287
|
+
});
|
|
10288
|
+
return availableRoles;
|
|
10289
|
+
}
|
|
10012
10290
|
|
|
10013
10291
|
// ../commons/src/events/serializers/user/deserializer.ts
|
|
10014
10292
|
function userDeserializer(serializedUserField, user2) {
|