@pixerate/schemas 1.3.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
@@ -41,6 +41,7 @@ __export(index_exports, {
41
41
  DecisionGateSchema: () => DecisionGateSchema,
42
42
  DimensionScoreSchema: () => DimensionScoreSchema,
43
43
  DropShadowSchema: () => DropShadowSchema,
44
+ FORM_SCHEMA_JSON_SCHEMA: () => FORM_SCHEMA_JSON_SCHEMA,
44
45
  FidelitySchema: () => FidelitySchema,
45
46
  FormControlSchema: () => FormControlSchema,
46
47
  FormControlTypeSchema: () => FormControlTypeSchema,
@@ -564,6 +565,264 @@ var FormSubmissionPayloadSchema = import_zod.z.object({
564
565
  submittedAt: import_zod.z.string().optional(),
565
566
  score: SubmissionScoreSchema.optional()
566
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
+ };
567
826
  // Annotate the CommonJS export names for ESM import in node:
568
827
  0 && (module.exports = {
569
828
  AgentConfigSchema,
@@ -587,6 +846,7 @@ var FormSubmissionPayloadSchema = import_zod.z.object({
587
846
  DecisionGateSchema,
588
847
  DimensionScoreSchema,
589
848
  DropShadowSchema,
849
+ FORM_SCHEMA_JSON_SCHEMA,
590
850
  FidelitySchema,
591
851
  FormControlSchema,
592
852
  FormControlTypeSchema,