@tscircuit/fake-snippets 0.0.107 → 0.0.108

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 (35) hide show
  1. package/api/generated-index.js +82 -22
  2. package/biome.json +7 -1
  3. package/bun-tests/fake-snippets-api/routes/package_builds/get.test.ts +0 -15
  4. package/bun-tests/fake-snippets-api/routes/package_builds/list.test.ts +0 -12
  5. package/dist/bundle.js +23 -23
  6. package/dist/index.d.ts +21 -15
  7. package/dist/index.js +17 -17
  8. package/dist/schema.d.ts +24 -24
  9. package/dist/schema.js +5 -5
  10. package/fake-snippets-api/lib/db/db-client.ts +10 -1
  11. package/fake-snippets-api/lib/db/schema.ts +3 -3
  12. package/fake-snippets-api/lib/db/seed.ts +6 -9
  13. package/fake-snippets-api/lib/public-mapping/public-map-package-build.ts +0 -3
  14. package/fake-snippets-api/lib/public-mapping/public-map-package-release.ts +3 -0
  15. package/package.json +1 -1
  16. package/src/App.tsx +12 -9
  17. package/src/components/FileSidebar.tsx +14 -159
  18. package/src/components/PackageBreadcrumb.tsx +1 -1
  19. package/src/components/ViewPackagePage/components/mobile-sidebar.tsx +1 -1
  20. package/src/components/ViewPackagePage/components/sidebar-about-section.tsx +18 -2
  21. package/src/components/ViewPackagePage/components/sidebar-releases-section.tsx +1 -1
  22. package/src/components/preview/BuildsList.tsx +20 -9
  23. package/src/components/preview/ConnectedPackagesList.tsx +73 -60
  24. package/src/components/preview/ConnectedRepoOverview.tsx +160 -154
  25. package/src/components/preview/PackageReleasesDashboard.tsx +11 -5
  26. package/src/components/preview/index.tsx +16 -153
  27. package/src/index.css +24 -0
  28. package/src/lib/utils/transformFilesToTreeData.tsx +195 -0
  29. package/src/pages/404.tsx +3 -5
  30. package/src/pages/preview-release.tsx +269 -0
  31. package/src/pages/release-builds.tsx +0 -8
  32. package/src/pages/release-detail.tsx +17 -15
  33. package/src/pages/releases.tsx +5 -1
  34. package/src/hooks/use-snippets-base-api-url.ts +0 -3
  35. package/src/pages/preview-build.tsx +0 -380
package/dist/index.d.ts CHANGED
@@ -521,6 +521,9 @@ declare const packageReleaseSchema: z.ZodObject<{
521
521
  is_pr_preview: z.ZodDefault<z.ZodBoolean>;
522
522
  github_pr_number: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
523
523
  latest_package_build_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
524
+ branch_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
525
+ commit_message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
526
+ commit_author: z.ZodOptional<z.ZodNullable<z.ZodString>>;
524
527
  }, "strip", z.ZodTypeAny, {
525
528
  package_release_id: string;
526
529
  created_at: string;
@@ -558,6 +561,9 @@ declare const packageReleaseSchema: z.ZodObject<{
558
561
  ai_review_logs?: any[] | null | undefined;
559
562
  github_pr_number?: number | null | undefined;
560
563
  latest_package_build_id?: string | null | undefined;
564
+ branch_name?: string | null | undefined;
565
+ commit_message?: string | null | undefined;
566
+ commit_author?: string | null | undefined;
561
567
  }, {
562
568
  package_release_id: string;
563
569
  created_at: string;
@@ -595,6 +601,9 @@ declare const packageReleaseSchema: z.ZodObject<{
595
601
  is_pr_preview?: boolean | undefined;
596
602
  github_pr_number?: number | null | undefined;
597
603
  latest_package_build_id?: string | null | undefined;
604
+ branch_name?: string | null | undefined;
605
+ commit_message?: string | null | undefined;
606
+ commit_author?: string | null | undefined;
598
607
  }>;
599
608
  type PackageRelease = z.infer<typeof packageReleaseSchema>;
600
609
  declare const packageFileSchema: z.ZodObject<{
@@ -845,9 +854,6 @@ declare const packageBuildSchema: z.ZodObject<{
845
854
  build_error_last_updated_at: z.ZodString;
846
855
  preview_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
847
856
  build_logs: z.ZodOptional<z.ZodNullable<z.ZodString>>;
848
- branch_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
849
- commit_message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
850
- commit_author: z.ZodOptional<z.ZodNullable<z.ZodString>>;
851
857
  }, "strip", z.ZodTypeAny, {
852
858
  package_release_id: string;
853
859
  created_at: string;
@@ -869,9 +875,6 @@ declare const packageBuildSchema: z.ZodObject<{
869
875
  build_error?: string | null | undefined;
870
876
  preview_url?: string | null | undefined;
871
877
  build_logs?: string | null | undefined;
872
- branch_name?: string | null | undefined;
873
- commit_message?: string | null | undefined;
874
- commit_author?: string | null | undefined;
875
878
  }, {
876
879
  package_release_id: string;
877
880
  created_at: string;
@@ -893,9 +896,6 @@ declare const packageBuildSchema: z.ZodObject<{
893
896
  build_error?: string | null | undefined;
894
897
  preview_url?: string | null | undefined;
895
898
  build_logs?: string | null | undefined;
896
- branch_name?: string | null | undefined;
897
- commit_message?: string | null | undefined;
898
- commit_author?: string | null | undefined;
899
899
  }>;
900
900
  type PackageBuild = z.infer<typeof packageBuildSchema>;
901
901
 
@@ -964,6 +964,9 @@ declare const createDatabase: ({ seed }?: {
964
964
  ai_review_logs?: any[] | null | undefined;
965
965
  github_pr_number?: number | null | undefined;
966
966
  latest_package_build_id?: string | null | undefined;
967
+ branch_name?: string | null | undefined;
968
+ commit_message?: string | null | undefined;
969
+ commit_author?: string | null | undefined;
967
970
  }[];
968
971
  packageFiles: {
969
972
  package_release_id: string;
@@ -1199,9 +1202,6 @@ declare const createDatabase: ({ seed }?: {
1199
1202
  build_error?: string | null | undefined;
1200
1203
  preview_url?: string | null | undefined;
1201
1204
  build_logs?: string | null | undefined;
1202
- branch_name?: string | null | undefined;
1203
- commit_message?: string | null | undefined;
1204
- commit_author?: string | null | undefined;
1205
1205
  }[];
1206
1206
  }, "addOrder" | "getOrderById" | "getOrderFilesByOrderId" | "addOrderQuote" | "getOrderQuoteById" | "getJlcpcbOrderStatesByOrderId" | "getJlcpcbOrderStepRunsByJlcpcbOrderStateId" | "updateOrder" | "addJlcpcbOrderState" | "updateJlcpcbOrderState" | "addOrderFile" | "getOrderFileById" | "addAccount" | "addAccountPackage" | "getAccountPackageById" | "updateAccountPackage" | "deleteAccountPackage" | "addSnippet" | "getLatestSnippets" | "getTrendingSnippets" | "getPackagesByAuthor" | "getSnippetByAuthorAndName" | "updateSnippet" | "getSnippetById" | "searchSnippets" | "searchPackages" | "searchAccounts" | "deleteSnippet" | "addSession" | "getSessions" | "createLoginPage" | "getLoginPage" | "updateLoginPage" | "getAccount" | "updateAccount" | "createSession" | "addStar" | "removeStar" | "hasStarred" | "addPackage" | "updatePackage" | "getPackageById" | "getPackageReleaseById" | "addPackageRelease" | "updatePackageRelease" | "deletePackageFile" | "addPackageFile" | "updatePackageFile" | "getStarCount" | "getPackageFilesByReleaseId" | "updatePackageReleaseFsSha" | "addAiReview" | "updateAiReview" | "getAiReviewById" | "listAiReviews" | "addDatasheet" | "getDatasheetById" | "getDatasheetByChipName" | "listDatasheets" | "updateDatasheet" | "addPackageBuild" | "getPackageBuildById" | "getPackageBuildsByReleaseId" | "updatePackageBuild"> & {
1207
1207
  addOrder: (order: Omit<Order, "order_id">) => Order;
@@ -1243,6 +1243,9 @@ declare const createDatabase: ({ seed }?: {
1243
1243
  addSnippet: (snippet: Omit<z.input<typeof snippetSchema>, "snippet_id" | "package_release_id"> & {
1244
1244
  creator_account_id?: string;
1245
1245
  github_repo_full_name?: string;
1246
+ branch_name?: string;
1247
+ commit_message?: string;
1248
+ commit_author?: string;
1246
1249
  }) => Snippet;
1247
1250
  getLatestSnippets: (limit: number) => Snippet[];
1248
1251
  getTrendingSnippets: (limit: number, since: string) => Snippet[];
@@ -1366,6 +1369,9 @@ declare const createDatabase: ({ seed }?: {
1366
1369
  ai_review_logs?: any[] | null | undefined;
1367
1370
  github_pr_number?: number | null | undefined;
1368
1371
  latest_package_build_id?: string | null | undefined;
1372
+ branch_name?: string | null | undefined;
1373
+ commit_message?: string | null | undefined;
1374
+ commit_author?: string | null | undefined;
1369
1375
  }[];
1370
1376
  packageFiles: {
1371
1377
  package_release_id: string;
@@ -1601,9 +1607,6 @@ declare const createDatabase: ({ seed }?: {
1601
1607
  build_error?: string | null | undefined;
1602
1608
  preview_url?: string | null | undefined;
1603
1609
  build_logs?: string | null | undefined;
1604
- branch_name?: string | null | undefined;
1605
- commit_message?: string | null | undefined;
1606
- commit_author?: string | null | undefined;
1607
1610
  }[];
1608
1611
  }, "addOrder" | "getOrderById" | "getOrderFilesByOrderId" | "addOrderQuote" | "getOrderQuoteById" | "getJlcpcbOrderStatesByOrderId" | "getJlcpcbOrderStepRunsByJlcpcbOrderStateId" | "updateOrder" | "addJlcpcbOrderState" | "updateJlcpcbOrderState" | "addOrderFile" | "getOrderFileById" | "addAccount" | "addAccountPackage" | "getAccountPackageById" | "updateAccountPackage" | "deleteAccountPackage" | "addSnippet" | "getLatestSnippets" | "getTrendingSnippets" | "getPackagesByAuthor" | "getSnippetByAuthorAndName" | "updateSnippet" | "getSnippetById" | "searchSnippets" | "searchPackages" | "searchAccounts" | "deleteSnippet" | "addSession" | "getSessions" | "createLoginPage" | "getLoginPage" | "updateLoginPage" | "getAccount" | "updateAccount" | "createSession" | "addStar" | "removeStar" | "hasStarred" | "addPackage" | "updatePackage" | "getPackageById" | "getPackageReleaseById" | "addPackageRelease" | "updatePackageRelease" | "deletePackageFile" | "addPackageFile" | "updatePackageFile" | "getStarCount" | "getPackageFilesByReleaseId" | "updatePackageReleaseFsSha" | "addAiReview" | "updateAiReview" | "getAiReviewById" | "listAiReviews" | "addDatasheet" | "getDatasheetById" | "getDatasheetByChipName" | "listDatasheets" | "updateDatasheet" | "addPackageBuild" | "getPackageBuildById" | "getPackageBuildsByReleaseId" | "updatePackageBuild"> & {
1609
1612
  addOrder: (order: Omit<Order, "order_id">) => Order;
@@ -1645,6 +1648,9 @@ declare const createDatabase: ({ seed }?: {
1645
1648
  addSnippet: (snippet: Omit<z.input<typeof snippetSchema>, "snippet_id" | "package_release_id"> & {
1646
1649
  creator_account_id?: string;
1647
1650
  github_repo_full_name?: string;
1651
+ branch_name?: string;
1652
+ commit_message?: string;
1653
+ commit_author?: string;
1648
1654
  }) => Snippet;
1649
1655
  getLatestSnippets: (limit: number) => Snippet[];
1650
1656
  getTrendingSnippets: (limit: number, since: string) => Snippet[];
package/dist/index.js CHANGED
@@ -214,7 +214,10 @@ var packageReleaseSchema = z.object({
214
214
  is_pr_preview: z.boolean().default(false),
215
215
  github_pr_number: z.number().nullable().optional(),
216
216
  // Latest Build Reference
217
- latest_package_build_id: z.string().nullable().optional()
217
+ latest_package_build_id: z.string().nullable().optional(),
218
+ branch_name: z.string().nullable().optional(),
219
+ commit_message: z.string().nullable().optional(),
220
+ commit_author: z.string().nullable().optional()
218
221
  });
219
222
  var packageFileSchema = z.object({
220
223
  package_file_id: z.string(),
@@ -313,10 +316,7 @@ var packageBuildSchema = z.object({
313
316
  build_error: z.string().nullable().optional(),
314
317
  build_error_last_updated_at: z.string().datetime(),
315
318
  preview_url: z.string().nullable().optional(),
316
- build_logs: z.string().nullable().optional(),
317
- branch_name: z.string().nullable().optional(),
318
- commit_message: z.string().nullable().optional(),
319
- commit_author: z.string().nullable().optional()
319
+ build_logs: z.string().nullable().optional()
320
320
  });
321
321
  var databaseSchema = z.object({
322
322
  idCounter: z.number().default(0),
@@ -541,6 +541,9 @@ var seed = (db) => {
541
541
  unscoped_name: "my-test-board",
542
542
  github_repo_full_name: "testuser/my-test-board",
543
543
  owner_name: "testuser",
544
+ branch_name: "main",
545
+ commit_message: "Attempted build of a555timer-square-wave package",
546
+ commit_author: "testuser",
544
547
  creator_account_id: account_id,
545
548
  code: `
546
549
  import { A555Timer } from "@tsci/seveibar.a555timer"
@@ -1072,10 +1075,7 @@ export default () => (
1072
1075
  build_error: "Build failed: Unable to complete transpilation step",
1073
1076
  build_error_last_updated_at: new Date(Date.now() - 14e3).toISOString(),
1074
1077
  preview_url: null,
1075
- build_logs: "Build process:\n1. Environment setup - OK\n2. Dependency resolution - OK\n3. Code compilation - FAILED\nError: Invalid syntax in component declaration\nBuild terminated with errors",
1076
- branch_name: "main",
1077
- commit_message: "Attempted build of a555timer-square-wave package",
1078
- commit_author: "testuser"
1078
+ build_logs: "Build process:\n1. Environment setup - OK\n2. Dependency resolution - OK\n3. Code compilation - FAILED\nError: Invalid syntax in component declaration\nBuild terminated with errors"
1079
1079
  });
1080
1080
  const release1 = db.getPackageReleaseById(packageReleaseId1);
1081
1081
  db.updatePackageRelease({
@@ -1613,6 +1613,9 @@ exports.A555Timer = A555Timer;
1613
1613
  name: "testuser/a555timer-square-wave",
1614
1614
  unscoped_name: "a555timer-square-wave",
1615
1615
  owner_name: "testuser",
1616
+ branch_name: "main",
1617
+ commit_message: "Attempted build of a555timer-square-wave package",
1618
+ commit_author: "testuser",
1616
1619
  creator_account_id: account_id,
1617
1620
  code: `
1618
1621
  import { A555Timer } from "@tsci/seveibar.a555timer"
@@ -2145,10 +2148,7 @@ export const SquareWaveModule = () => (
2145
2148
  build_error: "Build failed: Unable to complete transpilation step",
2146
2149
  build_error_last_updated_at: new Date(Date.now() - 14e3).toISOString(),
2147
2150
  preview_url: null,
2148
- build_logs: "Build process:\n1. Environment setup - OK\n2. Dependency resolution - OK\n3. Code compilation - FAILED\nError: Invalid syntax in component declaration\nBuild terminated with errors",
2149
- branch_name: "main",
2150
- commit_message: "Attempted build of a555timer-square-wave package",
2151
- commit_author: "testuser"
2151
+ build_logs: "Build process:\n1. Environment setup - OK\n2. Dependency resolution - OK\n3. Code compilation - FAILED\nError: Invalid syntax in component declaration\nBuild terminated with errors"
2152
2152
  });
2153
2153
  const successfulBuild = db.addPackageBuild({
2154
2154
  package_release_id: packageReleaseId2,
@@ -2187,10 +2187,7 @@ export const SquareWaveModule = () => (
2187
2187
  build_error: null,
2188
2188
  build_error_last_updated_at: (/* @__PURE__ */ new Date()).toISOString(),
2189
2189
  preview_url: "http://localhost:3000/preview/package_build_1",
2190
- build_logs: "Build process:\n1. Environment setup - OK\n2. Dependency resolution - OK\n3. Code compilation - OK\n4. Circuit validation - OK\n5. Package assembly - OK\nBuild completed successfully",
2191
- branch_name: "main",
2192
- commit_message: "Initial build of a555timer-square-wave package",
2193
- commit_author: "testuser"
2190
+ build_logs: "Build process:\n1. Environment setup - OK\n2. Dependency resolution - OK\n3. Code compilation - OK\n4. Circuit validation - OK\n5. Package assembly - OK\nBuild completed successfully"
2194
2191
  });
2195
2192
  const release2 = db.getPackageReleaseById(packageReleaseId2);
2196
2193
  db.updatePackageRelease({
@@ -2450,6 +2447,9 @@ var initializer = combine(databaseSchema.parse({}), (set, get) => ({
2450
2447
  is_locked: false,
2451
2448
  created_at: currentTime,
2452
2449
  updated_at: currentTime,
2450
+ branch_name: snippet.branch_name,
2451
+ commit_message: snippet.commit_message,
2452
+ commit_author: snippet.commit_author,
2453
2453
  has_transpiled: true,
2454
2454
  transpilation_error: null,
2455
2455
  ...snippet.name == "testuser/my-test-board" ? { is_pr_preview: true, github_pr_number: 69 } : {}
package/dist/schema.d.ts CHANGED
@@ -694,6 +694,9 @@ declare const packageReleaseSchema: z.ZodObject<{
694
694
  is_pr_preview: z.ZodDefault<z.ZodBoolean>;
695
695
  github_pr_number: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
696
696
  latest_package_build_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
697
+ branch_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
698
+ commit_message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
699
+ commit_author: z.ZodOptional<z.ZodNullable<z.ZodString>>;
697
700
  }, "strip", z.ZodTypeAny, {
698
701
  package_release_id: string;
699
702
  created_at: string;
@@ -731,6 +734,9 @@ declare const packageReleaseSchema: z.ZodObject<{
731
734
  ai_review_logs?: any[] | null | undefined;
732
735
  github_pr_number?: number | null | undefined;
733
736
  latest_package_build_id?: string | null | undefined;
737
+ branch_name?: string | null | undefined;
738
+ commit_message?: string | null | undefined;
739
+ commit_author?: string | null | undefined;
734
740
  }, {
735
741
  package_release_id: string;
736
742
  created_at: string;
@@ -768,6 +774,9 @@ declare const packageReleaseSchema: z.ZodObject<{
768
774
  is_pr_preview?: boolean | undefined;
769
775
  github_pr_number?: number | null | undefined;
770
776
  latest_package_build_id?: string | null | undefined;
777
+ branch_name?: string | null | undefined;
778
+ commit_message?: string | null | undefined;
779
+ commit_author?: string | null | undefined;
771
780
  }>;
772
781
  type PackageRelease = z.infer<typeof packageReleaseSchema>;
773
782
  declare const packageFileSchema: z.ZodObject<{
@@ -1018,9 +1027,6 @@ declare const packageBuildSchema: z.ZodObject<{
1018
1027
  build_error_last_updated_at: z.ZodString;
1019
1028
  preview_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1020
1029
  build_logs: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1021
- branch_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1022
- commit_message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1023
- commit_author: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1024
1030
  }, "strip", z.ZodTypeAny, {
1025
1031
  package_release_id: string;
1026
1032
  created_at: string;
@@ -1042,9 +1048,6 @@ declare const packageBuildSchema: z.ZodObject<{
1042
1048
  build_error?: string | null | undefined;
1043
1049
  preview_url?: string | null | undefined;
1044
1050
  build_logs?: string | null | undefined;
1045
- branch_name?: string | null | undefined;
1046
- commit_message?: string | null | undefined;
1047
- commit_author?: string | null | undefined;
1048
1051
  }, {
1049
1052
  package_release_id: string;
1050
1053
  created_at: string;
@@ -1066,9 +1069,6 @@ declare const packageBuildSchema: z.ZodObject<{
1066
1069
  build_error?: string | null | undefined;
1067
1070
  preview_url?: string | null | undefined;
1068
1071
  build_logs?: string | null | undefined;
1069
- branch_name?: string | null | undefined;
1070
- commit_message?: string | null | undefined;
1071
- commit_author?: string | null | undefined;
1072
1072
  }>;
1073
1073
  type PackageBuild = z.infer<typeof packageBuildSchema>;
1074
1074
  declare const databaseSchema: z.ZodObject<{
@@ -1180,6 +1180,9 @@ declare const databaseSchema: z.ZodObject<{
1180
1180
  is_pr_preview: z.ZodDefault<z.ZodBoolean>;
1181
1181
  github_pr_number: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
1182
1182
  latest_package_build_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1183
+ branch_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1184
+ commit_message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1185
+ commit_author: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1183
1186
  }, "strip", z.ZodTypeAny, {
1184
1187
  package_release_id: string;
1185
1188
  created_at: string;
@@ -1217,6 +1220,9 @@ declare const databaseSchema: z.ZodObject<{
1217
1220
  ai_review_logs?: any[] | null | undefined;
1218
1221
  github_pr_number?: number | null | undefined;
1219
1222
  latest_package_build_id?: string | null | undefined;
1223
+ branch_name?: string | null | undefined;
1224
+ commit_message?: string | null | undefined;
1225
+ commit_author?: string | null | undefined;
1220
1226
  }, {
1221
1227
  package_release_id: string;
1222
1228
  created_at: string;
@@ -1254,6 +1260,9 @@ declare const databaseSchema: z.ZodObject<{
1254
1260
  is_pr_preview?: boolean | undefined;
1255
1261
  github_pr_number?: number | null | undefined;
1256
1262
  latest_package_build_id?: string | null | undefined;
1263
+ branch_name?: string | null | undefined;
1264
+ commit_message?: string | null | undefined;
1265
+ commit_author?: string | null | undefined;
1257
1266
  }>, "many">>;
1258
1267
  packageFiles: z.ZodDefault<z.ZodArray<z.ZodObject<{
1259
1268
  package_file_id: z.ZodString;
@@ -1951,9 +1960,6 @@ declare const databaseSchema: z.ZodObject<{
1951
1960
  build_error_last_updated_at: z.ZodString;
1952
1961
  preview_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1953
1962
  build_logs: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1954
- branch_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1955
- commit_message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1956
- commit_author: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1957
1963
  }, "strip", z.ZodTypeAny, {
1958
1964
  package_release_id: string;
1959
1965
  created_at: string;
@@ -1975,9 +1981,6 @@ declare const databaseSchema: z.ZodObject<{
1975
1981
  build_error?: string | null | undefined;
1976
1982
  preview_url?: string | null | undefined;
1977
1983
  build_logs?: string | null | undefined;
1978
- branch_name?: string | null | undefined;
1979
- commit_message?: string | null | undefined;
1980
- commit_author?: string | null | undefined;
1981
1984
  }, {
1982
1985
  package_release_id: string;
1983
1986
  created_at: string;
@@ -1999,9 +2002,6 @@ declare const databaseSchema: z.ZodObject<{
1999
2002
  build_error?: string | null | undefined;
2000
2003
  preview_url?: string | null | undefined;
2001
2004
  build_logs?: string | null | undefined;
2002
- branch_name?: string | null | undefined;
2003
- commit_message?: string | null | undefined;
2004
- commit_author?: string | null | undefined;
2005
2005
  }>, "many">>;
2006
2006
  }, "strip", z.ZodTypeAny, {
2007
2007
  idCounter: number;
@@ -2066,6 +2066,9 @@ declare const databaseSchema: z.ZodObject<{
2066
2066
  ai_review_logs?: any[] | null | undefined;
2067
2067
  github_pr_number?: number | null | undefined;
2068
2068
  latest_package_build_id?: string | null | undefined;
2069
+ branch_name?: string | null | undefined;
2070
+ commit_message?: string | null | undefined;
2071
+ commit_author?: string | null | undefined;
2069
2072
  }[];
2070
2073
  packageFiles: {
2071
2074
  package_release_id: string;
@@ -2301,9 +2304,6 @@ declare const databaseSchema: z.ZodObject<{
2301
2304
  build_error?: string | null | undefined;
2302
2305
  preview_url?: string | null | undefined;
2303
2306
  build_logs?: string | null | undefined;
2304
- branch_name?: string | null | undefined;
2305
- commit_message?: string | null | undefined;
2306
- commit_author?: string | null | undefined;
2307
2307
  }[];
2308
2308
  }, {
2309
2309
  idCounter?: number | undefined;
@@ -2368,6 +2368,9 @@ declare const databaseSchema: z.ZodObject<{
2368
2368
  is_pr_preview?: boolean | undefined;
2369
2369
  github_pr_number?: number | null | undefined;
2370
2370
  latest_package_build_id?: string | null | undefined;
2371
+ branch_name?: string | null | undefined;
2372
+ commit_message?: string | null | undefined;
2373
+ commit_author?: string | null | undefined;
2371
2374
  }[] | undefined;
2372
2375
  packageFiles?: {
2373
2376
  package_release_id: string;
@@ -2603,9 +2606,6 @@ declare const databaseSchema: z.ZodObject<{
2603
2606
  build_error?: string | null | undefined;
2604
2607
  preview_url?: string | null | undefined;
2605
2608
  build_logs?: string | null | undefined;
2606
- branch_name?: string | null | undefined;
2607
- commit_message?: string | null | undefined;
2608
- commit_author?: string | null | undefined;
2609
2609
  }[] | undefined;
2610
2610
  }>;
2611
2611
  type DatabaseSchema = z.infer<typeof databaseSchema>;
package/dist/schema.js CHANGED
@@ -209,7 +209,10 @@ var packageReleaseSchema = z.object({
209
209
  is_pr_preview: z.boolean().default(false),
210
210
  github_pr_number: z.number().nullable().optional(),
211
211
  // Latest Build Reference
212
- latest_package_build_id: z.string().nullable().optional()
212
+ latest_package_build_id: z.string().nullable().optional(),
213
+ branch_name: z.string().nullable().optional(),
214
+ commit_message: z.string().nullable().optional(),
215
+ commit_author: z.string().nullable().optional()
213
216
  });
214
217
  var packageFileSchema = z.object({
215
218
  package_file_id: z.string(),
@@ -308,10 +311,7 @@ var packageBuildSchema = z.object({
308
311
  build_error: z.string().nullable().optional(),
309
312
  build_error_last_updated_at: z.string().datetime(),
310
313
  preview_url: z.string().nullable().optional(),
311
- build_logs: z.string().nullable().optional(),
312
- branch_name: z.string().nullable().optional(),
313
- commit_message: z.string().nullable().optional(),
314
- commit_author: z.string().nullable().optional()
314
+ build_logs: z.string().nullable().optional()
315
315
  });
316
316
  var databaseSchema = z.object({
317
317
  idCounter: z.number().default(0),
@@ -242,7 +242,13 @@ const initializer = combine(databaseSchema.parse({}), (set, get) => ({
242
242
  snippet: Omit<
243
243
  z.input<typeof snippetSchema>,
244
244
  "snippet_id" | "package_release_id"
245
- > & { creator_account_id?: string; github_repo_full_name?: string },
245
+ > & {
246
+ creator_account_id?: string
247
+ github_repo_full_name?: string
248
+ branch_name?: string
249
+ commit_message?: string
250
+ commit_author?: string
251
+ },
246
252
  ): Snippet => {
247
253
  const timestamp = Date.now()
248
254
  const currentTime = new Date(timestamp).toISOString()
@@ -291,6 +297,9 @@ const initializer = combine(databaseSchema.parse({}), (set, get) => ({
291
297
  is_locked: false,
292
298
  created_at: currentTime,
293
299
  updated_at: currentTime,
300
+ branch_name: snippet.branch_name,
301
+ commit_message: snippet.commit_message,
302
+ commit_author: snippet.commit_author,
294
303
  has_transpiled: true,
295
304
  transpilation_error: null,
296
305
  ...(snippet.name == "testuser/my-test-board"
@@ -258,6 +258,9 @@ export const packageReleaseSchema = z.object({
258
258
 
259
259
  // Latest Build Reference
260
260
  latest_package_build_id: z.string().nullable().optional(),
261
+ branch_name: z.string().nullable().optional(),
262
+ commit_message: z.string().nullable().optional(),
263
+ commit_author: z.string().nullable().optional(),
261
264
  })
262
265
  export type PackageRelease = z.infer<typeof packageReleaseSchema>
263
266
 
@@ -370,9 +373,6 @@ export const packageBuildSchema = z.object({
370
373
  build_error_last_updated_at: z.string().datetime(),
371
374
  preview_url: z.string().nullable().optional(),
372
375
  build_logs: z.string().nullable().optional(),
373
- branch_name: z.string().nullable().optional(),
374
- commit_message: z.string().nullable().optional(),
375
- commit_author: z.string().nullable().optional(),
376
376
  })
377
377
  export type PackageBuild = z.infer<typeof packageBuildSchema>
378
378
 
@@ -31,6 +31,9 @@ export const seed = (db: DbClient) => {
31
31
  unscoped_name: "my-test-board",
32
32
  github_repo_full_name: "testuser/my-test-board",
33
33
  owner_name: "testuser",
34
+ branch_name: "main",
35
+ commit_message: "Attempted build of a555timer-square-wave package",
36
+ commit_author: "testuser",
34
37
  creator_account_id: account_id,
35
38
  code: `
36
39
  import { A555Timer } from "@tsci/seveibar.a555timer"
@@ -570,9 +573,6 @@ export default () => (
570
573
  "3. Code compilation - FAILED\n" +
571
574
  "Error: Invalid syntax in component declaration\n" +
572
575
  "Build terminated with errors",
573
- branch_name: "main",
574
- commit_message: "Attempted build of a555timer-square-wave package",
575
- commit_author: "testuser",
576
576
  })
577
577
 
578
578
  // Update the package release with the latest build ID
@@ -1116,6 +1116,9 @@ exports.A555Timer = A555Timer;
1116
1116
  name: "testuser/a555timer-square-wave",
1117
1117
  unscoped_name: "a555timer-square-wave",
1118
1118
  owner_name: "testuser",
1119
+ branch_name: "main",
1120
+ commit_message: "Attempted build of a555timer-square-wave package",
1121
+ commit_author: "testuser",
1119
1122
  creator_account_id: account_id,
1120
1123
  code: `
1121
1124
  import { A555Timer } from "@tsci/seveibar.a555timer"
@@ -1659,9 +1662,6 @@ export const SquareWaveModule = () => (
1659
1662
  "3. Code compilation - FAILED\n" +
1660
1663
  "Error: Invalid syntax in component declaration\n" +
1661
1664
  "Build terminated with errors",
1662
- branch_name: "main",
1663
- commit_message: "Attempted build of a555timer-square-wave package",
1664
- commit_author: "testuser",
1665
1665
  })
1666
1666
 
1667
1667
  // Add successful build
@@ -1704,9 +1704,6 @@ export const SquareWaveModule = () => (
1704
1704
  "4. Circuit validation - OK\n" +
1705
1705
  "5. Package assembly - OK\n" +
1706
1706
  "Build completed successfully",
1707
- branch_name: "main",
1708
- commit_message: "Initial build of a555timer-square-wave package",
1709
- commit_author: "testuser",
1710
1707
  })
1711
1708
 
1712
1709
  // Update the package release with the latest (successful) build ID
@@ -32,9 +32,6 @@ export const publicMapPackageBuild = (
32
32
  internalPackageBuild.build_error_last_updated_at,
33
33
  preview_url: internalPackageBuild.preview_url,
34
34
  build_logs: options.include_logs ? internalPackageBuild.build_logs : null,
35
- branch_name: internalPackageBuild.branch_name,
36
- commit_message: internalPackageBuild.commit_message,
37
- commit_author: internalPackageBuild.commit_author,
38
35
  }
39
36
 
40
37
  return result
@@ -26,6 +26,9 @@ export const publicMapPackageRelease = (
26
26
  : [],
27
27
  is_pr_preview: Boolean(internal_package_release.is_pr_preview),
28
28
  github_pr_number: internal_package_release.github_pr_number,
29
+ branch_name: internal_package_release.branch_name,
30
+ commit_message: internal_package_release.commit_message ?? null,
31
+ commit_author: internal_package_release.commit_author ?? null,
29
32
  }
30
33
 
31
34
  if (options.include_ai_review && options.db) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/fake-snippets",
3
- "version": "0.0.107",
3
+ "version": "0.0.108",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
package/src/App.tsx CHANGED
@@ -82,7 +82,7 @@ const PackageEditorPage = lazyImport(async () => {
82
82
  const ReleasesPage = lazyImport(() => import("@/pages/releases"))
83
83
  const ReleaseDetailPage = lazyImport(() => import("@/pages/release-detail"))
84
84
  const ReleaseBuildsPage = lazyImport(() => import("@/pages/release-builds"))
85
- const PreviewBuildPage = lazyImport(() => import("@/pages/preview-build"))
85
+ const ReleasePreviewPage = lazyImport(() => import("@/pages/preview-release"))
86
86
 
87
87
  class ErrorBoundary extends React.Component<
88
88
  { children: React.ReactNode },
@@ -109,7 +109,7 @@ class ErrorBoundary extends React.Component<
109
109
  )
110
110
  ) {
111
111
  const loadedAt = window.__APP_LOADED_AT || Date.now()
112
- if (Date.now() - loadedAt >= 10_000) {
112
+ if (Date.now() - loadedAt >= 180_000) {
113
113
  this.performReload()
114
114
  }
115
115
  }
@@ -144,6 +144,7 @@ class ErrorBoundary extends React.Component<
144
144
  this.setState({ reloading: true })
145
145
  this.reloadTimeout = window.setTimeout(() => {
146
146
  if (window?.location.href.includes("localhost:")) return
147
+ if (window?.location.href.includes("127.0.0.1:")) return
147
148
  window.location.reload()
148
149
  }, 500)
149
150
  }
@@ -152,10 +153,12 @@ class ErrorBoundary extends React.Component<
152
153
  this.cleanup() // Clean up any existing handlers
153
154
 
154
155
  this.visibilityHandler = () => {
156
+ const loadedAt = window.__APP_LOADED_AT || Date.now()
155
157
  if (
156
158
  document.visibilityState === "visible" &&
157
159
  this.state.hasError &&
158
- !this.state.reloading
160
+ !this.state.reloading &&
161
+ Date.now() - loadedAt >= 180_000
159
162
  ) {
160
163
  this.performReload()
161
164
  }
@@ -259,13 +262,17 @@ function App() {
259
262
  <Route path="/dev-login" component={DevLoginPage} />
260
263
  <Route path="/:username" component={UserProfilePage} />
261
264
  <Route
262
- path="/:author/:packageName/release/:releaseId/builds"
265
+ path="/:author/:packageName/releases/:releaseId/builds"
263
266
  component={ReleaseBuildsPage}
264
267
  />
265
268
  <Route
266
- path="/:author/:packageName/release/:releaseId"
269
+ path="/:author/:packageName/releases/:releaseId"
267
270
  component={ReleaseDetailPage}
268
271
  />
272
+ <Route
273
+ path="/:author/:packageName/releases/:packageReleaseId/preview"
274
+ component={ReleasePreviewPage}
275
+ />
269
276
  <Route
270
277
  path="/:author/:packageName/releases/:packageReleaseId"
271
278
  component={ReleaseDetailPage}
@@ -274,10 +281,6 @@ function App() {
274
281
  path="/:author/:packageName/releases"
275
282
  component={ReleasesPage}
276
283
  />
277
- <Route
278
- path="/build/:buildId/preview"
279
- component={PreviewBuildPage}
280
- />
281
284
  <Route path="/:author/:packageName" component={ViewPackagePage} />
282
285
  <Route
283
286
  path="/:author/:packageName/builds"