@opencrvs/toolkit 2.0.0-rc.3126aa4 → 2.0.0-rc.315863
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/build.sh +3 -2
- package/create-countryconfig/index.js +50 -20
- package/dist/application-config/index.js +82 -40
- package/dist/cli.js +3264 -50
- package/dist/commons/api/router.d.ts +700 -22
- package/dist/commons/application-config/index.d.ts +1 -0
- package/dist/commons/conditionals/conditionals.d.ts +360 -10
- package/dist/commons/conditionals/validate.d.ts +51 -2
- package/dist/commons/events/ActionConfig.d.ts +54 -2
- package/dist/commons/events/ActionDocument.d.ts +50 -0
- package/dist/commons/events/ActionInput.d.ts +32 -0
- package/dist/commons/events/ActionType.d.ts +6 -1
- package/dist/commons/events/AdvancedSearchConfig.d.ts +360 -0
- package/dist/commons/events/AuditLog.d.ts +2 -0
- package/dist/commons/events/CountryConfigQueryInput.d.ts +42 -0
- package/dist/commons/events/Draft.d.ts +2 -0
- package/dist/commons/events/EventConfig.d.ts +2 -0
- package/dist/commons/events/EventDocument.d.ts +25 -0
- package/dist/commons/events/EventIndex.d.ts +25 -0
- package/dist/commons/events/EventMetadata.d.ts +26 -0
- package/dist/commons/events/FieldConfig.d.ts +393 -50
- package/dist/commons/events/FieldType.d.ts +1 -0
- package/dist/commons/events/FieldTypeMapping.d.ts +1 -1
- package/dist/commons/events/FieldValue.d.ts +6 -0
- package/dist/commons/events/WorkqueueConfig.d.ts +44 -2
- package/dist/commons/events/field.d.ts +53 -1
- package/dist/commons/events/index.d.ts +1 -0
- package/dist/commons/events/locations.d.ts +1 -0
- package/dist/commons/events/scopes.d.ts +1 -0
- package/dist/commons/events/state/flags.d.ts +16 -0
- package/dist/commons/events/state/index.d.ts +8 -0
- package/dist/commons/events/state/utils.d.ts +21 -287
- package/dist/commons/events/test.utils.d.ts +9 -1
- package/dist/commons/events/utils.d.ts +27 -2
- package/dist/conditionals/index.js +64 -6
- package/dist/environment/custom-types.d.ts +33 -0
- package/dist/environment/custom-types.d.ts.map +1 -0
- package/dist/environment/custom-types.js +12 -0
- package/dist/environment/derived-variables.d.ts +134 -0
- package/dist/environment/derived-variables.d.ts.map +1 -0
- package/dist/environment/derived-variables.js +169 -0
- package/dist/environment/editor-questions.d.ts +4 -0
- package/dist/environment/editor-questions.d.ts.map +1 -0
- package/dist/environment/editor-questions.js +67 -0
- package/dist/environment/git.d.ts +5 -0
- package/dist/environment/git.d.ts.map +1 -0
- package/dist/environment/git.js +38 -0
- package/dist/environment/github.d.ts +26 -0
- package/dist/environment/github.d.ts.map +1 -0
- package/dist/environment/github.js +247 -0
- package/dist/environment/index.d.ts +5 -0
- package/dist/environment/index.d.ts.map +1 -0
- package/dist/environment/index.js +71 -0
- package/dist/environment/logger.d.ts +15 -0
- package/dist/environment/logger.d.ts.map +1 -0
- package/dist/environment/logger.js +25 -0
- package/dist/environment/manage-users.d.ts +11 -0
- package/dist/environment/manage-users.d.ts.map +1 -0
- package/dist/environment/manage-users.js +497 -0
- package/dist/environment/questions-helper.d.ts +15 -0
- package/dist/environment/questions-helper.d.ts.map +1 -0
- package/dist/environment/questions-helper.js +70 -0
- package/dist/environment/questions.d.ts +199 -0
- package/dist/environment/questions.d.ts.map +1 -0
- package/dist/environment/questions.js +412 -0
- package/dist/environment/setup-environment.d.ts +2 -0
- package/dist/environment/setup-environment.d.ts.map +1 -0
- package/dist/environment/setup-environment.js +794 -0
- package/dist/environment/ssh-keygen.d.ts +5 -0
- package/dist/environment/ssh-keygen.d.ts.map +1 -0
- package/dist/environment/ssh-keygen.js +21 -0
- package/dist/environment/swarm-to-k8s.d.ts +2 -0
- package/dist/environment/swarm-to-k8s.d.ts.map +1 -0
- package/dist/environment/swarm-to-k8s.js +173 -0
- package/dist/environment/templates.d.ts +27 -0
- package/dist/environment/templates.d.ts.map +1 -0
- package/dist/environment/templates.js +163 -0
- package/dist/environment/update-workflows.d.ts +2 -0
- package/dist/environment/update-workflows.d.ts.map +1 -0
- package/dist/environment/update-workflows.js +169 -0
- package/dist/environment/users.d.ts +2 -0
- package/dist/environment/users.d.ts.map +1 -0
- package/dist/environment/users.js +112 -0
- package/dist/environment/utils.d.ts +18 -0
- package/dist/environment/utils.d.ts.map +1 -0
- package/dist/environment/utils.js +100 -0
- package/dist/events/index.js +517 -151
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.js +1 -1
- package/dist/migrations/v2.0/index.js +22 -9
- package/dist/notification/index.js +298 -46
- package/dist/scopes/index.d.ts +100 -8
- package/dist/scopes/index.js +21 -8
- package/dist/templates/charts-values/dependencies/values.override.yaml +4 -0
- package/dist/templates/charts-values/dependencies/values.yaml +83 -0
- package/dist/templates/charts-values/opencrvs-services/values.override.yaml +4 -0
- package/dist/templates/charts-values/opencrvs-services/values.yaml +81 -0
- package/dist/templates/charts-values/traefik/values.override.yaml +4 -0
- package/dist/templates/charts-values/traefik/values.yaml +115 -0
- package/dist/templates/inventory/inventory.template.yml +100 -0
- package/dist/templates/inventory/production.example.yml +77 -0
- package/dist/templates/inventory/qa.example.yml +48 -0
- package/opencrvs-toolkit-2.0.0-rc.0315863.tgz +0 -0
- package/package.json +16 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.0.0-rc.3126aa4.tgz +0 -0
package/dist/events/index.js
CHANGED
|
@@ -75,6 +75,7 @@ __export(events_exports, {
|
|
|
75
75
|
CheckboxFieldValue: () => CheckboxFieldValue,
|
|
76
76
|
Clause: () => Clause,
|
|
77
77
|
ClientSpecificAction: () => ClientSpecificAction,
|
|
78
|
+
ComputedDefaultValue: () => ComputedDefaultValue,
|
|
78
79
|
Conditional: () => Conditional,
|
|
79
80
|
ConditionalType: () => ConditionalType,
|
|
80
81
|
ConfirmableActions: () => ConfirmableActions,
|
|
@@ -150,6 +151,7 @@ __export(events_exports, {
|
|
|
150
151
|
FormPageConfig: () => FormPageConfig,
|
|
151
152
|
Fuzzy: () => Fuzzy,
|
|
152
153
|
GeographicalArea: () => GeographicalArea,
|
|
154
|
+
HiddenFieldTypes: () => HiddenFieldTypes,
|
|
153
155
|
HiddenFieldValue: () => HiddenFieldValue,
|
|
154
156
|
HttpFieldUpdateValue: () => HttpFieldUpdateValue,
|
|
155
157
|
HttpFieldValue: () => HttpFieldValue,
|
|
@@ -200,6 +202,7 @@ __export(events_exports, {
|
|
|
200
202
|
SelectDateRangeValue: () => SelectDateRangeValue,
|
|
201
203
|
SelectOption: () => SelectOption,
|
|
202
204
|
ShowConditional: () => ShowConditional,
|
|
205
|
+
SignatureFieldValue: () => SignatureFieldValue,
|
|
203
206
|
StaticDataEntry: () => StaticDataEntry,
|
|
204
207
|
StreetLevelDetailsUpdateValue: () => StreetLevelDetailsUpdateValue,
|
|
205
208
|
SummaryConfig: () => SummaryConfig,
|
|
@@ -211,6 +214,7 @@ __export(events_exports, {
|
|
|
211
214
|
TimeValue: () => TimeValue,
|
|
212
215
|
TranslationConfig: () => TranslationConfig,
|
|
213
216
|
UUID: () => UUID,
|
|
217
|
+
UnarchiveActionInput: () => UnarchiveActionInput,
|
|
214
218
|
UnassignActionInput: () => UnassignActionInput,
|
|
215
219
|
UserAuditRecordInput: () => UserAuditRecordInput,
|
|
216
220
|
V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS: () => V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS,
|
|
@@ -238,6 +242,7 @@ __export(events_exports, {
|
|
|
238
242
|
ageToDate: () => ageToDate,
|
|
239
243
|
aggregateActionAnnotations: () => aggregateActionAnnotations,
|
|
240
244
|
aggregateActionDeclarations: () => aggregateActionDeclarations,
|
|
245
|
+
always: () => always,
|
|
241
246
|
alwaysTrue: () => alwaysTrue,
|
|
242
247
|
and: () => and,
|
|
243
248
|
annotationActions: () => annotationActions,
|
|
@@ -245,10 +250,12 @@ __export(events_exports, {
|
|
|
245
250
|
applyDraftToEventIndex: () => applyDraftToEventIndex,
|
|
246
251
|
areCertificateConditionsMet: () => areCertificateConditionsMet,
|
|
247
252
|
areConditionsMet: () => areConditionsMet,
|
|
253
|
+
buildClientFunctionContext: () => buildClientFunctionContext,
|
|
248
254
|
buildFormState: () => buildFormState,
|
|
249
255
|
canAccessEventWithScope: () => canAccessEventWithScope,
|
|
250
256
|
canAccessOtherUserWithScopes: () => canAccessOtherUserWithScopes,
|
|
251
257
|
canAccessUserWithScope: () => canAccessUserWithScope,
|
|
258
|
+
compileClientFunction: () => compileClientFunction,
|
|
252
259
|
compositeFieldTypes: () => compositeFieldTypes,
|
|
253
260
|
createEmptyDraft: () => createEmptyDraft,
|
|
254
261
|
createFieldConditionals: () => createFieldConditionals,
|
|
@@ -269,6 +276,7 @@ __export(events_exports, {
|
|
|
269
276
|
defineWorkqueuesColumns: () => defineWorkqueuesColumns,
|
|
270
277
|
deserializeQuery: () => deserializeQuery,
|
|
271
278
|
errorMessages: () => errorMessages,
|
|
279
|
+
evaluate: () => evaluate,
|
|
272
280
|
event: () => event,
|
|
273
281
|
eventMetadataLabelMap: () => eventMetadataLabelMap,
|
|
274
282
|
eventPayloadGenerator: () => eventPayloadGenerator,
|
|
@@ -281,6 +289,7 @@ __export(events_exports, {
|
|
|
281
289
|
findActiveDraftForEvent: () => findActiveDraftForEvent,
|
|
282
290
|
findAllFields: () => findAllFields,
|
|
283
291
|
findLastAssignmentAction: () => findLastAssignmentAction,
|
|
292
|
+
findPendingCorrectionAction: () => findPendingCorrectionAction,
|
|
284
293
|
findRecordActionPages: () => findRecordActionPages,
|
|
285
294
|
flag: () => flag,
|
|
286
295
|
flattenFieldReference: () => flattenFieldReference,
|
|
@@ -314,6 +323,7 @@ __export(events_exports, {
|
|
|
314
323
|
getAvailableActionsForEvent: () => getAvailableActionsForEvent,
|
|
315
324
|
getAvailableRolesForUserUpdatePayload: () => getAvailableRolesForUserUpdatePayload,
|
|
316
325
|
getCompleteActionAnnotation: () => getCompleteActionAnnotation,
|
|
326
|
+
getCompleteActionContent: () => getCompleteActionContent,
|
|
317
327
|
getCompleteActionDeclaration: () => getCompleteActionDeclaration,
|
|
318
328
|
getCurrentEventState: () => getCurrentEventState,
|
|
319
329
|
getCustomActionFields: () => getCustomActionFields,
|
|
@@ -322,6 +332,7 @@ __export(events_exports, {
|
|
|
322
332
|
getDeclarationFields: () => getDeclarationFields,
|
|
323
333
|
getDeclarationPages: () => getDeclarationPages,
|
|
324
334
|
getEventConfigById: () => getEventConfigById,
|
|
335
|
+
getEventFlags: () => getEventFlags,
|
|
325
336
|
getFilePathsFromEvent: () => getFilePathsFromEvent,
|
|
326
337
|
getLocationHierarchy: () => getLocationHierarchy,
|
|
327
338
|
getMixedPath: () => getMixedPath,
|
|
@@ -344,6 +355,7 @@ __export(events_exports, {
|
|
|
344
355
|
isBulletListFieldType: () => isBulletListFieldType,
|
|
345
356
|
isButtonFieldType: () => isButtonFieldType,
|
|
346
357
|
isCheckboxFieldType: () => isCheckboxFieldType,
|
|
358
|
+
isCodeToEvaluate: () => isCodeToEvaluate,
|
|
347
359
|
isConditionMet: () => isConditionMet,
|
|
348
360
|
isCountryFieldType: () => isCountryFieldType,
|
|
349
361
|
isCustomFieldType: () => isCustomFieldType,
|
|
@@ -384,6 +396,7 @@ __export(events_exports, {
|
|
|
384
396
|
isPageVisible: () => isPageVisible,
|
|
385
397
|
isParagraphFieldType: () => isParagraphFieldType,
|
|
386
398
|
isPhoneFieldType: () => isPhoneFieldType,
|
|
399
|
+
isPotentialDuplicate: () => isPotentialDuplicate,
|
|
387
400
|
isPrintButtonFieldType: () => isPrintButtonFieldType,
|
|
388
401
|
isQrReaderFieldType: () => isQrReaderFieldType,
|
|
389
402
|
isQueryParamReaderFieldType: () => isQueryParamReaderFieldType,
|
|
@@ -417,12 +430,15 @@ __export(events_exports, {
|
|
|
417
430
|
plainDateToLocalDate: () => plainDateToLocalDate,
|
|
418
431
|
precompileActionSchemas: () => precompileActionSchemas,
|
|
419
432
|
resolveDateOfEvent: () => resolveDateOfEvent,
|
|
433
|
+
resolveEventCustomFlags: () => resolveEventCustomFlags,
|
|
420
434
|
resolvePlaceOfEvent: () => resolvePlaceOfEvent,
|
|
435
|
+
runClientFunction: () => runClientFunction,
|
|
421
436
|
runFieldValidations: () => runFieldValidations,
|
|
422
437
|
runStructuralValidations: () => runStructuralValidations,
|
|
423
438
|
safeUnion: () => safeUnion,
|
|
424
439
|
status: () => status,
|
|
425
440
|
timePeriodToDateRange: () => timePeriodToDateRange,
|
|
441
|
+
todayISO: () => todayISO,
|
|
426
442
|
user: () => user,
|
|
427
443
|
userCanAccessEventWithScopes: () => userCanAccessEventWithScopes,
|
|
428
444
|
validate: () => validate,
|
|
@@ -466,6 +482,7 @@ var RecordScopeTypeV2 = z2.enum([
|
|
|
466
482
|
"record.edit",
|
|
467
483
|
"record.reject",
|
|
468
484
|
"record.archive",
|
|
485
|
+
"record.unarchive",
|
|
469
486
|
"record.review-duplicates",
|
|
470
487
|
"record.register",
|
|
471
488
|
"record.print-certified-copies",
|
|
@@ -505,11 +522,13 @@ var scopeOptionsPlaceEvent = z2.object({
|
|
|
505
522
|
event: scopeByEvent,
|
|
506
523
|
placeOfEvent: JurisdictionFilter.optional()
|
|
507
524
|
}).describe("Options applicable to all record scopes.");
|
|
508
|
-
var
|
|
525
|
+
var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
526
|
+
notifiedIn: JurisdictionFilter.optional(),
|
|
527
|
+
notifiedBy: UserFilter.optional(),
|
|
509
528
|
declaredIn: JurisdictionFilter.optional(),
|
|
510
529
|
declaredBy: UserFilter.optional()
|
|
511
530
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
512
|
-
var AllRecordScopeOptions =
|
|
531
|
+
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
513
532
|
registeredIn: JurisdictionFilter.optional(),
|
|
514
533
|
registeredBy: UserFilter.optional()
|
|
515
534
|
}).describe(
|
|
@@ -547,6 +566,8 @@ var ResolvedScopeOptionsPlaceEvent = z2.object({
|
|
|
547
566
|
"Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
|
|
548
567
|
);
|
|
549
568
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
569
|
+
notifiedIn: UUID.nullish(),
|
|
570
|
+
notifiedBy: z2.string().optional(),
|
|
550
571
|
declaredIn: UUID.nullish(),
|
|
551
572
|
declaredBy: z2.string().optional()
|
|
552
573
|
}).describe(
|
|
@@ -567,6 +588,7 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
|
567
588
|
"record.edit",
|
|
568
589
|
"record.reject",
|
|
569
590
|
"record.archive",
|
|
591
|
+
"record.unarchive",
|
|
570
592
|
"record.review-duplicates",
|
|
571
593
|
"record.register"
|
|
572
594
|
]);
|
|
@@ -592,7 +614,7 @@ var RecordScopeV2 = z2.discriminatedUnion("type", [
|
|
|
592
614
|
}),
|
|
593
615
|
z2.object({
|
|
594
616
|
type: ScopesWithDeclaredOptions,
|
|
595
|
-
options:
|
|
617
|
+
options: scopeOptionsDeclaredOrNotified.optional()
|
|
596
618
|
}),
|
|
597
619
|
z2.object({
|
|
598
620
|
type: ScopesWithFullOptions,
|
|
@@ -697,20 +719,27 @@ var unflattenScope = (input) => {
|
|
|
697
719
|
return { type, options };
|
|
698
720
|
};
|
|
699
721
|
var EncodedScope = z2.string().brand("EncodedScope");
|
|
700
|
-
var
|
|
701
|
-
|
|
722
|
+
var decodedScopeCache = /* @__PURE__ */ new Map();
|
|
723
|
+
var decodeScope = (encodedScope) => {
|
|
724
|
+
if (decodedScopeCache.has(encodedScope)) {
|
|
725
|
+
return decodedScopeCache.get(encodedScope);
|
|
726
|
+
}
|
|
727
|
+
const scope = qs.parse(encodedScope, {
|
|
702
728
|
ignoreQueryPrefix: true,
|
|
703
729
|
comma: true,
|
|
704
730
|
allowDots: true
|
|
705
731
|
});
|
|
706
732
|
const unflattenedScope = unflattenScope(scope);
|
|
707
|
-
|
|
733
|
+
const result = Scope.safeParse(unflattenedScope)?.data;
|
|
734
|
+
decodedScopeCache.set(encodedScope, result);
|
|
735
|
+
return result;
|
|
708
736
|
};
|
|
709
737
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
710
738
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
711
739
|
accessLevel: JurisdictionFilter.enum.all,
|
|
712
|
-
|
|
713
|
-
declaredIn: JurisdictionFilter.enum.all
|
|
740
|
+
notifiedIn: JurisdictionFilter.enum.all,
|
|
741
|
+
declaredIn: JurisdictionFilter.enum.all,
|
|
742
|
+
registeredIn: JurisdictionFilter.enum.all
|
|
714
743
|
};
|
|
715
744
|
function getAcceptedScopesByType({
|
|
716
745
|
acceptedScopes,
|
|
@@ -746,6 +775,7 @@ var ActionType = {
|
|
|
746
775
|
MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
|
|
747
776
|
MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
|
|
748
777
|
ARCHIVE: "ARCHIVE",
|
|
778
|
+
UNARCHIVE: "UNARCHIVE",
|
|
749
779
|
// Record actions
|
|
750
780
|
PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
|
|
751
781
|
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
|
@@ -765,6 +795,7 @@ var ConfirmableActions = [
|
|
|
765
795
|
ActionType.REGISTER,
|
|
766
796
|
ActionType.REJECT,
|
|
767
797
|
ActionType.ARCHIVE,
|
|
798
|
+
ActionType.UNARCHIVE,
|
|
768
799
|
ActionType.PRINT_CERTIFICATE,
|
|
769
800
|
ActionType.REQUEST_CORRECTION,
|
|
770
801
|
ActionType.APPROVE_CORRECTION,
|
|
@@ -783,6 +814,7 @@ var ActionTypes = z4.enum([
|
|
|
783
814
|
"MARK_AS_DUPLICATE",
|
|
784
815
|
"MARK_AS_NOT_DUPLICATE",
|
|
785
816
|
"ARCHIVE",
|
|
817
|
+
"UNARCHIVE",
|
|
786
818
|
"PRINT_CERTIFICATE",
|
|
787
819
|
"REQUEST_CORRECTION",
|
|
788
820
|
"REJECT_CORRECTION",
|
|
@@ -826,6 +858,7 @@ var WorkqueueActionType = ActionTypes.extract([
|
|
|
826
858
|
ActionType.REJECT,
|
|
827
859
|
ActionType.MARK_AS_DUPLICATE,
|
|
828
860
|
ActionType.ARCHIVE,
|
|
861
|
+
ActionType.UNARCHIVE,
|
|
829
862
|
ActionType.PRINT_CERTIFICATE,
|
|
830
863
|
ActionType.REQUEST_CORRECTION
|
|
831
864
|
]);
|
|
@@ -890,6 +923,7 @@ var EventActionEntrySchema = AuditLogEntryBase.extend({
|
|
|
890
923
|
"event.actions.unassign.request",
|
|
891
924
|
"event.actions.read.request",
|
|
892
925
|
"event.actions.archive.request",
|
|
926
|
+
"event.actions.unarchive.request",
|
|
893
927
|
"event.actions.reinstate.request",
|
|
894
928
|
"event.actions.print_certificate.request",
|
|
895
929
|
"event.actions.correction.request.request",
|
|
@@ -1199,6 +1233,11 @@ var FieldTypesToHideInReview = [
|
|
|
1199
1233
|
FieldType.ALPHA_PRINT_BUTTON,
|
|
1200
1234
|
FieldType.ALPHA_HIDDEN
|
|
1201
1235
|
];
|
|
1236
|
+
var HiddenFieldTypes = [
|
|
1237
|
+
FieldType.HTTP,
|
|
1238
|
+
FieldType.QUERY_PARAM_READER,
|
|
1239
|
+
FieldType.ALPHA_HIDDEN
|
|
1240
|
+
];
|
|
1202
1241
|
|
|
1203
1242
|
// ../commons/src/events/FieldValue.ts
|
|
1204
1243
|
var z12 = __toESM(require("zod/v4"));
|
|
@@ -1325,7 +1364,7 @@ function plainDateToLocalDate(date) {
|
|
|
1325
1364
|
// ../commons/src/events/FieldValue.ts
|
|
1326
1365
|
var TextValue = z12.string();
|
|
1327
1366
|
var HiddenFieldValue = z12.string();
|
|
1328
|
-
var NonEmptyTextValue =
|
|
1367
|
+
var NonEmptyTextValue = z12.string().trim().min(1);
|
|
1329
1368
|
var DateValue = z12.iso.date().describe("Date in the format YYYY-MM-DD");
|
|
1330
1369
|
var AgeValue = z12.object({
|
|
1331
1370
|
age: z12.number(),
|
|
@@ -1354,6 +1393,7 @@ var DateRangeFieldValue = z12.object({
|
|
|
1354
1393
|
var EmailValue = z12.email();
|
|
1355
1394
|
var CheckboxFieldValue = z12.boolean();
|
|
1356
1395
|
var NumberFieldValue = z12.number();
|
|
1396
|
+
var SignatureFieldValue = FileFieldValue;
|
|
1357
1397
|
var ButtonFieldValue = z12.number();
|
|
1358
1398
|
var VerificationStatusValue = z12.enum([
|
|
1359
1399
|
"verified",
|
|
@@ -1617,6 +1657,11 @@ var ArchiveAction = ActionBase.extend(
|
|
|
1617
1657
|
content: ReasonContent
|
|
1618
1658
|
}).shape
|
|
1619
1659
|
);
|
|
1660
|
+
var UnarchiveAction = ActionBase.extend(
|
|
1661
|
+
z14.object({
|
|
1662
|
+
type: z14.literal(ActionType.UNARCHIVE)
|
|
1663
|
+
}).shape
|
|
1664
|
+
);
|
|
1620
1665
|
var CreatedAction = ActionBase.extend(
|
|
1621
1666
|
z14.object({
|
|
1622
1667
|
type: z14.literal(ActionType.CREATE)
|
|
@@ -1652,8 +1697,9 @@ var RequestedCorrectionAction = ActionBase.extend(
|
|
|
1652
1697
|
var ApprovedCorrectionAction = ActionBase.extend(
|
|
1653
1698
|
z14.object({
|
|
1654
1699
|
type: z14.literal(ActionType.APPROVE_CORRECTION),
|
|
1655
|
-
requestId: z14.string()
|
|
1700
|
+
requestId: z14.string(),
|
|
1656
1701
|
// TODO move into 'content' property
|
|
1702
|
+
content: z14.object({ immediateCorrection: z14.boolean().optional() }).optional()
|
|
1657
1703
|
}).shape
|
|
1658
1704
|
);
|
|
1659
1705
|
var RejectedCorrectionAction = ActionBase.extend(
|
|
@@ -1682,6 +1728,7 @@ var ActionDocument = z14.discriminatedUnion("type", [
|
|
|
1682
1728
|
MarkNotDuplicateAction.meta({ id: "MarkNotDuplicateAction" }),
|
|
1683
1729
|
MarkAsDuplicateAction.meta({ id: "MarkAsDuplicateAction" }),
|
|
1684
1730
|
ArchiveAction.meta({ id: "ArchiveAction" }),
|
|
1731
|
+
UnarchiveAction.meta({ id: "UnarchiveAction" }),
|
|
1685
1732
|
NotifiedAction.meta({ id: "NotifiedAction" }),
|
|
1686
1733
|
RegisterAction.meta({ id: "RegisterAction" }),
|
|
1687
1734
|
DeclareAction.meta({ id: "DeclareAction" }),
|
|
@@ -1787,6 +1834,7 @@ var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
|
1787
1834
|
)
|
|
1788
1835
|
});
|
|
1789
1836
|
var LegalStatuses = z16.object({
|
|
1837
|
+
[EventStatus.enum.NOTIFIED]: ActionCreationMetadata.nullish(),
|
|
1790
1838
|
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
|
1791
1839
|
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
|
1792
1840
|
});
|
|
@@ -1928,6 +1976,8 @@ var eventMetadataLabelMap = {
|
|
|
1928
1976
|
var EventMetadataDateFieldIdInput = z16.enum([
|
|
1929
1977
|
"createdAt",
|
|
1930
1978
|
"updatedAt",
|
|
1979
|
+
"legalStatuses.NOTIFIED.createdAt",
|
|
1980
|
+
"legalStatuses.NOTIFIED.acceptedAt",
|
|
1931
1981
|
"legalStatuses.DECLARED.createdAt",
|
|
1932
1982
|
"legalStatuses.DECLARED.acceptedAt",
|
|
1933
1983
|
"legalStatuses.REGISTERED.createdAt",
|
|
@@ -1936,6 +1986,8 @@ var EventMetadataDateFieldIdInput = z16.enum([
|
|
|
1936
1986
|
var EventMetadataDateFieldId = z16.enum([
|
|
1937
1987
|
"event.createdAt",
|
|
1938
1988
|
"event.updatedAt",
|
|
1989
|
+
"event.legalStatuses.NOTIFIED.createdAt",
|
|
1990
|
+
"event.legalStatuses.NOTIFIED.acceptedAt",
|
|
1939
1991
|
"event.legalStatuses.DECLARED.createdAt",
|
|
1940
1992
|
"event.legalStatuses.DECLARED.acceptedAt",
|
|
1941
1993
|
"event.legalStatuses.REGISTERED.createdAt",
|
|
@@ -1995,7 +2047,8 @@ var Range = import_v4.z.object({
|
|
|
1995
2047
|
});
|
|
1996
2048
|
var ContainsFlags = import_v4.z.object({
|
|
1997
2049
|
anyOf: import_v4.z.array(Flag).optional(),
|
|
1998
|
-
noneOf: import_v4.z.array(Flag).optional()
|
|
2050
|
+
noneOf: import_v4.z.array(Flag).optional(),
|
|
2051
|
+
allOf: import_v4.z.array(Flag).optional()
|
|
1999
2052
|
}).meta({
|
|
2000
2053
|
id: "ContainsFlags"
|
|
2001
2054
|
});
|
|
@@ -2184,8 +2237,21 @@ var FieldReference = import_v43.default.object({
|
|
|
2184
2237
|
$$field: FieldId.describe("Id of the field to reference"),
|
|
2185
2238
|
$$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
|
|
2186
2239
|
'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
|
|
2240
|
+
),
|
|
2241
|
+
$$code: import_v43.default.string().optional().describe(
|
|
2242
|
+
"Serialised client-side function body. When present the expression is evaluated rather than dereferenced."
|
|
2243
|
+
)
|
|
2244
|
+
}).describe(
|
|
2245
|
+
"Reference to a field value, with an optional client-side computation applied."
|
|
2246
|
+
);
|
|
2247
|
+
function isCodeToEvaluate(v) {
|
|
2248
|
+
return !!v && typeof v === "object" && "$$code" in v;
|
|
2249
|
+
}
|
|
2250
|
+
var ComputedDefaultValue = import_v43.default.object({
|
|
2251
|
+
$$code: import_v43.default.string().describe(
|
|
2252
|
+
"Serialised client-side function body. Receives (undefined, context) where context includes $now, $online, and system variables."
|
|
2187
2253
|
)
|
|
2188
|
-
}).describe("
|
|
2254
|
+
}).describe("A context-only computation used as a field default value.");
|
|
2189
2255
|
var ValidationConfig = import_v43.default.object({
|
|
2190
2256
|
validator: Conditional.describe(
|
|
2191
2257
|
"Conditional expression that must hold for the field value to be considered valid."
|
|
@@ -2226,7 +2292,7 @@ var BaseField = import_v43.default.object({
|
|
|
2226
2292
|
"Indicates whether the field can be modified during record correction."
|
|
2227
2293
|
),
|
|
2228
2294
|
value: FieldReference.or(import_v43.default.array(FieldReference)).optional().describe(
|
|
2229
|
-
"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."
|
|
2295
|
+
"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."
|
|
2230
2296
|
),
|
|
2231
2297
|
analytics: import_v43.default.boolean().default(false).optional().describe(
|
|
2232
2298
|
"Indicates whether the field is included in analytics. When enabled, its value becomes available in the analytics dashboard."
|
|
@@ -2240,7 +2306,7 @@ var Divider = BaseField.extend({
|
|
|
2240
2306
|
});
|
|
2241
2307
|
var TextField = BaseField.extend({
|
|
2242
2308
|
type: import_v43.default.literal(FieldType.TEXT),
|
|
2243
|
-
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
2309
|
+
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
|
|
2244
2310
|
configuration: import_v43.default.object({
|
|
2245
2311
|
maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
|
|
2246
2312
|
type: import_v43.default.enum(["text", "password"]).optional(),
|
|
@@ -2253,10 +2319,11 @@ var TextField = BaseField.extend({
|
|
|
2253
2319
|
});
|
|
2254
2320
|
var NumberField = BaseField.extend({
|
|
2255
2321
|
type: import_v43.default.literal(FieldType.NUMBER),
|
|
2256
|
-
defaultValue: NumberFieldValue.optional(),
|
|
2322
|
+
defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
|
|
2257
2323
|
configuration: import_v43.default.object({
|
|
2258
2324
|
min: import_v43.default.number().optional().describe("Minimum value"),
|
|
2259
2325
|
max: import_v43.default.number().optional().describe("Maximum value"),
|
|
2326
|
+
integer: import_v43.default.boolean().optional().describe("When true, only whole numbers are allowed"),
|
|
2260
2327
|
prefix: TranslationConfig.optional(),
|
|
2261
2328
|
postfix: TranslationConfig.optional()
|
|
2262
2329
|
}).optional()
|
|
@@ -2266,7 +2333,7 @@ var NumberField = BaseField.extend({
|
|
|
2266
2333
|
});
|
|
2267
2334
|
var TextAreaField = BaseField.extend({
|
|
2268
2335
|
type: import_v43.default.literal(FieldType.TEXTAREA),
|
|
2269
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
2336
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
2270
2337
|
configuration: import_v43.default.object({
|
|
2271
2338
|
maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
|
|
2272
2339
|
rows: import_v43.default.number().optional().describe("Number of visible text lines"),
|
|
@@ -2300,7 +2367,7 @@ var SignatureField = BaseField.extend({
|
|
|
2300
2367
|
signaturePromptLabel: TranslationConfig.describe(
|
|
2301
2368
|
"Title of the signature modal"
|
|
2302
2369
|
),
|
|
2303
|
-
defaultValue:
|
|
2370
|
+
defaultValue: SignatureFieldValue.or(ComputedDefaultValue).optional(),
|
|
2304
2371
|
configuration: import_v43.default.object({
|
|
2305
2372
|
maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
|
2306
2373
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
|
@@ -2316,14 +2383,14 @@ var EmailField = BaseField.extend({
|
|
|
2316
2383
|
configuration: import_v43.default.object({
|
|
2317
2384
|
maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
|
|
2318
2385
|
}).default({ maxLength: 255 }).optional(),
|
|
2319
|
-
defaultValue: NonEmptyTextValue.optional()
|
|
2386
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional()
|
|
2320
2387
|
}).meta({
|
|
2321
2388
|
description: "An email input field",
|
|
2322
2389
|
id: "EmailField"
|
|
2323
2390
|
});
|
|
2324
2391
|
var DateField = BaseField.extend({
|
|
2325
2392
|
type: import_v43.default.literal(FieldType.DATE),
|
|
2326
|
-
defaultValue: SerializedNowDateTime.or(PlainDate).optional().describe("Default date value(yyyy-MM-dd)"),
|
|
2393
|
+
defaultValue: SerializedNowDateTime.or(PlainDate).or(ComputedDefaultValue).optional().describe("Default date value(yyyy-MM-dd)"),
|
|
2327
2394
|
configuration: import_v43.default.object({
|
|
2328
2395
|
notice: TranslationConfig.describe(
|
|
2329
2396
|
"Text to display above the date input"
|
|
@@ -2335,7 +2402,7 @@ var DateField = BaseField.extend({
|
|
|
2335
2402
|
});
|
|
2336
2403
|
var AgeField = BaseField.extend({
|
|
2337
2404
|
type: import_v43.default.literal(FieldType.AGE),
|
|
2338
|
-
defaultValue: NumberFieldValue.optional(),
|
|
2405
|
+
defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
|
|
2339
2406
|
configuration: import_v43.default.object({
|
|
2340
2407
|
asOfDate: FieldReference,
|
|
2341
2408
|
prefix: TranslationConfig.optional(),
|
|
@@ -2347,7 +2414,7 @@ var AgeField = BaseField.extend({
|
|
|
2347
2414
|
});
|
|
2348
2415
|
var TimeField = BaseField.extend({
|
|
2349
2416
|
type: import_v43.default.literal(FieldType.TIME),
|
|
2350
|
-
defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
|
|
2417
|
+
defaultValue: SerializedNowDateTime.or(TimeValue).or(ComputedDefaultValue).optional().describe("Default time value (HH-mm)"),
|
|
2351
2418
|
configuration: import_v43.default.object({
|
|
2352
2419
|
use12HourFormat: import_v43.default.boolean().optional().describe("Whether to use 12-hour format"),
|
|
2353
2420
|
notice: TranslationConfig.describe(
|
|
@@ -2360,7 +2427,7 @@ var TimeField = BaseField.extend({
|
|
|
2360
2427
|
});
|
|
2361
2428
|
var DateRangeField = BaseField.extend({
|
|
2362
2429
|
type: import_v43.default.literal(FieldType.DATE_RANGE),
|
|
2363
|
-
defaultValue: DateRangeFieldValue.optional(),
|
|
2430
|
+
defaultValue: DateRangeFieldValue.or(ComputedDefaultValue).optional(),
|
|
2364
2431
|
configuration: import_v43.default.object({
|
|
2365
2432
|
notice: TranslationConfig.describe(
|
|
2366
2433
|
"Text to display above the date input"
|
|
@@ -2439,7 +2506,7 @@ var PageHeader = BaseField.extend({
|
|
|
2439
2506
|
});
|
|
2440
2507
|
var File = BaseField.extend({
|
|
2441
2508
|
type: import_v43.default.literal(FieldType.FILE),
|
|
2442
|
-
defaultValue: FileFieldValue.optional(),
|
|
2509
|
+
defaultValue: FileFieldValue.or(ComputedDefaultValue).optional(),
|
|
2443
2510
|
configuration: import_v43.default.object({
|
|
2444
2511
|
maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
|
2445
2512
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
|
|
@@ -2466,7 +2533,7 @@ var SelectOption = import_v43.default.object({
|
|
|
2466
2533
|
});
|
|
2467
2534
|
var NumberWithUnitField = BaseField.extend({
|
|
2468
2535
|
type: import_v43.default.literal(FieldType.NUMBER_WITH_UNIT),
|
|
2469
|
-
defaultValue: NumberWithUnitFieldValue.optional(),
|
|
2536
|
+
defaultValue: NumberWithUnitFieldValue.or(ComputedDefaultValue).optional(),
|
|
2470
2537
|
options: import_v43.default.array(SelectOption).describe("A list of options for the unit select"),
|
|
2471
2538
|
configuration: import_v43.default.object({
|
|
2472
2539
|
min: import_v43.default.number().optional().describe("Minimum value of the number field"),
|
|
@@ -2481,7 +2548,7 @@ var NumberWithUnitField = BaseField.extend({
|
|
|
2481
2548
|
});
|
|
2482
2549
|
var RadioGroup = BaseField.extend({
|
|
2483
2550
|
type: import_v43.default.literal(FieldType.RADIO_GROUP),
|
|
2484
|
-
defaultValue: TextValue.optional(),
|
|
2551
|
+
defaultValue: TextValue.or(ComputedDefaultValue).optional(),
|
|
2485
2552
|
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
2486
2553
|
configuration: import_v43.default.object({
|
|
2487
2554
|
styles: import_v43.default.object({
|
|
@@ -2506,7 +2573,7 @@ var BulletList = BaseField.extend({
|
|
|
2506
2573
|
});
|
|
2507
2574
|
var Select = BaseField.extend({
|
|
2508
2575
|
type: import_v43.default.literal(FieldType.SELECT),
|
|
2509
|
-
defaultValue: TextValue.optional(),
|
|
2576
|
+
defaultValue: TextValue.or(ComputedDefaultValue).optional(),
|
|
2510
2577
|
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
2511
2578
|
noOptionsMessage: TranslationConfig.optional().describe(
|
|
2512
2579
|
`
|
|
@@ -2528,7 +2595,7 @@ var SelectDateRangeOption = import_v43.default.object({
|
|
|
2528
2595
|
});
|
|
2529
2596
|
var SelectDateRangeField = BaseField.extend({
|
|
2530
2597
|
type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
|
|
2531
|
-
defaultValue: SelectDateRangeValue.optional(),
|
|
2598
|
+
defaultValue: SelectDateRangeValue.or(ComputedDefaultValue).optional(),
|
|
2532
2599
|
options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
|
|
2533
2600
|
}).meta({
|
|
2534
2601
|
description: "A date range selection field",
|
|
@@ -2545,7 +2612,7 @@ var NameField = BaseField.extend({
|
|
|
2545
2612
|
firstname: SerializedUserField.or(NonEmptyTextValue).optional(),
|
|
2546
2613
|
middlename: SerializedUserField.or(NonEmptyTextValue).optional(),
|
|
2547
2614
|
surname: SerializedUserField.or(NonEmptyTextValue).optional()
|
|
2548
|
-
}).optional(),
|
|
2615
|
+
}).or(ComputedDefaultValue).optional(),
|
|
2549
2616
|
configuration: import_v43.default.object({
|
|
2550
2617
|
name: NameConfig.default({
|
|
2551
2618
|
firstname: { required: true },
|
|
@@ -2569,14 +2636,14 @@ var NameField = BaseField.extend({
|
|
|
2569
2636
|
id: "NameField"
|
|
2570
2637
|
});
|
|
2571
2638
|
var PhoneField = BaseField.extend({
|
|
2572
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
2639
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
2573
2640
|
type: import_v43.default.literal(FieldType.PHONE)
|
|
2574
2641
|
}).meta({
|
|
2575
2642
|
description: "A field for entering a phone number",
|
|
2576
2643
|
id: "PhoneField"
|
|
2577
2644
|
});
|
|
2578
2645
|
var IdField = BaseField.extend({
|
|
2579
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
2646
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
2580
2647
|
type: import_v43.default.literal(FieldType.ID)
|
|
2581
2648
|
}).meta({
|
|
2582
2649
|
description: "A field for entering an ID",
|
|
@@ -2584,14 +2651,14 @@ var IdField = BaseField.extend({
|
|
|
2584
2651
|
});
|
|
2585
2652
|
var Checkbox = BaseField.extend({
|
|
2586
2653
|
type: import_v43.default.literal(FieldType.CHECKBOX),
|
|
2587
|
-
defaultValue: CheckboxFieldValue.default(false)
|
|
2654
|
+
defaultValue: CheckboxFieldValue.or(ComputedDefaultValue).default(false)
|
|
2588
2655
|
}).meta({
|
|
2589
2656
|
description: "A boolean checkbox field",
|
|
2590
2657
|
id: "Checkbox"
|
|
2591
2658
|
});
|
|
2592
2659
|
var Country = BaseField.extend({
|
|
2593
2660
|
type: import_v43.default.literal(FieldType.COUNTRY),
|
|
2594
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
2661
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
2595
2662
|
optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
|
|
2596
2663
|
"Conditionals for specific countries. Countries not listed are always shown and enabled."
|
|
2597
2664
|
)
|
|
@@ -2609,7 +2676,7 @@ var AdministrativeAreas = import_v43.default.enum([
|
|
|
2609
2676
|
]);
|
|
2610
2677
|
var AdministrativeAreaField = BaseField.extend({
|
|
2611
2678
|
type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
|
|
2612
|
-
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
2679
|
+
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
|
|
2613
2680
|
configuration: import_v43.default.object({
|
|
2614
2681
|
partOf: FieldReference.optional().describe("Parent location"),
|
|
2615
2682
|
type: AdministrativeAreas,
|
|
@@ -2621,7 +2688,7 @@ var AdministrativeAreaField = BaseField.extend({
|
|
|
2621
2688
|
});
|
|
2622
2689
|
var LocationInput = BaseField.extend({
|
|
2623
2690
|
type: import_v43.default.literal(FieldType.LOCATION),
|
|
2624
|
-
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
2691
|
+
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
|
|
2625
2692
|
configuration: import_v43.default.object({
|
|
2626
2693
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
2627
2694
|
allowedLocations: AllowedLocations
|
|
@@ -2633,7 +2700,7 @@ var LocationInput = BaseField.extend({
|
|
|
2633
2700
|
var FileUploadWithOptions = BaseField.extend({
|
|
2634
2701
|
type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
|
|
2635
2702
|
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
2636
|
-
defaultValue: FileFieldWithOptionValue.optional(),
|
|
2703
|
+
defaultValue: FileFieldWithOptionValue.or(ComputedDefaultValue).optional(),
|
|
2637
2704
|
configuration: import_v43.default.object({
|
|
2638
2705
|
maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
|
2639
2706
|
maxImageSize: import_v43.default.object({
|
|
@@ -2649,12 +2716,12 @@ var FileUploadWithOptions = BaseField.extend({
|
|
|
2649
2716
|
});
|
|
2650
2717
|
var Facility = BaseField.extend({
|
|
2651
2718
|
type: import_v43.default.literal(FieldType.FACILITY),
|
|
2652
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
2719
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
2653
2720
|
configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
|
|
2654
2721
|
}).describe("Input field for a facility");
|
|
2655
2722
|
var Office = BaseField.extend({
|
|
2656
2723
|
type: import_v43.default.literal(FieldType.OFFICE),
|
|
2657
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
2724
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
2658
2725
|
configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
|
|
2659
2726
|
}).describe("Input field for an office");
|
|
2660
2727
|
var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
|
|
@@ -2690,7 +2757,7 @@ var Address = BaseField.extend({
|
|
|
2690
2757
|
).optional(),
|
|
2691
2758
|
allowedLocations: AllowedLocations
|
|
2692
2759
|
}).optional(),
|
|
2693
|
-
defaultValue: DefaultAddressFieldValue.optional()
|
|
2760
|
+
defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
|
|
2694
2761
|
}).meta({
|
|
2695
2762
|
description: "Address input field \u2013 a combination of location and text fields",
|
|
2696
2763
|
id: "Address"
|
|
@@ -2737,7 +2804,7 @@ var ButtonConfiguration = import_v43.default.object({
|
|
|
2737
2804
|
});
|
|
2738
2805
|
var ButtonField = BaseField.extend({
|
|
2739
2806
|
type: import_v43.default.literal(FieldType.BUTTON),
|
|
2740
|
-
defaultValue: ButtonFieldValue.optional(),
|
|
2807
|
+
defaultValue: ButtonFieldValue.or(ComputedDefaultValue).optional(),
|
|
2741
2808
|
configuration: ButtonConfiguration
|
|
2742
2809
|
}).meta({
|
|
2743
2810
|
description: "A generic button that can be used to trigger an action",
|
|
@@ -2765,7 +2832,7 @@ var AlphaPrintButton = BaseField.extend({
|
|
|
2765
2832
|
});
|
|
2766
2833
|
var HttpField = BaseField.extend({
|
|
2767
2834
|
type: import_v43.default.literal(FieldType.HTTP),
|
|
2768
|
-
defaultValue: HttpFieldValue.optional(),
|
|
2835
|
+
defaultValue: HttpFieldValue.or(ComputedDefaultValue).optional(),
|
|
2769
2836
|
configuration: import_v43.default.object({
|
|
2770
2837
|
trigger: FieldReference.optional().describe(
|
|
2771
2838
|
"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."
|
|
@@ -2851,7 +2918,7 @@ var LinkButtonField = BaseField.extend({
|
|
|
2851
2918
|
});
|
|
2852
2919
|
var VerificationStatus = BaseField.extend({
|
|
2853
2920
|
type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
|
|
2854
|
-
defaultValue: VerificationStatusValue.optional(),
|
|
2921
|
+
defaultValue: VerificationStatusValue.or(ComputedDefaultValue).optional(),
|
|
2855
2922
|
configuration: import_v43.default.object({
|
|
2856
2923
|
status: TranslationConfig.describe("Text to display on the status pill."),
|
|
2857
2924
|
description: TranslationConfig.describe(
|
|
@@ -2873,7 +2940,7 @@ var QueryParamReaderField = BaseField.extend({
|
|
|
2873
2940
|
});
|
|
2874
2941
|
var QrReaderField = BaseField.extend({
|
|
2875
2942
|
type: import_v43.default.literal(FieldType.QR_READER),
|
|
2876
|
-
defaultValue: QrReaderFieldValue.optional(),
|
|
2943
|
+
defaultValue: QrReaderFieldValue.or(ComputedDefaultValue).optional(),
|
|
2877
2944
|
configuration: import_v43.default.object({
|
|
2878
2945
|
validator: import_v43.default.any().meta({
|
|
2879
2946
|
description: "JSON Schema to validate the scanned QR code data against before populating the form fields.",
|
|
@@ -2886,7 +2953,7 @@ var QrReaderField = BaseField.extend({
|
|
|
2886
2953
|
});
|
|
2887
2954
|
var IdReaderField = BaseField.extend({
|
|
2888
2955
|
type: import_v43.default.literal(FieldType.ID_READER),
|
|
2889
|
-
defaultValue: IdReaderFieldValue.optional(),
|
|
2956
|
+
defaultValue: IdReaderFieldValue.or(ComputedDefaultValue).optional(),
|
|
2890
2957
|
methods: import_v43.default.array(
|
|
2891
2958
|
import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
|
|
2892
2959
|
)
|
|
@@ -3180,6 +3247,11 @@ var ReadActionConfig = ActionConfigBase.extend(
|
|
|
3180
3247
|
conditionals: z24.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
|
|
3181
3248
|
}).shape
|
|
3182
3249
|
);
|
|
3250
|
+
var NotifyConfig = ActionConfigBase.extend(
|
|
3251
|
+
z24.object({
|
|
3252
|
+
type: z24.literal(ActionType.NOTIFY)
|
|
3253
|
+
}).shape
|
|
3254
|
+
);
|
|
3183
3255
|
var DeclareConfig = DeclarationActionBase.extend(
|
|
3184
3256
|
z24.object({
|
|
3185
3257
|
type: z24.literal(ActionType.DECLARE),
|
|
@@ -3204,6 +3276,11 @@ var ArchiveConfig = ActionConfigBase.extend(
|
|
|
3204
3276
|
type: z24.literal(ActionType.ARCHIVE)
|
|
3205
3277
|
}).shape
|
|
3206
3278
|
);
|
|
3279
|
+
var UnarchiveConfig = ActionConfigBase.extend(
|
|
3280
|
+
z24.object({
|
|
3281
|
+
type: z24.literal(ActionType.UNARCHIVE)
|
|
3282
|
+
}).shape
|
|
3283
|
+
);
|
|
3207
3284
|
var EditActionConfig = ActionConfigBase.extend(
|
|
3208
3285
|
z24.object({
|
|
3209
3286
|
type: z24.literal(ActionType.EDIT),
|
|
@@ -3264,9 +3341,13 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3264
3341
|
id: "ReadActionConfig",
|
|
3265
3342
|
description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
|
|
3266
3343
|
}),
|
|
3344
|
+
NotifyConfig.meta({
|
|
3345
|
+
id: "NotifyActionConfig",
|
|
3346
|
+
description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
|
|
3347
|
+
}),
|
|
3267
3348
|
DeclareConfig.meta({
|
|
3268
3349
|
id: "DeclareActionConfig",
|
|
3269
|
-
description: "Configuration for the declare action. Includes review-page fields.
|
|
3350
|
+
description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
|
|
3270
3351
|
}),
|
|
3271
3352
|
RejectConfig.meta({
|
|
3272
3353
|
id: "RejectActionConfig",
|
|
@@ -3292,6 +3373,10 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3292
3373
|
id: "ArchiveActionConfig",
|
|
3293
3374
|
description: "Configuration for archiving a record."
|
|
3294
3375
|
}),
|
|
3376
|
+
UnarchiveConfig.meta({
|
|
3377
|
+
id: "UnarchiveActionConfig",
|
|
3378
|
+
description: "Configuration for unarchiving a record."
|
|
3379
|
+
}),
|
|
3295
3380
|
CustomActionConfig.meta({
|
|
3296
3381
|
id: "CustomActionConfig",
|
|
3297
3382
|
description: "Configuration for a country-defined custom action. An event may include any number of these."
|
|
@@ -3445,6 +3530,9 @@ var BaseField3 = z28.object({
|
|
|
3445
3530
|
),
|
|
3446
3531
|
validations: z28.array(ValidationConfig).optional().describe(
|
|
3447
3532
|
`Option for overriding the field validations specifically for advanced search form.`
|
|
3533
|
+
),
|
|
3534
|
+
allowedLocations: JurisdictionReference.optional().describe(
|
|
3535
|
+
`Override the allowedLocations for a location field in advanced search. Use this when the declaration form's allowedLocations references a scope (e.g. record.create) that search-only users don't have \u2014 specify record.search scope instead.`
|
|
3448
3536
|
)
|
|
3449
3537
|
});
|
|
3450
3538
|
var SearchQueryParams = z28.object({
|
|
@@ -3519,9 +3607,11 @@ var z30 = __toESM(require("zod/v4"));
|
|
|
3519
3607
|
var z29 = __toESM(require("zod/v4"));
|
|
3520
3608
|
function getDynamicNameValue(field3) {
|
|
3521
3609
|
const nameConfiguration = field3.configuration?.name;
|
|
3610
|
+
const firstnameRequired = nameConfiguration?.firstname?.required ?? field3.required;
|
|
3611
|
+
const surnameRequired = nameConfiguration?.surname?.required ?? field3.required;
|
|
3522
3612
|
return z29.object({
|
|
3523
|
-
firstname:
|
|
3524
|
-
surname:
|
|
3613
|
+
firstname: firstnameRequired ? NonEmptyTextValue : TextValue,
|
|
3614
|
+
surname: surnameRequired ? NonEmptyTextValue : TextValue,
|
|
3525
3615
|
middlename: nameConfiguration?.middlename?.required ? NonEmptyTextValue : TextValue.optional()
|
|
3526
3616
|
});
|
|
3527
3617
|
}
|
|
@@ -3868,7 +3958,7 @@ var isHiddenFieldType = (field3) => {
|
|
|
3868
3958
|
return field3.config.type === FieldType.ALPHA_HIDDEN;
|
|
3869
3959
|
};
|
|
3870
3960
|
var isNonInteractiveFieldType = (field3) => {
|
|
3871
|
-
return field3.type === FieldType.DIVIDER || field3.type === FieldType.PAGE_HEADER || field3.type === FieldType.PARAGRAPH || field3.type === FieldType.HEADING || field3.type === FieldType.BULLET_LIST || field3.type === FieldType.DATA || field3.type === FieldType.ALPHA_PRINT_BUTTON || field3.type === FieldType.
|
|
3961
|
+
return field3.type === FieldType.DIVIDER || field3.type === FieldType.PAGE_HEADER || field3.type === FieldType.PARAGRAPH || field3.type === FieldType.HEADING || field3.type === FieldType.BULLET_LIST || field3.type === FieldType.DATA || field3.type === FieldType.ALPHA_PRINT_BUTTON || field3.type === FieldType.LINK_BUTTON || field3.type === FieldType.LOADER;
|
|
3872
3962
|
};
|
|
3873
3963
|
|
|
3874
3964
|
// ../commons/src/conditionals/validate.ts
|
|
@@ -3904,7 +3994,37 @@ function resolveDataPath(rootData, dataPath, instancePath) {
|
|
|
3904
3994
|
}
|
|
3905
3995
|
return current;
|
|
3906
3996
|
}
|
|
3997
|
+
function todayISO() {
|
|
3998
|
+
return (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
|
|
3999
|
+
}
|
|
4000
|
+
var compiledFunctionCache = /* @__PURE__ */ new Map();
|
|
4001
|
+
function compileClientFunction(code) {
|
|
4002
|
+
let fn = compiledFunctionCache.get(code);
|
|
4003
|
+
if (!fn) {
|
|
4004
|
+
fn = new Function(`return (${code})`)();
|
|
4005
|
+
compiledFunctionCache.set(code, fn);
|
|
4006
|
+
}
|
|
4007
|
+
return fn;
|
|
4008
|
+
}
|
|
3907
4009
|
(0, import_ajv_formats.default)(ajv);
|
|
4010
|
+
function buildClientFunctionContext(input) {
|
|
4011
|
+
return {
|
|
4012
|
+
$form: input.form,
|
|
4013
|
+
$now: todayISO(),
|
|
4014
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
4015
|
+
$online: isOnline(),
|
|
4016
|
+
$user: input.validatorContext?.user,
|
|
4017
|
+
$event: input.validatorContext?.event,
|
|
4018
|
+
$leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
|
|
4019
|
+
user: input.systemVariables?.user,
|
|
4020
|
+
$window: input.systemVariables?.$window,
|
|
4021
|
+
locations: input.locations,
|
|
4022
|
+
adminLevelIds: input.adminLevelIds
|
|
4023
|
+
};
|
|
4024
|
+
}
|
|
4025
|
+
function runClientFunction(code, data, context) {
|
|
4026
|
+
return compileClientFunction(code)(data, context);
|
|
4027
|
+
}
|
|
3908
4028
|
ajv.addKeyword({
|
|
3909
4029
|
keyword: "daysFromDate",
|
|
3910
4030
|
type: "string",
|
|
@@ -3949,7 +4069,7 @@ ajv.addKeyword({
|
|
|
3949
4069
|
$data: true,
|
|
3950
4070
|
errors: true,
|
|
3951
4071
|
// @ts-ignore -- Force type. We will move this away from AJV next. Parsing the array will take seconds and is only called by core.
|
|
3952
|
-
validate(
|
|
4072
|
+
validate(_schema, data, _2, dataContext) {
|
|
3953
4073
|
const locationIdInput = data;
|
|
3954
4074
|
const locations = dataContext?.rootData.$leafAdminStructureLocationIds ?? [];
|
|
3955
4075
|
return locations.some((location) => location.id === locationIdInput);
|
|
@@ -3980,6 +4100,23 @@ function isAgeValue(value) {
|
|
|
3980
4100
|
function mergeWithBaseFormState(values, context) {
|
|
3981
4101
|
return { ...context.baseFormState, ...values };
|
|
3982
4102
|
}
|
|
4103
|
+
ajv.addKeyword({
|
|
4104
|
+
keyword: "customClientValidator",
|
|
4105
|
+
schemaType: "object",
|
|
4106
|
+
errors: true,
|
|
4107
|
+
// @ts-expect-error -- AJV's public types don't expose `rootData`. All
|
|
4108
|
+
// `validate()` callers build root data via `buildClientFunctionContext`,
|
|
4109
|
+
// so the cast holds.
|
|
4110
|
+
validate(schema, data, _2, dataContext) {
|
|
4111
|
+
return Boolean(
|
|
4112
|
+
runClientFunction(
|
|
4113
|
+
schema.code,
|
|
4114
|
+
data,
|
|
4115
|
+
dataContext?.rootData ?? buildClientFunctionContext({ form: {} })
|
|
4116
|
+
)
|
|
4117
|
+
);
|
|
4118
|
+
}
|
|
4119
|
+
});
|
|
3983
4120
|
function validate(schema, data) {
|
|
3984
4121
|
const validator = ajv.getSchema(schema.$id) || ajv.compile(schema);
|
|
3985
4122
|
if ("$form" in data) {
|
|
@@ -4016,17 +4153,14 @@ function isOnline() {
|
|
|
4016
4153
|
}
|
|
4017
4154
|
return true;
|
|
4018
4155
|
}
|
|
4019
|
-
function isConditionMet(conditional, values, context
|
|
4020
|
-
return validate(
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
$status: eventIndex?.status,
|
|
4028
|
-
$event: context.event
|
|
4029
|
-
});
|
|
4156
|
+
function isConditionMet(conditional, values, context) {
|
|
4157
|
+
return validate(
|
|
4158
|
+
conditional,
|
|
4159
|
+
buildClientFunctionContext({
|
|
4160
|
+
form: mergeWithBaseFormState(values, context),
|
|
4161
|
+
validatorContext: context
|
|
4162
|
+
})
|
|
4163
|
+
);
|
|
4030
4164
|
}
|
|
4031
4165
|
function getConditionalActionsForField(field3, values) {
|
|
4032
4166
|
if (!field3.conditionals) {
|
|
@@ -4034,9 +4168,9 @@ function getConditionalActionsForField(field3, values) {
|
|
|
4034
4168
|
}
|
|
4035
4169
|
return field3.conditionals.filter((conditional) => validate(conditional.conditional, values)).map((conditional) => conditional.type);
|
|
4036
4170
|
}
|
|
4037
|
-
function areConditionsMet(conditions, values, context,
|
|
4171
|
+
function areConditionsMet(conditions, values, context, _event) {
|
|
4038
4172
|
return conditions.every(
|
|
4039
|
-
(condition) => isConditionMet(condition.conditional, values, context
|
|
4173
|
+
(condition) => isConditionMet(condition.conditional, values, context)
|
|
4040
4174
|
);
|
|
4041
4175
|
}
|
|
4042
4176
|
function isFieldConditionMet(field3, form, conditionalType, context) {
|
|
@@ -4046,14 +4180,13 @@ function isFieldConditionMet(field3, form, conditionalType, context) {
|
|
|
4046
4180
|
if (!hasRule) {
|
|
4047
4181
|
return true;
|
|
4048
4182
|
}
|
|
4049
|
-
const validConditionals = getConditionalActionsForField(
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
});
|
|
4183
|
+
const validConditionals = getConditionalActionsForField(
|
|
4184
|
+
field3,
|
|
4185
|
+
buildClientFunctionContext({
|
|
4186
|
+
form: mergeWithBaseFormState(form, context),
|
|
4187
|
+
validatorContext: context
|
|
4188
|
+
})
|
|
4189
|
+
);
|
|
4057
4190
|
return validConditionals.includes(conditionalType);
|
|
4058
4191
|
}
|
|
4059
4192
|
function isFieldVisible(field3, form, context) {
|
|
@@ -4079,7 +4212,14 @@ function isActionConditionMet(actionConfig, event2, context, conditionalType) {
|
|
|
4079
4212
|
if (!rule) {
|
|
4080
4213
|
return true;
|
|
4081
4214
|
}
|
|
4082
|
-
return
|
|
4215
|
+
return validate(rule.conditional, {
|
|
4216
|
+
...buildClientFunctionContext({
|
|
4217
|
+
form: mergeWithBaseFormState(event2.declaration, context),
|
|
4218
|
+
validatorContext: context
|
|
4219
|
+
}),
|
|
4220
|
+
$flags: event2.flags,
|
|
4221
|
+
$status: event2.status
|
|
4222
|
+
});
|
|
4083
4223
|
}
|
|
4084
4224
|
function isActionEnabled(actionConfig, event2, context) {
|
|
4085
4225
|
return isActionConditionMet(
|
|
@@ -4238,19 +4378,10 @@ function runFieldValidations({
|
|
|
4238
4378
|
if (!isFieldVisible(field3.config, form, context)) {
|
|
4239
4379
|
return [];
|
|
4240
4380
|
}
|
|
4241
|
-
const conditionalParameters = {
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
* In real use cases, there can be hundreds of thousands of locations.
|
|
4246
|
-
* Make sure that the context contains only the locations that are needed for validation.
|
|
4247
|
-
* E.g. if the user is a leaf admin, only the leaf locations under their admin structure are needed.
|
|
4248
|
-
* Loading few megabytes of locations to memory just for validation is not efficient and will choke the application.
|
|
4249
|
-
*/
|
|
4250
|
-
$leafAdminStructureLocationIds: context.leafAdminStructureLocationIds ?? [],
|
|
4251
|
-
$online: isOnline(),
|
|
4252
|
-
$user: context.user
|
|
4253
|
-
};
|
|
4381
|
+
const conditionalParameters = buildClientFunctionContext({
|
|
4382
|
+
form: mergeWithBaseFormState(form, context),
|
|
4383
|
+
validatorContext: context
|
|
4384
|
+
});
|
|
4254
4385
|
if (isFieldGroupFieldType(field3)) {
|
|
4255
4386
|
const subfieldErrors = buildFormState(
|
|
4256
4387
|
field3.config.fields,
|
|
@@ -4389,13 +4520,13 @@ function getActionConfig({
|
|
|
4389
4520
|
actionType,
|
|
4390
4521
|
customActionType
|
|
4391
4522
|
}) {
|
|
4523
|
+
if (actionType === ActionType.NOTIFY) {
|
|
4524
|
+
return eventConfiguration.actions.find((a) => a.type === ActionType.NOTIFY) ?? eventConfiguration.actions.find((a) => a.type === ActionType.DECLARE);
|
|
4525
|
+
}
|
|
4392
4526
|
return eventConfiguration.actions.find((a) => {
|
|
4393
4527
|
if (a.type === ActionType.CUSTOM && customActionType) {
|
|
4394
4528
|
return a.customActionType === customActionType;
|
|
4395
4529
|
}
|
|
4396
|
-
if (actionType === ActionType.NOTIFY) {
|
|
4397
|
-
return a.type === ActionType.DECLARE;
|
|
4398
|
-
}
|
|
4399
4530
|
if (actionType === ActionType.APPROVE_CORRECTION || actionType === ActionType.REJECT_CORRECTION) {
|
|
4400
4531
|
return a.type === ActionType.REQUEST_CORRECTION;
|
|
4401
4532
|
}
|
|
@@ -4432,7 +4563,7 @@ var getActionAnnotationFields = (actionConfig) => {
|
|
|
4432
4563
|
if (actionConfig.type === ActionType.CUSTOM) {
|
|
4433
4564
|
return actionConfig.form;
|
|
4434
4565
|
}
|
|
4435
|
-
if ("review" in actionConfig) {
|
|
4566
|
+
if ("review" in actionConfig && actionConfig.review != null) {
|
|
4436
4567
|
return actionConfig.review.fields;
|
|
4437
4568
|
}
|
|
4438
4569
|
return [];
|
|
@@ -4734,19 +4865,32 @@ function getPendingAction(actions) {
|
|
|
4734
4865
|
}
|
|
4735
4866
|
return pendingActions[0];
|
|
4736
4867
|
}
|
|
4737
|
-
function getCompleteActionAnnotation(
|
|
4868
|
+
function getCompleteActionAnnotation(event2, action) {
|
|
4738
4869
|
if (action.originalActionId) {
|
|
4739
4870
|
const originalAction = event2.actions.find(
|
|
4740
4871
|
({ id }) => id === action.originalActionId
|
|
4741
4872
|
);
|
|
4742
4873
|
if (originalAction?.status === ActionStatus.Requested) {
|
|
4743
|
-
return deepMerge(
|
|
4744
|
-
deepMerge(annotation, originalAction.annotation ?? {}),
|
|
4745
|
-
action.annotation ?? {}
|
|
4746
|
-
);
|
|
4874
|
+
return deepMerge(originalAction.annotation ?? {}, action.annotation ?? {});
|
|
4747
4875
|
}
|
|
4748
4876
|
}
|
|
4749
|
-
return
|
|
4877
|
+
return action.annotation ?? {};
|
|
4878
|
+
}
|
|
4879
|
+
function getCompleteActionContent(event2, action) {
|
|
4880
|
+
const currentContent = "content" in action ? action.content : void 0;
|
|
4881
|
+
if (!action.originalActionId) {
|
|
4882
|
+
return currentContent;
|
|
4883
|
+
}
|
|
4884
|
+
const originalAction = event2.actions.find(
|
|
4885
|
+
({ id }) => id === action.originalActionId
|
|
4886
|
+
);
|
|
4887
|
+
if (originalAction && "content" in originalAction && originalAction.content) {
|
|
4888
|
+
return {
|
|
4889
|
+
...originalAction.content,
|
|
4890
|
+
...currentContent ?? {}
|
|
4891
|
+
};
|
|
4892
|
+
}
|
|
4893
|
+
return currentContent;
|
|
4750
4894
|
}
|
|
4751
4895
|
function getCompleteActionDeclaration(declaration, event2, action) {
|
|
4752
4896
|
if (action.originalActionId) {
|
|
@@ -4766,7 +4910,7 @@ function getAcceptedActions(event2) {
|
|
|
4766
4910
|
return event2.actions.filter(isAcceptedAction).map((action) => ({
|
|
4767
4911
|
...action,
|
|
4768
4912
|
declaration: getCompleteActionDeclaration({}, event2, action),
|
|
4769
|
-
annotation: getCompleteActionAnnotation(
|
|
4913
|
+
annotation: getCompleteActionAnnotation(event2, action)
|
|
4770
4914
|
}));
|
|
4771
4915
|
}
|
|
4772
4916
|
var EXCLUDED_ACTIONS = [
|
|
@@ -4854,6 +4998,9 @@ function not(condition) {
|
|
|
4854
4998
|
function never2() {
|
|
4855
4999
|
return not(alwaysTrue());
|
|
4856
5000
|
}
|
|
5001
|
+
function always() {
|
|
5002
|
+
return defineConditional(alwaysTrue());
|
|
5003
|
+
}
|
|
4857
5004
|
function jsonFieldPath(field3) {
|
|
4858
5005
|
return [field3.$$field, ...field3.$$subfield].join("/");
|
|
4859
5006
|
}
|
|
@@ -5401,7 +5548,54 @@ function createFieldConditionals(fieldId) {
|
|
|
5401
5548
|
}
|
|
5402
5549
|
},
|
|
5403
5550
|
required: [fieldId]
|
|
5404
|
-
})
|
|
5551
|
+
}),
|
|
5552
|
+
/**
|
|
5553
|
+
* Custom client-side validator. The provided function is serialised and executed
|
|
5554
|
+
* just-in-time on the client only. External references (e.g. lodash) are not
|
|
5555
|
+
* available inside the function body — all logic must be self-contained.
|
|
5556
|
+
*
|
|
5557
|
+
* @example
|
|
5558
|
+
* field('nid').customClientValidator((value) => {
|
|
5559
|
+
* // LUHN check — all logic must be inline
|
|
5560
|
+
* const digits = String(value).split('').map(Number)
|
|
5561
|
+
* // ...
|
|
5562
|
+
* return isValid
|
|
5563
|
+
* })
|
|
5564
|
+
*/
|
|
5565
|
+
customClientValidator(validationFn) {
|
|
5566
|
+
const code = validationFn.toString();
|
|
5567
|
+
return defineFormConditional({
|
|
5568
|
+
type: "object",
|
|
5569
|
+
properties: wrapToPath(
|
|
5570
|
+
{ [fieldId]: { customClientValidator: { code } } },
|
|
5571
|
+
this.$$subfield
|
|
5572
|
+
),
|
|
5573
|
+
required: [fieldId]
|
|
5574
|
+
});
|
|
5575
|
+
},
|
|
5576
|
+
/**
|
|
5577
|
+
* Custom client-side evaluation. Returns a {@link FieldReference} descriptor
|
|
5578
|
+
* that can be used as the `value` property or a DATA component entry.
|
|
5579
|
+
* The function receives the referenced field's value as the first argument and
|
|
5580
|
+
* the full form context as the second; its return value replaces the field reference.
|
|
5581
|
+
* The function is serialised and executed just-in-time on the client only.
|
|
5582
|
+
* External references (e.g. lodash) are not available inside the function body.
|
|
5583
|
+
*
|
|
5584
|
+
* For computing a default value without referencing a specific field, use
|
|
5585
|
+
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
5586
|
+
*
|
|
5587
|
+
* @example
|
|
5588
|
+
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
5589
|
+
* Number(aValue) + Number(ctx.$form.b)
|
|
5590
|
+
* )
|
|
5591
|
+
*/
|
|
5592
|
+
customClientEvaluation(computationFn) {
|
|
5593
|
+
return {
|
|
5594
|
+
$$code: computationFn.toString(),
|
|
5595
|
+
$$field: fieldId,
|
|
5596
|
+
$$subfield: this.$$subfield
|
|
5597
|
+
};
|
|
5598
|
+
}
|
|
5405
5599
|
};
|
|
5406
5600
|
}
|
|
5407
5601
|
|
|
@@ -6164,6 +6358,11 @@ var ArchiveActionInput = BaseActionInput.extend(
|
|
|
6164
6358
|
content: ReasonContent
|
|
6165
6359
|
}).shape
|
|
6166
6360
|
);
|
|
6361
|
+
var UnarchiveActionInput = BaseActionInput.extend(
|
|
6362
|
+
z38.object({
|
|
6363
|
+
type: z38.literal(ActionType.UNARCHIVE).default(ActionType.UNARCHIVE)
|
|
6364
|
+
}).shape
|
|
6365
|
+
);
|
|
6167
6366
|
var AssignActionInput = BaseActionInput.extend(
|
|
6168
6367
|
z38.object({
|
|
6169
6368
|
type: z38.literal(ActionType.ASSIGN),
|
|
@@ -6191,7 +6390,8 @@ var RejectCorrectionActionInput = BaseActionInput.extend(
|
|
|
6191
6390
|
var ApproveCorrectionActionInput = BaseActionInput.extend(
|
|
6192
6391
|
z38.object({
|
|
6193
6392
|
requestId: z38.string(),
|
|
6194
|
-
type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
|
6393
|
+
type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION),
|
|
6394
|
+
content: z38.object({ immediateCorrection: z38.boolean().optional() }).optional()
|
|
6195
6395
|
}).shape
|
|
6196
6396
|
);
|
|
6197
6397
|
var ReadActionInput = BaseActionInput.extend(
|
|
@@ -6224,6 +6424,7 @@ var ActionInput = z38.discriminatedUnion("type", [
|
|
|
6224
6424
|
id: "MarkNotDuplicateActionInput"
|
|
6225
6425
|
}),
|
|
6226
6426
|
ArchiveActionInput.meta({ id: "ArchiveActionInput" }),
|
|
6427
|
+
UnarchiveActionInput.meta({ id: "UnarchiveActionInput" }),
|
|
6227
6428
|
AssignActionInput.meta({ id: "AssignActionInput" }),
|
|
6228
6429
|
UnassignActionInput.meta({ id: "UnassignActionInput" }),
|
|
6229
6430
|
PrintCertificateActionInput.meta({ id: "PrintCertificateActionInput" }),
|
|
@@ -6338,8 +6539,11 @@ var updateActions = ActionTypes.extract([
|
|
|
6338
6539
|
ActionType.REGISTER,
|
|
6339
6540
|
ActionType.REJECT,
|
|
6340
6541
|
ActionType.ARCHIVE,
|
|
6542
|
+
ActionType.UNARCHIVE,
|
|
6341
6543
|
ActionType.PRINT_CERTIFICATE,
|
|
6342
6544
|
ActionType.REQUEST_CORRECTION,
|
|
6545
|
+
ActionType.APPROVE_CORRECTION,
|
|
6546
|
+
ActionType.REJECT_CORRECTION,
|
|
6343
6547
|
ActionType.CUSTOM
|
|
6344
6548
|
]);
|
|
6345
6549
|
function getActionUpdateMetadata(actions) {
|
|
@@ -6354,7 +6558,7 @@ function getActionUpdateMetadata(actions) {
|
|
|
6354
6558
|
"createdAtLocation",
|
|
6355
6559
|
"createdByRole"
|
|
6356
6560
|
];
|
|
6357
|
-
return actions.filter(({ type }) => updateActions.safeParse(type).success).
|
|
6561
|
+
return actions.filter(({ type }) => updateActions.safeParse(type).success).reduce(
|
|
6358
6562
|
(_2, action) => {
|
|
6359
6563
|
if (action.originalActionId) {
|
|
6360
6564
|
const originalAction = actions.find(({ id }) => id === action.originalActionId) ?? action;
|
|
@@ -6367,6 +6571,10 @@ function getActionUpdateMetadata(actions) {
|
|
|
6367
6571
|
}
|
|
6368
6572
|
function getLegalStatuses(actions) {
|
|
6369
6573
|
return {
|
|
6574
|
+
[EventStatus.enum.NOTIFIED]: getDeclarationActionCreationMetadata(
|
|
6575
|
+
ActionType.NOTIFY,
|
|
6576
|
+
actions
|
|
6577
|
+
),
|
|
6370
6578
|
[EventStatus.enum.DECLARED]: getDeclarationActionCreationMetadata(
|
|
6371
6579
|
ActionType.DECLARE,
|
|
6372
6580
|
actions
|
|
@@ -6381,28 +6589,19 @@ function getLegalStatuses(actions) {
|
|
|
6381
6589
|
// ../commons/src/events/state/flags.ts
|
|
6382
6590
|
var import_lodash3 = require("lodash");
|
|
6383
6591
|
var import_date_fns3 = require("date-fns");
|
|
6384
|
-
function
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
return true;
|
|
6391
|
-
}
|
|
6392
|
-
if (type === ActionType.APPROVE_CORRECTION) {
|
|
6393
|
-
return false;
|
|
6592
|
+
function findPendingCorrectionAction(writeActions2) {
|
|
6593
|
+
let correctionRequestAction;
|
|
6594
|
+
for (let i = writeActions2.length - 1; i >= 0; i--) {
|
|
6595
|
+
const action = writeActions2[i];
|
|
6596
|
+
if (action.type === ActionType.APPROVE_CORRECTION || action.type === ActionType.REJECT_CORRECTION) {
|
|
6597
|
+
break;
|
|
6394
6598
|
}
|
|
6395
|
-
if (type === ActionType.
|
|
6396
|
-
|
|
6599
|
+
if (action.type === ActionType.REQUEST_CORRECTION) {
|
|
6600
|
+
correctionRequestAction = action;
|
|
6601
|
+
break;
|
|
6397
6602
|
}
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
}
|
|
6401
|
-
function isDeclarationIncomplete(actions) {
|
|
6402
|
-
return getStatusFromActions(actions) === EventStatus.enum.NOTIFIED;
|
|
6403
|
-
}
|
|
6404
|
-
function isRejected(actions) {
|
|
6405
|
-
return actions.at(-1)?.type === ActionType.REJECT;
|
|
6603
|
+
}
|
|
6604
|
+
return correctionRequestAction;
|
|
6406
6605
|
}
|
|
6407
6606
|
function isPotentialDuplicate(actions) {
|
|
6408
6607
|
return actions.reduce((prev, { type }) => {
|
|
@@ -6431,6 +6630,85 @@ function isFlagConditionMet(conditional, form, action) {
|
|
|
6431
6630
|
}
|
|
6432
6631
|
});
|
|
6433
6632
|
}
|
|
6633
|
+
function actionConfigRemovesFlag(action, flagId, actionsUpToAndIncluding, event2, eventConfiguration) {
|
|
6634
|
+
if (!isActionConfigType(action.type)) {
|
|
6635
|
+
return false;
|
|
6636
|
+
}
|
|
6637
|
+
const actionConfig = getActionConfig({
|
|
6638
|
+
eventConfiguration,
|
|
6639
|
+
actionType: action.type,
|
|
6640
|
+
customActionType: "customActionType" in action ? action.customActionType : void 0
|
|
6641
|
+
});
|
|
6642
|
+
const removeOperations = (actionConfig?.flags ?? []).filter(
|
|
6643
|
+
({ id, operation }) => id === flagId && operation === "remove"
|
|
6644
|
+
);
|
|
6645
|
+
if (removeOperations.length === 0) {
|
|
6646
|
+
return false;
|
|
6647
|
+
}
|
|
6648
|
+
const eventUpToThisAction = { ...event2, actions: actionsUpToAndIncluding };
|
|
6649
|
+
const declaration = aggregateActionDeclarations(eventUpToThisAction);
|
|
6650
|
+
const annotation = aggregateActionAnnotations(eventUpToThisAction);
|
|
6651
|
+
const form = { ...declaration, ...annotation };
|
|
6652
|
+
return removeOperations.some(
|
|
6653
|
+
({ conditional }) => conditional ? isFlagConditionMet(conditional, form, action) : true
|
|
6654
|
+
);
|
|
6655
|
+
}
|
|
6656
|
+
var INHERENT_FLAG_RULES = [
|
|
6657
|
+
{
|
|
6658
|
+
flag: InherentFlags.CORRECTION_REQUESTED,
|
|
6659
|
+
setOn: [ActionType.REQUEST_CORRECTION],
|
|
6660
|
+
resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
|
|
6661
|
+
},
|
|
6662
|
+
{
|
|
6663
|
+
// INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
|
|
6664
|
+
// other status-changing action (see getStatusFromActions). ARCHIVE/UNARCHIVE
|
|
6665
|
+
// are deliberately excluded so the flag freezes across an archive/unarchive
|
|
6666
|
+
// round trip and comes back exactly as it was.
|
|
6667
|
+
flag: InherentFlags.INCOMPLETE,
|
|
6668
|
+
setOn: [ActionType.NOTIFY],
|
|
6669
|
+
resetOn: [ActionType.CREATE, ActionType.DECLARE, ActionType.REGISTER]
|
|
6670
|
+
},
|
|
6671
|
+
{
|
|
6672
|
+
flag: InherentFlags.REJECTED,
|
|
6673
|
+
setOn: [ActionType.REJECT],
|
|
6674
|
+
resetOn: [
|
|
6675
|
+
ActionType.NOTIFY,
|
|
6676
|
+
ActionType.DECLARE,
|
|
6677
|
+
ActionType.EDIT,
|
|
6678
|
+
ActionType.REGISTER
|
|
6679
|
+
]
|
|
6680
|
+
},
|
|
6681
|
+
{
|
|
6682
|
+
flag: InherentFlags.POTENTIAL_DUPLICATE,
|
|
6683
|
+
setOn: [ActionType.DUPLICATE_DETECTED],
|
|
6684
|
+
resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
|
|
6685
|
+
},
|
|
6686
|
+
{
|
|
6687
|
+
flag: InherentFlags.EDIT_IN_PROGRESS,
|
|
6688
|
+
setOn: [ActionType.EDIT],
|
|
6689
|
+
resetOnAnyOtherAction: true
|
|
6690
|
+
}
|
|
6691
|
+
];
|
|
6692
|
+
function resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration) {
|
|
6693
|
+
return acceptedActions.reduce((present, action, idx) => {
|
|
6694
|
+
if (rule.setOn.includes(action.type)) {
|
|
6695
|
+
return true;
|
|
6696
|
+
}
|
|
6697
|
+
if (rule.resetOnAnyOtherAction || (rule.resetOn ?? []).includes(action.type)) {
|
|
6698
|
+
return false;
|
|
6699
|
+
}
|
|
6700
|
+
if (actionConfigRemovesFlag(
|
|
6701
|
+
action,
|
|
6702
|
+
rule.flag,
|
|
6703
|
+
acceptedActions.slice(0, idx + 1),
|
|
6704
|
+
event2,
|
|
6705
|
+
eventConfiguration
|
|
6706
|
+
)) {
|
|
6707
|
+
return false;
|
|
6708
|
+
}
|
|
6709
|
+
return present;
|
|
6710
|
+
}, false);
|
|
6711
|
+
}
|
|
6434
6712
|
function resolveEventCustomFlags(event2, eventConfiguration) {
|
|
6435
6713
|
const actions = getAcceptedActions(event2).filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
6436
6714
|
return actions.reduce((acc, action, idx) => {
|
|
@@ -6466,8 +6744,7 @@ function resolveEventCustomFlags(event2, eventConfiguration) {
|
|
|
6466
6744
|
return (0, import_lodash3.uniq)(flags);
|
|
6467
6745
|
}, []);
|
|
6468
6746
|
}
|
|
6469
|
-
function
|
|
6470
|
-
const sortedActions = event2.actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
6747
|
+
function getActionStatusFlags(sortedActions) {
|
|
6471
6748
|
const actionStatus = sortedActions.reduce(
|
|
6472
6749
|
(actionStatuses, { type, status: status2 }) => ({
|
|
6473
6750
|
...actionStatuses,
|
|
@@ -6475,31 +6752,51 @@ function getEventFlags(event2, config) {
|
|
|
6475
6752
|
}),
|
|
6476
6753
|
{}
|
|
6477
6754
|
);
|
|
6478
|
-
|
|
6755
|
+
return Object.entries(actionStatus).filter(([, status2]) => status2 !== ActionStatus.Accepted).map(([type, status2]) => {
|
|
6479
6756
|
const flag2 = joinValues([type, status2], ":").toLowerCase();
|
|
6480
6757
|
return flag2;
|
|
6481
6758
|
});
|
|
6482
|
-
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6759
|
+
}
|
|
6760
|
+
function getInherentFlags(sortedActions, event2, eventConfiguration) {
|
|
6761
|
+
const acceptedActions = sortedActions.filter(
|
|
6762
|
+
({ status: status2 }) => status2 === ActionStatus.Accepted
|
|
6763
|
+
);
|
|
6764
|
+
return INHERENT_FLAG_RULES.filter(
|
|
6765
|
+
(rule) => resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration)
|
|
6766
|
+
).map(({ flag: flag2 }) => flag2);
|
|
6767
|
+
}
|
|
6768
|
+
function getEventFlags(event2, config) {
|
|
6769
|
+
const sortedActions = event2.actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
6770
|
+
return [
|
|
6771
|
+
...getActionStatusFlags(sortedActions),
|
|
6772
|
+
...getInherentFlags(sortedActions, event2, config),
|
|
6773
|
+
...resolveEventCustomFlags(event2, config)
|
|
6774
|
+
];
|
|
6498
6775
|
}
|
|
6499
6776
|
|
|
6500
6777
|
// ../commons/src/events/state/index.ts
|
|
6501
6778
|
function getStatusFromActions(actions) {
|
|
6502
|
-
|
|
6779
|
+
const acceptedActions = actions.filter(
|
|
6780
|
+
({ status: status2 }) => status2 === ActionStatus.Accepted
|
|
6781
|
+
);
|
|
6782
|
+
const isCurrentlyArchived = acceptedActions.reduce(
|
|
6783
|
+
(archived, action) => {
|
|
6784
|
+
if (action.type === ActionType.ARCHIVE) {
|
|
6785
|
+
return true;
|
|
6786
|
+
}
|
|
6787
|
+
if (action.type === ActionType.UNARCHIVE) {
|
|
6788
|
+
return false;
|
|
6789
|
+
}
|
|
6790
|
+
return archived;
|
|
6791
|
+
},
|
|
6792
|
+
false
|
|
6793
|
+
);
|
|
6794
|
+
if (isCurrentlyArchived) {
|
|
6795
|
+
return EventStatus.enum.ARCHIVED;
|
|
6796
|
+
}
|
|
6797
|
+
return acceptedActions.filter(
|
|
6798
|
+
({ type }) => type !== ActionType.ARCHIVE && type !== ActionType.UNARCHIVE
|
|
6799
|
+
).reduce((status2, action) => {
|
|
6503
6800
|
switch (action.type) {
|
|
6504
6801
|
case ActionType.CREATE:
|
|
6505
6802
|
return EventStatus.enum.CREATED;
|
|
@@ -6507,10 +6804,11 @@ function getStatusFromActions(actions) {
|
|
|
6507
6804
|
return EventStatus.enum.DECLARED;
|
|
6508
6805
|
case ActionType.REGISTER:
|
|
6509
6806
|
return EventStatus.enum.REGISTERED;
|
|
6510
|
-
case ActionType.ARCHIVE:
|
|
6511
|
-
return EventStatus.enum.ARCHIVED;
|
|
6512
6807
|
case ActionType.NOTIFY:
|
|
6513
6808
|
return EventStatus.enum.NOTIFIED;
|
|
6809
|
+
// Already filtered out above; listed here only to satisfy exhaustiveness.
|
|
6810
|
+
case ActionType.ARCHIVE:
|
|
6811
|
+
case ActionType.UNARCHIVE:
|
|
6514
6812
|
case ActionType.CUSTOM:
|
|
6515
6813
|
case ActionType.PRINT_CERTIFICATE:
|
|
6516
6814
|
case ActionType.ASSIGN:
|
|
@@ -6729,7 +7027,7 @@ function getActionAnnotation({
|
|
|
6729
7027
|
const action = (0, import_lodash4.findLast)(activeActions, (a) => a.type === actionType);
|
|
6730
7028
|
const actionWithCompleteAnnotation = action && {
|
|
6731
7029
|
...action,
|
|
6732
|
-
annotation: getCompleteActionAnnotation(
|
|
7030
|
+
annotation: getCompleteActionAnnotation(event2, action)
|
|
6733
7031
|
};
|
|
6734
7032
|
const matchingDraft = draft?.action.type === actionType ? draft : void 0;
|
|
6735
7033
|
const sortedActions = (0, import_lodash4.orderBy)(
|
|
@@ -6801,6 +7099,9 @@ function createFieldConfig(fieldId, options) {
|
|
|
6801
7099
|
}
|
|
6802
7100
|
|
|
6803
7101
|
// ../commons/src/events/field.ts
|
|
7102
|
+
function evaluate(computationFn) {
|
|
7103
|
+
return { $$code: computationFn.toString() };
|
|
7104
|
+
}
|
|
6804
7105
|
function field(fieldId, options = {}) {
|
|
6805
7106
|
return {
|
|
6806
7107
|
...createFieldConditionals(fieldId),
|
|
@@ -7494,6 +7795,11 @@ var TENNIS_CLUB_DECLARATION_REVIEW = {
|
|
|
7494
7795
|
id: "signature.upload.modal.title",
|
|
7495
7796
|
defaultMessage: "Draw signature",
|
|
7496
7797
|
description: "Title for the modal to draw signature"
|
|
7798
|
+
},
|
|
7799
|
+
// Zod applies the schema default at parse time, but this fixture bypasses
|
|
7800
|
+
// parsing — GeneratedInputField accesses configuration.maxFileSize directly.
|
|
7801
|
+
configuration: {
|
|
7802
|
+
maxFileSize: 5 * 1024 * 1024
|
|
7497
7803
|
}
|
|
7498
7804
|
}
|
|
7499
7805
|
]
|
|
@@ -8050,6 +8356,20 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
8050
8356
|
},
|
|
8051
8357
|
review: TENNIS_CLUB_DECLARATION_REVIEW
|
|
8052
8358
|
},
|
|
8359
|
+
{
|
|
8360
|
+
type: ActionType.NOTIFY,
|
|
8361
|
+
label: {
|
|
8362
|
+
defaultMessage: "Notify health worker",
|
|
8363
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
|
8364
|
+
id: "event.tennis-club-membership.action.notify.label"
|
|
8365
|
+
},
|
|
8366
|
+
flags: [
|
|
8367
|
+
{
|
|
8368
|
+
id: "health-worker-notified",
|
|
8369
|
+
operation: "add"
|
|
8370
|
+
}
|
|
8371
|
+
]
|
|
8372
|
+
},
|
|
8053
8373
|
{
|
|
8054
8374
|
type: ActionType.REJECT,
|
|
8055
8375
|
label: {
|
|
@@ -8292,6 +8612,17 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
8292
8612
|
}
|
|
8293
8613
|
}
|
|
8294
8614
|
],
|
|
8615
|
+
flags: [
|
|
8616
|
+
{
|
|
8617
|
+
id: "health-worker-notified",
|
|
8618
|
+
requiresAction: false,
|
|
8619
|
+
label: {
|
|
8620
|
+
id: "event.tennis-club-membership.flag.health-worker-notified.label",
|
|
8621
|
+
defaultMessage: "Health worker notified",
|
|
8622
|
+
description: "Label for the health-worker-notified flag"
|
|
8623
|
+
}
|
|
8624
|
+
}
|
|
8625
|
+
],
|
|
8295
8626
|
advancedSearch: [
|
|
8296
8627
|
{
|
|
8297
8628
|
title: {
|
|
@@ -9562,6 +9893,14 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
|
|
|
9562
9893
|
},
|
|
9563
9894
|
...input
|
|
9564
9895
|
}),
|
|
9896
|
+
unarchive: (eventId, input = {}) => ({
|
|
9897
|
+
type: ActionType.UNARCHIVE,
|
|
9898
|
+
transactionId: input.transactionId ?? getUUID(),
|
|
9899
|
+
declaration: {},
|
|
9900
|
+
annotation: {},
|
|
9901
|
+
eventId,
|
|
9902
|
+
...input
|
|
9903
|
+
}),
|
|
9565
9904
|
reject: (eventId, input = {}) => ({
|
|
9566
9905
|
type: ActionType.REJECT,
|
|
9567
9906
|
transactionId: input.transactionId ?? getUUID(),
|
|
@@ -9720,6 +10059,7 @@ function generateActionDocument({
|
|
|
9720
10059
|
case ActionType.NOTIFY:
|
|
9721
10060
|
case ActionType.REGISTER:
|
|
9722
10061
|
case ActionType.REQUEST_CORRECTION:
|
|
10062
|
+
case ActionType.UNARCHIVE:
|
|
9723
10063
|
return { ...actionBase, type: action };
|
|
9724
10064
|
case ActionType.EDIT:
|
|
9725
10065
|
return {
|
|
@@ -10050,7 +10390,7 @@ function matchesJurisdictionFilter(locationIds, filter, user2) {
|
|
|
10050
10390
|
return locationIds.some((id) => id === user2.primaryOfficeId);
|
|
10051
10391
|
}
|
|
10052
10392
|
if (filter === JurisdictionFilter.enum.administrativeArea) {
|
|
10053
|
-
return user2.administrativeAreaId
|
|
10393
|
+
return !user2.administrativeAreaId || locationIds.some((id) => id === user2.administrativeAreaId);
|
|
10054
10394
|
}
|
|
10055
10395
|
return true;
|
|
10056
10396
|
}
|
|
@@ -10077,6 +10417,25 @@ function canAccessEventWithScope(event2, scope, user2, customActionType) {
|
|
|
10077
10417
|
}
|
|
10078
10418
|
if (scopeUsesDeclaredOptions(scope)) {
|
|
10079
10419
|
const { options } = scope;
|
|
10420
|
+
if (options?.notifiedBy === UserFilter.enum.user) {
|
|
10421
|
+
if (event2.legalStatuses?.NOTIFIED?.createdBy !== user2.id) {
|
|
10422
|
+
return false;
|
|
10423
|
+
}
|
|
10424
|
+
}
|
|
10425
|
+
if (options?.notifiedIn === JurisdictionFilter.enum.location && !matchesJurisdictionFilter(
|
|
10426
|
+
event2.legalStatuses?.NOTIFIED?.createdAtLocation,
|
|
10427
|
+
JurisdictionFilter.enum.location,
|
|
10428
|
+
user2
|
|
10429
|
+
)) {
|
|
10430
|
+
return false;
|
|
10431
|
+
}
|
|
10432
|
+
if (options?.notifiedIn === JurisdictionFilter.enum.administrativeArea && !matchesJurisdictionFilter(
|
|
10433
|
+
event2.legalStatuses?.NOTIFIED?.createdAtLocation,
|
|
10434
|
+
JurisdictionFilter.enum.administrativeArea,
|
|
10435
|
+
user2
|
|
10436
|
+
)) {
|
|
10437
|
+
return false;
|
|
10438
|
+
}
|
|
10080
10439
|
if (options?.declaredBy === UserFilter.enum.user) {
|
|
10081
10440
|
if (event2.legalStatuses?.DECLARED?.createdBy !== user2.id) {
|
|
10082
10441
|
return false;
|
|
@@ -10139,7 +10498,7 @@ function canAccessUserWithScope({
|
|
|
10139
10498
|
}
|
|
10140
10499
|
const hasAdministrativeAreaInHierarchy = userToAccess.administrativeHierarchy.some(
|
|
10141
10500
|
(id) => user2.administrativeAreaId === id
|
|
10142
|
-
) || user2.administrativeAreaId
|
|
10501
|
+
) || !user2.administrativeAreaId;
|
|
10143
10502
|
if (opts?.accessLevel === JurisdictionFilter.enum.administrativeArea && !hasAdministrativeAreaInHierarchy) {
|
|
10144
10503
|
return false;
|
|
10145
10504
|
}
|
|
@@ -10219,6 +10578,7 @@ var ACTION_SCOPE_MAP = {
|
|
|
10219
10578
|
[ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
|
|
10220
10579
|
[ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
|
|
10221
10580
|
[ActionType.ARCHIVE]: ["record.archive"],
|
|
10581
|
+
[ActionType.UNARCHIVE]: ["record.unarchive"],
|
|
10222
10582
|
[ActionType.REJECT]: ["record.reject"],
|
|
10223
10583
|
[ActionType.ASSIGN]: null,
|
|
10224
10584
|
[ActionType.UNASSIGN]: null,
|
|
@@ -10425,7 +10785,11 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
|
10425
10785
|
ActionType.CUSTOM,
|
|
10426
10786
|
ClientSpecificAction.REVIEW_CORRECTION_REQUEST
|
|
10427
10787
|
],
|
|
10428
|
-
[EventStatus.enum.ARCHIVED]: [
|
|
10788
|
+
[EventStatus.enum.ARCHIVED]: [
|
|
10789
|
+
ActionType.READ,
|
|
10790
|
+
ActionType.CUSTOM,
|
|
10791
|
+
ActionType.UNARCHIVE
|
|
10792
|
+
]
|
|
10429
10793
|
};
|
|
10430
10794
|
var ACTION_FILTERS = {
|
|
10431
10795
|
[ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
@@ -10438,6 +10802,7 @@ var ACTION_FILTERS = {
|
|
|
10438
10802
|
[ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10439
10803
|
[ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10440
10804
|
[ActionType.ARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10805
|
+
[ActionType.UNARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10441
10806
|
[ActionType.ASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10442
10807
|
[ActionType.UNASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
10443
10808
|
[ActionType.CUSTOM]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested"))
|
|
@@ -10445,18 +10810,19 @@ var ACTION_FILTERS = {
|
|
|
10445
10810
|
function filterActionsByFlags(actions, flags) {
|
|
10446
10811
|
return actions.filter((action) => ACTION_FILTERS[action]?.(flags) ?? true);
|
|
10447
10812
|
}
|
|
10813
|
+
var REJECTED_ACTIONS = [
|
|
10814
|
+
ActionType.READ,
|
|
10815
|
+
ActionType.NOTIFY,
|
|
10816
|
+
ActionType.CUSTOM,
|
|
10817
|
+
ActionType.EDIT,
|
|
10818
|
+
ActionType.ARCHIVE
|
|
10819
|
+
];
|
|
10448
10820
|
function getAvailableActionsWithoutFlagFilters(status2, flags) {
|
|
10449
10821
|
if (flags.includes(InherentFlags.EDIT_IN_PROGRESS)) {
|
|
10450
10822
|
return [ActionType.NOTIFY, ActionType.DECLARE, ActionType.REGISTER];
|
|
10451
10823
|
}
|
|
10452
|
-
if (flags.includes(InherentFlags.REJECTED)) {
|
|
10453
|
-
return
|
|
10454
|
-
ActionType.READ,
|
|
10455
|
-
ActionType.NOTIFY,
|
|
10456
|
-
ActionType.CUSTOM,
|
|
10457
|
-
ActionType.EDIT,
|
|
10458
|
-
ActionType.ARCHIVE
|
|
10459
|
-
];
|
|
10824
|
+
if (flags.includes(InherentFlags.REJECTED) && status2 !== EventStatus.enum.ARCHIVED) {
|
|
10825
|
+
return REJECTED_ACTIONS;
|
|
10460
10826
|
}
|
|
10461
10827
|
return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status2];
|
|
10462
10828
|
}
|