@opencrvs/toolkit 1.9.12-rc.9ad0c5f → 1.9.12-rc.9be45d7

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.
Files changed (38) hide show
  1. package/dist/application-config/index.js +13 -21
  2. package/dist/cli.js +1246 -35
  3. package/dist/commons/api/router.d.ts +180 -161
  4. package/dist/commons/events/ActionInput.d.ts +36 -0
  5. package/dist/commons/events/Draft.d.ts +1 -0
  6. package/dist/commons/events/EventConfig.d.ts +3 -1
  7. package/dist/commons/events/FieldConfig.d.ts +2 -2
  8. package/dist/events/index.js +29 -23
  9. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +3 -0
  10. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -0
  11. package/dist/migrations/v2.0/checkout-upstream-files.js +143 -0
  12. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +1 -1
  13. package/dist/migrations/v2.0/convert-config-files-to-ts.js +97 -21
  14. package/dist/migrations/v2.0/create-events-index.d.ts +3 -0
  15. package/dist/migrations/v2.0/create-events-index.d.ts.map +1 -0
  16. package/dist/migrations/v2.0/create-events-index.js +326 -0
  17. package/dist/migrations/v2.0/index.d.ts.map +1 -1
  18. package/dist/migrations/v2.0/index.js +1244 -33
  19. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
  20. package/dist/migrations/v2.0/migrate-scopes.js +6 -5
  21. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts +3 -0
  22. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -0
  23. package/dist/migrations/v2.0/migrate-workqueue-configs.js +237 -0
  24. package/dist/migrations/v2.0/remove-demo-scope.d.ts +3 -0
  25. package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +1 -0
  26. package/dist/migrations/v2.0/remove-demo-scope.js +75 -0
  27. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts +3 -0
  28. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +1 -0
  29. package/dist/migrations/v2.0/remove-hearth-migrations.js +78 -0
  30. package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts +3 -0
  31. package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts.map +1 -0
  32. package/dist/migrations/v2.0/simplify-analytics-precalculations.js +196 -0
  33. package/dist/notification/index.js +17 -21
  34. package/opencrvs-toolkit-1.9.12-rc.9be45d7.tgz +0 -0
  35. package/package.json +1 -1
  36. package/tsconfig.json +3 -0
  37. package/tsconfig.tsbuildinfo +1 -1
  38. package/opencrvs-toolkit-1.9.12-rc.9ad0c5f.tgz +0 -0
@@ -949,28 +949,20 @@ function schemaPriority(schema) {
949
949
  return idx === -1 ? 9999 : idx;
950
950
  }
951
951
  function safeUnion(schemas) {
952
+ const sortedSchemas = [...schemas].sort(
953
+ (a, b) => schemaPriority(a) - schemaPriority(b)
954
+ );
952
955
  return z12.any().superRefine((val, ctx) => {
953
- const successful = schemas.filter((s) => s.safeParse(val).success);
954
- if (successful.length === 1) {
955
- return;
956
- }
957
- if (successful.length === 0) {
958
- ctx.addIssue({
959
- code: "invalid_type",
960
- expected: "custom",
961
- message: "Value does not match any schema"
962
- });
963
- return;
964
- }
965
- successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
966
- const best = successful[0];
967
- if (!best.safeParse(val).success) {
968
- ctx.addIssue({
969
- expected: "custom",
970
- code: "invalid_type",
971
- message: "Value did not match the best schema"
972
- });
956
+ for (const schema of sortedSchemas) {
957
+ if (schema.safeParse(val).success) {
958
+ return;
959
+ }
973
960
  }
961
+ ctx.addIssue({
962
+ code: "invalid_type",
963
+ expected: "custom",
964
+ message: "Value does not match any schema"
965
+ });
974
966
  }).meta({
975
967
  description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
976
968
  });
@@ -1992,7 +1984,7 @@ var LocationInput = BaseField.extend({
1992
1984
  configuration: import_v43.default.object({
1993
1985
  locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
1994
1986
  allowedLocations: AllowedLocations
1995
- })
1987
+ }).optional()
1996
1988
  }).describe("Input field for a location");
1997
1989
  var FileUploadWithOptions = BaseField.extend({
1998
1990
  type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
@@ -3661,6 +3653,9 @@ var _EventConfigBase = z33.object({
3661
3653
  ),
3662
3654
  flags: z33.array(FlagConfig).optional().default([]).describe(
3663
3655
  "Configuration of flags associated with the actions of this event type."
3656
+ ),
3657
+ analytics: z33.boolean().optional().default(true).describe(
3658
+ "Indicates whether the records of this event type are included in analytics"
3664
3659
  )
3665
3660
  });
3666
3661
  var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
@@ -4146,6 +4141,7 @@ var BaseActionInput = z38.object({
4146
4141
  originalActionId: UUID.optional(),
4147
4142
  // should not be part of base action.
4148
4143
  keepAssignment: z38.boolean().optional(),
4144
+ waitFor: z38.boolean().optional(),
4149
4145
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
4150
4146
  // @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
4151
4147
  createdAtLocation: UUID.nullish().describe(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "1.9.12-rc.9ad0c5f",
3
+ "version": "1.9.12-rc.9be45d7",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "bin": {
package/tsconfig.json CHANGED
@@ -20,6 +20,9 @@
20
20
  "@opencrvs/commons/events/deduplication": [
21
21
  "../commons/src/events/deduplication.ts"
22
22
  ],
23
+ "@opencrvs/commons/scopes.deprecated.do-not-use": [
24
+ "../commons/src/scopes.deprecated.do-not-use.ts"
25
+ ],
23
26
  "@opencrvs/commons/notification": [
24
27
  "../commons/src/notification/index.ts"
25
28
  ],
@@ -1 +1 @@
1
- {"root":["./src/cli.ts","./src/api/index.ts","./src/application-config/index.ts","./src/conditionals/index.ts","./src/events/deduplication.ts","./src/events/index.ts","./src/migrations/v2.0/add-birth-certificate-issuance-flag.ts","./src/migrations/v2.0/convert-config-files-to-ts.ts","./src/migrations/v2.0/convert-paragraph-to-heading.ts","./src/migrations/v2.0/index.ts","./src/migrations/v2.0/make-built-in-validate-actions-custom.ts","./src/migrations/v2.0/migrate-scopes.ts","./src/migrations/v2.0/migrate-validated-workqueue-status-to-flag.ts","./src/migrations/v2.0/remove-delete-actions.ts","./src/migrations/v2.0/remove-deprecated-imports.ts","./src/migrations/v2.0/remove-pending-certification-flag.ts","./src/migrations/v2.0/remove-review-from-register-action.ts","./src/migrations/v2.0/rename-api-paths.ts","./src/migrations/v2.0/rename-location-parent-id.ts","./src/notification/index.ts","./src/scopes/index.ts"],"version":"5.6.3"}
1
+ {"root":["./src/cli.ts","./src/api/index.ts","./src/application-config/index.ts","./src/conditionals/index.ts","./src/events/deduplication.ts","./src/events/index.ts","./src/migrations/v2.0/add-birth-certificate-issuance-flag.ts","./src/migrations/v2.0/checkout-upstream-files.ts","./src/migrations/v2.0/convert-config-files-to-ts.ts","./src/migrations/v2.0/convert-paragraph-to-heading.ts","./src/migrations/v2.0/create-events-index.ts","./src/migrations/v2.0/index.ts","./src/migrations/v2.0/make-built-in-validate-actions-custom.ts","./src/migrations/v2.0/migrate-scopes.ts","./src/migrations/v2.0/migrate-validated-workqueue-status-to-flag.ts","./src/migrations/v2.0/migrate-workqueue-configs.ts","./src/migrations/v2.0/remove-delete-actions.ts","./src/migrations/v2.0/remove-demo-scope.ts","./src/migrations/v2.0/remove-deprecated-imports.ts","./src/migrations/v2.0/remove-hearth-migrations.ts","./src/migrations/v2.0/remove-pending-certification-flag.ts","./src/migrations/v2.0/remove-review-from-register-action.ts","./src/migrations/v2.0/rename-api-paths.ts","./src/migrations/v2.0/rename-location-parent-id.ts","./src/migrations/v2.0/simplify-analytics-precalculations.ts","./src/notification/index.ts","./src/scopes/index.ts"],"version":"5.6.3"}