circuit-json 0.0.281 → 0.0.283
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 +21 -0
- package/dist/index.d.mts +147 -2
- package/dist/index.mjs +120 -98
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1473,6 +1473,7 @@ var pcb_smtpad_rect = z71.object({
|
|
|
1473
1473
|
width: z71.number(),
|
|
1474
1474
|
height: z71.number(),
|
|
1475
1475
|
rect_border_radius: z71.number().optional(),
|
|
1476
|
+
corner_radius: z71.number().optional(),
|
|
1476
1477
|
layer: layer_ref,
|
|
1477
1478
|
port_hints: z71.array(z71.string()).optional(),
|
|
1478
1479
|
pcb_component_id: z71.string().optional(),
|
|
@@ -1490,6 +1491,7 @@ var pcb_smtpad_rotated_rect = z71.object({
|
|
|
1490
1491
|
width: z71.number(),
|
|
1491
1492
|
height: z71.number(),
|
|
1492
1493
|
rect_border_radius: z71.number().optional(),
|
|
1494
|
+
corner_radius: z71.number().optional(),
|
|
1493
1495
|
ccw_rotation: rotation,
|
|
1494
1496
|
layer: layer_ref,
|
|
1495
1497
|
port_hints: z71.array(z71.string()).optional(),
|
|
@@ -2430,93 +2432,111 @@ var pcb_component_outside_board_error = z113.object({
|
|
|
2430
2432
|
);
|
|
2431
2433
|
expectTypesMatch(true);
|
|
2432
2434
|
|
|
2433
|
-
// src/pcb/
|
|
2435
|
+
// src/pcb/pcb_component_invalid_layer_error.ts
|
|
2434
2436
|
import { z as z114 } from "zod";
|
|
2435
|
-
var
|
|
2436
|
-
type: z114.literal("
|
|
2437
|
-
|
|
2438
|
-
|
|
2437
|
+
var pcb_component_invalid_layer_error = z114.object({
|
|
2438
|
+
type: z114.literal("pcb_component_invalid_layer_error"),
|
|
2439
|
+
pcb_component_invalid_layer_error_id: getZodPrefixedIdWithDefault(
|
|
2440
|
+
"pcb_component_invalid_layer_error"
|
|
2441
|
+
),
|
|
2442
|
+
error_type: z114.literal("pcb_component_invalid_layer_error").default("pcb_component_invalid_layer_error"),
|
|
2439
2443
|
message: z114.string(),
|
|
2440
|
-
|
|
2444
|
+
pcb_component_id: z114.string().optional(),
|
|
2445
|
+
source_component_id: z114.string(),
|
|
2446
|
+
layer: layer_ref,
|
|
2447
|
+
subcircuit_id: z114.string().optional()
|
|
2448
|
+
}).describe(
|
|
2449
|
+
"Error emitted when a component is placed on an invalid layer (components can only be on 'top' or 'bottom' layers)"
|
|
2450
|
+
);
|
|
2451
|
+
expectTypesMatch(true);
|
|
2452
|
+
|
|
2453
|
+
// src/pcb/pcb_via_clearance_error.ts
|
|
2454
|
+
import { z as z115 } from "zod";
|
|
2455
|
+
var pcb_via_clearance_error = z115.object({
|
|
2456
|
+
type: z115.literal("pcb_via_clearance_error"),
|
|
2457
|
+
pcb_error_id: getZodPrefixedIdWithDefault("pcb_error"),
|
|
2458
|
+
error_type: z115.literal("pcb_via_clearance_error").default("pcb_via_clearance_error"),
|
|
2459
|
+
message: z115.string(),
|
|
2460
|
+
pcb_via_ids: z115.array(z115.string()).min(2),
|
|
2441
2461
|
minimum_clearance: distance.optional(),
|
|
2442
2462
|
actual_clearance: distance.optional(),
|
|
2443
|
-
pcb_center:
|
|
2444
|
-
x:
|
|
2445
|
-
y:
|
|
2463
|
+
pcb_center: z115.object({
|
|
2464
|
+
x: z115.number().optional(),
|
|
2465
|
+
y: z115.number().optional()
|
|
2446
2466
|
}).optional(),
|
|
2447
|
-
subcircuit_id:
|
|
2467
|
+
subcircuit_id: z115.string().optional()
|
|
2448
2468
|
}).describe("Error emitted when vias are closer than the allowed clearance");
|
|
2449
2469
|
expectTypesMatch(true);
|
|
2450
2470
|
|
|
2451
2471
|
// src/pcb/pcb_courtyard_rect.ts
|
|
2452
|
-
import { z as
|
|
2453
|
-
var pcb_courtyard_rect =
|
|
2454
|
-
type:
|
|
2472
|
+
import { z as z116 } from "zod";
|
|
2473
|
+
var pcb_courtyard_rect = z116.object({
|
|
2474
|
+
type: z116.literal("pcb_courtyard_rect"),
|
|
2455
2475
|
pcb_courtyard_rect_id: getZodPrefixedIdWithDefault("pcb_courtyard_rect"),
|
|
2456
|
-
pcb_component_id:
|
|
2457
|
-
pcb_group_id:
|
|
2458
|
-
subcircuit_id:
|
|
2476
|
+
pcb_component_id: z116.string(),
|
|
2477
|
+
pcb_group_id: z116.string().optional(),
|
|
2478
|
+
subcircuit_id: z116.string().optional(),
|
|
2459
2479
|
center: point,
|
|
2460
2480
|
width: length,
|
|
2461
2481
|
height: length,
|
|
2462
2482
|
layer: visible_layer,
|
|
2463
2483
|
stroke_width: length.default("0.1mm"),
|
|
2464
|
-
is_filled:
|
|
2465
|
-
has_stroke:
|
|
2466
|
-
is_stroke_dashed:
|
|
2467
|
-
color:
|
|
2484
|
+
is_filled: z116.boolean().optional(),
|
|
2485
|
+
has_stroke: z116.boolean().optional(),
|
|
2486
|
+
is_stroke_dashed: z116.boolean().optional(),
|
|
2487
|
+
color: z116.string().optional()
|
|
2468
2488
|
}).describe("Defines a courtyard rectangle on the PCB");
|
|
2469
2489
|
expectTypesMatch(true);
|
|
2470
2490
|
|
|
2471
2491
|
// src/pcb/pcb_courtyard_outline.ts
|
|
2472
|
-
import { z as
|
|
2473
|
-
var pcb_courtyard_outline =
|
|
2474
|
-
type:
|
|
2492
|
+
import { z as z117 } from "zod";
|
|
2493
|
+
var pcb_courtyard_outline = z117.object({
|
|
2494
|
+
type: z117.literal("pcb_courtyard_outline"),
|
|
2475
2495
|
pcb_courtyard_outline_id: getZodPrefixedIdWithDefault(
|
|
2476
2496
|
"pcb_courtyard_outline"
|
|
2477
2497
|
),
|
|
2478
|
-
pcb_component_id:
|
|
2479
|
-
pcb_group_id:
|
|
2480
|
-
subcircuit_id:
|
|
2498
|
+
pcb_component_id: z117.string(),
|
|
2499
|
+
pcb_group_id: z117.string().optional(),
|
|
2500
|
+
subcircuit_id: z117.string().optional(),
|
|
2481
2501
|
layer: visible_layer,
|
|
2482
|
-
outline:
|
|
2502
|
+
outline: z117.array(point).min(2),
|
|
2483
2503
|
stroke_width: length.default("0.1mm"),
|
|
2484
|
-
is_closed:
|
|
2485
|
-
is_stroke_dashed:
|
|
2486
|
-
color:
|
|
2504
|
+
is_closed: z117.boolean().optional(),
|
|
2505
|
+
is_stroke_dashed: z117.boolean().optional(),
|
|
2506
|
+
color: z117.string().optional()
|
|
2487
2507
|
}).describe("Defines a courtyard outline on the PCB");
|
|
2488
2508
|
expectTypesMatch(true);
|
|
2489
2509
|
|
|
2490
2510
|
// src/cad/cad_component.ts
|
|
2491
|
-
import { z as
|
|
2492
|
-
var cad_component =
|
|
2493
|
-
type:
|
|
2494
|
-
cad_component_id:
|
|
2495
|
-
pcb_component_id:
|
|
2496
|
-
source_component_id:
|
|
2511
|
+
import { z as z118 } from "zod";
|
|
2512
|
+
var cad_component = z118.object({
|
|
2513
|
+
type: z118.literal("cad_component"),
|
|
2514
|
+
cad_component_id: z118.string(),
|
|
2515
|
+
pcb_component_id: z118.string(),
|
|
2516
|
+
source_component_id: z118.string(),
|
|
2497
2517
|
position: point3,
|
|
2498
2518
|
rotation: point3.optional(),
|
|
2499
2519
|
size: point3.optional(),
|
|
2500
2520
|
layer: layer_ref.optional(),
|
|
2501
|
-
subcircuit_id:
|
|
2521
|
+
subcircuit_id: z118.string().optional(),
|
|
2502
2522
|
// These are all ways to generate/load the 3d model
|
|
2503
|
-
footprinter_string:
|
|
2504
|
-
model_obj_url:
|
|
2505
|
-
model_stl_url:
|
|
2506
|
-
model_3mf_url:
|
|
2507
|
-
model_gltf_url:
|
|
2508
|
-
model_glb_url:
|
|
2509
|
-
model_step_url:
|
|
2510
|
-
model_wrl_url:
|
|
2511
|
-
model_unit_to_mm_scale_factor:
|
|
2512
|
-
model_jscad:
|
|
2523
|
+
footprinter_string: z118.string().optional(),
|
|
2524
|
+
model_obj_url: z118.string().optional(),
|
|
2525
|
+
model_stl_url: z118.string().optional(),
|
|
2526
|
+
model_3mf_url: z118.string().optional(),
|
|
2527
|
+
model_gltf_url: z118.string().optional(),
|
|
2528
|
+
model_glb_url: z118.string().optional(),
|
|
2529
|
+
model_step_url: z118.string().optional(),
|
|
2530
|
+
model_wrl_url: z118.string().optional(),
|
|
2531
|
+
model_unit_to_mm_scale_factor: z118.number().optional(),
|
|
2532
|
+
model_jscad: z118.any().optional()
|
|
2513
2533
|
}).describe("Defines a component on the PCB");
|
|
2514
2534
|
expectTypesMatch(true);
|
|
2515
2535
|
|
|
2516
2536
|
// src/simulation/simulation_voltage_source.ts
|
|
2517
|
-
import { z as
|
|
2518
|
-
var wave_shape =
|
|
2519
|
-
var percentage =
|
|
2537
|
+
import { z as z119 } from "zod";
|
|
2538
|
+
var wave_shape = z119.enum(["sinewave", "square", "triangle", "sawtooth"]);
|
|
2539
|
+
var percentage = z119.union([z119.string(), z119.number()]).transform((val) => {
|
|
2520
2540
|
if (typeof val === "string") {
|
|
2521
2541
|
if (val.endsWith("%")) {
|
|
2522
2542
|
return parseFloat(val.slice(0, -1)) / 100;
|
|
@@ -2525,30 +2545,30 @@ var percentage = z118.union([z118.string(), z118.number()]).transform((val) => {
|
|
|
2525
2545
|
}
|
|
2526
2546
|
return val;
|
|
2527
2547
|
}).pipe(
|
|
2528
|
-
|
|
2548
|
+
z119.number().min(0, "Duty cycle must be non-negative").max(1, "Duty cycle cannot be greater than 100%")
|
|
2529
2549
|
);
|
|
2530
|
-
var simulation_dc_voltage_source =
|
|
2531
|
-
type:
|
|
2550
|
+
var simulation_dc_voltage_source = z119.object({
|
|
2551
|
+
type: z119.literal("simulation_voltage_source"),
|
|
2532
2552
|
simulation_voltage_source_id: getZodPrefixedIdWithDefault(
|
|
2533
2553
|
"simulation_voltage_source"
|
|
2534
2554
|
),
|
|
2535
|
-
is_dc_source:
|
|
2536
|
-
positive_source_port_id:
|
|
2537
|
-
negative_source_port_id:
|
|
2538
|
-
positive_source_net_id:
|
|
2539
|
-
negative_source_net_id:
|
|
2555
|
+
is_dc_source: z119.literal(true).optional().default(true),
|
|
2556
|
+
positive_source_port_id: z119.string().optional(),
|
|
2557
|
+
negative_source_port_id: z119.string().optional(),
|
|
2558
|
+
positive_source_net_id: z119.string().optional(),
|
|
2559
|
+
negative_source_net_id: z119.string().optional(),
|
|
2540
2560
|
voltage
|
|
2541
2561
|
}).describe("Defines a DC voltage source for simulation");
|
|
2542
|
-
var simulation_ac_voltage_source =
|
|
2543
|
-
type:
|
|
2562
|
+
var simulation_ac_voltage_source = z119.object({
|
|
2563
|
+
type: z119.literal("simulation_voltage_source"),
|
|
2544
2564
|
simulation_voltage_source_id: getZodPrefixedIdWithDefault(
|
|
2545
2565
|
"simulation_voltage_source"
|
|
2546
2566
|
),
|
|
2547
|
-
is_dc_source:
|
|
2548
|
-
terminal1_source_port_id:
|
|
2549
|
-
terminal2_source_port_id:
|
|
2550
|
-
terminal1_source_net_id:
|
|
2551
|
-
terminal2_source_net_id:
|
|
2567
|
+
is_dc_source: z119.literal(false),
|
|
2568
|
+
terminal1_source_port_id: z119.string().optional(),
|
|
2569
|
+
terminal2_source_port_id: z119.string().optional(),
|
|
2570
|
+
terminal1_source_net_id: z119.string().optional(),
|
|
2571
|
+
terminal2_source_net_id: z119.string().optional(),
|
|
2552
2572
|
voltage: voltage.optional(),
|
|
2553
2573
|
frequency: frequency.optional(),
|
|
2554
2574
|
peak_to_peak_voltage: voltage.optional(),
|
|
@@ -2556,25 +2576,25 @@ var simulation_ac_voltage_source = z118.object({
|
|
|
2556
2576
|
phase: rotation.optional(),
|
|
2557
2577
|
duty_cycle: percentage.optional()
|
|
2558
2578
|
}).describe("Defines an AC voltage source for simulation");
|
|
2559
|
-
var simulation_voltage_source =
|
|
2579
|
+
var simulation_voltage_source = z119.union([simulation_dc_voltage_source, simulation_ac_voltage_source]).describe("Defines a voltage source for simulation");
|
|
2560
2580
|
expectTypesMatch(true);
|
|
2561
2581
|
expectTypesMatch(true);
|
|
2562
2582
|
expectTypesMatch(true);
|
|
2563
2583
|
|
|
2564
2584
|
// src/simulation/simulation_experiment.ts
|
|
2565
|
-
import { z as
|
|
2566
|
-
var experiment_type =
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2585
|
+
import { z as z120 } from "zod";
|
|
2586
|
+
var experiment_type = z120.union([
|
|
2587
|
+
z120.literal("spice_dc_sweep"),
|
|
2588
|
+
z120.literal("spice_dc_operating_point"),
|
|
2589
|
+
z120.literal("spice_transient_analysis"),
|
|
2590
|
+
z120.literal("spice_ac_analysis")
|
|
2571
2591
|
]);
|
|
2572
|
-
var simulation_experiment =
|
|
2573
|
-
type:
|
|
2592
|
+
var simulation_experiment = z120.object({
|
|
2593
|
+
type: z120.literal("simulation_experiment"),
|
|
2574
2594
|
simulation_experiment_id: getZodPrefixedIdWithDefault(
|
|
2575
2595
|
"simulation_experiment"
|
|
2576
2596
|
),
|
|
2577
|
-
name:
|
|
2597
|
+
name: z120.string(),
|
|
2578
2598
|
experiment_type,
|
|
2579
2599
|
time_per_step: duration_ms.optional(),
|
|
2580
2600
|
start_time_ms: ms.optional(),
|
|
@@ -2583,48 +2603,48 @@ var simulation_experiment = z119.object({
|
|
|
2583
2603
|
expectTypesMatch(true);
|
|
2584
2604
|
|
|
2585
2605
|
// src/simulation/simulation_transient_voltage_graph.ts
|
|
2586
|
-
import { z as
|
|
2587
|
-
var simulation_transient_voltage_graph =
|
|
2588
|
-
type:
|
|
2606
|
+
import { z as z121 } from "zod";
|
|
2607
|
+
var simulation_transient_voltage_graph = z121.object({
|
|
2608
|
+
type: z121.literal("simulation_transient_voltage_graph"),
|
|
2589
2609
|
simulation_transient_voltage_graph_id: getZodPrefixedIdWithDefault(
|
|
2590
2610
|
"simulation_transient_voltage_graph"
|
|
2591
2611
|
),
|
|
2592
|
-
simulation_experiment_id:
|
|
2593
|
-
timestamps_ms:
|
|
2594
|
-
voltage_levels:
|
|
2595
|
-
schematic_voltage_probe_id:
|
|
2596
|
-
simulation_voltage_probe_id:
|
|
2597
|
-
subcircuit_connectivity_map_key:
|
|
2612
|
+
simulation_experiment_id: z121.string(),
|
|
2613
|
+
timestamps_ms: z121.array(z121.number()).optional(),
|
|
2614
|
+
voltage_levels: z121.array(z121.number()),
|
|
2615
|
+
schematic_voltage_probe_id: z121.string().optional(),
|
|
2616
|
+
simulation_voltage_probe_id: z121.string().optional(),
|
|
2617
|
+
subcircuit_connectivity_map_key: z121.string().optional(),
|
|
2598
2618
|
time_per_step: duration_ms,
|
|
2599
2619
|
start_time_ms: ms,
|
|
2600
2620
|
end_time_ms: ms,
|
|
2601
|
-
name:
|
|
2621
|
+
name: z121.string().optional()
|
|
2602
2622
|
}).describe("Stores voltage measurements over time for a simulation");
|
|
2603
2623
|
expectTypesMatch(true);
|
|
2604
2624
|
|
|
2605
2625
|
// src/simulation/simulation_switch.ts
|
|
2606
|
-
import { z as
|
|
2607
|
-
var simulation_switch =
|
|
2608
|
-
type:
|
|
2626
|
+
import { z as z122 } from "zod";
|
|
2627
|
+
var simulation_switch = z122.object({
|
|
2628
|
+
type: z122.literal("simulation_switch"),
|
|
2609
2629
|
simulation_switch_id: getZodPrefixedIdWithDefault("simulation_switch"),
|
|
2610
2630
|
closes_at: ms.optional(),
|
|
2611
2631
|
opens_at: ms.optional(),
|
|
2612
|
-
starts_closed:
|
|
2632
|
+
starts_closed: z122.boolean().optional(),
|
|
2613
2633
|
switching_frequency: frequency.optional()
|
|
2614
2634
|
}).describe("Defines a switch for simulation timing control");
|
|
2615
2635
|
expectTypesMatch(true);
|
|
2616
2636
|
|
|
2617
2637
|
// src/simulation/simulation_voltage_probe.ts
|
|
2618
|
-
import { z as
|
|
2619
|
-
var simulation_voltage_probe =
|
|
2620
|
-
type:
|
|
2638
|
+
import { z as z123 } from "zod";
|
|
2639
|
+
var simulation_voltage_probe = z123.object({
|
|
2640
|
+
type: z123.literal("simulation_voltage_probe"),
|
|
2621
2641
|
simulation_voltage_probe_id: getZodPrefixedIdWithDefault(
|
|
2622
2642
|
"simulation_voltage_probe"
|
|
2623
2643
|
),
|
|
2624
|
-
source_port_id:
|
|
2625
|
-
source_net_id:
|
|
2626
|
-
name:
|
|
2627
|
-
subcircuit_id:
|
|
2644
|
+
source_port_id: z123.string().optional(),
|
|
2645
|
+
source_net_id: z123.string().optional(),
|
|
2646
|
+
name: z123.string().optional(),
|
|
2647
|
+
subcircuit_id: z123.string().optional()
|
|
2628
2648
|
}).describe(
|
|
2629
2649
|
"Defines a voltage probe for simulation, connected to a port or a net"
|
|
2630
2650
|
).refine(
|
|
@@ -2636,8 +2656,8 @@ var simulation_voltage_probe = z122.object({
|
|
|
2636
2656
|
expectTypesMatch(true);
|
|
2637
2657
|
|
|
2638
2658
|
// src/any_circuit_element.ts
|
|
2639
|
-
import { z as
|
|
2640
|
-
var any_circuit_element =
|
|
2659
|
+
import { z as z124 } from "zod";
|
|
2660
|
+
var any_circuit_element = z124.union([
|
|
2641
2661
|
source_trace,
|
|
2642
2662
|
source_port,
|
|
2643
2663
|
any_source_component,
|
|
@@ -2714,6 +2734,7 @@ var any_circuit_element = z123.union([
|
|
|
2714
2734
|
pcb_thermal_spoke,
|
|
2715
2735
|
pcb_copper_pour,
|
|
2716
2736
|
pcb_component_outside_board_error,
|
|
2737
|
+
pcb_component_invalid_layer_error,
|
|
2717
2738
|
pcb_courtyard_rect,
|
|
2718
2739
|
pcb_courtyard_outline,
|
|
2719
2740
|
schematic_box,
|
|
@@ -2772,6 +2793,7 @@ export {
|
|
|
2772
2793
|
pcb_board,
|
|
2773
2794
|
pcb_breakout_point,
|
|
2774
2795
|
pcb_component,
|
|
2796
|
+
pcb_component_invalid_layer_error,
|
|
2775
2797
|
pcb_component_outside_board_error,
|
|
2776
2798
|
pcb_copper_pour,
|
|
2777
2799
|
pcb_copper_pour_brep,
|