From ea0786efa7b233fae821c014a59da9ea24598f67 Mon Sep 17 00:00:00 2001 From: Matias Benary Date: Mon, 26 Jan 2026 12:11:46 -0300 Subject: [PATCH 1/8] feat: add meiliseach --- .mcp.json | 14 + package-lock.json | 6 + website/.env.example | 8 +- website/docker-compose.yml | 16 + website/docusaurus.config.js | 28 +- website/mcp-meilisearch/index.mjs | 203 +++ website/mcp-meilisearch/package-lock.json | 1137 +++++++++++++++++ website/mcp-meilisearch/package.json | 18 + website/package.json | 3 + website/scripts/index-meilisearch.mjs | 339 +++++ website/src/pages/search.tsx | 6 + website/src/theme/SearchBar/index.tsx | 349 +++++ website/src/theme/SearchBar/styles.module.css | 365 ++++++ website/src/theme/SearchPage/index.tsx | 368 ++++++ .../src/theme/SearchPage/styles.module.css | 378 ++++++ website/src/utils/searchAnalytics.ts | 67 + 16 files changed, 3281 insertions(+), 24 deletions(-) create mode 100644 .mcp.json create mode 100644 package-lock.json create mode 100644 website/docker-compose.yml create mode 100644 website/mcp-meilisearch/index.mjs create mode 100644 website/mcp-meilisearch/package-lock.json create mode 100644 website/mcp-meilisearch/package.json create mode 100644 website/scripts/index-meilisearch.mjs create mode 100644 website/src/pages/search.tsx create mode 100644 website/src/theme/SearchBar/index.tsx create mode 100644 website/src/theme/SearchBar/styles.module.css create mode 100644 website/src/theme/SearchPage/index.tsx create mode 100644 website/src/theme/SearchPage/styles.module.css create mode 100644 website/src/utils/searchAnalytics.ts diff --git a/.mcp.json b/.mcp.json new file mode 100644 index 00000000000..cdfcb06f4df --- /dev/null +++ b/.mcp.json @@ -0,0 +1,14 @@ +{ + "mcpServers": { + "near-docs": { + "type": "stdio", + "command": "node", + "args": ["/home/matiasbenary/projects/near/docs/website/mcp-meilisearch/index.mjs"], + "env": { + "MEILI_HOST": "http://localhost:7700", + "MEILI_API_KEY": "masterKey123", + "MEILI_INDEX_NAME": "near-docs" + } + } + } +} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000000..6ab682576c9 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "docs", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} diff --git a/website/.env.example b/website/.env.example index 9d4ff263177..09669a1e4a2 100644 --- a/website/.env.example +++ b/website/.env.example @@ -9,4 +9,10 @@ REACT_APP_NEAR_TOWN_HALL_CALENDAR_ID= # Analytics REACT_APP_PUBLIC_POSTHOG_KEY= -REACT_APP_PUBLIC_POSTHOG_HOST= \ No newline at end of file +REACT_APP_PUBLIC_POSTHOG_HOST= + +# MeiliSearch +MEILI_HOST=http://localhost:7700 +MEILI_MASTER_KEY=masterKey123 +MEILI_SEARCH_KEY= +MEILI_INDEX_NAME=near-docs \ No newline at end of file diff --git a/website/docker-compose.yml b/website/docker-compose.yml new file mode 100644 index 00000000000..2d45e7376e9 --- /dev/null +++ b/website/docker-compose.yml @@ -0,0 +1,16 @@ +version: '3.8' +services: + meilisearch: + image: getmeili/meilisearch:v1.34 + container_name: near-docs-search + ports: + - "7700:7700" + environment: + - MEILI_MASTER_KEY=${MEILI_MASTER_KEY:-masterKey123} + - MEILI_ENV=development + volumes: + - meilisearch_data:/meili_data + +volumes: + meilisearch_data: + diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 7c9667b0c4c..2c1f78c8049 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -30,6 +30,11 @@ const config = { REACT_APP_GOOGLE_CALENDAR_API_KEY: process.env.REACT_APP_GOOGLE_CALENDAR_API_KEY, REACT_APP_LUMA_NEAR_CALENDAR_ID: process.env.REACT_APP_LUMA_NEAR_CALENDAR_ID, REACT_APP_DEVHUB_GOOGLE_CALENDAR_ID: process.env.REACT_APP_DEVHUB_GOOGLE_CALENDAR_ID, + meilisearch: { + host: process.env.MEILI_HOST || 'http://localhost:7700', + apiKey: process.env.MEILI_SEARCH_KEY || process.env.MEILI_MASTER_KEY || 'masterKey123', + indexName: process.env.MEILI_INDEX_NAME || 'near-docs', + }, }, themes: ['@saucelabs/theme-github-codeblock', '@docusaurus/theme-mermaid'], onBrokenLinks: 'throw', @@ -276,29 +281,6 @@ const config = { src: 'img/near_logo.svg', }, }, - algolia: { - // The application ID provided by Algolia - appId: '0LUM67N2P2', - // Public API key: it is safe to commit it - apiKey: '41e2feb6ffa0d3450ca9d0a0c1826c1c', - indexName: 'docs', - askAi: { - assistantId: 'ck1jQv3AzZ5R', - indexName: 'docs.md', - apiKey: '41e2feb6ffa0d3450ca9d0a0c1826c1c', - appId: '0LUM67N2P2', - }, - // Optional: see doc section below - contextualSearch: true, - // Optional: Algolia search parameters - searchParameters: { - clickAnalytics: true, - analytics: true, - }, - //... other Algolia params - placeholder: 'Search the Docs...', - insights: true, - }, }, }; diff --git a/website/mcp-meilisearch/index.mjs b/website/mcp-meilisearch/index.mjs new file mode 100644 index 00000000000..5dbd75385d9 --- /dev/null +++ b/website/mcp-meilisearch/index.mjs @@ -0,0 +1,203 @@ +#!/usr/bin/env node + +import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; +import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'; +import { MeiliSearch } from 'meilisearch'; +import { z } from 'zod'; + +const MEILI_HOST = process.env.MEILI_HOST || 'http://localhost:7700'; +const MEILI_API_KEY = process.env.MEILI_API_KEY || process.env.MEILI_MASTER_KEY || 'masterKey123'; +const MEILI_INDEX_NAME = process.env.MEILI_INDEX_NAME || 'near-docs'; + + +const client = new MeiliSearch({ + host: MEILI_HOST, + apiKey: MEILI_API_KEY, +}); + +const server = new McpServer({ + name: 'mcp-meilisearch', + version: '1.0.0', +}); + +server.registerTool( + 'search_near_docs', + { + description: 'Search the NEAR Protocol documentation. Use this to find information about NEAR blockchain, smart contracts, web3 apps, wallets, transactions, gas, accounts, and more.', + inputSchema: { + query: z.string().describe('The search query (e.g., "smart contract", "gas fees", "wallet integration")'), + category: z.string().optional().describe('Optional category filter: Smart Contracts, Web3 Apps, Protocol, Tutorials, AI, Tools, API, Integrations, Data Infrastructure, Chain Abstraction, Primitives'), + limit: z.number().optional().default(5).describe('Maximum number of results (default: 5, max: 20)'), + }, + }, + async ({ query, category, limit = 5 }) => { + try { + const index = client.index(MEILI_INDEX_NAME); + + const searchParams = { + limit: Math.min(limit, 20), + attributesToRetrieve: ['title', 'content', 'path', 'category', 'hierarchy_lvl0', 'hierarchy_lvl1'], + attributesToHighlight: ['title', 'content'], + highlightPreTag: '**', + highlightPostTag: '**', + }; + + if (category) { + searchParams.filter = `category = "${category}"`; + } + + const results = await index.search(query, searchParams); + + if (results.hits.length === 0) { + return { + content: [ + { + type: 'text', + text: `No results found for "${query}"${category ? ` in category "${category}"` : ''}. Try different keywords or remove the category filter.`, + }, + ], + }; + } + + const formattedResults = results.hits.map((hit, i) => { + const breadcrumb = [hit.hierarchy_lvl0, hit.hierarchy_lvl1].filter(Boolean).join(' > '); + const content = hit._formatted?.content?.substring(0, 300) || hit.content?.substring(0, 300); + + return `## ${i + 1}. ${hit._formatted?.title || hit.title} + +**Category:** ${hit.category} +**Path:** ${hit.path} +**Breadcrumb:** ${breadcrumb} + +${content}... + +---`; + }).join('\n\n'); + + return { + content: [ + { + type: 'text', + text: `Found ${results.estimatedTotalHits} results for "${query}" (showing ${results.hits.length}):\n\n${formattedResults}`, + }, + ], + }; + } catch (error) { + return { + content: [ + { + type: 'text', + text: `Error searching: ${error.message}`, + }, + ], + isError: true, + }; + } + } +); + +server.registerTool( + 'get_doc_content', + { + description: 'Get the full content of a specific documentation page by its path', + inputSchema: { + path: z.string().describe('The document path (e.g., "/smart-contracts/what-is")'), + }, + }, + async ({ path }) => { + try { + const index = client.index(MEILI_INDEX_NAME); + + const results = await index.search('', { + filter: `path = "${path}"`, + limit: 1, + attributesToRetrieve: ['title', 'content', 'path', 'category', 'hierarchy_lvl0', 'hierarchy_lvl1', 'hierarchy_lvl2'], + }); + + if (results.hits.length === 0) { + return { + content: [ + { + type: 'text', + text: `Document not found at path: ${path}`, + }, + ], + }; + } + + const doc = results.hits[0]; + const breadcrumb = [doc.hierarchy_lvl0, doc.hierarchy_lvl1, doc.hierarchy_lvl2].filter(Boolean).join(' > '); + + return { + content: [ + { + type: 'text', + text: `# ${doc.title} + +**Category:** ${doc.category} +**Path:** ${doc.path} +**Breadcrumb:** ${breadcrumb} + +--- + +${doc.content}`, + }, + ], + }; + } catch (error) { + return { + content: [ + { + type: 'text', + text: `Error: ${error.message}`, + }, + ], + isError: true, + }; + } + } +); + +server.registerTool( + 'list_doc_categories', + { + description: 'List all available documentation categories', + inputSchema: {}, + }, + async () => { + const categories = [ + 'Smart Contracts - Build and deploy smart contracts on NEAR', + 'Web3 Apps - Create decentralized applications', + 'Protocol - Core NEAR Protocol concepts (accounts, transactions, gas)', + 'Tutorials - Step-by-step guides and examples', + 'AI - AI agents and tools on NEAR', + 'Tools - CLI, SDKs, and developer tools', + 'API - RPC API reference', + 'Integrations - Exchange and wallet integrations', + 'Data Infrastructure - Indexers and data tools', + 'Chain Abstraction - Cross-chain functionality', + 'Primitives - NFTs, FTs, DAOs', + ]; + + return { + content: [ + { + type: 'text', + text: `Available documentation categories:\n\n${categories.map(c => `- ${c}`).join('\n')}`, + }, + ], + }; + } +); + + +async function main() { + const transport = new StdioServerTransport(); + await server.connect(transport); + console.error('MeiliSearch MCP server running on stdio'); +} + +main().catch((error) => { + console.error('Fatal error:', error); + process.exit(1); +}); diff --git a/website/mcp-meilisearch/package-lock.json b/website/mcp-meilisearch/package-lock.json new file mode 100644 index 00000000000..b8f1f00925f --- /dev/null +++ b/website/mcp-meilisearch/package-lock.json @@ -0,0 +1,1137 @@ +{ + "name": "mcp-meilisearch", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "mcp-meilisearch", + "version": "1.0.0", + "dependencies": { + "@modelcontextprotocol/sdk": "^1.25.3", + "meilisearch": "^0.55.0", + "zod": "^3.24.0" + }, + "bin": { + "mcp-meilisearch": "index.mjs" + } + }, + "node_modules/@hono/node-server": { + "version": "1.19.9", + "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-1.19.9.tgz", + "integrity": "sha512-vHL6w3ecZsky+8P5MD+eFfaGTyCeOHUIFYMGpQGbrBTSmNNoxv0if69rEZ5giu36weC5saFuznL411gRX7bJDw==", + "license": "MIT", + "engines": { + "node": ">=18.14.1" + }, + "peerDependencies": { + "hono": "^4" + } + }, + "node_modules/@modelcontextprotocol/sdk": { + "version": "1.25.3", + "resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.25.3.tgz", + "integrity": "sha512-vsAMBMERybvYgKbg/l4L1rhS7VXV1c0CtyJg72vwxONVX0l4ZfKVAnZEWTQixJGTzKnELjQ59e4NbdFDALRiAQ==", + "license": "MIT", + "dependencies": { + "@hono/node-server": "^1.19.9", + "ajv": "^8.17.1", + "ajv-formats": "^3.0.1", + "content-type": "^1.0.5", + "cors": "^2.8.5", + "cross-spawn": "^7.0.5", + "eventsource": "^3.0.2", + "eventsource-parser": "^3.0.0", + "express": "^5.0.1", + "express-rate-limit": "^7.5.0", + "jose": "^6.1.1", + "json-schema-typed": "^8.0.2", + "pkce-challenge": "^5.0.0", + "raw-body": "^3.0.0", + "zod": "^3.25 || ^4.0", + "zod-to-json-schema": "^3.25.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@cfworker/json-schema": "^4.1.1", + "zod": "^3.25 || ^4.0" + }, + "peerDependenciesMeta": { + "@cfworker/json-schema": { + "optional": true + }, + "zod": { + "optional": false + } + } + }, + "node_modules/accepts": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", + "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", + "license": "MIT", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-3.0.1.tgz", + "integrity": "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==", + "license": "MIT", + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/body-parser": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.2.tgz", + "integrity": "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA==", + "license": "MIT", + "dependencies": { + "bytes": "^3.1.2", + "content-type": "^1.0.5", + "debug": "^4.4.3", + "http-errors": "^2.0.0", + "iconv-lite": "^0.7.0", + "on-finished": "^2.4.1", + "qs": "^6.14.1", + "raw-body": "^3.0.1", + "type-is": "^2.0.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/content-disposition": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.1.tgz", + "integrity": "sha512-oIXISMynqSqm241k6kcQ5UwttDILMK4BiurCfGEREw6+X9jkkpEe5T9FZaApyLGGOnFuyMWZpdolTXMtvEJ08Q==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "license": "MIT", + "engines": { + "node": ">=6.6.0" + } + }, + "node_modules/cors": { + "version": "2.8.6", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.6.tgz", + "integrity": "sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==", + "license": "MIT", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/eventsource": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-3.0.7.tgz", + "integrity": "sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==", + "license": "MIT", + "dependencies": { + "eventsource-parser": "^3.0.1" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/eventsource-parser": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/eventsource-parser/-/eventsource-parser-3.0.6.tgz", + "integrity": "sha512-Vo1ab+QXPzZ4tCa8SwIHJFaSzy4R6SHf7BY79rFBDf0idraZWAkYrDjDj8uWaSm3S2TK+hJ7/t1CEmZ7jXw+pg==", + "license": "MIT", + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/express": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz", + "integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==", + "license": "MIT", + "dependencies": { + "accepts": "^2.0.0", + "body-parser": "^2.2.1", + "content-disposition": "^1.0.0", + "content-type": "^1.0.5", + "cookie": "^0.7.1", + "cookie-signature": "^1.2.1", + "debug": "^4.4.0", + "depd": "^2.0.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "finalhandler": "^2.1.0", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "merge-descriptors": "^2.0.0", + "mime-types": "^3.0.0", + "on-finished": "^2.4.1", + "once": "^1.4.0", + "parseurl": "^1.3.3", + "proxy-addr": "^2.0.7", + "qs": "^6.14.0", + "range-parser": "^1.2.1", + "router": "^2.2.0", + "send": "^1.1.0", + "serve-static": "^2.2.0", + "statuses": "^2.0.1", + "type-is": "^2.0.1", + "vary": "^1.1.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/express-rate-limit": { + "version": "7.5.1", + "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-7.5.1.tgz", + "integrity": "sha512-7iN8iPMDzOMHPUYllBEsQdWVB6fPDMPqwjBaFrgr4Jgr/+okjvzAy+UHlYYL/Vs0OsOrMkwS6PJDkFlJwoxUnw==", + "license": "MIT", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/express-rate-limit" + }, + "peerDependencies": { + "express": ">= 4.11" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "license": "MIT" + }, + "node_modules/fast-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz", + "integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/finalhandler": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz", + "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/hono": { + "version": "4.11.5", + "resolved": "https://registry.npmjs.org/hono/-/hono-4.11.5.tgz", + "integrity": "sha512-WemPi9/WfyMwZs+ZUXdiwcCh9Y+m7L+8vki9MzDw3jJ+W9Lc+12HGsd368Qc1vZi1xwW8BWMMsnK5efYKPdt4g==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=16.9.0" + } + }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "license": "MIT", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/iconv-lite": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz", + "integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", + "license": "MIT" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "license": "ISC" + }, + "node_modules/jose": { + "version": "6.1.3", + "resolved": "https://registry.npmjs.org/jose/-/jose-6.1.3.tgz", + "integrity": "sha512-0TpaTfihd4QMNwrz/ob2Bp7X04yuxJkjRGi4aKmOqwhov54i6u79oCv7T+C7lo70MKH6BesI3vscD1yb/yzKXQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/panva" + } + }, + "node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "license": "MIT" + }, + "node_modules/json-schema-typed": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/json-schema-typed/-/json-schema-typed-8.0.2.tgz", + "integrity": "sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA==", + "license": "BSD-2-Clause" + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", + "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/meilisearch": { + "version": "0.55.0", + "resolved": "https://registry.npmjs.org/meilisearch/-/meilisearch-0.55.0.tgz", + "integrity": "sha512-qSMeiezfDgIqciIeYzh5E4pXDZZD7CtHeWDCs43kN3trLgl5FtfmBAIkljL3huFaOx08feYtC8FfIFUpVwq6rg==", + "license": "MIT" + }, + "node_modules/merge-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/negotiator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-to-regexp": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz", + "integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/pkce-challenge": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-5.0.1.tgz", + "integrity": "sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ==", + "license": "MIT", + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/qs": { + "version": "6.14.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.1.tgz", + "integrity": "sha512-4EK3+xJl8Ts67nLYNwqw/dsFVnCf+qR7RgXSK9jEEm9unao3njwMDdmsdvoKBKHzxd7tCYz5e5M+SnMjdtXGQQ==", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz", + "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.7.0", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/router": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", + "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "depd": "^2.0.0", + "is-promise": "^4.0.0", + "parseurl": "^1.3.3", + "path-to-regexp": "^8.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/send": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz", + "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.3", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.1", + "mime-types": "^3.0.2", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/serve-static": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz", + "integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==", + "license": "MIT", + "dependencies": { + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.2.0" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/type-is": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz", + "integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==", + "license": "MIT", + "dependencies": { + "content-type": "^1.0.5", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + }, + "node_modules/zod": { + "version": "3.25.76", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", + "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "node_modules/zod-to-json-schema": { + "version": "3.25.1", + "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.25.1.tgz", + "integrity": "sha512-pM/SU9d3YAggzi6MtR4h7ruuQlqKtad8e9S0fmxcMi+ueAK5Korys/aWcV9LIIHTVbj01NdzxcnXSN+O74ZIVA==", + "license": "ISC", + "peerDependencies": { + "zod": "^3.25 || ^4" + } + } + } +} diff --git a/website/mcp-meilisearch/package.json b/website/mcp-meilisearch/package.json new file mode 100644 index 00000000000..614cf7c6b50 --- /dev/null +++ b/website/mcp-meilisearch/package.json @@ -0,0 +1,18 @@ +{ + "name": "mcp-meilisearch", + "version": "1.0.0", + "description": "MCP server for searching NEAR documentation with MeiliSearch", + "type": "module", + "main": "index.mjs", + "bin": { + "mcp-meilisearch": "./index.mjs" + }, + "scripts": { + "start": "node index.mjs" + }, + "dependencies": { + "@modelcontextprotocol/sdk": "^1.25.3", + "meilisearch": "^0.55.0", + "zod": "^3.24.0" + } +} diff --git a/website/package.json b/website/package.json index f125983d5ff..e3216cfa3c0 100644 --- a/website/package.json +++ b/website/package.json @@ -16,6 +16,7 @@ "build:dev": "./node_modules/.bin/docusaurus build --dev && yarn run process-markdown", "build:preview": "yarn run process-markdown && ./node_modules/.bin/docusaurus build --locale en && yarn run process-markdown", "process-markdown": "node ./scripts/copy-md-to-static.js", + "index:meilisearch": "node scripts/index-meilisearch.mjs", "swizzle": "docusaurus swizzle", "docusaurus": "docusaurus" }, @@ -32,6 +33,8 @@ }, "dependencies": { "@docsearch/core": "^4.5.0", + "@headlessui/react": "^1.7.0", + "meilisearch": "^0.55.0", "@docusaurus/core": "3.9.2", "@docusaurus/plugin-ideal-image": "3.9.2", "@docusaurus/plugin-sitemap": "3.9.2", diff --git a/website/scripts/index-meilisearch.mjs b/website/scripts/index-meilisearch.mjs new file mode 100644 index 00000000000..8b315b030ec --- /dev/null +++ b/website/scripts/index-meilisearch.mjs @@ -0,0 +1,339 @@ +import { MeiliSearch } from 'meilisearch'; +import fs from 'fs'; +import path from 'path'; +import { fileURLToPath } from 'url'; +import { createHash } from 'crypto'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +const MEILI_HOST = process.env.MEILI_HOST || 'http://localhost:7700'; +const MEILI_MASTER_KEY = process.env.MEILI_MASTER_KEY || 'masterKey123'; +const MEILI_INDEX_NAME = process.env.MEILI_INDEX_NAME || 'near-docs'; +const DOCS_PATH = path.resolve(__dirname, '../../docs'); +const BATCH_SIZE = 100; + +const CATEGORY_MAP = { + 'smart-contracts': 'Smart Contracts', + 'web3-apps': 'Web3 Apps', + 'protocol': 'Protocol', + 'tools': 'Tools', + 'api': 'API', + 'tutorials': 'Tutorials', + 'primitives': 'Primitives', + 'chain-abstraction': 'Chain Abstraction', + 'integrations': 'Integrations', + 'data-infrastructure': 'Data Infrastructure', + 'ai': 'AI', + 'aurora': 'Aurora', + 'quest': 'Quest', +}; + +function generateId(content) { + return createHash('md5').update(content).digest('hex').substring(0, 12); +} + +function extractFrontmatter(content) { + const frontmatterRegex = /^---\n([\s\S]*?)\n---/; + const match = content.match(frontmatterRegex); + + if (!match) return { frontmatter: {}, body: content }; + + const frontmatterStr = match[1]; + const body = content.slice(match[0].length).trim(); + + const frontmatter = {}; + const lines = frontmatterStr.split('\n'); + + for (const line of lines) { + const colonIndex = line.indexOf(':'); + if (colonIndex > 0) { + const key = line.slice(0, colonIndex).trim(); + let value = line.slice(colonIndex + 1).trim(); + // Remove quotes if present + if ((value.startsWith('"') && value.endsWith('"')) || + (value.startsWith("'") && value.endsWith("'"))) { + value = value.slice(1, -1); + } + frontmatter[key] = value; + } + } + + return { frontmatter, body }; +} + +function extractHeadings(content) { + const headings = []; + const headingRegex = /^(#{1,6})\s+(.+)$/gm; + let match; + + while ((match = headingRegex.exec(content)) !== null) { + headings.push({ + level: match[1].length, + text: match[2].replace(/[*_`]/g, '').trim(), + }); + } + + return headings; +} + +function cleanContent(content) { + return content + // Remove code blocks + .replace(/```[\s\S]*?```/g, '') + // Remove inline code + .replace(/`[^`]+`/g, '') + // Remove links but keep text + .replace(/\[([^\]]+)\]\([^)]+\)/g, '$1') + // Remove images + .replace(/!\[[^\]]*\]\([^)]+\)/g, '') + // Remove HTML tags + .replace(/<[^>]+>/g, '') + // Remove import statements + .replace(/^import\s+.*$/gm, '') + // Remove markdown emphasis + .replace(/[*_]{1,2}([^*_]+)[*_]{1,2}/g, '$1') + // Normalize whitespace + .replace(/\n{3,}/g, '\n\n') + .trim(); +} + +function getUrlPath(filePath) { + const relativePath = path.relative(DOCS_PATH, filePath); + let urlPath = relativePath + .replace(/\.mdx?$/, '') + .replace(/\\/g, '/'); + + // Handle index files + if (urlPath.endsWith('/index')) { + urlPath = urlPath.slice(0, -6); + } + + // Handle files with numeric prefixes (e.g., 0-intro.md -> intro) + urlPath = urlPath.replace(/\/\d+-/g, '/').replace(/^\d+-/, ''); + + return '/' + urlPath; +} + +function getCategoryFromPath(filePath) { + const relativePath = path.relative(DOCS_PATH, filePath); + const firstFolder = relativePath.split(path.sep)[0]; + return CATEGORY_MAP[firstFolder] || 'General'; +} + +function getHierarchy(filePath, title) { + const relativePath = path.relative(DOCS_PATH, filePath); + const parts = relativePath.split(path.sep); + + // Remove file name + parts.pop(); + + const hierarchy = { + lvl0: getCategoryFromPath(filePath), + lvl1: '', + lvl2: '', + }; + + if (parts.length > 0) { + hierarchy.lvl1 = parts[0] + .replace(/-/g, ' ') + .replace(/^\d+\s*/, '') + .replace(/\b\w/g, c => c.toUpperCase()); + } + + if (parts.length > 1) { + hierarchy.lvl2 = parts.slice(1).join(' > ') + .replace(/-/g, ' ') + .replace(/^\d+\s*/g, '') + .replace(/\b\w/g, c => c.toUpperCase()); + } + + return hierarchy; +} + +function getAllMarkdownFiles(dir) { + const files = []; + + function walk(currentDir) { + const entries = fs.readdirSync(currentDir, { withFileTypes: true }); + + for (const entry of entries) { + const fullPath = path.join(currentDir, entry.name); + + if (entry.isDirectory()) { + // Skip hidden directories + if (!entry.name.startsWith('.')) { + walk(fullPath); + } + } else if (entry.isFile() && /\.mdx?$/.test(entry.name)) { + files.push(fullPath); + } + } + } + + walk(dir); + return files; +} + +async function indexDocuments() { + console.log('Starting MeiliSearch indexation...'); + console.log(`Host: ${MEILI_HOST}`); + console.log(`Index: ${MEILI_INDEX_NAME}`); + + // Initialize client + const client = new MeiliSearch({ + host: MEILI_HOST, + apiKey: MEILI_MASTER_KEY, + }); + + // Check connection + try { + const health = await client.health(); + console.log('MeiliSearch status:', health.status); + } catch (error) { + console.error('Failed to connect to MeiliSearch:', error.message); + console.error('Make sure MeiliSearch is running at', MEILI_HOST); + process.exit(1); + } + + // Get or create index + let index; + try { + index = await client.getIndex(MEILI_INDEX_NAME); + console.log('Using existing index:', MEILI_INDEX_NAME); + } catch { + console.log('Creating new index:', MEILI_INDEX_NAME); + const task = await client.createIndex(MEILI_INDEX_NAME, { primaryKey: 'id' }); + // Wait for index creation to complete + await client.tasks.waitForTask(task.taskUid); + index = client.index(MEILI_INDEX_NAME); + } + + // Configure index settings + console.log('Configuring index settings...'); + await index.updateSettings({ + searchableAttributes: ['title', 'content', 'section', 'hierarchy_lvl0', 'hierarchy_lvl1', 'hierarchy_lvl2'], + filterableAttributes: ['category', 'version', 'hierarchy_lvl0'], + sortableAttributes: ['timestamp'], + rankingRules: ['words', 'typo', 'proximity', 'attribute', 'sort', 'exactness'], + distinctAttribute: 'path', + }); + + // Get all markdown files + const files = getAllMarkdownFiles(DOCS_PATH); + console.log(`Found ${files.length} markdown files`); + + // Process files into documents + const documents = []; + + for (const filePath of files) { + try { + const content = fs.readFileSync(filePath, 'utf-8'); + const { frontmatter, body } = extractFrontmatter(content); + const headings = extractHeadings(body); + const cleanedContent = cleanContent(body); + + // Skip empty or very short content + if (cleanedContent.length < 50) continue; + + const urlPath = getUrlPath(filePath); + const title = frontmatter.title || + frontmatter.sidebar_label || + headings[0]?.text || + path.basename(filePath, path.extname(filePath)).replace(/-/g, ' '); + + const hierarchy = getHierarchy(filePath, title); + + const doc = { + id: generateId(urlPath), + title, + content: cleanedContent.substring(0, 10000), // Limit content size + path: urlPath, + section: frontmatter.sidebar_label || title, + category: getCategoryFromPath(filePath), + version: 'current', + hierarchy_lvl0: hierarchy.lvl0, + hierarchy_lvl1: hierarchy.lvl1, + hierarchy_lvl2: hierarchy.lvl2, + timestamp: Date.now(), + }; + + documents.push(doc); + + // Also index individual headings as separate documents for better search granularity + for (const heading of headings.slice(0, 5)) { // Limit to first 5 headings + const anchor = heading.text + .toLowerCase() + .replace(/[^\w\s-]/g, '') + .replace(/\s+/g, '-'); + + const headingDoc = { + id: generateId(urlPath + '#' + anchor), + title: heading.text, + content: cleanedContent.substring(0, 500), + path: urlPath + '#' + anchor, + section: title, + category: getCategoryFromPath(filePath), + version: 'current', + hierarchy_lvl0: hierarchy.lvl0, + hierarchy_lvl1: hierarchy.lvl1, + hierarchy_lvl2: heading.text, + timestamp: Date.now(), + }; + + documents.push(headingDoc); + } + } catch (error) { + console.warn(`Warning: Failed to process ${filePath}:`, error.message); + } + } + + console.log(`Prepared ${documents.length} documents for indexing`); + + // Delete all existing documents + console.log('Clearing existing documents...'); + const deleteTask = await index.deleteAllDocuments(); + await client.tasks.waitForTask(deleteTask.taskUid); + + // Upload documents in batches + console.log('Uploading documents...'); + const uploadTasks = []; + for (let i = 0; i < documents.length; i += BATCH_SIZE) { + const batch = documents.slice(i, i + BATCH_SIZE); + const task = await index.addDocuments(batch); + uploadTasks.push(task.taskUid); + console.log(`Uploaded batch ${Math.floor(i / BATCH_SIZE) + 1}/${Math.ceil(documents.length / BATCH_SIZE)} (Task: ${task.taskUid})`); + } + + // Wait for all indexing tasks to complete + console.log('Waiting for indexing to complete...'); + for (const taskUid of uploadTasks) { + await client.tasks.waitForTask(taskUid); + } + + // Get final stats + const stats = await index.getStats(); + console.log('\nIndexing complete!'); + console.log(`Total documents indexed: ${stats.numberOfDocuments}`); + console.log(`Index is indexing: ${stats.isIndexing}`); + + // Generate search API key if master key is provided + if (MEILI_MASTER_KEY && MEILI_MASTER_KEY !== 'masterKey123') { + try { + const keys = await client.getKeys(); + const searchKey = keys.results.find(k => k.actions.includes('search')); + if (searchKey) { + console.log(`\nSearch API Key: ${searchKey.key}`); + console.log('Add this to your .env file as MEILI_SEARCH_KEY'); + } + } catch (error) { + console.log('Note: Could not retrieve search key. Use the dashboard to get it.'); + } + } +} + +// Run indexation +indexDocuments().catch(error => { + console.error('Indexation failed:', error); + process.exit(1); +}); diff --git a/website/src/pages/search.tsx b/website/src/pages/search.tsx new file mode 100644 index 00000000000..9bd7b7d4bf5 --- /dev/null +++ b/website/src/pages/search.tsx @@ -0,0 +1,6 @@ +import React from 'react'; +import SearchPage from '../theme/SearchPage'; + +export default function Search(): JSX.Element { + return ; +} diff --git a/website/src/theme/SearchBar/index.tsx b/website/src/theme/SearchBar/index.tsx new file mode 100644 index 00000000000..4a7bc24ce42 --- /dev/null +++ b/website/src/theme/SearchBar/index.tsx @@ -0,0 +1,349 @@ +import React, { useState, useEffect, useCallback, useRef, Fragment } from 'react'; +import { useHistory } from '@docusaurus/router'; +import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; +import { MeiliSearch } from 'meilisearch'; +import { Dialog, Transition } from '@headlessui/react'; +import { trackSearch, trackSearchResultClick, trackSearchNoResults } from '../../utils/searchAnalytics'; +import styles from './styles.module.css'; + +interface SearchHit { + id: string; + title: string; + content: string; + path: string; + section: string; + category: string; + hierarchy_lvl0: string; + hierarchy_lvl1: string; + hierarchy_lvl2: string; + _formatted?: { + title?: string; + content?: string; + }; +} + +interface SearchResult { + hits: SearchHit[]; + query: string; + processingTimeMs: number; + estimatedTotalHits: number; +} + +const CATEGORIES = [ + { id: 'all', label: 'All' }, + { id: 'Smart Contracts', label: 'Contracts' }, + { id: 'Web3 Apps', label: 'Apps' }, + { id: 'Protocol', label: 'Protocol' }, + { id: 'Tutorials', label: 'Tutorials' }, + { id: 'AI', label: 'AI' }, + { id: 'Tools', label: 'Tools' }, +]; + +export default function SearchBar(): JSX.Element { + const { siteConfig } = useDocusaurusContext(); + const history = useHistory(); + + const [isOpen, setIsOpen] = useState(false); + const [query, setQuery] = useState(''); + const [results, setResults] = useState([]); + const [loading, setLoading] = useState(false); + const [selectedIndex, setSelectedIndex] = useState(0); + const [selectedCategory, setSelectedCategory] = useState('all'); + const [client, setClient] = useState(null); + + const inputRef = useRef(null); + const resultsRef = useRef(null); + + useEffect(() => { + const config = siteConfig.customFields?.meilisearch as { + host?: string; + apiKey?: string; + indexName?: string; + } | undefined; + + if (config?.host) { + const meiliClient = new MeiliSearch({ + host: config.host, + apiKey: config.apiKey || '', + }); + setClient(meiliClient); + } + }, [siteConfig]); + + useEffect(() => { + const handleKeyDown = (e: KeyboardEvent) => { + if ((e.metaKey || e.ctrlKey) && e.key === 'k') { + e.preventDefault(); + setIsOpen(true); + } + if (e.key === 'Escape') { + setIsOpen(false); + } + }; + + document.addEventListener('keydown', handleKeyDown); + return () => document.removeEventListener('keydown', handleKeyDown); + }, []); + + useEffect(() => { + if (isOpen && inputRef.current) { + setTimeout(() => inputRef.current?.focus(), 100); + } + }, [isOpen]); + + const search = useCallback(async (searchQuery: string, category: string) => { + if (!client || !searchQuery.trim()) { + setResults([]); + return; + } + + const config = siteConfig.customFields?.meilisearch as { indexName?: string } | undefined; + const indexName = config?.indexName || 'near-docs'; + + setLoading(true); + try { + const index = client.index(indexName); + const filter = category !== 'all' ? `category = "${category}"` : undefined; + + const searchResult: SearchResult = await index.search(searchQuery, { + limit: 10, + attributesToHighlight: ['title', 'content'], + highlightPreTag: '', + highlightPostTag: '', + filter, + }); + + setResults(searchResult.hits); + setSelectedIndex(0); + + trackSearch(searchQuery, searchResult.hits.length, category); + + if (searchResult.hits.length === 0) { + trackSearchNoResults(searchQuery); + } + } catch (error) { + console.error('Search error:', error); + setResults([]); + } finally { + setLoading(false); + } + }, [client, siteConfig]); + + useEffect(() => { + const timer = setTimeout(() => { + search(query, selectedCategory); + }, 150); + + return () => clearTimeout(timer); + }, [query, selectedCategory, search]); + + const handleKeyDown = (e: React.KeyboardEvent) => { + if (e.key === 'ArrowDown') { + e.preventDefault(); + setSelectedIndex(prev => Math.min(prev + 1, results.length - 1)); + } else if (e.key === 'ArrowUp') { + e.preventDefault(); + setSelectedIndex(prev => Math.max(prev - 1, 0)); + } else if (e.key === 'Enter' && results[selectedIndex]) { + e.preventDefault(); + navigateToResult(results[selectedIndex], selectedIndex); + } + }; + + const navigateToResult = (hit: SearchHit, index: number) => { + trackSearchResultClick(query, index, hit.path); + setIsOpen(false); + setQuery(''); + history.push(hit.path); + }; + + useEffect(() => { + if (resultsRef.current && results.length > 0) { + const selectedElement = resultsRef.current.children[selectedIndex] as HTMLElement; + selectedElement?.scrollIntoView({ block: 'nearest' }); + } + }, [selectedIndex, results.length]); + + const renderHighlight = (text: string | undefined, fallback: string) => { + if (!text) return fallback; + return ; + }; + + return ( + <> + + + + setIsOpen(false)} + className={styles.dialogOverlay} + > + + + + + ); +} diff --git a/website/src/theme/SearchBar/styles.module.css b/website/src/theme/SearchBar/styles.module.css new file mode 100644 index 00000000000..b0121cd77ee --- /dev/null +++ b/website/src/theme/SearchBar/styles.module.css @@ -0,0 +1,365 @@ +/* Search Button */ +.searchButton { + display: flex; + align-items: center; + gap: 0.5rem; + padding: 0.5rem 1rem; + background: var(--ifm-color-emphasis-100); + border: 1px solid var(--ifm-color-emphasis-300); + border-radius: 8px; + color: var(--ifm-color-emphasis-600); + cursor: pointer; + transition: all 0.2s ease; + font-size: 0.875rem; +} + +.searchButton:hover { + background: var(--ifm-color-emphasis-200); + border-color: var(--ifm-color-emphasis-400); +} + +.searchPlaceholder { + display: none; +} + +@media (min-width: 768px) { + .searchPlaceholder { + display: inline; + } +} + +.searchShortcut { + display: none; + gap: 0.25rem; + margin-left: 0.5rem; +} + +@media (min-width: 768px) { + .searchShortcut { + display: flex; + } +} + +.searchShortcut kbd { + padding: 0.125rem 0.375rem; + font-size: 0.75rem; + background: var(--ifm-color-emphasis-200); + border: 1px solid var(--ifm-color-emphasis-300); + border-radius: 4px; + font-family: inherit; +} + +/* Dialog Overlay */ +.dialogOverlay { + position: fixed; + inset: 0; + z-index: 1000; + display: flex; + align-items: flex-start; + justify-content: center; + padding-top: 15vh; +} + +/* Backdrop */ +.backdrop { + position: fixed; + inset: 0; + background: rgba(0, 0, 0, 0.5); + backdrop-filter: blur(4px); +} + +/* Backdrop Transitions */ +.backdropEnter { + transition: opacity 200ms ease-out; +} + +.backdropEnterFrom { + opacity: 0; +} + +.backdropEnterTo { + opacity: 1; +} + +.backdropLeave { + transition: opacity 150ms ease-in; +} + +.backdropLeaveFrom { + opacity: 1; +} + +.backdropLeaveTo { + opacity: 0; +} + +/* Modal */ +.modal { + position: relative; + width: 100%; + max-width: 640px; + margin: 0 1rem; + background: var(--ifm-background-color); + border-radius: 12px; + box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); + overflow: hidden; +} + +/* Modal Transitions */ +.modalEnter { + transition: all 200ms ease-out; +} + +.modalEnterFrom { + opacity: 0; + transform: scale(0.95) translateY(-20px); +} + +.modalEnterTo { + opacity: 1; + transform: scale(1) translateY(0); +} + +.modalLeave { + transition: all 150ms ease-in; +} + +.modalLeaveFrom { + opacity: 1; + transform: scale(1) translateY(0); +} + +.modalLeaveTo { + opacity: 0; + transform: scale(0.95) translateY(-20px); +} + +/* Search Header */ +.searchHeader { + display: flex; + align-items: center; + gap: 0.75rem; + padding: 1rem; + border-bottom: 1px solid var(--ifm-color-emphasis-200); +} + +.searchIcon { + flex-shrink: 0; + color: var(--ifm-color-emphasis-500); +} + +.searchInput { + flex: 1; + border: none; + background: transparent; + font-size: 1rem; + color: var(--ifm-font-color-base); + outline: none; +} + +.searchInput::placeholder { + color: var(--ifm-color-emphasis-500); +} + +.spinner { + width: 20px; + height: 20px; + border: 2px solid var(--ifm-color-emphasis-300); + border-top-color: var(--ifm-color-primary); + border-radius: 50%; + animation: spin 0.6s linear infinite; +} + +@keyframes spin { + to { + transform: rotate(360deg); + } +} + +.closeButton { + padding: 0.25rem 0.5rem; + background: transparent; + border: none; + cursor: pointer; +} + +.closeButton kbd { + padding: 0.125rem 0.5rem; + font-size: 0.75rem; + background: var(--ifm-color-emphasis-200); + border: 1px solid var(--ifm-color-emphasis-300); + border-radius: 4px; + color: var(--ifm-color-emphasis-600); +} + +/* Category Filters */ +.categoryFilters { + display: flex; + flex-wrap: wrap; + gap: 0.5rem; + padding: 0.75rem 1rem; + border-bottom: 1px solid var(--ifm-color-emphasis-200); + background: var(--ifm-color-emphasis-50); +} + +.categoryChip { + padding: 0.375rem 0.75rem; + font-size: 0.8125rem; + background: var(--ifm-color-emphasis-100); + border: 1px solid var(--ifm-color-emphasis-300); + border-radius: 9999px; + color: var(--ifm-color-emphasis-700); + cursor: pointer; + transition: all 0.15s ease; +} + +.categoryChip:hover { + background: var(--ifm-color-emphasis-200); +} + +.categoryChipActive { + background: var(--ifm-color-primary); + border-color: var(--ifm-color-primary); + color: white; +} + +.categoryChipActive:hover { + background: var(--ifm-color-primary-dark); +} + +/* Results */ +.results { + max-height: 400px; + overflow-y: auto; +} + +.noResults { + padding: 2rem; + text-align: center; + color: var(--ifm-color-emphasis-600); +} + +.noResultsHint { + font-size: 0.875rem; + color: var(--ifm-color-emphasis-500); + margin-top: 0.5rem; +} + +/* Result Item */ +.resultItem { + display: block; + width: 100%; + padding: 1rem; + text-align: left; + background: transparent; + border: none; + border-bottom: 1px solid var(--ifm-color-emphasis-200); + cursor: pointer; + transition: background 0.1s ease; +} + +.resultItem:last-child { + border-bottom: none; +} + +.resultItem:hover, +.resultItemSelected { + background: var(--ifm-color-emphasis-100); +} + +.resultBreadcrumb { + font-size: 0.75rem; + color: var(--ifm-color-emphasis-500); + margin-bottom: 0.25rem; +} + +.resultTitle { + font-size: 0.9375rem; + font-weight: 600; + color: var(--ifm-font-color-base); + margin-bottom: 0.25rem; +} + +.resultTitle mark { + background: var(--ifm-color-primary-lightest); + color: var(--ifm-color-primary-darkest); + padding: 0.125rem 0.25rem; + border-radius: 2px; +} + +.resultContent { + font-size: 0.8125rem; + color: var(--ifm-color-emphasis-600); + line-height: 1.5; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; +} + +.resultContent mark { + background: var(--ifm-color-warning-lightest); + color: var(--ifm-color-warning-darkest); + padding: 0 0.125rem; + border-radius: 2px; +} + +/* Footer */ +.footer { + display: flex; + align-items: center; + justify-content: space-between; + padding: 0.75rem 1rem; + border-top: 1px solid var(--ifm-color-emphasis-200); + background: var(--ifm-color-emphasis-50); +} + +.footerHint { + display: flex; + align-items: center; + gap: 0.5rem; + font-size: 0.75rem; + color: var(--ifm-color-emphasis-500); +} + +.footerHint kbd { + padding: 0.125rem 0.375rem; + font-size: 0.6875rem; + background: var(--ifm-color-emphasis-200); + border: 1px solid var(--ifm-color-emphasis-300); + border-radius: 4px; +} + +.viewAll { + font-size: 0.8125rem; + color: var(--ifm-color-primary); + text-decoration: none; +} + +.viewAll:hover { + text-decoration: underline; +} + +/* Dark mode adjustments */ +[data-theme='dark'] .backdrop { + background: rgba(0, 0, 0, 0.7); +} + +[data-theme='dark'] .categoryFilters { + background: var(--ifm-color-emphasis-100); +} + +[data-theme='dark'] .footer { + background: var(--ifm-color-emphasis-100); +} + +[data-theme='dark'] .resultTitle mark { + background: rgba(0, 204, 163, 0.2); + color: var(--ifm-color-primary-light); +} + +[data-theme='dark'] .resultContent mark { + background: rgba(255, 186, 0, 0.2); + color: var(--ifm-color-warning-light); +} diff --git a/website/src/theme/SearchPage/index.tsx b/website/src/theme/SearchPage/index.tsx new file mode 100644 index 00000000000..d4fbee9b62c --- /dev/null +++ b/website/src/theme/SearchPage/index.tsx @@ -0,0 +1,368 @@ +import React, { useState, useEffect, useCallback } from 'react'; +import Layout from '@theme/Layout'; +import { useLocation, useHistory } from '@docusaurus/router'; +import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; +import { MeiliSearch } from 'meilisearch'; +import { trackSearch, trackSearchResultClick, trackSearchNoResults, trackSearchPageView, trackSearchFilter } from '../../utils/searchAnalytics'; +import styles from './styles.module.css'; + +interface SearchHit { + id: string; + title: string; + content: string; + path: string; + section: string; + category: string; + hierarchy_lvl0: string; + hierarchy_lvl1: string; + hierarchy_lvl2: string; + _formatted?: { + title?: string; + content?: string; + }; +} + +interface SearchResult { + hits: SearchHit[]; + query: string; + processingTimeMs: number; + estimatedTotalHits: number; +} + +const CATEGORIES = [ + { id: 'all', label: 'All Categories', count: 0 }, + { id: 'Smart Contracts', label: 'Smart Contracts', count: 0 }, + { id: 'Web3 Apps', label: 'Web3 Apps', count: 0 }, + { id: 'Protocol', label: 'Protocol', count: 0 }, + { id: 'Tutorials', label: 'Tutorials', count: 0 }, + { id: 'AI', label: 'AI', count: 0 }, + { id: 'Tools', label: 'Tools', count: 0 }, + { id: 'API', label: 'API', count: 0 }, + { id: 'Integrations', label: 'Integrations', count: 0 }, + { id: 'Data Infrastructure', label: 'Data Infrastructure', count: 0 }, + { id: 'Chain Abstraction', label: 'Chain Abstraction', count: 0 }, + { id: 'Primitives', label: 'Primitives', count: 0 }, +]; + +const ITEMS_PER_PAGE = 20; + +export default function SearchPage(): JSX.Element { + const { siteConfig } = useDocusaurusContext(); + const location = useLocation(); + const history = useHistory(); + + const [query, setQuery] = useState(''); + const [results, setResults] = useState([]); + const [loading, setLoading] = useState(false); + const [selectedCategory, setSelectedCategory] = useState('all'); + const [currentPage, setCurrentPage] = useState(1); + const [totalHits, setTotalHits] = useState(0); + const [processingTime, setProcessingTime] = useState(0); + const [client, setClient] = useState(null); + + // Initialize MeiliSearch client + useEffect(() => { + const config = siteConfig.customFields?.meilisearch as { + host?: string; + apiKey?: string; + indexName?: string; + } | undefined; + + if (config?.host) { + const meiliClient = new MeiliSearch({ + host: config.host, + apiKey: config.apiKey || '', + }); + setClient(meiliClient); + } + }, [siteConfig]); + + // Parse URL parameters + useEffect(() => { + const params = new URLSearchParams(location.search); + const q = params.get('q') || ''; + const category = params.get('category') || 'all'; + const page = parseInt(params.get('page') || '1', 10); + + setQuery(q); + setSelectedCategory(category); + setCurrentPage(page); + + if (q) { + trackSearchPageView(q, category); + } + }, [location.search]); + + // Search function + const search = useCallback(async () => { + if (!client || !query.trim()) { + setResults([]); + setTotalHits(0); + return; + } + + const config = siteConfig.customFields?.meilisearch as { indexName?: string } | undefined; + const indexName = config?.indexName || 'near-docs'; + + setLoading(true); + try { + const index = client.index(indexName); + const filter = selectedCategory !== 'all' ? `category = "${selectedCategory}"` : undefined; + + const searchResult: SearchResult = await index.search(query, { + limit: ITEMS_PER_PAGE, + offset: (currentPage - 1) * ITEMS_PER_PAGE, + attributesToHighlight: ['title', 'content'], + highlightPreTag: '', + highlightPostTag: '', + filter, + }); + + setResults(searchResult.hits); + setTotalHits(searchResult.estimatedTotalHits); + setProcessingTime(searchResult.processingTimeMs); + + trackSearch(query, searchResult.hits.length, selectedCategory); + + if (searchResult.hits.length === 0) { + trackSearchNoResults(query); + } + } catch (error) { + console.error('Search error:', error); + setResults([]); + setTotalHits(0); + } finally { + setLoading(false); + } + }, [client, query, selectedCategory, currentPage, siteConfig]); + + // Perform search when parameters change + useEffect(() => { + search(); + }, [search]); + + // Update URL when parameters change + const updateUrl = useCallback((newQuery: string, newCategory: string, newPage: number) => { + const params = new URLSearchParams(); + if (newQuery) params.set('q', newQuery); + if (newCategory !== 'all') params.set('category', newCategory); + if (newPage > 1) params.set('page', newPage.toString()); + + history.push(`/search?${params.toString()}`); + }, [history]); + + // Handle search input + const handleSearch = (e: React.FormEvent) => { + e.preventDefault(); + updateUrl(query, selectedCategory, 1); + }; + + // Handle category change + const handleCategoryChange = (category: string) => { + trackSearchFilter('category', category); + setSelectedCategory(category); + updateUrl(query, category, 1); + }; + + // Handle page change + const handlePageChange = (page: number) => { + setCurrentPage(page); + updateUrl(query, selectedCategory, page); + window.scrollTo({ top: 0, behavior: 'smooth' }); + }; + + // Handle result click + const handleResultClick = (hit: SearchHit, index: number) => { + trackSearchResultClick(query, (currentPage - 1) * ITEMS_PER_PAGE + index, hit.path); + }; + + // Render highlighted content + const renderHighlight = (text: string | undefined, fallback: string) => { + if (!text) return fallback; + return ; + }; + + // Calculate total pages + const totalPages = Math.ceil(totalHits / ITEMS_PER_PAGE); + + return ( + +
+
+

Categories

+
    + {CATEGORIES.map((cat) => ( +
  • + +
  • + ))} +
+
+ +
+
+
+ + + + + setQuery(e.target.value)} + /> + +
+
+ + {query && ( +
+ {loading ? ( + Searching... + ) : ( + + Found {totalHits} result{totalHits !== 1 ? 's' : ''} for "{query}" + {selectedCategory !== 'all' && ` in ${selectedCategory}`} + ({processingTime}ms) + + )} +
+ )} + + {!loading && results.length === 0 && query && ( +
+

No results found

+

We couldn't find any results for "{query}"

+
+

Suggestions:

+
    +
  • Check your spelling
  • +
  • Try different keywords
  • +
  • Try more general terms
  • +
  • Clear category filters
  • +
+
+
+

Popular searches:

+ +
+
+ )} + + {loading && ( +
+
+ Searching... +
+ )} + + + + {totalPages > 1 && ( +
+ + +
+ {Array.from({ length: Math.min(5, totalPages) }, (_, i) => { + let pageNum: number; + if (totalPages <= 5) { + pageNum = i + 1; + } else if (currentPage <= 3) { + pageNum = i + 1; + } else if (currentPage >= totalPages - 2) { + pageNum = totalPages - 4 + i; + } else { + pageNum = currentPage - 2 + i; + } + + return ( + + ); + })} +
+ + +
+ )} +
+
+ + ); +} diff --git a/website/src/theme/SearchPage/styles.module.css b/website/src/theme/SearchPage/styles.module.css new file mode 100644 index 00000000000..c132bd9e50a --- /dev/null +++ b/website/src/theme/SearchPage/styles.module.css @@ -0,0 +1,378 @@ +/* Container */ +.container { + display: flex; + max-width: 1200px; + margin: 0 auto; + padding: 2rem; + gap: 2rem; +} + +/* Sidebar */ +.sidebar { + width: 250px; + flex-shrink: 0; +} + +@media (max-width: 768px) { + .container { + flex-direction: column; + padding: 1rem; + } + + .sidebar { + width: 100%; + } +} + +.sidebarTitle { + font-size: 0.875rem; + font-weight: 600; + text-transform: uppercase; + letter-spacing: 0.05em; + color: var(--ifm-color-emphasis-600); + margin-bottom: 1rem; +} + +.categoryList { + list-style: none; + padding: 0; + margin: 0; +} + +.categoryButton { + display: block; + width: 100%; + padding: 0.5rem 0.75rem; + text-align: left; + background: transparent; + border: none; + border-radius: 6px; + color: var(--ifm-font-color-base); + cursor: pointer; + transition: all 0.15s ease; + font-size: 0.9375rem; +} + +.categoryButton:hover { + background: var(--ifm-color-emphasis-100); +} + +.categoryButtonActive { + background: var(--ifm-color-primary-lightest); + color: var(--ifm-color-primary-darkest); + font-weight: 500; +} + +.categoryButtonActive:hover { + background: var(--ifm-color-primary-lightest); +} + +/* Main Content */ +.main { + flex: 1; + min-width: 0; +} + +/* Search Form */ +.searchForm { + margin-bottom: 1.5rem; +} + +.searchInputWrapper { + display: flex; + align-items: center; + gap: 0.75rem; + padding: 0.75rem 1rem; + background: var(--ifm-color-emphasis-100); + border: 1px solid var(--ifm-color-emphasis-300); + border-radius: 10px; +} + +.searchInputWrapper:focus-within { + border-color: var(--ifm-color-primary); + box-shadow: 0 0 0 3px var(--ifm-color-primary-lightest); +} + +.searchIcon { + flex-shrink: 0; + color: var(--ifm-color-emphasis-500); +} + +.searchInput { + flex: 1; + border: none; + background: transparent; + font-size: 1rem; + color: var(--ifm-font-color-base); + outline: none; +} + +.searchInput::placeholder { + color: var(--ifm-color-emphasis-500); +} + +.searchButton { + padding: 0.5rem 1.25rem; + background: var(--ifm-color-primary); + color: white; + border: none; + border-radius: 6px; + font-weight: 500; + cursor: pointer; + transition: background 0.15s ease; +} + +.searchButton:hover { + background: var(--ifm-color-primary-dark); +} + +/* Results Header */ +.resultsHeader { + padding-bottom: 1rem; + border-bottom: 1px solid var(--ifm-color-emphasis-200); + margin-bottom: 1.5rem; + color: var(--ifm-color-emphasis-700); +} + +.processingTime { + color: var(--ifm-color-emphasis-500); + font-size: 0.875rem; +} + +/* Loading */ +.loading { + display: flex; + align-items: center; + justify-content: center; + gap: 0.75rem; + padding: 3rem; + color: var(--ifm-color-emphasis-600); +} + +.spinner { + width: 24px; + height: 24px; + border: 2px solid var(--ifm-color-emphasis-300); + border-top-color: var(--ifm-color-primary); + border-radius: 50%; + animation: spin 0.6s linear infinite; +} + +@keyframes spin { + to { + transform: rotate(360deg); + } +} + +/* No Results */ +.noResults { + text-align: center; + padding: 3rem 1rem; +} + +.noResults h2 { + color: var(--ifm-font-color-base); + margin-bottom: 0.5rem; +} + +.noResults p { + color: var(--ifm-color-emphasis-600); + margin-bottom: 2rem; +} + +.suggestions { + text-align: left; + max-width: 400px; + margin: 0 auto 2rem; +} + +.suggestions h3 { + font-size: 1rem; + margin-bottom: 0.75rem; +} + +.suggestions ul { + margin: 0; + padding-left: 1.5rem; + color: var(--ifm-color-emphasis-600); +} + +.suggestions li { + margin-bottom: 0.25rem; +} + +.popularSearches { + text-align: left; + max-width: 400px; + margin: 0 auto; +} + +.popularSearches h3 { + font-size: 1rem; + margin-bottom: 0.75rem; +} + +.popularTags { + display: flex; + flex-wrap: wrap; + gap: 0.5rem; +} + +.popularTags a { + padding: 0.375rem 0.75rem; + background: var(--ifm-color-emphasis-100); + border: 1px solid var(--ifm-color-emphasis-300); + border-radius: 9999px; + color: var(--ifm-color-emphasis-700); + font-size: 0.875rem; + text-decoration: none; + transition: all 0.15s ease; +} + +.popularTags a:hover { + background: var(--ifm-color-emphasis-200); + text-decoration: none; +} + +/* Results */ +.results { + display: flex; + flex-direction: column; + gap: 1rem; +} + +.resultItem { + display: block; + padding: 1.25rem; + background: var(--ifm-color-emphasis-50); + border: 1px solid var(--ifm-color-emphasis-200); + border-radius: 10px; + text-decoration: none; + transition: all 0.15s ease; +} + +.resultItem:hover { + background: var(--ifm-color-emphasis-100); + border-color: var(--ifm-color-emphasis-300); + text-decoration: none; +} + +.resultBreadcrumb { + font-size: 0.75rem; + color: var(--ifm-color-emphasis-500); + margin-bottom: 0.5rem; +} + +.resultTitle { + font-size: 1.125rem; + font-weight: 600; + color: var(--ifm-font-color-base); + margin: 0 0 0.5rem 0; +} + +.resultTitle mark { + background: var(--ifm-color-primary-lightest); + color: var(--ifm-color-primary-darkest); + padding: 0.125rem 0.25rem; + border-radius: 2px; +} + +.resultContent { + font-size: 0.9375rem; + color: var(--ifm-color-emphasis-700); + line-height: 1.6; + margin: 0 0 0.75rem 0; +} + +.resultContent mark { + background: var(--ifm-color-warning-lightest); + color: var(--ifm-color-warning-darkest); + padding: 0 0.125rem; + border-radius: 2px; +} + +.resultPath { + font-size: 0.8125rem; + color: var(--ifm-color-primary); +} + +/* Pagination */ +.pagination { + display: flex; + align-items: center; + justify-content: center; + gap: 0.5rem; + margin-top: 2rem; + padding-top: 2rem; + border-top: 1px solid var(--ifm-color-emphasis-200); +} + +.paginationButton { + padding: 0.5rem 1rem; + background: var(--ifm-color-emphasis-100); + border: 1px solid var(--ifm-color-emphasis-300); + border-radius: 6px; + color: var(--ifm-font-color-base); + cursor: pointer; + transition: all 0.15s ease; +} + +.paginationButton:hover:not(:disabled) { + background: var(--ifm-color-emphasis-200); +} + +.paginationButton:disabled { + opacity: 0.5; + cursor: not-allowed; +} + +.paginationPages { + display: flex; + gap: 0.25rem; +} + +.pageButton { + width: 36px; + height: 36px; + display: flex; + align-items: center; + justify-content: center; + background: transparent; + border: 1px solid transparent; + border-radius: 6px; + color: var(--ifm-font-color-base); + cursor: pointer; + transition: all 0.15s ease; +} + +.pageButton:hover { + background: var(--ifm-color-emphasis-100); +} + +.pageButtonActive { + background: var(--ifm-color-primary); + color: white; +} + +.pageButtonActive:hover { + background: var(--ifm-color-primary-dark); +} + +/* Dark mode adjustments */ +[data-theme='dark'] .resultItem { + background: var(--ifm-color-emphasis-100); +} + +[data-theme='dark'] .resultItem:hover { + background: var(--ifm-color-emphasis-200); +} + +[data-theme='dark'] .resultTitle mark { + background: rgba(0, 204, 163, 0.2); + color: var(--ifm-color-primary-light); +} + +[data-theme='dark'] .resultContent mark { + background: rgba(255, 186, 0, 0.2); + color: var(--ifm-color-warning-light); +} diff --git a/website/src/utils/searchAnalytics.ts b/website/src/utils/searchAnalytics.ts new file mode 100644 index 00000000000..3eb02c9679d --- /dev/null +++ b/website/src/utils/searchAnalytics.ts @@ -0,0 +1,67 @@ +import posthog from 'posthog-js'; + +/** + * Track when a search is performed + */ +export function trackSearch(query: string, hitsCount: number, category: string = 'all'): void { + if (typeof window === 'undefined') return; + + posthog.capture('search_performed', { + query, + hits_count: hitsCount, + category, + timestamp: new Date().toISOString(), + }); +} + +/** + * Track when a search result is clicked + */ +export function trackSearchResultClick(query: string, position: number, path: string): void { + if (typeof window === 'undefined') return; + + posthog.capture('search_result_clicked', { + query, + position, + path, + timestamp: new Date().toISOString(), + }); +} + +/** + * Track when a search returns no results + */ +export function trackSearchNoResults(query: string): void { + if (typeof window === 'undefined') return; + + posthog.capture('search_no_results', { + query, + timestamp: new Date().toISOString(), + }); +} + +/** + * Track when user uses a search filter + */ +export function trackSearchFilter(filterType: string, filterValue: string): void { + if (typeof window === 'undefined') return; + + posthog.capture('search_filter_used', { + filter_type: filterType, + filter_value: filterValue, + timestamp: new Date().toISOString(), + }); +} + +/** + * Track search page visits + */ +export function trackSearchPageView(query: string, category: string = 'all'): void { + if (typeof window === 'undefined') return; + + posthog.capture('search_page_viewed', { + query, + category, + timestamp: new Date().toISOString(), + }); +} From 0aedccc0c8bb057551e175dc6c35c34f77b1d632 Mon Sep 17 00:00:00 2001 From: Matias Benary Date: Mon, 26 Jan 2026 15:57:51 -0300 Subject: [PATCH 2/8] chore: clear code --- website/package.json | 1 - website/scripts/index-meilisearch.mjs | 27 +- website/src/theme/Icon/Search/index.tsx | 35 +++ website/src/theme/SearchBar/index.tsx | 250 +++++++----------- website/src/theme/SearchBar/styles.module.css | 68 ++--- website/src/theme/SearchPage/index.tsx | 22 +- website/tsconfig.json | 4 +- 7 files changed, 173 insertions(+), 234 deletions(-) create mode 100644 website/src/theme/Icon/Search/index.tsx diff --git a/website/package.json b/website/package.json index e3216cfa3c0..349e353e362 100644 --- a/website/package.json +++ b/website/package.json @@ -33,7 +33,6 @@ }, "dependencies": { "@docsearch/core": "^4.5.0", - "@headlessui/react": "^1.7.0", "meilisearch": "^0.55.0", "@docusaurus/core": "3.9.2", "@docusaurus/plugin-ideal-image": "3.9.2", diff --git a/website/scripts/index-meilisearch.mjs b/website/scripts/index-meilisearch.mjs index 8b315b030ec..ed41c269d7a 100644 --- a/website/scripts/index-meilisearch.mjs +++ b/website/scripts/index-meilisearch.mjs @@ -1,11 +1,11 @@ +import 'dotenv/config'; import { MeiliSearch } from 'meilisearch'; import fs from 'fs'; import path from 'path'; import { fileURLToPath } from 'url'; import { createHash } from 'crypto'; -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); +const __dirname = path.dirname(fileURLToPath(import.meta.url)); const MEILI_HOST = process.env.MEILI_HOST || 'http://localhost:7700'; const MEILI_MASTER_KEY = process.env.MEILI_MASTER_KEY || 'masterKey123'; @@ -64,14 +64,11 @@ function extractFrontmatter(content) { function extractHeadings(content) { const headings = []; - const headingRegex = /^(#{1,6})\s+(.+)$/gm; + const headingRegex = /^#{1,6}\s+(.+)$/gm; let match; while ((match = headingRegex.exec(content)) !== null) { - headings.push({ - level: match[1].length, - text: match[2].replace(/[*_`]/g, '').trim(), - }); + headings.push(match[1].replace(/[*_`]/g, '').trim()); } return headings; @@ -121,7 +118,7 @@ function getCategoryFromPath(filePath) { return CATEGORY_MAP[firstFolder] || 'General'; } -function getHierarchy(filePath, title) { +function getHierarchy(filePath) { const relativePath = path.relative(DOCS_PATH, filePath); const parts = relativePath.split(path.sep); @@ -239,10 +236,10 @@ async function indexDocuments() { const urlPath = getUrlPath(filePath); const title = frontmatter.title || frontmatter.sidebar_label || - headings[0]?.text || + headings[0] || path.basename(filePath, path.extname(filePath)).replace(/-/g, ' '); - const hierarchy = getHierarchy(filePath, title); + const hierarchy = getHierarchy(filePath); const doc = { id: generateId(urlPath), @@ -250,7 +247,7 @@ async function indexDocuments() { content: cleanedContent.substring(0, 10000), // Limit content size path: urlPath, section: frontmatter.sidebar_label || title, - category: getCategoryFromPath(filePath), + category: hierarchy.lvl0, version: 'current', hierarchy_lvl0: hierarchy.lvl0, hierarchy_lvl1: hierarchy.lvl1, @@ -262,22 +259,22 @@ async function indexDocuments() { // Also index individual headings as separate documents for better search granularity for (const heading of headings.slice(0, 5)) { // Limit to first 5 headings - const anchor = heading.text + const anchor = heading .toLowerCase() .replace(/[^\w\s-]/g, '') .replace(/\s+/g, '-'); const headingDoc = { id: generateId(urlPath + '#' + anchor), - title: heading.text, + title: heading, content: cleanedContent.substring(0, 500), path: urlPath + '#' + anchor, section: title, - category: getCategoryFromPath(filePath), + category: hierarchy.lvl0, version: 'current', hierarchy_lvl0: hierarchy.lvl0, hierarchy_lvl1: hierarchy.lvl1, - hierarchy_lvl2: heading.text, + hierarchy_lvl2: heading, timestamp: Date.now(), }; diff --git a/website/src/theme/Icon/Search/index.tsx b/website/src/theme/Icon/Search/index.tsx new file mode 100644 index 00000000000..58097c91c11 --- /dev/null +++ b/website/src/theme/Icon/Search/index.tsx @@ -0,0 +1,35 @@ +import React from 'react'; + +interface IconProps { + width?: number; + height?: number; + className?: string; +} + +export function SearchIcon({ width = 20, height = 20, className }: IconProps): JSX.Element { + return ( + + + + + ); +} diff --git a/website/src/theme/SearchBar/index.tsx b/website/src/theme/SearchBar/index.tsx index 4a7bc24ce42..5881441e8ab 100644 --- a/website/src/theme/SearchBar/index.tsx +++ b/website/src/theme/SearchBar/index.tsx @@ -1,9 +1,9 @@ -import React, { useState, useEffect, useCallback, useRef, Fragment } from 'react'; +import React, { useState, useEffect, useCallback, useRef } from 'react'; import { useHistory } from '@docusaurus/router'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import { MeiliSearch } from 'meilisearch'; -import { Dialog, Transition } from '@headlessui/react'; import { trackSearch, trackSearchResultClick, trackSearchNoResults } from '../../utils/searchAnalytics'; +import { SearchIcon } from '../Icon/Search'; import styles from './styles.module.css'; interface SearchHit { @@ -176,28 +176,7 @@ export default function SearchBar(): JSX.Element { onClick={() => setIsOpen(true)} aria-label="Search" > - - - - + Search Ctrl @@ -205,145 +184,108 @@ export default function SearchBar(): JSX.Element { - - setIsOpen(false)} - className={styles.dialogOverlay} - > - - - + { + e.preventDefault(); + setIsOpen(false); + history.push(`/search?q=${encodeURIComponent(query)}${selectedCategory !== 'all' ? `&category=${encodeURIComponent(selectedCategory)}` : ''}`); + }} + > + View all results + +
+ )} + + + )} ); } diff --git a/website/src/theme/SearchBar/styles.module.css b/website/src/theme/SearchBar/styles.module.css index b0121cd77ee..7330351ca64 100644 --- a/website/src/theme/SearchBar/styles.module.css +++ b/website/src/theme/SearchBar/styles.module.css @@ -66,31 +66,16 @@ inset: 0; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); + animation: fadeIn 200ms ease-out; } -/* Backdrop Transitions */ -.backdropEnter { - transition: opacity 200ms ease-out; -} - -.backdropEnterFrom { - opacity: 0; -} - -.backdropEnterTo { - opacity: 1; -} - -.backdropLeave { - transition: opacity 150ms ease-in; -} - -.backdropLeaveFrom { - opacity: 1; -} - -.backdropLeaveTo { - opacity: 0; +@keyframes fadeIn { + from { + opacity: 0; + } + to { + opacity: 1; + } } /* Modal */ @@ -103,35 +88,18 @@ border-radius: 12px; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); overflow: hidden; + animation: modalIn 200ms ease-out; } -/* Modal Transitions */ -.modalEnter { - transition: all 200ms ease-out; -} - -.modalEnterFrom { - opacity: 0; - transform: scale(0.95) translateY(-20px); -} - -.modalEnterTo { - opacity: 1; - transform: scale(1) translateY(0); -} - -.modalLeave { - transition: all 150ms ease-in; -} - -.modalLeaveFrom { - opacity: 1; - transform: scale(1) translateY(0); -} - -.modalLeaveTo { - opacity: 0; - transform: scale(0.95) translateY(-20px); +@keyframes modalIn { + from { + opacity: 0; + transform: scale(0.95) translateY(-20px); + } + to { + opacity: 1; + transform: scale(1) translateY(0); + } } /* Search Header */ diff --git a/website/src/theme/SearchPage/index.tsx b/website/src/theme/SearchPage/index.tsx index d4fbee9b62c..54987c0c483 100644 --- a/website/src/theme/SearchPage/index.tsx +++ b/website/src/theme/SearchPage/index.tsx @@ -1,5 +1,6 @@ import React, { useState, useEffect, useCallback } from 'react'; import Layout from '@theme/Layout'; +import Head from '@docusaurus/Head'; import { useLocation, useHistory } from '@docusaurus/router'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import { MeiliSearch } from 'meilisearch'; @@ -60,7 +61,6 @@ export default function SearchPage(): JSX.Element { const [processingTime, setProcessingTime] = useState(0); const [client, setClient] = useState(null); - // Initialize MeiliSearch client useEffect(() => { const config = siteConfig.customFields?.meilisearch as { host?: string; @@ -77,7 +77,6 @@ export default function SearchPage(): JSX.Element { } }, [siteConfig]); - // Parse URL parameters useEffect(() => { const params = new URLSearchParams(location.search); const q = params.get('q') || ''; @@ -93,7 +92,6 @@ export default function SearchPage(): JSX.Element { } }, [location.search]); - // Search function const search = useCallback(async () => { if (!client || !query.trim()) { setResults([]); @@ -136,12 +134,10 @@ export default function SearchPage(): JSX.Element { } }, [client, query, selectedCategory, currentPage, siteConfig]); - // Perform search when parameters change useEffect(() => { search(); }, [search]); - // Update URL when parameters change const updateUrl = useCallback((newQuery: string, newCategory: string, newPage: number) => { const params = new URLSearchParams(); if (newQuery) params.set('q', newQuery); @@ -151,43 +147,43 @@ export default function SearchPage(): JSX.Element { history.push(`/search?${params.toString()}`); }, [history]); - // Handle search input const handleSearch = (e: React.FormEvent) => { e.preventDefault(); updateUrl(query, selectedCategory, 1); }; - // Handle category change const handleCategoryChange = (category: string) => { trackSearchFilter('category', category); setSelectedCategory(category); updateUrl(query, category, 1); }; - // Handle page change const handlePageChange = (page: number) => { setCurrentPage(page); updateUrl(query, selectedCategory, page); window.scrollTo({ top: 0, behavior: 'smooth' }); }; - // Handle result click const handleResultClick = (hit: SearchHit, index: number) => { trackSearchResultClick(query, (currentPage - 1) * ITEMS_PER_PAGE + index, hit.path); }; - // Render highlighted content const renderHighlight = (text: string | undefined, fallback: string) => { if (!text) return fallback; return ; }; - // Calculate total pages const totalPages = Math.ceil(totalHits / ITEMS_PER_PAGE); return ( - -
+ // @ts-expect-error - Docusaurus types have React version mismatch + + {/* @ts-expect-error - Docusaurus types have React version mismatch */} + + Search | NEAR Documentation + + +

Categories

    diff --git a/website/tsconfig.json b/website/tsconfig.json index c71b8a2d2cf..812905084b9 100644 --- a/website/tsconfig.json +++ b/website/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { "allowSyntheticDefaultImports": true, + "baseUrl": ".", "jsx": "react", "module": "es2015", "moduleResolution": "node", @@ -12,6 +13,7 @@ "resolveJsonModule": true, "skipLibCheck": true, "strict": true, - "target": "ESNEXT" + "target": "ESNEXT", + "types": ["@docusaurus/module-type-aliases", "@docusaurus/types"] } } \ No newline at end of file From a84af87c7d60f56c38262bd04e3f5993ed802890 Mon Sep 17 00:00:00 2001 From: Matias Benary Date: Mon, 26 Jan 2026 16:15:31 -0300 Subject: [PATCH 3/8] chore: remove mcp --- website/mcp-meilisearch/index.mjs | 203 ---- website/mcp-meilisearch/package-lock.json | 1137 --------------------- website/mcp-meilisearch/package.json | 18 - 3 files changed, 1358 deletions(-) delete mode 100644 website/mcp-meilisearch/index.mjs delete mode 100644 website/mcp-meilisearch/package-lock.json delete mode 100644 website/mcp-meilisearch/package.json diff --git a/website/mcp-meilisearch/index.mjs b/website/mcp-meilisearch/index.mjs deleted file mode 100644 index 5dbd75385d9..00000000000 --- a/website/mcp-meilisearch/index.mjs +++ /dev/null @@ -1,203 +0,0 @@ -#!/usr/bin/env node - -import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; -import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'; -import { MeiliSearch } from 'meilisearch'; -import { z } from 'zod'; - -const MEILI_HOST = process.env.MEILI_HOST || 'http://localhost:7700'; -const MEILI_API_KEY = process.env.MEILI_API_KEY || process.env.MEILI_MASTER_KEY || 'masterKey123'; -const MEILI_INDEX_NAME = process.env.MEILI_INDEX_NAME || 'near-docs'; - - -const client = new MeiliSearch({ - host: MEILI_HOST, - apiKey: MEILI_API_KEY, -}); - -const server = new McpServer({ - name: 'mcp-meilisearch', - version: '1.0.0', -}); - -server.registerTool( - 'search_near_docs', - { - description: 'Search the NEAR Protocol documentation. Use this to find information about NEAR blockchain, smart contracts, web3 apps, wallets, transactions, gas, accounts, and more.', - inputSchema: { - query: z.string().describe('The search query (e.g., "smart contract", "gas fees", "wallet integration")'), - category: z.string().optional().describe('Optional category filter: Smart Contracts, Web3 Apps, Protocol, Tutorials, AI, Tools, API, Integrations, Data Infrastructure, Chain Abstraction, Primitives'), - limit: z.number().optional().default(5).describe('Maximum number of results (default: 5, max: 20)'), - }, - }, - async ({ query, category, limit = 5 }) => { - try { - const index = client.index(MEILI_INDEX_NAME); - - const searchParams = { - limit: Math.min(limit, 20), - attributesToRetrieve: ['title', 'content', 'path', 'category', 'hierarchy_lvl0', 'hierarchy_lvl1'], - attributesToHighlight: ['title', 'content'], - highlightPreTag: '**', - highlightPostTag: '**', - }; - - if (category) { - searchParams.filter = `category = "${category}"`; - } - - const results = await index.search(query, searchParams); - - if (results.hits.length === 0) { - return { - content: [ - { - type: 'text', - text: `No results found for "${query}"${category ? ` in category "${category}"` : ''}. Try different keywords or remove the category filter.`, - }, - ], - }; - } - - const formattedResults = results.hits.map((hit, i) => { - const breadcrumb = [hit.hierarchy_lvl0, hit.hierarchy_lvl1].filter(Boolean).join(' > '); - const content = hit._formatted?.content?.substring(0, 300) || hit.content?.substring(0, 300); - - return `## ${i + 1}. ${hit._formatted?.title || hit.title} - -**Category:** ${hit.category} -**Path:** ${hit.path} -**Breadcrumb:** ${breadcrumb} - -${content}... - ----`; - }).join('\n\n'); - - return { - content: [ - { - type: 'text', - text: `Found ${results.estimatedTotalHits} results for "${query}" (showing ${results.hits.length}):\n\n${formattedResults}`, - }, - ], - }; - } catch (error) { - return { - content: [ - { - type: 'text', - text: `Error searching: ${error.message}`, - }, - ], - isError: true, - }; - } - } -); - -server.registerTool( - 'get_doc_content', - { - description: 'Get the full content of a specific documentation page by its path', - inputSchema: { - path: z.string().describe('The document path (e.g., "/smart-contracts/what-is")'), - }, - }, - async ({ path }) => { - try { - const index = client.index(MEILI_INDEX_NAME); - - const results = await index.search('', { - filter: `path = "${path}"`, - limit: 1, - attributesToRetrieve: ['title', 'content', 'path', 'category', 'hierarchy_lvl0', 'hierarchy_lvl1', 'hierarchy_lvl2'], - }); - - if (results.hits.length === 0) { - return { - content: [ - { - type: 'text', - text: `Document not found at path: ${path}`, - }, - ], - }; - } - - const doc = results.hits[0]; - const breadcrumb = [doc.hierarchy_lvl0, doc.hierarchy_lvl1, doc.hierarchy_lvl2].filter(Boolean).join(' > '); - - return { - content: [ - { - type: 'text', - text: `# ${doc.title} - -**Category:** ${doc.category} -**Path:** ${doc.path} -**Breadcrumb:** ${breadcrumb} - ---- - -${doc.content}`, - }, - ], - }; - } catch (error) { - return { - content: [ - { - type: 'text', - text: `Error: ${error.message}`, - }, - ], - isError: true, - }; - } - } -); - -server.registerTool( - 'list_doc_categories', - { - description: 'List all available documentation categories', - inputSchema: {}, - }, - async () => { - const categories = [ - 'Smart Contracts - Build and deploy smart contracts on NEAR', - 'Web3 Apps - Create decentralized applications', - 'Protocol - Core NEAR Protocol concepts (accounts, transactions, gas)', - 'Tutorials - Step-by-step guides and examples', - 'AI - AI agents and tools on NEAR', - 'Tools - CLI, SDKs, and developer tools', - 'API - RPC API reference', - 'Integrations - Exchange and wallet integrations', - 'Data Infrastructure - Indexers and data tools', - 'Chain Abstraction - Cross-chain functionality', - 'Primitives - NFTs, FTs, DAOs', - ]; - - return { - content: [ - { - type: 'text', - text: `Available documentation categories:\n\n${categories.map(c => `- ${c}`).join('\n')}`, - }, - ], - }; - } -); - - -async function main() { - const transport = new StdioServerTransport(); - await server.connect(transport); - console.error('MeiliSearch MCP server running on stdio'); -} - -main().catch((error) => { - console.error('Fatal error:', error); - process.exit(1); -}); diff --git a/website/mcp-meilisearch/package-lock.json b/website/mcp-meilisearch/package-lock.json deleted file mode 100644 index b8f1f00925f..00000000000 --- a/website/mcp-meilisearch/package-lock.json +++ /dev/null @@ -1,1137 +0,0 @@ -{ - "name": "mcp-meilisearch", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "mcp-meilisearch", - "version": "1.0.0", - "dependencies": { - "@modelcontextprotocol/sdk": "^1.25.3", - "meilisearch": "^0.55.0", - "zod": "^3.24.0" - }, - "bin": { - "mcp-meilisearch": "index.mjs" - } - }, - "node_modules/@hono/node-server": { - "version": "1.19.9", - "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-1.19.9.tgz", - "integrity": "sha512-vHL6w3ecZsky+8P5MD+eFfaGTyCeOHUIFYMGpQGbrBTSmNNoxv0if69rEZ5giu36weC5saFuznL411gRX7bJDw==", - "license": "MIT", - "engines": { - "node": ">=18.14.1" - }, - "peerDependencies": { - "hono": "^4" - } - }, - "node_modules/@modelcontextprotocol/sdk": { - "version": "1.25.3", - "resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.25.3.tgz", - "integrity": "sha512-vsAMBMERybvYgKbg/l4L1rhS7VXV1c0CtyJg72vwxONVX0l4ZfKVAnZEWTQixJGTzKnELjQ59e4NbdFDALRiAQ==", - "license": "MIT", - "dependencies": { - "@hono/node-server": "^1.19.9", - "ajv": "^8.17.1", - "ajv-formats": "^3.0.1", - "content-type": "^1.0.5", - "cors": "^2.8.5", - "cross-spawn": "^7.0.5", - "eventsource": "^3.0.2", - "eventsource-parser": "^3.0.0", - "express": "^5.0.1", - "express-rate-limit": "^7.5.0", - "jose": "^6.1.1", - "json-schema-typed": "^8.0.2", - "pkce-challenge": "^5.0.0", - "raw-body": "^3.0.0", - "zod": "^3.25 || ^4.0", - "zod-to-json-schema": "^3.25.0" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "@cfworker/json-schema": "^4.1.1", - "zod": "^3.25 || ^4.0" - }, - "peerDependenciesMeta": { - "@cfworker/json-schema": { - "optional": true - }, - "zod": { - "optional": false - } - } - }, - "node_modules/accepts": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", - "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", - "license": "MIT", - "dependencies": { - "mime-types": "^3.0.0", - "negotiator": "^1.0.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/ajv-formats": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-3.0.1.tgz", - "integrity": "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==", - "license": "MIT", - "dependencies": { - "ajv": "^8.0.0" - }, - "peerDependencies": { - "ajv": "^8.0.0" - }, - "peerDependenciesMeta": { - "ajv": { - "optional": true - } - } - }, - "node_modules/body-parser": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.2.tgz", - "integrity": "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA==", - "license": "MIT", - "dependencies": { - "bytes": "^3.1.2", - "content-type": "^1.0.5", - "debug": "^4.4.3", - "http-errors": "^2.0.0", - "iconv-lite": "^0.7.0", - "on-finished": "^2.4.1", - "qs": "^6.14.1", - "raw-body": "^3.0.1", - "type-is": "^2.0.1" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/bytes": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", - "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/call-bind-apply-helpers": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", - "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0", - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/call-bound": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", - "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", - "license": "MIT", - "dependencies": { - "call-bind-apply-helpers": "^1.0.2", - "get-intrinsic": "^1.3.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/content-disposition": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.1.tgz", - "integrity": "sha512-oIXISMynqSqm241k6kcQ5UwttDILMK4BiurCfGEREw6+X9jkkpEe5T9FZaApyLGGOnFuyMWZpdolTXMtvEJ08Q==", - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/content-type": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", - "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/cookie": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", - "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/cookie-signature": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", - "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", - "license": "MIT", - "engines": { - "node": ">=6.6.0" - } - }, - "node_modules/cors": { - "version": "2.8.6", - "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.6.tgz", - "integrity": "sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==", - "license": "MIT", - "dependencies": { - "object-assign": "^4", - "vary": "^1" - }, - "engines": { - "node": ">= 0.10" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/cross-spawn": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", - "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", - "license": "MIT", - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/debug": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", - "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/dunder-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", - "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", - "license": "MIT", - "dependencies": { - "call-bind-apply-helpers": "^1.0.1", - "es-errors": "^1.3.0", - "gopd": "^1.2.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", - "license": "MIT" - }, - "node_modules/encodeurl": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", - "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/es-define-property": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", - "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-errors": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", - "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-object-atoms": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", - "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", - "license": "MIT" - }, - "node_modules/etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/eventsource": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-3.0.7.tgz", - "integrity": "sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==", - "license": "MIT", - "dependencies": { - "eventsource-parser": "^3.0.1" - }, - "engines": { - "node": ">=18.0.0" - } - }, - "node_modules/eventsource-parser": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/eventsource-parser/-/eventsource-parser-3.0.6.tgz", - "integrity": "sha512-Vo1ab+QXPzZ4tCa8SwIHJFaSzy4R6SHf7BY79rFBDf0idraZWAkYrDjDj8uWaSm3S2TK+hJ7/t1CEmZ7jXw+pg==", - "license": "MIT", - "engines": { - "node": ">=18.0.0" - } - }, - "node_modules/express": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz", - "integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==", - "license": "MIT", - "dependencies": { - "accepts": "^2.0.0", - "body-parser": "^2.2.1", - "content-disposition": "^1.0.0", - "content-type": "^1.0.5", - "cookie": "^0.7.1", - "cookie-signature": "^1.2.1", - "debug": "^4.4.0", - "depd": "^2.0.0", - "encodeurl": "^2.0.0", - "escape-html": "^1.0.3", - "etag": "^1.8.1", - "finalhandler": "^2.1.0", - "fresh": "^2.0.0", - "http-errors": "^2.0.0", - "merge-descriptors": "^2.0.0", - "mime-types": "^3.0.0", - "on-finished": "^2.4.1", - "once": "^1.4.0", - "parseurl": "^1.3.3", - "proxy-addr": "^2.0.7", - "qs": "^6.14.0", - "range-parser": "^1.2.1", - "router": "^2.2.0", - "send": "^1.1.0", - "serve-static": "^2.2.0", - "statuses": "^2.0.1", - "type-is": "^2.0.1", - "vary": "^1.1.2" - }, - "engines": { - "node": ">= 18" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/express-rate-limit": { - "version": "7.5.1", - "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-7.5.1.tgz", - "integrity": "sha512-7iN8iPMDzOMHPUYllBEsQdWVB6fPDMPqwjBaFrgr4Jgr/+okjvzAy+UHlYYL/Vs0OsOrMkwS6PJDkFlJwoxUnw==", - "license": "MIT", - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://github.com/sponsors/express-rate-limit" - }, - "peerDependencies": { - "express": ">= 4.11" - } - }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "license": "MIT" - }, - "node_modules/fast-uri": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz", - "integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/fastify" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/fastify" - } - ], - "license": "BSD-3-Clause" - }, - "node_modules/finalhandler": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz", - "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==", - "license": "MIT", - "dependencies": { - "debug": "^4.4.0", - "encodeurl": "^2.0.0", - "escape-html": "^1.0.3", - "on-finished": "^2.4.1", - "parseurl": "^1.3.3", - "statuses": "^2.0.1" - }, - "engines": { - "node": ">= 18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/forwarded": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", - "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/fresh": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", - "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-intrinsic": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", - "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", - "license": "MIT", - "dependencies": { - "call-bind-apply-helpers": "^1.0.2", - "es-define-property": "^1.0.1", - "es-errors": "^1.3.0", - "es-object-atoms": "^1.1.1", - "function-bind": "^1.1.2", - "get-proto": "^1.0.1", - "gopd": "^1.2.0", - "has-symbols": "^1.1.0", - "hasown": "^2.0.2", - "math-intrinsics": "^1.1.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", - "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", - "license": "MIT", - "dependencies": { - "dunder-proto": "^1.0.1", - "es-object-atoms": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/gopd": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", - "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-symbols": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", - "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/hasown": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", - "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", - "license": "MIT", - "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/hono": { - "version": "4.11.5", - "resolved": "https://registry.npmjs.org/hono/-/hono-4.11.5.tgz", - "integrity": "sha512-WemPi9/WfyMwZs+ZUXdiwcCh9Y+m7L+8vki9MzDw3jJ+W9Lc+12HGsd368Qc1vZi1xwW8BWMMsnK5efYKPdt4g==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">=16.9.0" - } - }, - "node_modules/http-errors": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", - "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", - "license": "MIT", - "dependencies": { - "depd": "~2.0.0", - "inherits": "~2.0.4", - "setprototypeof": "~1.2.0", - "statuses": "~2.0.2", - "toidentifier": "~1.0.1" - }, - "engines": { - "node": ">= 0.8" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/iconv-lite": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz", - "integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==", - "license": "MIT", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - }, - "engines": { - "node": ">=0.10.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "license": "ISC" - }, - "node_modules/ipaddr.js": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", - "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", - "license": "MIT", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/is-promise": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", - "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", - "license": "MIT" - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "license": "ISC" - }, - "node_modules/jose": { - "version": "6.1.3", - "resolved": "https://registry.npmjs.org/jose/-/jose-6.1.3.tgz", - "integrity": "sha512-0TpaTfihd4QMNwrz/ob2Bp7X04yuxJkjRGi4aKmOqwhov54i6u79oCv7T+C7lo70MKH6BesI3vscD1yb/yzKXQ==", - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/panva" - } - }, - "node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "license": "MIT" - }, - "node_modules/json-schema-typed": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/json-schema-typed/-/json-schema-typed-8.0.2.tgz", - "integrity": "sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA==", - "license": "BSD-2-Clause" - }, - "node_modules/math-intrinsics": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", - "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/media-typer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", - "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/meilisearch": { - "version": "0.55.0", - "resolved": "https://registry.npmjs.org/meilisearch/-/meilisearch-0.55.0.tgz", - "integrity": "sha512-qSMeiezfDgIqciIeYzh5E4pXDZZD7CtHeWDCs43kN3trLgl5FtfmBAIkljL3huFaOx08feYtC8FfIFUpVwq6rg==", - "license": "MIT" - }, - "node_modules/merge-descriptors": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", - "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/mime-db": { - "version": "1.54.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", - "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", - "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", - "license": "MIT", - "dependencies": { - "mime-db": "^1.54.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "license": "MIT" - }, - "node_modules/negotiator": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", - "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-inspect": { - "version": "1.13.4", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", - "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/on-finished": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", - "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", - "license": "MIT", - "dependencies": { - "ee-first": "1.1.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "license": "ISC", - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/path-to-regexp": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz", - "integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==", - "license": "MIT", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/pkce-challenge": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-5.0.1.tgz", - "integrity": "sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ==", - "license": "MIT", - "engines": { - "node": ">=16.20.0" - } - }, - "node_modules/proxy-addr": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", - "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", - "license": "MIT", - "dependencies": { - "forwarded": "0.2.0", - "ipaddr.js": "1.9.1" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/qs": { - "version": "6.14.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.1.tgz", - "integrity": "sha512-4EK3+xJl8Ts67nLYNwqw/dsFVnCf+qR7RgXSK9jEEm9unao3njwMDdmsdvoKBKHzxd7tCYz5e5M+SnMjdtXGQQ==", - "license": "BSD-3-Clause", - "dependencies": { - "side-channel": "^1.1.0" - }, - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/range-parser": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/raw-body": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz", - "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==", - "license": "MIT", - "dependencies": { - "bytes": "~3.1.2", - "http-errors": "~2.0.1", - "iconv-lite": "~0.7.0", - "unpipe": "~1.0.0" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/router": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", - "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", - "license": "MIT", - "dependencies": { - "debug": "^4.4.0", - "depd": "^2.0.0", - "is-promise": "^4.0.0", - "parseurl": "^1.3.3", - "path-to-regexp": "^8.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "license": "MIT" - }, - "node_modules/send": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz", - "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==", - "license": "MIT", - "dependencies": { - "debug": "^4.4.3", - "encodeurl": "^2.0.0", - "escape-html": "^1.0.3", - "etag": "^1.8.1", - "fresh": "^2.0.0", - "http-errors": "^2.0.1", - "mime-types": "^3.0.2", - "ms": "^2.1.3", - "on-finished": "^2.4.1", - "range-parser": "^1.2.1", - "statuses": "^2.0.2" - }, - "engines": { - "node": ">= 18" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/serve-static": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz", - "integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==", - "license": "MIT", - "dependencies": { - "encodeurl": "^2.0.0", - "escape-html": "^1.0.3", - "parseurl": "^1.3.3", - "send": "^1.2.0" - }, - "engines": { - "node": ">= 18" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, - "node_modules/setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", - "license": "ISC" - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "license": "MIT", - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/side-channel": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", - "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0", - "object-inspect": "^1.13.3", - "side-channel-list": "^1.0.0", - "side-channel-map": "^1.0.1", - "side-channel-weakmap": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/side-channel-list": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", - "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0", - "object-inspect": "^1.13.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/side-channel-map": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", - "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", - "license": "MIT", - "dependencies": { - "call-bound": "^1.0.2", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.5", - "object-inspect": "^1.13.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/side-channel-weakmap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", - "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", - "license": "MIT", - "dependencies": { - "call-bound": "^1.0.2", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.5", - "object-inspect": "^1.13.3", - "side-channel-map": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/statuses": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", - "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/toidentifier": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", - "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", - "license": "MIT", - "engines": { - "node": ">=0.6" - } - }, - "node_modules/type-is": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz", - "integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==", - "license": "MIT", - "dependencies": { - "content-type": "^1.0.5", - "media-typer": "^1.1.0", - "mime-types": "^3.0.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "license": "ISC" - }, - "node_modules/zod": { - "version": "3.25.76", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", - "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/colinhacks" - } - }, - "node_modules/zod-to-json-schema": { - "version": "3.25.1", - "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.25.1.tgz", - "integrity": "sha512-pM/SU9d3YAggzi6MtR4h7ruuQlqKtad8e9S0fmxcMi+ueAK5Korys/aWcV9LIIHTVbj01NdzxcnXSN+O74ZIVA==", - "license": "ISC", - "peerDependencies": { - "zod": "^3.25 || ^4" - } - } - } -} diff --git a/website/mcp-meilisearch/package.json b/website/mcp-meilisearch/package.json deleted file mode 100644 index 614cf7c6b50..00000000000 --- a/website/mcp-meilisearch/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "mcp-meilisearch", - "version": "1.0.0", - "description": "MCP server for searching NEAR documentation with MeiliSearch", - "type": "module", - "main": "index.mjs", - "bin": { - "mcp-meilisearch": "./index.mjs" - }, - "scripts": { - "start": "node index.mjs" - }, - "dependencies": { - "@modelcontextprotocol/sdk": "^1.25.3", - "meilisearch": "^0.55.0", - "zod": "^3.24.0" - } -} From 7e9d83321d62a5371c83d2894580d5caecd959a0 Mon Sep 17 00:00:00 2001 From: Matias Benary Date: Mon, 26 Jan 2026 16:21:42 -0300 Subject: [PATCH 4/8] feat: add github actions --- .github/workflows/index-meilisearch.yml | 35 +++++++++++++++++++++++++ .mcp.json | 14 ---------- 2 files changed, 35 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/index-meilisearch.yml delete mode 100644 .mcp.json diff --git a/.github/workflows/index-meilisearch.yml b/.github/workflows/index-meilisearch.yml new file mode 100644 index 00000000000..70361625edb --- /dev/null +++ b/.github/workflows/index-meilisearch.yml @@ -0,0 +1,35 @@ +name: index-meilisearch + +on: + push: + branches: + - master + workflow_dispatch: + +jobs: + index-meilisearch: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "22" + - uses: actions/cache@v4 + with: + path: | + ${{ github.workspace }}/**/.cache + ${{ github.workspace }}/website/node_modules + key: | + ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Install dependencies + run: cd website && yarn + + - name: Index to MeiliSearch + run: cd website && yarn run index:meilisearch + env: + MEILI_HOST: ${{ secrets.MEILI_HOST }} + MEILI_MASTER_KEY: ${{ secrets.MEILI_MASTER_KEY }} + MEILI_INDEX_NAME: ${{ secrets.MEILI_INDEX_NAME }} diff --git a/.mcp.json b/.mcp.json deleted file mode 100644 index cdfcb06f4df..00000000000 --- a/.mcp.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "mcpServers": { - "near-docs": { - "type": "stdio", - "command": "node", - "args": ["/home/matiasbenary/projects/near/docs/website/mcp-meilisearch/index.mjs"], - "env": { - "MEILI_HOST": "http://localhost:7700", - "MEILI_API_KEY": "masterKey123", - "MEILI_INDEX_NAME": "near-docs" - } - } - } -} From 5657fbf67392b656e01225aea684bf584e088879 Mon Sep 17 00:00:00 2001 From: Matias Benary Date: Tue, 27 Jan 2026 16:33:09 -0300 Subject: [PATCH 5/8] feat: add embeddings --- website/scripts/index-meilisearch.mjs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/website/scripts/index-meilisearch.mjs b/website/scripts/index-meilisearch.mjs index ed41c269d7a..e3ef75a794b 100644 --- a/website/scripts/index-meilisearch.mjs +++ b/website/scripts/index-meilisearch.mjs @@ -12,6 +12,7 @@ const MEILI_MASTER_KEY = process.env.MEILI_MASTER_KEY || 'masterKey123'; const MEILI_INDEX_NAME = process.env.MEILI_INDEX_NAME || 'near-docs'; const DOCS_PATH = path.resolve(__dirname, '../../docs'); const BATCH_SIZE = 100; +const TASK_TIMEOUT = 300000; // 5 minutes timeout for tasks with embedders const CATEGORY_MAP = { 'smart-contracts': 'Smart Contracts', @@ -52,7 +53,7 @@ function extractFrontmatter(content) { let value = line.slice(colonIndex + 1).trim(); // Remove quotes if present if ((value.startsWith('"') && value.endsWith('"')) || - (value.startsWith("'") && value.endsWith("'"))) { + (value.startsWith("'") && value.endsWith("'"))) { value = value.slice(1, -1); } frontmatter[key] = value; @@ -202,7 +203,7 @@ async function indexDocuments() { console.log('Creating new index:', MEILI_INDEX_NAME); const task = await client.createIndex(MEILI_INDEX_NAME, { primaryKey: 'id' }); // Wait for index creation to complete - await client.tasks.waitForTask(task.taskUid); + await client.tasks.waitForTask(task.taskUid, { timeout: TASK_TIMEOUT }); index = client.index(MEILI_INDEX_NAME); } @@ -214,6 +215,13 @@ async function indexDocuments() { sortableAttributes: ['timestamp'], rankingRules: ['words', 'typo', 'proximity', 'attribute', 'sort', 'exactness'], distinctAttribute: 'path', + embedders: { + default: { + source: 'huggingFace', + model: 'sentence-transformers/all-MiniLM-L6-v2', + documentTemplate: '{{doc.title}} {{doc.content}}', + }, + }, }); // Get all markdown files @@ -290,7 +298,7 @@ async function indexDocuments() { // Delete all existing documents console.log('Clearing existing documents...'); const deleteTask = await index.deleteAllDocuments(); - await client.tasks.waitForTask(deleteTask.taskUid); + await client.tasks.waitForTask(deleteTask.taskUid, { timeout: TASK_TIMEOUT }); // Upload documents in batches console.log('Uploading documents...'); @@ -302,10 +310,10 @@ async function indexDocuments() { console.log(`Uploaded batch ${Math.floor(i / BATCH_SIZE) + 1}/${Math.ceil(documents.length / BATCH_SIZE)} (Task: ${task.taskUid})`); } - // Wait for all indexing tasks to complete - console.log('Waiting for indexing to complete...'); + // Wait for all indexing tasks to complete (takes longer with embedders) + console.log('Waiting for indexing to complete (this may take a few minutes with embedders)...'); for (const taskUid of uploadTasks) { - await client.tasks.waitForTask(taskUid); + await client.tasks.waitForTask(taskUid, { timeout: TASK_TIMEOUT }); } // Get final stats From b0e15664ef8736294f0dd4925932e2af63a6bdc2 Mon Sep 17 00:00:00 2001 From: Guillermo Alejandro Gallardo Diez Date: Thu, 5 Feb 2026 17:09:47 +0100 Subject: [PATCH 6/8] chore: review and improve searchbar --- website/package.json | 4 +- website/scripts/index-meilisearch.mjs | 86 ++-- website/src/pages/search.tsx | 6 - website/src/theme/SearchBar/index.tsx | 28 +- website/src/theme/SearchBar/styles.module.css | 11 +- website/src/theme/SearchPage/index.tsx | 364 ----------------- .../src/theme/SearchPage/styles.module.css | 378 ------------------ 7 files changed, 58 insertions(+), 819 deletions(-) delete mode 100644 website/src/pages/search.tsx delete mode 100644 website/src/theme/SearchPage/index.tsx delete mode 100644 website/src/theme/SearchPage/styles.module.css diff --git a/website/package.json b/website/package.json index 008843744e8..c357a03dbf6 100644 --- a/website/package.json +++ b/website/package.json @@ -16,7 +16,7 @@ "build:dev": "./node_modules/.bin/docusaurus build --dev && yarn run process-markdown", "build:preview": "yarn run process-markdown && ./node_modules/.bin/docusaurus build --locale en && yarn run process-markdown", "process-markdown": "node ./scripts/copy-md-to-static.js", - "index:meilisearch": "node scripts/index-meilisearch.mjs", + "meilisearch:build-index": "node scripts/index-meilisearch.mjs", "swizzle": "docusaurus swizzle", "docusaurus": "docusaurus" }, @@ -33,7 +33,6 @@ }, "dependencies": { "@docsearch/core": "^4.5.0", - "meilisearch": "^0.55.0", "@docusaurus/core": "3.9.2", "@docusaurus/plugin-ideal-image": "3.9.2", "@docusaurus/plugin-sitemap": "3.9.2", @@ -51,6 +50,7 @@ "gleap": "^13.7.3", "lodash": "^4.17.21", "lucide-react": "^0.555.0", + "meilisearch": "^0.55.0", "monaco-editor": "^0.55.1", "near-api-js": "^7.0.0", "near-connect-hooks": "^1.0.2", diff --git a/website/scripts/index-meilisearch.mjs b/website/scripts/index-meilisearch.mjs index e3ef75a794b..70dfe493869 100644 --- a/website/scripts/index-meilisearch.mjs +++ b/website/scripts/index-meilisearch.mjs @@ -15,19 +15,15 @@ const BATCH_SIZE = 100; const TASK_TIMEOUT = 300000; // 5 minutes timeout for tasks with embedders const CATEGORY_MAP = { + 'protocol': 'Protocol', + 'chain-abstraction': 'Multi-Chain', + 'ai': 'AI & Agents', 'smart-contracts': 'Smart Contracts', 'web3-apps': 'Web3 Apps', - 'protocol': 'Protocol', - 'tools': 'Tools', - 'api': 'API', - 'tutorials': 'Tutorials', 'primitives': 'Primitives', - 'chain-abstraction': 'Chain Abstraction', - 'integrations': 'Integrations', 'data-infrastructure': 'Data Infrastructure', - 'ai': 'AI', - 'aurora': 'Aurora', - 'quest': 'Quest', + 'tools': 'Tools', + 'api': 'API', }; function generateId(content) { @@ -96,19 +92,40 @@ function cleanContent(content) { .trim(); } -function getUrlPath(filePath) { - const relativePath = path.relative(DOCS_PATH, filePath); - let urlPath = relativePath - .replace(/\.mdx?$/, '') - .replace(/\\/g, '/'); - - // Handle index files - if (urlPath.endsWith('/index')) { - urlPath = urlPath.slice(0, -6); +function getUrlPath(filePath, frontmatter = {}) { + // If slug is explicitly set in frontmatter, use it directly + if (frontmatter.slug) { + const slug = frontmatter.slug.startsWith('/') ? frontmatter.slug : '/' + frontmatter.slug; + return slug; } - // Handle files with numeric prefixes (e.g., 0-intro.md -> intro) - urlPath = urlPath.replace(/\/\d+-/g, '/').replace(/^\d+-/, ''); + const relativePath = path.relative(DOCS_PATH, filePath); + const pathParts = relativePath.replace(/\\/g, '/').split('/'); + const fileName = pathParts.pop().replace(/\.mdx?$/, ''); + + // Get document ID: from frontmatter.id, or filename (without numeric prefix) + const docId = frontmatter.id || fileName.replace(/^\d+-/, ''); + + // Remove numeric prefixes from path parts + const cleanPathParts = pathParts.map(part => part.replace(/^\d+-/, '')); + + // Build the URL path + let urlPath; + + if (docId === 'index') { + // index files: /path/path/index -> /path/path + urlPath = cleanPathParts.join('/'); + } else { + // Check if docId matches the parent folder name + const parentFolder = cleanPathParts[cleanPathParts.length - 1]; + if (docId === parentFolder) { + // /primitives/nft/nft -> /primitives/nft + urlPath = cleanPathParts.join('/'); + } else { + // Normal case: /path/to/file/ + urlPath = [...cleanPathParts, docId].join('/'); + } + } return '/' + urlPath; } @@ -238,9 +255,6 @@ async function indexDocuments() { const headings = extractHeadings(body); const cleanedContent = cleanContent(body); - // Skip empty or very short content - if (cleanedContent.length < 50) continue; - const urlPath = getUrlPath(filePath); const title = frontmatter.title || frontmatter.sidebar_label || @@ -252,7 +266,7 @@ async function indexDocuments() { const doc = { id: generateId(urlPath), title, - content: cleanedContent.substring(0, 10000), // Limit content size + content: cleanedContent, // Limit content size path: urlPath, section: frontmatter.sidebar_label || title, category: hierarchy.lvl0, @@ -264,30 +278,6 @@ async function indexDocuments() { }; documents.push(doc); - - // Also index individual headings as separate documents for better search granularity - for (const heading of headings.slice(0, 5)) { // Limit to first 5 headings - const anchor = heading - .toLowerCase() - .replace(/[^\w\s-]/g, '') - .replace(/\s+/g, '-'); - - const headingDoc = { - id: generateId(urlPath + '#' + anchor), - title: heading, - content: cleanedContent.substring(0, 500), - path: urlPath + '#' + anchor, - section: title, - category: hierarchy.lvl0, - version: 'current', - hierarchy_lvl0: hierarchy.lvl0, - hierarchy_lvl1: hierarchy.lvl1, - hierarchy_lvl2: heading, - timestamp: Date.now(), - }; - - documents.push(headingDoc); - } } catch (error) { console.warn(`Warning: Failed to process ${filePath}:`, error.message); } diff --git a/website/src/pages/search.tsx b/website/src/pages/search.tsx deleted file mode 100644 index 9bd7b7d4bf5..00000000000 --- a/website/src/pages/search.tsx +++ /dev/null @@ -1,6 +0,0 @@ -import React from 'react'; -import SearchPage from '../theme/SearchPage'; - -export default function Search(): JSX.Element { - return ; -} diff --git a/website/src/theme/SearchBar/index.tsx b/website/src/theme/SearchBar/index.tsx index 5881441e8ab..5d1fde107c4 100644 --- a/website/src/theme/SearchBar/index.tsx +++ b/website/src/theme/SearchBar/index.tsx @@ -31,12 +31,15 @@ interface SearchResult { const CATEGORIES = [ { id: 'all', label: 'All' }, - { id: 'Smart Contracts', label: 'Contracts' }, - { id: 'Web3 Apps', label: 'Apps' }, { id: 'Protocol', label: 'Protocol' }, - { id: 'Tutorials', label: 'Tutorials' }, - { id: 'AI', label: 'AI' }, + { id: 'Multi-Chain', label: 'Multi-Chain' }, + { id: 'AI & Agents', label: 'AI' }, + { id: 'Smart Contracts', label: 'Contracts' }, + { id: 'Web3 Apps', label: 'Web3 Apps' }, + { id: 'Primitives', label: 'Tokens & Primitives' }, + { id: 'Data Infrastructure', label: 'Data Infrastructure' }, { id: 'Tools', label: 'Tools' }, + { id: 'API', label: 'API' }, ]; export default function SearchBar(): JSX.Element { @@ -111,6 +114,10 @@ export default function SearchBar(): JSX.Element { highlightPreTag: '', highlightPostTag: '', filter, + hybrid: { + semanticRatio: 0.6, + embedder: 'default' + }, }); setResults(searchResult.hits); @@ -132,7 +139,7 @@ export default function SearchBar(): JSX.Element { useEffect(() => { const timer = setTimeout(() => { search(query, selectedCategory); - }, 150); + }, 300); return () => clearTimeout(timer); }, [query, selectedCategory, search]); @@ -270,17 +277,6 @@ export default function SearchBar(): JSX.Element { to navigate Esc to close
- { - e.preventDefault(); - setIsOpen(false); - history.push(`/search?q=${encodeURIComponent(query)}${selectedCategory !== 'all' ? `&category=${encodeURIComponent(selectedCategory)}` : ''}`); - }} - > - View all results -
)}
diff --git a/website/src/theme/SearchBar/styles.module.css b/website/src/theme/SearchBar/styles.module.css index 7330351ca64..424c954dd54 100644 --- a/website/src/theme/SearchBar/styles.module.css +++ b/website/src/theme/SearchBar/styles.module.css @@ -3,10 +3,10 @@ display: flex; align-items: center; gap: 0.5rem; - padding: 0.5rem 1rem; + padding: 0.4rem .75rem; background: var(--ifm-color-emphasis-100); border: 1px solid var(--ifm-color-emphasis-300); - border-radius: 8px; + border-radius: 5px; color: var(--ifm-color-emphasis-600); cursor: pointer; transition: all 0.2s ease; @@ -84,7 +84,7 @@ width: 100%; max-width: 640px; margin: 0 1rem; - background: var(--ifm-background-color); + background: var(--ifm-color-emphasis-100); border-radius: 12px; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); overflow: hidden; @@ -237,7 +237,7 @@ .resultBreadcrumb { font-size: 0.75rem; - color: var(--ifm-color-emphasis-500); + color: var(--ifm-color-emphasis-700); margin-bottom: 0.25rem; } @@ -257,12 +257,13 @@ .resultContent { font-size: 0.8125rem; - color: var(--ifm-color-emphasis-600); + color: var(--ifm-color-emphasis-700); line-height: 1.5; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; + line-clamp: 2; -webkit-box-orient: vertical; } diff --git a/website/src/theme/SearchPage/index.tsx b/website/src/theme/SearchPage/index.tsx deleted file mode 100644 index 54987c0c483..00000000000 --- a/website/src/theme/SearchPage/index.tsx +++ /dev/null @@ -1,364 +0,0 @@ -import React, { useState, useEffect, useCallback } from 'react'; -import Layout from '@theme/Layout'; -import Head from '@docusaurus/Head'; -import { useLocation, useHistory } from '@docusaurus/router'; -import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; -import { MeiliSearch } from 'meilisearch'; -import { trackSearch, trackSearchResultClick, trackSearchNoResults, trackSearchPageView, trackSearchFilter } from '../../utils/searchAnalytics'; -import styles from './styles.module.css'; - -interface SearchHit { - id: string; - title: string; - content: string; - path: string; - section: string; - category: string; - hierarchy_lvl0: string; - hierarchy_lvl1: string; - hierarchy_lvl2: string; - _formatted?: { - title?: string; - content?: string; - }; -} - -interface SearchResult { - hits: SearchHit[]; - query: string; - processingTimeMs: number; - estimatedTotalHits: number; -} - -const CATEGORIES = [ - { id: 'all', label: 'All Categories', count: 0 }, - { id: 'Smart Contracts', label: 'Smart Contracts', count: 0 }, - { id: 'Web3 Apps', label: 'Web3 Apps', count: 0 }, - { id: 'Protocol', label: 'Protocol', count: 0 }, - { id: 'Tutorials', label: 'Tutorials', count: 0 }, - { id: 'AI', label: 'AI', count: 0 }, - { id: 'Tools', label: 'Tools', count: 0 }, - { id: 'API', label: 'API', count: 0 }, - { id: 'Integrations', label: 'Integrations', count: 0 }, - { id: 'Data Infrastructure', label: 'Data Infrastructure', count: 0 }, - { id: 'Chain Abstraction', label: 'Chain Abstraction', count: 0 }, - { id: 'Primitives', label: 'Primitives', count: 0 }, -]; - -const ITEMS_PER_PAGE = 20; - -export default function SearchPage(): JSX.Element { - const { siteConfig } = useDocusaurusContext(); - const location = useLocation(); - const history = useHistory(); - - const [query, setQuery] = useState(''); - const [results, setResults] = useState([]); - const [loading, setLoading] = useState(false); - const [selectedCategory, setSelectedCategory] = useState('all'); - const [currentPage, setCurrentPage] = useState(1); - const [totalHits, setTotalHits] = useState(0); - const [processingTime, setProcessingTime] = useState(0); - const [client, setClient] = useState(null); - - useEffect(() => { - const config = siteConfig.customFields?.meilisearch as { - host?: string; - apiKey?: string; - indexName?: string; - } | undefined; - - if (config?.host) { - const meiliClient = new MeiliSearch({ - host: config.host, - apiKey: config.apiKey || '', - }); - setClient(meiliClient); - } - }, [siteConfig]); - - useEffect(() => { - const params = new URLSearchParams(location.search); - const q = params.get('q') || ''; - const category = params.get('category') || 'all'; - const page = parseInt(params.get('page') || '1', 10); - - setQuery(q); - setSelectedCategory(category); - setCurrentPage(page); - - if (q) { - trackSearchPageView(q, category); - } - }, [location.search]); - - const search = useCallback(async () => { - if (!client || !query.trim()) { - setResults([]); - setTotalHits(0); - return; - } - - const config = siteConfig.customFields?.meilisearch as { indexName?: string } | undefined; - const indexName = config?.indexName || 'near-docs'; - - setLoading(true); - try { - const index = client.index(indexName); - const filter = selectedCategory !== 'all' ? `category = "${selectedCategory}"` : undefined; - - const searchResult: SearchResult = await index.search(query, { - limit: ITEMS_PER_PAGE, - offset: (currentPage - 1) * ITEMS_PER_PAGE, - attributesToHighlight: ['title', 'content'], - highlightPreTag: '', - highlightPostTag: '', - filter, - }); - - setResults(searchResult.hits); - setTotalHits(searchResult.estimatedTotalHits); - setProcessingTime(searchResult.processingTimeMs); - - trackSearch(query, searchResult.hits.length, selectedCategory); - - if (searchResult.hits.length === 0) { - trackSearchNoResults(query); - } - } catch (error) { - console.error('Search error:', error); - setResults([]); - setTotalHits(0); - } finally { - setLoading(false); - } - }, [client, query, selectedCategory, currentPage, siteConfig]); - - useEffect(() => { - search(); - }, [search]); - - const updateUrl = useCallback((newQuery: string, newCategory: string, newPage: number) => { - const params = new URLSearchParams(); - if (newQuery) params.set('q', newQuery); - if (newCategory !== 'all') params.set('category', newCategory); - if (newPage > 1) params.set('page', newPage.toString()); - - history.push(`/search?${params.toString()}`); - }, [history]); - - const handleSearch = (e: React.FormEvent) => { - e.preventDefault(); - updateUrl(query, selectedCategory, 1); - }; - - const handleCategoryChange = (category: string) => { - trackSearchFilter('category', category); - setSelectedCategory(category); - updateUrl(query, category, 1); - }; - - const handlePageChange = (page: number) => { - setCurrentPage(page); - updateUrl(query, selectedCategory, page); - window.scrollTo({ top: 0, behavior: 'smooth' }); - }; - - const handleResultClick = (hit: SearchHit, index: number) => { - trackSearchResultClick(query, (currentPage - 1) * ITEMS_PER_PAGE + index, hit.path); - }; - - const renderHighlight = (text: string | undefined, fallback: string) => { - if (!text) return fallback; - return ; - }; - - const totalPages = Math.ceil(totalHits / ITEMS_PER_PAGE); - - return ( - // @ts-expect-error - Docusaurus types have React version mismatch - - {/* @ts-expect-error - Docusaurus types have React version mismatch */} - - Search | NEAR Documentation - - -
-
-

Categories

-
    - {CATEGORIES.map((cat) => ( -
  • - -
  • - ))} -
-
- -
-
-
- - - - - setQuery(e.target.value)} - /> - -
-
- - {query && ( -
- {loading ? ( - Searching... - ) : ( - - Found {totalHits} result{totalHits !== 1 ? 's' : ''} for "{query}" - {selectedCategory !== 'all' && ` in ${selectedCategory}`} - ({processingTime}ms) - - )} -
- )} - - {!loading && results.length === 0 && query && ( -
-

No results found

-

We couldn't find any results for "{query}"

-
-

Suggestions:

-
    -
  • Check your spelling
  • -
  • Try different keywords
  • -
  • Try more general terms
  • -
  • Clear category filters
  • -
-
-
-

Popular searches:

- -
-
- )} - - {loading && ( -
-
- Searching... -
- )} - - - - {totalPages > 1 && ( -
- - -
- {Array.from({ length: Math.min(5, totalPages) }, (_, i) => { - let pageNum: number; - if (totalPages <= 5) { - pageNum = i + 1; - } else if (currentPage <= 3) { - pageNum = i + 1; - } else if (currentPage >= totalPages - 2) { - pageNum = totalPages - 4 + i; - } else { - pageNum = currentPage - 2 + i; - } - - return ( - - ); - })} -
- - -
- )} -
-
- - ); -} diff --git a/website/src/theme/SearchPage/styles.module.css b/website/src/theme/SearchPage/styles.module.css deleted file mode 100644 index c132bd9e50a..00000000000 --- a/website/src/theme/SearchPage/styles.module.css +++ /dev/null @@ -1,378 +0,0 @@ -/* Container */ -.container { - display: flex; - max-width: 1200px; - margin: 0 auto; - padding: 2rem; - gap: 2rem; -} - -/* Sidebar */ -.sidebar { - width: 250px; - flex-shrink: 0; -} - -@media (max-width: 768px) { - .container { - flex-direction: column; - padding: 1rem; - } - - .sidebar { - width: 100%; - } -} - -.sidebarTitle { - font-size: 0.875rem; - font-weight: 600; - text-transform: uppercase; - letter-spacing: 0.05em; - color: var(--ifm-color-emphasis-600); - margin-bottom: 1rem; -} - -.categoryList { - list-style: none; - padding: 0; - margin: 0; -} - -.categoryButton { - display: block; - width: 100%; - padding: 0.5rem 0.75rem; - text-align: left; - background: transparent; - border: none; - border-radius: 6px; - color: var(--ifm-font-color-base); - cursor: pointer; - transition: all 0.15s ease; - font-size: 0.9375rem; -} - -.categoryButton:hover { - background: var(--ifm-color-emphasis-100); -} - -.categoryButtonActive { - background: var(--ifm-color-primary-lightest); - color: var(--ifm-color-primary-darkest); - font-weight: 500; -} - -.categoryButtonActive:hover { - background: var(--ifm-color-primary-lightest); -} - -/* Main Content */ -.main { - flex: 1; - min-width: 0; -} - -/* Search Form */ -.searchForm { - margin-bottom: 1.5rem; -} - -.searchInputWrapper { - display: flex; - align-items: center; - gap: 0.75rem; - padding: 0.75rem 1rem; - background: var(--ifm-color-emphasis-100); - border: 1px solid var(--ifm-color-emphasis-300); - border-radius: 10px; -} - -.searchInputWrapper:focus-within { - border-color: var(--ifm-color-primary); - box-shadow: 0 0 0 3px var(--ifm-color-primary-lightest); -} - -.searchIcon { - flex-shrink: 0; - color: var(--ifm-color-emphasis-500); -} - -.searchInput { - flex: 1; - border: none; - background: transparent; - font-size: 1rem; - color: var(--ifm-font-color-base); - outline: none; -} - -.searchInput::placeholder { - color: var(--ifm-color-emphasis-500); -} - -.searchButton { - padding: 0.5rem 1.25rem; - background: var(--ifm-color-primary); - color: white; - border: none; - border-radius: 6px; - font-weight: 500; - cursor: pointer; - transition: background 0.15s ease; -} - -.searchButton:hover { - background: var(--ifm-color-primary-dark); -} - -/* Results Header */ -.resultsHeader { - padding-bottom: 1rem; - border-bottom: 1px solid var(--ifm-color-emphasis-200); - margin-bottom: 1.5rem; - color: var(--ifm-color-emphasis-700); -} - -.processingTime { - color: var(--ifm-color-emphasis-500); - font-size: 0.875rem; -} - -/* Loading */ -.loading { - display: flex; - align-items: center; - justify-content: center; - gap: 0.75rem; - padding: 3rem; - color: var(--ifm-color-emphasis-600); -} - -.spinner { - width: 24px; - height: 24px; - border: 2px solid var(--ifm-color-emphasis-300); - border-top-color: var(--ifm-color-primary); - border-radius: 50%; - animation: spin 0.6s linear infinite; -} - -@keyframes spin { - to { - transform: rotate(360deg); - } -} - -/* No Results */ -.noResults { - text-align: center; - padding: 3rem 1rem; -} - -.noResults h2 { - color: var(--ifm-font-color-base); - margin-bottom: 0.5rem; -} - -.noResults p { - color: var(--ifm-color-emphasis-600); - margin-bottom: 2rem; -} - -.suggestions { - text-align: left; - max-width: 400px; - margin: 0 auto 2rem; -} - -.suggestions h3 { - font-size: 1rem; - margin-bottom: 0.75rem; -} - -.suggestions ul { - margin: 0; - padding-left: 1.5rem; - color: var(--ifm-color-emphasis-600); -} - -.suggestions li { - margin-bottom: 0.25rem; -} - -.popularSearches { - text-align: left; - max-width: 400px; - margin: 0 auto; -} - -.popularSearches h3 { - font-size: 1rem; - margin-bottom: 0.75rem; -} - -.popularTags { - display: flex; - flex-wrap: wrap; - gap: 0.5rem; -} - -.popularTags a { - padding: 0.375rem 0.75rem; - background: var(--ifm-color-emphasis-100); - border: 1px solid var(--ifm-color-emphasis-300); - border-radius: 9999px; - color: var(--ifm-color-emphasis-700); - font-size: 0.875rem; - text-decoration: none; - transition: all 0.15s ease; -} - -.popularTags a:hover { - background: var(--ifm-color-emphasis-200); - text-decoration: none; -} - -/* Results */ -.results { - display: flex; - flex-direction: column; - gap: 1rem; -} - -.resultItem { - display: block; - padding: 1.25rem; - background: var(--ifm-color-emphasis-50); - border: 1px solid var(--ifm-color-emphasis-200); - border-radius: 10px; - text-decoration: none; - transition: all 0.15s ease; -} - -.resultItem:hover { - background: var(--ifm-color-emphasis-100); - border-color: var(--ifm-color-emphasis-300); - text-decoration: none; -} - -.resultBreadcrumb { - font-size: 0.75rem; - color: var(--ifm-color-emphasis-500); - margin-bottom: 0.5rem; -} - -.resultTitle { - font-size: 1.125rem; - font-weight: 600; - color: var(--ifm-font-color-base); - margin: 0 0 0.5rem 0; -} - -.resultTitle mark { - background: var(--ifm-color-primary-lightest); - color: var(--ifm-color-primary-darkest); - padding: 0.125rem 0.25rem; - border-radius: 2px; -} - -.resultContent { - font-size: 0.9375rem; - color: var(--ifm-color-emphasis-700); - line-height: 1.6; - margin: 0 0 0.75rem 0; -} - -.resultContent mark { - background: var(--ifm-color-warning-lightest); - color: var(--ifm-color-warning-darkest); - padding: 0 0.125rem; - border-radius: 2px; -} - -.resultPath { - font-size: 0.8125rem; - color: var(--ifm-color-primary); -} - -/* Pagination */ -.pagination { - display: flex; - align-items: center; - justify-content: center; - gap: 0.5rem; - margin-top: 2rem; - padding-top: 2rem; - border-top: 1px solid var(--ifm-color-emphasis-200); -} - -.paginationButton { - padding: 0.5rem 1rem; - background: var(--ifm-color-emphasis-100); - border: 1px solid var(--ifm-color-emphasis-300); - border-radius: 6px; - color: var(--ifm-font-color-base); - cursor: pointer; - transition: all 0.15s ease; -} - -.paginationButton:hover:not(:disabled) { - background: var(--ifm-color-emphasis-200); -} - -.paginationButton:disabled { - opacity: 0.5; - cursor: not-allowed; -} - -.paginationPages { - display: flex; - gap: 0.25rem; -} - -.pageButton { - width: 36px; - height: 36px; - display: flex; - align-items: center; - justify-content: center; - background: transparent; - border: 1px solid transparent; - border-radius: 6px; - color: var(--ifm-font-color-base); - cursor: pointer; - transition: all 0.15s ease; -} - -.pageButton:hover { - background: var(--ifm-color-emphasis-100); -} - -.pageButtonActive { - background: var(--ifm-color-primary); - color: white; -} - -.pageButtonActive:hover { - background: var(--ifm-color-primary-dark); -} - -/* Dark mode adjustments */ -[data-theme='dark'] .resultItem { - background: var(--ifm-color-emphasis-100); -} - -[data-theme='dark'] .resultItem:hover { - background: var(--ifm-color-emphasis-200); -} - -[data-theme='dark'] .resultTitle mark { - background: rgba(0, 204, 163, 0.2); - color: var(--ifm-color-primary-light); -} - -[data-theme='dark'] .resultContent mark { - background: rgba(255, 186, 0, 0.2); - color: var(--ifm-color-warning-light); -} From 28ec809037cf6c76645c97875ffa9918f765c486 Mon Sep 17 00:00:00 2001 From: Guillermo Alejandro Gallardo Diez Date: Thu, 5 Feb 2026 17:19:08 +0100 Subject: [PATCH 7/8] fix: small css --- website/src/theme/SearchBar/styles.module.css | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/website/src/theme/SearchBar/styles.module.css b/website/src/theme/SearchBar/styles.module.css index 424c954dd54..5424ba1bf87 100644 --- a/website/src/theme/SearchBar/styles.module.css +++ b/website/src/theme/SearchBar/styles.module.css @@ -163,22 +163,27 @@ /* Category Filters */ .categoryFilters { display: flex; - flex-wrap: wrap; gap: 0.5rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--ifm-color-emphasis-200); background: var(--ifm-color-emphasis-50); + overflow-x: auto; + overflow-y: hidden; + -webkit-overflow-scrolling: touch; + scroll-behavior: smooth; + scrollbar-width: thin; } .categoryChip { padding: 0.375rem 0.75rem; - font-size: 0.8125rem; + font-size: 12px; background: var(--ifm-color-emphasis-100); border: 1px solid var(--ifm-color-emphasis-300); border-radius: 9999px; color: var(--ifm-color-emphasis-700); cursor: pointer; transition: all 0.15s ease; + white-space: nowrap; } .categoryChip:hover { From a62b15139e8d6a90a6d14ef76245d436933f92c8 Mon Sep 17 00:00:00 2001 From: Guillermo Alejandro Gallardo Diez Date: Thu, 5 Feb 2026 17:27:37 +0100 Subject: [PATCH 8/8] fix: github action --- .github/workflows/index-meilisearch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/index-meilisearch.yml b/.github/workflows/index-meilisearch.yml index 70361625edb..a617d6044cd 100644 --- a/.github/workflows/index-meilisearch.yml +++ b/.github/workflows/index-meilisearch.yml @@ -28,7 +28,7 @@ jobs: run: cd website && yarn - name: Index to MeiliSearch - run: cd website && yarn run index:meilisearch + run: cd website && yarn run meilisearch:build-index env: MEILI_HOST: ${{ secrets.MEILI_HOST }} MEILI_MASTER_KEY: ${{ secrets.MEILI_MASTER_KEY }}