@opencrvs/toolkit 1.8.0-rc.fb8e005 → 1.8.0-rc.fb96ec1
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/commons/api/router.d.ts +9779 -578
- package/dist/commons/events/ActionConfig.d.ts +0 -2856
- package/dist/commons/events/ActionDocument.d.ts +696 -696
- package/dist/commons/events/ActionInput.d.ts +600 -600
- package/dist/commons/events/ActionType.d.ts +2 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +18 -18
- package/dist/commons/events/CompositeFieldValue.d.ts +6 -6
- package/dist/commons/events/Draft.d.ts +48 -48
- package/dist/commons/events/EventConfig.d.ts +0 -1432
- package/dist/commons/events/EventDocument.d.ts +432 -432
- package/dist/commons/events/EventIndex.d.ts +10 -10
- package/dist/commons/events/FieldConfig.d.ts +0 -179
- package/dist/commons/events/FieldTypeMapping.d.ts +16 -16
- package/dist/commons/events/FieldValue.d.ts +12 -12
- package/dist/commons/events/FormConfig.d.ts +0 -1200
- package/dist/commons/events/PageConfig.d.ts +0 -288
- package/dist/commons/events/defineConfig.d.ts +0 -308
- package/dist/commons/events/test.utils.d.ts +12 -12
- package/dist/commons/events/utils.d.ts +8 -456
- package/dist/events/index.js +40 -43
- package/package.json +1 -1
package/dist/events/index.js
CHANGED
@@ -158,6 +158,7 @@ __export(events_exports, {
|
|
158
158
|
SelectOption: () => SelectOption,
|
159
159
|
ShowConditional: () => ShowConditional,
|
160
160
|
SignatureFieldValue: () => SignatureFieldValue,
|
161
|
+
StatusChangingActions: () => StatusChangingActions,
|
161
162
|
SummaryConfig: () => SummaryConfig,
|
162
163
|
TENNIS_CLUB_MEMBERSHIP: () => TENNIS_CLUB_MEMBERSHIP,
|
163
164
|
TestUserRole: () => TestUserRole,
|
@@ -481,8 +482,8 @@ var NameFieldValue = import_zod3.z.object({
|
|
481
482
|
middlename: import_zod3.z.string().optional()
|
482
483
|
});
|
483
484
|
var NameFieldUpdateValue = import_zod3.z.object({
|
484
|
-
firstname: import_zod3.z.string()
|
485
|
-
surname: import_zod3.z.string()
|
485
|
+
firstname: import_zod3.z.string(),
|
486
|
+
surname: import_zod3.z.string(),
|
486
487
|
middlename: import_zod3.z.string().nullish()
|
487
488
|
}).or(import_zod3.z.null()).or(import_zod3.z.undefined());
|
488
489
|
var RuralAddressUpdateValue = AdminStructure.extend({
|
@@ -582,7 +583,6 @@ var BaseField = import_zod5.z.object({
|
|
582
583
|
parent: ParentReference,
|
583
584
|
conditionals: import_zod5.z.array(FieldConditional).default([]).optional(),
|
584
585
|
required: import_zod5.z.boolean().default(false).optional(),
|
585
|
-
secured: import_zod5.z.boolean().default(false).optional(),
|
586
586
|
placeholder: TranslationConfig.optional(),
|
587
587
|
validation: import_zod5.z.array(ValidationConfig).default([]).optional(),
|
588
588
|
label: TranslationConfig,
|
@@ -748,9 +748,7 @@ var NameField = BaseField.extend({
|
|
748
748
|
configuration: import_zod5.z.object({
|
749
749
|
maxLength: import_zod5.z.number().optional().describe("Maximum length of the text"),
|
750
750
|
prefix: TranslationConfig.optional(),
|
751
|
-
postfix: TranslationConfig.optional()
|
752
|
-
includeMiddlename: import_zod5.z.boolean().default(false).optional().describe("To make middle name visible in Name form field"),
|
753
|
-
searchMode: import_zod5.z.boolean().optional()
|
751
|
+
postfix: TranslationConfig.optional()
|
754
752
|
}).optional()
|
755
753
|
}).describe("Name input field");
|
756
754
|
var PhoneField = BaseField.extend({
|
@@ -976,6 +974,16 @@ var writeActions = ActionTypes.exclude([
|
|
976
974
|
ActionType.ASSIGN,
|
977
975
|
ActionType.UNASSIGN
|
978
976
|
]);
|
977
|
+
var StatusChangingActions = ActionTypes.extract([
|
978
|
+
ActionType.CREATE,
|
979
|
+
ActionType.NOTIFY,
|
980
|
+
ActionType.DECLARE,
|
981
|
+
ActionType.VALIDATE,
|
982
|
+
ActionType.REGISTER,
|
983
|
+
ActionType.REJECT,
|
984
|
+
ActionType.ARCHIVE,
|
985
|
+
ActionType.PRINT_CERTIFICATE
|
986
|
+
]);
|
979
987
|
var workqueueActions = ActionTypes.exclude([
|
980
988
|
ActionType.CREATE,
|
981
989
|
ActionType.NOTIFY,
|
@@ -2221,7 +2229,7 @@ var errorMessages = {
|
|
2221
2229
|
id: "v2.error.invalidEmail"
|
2222
2230
|
},
|
2223
2231
|
requiredField: {
|
2224
|
-
defaultMessage: "Required",
|
2232
|
+
defaultMessage: "Required for registration",
|
2225
2233
|
description: "Error message when required field is missing",
|
2226
2234
|
id: "v2.error.required"
|
2227
2235
|
},
|
@@ -3827,7 +3835,6 @@ var EventDocument = import_zod31.z.object({
|
|
3827
3835
|
}).openapi({ ref: "EventDocument" });
|
3828
3836
|
|
3829
3837
|
// ../commons/src/events/state/utils.ts
|
3830
|
-
var import_lodash2 = require("lodash");
|
3831
3838
|
function getActionRequests(actionType, actions) {
|
3832
3839
|
const filtered = actions.filter((action) => action.type === actionType);
|
3833
3840
|
const accept = filtered.find(
|
@@ -3866,38 +3873,29 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
|
|
3866
3873
|
registrationNumber
|
3867
3874
|
};
|
3868
3875
|
}
|
3869
|
-
var updateActions = ActionTypes.extract([
|
3870
|
-
ActionType.CREATE,
|
3871
|
-
ActionType.NOTIFY,
|
3872
|
-
ActionType.DECLARE,
|
3873
|
-
ActionType.VALIDATE,
|
3874
|
-
ActionType.REGISTER,
|
3875
|
-
ActionType.REJECT,
|
3876
|
-
ActionType.ARCHIVE,
|
3877
|
-
ActionType.PRINT_CERTIFICATE,
|
3878
|
-
ActionType.REQUEST_CORRECTION
|
3879
|
-
]);
|
3880
3876
|
function getActionUpdateMetadata(actions) {
|
3881
3877
|
const createAction = getOrThrow(
|
3882
3878
|
actions.find((action) => action.type === ActionType.CREATE),
|
3883
3879
|
`Event has no ${ActionType.CREATE} action`
|
3884
3880
|
);
|
3885
|
-
|
3886
|
-
|
3887
|
-
|
3888
|
-
|
3889
|
-
|
3890
|
-
|
3891
|
-
|
3892
|
-
|
3893
|
-
|
3894
|
-
|
3895
|
-
const originalAction = actions.find(({ id }) => id === action.originalActionId) ?? action;
|
3896
|
-
return (0, import_lodash2.pick)(originalAction, metadataFields);
|
3897
|
-
}
|
3898
|
-
return (0, import_lodash2.pick)(action, metadataFields);
|
3881
|
+
return StatusChangingActions.options.reduce(
|
3882
|
+
(metadata, actionType) => {
|
3883
|
+
const { accept, request } = getActionRequests(actionType, actions);
|
3884
|
+
return {
|
3885
|
+
createdAt: request?.createdAt ?? accept?.createdAt ?? metadata.createdAt,
|
3886
|
+
createdBy: request?.createdBy ?? accept?.createdBy ?? metadata.createdBy,
|
3887
|
+
createdByUserType: request?.createdByUserType ?? accept?.createdByUserType ?? metadata.createdByUserType,
|
3888
|
+
createdAtLocation: request?.createdAtLocation ?? accept?.createdAtLocation ?? metadata.createdAtLocation,
|
3889
|
+
createdByRole: request?.createdByRole ?? accept?.createdByRole ?? metadata.createdByRole
|
3890
|
+
};
|
3899
3891
|
},
|
3900
|
-
|
3892
|
+
{
|
3893
|
+
createdAt: createAction.createdAt,
|
3894
|
+
createdBy: createAction.createdBy,
|
3895
|
+
createdByUserType: createAction.createdByUserType,
|
3896
|
+
createdAtLocation: createAction.createdAtLocation,
|
3897
|
+
createdByRole: createAction.createdByRole
|
3898
|
+
}
|
3901
3899
|
);
|
3902
3900
|
}
|
3903
3901
|
function getLegalStatuses(actions) {
|
@@ -4210,8 +4208,8 @@ var User = import_zod32.z.object({
|
|
4210
4208
|
});
|
4211
4209
|
|
4212
4210
|
// ../commons/src/events/test.utils.ts
|
4213
|
-
var
|
4214
|
-
var
|
4211
|
+
var import_lodash2 = require("lodash");
|
4212
|
+
var import_addDays = __toESM(require("date-fns/addDays"));
|
4215
4213
|
|
4216
4214
|
// ../commons/src/field-config/field-configuration.ts
|
4217
4215
|
function createFieldConfig(fieldId, options) {
|
@@ -5030,7 +5028,6 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
|
5030
5028
|
id: "applicant.address",
|
5031
5029
|
type: "ADDRESS",
|
5032
5030
|
required: true,
|
5033
|
-
secured: true,
|
5034
5031
|
conditionals: [],
|
5035
5032
|
label: {
|
5036
5033
|
defaultMessage: "Applicant's address",
|
@@ -6353,7 +6350,7 @@ function eventPayloadGenerator(rng) {
|
|
6353
6350
|
type: input.type ?? TENNIS_CLUB_MEMBERSHIP,
|
6354
6351
|
id
|
6355
6352
|
}),
|
6356
|
-
draft: ({ eventId, actionType }, input = {}) => (0,
|
6353
|
+
draft: ({ eventId, actionType }, input = {}) => (0, import_lodash2.merge)(
|
6357
6354
|
{
|
6358
6355
|
id: getUUID(),
|
6359
6356
|
eventId,
|
@@ -6407,13 +6404,13 @@ function eventPayloadGenerator(rng) {
|
|
6407
6404
|
notify: (eventId, input = {}) => {
|
6408
6405
|
let declaration = input.declaration;
|
6409
6406
|
if (!declaration) {
|
6410
|
-
const partialDeclaration = (0,
|
6407
|
+
const partialDeclaration = (0, import_lodash2.omitBy)(
|
6411
6408
|
generateActionDeclarationInput(
|
6412
6409
|
tennisClubMembershipEvent,
|
6413
6410
|
ActionType.DECLARE,
|
6414
6411
|
rng
|
6415
6412
|
),
|
6416
|
-
|
6413
|
+
import_lodash2.isString
|
6417
6414
|
);
|
6418
6415
|
declaration = partialDeclaration;
|
6419
6416
|
}
|
@@ -6740,7 +6737,7 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
|
|
6740
6737
|
createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
|
6741
6738
|
updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
|
6742
6739
|
createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
|
6743
|
-
updatedAt: overrides.updatedAt ?? (0,
|
6740
|
+
updatedAt: overrides.updatedAt ?? (0, import_addDays.default)(new Date(createdAt), 1).toISOString(),
|
6744
6741
|
assignedTo: overrides.assignedTo ?? null,
|
6745
6742
|
updatedBy: overrides.updatedBy ?? generateUuid(rng),
|
6746
6743
|
updatedByUserRole: overrides.updatedByUserRole ?? "FIELD_AGENT",
|
@@ -6812,7 +6809,7 @@ function isFieldConfigDefaultValue(value) {
|
|
6812
6809
|
}
|
6813
6810
|
|
6814
6811
|
// ../commons/src/events/scopes.ts
|
6815
|
-
var
|
6812
|
+
var import_lodash3 = require("lodash");
|
6816
6813
|
var CONFIG_GET_ALLOWED_SCOPES = [
|
6817
6814
|
SCOPES.RECORD_DECLARE,
|
6818
6815
|
SCOPES.RECORD_READ,
|
@@ -6896,7 +6893,7 @@ var WRITE_ACTION_SCOPES = [
|
|
6896
6893
|
...ACTION_ALLOWED_SCOPES[ActionType.PRINT_CERTIFICATE]
|
6897
6894
|
];
|
6898
6895
|
function hasAnyOfScopes(a, b) {
|
6899
|
-
return (0,
|
6896
|
+
return (0, import_lodash3.intersection)(a, b).length > 0;
|
6900
6897
|
}
|
6901
6898
|
|
6902
6899
|
// ../commons/src/events/serializers/user/deserializer.ts
|