@pattern-stack/codegen 0.4.3 → 0.4.4

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.
package/dist/src/index.js CHANGED
@@ -466,7 +466,15 @@ var EVENT_FIELD_TYPES = [
466
466
  "number",
467
467
  "boolean",
468
468
  "date",
469
- "json"
469
+ "json",
470
+ "array"
471
+ ];
472
+ var EVENT_ARRAY_ITEM_TYPES = [
473
+ "uuid",
474
+ "string",
475
+ "number",
476
+ "boolean",
477
+ "date"
470
478
  ];
471
479
  var RESERVED_EVENT_POOLS = [
472
480
  "events_inbound",
@@ -481,12 +489,29 @@ var DIRECTION_TO_POOL = {
481
489
  };
482
490
  var EventDirectionSchema = z2.enum(EVENT_DIRECTIONS);
483
491
  var EventFieldTypeSchema = z2.enum(EVENT_FIELD_TYPES);
492
+ var EventArrayItemTypeSchema = z2.enum(EVENT_ARRAY_ITEM_TYPES);
484
493
  var EventPoolSchema = z2.enum(RESERVED_EVENT_POOLS);
485
494
  var EventPayloadFieldSchema = z2.object({
486
495
  type: EventFieldTypeSchema,
496
+ items: EventArrayItemTypeSchema.optional(),
487
497
  nullable: z2.boolean().optional().default(false),
488
498
  description: z2.string().optional()
489
- }).strict();
499
+ }).strict().superRefine((data, ctx) => {
500
+ if (data.type === "array" && data.items === void 0) {
501
+ ctx.addIssue({
502
+ code: z2.ZodIssueCode.custom,
503
+ message: "'items' is required when type is 'array'",
504
+ path: ["items"]
505
+ });
506
+ }
507
+ if (data.type !== "array" && data.items !== void 0) {
508
+ ctx.addIssue({
509
+ code: z2.ZodIssueCode.custom,
510
+ message: `'items' is only valid when type is 'array' (got '${data.type}')`,
511
+ path: ["items"]
512
+ });
513
+ }
514
+ });
490
515
  var RetrySchema = z2.object({
491
516
  attempts: z2.number().int().min(0).max(20),
492
517
  backoff: z2.enum(EVENT_BACKOFF_STRATEGIES)