@tscircuit/fake-snippets 0.0.74 → 0.0.76

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 (25) hide show
  1. package/bun-tests/fake-snippets-api/routes/package_releases/get.test.ts +38 -0
  2. package/bun-tests/fake-snippets-api/routes/packages/images.test.ts +14 -11
  3. package/bun.lock +1 -4
  4. package/dist/bundle.js +20 -8
  5. package/fake-snippets-api/lib/public-mapping/public-map-package-release.ts +11 -0
  6. package/fake-snippets-api/routes/api/package_releases/get.ts +6 -1
  7. package/fake-snippets-api/routes/api/package_releases/update.ts +4 -1
  8. package/package.json +1 -2
  9. package/src/components/DownloadButtonAndMenu.tsx +26 -8
  10. package/src/components/Header.tsx +7 -7
  11. package/src/components/PackageBuildsPage/ErrorObject.ts +12 -0
  12. package/src/components/PackageBuildsPage/LogContent.tsx +32 -0
  13. package/src/components/PackageBuildsPage/PackageBuildDetailsPage.tsx +62 -4
  14. package/src/components/PackageBuildsPage/build-preview-content.tsx +21 -5
  15. package/src/components/PackageBuildsPage/capitalCase.ts +4 -0
  16. package/src/components/PackageBuildsPage/collapsible-section.tsx +34 -9
  17. package/src/components/PackageBuildsPage/getColorForDisplayStatus.ts +17 -0
  18. package/src/components/PackageBuildsPage/package-build-details-panel.tsx +80 -17
  19. package/src/components/PackageBuildsPage/package-build-header.tsx +15 -30
  20. package/src/components/ViewPackagePage/components/main-content-header.tsx +1 -1
  21. package/src/components/ViewPackagePage/components/package-header.tsx +0 -1
  22. package/src/components/dialogs/pcb-download-dialog.tsx +113 -0
  23. package/src/lib/download-fns/download-pcb-svg.ts +35 -0
  24. package/src/lib/utils/timeAgo.ts +14 -3
  25. package/bun-tests/fake-snippets-api/fixtures/get-circuit-json.ts +0 -10
@@ -116,3 +116,41 @@ test("POST /api/package_releases/get - should return circuit_json_build_error if
116
116
  expect(responseBody.ok).toBe(true)
117
117
  expect(responseBody.package_release.circuit_json_build_error).toBe(null)
118
118
  })
119
+
120
+ test("POST /api/package_releases/get?include_logs=true - should return include_logs if it exists", async () => {
121
+ const { axios } = await getTestServer()
122
+
123
+ // First create a package with valid name format
124
+ const packageResponse = await axios.post("/api/packages/create", {
125
+ name: "@test/package-4",
126
+ description: "Another test package",
127
+ })
128
+ expect(packageResponse.status).toBe(200)
129
+ const createdPackage = packageResponse.data.package
130
+
131
+ // Create a package release with a circuit_json_build_error
132
+ const releaseResponse = await axios.post("/api/package_releases/create", {
133
+ package_id: createdPackage.package_id,
134
+ version: "1.0.0",
135
+ is_latest: true,
136
+ })
137
+ expect(releaseResponse.status).toBe(200)
138
+ const createdRelease = releaseResponse.data.package_release
139
+
140
+ // Get the release
141
+ const getResponse = await axios.post(
142
+ "/api/package_releases/get",
143
+ {
144
+ package_release_id: createdRelease.package_release_id,
145
+ },
146
+ {
147
+ params: { include_logs: true },
148
+ },
149
+ )
150
+ expect(getResponse.status).toBe(200)
151
+
152
+ const responseBody = getResponse.data
153
+ expect(responseBody.ok).toBe(true)
154
+ expect(responseBody.package_release.transpilation_logs).toEqual([])
155
+ expect(responseBody.package_release.circuit_json_build_logs).toEqual([])
156
+ })
@@ -1,6 +1,5 @@
1
1
  import { getTestServer } from "bun-tests/fake-snippets-api/fixtures/get-test-server"
2
2
  import { expect, test } from "bun:test"
3
- import { generateCircuitJson } from "bun-tests/fake-snippets-api/fixtures/get-circuit-json"
4
3
  import md5 from "md5"
5
4
  test("get schematic svg of a package", async () => {
6
5
  const { axios, db } = await getTestServer()
@@ -18,16 +17,20 @@ test("get schematic svg of a package", async () => {
18
17
  is_latest: true,
19
18
  })
20
19
 
21
- const circuit_json = await generateCircuitJson({
22
- code: `
23
- import { A555Timer } from "@tsci/seveibar.a555timer"
24
-
25
- export default () => (
26
- <board width="10mm" height="10mm">
27
- <A555Timer name="U1" />
28
- </board>
29
- )`.trim(),
30
- })
20
+ const circuit_json = [
21
+ {
22
+ type: "pcb_board",
23
+ pcb_board_id: "pcb_board_0",
24
+ center: {
25
+ x: 0,
26
+ y: 0,
27
+ },
28
+ thickness: 1.4,
29
+ num_layers: 4,
30
+ width: 30,
31
+ height: 30,
32
+ },
33
+ ]
31
34
  // create a package file
32
35
  const pkg_file = await axios.post("/api/package_files/create", {
33
36
  package_release_id: pkg_release.data.package_release.package_release_id,
package/bun.lock CHANGED
@@ -41,7 +41,6 @@
41
41
  "@radix-ui/react-toggle": "^1.1.0",
42
42
  "@radix-ui/react-toggle-group": "^1.1.0",
43
43
  "@radix-ui/react-tooltip": "^1.1.2",
44
- "@tscircuit/eval": "^0.0.198",
45
44
  "@tscircuit/footprinter": "^0.0.169",
46
45
  "@tscircuit/layout": "^0.0.29",
47
46
  "@tscircuit/math-utils": "^0.0.10",
@@ -708,7 +707,7 @@
708
707
 
709
708
  "@tscircuit/create-snippet-url": ["@tscircuit/create-snippet-url@0.0.8", "", { "dependencies": { "fflate": "^0.8.2" }, "peerDependencies": { "typescript": "^5.0.0" } }, "sha512-VMixgwQRsOXlQGwVh2RZIFLLtsn8YWl2Bht61T26MHNM71A1Wzo5qGZtqcdbVkFnvlA42KmdVVjvxYDvEyWdJw=="],
710
709
 
711
- "@tscircuit/eval": ["@tscircuit/eval@0.0.198", "", { "peerDependencies": { "@tscircuit/core": "*", "circuit-json": "*", "jscad-fiber": "*", "typescript": "^5.0.0" } }, "sha512-OQxb01iPAze88US0jotwdorIaNB5rwzrOyD5CvBqeHrcYKXkeEYXcMmps0frOLwIen3Q8TcOcf2xP3XpQd5wjA=="],
710
+ "@tscircuit/eval": ["@tscircuit/eval@0.0.216", "", { "peerDependencies": { "@tscircuit/core": "*", "circuit-json": "*", "jscad-fiber": "*", "typescript": "^5.0.0" } }, "sha512-OPjTJSDfZyQm09tAn4+IephbBtUG+a+HtPf8A7wZQcOcI3gc0qRKYmzjbW/CStCzVNObf7ziO3uXWUNI5h0cBQ=="],
712
711
 
713
712
  "@tscircuit/featured-snippets": ["@tscircuit/featured-snippets@0.0.1", "", { "peerDependencies": { "typescript": "^5.0.0" } }, "sha512-SNUbCQmyaAaWq7DqqDbYlZkYttbfaObtp5rOheZvlJ2TGYvooECFpB8SzNo06bqKGoIwNjgaAGUTB2DcxdX7ow=="],
714
713
 
@@ -2822,8 +2821,6 @@
2822
2821
 
2823
2822
  "@tscircuit/runframe/@tscircuit/core": ["@tscircuit/core@0.0.424", "", { "dependencies": { "@lume/kiwi": "^0.4.3", "css-select": "^5.1.0", "format-si-unit": "^0.0.3", "nanoid": "^5.0.7", "performance-now": "^2.1.0", "react-reconciler": "^0.31.0", "react-reconciler-18": "npm:react-reconciler@0.29.2", "transformation-matrix": "^2.16.1", "zod": "^3.23.8" }, "peerDependencies": { "@tscircuit/capacity-autorouter": "*", "@tscircuit/checks": "*", "@tscircuit/circuit-json-util": "*", "@tscircuit/footprinter": "*", "@tscircuit/infgrid-ijump-astar": "*", "@tscircuit/math-utils": "*", "@tscircuit/props": "*", "@tscircuit/schematic-autolayout": "*", "circuit-json": "*", "circuit-json-to-connectivity-map": "*", "schematic-symbols": "*", "typescript": "^5.0.0" } }, "sha512-XmlSpty2ltVs0SxQ4z//RWlIk5S3FjAVPPwoOLPSfUrrL7JMWiyncbO2GQSzrNRbS01t7NapQ+3hwzKb+V2s9Q=="],
2824
2823
 
2825
- "@tscircuit/runframe/@tscircuit/eval": ["@tscircuit/eval@0.0.216", "", { "peerDependencies": { "@tscircuit/core": "*", "circuit-json": "*", "jscad-fiber": "*", "typescript": "^5.0.0" } }, "sha512-OPjTJSDfZyQm09tAn4+IephbBtUG+a+HtPf8A7wZQcOcI3gc0qRKYmzjbW/CStCzVNObf7ziO3uXWUNI5h0cBQ=="],
2826
-
2827
2824
  "@tscircuit/runframe/@tscircuit/props": ["@tscircuit/props@0.0.193", "", { "peerDependencies": { "@tscircuit/layout": "*", "circuit-json": "*", "react": "*", "zod": "*" } }, "sha512-IBG5uJGedxVG8KVuyaMVBDAzbuuR+CNQ/YezqlVHbmRKkn+OMB/f0zUCr9HpFnZ3+3w8ByybL+cv/mcrxfXKjA=="],
2828
2825
 
2829
2826
  "@tscircuit/runframe/circuit-to-svg": ["circuit-to-svg@0.0.131", "", { "dependencies": { "@types/node": "^22.5.5", "bun-types": "^1.1.40", "svgson": "^5.3.1", "transformation-matrix": "^2.16.1" }, "peerDependencies": { "@tscircuit/circuit-json-util": "*", "@tscircuit/footprinter": "*", "circuit-json": "*", "schematic-symbols": "*" } }, "sha512-iTpU1mNjhj38lnpLEysF6Mxm99LvuZgnXR4Qpt6pqdCwh+Fe9TfyEEbTXG9HngQAW7QQBoIVc/sA9sIbay9xIA=="],