circuit-json 0.0.435 → 0.0.436

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.mjs CHANGED
@@ -3560,40 +3560,60 @@ var simulation_transient_voltage_graph = z165.object({
3560
3560
  }).describe("Stores voltage measurements over time for a simulation");
3561
3561
  expectTypesMatch(true);
3562
3562
 
3563
- // src/simulation/simulation_switch.ts
3563
+ // src/simulation/simulation_transient_current_graph.ts
3564
3564
  import { z as z166 } from "zod";
3565
- var simulation_switch = z166.object({
3566
- type: z166.literal("simulation_switch"),
3567
- simulation_switch_id: getZodPrefixedIdWithDefault("simulation_switch"),
3565
+ var simulation_transient_current_graph = z166.object({
3566
+ type: z166.literal("simulation_transient_current_graph"),
3567
+ simulation_transient_current_graph_id: getZodPrefixedIdWithDefault(
3568
+ "simulation_transient_current_graph"
3569
+ ),
3570
+ simulation_experiment_id: z166.string(),
3571
+ timestamps_ms: z166.array(z166.number()).optional(),
3572
+ current_levels: z166.array(z166.number()),
3568
3573
  source_component_id: z166.string().optional(),
3574
+ subcircuit_connectivity_map_key: z166.string().optional(),
3575
+ time_per_step: duration_ms,
3576
+ start_time_ms: ms,
3577
+ end_time_ms: ms,
3578
+ name: z166.string().optional(),
3579
+ color: z166.string().optional()
3580
+ }).describe("Stores current measurements over time for a simulation");
3581
+ expectTypesMatch(true);
3582
+
3583
+ // src/simulation/simulation_switch.ts
3584
+ import { z as z167 } from "zod";
3585
+ var simulation_switch = z167.object({
3586
+ type: z167.literal("simulation_switch"),
3587
+ simulation_switch_id: getZodPrefixedIdWithDefault("simulation_switch"),
3588
+ source_component_id: z167.string().optional(),
3569
3589
  closes_at: ms.optional(),
3570
3590
  opens_at: ms.optional(),
3571
- starts_closed: z166.boolean().optional(),
3591
+ starts_closed: z167.boolean().optional(),
3572
3592
  switching_frequency: frequency.optional()
3573
3593
  }).describe("Defines a switch for simulation timing control");
3574
3594
  expectTypesMatch(true);
3575
3595
 
3576
3596
  // src/simulation/simulation_voltage_probe.ts
3577
- import { z as z167 } from "zod";
3578
- var simulation_voltage_probe_display_options = z167.object({
3579
- label: z167.string().optional(),
3580
- center: z167.number().optional(),
3581
- offset_divs: z167.number().optional(),
3582
- units_per_div: z167.number().optional()
3583
- });
3584
- var simulation_voltage_probe = z167.object({
3585
- type: z167.literal("simulation_voltage_probe"),
3597
+ import { z as z168 } from "zod";
3598
+ var simulation_voltage_probe_display_options = z168.object({
3599
+ label: z168.string().optional(),
3600
+ center: z168.number().optional(),
3601
+ offset_divs: z168.number().optional(),
3602
+ units_per_div: z168.number().optional()
3603
+ });
3604
+ var simulation_voltage_probe = z168.object({
3605
+ type: z168.literal("simulation_voltage_probe"),
3586
3606
  simulation_voltage_probe_id: getZodPrefixedIdWithDefault(
3587
3607
  "simulation_voltage_probe"
3588
3608
  ),
3589
- source_component_id: z167.string().optional(),
3590
- name: z167.string().optional(),
3591
- signal_input_source_port_id: z167.string().optional(),
3592
- signal_input_source_net_id: z167.string().optional(),
3593
- reference_input_source_port_id: z167.string().optional(),
3594
- reference_input_source_net_id: z167.string().optional(),
3595
- subcircuit_id: z167.string().optional(),
3596
- color: z167.string().optional(),
3609
+ source_component_id: z168.string().optional(),
3610
+ name: z168.string().optional(),
3611
+ signal_input_source_port_id: z168.string().optional(),
3612
+ signal_input_source_net_id: z168.string().optional(),
3613
+ reference_input_source_port_id: z168.string().optional(),
3614
+ reference_input_source_net_id: z168.string().optional(),
3615
+ subcircuit_id: z168.string().optional(),
3616
+ color: z168.string().optional(),
3597
3617
  display_options: simulation_voltage_probe_display_options.optional()
3598
3618
  }).describe(
3599
3619
  "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."
@@ -3604,20 +3624,20 @@ var simulation_voltage_probe = z167.object({
3604
3624
  const has_nets = !!data.signal_input_source_net_id || !!data.reference_input_source_net_id;
3605
3625
  if (has_ports && has_nets) {
3606
3626
  ctx.addIssue({
3607
- code: z167.ZodIssueCode.custom,
3627
+ code: z168.ZodIssueCode.custom,
3608
3628
  message: "Cannot mix port and net connections in a differential probe."
3609
3629
  });
3610
3630
  } else if (has_ports) {
3611
3631
  if (!data.signal_input_source_port_id || !data.reference_input_source_port_id) {
3612
3632
  ctx.addIssue({
3613
- code: z167.ZodIssueCode.custom,
3633
+ code: z168.ZodIssueCode.custom,
3614
3634
  message: "Differential port probe requires both signal_input_source_port_id and reference_input_source_port_id."
3615
3635
  });
3616
3636
  }
3617
3637
  } else if (has_nets) {
3618
3638
  if (!data.signal_input_source_net_id || !data.reference_input_source_net_id) {
3619
3639
  ctx.addIssue({
3620
- code: z167.ZodIssueCode.custom,
3640
+ code: z168.ZodIssueCode.custom,
3621
3641
  message: "Differential net probe requires both signal_input_source_net_id and reference_input_source_net_id."
3622
3642
  });
3623
3643
  }
@@ -3625,7 +3645,7 @@ var simulation_voltage_probe = z167.object({
3625
3645
  } else {
3626
3646
  if (!!data.signal_input_source_port_id === !!data.signal_input_source_net_id) {
3627
3647
  ctx.addIssue({
3628
- code: z167.ZodIssueCode.custom,
3648
+ code: z168.ZodIssueCode.custom,
3629
3649
  message: "A voltage probe must have exactly one of signal_input_source_port_id or signal_input_source_net_id."
3630
3650
  });
3631
3651
  }
@@ -3634,51 +3654,115 @@ var simulation_voltage_probe = z167.object({
3634
3654
  expectTypesMatch(true);
3635
3655
  expectTypesMatch(true);
3636
3656
 
3657
+ // src/simulation/simulation_current_probe.ts
3658
+ import { z as z169 } from "zod";
3659
+ var simulation_current_probe_display_options = z169.object({
3660
+ label: z169.string().optional(),
3661
+ center: z169.number().optional(),
3662
+ offset_divs: z169.number().optional(),
3663
+ units_per_div: z169.number().optional()
3664
+ });
3665
+ var simulation_current_probe = z169.object({
3666
+ type: z169.literal("simulation_current_probe"),
3667
+ simulation_current_probe_id: getZodPrefixedIdWithDefault(
3668
+ "simulation_current_probe"
3669
+ ),
3670
+ source_component_id: z169.string().optional(),
3671
+ name: z169.string().optional(),
3672
+ positive_source_port_id: z169.string().optional(),
3673
+ negative_source_port_id: z169.string().optional(),
3674
+ positive_source_net_id: z169.string().optional(),
3675
+ negative_source_net_id: z169.string().optional(),
3676
+ subcircuit_id: z169.string().optional(),
3677
+ color: z169.string().optional(),
3678
+ display_options: simulation_current_probe_display_options.optional()
3679
+ }).describe(
3680
+ "Defines a current probe for simulation. It measures current flowing from the positive endpoint to the negative endpoint."
3681
+ ).superRefine((data, ctx) => {
3682
+ const hasPositivePort = !!data.positive_source_port_id;
3683
+ const hasNegativePort = !!data.negative_source_port_id;
3684
+ const hasPositiveNet = !!data.positive_source_net_id;
3685
+ const hasNegativeNet = !!data.negative_source_net_id;
3686
+ const hasPorts = hasPositivePort || hasNegativePort;
3687
+ const hasNets = hasPositiveNet || hasNegativeNet;
3688
+ if (hasPorts && hasNets) {
3689
+ ctx.addIssue({
3690
+ code: z169.ZodIssueCode.custom,
3691
+ message: "Cannot mix port and net connections in a current probe."
3692
+ });
3693
+ return;
3694
+ }
3695
+ if (hasPorts) {
3696
+ if (!hasPositivePort || !hasNegativePort) {
3697
+ ctx.addIssue({
3698
+ code: z169.ZodIssueCode.custom,
3699
+ message: "Current probe using source ports requires both positive_source_port_id and negative_source_port_id."
3700
+ });
3701
+ }
3702
+ return;
3703
+ }
3704
+ if (hasNets) {
3705
+ if (!hasPositiveNet || !hasNegativeNet) {
3706
+ ctx.addIssue({
3707
+ code: z169.ZodIssueCode.custom,
3708
+ message: "Current probe using source nets requires both positive_source_net_id and negative_source_net_id."
3709
+ });
3710
+ }
3711
+ return;
3712
+ }
3713
+ ctx.addIssue({
3714
+ code: z169.ZodIssueCode.custom,
3715
+ message: "A current probe must have either positive/negative source port ids or positive/negative source net ids."
3716
+ });
3717
+ });
3718
+ expectTypesMatch(true);
3719
+ expectTypesMatch(true);
3720
+
3637
3721
  // src/simulation/simulation_unknown_experiment_error.ts
3638
- import { z as z168 } from "zod";
3722
+ import { z as z170 } from "zod";
3639
3723
  var simulation_unknown_experiment_error = base_circuit_json_error.extend({
3640
- type: z168.literal("simulation_unknown_experiment_error"),
3724
+ type: z170.literal("simulation_unknown_experiment_error"),
3641
3725
  simulation_unknown_experiment_error_id: getZodPrefixedIdWithDefault(
3642
3726
  "simulation_unknown_experiment_error"
3643
3727
  ),
3644
- error_type: z168.literal("simulation_unknown_experiment_error").default("simulation_unknown_experiment_error"),
3645
- simulation_experiment_id: z168.string().optional(),
3646
- subcircuit_id: z168.string().optional()
3728
+ error_type: z170.literal("simulation_unknown_experiment_error").default("simulation_unknown_experiment_error"),
3729
+ simulation_experiment_id: z170.string().optional(),
3730
+ subcircuit_id: z170.string().optional()
3647
3731
  }).describe("An unknown error occurred during the simulation experiment.");
3648
3732
  expectTypesMatch(true);
3649
3733
 
3650
3734
  // src/simulation/simulation_op_amp.ts
3651
- import { z as z169 } from "zod";
3652
- var simulation_op_amp = z169.object({
3653
- type: z169.literal("simulation_op_amp"),
3735
+ import { z as z171 } from "zod";
3736
+ var simulation_op_amp = z171.object({
3737
+ type: z171.literal("simulation_op_amp"),
3654
3738
  simulation_op_amp_id: getZodPrefixedIdWithDefault("simulation_op_amp"),
3655
- source_component_id: z169.string().optional(),
3656
- inverting_input_source_port_id: z169.string(),
3657
- non_inverting_input_source_port_id: z169.string(),
3658
- output_source_port_id: z169.string(),
3659
- positive_supply_source_port_id: z169.string(),
3660
- negative_supply_source_port_id: z169.string()
3739
+ source_component_id: z171.string().optional(),
3740
+ inverting_input_source_port_id: z171.string(),
3741
+ non_inverting_input_source_port_id: z171.string(),
3742
+ output_source_port_id: z171.string(),
3743
+ positive_supply_source_port_id: z171.string(),
3744
+ negative_supply_source_port_id: z171.string()
3661
3745
  }).describe("Defines a simple ideal operational amplifier for simulation");
3662
3746
  expectTypesMatch(true);
3663
3747
 
3664
3748
  // src/simulation/simulation_spice_subcircuit.ts
3665
- import { z as z170 } from "zod";
3666
- var simulation_spice_subcircuit = z170.object({
3667
- type: z170.literal("simulation_spice_subcircuit"),
3749
+ import { z as z172 } from "zod";
3750
+ var simulation_spice_subcircuit = z172.object({
3751
+ type: z172.literal("simulation_spice_subcircuit"),
3668
3752
  simulation_spice_subcircuit_id: getZodPrefixedIdWithDefault(
3669
3753
  "simulation_spice_subcircuit"
3670
3754
  ),
3671
- source_component_id: z170.string(),
3672
- spice_pin_to_source_port_map: z170.record(z170.string(), z170.string()),
3673
- subcircuit_source: z170.string()
3755
+ source_component_id: z172.string(),
3756
+ spice_pin_to_source_port_map: z172.record(z172.string(), z172.string()),
3757
+ subcircuit_source: z172.string()
3674
3758
  }).describe("Defines a custom SPICE subcircuit model for simulation");
3675
3759
  expectTypesMatch(
3676
3760
  true
3677
3761
  );
3678
3762
 
3679
3763
  // src/any_circuit_element.ts
3680
- import { z as z171 } from "zod";
3681
- var any_circuit_element = z171.union([
3764
+ import { z as z173 } from "zod";
3765
+ var any_circuit_element = z173.union([
3682
3766
  source_trace,
3683
3767
  source_port,
3684
3768
  source_component_internal_connection,
@@ -3812,8 +3896,10 @@ var any_circuit_element = z171.union([
3812
3896
  simulation_current_source,
3813
3897
  simulation_experiment,
3814
3898
  simulation_transient_voltage_graph,
3899
+ simulation_transient_current_graph,
3815
3900
  simulation_switch,
3816
3901
  simulation_voltage_probe,
3902
+ simulation_current_probe,
3817
3903
  simulation_unknown_experiment_error,
3818
3904
  simulation_op_amp,
3819
3905
  simulation_spice_subcircuit
@@ -3992,6 +4078,8 @@ export {
3992
4078
  schematic_voltage_probe,
3993
4079
  simulation_ac_current_source,
3994
4080
  simulation_ac_voltage_source,
4081
+ simulation_current_probe,
4082
+ simulation_current_probe_display_options,
3995
4083
  simulation_current_source,
3996
4084
  simulation_dc_current_source,
3997
4085
  simulation_dc_voltage_source,
@@ -3999,6 +4087,7 @@ export {
3999
4087
  simulation_op_amp,
4000
4088
  simulation_spice_subcircuit,
4001
4089
  simulation_switch,
4090
+ simulation_transient_current_graph,
4002
4091
  simulation_transient_voltage_graph,
4003
4092
  simulation_unknown_experiment_error,
4004
4093
  simulation_voltage_probe,