@tscircuit/fake-snippets 0.0.120 → 0.0.122
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.
- package/dist/bundle.js +1 -2
- package/package.json +4 -1
- package/.github/CODEOWNERS +0 -1
- package/.github/workflows/bun-formatcheck.yml +0 -26
- package/.github/workflows/bun-pver-release.yml +0 -28
- package/.github/workflows/bun-test.yml +0 -28
- package/.github/workflows/bun-typecheck.yml +0 -26
- package/.github/workflows/bundle-size-analysis.yml +0 -79
- package/.github/workflows/stale.yml +0 -40
- package/.github/workflows/update-package.yml +0 -58
- package/.github/workflows/update-snapshots.yml +0 -49
- package/CLAUDE.md +0 -92
- package/CONTRIBUTING.md +0 -59
- package/api/generated-index.js +0 -456
- package/biome.json +0 -67
- package/bun-tests/fake-snippets-api/fixtures/get-test-server.ts +0 -141
- package/bun-tests/fake-snippets-api/fixtures/preload.ts +0 -18
- package/bun-tests/fake-snippets-api/fixtures/start-server.ts +0 -48
- package/bun-tests/fake-snippets-api/routes/accounts/get.test.ts +0 -64
- package/bun-tests/fake-snippets-api/routes/accounts/get_account_balance.test.ts +0 -14
- package/bun-tests/fake-snippets-api/routes/ai_reviews/create.test.ts +0 -21
- package/bun-tests/fake-snippets-api/routes/ai_reviews/get.test.ts +0 -16
- package/bun-tests/fake-snippets-api/routes/ai_reviews/list.test.ts +0 -14
- package/bun-tests/fake-snippets-api/routes/ai_reviews/process_review.test.ts +0 -16
- package/bun-tests/fake-snippets-api/routes/bug_reports/create.test.ts +0 -37
- package/bun-tests/fake-snippets-api/routes/bug_reports/upload_file.test.ts +0 -89
- package/bun-tests/fake-snippets-api/routes/datasheets/create.test.ts +0 -16
- package/bun-tests/fake-snippets-api/routes/datasheets/get.test.ts +0 -54
- package/bun-tests/fake-snippets-api/routes/datasheets/list.test.ts +0 -49
- package/bun-tests/fake-snippets-api/routes/datasheets/process_all_datasheets.test.ts +0 -22
- package/bun-tests/fake-snippets-api/routes/datasheets/run_async_tasks.test.ts +0 -19
- package/bun-tests/fake-snippets-api/routes/health.test.ts +0 -9
- package/bun-tests/fake-snippets-api/routes/order_files/get.test.ts +0 -48
- package/bun-tests/fake-snippets-api/routes/order_files/upload.test.ts +0 -77
- package/bun-tests/fake-snippets-api/routes/order_quotes/create.test.ts +0 -33
- package/bun-tests/fake-snippets-api/routes/orders/create.test.ts +0 -17
- package/bun-tests/fake-snippets-api/routes/orders/get.test.ts +0 -199
- package/bun-tests/fake-snippets-api/routes/orders/list.test.ts +0 -30
- package/bun-tests/fake-snippets-api/routes/orgs/add_member.test.ts +0 -26
- package/bun-tests/fake-snippets-api/routes/orgs/create.test.ts +0 -37
- package/bun-tests/fake-snippets-api/routes/orgs/get.test.ts +0 -53
- package/bun-tests/fake-snippets-api/routes/orgs/get_member.test.ts +0 -110
- package/bun-tests/fake-snippets-api/routes/orgs/list.test.ts +0 -17
- package/bun-tests/fake-snippets-api/routes/orgs/list_members.test.ts +0 -24
- package/bun-tests/fake-snippets-api/routes/orgs/remove_member.test.ts +0 -81
- package/bun-tests/fake-snippets-api/routes/orgs/update.test.ts +0 -151
- package/bun-tests/fake-snippets-api/routes/package_builds/get.test.ts +0 -279
- package/bun-tests/fake-snippets-api/routes/package_builds/list.test.ts +0 -292
- package/bun-tests/fake-snippets-api/routes/package_files/create.test.ts +0 -320
- package/bun-tests/fake-snippets-api/routes/package_files/create_or_update.test.ts +0 -603
- package/bun-tests/fake-snippets-api/routes/package_files/delete.test.ts +0 -233
- package/bun-tests/fake-snippets-api/routes/package_files/download.test.ts +0 -248
- package/bun-tests/fake-snippets-api/routes/package_files/get.test.ts +0 -230
- package/bun-tests/fake-snippets-api/routes/package_files/list.test.ts +0 -212
- package/bun-tests/fake-snippets-api/routes/package_releases/create.test.ts +0 -171
- package/bun-tests/fake-snippets-api/routes/package_releases/get.test.ts +0 -181
- package/bun-tests/fake-snippets-api/routes/package_releases/get_image_generation_fields.test.ts +0 -38
- package/bun-tests/fake-snippets-api/routes/package_releases/list.test.ts +0 -149
- package/bun-tests/fake-snippets-api/routes/package_releases/update.test.ts +0 -160
- package/bun-tests/fake-snippets-api/routes/packages/add_star.test.ts +0 -129
- package/bun-tests/fake-snippets-api/routes/packages/create.test.ts +0 -67
- package/bun-tests/fake-snippets-api/routes/packages/delete.test.ts +0 -74
- package/bun-tests/fake-snippets-api/routes/packages/fork.test.ts +0 -132
- package/bun-tests/fake-snippets-api/routes/packages/get.test.ts +0 -112
- package/bun-tests/fake-snippets-api/routes/packages/images.test.ts +0 -72
- package/bun-tests/fake-snippets-api/routes/packages/list-1.test.ts +0 -145
- package/bun-tests/fake-snippets-api/routes/packages/list-2.test.ts +0 -48
- package/bun-tests/fake-snippets-api/routes/packages/list_latest.test.ts +0 -110
- package/bun-tests/fake-snippets-api/routes/packages/list_trending.test.ts +0 -103
- package/bun-tests/fake-snippets-api/routes/packages/remove_star.test.ts +0 -131
- package/bun-tests/fake-snippets-api/routes/packages/update.test.ts +0 -217
- package/bun-tests/fake-snippets-api/routes/proxy.test.ts +0 -42
- package/bun.lock +0 -2724
- package/bunfig.toml +0 -3
- package/components.json +0 -20
- package/docs/CIRCUIT_JSON_SOURCE_COMPONENT_OVERVIEW.md +0 -151
- package/fake-snippets-api/README.md +0 -6
- package/fake-snippets-api/biome.json +0 -47
- package/fake-snippets-api/bun.lockb +0 -0
- package/fake-snippets-api/lib/db/autoload-dev-packages.ts +0 -222
- package/fake-snippets-api/lib/db/autoload-packages.json +0 -8
- package/fake-snippets-api/lib/db/db-client.ts +0 -1857
- package/fake-snippets-api/lib/db/schema.ts +0 -502
- package/fake-snippets-api/lib/db/seed.ts +0 -1843
- package/fake-snippets-api/lib/index.ts +0 -3
- package/fake-snippets-api/lib/middleware/with-ctx-error.ts +0 -26
- package/fake-snippets-api/lib/middleware/with-db.ts +0 -15
- package/fake-snippets-api/lib/middleware/with-error-handling.ts +0 -24
- package/fake-snippets-api/lib/middleware/with-optional-session-auth.ts +0 -53
- package/fake-snippets-api/lib/middleware/with-request-logging.ts +0 -54
- package/fake-snippets-api/lib/middleware/with-session-auth.ts +0 -102
- package/fake-snippets-api/lib/middleware/with-winter-spec.ts +0 -24
- package/fake-snippets-api/lib/package_file/generate-fs-sha.ts +0 -20
- package/fake-snippets-api/lib/package_file/get-package-file-id-from-file-descriptor.ts +0 -173
- package/fake-snippets-api/lib/package_release/find-package-release-id.ts +0 -120
- package/fake-snippets-api/lib/public-mapping/public-map-org.ts +0 -34
- package/fake-snippets-api/lib/public-mapping/public-map-package-build.ts +0 -48
- package/fake-snippets-api/lib/public-mapping/public-map-package-release.ts +0 -88
- package/fake-snippets-api/lib/public-mapping/public-map-package.ts +0 -60
- package/fake-snippets-api/lib/with-winter-spec.ts +0 -1
- package/fake-snippets-api/next-env.d.ts +0 -5
- package/fake-snippets-api/routes/api/_fake/ai_reviews/process_review.ts +0 -31
- package/fake-snippets-api/routes/api/_fake/datasheets/process_all_datasheets.ts +0 -38
- package/fake-snippets-api/routes/api/_fake/db.ts +0 -11
- package/fake-snippets-api/routes/api/_fake/move_orders_forward.ts +0 -65
- package/fake-snippets-api/routes/api/_fake/received_quotes.ts +0 -112
- package/fake-snippets-api/routes/api/_fake/run_async_tasks.ts +0 -12
- package/fake-snippets-api/routes/api/_fake/seed.ts +0 -13
- package/fake-snippets-api/routes/api/accounts/get.ts +0 -35
- package/fake-snippets-api/routes/api/accounts/get_account_balance.ts +0 -22
- package/fake-snippets-api/routes/api/accounts/search.ts +0 -20
- package/fake-snippets-api/routes/api/accounts/update.ts +0 -32
- package/fake-snippets-api/routes/api/ai/[...anyroute].ts +0 -31
- package/fake-snippets-api/routes/api/ai.ts +0 -2
- package/fake-snippets-api/routes/api/ai_reviews/create.ts +0 -44
- package/fake-snippets-api/routes/api/ai_reviews/get.ts +0 -24
- package/fake-snippets-api/routes/api/ai_reviews/list.ts +0 -14
- package/fake-snippets-api/routes/api/aistream/[...anyroute].ts +0 -65
- package/fake-snippets-api/routes/api/autocomplete/create_autocomplete.ts +0 -16
- package/fake-snippets-api/routes/api/bug_reports/create.ts +0 -43
- package/fake-snippets-api/routes/api/bug_reports/upload_file.ts +0 -113
- package/fake-snippets-api/routes/api/datasheets/create.ts +0 -18
- package/fake-snippets-api/routes/api/datasheets/get.ts +0 -35
- package/fake-snippets-api/routes/api/datasheets/list.ts +0 -29
- package/fake-snippets-api/routes/api/github/installations/create_new_installation_redirect.ts +0 -75
- package/fake-snippets-api/routes/api/github/repos/list_available.ts +0 -91
- package/fake-snippets-api/routes/api/github/repos/refresh.ts +0 -44
- package/fake-snippets-api/routes/api/health.ts +0 -9
- package/fake-snippets-api/routes/api/internal/sessions/create_without_auth.ts +0 -63
- package/fake-snippets-api/routes/api/order_files/get.ts +0 -28
- package/fake-snippets-api/routes/api/order_files/upload.ts +0 -46
- package/fake-snippets-api/routes/api/order_quotes/create.ts +0 -60
- package/fake-snippets-api/routes/api/order_quotes/create_all_vendor_quotes.ts +0 -30
- package/fake-snippets-api/routes/api/order_quotes/get.ts +0 -29
- package/fake-snippets-api/routes/api/orders/create.ts +0 -70
- package/fake-snippets-api/routes/api/orders/get.ts +0 -168
- package/fake-snippets-api/routes/api/orders/list.ts +0 -15
- package/fake-snippets-api/routes/api/orgs/add_member.ts +0 -52
- package/fake-snippets-api/routes/api/orgs/create.ts +0 -48
- package/fake-snippets-api/routes/api/orgs/get.ts +0 -39
- package/fake-snippets-api/routes/api/orgs/get_member.ts +0 -67
- package/fake-snippets-api/routes/api/orgs/list.ts +0 -31
- package/fake-snippets-api/routes/api/orgs/list_members.ts +0 -106
- package/fake-snippets-api/routes/api/orgs/remove_member.ts +0 -46
- package/fake-snippets-api/routes/api/orgs/update.ts +0 -118
- package/fake-snippets-api/routes/api/package_builds/get.ts +0 -70
- package/fake-snippets-api/routes/api/package_builds/list.ts +0 -97
- package/fake-snippets-api/routes/api/package_files/create.ts +0 -135
- package/fake-snippets-api/routes/api/package_files/create_or_update.ts +0 -194
- package/fake-snippets-api/routes/api/package_files/delete.ts +0 -109
- package/fake-snippets-api/routes/api/package_files/download.ts +0 -87
- package/fake-snippets-api/routes/api/package_files/get.ts +0 -68
- package/fake-snippets-api/routes/api/package_files/list.ts +0 -54
- package/fake-snippets-api/routes/api/package_releases/create.ts +0 -109
- package/fake-snippets-api/routes/api/package_releases/get.ts +0 -137
- package/fake-snippets-api/routes/api/package_releases/list.ts +0 -85
- package/fake-snippets-api/routes/api/package_releases/rebuild.ts +0 -66
- package/fake-snippets-api/routes/api/package_releases/update.ts +0 -122
- package/fake-snippets-api/routes/api/packages/add_star.ts +0 -84
- package/fake-snippets-api/routes/api/packages/create.ts +0 -136
- package/fake-snippets-api/routes/api/packages/delete.ts +0 -41
- package/fake-snippets-api/routes/api/packages/fork.ts +0 -165
- package/fake-snippets-api/routes/api/packages/generate_from_jlcpcb.ts +0 -111
- package/fake-snippets-api/routes/api/packages/get.ts +0 -81
- package/fake-snippets-api/routes/api/packages/images/[owner_github_username]/[unscoped_name]/[view_format].ts +0 -119
- package/fake-snippets-api/routes/api/packages/list.ts +0 -105
- package/fake-snippets-api/routes/api/packages/list_latest.ts +0 -29
- package/fake-snippets-api/routes/api/packages/list_trending.ts +0 -43
- package/fake-snippets-api/routes/api/packages/remove_star.ts +0 -70
- package/fake-snippets-api/routes/api/packages/search.ts +0 -19
- package/fake-snippets-api/routes/api/packages/update.ts +0 -112
- package/fake-snippets-api/routes/api/packages/update_ai_description.ts +0 -37
- package/fake-snippets-api/routes/api/proxy.ts +0 -128
- package/fake-snippets-api/routes/api/snippets/add_star.ts +0 -62
- package/fake-snippets-api/routes/api/snippets/create.ts +0 -184
- package/fake-snippets-api/routes/api/snippets/delete.ts +0 -41
- package/fake-snippets-api/routes/api/snippets/download.ts +0 -162
- package/fake-snippets-api/routes/api/snippets/generate_from_jlcpcb.ts +0 -48
- package/fake-snippets-api/routes/api/snippets/get.ts +0 -83
- package/fake-snippets-api/routes/api/snippets/get_image.ts +0 -65
- package/fake-snippets-api/routes/api/snippets/images/[author]/[snippet_name]/[typeFormat].ts +0 -80
- package/fake-snippets-api/routes/api/snippets/list.ts +0 -151
- package/fake-snippets-api/routes/api/snippets/list_latest.ts +0 -13
- package/fake-snippets-api/routes/api/snippets/list_trending.ts +0 -38
- package/fake-snippets-api/routes/api/snippets/remove_star.ts +0 -42
- package/fake-snippets-api/routes/api/snippets/search.ts +0 -18
- package/fake-snippets-api/routes/api/snippets/update.ts +0 -114
- package/fake-snippets-api/utils/normalizeProjectFilePath.ts +0 -60
- package/fake-snippets-api/utils/order-steps.ts +0 -20
- package/favicon.ico +0 -0
- package/index.html +0 -125
- package/landing.html +0 -23
- package/playwright-tests/ai-page.spec.ts +0 -19
- package/playwright-tests/circuit-json-import.spec.ts +0 -133
- package/playwright-tests/cmd-click.spec.ts +0 -43
- package/playwright-tests/dashboard-page.spec.ts +0 -10
- package/playwright-tests/editor-page.spec.ts +0 -15
- package/playwright-tests/exampleCircuitJson.ts +0 -498
- package/playwright-tests/files-dialog.spec.ts +0 -19
- package/playwright-tests/footprint-dialog/footprint-dialog.spec.ts +0 -27
- package/playwright-tests/footprint-dialog/footprint-insertion.spec.ts +0 -38
- package/playwright-tests/footprint-dialog/footprint-preview.spec.ts +0 -34
- package/playwright-tests/footprint-dialog/footprint-selection.spec.ts +0 -29
- package/playwright-tests/handle-manual-edits.spec.ts +0 -55
- package/playwright-tests/home-page.spec.ts +0 -10
- package/playwright-tests/images.spec.ts +0 -17
- package/playwright-tests/manual-edits.spec.ts +0 -89
- package/playwright-tests/preview-page.spec.ts +0 -7
- package/playwright-tests/profile-page.spec.ts +0 -108
- package/playwright-tests/quickstart-page.spec.ts +0 -10
- package/playwright-tests/search-links.spec.ts +0 -21
- package/playwright-tests/search.spec.ts +0 -27
- package/playwright-tests/snapshots/ai-page.spec.ts-AI-Page-lg.png +0 -0
- package/playwright-tests/snapshots/ai-page.spec.ts-AI-Page-md.png +0 -0
- package/playwright-tests/snapshots/ai-page.spec.ts-AI-Page-xs.png +0 -0
- package/playwright-tests/snapshots/cmd-click.spec.ts-underlined-imports.png +0 -0
- package/playwright-tests/snapshots/dashboard-page.spec.ts-Dashboard-page-lg.png +0 -0
- package/playwright-tests/snapshots/dashboard-page.spec.ts-Dashboard-page-md.png +0 -0
- package/playwright-tests/snapshots/dashboard-page.spec.ts-Dashboard-page-xs.png +0 -0
- package/playwright-tests/snapshots/editor-page.spec.ts-editor-with-snippet.png +0 -0
- package/playwright-tests/snapshots/error-fallback.spec.ts-error-fallback-lg.png +0 -0
- package/playwright-tests/snapshots/error-fallback.spec.ts-error-fallback-md.png +0 -0
- package/playwright-tests/snapshots/error-fallback.spec.ts-error-fallback-xs.png +0 -0
- package/playwright-tests/snapshots/files-dialog.spec.ts-view-snippet-files.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-dialog.spec.ts-footprint-preview-lg.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-dialog.spec.ts-footprint-preview-md.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-dialog.spec.ts-footprint-preview-xs.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-insertion.spec.ts-footprint-insertion-lg.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-insertion.spec.ts-footprint-insertion-md.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-insertion.spec.ts-footprint-insertion-xs.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-preview.spec.ts-footprint-preview-lg.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-preview.spec.ts-footprint-preview-md.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-preview.spec.ts-footprint-preview-xs.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-selection.spec.ts-footprint-preview-lg.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-selection.spec.ts-footprint-preview-md.png +0 -0
- package/playwright-tests/snapshots/footprint-dialog/footprint-selection.spec.ts-footprint-preview-xs.png +0 -0
- package/playwright-tests/snapshots/handle-manual-edits.spec.ts-handle-manual-edits.png +0 -0
- package/playwright-tests/snapshots/home-page.spec.ts-Home-page-lg.png +0 -0
- package/playwright-tests/snapshots/home-page.spec.ts-Home-page-md.png +0 -0
- package/playwright-tests/snapshots/home-page.spec.ts-Home-page-xs.png +0 -0
- package/playwright-tests/snapshots/images.spec.ts-pcb-image.png +0 -0
- package/playwright-tests/snapshots/images.spec.ts-schematic-image.png +0 -0
- package/playwright-tests/snapshots/manual-edits.spec.ts-editor-manual-edits.png +0 -0
- package/playwright-tests/snapshots/manual-edits.spec.ts-manual-edits-view.png +0 -0
- package/playwright-tests/snapshots/preview-page.spec.ts-preview-snippet-pcb.png +0 -0
- package/playwright-tests/snapshots/profile-page.spec.ts-profile-page-before-delete.png +0 -0
- package/playwright-tests/snapshots/profile-page.spec.ts-profile-page-delete-dialog.png +0 -0
- package/playwright-tests/snapshots/profile-page.spec.ts-profile-page-dropdown-open.png +0 -0
- package/playwright-tests/snapshots/profile-page.spec.ts-profile-page-snippets-tab.png +0 -0
- package/playwright-tests/snapshots/profile-page.spec.ts-profile-page-starred-tab.png +0 -0
- package/playwright-tests/snapshots/profile-page.spec.ts-snippet-page-open-after-star-click.png +0 -0
- package/playwright-tests/snapshots/quickstart-page.spec.ts-Quickstart-Pagelg.png +0 -0
- package/playwright-tests/snapshots/quickstart-page.spec.ts-Quickstart-Pagemd.png +0 -0
- package/playwright-tests/snapshots/quickstart-page.spec.ts-Quickstart-Pagexs.png +0 -0
- package/playwright-tests/snapshots/search-links.spec.ts-search-links.png +0 -0
- package/playwright-tests/snapshots/search.spec.ts-search-lg.png +0 -0
- package/playwright-tests/snapshots/search.spec.ts-search-md.png +0 -0
- package/playwright-tests/snapshots/search.spec.ts-search-xs.png +0 -0
- package/playwright-tests/snapshots/star.spec.ts-remove-star-button.png +0 -0
- package/playwright-tests/snapshots/star.spec.ts-star-button.png +0 -0
- package/playwright-tests/snapshots/update-description.spec.ts-update-description.png +0 -0
- package/playwright-tests/snapshots/view-snippet.spec.ts-view-snippet-after-lg.png +0 -0
- package/playwright-tests/snapshots/view-snippet.spec.ts-view-snippet-after-md.png +0 -0
- package/playwright-tests/snapshots/view-snippet.spec.ts-view-snippet-after-xs.png +0 -0
- package/playwright-tests/snapshots/view-snippet.spec.ts-view-snippet-before-lg.png +0 -0
- package/playwright-tests/snapshots/view-snippet.spec.ts-view-snippet-before-md.png +0 -0
- package/playwright-tests/snapshots/view-snippet.spec.ts-view-snippet-before-xs.png +0 -0
- package/playwright-tests/snapshots/view-snippet.spec.ts-view-snippet-files.png +0 -0
- package/playwright-tests/star.spec.ts +0 -40
- package/playwright-tests/update-description.spec.ts +0 -18
- package/playwright-tests/view-snippet.spec.ts +0 -35
- package/playwright-tests/viewports.ts +0 -5
- package/playwright.config.ts +0 -27
- package/postcss.config.js +0 -6
- package/public/robots.txt +0 -9
- package/renovate.json +0 -25
- package/scripts/generate-image-sizes.ts +0 -57
- package/scripts/generate-sitemap.ts +0 -103
- package/scripts/generate_bundle_stats.js +0 -208
- package/scripts/snapshot.ts +0 -35
- package/src/App.tsx +0 -314
- package/src/ContextProviders.tsx +0 -94
- package/src/assets/originals/editor_example_1.webp +0 -0
- package/src/assets/originals/editor_example_1_more_square.webp +0 -0
- package/src/assets/originals/editor_example_2.webp +0 -0
- package/src/assets/originals/example_schematic.webp +0 -0
- package/src/components/AiChatMessage.tsx +0 -86
- package/src/components/Analytics.tsx +0 -23
- package/src/components/BomTable.tsx +0 -69
- package/src/components/ChatInput.tsx +0 -53
- package/src/components/CircuitJsonImportDialog.tsx +0 -269
- package/src/components/CircuitToSvgWithMouseControl.tsx +0 -78
- package/src/components/CmdKMenu.tsx +0 -809
- package/src/components/CreateNewSnippetWithAiHero.tsx +0 -81
- package/src/components/CreateReleaseDialog.tsx +0 -124
- package/src/components/DownloadButtonAndMenu.tsx +0 -443
- package/src/components/ErrorFallback.tsx +0 -25
- package/src/components/ErrorOutline.tsx +0 -35
- package/src/components/ErrorTabContent.tsx +0 -122
- package/src/components/ExpandableText.tsx +0 -29
- package/src/components/FAQ.tsx +0 -189
- package/src/components/FileSidebar.tsx +0 -271
- package/src/components/Footer.tsx +0 -144
- package/src/components/GithubAvatarWithFallback.tsx +0 -35
- package/src/components/Header.tsx +0 -202
- package/src/components/Header2.tsx +0 -202
- package/src/components/HeaderDropdown.tsx +0 -88
- package/src/components/HeaderLogin.tsx +0 -105
- package/src/components/HiddenFilesDropdown.tsx +0 -42
- package/src/components/ImageWithFallback.tsx +0 -37
- package/src/components/LatestSnippets.tsx +0 -39
- package/src/components/NotFound.tsx +0 -37
- package/src/components/OptimizedImage.tsx +0 -100
- package/src/components/PackageBreadcrumb.tsx +0 -105
- package/src/components/PackageBuildsPage/ErrorObject.ts +0 -12
- package/src/components/PackageBuildsPage/capitalCase.ts +0 -4
- package/src/components/PackageBuildsPage/getColorForDisplayStatus.ts +0 -17
- package/src/components/PackageCard.tsx +0 -191
- package/src/components/PackageCardSkeleton.tsx +0 -17
- package/src/components/PackageLink.tsx +0 -29
- package/src/components/PackageSearchResults.tsx +0 -81
- package/src/components/PackagesList.tsx +0 -71
- package/src/components/PcbViewerWithContainerHeight.tsx +0 -47
- package/src/components/PrefetchPageLink.tsx +0 -114
- package/src/components/PreviewEmptyState.tsx +0 -16
- package/src/components/ProfileRouter.tsx +0 -30
- package/src/components/RunButton.tsx +0 -27
- package/src/components/SearchComponent.tsx +0 -282
- package/src/components/SentryNotFoundReporter.tsx +0 -44
- package/src/components/SnippetTypeIcon.tsx +0 -60
- package/src/components/StaticPreviewContent.tsx +0 -89
- package/src/components/StaticViewSnippetSidebar.tsx +0 -100
- package/src/components/SuspenseRunFrame.tsx +0 -28
- package/src/components/TableViewer/CircuitJsonTableViewer.tsx +0 -316
- package/src/components/TableViewer/ClickableText.tsx +0 -21
- package/src/components/TableViewer/HeaderCell.tsx +0 -27
- package/src/components/TableViewer/Modal.tsx +0 -39
- package/src/components/TrendingPackagesCarousel.tsx +0 -79
- package/src/components/TypeBadge.tsx +0 -31
- package/src/components/UserCard.tsx +0 -80
- package/src/components/ViewPackagePage/components/ShikiCodeViewer.tsx +0 -49
- package/src/components/ViewPackagePage/components/build-status.tsx +0 -38
- package/src/components/ViewPackagePage/components/important-files-view.tsx +0 -611
- package/src/components/ViewPackagePage/components/main-content-header.tsx +0 -181
- package/src/components/ViewPackagePage/components/main-content-view-selector.tsx +0 -167
- package/src/components/ViewPackagePage/components/markdown-viewer.tsx +0 -88
- package/src/components/ViewPackagePage/components/mobile-sidebar.tsx +0 -301
- package/src/components/ViewPackagePage/components/package-header.tsx +0 -264
- package/src/components/ViewPackagePage/components/preview-image-squares.tsx +0 -47
- package/src/components/ViewPackagePage/components/repo-page-content.tsx +0 -266
- package/src/components/ViewPackagePage/components/sidebar-about-section.tsx +0 -223
- package/src/components/ViewPackagePage/components/sidebar-packages-section.tsx +0 -16
- package/src/components/ViewPackagePage/components/sidebar-releases-section.tsx +0 -126
- package/src/components/ViewPackagePage/components/sidebar.tsx +0 -29
- package/src/components/ViewPackagePage/components/tab-views/3d-view.tsx +0 -43
- package/src/components/ViewPackagePage/components/tab-views/bom-view.tsx +0 -30
- package/src/components/ViewPackagePage/components/tab-views/files-view.tsx +0 -295
- package/src/components/ViewPackagePage/components/tab-views/pcb-view.tsx +0 -35
- package/src/components/ViewPackagePage/components/tab-views/schematic-view.tsx +0 -38
- package/src/components/ViewPackagePage/components/theme-toggle.tsx +0 -40
- package/src/components/ViewPackagePage/hooks/use-current-package-circuit-json.ts +0 -46
- package/src/components/ViewPackagePage/hooks/use-mobile.tsx +0 -19
- package/src/components/ViewPackagePage/hooks/use-toast.tsx +0 -69
- package/src/components/ViewPackagePage/utils/fuzz-search.ts +0 -121
- package/src/components/ViewPackagePage/utils/get-license-content.ts +0 -119
- package/src/components/ViewPackagePage/utils/is-hidden-file.ts +0 -55
- package/src/components/ViewPackagePage/utils/is-package-file-important.ts +0 -35
- package/src/components/ViewPackagePage/utils/is-within-directory.ts +0 -32
- package/src/components/dialogs/GitHubRepositorySelector.tsx +0 -300
- package/src/components/dialogs/confirm-delete-package-dialog.tsx +0 -74
- package/src/components/dialogs/confirm-discard-changes-dialog.tsx +0 -73
- package/src/components/dialogs/create-use-dialog.tsx +0 -40
- package/src/components/dialogs/edit-description-dialog.tsx +0 -96
- package/src/components/dialogs/edit-package-details-dialog.tsx +0 -474
- package/src/components/dialogs/files-dialog.tsx +0 -70
- package/src/components/dialogs/import-component-dialog.tsx +0 -32
- package/src/components/dialogs/import-package-dialog.tsx +0 -90
- package/src/components/dialogs/new-package-save-prompt-dialog.tsx +0 -199
- package/src/components/dialogs/package-visibility-settings-dialog.tsx +0 -93
- package/src/components/dialogs/pcb-download-dialog.tsx +0 -113
- package/src/components/dialogs/rename-package-dialog.tsx +0 -86
- package/src/components/dialogs/rename-snippet-dialog.tsx +0 -81
- package/src/components/dialogs/update-package-description-dialog.tsx +0 -96
- package/src/components/dialogs/view-ts-files-dialog.tsx +0 -664
- package/src/components/organization/OrganizationCard.tsx +0 -202
- package/src/components/organization/OrganizationCardSkeleton.tsx +0 -55
- package/src/components/organization/OrganizationHeader.tsx +0 -140
- package/src/components/organization/OrganizationMembers.tsx +0 -117
- package/src/components/package-port/CodeAndPreview.tsx +0 -253
- package/src/components/package-port/CodeEditor.tsx +0 -866
- package/src/components/package-port/CodeEditorHeader.tsx +0 -427
- package/src/components/package-port/EditorNav.tsx +0 -606
- package/src/components/package-port/GlobalFindReplace.tsx +0 -681
- package/src/components/package-port/QuickOpen.tsx +0 -241
- package/src/components/preview/BuildsList.tsx +0 -237
- package/src/components/preview/ConnectedPackagesList.tsx +0 -229
- package/src/components/preview/ConnectedRepoOverview.tsx +0 -588
- package/src/components/preview/PackageReleasesDashboard.tsx +0 -228
- package/src/components/preview/index.tsx +0 -54
- package/src/components/ui/accordion.tsx +0 -55
- package/src/components/ui/alert-dialog.tsx +0 -139
- package/src/components/ui/alert.tsx +0 -59
- package/src/components/ui/aspect-ratio.tsx +0 -5
- package/src/components/ui/avatar.tsx +0 -48
- package/src/components/ui/badge.tsx +0 -36
- package/src/components/ui/breadcrumb.tsx +0 -118
- package/src/components/ui/button.tsx +0 -58
- package/src/components/ui/calendar.tsx +0 -73
- package/src/components/ui/card.tsx +0 -76
- package/src/components/ui/carousel.tsx +0 -260
- package/src/components/ui/chart.tsx +0 -363
- package/src/components/ui/checkbox.tsx +0 -28
- package/src/components/ui/collapsible.tsx +0 -9
- package/src/components/ui/combobox.tsx +0 -178
- package/src/components/ui/command.tsx +0 -151
- package/src/components/ui/context-menu.tsx +0 -202
- package/src/components/ui/dialog.tsx +0 -120
- package/src/components/ui/drawer.tsx +0 -116
- package/src/components/ui/dropdown-menu.tsx +0 -203
- package/src/components/ui/form.tsx +0 -182
- package/src/components/ui/hover-card.tsx +0 -27
- package/src/components/ui/input.tsx +0 -25
- package/src/components/ui/label.tsx +0 -24
- package/src/components/ui/menubar.tsx +0 -238
- package/src/components/ui/navigation-menu.tsx +0 -129
- package/src/components/ui/pagination.tsx +0 -121
- package/src/components/ui/popover.tsx +0 -31
- package/src/components/ui/progress.tsx +0 -26
- package/src/components/ui/radio-group.tsx +0 -42
- package/src/components/ui/resizable.tsx +0 -43
- package/src/components/ui/role-badge.tsx +0 -27
- package/src/components/ui/scroll-area.tsx +0 -46
- package/src/components/ui/searchable-select.tsx +0 -94
- package/src/components/ui/select.tsx +0 -162
- package/src/components/ui/separator.tsx +0 -29
- package/src/components/ui/sheet.tsx +0 -141
- package/src/components/ui/skeleton.tsx +0 -18
- package/src/components/ui/slider.tsx +0 -26
- package/src/components/ui/sonner.tsx +0 -30
- package/src/components/ui/switch.tsx +0 -27
- package/src/components/ui/table.tsx +0 -120
- package/src/components/ui/tabs.tsx +0 -53
- package/src/components/ui/textarea.tsx +0 -24
- package/src/components/ui/toast.tsx +0 -128
- package/src/components/ui/toaster.tsx +0 -1
- package/src/components/ui/toggle-group.tsx +0 -59
- package/src/components/ui/toggle.tsx +0 -43
- package/src/components/ui/tooltip.tsx +0 -28
- package/src/components/ui/tree-view.tsx +0 -563
- package/src/entry-server.tsx +0 -12
- package/src/hooks/use-account-balance.ts +0 -25
- package/src/hooks/use-add-org-member-mutation.ts +0 -51
- package/src/hooks/use-ai-api.ts +0 -35
- package/src/hooks/use-ai-review.ts +0 -31
- package/src/hooks/use-axios.ts +0 -20
- package/src/hooks/use-code-completion-ai-api.ts +0 -11
- package/src/hooks/use-copy-to-clipboard.ts +0 -26
- package/src/hooks/use-create-datasheet.ts +0 -30
- package/src/hooks/use-create-org-mutation.ts +0 -38
- package/src/hooks/use-create-package-files-mutation.ts +0 -76
- package/src/hooks/use-create-package-mutation.ts +0 -54
- package/src/hooks/use-create-package-release-mutation.ts +0 -107
- package/src/hooks/use-create-release-dialog.ts +0 -160
- package/src/hooks/use-create-snippet-mutation.ts +0 -65
- package/src/hooks/use-current-package-id.ts +0 -16
- package/src/hooks/use-current-package-info.ts +0 -32
- package/src/hooks/use-current-package-release.ts +0 -48
- package/src/hooks/use-current-snippet-id.ts +0 -78
- package/src/hooks/use-current-snippet.ts +0 -24
- package/src/hooks/use-datasheet.ts +0 -18
- package/src/hooks/use-debounce.ts +0 -17
- package/src/hooks/use-delete-package.ts +0 -45
- package/src/hooks/use-download-zip.ts +0 -50
- package/src/hooks/use-fork-package-mutation.ts +0 -61
- package/src/hooks/use-global-store.ts +0 -36
- package/src/hooks/use-hotkey.ts +0 -116
- package/src/hooks/use-hydration.ts +0 -30
- package/src/hooks/use-is-using-fake-api.ts +0 -3
- package/src/hooks/use-jlcpcb-component-import.tsx +0 -164
- package/src/hooks/use-list-org-members.ts +0 -32
- package/src/hooks/use-list-user-orgs.ts +0 -25
- package/src/hooks/use-now.ts +0 -12
- package/src/hooks/use-org-by-github-handle.ts +0 -24
- package/src/hooks/use-org.ts +0 -24
- package/src/hooks/use-organization.ts +0 -42
- package/src/hooks/use-package-as-snippet.ts +0 -81
- package/src/hooks/use-package-builds.ts +0 -91
- package/src/hooks/use-package-by-package-id.ts +0 -24
- package/src/hooks/use-package-by-package-name.ts +0 -29
- package/src/hooks/use-package-details-form.ts +0 -146
- package/src/hooks/use-package-files.ts +0 -122
- package/src/hooks/use-package-release-by-id-or-version.ts +0 -45
- package/src/hooks/use-package-release-images.ts +0 -105
- package/src/hooks/use-package-release.ts +0 -124
- package/src/hooks/use-package-stars.ts +0 -163
- package/src/hooks/use-package.ts +0 -24
- package/src/hooks/use-packages-base-api-url.ts +0 -3
- package/src/hooks/use-preview-images.ts +0 -78
- package/src/hooks/use-rebuild-package-release-mutation.ts +0 -41
- package/src/hooks/use-remove-org-member-mutation.ts +0 -32
- package/src/hooks/use-request-ai-review-mutation.ts +0 -54
- package/src/hooks/use-run-tsx/eval-compiled-js.ts +0 -9
- package/src/hooks/use-shiki-highlighter.ts +0 -33
- package/src/hooks/use-sign-in.ts +0 -24
- package/src/hooks/use-snippet-by-name.ts +0 -25
- package/src/hooks/use-snippet.ts +0 -24
- package/src/hooks/use-toast.tsx +0 -90
- package/src/hooks/use-update-ai-description-mutation.ts +0 -42
- package/src/hooks/use-update-org-mutation.ts +0 -41
- package/src/hooks/use-url-params.ts +0 -31
- package/src/hooks/use-warn-user-on-page-change.ts +0 -90
- package/src/hooks/useFileManagement.ts +0 -602
- package/src/hooks/useForkPackageMutation.ts +0 -50
- package/src/hooks/useForkSnippetMutation.ts +0 -53
- package/src/hooks/useOptimizedPackageFilesLoader.ts +0 -136
- package/src/hooks/usePackageFilesLoader.ts +0 -58
- package/src/hooks/useUpdatePackageFilesMutation.ts +0 -131
- package/src/hooks/useUpdatePackageMutation.ts +0 -63
- package/src/index.css +0 -108
- package/src/lib/__tests__/constants.test.ts +0 -66
- package/src/lib/base64ToBytes.ts +0 -5
- package/src/lib/bytesToBase64.ts +0 -4
- package/src/lib/codemirror/basic-setup.ts +0 -67
- package/src/lib/constants.ts +0 -23
- package/src/lib/decodeUrlHashToFsMap.ts +0 -17
- package/src/lib/decodeUrlHashToText.ts +0 -15
- package/src/lib/defaultCodeForBlankCode.tsx +0 -7
- package/src/lib/download-fns/createBlobURL.ts +0 -4
- package/src/lib/download-fns/download-assembly-svg.ts +0 -12
- package/src/lib/download-fns/download-circuit-json-fn.ts +0 -12
- package/src/lib/download-fns/download-circuit-png.ts +0 -96
- package/src/lib/download-fns/download-dsn-file-fn.ts +0 -12
- package/src/lib/download-fns/download-fabrication-files.ts +0 -233
- package/src/lib/download-fns/download-gltf-from-circuit-json.ts +0 -44
- package/src/lib/download-fns/download-gltf.ts +0 -43
- package/src/lib/download-fns/download-kicad-files.ts +0 -38
- package/src/lib/download-fns/download-pcb-svg.ts +0 -35
- package/src/lib/download-fns/download-png-utils.ts +0 -31
- package/src/lib/download-fns/download-readable-netlist.ts +0 -12
- package/src/lib/download-fns/download-schematic-svg.ts +0 -12
- package/src/lib/download-fns/download-simple-route-json.ts +0 -17
- package/src/lib/download-fns/download-spice-file.ts +0 -13
- package/src/lib/download-fns/download-step.ts +0 -12
- package/src/lib/encodeFsMapToUrlHash.ts +0 -13
- package/src/lib/encodeTextToUrlHash.ts +0 -17
- package/src/lib/get-snippet-template.ts +0 -26
- package/src/lib/getLicenseFromLicenseContent.ts +0 -67
- package/src/lib/handleManualEditsImport.tsx +0 -65
- package/src/lib/handleManualEditsImportWithSupportForMultipleFiles.ts +0 -67
- package/src/lib/normalize-svg-for-tile.ts +0 -50
- package/src/lib/populate-query-cache-with-ssr-data.ts +0 -53
- package/src/lib/posthog.ts +0 -17
- package/src/lib/react-query-api-failure-tracking.ts +0 -148
- package/src/lib/sentry.ts +0 -14
- package/src/lib/templates/blank-3d-model-template.ts +0 -12
- package/src/lib/templates/blank-circuit-board-template.ts +0 -20
- package/src/lib/templates/blank-footprint-template.ts +0 -29
- package/src/lib/templates/blank-package-template.ts +0 -21
- package/src/lib/templates/blinking-led-board-template.ts +0 -64
- package/src/lib/templates/usb-c-led-flashlight-template.ts +0 -22
- package/src/lib/ts-lib-cache.ts +0 -162
- package/src/lib/types.ts +0 -31
- package/src/lib/utils/checkIfManualEditsImported.ts +0 -20
- package/src/lib/utils/findTargetFile.ts +0 -97
- package/src/lib/utils/formatTimeAgo.ts +0 -10
- package/src/lib/utils/getPackagePreviewImageUrl.ts +0 -15
- package/src/lib/utils/index.ts +0 -6
- package/src/lib/utils/isComponentExported.ts +0 -10
- package/src/lib/utils/isUuid.ts +0 -5
- package/src/lib/utils/isValidFileName.ts +0 -17
- package/src/lib/utils/load-prettier.ts +0 -23
- package/src/lib/utils/member-role.tsx +0 -61
- package/src/lib/utils/package-utils.ts +0 -7
- package/src/lib/utils/parseJsonOrNull.ts +0 -8
- package/src/lib/utils/pcbManualEditEventHandler.ts +0 -156
- package/src/lib/utils/resolveRelativePath.ts +0 -40
- package/src/lib/utils/timeAgo.ts +0 -20
- package/src/lib/utils/toastManualEditConflicts.tsx +0 -39
- package/src/lib/utils/transformFilesToTreeData.tsx +0 -195
- package/src/main.tsx +0 -15
- package/src/pages/404.tsx +0 -23
- package/src/pages/authorize.tsx +0 -208
- package/src/pages/create-organization.tsx +0 -169
- package/src/pages/dashboard.tsx +0 -254
- package/src/pages/datasheet.tsx +0 -198
- package/src/pages/datasheets.tsx +0 -148
- package/src/pages/dev-login.tsx +0 -68
- package/src/pages/editor.tsx +0 -54
- package/src/pages/landing.tsx +0 -237
- package/src/pages/latest.tsx +0 -145
- package/src/pages/my-orders.tsx +0 -54
- package/src/pages/organization-profile.tsx +0 -197
- package/src/pages/organization-settings.tsx +0 -571
- package/src/pages/package-editor.tsx +0 -60
- package/src/pages/preview-release.tsx +0 -209
- package/src/pages/quickstart.tsx +0 -258
- package/src/pages/release-builds.tsx +0 -99
- package/src/pages/release-detail.tsx +0 -211
- package/src/pages/releases.tsx +0 -55
- package/src/pages/search.tsx +0 -288
- package/src/pages/settings-redirect.tsx +0 -44
- package/src/pages/trending.tsx +0 -201
- package/src/pages/user-profile.tsx +0 -330
- package/src/pages/user-settings.tsx +0 -161
- package/src/pages/view-package.tsx +0 -90
- package/src/types/package.ts +0 -4
- package/src/vite-env.d.ts +0 -1
- package/tailwind.config.js +0 -47
- package/tsconfig.json +0 -30
- package/vercel.json +0 -50
- package/vite.config.ts +0 -236
- package/winterspec.config.ts +0 -6
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import * as ZT from "fake-snippets-api/lib/db/schema"
|
|
2
|
-
|
|
3
|
-
export const publicMapPackageBuild = (
|
|
4
|
-
internalPackageBuild: ZT.PackageBuild,
|
|
5
|
-
options: {
|
|
6
|
-
include_logs?: boolean
|
|
7
|
-
} = {
|
|
8
|
-
include_logs: false,
|
|
9
|
-
},
|
|
10
|
-
): ZT.PackageBuild => {
|
|
11
|
-
const result = {
|
|
12
|
-
...internalPackageBuild,
|
|
13
|
-
created_at: internalPackageBuild.created_at,
|
|
14
|
-
transpilation_started_at: internalPackageBuild.transpilation_started_at,
|
|
15
|
-
transpilation_completed_at: internalPackageBuild.transpilation_completed_at,
|
|
16
|
-
transpilation_logs: options.include_logs
|
|
17
|
-
? internalPackageBuild.transpilation_logs
|
|
18
|
-
: [],
|
|
19
|
-
transpilation_error: internalPackageBuild.transpilation_error,
|
|
20
|
-
circuit_json_build_started_at:
|
|
21
|
-
internalPackageBuild.circuit_json_build_started_at,
|
|
22
|
-
circuit_json_build_completed_at:
|
|
23
|
-
internalPackageBuild.circuit_json_build_completed_at,
|
|
24
|
-
circuit_json_build_logs: options.include_logs
|
|
25
|
-
? internalPackageBuild.circuit_json_build_logs
|
|
26
|
-
: [],
|
|
27
|
-
circuit_json_build_error: internalPackageBuild.circuit_json_build_error,
|
|
28
|
-
image_generation_in_progress:
|
|
29
|
-
internalPackageBuild.image_generation_in_progress,
|
|
30
|
-
image_generation_started_at:
|
|
31
|
-
internalPackageBuild.image_generation_started_at,
|
|
32
|
-
image_generation_completed_at:
|
|
33
|
-
internalPackageBuild.image_generation_completed_at,
|
|
34
|
-
image_generation_logs: options.include_logs
|
|
35
|
-
? internalPackageBuild.image_generation_logs
|
|
36
|
-
: [],
|
|
37
|
-
image_generation_error: internalPackageBuild.image_generation_error,
|
|
38
|
-
build_started_at: internalPackageBuild.build_started_at,
|
|
39
|
-
build_completed_at: internalPackageBuild.build_completed_at,
|
|
40
|
-
build_error: internalPackageBuild.build_error,
|
|
41
|
-
build_error_last_updated_at:
|
|
42
|
-
internalPackageBuild.build_error_last_updated_at,
|
|
43
|
-
preview_url: internalPackageBuild.preview_url,
|
|
44
|
-
build_logs: options.include_logs ? internalPackageBuild.build_logs : null,
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return result
|
|
48
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import * as ZT from "fake-snippets-api/lib/db/schema"
|
|
2
|
-
import type { DbClient } from "fake-snippets-api/lib/db/db-client"
|
|
3
|
-
|
|
4
|
-
export const publicMapPackageRelease = (
|
|
5
|
-
internal_package_release: ZT.PackageRelease,
|
|
6
|
-
options: {
|
|
7
|
-
include_logs?: boolean
|
|
8
|
-
include_ai_review?: boolean
|
|
9
|
-
db?: DbClient
|
|
10
|
-
} = {
|
|
11
|
-
include_logs: false,
|
|
12
|
-
include_ai_review: false,
|
|
13
|
-
},
|
|
14
|
-
): ZT.PackageRelease => {
|
|
15
|
-
const result = {
|
|
16
|
-
...internal_package_release,
|
|
17
|
-
created_at: internal_package_release.created_at,
|
|
18
|
-
circuit_json_build_error_last_updated_at:
|
|
19
|
-
internal_package_release.circuit_json_build_error_last_updated_at,
|
|
20
|
-
circuit_json_build_error: internal_package_release.circuit_json_build_error,
|
|
21
|
-
transpilation_logs: options.include_logs
|
|
22
|
-
? internal_package_release.transpilation_logs
|
|
23
|
-
: [],
|
|
24
|
-
circuit_json_build_logs: options.include_logs
|
|
25
|
-
? internal_package_release.circuit_json_build_logs
|
|
26
|
-
: [],
|
|
27
|
-
image_generation_logs: options.include_logs
|
|
28
|
-
? internal_package_release.image_generation_logs
|
|
29
|
-
: null,
|
|
30
|
-
image_generation_in_progress:
|
|
31
|
-
internal_package_release.image_generation_in_progress,
|
|
32
|
-
image_generation_started_at:
|
|
33
|
-
internal_package_release.image_generation_started_at ?? null,
|
|
34
|
-
image_generation_completed_at:
|
|
35
|
-
internal_package_release.image_generation_completed_at ?? null,
|
|
36
|
-
image_generation_is_stale:
|
|
37
|
-
internal_package_release.image_generation_is_stale,
|
|
38
|
-
image_generation_error:
|
|
39
|
-
internal_package_release.image_generation_error ?? null,
|
|
40
|
-
image_generation_error_last_updated_at:
|
|
41
|
-
internal_package_release.image_generation_error_last_updated_at ?? null,
|
|
42
|
-
image_generation_display_status:
|
|
43
|
-
internal_package_release.image_generation_display_status,
|
|
44
|
-
is_pr_preview: Boolean(internal_package_release.is_pr_preview),
|
|
45
|
-
github_pr_number: internal_package_release.github_pr_number,
|
|
46
|
-
branch_name: internal_package_release.branch_name,
|
|
47
|
-
commit_message: internal_package_release.commit_message ?? null,
|
|
48
|
-
commit_author: internal_package_release.commit_author ?? null,
|
|
49
|
-
pcb_preview_image_url:
|
|
50
|
-
internal_package_release.pcb_preview_image_url ?? null,
|
|
51
|
-
sch_preview_image_url:
|
|
52
|
-
internal_package_release.sch_preview_image_url ?? null,
|
|
53
|
-
cad_preview_image_url:
|
|
54
|
-
internal_package_release.cad_preview_image_url ?? null,
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (options.include_ai_review && options.db) {
|
|
58
|
-
const reviews = options.db
|
|
59
|
-
.listAiReviews()
|
|
60
|
-
.filter(
|
|
61
|
-
(r) =>
|
|
62
|
-
r.package_release_id === internal_package_release.package_release_id,
|
|
63
|
-
)
|
|
64
|
-
.sort(
|
|
65
|
-
(a, b) =>
|
|
66
|
-
new Date(b.created_at).getTime() - new Date(a.created_at).getTime(),
|
|
67
|
-
)
|
|
68
|
-
|
|
69
|
-
if (reviews.length > 0) {
|
|
70
|
-
const latest = reviews[0]
|
|
71
|
-
result.ai_review_text = latest.ai_review_text ?? null
|
|
72
|
-
result.ai_review_started_at = latest.start_processing_at ?? null
|
|
73
|
-
result.ai_review_completed_at = latest.finished_processing_at ?? null
|
|
74
|
-
result.ai_review_error = latest.processing_error ?? null
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// Only include AI review fields when include_ai_review is true
|
|
79
|
-
if (!options.include_ai_review) {
|
|
80
|
-
delete result.ai_review_text
|
|
81
|
-
delete result.ai_review_started_at
|
|
82
|
-
delete result.ai_review_completed_at
|
|
83
|
-
delete result.ai_review_error
|
|
84
|
-
delete result.ai_review_logs
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return result
|
|
88
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import type * as zt from "fake-snippets-api/lib/db/schema"
|
|
2
|
-
|
|
3
|
-
export const publicMapPackage = (internalPackage: {
|
|
4
|
-
package_id: string
|
|
5
|
-
creator_account_id: string
|
|
6
|
-
owner_org_id: string
|
|
7
|
-
owner_github_username: string | null
|
|
8
|
-
is_source_from_github: boolean
|
|
9
|
-
description: string | null
|
|
10
|
-
latest_version?: string | null
|
|
11
|
-
latest_license?: string | null
|
|
12
|
-
latest_package_release_id?: string | null
|
|
13
|
-
star_count?: number | null
|
|
14
|
-
name: string
|
|
15
|
-
website: string | null
|
|
16
|
-
unscoped_name: string
|
|
17
|
-
updated_at: string
|
|
18
|
-
created_at: string
|
|
19
|
-
ai_description: string | null
|
|
20
|
-
ai_usage_instructions: string | null
|
|
21
|
-
is_snippet: boolean
|
|
22
|
-
is_board: boolean
|
|
23
|
-
is_package: boolean
|
|
24
|
-
is_model: boolean
|
|
25
|
-
is_footprint: boolean
|
|
26
|
-
is_private: boolean | null
|
|
27
|
-
is_unlisted: boolean | null
|
|
28
|
-
latest_package_release_fs_sha: string | null
|
|
29
|
-
github_repo_full_name?: string | null
|
|
30
|
-
allow_pr_previews?: boolean
|
|
31
|
-
latest_pcb_preview_image_url?: string | null
|
|
32
|
-
latest_sch_preview_image_url?: string | null
|
|
33
|
-
latest_cad_preview_image_url?: string | null
|
|
34
|
-
}): zt.Package => {
|
|
35
|
-
return {
|
|
36
|
-
...internalPackage,
|
|
37
|
-
latest_package_release_id:
|
|
38
|
-
internalPackage.latest_package_release_id ?? null,
|
|
39
|
-
latest_version: internalPackage.latest_version ?? null,
|
|
40
|
-
license: internalPackage.latest_license ?? null,
|
|
41
|
-
website: internalPackage.website ?? null,
|
|
42
|
-
star_count: internalPackage.star_count ?? 0,
|
|
43
|
-
created_at: internalPackage.created_at,
|
|
44
|
-
updated_at: internalPackage.updated_at,
|
|
45
|
-
github_repo_full_name: internalPackage.github_repo_full_name ?? null,
|
|
46
|
-
is_private: internalPackage.is_private ?? false,
|
|
47
|
-
is_public: internalPackage.is_private === true ? false : true,
|
|
48
|
-
is_unlisted:
|
|
49
|
-
internalPackage.is_private === true
|
|
50
|
-
? true
|
|
51
|
-
: (internalPackage.is_unlisted ?? false),
|
|
52
|
-
allow_pr_previews: Boolean(internalPackage.allow_pr_previews),
|
|
53
|
-
latest_pcb_preview_image_url:
|
|
54
|
-
internalPackage.latest_pcb_preview_image_url ?? null,
|
|
55
|
-
latest_sch_preview_image_url:
|
|
56
|
-
internalPackage.latest_sch_preview_image_url ?? null,
|
|
57
|
-
latest_cad_preview_image_url:
|
|
58
|
-
internalPackage.latest_cad_preview_image_url ?? null,
|
|
59
|
-
}
|
|
60
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./middleware/with-winter-spec"
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { withRouteSpec } from "fake-snippets-api/lib/middleware/with-winter-spec"
|
|
2
|
-
import { z } from "zod"
|
|
3
|
-
import { aiReviewSchema } from "fake-snippets-api/lib/db/schema"
|
|
4
|
-
|
|
5
|
-
export default withRouteSpec({
|
|
6
|
-
methods: ["POST"],
|
|
7
|
-
auth: "session",
|
|
8
|
-
jsonBody: z.object({
|
|
9
|
-
ai_review_id: z.string(),
|
|
10
|
-
}),
|
|
11
|
-
jsonResponse: z.object({
|
|
12
|
-
ai_review: aiReviewSchema,
|
|
13
|
-
}),
|
|
14
|
-
})(async (req, ctx) => {
|
|
15
|
-
const { ai_review_id } = req.jsonBody
|
|
16
|
-
const existing = ctx.db.getAiReviewById(ai_review_id)
|
|
17
|
-
if (!existing) {
|
|
18
|
-
return ctx.error(404, {
|
|
19
|
-
error_code: "ai_review_not_found",
|
|
20
|
-
message: "AI review not found",
|
|
21
|
-
})
|
|
22
|
-
}
|
|
23
|
-
const now = new Date().toISOString()
|
|
24
|
-
const updated = ctx.db.updateAiReview(ai_review_id, {
|
|
25
|
-
ai_review_text: "Placeholder AI Review",
|
|
26
|
-
start_processing_at: existing.start_processing_at ?? now,
|
|
27
|
-
finished_processing_at: now,
|
|
28
|
-
display_status: "completed",
|
|
29
|
-
})!
|
|
30
|
-
return ctx.json({ ai_review: updated })
|
|
31
|
-
})
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { datasheetSchema } from "fake-snippets-api/lib/db/schema"
|
|
2
|
-
import { withRouteSpec } from "fake-snippets-api/lib/middleware/with-winter-spec"
|
|
3
|
-
import { z } from "zod"
|
|
4
|
-
|
|
5
|
-
export const processAllDatasheets = (ctx: any) => {
|
|
6
|
-
const processed = [] as z.infer<typeof datasheetSchema>[]
|
|
7
|
-
ctx.db.datasheets.forEach((ds: any) => {
|
|
8
|
-
if (!ds.pin_information || !ds.datasheet_pdf_urls || !ds.ai_description) {
|
|
9
|
-
const updated = ctx.db.updateDatasheet(ds.datasheet_id, {
|
|
10
|
-
pin_information: [
|
|
11
|
-
{
|
|
12
|
-
pin_number: "1",
|
|
13
|
-
name: "PIN1",
|
|
14
|
-
description: "Placeholder pin",
|
|
15
|
-
capabilities: ["digital"],
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
datasheet_pdf_urls: ["https://example.com/datasheet.pdf"],
|
|
19
|
-
ai_description: "Placeholder ai description",
|
|
20
|
-
})
|
|
21
|
-
processed.push(updated!)
|
|
22
|
-
} else {
|
|
23
|
-
processed.push(ds)
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
return processed
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export default withRouteSpec({
|
|
30
|
-
methods: ["POST"],
|
|
31
|
-
auth: "none",
|
|
32
|
-
jsonResponse: z.object({
|
|
33
|
-
datasheets: datasheetSchema.array(),
|
|
34
|
-
}),
|
|
35
|
-
})(async (req, ctx) => {
|
|
36
|
-
const datasheets = processAllDatasheets(ctx)
|
|
37
|
-
return ctx.json({ datasheets })
|
|
38
|
-
})
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { withRouteSpec } from "fake-snippets-api/lib/middleware/with-winter-spec"
|
|
2
|
-
import { z } from "zod"
|
|
3
|
-
import { seed } from "fake-snippets-api/lib/db/seed"
|
|
4
|
-
|
|
5
|
-
export default withRouteSpec({
|
|
6
|
-
methods: ["GET"],
|
|
7
|
-
auth: "none",
|
|
8
|
-
jsonResponse: z.any(),
|
|
9
|
-
})(async (req, ctx) => {
|
|
10
|
-
return ctx.json(ctx.db.getState())
|
|
11
|
-
})
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { withRouteSpec } from "fake-snippets-api/lib/middleware/with-winter-spec"
|
|
2
|
-
import { z } from "zod"
|
|
3
|
-
import { orderSteps } from "fake-snippets-api/utils/order-steps"
|
|
4
|
-
|
|
5
|
-
export default withRouteSpec({
|
|
6
|
-
methods: ["GET"],
|
|
7
|
-
auth: "session",
|
|
8
|
-
jsonResponse: z.object({
|
|
9
|
-
success: z.boolean(),
|
|
10
|
-
}),
|
|
11
|
-
})(async (req, ctx) => {
|
|
12
|
-
// Get all orders that aren't finished
|
|
13
|
-
const orders = ctx.db.orders.filter((order) => !order.is_finished)
|
|
14
|
-
const updatedOrders = []
|
|
15
|
-
|
|
16
|
-
for (const order of orders) {
|
|
17
|
-
const orderState = ctx.db.getJlcpcbOrderStatesByOrderId(order.order_id)
|
|
18
|
-
if (!orderState) continue
|
|
19
|
-
|
|
20
|
-
// Find the next step to complete
|
|
21
|
-
let nextStepIndex = -1
|
|
22
|
-
for (let i = 0; i < orderSteps.length; i++) {
|
|
23
|
-
const step = orderSteps[i]
|
|
24
|
-
if (!orderState[step]) {
|
|
25
|
-
nextStepIndex = i
|
|
26
|
-
break
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// If all steps are completed or no next step found
|
|
31
|
-
if (nextStepIndex === -1) {
|
|
32
|
-
updatedOrders.push({
|
|
33
|
-
order_id: order.order_id,
|
|
34
|
-
current_step: null,
|
|
35
|
-
})
|
|
36
|
-
continue
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Update the next step to true
|
|
40
|
-
const nextStep = orderSteps[nextStepIndex]
|
|
41
|
-
const updates = {
|
|
42
|
-
[nextStep]: true,
|
|
43
|
-
current_step: nextStep,
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// If this is the last step, also update the order status
|
|
47
|
-
if (nextStepIndex === orderSteps.length - 1) {
|
|
48
|
-
ctx.db.updateOrder(order.order_id, {
|
|
49
|
-
is_finished: true,
|
|
50
|
-
completed_at: new Date().toISOString(),
|
|
51
|
-
})
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
ctx.db.updateJlcpcbOrderState(order.order_id, updates)
|
|
55
|
-
|
|
56
|
-
updatedOrders.push({
|
|
57
|
-
order_id: order.order_id,
|
|
58
|
-
current_step: nextStep,
|
|
59
|
-
})
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return ctx.json({
|
|
63
|
-
success: true,
|
|
64
|
-
})
|
|
65
|
-
})
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { withRouteSpec } from "fake-snippets-api/lib/middleware/with-winter-spec"
|
|
2
|
-
import { z } from "zod"
|
|
3
|
-
import { orderQuoteSchema } from "fake-snippets-api/lib/db/schema"
|
|
4
|
-
|
|
5
|
-
export default withRouteSpec({
|
|
6
|
-
methods: ["POST"],
|
|
7
|
-
auth: "session",
|
|
8
|
-
jsonBody: z.object({
|
|
9
|
-
order_quote_id: z.string(),
|
|
10
|
-
}),
|
|
11
|
-
jsonResponse: z.object({
|
|
12
|
-
order_quotes: orderQuoteSchema.array().optional(),
|
|
13
|
-
error: z.string().optional(),
|
|
14
|
-
}),
|
|
15
|
-
})(async (req, ctx) => {
|
|
16
|
-
const { order_quote_id } = req.jsonBody
|
|
17
|
-
|
|
18
|
-
return ctx.json({
|
|
19
|
-
order_quotes: [
|
|
20
|
-
{
|
|
21
|
-
order_quote_id,
|
|
22
|
-
account_id: "123",
|
|
23
|
-
package_release_id: "123",
|
|
24
|
-
is_completed: true,
|
|
25
|
-
is_processing: false,
|
|
26
|
-
vendor_name: "JLCPCB",
|
|
27
|
-
error: null,
|
|
28
|
-
has_error: false,
|
|
29
|
-
created_at: "2025-04-21",
|
|
30
|
-
updated_at: "2025-04-21",
|
|
31
|
-
completed_at: "2025-04-21",
|
|
32
|
-
quoted_components: [
|
|
33
|
-
{
|
|
34
|
-
manufacturer_part_number: "123",
|
|
35
|
-
supplier_part_number: "123",
|
|
36
|
-
quantity: 1,
|
|
37
|
-
unit_price: 100,
|
|
38
|
-
total_price: 100,
|
|
39
|
-
available: true,
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
manufacturer_part_number: "1234",
|
|
43
|
-
supplier_part_number: "1234",
|
|
44
|
-
quantity: 1,
|
|
45
|
-
unit_price: 200,
|
|
46
|
-
total_price: 200,
|
|
47
|
-
available: true,
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
bare_pcb_cost: 300,
|
|
51
|
-
shipping_options: [
|
|
52
|
-
{
|
|
53
|
-
carrier: "DHL",
|
|
54
|
-
service: "Express",
|
|
55
|
-
cost: 100,
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
carrier: "FedEx",
|
|
59
|
-
service: "Express",
|
|
60
|
-
cost: 200,
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
total_cost_without_shipping: 100,
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
order_quote_id,
|
|
67
|
-
account_id: "123",
|
|
68
|
-
package_release_id: "123",
|
|
69
|
-
is_completed: true,
|
|
70
|
-
is_processing: false,
|
|
71
|
-
vendor_name: "DKRed",
|
|
72
|
-
error: null,
|
|
73
|
-
has_error: false,
|
|
74
|
-
created_at: "2025-04-21",
|
|
75
|
-
updated_at: "2025-04-21",
|
|
76
|
-
completed_at: "2025-04-21",
|
|
77
|
-
quoted_components: [
|
|
78
|
-
{
|
|
79
|
-
manufacturer_part_number: "123",
|
|
80
|
-
supplier_part_number: "123",
|
|
81
|
-
quantity: 1,
|
|
82
|
-
unit_price: 100,
|
|
83
|
-
total_price: 100,
|
|
84
|
-
available: true,
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
manufacturer_part_number: "1234",
|
|
88
|
-
supplier_part_number: "1234",
|
|
89
|
-
quantity: 1,
|
|
90
|
-
unit_price: 200,
|
|
91
|
-
total_price: 200,
|
|
92
|
-
available: true,
|
|
93
|
-
},
|
|
94
|
-
],
|
|
95
|
-
bare_pcb_cost: 300,
|
|
96
|
-
shipping_options: [
|
|
97
|
-
{
|
|
98
|
-
carrier: "DHL",
|
|
99
|
-
service: "Express",
|
|
100
|
-
cost: 100,
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
carrier: "FedEx",
|
|
104
|
-
service: "Express",
|
|
105
|
-
cost: 200,
|
|
106
|
-
},
|
|
107
|
-
],
|
|
108
|
-
total_cost_without_shipping: 100,
|
|
109
|
-
},
|
|
110
|
-
],
|
|
111
|
-
})
|
|
112
|
-
})
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { withRouteSpec } from "fake-snippets-api/lib/middleware/with-winter-spec"
|
|
2
|
-
import { z } from "zod"
|
|
3
|
-
import { processAllDatasheets } from "./datasheets/process_all_datasheets"
|
|
4
|
-
|
|
5
|
-
export default withRouteSpec({
|
|
6
|
-
methods: ["GET"],
|
|
7
|
-
auth: "none",
|
|
8
|
-
jsonResponse: z.object({ ok: z.boolean() }),
|
|
9
|
-
})(async (req, ctx) => {
|
|
10
|
-
processAllDatasheets(ctx)
|
|
11
|
-
return ctx.json({ ok: true })
|
|
12
|
-
})
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { withRouteSpec } from "fake-snippets-api/lib/middleware/with-winter-spec"
|
|
2
|
-
import { z } from "zod"
|
|
3
|
-
import { seed } from "fake-snippets-api/lib/db/seed"
|
|
4
|
-
|
|
5
|
-
export default withRouteSpec({
|
|
6
|
-
methods: ["POST"],
|
|
7
|
-
auth: "none",
|
|
8
|
-
jsonResponse: z.object({ ok: z.boolean() }),
|
|
9
|
-
})(async (req, ctx) => {
|
|
10
|
-
seed(ctx.db)
|
|
11
|
-
|
|
12
|
-
return ctx.json({ ok: true })
|
|
13
|
-
})
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { withRouteSpec } from "fake-snippets-api/lib/middleware/with-winter-spec"
|
|
2
|
-
import { z } from "zod"
|
|
3
|
-
import { Account, accountSchema } from "fake-snippets-api/lib/db/schema"
|
|
4
|
-
|
|
5
|
-
export default withRouteSpec({
|
|
6
|
-
methods: ["GET", "POST"],
|
|
7
|
-
auth: "session",
|
|
8
|
-
jsonBody: z.object({
|
|
9
|
-
github_username: z.string(),
|
|
10
|
-
}),
|
|
11
|
-
jsonResponse: z.object({
|
|
12
|
-
account: accountSchema,
|
|
13
|
-
}),
|
|
14
|
-
})(async (req, ctx) => {
|
|
15
|
-
let account: Account | undefined
|
|
16
|
-
|
|
17
|
-
if (req.method === "POST") {
|
|
18
|
-
const { github_username } = req.jsonBody
|
|
19
|
-
account = ctx.db.accounts.find(
|
|
20
|
-
(acc: Account) =>
|
|
21
|
-
acc.github_username.toLowerCase() === github_username.toLowerCase(),
|
|
22
|
-
)
|
|
23
|
-
} else {
|
|
24
|
-
account = ctx.db.getAccount(ctx.auth.account_id)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (!account) {
|
|
28
|
-
return ctx.error(404, {
|
|
29
|
-
error_code: "account_not_found",
|
|
30
|
-
message: "Account not found",
|
|
31
|
-
})
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return ctx.json({ account })
|
|
35
|
-
})
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { withRouteSpec } from "fake-snippets-api/lib/middleware/with-winter-spec"
|
|
2
|
-
import { z } from "zod"
|
|
3
|
-
|
|
4
|
-
export default withRouteSpec({
|
|
5
|
-
methods: ["GET"],
|
|
6
|
-
auth: "session",
|
|
7
|
-
jsonResponse: z.object({
|
|
8
|
-
account_balance: z.object({
|
|
9
|
-
monthly_ai_budget_used_usd: z.number(),
|
|
10
|
-
}),
|
|
11
|
-
}),
|
|
12
|
-
})(async (req, ctx) => {
|
|
13
|
-
// For this example, we'll return a mock balance
|
|
14
|
-
// In a real implementation, you would fetch this from a database or external service
|
|
15
|
-
const mockBalance = {
|
|
16
|
-
monthly_ai_budget_used_usd: 2.5,
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return ctx.json({
|
|
20
|
-
account_balance: mockBalance,
|
|
21
|
-
})
|
|
22
|
-
})
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { withRouteSpec } from "fake-snippets-api/lib/middleware/with-winter-spec"
|
|
2
|
-
import { z } from "zod"
|
|
3
|
-
import { accountSchema } from "fake-snippets-api/lib/db/schema"
|
|
4
|
-
|
|
5
|
-
export default withRouteSpec({
|
|
6
|
-
methods: ["POST"],
|
|
7
|
-
auth: "session",
|
|
8
|
-
jsonBody: z.object({
|
|
9
|
-
query: z.string(),
|
|
10
|
-
limit: z.number().optional().default(50),
|
|
11
|
-
}),
|
|
12
|
-
jsonResponse: z.object({
|
|
13
|
-
ok: z.boolean(),
|
|
14
|
-
accounts: z.array(accountSchema),
|
|
15
|
-
}),
|
|
16
|
-
})(async (req, ctx) => {
|
|
17
|
-
const { query, limit } = req.jsonBody
|
|
18
|
-
const accounts = ctx.db.searchAccounts(query, limit)
|
|
19
|
-
return ctx.json({ accounts, ok: true })
|
|
20
|
-
})
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { withRouteSpec } from "fake-snippets-api/lib/middleware/with-winter-spec"
|
|
2
|
-
import { z } from "zod"
|
|
3
|
-
import {
|
|
4
|
-
accountSchema,
|
|
5
|
-
shippingInfoSchema,
|
|
6
|
-
} from "fake-snippets-api/lib/db/schema"
|
|
7
|
-
|
|
8
|
-
export default withRouteSpec({
|
|
9
|
-
methods: ["POST"],
|
|
10
|
-
auth: "session",
|
|
11
|
-
jsonBody: z.object({
|
|
12
|
-
shippingInfo: shippingInfoSchema,
|
|
13
|
-
}),
|
|
14
|
-
jsonResponse: z.object({
|
|
15
|
-
account: accountSchema,
|
|
16
|
-
}),
|
|
17
|
-
})(async (req, ctx) => {
|
|
18
|
-
const { shippingInfo } = req.jsonBody
|
|
19
|
-
|
|
20
|
-
const updatedAccount = ctx.db.updateAccount(ctx.auth.account_id, {
|
|
21
|
-
shippingInfo,
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
if (!updatedAccount) {
|
|
25
|
-
return ctx.error(404, {
|
|
26
|
-
error_code: "account_not_found",
|
|
27
|
-
message: "Account not found",
|
|
28
|
-
})
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return ctx.json({ account: updatedAccount })
|
|
32
|
-
})
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Forward request to anthropic
|
|
3
|
-
*/
|
|
4
|
-
export default async (req: Request) => {
|
|
5
|
-
const url = new URL(req.url)
|
|
6
|
-
const anthropicApiKey = process.env.ANTHROPIC_API_KEY
|
|
7
|
-
|
|
8
|
-
if (!anthropicApiKey) {
|
|
9
|
-
return new Response("Anthropic API key is not set", { status: 500 })
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const anthropicUrl =
|
|
13
|
-
"https://api.anthropic.com" + url.pathname.replace(/^\/api\/ai/, "")
|
|
14
|
-
|
|
15
|
-
const headers = new Headers(req.headers)
|
|
16
|
-
headers.set("x-api-key", `${anthropicApiKey}`)
|
|
17
|
-
|
|
18
|
-
console.log("sending request to anthropic")
|
|
19
|
-
const response = await fetch(anthropicUrl, {
|
|
20
|
-
method: req.method,
|
|
21
|
-
headers: headers,
|
|
22
|
-
body: req.body,
|
|
23
|
-
// @ts-ignore
|
|
24
|
-
duplex: "half",
|
|
25
|
-
}).then((r) => r.json())
|
|
26
|
-
|
|
27
|
-
return new Response(JSON.stringify(response), {
|
|
28
|
-
status: 200,
|
|
29
|
-
headers: { "Content-Type": "application/json" },
|
|
30
|
-
})
|
|
31
|
-
}
|