@tscircuit/core 0.0.1385 → 0.0.1387

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.
Files changed (2) hide show
  1. package/dist/index.js +42 -23
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -114,7 +114,7 @@ import {
114
114
  pcb_manual_edit_conflict_warning,
115
115
  point3 as point32,
116
116
  rotation as rotation2,
117
- unknown_error_finding_part as unknown_error_finding_part2
117
+ source_part_not_found_warning as source_part_not_found_warning2
118
118
  } from "circuit-json";
119
119
  import Debug5 from "debug";
120
120
 
@@ -12611,8 +12611,8 @@ import {
12611
12611
  supplierProps
12612
12612
  } from "@tscircuit/props";
12613
12613
  import {
12614
- supplier_footprint_mismatch_warning,
12615
- unknown_error_finding_part
12614
+ source_part_not_found_warning,
12615
+ supplier_footprint_mismatch_warning
12616
12616
  } from "circuit-json";
12617
12617
  var SUPPLIER_FOOTPRINT_IOU_WARNING_THRESHOLD = 0.8;
12618
12618
  var supplierNames = supplierProps.shape.supplierPartNumbers.unwrap().keySchema.options;
@@ -12719,13 +12719,15 @@ function NormalComponent_doInitialSupplierFootprintMismatchWarning(component) {
12719
12719
  return;
12720
12720
  } catch (error) {
12721
12721
  const errorMessage = error instanceof Error ? error.message : String(error);
12722
- const errorObj = unknown_error_finding_part.parse({
12723
- type: "unknown_error_finding_part",
12722
+ const warning = source_part_not_found_warning.parse({
12723
+ type: "source_part_not_found_warning",
12724
12724
  message: `Failed to fetch supplier footprint for ${component.getString()} (${supplierName}:${supplierPartNumber}): ${errorMessage}`,
12725
- source_component_id: component.source_component_id,
12726
- subcircuit_id: component.getSubcircuit()?.subcircuit_id
12725
+ source_component_id: component.source_component_id ?? void 0,
12726
+ subcircuit_id: component.getSubcircuit()?.subcircuit_id ?? void 0,
12727
+ supplier_name: supplierName,
12728
+ supplier_part_number: supplierPartNumber
12727
12729
  });
12728
- db2.unknown_error_finding_part.insert(errorObj);
12730
+ db2.source_part_not_found_warning.insert(warning);
12729
12731
  return;
12730
12732
  }
12731
12733
  }
@@ -14259,7 +14261,9 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
14259
14261
  );
14260
14262
  }
14261
14263
  if (result === "Not found") {
14262
- return {};
14264
+ throw new Error(
14265
+ `Part not found for ${this.getString()}${footprinterString ? ` with footprint "${footprinterString}"` : ""}`
14266
+ );
14263
14267
  }
14264
14268
  throw new Error(
14265
14269
  `Invalid supplier part numbers format: Expected object but got string: "${result}"`
@@ -14309,13 +14313,15 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
14309
14313
  this._markDirty("PartsEngineRender");
14310
14314
  }).catch((error) => {
14311
14315
  this._asyncSupplierPartNumbers = {};
14312
- const errorObj = unknown_error_finding_part2.parse({
14313
- type: "unknown_error_finding_part",
14316
+ const warning = source_part_not_found_warning2.parse({
14317
+ type: "source_part_not_found_warning",
14314
14318
  message: `Failed to fetch supplier part numbers for ${this.getString()}: ${error.message}`,
14315
- source_component_id: this.source_component_id,
14316
- subcircuit_id: this.getSubcircuit()?.subcircuit_id
14319
+ source_component_id: this.source_component_id ?? void 0,
14320
+ subcircuit_id: this.getSubcircuit()?.subcircuit_id ?? void 0,
14321
+ manufacturer_part_number: source_component.manufacturer_part_number ?? void 0,
14322
+ part_name: source_component.name ?? void 0
14317
14323
  });
14318
- db.unknown_error_finding_part.insert(errorObj);
14324
+ db.source_part_not_found_warning.insert(warning);
14319
14325
  this._markDirty("PartsEngineRender");
14320
14326
  });
14321
14327
  });
@@ -25069,7 +25075,7 @@ import { identity as identity5 } from "transformation-matrix";
25069
25075
  var package_default = {
25070
25076
  name: "@tscircuit/core",
25071
25077
  type: "module",
25072
- version: "0.0.1384",
25078
+ version: "0.0.1386",
25073
25079
  types: "dist/index.d.ts",
25074
25080
  main: "dist/index.js",
25075
25081
  module: "dist/index.js",
@@ -25103,7 +25109,7 @@ var package_default = {
25103
25109
  "@tscircuit/alphabet": "0.0.25",
25104
25110
  "@tscircuit/breakout-point-solver": "github:tscircuit/breakout-point-solver#bac9629",
25105
25111
  "@tscircuit/capacity-autorouter": "^0.0.625",
25106
- "@tscircuit/checks": "0.0.140",
25112
+ "@tscircuit/checks": "0.0.141",
25107
25113
  "@tscircuit/circuit-json-util": "^0.0.97",
25108
25114
  "@tscircuit/common": "^0.0.20",
25109
25115
  "@tscircuit/copper-pour-solver": "0.0.35",
@@ -25132,7 +25138,7 @@ var package_default = {
25132
25138
  "bun-match-svg": "0.0.12",
25133
25139
  "calculate-elbow": "^0.0.12",
25134
25140
  "chokidar-cli": "^3.0.0",
25135
- "circuit-json": "^0.0.443",
25141
+ "circuit-json": "^0.0.445",
25136
25142
  "circuit-json-to-bpc": "^0.0.13",
25137
25143
  "circuit-json-to-connectivity-map": "^0.0.23",
25138
25144
  "circuit-json-to-gltf": "^0.0.105",
@@ -30259,7 +30265,7 @@ import { guessCableInsertCenter } from "@tscircuit/infer-cable-insertion-point";
30259
30265
  import {
30260
30266
  connectorProps
30261
30267
  } from "@tscircuit/props";
30262
- import { unknown_error_finding_part as unknown_error_finding_part3 } from "circuit-json";
30268
+ import { source_part_not_found_warning as source_part_not_found_warning3 } from "circuit-json";
30263
30269
 
30264
30270
  // lib/utils/connectors/convertCircuitJsonToUsbCStandardCircuitJson.ts
30265
30271
  var STANDARD_USB_C_PIN_LABELS = [
@@ -30478,13 +30484,15 @@ var Connector = class extends Chip {
30478
30484
  }
30479
30485
  _insertStandardConnectorCircuitJsonError(standard, message) {
30480
30486
  const { db } = this.root;
30481
- const errorObj = unknown_error_finding_part3.parse({
30482
- type: "unknown_error_finding_part",
30487
+ const warning = source_part_not_found_warning3.parse({
30488
+ type: "source_part_not_found_warning",
30483
30489
  message: `Failed to fetch circuit JSON for ${this.getString()} (standard="${standard}"): ${message}`,
30484
30490
  source_component_id: this.source_component_id ?? void 0,
30485
- subcircuit_id: this.getSubcircuit()?.subcircuit_id ?? void 0
30491
+ subcircuit_id: this.getSubcircuit()?.subcircuit_id ?? void 0,
30492
+ manufacturer_part_number: this._getConnectorProps().manufacturerPartNumber ?? this._getConnectorProps().mfn ?? void 0,
30493
+ part_name: this.name
30486
30494
  });
30487
- db.unknown_error_finding_part.insert(errorObj);
30495
+ db.source_part_not_found_warning.insert(warning);
30488
30496
  }
30489
30497
  _getSupplierPartNumbersToTry(supplierPartNumbers) {
30490
30498
  const partNumbers = [];
@@ -30704,9 +30712,20 @@ var Connector = class extends Chip {
30704
30712
  supplierPartNumbers,
30705
30713
  sourceComponentForQuery.manufacturer_part_number
30706
30714
  );
30707
- if (!circuitJson) return;
30715
+ if (!circuitJson) {
30716
+ this._insertStandardConnectorCircuitJsonError(
30717
+ standard,
30718
+ "part circuit JSON was not found"
30719
+ );
30720
+ return;
30721
+ }
30708
30722
  this._addConnectorFootprintFromCircuitJson(standard, circuitJson);
30709
30723
  } catch (error) {
30724
+ if (this.source_component_id) {
30725
+ db.source_component.update(this.source_component_id, {
30726
+ supplier_part_numbers: {}
30727
+ });
30728
+ }
30710
30729
  this._insertStandardConnectorCircuitJsonError(standard, error.message);
30711
30730
  }
30712
30731
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1385",
4
+ "version": "0.0.1387",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -35,7 +35,7 @@
35
35
  "@tscircuit/alphabet": "0.0.25",
36
36
  "@tscircuit/breakout-point-solver": "github:tscircuit/breakout-point-solver#bac9629",
37
37
  "@tscircuit/capacity-autorouter": "^0.0.625",
38
- "@tscircuit/checks": "0.0.140",
38
+ "@tscircuit/checks": "0.0.141",
39
39
  "@tscircuit/circuit-json-util": "^0.0.97",
40
40
  "@tscircuit/common": "^0.0.20",
41
41
  "@tscircuit/copper-pour-solver": "0.0.35",
@@ -64,7 +64,7 @@
64
64
  "bun-match-svg": "0.0.12",
65
65
  "calculate-elbow": "^0.0.12",
66
66
  "chokidar-cli": "^3.0.0",
67
- "circuit-json": "^0.0.443",
67
+ "circuit-json": "^0.0.445",
68
68
  "circuit-json-to-bpc": "^0.0.13",
69
69
  "circuit-json-to-connectivity-map": "^0.0.23",
70
70
  "circuit-json-to-gltf": "^0.0.105",