@opencrvs/toolkit 2.0.0-rc.adf3f22 → 2.0.0-rc.b0a238f

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 (36) hide show
  1. package/dist/application-config/index.js +13 -25
  2. package/dist/cli.js +389 -127
  3. package/dist/commons/api/router.d.ts +3301 -247
  4. package/dist/commons/conditionals/validate.d.ts +1 -0
  5. package/dist/commons/events/ActionInput.d.ts +108 -0
  6. package/dist/commons/events/Draft.d.ts +3 -0
  7. package/dist/commons/events/EventIndex.d.ts +0 -3
  8. package/dist/commons/events/EventMetadata.d.ts +0 -7
  9. package/dist/commons/events/state/index.d.ts +0 -4
  10. package/dist/commons/events/state/utils.d.ts +0 -2
  11. package/dist/commons/events/utils.d.ts +1 -1
  12. package/dist/events/index.js +29 -55
  13. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
  14. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  15. package/dist/migrations/v2.0/checkout-upstream-files.js +1 -2
  16. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +9 -1
  17. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -1
  18. package/dist/migrations/v2.0/delete-infrastructure-directory.js +66 -20
  19. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +3 -0
  20. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +1 -0
  21. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +110 -0
  22. package/dist/migrations/v2.0/index.d.ts +5 -3
  23. package/dist/migrations/v2.0/index.d.ts.map +1 -1
  24. package/dist/migrations/v2.0/index.js +387 -125
  25. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +11 -1
  26. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -1
  27. package/dist/migrations/v2.0/merge-infrastructure-directory.js +17 -16
  28. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
  29. package/dist/migrations/v2.0/migrate-scopes.js +54 -30
  30. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
  31. package/dist/migrations/v2.0/migrate-workqueue-configs.js +140 -59
  32. package/dist/notification/index.js +16 -25
  33. package/opencrvs-toolkit-2.0.0-rc.b0a238f.tgz +0 -0
  34. package/package.json +1 -1
  35. package/tsconfig.tsbuildinfo +1 -1
  36. package/opencrvs-toolkit-2.0.0-rc.adf3f22.tgz +0 -0
@@ -418,28 +418,20 @@ function schemaPriority(schema) {
418
418
  return idx === -1 ? 9999 : idx;
419
419
  }
420
420
  function safeUnion(schemas) {
421
+ const sortedSchemas = [...schemas].sort(
422
+ (a, b) => schemaPriority(a) - schemaPriority(b)
423
+ );
421
424
  return z7.any().superRefine((val, ctx) => {
422
- const successful = schemas.filter((s) => s.safeParse(val).success);
423
- if (successful.length === 1) {
424
- return;
425
- }
426
- if (successful.length === 0) {
427
- ctx.addIssue({
428
- code: "invalid_type",
429
- expected: "custom",
430
- message: "Value does not match any schema"
431
- });
432
- return;
433
- }
434
- successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
435
- const best = successful[0];
436
- if (!best.safeParse(val).success) {
437
- ctx.addIssue({
438
- expected: "custom",
439
- code: "invalid_type",
440
- message: "Value did not match the best schema"
441
- });
425
+ for (const schema of sortedSchemas) {
426
+ if (schema.safeParse(val).success) {
427
+ return;
428
+ }
442
429
  }
430
+ ctx.addIssue({
431
+ code: "invalid_type",
432
+ expected: "custom",
433
+ message: "Value does not match any schema"
434
+ });
443
435
  }).meta({
444
436
  description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
445
437
  });
@@ -1113,8 +1105,7 @@ var ActionCreationMetadata = z15.object({
1113
1105
  ),
1114
1106
  createdByUserType: z15.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1115
1107
  acceptedAt: z15.iso.datetime().describe("Timestamp when the action request was accepted."),
1116
- createdByRole: z15.string().optional().describe("Role of the user at the time of action request creation."),
1117
- createdBySignature: z15.string().nullish().describe("Signature of the user who created the action request.")
1108
+ createdByRole: z15.string().optional().describe("Role of the user at the time of action request creation.")
1118
1109
  });
1119
1110
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1120
1111
  registrationNumber: z15.string().describe(
@@ -1142,9 +1133,6 @@ var EventMetadata = z15.object({
1142
1133
  createdAtLocation: UUID.nullish().describe(
1143
1134
  "Location of the user who created the event."
1144
1135
  ),
1145
- createdBySignature: DocumentPath.nullish().describe(
1146
- "Signature of the user who created the event."
1147
- ),
1148
1136
  updatedAtLocation: UUID.nullish().describe(
1149
1137
  "Location of the user who last changed the status."
1150
1138
  ),