@opencrvs/toolkit 2.0.0-rc.92bed7b → 2.0.0-rc.941dbd9

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.
@@ -989,8 +989,9 @@ var RequestedCorrectionAction = ActionBase.extend(
989
989
  var ApprovedCorrectionAction = ActionBase.extend(
990
990
  z13.object({
991
991
  type: z13.literal(ActionType.APPROVE_CORRECTION),
992
- requestId: z13.string()
992
+ requestId: z13.string(),
993
993
  // TODO move into 'content' property
994
+ content: z13.object({ immediateCorrection: z13.boolean().optional() }).optional()
994
995
  }).shape
995
996
  );
996
997
  var RejectedCorrectionAction = ActionBase.extend(
@@ -313,6 +313,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
313
313
  createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
314
314
  annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
315
315
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
316
+ content?: {
317
+ immediateCorrection?: boolean | undefined;
318
+ } | undefined;
316
319
  } | {
317
320
  id: string & import("zod").$brand<"UUID">;
318
321
  transactionId: string;
@@ -622,6 +625,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
622
625
  createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
623
626
  annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
624
627
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
628
+ content?: {
629
+ immediateCorrection?: boolean | undefined;
630
+ } | undefined;
625
631
  } | {
626
632
  id: string & import("zod").$brand<"UUID">;
627
633
  transactionId: string;
@@ -930,6 +936,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
930
936
  createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
931
937
  annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
932
938
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
939
+ content?: {
940
+ immediateCorrection?: boolean | undefined;
941
+ } | undefined;
933
942
  } | {
934
943
  id: string & import("zod").$brand<"UUID">;
935
944
  transactionId: string;
@@ -1388,6 +1397,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1388
1397
  waitFor?: boolean | undefined;
1389
1398
  createdAtLocation?: string | null | undefined;
1390
1399
  type?: "APPROVE_CORRECTION" | undefined;
1400
+ content?: {
1401
+ immediateCorrection?: boolean | undefined;
1402
+ } | undefined;
1391
1403
  }, "keepAssignmentIfAccepted" | "keepAssignmentIfRejected"> | Omit<{
1392
1404
  eventId: string;
1393
1405
  transactionId: string;
@@ -1672,6 +1684,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1672
1684
  createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
1673
1685
  annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
1674
1686
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
1687
+ content?: {
1688
+ immediateCorrection?: boolean | undefined;
1689
+ } | undefined;
1675
1690
  } | {
1676
1691
  id: string & import("zod").$brand<"UUID">;
1677
1692
  transactionId: string;
@@ -2012,6 +2027,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
2012
2027
  createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
2013
2028
  annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
2014
2029
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
2030
+ content?: {
2031
+ immediateCorrection?: boolean | undefined;
2032
+ } | undefined;
2015
2033
  } | {
2016
2034
  id: string & import("zod").$brand<"UUID">;
2017
2035
  transactionId: string;
@@ -2331,6 +2349,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
2331
2349
  waitFor?: boolean | undefined;
2332
2350
  createdAtLocation?: string | null | undefined;
2333
2351
  type?: "APPROVE_CORRECTION" | undefined;
2352
+ content?: {
2353
+ immediateCorrection?: boolean | undefined;
2354
+ } | undefined;
2334
2355
  }, "keepAssignmentIfAccepted" | "keepAssignmentIfRejected"> | Omit<{
2335
2356
  eventId: string;
2336
2357
  transactionId: string;
@@ -2623,6 +2644,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
2623
2644
  waitFor?: boolean | undefined;
2624
2645
  createdAtLocation?: string | null | undefined;
2625
2646
  type?: "APPROVE_CORRECTION" | undefined;
2647
+ content?: {
2648
+ immediateCorrection?: boolean | undefined;
2649
+ } | undefined;
2626
2650
  }, "keepAssignmentIfAccepted" | "keepAssignmentIfRejected"> | Omit<{
2627
2651
  eventId: string;
2628
2652
  transactionId: string;
@@ -2915,6 +2939,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
2915
2939
  waitFor?: boolean | undefined;
2916
2940
  createdAtLocation?: string | null | undefined;
2917
2941
  type?: "APPROVE_CORRECTION" | undefined;
2942
+ content?: {
2943
+ immediateCorrection?: boolean | undefined;
2944
+ } | undefined;
2918
2945
  }, "keepAssignmentIfAccepted" | "keepAssignmentIfRejected"> | Omit<{
2919
2946
  eventId: string;
2920
2947
  transactionId: string;
@@ -3207,6 +3234,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
3207
3234
  waitFor?: boolean | undefined;
3208
3235
  createdAtLocation?: string | null | undefined;
3209
3236
  type?: "APPROVE_CORRECTION" | undefined;
3237
+ content?: {
3238
+ immediateCorrection?: boolean | undefined;
3239
+ } | undefined;
3210
3240
  }, "keepAssignmentIfAccepted" | "keepAssignmentIfRejected"> | Omit<{
3211
3241
  eventId: string;
3212
3242
  transactionId: string;
@@ -3499,6 +3529,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
3499
3529
  waitFor?: boolean | undefined;
3500
3530
  createdAtLocation?: string | null | undefined;
3501
3531
  type?: "APPROVE_CORRECTION" | undefined;
3532
+ content?: {
3533
+ immediateCorrection?: boolean | undefined;
3534
+ } | undefined;
3502
3535
  }, "keepAssignmentIfAccepted" | "keepAssignmentIfRejected"> | Omit<{
3503
3536
  eventId: string;
3504
3537
  transactionId: string;
@@ -3791,6 +3824,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
3791
3824
  waitFor?: boolean | undefined;
3792
3825
  createdAtLocation?: string | null | undefined;
3793
3826
  type?: "APPROVE_CORRECTION" | undefined;
3827
+ content?: {
3828
+ immediateCorrection?: boolean | undefined;
3829
+ } | undefined;
3794
3830
  }, "keepAssignmentIfAccepted" | "keepAssignmentIfRejected"> | Omit<{
3795
3831
  eventId: string;
3796
3832
  transactionId: string;
@@ -4077,6 +4113,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4077
4113
  createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
4078
4114
  annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
4079
4115
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
4116
+ content?: {
4117
+ immediateCorrection?: boolean | undefined;
4118
+ } | undefined;
4080
4119
  } | {
4081
4120
  id: string & import("zod").$brand<"UUID">;
4082
4121
  transactionId: string;
@@ -4396,6 +4435,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4396
4435
  waitFor?: boolean | undefined;
4397
4436
  createdAtLocation?: string | null | undefined;
4398
4437
  type?: "APPROVE_CORRECTION" | undefined;
4438
+ content?: {
4439
+ immediateCorrection?: boolean | undefined;
4440
+ } | undefined;
4399
4441
  }, "keepAssignmentIfAccepted" | "keepAssignmentIfRejected"> | Omit<{
4400
4442
  eventId: string;
4401
4443
  transactionId: string;
@@ -4682,6 +4724,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4682
4724
  createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
4683
4725
  annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
4684
4726
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
4727
+ content?: {
4728
+ immediateCorrection?: boolean | undefined;
4729
+ } | undefined;
4685
4730
  } | {
4686
4731
  id: string & import("zod").$brand<"UUID">;
4687
4732
  transactionId: string;
@@ -5000,6 +5045,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
5000
5045
  createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
5001
5046
  annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
5002
5047
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
5048
+ content?: {
5049
+ immediateCorrection?: boolean | undefined;
5050
+ } | undefined;
5003
5051
  } | {
5004
5052
  id: string & import("zod").$brand<"UUID">;
5005
5053
  transactionId: string;
@@ -5369,6 +5417,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
5369
5417
  waitFor?: boolean | undefined;
5370
5418
  createdAtLocation?: string | null | undefined;
5371
5419
  type?: "APPROVE_CORRECTION" | undefined;
5420
+ content?: {
5421
+ immediateCorrection?: boolean | undefined;
5422
+ } | undefined;
5372
5423
  }, "keepAssignmentIfAccepted" | "keepAssignmentIfRejected"> | Omit<{
5373
5424
  eventId: string;
5374
5425
  transactionId: string;
@@ -5661,6 +5712,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
5661
5712
  waitFor?: boolean | undefined;
5662
5713
  createdAtLocation?: string | null | undefined;
5663
5714
  type?: "APPROVE_CORRECTION" | undefined;
5715
+ content?: {
5716
+ immediateCorrection?: boolean | undefined;
5717
+ } | undefined;
5664
5718
  }, "keepAssignmentIfAccepted" | "keepAssignmentIfRejected"> | Omit<{
5665
5719
  eventId: string;
5666
5720
  transactionId: string;
@@ -5953,6 +6007,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
5953
6007
  waitFor?: boolean | undefined;
5954
6008
  createdAtLocation?: string | null | undefined;
5955
6009
  type?: "APPROVE_CORRECTION" | undefined;
6010
+ content?: {
6011
+ immediateCorrection?: boolean | undefined;
6012
+ } | undefined;
5956
6013
  }, "keepAssignmentIfAccepted" | "keepAssignmentIfRejected"> | Omit<{
5957
6014
  eventId: string;
5958
6015
  transactionId: string;
@@ -6242,6 +6299,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
6242
6299
  createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
6243
6300
  annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
6244
6301
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
6302
+ content?: {
6303
+ immediateCorrection?: boolean | undefined;
6304
+ } | undefined;
6245
6305
  } | {
6246
6306
  id: string & import("zod").$brand<"UUID">;
6247
6307
  transactionId: string;
@@ -6559,6 +6619,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
6559
6619
  createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
6560
6620
  annotation?: Record<string, import("../commons").FieldUpdateValue> | null | undefined;
6561
6621
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
6622
+ content?: {
6623
+ immediateCorrection?: boolean | undefined;
6624
+ } | undefined;
6562
6625
  } | {
6563
6626
  id: string & import("zod").$brand<"UUID">;
6564
6627
  transactionId: string;
@@ -6919,6 +6982,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
6919
6982
  createdAtLocation?: string | null | undefined;
6920
6983
  annotation?: Record<string, unknown> | null | undefined;
6921
6984
  originalActionId?: string | null | undefined;
6985
+ content?: {
6986
+ immediateCorrection?: boolean | undefined;
6987
+ } | undefined;
6922
6988
  } | {
6923
6989
  id: string;
6924
6990
  transactionId: string;
@@ -67,6 +67,12 @@ export declare function not(condition: AjvJSONSchema): JSONSchema;
67
67
  * @returns {JSONSchema} An schema object that always evaluates to false.
68
68
  */
69
69
  export declare function never(): JSONSchema;
70
+ /**
71
+ * Returns an JSON Schema object, which is treated as always valid.
72
+ *
73
+ * @returns {JSONSchema} An schema object that always evaluates to true.
74
+ */
75
+ export declare function always(): JSONSchema;
70
76
  /**
71
77
  * Generate conditional rules for current date
72
78
  */
@@ -517,6 +517,9 @@ export declare const ActionDocument: z.ZodDiscriminatedUnion<[z.ZodObject<{
517
517
  originalActionId: z.ZodNullable<z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
518
518
  type: z.ZodLiteral<"APPROVE_CORRECTION">;
519
519
  requestId: z.ZodString;
520
+ content: z.ZodOptional<z.ZodObject<{
521
+ immediateCorrection: z.ZodOptional<z.ZodBoolean>;
522
+ }, z.core.$strip>>;
520
523
  }, z.core.$strip>, z.ZodObject<{
521
524
  id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
522
525
  transactionId: z.ZodString;
@@ -955,6 +958,9 @@ export declare const Action: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.Zod
955
958
  originalActionId: z.ZodNullable<z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
956
959
  type: z.ZodLiteral<"APPROVE_CORRECTION">;
957
960
  requestId: z.ZodString;
961
+ content: z.ZodOptional<z.ZodObject<{
962
+ immediateCorrection: z.ZodOptional<z.ZodBoolean>;
963
+ }, z.core.$strip>>;
958
964
  }, z.core.$strip>, z.ZodObject<{
959
965
  id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
960
966
  transactionId: z.ZodString;
@@ -246,6 +246,9 @@ export declare const ApproveCorrectionActionInput: z.ZodObject<{
246
246
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
247
247
  requestId: z.ZodString;
248
248
  type: z.ZodDefault<z.ZodLiteral<"APPROVE_CORRECTION">>;
249
+ content: z.ZodOptional<z.ZodObject<{
250
+ immediateCorrection: z.ZodOptional<z.ZodBoolean>;
251
+ }, z.core.$strip>>;
249
252
  }, z.core.$strip>;
250
253
  export type ApproveCorrectionActionInput = z.infer<typeof ApproveCorrectionActionInput>;
251
254
  export declare const ReadActionInput: z.ZodObject<{
@@ -495,6 +498,9 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
495
498
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
496
499
  requestId: z.ZodString;
497
500
  type: z.ZodDefault<z.ZodLiteral<"APPROVE_CORRECTION">>;
501
+ content: z.ZodOptional<z.ZodObject<{
502
+ immediateCorrection: z.ZodOptional<z.ZodBoolean>;
503
+ }, z.core.$strip>>;
498
504
  }, z.core.$strip>, z.ZodObject<{
499
505
  eventId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
500
506
  transactionId: z.ZodString;
@@ -91,6 +91,63 @@ export declare const FieldConfigSchema: z.ZodObject<{
91
91
  validator: z.ZodAny;
92
92
  message: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
93
93
  }, z.core.$strip>>>;
94
+ allowedLocations: z.ZodOptional<z.ZodObject<{
95
+ $jurisdiction: z.ZodUnion<[z.ZodEnum<{
96
+ administrativeArea: "administrativeArea";
97
+ location: "location";
98
+ all: "all";
99
+ }>, z.ZodObject<{
100
+ $scope: z.ZodEnum<{
101
+ "record.search": "record.search";
102
+ "record.create": "record.create";
103
+ "record.read": "record.read";
104
+ "record.declare": "record.declare";
105
+ "record.notify": "record.notify";
106
+ "record.edit": "record.edit";
107
+ "record.reject": "record.reject";
108
+ "record.archive": "record.archive";
109
+ "record.review-duplicates": "record.review-duplicates";
110
+ "record.register": "record.register";
111
+ "record.print-certified-copies": "record.print-certified-copies";
112
+ "record.request-correction": "record.request-correction";
113
+ "record.correct": "record.correct";
114
+ "record.unassign-others": "record.unassign-others";
115
+ "record.custom-action": "record.custom-action";
116
+ bypassratelimit: "bypassratelimit";
117
+ "record.reindex": "record.reindex";
118
+ "user.data-seeding": "user.data-seeding";
119
+ "integration.create": "integration.create";
120
+ "record.import": "record.import";
121
+ "config.update-all": "config.update-all";
122
+ "attachment.upload": "attachment.upload";
123
+ "profile.electronic-signature": "profile.electronic-signature";
124
+ "user.read-only-my-audit": "user.read-only-my-audit";
125
+ "performance.read": "performance.read";
126
+ "performance.read-dashboards": "performance.read-dashboards";
127
+ "performance.vital-statistics-export": "performance.vital-statistics-export";
128
+ "record.confirm-registration": "record.confirm-registration";
129
+ "record.reject-registration": "record.reject-registration";
130
+ "organisation.read-locations": "organisation.read-locations";
131
+ "user.read": "user.read";
132
+ "user.create": "user.create";
133
+ "user.edit": "user.edit";
134
+ "user.search": "user.search";
135
+ workqueue: "workqueue";
136
+ "dashboard.view": "dashboard.view";
137
+ }>;
138
+ $option: z.ZodEnum<{
139
+ role: "role";
140
+ event: "event";
141
+ placeOfEvent: "placeOfEvent";
142
+ declaredIn: "declaredIn";
143
+ declaredBy: "declaredBy";
144
+ registeredIn: "registeredIn";
145
+ registeredBy: "registeredBy";
146
+ accessLevel: "accessLevel";
147
+ ids: "ids";
148
+ }>;
149
+ }, z.core.$strip>]>;
150
+ }, z.core.$strip>>;
94
151
  fieldId: z.ZodString;
95
152
  fieldType: z.ZodLiteral<"field">;
96
153
  }, z.core.$strip>;
@@ -211,6 +268,63 @@ export declare const EventFieldConfigSchema: z.ZodObject<{
211
268
  validator: z.ZodAny;
212
269
  message: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
213
270
  }, z.core.$strip>>>;
271
+ allowedLocations: z.ZodOptional<z.ZodObject<{
272
+ $jurisdiction: z.ZodUnion<[z.ZodEnum<{
273
+ administrativeArea: "administrativeArea";
274
+ location: "location";
275
+ all: "all";
276
+ }>, z.ZodObject<{
277
+ $scope: z.ZodEnum<{
278
+ "record.search": "record.search";
279
+ "record.create": "record.create";
280
+ "record.read": "record.read";
281
+ "record.declare": "record.declare";
282
+ "record.notify": "record.notify";
283
+ "record.edit": "record.edit";
284
+ "record.reject": "record.reject";
285
+ "record.archive": "record.archive";
286
+ "record.review-duplicates": "record.review-duplicates";
287
+ "record.register": "record.register";
288
+ "record.print-certified-copies": "record.print-certified-copies";
289
+ "record.request-correction": "record.request-correction";
290
+ "record.correct": "record.correct";
291
+ "record.unassign-others": "record.unassign-others";
292
+ "record.custom-action": "record.custom-action";
293
+ bypassratelimit: "bypassratelimit";
294
+ "record.reindex": "record.reindex";
295
+ "user.data-seeding": "user.data-seeding";
296
+ "integration.create": "integration.create";
297
+ "record.import": "record.import";
298
+ "config.update-all": "config.update-all";
299
+ "attachment.upload": "attachment.upload";
300
+ "profile.electronic-signature": "profile.electronic-signature";
301
+ "user.read-only-my-audit": "user.read-only-my-audit";
302
+ "performance.read": "performance.read";
303
+ "performance.read-dashboards": "performance.read-dashboards";
304
+ "performance.vital-statistics-export": "performance.vital-statistics-export";
305
+ "record.confirm-registration": "record.confirm-registration";
306
+ "record.reject-registration": "record.reject-registration";
307
+ "organisation.read-locations": "organisation.read-locations";
308
+ "user.read": "user.read";
309
+ "user.create": "user.create";
310
+ "user.edit": "user.edit";
311
+ "user.search": "user.search";
312
+ workqueue: "workqueue";
313
+ "dashboard.view": "dashboard.view";
314
+ }>;
315
+ $option: z.ZodEnum<{
316
+ role: "role";
317
+ event: "event";
318
+ placeOfEvent: "placeOfEvent";
319
+ declaredIn: "declaredIn";
320
+ declaredBy: "declaredBy";
321
+ registeredIn: "registeredIn";
322
+ registeredBy: "registeredBy";
323
+ accessLevel: "accessLevel";
324
+ ids: "ids";
325
+ }>;
326
+ }, z.core.$strip>]>;
327
+ }, z.core.$strip>>;
214
328
  fieldId: z.ZodEnum<{
215
329
  "event.updatedAt": "event.updatedAt";
216
330
  "event.status": "event.status";
@@ -307,6 +421,63 @@ export declare const AdvancedSearchField: z.ZodDiscriminatedUnion<[z.ZodObject<{
307
421
  validator: z.ZodAny;
308
422
  message: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
309
423
  }, z.core.$strip>>>;
424
+ allowedLocations: z.ZodOptional<z.ZodObject<{
425
+ $jurisdiction: z.ZodUnion<[z.ZodEnum<{
426
+ administrativeArea: "administrativeArea";
427
+ location: "location";
428
+ all: "all";
429
+ }>, z.ZodObject<{
430
+ $scope: z.ZodEnum<{
431
+ "record.search": "record.search";
432
+ "record.create": "record.create";
433
+ "record.read": "record.read";
434
+ "record.declare": "record.declare";
435
+ "record.notify": "record.notify";
436
+ "record.edit": "record.edit";
437
+ "record.reject": "record.reject";
438
+ "record.archive": "record.archive";
439
+ "record.review-duplicates": "record.review-duplicates";
440
+ "record.register": "record.register";
441
+ "record.print-certified-copies": "record.print-certified-copies";
442
+ "record.request-correction": "record.request-correction";
443
+ "record.correct": "record.correct";
444
+ "record.unassign-others": "record.unassign-others";
445
+ "record.custom-action": "record.custom-action";
446
+ bypassratelimit: "bypassratelimit";
447
+ "record.reindex": "record.reindex";
448
+ "user.data-seeding": "user.data-seeding";
449
+ "integration.create": "integration.create";
450
+ "record.import": "record.import";
451
+ "config.update-all": "config.update-all";
452
+ "attachment.upload": "attachment.upload";
453
+ "profile.electronic-signature": "profile.electronic-signature";
454
+ "user.read-only-my-audit": "user.read-only-my-audit";
455
+ "performance.read": "performance.read";
456
+ "performance.read-dashboards": "performance.read-dashboards";
457
+ "performance.vital-statistics-export": "performance.vital-statistics-export";
458
+ "record.confirm-registration": "record.confirm-registration";
459
+ "record.reject-registration": "record.reject-registration";
460
+ "organisation.read-locations": "organisation.read-locations";
461
+ "user.read": "user.read";
462
+ "user.create": "user.create";
463
+ "user.edit": "user.edit";
464
+ "user.search": "user.search";
465
+ workqueue: "workqueue";
466
+ "dashboard.view": "dashboard.view";
467
+ }>;
468
+ $option: z.ZodEnum<{
469
+ role: "role";
470
+ event: "event";
471
+ placeOfEvent: "placeOfEvent";
472
+ declaredIn: "declaredIn";
473
+ declaredBy: "declaredBy";
474
+ registeredIn: "registeredIn";
475
+ registeredBy: "registeredBy";
476
+ accessLevel: "accessLevel";
477
+ ids: "ids";
478
+ }>;
479
+ }, z.core.$strip>]>;
480
+ }, z.core.$strip>>;
310
481
  fieldId: z.ZodString;
311
482
  fieldType: z.ZodLiteral<"field">;
312
483
  }, z.core.$strip>, z.ZodObject<{
@@ -395,6 +566,63 @@ export declare const AdvancedSearchField: z.ZodDiscriminatedUnion<[z.ZodObject<{
395
566
  validator: z.ZodAny;
396
567
  message: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
397
568
  }, z.core.$strip>>>;
569
+ allowedLocations: z.ZodOptional<z.ZodObject<{
570
+ $jurisdiction: z.ZodUnion<[z.ZodEnum<{
571
+ administrativeArea: "administrativeArea";
572
+ location: "location";
573
+ all: "all";
574
+ }>, z.ZodObject<{
575
+ $scope: z.ZodEnum<{
576
+ "record.search": "record.search";
577
+ "record.create": "record.create";
578
+ "record.read": "record.read";
579
+ "record.declare": "record.declare";
580
+ "record.notify": "record.notify";
581
+ "record.edit": "record.edit";
582
+ "record.reject": "record.reject";
583
+ "record.archive": "record.archive";
584
+ "record.review-duplicates": "record.review-duplicates";
585
+ "record.register": "record.register";
586
+ "record.print-certified-copies": "record.print-certified-copies";
587
+ "record.request-correction": "record.request-correction";
588
+ "record.correct": "record.correct";
589
+ "record.unassign-others": "record.unassign-others";
590
+ "record.custom-action": "record.custom-action";
591
+ bypassratelimit: "bypassratelimit";
592
+ "record.reindex": "record.reindex";
593
+ "user.data-seeding": "user.data-seeding";
594
+ "integration.create": "integration.create";
595
+ "record.import": "record.import";
596
+ "config.update-all": "config.update-all";
597
+ "attachment.upload": "attachment.upload";
598
+ "profile.electronic-signature": "profile.electronic-signature";
599
+ "user.read-only-my-audit": "user.read-only-my-audit";
600
+ "performance.read": "performance.read";
601
+ "performance.read-dashboards": "performance.read-dashboards";
602
+ "performance.vital-statistics-export": "performance.vital-statistics-export";
603
+ "record.confirm-registration": "record.confirm-registration";
604
+ "record.reject-registration": "record.reject-registration";
605
+ "organisation.read-locations": "organisation.read-locations";
606
+ "user.read": "user.read";
607
+ "user.create": "user.create";
608
+ "user.edit": "user.edit";
609
+ "user.search": "user.search";
610
+ workqueue: "workqueue";
611
+ "dashboard.view": "dashboard.view";
612
+ }>;
613
+ $option: z.ZodEnum<{
614
+ role: "role";
615
+ event: "event";
616
+ placeOfEvent: "placeOfEvent";
617
+ declaredIn: "declaredIn";
618
+ declaredBy: "declaredBy";
619
+ registeredIn: "registeredIn";
620
+ registeredBy: "registeredBy";
621
+ accessLevel: "accessLevel";
622
+ ids: "ids";
623
+ }>;
624
+ }, z.core.$strip>]>;
625
+ }, z.core.$strip>>;
398
626
  fieldId: z.ZodEnum<{
399
627
  "event.updatedAt": "event.updatedAt";
400
628
  "event.status": "event.status";
@@ -494,6 +722,63 @@ export declare const AdvancedSearchConfig: z.ZodObject<{
494
722
  validator: z.ZodAny;
495
723
  message: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
496
724
  }, z.core.$strip>>>;
725
+ allowedLocations: z.ZodOptional<z.ZodObject<{
726
+ $jurisdiction: z.ZodUnion<[z.ZodEnum<{
727
+ administrativeArea: "administrativeArea";
728
+ location: "location";
729
+ all: "all";
730
+ }>, z.ZodObject<{
731
+ $scope: z.ZodEnum<{
732
+ "record.search": "record.search";
733
+ "record.create": "record.create";
734
+ "record.read": "record.read";
735
+ "record.declare": "record.declare";
736
+ "record.notify": "record.notify";
737
+ "record.edit": "record.edit";
738
+ "record.reject": "record.reject";
739
+ "record.archive": "record.archive";
740
+ "record.review-duplicates": "record.review-duplicates";
741
+ "record.register": "record.register";
742
+ "record.print-certified-copies": "record.print-certified-copies";
743
+ "record.request-correction": "record.request-correction";
744
+ "record.correct": "record.correct";
745
+ "record.unassign-others": "record.unassign-others";
746
+ "record.custom-action": "record.custom-action";
747
+ bypassratelimit: "bypassratelimit";
748
+ "record.reindex": "record.reindex";
749
+ "user.data-seeding": "user.data-seeding";
750
+ "integration.create": "integration.create";
751
+ "record.import": "record.import";
752
+ "config.update-all": "config.update-all";
753
+ "attachment.upload": "attachment.upload";
754
+ "profile.electronic-signature": "profile.electronic-signature";
755
+ "user.read-only-my-audit": "user.read-only-my-audit";
756
+ "performance.read": "performance.read";
757
+ "performance.read-dashboards": "performance.read-dashboards";
758
+ "performance.vital-statistics-export": "performance.vital-statistics-export";
759
+ "record.confirm-registration": "record.confirm-registration";
760
+ "record.reject-registration": "record.reject-registration";
761
+ "organisation.read-locations": "organisation.read-locations";
762
+ "user.read": "user.read";
763
+ "user.create": "user.create";
764
+ "user.edit": "user.edit";
765
+ "user.search": "user.search";
766
+ workqueue: "workqueue";
767
+ "dashboard.view": "dashboard.view";
768
+ }>;
769
+ $option: z.ZodEnum<{
770
+ role: "role";
771
+ event: "event";
772
+ placeOfEvent: "placeOfEvent";
773
+ declaredIn: "declaredIn";
774
+ declaredBy: "declaredBy";
775
+ registeredIn: "registeredIn";
776
+ registeredBy: "registeredBy";
777
+ accessLevel: "accessLevel";
778
+ ids: "ids";
779
+ }>;
780
+ }, z.core.$strip>]>;
781
+ }, z.core.$strip>>;
497
782
  fieldId: z.ZodString;
498
783
  fieldType: z.ZodLiteral<"field">;
499
784
  }, z.core.$strip>, z.ZodObject<{
@@ -582,6 +867,63 @@ export declare const AdvancedSearchConfig: z.ZodObject<{
582
867
  validator: z.ZodAny;
583
868
  message: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
584
869
  }, z.core.$strip>>>;
870
+ allowedLocations: z.ZodOptional<z.ZodObject<{
871
+ $jurisdiction: z.ZodUnion<[z.ZodEnum<{
872
+ administrativeArea: "administrativeArea";
873
+ location: "location";
874
+ all: "all";
875
+ }>, z.ZodObject<{
876
+ $scope: z.ZodEnum<{
877
+ "record.search": "record.search";
878
+ "record.create": "record.create";
879
+ "record.read": "record.read";
880
+ "record.declare": "record.declare";
881
+ "record.notify": "record.notify";
882
+ "record.edit": "record.edit";
883
+ "record.reject": "record.reject";
884
+ "record.archive": "record.archive";
885
+ "record.review-duplicates": "record.review-duplicates";
886
+ "record.register": "record.register";
887
+ "record.print-certified-copies": "record.print-certified-copies";
888
+ "record.request-correction": "record.request-correction";
889
+ "record.correct": "record.correct";
890
+ "record.unassign-others": "record.unassign-others";
891
+ "record.custom-action": "record.custom-action";
892
+ bypassratelimit: "bypassratelimit";
893
+ "record.reindex": "record.reindex";
894
+ "user.data-seeding": "user.data-seeding";
895
+ "integration.create": "integration.create";
896
+ "record.import": "record.import";
897
+ "config.update-all": "config.update-all";
898
+ "attachment.upload": "attachment.upload";
899
+ "profile.electronic-signature": "profile.electronic-signature";
900
+ "user.read-only-my-audit": "user.read-only-my-audit";
901
+ "performance.read": "performance.read";
902
+ "performance.read-dashboards": "performance.read-dashboards";
903
+ "performance.vital-statistics-export": "performance.vital-statistics-export";
904
+ "record.confirm-registration": "record.confirm-registration";
905
+ "record.reject-registration": "record.reject-registration";
906
+ "organisation.read-locations": "organisation.read-locations";
907
+ "user.read": "user.read";
908
+ "user.create": "user.create";
909
+ "user.edit": "user.edit";
910
+ "user.search": "user.search";
911
+ workqueue: "workqueue";
912
+ "dashboard.view": "dashboard.view";
913
+ }>;
914
+ $option: z.ZodEnum<{
915
+ role: "role";
916
+ event: "event";
917
+ placeOfEvent: "placeOfEvent";
918
+ declaredIn: "declaredIn";
919
+ declaredBy: "declaredBy";
920
+ registeredIn: "registeredIn";
921
+ registeredBy: "registeredBy";
922
+ accessLevel: "accessLevel";
923
+ ids: "ids";
924
+ }>;
925
+ }, z.core.$strip>]>;
926
+ }, z.core.$strip>>;
585
927
  fieldId: z.ZodEnum<{
586
928
  "event.updatedAt": "event.updatedAt";
587
929
  "event.status": "event.status";
@@ -274,6 +274,9 @@ export declare const EventDocument: z.ZodObject<{
274
274
  originalActionId: z.ZodNullable<z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
275
275
  type: z.ZodLiteral<"APPROVE_CORRECTION">;
276
276
  requestId: z.ZodString;
277
+ content: z.ZodOptional<z.ZodObject<{
278
+ immediateCorrection: z.ZodOptional<z.ZodBoolean>;
279
+ }, z.core.$strip>>;
277
280
  }, z.core.$strip>, z.ZodObject<{
278
281
  id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
279
282
  transactionId: z.ZodString;
@@ -1,6 +1,7 @@
1
1
  import { FieldConditional } from './Conditional';
2
2
  import { TranslationConfig } from './TranslationConfig';
3
3
  import { SelectOption, ValidationConfig } from './FieldConfig';
4
+ import { JurisdictionReference } from '../users/userReferences';
4
5
  /**
5
6
  * Entry point for defining conditional logic or configuration for a form field.
6
7
  * @param fieldId - The ID of the field to define rules or config for.
@@ -11,12 +12,14 @@ export declare function field(fieldId: string, options?: {
11
12
  conditionals?: FieldConditional[];
12
13
  validations?: ValidationConfig[];
13
14
  searchCriteriaLabelPrefix?: TranslationConfig;
15
+ allowedLocations?: JurisdictionReference;
14
16
  }): {
15
17
  range: () => {
16
18
  options?: SelectOption[];
17
19
  conditionals?: FieldConditional[];
18
20
  validations?: ValidationConfig[];
19
21
  searchCriteriaLabelPrefix?: TranslationConfig;
22
+ allowedLocations?: JurisdictionReference;
20
23
  fieldId: string;
21
24
  fieldType: "field";
22
25
  } & {
@@ -29,6 +32,7 @@ export declare function field(fieldId: string, options?: {
29
32
  conditionals?: FieldConditional[];
30
33
  validations?: ValidationConfig[];
31
34
  searchCriteriaLabelPrefix?: TranslationConfig;
35
+ allowedLocations?: JurisdictionReference;
32
36
  fieldId: string;
33
37
  fieldType: "field";
34
38
  } & {
@@ -41,6 +45,7 @@ export declare function field(fieldId: string, options?: {
41
45
  conditionals?: FieldConditional[];
42
46
  validations?: ValidationConfig[];
43
47
  searchCriteriaLabelPrefix?: TranslationConfig;
48
+ allowedLocations?: JurisdictionReference;
44
49
  fieldId: string;
45
50
  fieldType: "field";
46
51
  } & {
@@ -53,6 +58,7 @@ export declare function field(fieldId: string, options?: {
53
58
  conditionals?: FieldConditional[];
54
59
  validations?: ValidationConfig[];
55
60
  searchCriteriaLabelPrefix?: TranslationConfig;
61
+ allowedLocations?: JurisdictionReference;
56
62
  fieldId: string;
57
63
  fieldType: "field";
58
64
  } & {
@@ -22,6 +22,7 @@ export * from './FieldValue';
22
22
  export * from './FormConfig';
23
23
  export * from './CompositeFieldValue';
24
24
  export * from './state';
25
+ export * from './state/flags';
25
26
  export * from './utils';
26
27
  export * from './defineConfig';
27
28
  export * from './DeduplicationConfig';
@@ -1,6 +1,9 @@
1
+ import { Action, RequestedCorrectionAction } from '../ActionDocument';
1
2
  import { Flag, CustomFlag } from '../Flag';
2
3
  import { EventConfig } from '../EventConfig';
3
4
  import { EventDocument } from '../EventDocument';
5
+ export declare function findPendingCorrectionAction(writeActions: Action[]): RequestedCorrectionAction | undefined;
6
+ export declare function isPotentialDuplicate(actions: Action[]): boolean;
4
7
  /**
5
8
  * This function resolves custom flags for an event based on its actions.
6
9
  * Flags are not stored to the event state or any database directly, instead they are always computed/evaluated from the event actions.
@@ -18,5 +21,18 @@ import { EventDocument } from '../EventDocument';
18
21
  * // Returns: ['flag-1', 'flag-3']
19
22
  */
20
23
  export declare function resolveEventCustomFlags(event: EventDocument, eventConfiguration: EventConfig): CustomFlag[];
24
+ /**
25
+ * Computes all flags (inherent, action status, and custom) that should be attached to the given event,
26
+ * based on its actions and event-specific configuration.
27
+ *
28
+ * Flags are determined by combining:
29
+ * - Action status flags (format 'ActionType:ActionStatus')
30
+ * - Inherent flags (e.g. incomplete, rejected, correction requested, potential duplicate, edit in progress)
31
+ * - Event type-specific custom flags defined in the event configuration
32
+ *
33
+ * @param event - The EventDocument containing the action history and payload
34
+ * @param config - The EventConfig providing rules for custom flag evaluation
35
+ * @returns An array of flags currently relevant/applicable to the event
36
+ */
21
37
  export declare function getEventFlags(event: EventDocument, config: EventConfig): Flag[];
22
38
  //# sourceMappingURL=flags.d.ts.map
@@ -241,6 +241,9 @@ export declare function getActionUpdateMetadata(actions: Action[]): Partial<{
241
241
  createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
242
242
  annotation?: Record<string, import("..").FieldUpdateValue> | null | undefined;
243
243
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
244
+ content?: {
245
+ immediateCorrection?: boolean | undefined;
246
+ } | undefined;
244
247
  } | {
245
248
  id: string & import("zod").$brand<"UUID">;
246
249
  transactionId: string;
@@ -386,6 +386,9 @@ export declare function findLastAssignmentAction(actions: Action[]): {
386
386
  createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
387
387
  annotation?: Record<string, import("./FieldValue").FieldUpdateValue> | null | undefined;
388
388
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
389
+ content?: {
390
+ immediateCorrection?: boolean | undefined;
391
+ } | undefined;
389
392
  } | {
390
393
  id: string & import("zod").$brand<"UUID">;
391
394
  transactionId: string;
@@ -560,6 +563,14 @@ export declare function timePeriodToDateRange(value: SelectDateRangeValue): {
560
563
  export declare function mergeDrafts(currentDraft: Draft, incomingDraft: Draft): Draft;
561
564
  export declare function getPendingAction(actions: Action[]): ActionDocument;
562
565
  export declare function getCompleteActionAnnotation(annotation: ActionUpdate, event: EventDocument, action: ActionDocument): ActionUpdate;
566
+ /**
567
+ * Resolves the complete content for an action, inheriting from its original
568
+ * Requested action when the Accepted action carries no content of its own.
569
+ *
570
+ * Mirrors the same "originalActionId → merge from Requested" pattern used by
571
+ * getCompleteActionAnnotation and getCompleteActionDeclaration.
572
+ */
573
+ export declare function getCompleteActionContent(event: EventDocument, action: ActionDocument): Record<string, unknown> | null | undefined;
563
574
  export declare function getCompleteActionDeclaration<T extends EventState | ActionUpdate>(declaration: T, event: EventDocument, action: ActionDocument): T;
564
575
  export declare function getAcceptedActions(event: EventDocument): ActionDocument[];
565
576
  export declare function aggregateActionDeclarations(event: EventDocument): EventState;
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/conditionals/index.ts
31
31
  var conditionals_exports = {};
32
32
  __export(conditionals_exports, {
33
+ always: () => always,
33
34
  alwaysTrue: () => alwaysTrue,
34
35
  and: () => and,
35
36
  createFieldConditionals: () => createFieldConditionals,
@@ -454,6 +455,9 @@ function not(condition) {
454
455
  function never() {
455
456
  return not(alwaysTrue());
456
457
  }
458
+ function always() {
459
+ return defineConditional(alwaysTrue());
460
+ }
457
461
  function jsonFieldPath(field) {
458
462
  return [field.$$field, ...field.$$subfield].join("/");
459
463
  }
@@ -238,6 +238,7 @@ __export(events_exports, {
238
238
  ageToDate: () => ageToDate,
239
239
  aggregateActionAnnotations: () => aggregateActionAnnotations,
240
240
  aggregateActionDeclarations: () => aggregateActionDeclarations,
241
+ always: () => always,
241
242
  alwaysTrue: () => alwaysTrue,
242
243
  and: () => and,
243
244
  annotationActions: () => annotationActions,
@@ -281,6 +282,7 @@ __export(events_exports, {
281
282
  findActiveDraftForEvent: () => findActiveDraftForEvent,
282
283
  findAllFields: () => findAllFields,
283
284
  findLastAssignmentAction: () => findLastAssignmentAction,
285
+ findPendingCorrectionAction: () => findPendingCorrectionAction,
284
286
  findRecordActionPages: () => findRecordActionPages,
285
287
  flag: () => flag,
286
288
  flattenFieldReference: () => flattenFieldReference,
@@ -314,6 +316,7 @@ __export(events_exports, {
314
316
  getAvailableActionsForEvent: () => getAvailableActionsForEvent,
315
317
  getAvailableRolesForUserUpdatePayload: () => getAvailableRolesForUserUpdatePayload,
316
318
  getCompleteActionAnnotation: () => getCompleteActionAnnotation,
319
+ getCompleteActionContent: () => getCompleteActionContent,
317
320
  getCompleteActionDeclaration: () => getCompleteActionDeclaration,
318
321
  getCurrentEventState: () => getCurrentEventState,
319
322
  getCustomActionFields: () => getCustomActionFields,
@@ -322,6 +325,7 @@ __export(events_exports, {
322
325
  getDeclarationFields: () => getDeclarationFields,
323
326
  getDeclarationPages: () => getDeclarationPages,
324
327
  getEventConfigById: () => getEventConfigById,
328
+ getEventFlags: () => getEventFlags,
325
329
  getFilePathsFromEvent: () => getFilePathsFromEvent,
326
330
  getLocationHierarchy: () => getLocationHierarchy,
327
331
  getMixedPath: () => getMixedPath,
@@ -384,6 +388,7 @@ __export(events_exports, {
384
388
  isPageVisible: () => isPageVisible,
385
389
  isParagraphFieldType: () => isParagraphFieldType,
386
390
  isPhoneFieldType: () => isPhoneFieldType,
391
+ isPotentialDuplicate: () => isPotentialDuplicate,
387
392
  isPrintButtonFieldType: () => isPrintButtonFieldType,
388
393
  isQrReaderFieldType: () => isQrReaderFieldType,
389
394
  isQueryParamReaderFieldType: () => isQueryParamReaderFieldType,
@@ -417,6 +422,7 @@ __export(events_exports, {
417
422
  plainDateToLocalDate: () => plainDateToLocalDate,
418
423
  precompileActionSchemas: () => precompileActionSchemas,
419
424
  resolveDateOfEvent: () => resolveDateOfEvent,
425
+ resolveEventCustomFlags: () => resolveEventCustomFlags,
420
426
  resolvePlaceOfEvent: () => resolvePlaceOfEvent,
421
427
  runFieldValidations: () => runFieldValidations,
422
428
  runStructuralValidations: () => runStructuralValidations,
@@ -1652,8 +1658,9 @@ var RequestedCorrectionAction = ActionBase.extend(
1652
1658
  var ApprovedCorrectionAction = ActionBase.extend(
1653
1659
  z14.object({
1654
1660
  type: z14.literal(ActionType.APPROVE_CORRECTION),
1655
- requestId: z14.string()
1661
+ requestId: z14.string(),
1656
1662
  // TODO move into 'content' property
1663
+ content: z14.object({ immediateCorrection: z14.boolean().optional() }).optional()
1657
1664
  }).shape
1658
1665
  );
1659
1666
  var RejectedCorrectionAction = ActionBase.extend(
@@ -3445,6 +3452,9 @@ var BaseField3 = z28.object({
3445
3452
  ),
3446
3453
  validations: z28.array(ValidationConfig).optional().describe(
3447
3454
  `Option for overriding the field validations specifically for advanced search form.`
3455
+ ),
3456
+ allowedLocations: JurisdictionReference.optional().describe(
3457
+ `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
3458
  )
3449
3459
  });
3450
3460
  var SearchQueryParams = z28.object({
@@ -4748,6 +4758,22 @@ function getCompleteActionAnnotation(annotation, event2, action) {
4748
4758
  }
4749
4759
  return deepMerge(annotation, action.annotation ?? {});
4750
4760
  }
4761
+ function getCompleteActionContent(event2, action) {
4762
+ const currentContent = "content" in action ? action.content : void 0;
4763
+ if (!action.originalActionId) {
4764
+ return currentContent;
4765
+ }
4766
+ const originalAction = event2.actions.find(
4767
+ ({ id }) => id === action.originalActionId
4768
+ );
4769
+ if (originalAction && "content" in originalAction && originalAction.content) {
4770
+ return {
4771
+ ...originalAction.content,
4772
+ ...currentContent ?? {}
4773
+ };
4774
+ }
4775
+ return currentContent;
4776
+ }
4751
4777
  function getCompleteActionDeclaration(declaration, event2, action) {
4752
4778
  if (action.originalActionId) {
4753
4779
  const originalAction = event2.actions.find(
@@ -4854,6 +4880,9 @@ function not(condition) {
4854
4880
  function never2() {
4855
4881
  return not(alwaysTrue());
4856
4882
  }
4883
+ function always() {
4884
+ return defineConditional(alwaysTrue());
4885
+ }
4857
4886
  function jsonFieldPath(field3) {
4858
4887
  return [field3.$$field, ...field3.$$subfield].join("/");
4859
4888
  }
@@ -6191,7 +6220,8 @@ var RejectCorrectionActionInput = BaseActionInput.extend(
6191
6220
  var ApproveCorrectionActionInput = BaseActionInput.extend(
6192
6221
  z38.object({
6193
6222
  requestId: z38.string(),
6194
- type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
6223
+ type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION),
6224
+ content: z38.object({ immediateCorrection: z38.boolean().optional() }).optional()
6195
6225
  }).shape
6196
6226
  );
6197
6227
  var ReadActionInput = BaseActionInput.extend(
@@ -6384,26 +6414,43 @@ var import_date_fns3 = require("date-fns");
6384
6414
  function isEditInProgress(actions) {
6385
6415
  return actions.at(-1)?.type === ActionType.EDIT;
6386
6416
  }
6417
+ function findPendingCorrectionAction(writeActions2) {
6418
+ let correctionRequestAction;
6419
+ for (let i = writeActions2.length - 1; i >= 0; i--) {
6420
+ const action = writeActions2[i];
6421
+ if (action.type === ActionType.APPROVE_CORRECTION || action.type === ActionType.REJECT_CORRECTION) {
6422
+ break;
6423
+ }
6424
+ if (action.type === ActionType.REQUEST_CORRECTION) {
6425
+ correctionRequestAction = action;
6426
+ break;
6427
+ }
6428
+ }
6429
+ return correctionRequestAction;
6430
+ }
6387
6431
  function isCorrectionRequested(actions) {
6432
+ return findPendingCorrectionAction(actions) !== void 0;
6433
+ }
6434
+ function isDeclarationIncomplete(actions) {
6435
+ return getStatusFromActions(actions) === EventStatus.enum.NOTIFIED;
6436
+ }
6437
+ function isRejected(actions) {
6438
+ const resettingActionTypes = [
6439
+ ActionType.NOTIFY,
6440
+ ActionType.DECLARE,
6441
+ ActionType.EDIT,
6442
+ ActionType.REGISTER
6443
+ ];
6388
6444
  return actions.reduce((prev, { type }) => {
6389
- if (type === ActionType.REQUEST_CORRECTION) {
6445
+ if (type === ActionType.REJECT) {
6390
6446
  return true;
6391
6447
  }
6392
- if (type === ActionType.APPROVE_CORRECTION) {
6393
- return false;
6394
- }
6395
- if (type === ActionType.REJECT_CORRECTION) {
6448
+ if (resettingActionTypes.includes(type)) {
6396
6449
  return false;
6397
6450
  }
6398
6451
  return prev;
6399
6452
  }, false);
6400
6453
  }
6401
- function isDeclarationIncomplete(actions) {
6402
- return getStatusFromActions(actions) === EventStatus.enum.NOTIFIED;
6403
- }
6404
- function isRejected(actions) {
6405
- return actions.at(-1)?.type === ActionType.REJECT;
6406
- }
6407
6454
  function isPotentialDuplicate(actions) {
6408
6455
  return actions.reduce((prev, { type }) => {
6409
6456
  if (type === ActionType.DUPLICATE_DETECTED) {
@@ -6466,8 +6513,7 @@ function resolveEventCustomFlags(event2, eventConfiguration) {
6466
6513
  return (0, import_lodash3.uniq)(flags);
6467
6514
  }, []);
6468
6515
  }
6469
- function getEventFlags(event2, config) {
6470
- const sortedActions = event2.actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
6516
+ function getActionStatusFlags(sortedActions) {
6471
6517
  const actionStatus = sortedActions.reduce(
6472
6518
  (actionStatuses, { type, status: status2 }) => ({
6473
6519
  ...actionStatuses,
@@ -6475,26 +6521,40 @@ function getEventFlags(event2, config) {
6475
6521
  }),
6476
6522
  {}
6477
6523
  );
6478
- const flags = Object.entries(actionStatus).filter(([, status2]) => status2 !== ActionStatus.Accepted).map(([type, status2]) => {
6524
+ return Object.entries(actionStatus).filter(([, status2]) => status2 !== ActionStatus.Accepted).map(([type, status2]) => {
6479
6525
  const flag2 = joinValues([type, status2], ":").toLowerCase();
6480
6526
  return flag2;
6481
6527
  });
6482
- if (isCorrectionRequested(sortedActions)) {
6483
- flags.push(InherentFlags.CORRECTION_REQUESTED);
6528
+ }
6529
+ function getInherentFlags(sortedActions) {
6530
+ const acceptedActions = sortedActions.filter(
6531
+ ({ status: status2 }) => status2 === ActionStatus.Accepted
6532
+ );
6533
+ const inherentFlags = [];
6534
+ if (isCorrectionRequested(acceptedActions)) {
6535
+ inherentFlags.push(InherentFlags.CORRECTION_REQUESTED);
6484
6536
  }
6485
- if (isDeclarationIncomplete(sortedActions)) {
6486
- flags.push(InherentFlags.INCOMPLETE);
6537
+ if (isDeclarationIncomplete(acceptedActions)) {
6538
+ inherentFlags.push(InherentFlags.INCOMPLETE);
6487
6539
  }
6488
- if (isRejected(sortedActions)) {
6489
- flags.push(InherentFlags.REJECTED);
6540
+ if (isRejected(acceptedActions)) {
6541
+ inherentFlags.push(InherentFlags.REJECTED);
6490
6542
  }
6491
- if (isPotentialDuplicate(sortedActions)) {
6492
- flags.push(InherentFlags.POTENTIAL_DUPLICATE);
6543
+ if (isPotentialDuplicate(acceptedActions)) {
6544
+ inherentFlags.push(InherentFlags.POTENTIAL_DUPLICATE);
6493
6545
  }
6494
- if (isEditInProgress(sortedActions)) {
6495
- flags.push(InherentFlags.EDIT_IN_PROGRESS);
6546
+ if (isEditInProgress(acceptedActions)) {
6547
+ inherentFlags.push(InherentFlags.EDIT_IN_PROGRESS);
6496
6548
  }
6497
- return [...flags, ...resolveEventCustomFlags(event2, config)];
6549
+ return inherentFlags;
6550
+ }
6551
+ function getEventFlags(event2, config) {
6552
+ const sortedActions = event2.actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
6553
+ return [
6554
+ ...getActionStatusFlags(sortedActions),
6555
+ ...getInherentFlags(sortedActions),
6556
+ ...resolveEventCustomFlags(event2, config)
6557
+ ];
6498
6558
  }
6499
6559
 
6500
6560
  // ../commons/src/events/state/index.ts
@@ -1215,8 +1215,9 @@ var RequestedCorrectionAction = ActionBase.extend(
1215
1215
  var ApprovedCorrectionAction = ActionBase.extend(
1216
1216
  z14.object({
1217
1217
  type: z14.literal(ActionType.APPROVE_CORRECTION),
1218
- requestId: z14.string()
1218
+ requestId: z14.string(),
1219
1219
  // TODO move into 'content' property
1220
+ content: z14.object({ immediateCorrection: z14.boolean().optional() }).optional()
1220
1221
  }).shape
1221
1222
  );
1222
1223
  var RejectedCorrectionAction = ActionBase.extend(
@@ -2926,6 +2927,9 @@ var BaseField3 = z28.object({
2926
2927
  ),
2927
2928
  validations: z28.array(ValidationConfig).optional().describe(
2928
2929
  `Option for overriding the field validations specifically for advanced search form.`
2930
+ ),
2931
+ allowedLocations: JurisdictionReference.optional().describe(
2932
+ `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.`
2929
2933
  )
2930
2934
  });
2931
2935
  var SearchQueryParams = z28.object({
@@ -4469,7 +4473,8 @@ var RejectCorrectionActionInput = BaseActionInput.extend(
4469
4473
  var ApproveCorrectionActionInput = BaseActionInput.extend(
4470
4474
  z38.object({
4471
4475
  requestId: z38.string(),
4472
- type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
4476
+ type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION),
4477
+ content: z38.object({ immediateCorrection: z38.boolean().optional() }).optional()
4473
4478
  }).shape
4474
4479
  );
4475
4480
  var ReadActionInput = BaseActionInput.extend(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "2.0.0-rc.92bed7b",
3
+ "version": "2.0.0-rc.941dbd9",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "bin": {