@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.js CHANGED
@@ -267,6 +267,473 @@ var QueueJobSchema = z.object({
267
267
  createdAt: z.any().optional(),
268
268
  updatedAt: z.any().optional()
269
269
  });
270
+ var ConditionOperatorSchema = z.enum([
271
+ "equals",
272
+ "notEquals",
273
+ "not_equals",
274
+ "includes",
275
+ "contains",
276
+ "greaterThan",
277
+ "greater_than",
278
+ "lessThan",
279
+ "less_than",
280
+ "exists"
281
+ ]);
282
+ var ConditionSchema = z.object({
283
+ field: z.string().optional(),
284
+ fieldId: z.string().optional(),
285
+ operator: ConditionOperatorSchema,
286
+ value: z.union([z.string(), z.number(), z.boolean()]).optional()
287
+ });
288
+ var ControlValidationSchema = z.object({
289
+ min: z.number().optional(),
290
+ max: z.number().optional(),
291
+ minLength: z.number().optional(),
292
+ maxLength: z.number().optional(),
293
+ pattern: z.string().optional(),
294
+ message: z.string().optional(),
295
+ unit: z.string().optional()
296
+ });
297
+ var FormOptionSchema = z.object({
298
+ label: z.string(),
299
+ value: z.string()
300
+ });
301
+ var ReferenceDataSourceSchema = z.enum(["companies", "users"]);
302
+ var FormControlTypeSchema = z.enum([
303
+ "text",
304
+ "textarea",
305
+ "number",
306
+ "select",
307
+ "multiselect",
308
+ "radio",
309
+ "checkbox",
310
+ "date",
311
+ "file",
312
+ "company",
313
+ "user",
314
+ "slider",
315
+ "computed",
316
+ "repeater"
317
+ ]);
318
+ var FormControlSchema = z.lazy(
319
+ () => z.object({
320
+ id: z.string(),
321
+ type: FormControlTypeSchema,
322
+ label: z.string(),
323
+ description: z.string().optional(),
324
+ helperText: z.string().optional(),
325
+ placeholder: z.string().optional(),
326
+ required: z.boolean().optional(),
327
+ defaultValue: z.any().optional(),
328
+ options: z.array(FormOptionSchema).optional(),
329
+ dataSource: ReferenceDataSourceSchema.optional(),
330
+ validation: ControlValidationSchema.optional(),
331
+ pattern: z.string().optional(),
332
+ min: z.number().optional(),
333
+ max: z.number().optional(),
334
+ step: z.number().optional(),
335
+ minItems: z.number().optional(),
336
+ maxItems: z.number().optional(),
337
+ formula: z.string().optional(),
338
+ computed: z.object({ formula: z.string().optional() }).optional(),
339
+ visibleWhen: ConditionSchema.optional(),
340
+ condition: ConditionSchema.optional(),
341
+ itemControls: z.array(FormControlSchema).optional(),
342
+ controls: z.array(FormControlSchema).optional()
343
+ })
344
+ );
345
+ var FormSectionSchema = z.object({
346
+ id: z.string(),
347
+ title: z.string(),
348
+ description: z.string().optional(),
349
+ controls: z.array(FormControlSchema),
350
+ visibleWhen: ConditionSchema.optional(),
351
+ condition: ConditionSchema.optional()
352
+ });
353
+ var FormStageSchema = z.object({
354
+ id: z.string(),
355
+ title: z.string(),
356
+ description: z.string().optional(),
357
+ sections: z.array(FormSectionSchema),
358
+ gate: z.string().optional()
359
+ });
360
+ var DecisionGateKindSchema = z.enum(["approval", "review", "decision"]);
361
+ var DecisionGateSchema = z.object({
362
+ id: z.string(),
363
+ title: z.string(),
364
+ description: z.string().optional(),
365
+ stageId: z.string(),
366
+ kind: DecisionGateKindSchema.optional(),
367
+ trigger: z.string().optional(),
368
+ requiredAction: z.string().optional(),
369
+ consequence: z.string().optional(),
370
+ condition: z.union([ConditionSchema, z.string()]).optional(),
371
+ blocking: z.boolean(),
372
+ reviewerRole: z.string().optional()
373
+ });
374
+ var ScoringRuleSchema = z.object({
375
+ field: z.string(),
376
+ optionPoints: z.record(z.number()).optional(),
377
+ ranges: z.array(
378
+ z.object({
379
+ min: z.number().optional(),
380
+ max: z.number().optional(),
381
+ points: z.number()
382
+ })
383
+ ).optional(),
384
+ multiplier: z.number().optional(),
385
+ truePoints: z.number().optional(),
386
+ falsePoints: z.number().optional()
387
+ });
388
+ var ScoringDimensionSchema = z.object({
389
+ id: z.string(),
390
+ label: z.string(),
391
+ description: z.string().optional(),
392
+ weight: z.number().optional(),
393
+ rules: z.array(ScoringRuleSchema)
394
+ });
395
+ var ScoreBandSchema = z.object({
396
+ id: z.string(),
397
+ label: z.string(),
398
+ min: z.number(),
399
+ max: z.number().optional()
400
+ });
401
+ var ScoringConfigSchema = z.object({
402
+ description: z.string().optional(),
403
+ dimensions: z.array(ScoringDimensionSchema),
404
+ bands: z.array(ScoreBandSchema).optional()
405
+ });
406
+ var DimensionScoreSchema = z.object({
407
+ dimensionId: z.string(),
408
+ label: z.string(),
409
+ points: z.number(),
410
+ weight: z.number(),
411
+ weighted: z.number()
412
+ });
413
+ var SubmissionScoreSchema = z.object({
414
+ total: z.number(),
415
+ dimensions: z.array(DimensionScoreSchema),
416
+ band: z.object({ id: z.string(), label: z.string() }).optional(),
417
+ calculatedAt: z.string(),
418
+ schemaVersion: z.union([z.string(), z.number()])
419
+ });
420
+ var FormValidatorSchema = z.object({
421
+ id: z.string(),
422
+ description: z.string().optional(),
423
+ fields: z.array(z.string()).optional(),
424
+ severity: z.union([z.enum(["error", "warning"]), z.string()]).optional(),
425
+ type: z.string().optional(),
426
+ config: z.any().optional()
427
+ });
428
+ var FormHandoffActionSchema = z.object({
429
+ id: z.string().optional(),
430
+ label: z.string().optional(),
431
+ destination: z.string().optional(),
432
+ condition: z.union([ConditionSchema, z.string()]).optional(),
433
+ payloadFields: z.array(z.string()).optional(),
434
+ type: z.string().optional(),
435
+ config: z.any().optional()
436
+ });
437
+ var FormReviewMetaSchema = z.object({
438
+ humanReviewRequired: z.boolean(),
439
+ reviewAreas: z.array(z.string())
440
+ });
441
+ var TechnicalFormSchema = z.object({
442
+ id: z.string().optional(),
443
+ title: z.string().optional(),
444
+ description: z.string().optional(),
445
+ version: z.union([z.string(), z.number()]),
446
+ stages: z.array(FormStageSchema),
447
+ decisionGates: z.array(DecisionGateSchema).optional(),
448
+ validators: z.array(FormValidatorSchema).optional(),
449
+ handoffActions: z.array(FormHandoffActionSchema).optional(),
450
+ review: FormReviewMetaSchema.optional(),
451
+ reviewMetadata: z.object({
452
+ approvers: z.array(z.string()),
453
+ requirements: z.array(z.string())
454
+ }).optional(),
455
+ scoring: ScoringConfigSchema.optional()
456
+ });
457
+ var SemanticReviewStatusSchema = z.enum(["pass", "flagged", "unavailable"]);
458
+ var SemanticReviewIssueSchema = z.object({
459
+ id: z.string(),
460
+ severity: z.enum(["warning", "error"]),
461
+ message: z.string(),
462
+ fieldId: z.string().optional(),
463
+ fieldLabel: z.string().optional(),
464
+ suggestion: z.string().optional()
465
+ });
466
+ var SemanticReviewResultSchema = z.object({
467
+ status: SemanticReviewStatusSchema,
468
+ summary: z.string().optional(),
469
+ issues: z.array(SemanticReviewIssueSchema)
470
+ });
471
+ var FormSubmissionPayloadSchema = z.object({
472
+ id: z.string().optional(),
473
+ answers: z.record(z.any()),
474
+ stageReviews: z.array(z.any()).optional(),
475
+ gateDecisions: z.array(z.any()).optional(),
476
+ submittedAt: z.string().optional(),
477
+ score: SubmissionScoreSchema.optional()
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
+ };
270
737
  export {
271
738
  AgentConfigSchema,
272
739
  AgentDocumentAttachmentSchema,
@@ -282,8 +749,24 @@ export {
282
749
  CodeGenerationSchema,
283
750
  ComponentPropDefinitionSchema,
284
751
  ComponentSynthesisSchema,
752
+ ConditionOperatorSchema,
753
+ ConditionSchema,
754
+ ControlValidationSchema,
755
+ DecisionGateKindSchema,
756
+ DecisionGateSchema,
757
+ DimensionScoreSchema,
285
758
  DropShadowSchema,
759
+ FORM_SCHEMA_JSON_SCHEMA,
286
760
  FidelitySchema,
761
+ FormControlSchema,
762
+ FormControlTypeSchema,
763
+ FormHandoffActionSchema,
764
+ FormOptionSchema,
765
+ FormReviewMetaSchema,
766
+ FormSectionSchema,
767
+ FormStageSchema,
768
+ FormSubmissionPayloadSchema,
769
+ FormValidatorSchema,
287
770
  ImageCompositingSchema,
288
771
  ImageGenerationSchema,
289
772
  ImageTextOverlaySchema,
@@ -293,8 +776,18 @@ export {
293
776
  QueueJobSchema,
294
777
  QueueJobStatusSchema,
295
778
  QueueJobTypeSchema,
779
+ ReferenceDataSourceSchema,
780
+ ScoreBandSchema,
781
+ ScoringConfigSchema,
782
+ ScoringDimensionSchema,
783
+ ScoringRuleSchema,
784
+ SemanticReviewIssueSchema,
785
+ SemanticReviewResultSchema,
786
+ SemanticReviewStatusSchema,
296
787
  ServiceClientSchema,
297
788
  SocialVideoGenerationSchema,
789
+ SubmissionScoreSchema,
790
+ TechnicalFormSchema,
298
791
  TextAlignmentSchema,
299
792
  TextOverlayPositionSchema,
300
793
  VideoAnalysisCategorySchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/schemas",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",