@opencrvs/toolkit 2.0.0-rc.da37d4e → 2.0.0-rc.da8cc8f

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 (42) hide show
  1. package/create-countryconfig/index.js +73 -0
  2. package/create-countryconfig/package.json +11 -0
  3. package/dist/application-config/index.js +17 -29
  4. package/dist/cli.js +405 -162
  5. package/dist/commons/api/router.d.ts +2983 -253
  6. package/dist/commons/application-config/index.d.ts +16 -4
  7. package/dist/commons/conditionals/validate.d.ts +1 -0
  8. package/dist/commons/events/ActionInput.d.ts +108 -0
  9. package/dist/commons/events/Draft.d.ts +3 -0
  10. package/dist/commons/events/EventIndex.d.ts +0 -3
  11. package/dist/commons/events/EventMetadata.d.ts +0 -7
  12. package/dist/commons/events/locations.d.ts +21 -0
  13. package/dist/commons/events/mocks.test.utils.d.ts +19 -0
  14. package/dist/commons/events/scopes.d.ts +24 -1
  15. package/dist/commons/events/state/index.d.ts +0 -4
  16. package/dist/commons/events/state/utils.d.ts +0 -2
  17. package/dist/commons/events/utils.d.ts +1 -1
  18. package/dist/events/index.js +84 -55
  19. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -1
  20. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +60 -35
  21. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
  22. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  23. package/dist/migrations/v2.0/checkout-upstream-files.js +1 -2
  24. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +9 -1
  25. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -1
  26. package/dist/migrations/v2.0/delete-infrastructure-directory.js +66 -20
  27. package/dist/migrations/v2.0/index.d.ts +5 -3
  28. package/dist/migrations/v2.0/index.d.ts.map +1 -1
  29. package/dist/migrations/v2.0/index.js +405 -162
  30. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -1
  31. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +90 -1
  32. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +11 -1
  33. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -1
  34. package/dist/migrations/v2.0/merge-infrastructure-directory.js +17 -16
  35. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
  36. package/dist/migrations/v2.0/migrate-scopes.js +54 -30
  37. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
  38. package/dist/migrations/v2.0/migrate-workqueue-configs.js +140 -59
  39. package/dist/notification/index.js +16 -25
  40. package/opencrvs-toolkit-2.0.0-rc.da8cc8f.tgz +0 -0
  41. package/package.json +1 -1
  42. package/opencrvs-toolkit-2.0.0-rc.da37d4e.tgz +0 -0
@@ -980,28 +980,20 @@ function schemaPriority(schema) {
980
980
  return idx === -1 ? 9999 : idx;
981
981
  }
982
982
  function safeUnion(schemas) {
983
+ const sortedSchemas = [...schemas].sort(
984
+ (a, b) => schemaPriority(a) - schemaPriority(b)
985
+ );
983
986
  return z12.any().superRefine((val, ctx) => {
984
- const successful = schemas.filter((s) => s.safeParse(val).success);
985
- if (successful.length === 1) {
986
- return;
987
- }
988
- if (successful.length === 0) {
989
- ctx.addIssue({
990
- code: "invalid_type",
991
- expected: "custom",
992
- message: "Value does not match any schema"
993
- });
994
- return;
995
- }
996
- successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
997
- const best = successful[0];
998
- if (!best.safeParse(val).success) {
999
- ctx.addIssue({
1000
- expected: "custom",
1001
- code: "invalid_type",
1002
- message: "Value did not match the best schema"
1003
- });
987
+ for (const schema of sortedSchemas) {
988
+ if (schema.safeParse(val).success) {
989
+ return;
990
+ }
1004
991
  }
992
+ ctx.addIssue({
993
+ code: "invalid_type",
994
+ expected: "custom",
995
+ message: "Value does not match any schema"
996
+ });
1005
997
  }).meta({
1006
998
  description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
1007
999
  });
@@ -1339,8 +1331,7 @@ var ActionCreationMetadata = z16.object({
1339
1331
  ),
1340
1332
  createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1341
1333
  acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
1342
- createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation."),
1343
- createdBySignature: z16.string().nullish().describe("Signature of the user who created the action request.")
1334
+ createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
1344
1335
  });
1345
1336
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1346
1337
  registrationNumber: z16.string().describe(
@@ -1368,9 +1359,6 @@ var EventMetadata = z16.object({
1368
1359
  createdAtLocation: UUID.nullish().describe(
1369
1360
  "Location of the user who created the event."
1370
1361
  ),
1371
- createdBySignature: DocumentPath.nullish().describe(
1372
- "Signature of the user who created the event."
1373
- ),
1374
1362
  updatedAtLocation: UUID.nullish().describe(
1375
1363
  "Location of the user who last changed the status."
1376
1364
  ),
@@ -4180,6 +4168,9 @@ var BaseActionInput = z38.object({
4180
4168
  originalActionId: UUID.optional(),
4181
4169
  // should not be part of base action.
4182
4170
  keepAssignment: z38.boolean().optional(),
4171
+ keepAssignmentIfAccepted: z38.boolean().optional(),
4172
+ keepAssignmentIfRejected: z38.boolean().optional(),
4173
+ waitFor: z38.boolean().optional(),
4183
4174
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
4184
4175
  // @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
4185
4176
  createdAtLocation: UUID.nullish().describe(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "2.0.0-rc.da37d4e",
3
+ "version": "2.0.0-rc.da8cc8f",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "bin": {