@opencrvs/toolkit 1.8.0-rc.ff62f9e → 1.8.0-rc.ffb4f66

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.
@@ -1,30 +1,39 @@
1
+ import { z } from 'zod';
1
2
  /**
2
3
  * Actions recognized by the system
3
4
  */
4
5
  export declare const ActionType: {
6
+ readonly DELETE: "DELETE";
5
7
  readonly CREATE: "CREATE";
6
- readonly ASSIGN: "ASSIGN";
7
- readonly UNASSIGN: "UNASSIGN";
8
- readonly REGISTER: "REGISTER";
9
- readonly VALIDATE: "VALIDATE";
10
- readonly REQUEST_CORRECTION: "REQUEST_CORRECTION";
11
- readonly REJECT_CORRECTION: "REJECT_CORRECTION";
12
- readonly APPROVE_CORRECTION: "APPROVE_CORRECTION";
13
- readonly DETECT_DUPLICATE: "DETECT_DUPLICATE";
14
8
  readonly NOTIFY: "NOTIFY";
15
9
  readonly DECLARE: "DECLARE";
16
- readonly DELETE: "DELETE";
17
- readonly PRINT_CERTIFICATE: "PRINT_CERTIFICATE";
18
- readonly CUSTOM: "CUSTOM";
10
+ readonly VALIDATE: "VALIDATE";
11
+ readonly REGISTER: "REGISTER";
12
+ readonly DETECT_DUPLICATE: "DETECT_DUPLICATE";
19
13
  readonly REJECT: "REJECT";
20
14
  readonly MARKED_AS_DUPLICATE: "MARKED_AS_DUPLICATE";
21
15
  readonly ARCHIVE: "ARCHIVE";
16
+ readonly PRINT_CERTIFICATE: "PRINT_CERTIFICATE";
17
+ readonly REQUEST_CORRECTION: "REQUEST_CORRECTION";
18
+ readonly REJECT_CORRECTION: "REJECT_CORRECTION";
19
+ readonly APPROVE_CORRECTION: "APPROVE_CORRECTION";
22
20
  readonly READ: "READ";
21
+ readonly ASSIGN: "ASSIGN";
22
+ readonly UNASSIGN: "UNASSIGN";
23
23
  };
24
- /**
25
- * Actions that can be attached to an event document
26
- * even if they are not in event configuration
27
- */
28
- export declare const LatentActions: ("REJECT" | "ARCHIVE")[];
29
24
  export type ActionType = (typeof ActionType)[keyof typeof ActionType];
25
+ export declare const ConfirmableActions: readonly ["NOTIFY", "DECLARE", "VALIDATE", "REGISTER", "REJECT", "ARCHIVE", "PRINT_CERTIFICATE"];
26
+ /** Testing building types from enums as an alternative */
27
+ export declare const ActionTypes: z.ZodEnum<["DELETE", "CREATE", "NOTIFY", "DECLARE", "VALIDATE", "REGISTER", "DETECT_DUPLICATE", "REJECT", "MARKED_AS_DUPLICATE", "ARCHIVE", "PRINT_CERTIFICATE", "REQUEST_CORRECTION", "REJECT_CORRECTION", "APPROVE_CORRECTION", "READ", "ASSIGN", "UNASSIGN"]>;
28
+ /** Actions which change event data (declaration) before registration / during declaration. */
29
+ export declare const DeclarationActions: z.ZodEnum<["DECLARE", "VALIDATE", "REGISTER"]>;
30
+ export type DeclarationActionType = z.infer<typeof DeclarationActions>;
31
+ /** Actions that can modify declaration data. Request can be corrected after declaring it. */
32
+ export declare const DeclarationUpdateActions: z.ZodEnum<["DECLARE", "VALIDATE", "REGISTER", "REQUEST_CORRECTION"]>;
33
+ export type DeclarationUpdateActionType = z.infer<typeof DeclarationUpdateActions>;
34
+ /** Actions which update annotation or status of an event. */
35
+ export declare const annotationActions: z.ZodEnum<["DELETE", "CREATE", "NOTIFY", "DETECT_DUPLICATE", "REJECT", "MARKED_AS_DUPLICATE", "ARCHIVE", "PRINT_CERTIFICATE", "REQUEST_CORRECTION", "REJECT_CORRECTION", "APPROVE_CORRECTION", "READ", "ASSIGN", "UNASSIGN"]>;
36
+ export type AnnotationActionType = z.infer<typeof annotationActions>;
37
+ /** Actions which requires the user to be assigned */
38
+ export declare const writeActions: z.ZodEnum<["DELETE", "NOTIFY", "DECLARE", "VALIDATE", "REGISTER", "DETECT_DUPLICATE", "REJECT", "MARKED_AS_DUPLICATE", "ARCHIVE", "PRINT_CERTIFICATE", "REQUEST_CORRECTION", "REJECT_CORRECTION", "APPROVE_CORRECTION"]>;
30
39
  //# sourceMappingURL=ActionType.d.ts.map
@@ -1,15 +1,15 @@
1
1
  import { JSONSchema } from '../conditionals/conditionals';
2
2
  import { z } from 'zod';
3
- export declare function Conditional(): z.ZodType<JSONSchema, z.ZodTypeDef, JSONSchema>;
3
+ export declare const Conditional: z.ZodType<JSONSchema, z.ZodTypeDef, JSONSchema>;
4
4
  /**
5
5
  * By default, when conditionals are undefined, action is visible and enabled to everyone.
6
6
  */
7
7
  export declare const ConditionalType: {
8
- /** When 'SHOW' conditional is defined, the action is shown to the user only if the condition is met */
9
8
  readonly SHOW: "SHOW";
10
- /** If 'ENABLE' conditional is defined, the action is enabled only if the condition is met */
11
9
  readonly ENABLE: "ENABLE";
10
+ readonly DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW";
12
11
  };
12
+ export type ConditionalType = (typeof ConditionalType)[keyof typeof ConditionalType];
13
13
  export declare const ShowConditional: z.ZodObject<{
14
14
  type: z.ZodLiteral<"SHOW">;
15
15
  conditional: z.ZodType<JSONSchema, z.ZodTypeDef, JSONSchema>;
@@ -31,9 +31,25 @@ export declare const EnableConditional: z.ZodObject<{
31
31
  conditional: JSONSchema;
32
32
  }>;
33
33
  /** @knipignore */
34
- export type AllActionConditionalFields = typeof ShowConditional | typeof EnableConditional;
34
+ export type ActionConditionalType = typeof ShowConditional | typeof EnableConditional;
35
35
  /** @knipignore */
36
36
  export type InferredActionConditional = z.infer<typeof ShowConditional> | z.infer<typeof EnableConditional>;
37
- export declare const ActionConditional: z.ZodDiscriminatedUnion<"type", AllActionConditionalFields[]>;
37
+ export declare const ActionConditional: z.ZodDiscriminatedUnion<"type", ActionConditionalType[]>;
38
38
  export type ActionConditional = InferredActionConditional;
39
+ export declare const DisplayOnReviewConditional: z.ZodObject<{
40
+ type: z.ZodLiteral<"DISPLAY_ON_REVIEW">;
41
+ conditional: z.ZodType<JSONSchema, z.ZodTypeDef, JSONSchema>;
42
+ }, "strip", z.ZodTypeAny, {
43
+ type: "DISPLAY_ON_REVIEW";
44
+ conditional: JSONSchema;
45
+ }, {
46
+ type: "DISPLAY_ON_REVIEW";
47
+ conditional: JSONSchema;
48
+ }>;
49
+ /** @knipignore */
50
+ export type FieldConditionalType = typeof ShowConditional | typeof EnableConditional | typeof DisplayOnReviewConditional;
51
+ /** @knipignore */
52
+ export type InferredFieldConditional = z.infer<typeof ShowConditional> | z.infer<typeof EnableConditional> | z.infer<typeof DisplayOnReviewConditional>;
53
+ export declare const FieldConditional: z.ZodDiscriminatedUnion<"type", FieldConditionalType[]>;
54
+ export type FieldConditional = z.infer<typeof FieldConditional>;
39
55
  //# sourceMappingURL=Conditional.d.ts.map
@@ -1,5 +1,4 @@
1
1
  import { z } from 'zod';
2
- import { ActionType } from './ActionType';
3
2
  export declare const Draft: z.ZodObject<{
4
3
  id: z.ZodString;
5
4
  eventId: z.ZodString;
@@ -9,7 +8,7 @@ export declare const Draft: z.ZodObject<{
9
8
  id: z.ZodString;
10
9
  createdAt: z.ZodString;
11
10
  createdBy: z.ZodString;
12
- data: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
11
+ declaration: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
13
12
  filename: z.ZodString;
14
13
  originalFilename: z.ZodString;
15
14
  type: z.ZodString;
@@ -123,7 +122,7 @@ export declare const Draft: z.ZodObject<{
123
122
  addressLine3?: string | null | undefined;
124
123
  postcodeOrZip?: string | null | undefined;
125
124
  }>]>>;
126
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
125
+ annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
127
126
  filename: z.ZodString;
128
127
  originalFilename: z.ZodString;
129
128
  type: z.ZodString;
@@ -238,11 +237,16 @@ export declare const Draft: z.ZodObject<{
238
237
  postcodeOrZip?: string | null | undefined;
239
238
  }>]>>>;
240
239
  createdAtLocation: z.ZodString;
240
+ status: z.ZodEnum<["Requested", "Accepted", "Rejected"]>;
241
+ originalActionId: z.ZodOptional<z.ZodString>;
241
242
  }, {
242
- type: z.ZodEnum<[ActionType, ...ActionType[]]>;
243
+ type: z.ZodEnum<["DELETE", "CREATE", "NOTIFY", "DECLARE", "VALIDATE", "REGISTER", "DETECT_DUPLICATE", "REJECT", "MARKED_AS_DUPLICATE", "ARCHIVE", "PRINT_CERTIFICATE", "REQUEST_CORRECTION", "REJECT_CORRECTION", "APPROVE_CORRECTION", "READ", "ASSIGN", "UNASSIGN"]>;
243
244
  }>, "id">, "strip", z.ZodTypeAny, {
244
- type: ActionType;
245
- data: Record<string, string | number | boolean | {
245
+ type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "CREATE" | "NOTIFY" | "DETECT_DUPLICATE" | "REJECT" | "MARKED_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "READ" | "ASSIGN" | "UNASSIGN";
246
+ status: "Rejected" | "Requested" | "Accepted";
247
+ createdAt: string;
248
+ createdBy: string;
249
+ declaration: Record<string, string | number | boolean | {
246
250
  type: string;
247
251
  filename: string;
248
252
  originalFilename: string;
@@ -280,10 +284,8 @@ export declare const Draft: z.ZodObject<{
280
284
  filename: string;
281
285
  originalFilename: string;
282
286
  }[] | undefined>;
283
- createdAt: string;
284
- createdBy: string;
285
287
  createdAtLocation: string;
286
- metadata?: Record<string, string | number | boolean | {
288
+ annotation?: Record<string, string | number | boolean | {
287
289
  type: string;
288
290
  filename: string;
289
291
  originalFilename: string;
@@ -321,9 +323,13 @@ export declare const Draft: z.ZodObject<{
321
323
  filename: string;
322
324
  originalFilename: string;
323
325
  }[] | undefined> | undefined;
326
+ originalActionId?: string | undefined;
324
327
  }, {
325
- type: ActionType;
326
- data: Record<string, string | number | boolean | {
328
+ type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "CREATE" | "NOTIFY" | "DETECT_DUPLICATE" | "REJECT" | "MARKED_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "READ" | "ASSIGN" | "UNASSIGN";
329
+ status: "Rejected" | "Requested" | "Accepted";
330
+ createdAt: string;
331
+ createdBy: string;
332
+ declaration: Record<string, string | number | boolean | {
327
333
  type: string;
328
334
  filename: string;
329
335
  originalFilename: string;
@@ -361,10 +367,8 @@ export declare const Draft: z.ZodObject<{
361
367
  filename: string;
362
368
  originalFilename: string;
363
369
  }[] | undefined>;
364
- createdAt: string;
365
- createdBy: string;
366
370
  createdAtLocation: string;
367
- metadata?: Record<string, string | number | boolean | {
371
+ annotation?: Record<string, string | number | boolean | {
368
372
  type: string;
369
373
  filename: string;
370
374
  originalFilename: string;
@@ -402,6 +406,7 @@ export declare const Draft: z.ZodObject<{
402
406
  filename: string;
403
407
  originalFilename: string;
404
408
  }[] | undefined> | undefined;
409
+ originalActionId?: string | undefined;
405
410
  }>;
406
411
  }, "strip", z.ZodTypeAny, {
407
412
  id: string;
@@ -409,8 +414,11 @@ export declare const Draft: z.ZodObject<{
409
414
  eventId: string;
410
415
  transactionId: string;
411
416
  action: {
412
- type: ActionType;
413
- data: Record<string, string | number | boolean | {
417
+ type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "CREATE" | "NOTIFY" | "DETECT_DUPLICATE" | "REJECT" | "MARKED_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "READ" | "ASSIGN" | "UNASSIGN";
418
+ status: "Rejected" | "Requested" | "Accepted";
419
+ createdAt: string;
420
+ createdBy: string;
421
+ declaration: Record<string, string | number | boolean | {
414
422
  type: string;
415
423
  filename: string;
416
424
  originalFilename: string;
@@ -448,10 +456,8 @@ export declare const Draft: z.ZodObject<{
448
456
  filename: string;
449
457
  originalFilename: string;
450
458
  }[] | undefined>;
451
- createdAt: string;
452
- createdBy: string;
453
459
  createdAtLocation: string;
454
- metadata?: Record<string, string | number | boolean | {
460
+ annotation?: Record<string, string | number | boolean | {
455
461
  type: string;
456
462
  filename: string;
457
463
  originalFilename: string;
@@ -489,6 +495,7 @@ export declare const Draft: z.ZodObject<{
489
495
  filename: string;
490
496
  originalFilename: string;
491
497
  }[] | undefined> | undefined;
498
+ originalActionId?: string | undefined;
492
499
  };
493
500
  }, {
494
501
  id: string;
@@ -496,8 +503,11 @@ export declare const Draft: z.ZodObject<{
496
503
  eventId: string;
497
504
  transactionId: string;
498
505
  action: {
499
- type: ActionType;
500
- data: Record<string, string | number | boolean | {
506
+ type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "CREATE" | "NOTIFY" | "DETECT_DUPLICATE" | "REJECT" | "MARKED_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "READ" | "ASSIGN" | "UNASSIGN";
507
+ status: "Rejected" | "Requested" | "Accepted";
508
+ createdAt: string;
509
+ createdBy: string;
510
+ declaration: Record<string, string | number | boolean | {
501
511
  type: string;
502
512
  filename: string;
503
513
  originalFilename: string;
@@ -535,10 +545,8 @@ export declare const Draft: z.ZodObject<{
535
545
  filename: string;
536
546
  originalFilename: string;
537
547
  }[] | undefined>;
538
- createdAt: string;
539
- createdBy: string;
540
548
  createdAtLocation: string;
541
- metadata?: Record<string, string | number | boolean | {
549
+ annotation?: Record<string, string | number | boolean | {
542
550
  type: string;
543
551
  filename: string;
544
552
  originalFilename: string;
@@ -576,12 +584,13 @@ export declare const Draft: z.ZodObject<{
576
584
  filename: string;
577
585
  originalFilename: string;
578
586
  }[] | undefined> | undefined;
587
+ originalActionId?: string | undefined;
579
588
  };
580
589
  }>;
581
590
  export declare const DraftInput: z.ZodObject<z.objectUtil.extendShape<{
582
591
  eventId: z.ZodString;
583
592
  transactionId: z.ZodString;
584
- data: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
593
+ declaration: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
585
594
  filename: z.ZodString;
586
595
  originalFilename: z.ZodString;
587
596
  type: z.ZodString;
@@ -694,8 +703,8 @@ export declare const DraftInput: z.ZodObject<z.objectUtil.extendShape<{
694
703
  addressLine2?: string | null | undefined;
695
704
  addressLine3?: string | null | undefined;
696
705
  postcodeOrZip?: string | null | undefined;
697
- }>]>>;
698
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
706
+ }>]>>>;
707
+ annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
699
708
  filename: z.ZodString;
700
709
  originalFilename: z.ZodString;
701
710
  type: z.ZodString;
@@ -809,11 +818,13 @@ export declare const DraftInput: z.ZodObject<z.objectUtil.extendShape<{
809
818
  addressLine3?: string | null | undefined;
810
819
  postcodeOrZip?: string | null | undefined;
811
820
  }>]>>>;
821
+ originalActionId: z.ZodOptional<z.ZodString>;
822
+ keepAssignment: z.ZodOptional<z.ZodBoolean>;
812
823
  }, {
813
- type: z.ZodEnum<[ActionType, ...ActionType[]]>;
824
+ type: z.ZodEnum<["DELETE", "CREATE", "NOTIFY", "DECLARE", "VALIDATE", "REGISTER", "DETECT_DUPLICATE", "REJECT", "MARKED_AS_DUPLICATE", "ARCHIVE", "PRINT_CERTIFICATE", "REQUEST_CORRECTION", "REJECT_CORRECTION", "APPROVE_CORRECTION", "READ", "ASSIGN", "UNASSIGN"]>;
814
825
  }>, "strip", z.ZodTypeAny, {
815
- type: ActionType;
816
- data: Record<string, string | number | boolean | {
826
+ type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "CREATE" | "NOTIFY" | "DETECT_DUPLICATE" | "REJECT" | "MARKED_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "READ" | "ASSIGN" | "UNASSIGN";
827
+ declaration: Record<string, string | number | boolean | {
817
828
  type: string;
818
829
  filename: string;
819
830
  originalFilename: string;
@@ -853,7 +864,7 @@ export declare const DraftInput: z.ZodObject<z.objectUtil.extendShape<{
853
864
  }[] | undefined>;
854
865
  eventId: string;
855
866
  transactionId: string;
856
- metadata?: Record<string, string | number | boolean | {
867
+ annotation?: Record<string, string | number | boolean | {
857
868
  type: string;
858
869
  filename: string;
859
870
  originalFilename: string;
@@ -891,9 +902,13 @@ export declare const DraftInput: z.ZodObject<z.objectUtil.extendShape<{
891
902
  filename: string;
892
903
  originalFilename: string;
893
904
  }[] | undefined> | undefined;
905
+ originalActionId?: string | undefined;
906
+ keepAssignment?: boolean | undefined;
894
907
  }, {
895
- type: ActionType;
896
- data: Record<string, string | number | boolean | {
908
+ type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "CREATE" | "NOTIFY" | "DETECT_DUPLICATE" | "REJECT" | "MARKED_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "READ" | "ASSIGN" | "UNASSIGN";
909
+ eventId: string;
910
+ transactionId: string;
911
+ declaration?: Record<string, string | number | boolean | {
897
912
  type: string;
898
913
  filename: string;
899
914
  originalFilename: string;
@@ -930,10 +945,8 @@ export declare const DraftInput: z.ZodObject<z.objectUtil.extendShape<{
930
945
  option: string;
931
946
  filename: string;
932
947
  originalFilename: string;
933
- }[] | undefined>;
934
- eventId: string;
935
- transactionId: string;
936
- metadata?: Record<string, string | number | boolean | {
948
+ }[] | undefined> | undefined;
949
+ annotation?: Record<string, string | number | boolean | {
937
950
  type: string;
938
951
  filename: string;
939
952
  originalFilename: string;
@@ -971,6 +984,8 @@ export declare const DraftInput: z.ZodObject<z.objectUtil.extendShape<{
971
984
  filename: string;
972
985
  originalFilename: string;
973
986
  }[] | undefined> | undefined;
987
+ originalActionId?: string | undefined;
988
+ keepAssignment?: boolean | undefined;
974
989
  }>;
975
990
  export type Draft = z.infer<typeof Draft>;
976
991
  export type DraftInput = z.infer<typeof DraftInput>;