@opencrvs/toolkit 1.9.13-rc.a55515a → 1.9.13-rc.a8c3521

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.
@@ -88,6 +88,8 @@ export declare const DraftInput: z.ZodObject<z.objectUtil.extendShape<{
88
88
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, z.ZodTypeDef, import("./FieldValue").FieldUpdateValue>>>;
89
89
  originalActionId: z.ZodOptional<z.ZodBranded<z.ZodString, "UUID">>;
90
90
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
91
+ keepAssignmentIfAccepted: z.ZodOptional<z.ZodBoolean>;
92
+ keepAssignmentIfRejected: z.ZodOptional<z.ZodBoolean>;
91
93
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodString, "UUID">>>;
92
94
  }, {
93
95
  type: z.ZodEnum<["CREATE", "NOTIFY", "DECLARE", "VALIDATE", "REGISTER", "DUPLICATE_DETECTED", "REJECT", "MARK_AS_DUPLICATE", "MARK_AS_NOT_DUPLICATE", "ARCHIVE", "PRINT_CERTIFICATE", "REQUEST_CORRECTION", "REJECT_CORRECTION", "APPROVE_CORRECTION", "READ", "ASSIGN", "UNASSIGN"]>;
@@ -102,6 +104,8 @@ export declare const DraftInput: z.ZodObject<z.objectUtil.extendShape<{
102
104
  annotation?: Record<string, import("./FieldValue").FieldUpdateValue> | undefined;
103
105
  originalActionId?: (string & z.BRAND<"UUID">) | undefined;
104
106
  keepAssignment?: boolean | undefined;
107
+ keepAssignmentIfAccepted?: boolean | undefined;
108
+ keepAssignmentIfRejected?: boolean | undefined;
105
109
  }, {
106
110
  type: "CREATE" | "NOTIFY" | "DECLARE" | "VALIDATE" | "REGISTER" | "DUPLICATE_DETECTED" | "REJECT" | "MARK_AS_DUPLICATE" | "MARK_AS_NOT_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "READ" | "ASSIGN" | "UNASSIGN";
107
111
  status: "Rejected" | "Requested" | "Accepted";
@@ -112,6 +116,8 @@ export declare const DraftInput: z.ZodObject<z.objectUtil.extendShape<{
112
116
  annotation?: Record<string, import("./FieldValue").FieldUpdateValue> | undefined;
113
117
  originalActionId?: string | undefined;
114
118
  keepAssignment?: boolean | undefined;
119
+ keepAssignmentIfAccepted?: boolean | undefined;
120
+ keepAssignmentIfRejected?: boolean | undefined;
115
121
  }>;
116
122
  export type Draft = z.infer<typeof Draft>;
117
123
  export type DraftInput = z.infer<typeof DraftInput>;
@@ -460,7 +460,7 @@ export declare function timePeriodToDateRange(value: SelectDateRangeValue): {
460
460
  };
461
461
  export declare function mergeDrafts(currentDraft: Draft, incomingDraft: Draft): Draft;
462
462
  export declare function getPendingAction(actions: Action[]): ActionDocument;
463
- export declare function getCompleteActionAnnotation(annotation: ActionUpdate, event: EventDocument, action: ActionDocument): ActionUpdate;
463
+ export declare function getCompleteActionAnnotation(event: EventDocument, action: ActionDocument): ActionUpdate;
464
464
  export declare function getCompleteActionDeclaration<T extends EventState | ActionUpdate>(declaration: T, event: EventDocument, action: ActionDocument): T;
465
465
  export declare function getAcceptedActions(event: EventDocument): ActionDocument[];
466
466
  export declare function aggregateActionDeclarations(event: EventDocument): EventState;
@@ -4097,20 +4097,16 @@ function getPendingAction(actions) {
4097
4097
  }
4098
4098
  return pendingActions[0];
4099
4099
  }
4100
- function getCompleteActionAnnotation(annotation, event2, action) {
4100
+ function getCompleteActionAnnotation(event2, action) {
4101
4101
  if (action.originalActionId) {
4102
4102
  const originalAction = event2.actions.find(
4103
4103
  ({ id }) => id === action.originalActionId
4104
4104
  );
4105
- if (originalAction?.status !== ActionStatus.Requested) {
4106
- return annotation;
4105
+ if (originalAction?.status === ActionStatus.Requested) {
4106
+ return deepMerge(originalAction.annotation ?? {}, action.annotation ?? {});
4107
4107
  }
4108
- return deepMerge(
4109
- deepMerge(annotation, originalAction.annotation ?? {}),
4110
- action.annotation ?? {}
4111
- );
4112
4108
  }
4113
- return deepMerge(annotation, action.annotation ?? {});
4109
+ return action.annotation ?? {};
4114
4110
  }
4115
4111
  function getCompleteActionDeclaration(declaration, event2, action) {
4116
4112
  if (action.originalActionId) {
@@ -4130,7 +4126,7 @@ function getAcceptedActions(event2) {
4130
4126
  return event2.actions.filter(isAcceptedAction).map((action) => ({
4131
4127
  ...action,
4132
4128
  declaration: getCompleteActionDeclaration({}, event2, action),
4133
- annotation: getCompleteActionAnnotation({}, event2, action)
4129
+ annotation: getCompleteActionAnnotation(event2, action)
4134
4130
  }));
4135
4131
  }
4136
4132
  var EXCLUDED_ACTIONS = [
@@ -5306,6 +5302,8 @@ var BaseActionInput = import_zod34.z.object({
5306
5302
  originalActionId: UUID.optional(),
5307
5303
  // should not be part of base action.
5308
5304
  keepAssignment: import_zod34.z.boolean().optional(),
5305
+ keepAssignmentIfAccepted: import_zod34.z.boolean().optional(),
5306
+ keepAssignmentIfRejected: import_zod34.z.boolean().optional(),
5309
5307
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
5310
5308
  createdAtLocation: CreatedAtLocation.describe(
5311
5309
  "A valid office location ID. This is required for system users performing actions. The provided location must be a leaf-location, i.e. it must not have any children locations."
@@ -5876,7 +5874,7 @@ function getActionAnnotation({
5876
5874
  const action = (0, import_lodash3.findLast)(activeActions, (a) => a.type === actionType);
5877
5875
  const actionWithCompleteAnnotation = action && {
5878
5876
  ...action,
5879
- annotation: getCompleteActionAnnotation({}, event2, action)
5877
+ annotation: getCompleteActionAnnotation(event2, action)
5880
5878
  };
5881
5879
  const matchingDraft = draft?.action.type === actionType ? draft : void 0;
5882
5880
  const sortedActions = (0, import_lodash3.orderBy)(
@@ -3801,6 +3801,8 @@ var BaseActionInput = import_zod34.z.object({
3801
3801
  originalActionId: UUID.optional(),
3802
3802
  // should not be part of base action.
3803
3803
  keepAssignment: import_zod34.z.boolean().optional(),
3804
+ keepAssignmentIfAccepted: import_zod34.z.boolean().optional(),
3805
+ keepAssignmentIfRejected: import_zod34.z.boolean().optional(),
3804
3806
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
3805
3807
  createdAtLocation: CreatedAtLocation.describe(
3806
3808
  "A valid office location ID. This is required for system users performing actions. The provided location must be a leaf-location, i.e. it must not have any children locations."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "1.9.13-rc.a55515a",
3
+ "version": "1.9.13-rc.a8c3521",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "exports": {
@@ -17,21 +17,21 @@
17
17
  "build:all": "lerna run build --include-dependencies --scope @opencrvs/toolkit && ./build.sh"
18
18
  },
19
19
  "dependencies": {
20
- "uuid": "^9.0.0",
20
+ "@trpc/client": "11.4.3",
21
+ "@trpc/server": "11.4.3",
21
22
  "ajv": "^8.17.1",
22
23
  "ajv-formats": "^3.0.1",
23
24
  "object-hash": "^3.0.0",
24
25
  "superjson": "1.9.0-0",
25
- "@trpc/client": "11.4.3",
26
- "@trpc/server": "11.4.3",
26
+ "uuid": "^9.0.0",
27
27
  "zod-openapi": "^4.2.4"
28
28
  },
29
29
  "devDependencies": {
30
+ "@opencrvs/events": "^1.9.0",
31
+ "@types/object-hash": "^3.0.6",
30
32
  "@types/uuid": "^9.0.3",
31
33
  "esbuild": "^0.24.0",
32
- "typescript": "^5.6.3",
33
- "@opencrvs/events": "^1.9.0",
34
- "@types/object-hash": "^3.0.6"
34
+ "typescript": "^5.6.3"
35
35
  },
36
36
  "moduleNameMapper": {
37
37
  "@opencrvs/commons/events": "@opencrvs/commons/build/dist/common/events/index.js",