Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ http {
rewrite ^/docs/([a-zA-Z][a-zA-Z])/tap/$ $scheme://$http_host/docs/$1/indexing/tap/ permanent;
rewrite ^/docs/([a-zA-Z][a-zA-Z])/tokenomics/$ $scheme://$http_host/docs/$1/resources/tokenomics/ permanent;
rewrite ^/docs/([a-zA-Z][a-zA-Z])/token-api/$ $scheme://$http_host/docs/$1/token-api/quick-start/ permanent;
rewrite ^/docs/([a-zA-Z][a-zA-Z])/token-api/evm/get-transfers-evm-by-address/$ $scheme://$http_host/docs/$1/token-api/evm/get-transfers-evm/ permanent;
rewrite ^/docs/([a-zA-Z][a-zA-Z])/token-api/mcp/cline/$ $scheme://$http_host/docs/$1/ai-suite/token-api-mcp/ permanent;
rewrite ^/docs/([a-zA-Z][a-zA-Z])/token-api/mcp/cline/$ $scheme://$http_host/docs/$1/ai-suite/token-api-mcp/ permanent;
rewrite ^/docs/([a-zA-Z][a-zA-Z])/token-api/mcp/cline/$ $scheme://$http_host/docs/$1/ai-suite/token-api-mcp/ permanent;
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "graph-docs",
"private": true,
"version": "1.0.0",
"packageManager": "[email protected].0",
"packageManager": "[email protected].3",
"scripts": {
"dev": "turbo run dev",
"build": "NODE_OPTIONS='--max-old-space-size=8192' turbo run build",
Expand All @@ -21,11 +21,11 @@
},
"devDependencies": {
"@edgeandnode/eslint-config": "^2.0.3",
"@types/node": "^22.18.8",
"@types/node": "^22.18.10",
"eslint": "^8.57.1",
"eslint-plugin-mdx": "^3.6.2",
"prettier": "^3.6.2",
"prettier-plugin-tailwindcss": "^0.6.14",
"prettier-plugin-tailwindcss": "^0.7.0",
"remark-frontmatter": "^5.0.0",
"remark-lint-first-heading-level": "^4.0.1",
"remark-lint-heading-increment": "^4.0.1",
Expand Down
6 changes: 3 additions & 3 deletions packages/og-image/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
"yoga-wasm-web": "^0.3.3"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20251001.0",
"@types/react": "^18.3.25",
"@cloudflare/workers-types": "^4.20251011.0",
"@types/react": "^18.3.26",
"jest-image-snapshot": "^6.5.1",
"tsx": "4.20.4",
"typescript": "^5.9.3",
"vitest": "^2.1.9",
"wrangler": "^3.114.14"
"wrangler": "^3.114.15"
},
"sideEffects": false
}
3,362 changes: 1,678 additions & 1,684 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"dependencies": {
"@docsearch/react": "^3.9.0",
"@edgeandnode/common": "^7.0.4",
"@edgeandnode/gds": "^6.7.4",
"@edgeandnode/go": "^10.3.8",
"@edgeandnode/gds": "^6.7.6",
"@edgeandnode/go": "^10.3.10",
"@emotion/react": "^11.14.0",
"@graphprotocol/contracts": "^7.3.0",
"@pinax/graph-networks-registry": "^0.7.1",
Expand All @@ -33,8 +33,8 @@
"lodash": "^4.17.21",
"mdast-util-mdx-jsx": "^3.2.0",
"mdast-util-to-hast": "^13.2.0",
"mixpanel-browser": "^2.70.0",
"motion": "^12.23.22",
"mixpanel-browser": "^2.71.0",
"motion": "^12.23.24",
"next": "^14.2.33",
"next-seo": "^6.8.0",
"next-sitemap": "^4.2.3",
Expand All @@ -55,12 +55,12 @@
"@types/lodash": "^4.17.20",
"@types/mdast": "^4.0.4",
"@types/mixpanel-browser": "^2.66.0",
"@types/node": "^22.18.8",
"@types/react": "^18.3.25",
"@types/node": "^22.18.10",
"@types/react": "^18.3.26",
"@types/react-dom": "^18.3.7",
"@types/vfile": "^4.0.0",
"autoprefixer": "^10.4.21",
"fast-xml-parser": "^5.2.5",
"fast-xml-parser": "^5.3.0",
"postcss": "^8.5.6",
"tailwindcss": "^3.4.18",
"tsup": "^8.5.0",
Expand Down
62 changes: 48 additions & 14 deletions website/src/openApi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,53 @@ import tokenApi from './tokenApi.json'

export const API_IDS = ['tokenApi'] as const

export const APIS = {
export const APIS: Record<ApiId, ApiConfig> = {
tokenApi: {
name: 'Token API',
url: 'https://token-api.thegraph.com/openapi', // production
// url: 'https://token-api.service.stage.pinax.network/openapi', // staging
document: tokenApi as OpenAPIV3_1.Document,
sections: {
EVM: '/token-api/evm',
SVM: '/token-api/svm',
Monitoring: '/token-api/monitoring',
'EVM Tokens': {
path: '/token-api/evm-tokens',
operationIdPrefixes: ['getV1Evm'],
},
'EVM DEXs': {
path: '/token-api/evm-dexs',
operationIdPrefixes: ['getV1Evm'],
},
'EVM NFTs': {
path: '/token-api/evm-nfts',
operationIdPrefixes: ['getV1EvmNft'],
},
'SVM Tokens': {
path: '/token-api/svm-tokens',
operationIdPrefixes: ['getV1Svm'],
},
'SVM DEXs': {
path: '/token-api/svm-dexs',
operationIdPrefixes: ['getV1Svm'],
},
Monitoring: {
path: '/token-api/monitoring',
operationIdPrefixes: ['getV1'],
},
},
},
} satisfies Record<ApiId, ApiConfig>
}

export type ApiId = (typeof API_IDS)[number]

export type ApiConfig = {
name: string
url: string
document: OpenAPIV3_1.Document
sections: Record<string, string>
sections: Record<string, ApiSectionConfig>
}

export type ApiSectionConfig = {
path: string
operationIdPrefixes?: string[]
}

export type ApiSection = {
Expand Down Expand Up @@ -116,17 +142,16 @@ export function getApi(apiId: ApiId, passedDocument?: OpenAPIV3_1.Document): Api
if (typeof documentOperation !== 'object' || !('tags' in documentOperation) || !documentOperation.tags) continue

// Get the section name and path from the tags
const sectionName = documentOperation.tags.find((tag) => tag in config.sections) as
| keyof typeof config.sections
| undefined
const sectionPath = sectionName ? config.sections[sectionName] : undefined
if (!sectionName || !sectionPath || !('operationId' in documentOperation) || !documentOperation.operationId) {
const sectionName = documentOperation.tags.find((tag) => tag in config.sections)
const section = sectionName ? config.sections[sectionName] : undefined
if (!sectionName || !section || !('operationId' in documentOperation) || !documentOperation.operationId) {
continue
}
const operationId = documentOperation.operationId
if (!sections[sectionName]) {
sections[sectionName] = {
name: sectionName,
path: sectionPath,
path: section.path,
operations: [],
}
}
Expand Down Expand Up @@ -174,10 +199,19 @@ export function getApi(apiId: ApiId, passedDocument?: OpenAPIV3_1.Document): Api
})
}

const longestOperationIdPrefixThatMatches = (section.operationIdPrefixes ?? [])
.filter((prefix) => operationId.startsWith(prefix))
.sort((a, b) => b.length - a.length)[0]
const slug = camelToKebab(
longestOperationIdPrefixThatMatches
? operationId.slice(longestOperationIdPrefixThatMatches.length)
: operationId,
)

const operation: ApiOperation = {
...documentOperation,
operationId: documentOperation.operationId,
slug: camelToKebab(documentOperation.operationId),
operationId,
slug,
method: method.toUpperCase(),
baseUrl,
path,
Expand Down
Loading