Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/source/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export * from "./any_source_component"
export * from "./source_port"
export * from "./source_trace"
export * from "./base/source_component_base"
export * from "./pin_attributes"
export * from "./source_group"
export * from "./source_net"
export * from "./source_simple_battery"
Expand Down
15 changes: 15 additions & 0 deletions src/source/pin_attributes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { z } from "zod"
import { expectTypesMatch } from "src/utils/expect-types-match"

export const pin_attributes = z.object({
rats_nest_color: z.string().optional(),
})

export type PinAttributesInput = z.input<typeof pin_attributes>
type InferredPinAttributes = z.infer<typeof pin_attributes>

export interface PinAttributes {
rats_nest_color?: string
}

expectTypesMatch<PinAttributes, InferredPinAttributes>(true)
2 changes: 2 additions & 0 deletions src/source/source_net.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const source_net = z.object({
trace_width: z.number().optional(),
subcircuit_id: z.string().optional(),
subcircuit_connectivity_map_key: z.string().optional(),
rats_nest_color: z.string().optional(),
})

export type SourceNetInput = z.input<typeof source_net>
Expand All @@ -32,6 +33,7 @@ export interface SourceNet {
trace_width?: number
subcircuit_id?: string
subcircuit_connectivity_map_key?: string
rats_nest_color?: string
}

expectTypesMatch<SourceNet, InferredSourceNet>(true)
3 changes: 3 additions & 0 deletions src/source/source_port.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { z } from "zod"
import { expectTypesMatch } from "src/utils/expect-types-match"
import { pin_attributes, type PinAttributes } from "./pin_attributes"

export const source_port = z.object({
type: z.literal("source_port"),
Expand All @@ -10,6 +11,7 @@ export const source_port = z.object({
source_component_id: z.string(),
subcircuit_id: z.string().optional(),
subcircuit_connectivity_map_key: z.string().optional(),
pin_attributes: pin_attributes.optional(),
})

export type SourcePortInput = z.input<typeof source_port>
Expand All @@ -27,6 +29,7 @@ export interface SourcePort {
source_component_id: string
subcircuit_id?: string
subcircuit_connectivity_map_key?: string
pin_attributes?: PinAttributes
}

expectTypesMatch<SourcePort, InferredSourcePort>(true)