@pixerate/schemas 1.2.0 → 1.4.0

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/index.cjs CHANGED
@@ -34,8 +34,24 @@ __export(index_exports, {
34
34
  CodeGenerationSchema: () => CodeGenerationSchema,
35
35
  ComponentPropDefinitionSchema: () => ComponentPropDefinitionSchema,
36
36
  ComponentSynthesisSchema: () => ComponentSynthesisSchema,
37
+ ConditionOperatorSchema: () => ConditionOperatorSchema,
38
+ ConditionSchema: () => ConditionSchema,
39
+ ControlValidationSchema: () => ControlValidationSchema,
40
+ DecisionGateKindSchema: () => DecisionGateKindSchema,
41
+ DecisionGateSchema: () => DecisionGateSchema,
42
+ DimensionScoreSchema: () => DimensionScoreSchema,
37
43
  DropShadowSchema: () => DropShadowSchema,
44
+ FORM_SCHEMA_JSON_SCHEMA: () => FORM_SCHEMA_JSON_SCHEMA,
38
45
  FidelitySchema: () => FidelitySchema,
46
+ FormControlSchema: () => FormControlSchema,
47
+ FormControlTypeSchema: () => FormControlTypeSchema,
48
+ FormHandoffActionSchema: () => FormHandoffActionSchema,
49
+ FormOptionSchema: () => FormOptionSchema,
50
+ FormReviewMetaSchema: () => FormReviewMetaSchema,
51
+ FormSectionSchema: () => FormSectionSchema,
52
+ FormStageSchema: () => FormStageSchema,
53
+ FormSubmissionPayloadSchema: () => FormSubmissionPayloadSchema,
54
+ FormValidatorSchema: () => FormValidatorSchema,
39
55
  ImageCompositingSchema: () => ImageCompositingSchema,
40
56
  ImageGenerationSchema: () => ImageGenerationSchema,
41
57
  ImageTextOverlaySchema: () => ImageTextOverlaySchema,
@@ -45,8 +61,18 @@ __export(index_exports, {
45
61
  QueueJobSchema: () => QueueJobSchema,
46
62
  QueueJobStatusSchema: () => QueueJobStatusSchema,
47
63
  QueueJobTypeSchema: () => QueueJobTypeSchema,
64
+ ReferenceDataSourceSchema: () => ReferenceDataSourceSchema,
65
+ ScoreBandSchema: () => ScoreBandSchema,
66
+ ScoringConfigSchema: () => ScoringConfigSchema,
67
+ ScoringDimensionSchema: () => ScoringDimensionSchema,
68
+ ScoringRuleSchema: () => ScoringRuleSchema,
69
+ SemanticReviewIssueSchema: () => SemanticReviewIssueSchema,
70
+ SemanticReviewResultSchema: () => SemanticReviewResultSchema,
71
+ SemanticReviewStatusSchema: () => SemanticReviewStatusSchema,
48
72
  ServiceClientSchema: () => ServiceClientSchema,
49
73
  SocialVideoGenerationSchema: () => SocialVideoGenerationSchema,
74
+ SubmissionScoreSchema: () => SubmissionScoreSchema,
75
+ TechnicalFormSchema: () => TechnicalFormSchema,
50
76
  TextAlignmentSchema: () => TextAlignmentSchema,
51
77
  TextOverlayPositionSchema: () => TextOverlayPositionSchema,
52
78
  VideoAnalysisCategorySchema: () => VideoAnalysisCategorySchema,
@@ -330,6 +356,473 @@ var QueueJobSchema = import_zod.z.object({
330
356
  createdAt: import_zod.z.any().optional(),
331
357
  updatedAt: import_zod.z.any().optional()
332
358
  });
359
+ var ConditionOperatorSchema = import_zod.z.enum([
360
+ "equals",
361
+ "notEquals",
362
+ "not_equals",
363
+ "includes",
364
+ "contains",
365
+ "greaterThan",
366
+ "greater_than",
367
+ "lessThan",
368
+ "less_than",
369
+ "exists"
370
+ ]);
371
+ var ConditionSchema = import_zod.z.object({
372
+ field: import_zod.z.string().optional(),
373
+ fieldId: import_zod.z.string().optional(),
374
+ operator: ConditionOperatorSchema,
375
+ value: import_zod.z.union([import_zod.z.string(), import_zod.z.number(), import_zod.z.boolean()]).optional()
376
+ });
377
+ var ControlValidationSchema = import_zod.z.object({
378
+ min: import_zod.z.number().optional(),
379
+ max: import_zod.z.number().optional(),
380
+ minLength: import_zod.z.number().optional(),
381
+ maxLength: import_zod.z.number().optional(),
382
+ pattern: import_zod.z.string().optional(),
383
+ message: import_zod.z.string().optional(),
384
+ unit: import_zod.z.string().optional()
385
+ });
386
+ var FormOptionSchema = import_zod.z.object({
387
+ label: import_zod.z.string(),
388
+ value: import_zod.z.string()
389
+ });
390
+ var ReferenceDataSourceSchema = import_zod.z.enum(["companies", "users"]);
391
+ var FormControlTypeSchema = import_zod.z.enum([
392
+ "text",
393
+ "textarea",
394
+ "number",
395
+ "select",
396
+ "multiselect",
397
+ "radio",
398
+ "checkbox",
399
+ "date",
400
+ "file",
401
+ "company",
402
+ "user",
403
+ "slider",
404
+ "computed",
405
+ "repeater"
406
+ ]);
407
+ var FormControlSchema = import_zod.z.lazy(
408
+ () => import_zod.z.object({
409
+ id: import_zod.z.string(),
410
+ type: FormControlTypeSchema,
411
+ label: import_zod.z.string(),
412
+ description: import_zod.z.string().optional(),
413
+ helperText: import_zod.z.string().optional(),
414
+ placeholder: import_zod.z.string().optional(),
415
+ required: import_zod.z.boolean().optional(),
416
+ defaultValue: import_zod.z.any().optional(),
417
+ options: import_zod.z.array(FormOptionSchema).optional(),
418
+ dataSource: ReferenceDataSourceSchema.optional(),
419
+ validation: ControlValidationSchema.optional(),
420
+ pattern: import_zod.z.string().optional(),
421
+ min: import_zod.z.number().optional(),
422
+ max: import_zod.z.number().optional(),
423
+ step: import_zod.z.number().optional(),
424
+ minItems: import_zod.z.number().optional(),
425
+ maxItems: import_zod.z.number().optional(),
426
+ formula: import_zod.z.string().optional(),
427
+ computed: import_zod.z.object({ formula: import_zod.z.string().optional() }).optional(),
428
+ visibleWhen: ConditionSchema.optional(),
429
+ condition: ConditionSchema.optional(),
430
+ itemControls: import_zod.z.array(FormControlSchema).optional(),
431
+ controls: import_zod.z.array(FormControlSchema).optional()
432
+ })
433
+ );
434
+ var FormSectionSchema = import_zod.z.object({
435
+ id: import_zod.z.string(),
436
+ title: import_zod.z.string(),
437
+ description: import_zod.z.string().optional(),
438
+ controls: import_zod.z.array(FormControlSchema),
439
+ visibleWhen: ConditionSchema.optional(),
440
+ condition: ConditionSchema.optional()
441
+ });
442
+ var FormStageSchema = import_zod.z.object({
443
+ id: import_zod.z.string(),
444
+ title: import_zod.z.string(),
445
+ description: import_zod.z.string().optional(),
446
+ sections: import_zod.z.array(FormSectionSchema),
447
+ gate: import_zod.z.string().optional()
448
+ });
449
+ var DecisionGateKindSchema = import_zod.z.enum(["approval", "review", "decision"]);
450
+ var DecisionGateSchema = import_zod.z.object({
451
+ id: import_zod.z.string(),
452
+ title: import_zod.z.string(),
453
+ description: import_zod.z.string().optional(),
454
+ stageId: import_zod.z.string(),
455
+ kind: DecisionGateKindSchema.optional(),
456
+ trigger: import_zod.z.string().optional(),
457
+ requiredAction: import_zod.z.string().optional(),
458
+ consequence: import_zod.z.string().optional(),
459
+ condition: import_zod.z.union([ConditionSchema, import_zod.z.string()]).optional(),
460
+ blocking: import_zod.z.boolean(),
461
+ reviewerRole: import_zod.z.string().optional()
462
+ });
463
+ var ScoringRuleSchema = import_zod.z.object({
464
+ field: import_zod.z.string(),
465
+ optionPoints: import_zod.z.record(import_zod.z.number()).optional(),
466
+ ranges: import_zod.z.array(
467
+ import_zod.z.object({
468
+ min: import_zod.z.number().optional(),
469
+ max: import_zod.z.number().optional(),
470
+ points: import_zod.z.number()
471
+ })
472
+ ).optional(),
473
+ multiplier: import_zod.z.number().optional(),
474
+ truePoints: import_zod.z.number().optional(),
475
+ falsePoints: import_zod.z.number().optional()
476
+ });
477
+ var ScoringDimensionSchema = import_zod.z.object({
478
+ id: import_zod.z.string(),
479
+ label: import_zod.z.string(),
480
+ description: import_zod.z.string().optional(),
481
+ weight: import_zod.z.number().optional(),
482
+ rules: import_zod.z.array(ScoringRuleSchema)
483
+ });
484
+ var ScoreBandSchema = import_zod.z.object({
485
+ id: import_zod.z.string(),
486
+ label: import_zod.z.string(),
487
+ min: import_zod.z.number(),
488
+ max: import_zod.z.number().optional()
489
+ });
490
+ var ScoringConfigSchema = import_zod.z.object({
491
+ description: import_zod.z.string().optional(),
492
+ dimensions: import_zod.z.array(ScoringDimensionSchema),
493
+ bands: import_zod.z.array(ScoreBandSchema).optional()
494
+ });
495
+ var DimensionScoreSchema = import_zod.z.object({
496
+ dimensionId: import_zod.z.string(),
497
+ label: import_zod.z.string(),
498
+ points: import_zod.z.number(),
499
+ weight: import_zod.z.number(),
500
+ weighted: import_zod.z.number()
501
+ });
502
+ var SubmissionScoreSchema = import_zod.z.object({
503
+ total: import_zod.z.number(),
504
+ dimensions: import_zod.z.array(DimensionScoreSchema),
505
+ band: import_zod.z.object({ id: import_zod.z.string(), label: import_zod.z.string() }).optional(),
506
+ calculatedAt: import_zod.z.string(),
507
+ schemaVersion: import_zod.z.union([import_zod.z.string(), import_zod.z.number()])
508
+ });
509
+ var FormValidatorSchema = import_zod.z.object({
510
+ id: import_zod.z.string(),
511
+ description: import_zod.z.string().optional(),
512
+ fields: import_zod.z.array(import_zod.z.string()).optional(),
513
+ severity: import_zod.z.union([import_zod.z.enum(["error", "warning"]), import_zod.z.string()]).optional(),
514
+ type: import_zod.z.string().optional(),
515
+ config: import_zod.z.any().optional()
516
+ });
517
+ var FormHandoffActionSchema = import_zod.z.object({
518
+ id: import_zod.z.string().optional(),
519
+ label: import_zod.z.string().optional(),
520
+ destination: import_zod.z.string().optional(),
521
+ condition: import_zod.z.union([ConditionSchema, import_zod.z.string()]).optional(),
522
+ payloadFields: import_zod.z.array(import_zod.z.string()).optional(),
523
+ type: import_zod.z.string().optional(),
524
+ config: import_zod.z.any().optional()
525
+ });
526
+ var FormReviewMetaSchema = import_zod.z.object({
527
+ humanReviewRequired: import_zod.z.boolean(),
528
+ reviewAreas: import_zod.z.array(import_zod.z.string())
529
+ });
530
+ var TechnicalFormSchema = import_zod.z.object({
531
+ id: import_zod.z.string().optional(),
532
+ title: import_zod.z.string().optional(),
533
+ description: import_zod.z.string().optional(),
534
+ version: import_zod.z.union([import_zod.z.string(), import_zod.z.number()]),
535
+ stages: import_zod.z.array(FormStageSchema),
536
+ decisionGates: import_zod.z.array(DecisionGateSchema).optional(),
537
+ validators: import_zod.z.array(FormValidatorSchema).optional(),
538
+ handoffActions: import_zod.z.array(FormHandoffActionSchema).optional(),
539
+ review: FormReviewMetaSchema.optional(),
540
+ reviewMetadata: import_zod.z.object({
541
+ approvers: import_zod.z.array(import_zod.z.string()),
542
+ requirements: import_zod.z.array(import_zod.z.string())
543
+ }).optional(),
544
+ scoring: ScoringConfigSchema.optional()
545
+ });
546
+ var SemanticReviewStatusSchema = import_zod.z.enum(["pass", "flagged", "unavailable"]);
547
+ var SemanticReviewIssueSchema = import_zod.z.object({
548
+ id: import_zod.z.string(),
549
+ severity: import_zod.z.enum(["warning", "error"]),
550
+ message: import_zod.z.string(),
551
+ fieldId: import_zod.z.string().optional(),
552
+ fieldLabel: import_zod.z.string().optional(),
553
+ suggestion: import_zod.z.string().optional()
554
+ });
555
+ var SemanticReviewResultSchema = import_zod.z.object({
556
+ status: SemanticReviewStatusSchema,
557
+ summary: import_zod.z.string().optional(),
558
+ issues: import_zod.z.array(SemanticReviewIssueSchema)
559
+ });
560
+ var FormSubmissionPayloadSchema = import_zod.z.object({
561
+ id: import_zod.z.string().optional(),
562
+ answers: import_zod.z.record(import_zod.z.any()),
563
+ stageReviews: import_zod.z.array(import_zod.z.any()).optional(),
564
+ gateDecisions: import_zod.z.array(import_zod.z.any()).optional(),
565
+ submittedAt: import_zod.z.string().optional(),
566
+ score: SubmissionScoreSchema.optional()
567
+ });
568
+ var formJsonCondition = {
569
+ type: "object",
570
+ properties: {
571
+ field: { type: "string" },
572
+ fieldId: { type: "string" },
573
+ operator: {
574
+ enum: [
575
+ "equals",
576
+ "notEquals",
577
+ "not_equals",
578
+ "includes",
579
+ "contains",
580
+ "greaterThan",
581
+ "greater_than",
582
+ "lessThan",
583
+ "less_than",
584
+ "exists"
585
+ ]
586
+ },
587
+ value: { type: ["string", "number", "boolean"] }
588
+ },
589
+ required: ["operator"]
590
+ };
591
+ var formJsonControl = {
592
+ type: "object",
593
+ properties: {
594
+ id: { type: "string" },
595
+ type: {
596
+ enum: [
597
+ "text",
598
+ "textarea",
599
+ "number",
600
+ "select",
601
+ "multiselect",
602
+ "radio",
603
+ "checkbox",
604
+ "date",
605
+ "file",
606
+ "company",
607
+ "user",
608
+ "slider",
609
+ "computed",
610
+ "repeater"
611
+ ]
612
+ },
613
+ label: { type: "string" },
614
+ description: { type: "string" },
615
+ helperText: { type: "string" },
616
+ placeholder: { type: "string" },
617
+ required: { type: "boolean" },
618
+ defaultValue: {},
619
+ options: {
620
+ type: "array",
621
+ items: {
622
+ type: "object",
623
+ properties: { label: { type: "string" }, value: { type: "string" } },
624
+ required: ["label", "value"]
625
+ }
626
+ },
627
+ dataSource: { enum: ["companies", "users"] },
628
+ validation: {
629
+ type: "object",
630
+ properties: {
631
+ min: { type: "number" },
632
+ max: { type: "number" },
633
+ minLength: { type: "number" },
634
+ maxLength: { type: "number" },
635
+ pattern: { type: "string" },
636
+ message: { type: "string" },
637
+ unit: { type: "string" }
638
+ }
639
+ },
640
+ pattern: { type: "string" },
641
+ min: { type: "number" },
642
+ max: { type: "number" },
643
+ step: { type: "number" },
644
+ minItems: { type: "number" },
645
+ maxItems: { type: "number" },
646
+ formula: { type: "string" },
647
+ computed: { type: "object", properties: { formula: { type: "string" } } },
648
+ visibleWhen: formJsonCondition,
649
+ condition: formJsonCondition,
650
+ itemControls: { type: "array", items: { $ref: "#/$defs/control" } },
651
+ controls: { type: "array", items: { $ref: "#/$defs/control" } }
652
+ },
653
+ required: ["id", "type", "label"]
654
+ };
655
+ var FORM_SCHEMA_JSON_SCHEMA = {
656
+ $schema: "https://json-schema.org/draft/2020-12/schema",
657
+ $id: "https://workspace.local/schemas/generative-forms/form-schema-v1.json",
658
+ type: "object",
659
+ $defs: { control: formJsonControl },
660
+ properties: {
661
+ id: { type: "string" },
662
+ title: { type: "string" },
663
+ description: { type: "string" },
664
+ version: { type: ["string", "number"] },
665
+ stages: {
666
+ type: "array",
667
+ items: {
668
+ type: "object",
669
+ properties: {
670
+ id: { type: "string" },
671
+ title: { type: "string" },
672
+ description: { type: "string" },
673
+ gate: { type: "string" },
674
+ sections: {
675
+ type: "array",
676
+ items: {
677
+ type: "object",
678
+ properties: {
679
+ id: { type: "string" },
680
+ title: { type: "string" },
681
+ description: { type: "string" },
682
+ controls: { type: "array", items: { $ref: "#/$defs/control" } },
683
+ visibleWhen: formJsonCondition,
684
+ condition: formJsonCondition
685
+ },
686
+ required: ["id", "title", "controls"]
687
+ }
688
+ }
689
+ },
690
+ required: ["id", "title", "sections"]
691
+ }
692
+ },
693
+ decisionGates: {
694
+ type: "array",
695
+ items: {
696
+ type: "object",
697
+ properties: {
698
+ id: { type: "string" },
699
+ title: { type: "string" },
700
+ description: { type: "string" },
701
+ stageId: { type: "string" },
702
+ kind: { enum: ["approval", "review", "decision"] },
703
+ trigger: { type: "string" },
704
+ requiredAction: { type: "string" },
705
+ consequence: { type: "string" },
706
+ condition: { anyOf: [formJsonCondition, { type: "string" }] },
707
+ blocking: { type: "boolean" },
708
+ reviewerRole: { type: "string" }
709
+ },
710
+ required: ["id", "title", "stageId", "blocking"]
711
+ }
712
+ },
713
+ validators: {
714
+ type: "array",
715
+ items: {
716
+ type: "object",
717
+ properties: {
718
+ id: { type: "string" },
719
+ description: { type: "string" },
720
+ fields: { type: "array", items: { type: "string" } },
721
+ severity: { type: "string" },
722
+ type: { type: "string" },
723
+ config: {}
724
+ },
725
+ required: ["id"]
726
+ }
727
+ },
728
+ handoffActions: {
729
+ type: "array",
730
+ items: {
731
+ type: "object",
732
+ properties: {
733
+ id: { type: "string" },
734
+ label: { type: "string" },
735
+ destination: { type: "string" },
736
+ condition: { anyOf: [formJsonCondition, { type: "string" }] },
737
+ payloadFields: { type: "array", items: { type: "string" } },
738
+ type: { type: "string" },
739
+ config: {}
740
+ }
741
+ }
742
+ },
743
+ review: {
744
+ type: "object",
745
+ properties: {
746
+ humanReviewRequired: { type: "boolean" },
747
+ reviewAreas: { type: "array", items: { type: "string" } }
748
+ },
749
+ required: ["humanReviewRequired", "reviewAreas"]
750
+ },
751
+ reviewMetadata: {
752
+ type: "object",
753
+ properties: {
754
+ approvers: { type: "array", items: { type: "string" } },
755
+ requirements: { type: "array", items: { type: "string" } }
756
+ },
757
+ required: ["approvers", "requirements"]
758
+ },
759
+ scoring: {
760
+ type: "object",
761
+ properties: {
762
+ description: { type: "string" },
763
+ dimensions: {
764
+ type: "array",
765
+ minItems: 1,
766
+ items: {
767
+ type: "object",
768
+ properties: {
769
+ id: { type: "string" },
770
+ label: { type: "string" },
771
+ description: { type: "string" },
772
+ weight: { type: "number" },
773
+ rules: {
774
+ type: "array",
775
+ minItems: 1,
776
+ items: {
777
+ type: "object",
778
+ properties: {
779
+ field: { type: "string" },
780
+ optionPoints: {
781
+ type: "object",
782
+ additionalProperties: { type: "number" }
783
+ },
784
+ ranges: {
785
+ type: "array",
786
+ items: {
787
+ type: "object",
788
+ properties: {
789
+ min: { type: "number" },
790
+ max: { type: "number" },
791
+ points: { type: "number" }
792
+ },
793
+ required: ["points"]
794
+ }
795
+ },
796
+ multiplier: { type: "number" },
797
+ truePoints: { type: "number" },
798
+ falsePoints: { type: "number" }
799
+ },
800
+ required: ["field"]
801
+ }
802
+ }
803
+ },
804
+ required: ["id", "label", "rules"]
805
+ }
806
+ },
807
+ bands: {
808
+ type: "array",
809
+ items: {
810
+ type: "object",
811
+ properties: {
812
+ id: { type: "string" },
813
+ label: { type: "string" },
814
+ min: { type: "number" },
815
+ max: { type: "number" }
816
+ },
817
+ required: ["id", "label", "min"]
818
+ }
819
+ }
820
+ },
821
+ required: ["dimensions"]
822
+ }
823
+ },
824
+ required: ["version", "stages"]
825
+ };
333
826
  // Annotate the CommonJS export names for ESM import in node:
334
827
  0 && (module.exports = {
335
828
  AgentConfigSchema,
@@ -346,8 +839,24 @@ var QueueJobSchema = import_zod.z.object({
346
839
  CodeGenerationSchema,
347
840
  ComponentPropDefinitionSchema,
348
841
  ComponentSynthesisSchema,
842
+ ConditionOperatorSchema,
843
+ ConditionSchema,
844
+ ControlValidationSchema,
845
+ DecisionGateKindSchema,
846
+ DecisionGateSchema,
847
+ DimensionScoreSchema,
349
848
  DropShadowSchema,
849
+ FORM_SCHEMA_JSON_SCHEMA,
350
850
  FidelitySchema,
851
+ FormControlSchema,
852
+ FormControlTypeSchema,
853
+ FormHandoffActionSchema,
854
+ FormOptionSchema,
855
+ FormReviewMetaSchema,
856
+ FormSectionSchema,
857
+ FormStageSchema,
858
+ FormSubmissionPayloadSchema,
859
+ FormValidatorSchema,
351
860
  ImageCompositingSchema,
352
861
  ImageGenerationSchema,
353
862
  ImageTextOverlaySchema,
@@ -357,8 +866,18 @@ var QueueJobSchema = import_zod.z.object({
357
866
  QueueJobSchema,
358
867
  QueueJobStatusSchema,
359
868
  QueueJobTypeSchema,
869
+ ReferenceDataSourceSchema,
870
+ ScoreBandSchema,
871
+ ScoringConfigSchema,
872
+ ScoringDimensionSchema,
873
+ ScoringRuleSchema,
874
+ SemanticReviewIssueSchema,
875
+ SemanticReviewResultSchema,
876
+ SemanticReviewStatusSchema,
360
877
  ServiceClientSchema,
361
878
  SocialVideoGenerationSchema,
879
+ SubmissionScoreSchema,
880
+ TechnicalFormSchema,
362
881
  TextAlignmentSchema,
363
882
  TextOverlayPositionSchema,
364
883
  VideoAnalysisCategorySchema,