-
Notifications
You must be signed in to change notification settings - Fork 16
docs: add sandbox and ensv2readiness #2103
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
39 commits
Select commit
Hold shift + click to select a range
d391047
add sandbox and ensv2readiness
sevenzing 787609b
temp remove quickstart from llmtext
sevenzing f01ce76
create static graphql examples
sevenzing 0e9b76e
revert quickstart and ensv2 readiness changes
sevenzing 894b9b6
Merge branch 'main' into ll/docs-query-sandbox
sevenzing ab9e0de
playgroud examples
sevenzing 394dd38
rename cookbook to examples
sevenzing 58cef6a
Merge branch 'main' into ll/docs-query-sandbox
sevenzing 28b1a51
add description to examples
sevenzing 4f9ec7c
add interactive enssdk example
sevenzing 8335ddf
add enskit interactive example
sevenzing b867a9c
remove title from code example
sevenzing 0b720c5
add sidebar docked
sevenzing 6d29219
add schema reference
sevenzing 239109f
use @ import instead of ..
sevenzing e4045e4
add cleanup
sevenzing 15959fc
Merge branch 'main' into ll/docs-query-sandbox
sevenzing 5dceafa
fix AI comments
sevenzing 9e7be1a
fix production bug
sevenzing 85825e1
replace rocket with zap
sevenzing 9c47174
update interactive example descriptions
sevenzing 8b5dca6
Merge branch 'main' into ll/docs-query-sandbox
sevenzing 4f30016
fix wrong git merge
sevenzing 42def48
Merge branch 'main' into ll/docs-query-sandbox
sevenzing 2ed324c
Update examples export to be published to NPM
tk-o e6413bb
Fix import paths
tk-o 100fda5
Add specific package entrypoint for gql examples
tk-o 6239a61
Update GQL examples
tk-o 410e6ff
revert examples to use previous data model version
tk-o d5ce33d
publish the internal module for ENSNode SDK package
tk-o f2f7ac2
Pin package version to make GQL examples work with the current produc…
tk-o 8fb2f07
fix example start
sevenzing 9c223af
final fixes
sevenzing ea80606
Merge branch 'main' into ll/docs-query-sandbox
sevenzing 821e2f3
Merge remote-tracking branch 'origin/fix-sha-89c022b' into ll/docs-qu…
sevenzing 97d434f
fix final
sevenzing 98c57d2
revert deleting why ensnode
sevenzing 348661b
super final fixes after self review. always self review before merge!…
sevenzing 922e358
final fixes
sevenzing 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
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
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
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
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
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,20 @@ | ||
| import starlightLlmsTxt from "starlight-llms-txt"; | ||
|
|
||
| /** | ||
| * `starlight-llms-txt` renders each docs entry for `/llms-full.txt` and `/llms-small.txt` through | ||
| * an Astro container that only registers the MDX SSR renderer, not React. MDX pages that import | ||
| * `.tsx` islands must be omitted from those exports or `astro build` fails with `NoMatchingRenderer`. | ||
| * | ||
| * Patterns use micromatch against each entry's `id` in the Starlight `docs` collection (paths are | ||
| * relative to `src/content/docs/`). | ||
| * | ||
| * The Interactive example imports a React playground and cannot be rendered by `starlight-llms-txt`. | ||
| * The Schema Reference imports a React playground and cannot be rendered by `starlight-llms-txt`. | ||
| */ | ||
| export const starlightLlmsTxtPlugin = starlightLlmsTxt({ | ||
| exclude: [ | ||
| "docs/integrate/integration-options/enssdk/example", | ||
| "docs/integrate/integration-options/enskit/example", | ||
| "docs/integrate/omnigraph/schema-reference", | ||
| ], | ||
| }); |
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
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
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
97 changes: 97 additions & 0 deletions
97
docs/ensnode.io/scripts/fetch-omnigraph-example-responses.mts
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,97 @@ | ||
| import { existsSync, readFileSync, writeFileSync } from "node:fs"; | ||
| import { dirname, join } from "node:path"; | ||
| import { fileURLToPath } from "node:url"; | ||
|
|
||
| import { getNamespaceSpecificValue } from "@ensnode/ensnode-sdk"; | ||
| import { getGraphqlApiExampleQueryById } from "@ensnode/ensnode-sdk/internal"; | ||
|
|
||
| import { OMNIGRAPH_EXAMPLES_META } from "../src/data/omnigraph-examples/meta.ts"; | ||
| import { DOCS_OMNIGRAPH_NAMESPACE, ENSNODE_URL } from "../src/lib/playground/constants.ts"; | ||
|
|
||
| function logStep(message: string, id?: string) { | ||
| console.log(`[omnigraph-examples] ${message} ${id ? `for '${id}'` : ""}`); | ||
| } | ||
|
|
||
| function logError(message: string, id?: string) { | ||
| console.error(`[omnigraph-examples] ERROR: ${message} ${id ? `for example '${id}'` : ""}`); | ||
| } | ||
|
|
||
| const allExampleIds = (Object.keys(OMNIGRAPH_EXAMPLES_META) as string[]).sort(); | ||
|
|
||
| const outputPath = join( | ||
| dirname(fileURLToPath(import.meta.url)), | ||
| "../src/data/omnigraph-examples/responses.json", | ||
| ); | ||
|
|
||
| // Optional filter: `pnpm omnigraph-examples:refresh-responses <id>,<id>` | ||
| const argIds = | ||
| process.argv[2] | ||
| ?.split(",") | ||
| .map((s) => s.trim()) | ||
| .filter(Boolean) ?? []; | ||
|
|
||
| if (argIds.length > 0) { | ||
| const unknown = argIds.filter((id) => !allExampleIds.includes(id)); | ||
| if (unknown.length > 0) { | ||
| logError(`Unknown example ID(s): ${unknown.join(", ")}. Known: ${allExampleIds.join(", ")}`); | ||
| process.exit(1); | ||
| } | ||
| } | ||
|
|
||
| const exampleIds = argIds.length > 0 ? argIds : allExampleIds; | ||
|
|
||
| const base = ENSNODE_URL.replace(/\/+$/, ""); | ||
| const url = `${base}/api/omnigraph`; | ||
|
|
||
| logStep( | ||
| argIds.length > 0 | ||
| ? `Refreshing ${exampleIds.length} of ${allExampleIds.length} examples from ${url}: ${exampleIds.join(", ")}` | ||
| : `Fetching all ${exampleIds.length} Omnigraph examples from ${url}`, | ||
| ); | ||
|
|
||
| // When refreshing a subset, load the existing responses so unaffected entries are preserved. | ||
| const out: Record<string, unknown> = | ||
| argIds.length > 0 && existsSync(outputPath) | ||
| ? (JSON.parse(readFileSync(outputPath, "utf8")) as Record<string, unknown>) | ||
| : {}; | ||
|
sevenzing marked this conversation as resolved.
|
||
|
|
||
| for (const id of exampleIds) { | ||
| logStep("Getting example query", id); | ||
|
|
||
| const example = getGraphqlApiExampleQueryById(id); | ||
| const query = example.query.trim(); | ||
| const variables = getNamespaceSpecificValue(DOCS_OMNIGRAPH_NAMESPACE, example.variables); | ||
|
|
||
| const response = await fetch(url, { | ||
| method: "POST", | ||
| headers: { "Content-Type": "application/json" }, | ||
| body: JSON.stringify({ query, variables }), | ||
| signal: AbortSignal.timeout(120_000), | ||
| }); | ||
|
|
||
| if (!response.ok) { | ||
| const text = await response.text(); | ||
| logError(`HTTP ${response.status}. Body (first 800 chars):\n${text.slice(0, 800)}`, id); | ||
| process.exit(1); | ||
| } | ||
|
sevenzing marked this conversation as resolved.
|
||
|
|
||
| const body = await response.json(); | ||
|
|
||
| if ( | ||
| typeof body === "object" && | ||
| body !== null && | ||
| "errors" in body && | ||
| Array.isArray((body as { errors: unknown }).errors) && | ||
| (body as { errors: unknown[] }).errors.length > 0 | ||
| ) { | ||
| logError(`GraphQL errors: ${JSON.stringify(body, null, 2)}`, id); | ||
| process.exit(1); | ||
| } | ||
|
|
||
| out[id] = body; | ||
| logStep("Success", id); | ||
| } | ||
|
|
||
| logStep(`Writing responses to ${outputPath}`); | ||
| writeFileSync(outputPath, `${JSON.stringify(out, null, 2)}\n`, "utf8"); | ||
| logStep("Done."); | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.