circuit-json 0.0.320 → 0.0.322

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/README.md CHANGED
@@ -453,6 +453,7 @@ interface SourcePort {
453
453
  source_group_id?: string
454
454
  subcircuit_id?: string
455
455
  subcircuit_connectivity_map_key?: string
456
+ must_be_connected?: boolean
456
457
  }
457
458
  ```
458
459
 
@@ -2712,17 +2713,19 @@ interface SimulationUnknownExperimentError {
2712
2713
 
2713
2714
  [Source](https://github.com/tscircuit/circuit-json/blob/main/src/simulation/simulation_voltage_probe.ts)
2714
2715
 
2715
- Defines a voltage probe for simulation, connected to a port or a net.
2716
-
2717
2716
  ```typescript
2718
- /** Defines a voltage probe for simulation, connected to a port or a net. */
2717
+ /** Defines a voltage probe for simulation. If a reference input is not provided,
2718
+ * it measures against ground. If a reference input is provided, it measures
2719
+ * the differential voltage between two points. */
2719
2720
  interface SimulationVoltageProbe {
2720
2721
  type: "simulation_voltage_probe"
2721
2722
  simulation_voltage_probe_id: string
2722
2723
  source_component_id?: string
2723
2724
  name?: string
2724
- source_port_id?: string
2725
- source_net_id?: string
2725
+ signal_input_source_port_id?: string
2726
+ signal_input_source_net_id?: string
2727
+ reference_input_source_port_id?: string
2728
+ reference_input_source_net_id?: string
2726
2729
  subcircuit_id?: string
2727
2730
  color?: string
2728
2731
  }
package/dist/index.d.mts CHANGED
@@ -9713,8 +9713,10 @@ declare const simulation_voltage_probe: z.ZodEffects<z.ZodObject<{
9713
9713
  simulation_voltage_probe_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
9714
9714
  source_component_id: z.ZodOptional<z.ZodString>;
9715
9715
  name: z.ZodOptional<z.ZodString>;
9716
- source_port_id: z.ZodOptional<z.ZodString>;
9717
- source_net_id: z.ZodOptional<z.ZodString>;
9716
+ signal_input_source_port_id: z.ZodOptional<z.ZodString>;
9717
+ signal_input_source_net_id: z.ZodOptional<z.ZodString>;
9718
+ reference_input_source_port_id: z.ZodOptional<z.ZodString>;
9719
+ reference_input_source_net_id: z.ZodOptional<z.ZodString>;
9718
9720
  subcircuit_id: z.ZodOptional<z.ZodString>;
9719
9721
  color: z.ZodOptional<z.ZodString>;
9720
9722
  }, "strip", z.ZodTypeAny, {
@@ -9723,48 +9725,60 @@ declare const simulation_voltage_probe: z.ZodEffects<z.ZodObject<{
9723
9725
  name?: string | undefined;
9724
9726
  source_component_id?: string | undefined;
9725
9727
  subcircuit_id?: string | undefined;
9726
- source_port_id?: string | undefined;
9727
- source_net_id?: string | undefined;
9728
9728
  color?: string | undefined;
9729
+ signal_input_source_port_id?: string | undefined;
9730
+ signal_input_source_net_id?: string | undefined;
9731
+ reference_input_source_port_id?: string | undefined;
9732
+ reference_input_source_net_id?: string | undefined;
9729
9733
  }, {
9730
9734
  type: "simulation_voltage_probe";
9731
9735
  name?: string | undefined;
9732
9736
  source_component_id?: string | undefined;
9733
9737
  subcircuit_id?: string | undefined;
9734
- source_port_id?: string | undefined;
9735
- source_net_id?: string | undefined;
9736
9738
  color?: string | undefined;
9737
9739
  simulation_voltage_probe_id?: string | undefined;
9740
+ signal_input_source_port_id?: string | undefined;
9741
+ signal_input_source_net_id?: string | undefined;
9742
+ reference_input_source_port_id?: string | undefined;
9743
+ reference_input_source_net_id?: string | undefined;
9738
9744
  }>, {
9739
9745
  type: "simulation_voltage_probe";
9740
9746
  simulation_voltage_probe_id: string;
9741
9747
  name?: string | undefined;
9742
9748
  source_component_id?: string | undefined;
9743
9749
  subcircuit_id?: string | undefined;
9744
- source_port_id?: string | undefined;
9745
- source_net_id?: string | undefined;
9746
9750
  color?: string | undefined;
9751
+ signal_input_source_port_id?: string | undefined;
9752
+ signal_input_source_net_id?: string | undefined;
9753
+ reference_input_source_port_id?: string | undefined;
9754
+ reference_input_source_net_id?: string | undefined;
9747
9755
  }, {
9748
9756
  type: "simulation_voltage_probe";
9749
9757
  name?: string | undefined;
9750
9758
  source_component_id?: string | undefined;
9751
9759
  subcircuit_id?: string | undefined;
9752
- source_port_id?: string | undefined;
9753
- source_net_id?: string | undefined;
9754
9760
  color?: string | undefined;
9755
9761
  simulation_voltage_probe_id?: string | undefined;
9762
+ signal_input_source_port_id?: string | undefined;
9763
+ signal_input_source_net_id?: string | undefined;
9764
+ reference_input_source_port_id?: string | undefined;
9765
+ reference_input_source_net_id?: string | undefined;
9756
9766
  }>;
9757
9767
  type SimulationVoltageProbeInput = z.input<typeof simulation_voltage_probe>;
9758
9768
  /**
9759
- * Defines a voltage probe for simulation, connected to a port or a net.
9769
+ * Defines a voltage probe for simulation. If a reference input is not provided,
9770
+ * it measures against ground. If a reference input is provided, it measures
9771
+ * the differential voltage between two points.
9760
9772
  */
9761
9773
  interface SimulationVoltageProbe {
9762
9774
  type: "simulation_voltage_probe";
9763
9775
  simulation_voltage_probe_id: string;
9764
9776
  source_component_id?: string;
9765
9777
  name?: string;
9766
- source_port_id?: string;
9767
- source_net_id?: string;
9778
+ signal_input_source_port_id?: string;
9779
+ signal_input_source_net_id?: string;
9780
+ reference_input_source_port_id?: string;
9781
+ reference_input_source_net_id?: string;
9768
9782
  subcircuit_id?: string;
9769
9783
  color?: string;
9770
9784
  }
@@ -12240,6 +12254,7 @@ declare const source_port: z.ZodObject<{
12240
12254
  source_group_id: z.ZodOptional<z.ZodString>;
12241
12255
  subcircuit_id: z.ZodOptional<z.ZodString>;
12242
12256
  subcircuit_connectivity_map_key: z.ZodOptional<z.ZodString>;
12257
+ must_be_connected: z.ZodOptional<z.ZodBoolean>;
12243
12258
  }, "strip", z.ZodTypeAny, {
12244
12259
  type: "source_port";
12245
12260
  name: string;
@@ -12250,6 +12265,7 @@ declare const source_port: z.ZodObject<{
12250
12265
  subcircuit_connectivity_map_key?: string | undefined;
12251
12266
  source_group_id?: string | undefined;
12252
12267
  pin_number?: number | undefined;
12268
+ must_be_connected?: boolean | undefined;
12253
12269
  }, {
12254
12270
  type: "source_port";
12255
12271
  name: string;
@@ -12260,6 +12276,7 @@ declare const source_port: z.ZodObject<{
12260
12276
  subcircuit_connectivity_map_key?: string | undefined;
12261
12277
  source_group_id?: string | undefined;
12262
12278
  pin_number?: number | undefined;
12279
+ must_be_connected?: boolean | undefined;
12263
12280
  }>;
12264
12281
  type SourcePortInput = z.input<typeof source_port>;
12265
12282
  /**
@@ -12275,6 +12292,7 @@ interface SourcePort {
12275
12292
  source_group_id?: string;
12276
12293
  subcircuit_id?: string;
12277
12294
  subcircuit_connectivity_map_key?: string;
12295
+ must_be_connected?: boolean;
12278
12296
  }
12279
12297
 
12280
12298
  interface SourceTrace {
@@ -12785,6 +12803,7 @@ declare const any_circuit_element: z.ZodUnion<[z.ZodObject<{
12785
12803
  source_group_id: z.ZodOptional<z.ZodString>;
12786
12804
  subcircuit_id: z.ZodOptional<z.ZodString>;
12787
12805
  subcircuit_connectivity_map_key: z.ZodOptional<z.ZodString>;
12806
+ must_be_connected: z.ZodOptional<z.ZodBoolean>;
12788
12807
  }, "strip", z.ZodTypeAny, {
12789
12808
  type: "source_port";
12790
12809
  name: string;
@@ -12795,6 +12814,7 @@ declare const any_circuit_element: z.ZodUnion<[z.ZodObject<{
12795
12814
  subcircuit_connectivity_map_key?: string | undefined;
12796
12815
  source_group_id?: string | undefined;
12797
12816
  pin_number?: number | undefined;
12817
+ must_be_connected?: boolean | undefined;
12798
12818
  }, {
12799
12819
  type: "source_port";
12800
12820
  name: string;
@@ -12805,6 +12825,7 @@ declare const any_circuit_element: z.ZodUnion<[z.ZodObject<{
12805
12825
  subcircuit_connectivity_map_key?: string | undefined;
12806
12826
  source_group_id?: string | undefined;
12807
12827
  pin_number?: number | undefined;
12828
+ must_be_connected?: boolean | undefined;
12808
12829
  }>, z.ZodUnion<[z.ZodObject<{
12809
12830
  type: z.ZodLiteral<"source_component">;
12810
12831
  source_component_id: z.ZodString;
@@ -20614,8 +20635,10 @@ declare const any_circuit_element: z.ZodUnion<[z.ZodObject<{
20614
20635
  simulation_voltage_probe_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
20615
20636
  source_component_id: z.ZodOptional<z.ZodString>;
20616
20637
  name: z.ZodOptional<z.ZodString>;
20617
- source_port_id: z.ZodOptional<z.ZodString>;
20618
- source_net_id: z.ZodOptional<z.ZodString>;
20638
+ signal_input_source_port_id: z.ZodOptional<z.ZodString>;
20639
+ signal_input_source_net_id: z.ZodOptional<z.ZodString>;
20640
+ reference_input_source_port_id: z.ZodOptional<z.ZodString>;
20641
+ reference_input_source_net_id: z.ZodOptional<z.ZodString>;
20619
20642
  subcircuit_id: z.ZodOptional<z.ZodString>;
20620
20643
  color: z.ZodOptional<z.ZodString>;
20621
20644
  }, "strip", z.ZodTypeAny, {
@@ -20624,36 +20647,44 @@ declare const any_circuit_element: z.ZodUnion<[z.ZodObject<{
20624
20647
  name?: string | undefined;
20625
20648
  source_component_id?: string | undefined;
20626
20649
  subcircuit_id?: string | undefined;
20627
- source_port_id?: string | undefined;
20628
- source_net_id?: string | undefined;
20629
20650
  color?: string | undefined;
20651
+ signal_input_source_port_id?: string | undefined;
20652
+ signal_input_source_net_id?: string | undefined;
20653
+ reference_input_source_port_id?: string | undefined;
20654
+ reference_input_source_net_id?: string | undefined;
20630
20655
  }, {
20631
20656
  type: "simulation_voltage_probe";
20632
20657
  name?: string | undefined;
20633
20658
  source_component_id?: string | undefined;
20634
20659
  subcircuit_id?: string | undefined;
20635
- source_port_id?: string | undefined;
20636
- source_net_id?: string | undefined;
20637
20660
  color?: string | undefined;
20638
20661
  simulation_voltage_probe_id?: string | undefined;
20662
+ signal_input_source_port_id?: string | undefined;
20663
+ signal_input_source_net_id?: string | undefined;
20664
+ reference_input_source_port_id?: string | undefined;
20665
+ reference_input_source_net_id?: string | undefined;
20639
20666
  }>, {
20640
20667
  type: "simulation_voltage_probe";
20641
20668
  simulation_voltage_probe_id: string;
20642
20669
  name?: string | undefined;
20643
20670
  source_component_id?: string | undefined;
20644
20671
  subcircuit_id?: string | undefined;
20645
- source_port_id?: string | undefined;
20646
- source_net_id?: string | undefined;
20647
20672
  color?: string | undefined;
20673
+ signal_input_source_port_id?: string | undefined;
20674
+ signal_input_source_net_id?: string | undefined;
20675
+ reference_input_source_port_id?: string | undefined;
20676
+ reference_input_source_net_id?: string | undefined;
20648
20677
  }, {
20649
20678
  type: "simulation_voltage_probe";
20650
20679
  name?: string | undefined;
20651
20680
  source_component_id?: string | undefined;
20652
20681
  subcircuit_id?: string | undefined;
20653
- source_port_id?: string | undefined;
20654
- source_net_id?: string | undefined;
20655
20682
  color?: string | undefined;
20656
20683
  simulation_voltage_probe_id?: string | undefined;
20684
+ signal_input_source_port_id?: string | undefined;
20685
+ signal_input_source_net_id?: string | undefined;
20686
+ reference_input_source_port_id?: string | undefined;
20687
+ reference_input_source_net_id?: string | undefined;
20657
20688
  }>, z.ZodObject<{
20658
20689
  type: z.ZodLiteral<"simulation_unknown_experiment_error">;
20659
20690
  simulation_unknown_experiment_error_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -20719,6 +20750,7 @@ declare const any_soup_element: z.ZodUnion<[z.ZodObject<{
20719
20750
  source_group_id: z.ZodOptional<z.ZodString>;
20720
20751
  subcircuit_id: z.ZodOptional<z.ZodString>;
20721
20752
  subcircuit_connectivity_map_key: z.ZodOptional<z.ZodString>;
20753
+ must_be_connected: z.ZodOptional<z.ZodBoolean>;
20722
20754
  }, "strip", z.ZodTypeAny, {
20723
20755
  type: "source_port";
20724
20756
  name: string;
@@ -20729,6 +20761,7 @@ declare const any_soup_element: z.ZodUnion<[z.ZodObject<{
20729
20761
  subcircuit_connectivity_map_key?: string | undefined;
20730
20762
  source_group_id?: string | undefined;
20731
20763
  pin_number?: number | undefined;
20764
+ must_be_connected?: boolean | undefined;
20732
20765
  }, {
20733
20766
  type: "source_port";
20734
20767
  name: string;
@@ -20739,6 +20772,7 @@ declare const any_soup_element: z.ZodUnion<[z.ZodObject<{
20739
20772
  subcircuit_connectivity_map_key?: string | undefined;
20740
20773
  source_group_id?: string | undefined;
20741
20774
  pin_number?: number | undefined;
20775
+ must_be_connected?: boolean | undefined;
20742
20776
  }>, z.ZodUnion<[z.ZodObject<{
20743
20777
  type: z.ZodLiteral<"source_component">;
20744
20778
  source_component_id: z.ZodString;
@@ -28548,8 +28582,10 @@ declare const any_soup_element: z.ZodUnion<[z.ZodObject<{
28548
28582
  simulation_voltage_probe_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
28549
28583
  source_component_id: z.ZodOptional<z.ZodString>;
28550
28584
  name: z.ZodOptional<z.ZodString>;
28551
- source_port_id: z.ZodOptional<z.ZodString>;
28552
- source_net_id: z.ZodOptional<z.ZodString>;
28585
+ signal_input_source_port_id: z.ZodOptional<z.ZodString>;
28586
+ signal_input_source_net_id: z.ZodOptional<z.ZodString>;
28587
+ reference_input_source_port_id: z.ZodOptional<z.ZodString>;
28588
+ reference_input_source_net_id: z.ZodOptional<z.ZodString>;
28553
28589
  subcircuit_id: z.ZodOptional<z.ZodString>;
28554
28590
  color: z.ZodOptional<z.ZodString>;
28555
28591
  }, "strip", z.ZodTypeAny, {
@@ -28558,36 +28594,44 @@ declare const any_soup_element: z.ZodUnion<[z.ZodObject<{
28558
28594
  name?: string | undefined;
28559
28595
  source_component_id?: string | undefined;
28560
28596
  subcircuit_id?: string | undefined;
28561
- source_port_id?: string | undefined;
28562
- source_net_id?: string | undefined;
28563
28597
  color?: string | undefined;
28598
+ signal_input_source_port_id?: string | undefined;
28599
+ signal_input_source_net_id?: string | undefined;
28600
+ reference_input_source_port_id?: string | undefined;
28601
+ reference_input_source_net_id?: string | undefined;
28564
28602
  }, {
28565
28603
  type: "simulation_voltage_probe";
28566
28604
  name?: string | undefined;
28567
28605
  source_component_id?: string | undefined;
28568
28606
  subcircuit_id?: string | undefined;
28569
- source_port_id?: string | undefined;
28570
- source_net_id?: string | undefined;
28571
28607
  color?: string | undefined;
28572
28608
  simulation_voltage_probe_id?: string | undefined;
28609
+ signal_input_source_port_id?: string | undefined;
28610
+ signal_input_source_net_id?: string | undefined;
28611
+ reference_input_source_port_id?: string | undefined;
28612
+ reference_input_source_net_id?: string | undefined;
28573
28613
  }>, {
28574
28614
  type: "simulation_voltage_probe";
28575
28615
  simulation_voltage_probe_id: string;
28576
28616
  name?: string | undefined;
28577
28617
  source_component_id?: string | undefined;
28578
28618
  subcircuit_id?: string | undefined;
28579
- source_port_id?: string | undefined;
28580
- source_net_id?: string | undefined;
28581
28619
  color?: string | undefined;
28620
+ signal_input_source_port_id?: string | undefined;
28621
+ signal_input_source_net_id?: string | undefined;
28622
+ reference_input_source_port_id?: string | undefined;
28623
+ reference_input_source_net_id?: string | undefined;
28582
28624
  }, {
28583
28625
  type: "simulation_voltage_probe";
28584
28626
  name?: string | undefined;
28585
28627
  source_component_id?: string | undefined;
28586
28628
  subcircuit_id?: string | undefined;
28587
- source_port_id?: string | undefined;
28588
- source_net_id?: string | undefined;
28589
28629
  color?: string | undefined;
28590
28630
  simulation_voltage_probe_id?: string | undefined;
28631
+ signal_input_source_port_id?: string | undefined;
28632
+ signal_input_source_net_id?: string | undefined;
28633
+ reference_input_source_port_id?: string | undefined;
28634
+ reference_input_source_net_id?: string | undefined;
28591
28635
  }>, z.ZodObject<{
28592
28636
  type: z.ZodLiteral<"simulation_unknown_experiment_error">;
28593
28637
  simulation_unknown_experiment_error_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
package/dist/index.mjs CHANGED
@@ -677,7 +677,8 @@ var source_port = z37.object({
677
677
  source_component_id: z37.string().optional(),
678
678
  source_group_id: z37.string().optional(),
679
679
  subcircuit_id: z37.string().optional(),
680
- subcircuit_connectivity_map_key: z37.string().optional()
680
+ subcircuit_connectivity_map_key: z37.string().optional(),
681
+ must_be_connected: z37.boolean().optional()
681
682
  });
682
683
  expectTypesMatch(true);
683
684
 
@@ -2890,18 +2891,48 @@ var simulation_voltage_probe = z130.object({
2890
2891
  ),
2891
2892
  source_component_id: z130.string().optional(),
2892
2893
  name: z130.string().optional(),
2893
- source_port_id: z130.string().optional(),
2894
- source_net_id: z130.string().optional(),
2894
+ signal_input_source_port_id: z130.string().optional(),
2895
+ signal_input_source_net_id: z130.string().optional(),
2896
+ reference_input_source_port_id: z130.string().optional(),
2897
+ reference_input_source_net_id: z130.string().optional(),
2895
2898
  subcircuit_id: z130.string().optional(),
2896
2899
  color: z130.string().optional()
2897
2900
  }).describe(
2898
- "Defines a voltage probe for simulation, connected to a port or a net"
2899
- ).refine(
2900
- (data) => Boolean(data.source_port_id) !== Boolean(data.source_net_id),
2901
- {
2902
- message: "Exactly one of source_port_id or source_net_id must be provided to simulation_voltage_probe"
2901
+ "Defines a voltage probe for simulation. If a reference input is not provided, it measures against ground. If a reference input is provided, it measures the differential voltage between two points."
2902
+ ).superRefine((data, ctx) => {
2903
+ const is_differential = data.reference_input_source_port_id || data.reference_input_source_net_id;
2904
+ if (is_differential) {
2905
+ const has_ports = !!data.signal_input_source_port_id || !!data.reference_input_source_port_id;
2906
+ const has_nets = !!data.signal_input_source_net_id || !!data.reference_input_source_net_id;
2907
+ if (has_ports && has_nets) {
2908
+ ctx.addIssue({
2909
+ code: z130.ZodIssueCode.custom,
2910
+ message: "Cannot mix port and net connections in a differential probe."
2911
+ });
2912
+ } else if (has_ports) {
2913
+ if (!data.signal_input_source_port_id || !data.reference_input_source_port_id) {
2914
+ ctx.addIssue({
2915
+ code: z130.ZodIssueCode.custom,
2916
+ message: "Differential port probe requires both signal_input_source_port_id and reference_input_source_port_id."
2917
+ });
2918
+ }
2919
+ } else if (has_nets) {
2920
+ if (!data.signal_input_source_net_id || !data.reference_input_source_net_id) {
2921
+ ctx.addIssue({
2922
+ code: z130.ZodIssueCode.custom,
2923
+ message: "Differential net probe requires both signal_input_source_net_id and reference_input_source_net_id."
2924
+ });
2925
+ }
2926
+ }
2927
+ } else {
2928
+ if (!!data.signal_input_source_port_id === !!data.signal_input_source_net_id) {
2929
+ ctx.addIssue({
2930
+ code: z130.ZodIssueCode.custom,
2931
+ message: "A voltage probe must have exactly one of signal_input_source_port_id or signal_input_source_net_id."
2932
+ });
2933
+ }
2903
2934
  }
2904
- );
2935
+ });
2905
2936
  expectTypesMatch(true);
2906
2937
 
2907
2938
  // src/simulation/simulation_unknown_experiment_error.ts