@tscircuit/fake-snippets 0.0.107 → 0.0.109

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 (80) 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/bun.lock +62 -19
  6. package/dist/bundle.js +25 -24
  7. package/dist/index.d.ts +26 -15
  8. package/dist/index.js +19 -18
  9. package/dist/schema.d.ts +32 -24
  10. package/dist/schema.js +7 -6
  11. package/fake-snippets-api/lib/db/db-client.ts +10 -1
  12. package/fake-snippets-api/lib/db/schema.ts +4 -3
  13. package/fake-snippets-api/lib/db/seed.ts +6 -9
  14. package/fake-snippets-api/lib/public-mapping/public-map-package-build.ts +0 -3
  15. package/fake-snippets-api/lib/public-mapping/public-map-package-release.ts +3 -0
  16. package/package.json +7 -8
  17. package/src/App.tsx +12 -11
  18. package/src/components/DownloadButtonAndMenu.tsx +133 -35
  19. package/src/components/FileSidebar.tsx +45 -193
  20. package/src/components/Footer.tsx +0 -1
  21. package/src/components/HeaderLogin.tsx +1 -1
  22. package/src/components/HiddenFilesDropdown.tsx +0 -2
  23. package/src/components/PackageBreadcrumb.tsx +1 -1
  24. package/src/components/PackageBuildsPage/PackageBuildDetailsPage.tsx +0 -2
  25. package/src/components/PackageBuildsPage/build-preview-content.tsx +34 -5
  26. package/src/components/PackageCard.tsx +0 -1
  27. package/src/components/ViewPackagePage/components/ShikiCodeViewer.tsx +20 -11
  28. package/src/components/ViewPackagePage/components/important-files-view.tsx +75 -59
  29. package/src/components/ViewPackagePage/components/main-content-header.tsx +4 -4
  30. package/src/components/ViewPackagePage/components/main-content-view-selector.tsx +0 -1
  31. package/src/components/ViewPackagePage/components/mobile-sidebar.tsx +1 -2
  32. package/src/components/ViewPackagePage/components/package-header.tsx +14 -17
  33. package/src/components/ViewPackagePage/components/preview-image-squares.tsx +0 -1
  34. package/src/components/ViewPackagePage/components/repo-page-content.tsx +21 -20
  35. package/src/components/ViewPackagePage/components/sidebar-about-section.tsx +18 -2
  36. package/src/components/ViewPackagePage/components/sidebar-releases-section.tsx +1 -1
  37. package/src/components/ViewPackagePage/components/sidebar.tsx +0 -2
  38. package/src/components/ViewPackagePage/components/tab-views/files-view.tsx +18 -17
  39. package/src/components/ViewPackagePage/components/theme-toggle.tsx +0 -2
  40. package/src/components/ViewPackagePage/hooks/use-toast.tsx +0 -1
  41. package/src/components/package-port/CodeAndPreview.tsx +23 -40
  42. package/src/components/package-port/CodeEditor.tsx +24 -1
  43. package/src/components/package-port/CodeEditorHeader.tsx +5 -2
  44. package/src/components/preview/BuildsList.tsx +20 -9
  45. package/src/components/preview/ConnectedPackagesList.tsx +73 -60
  46. package/src/components/preview/ConnectedRepoOverview.tsx +160 -154
  47. package/src/components/preview/PackageReleasesDashboard.tsx +41 -30
  48. package/src/components/preview/index.tsx +16 -153
  49. package/src/hooks/use-current-package-id.ts +5 -30
  50. package/src/hooks/use-current-package-info.ts +29 -5
  51. package/src/hooks/use-global-store.ts +1 -1
  52. package/src/hooks/useFileManagement.ts +153 -34
  53. package/src/hooks/useOptimizedPackageFilesLoader.ts +149 -0
  54. package/src/hooks/useUpdatePackageFilesMutation.ts +2 -0
  55. package/src/index.css +24 -0
  56. package/src/lib/download-fns/download-circuit-png.ts +11 -3
  57. package/src/lib/download-fns/download-gltf-from-circuit-json.ts +44 -0
  58. package/src/lib/utils/isComponentExported.ts +9 -0
  59. package/src/lib/utils/transformFilesToTreeData.tsx +195 -0
  60. package/src/pages/404.tsx +3 -5
  61. package/src/pages/authorize.tsx +0 -2
  62. package/src/pages/landing.tsx +0 -1
  63. package/src/pages/preview-release.tsx +279 -0
  64. package/src/pages/release-builds.tsx +0 -8
  65. package/src/pages/release-detail.tsx +17 -15
  66. package/src/pages/releases.tsx +5 -1
  67. package/src/pages/view-package.tsx +14 -13
  68. package/src/components/Footer2.tsx +0 -100
  69. package/src/components/ShippingInformationForm.tsx +0 -423
  70. package/src/components/StaticViewSnippetHeader.tsx +0 -70
  71. package/src/components/ViewPackagePage/components/file-explorer.tsx +0 -67
  72. package/src/components/ViewPackagePage/components/readme-view.tsx +0 -58
  73. package/src/components/ViewPackagePage/components/repo-header-button.tsx +0 -36
  74. package/src/components/ViewPackagePage/components/repo-header.tsx +0 -4
  75. package/src/components/ViewPackagePage/components/sidebar-contributors-section.tsx +0 -31
  76. package/src/components/ViewSnippetHeader.tsx +0 -181
  77. package/src/components/ui/input-otp.tsx +0 -69
  78. package/src/hooks/use-snippets-base-api-url.ts +0 -3
  79. package/src/pages/preview-build.tsx +0 -380
  80. package/src/pages/settings.tsx +0 -25
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<{
@@ -658,6 +667,7 @@ declare const packageSchema: z.ZodObject<{
658
667
  latest_package_release_fs_sha: z.ZodDefault<z.ZodNullable<z.ZodString>>;
659
668
  default_view: z.ZodOptional<z.ZodDefault<z.ZodEnum<["files", "3d", "pcb", "schematic"]>>>;
660
669
  allow_pr_previews: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
670
+ is_starred: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
661
671
  }, "strip", z.ZodTypeAny, {
662
672
  name: string;
663
673
  unscoped_name: string;
@@ -686,6 +696,7 @@ declare const packageSchema: z.ZodObject<{
686
696
  website: string | null;
687
697
  ai_usage_instructions: string | null;
688
698
  latest_package_release_fs_sha: string | null;
699
+ is_starred?: boolean | undefined;
689
700
  snippet_type?: "board" | "package" | "model" | "footprint" | undefined;
690
701
  latest_license?: string | null | undefined;
691
702
  default_view?: "files" | "3d" | "pcb" | "schematic" | undefined;
@@ -706,6 +717,7 @@ declare const packageSchema: z.ZodObject<{
706
717
  latest_package_release_id: string | null;
707
718
  latest_version: string | null;
708
719
  ai_usage_instructions: string | null;
720
+ is_starred?: boolean | undefined;
709
721
  snippet_type?: "board" | "package" | "model" | "footprint" | undefined;
710
722
  star_count?: number | undefined;
711
723
  is_private?: boolean | null | undefined;
@@ -845,9 +857,6 @@ declare const packageBuildSchema: z.ZodObject<{
845
857
  build_error_last_updated_at: z.ZodString;
846
858
  preview_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
847
859
  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
860
  }, "strip", z.ZodTypeAny, {
852
861
  package_release_id: string;
853
862
  created_at: string;
@@ -869,9 +878,6 @@ declare const packageBuildSchema: z.ZodObject<{
869
878
  build_error?: string | null | undefined;
870
879
  preview_url?: string | null | undefined;
871
880
  build_logs?: string | null | undefined;
872
- branch_name?: string | null | undefined;
873
- commit_message?: string | null | undefined;
874
- commit_author?: string | null | undefined;
875
881
  }, {
876
882
  package_release_id: string;
877
883
  created_at: string;
@@ -893,9 +899,6 @@ declare const packageBuildSchema: z.ZodObject<{
893
899
  build_error?: string | null | undefined;
894
900
  preview_url?: string | null | undefined;
895
901
  build_logs?: string | null | undefined;
896
- branch_name?: string | null | undefined;
897
- commit_message?: string | null | undefined;
898
- commit_author?: string | null | undefined;
899
902
  }>;
900
903
  type PackageBuild = z.infer<typeof packageBuildSchema>;
901
904
 
@@ -964,6 +967,9 @@ declare const createDatabase: ({ seed }?: {
964
967
  ai_review_logs?: any[] | null | undefined;
965
968
  github_pr_number?: number | null | undefined;
966
969
  latest_package_build_id?: string | null | undefined;
970
+ branch_name?: string | null | undefined;
971
+ commit_message?: string | null | undefined;
972
+ commit_author?: string | null | undefined;
967
973
  }[];
968
974
  packageFiles: {
969
975
  package_release_id: string;
@@ -1033,6 +1039,7 @@ declare const createDatabase: ({ seed }?: {
1033
1039
  website: string | null;
1034
1040
  ai_usage_instructions: string | null;
1035
1041
  latest_package_release_fs_sha: string | null;
1042
+ is_starred?: boolean | undefined;
1036
1043
  snippet_type?: "board" | "package" | "model" | "footprint" | undefined;
1037
1044
  latest_license?: string | null | undefined;
1038
1045
  default_view?: "files" | "3d" | "pcb" | "schematic" | undefined;
@@ -1199,9 +1206,6 @@ declare const createDatabase: ({ seed }?: {
1199
1206
  build_error?: string | null | undefined;
1200
1207
  preview_url?: string | null | undefined;
1201
1208
  build_logs?: string | null | undefined;
1202
- branch_name?: string | null | undefined;
1203
- commit_message?: string | null | undefined;
1204
- commit_author?: string | null | undefined;
1205
1209
  }[];
1206
1210
  }, "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
1211
  addOrder: (order: Omit<Order, "order_id">) => Order;
@@ -1243,6 +1247,9 @@ declare const createDatabase: ({ seed }?: {
1243
1247
  addSnippet: (snippet: Omit<z.input<typeof snippetSchema>, "snippet_id" | "package_release_id"> & {
1244
1248
  creator_account_id?: string;
1245
1249
  github_repo_full_name?: string;
1250
+ branch_name?: string;
1251
+ commit_message?: string;
1252
+ commit_author?: string;
1246
1253
  }) => Snippet;
1247
1254
  getLatestSnippets: (limit: number) => Snippet[];
1248
1255
  getTrendingSnippets: (limit: number, since: string) => Snippet[];
@@ -1366,6 +1373,9 @@ declare const createDatabase: ({ seed }?: {
1366
1373
  ai_review_logs?: any[] | null | undefined;
1367
1374
  github_pr_number?: number | null | undefined;
1368
1375
  latest_package_build_id?: string | null | undefined;
1376
+ branch_name?: string | null | undefined;
1377
+ commit_message?: string | null | undefined;
1378
+ commit_author?: string | null | undefined;
1369
1379
  }[];
1370
1380
  packageFiles: {
1371
1381
  package_release_id: string;
@@ -1435,6 +1445,7 @@ declare const createDatabase: ({ seed }?: {
1435
1445
  website: string | null;
1436
1446
  ai_usage_instructions: string | null;
1437
1447
  latest_package_release_fs_sha: string | null;
1448
+ is_starred?: boolean | undefined;
1438
1449
  snippet_type?: "board" | "package" | "model" | "footprint" | undefined;
1439
1450
  latest_license?: string | null | undefined;
1440
1451
  default_view?: "files" | "3d" | "pcb" | "schematic" | undefined;
@@ -1601,9 +1612,6 @@ declare const createDatabase: ({ seed }?: {
1601
1612
  build_error?: string | null | undefined;
1602
1613
  preview_url?: string | null | undefined;
1603
1614
  build_logs?: string | null | undefined;
1604
- branch_name?: string | null | undefined;
1605
- commit_message?: string | null | undefined;
1606
- commit_author?: string | null | undefined;
1607
1615
  }[];
1608
1616
  }, "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
1617
  addOrder: (order: Omit<Order, "order_id">) => Order;
@@ -1645,6 +1653,9 @@ declare const createDatabase: ({ seed }?: {
1645
1653
  addSnippet: (snippet: Omit<z.input<typeof snippetSchema>, "snippet_id" | "package_release_id"> & {
1646
1654
  creator_account_id?: string;
1647
1655
  github_repo_full_name?: string;
1656
+ branch_name?: string;
1657
+ commit_message?: string;
1658
+ commit_author?: string;
1648
1659
  }) => Snippet;
1649
1660
  getLatestSnippets: (limit: number) => Snippet[];
1650
1661
  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(),
@@ -257,7 +260,8 @@ var packageSchema = z.object({
257
260
  ai_usage_instructions: z.string().nullable(),
258
261
  latest_package_release_fs_sha: z.string().nullable().default(null),
259
262
  default_view: z.enum(["files", "3d", "pcb", "schematic"]).default("files").optional(),
260
- allow_pr_previews: z.boolean().default(false).optional()
263
+ allow_pr_previews: z.boolean().default(false).optional(),
264
+ is_starred: z.boolean().default(false).optional()
261
265
  });
262
266
  var jlcpcbOrderStateSchema = z.object({
263
267
  jlcpcb_order_state_id: z.string(),
@@ -313,10 +317,7 @@ var packageBuildSchema = z.object({
313
317
  build_error: z.string().nullable().optional(),
314
318
  build_error_last_updated_at: z.string().datetime(),
315
319
  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()
320
+ build_logs: z.string().nullable().optional()
320
321
  });
321
322
  var databaseSchema = z.object({
322
323
  idCounter: z.number().default(0),
@@ -541,6 +542,9 @@ var seed = (db) => {
541
542
  unscoped_name: "my-test-board",
542
543
  github_repo_full_name: "testuser/my-test-board",
543
544
  owner_name: "testuser",
545
+ branch_name: "main",
546
+ commit_message: "Attempted build of a555timer-square-wave package",
547
+ commit_author: "testuser",
544
548
  creator_account_id: account_id,
545
549
  code: `
546
550
  import { A555Timer } from "@tsci/seveibar.a555timer"
@@ -1072,10 +1076,7 @@ export default () => (
1072
1076
  build_error: "Build failed: Unable to complete transpilation step",
1073
1077
  build_error_last_updated_at: new Date(Date.now() - 14e3).toISOString(),
1074
1078
  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"
1079
+ 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
1080
  });
1080
1081
  const release1 = db.getPackageReleaseById(packageReleaseId1);
1081
1082
  db.updatePackageRelease({
@@ -1613,6 +1614,9 @@ exports.A555Timer = A555Timer;
1613
1614
  name: "testuser/a555timer-square-wave",
1614
1615
  unscoped_name: "a555timer-square-wave",
1615
1616
  owner_name: "testuser",
1617
+ branch_name: "main",
1618
+ commit_message: "Attempted build of a555timer-square-wave package",
1619
+ commit_author: "testuser",
1616
1620
  creator_account_id: account_id,
1617
1621
  code: `
1618
1622
  import { A555Timer } from "@tsci/seveibar.a555timer"
@@ -2145,10 +2149,7 @@ export const SquareWaveModule = () => (
2145
2149
  build_error: "Build failed: Unable to complete transpilation step",
2146
2150
  build_error_last_updated_at: new Date(Date.now() - 14e3).toISOString(),
2147
2151
  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"
2152
+ 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
2153
  });
2153
2154
  const successfulBuild = db.addPackageBuild({
2154
2155
  package_release_id: packageReleaseId2,
@@ -2187,10 +2188,7 @@ export const SquareWaveModule = () => (
2187
2188
  build_error: null,
2188
2189
  build_error_last_updated_at: (/* @__PURE__ */ new Date()).toISOString(),
2189
2190
  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"
2191
+ 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
2192
  });
2195
2193
  const release2 = db.getPackageReleaseById(packageReleaseId2);
2196
2194
  db.updatePackageRelease({
@@ -2450,6 +2448,9 @@ var initializer = combine(databaseSchema.parse({}), (set, get) => ({
2450
2448
  is_locked: false,
2451
2449
  created_at: currentTime,
2452
2450
  updated_at: currentTime,
2451
+ branch_name: snippet.branch_name,
2452
+ commit_message: snippet.commit_message,
2453
+ commit_author: snippet.commit_author,
2453
2454
  has_transpiled: true,
2454
2455
  transpilation_error: null,
2455
2456
  ...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<{
@@ -831,6 +840,7 @@ declare const packageSchema: z.ZodObject<{
831
840
  latest_package_release_fs_sha: z.ZodDefault<z.ZodNullable<z.ZodString>>;
832
841
  default_view: z.ZodOptional<z.ZodDefault<z.ZodEnum<["files", "3d", "pcb", "schematic"]>>>;
833
842
  allow_pr_previews: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
843
+ is_starred: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
834
844
  }, "strip", z.ZodTypeAny, {
835
845
  name: string;
836
846
  unscoped_name: string;
@@ -859,6 +869,7 @@ declare const packageSchema: z.ZodObject<{
859
869
  website: string | null;
860
870
  ai_usage_instructions: string | null;
861
871
  latest_package_release_fs_sha: string | null;
872
+ is_starred?: boolean | undefined;
862
873
  snippet_type?: "board" | "package" | "model" | "footprint" | undefined;
863
874
  latest_license?: string | null | undefined;
864
875
  default_view?: "files" | "3d" | "pcb" | "schematic" | undefined;
@@ -879,6 +890,7 @@ declare const packageSchema: z.ZodObject<{
879
890
  latest_package_release_id: string | null;
880
891
  latest_version: string | null;
881
892
  ai_usage_instructions: string | null;
893
+ is_starred?: boolean | undefined;
882
894
  snippet_type?: "board" | "package" | "model" | "footprint" | undefined;
883
895
  star_count?: number | undefined;
884
896
  is_private?: boolean | null | undefined;
@@ -1018,9 +1030,6 @@ declare const packageBuildSchema: z.ZodObject<{
1018
1030
  build_error_last_updated_at: z.ZodString;
1019
1031
  preview_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1020
1032
  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
1033
  }, "strip", z.ZodTypeAny, {
1025
1034
  package_release_id: string;
1026
1035
  created_at: string;
@@ -1042,9 +1051,6 @@ declare const packageBuildSchema: z.ZodObject<{
1042
1051
  build_error?: string | null | undefined;
1043
1052
  preview_url?: string | null | undefined;
1044
1053
  build_logs?: string | null | undefined;
1045
- branch_name?: string | null | undefined;
1046
- commit_message?: string | null | undefined;
1047
- commit_author?: string | null | undefined;
1048
1054
  }, {
1049
1055
  package_release_id: string;
1050
1056
  created_at: string;
@@ -1066,9 +1072,6 @@ declare const packageBuildSchema: z.ZodObject<{
1066
1072
  build_error?: string | null | undefined;
1067
1073
  preview_url?: string | null | undefined;
1068
1074
  build_logs?: string | null | undefined;
1069
- branch_name?: string | null | undefined;
1070
- commit_message?: string | null | undefined;
1071
- commit_author?: string | null | undefined;
1072
1075
  }>;
1073
1076
  type PackageBuild = z.infer<typeof packageBuildSchema>;
1074
1077
  declare const databaseSchema: z.ZodObject<{
@@ -1180,6 +1183,9 @@ declare const databaseSchema: z.ZodObject<{
1180
1183
  is_pr_preview: z.ZodDefault<z.ZodBoolean>;
1181
1184
  github_pr_number: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
1182
1185
  latest_package_build_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1186
+ branch_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1187
+ commit_message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1188
+ commit_author: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1183
1189
  }, "strip", z.ZodTypeAny, {
1184
1190
  package_release_id: string;
1185
1191
  created_at: string;
@@ -1217,6 +1223,9 @@ declare const databaseSchema: z.ZodObject<{
1217
1223
  ai_review_logs?: any[] | null | undefined;
1218
1224
  github_pr_number?: number | null | undefined;
1219
1225
  latest_package_build_id?: string | null | undefined;
1226
+ branch_name?: string | null | undefined;
1227
+ commit_message?: string | null | undefined;
1228
+ commit_author?: string | null | undefined;
1220
1229
  }, {
1221
1230
  package_release_id: string;
1222
1231
  created_at: string;
@@ -1254,6 +1263,9 @@ declare const databaseSchema: z.ZodObject<{
1254
1263
  is_pr_preview?: boolean | undefined;
1255
1264
  github_pr_number?: number | null | undefined;
1256
1265
  latest_package_build_id?: string | null | undefined;
1266
+ branch_name?: string | null | undefined;
1267
+ commit_message?: string | null | undefined;
1268
+ commit_author?: string | null | undefined;
1257
1269
  }>, "many">>;
1258
1270
  packageFiles: z.ZodDefault<z.ZodArray<z.ZodObject<{
1259
1271
  package_file_id: z.ZodString;
@@ -1421,6 +1433,7 @@ declare const databaseSchema: z.ZodObject<{
1421
1433
  latest_package_release_fs_sha: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1422
1434
  default_view: z.ZodOptional<z.ZodDefault<z.ZodEnum<["files", "3d", "pcb", "schematic"]>>>;
1423
1435
  allow_pr_previews: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
1436
+ is_starred: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
1424
1437
  }, "strip", z.ZodTypeAny, {
1425
1438
  name: string;
1426
1439
  unscoped_name: string;
@@ -1449,6 +1462,7 @@ declare const databaseSchema: z.ZodObject<{
1449
1462
  website: string | null;
1450
1463
  ai_usage_instructions: string | null;
1451
1464
  latest_package_release_fs_sha: string | null;
1465
+ is_starred?: boolean | undefined;
1452
1466
  snippet_type?: "board" | "package" | "model" | "footprint" | undefined;
1453
1467
  latest_license?: string | null | undefined;
1454
1468
  default_view?: "files" | "3d" | "pcb" | "schematic" | undefined;
@@ -1469,6 +1483,7 @@ declare const databaseSchema: z.ZodObject<{
1469
1483
  latest_package_release_id: string | null;
1470
1484
  latest_version: string | null;
1471
1485
  ai_usage_instructions: string | null;
1486
+ is_starred?: boolean | undefined;
1472
1487
  snippet_type?: "board" | "package" | "model" | "footprint" | undefined;
1473
1488
  star_count?: number | undefined;
1474
1489
  is_private?: boolean | null | undefined;
@@ -1951,9 +1966,6 @@ declare const databaseSchema: z.ZodObject<{
1951
1966
  build_error_last_updated_at: z.ZodString;
1952
1967
  preview_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1953
1968
  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
1969
  }, "strip", z.ZodTypeAny, {
1958
1970
  package_release_id: string;
1959
1971
  created_at: string;
@@ -1975,9 +1987,6 @@ declare const databaseSchema: z.ZodObject<{
1975
1987
  build_error?: string | null | undefined;
1976
1988
  preview_url?: string | null | undefined;
1977
1989
  build_logs?: string | null | undefined;
1978
- branch_name?: string | null | undefined;
1979
- commit_message?: string | null | undefined;
1980
- commit_author?: string | null | undefined;
1981
1990
  }, {
1982
1991
  package_release_id: string;
1983
1992
  created_at: string;
@@ -1999,9 +2008,6 @@ declare const databaseSchema: z.ZodObject<{
1999
2008
  build_error?: string | null | undefined;
2000
2009
  preview_url?: string | null | undefined;
2001
2010
  build_logs?: string | null | undefined;
2002
- branch_name?: string | null | undefined;
2003
- commit_message?: string | null | undefined;
2004
- commit_author?: string | null | undefined;
2005
2011
  }>, "many">>;
2006
2012
  }, "strip", z.ZodTypeAny, {
2007
2013
  idCounter: number;
@@ -2066,6 +2072,9 @@ declare const databaseSchema: z.ZodObject<{
2066
2072
  ai_review_logs?: any[] | null | undefined;
2067
2073
  github_pr_number?: number | null | undefined;
2068
2074
  latest_package_build_id?: string | null | undefined;
2075
+ branch_name?: string | null | undefined;
2076
+ commit_message?: string | null | undefined;
2077
+ commit_author?: string | null | undefined;
2069
2078
  }[];
2070
2079
  packageFiles: {
2071
2080
  package_release_id: string;
@@ -2135,6 +2144,7 @@ declare const databaseSchema: z.ZodObject<{
2135
2144
  website: string | null;
2136
2145
  ai_usage_instructions: string | null;
2137
2146
  latest_package_release_fs_sha: string | null;
2147
+ is_starred?: boolean | undefined;
2138
2148
  snippet_type?: "board" | "package" | "model" | "footprint" | undefined;
2139
2149
  latest_license?: string | null | undefined;
2140
2150
  default_view?: "files" | "3d" | "pcb" | "schematic" | undefined;
@@ -2301,9 +2311,6 @@ declare const databaseSchema: z.ZodObject<{
2301
2311
  build_error?: string | null | undefined;
2302
2312
  preview_url?: string | null | undefined;
2303
2313
  build_logs?: string | null | undefined;
2304
- branch_name?: string | null | undefined;
2305
- commit_message?: string | null | undefined;
2306
- commit_author?: string | null | undefined;
2307
2314
  }[];
2308
2315
  }, {
2309
2316
  idCounter?: number | undefined;
@@ -2368,6 +2375,9 @@ declare const databaseSchema: z.ZodObject<{
2368
2375
  is_pr_preview?: boolean | undefined;
2369
2376
  github_pr_number?: number | null | undefined;
2370
2377
  latest_package_build_id?: string | null | undefined;
2378
+ branch_name?: string | null | undefined;
2379
+ commit_message?: string | null | undefined;
2380
+ commit_author?: string | null | undefined;
2371
2381
  }[] | undefined;
2372
2382
  packageFiles?: {
2373
2383
  package_release_id: string;
@@ -2425,6 +2435,7 @@ declare const databaseSchema: z.ZodObject<{
2425
2435
  latest_package_release_id: string | null;
2426
2436
  latest_version: string | null;
2427
2437
  ai_usage_instructions: string | null;
2438
+ is_starred?: boolean | undefined;
2428
2439
  snippet_type?: "board" | "package" | "model" | "footprint" | undefined;
2429
2440
  star_count?: number | undefined;
2430
2441
  is_private?: boolean | null | undefined;
@@ -2603,9 +2614,6 @@ declare const databaseSchema: z.ZodObject<{
2603
2614
  build_error?: string | null | undefined;
2604
2615
  preview_url?: string | null | undefined;
2605
2616
  build_logs?: string | null | undefined;
2606
- branch_name?: string | null | undefined;
2607
- commit_message?: string | null | undefined;
2608
- commit_author?: string | null | undefined;
2609
2617
  }[] | undefined;
2610
2618
  }>;
2611
2619
  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(),
@@ -252,7 +255,8 @@ var packageSchema = z.object({
252
255
  ai_usage_instructions: z.string().nullable(),
253
256
  latest_package_release_fs_sha: z.string().nullable().default(null),
254
257
  default_view: z.enum(["files", "3d", "pcb", "schematic"]).default("files").optional(),
255
- allow_pr_previews: z.boolean().default(false).optional()
258
+ allow_pr_previews: z.boolean().default(false).optional(),
259
+ is_starred: z.boolean().default(false).optional()
256
260
  });
257
261
  var jlcpcbOrderStateSchema = z.object({
258
262
  jlcpcb_order_state_id: z.string(),
@@ -308,10 +312,7 @@ var packageBuildSchema = z.object({
308
312
  build_error: z.string().nullable().optional(),
309
313
  build_error_last_updated_at: z.string().datetime(),
310
314
  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()
315
+ build_logs: z.string().nullable().optional()
315
316
  });
316
317
  var databaseSchema = z.object({
317
318
  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
 
@@ -308,6 +311,7 @@ export const packageSchema = z.object({
308
311
  .default("files")
309
312
  .optional(),
310
313
  allow_pr_previews: z.boolean().default(false).optional(),
314
+ is_starred: z.boolean().default(false).optional(),
311
315
  })
312
316
  export type Package = z.infer<typeof packageSchema>
313
317
 
@@ -370,9 +374,6 @@ export const packageBuildSchema = z.object({
370
374
  build_error_last_updated_at: z.string().datetime(),
371
375
  preview_url: z.string().nullable().optional(),
372
376
  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
377
  })
377
378
  export type PackageBuild = z.infer<typeof packageBuildSchema>
378
379
 
@@ -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) {