@opencrvs/toolkit 1.8.0-rc.fd8a78f → 1.8.0-rc.fde984c

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.
@@ -36,11 +36,6 @@ export declare const errorMessages: {
36
36
  description: string;
37
37
  id: string;
38
38
  };
39
- unexpectedField: {
40
- defaultMessage: string;
41
- description: string;
42
- id: string;
43
- };
44
39
  };
45
40
  /**
46
41
  * Custom error map for Zod to override the default error messages in intl-formik format.
@@ -36,8 +36,4 @@ export declare const annotationActions: z.ZodEnum<["DELETE", "CREATE", "NOTIFY",
36
36
  export type AnnotationActionType = z.infer<typeof annotationActions>;
37
37
  /** Actions which requires the user to be assigned */
38
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"]>;
39
- /** Actions which are visible in action menu and workqueue */
40
- export declare const workqueueActions: z.ZodEnum<["DELETE", "DECLARE", "VALIDATE", "REGISTER", "PRINT_CERTIFICATE", "READ", "ASSIGN", "UNASSIGN"]>;
41
- export type WorkqueueActionType = z.infer<typeof workqueueActions>;
42
- export declare function isMetaAction(actionType: ActionType): boolean;
43
39
  //# sourceMappingURL=ActionType.d.ts.map
@@ -6,8 +6,6 @@ export declare const mandatoryColumns: {
6
6
  };
7
7
  label: TranslationConfig;
8
8
  }[];
9
- export declare const WorkqueueActionsWithDefault: z.ZodEnum<["DELETE", "DECLARE", "VALIDATE", "REGISTER", "PRINT_CERTIFICATE", "READ", "ASSIGN", "UNASSIGN", "DEFAULT"]>;
10
- export type WorkqueueActionsWithDefault = z.infer<typeof WorkqueueActionsWithDefault>;
11
9
  /**
12
10
  * Configuration for workqueue. Workqueues are used to display a list of events.
13
11
  */
@@ -1120,13 +1118,13 @@ export declare const WorkqueueConfig: z.ZodObject<{
1120
1118
  }[];
1121
1119
  }>]>;
1122
1120
  actions: z.ZodArray<z.ZodObject<{
1123
- type: z.ZodEnum<["DELETE", "DECLARE", "VALIDATE", "REGISTER", "PRINT_CERTIFICATE", "READ", "ASSIGN", "UNASSIGN", "DEFAULT"]>;
1121
+ type: z.ZodString;
1124
1122
  conditionals: z.ZodOptional<z.ZodArray<z.ZodType<import(".").JSONSchema, z.ZodTypeDef, import(".").JSONSchema>, "many">>;
1125
1123
  }, "strip", z.ZodTypeAny, {
1126
- type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "PRINT_CERTIFICATE" | "READ" | "ASSIGN" | "UNASSIGN" | "DEFAULT";
1124
+ type: string;
1127
1125
  conditionals?: import(".").JSONSchema[] | undefined;
1128
1126
  }, {
1129
- type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "PRINT_CERTIFICATE" | "READ" | "ASSIGN" | "UNASSIGN" | "DEFAULT";
1127
+ type: string;
1130
1128
  conditionals?: import(".").JSONSchema[] | undefined;
1131
1129
  }>, "many">;
1132
1130
  columns: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -1161,7 +1159,7 @@ export declare const WorkqueueConfig: z.ZodObject<{
1161
1159
  }, "strip", z.ZodTypeAny, {
1162
1160
  name: TranslationConfig;
1163
1161
  actions: {
1164
- type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "PRINT_CERTIFICATE" | "READ" | "ASSIGN" | "UNASSIGN" | "DEFAULT";
1162
+ type: string;
1165
1163
  conditionals?: import(".").JSONSchema[] | undefined;
1166
1164
  }[];
1167
1165
  query: {
@@ -1340,7 +1338,7 @@ export declare const WorkqueueConfig: z.ZodObject<{
1340
1338
  defaultMessage: string;
1341
1339
  };
1342
1340
  actions: {
1343
- type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "PRINT_CERTIFICATE" | "READ" | "ASSIGN" | "UNASSIGN" | "DEFAULT";
1341
+ type: string;
1344
1342
  conditionals?: import(".").JSONSchema[] | undefined;
1345
1343
  }[];
1346
1344
  query: {
@@ -3013,13 +3011,13 @@ export declare const WorkqueueConfigInput: z.ZodObject<{
3013
3011
  }[];
3014
3012
  }>]>;
3015
3013
  actions: z.ZodArray<z.ZodObject<{
3016
- type: z.ZodEnum<["DELETE", "DECLARE", "VALIDATE", "REGISTER", "PRINT_CERTIFICATE", "READ", "ASSIGN", "UNASSIGN", "DEFAULT"]>;
3014
+ type: z.ZodString;
3017
3015
  conditionals: z.ZodOptional<z.ZodArray<z.ZodType<import(".").JSONSchema, z.ZodTypeDef, import(".").JSONSchema>, "many">>;
3018
3016
  }, "strip", z.ZodTypeAny, {
3019
- type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "PRINT_CERTIFICATE" | "READ" | "ASSIGN" | "UNASSIGN" | "DEFAULT";
3017
+ type: string;
3020
3018
  conditionals?: import(".").JSONSchema[] | undefined;
3021
3019
  }, {
3022
- type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "PRINT_CERTIFICATE" | "READ" | "ASSIGN" | "UNASSIGN" | "DEFAULT";
3020
+ type: string;
3023
3021
  conditionals?: import(".").JSONSchema[] | undefined;
3024
3022
  }>, "many">;
3025
3023
  columns: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -3054,7 +3052,7 @@ export declare const WorkqueueConfigInput: z.ZodObject<{
3054
3052
  }, "strip", z.ZodTypeAny, {
3055
3053
  name: TranslationConfig;
3056
3054
  actions: {
3057
- type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "PRINT_CERTIFICATE" | "READ" | "ASSIGN" | "UNASSIGN" | "DEFAULT";
3055
+ type: string;
3058
3056
  conditionals?: import(".").JSONSchema[] | undefined;
3059
3057
  }[];
3060
3058
  query: {
@@ -3310,7 +3308,7 @@ export declare const WorkqueueConfigInput: z.ZodObject<{
3310
3308
  defaultMessage: string;
3311
3309
  };
3312
3310
  actions: {
3313
- type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "PRINT_CERTIFICATE" | "READ" | "ASSIGN" | "UNASSIGN" | "DEFAULT";
3311
+ type: string;
3314
3312
  conditionals?: import(".").JSONSchema[] | undefined;
3315
3313
  }[];
3316
3314
  query: {
@@ -3569,7 +3567,7 @@ export type WorkqueueConfigInput = z.input<typeof WorkqueueConfigInput>;
3569
3567
  export declare function defineWorkqueue(workqueueInput: WorkqueueConfigInput): {
3570
3568
  name: TranslationConfig;
3571
3569
  actions: {
3572
- type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "PRINT_CERTIFICATE" | "READ" | "ASSIGN" | "UNASSIGN" | "DEFAULT";
3570
+ type: string;
3573
3571
  conditionals?: import(".").JSONSchema[] | undefined;
3574
3572
  }[];
3575
3573
  query: {
@@ -3745,7 +3743,7 @@ export declare function defineWorkqueue(workqueueInput: WorkqueueConfigInput): {
3745
3743
  export declare function defineWorkqueues(workqueues: WorkqueueConfigInput[]): {
3746
3744
  name: TranslationConfig;
3747
3745
  actions: {
3748
- type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "PRINT_CERTIFICATE" | "READ" | "ASSIGN" | "UNASSIGN" | "DEFAULT";
3746
+ type: string;
3749
3747
  conditionals?: import(".").JSONSchema[] | undefined;
3750
3748
  }[];
3751
3749
  query: {
@@ -35,7 +35,6 @@ export * from './test.utils';
35
35
  export * from './TemplateConfig';
36
36
  export * from './scopes';
37
37
  export * from './serializer';
38
- export * from './state/availableActions';
39
38
  export * from '../conditionals/conditionals';
40
39
  export * from '../conditionals/validate';
41
40
  export * from './field';
@@ -167,7 +167,6 @@ __export(events_exports, {
167
167
  VerificationActionConfig: () => VerificationActionConfig,
168
168
  VerificationPageConfig: () => VerificationPageConfig,
169
169
  Within: () => Within,
170
- WorkqueueActionsWithDefault: () => WorkqueueActionsWithDefault,
171
170
  WorkqueueColumn: () => WorkqueueColumn,
172
171
  WorkqueueColumnKeys: () => WorkqueueColumnKeys,
173
172
  WorkqueueColumnKeysArray: () => WorkqueueColumnKeysArray,
@@ -234,7 +233,6 @@ __export(events_exports, {
234
233
  getAnnotationFromDrafts: () => getAnnotationFromDrafts,
235
234
  getAssignedUserFromActions: () => getAssignedUserFromActions,
236
235
  getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
237
- getAvailableActionsByStatus: () => getAvailableActionsByStatus,
238
236
  getCurrentEventState: () => getCurrentEventState,
239
237
  getCurrentEventStateWithDrafts: () => getCurrentEventStateWithDrafts,
240
238
  getDeclaration: () => getDeclaration,
@@ -271,7 +269,6 @@ __export(events_exports, {
271
269
  isFileFieldWithOptionType: () => isFileFieldWithOptionType,
272
270
  isIdFieldType: () => isIdFieldType,
273
271
  isLocationFieldType: () => isLocationFieldType,
274
- isMetaAction: () => isMetaAction,
275
272
  isNameFieldType: () => isNameFieldType,
276
273
  isNonInteractiveFieldType: () => isNonInteractiveFieldType,
277
274
  isNumberFieldType: () => isNumberFieldType,
@@ -303,7 +300,6 @@ __export(events_exports, {
303
300
  user: () => user,
304
301
  validate: () => validate,
305
302
  validateFieldInput: () => validateFieldInput,
306
- workqueueActions: () => workqueueActions,
307
303
  writeActions: () => writeActions
308
304
  });
309
305
  module.exports = __toCommonJS(events_exports);
@@ -967,25 +963,6 @@ var writeActions = ActionTypes.exclude([
967
963
  ActionType.ASSIGN,
968
964
  ActionType.UNASSIGN
969
965
  ]);
970
- var workqueueActions = ActionTypes.exclude([
971
- ActionType.CREATE,
972
- ActionType.NOTIFY,
973
- ActionType.DETECT_DUPLICATE,
974
- ActionType.REJECT,
975
- ActionType.MARKED_AS_DUPLICATE,
976
- ActionType.ARCHIVE,
977
- ActionType.REQUEST_CORRECTION,
978
- ActionType.REJECT_CORRECTION,
979
- ActionType.APPROVE_CORRECTION
980
- ]);
981
- var META_ACTIONS = [
982
- ActionType.ASSIGN,
983
- ActionType.UNASSIGN,
984
- ActionType.READ
985
- ];
986
- function isMetaAction(actionType) {
987
- return META_ACTIONS.includes(actionType);
988
- }
989
966
 
990
967
  // ../commons/src/events/FormConfig.ts
991
968
  var import_zod8 = require("zod");
@@ -1761,11 +1738,6 @@ var errorMessages = {
1761
1738
  defaultMessage: "Invalid input",
1762
1739
  description: "Error message when generic field is invalid",
1763
1740
  id: "v2.error.invalid"
1764
- },
1765
- unexpectedField: {
1766
- defaultMessage: "Unexpected field",
1767
- description: "Error message when field is not expected",
1768
- id: "v2.error.unexpectedField"
1769
1741
  }
1770
1742
  };
1771
1743
  function createIntlError(message) {
@@ -3070,10 +3042,6 @@ var mandatoryColumns = defineWorkqueuesColumns([
3070
3042
  value: event.field("updatedAt")
3071
3043
  }
3072
3044
  ]);
3073
- var WorkqueueActionsWithDefault = import_zod25.z.enum([
3074
- ...workqueueActions.options,
3075
- "DEFAULT"
3076
- ]);
3077
3045
  var WorkqueueConfig = import_zod25.z.object({
3078
3046
  slug: import_zod25.z.string().describe("Determines the url of the workqueue."),
3079
3047
  name: TranslationConfig.describe(
@@ -3082,7 +3050,7 @@ var WorkqueueConfig = import_zod25.z.object({
3082
3050
  query: CountryConfigQueryType,
3083
3051
  actions: import_zod25.z.array(
3084
3052
  import_zod25.z.object({
3085
- type: WorkqueueActionsWithDefault,
3053
+ type: import_zod25.z.string(),
3086
3054
  conditionals: import_zod25.z.array(Conditional).optional()
3087
3055
  })
3088
3056
  ),
@@ -3097,7 +3065,7 @@ var WorkqueueConfigInput = import_zod25.z.object({
3097
3065
  query: CountryConfigQueryInputType,
3098
3066
  actions: import_zod25.z.array(
3099
3067
  import_zod25.z.object({
3100
- type: WorkqueueActionsWithDefault,
3068
+ type: import_zod25.z.string(),
3101
3069
  conditionals: import_zod25.z.array(Conditional).optional()
3102
3070
  })
3103
3071
  ),
@@ -6561,7 +6529,7 @@ function filterUnallowedActions(actions, userScopes) {
6561
6529
  return hasAnyOfScopes(userScopes, requiredScopes);
6562
6530
  });
6563
6531
  const hasOtherAllowedActions = allowedActions.some(
6564
- (action) => !isMetaAction(action)
6532
+ (action) => action !== ActionType.READ && action !== ActionType.ASSIGN && action !== ActionType.UNASSIGN
6565
6533
  );
6566
6534
  if (hasOtherAllowedActions) {
6567
6535
  return allowedActions;
@@ -6632,38 +6600,3 @@ function deserializeQuery(query, user2) {
6632
6600
  )
6633
6601
  };
6634
6602
  }
6635
-
6636
- // ../commons/src/events/state/availableActions.ts
6637
- var AVAILABLE_ACTIONS_BY_STATUS = {
6638
- [EventStatus.enum.CREATED]: [
6639
- ActionType.READ,
6640
- ActionType.DECLARE,
6641
- ActionType.DELETE
6642
- ],
6643
- [EventStatus.enum.NOTIFIED]: [ActionType.READ, ActionType.VALIDATE],
6644
- [EventStatus.enum.DECLARED]: [ActionType.READ, ActionType.VALIDATE],
6645
- [EventStatus.enum.VALIDATED]: [ActionType.READ, ActionType.REGISTER],
6646
- [EventStatus.enum.REJECTED]: [
6647
- ActionType.READ,
6648
- ActionType.DECLARE,
6649
- ActionType.VALIDATE
6650
- ],
6651
- [EventStatus.enum.REGISTERED]: [
6652
- ActionType.READ,
6653
- ActionType.PRINT_CERTIFICATE,
6654
- ActionType.REQUEST_CORRECTION
6655
- ],
6656
- [EventStatus.enum.CERTIFIED]: [
6657
- ActionType.READ,
6658
- ActionType.PRINT_CERTIFICATE,
6659
- ActionType.REQUEST_CORRECTION
6660
- ],
6661
- [EventStatus.enum.ARCHIVED]: [
6662
- ActionType.READ,
6663
- ActionType.ASSIGN,
6664
- ActionType.UNASSIGN
6665
- ]
6666
- };
6667
- function getAvailableActionsByStatus(status) {
6668
- return AVAILABLE_ACTIONS_BY_STATUS[status];
6669
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "1.8.0-rc.fd8a78f",
3
+ "version": "1.8.0-rc.fde984c",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "exports": {