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
8 changes: 8 additions & 0 deletions cf-proxy/src/handlers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ export const TABLE_CONFIGS: Record<string, TableConfig> = {
package: { field: "package", type: "string" },
is_basic: { field: "is_basic", type: "boolean" },
is_preferred: { field: "is_preferred", type: "boolean" },
is_extended_promotional: {
field: "is_extended_promotional",
type: "boolean",
},
resistance: { field: "resistance", type: "number_tolerance" },
},
},
Expand All @@ -117,6 +121,10 @@ export const TABLE_CONFIGS: Record<string, TableConfig> = {
package: { field: "package", type: "string" },
is_basic: { field: "is_basic", type: "boolean" },
is_preferred: { field: "is_preferred", type: "boolean" },
is_extended_promotional: {
field: "is_extended_promotional",
type: "boolean",
},
capacitance: { field: "capacitance_farads", type: "number_tolerance" },
},
},
Expand Down
2 changes: 2 additions & 0 deletions lib/db/derivedtables/accelerometer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const accelerometerTableSpec: DerivedTableSpec<Accelerometer> = {
{ name: "has_uart", type: "boolean" },
{ name: "is_basic", type: "boolean" },
{ name: "is_preferred", type: "boolean" },
{ name: "is_extended_promotional", type: "boolean" },
],
listCandidateComponents: (db) =>
db
Expand Down Expand Up @@ -102,6 +103,7 @@ export const accelerometerTableSpec: DerivedTableSpec<Accelerometer> = {
in_stock: c.stock > 0,
is_basic: Boolean(c.basic),
is_preferred: Boolean(c.preferred),
is_extended_promotional: Boolean(c.extended_promotional),
package: c.package || "",
supply_voltage_min: voltageMin,
supply_voltage_max: voltageMax,
Expand Down
2 changes: 2 additions & 0 deletions lib/db/derivedtables/adc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const adcTableSpec: DerivedTableSpec<Adc> = {
{ name: "operating_temp_max", type: "real" },
{ name: "is_basic", type: "boolean" },
{ name: "is_preferred", type: "boolean" },
{ name: "is_extended_promotional", type: "boolean" },
],
listCandidateComponents: (db) =>
db
Expand Down Expand Up @@ -115,6 +116,7 @@ export const adcTableSpec: DerivedTableSpec<Adc> = {
in_stock: c.stock > 0,
is_basic: Boolean(c.basic),
is_preferred: Boolean(c.preferred),
is_extended_promotional: Boolean(c.extended_promotional),
package: c.package || "",
resolution_bits: resolution,
sampling_rate_hz: samplingRate,
Expand Down
2 changes: 2 additions & 0 deletions lib/db/derivedtables/analog_multiplexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const analogMultiplexerTableSpec: DerivedTableSpec<AnalogMultiplexer> = {
{ name: "channel_type", type: "text" },
{ name: "is_basic", type: "boolean" },
{ name: "is_preferred", type: "boolean" },
{ name: "is_extended_promotional", type: "boolean" },
],
listCandidateComponents: (db) =>
db
Expand Down Expand Up @@ -144,6 +145,7 @@ export const analogMultiplexerTableSpec: DerivedTableSpec<AnalogMultiplexer> = {
in_stock: c.stock > 0,
is_basic: Boolean(c.basic),
is_preferred: Boolean(c.preferred),
is_extended_promotional: Boolean(c.extended_promotional),
package: c.package || "",
num_channels: numChannels,
num_bits: numBits,
Expand Down
2 changes: 2 additions & 0 deletions lib/db/derivedtables/battery_holder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const batteryHolderTableSpec: DerivedTableSpec<BatteryHolder> = {
{ name: "operating_temp_max", type: "real" },
{ name: "is_basic", type: "boolean" },
{ name: "is_preferred", type: "boolean" },
{ name: "is_extended_promotional", type: "boolean" },
],
listCandidateComponents(db: KyselyDatabaseInstance) {
return db
Expand Down Expand Up @@ -74,6 +75,7 @@ export const batteryHolderTableSpec: DerivedTableSpec<BatteryHolder> = {
in_stock: Boolean((c.stock || 0) > 0),
is_basic: Boolean(c.basic),
is_preferred: Boolean(c.preferred),
is_extended_promotional: Boolean(c.extended_promotional),
package: String(c.package || ""),
connector_type: attrs["Connector Type"] || null,
battery_type: attrs["Battery Type"] || null,
Expand Down
2 changes: 2 additions & 0 deletions lib/db/derivedtables/bjt_transistor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const bjtTransistorTableSpec: DerivedTableSpec<BJTTransistor> = {
{ name: "temperature_range", type: "text" },
{ name: "is_basic", type: "boolean" },
{ name: "is_preferred", type: "boolean" },
{ name: "is_extended_promotional", type: "boolean" },
],
listCandidateComponents(db: KyselyDatabaseInstance) {
return db
Expand Down Expand Up @@ -74,6 +75,7 @@ export const bjtTransistorTableSpec: DerivedTableSpec<BJTTransistor> = {
in_stock: Boolean((c.stock || 0) > 0),
is_basic: Boolean(c.basic),
is_preferred: Boolean(c.preferred),
is_extended_promotional: Boolean(c.extended_promotional),
package: c.package || "",
current_gain: current_gain,
collector_current: collector_current,
Expand Down
2 changes: 2 additions & 0 deletions lib/db/derivedtables/boost_converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const boostConverterTableSpec: DerivedTableSpec<BoostConverter> = {
{ name: "number_of_outputs", type: "integer" },
{ name: "is_basic", type: "boolean" },
{ name: "is_preferred", type: "boolean" },
{ name: "is_extended_promotional", type: "boolean" },
],
listCandidateComponents: (db) =>
db
Expand Down Expand Up @@ -117,6 +118,7 @@ export const boostConverterTableSpec: DerivedTableSpec<BoostConverter> = {
in_stock: c.stock > 0,
is_basic: Boolean(c.basic),
is_preferred: Boolean(c.preferred),
is_extended_promotional: Boolean(c.extended_promotional),
package: c.package || "",
input_voltage_min: inputMin,
input_voltage_max: inputMax,
Expand Down
2 changes: 2 additions & 0 deletions lib/db/derivedtables/buck_boost_converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const buckBoostConverterTableSpec: DerivedTableSpec<BuckBoostConverter> =
{ name: "number_of_outputs", type: "integer" },
{ name: "is_basic", type: "boolean" },
{ name: "is_preferred", type: "boolean" },
{ name: "is_extended_promotional", type: "boolean" },
],
listCandidateComponents: (db) =>
db
Expand Down Expand Up @@ -121,6 +122,7 @@ export const buckBoostConverterTableSpec: DerivedTableSpec<BuckBoostConverter> =
in_stock: c.stock > 0,
is_basic: Boolean(c.basic),
is_preferred: Boolean(c.preferred),
is_extended_promotional: Boolean(c.extended_promotional),
package: c.package || "",
input_voltage_min: inputMin,
input_voltage_max: inputMax,
Expand Down
2 changes: 2 additions & 0 deletions lib/db/derivedtables/capacitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const capacitorTableSpec: DerivedTableSpec<Capacitor> = {
{ name: "capacitor_type", type: "text" },
{ name: "is_basic", type: "boolean" },
{ name: "is_preferred", type: "boolean" },
{ name: "is_extended_promotional", type: "boolean" },
],
listCandidateComponents: (db) =>
db
Expand Down Expand Up @@ -115,6 +116,7 @@ export const capacitorTableSpec: DerivedTableSpec<Capacitor> = {
in_stock: c.stock > 0,
is_basic: Boolean(c.basic),
is_preferred: Boolean(c.preferred),
is_extended_promotional: Boolean(c.extended_promotional),
capacitance_farads: capacitance,
tolerance_fraction: tolerance,
voltage_rating: voltage,
Expand Down
1 change: 1 addition & 0 deletions lib/db/derivedtables/component-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ export interface BaseComponent {
in_stock: boolean
is_basic: boolean
is_preferred: boolean
is_extended_promotional: boolean
attributes: Record<string, string>
}
2 changes: 2 additions & 0 deletions lib/db/derivedtables/dac.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const dacTableSpec: DerivedTableSpec<Dac> = {
{ name: "nonlinearity_lsb", type: "real" },
{ name: "is_basic", type: "boolean" },
{ name: "is_preferred", type: "boolean" },
{ name: "is_extended_promotional", type: "boolean" },
],
listCandidateComponents: (db) =>
db
Expand Down Expand Up @@ -129,6 +130,7 @@ export const dacTableSpec: DerivedTableSpec<Dac> = {
in_stock: c.stock > 0,
is_basic: Boolean(c.basic),
is_preferred: Boolean(c.preferred),
is_extended_promotional: Boolean(c.extended_promotional),
package: c.package || "",
resolution_bits: resolution,
num_channels: numChannels,
Expand Down
2 changes: 2 additions & 0 deletions lib/db/derivedtables/diode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const diodeTableSpec: DerivedTableSpec<Diode> = {
{ name: "configuration", type: "text" },
{ name: "is_basic", type: "boolean" },
{ name: "is_preferred", type: "boolean" },
{ name: "is_extended_promotional", type: "boolean" },
],
listCandidateComponents: (db) =>
db
Expand Down Expand Up @@ -159,6 +160,7 @@ export const diodeTableSpec: DerivedTableSpec<Diode> = {
in_stock: c.stock > 0,
is_basic: Boolean(c.basic),
is_preferred: Boolean(c.preferred),
is_extended_promotional: Boolean(c.extended_promotional),
package: c.package || "",
forward_voltage: forwardVoltage,
reverse_voltage: reverseVoltage,
Expand Down
2 changes: 2 additions & 0 deletions lib/db/derivedtables/fpc_connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const fpcConnectorTableSpec: DerivedTableSpec<FpcConnector> = {
{ name: "locking_feature", type: "text" },
{ name: "is_basic", type: "boolean" },
{ name: "is_preferred", type: "boolean" },
{ name: "is_extended_promotional", type: "boolean" },
],
listCandidateComponents(db: KyselyDatabaseInstance) {
return db
Expand Down Expand Up @@ -55,6 +56,7 @@ export const fpcConnectorTableSpec: DerivedTableSpec<FpcConnector> = {
in_stock: Boolean((c.stock || 0) > 0),
is_basic: Boolean(c.basic),
is_preferred: Boolean(c.preferred),
is_extended_promotional: Boolean(c.extended_promotional),
pitch_mm: parseNum(attrs["Pitch"]),
number_of_contacts: isNaN(contacts) ? null : contacts,
contact_type: attrs["Contact Type"] || null,
Expand Down
2 changes: 2 additions & 0 deletions lib/db/derivedtables/fpga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export const fpgaTableSpec: DerivedTableSpec<FPGA> = {
{ name: "logic_gates", type: "real" },
{ name: "is_basic", type: "boolean" },
{ name: "is_preferred", type: "boolean" },
{ name: "is_extended_promotional", type: "boolean" },
],
listCandidateComponents: (db) =>
db
Expand Down Expand Up @@ -99,6 +100,7 @@ export const fpgaTableSpec: DerivedTableSpec<FPGA> = {
in_stock: Boolean((c.stock ?? 0) > 0),
is_basic: Boolean(c.basic),
is_preferred: Boolean(c.preferred),
is_extended_promotional: Boolean(c.extended_promotional),
package: extra?.package ?? c.package ?? "",
type: attrs["Type"] ?? null,
logic_array_blocks: parseNumericValue(attrs["Logic Array Blocks"]),
Expand Down
2 changes: 2 additions & 0 deletions lib/db/derivedtables/fuse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const fuseTableSpec: DerivedTableSpec<Fuse> = {
{ name: "is_resettable", type: "boolean" },
{ name: "is_basic", type: "boolean" },
{ name: "is_preferred", type: "boolean" },
{ name: "is_extended_promotional", type: "boolean" },
],
listCandidateComponents(db: KyselyDatabaseInstance) {
return db
Expand Down Expand Up @@ -90,6 +91,7 @@ export const fuseTableSpec: DerivedTableSpec<Fuse> = {
in_stock: Boolean((c.stock || 0) > 0),
is_basic: Boolean(c.basic),
is_preferred: Boolean(c.preferred),
is_extended_promotional: Boolean(c.extended_promotional),
current_rating: current_rating as number,
voltage_rating: voltage_rating as number,
response_time,
Expand Down
2 changes: 2 additions & 0 deletions lib/db/derivedtables/gas_sensor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const gasSensorTableSpec: DerivedTableSpec<GasSensor> = {
{ name: "measures_explosive_gases", type: "boolean" },
{ name: "is_basic", type: "boolean" },
{ name: "is_preferred", type: "boolean" },
{ name: "is_extended_promotional", type: "boolean" },
],
listCandidateComponents(db) {
return db
Expand Down Expand Up @@ -82,6 +83,7 @@ export const gasSensorTableSpec: DerivedTableSpec<GasSensor> = {
in_stock: c.stock > 0,
is_basic: Boolean(c.basic),
is_preferred: Boolean(c.preferred),
is_extended_promotional: Boolean(c.extended_promotional),
package: c.package || "",
sensor_type: sensorType,
measures_air_quality: measuresAirQuality,
Expand Down
2 changes: 2 additions & 0 deletions lib/db/derivedtables/gyroscope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const gyroscopeTableSpec: DerivedTableSpec<Gyroscope> = {
{ name: "has_uart", type: "boolean" },
{ name: "is_basic", type: "boolean" },
{ name: "is_preferred", type: "boolean" },
{ name: "is_extended_promotional", type: "boolean" },
],
listCandidateComponents: (db) =>
db
Expand Down Expand Up @@ -106,6 +107,7 @@ export const gyroscopeTableSpec: DerivedTableSpec<Gyroscope> = {
in_stock: c.stock > 0,
is_basic: Boolean(c.basic),
is_preferred: Boolean(c.preferred),
is_extended_promotional: Boolean(c.extended_promotional),
package: c.package || "",
supply_voltage_min: voltageMin,
supply_voltage_max: voltageMax,
Expand Down
2 changes: 2 additions & 0 deletions lib/db/derivedtables/header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const headerTableSpec: DerivedTableSpec<Header> = {
{ name: "is_right_angle", type: "boolean" },
{ name: "is_basic", type: "boolean" },
{ name: "is_preferred", type: "boolean" },
{ name: "is_extended_promotional", type: "boolean" },
],
listCandidateComponents: (db) =>
db
Expand Down Expand Up @@ -197,6 +198,7 @@ export const headerTableSpec: DerivedTableSpec<Header> = {
in_stock: c.stock > 0,
is_basic: Boolean(c.basic),
is_preferred: Boolean(c.preferred),
is_extended_promotional: Boolean(c.extended_promotional),
price1: extractMinQPrice(c.price)!,
package: c.package || "",
pitch_mm: pitch,
Expand Down
2 changes: 2 additions & 0 deletions lib/db/derivedtables/io_expander.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const ioExpanderTableSpec: DerivedTableSpec<IoExpander> = {
{ name: "source_current_ma", type: "real" },
{ name: "is_basic", type: "boolean" },
{ name: "is_preferred", type: "boolean" },
{ name: "is_extended_promotional", type: "boolean" },
],
listCandidateComponents: (db) =>
db
Expand Down Expand Up @@ -139,6 +140,7 @@ export const ioExpanderTableSpec: DerivedTableSpec<IoExpander> = {
in_stock: c.stock > 0,
is_basic: Boolean(c.basic),
is_preferred: Boolean(c.preferred),
is_extended_promotional: Boolean(c.extended_promotional),
package: c.package || "",
num_gpios: numGpios,
supply_voltage_min: voltageMin,
Expand Down
2 changes: 2 additions & 0 deletions lib/db/derivedtables/jst_connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const jstConnectorTableSpec: DerivedTableSpec<JstConnector> = {
{ name: "reference_series", type: "text" },
{ name: "is_basic", type: "boolean" },
{ name: "is_preferred", type: "boolean" },
{ name: "is_extended_promotional", type: "boolean" },
],
listCandidateComponents(db: KyselyDatabaseInstance) {
return db
Expand Down Expand Up @@ -69,6 +70,7 @@ export const jstConnectorTableSpec: DerivedTableSpec<JstConnector> = {
in_stock: Boolean((c.stock || 0) > 0),
is_basic: Boolean(c.basic),
is_preferred: Boolean(c.preferred),
is_extended_promotional: Boolean(c.extended_promotional),
package: String(c.package || ""),
pitch_mm: parseNum(attrs["Pitch"]),
num_rows: isNaN(numRows) ? null : numRows,
Expand Down
2 changes: 2 additions & 0 deletions lib/db/derivedtables/lcd_display.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const lcdDisplayTableSpec: DerivedTableSpec<LCDDisplay> = {
{ name: "display_type", type: "text" },
{ name: "is_basic", type: "boolean" },
{ name: "is_preferred", type: "boolean" },
{ name: "is_extended_promotional", type: "boolean" },
],
listCandidateComponents(db: KyselyDatabaseInstance) {
return db
Expand Down Expand Up @@ -64,6 +65,7 @@ export const lcdDisplayTableSpec: DerivedTableSpec<LCDDisplay> = {
in_stock: Boolean((c.stock || 0) > 0),
is_basic: Boolean(c.basic),
is_preferred: Boolean(c.preferred),
is_extended_promotional: Boolean(c.extended_promotional),
package: String(c.package || ""),
display_size,
resolution,
Expand Down
2 changes: 2 additions & 0 deletions lib/db/derivedtables/led.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const ledTableSpec: DerivedTableSpec<Led> = {
{ name: "is_rgb", type: "boolean" },
{ name: "is_basic", type: "boolean" },
{ name: "is_preferred", type: "boolean" },
{ name: "is_extended_promotional", type: "boolean" },
],
listCandidateComponents: (db) =>
db
Expand Down Expand Up @@ -165,6 +166,7 @@ export const ledTableSpec: DerivedTableSpec<Led> = {
in_stock: c.stock > 0,
is_basic: Boolean(c.basic),
is_preferred: Boolean(c.preferred),
is_extended_promotional: Boolean(c.extended_promotional),
package: c.package || "",
forward_voltage: forwardVoltage,
forward_current: forwardCurrent,
Expand Down
2 changes: 2 additions & 0 deletions lib/db/derivedtables/led_dot_matrix_display.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const ledDotMatrixDisplayTableSpec: DerivedTableSpec<LEDDotMatrixDisplay>
{ name: "color", type: "text" },
{ name: "is_basic", type: "boolean" },
{ name: "is_preferred", type: "boolean" },
{ name: "is_extended_promotional", type: "boolean" },
],
listCandidateComponents(db: KyselyDatabaseInstance) {
return db
Expand Down Expand Up @@ -57,6 +58,7 @@ export const ledDotMatrixDisplayTableSpec: DerivedTableSpec<LEDDotMatrixDisplay>
in_stock: Boolean((c.stock || 0) > 0),
is_basic: Boolean(c.basic),
is_preferred: Boolean(c.preferred),
is_extended_promotional: Boolean(c.extended_promotional),
package: String(c.package || ""),
matrix_size,
color,
Expand Down
2 changes: 2 additions & 0 deletions lib/db/derivedtables/led_driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const ledDriverTableSpec: DerivedTableSpec<LedDriver> = {
{ name: "mounting_style", type: "text" },
{ name: "is_basic", type: "boolean" },
{ name: "is_preferred", type: "boolean" },
{ name: "is_extended_promotional", type: "boolean" },
],
listCandidateComponents(db: KyselyDatabaseInstance) {
return db
Expand Down Expand Up @@ -77,6 +78,7 @@ export const ledDriverTableSpec: DerivedTableSpec<LedDriver> = {
in_stock: Boolean((c.stock || 0) > 0),
is_basic: Boolean(c.basic),
is_preferred: Boolean(c.preferred),
is_extended_promotional: Boolean(c.extended_promotional),
package: String(c.package || ""),
supply_voltage_min: parseValue(attrs["Input Voltage"]?.split("~")[0]),
supply_voltage_max: parseValue(attrs["Input Voltage"]?.split("~")[1]),
Expand Down
2 changes: 2 additions & 0 deletions lib/db/derivedtables/led_segment_display.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const ledSegmentDisplayTableSpec: DerivedTableSpec<LEDSegmentDisplay> = {
{ name: "color", type: "text" },
{ name: "is_basic", type: "boolean" },
{ name: "is_preferred", type: "boolean" },
{ name: "is_extended_promotional", type: "boolean" },
],

listCandidateComponents(db: KyselyDatabaseInstance) {
Expand Down Expand Up @@ -70,6 +71,7 @@ export const ledSegmentDisplayTableSpec: DerivedTableSpec<LEDSegmentDisplay> = {
in_stock: Boolean((c.stock || 0) > 0),
is_basic: Boolean(c.basic),
is_preferred: Boolean(c.preferred),
is_extended_promotional: Boolean(c.extended_promotional),
package: String(c.package || ""),
positions,
type,
Expand Down
Loading
Loading