forked from stripe/sync-engine
-
Notifications
You must be signed in to change notification settings - Fork 13
Extract metadata table and add schema editor preview #142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
76258bb
Port PR #142: schema visualizer + explorer scripts onto v2
tonyxiao 7d891c9
Rename visualizer package to @stripe/sync-visualizer
tonyxiao bd81830
Fix consistency issues in visualizer + explorer scripts
tonyxiao eaa7bd4
Replace Docker pipeline with OpenAPI-driven schema generator
tonyxiao b41869a
Generate Stripe schema in-browser from OpenAPI spec
tonyxiao 1b68b6b
Fix pnpm-lock.yaml: restore v2 lockfile, add apps/visualizer dep entry
tonyxiao 3d566ca
Update pnpm-lock.yaml with apps/visualizer dependencies
tonyxiao 7ae4eab
Add browser subpath export to source-stripe; fix Next.js webpack error
tonyxiao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| .vercel | ||
| .next | ||
| .env*.local | ||
| tsconfig.tsbuildinfo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # Stripe Schema Visualizer | ||
|
|
||
| This package contains the standalone browser UI for exploring generated Stripe schema data with PGlite. | ||
|
|
||
| The visualizer has two parts: | ||
|
|
||
| - `pnpm explorer:build` generates static artifacts. | ||
| - `apps/visualizer` loads those artifacts into PGlite and lets you run SQL in the browser. | ||
|
|
||
| ## Generated artifacts | ||
|
|
||
| - `apps/visualizer/public/explorer-data/bootstrap.sql` | ||
| - `apps/visualizer/public/explorer-data/manifest.json` | ||
|
|
||
| These files are generated and should stay out of version control. | ||
|
|
||
| ## Common commands | ||
|
|
||
| ```bash | ||
| pnpm explorer:build | ||
| pnpm visualizer | ||
| pnpm visualizer:with-data | ||
| ``` | ||
|
|
||
| `pnpm visualizer:with-data` rebuilds the explorer data and then starts the visualizer app. | ||
|
|
||
| ## How the app loads data | ||
|
|
||
| At runtime, the app loads `manifest.json` first and then hydrates PGlite from `bootstrap.sql`. | ||
| After hydration, all SQL runs locally in the browser against the generated Stripe schema. | ||
|
|
||
| ## Direct phase debugging | ||
|
|
||
| `pnpm explorer:build` is the normal command, but the underlying phase scripts still exist for debugging: | ||
|
|
||
| ```bash | ||
| bun run scripts/explorer-harness.ts start | ||
| bun run scripts/explorer-migrate.ts --api-version=2020-08-27 | ||
| bun run scripts/explorer-seed.ts --api-version=2020-08-27 --seed=42 | ||
| bun run scripts/explorer-export.ts | ||
| bun run scripts/explorer-harness.ts stop | ||
| ``` | ||
|
|
||
| ## Notes | ||
|
|
||
| - SQL bootstrap is preferred for speed and consistency. | ||
| - The build pipeline recreates the artifacts from scratch on each run. | ||
| - The deploy/install dashboard stays in `packages/dashboard`; this package only contains the schema visualizer UI. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| /// <reference types="next" /> | ||
| /// <reference types="next/image-types/global" /> | ||
| /// <reference path="./.next/types/routes.d.ts" /> | ||
|
|
||
| // NOTE: This file should not be edited | ||
| // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import type { NextConfig } from 'next' | ||
|
|
||
| const nextConfig: NextConfig = { | ||
| typescript: { | ||
| ignoreBuildErrors: false, | ||
| }, | ||
| webpack: (config) => { | ||
| config.experiments = { | ||
| ...config.experiments, | ||
| asyncWebAssembly: true, | ||
| } | ||
|
|
||
| config.module.rules.push({ | ||
| test: /\.wasm$/, | ||
| type: 'asset/resource', | ||
| }) | ||
|
|
||
| return config | ||
| }, | ||
| async headers() { | ||
| return [ | ||
| { | ||
| source: '/(.*)', | ||
| headers: [ | ||
| { | ||
| key: 'Cross-Origin-Embedder-Policy', | ||
| value: 'require-corp', | ||
| }, | ||
| { | ||
| key: 'Cross-Origin-Opener-Policy', | ||
| value: 'same-origin', | ||
| }, | ||
| ], | ||
| }, | ||
| ] | ||
| }, | ||
| } | ||
|
|
||
| export default nextConfig |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| { | ||
| "name": "@stripe/sync-visualizer", | ||
| "version": "0.0.1", | ||
| "private": true, | ||
| "scripts": { | ||
| "dev": "next dev", | ||
| "build": "next build", | ||
| "start": "next start", | ||
| "lint": "next lint" | ||
| }, | ||
| "dependencies": { | ||
| "@stripe/sync-source-stripe": "workspace:*", | ||
| "@codemirror/lang-sql": "^6.7.0", | ||
| "@codemirror/state": "^6.4.0", | ||
| "@codemirror/view": "^6.26.0", | ||
| "@electric-sql/pglite": "^0.2.0", | ||
| "codemirror": "^6.0.1", | ||
| "next": "^15", | ||
| "react": "^19", | ||
| "react-dom": "^19" | ||
| }, | ||
| "devDependencies": { | ||
| "@tailwindcss/postcss": "^4.2.1", | ||
| "@types/node": "^22", | ||
| "@types/react": "^19", | ||
| "@types/react-dom": "^19", | ||
| "autoprefixer": "^10.4.27", | ||
| "postcss": "^8.5.8", | ||
| "tailwindcss": "^4.2.1", | ||
| "typescript": "^5" | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| const config = { | ||
| plugins: { | ||
| '@tailwindcss/postcss': {}, | ||
| }, | ||
| } | ||
|
|
||
| export default config |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we should call it
@stripe/schema-visualizer