@opencrvs/toolkit 2.0.0-rc.b4498f2 → 2.0.0-rc.b60239a

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.
@@ -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
  });
@@ -1152,6 +1144,9 @@ var EventMetadata = z15.object({
1152
1144
  "Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
1153
1145
  ),
1154
1146
  assignedTo: z15.string().nullish().describe("ID of the user currently assigned to the event."),
1147
+ assignedToSignature: DocumentPath.nullish().describe(
1148
+ "Signature of the user who is currently assigned to the event."
1149
+ ),
1155
1150
  updatedBy: z15.string().nullish().describe("ID of the user who last changed the status."),
1156
1151
  trackingId: z15.string().describe(
1157
1152
  "System-generated tracking ID used by informants or registrars to look up the event."