circuit-json 0.0.246 → 0.0.248
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 +27 -0
- package/dist/index.d.mts +353 -9
- package/dist/index.mjs +151 -105
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1928,67 +1928,84 @@ expectTypesMatch(
|
|
|
1928
1928
|
true
|
|
1929
1929
|
);
|
|
1930
1930
|
|
|
1931
|
-
// src/pcb/
|
|
1931
|
+
// src/pcb/external_footprint_load_error.ts
|
|
1932
1932
|
import { z as z91 } from "zod";
|
|
1933
|
-
var
|
|
1934
|
-
type: z91.literal("
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1933
|
+
var external_footprint_load_error = z91.object({
|
|
1934
|
+
type: z91.literal("external_footprint_load_error"),
|
|
1935
|
+
external_footprint_load_error_id: getZodPrefixedIdWithDefault(
|
|
1936
|
+
"external_footprint_load_error"
|
|
1937
|
+
),
|
|
1938
|
+
pcb_component_id: z91.string(),
|
|
1939
|
+
source_component_id: z91.string(),
|
|
1940
|
+
pcb_group_id: z91.string().optional(),
|
|
1938
1941
|
subcircuit_id: z91.string().optional(),
|
|
1942
|
+
footprinter_string: z91.string().optional(),
|
|
1943
|
+
error_type: z91.literal("external_footprint_load_error").default("external_footprint_load_error"),
|
|
1944
|
+
message: z91.string()
|
|
1945
|
+
}).describe("Defines an error when an external footprint fails to load");
|
|
1946
|
+
expectTypesMatch(true);
|
|
1947
|
+
|
|
1948
|
+
// src/pcb/pcb_group.ts
|
|
1949
|
+
import { z as z92 } from "zod";
|
|
1950
|
+
var pcb_group = z92.object({
|
|
1951
|
+
type: z92.literal("pcb_group"),
|
|
1952
|
+
pcb_group_id: getZodPrefixedIdWithDefault("pcb_group"),
|
|
1953
|
+
source_group_id: z92.string(),
|
|
1954
|
+
is_subcircuit: z92.boolean().optional(),
|
|
1955
|
+
subcircuit_id: z92.string().optional(),
|
|
1939
1956
|
width: length,
|
|
1940
1957
|
height: length,
|
|
1941
1958
|
center: point,
|
|
1942
|
-
pcb_component_ids:
|
|
1943
|
-
name:
|
|
1944
|
-
description:
|
|
1945
|
-
layout_mode:
|
|
1946
|
-
autorouter_configuration:
|
|
1959
|
+
pcb_component_ids: z92.array(z92.string()),
|
|
1960
|
+
name: z92.string().optional(),
|
|
1961
|
+
description: z92.string().optional(),
|
|
1962
|
+
layout_mode: z92.string().optional(),
|
|
1963
|
+
autorouter_configuration: z92.object({
|
|
1947
1964
|
trace_clearance: length
|
|
1948
1965
|
}).optional(),
|
|
1949
|
-
autorouter_used_string:
|
|
1966
|
+
autorouter_used_string: z92.string().optional()
|
|
1950
1967
|
}).describe("Defines a group of components on the PCB");
|
|
1951
1968
|
expectTypesMatch(true);
|
|
1952
1969
|
|
|
1953
1970
|
// src/pcb/pcb_autorouting_error.ts
|
|
1954
|
-
import { z as
|
|
1955
|
-
var pcb_autorouting_error =
|
|
1956
|
-
type:
|
|
1971
|
+
import { z as z93 } from "zod";
|
|
1972
|
+
var pcb_autorouting_error = z93.object({
|
|
1973
|
+
type: z93.literal("pcb_autorouting_error"),
|
|
1957
1974
|
pcb_error_id: getZodPrefixedIdWithDefault("pcb_autorouting_error"),
|
|
1958
|
-
error_type:
|
|
1959
|
-
message:
|
|
1960
|
-
subcircuit_id:
|
|
1975
|
+
error_type: z93.literal("pcb_autorouting_error").default("pcb_autorouting_error"),
|
|
1976
|
+
message: z93.string(),
|
|
1977
|
+
subcircuit_id: z93.string().optional()
|
|
1961
1978
|
}).describe("The autorouting has failed to route a portion of the board");
|
|
1962
1979
|
expectTypesMatch(true);
|
|
1963
1980
|
|
|
1964
1981
|
// src/pcb/pcb_manual_edit_conflict_warning.ts
|
|
1965
|
-
import { z as
|
|
1966
|
-
var pcb_manual_edit_conflict_warning =
|
|
1967
|
-
type:
|
|
1982
|
+
import { z as z94 } from "zod";
|
|
1983
|
+
var pcb_manual_edit_conflict_warning = z94.object({
|
|
1984
|
+
type: z94.literal("pcb_manual_edit_conflict_warning"),
|
|
1968
1985
|
pcb_manual_edit_conflict_warning_id: getZodPrefixedIdWithDefault(
|
|
1969
1986
|
"pcb_manual_edit_conflict_warning"
|
|
1970
1987
|
),
|
|
1971
|
-
warning_type:
|
|
1972
|
-
message:
|
|
1973
|
-
pcb_component_id:
|
|
1974
|
-
pcb_group_id:
|
|
1975
|
-
subcircuit_id:
|
|
1976
|
-
source_component_id:
|
|
1988
|
+
warning_type: z94.literal("pcb_manual_edit_conflict_warning").default("pcb_manual_edit_conflict_warning"),
|
|
1989
|
+
message: z94.string(),
|
|
1990
|
+
pcb_component_id: z94.string(),
|
|
1991
|
+
pcb_group_id: z94.string().optional(),
|
|
1992
|
+
subcircuit_id: z94.string().optional(),
|
|
1993
|
+
source_component_id: z94.string()
|
|
1977
1994
|
}).describe(
|
|
1978
1995
|
"Warning emitted when a component has both manual placement and explicit pcbX/pcbY coordinates"
|
|
1979
1996
|
);
|
|
1980
1997
|
expectTypesMatch(true);
|
|
1981
1998
|
|
|
1982
1999
|
// src/pcb/pcb_breakout_point.ts
|
|
1983
|
-
import { z as
|
|
1984
|
-
var pcb_breakout_point =
|
|
1985
|
-
type:
|
|
2000
|
+
import { z as z95 } from "zod";
|
|
2001
|
+
var pcb_breakout_point = z95.object({
|
|
2002
|
+
type: z95.literal("pcb_breakout_point"),
|
|
1986
2003
|
pcb_breakout_point_id: getZodPrefixedIdWithDefault("pcb_breakout_point"),
|
|
1987
|
-
pcb_group_id:
|
|
1988
|
-
subcircuit_id:
|
|
1989
|
-
source_trace_id:
|
|
1990
|
-
source_port_id:
|
|
1991
|
-
source_net_id:
|
|
2004
|
+
pcb_group_id: z95.string(),
|
|
2005
|
+
subcircuit_id: z95.string().optional(),
|
|
2006
|
+
source_trace_id: z95.string().optional(),
|
|
2007
|
+
source_port_id: z95.string().optional(),
|
|
2008
|
+
source_net_id: z95.string().optional(),
|
|
1992
2009
|
x: distance,
|
|
1993
2010
|
y: distance
|
|
1994
2011
|
}).describe(
|
|
@@ -1997,60 +2014,60 @@ var pcb_breakout_point = z94.object({
|
|
|
1997
2014
|
expectTypesMatch(true);
|
|
1998
2015
|
|
|
1999
2016
|
// src/pcb/pcb_ground_plane.ts
|
|
2000
|
-
import { z as
|
|
2001
|
-
var pcb_ground_plane =
|
|
2002
|
-
type:
|
|
2017
|
+
import { z as z96 } from "zod";
|
|
2018
|
+
var pcb_ground_plane = z96.object({
|
|
2019
|
+
type: z96.literal("pcb_ground_plane"),
|
|
2003
2020
|
pcb_ground_plane_id: getZodPrefixedIdWithDefault("pcb_ground_plane"),
|
|
2004
|
-
source_pcb_ground_plane_id:
|
|
2005
|
-
source_net_id:
|
|
2006
|
-
pcb_group_id:
|
|
2007
|
-
subcircuit_id:
|
|
2021
|
+
source_pcb_ground_plane_id: z96.string(),
|
|
2022
|
+
source_net_id: z96.string(),
|
|
2023
|
+
pcb_group_id: z96.string().optional(),
|
|
2024
|
+
subcircuit_id: z96.string().optional()
|
|
2008
2025
|
}).describe("Defines a ground plane on the PCB");
|
|
2009
2026
|
expectTypesMatch(true);
|
|
2010
2027
|
|
|
2011
2028
|
// src/pcb/pcb_ground_plane_region.ts
|
|
2012
|
-
import { z as
|
|
2013
|
-
var pcb_ground_plane_region =
|
|
2014
|
-
type:
|
|
2029
|
+
import { z as z97 } from "zod";
|
|
2030
|
+
var pcb_ground_plane_region = z97.object({
|
|
2031
|
+
type: z97.literal("pcb_ground_plane_region"),
|
|
2015
2032
|
pcb_ground_plane_region_id: getZodPrefixedIdWithDefault(
|
|
2016
2033
|
"pcb_ground_plane_region"
|
|
2017
2034
|
),
|
|
2018
|
-
pcb_ground_plane_id:
|
|
2019
|
-
pcb_group_id:
|
|
2020
|
-
subcircuit_id:
|
|
2035
|
+
pcb_ground_plane_id: z97.string(),
|
|
2036
|
+
pcb_group_id: z97.string().optional(),
|
|
2037
|
+
subcircuit_id: z97.string().optional(),
|
|
2021
2038
|
layer: layer_ref,
|
|
2022
|
-
points:
|
|
2039
|
+
points: z97.array(point)
|
|
2023
2040
|
}).describe("Defines a polygon region of a ground plane");
|
|
2024
2041
|
expectTypesMatch(true);
|
|
2025
2042
|
|
|
2026
2043
|
// src/pcb/pcb_thermal_spoke.ts
|
|
2027
|
-
import { z as
|
|
2028
|
-
var pcb_thermal_spoke =
|
|
2029
|
-
type:
|
|
2044
|
+
import { z as z98 } from "zod";
|
|
2045
|
+
var pcb_thermal_spoke = z98.object({
|
|
2046
|
+
type: z98.literal("pcb_thermal_spoke"),
|
|
2030
2047
|
pcb_thermal_spoke_id: getZodPrefixedIdWithDefault("pcb_thermal_spoke"),
|
|
2031
|
-
pcb_ground_plane_id:
|
|
2032
|
-
shape:
|
|
2033
|
-
spoke_count:
|
|
2048
|
+
pcb_ground_plane_id: z98.string(),
|
|
2049
|
+
shape: z98.string(),
|
|
2050
|
+
spoke_count: z98.number(),
|
|
2034
2051
|
spoke_thickness: distance,
|
|
2035
2052
|
spoke_inner_diameter: distance,
|
|
2036
2053
|
spoke_outer_diameter: distance,
|
|
2037
|
-
pcb_plated_hole_id:
|
|
2038
|
-
subcircuit_id:
|
|
2054
|
+
pcb_plated_hole_id: z98.string().optional(),
|
|
2055
|
+
subcircuit_id: z98.string().optional()
|
|
2039
2056
|
}).describe("Pattern for connecting a ground plane to a plated hole");
|
|
2040
2057
|
expectTypesMatch(true);
|
|
2041
2058
|
|
|
2042
2059
|
// src/pcb/pcb_copper_pour.ts
|
|
2043
|
-
import { z as
|
|
2044
|
-
var pcb_copper_pour_base =
|
|
2045
|
-
type:
|
|
2060
|
+
import { z as z99 } from "zod";
|
|
2061
|
+
var pcb_copper_pour_base = z99.object({
|
|
2062
|
+
type: z99.literal("pcb_copper_pour"),
|
|
2046
2063
|
pcb_copper_pour_id: getZodPrefixedIdWithDefault("pcb_copper_pour"),
|
|
2047
|
-
pcb_group_id:
|
|
2048
|
-
subcircuit_id:
|
|
2064
|
+
pcb_group_id: z99.string().optional(),
|
|
2065
|
+
subcircuit_id: z99.string().optional(),
|
|
2049
2066
|
layer: layer_ref,
|
|
2050
|
-
source_net_id:
|
|
2067
|
+
source_net_id: z99.string().optional()
|
|
2051
2068
|
});
|
|
2052
2069
|
var pcb_copper_pour_rect = pcb_copper_pour_base.extend({
|
|
2053
|
-
shape:
|
|
2070
|
+
shape: z99.literal("rect"),
|
|
2054
2071
|
center: point,
|
|
2055
2072
|
width: length,
|
|
2056
2073
|
height: length,
|
|
@@ -2058,51 +2075,76 @@ var pcb_copper_pour_rect = pcb_copper_pour_base.extend({
|
|
|
2058
2075
|
});
|
|
2059
2076
|
expectTypesMatch(true);
|
|
2060
2077
|
var pcb_copper_pour_brep = pcb_copper_pour_base.extend({
|
|
2061
|
-
shape:
|
|
2078
|
+
shape: z99.literal("brep"),
|
|
2062
2079
|
brep_shape
|
|
2063
2080
|
});
|
|
2064
2081
|
expectTypesMatch(true);
|
|
2065
2082
|
var pcb_copper_pour_polygon = pcb_copper_pour_base.extend({
|
|
2066
|
-
shape:
|
|
2067
|
-
points:
|
|
2083
|
+
shape: z99.literal("polygon"),
|
|
2084
|
+
points: z99.array(point)
|
|
2068
2085
|
});
|
|
2069
2086
|
expectTypesMatch(true);
|
|
2070
|
-
var pcb_copper_pour =
|
|
2087
|
+
var pcb_copper_pour = z99.discriminatedUnion("shape", [
|
|
2071
2088
|
pcb_copper_pour_rect,
|
|
2072
2089
|
pcb_copper_pour_brep,
|
|
2073
2090
|
pcb_copper_pour_polygon
|
|
2074
2091
|
]).describe("Defines a copper pour on the PCB.");
|
|
2075
2092
|
expectTypesMatch(true);
|
|
2076
2093
|
|
|
2094
|
+
// src/pcb/pcb_component_outside_board_error.ts
|
|
2095
|
+
import { z as z100 } from "zod";
|
|
2096
|
+
var pcb_component_outside_board_error = z100.object({
|
|
2097
|
+
type: z100.literal("pcb_component_outside_board_error"),
|
|
2098
|
+
pcb_component_outside_board_error_id: getZodPrefixedIdWithDefault(
|
|
2099
|
+
"pcb_component_outside_board_error"
|
|
2100
|
+
),
|
|
2101
|
+
error_type: z100.literal("pcb_component_outside_board_error").default("pcb_component_outside_board_error"),
|
|
2102
|
+
message: z100.string(),
|
|
2103
|
+
pcb_component_id: z100.string(),
|
|
2104
|
+
pcb_board_id: z100.string(),
|
|
2105
|
+
component_center: point,
|
|
2106
|
+
component_bounds: z100.object({
|
|
2107
|
+
min_x: z100.number(),
|
|
2108
|
+
max_x: z100.number(),
|
|
2109
|
+
min_y: z100.number(),
|
|
2110
|
+
max_y: z100.number()
|
|
2111
|
+
}),
|
|
2112
|
+
subcircuit_id: z100.string().optional(),
|
|
2113
|
+
source_component_id: z100.string().optional()
|
|
2114
|
+
}).describe(
|
|
2115
|
+
"Error emitted when a PCB component is placed outside the board boundaries"
|
|
2116
|
+
);
|
|
2117
|
+
expectTypesMatch(true);
|
|
2118
|
+
|
|
2077
2119
|
// src/cad/cad_component.ts
|
|
2078
|
-
import { z as
|
|
2079
|
-
var cad_component =
|
|
2080
|
-
type:
|
|
2081
|
-
cad_component_id:
|
|
2082
|
-
pcb_component_id:
|
|
2083
|
-
source_component_id:
|
|
2120
|
+
import { z as z101 } from "zod";
|
|
2121
|
+
var cad_component = z101.object({
|
|
2122
|
+
type: z101.literal("cad_component"),
|
|
2123
|
+
cad_component_id: z101.string(),
|
|
2124
|
+
pcb_component_id: z101.string(),
|
|
2125
|
+
source_component_id: z101.string(),
|
|
2084
2126
|
position: point3,
|
|
2085
2127
|
rotation: point3.optional(),
|
|
2086
2128
|
size: point3.optional(),
|
|
2087
2129
|
layer: layer_ref.optional(),
|
|
2088
|
-
subcircuit_id:
|
|
2130
|
+
subcircuit_id: z101.string().optional(),
|
|
2089
2131
|
// These are all ways to generate/load the 3d model
|
|
2090
|
-
footprinter_string:
|
|
2091
|
-
model_obj_url:
|
|
2092
|
-
model_stl_url:
|
|
2093
|
-
model_3mf_url:
|
|
2094
|
-
model_gltf_url:
|
|
2095
|
-
model_glb_url:
|
|
2096
|
-
model_step_url:
|
|
2097
|
-
model_wrl_url:
|
|
2098
|
-
model_jscad:
|
|
2132
|
+
footprinter_string: z101.string().optional(),
|
|
2133
|
+
model_obj_url: z101.string().optional(),
|
|
2134
|
+
model_stl_url: z101.string().optional(),
|
|
2135
|
+
model_3mf_url: z101.string().optional(),
|
|
2136
|
+
model_gltf_url: z101.string().optional(),
|
|
2137
|
+
model_glb_url: z101.string().optional(),
|
|
2138
|
+
model_step_url: z101.string().optional(),
|
|
2139
|
+
model_wrl_url: z101.string().optional(),
|
|
2140
|
+
model_jscad: z101.any().optional()
|
|
2099
2141
|
}).describe("Defines a component on the PCB");
|
|
2100
2142
|
expectTypesMatch(true);
|
|
2101
2143
|
|
|
2102
2144
|
// src/simulation/simulation_voltage_source.ts
|
|
2103
|
-
import { z as
|
|
2104
|
-
var wave_shape =
|
|
2105
|
-
var percentage =
|
|
2145
|
+
import { z as z102 } from "zod";
|
|
2146
|
+
var wave_shape = z102.enum(["sinewave", "square", "triangle", "sawtooth"]);
|
|
2147
|
+
var percentage = z102.union([z102.string(), z102.number()]).transform((val) => {
|
|
2106
2148
|
if (typeof val === "string") {
|
|
2107
2149
|
if (val.endsWith("%")) {
|
|
2108
2150
|
return parseFloat(val.slice(0, -1)) / 100;
|
|
@@ -2111,30 +2153,30 @@ var percentage = z100.union([z100.string(), z100.number()]).transform((val) => {
|
|
|
2111
2153
|
}
|
|
2112
2154
|
return val;
|
|
2113
2155
|
}).pipe(
|
|
2114
|
-
|
|
2156
|
+
z102.number().min(0, "Duty cycle must be non-negative").max(1, "Duty cycle cannot be greater than 100%")
|
|
2115
2157
|
);
|
|
2116
|
-
var simulation_dc_voltage_source =
|
|
2117
|
-
type:
|
|
2158
|
+
var simulation_dc_voltage_source = z102.object({
|
|
2159
|
+
type: z102.literal("simulation_voltage_source"),
|
|
2118
2160
|
simulation_voltage_source_id: getZodPrefixedIdWithDefault(
|
|
2119
2161
|
"simulation_voltage_source"
|
|
2120
2162
|
),
|
|
2121
|
-
is_dc_source:
|
|
2122
|
-
positive_source_port_id:
|
|
2123
|
-
negative_source_port_id:
|
|
2124
|
-
positive_source_net_id:
|
|
2125
|
-
negative_source_net_id:
|
|
2163
|
+
is_dc_source: z102.literal(true).optional().default(true),
|
|
2164
|
+
positive_source_port_id: z102.string().optional(),
|
|
2165
|
+
negative_source_port_id: z102.string().optional(),
|
|
2166
|
+
positive_source_net_id: z102.string().optional(),
|
|
2167
|
+
negative_source_net_id: z102.string().optional(),
|
|
2126
2168
|
voltage
|
|
2127
2169
|
}).describe("Defines a DC voltage source for simulation");
|
|
2128
|
-
var simulation_ac_voltage_source =
|
|
2129
|
-
type:
|
|
2170
|
+
var simulation_ac_voltage_source = z102.object({
|
|
2171
|
+
type: z102.literal("simulation_voltage_source"),
|
|
2130
2172
|
simulation_voltage_source_id: getZodPrefixedIdWithDefault(
|
|
2131
2173
|
"simulation_voltage_source"
|
|
2132
2174
|
),
|
|
2133
|
-
is_dc_source:
|
|
2134
|
-
terminal1_source_port_id:
|
|
2135
|
-
terminal2_source_port_id:
|
|
2136
|
-
terminal1_source_net_id:
|
|
2137
|
-
terminal2_source_net_id:
|
|
2175
|
+
is_dc_source: z102.literal(false),
|
|
2176
|
+
terminal1_source_port_id: z102.string().optional(),
|
|
2177
|
+
terminal2_source_port_id: z102.string().optional(),
|
|
2178
|
+
terminal1_source_net_id: z102.string().optional(),
|
|
2179
|
+
terminal2_source_net_id: z102.string().optional(),
|
|
2138
2180
|
voltage: voltage.optional(),
|
|
2139
2181
|
frequency: frequency.optional(),
|
|
2140
2182
|
peak_to_peak_voltage: voltage.optional(),
|
|
@@ -2142,14 +2184,14 @@ var simulation_ac_voltage_source = z100.object({
|
|
|
2142
2184
|
phase: rotation.optional(),
|
|
2143
2185
|
duty_cycle: percentage.optional()
|
|
2144
2186
|
}).describe("Defines an AC voltage source for simulation");
|
|
2145
|
-
var simulation_voltage_source =
|
|
2187
|
+
var simulation_voltage_source = z102.union([simulation_dc_voltage_source, simulation_ac_voltage_source]).describe("Defines a voltage source for simulation");
|
|
2146
2188
|
expectTypesMatch(true);
|
|
2147
2189
|
expectTypesMatch(true);
|
|
2148
2190
|
expectTypesMatch(true);
|
|
2149
2191
|
|
|
2150
2192
|
// src/any_circuit_element.ts
|
|
2151
|
-
import { z as
|
|
2152
|
-
var any_circuit_element =
|
|
2193
|
+
import { z as z103 } from "zod";
|
|
2194
|
+
var any_circuit_element = z103.union([
|
|
2153
2195
|
source_trace,
|
|
2154
2196
|
source_port,
|
|
2155
2197
|
any_source_component,
|
|
@@ -2180,6 +2222,7 @@ var any_circuit_element = z101.union([
|
|
|
2180
2222
|
pcb_component,
|
|
2181
2223
|
pcb_hole,
|
|
2182
2224
|
pcb_missing_footprint_error,
|
|
2225
|
+
external_footprint_load_error,
|
|
2183
2226
|
pcb_manual_edit_conflict_warning,
|
|
2184
2227
|
pcb_plated_hole,
|
|
2185
2228
|
pcb_keepout,
|
|
@@ -2213,6 +2256,7 @@ var any_circuit_element = z101.union([
|
|
|
2213
2256
|
pcb_ground_plane_region,
|
|
2214
2257
|
pcb_thermal_spoke,
|
|
2215
2258
|
pcb_copper_pour,
|
|
2259
|
+
pcb_component_outside_board_error,
|
|
2216
2260
|
schematic_box,
|
|
2217
2261
|
schematic_text,
|
|
2218
2262
|
schematic_line,
|
|
@@ -2246,6 +2290,7 @@ export {
|
|
|
2246
2290
|
capacitance,
|
|
2247
2291
|
current,
|
|
2248
2292
|
distance,
|
|
2293
|
+
external_footprint_load_error,
|
|
2249
2294
|
frequency,
|
|
2250
2295
|
getZodPrefixedIdWithDefault,
|
|
2251
2296
|
inductance,
|
|
@@ -2257,6 +2302,7 @@ export {
|
|
|
2257
2302
|
pcb_board,
|
|
2258
2303
|
pcb_breakout_point,
|
|
2259
2304
|
pcb_component,
|
|
2305
|
+
pcb_component_outside_board_error,
|
|
2260
2306
|
pcb_copper_pour,
|
|
2261
2307
|
pcb_copper_pour_brep,
|
|
2262
2308
|
pcb_copper_pour_polygon,
|