@treeseed/sdk 0.13.0-rc.124 → 0.13.0-rc.125

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.
@@ -319,14 +319,14 @@ export declare function validatePortableContentData(model: string, value: unknow
319
319
  maxLatencyMs?: number | undefined;
320
320
  } | {
321
321
  id: string;
322
- format: "map" | "summary" | "list" | "brief" | "full" | "sources";
323
- title: string;
324
- description: string;
325
322
  target: {
326
323
  kind: "code" | "content" | "mixed" | "graph";
327
324
  models?: string[] | undefined;
328
325
  paths?: string[] | undefined;
329
326
  };
327
+ format: "map" | "summary" | "list" | "brief" | "full" | "sources";
328
+ title: string;
329
+ description: string;
330
330
  query: string;
331
331
  revision: number;
332
332
  purpose: string;
@@ -438,42 +438,42 @@ export declare function validatePortableContentData(model: string, value: unknow
438
438
  evidenceRefs?: {
439
439
  id: string;
440
440
  model: string;
441
- store: "treedx" | "git" | "postgresql" | "url";
441
+ store: "url" | "treedx" | "git" | "postgresql";
442
442
  path?: string | undefined;
443
443
  anchor?: string | undefined;
444
+ url?: string | undefined;
444
445
  commit?: string | undefined;
445
446
  repository?: string | undefined;
446
447
  revision?: number | undefined;
447
448
  digest?: string | undefined;
448
- url?: string | undefined;
449
449
  startLine?: number | undefined;
450
450
  endLine?: number | undefined;
451
451
  }[] | undefined;
452
452
  objectiveRefs?: {
453
453
  id: string;
454
454
  model: string;
455
- store: "treedx" | "git" | "postgresql" | "url";
455
+ store: "url" | "treedx" | "git" | "postgresql";
456
456
  path?: string | undefined;
457
457
  anchor?: string | undefined;
458
+ url?: string | undefined;
458
459
  commit?: string | undefined;
459
460
  repository?: string | undefined;
460
461
  revision?: number | undefined;
461
462
  digest?: string | undefined;
462
- url?: string | undefined;
463
463
  startLine?: number | undefined;
464
464
  endLine?: number | undefined;
465
465
  }[] | undefined;
466
466
  discussionRef?: {
467
467
  id: string;
468
468
  model: string;
469
- store: "treedx" | "git" | "postgresql" | "url";
469
+ store: "url" | "treedx" | "git" | "postgresql";
470
470
  path?: string | undefined;
471
471
  anchor?: string | undefined;
472
+ url?: string | undefined;
472
473
  commit?: string | undefined;
473
474
  repository?: string | undefined;
474
475
  revision?: number | undefined;
475
476
  digest?: string | undefined;
476
- url?: string | undefined;
477
477
  startLine?: number | undefined;
478
478
  endLine?: number | undefined;
479
479
  } | undefined;
@@ -482,7 +482,7 @@ export declare function validatePortableContentData(model: string, value: unknow
482
482
  id: string;
483
483
  objective: string;
484
484
  agentClass: string;
485
- review: "required" | "none";
485
+ review: "none" | "required";
486
486
  dependsOn: string[];
487
487
  activity: "acting";
488
488
  acceptanceCriteria: string[];
@@ -504,14 +504,14 @@ export declare function validatePortableContentData(model: string, value: unknow
504
504
  contextRefs?: {
505
505
  id: string;
506
506
  model: string;
507
- store: "treedx" | "git" | "postgresql" | "url";
507
+ store: "url" | "treedx" | "git" | "postgresql";
508
508
  path?: string | undefined;
509
509
  anchor?: string | undefined;
510
+ url?: string | undefined;
510
511
  commit?: string | undefined;
511
512
  repository?: string | undefined;
512
513
  revision?: number | undefined;
513
514
  digest?: string | undefined;
514
- url?: string | undefined;
515
515
  startLine?: number | undefined;
516
516
  endLine?: number | undefined;
517
517
  }[] | undefined;
@@ -542,14 +542,14 @@ export declare function validatePortableContentData(model: string, value: unknow
542
542
  subjectRefs: {
543
543
  id: string;
544
544
  model: string;
545
- store: "treedx" | "git" | "postgresql" | "url";
545
+ store: "url" | "treedx" | "git" | "postgresql";
546
546
  path?: string | undefined;
547
547
  anchor?: string | undefined;
548
+ url?: string | undefined;
548
549
  commit?: string | undefined;
549
550
  repository?: string | undefined;
550
551
  revision?: number | undefined;
551
552
  digest?: string | undefined;
552
- url?: string | undefined;
553
553
  startLine?: number | undefined;
554
554
  endLine?: number | undefined;
555
555
  }[];
@@ -559,14 +559,14 @@ export declare function validatePortableContentData(model: string, value: unknow
559
559
  from: {
560
560
  id: string;
561
561
  model: string;
562
- store: "treedx" | "git" | "postgresql" | "url";
562
+ store: "url" | "treedx" | "git" | "postgresql";
563
563
  path?: string | undefined;
564
564
  anchor?: string | undefined;
565
+ url?: string | undefined;
565
566
  commit?: string | undefined;
566
567
  repository?: string | undefined;
567
568
  revision?: number | undefined;
568
569
  digest?: string | undefined;
569
- url?: string | undefined;
570
570
  startLine?: number | undefined;
571
571
  endLine?: number | undefined;
572
572
  } & {
@@ -575,14 +575,14 @@ export declare function validatePortableContentData(model: string, value: unknow
575
575
  to: {
576
576
  id: string;
577
577
  model: string;
578
- store: "treedx" | "git" | "postgresql" | "url";
578
+ store: "url" | "treedx" | "git" | "postgresql";
579
579
  path?: string | undefined;
580
580
  anchor?: string | undefined;
581
+ url?: string | undefined;
581
582
  commit?: string | undefined;
582
583
  repository?: string | undefined;
583
584
  revision?: number | undefined;
584
585
  digest?: string | undefined;
585
- url?: string | undefined;
586
586
  startLine?: number | undefined;
587
587
  endLine?: number | undefined;
588
588
  } & {
@@ -598,14 +598,14 @@ export declare function validatePortableContentData(model: string, value: unknow
598
598
  subjectRef: {
599
599
  id: string;
600
600
  model: string;
601
- store: "treedx" | "git" | "postgresql" | "url";
601
+ store: "url" | "treedx" | "git" | "postgresql";
602
602
  path?: string | undefined;
603
603
  anchor?: string | undefined;
604
+ url?: string | undefined;
604
605
  commit?: string | undefined;
605
606
  repository?: string | undefined;
606
607
  revision?: number | undefined;
607
608
  digest?: string | undefined;
608
- url?: string | undefined;
609
609
  startLine?: number | undefined;
610
610
  endLine?: number | undefined;
611
611
  };
@@ -615,14 +615,14 @@ export declare function validatePortableContentData(model: string, value: unknow
615
615
  answerRefs?: {
616
616
  id: string;
617
617
  model: string;
618
- store: "treedx" | "git" | "postgresql" | "url";
618
+ store: "url" | "treedx" | "git" | "postgresql";
619
619
  path?: string | undefined;
620
620
  anchor?: string | undefined;
621
+ url?: string | undefined;
621
622
  commit?: string | undefined;
622
623
  repository?: string | undefined;
623
624
  revision?: number | undefined;
624
625
  digest?: string | undefined;
625
- url?: string | undefined;
626
626
  startLine?: number | undefined;
627
627
  endLine?: number | undefined;
628
628
  }[] | undefined;
@@ -637,14 +637,14 @@ export declare function validatePortableContentData(model: string, value: unknow
637
637
  evidenceRefs?: {
638
638
  id: string;
639
639
  model: string;
640
- store: "treedx" | "git" | "postgresql" | "url";
640
+ store: "url" | "treedx" | "git" | "postgresql";
641
641
  path?: string | undefined;
642
642
  anchor?: string | undefined;
643
+ url?: string | undefined;
643
644
  commit?: string | undefined;
644
645
  repository?: string | undefined;
645
646
  revision?: number | undefined;
646
647
  digest?: string | undefined;
647
- url?: string | undefined;
648
648
  startLine?: number | undefined;
649
649
  endLine?: number | undefined;
650
650
  }[] | undefined;
@@ -656,28 +656,28 @@ export declare function validatePortableContentData(model: string, value: unknow
656
656
  authorityRefs: {
657
657
  id: string;
658
658
  model: string;
659
- store: "treedx" | "git" | "postgresql" | "url";
659
+ store: "url" | "treedx" | "git" | "postgresql";
660
660
  path?: string | undefined;
661
661
  anchor?: string | undefined;
662
+ url?: string | undefined;
662
663
  commit?: string | undefined;
663
664
  repository?: string | undefined;
664
665
  revision?: number | undefined;
665
666
  digest?: string | undefined;
666
- url?: string | undefined;
667
667
  startLine?: number | undefined;
668
668
  endLine?: number | undefined;
669
669
  }[];
670
670
  subjectRef: {
671
671
  id: string;
672
672
  model: string;
673
- store: "treedx" | "git" | "postgresql" | "url";
673
+ store: "url" | "treedx" | "git" | "postgresql";
674
674
  path?: string | undefined;
675
675
  anchor?: string | undefined;
676
+ url?: string | undefined;
676
677
  commit?: string | undefined;
677
678
  repository?: string | undefined;
678
679
  revision?: number | undefined;
679
680
  digest?: string | undefined;
680
- url?: string | undefined;
681
681
  startLine?: number | undefined;
682
682
  endLine?: number | undefined;
683
683
  };
@@ -687,14 +687,14 @@ export declare function validatePortableContentData(model: string, value: unknow
687
687
  decidedByRefs: {
688
688
  id: string;
689
689
  model: string;
690
- store: "treedx" | "git" | "postgresql" | "url";
690
+ store: "url" | "treedx" | "git" | "postgresql";
691
691
  path?: string | undefined;
692
692
  anchor?: string | undefined;
693
+ url?: string | undefined;
693
694
  commit?: string | undefined;
694
695
  repository?: string | undefined;
695
696
  revision?: number | undefined;
696
697
  digest?: string | undefined;
697
- url?: string | undefined;
698
698
  startLine?: number | undefined;
699
699
  endLine?: number | undefined;
700
700
  }[];
@@ -702,14 +702,14 @@ export declare function validatePortableContentData(model: string, value: unknow
702
702
  findingRefs?: {
703
703
  id: string;
704
704
  model: string;
705
- store: "treedx" | "git" | "postgresql" | "url";
705
+ store: "url" | "treedx" | "git" | "postgresql";
706
706
  path?: string | undefined;
707
707
  anchor?: string | undefined;
708
+ url?: string | undefined;
708
709
  commit?: string | undefined;
709
710
  repository?: string | undefined;
710
711
  revision?: number | undefined;
711
712
  digest?: string | undefined;
712
- url?: string | undefined;
713
713
  startLine?: number | undefined;
714
714
  endLine?: number | undefined;
715
715
  }[] | undefined;
@@ -717,14 +717,14 @@ export declare function validatePortableContentData(model: string, value: unknow
717
717
  actorRef: {
718
718
  id: string;
719
719
  model: string;
720
- store: "treedx" | "git" | "postgresql" | "url";
720
+ store: "url" | "treedx" | "git" | "postgresql";
721
721
  path?: string | undefined;
722
722
  anchor?: string | undefined;
723
+ url?: string | undefined;
723
724
  commit?: string | undefined;
724
725
  repository?: string | undefined;
725
726
  revision?: number | undefined;
726
727
  digest?: string | undefined;
727
- url?: string | undefined;
728
728
  startLine?: number | undefined;
729
729
  endLine?: number | undefined;
730
730
  };
@@ -765,14 +765,14 @@ export declare function validatePortableContentData(model: string, value: unknow
765
765
  bookRef: {
766
766
  id: string;
767
767
  model: string;
768
- store: "treedx" | "git" | "postgresql" | "url";
768
+ store: "url" | "treedx" | "git" | "postgresql";
769
769
  path?: string | undefined;
770
770
  anchor?: string | undefined;
771
+ url?: string | undefined;
771
772
  commit?: string | undefined;
772
773
  repository?: string | undefined;
773
774
  revision?: number | undefined;
774
775
  digest?: string | undefined;
775
- url?: string | undefined;
776
776
  startLine?: number | undefined;
777
777
  endLine?: number | undefined;
778
778
  };
@@ -798,14 +798,14 @@ export declare function validatePortableContentData(model: string, value: unknow
798
798
  relatedRefs?: {
799
799
  id: string;
800
800
  model: string;
801
- store: "treedx" | "git" | "postgresql" | "url";
801
+ store: "url" | "treedx" | "git" | "postgresql";
802
802
  path?: string | undefined;
803
803
  anchor?: string | undefined;
804
+ url?: string | undefined;
804
805
  commit?: string | undefined;
805
806
  repository?: string | undefined;
806
807
  revision?: number | undefined;
807
808
  digest?: string | undefined;
808
- url?: string | undefined;
809
809
  startLine?: number | undefined;
810
810
  endLine?: number | undefined;
811
811
  }[] | undefined;
@@ -836,14 +836,14 @@ export declare function validatePortableContentData(model: string, value: unknow
836
836
  subjectRef: {
837
837
  id: string;
838
838
  model: string;
839
- store: "treedx" | "git" | "postgresql" | "url";
839
+ store: "url" | "treedx" | "git" | "postgresql";
840
840
  path?: string | undefined;
841
841
  anchor?: string | undefined;
842
+ url?: string | undefined;
842
843
  commit?: string | undefined;
843
844
  repository?: string | undefined;
844
845
  revision?: number | undefined;
845
846
  digest?: string | undefined;
846
- url?: string | undefined;
847
847
  startLine?: number | undefined;
848
848
  endLine?: number | undefined;
849
849
  };
@@ -863,28 +863,28 @@ export declare function validatePortableContentData(model: string, value: unknow
863
863
  discussionRef: {
864
864
  id: string;
865
865
  model: string;
866
- store: "treedx" | "git" | "postgresql" | "url";
866
+ store: "url" | "treedx" | "git" | "postgresql";
867
867
  path?: string | undefined;
868
868
  anchor?: string | undefined;
869
+ url?: string | undefined;
869
870
  commit?: string | undefined;
870
871
  repository?: string | undefined;
871
872
  revision?: number | undefined;
872
873
  digest?: string | undefined;
873
- url?: string | undefined;
874
874
  startLine?: number | undefined;
875
875
  endLine?: number | undefined;
876
876
  };
877
877
  authorRef: {
878
878
  id: string;
879
879
  model: string;
880
- store: "treedx" | "git" | "postgresql" | "url";
880
+ store: "url" | "treedx" | "git" | "postgresql";
881
881
  path?: string | undefined;
882
882
  anchor?: string | undefined;
883
+ url?: string | undefined;
883
884
  commit?: string | undefined;
884
885
  repository?: string | undefined;
885
886
  revision?: number | undefined;
886
887
  digest?: string | undefined;
887
- url?: string | undefined;
888
888
  startLine?: number | undefined;
889
889
  endLine?: number | undefined;
890
890
  };
@@ -895,14 +895,14 @@ export declare function validatePortableContentData(model: string, value: unknow
895
895
  replyToRef?: {
896
896
  id: string;
897
897
  model: string;
898
- store: "treedx" | "git" | "postgresql" | "url";
898
+ store: "url" | "treedx" | "git" | "postgresql";
899
899
  path?: string | undefined;
900
900
  anchor?: string | undefined;
901
+ url?: string | undefined;
901
902
  commit?: string | undefined;
902
903
  repository?: string | undefined;
903
904
  revision?: number | undefined;
904
905
  digest?: string | undefined;
905
- url?: string | undefined;
906
906
  startLine?: number | undefined;
907
907
  endLine?: number | undefined;
908
908
  } | undefined;
@@ -916,14 +916,14 @@ export declare function validatePortableContentData(model: string, value: unknow
916
916
  sourceMessageRefs?: {
917
917
  id: string;
918
918
  model: string;
919
- store: "treedx" | "git" | "postgresql" | "url";
919
+ store: "url" | "treedx" | "git" | "postgresql";
920
920
  path?: string | undefined;
921
921
  anchor?: string | undefined;
922
+ url?: string | undefined;
922
923
  commit?: string | undefined;
923
924
  repository?: string | undefined;
924
925
  revision?: number | undefined;
925
926
  digest?: string | undefined;
926
- url?: string | undefined;
927
927
  startLine?: number | undefined;
928
928
  endLine?: number | undefined;
929
929
  }[] | undefined;
@@ -1,5 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { type PostProcessCallback } from 'zod-to-json-schema';
3
+ /** Validate with the owning parser without changing the caller's property order. */
4
+ export declare function preserveInputOrder<T extends z.ZodType<Record<string, unknown>>>(parser: T): z.ZodEffects<z.ZodType<Record<string, unknown>, z.ZodTypeDef, Record<string, unknown>>, z.output<T>, Record<string, unknown>>;
3
5
  /** Preserve inherited validation while requiring represented properties. */
4
6
  export declare function requiredProperties<T extends z.AnyZodObject>(object: T, fields: readonly string[], message: string): z.ZodEffects<T, {
5
7
  [x: string]: any;
@@ -1,6 +1,26 @@
1
1
  import { z } from "zod";
2
2
  import { zodToJsonSchema } from "zod-to-json-schema";
3
3
  const exporters = /* @__PURE__ */ new WeakMap();
4
+ function preserveInputOrder(parser) {
5
+ const schema = z.custom((value) => Boolean(value && typeof value === "object" && !Array.isArray(value))).transform((value, context) => {
6
+ const parsed = parser.safeParse(value);
7
+ if (!parsed.success) {
8
+ for (const issue of parsed.error.issues) context.addIssue(issue);
9
+ return z.NEVER;
10
+ }
11
+ const ordered = Object.fromEntries(Object.keys(value).filter((key) => Object.hasOwn(parsed.data, key)).map((key) => [key, parsed.data[key]]));
12
+ return { ...ordered, ...parsed.data };
13
+ });
14
+ exporters.set(schema._def, (_exported, refs) => {
15
+ const { $schema: _dialect, ...exported } = zodToJsonSchema(parser, {
16
+ target: refs.target,
17
+ $refStrategy: "none",
18
+ postProcess: exportSchemaConstraints
19
+ });
20
+ return exported;
21
+ });
22
+ return schema;
23
+ }
4
24
  function requiredProperties(object, fields, message) {
5
25
  const schema = object.superRefine((value, context) => {
6
26
  for (const field of fields) if (Object.getOwnPropertyDescriptor(value, field)?.value === void 0)
@@ -121,10 +141,10 @@ function conditionalFields(object, rules) {
121
141
  });
122
142
  return schema;
123
143
  }
124
- const exportSchemaConstraints = (schema, definition) => {
144
+ const exportSchemaConstraints = (schema, definition, refs) => {
125
145
  if ("typeName" in definition && definition.typeName === z.ZodFirstPartyTypeKind.ZodIntersection && "left" in definition && "right" in definition && definition.left instanceof z.ZodType && definition.right instanceof z.ZodType) {
126
146
  return { allOf: [definition.left, definition.right].map((part) => {
127
- const { $schema: _dialect, ...branch } = zodToJsonSchema(part, { $refStrategy: "none", postProcess: exportSchemaConstraints });
147
+ const { $schema: _dialect, ...branch } = zodToJsonSchema(part, { target: refs.target, $refStrategy: "none", postProcess: exportSchemaConstraints });
128
148
  return branch;
129
149
  }) };
130
150
  }
@@ -135,7 +155,7 @@ const exportSchemaConstraints = (schema, definition) => {
135
155
  return schema;
136
156
  }
137
157
  if (!schema) throw new Error("An owning constraint has no exported schema.");
138
- return exportConstraint(schema);
158
+ return exportConstraint(schema, refs);
139
159
  };
140
160
  export {
141
161
  alternativeProperties,
@@ -144,6 +164,7 @@ export {
144
164
  exclusiveUnion,
145
165
  exportSchemaConstraints,
146
166
  minimumProperties,
167
+ preserveInputOrder,
147
168
  requiredProperties,
148
169
  uniqueArray
149
170
  };