@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 +260 -0
- package/dist/index.d.cts +523 -1
- package/dist/index.d.ts +523 -1
- package/dist/index.js +259 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -476,6 +476,264 @@ var FormSubmissionPayloadSchema = z.object({
|
|
|
476
476
|
submittedAt: z.string().optional(),
|
|
477
477
|
score: SubmissionScoreSchema.optional()
|
|
478
478
|
});
|
|
479
|
+
var formJsonCondition = {
|
|
480
|
+
type: "object",
|
|
481
|
+
properties: {
|
|
482
|
+
field: { type: "string" },
|
|
483
|
+
fieldId: { type: "string" },
|
|
484
|
+
operator: {
|
|
485
|
+
enum: [
|
|
486
|
+
"equals",
|
|
487
|
+
"notEquals",
|
|
488
|
+
"not_equals",
|
|
489
|
+
"includes",
|
|
490
|
+
"contains",
|
|
491
|
+
"greaterThan",
|
|
492
|
+
"greater_than",
|
|
493
|
+
"lessThan",
|
|
494
|
+
"less_than",
|
|
495
|
+
"exists"
|
|
496
|
+
]
|
|
497
|
+
},
|
|
498
|
+
value: { type: ["string", "number", "boolean"] }
|
|
499
|
+
},
|
|
500
|
+
required: ["operator"]
|
|
501
|
+
};
|
|
502
|
+
var formJsonControl = {
|
|
503
|
+
type: "object",
|
|
504
|
+
properties: {
|
|
505
|
+
id: { type: "string" },
|
|
506
|
+
type: {
|
|
507
|
+
enum: [
|
|
508
|
+
"text",
|
|
509
|
+
"textarea",
|
|
510
|
+
"number",
|
|
511
|
+
"select",
|
|
512
|
+
"multiselect",
|
|
513
|
+
"radio",
|
|
514
|
+
"checkbox",
|
|
515
|
+
"date",
|
|
516
|
+
"file",
|
|
517
|
+
"company",
|
|
518
|
+
"user",
|
|
519
|
+
"slider",
|
|
520
|
+
"computed",
|
|
521
|
+
"repeater"
|
|
522
|
+
]
|
|
523
|
+
},
|
|
524
|
+
label: { type: "string" },
|
|
525
|
+
description: { type: "string" },
|
|
526
|
+
helperText: { type: "string" },
|
|
527
|
+
placeholder: { type: "string" },
|
|
528
|
+
required: { type: "boolean" },
|
|
529
|
+
defaultValue: {},
|
|
530
|
+
options: {
|
|
531
|
+
type: "array",
|
|
532
|
+
items: {
|
|
533
|
+
type: "object",
|
|
534
|
+
properties: { label: { type: "string" }, value: { type: "string" } },
|
|
535
|
+
required: ["label", "value"]
|
|
536
|
+
}
|
|
537
|
+
},
|
|
538
|
+
dataSource: { enum: ["companies", "users"] },
|
|
539
|
+
validation: {
|
|
540
|
+
type: "object",
|
|
541
|
+
properties: {
|
|
542
|
+
min: { type: "number" },
|
|
543
|
+
max: { type: "number" },
|
|
544
|
+
minLength: { type: "number" },
|
|
545
|
+
maxLength: { type: "number" },
|
|
546
|
+
pattern: { type: "string" },
|
|
547
|
+
message: { type: "string" },
|
|
548
|
+
unit: { type: "string" }
|
|
549
|
+
}
|
|
550
|
+
},
|
|
551
|
+
pattern: { type: "string" },
|
|
552
|
+
min: { type: "number" },
|
|
553
|
+
max: { type: "number" },
|
|
554
|
+
step: { type: "number" },
|
|
555
|
+
minItems: { type: "number" },
|
|
556
|
+
maxItems: { type: "number" },
|
|
557
|
+
formula: { type: "string" },
|
|
558
|
+
computed: { type: "object", properties: { formula: { type: "string" } } },
|
|
559
|
+
visibleWhen: formJsonCondition,
|
|
560
|
+
condition: formJsonCondition,
|
|
561
|
+
itemControls: { type: "array", items: { $ref: "#/$defs/control" } },
|
|
562
|
+
controls: { type: "array", items: { $ref: "#/$defs/control" } }
|
|
563
|
+
},
|
|
564
|
+
required: ["id", "type", "label"]
|
|
565
|
+
};
|
|
566
|
+
var FORM_SCHEMA_JSON_SCHEMA = {
|
|
567
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
568
|
+
$id: "https://workspace.local/schemas/generative-forms/form-schema-v1.json",
|
|
569
|
+
type: "object",
|
|
570
|
+
$defs: { control: formJsonControl },
|
|
571
|
+
properties: {
|
|
572
|
+
id: { type: "string" },
|
|
573
|
+
title: { type: "string" },
|
|
574
|
+
description: { type: "string" },
|
|
575
|
+
version: { type: ["string", "number"] },
|
|
576
|
+
stages: {
|
|
577
|
+
type: "array",
|
|
578
|
+
items: {
|
|
579
|
+
type: "object",
|
|
580
|
+
properties: {
|
|
581
|
+
id: { type: "string" },
|
|
582
|
+
title: { type: "string" },
|
|
583
|
+
description: { type: "string" },
|
|
584
|
+
gate: { type: "string" },
|
|
585
|
+
sections: {
|
|
586
|
+
type: "array",
|
|
587
|
+
items: {
|
|
588
|
+
type: "object",
|
|
589
|
+
properties: {
|
|
590
|
+
id: { type: "string" },
|
|
591
|
+
title: { type: "string" },
|
|
592
|
+
description: { type: "string" },
|
|
593
|
+
controls: { type: "array", items: { $ref: "#/$defs/control" } },
|
|
594
|
+
visibleWhen: formJsonCondition,
|
|
595
|
+
condition: formJsonCondition
|
|
596
|
+
},
|
|
597
|
+
required: ["id", "title", "controls"]
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
},
|
|
601
|
+
required: ["id", "title", "sections"]
|
|
602
|
+
}
|
|
603
|
+
},
|
|
604
|
+
decisionGates: {
|
|
605
|
+
type: "array",
|
|
606
|
+
items: {
|
|
607
|
+
type: "object",
|
|
608
|
+
properties: {
|
|
609
|
+
id: { type: "string" },
|
|
610
|
+
title: { type: "string" },
|
|
611
|
+
description: { type: "string" },
|
|
612
|
+
stageId: { type: "string" },
|
|
613
|
+
kind: { enum: ["approval", "review", "decision"] },
|
|
614
|
+
trigger: { type: "string" },
|
|
615
|
+
requiredAction: { type: "string" },
|
|
616
|
+
consequence: { type: "string" },
|
|
617
|
+
condition: { anyOf: [formJsonCondition, { type: "string" }] },
|
|
618
|
+
blocking: { type: "boolean" },
|
|
619
|
+
reviewerRole: { type: "string" }
|
|
620
|
+
},
|
|
621
|
+
required: ["id", "title", "stageId", "blocking"]
|
|
622
|
+
}
|
|
623
|
+
},
|
|
624
|
+
validators: {
|
|
625
|
+
type: "array",
|
|
626
|
+
items: {
|
|
627
|
+
type: "object",
|
|
628
|
+
properties: {
|
|
629
|
+
id: { type: "string" },
|
|
630
|
+
description: { type: "string" },
|
|
631
|
+
fields: { type: "array", items: { type: "string" } },
|
|
632
|
+
severity: { type: "string" },
|
|
633
|
+
type: { type: "string" },
|
|
634
|
+
config: {}
|
|
635
|
+
},
|
|
636
|
+
required: ["id"]
|
|
637
|
+
}
|
|
638
|
+
},
|
|
639
|
+
handoffActions: {
|
|
640
|
+
type: "array",
|
|
641
|
+
items: {
|
|
642
|
+
type: "object",
|
|
643
|
+
properties: {
|
|
644
|
+
id: { type: "string" },
|
|
645
|
+
label: { type: "string" },
|
|
646
|
+
destination: { type: "string" },
|
|
647
|
+
condition: { anyOf: [formJsonCondition, { type: "string" }] },
|
|
648
|
+
payloadFields: { type: "array", items: { type: "string" } },
|
|
649
|
+
type: { type: "string" },
|
|
650
|
+
config: {}
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
},
|
|
654
|
+
review: {
|
|
655
|
+
type: "object",
|
|
656
|
+
properties: {
|
|
657
|
+
humanReviewRequired: { type: "boolean" },
|
|
658
|
+
reviewAreas: { type: "array", items: { type: "string" } }
|
|
659
|
+
},
|
|
660
|
+
required: ["humanReviewRequired", "reviewAreas"]
|
|
661
|
+
},
|
|
662
|
+
reviewMetadata: {
|
|
663
|
+
type: "object",
|
|
664
|
+
properties: {
|
|
665
|
+
approvers: { type: "array", items: { type: "string" } },
|
|
666
|
+
requirements: { type: "array", items: { type: "string" } }
|
|
667
|
+
},
|
|
668
|
+
required: ["approvers", "requirements"]
|
|
669
|
+
},
|
|
670
|
+
scoring: {
|
|
671
|
+
type: "object",
|
|
672
|
+
properties: {
|
|
673
|
+
description: { type: "string" },
|
|
674
|
+
dimensions: {
|
|
675
|
+
type: "array",
|
|
676
|
+
minItems: 1,
|
|
677
|
+
items: {
|
|
678
|
+
type: "object",
|
|
679
|
+
properties: {
|
|
680
|
+
id: { type: "string" },
|
|
681
|
+
label: { type: "string" },
|
|
682
|
+
description: { type: "string" },
|
|
683
|
+
weight: { type: "number" },
|
|
684
|
+
rules: {
|
|
685
|
+
type: "array",
|
|
686
|
+
minItems: 1,
|
|
687
|
+
items: {
|
|
688
|
+
type: "object",
|
|
689
|
+
properties: {
|
|
690
|
+
field: { type: "string" },
|
|
691
|
+
optionPoints: {
|
|
692
|
+
type: "object",
|
|
693
|
+
additionalProperties: { type: "number" }
|
|
694
|
+
},
|
|
695
|
+
ranges: {
|
|
696
|
+
type: "array",
|
|
697
|
+
items: {
|
|
698
|
+
type: "object",
|
|
699
|
+
properties: {
|
|
700
|
+
min: { type: "number" },
|
|
701
|
+
max: { type: "number" },
|
|
702
|
+
points: { type: "number" }
|
|
703
|
+
},
|
|
704
|
+
required: ["points"]
|
|
705
|
+
}
|
|
706
|
+
},
|
|
707
|
+
multiplier: { type: "number" },
|
|
708
|
+
truePoints: { type: "number" },
|
|
709
|
+
falsePoints: { type: "number" }
|
|
710
|
+
},
|
|
711
|
+
required: ["field"]
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
},
|
|
715
|
+
required: ["id", "label", "rules"]
|
|
716
|
+
}
|
|
717
|
+
},
|
|
718
|
+
bands: {
|
|
719
|
+
type: "array",
|
|
720
|
+
items: {
|
|
721
|
+
type: "object",
|
|
722
|
+
properties: {
|
|
723
|
+
id: { type: "string" },
|
|
724
|
+
label: { type: "string" },
|
|
725
|
+
min: { type: "number" },
|
|
726
|
+
max: { type: "number" }
|
|
727
|
+
},
|
|
728
|
+
required: ["id", "label", "min"]
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
},
|
|
732
|
+
required: ["dimensions"]
|
|
733
|
+
}
|
|
734
|
+
},
|
|
735
|
+
required: ["version", "stages"]
|
|
736
|
+
};
|
|
479
737
|
export {
|
|
480
738
|
AgentConfigSchema,
|
|
481
739
|
AgentDocumentAttachmentSchema,
|
|
@@ -498,6 +756,7 @@ export {
|
|
|
498
756
|
DecisionGateSchema,
|
|
499
757
|
DimensionScoreSchema,
|
|
500
758
|
DropShadowSchema,
|
|
759
|
+
FORM_SCHEMA_JSON_SCHEMA,
|
|
501
760
|
FidelitySchema,
|
|
502
761
|
FormControlSchema,
|
|
503
762
|
FormControlTypeSchema,
|