@opencrvs/toolkit 2.0.0-rc.6bd1e6b → 2.0.0-rc.6bff30f
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/dist/application-config/index.js +7 -1
- package/dist/cli.js +9 -3
- package/dist/commons/api/router.d.ts +26 -17
- package/dist/commons/events/AdvancedSearchConfig.d.ts +342 -0
- package/dist/commons/events/FieldConfig.d.ts +1 -0
- package/dist/commons/events/FieldType.d.ts +1 -0
- package/dist/commons/events/FieldTypeMapping.d.ts +1 -1
- package/dist/commons/events/field.d.ts +6 -0
- package/dist/commons/events/state/utils.d.ts +12 -290
- package/dist/events/index.js +131 -63
- package/dist/migrations/v2.0/index.js +9 -3
- package/dist/notification/index.js +63 -1
- package/dist/scopes/index.d.ts +4 -6
- package/dist/scopes/index.js +9 -3
- package/opencrvs-toolkit-2.0.0-rc.6bff30f.tgz +0 -0
- package/package.json +1 -1
- package/opencrvs-toolkit-2.0.0-rc.6bd1e6b.tgz +0 -0
package/dist/events/index.js
CHANGED
|
@@ -151,6 +151,7 @@ __export(events_exports, {
|
|
|
151
151
|
FormPageConfig: () => FormPageConfig,
|
|
152
152
|
Fuzzy: () => Fuzzy,
|
|
153
153
|
GeographicalArea: () => GeographicalArea,
|
|
154
|
+
HiddenFieldTypes: () => HiddenFieldTypes,
|
|
154
155
|
HiddenFieldValue: () => HiddenFieldValue,
|
|
155
156
|
HttpFieldUpdateValue: () => HttpFieldUpdateValue,
|
|
156
157
|
HttpFieldValue: () => HttpFieldValue,
|
|
@@ -711,14 +712,20 @@ var unflattenScope = (input) => {
|
|
|
711
712
|
return { type, options };
|
|
712
713
|
};
|
|
713
714
|
var EncodedScope = z2.string().brand("EncodedScope");
|
|
714
|
-
var
|
|
715
|
-
|
|
715
|
+
var decodedScopeCache = /* @__PURE__ */ new Map();
|
|
716
|
+
var decodeScope = (encodedScope) => {
|
|
717
|
+
if (decodedScopeCache.has(encodedScope)) {
|
|
718
|
+
return decodedScopeCache.get(encodedScope);
|
|
719
|
+
}
|
|
720
|
+
const scope = qs.parse(encodedScope, {
|
|
716
721
|
ignoreQueryPrefix: true,
|
|
717
722
|
comma: true,
|
|
718
723
|
allowDots: true
|
|
719
724
|
});
|
|
720
725
|
const unflattenedScope = unflattenScope(scope);
|
|
721
|
-
|
|
726
|
+
const result = Scope.safeParse(unflattenedScope)?.data;
|
|
727
|
+
decodedScopeCache.set(encodedScope, result);
|
|
728
|
+
return result;
|
|
722
729
|
};
|
|
723
730
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
724
731
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
@@ -1213,6 +1220,11 @@ var FieldTypesToHideInReview = [
|
|
|
1213
1220
|
FieldType.ALPHA_PRINT_BUTTON,
|
|
1214
1221
|
FieldType.ALPHA_HIDDEN
|
|
1215
1222
|
];
|
|
1223
|
+
var HiddenFieldTypes = [
|
|
1224
|
+
FieldType.HTTP,
|
|
1225
|
+
FieldType.QUERY_PARAM_READER,
|
|
1226
|
+
FieldType.ALPHA_HIDDEN
|
|
1227
|
+
];
|
|
1216
1228
|
|
|
1217
1229
|
// ../commons/src/events/FieldValue.ts
|
|
1218
1230
|
var z12 = __toESM(require("zod/v4"));
|
|
@@ -1339,7 +1351,7 @@ function plainDateToLocalDate(date) {
|
|
|
1339
1351
|
// ../commons/src/events/FieldValue.ts
|
|
1340
1352
|
var TextValue = z12.string();
|
|
1341
1353
|
var HiddenFieldValue = z12.string();
|
|
1342
|
-
var NonEmptyTextValue =
|
|
1354
|
+
var NonEmptyTextValue = z12.string().trim().min(1);
|
|
1343
1355
|
var DateValue = z12.iso.date().describe("Date in the format YYYY-MM-DD");
|
|
1344
1356
|
var AgeValue = z12.object({
|
|
1345
1357
|
age: z12.number(),
|
|
@@ -2286,6 +2298,7 @@ var NumberField = BaseField.extend({
|
|
|
2286
2298
|
configuration: import_v43.default.object({
|
|
2287
2299
|
min: import_v43.default.number().optional().describe("Minimum value"),
|
|
2288
2300
|
max: import_v43.default.number().optional().describe("Maximum value"),
|
|
2301
|
+
integer: import_v43.default.boolean().optional().describe("When true, only whole numbers are allowed"),
|
|
2289
2302
|
prefix: TranslationConfig.optional(),
|
|
2290
2303
|
postfix: TranslationConfig.optional()
|
|
2291
2304
|
}).optional()
|
|
@@ -3474,6 +3487,9 @@ var BaseField3 = z28.object({
|
|
|
3474
3487
|
),
|
|
3475
3488
|
validations: z28.array(ValidationConfig).optional().describe(
|
|
3476
3489
|
`Option for overriding the field validations specifically for advanced search form.`
|
|
3490
|
+
),
|
|
3491
|
+
allowedLocations: JurisdictionReference.optional().describe(
|
|
3492
|
+
`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.`
|
|
3477
3493
|
)
|
|
3478
3494
|
});
|
|
3479
3495
|
var SearchQueryParams = z28.object({
|
|
@@ -3548,9 +3564,11 @@ var z30 = __toESM(require("zod/v4"));
|
|
|
3548
3564
|
var z29 = __toESM(require("zod/v4"));
|
|
3549
3565
|
function getDynamicNameValue(field3) {
|
|
3550
3566
|
const nameConfiguration = field3.configuration?.name;
|
|
3567
|
+
const firstnameRequired = nameConfiguration?.firstname?.required ?? field3.required;
|
|
3568
|
+
const surnameRequired = nameConfiguration?.surname?.required ?? field3.required;
|
|
3551
3569
|
return z29.object({
|
|
3552
|
-
firstname:
|
|
3553
|
-
surname:
|
|
3570
|
+
firstname: firstnameRequired ? NonEmptyTextValue : TextValue,
|
|
3571
|
+
surname: surnameRequired ? NonEmptyTextValue : TextValue,
|
|
3554
3572
|
middlename: nameConfiguration?.middlename?.required ? NonEmptyTextValue : TextValue.optional()
|
|
3555
3573
|
});
|
|
3556
3574
|
}
|
|
@@ -3897,7 +3915,7 @@ var isHiddenFieldType = (field3) => {
|
|
|
3897
3915
|
return field3.config.type === FieldType.ALPHA_HIDDEN;
|
|
3898
3916
|
};
|
|
3899
3917
|
var isNonInteractiveFieldType = (field3) => {
|
|
3900
|
-
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.
|
|
3918
|
+
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;
|
|
3901
3919
|
};
|
|
3902
3920
|
|
|
3903
3921
|
// ../commons/src/conditionals/validate.ts
|
|
@@ -6474,6 +6492,8 @@ var updateActions = ActionTypes.extract([
|
|
|
6474
6492
|
ActionType.ARCHIVE,
|
|
6475
6493
|
ActionType.PRINT_CERTIFICATE,
|
|
6476
6494
|
ActionType.REQUEST_CORRECTION,
|
|
6495
|
+
ActionType.APPROVE_CORRECTION,
|
|
6496
|
+
ActionType.REJECT_CORRECTION,
|
|
6477
6497
|
ActionType.CUSTOM
|
|
6478
6498
|
]);
|
|
6479
6499
|
function getActionUpdateMetadata(actions) {
|
|
@@ -6488,7 +6508,7 @@ function getActionUpdateMetadata(actions) {
|
|
|
6488
6508
|
"createdAtLocation",
|
|
6489
6509
|
"createdByRole"
|
|
6490
6510
|
];
|
|
6491
|
-
return actions.filter(({ type }) => updateActions.safeParse(type).success).
|
|
6511
|
+
return actions.filter(({ type }) => updateActions.safeParse(type).success).reduce(
|
|
6492
6512
|
(_2, action) => {
|
|
6493
6513
|
if (action.originalActionId) {
|
|
6494
6514
|
const originalAction = actions.find(({ id }) => id === action.originalActionId) ?? action;
|
|
@@ -6515,9 +6535,6 @@ function getLegalStatuses(actions) {
|
|
|
6515
6535
|
// ../commons/src/events/state/flags.ts
|
|
6516
6536
|
var import_lodash3 = require("lodash");
|
|
6517
6537
|
var import_date_fns3 = require("date-fns");
|
|
6518
|
-
function isEditInProgress(actions) {
|
|
6519
|
-
return actions.at(-1)?.type === ActionType.EDIT;
|
|
6520
|
-
}
|
|
6521
6538
|
function findPendingCorrectionAction(writeActions2) {
|
|
6522
6539
|
let correctionRequestAction;
|
|
6523
6540
|
for (let i = writeActions2.length - 1; i >= 0; i--) {
|
|
@@ -6532,29 +6549,6 @@ function findPendingCorrectionAction(writeActions2) {
|
|
|
6532
6549
|
}
|
|
6533
6550
|
return correctionRequestAction;
|
|
6534
6551
|
}
|
|
6535
|
-
function isCorrectionRequested(actions) {
|
|
6536
|
-
return findPendingCorrectionAction(actions) !== void 0;
|
|
6537
|
-
}
|
|
6538
|
-
function isDeclarationIncomplete(actions) {
|
|
6539
|
-
return getStatusFromActions(actions) === EventStatus.enum.NOTIFIED;
|
|
6540
|
-
}
|
|
6541
|
-
function isRejected(actions) {
|
|
6542
|
-
const resettingActionTypes = [
|
|
6543
|
-
ActionType.NOTIFY,
|
|
6544
|
-
ActionType.DECLARE,
|
|
6545
|
-
ActionType.EDIT,
|
|
6546
|
-
ActionType.REGISTER
|
|
6547
|
-
];
|
|
6548
|
-
return actions.reduce((prev, { type }) => {
|
|
6549
|
-
if (type === ActionType.REJECT) {
|
|
6550
|
-
return true;
|
|
6551
|
-
}
|
|
6552
|
-
if (resettingActionTypes.includes(type)) {
|
|
6553
|
-
return false;
|
|
6554
|
-
}
|
|
6555
|
-
return prev;
|
|
6556
|
-
}, false);
|
|
6557
|
-
}
|
|
6558
6552
|
function isPotentialDuplicate(actions) {
|
|
6559
6553
|
return actions.reduce((prev, { type }) => {
|
|
6560
6554
|
if (type === ActionType.DUPLICATE_DETECTED) {
|
|
@@ -6582,6 +6576,88 @@ function isFlagConditionMet(conditional, form, action) {
|
|
|
6582
6576
|
}
|
|
6583
6577
|
});
|
|
6584
6578
|
}
|
|
6579
|
+
function actionConfigRemovesFlag(action, flagId, actionsUpToAndIncluding, event2, eventConfiguration) {
|
|
6580
|
+
if (!isActionConfigType(action.type)) {
|
|
6581
|
+
return false;
|
|
6582
|
+
}
|
|
6583
|
+
const actionConfig = getActionConfig({
|
|
6584
|
+
eventConfiguration,
|
|
6585
|
+
actionType: action.type,
|
|
6586
|
+
customActionType: "customActionType" in action ? action.customActionType : void 0
|
|
6587
|
+
});
|
|
6588
|
+
const removeOperations = (actionConfig?.flags ?? []).filter(
|
|
6589
|
+
({ id, operation }) => id === flagId && operation === "remove"
|
|
6590
|
+
);
|
|
6591
|
+
if (removeOperations.length === 0) {
|
|
6592
|
+
return false;
|
|
6593
|
+
}
|
|
6594
|
+
const eventUpToThisAction = { ...event2, actions: actionsUpToAndIncluding };
|
|
6595
|
+
const declaration = aggregateActionDeclarations(eventUpToThisAction);
|
|
6596
|
+
const annotation = aggregateActionAnnotations(eventUpToThisAction);
|
|
6597
|
+
const form = { ...declaration, ...annotation };
|
|
6598
|
+
return removeOperations.some(
|
|
6599
|
+
({ conditional }) => conditional ? isFlagConditionMet(conditional, form, action) : true
|
|
6600
|
+
);
|
|
6601
|
+
}
|
|
6602
|
+
var INHERENT_FLAG_RULES = [
|
|
6603
|
+
{
|
|
6604
|
+
flag: InherentFlags.CORRECTION_REQUESTED,
|
|
6605
|
+
setOn: [ActionType.REQUEST_CORRECTION],
|
|
6606
|
+
resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
|
|
6607
|
+
},
|
|
6608
|
+
{
|
|
6609
|
+
// INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
|
|
6610
|
+
// other status-changing action (see getStatusFromActions).
|
|
6611
|
+
flag: InherentFlags.INCOMPLETE,
|
|
6612
|
+
setOn: [ActionType.NOTIFY],
|
|
6613
|
+
resetOn: [
|
|
6614
|
+
ActionType.CREATE,
|
|
6615
|
+
ActionType.DECLARE,
|
|
6616
|
+
ActionType.REGISTER,
|
|
6617
|
+
ActionType.ARCHIVE
|
|
6618
|
+
]
|
|
6619
|
+
},
|
|
6620
|
+
{
|
|
6621
|
+
flag: InherentFlags.REJECTED,
|
|
6622
|
+
setOn: [ActionType.REJECT],
|
|
6623
|
+
resetOn: [
|
|
6624
|
+
ActionType.NOTIFY,
|
|
6625
|
+
ActionType.DECLARE,
|
|
6626
|
+
ActionType.EDIT,
|
|
6627
|
+
ActionType.REGISTER
|
|
6628
|
+
]
|
|
6629
|
+
},
|
|
6630
|
+
{
|
|
6631
|
+
flag: InherentFlags.POTENTIAL_DUPLICATE,
|
|
6632
|
+
setOn: [ActionType.DUPLICATE_DETECTED],
|
|
6633
|
+
resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
|
|
6634
|
+
},
|
|
6635
|
+
{
|
|
6636
|
+
flag: InherentFlags.EDIT_IN_PROGRESS,
|
|
6637
|
+
setOn: [ActionType.EDIT],
|
|
6638
|
+
resetOnAnyOtherAction: true
|
|
6639
|
+
}
|
|
6640
|
+
];
|
|
6641
|
+
function resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration) {
|
|
6642
|
+
return acceptedActions.reduce((present, action, idx) => {
|
|
6643
|
+
if (rule.setOn.includes(action.type)) {
|
|
6644
|
+
return true;
|
|
6645
|
+
}
|
|
6646
|
+
if (rule.resetOnAnyOtherAction || (rule.resetOn ?? []).includes(action.type)) {
|
|
6647
|
+
return false;
|
|
6648
|
+
}
|
|
6649
|
+
if (actionConfigRemovesFlag(
|
|
6650
|
+
action,
|
|
6651
|
+
rule.flag,
|
|
6652
|
+
acceptedActions.slice(0, idx + 1),
|
|
6653
|
+
event2,
|
|
6654
|
+
eventConfiguration
|
|
6655
|
+
)) {
|
|
6656
|
+
return false;
|
|
6657
|
+
}
|
|
6658
|
+
return present;
|
|
6659
|
+
}, false);
|
|
6660
|
+
}
|
|
6585
6661
|
function resolveEventCustomFlags(event2, eventConfiguration) {
|
|
6586
6662
|
const actions = getAcceptedActions(event2).filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
6587
6663
|
return actions.reduce((acc, action, idx) => {
|
|
@@ -6630,33 +6706,19 @@ function getActionStatusFlags(sortedActions) {
|
|
|
6630
6706
|
return flag2;
|
|
6631
6707
|
});
|
|
6632
6708
|
}
|
|
6633
|
-
function getInherentFlags(sortedActions) {
|
|
6709
|
+
function getInherentFlags(sortedActions, event2, eventConfiguration) {
|
|
6634
6710
|
const acceptedActions = sortedActions.filter(
|
|
6635
6711
|
({ status: status2 }) => status2 === ActionStatus.Accepted
|
|
6636
6712
|
);
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
}
|
|
6641
|
-
if (isDeclarationIncomplete(acceptedActions)) {
|
|
6642
|
-
inherentFlags.push(InherentFlags.INCOMPLETE);
|
|
6643
|
-
}
|
|
6644
|
-
if (isRejected(acceptedActions)) {
|
|
6645
|
-
inherentFlags.push(InherentFlags.REJECTED);
|
|
6646
|
-
}
|
|
6647
|
-
if (isPotentialDuplicate(acceptedActions)) {
|
|
6648
|
-
inherentFlags.push(InherentFlags.POTENTIAL_DUPLICATE);
|
|
6649
|
-
}
|
|
6650
|
-
if (isEditInProgress(acceptedActions)) {
|
|
6651
|
-
inherentFlags.push(InherentFlags.EDIT_IN_PROGRESS);
|
|
6652
|
-
}
|
|
6653
|
-
return inherentFlags;
|
|
6713
|
+
return INHERENT_FLAG_RULES.filter(
|
|
6714
|
+
(rule) => resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration)
|
|
6715
|
+
).map(({ flag: flag2 }) => flag2);
|
|
6654
6716
|
}
|
|
6655
6717
|
function getEventFlags(event2, config) {
|
|
6656
6718
|
const sortedActions = event2.actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
6657
6719
|
return [
|
|
6658
6720
|
...getActionStatusFlags(sortedActions),
|
|
6659
|
-
...getInherentFlags(sortedActions),
|
|
6721
|
+
...getInherentFlags(sortedActions, event2, config),
|
|
6660
6722
|
...resolveEventCustomFlags(event2, config)
|
|
6661
6723
|
];
|
|
6662
6724
|
}
|
|
@@ -7661,6 +7723,11 @@ var TENNIS_CLUB_DECLARATION_REVIEW = {
|
|
|
7661
7723
|
id: "signature.upload.modal.title",
|
|
7662
7724
|
defaultMessage: "Draw signature",
|
|
7663
7725
|
description: "Title for the modal to draw signature"
|
|
7726
|
+
},
|
|
7727
|
+
// Zod applies the schema default at parse time, but this fixture bypasses
|
|
7728
|
+
// parsing — GeneratedInputField accesses configuration.maxFileSize directly.
|
|
7729
|
+
configuration: {
|
|
7730
|
+
maxFileSize: 5 * 1024 * 1024
|
|
7664
7731
|
}
|
|
7665
7732
|
}
|
|
7666
7733
|
]
|
|
@@ -10217,7 +10284,7 @@ function matchesJurisdictionFilter(locationIds, filter, user2) {
|
|
|
10217
10284
|
return locationIds.some((id) => id === user2.primaryOfficeId);
|
|
10218
10285
|
}
|
|
10219
10286
|
if (filter === JurisdictionFilter.enum.administrativeArea) {
|
|
10220
|
-
return user2.administrativeAreaId
|
|
10287
|
+
return !user2.administrativeAreaId || locationIds.some((id) => id === user2.administrativeAreaId);
|
|
10221
10288
|
}
|
|
10222
10289
|
return true;
|
|
10223
10290
|
}
|
|
@@ -10306,7 +10373,7 @@ function canAccessUserWithScope({
|
|
|
10306
10373
|
}
|
|
10307
10374
|
const hasAdministrativeAreaInHierarchy = userToAccess.administrativeHierarchy.some(
|
|
10308
10375
|
(id) => user2.administrativeAreaId === id
|
|
10309
|
-
) || user2.administrativeAreaId
|
|
10376
|
+
) || !user2.administrativeAreaId;
|
|
10310
10377
|
if (opts?.accessLevel === JurisdictionFilter.enum.administrativeArea && !hasAdministrativeAreaInHierarchy) {
|
|
10311
10378
|
return false;
|
|
10312
10379
|
}
|
|
@@ -10612,18 +10679,19 @@ var ACTION_FILTERS = {
|
|
|
10612
10679
|
function filterActionsByFlags(actions, flags) {
|
|
10613
10680
|
return actions.filter((action) => ACTION_FILTERS[action]?.(flags) ?? true);
|
|
10614
10681
|
}
|
|
10682
|
+
var REJECTED_ACTIONS = [
|
|
10683
|
+
ActionType.READ,
|
|
10684
|
+
ActionType.NOTIFY,
|
|
10685
|
+
ActionType.CUSTOM,
|
|
10686
|
+
ActionType.EDIT,
|
|
10687
|
+
ActionType.ARCHIVE
|
|
10688
|
+
];
|
|
10615
10689
|
function getAvailableActionsWithoutFlagFilters(status2, flags) {
|
|
10616
10690
|
if (flags.includes(InherentFlags.EDIT_IN_PROGRESS)) {
|
|
10617
10691
|
return [ActionType.NOTIFY, ActionType.DECLARE, ActionType.REGISTER];
|
|
10618
10692
|
}
|
|
10619
|
-
if (flags.includes(InherentFlags.REJECTED)) {
|
|
10620
|
-
return
|
|
10621
|
-
ActionType.READ,
|
|
10622
|
-
ActionType.NOTIFY,
|
|
10623
|
-
ActionType.CUSTOM,
|
|
10624
|
-
ActionType.EDIT,
|
|
10625
|
-
ActionType.ARCHIVE
|
|
10626
|
-
];
|
|
10693
|
+
if (flags.includes(InherentFlags.REJECTED) && status2 !== EventStatus.enum.ARCHIVED) {
|
|
10694
|
+
return REJECTED_ACTIONS;
|
|
10627
10695
|
}
|
|
10628
10696
|
return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status2];
|
|
10629
10697
|
}
|
|
@@ -2394,14 +2394,20 @@ var encodeScope = (scope) => {
|
|
|
2394
2394
|
encode: false
|
|
2395
2395
|
});
|
|
2396
2396
|
};
|
|
2397
|
-
var
|
|
2398
|
-
|
|
2397
|
+
var decodedScopeCache = /* @__PURE__ */ new Map();
|
|
2398
|
+
var decodeScope = (encodedScope) => {
|
|
2399
|
+
if (decodedScopeCache.has(encodedScope)) {
|
|
2400
|
+
return decodedScopeCache.get(encodedScope);
|
|
2401
|
+
}
|
|
2402
|
+
const scope = qs.parse(encodedScope, {
|
|
2399
2403
|
ignoreQueryPrefix: true,
|
|
2400
2404
|
comma: true,
|
|
2401
2405
|
allowDots: true
|
|
2402
2406
|
});
|
|
2403
2407
|
const unflattenedScope = unflattenScope(scope);
|
|
2404
|
-
|
|
2408
|
+
const result = Scope2.safeParse(unflattenedScope)?.data;
|
|
2409
|
+
decodedScopeCache.set(encodedScope, result);
|
|
2410
|
+
return result;
|
|
2405
2411
|
};
|
|
2406
2412
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
2407
2413
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
@@ -770,6 +770,11 @@ var FieldTypesToHideInReview = [
|
|
|
770
770
|
FieldType.ALPHA_PRINT_BUTTON,
|
|
771
771
|
FieldType.ALPHA_HIDDEN
|
|
772
772
|
];
|
|
773
|
+
var HiddenFieldTypes = [
|
|
774
|
+
FieldType.HTTP,
|
|
775
|
+
FieldType.QUERY_PARAM_READER,
|
|
776
|
+
FieldType.ALPHA_HIDDEN
|
|
777
|
+
];
|
|
773
778
|
|
|
774
779
|
// ../commons/src/events/FieldValue.ts
|
|
775
780
|
var z12 = __toESM(require("zod/v4"));
|
|
@@ -888,7 +893,7 @@ var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date i
|
|
|
888
893
|
// ../commons/src/events/FieldValue.ts
|
|
889
894
|
var TextValue = z12.string();
|
|
890
895
|
var HiddenFieldValue = z12.string();
|
|
891
|
-
var NonEmptyTextValue =
|
|
896
|
+
var NonEmptyTextValue = z12.string().trim().min(1);
|
|
892
897
|
var DateValue = z12.iso.date().describe("Date in the format YYYY-MM-DD");
|
|
893
898
|
var AgeValue = z12.object({
|
|
894
899
|
age: z12.number(),
|
|
@@ -1750,6 +1755,7 @@ var NumberField = BaseField.extend({
|
|
|
1750
1755
|
configuration: import_v43.default.object({
|
|
1751
1756
|
min: import_v43.default.number().optional().describe("Minimum value"),
|
|
1752
1757
|
max: import_v43.default.number().optional().describe("Maximum value"),
|
|
1758
|
+
integer: import_v43.default.boolean().optional().describe("When true, only whole numbers are allowed"),
|
|
1753
1759
|
prefix: TranslationConfig.optional(),
|
|
1754
1760
|
postfix: TranslationConfig.optional()
|
|
1755
1761
|
}).optional()
|
|
@@ -2938,6 +2944,9 @@ var BaseField3 = z28.object({
|
|
|
2938
2944
|
),
|
|
2939
2945
|
validations: z28.array(ValidationConfig).optional().describe(
|
|
2940
2946
|
`Option for overriding the field validations specifically for advanced search form.`
|
|
2947
|
+
),
|
|
2948
|
+
allowedLocations: JurisdictionReference.optional().describe(
|
|
2949
|
+
`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.`
|
|
2941
2950
|
)
|
|
2942
2951
|
});
|
|
2943
2952
|
var SearchQueryParams = z28.object({
|
|
@@ -4694,12 +4703,53 @@ var updateActions = ActionTypes.extract([
|
|
|
4694
4703
|
ActionType.ARCHIVE,
|
|
4695
4704
|
ActionType.PRINT_CERTIFICATE,
|
|
4696
4705
|
ActionType.REQUEST_CORRECTION,
|
|
4706
|
+
ActionType.APPROVE_CORRECTION,
|
|
4707
|
+
ActionType.REJECT_CORRECTION,
|
|
4697
4708
|
ActionType.CUSTOM
|
|
4698
4709
|
]);
|
|
4699
4710
|
|
|
4700
4711
|
// ../commons/src/events/state/flags.ts
|
|
4701
4712
|
var import_lodash3 = require("lodash");
|
|
4702
4713
|
var import_date_fns3 = require("date-fns");
|
|
4714
|
+
var INHERENT_FLAG_RULES = [
|
|
4715
|
+
{
|
|
4716
|
+
flag: InherentFlags.CORRECTION_REQUESTED,
|
|
4717
|
+
setOn: [ActionType.REQUEST_CORRECTION],
|
|
4718
|
+
resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
|
|
4719
|
+
},
|
|
4720
|
+
{
|
|
4721
|
+
// INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
|
|
4722
|
+
// other status-changing action (see getStatusFromActions).
|
|
4723
|
+
flag: InherentFlags.INCOMPLETE,
|
|
4724
|
+
setOn: [ActionType.NOTIFY],
|
|
4725
|
+
resetOn: [
|
|
4726
|
+
ActionType.CREATE,
|
|
4727
|
+
ActionType.DECLARE,
|
|
4728
|
+
ActionType.REGISTER,
|
|
4729
|
+
ActionType.ARCHIVE
|
|
4730
|
+
]
|
|
4731
|
+
},
|
|
4732
|
+
{
|
|
4733
|
+
flag: InherentFlags.REJECTED,
|
|
4734
|
+
setOn: [ActionType.REJECT],
|
|
4735
|
+
resetOn: [
|
|
4736
|
+
ActionType.NOTIFY,
|
|
4737
|
+
ActionType.DECLARE,
|
|
4738
|
+
ActionType.EDIT,
|
|
4739
|
+
ActionType.REGISTER
|
|
4740
|
+
]
|
|
4741
|
+
},
|
|
4742
|
+
{
|
|
4743
|
+
flag: InherentFlags.POTENTIAL_DUPLICATE,
|
|
4744
|
+
setOn: [ActionType.DUPLICATE_DETECTED],
|
|
4745
|
+
resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
|
|
4746
|
+
},
|
|
4747
|
+
{
|
|
4748
|
+
flag: InherentFlags.EDIT_IN_PROGRESS,
|
|
4749
|
+
setOn: [ActionType.EDIT],
|
|
4750
|
+
resetOnAnyOtherAction: true
|
|
4751
|
+
}
|
|
4752
|
+
];
|
|
4703
4753
|
|
|
4704
4754
|
// ../commons/src/events/defineConfig.ts
|
|
4705
4755
|
var IGNORED_EVENT_TYPES = [
|
|
@@ -5445,6 +5495,11 @@ var TENNIS_CLUB_DECLARATION_REVIEW = {
|
|
|
5445
5495
|
id: "signature.upload.modal.title",
|
|
5446
5496
|
defaultMessage: "Draw signature",
|
|
5447
5497
|
description: "Title for the modal to draw signature"
|
|
5498
|
+
},
|
|
5499
|
+
// Zod applies the schema default at parse time, but this fixture bypasses
|
|
5500
|
+
// parsing — GeneratedInputField accesses configuration.maxFileSize directly.
|
|
5501
|
+
configuration: {
|
|
5502
|
+
maxFileSize: 5 * 1024 * 1024
|
|
5448
5503
|
}
|
|
5449
5504
|
}
|
|
5450
5505
|
]
|
|
@@ -7238,6 +7293,13 @@ var ACTION_FILTERS = {
|
|
|
7238
7293
|
[ActionType.UNASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
|
|
7239
7294
|
[ActionType.CUSTOM]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))
|
|
7240
7295
|
};
|
|
7296
|
+
var REJECTED_ACTIONS = [
|
|
7297
|
+
ActionType.READ,
|
|
7298
|
+
ActionType.NOTIFY,
|
|
7299
|
+
ActionType.CUSTOM,
|
|
7300
|
+
ActionType.EDIT,
|
|
7301
|
+
ActionType.ARCHIVE
|
|
7302
|
+
];
|
|
7241
7303
|
|
|
7242
7304
|
// ../commons/src/events/FileUtils.ts
|
|
7243
7305
|
var import_lodash7 = require("lodash");
|
package/dist/scopes/index.d.ts
CHANGED
|
@@ -580,14 +580,12 @@ export type EncodedScope = z.infer<typeof EncodedScope>;
|
|
|
580
580
|
*/
|
|
581
581
|
export declare const encodeScope: (scope: Scope) => EncodedScope;
|
|
582
582
|
/**
|
|
583
|
-
* Converts
|
|
583
|
+
* Converts an encoded scope string into a scope object.
|
|
584
584
|
*
|
|
585
|
-
* @
|
|
586
|
-
*
|
|
587
|
-
* @param scope - The scope object to encode.
|
|
588
|
-
* @returns The encoded scope as a branded string (`EncodedScope`).
|
|
585
|
+
* @param scope - The encoded scope string to decode.
|
|
586
|
+
* @returns The decoded scope object.
|
|
589
587
|
*/
|
|
590
|
-
export declare const decodeScope: (
|
|
588
|
+
export declare const decodeScope: (encodedScope: EncodedScope) => {
|
|
591
589
|
type: "record.create" | "record.declare" | "record.notify";
|
|
592
590
|
options?: {
|
|
593
591
|
event?: string[] | undefined;
|
package/dist/scopes/index.js
CHANGED
|
@@ -354,14 +354,20 @@ var encodeScope = (scope) => {
|
|
|
354
354
|
encode: false
|
|
355
355
|
});
|
|
356
356
|
};
|
|
357
|
-
var
|
|
358
|
-
|
|
357
|
+
var decodedScopeCache = /* @__PURE__ */ new Map();
|
|
358
|
+
var decodeScope = (encodedScope) => {
|
|
359
|
+
if (decodedScopeCache.has(encodedScope)) {
|
|
360
|
+
return decodedScopeCache.get(encodedScope);
|
|
361
|
+
}
|
|
362
|
+
const scope = qs.parse(encodedScope, {
|
|
359
363
|
ignoreQueryPrefix: true,
|
|
360
364
|
comma: true,
|
|
361
365
|
allowDots: true
|
|
362
366
|
});
|
|
363
367
|
const unflattenedScope = unflattenScope(scope);
|
|
364
|
-
|
|
368
|
+
const result = Scope2.safeParse(unflattenedScope)?.data;
|
|
369
|
+
decodedScopeCache.set(encodedScope, result);
|
|
370
|
+
return result;
|
|
365
371
|
};
|
|
366
372
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
367
373
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
Binary file
|
package/package.json
CHANGED
|
Binary file
|