-
Notifications
You must be signed in to change notification settings - Fork 19
Add unlisted GraphQL migration guide and TypeScript web client docs #547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1696bb4
docs: add GraphQL migration guide (unlisted) and TypeScript web clien…
g-despot a956f03
docs(web-client): fold server floor into Connect section, drop TypeSc…
g-despot 0a1ecf1
docs: update @weaviate/web install to 3.15.0-alpha.6; version-scope t…
g-despot 4700929
docs(web-client): rewrite the custom-headers note in plain language
g-despot 8ab7c89
Revise migration documentation for API changes
g-despot 3f2a1cd
docs(migration): drop the test-log style what-works paragraph
g-despot 2df313f
docs: correct browser custom-headers claim after live e2e; punctuatio…
g-despot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| --- | ||
| title: Web client | ||
| sidebar_position: 3 | ||
| description: "The @weaviate/web package: a browser build of the Weaviate v3 TypeScript client that connects over gRPC-Web." | ||
| image: og/docs/client-libraries.jpg | ||
| --- | ||
|
|
||
| {/* MAINTENANCE: `3.15.0-alpha.6` is hardcoded in 3 places: the Alpha admonition and the | ||
| install command below, plus the availability table in weaviate/api/graphql/migration.mdx. | ||
| The `latest` tag lags behind, so the admonition also names the version it points at. | ||
| Update all 3 together when the package moves. */} | ||
|
|
||
| `@weaviate/web` is a browser build of the v3 client. Use it in browsers and edge runtimes such as Cloudflare Workers and Vercel, where a plain gRPC connection is not possible. | ||
|
|
||
| It has the same API as `weaviate-client`, but sends queries over gRPC-Web. Connect options take one HTTP(S) endpoint. There is no gRPC host or port to set, because Weaviate serves gRPC-Web on the REST port. | ||
|
|
||
| :::caution Alpha | ||
|
|
||
| `@weaviate/web` `3.15.0-alpha.6` is an alpha. The `latest` tag still points at `3.15.0-alpha.2`, an older alpha that fails to load, so always install the version explicitly. | ||
|
|
||
| ::: | ||
|
|
||
| ## Install | ||
|
|
||
| Install the alpha explicitly: | ||
|
|
||
| ```bash | ||
| npm install @weaviate/web@3.15.0-alpha.6 | ||
|
g-despot marked this conversation as resolved.
|
||
| ``` | ||
|
|
||
| The `latest` tag still points at an older alpha that fails to load, so name the version. | ||
|
|
||
| The package is ESM-only. | ||
|
|
||
| ## Connect to Weaviate | ||
|
|
||
| Use a `connectTo*` helper. The low-level `weaviate.client(params)` entry point does not add the `/v1/grpc-web` prefix. `grpcHost`, `grpcPort` and `grpcSecure` are not connect options. If you pass them, they are ignored. | ||
|
|
||
| :::info Added in `v1.38.3` | ||
| Weaviate serves gRPC-Web by default from `v1.38.3`. | ||
| ::: | ||
|
|
||
| So the web client needs Weaviate `v1.38.3` or later. On `v1.38.2` it fails to connect, and the error names the missing path: | ||
|
|
||
| ```text | ||
| /grpc.health.v1.Health/Check UNIMPLEMENTED: Received HTTP 404 response: | ||
| {"code":404,"message":"path /v1/grpc-web/grpc.health.v1.Health/Check was not found"} | ||
| ``` | ||
|
|
||
| For the server side, see [gRPC-Web](../../api/grpc.md#grpc-web). | ||
|
|
||
|
|
||
| ## Browser notes | ||
|
|
||
| **Provider API keys work in the browser. Other custom headers do not.** Model provider keys passed through `headers`, such as `X-OpenAI-Api-Key`, are on Weaviate's default CORS allow-list, so they work cross-origin out of the box. Any other header fails the browser's CORS preflight unless the operator lists it in [`CORS_ALLOW_HEADERS`](/deploy/configuration/env-vars/index.md#CORS_ALLOW_HEADERS) on the server. Setting that variable replaces the default list, so include the defaults you still need. Node runs no preflight, so test header behavior in a real browser. | ||
|
|
||
| :::warning Browser credentials are visible to the user | ||
| Anyone who loads your page can read whatever the bundle holds, including Weaviate and model provider API keys. Use a read-only API key with the least [RBAC](/deploy/configuration/authorization.md) permissions the app needs. Never ship an admin key to a browser. | ||
| ::: | ||
|
|
||
| ## Questions and feedback | ||
|
|
||
| import DocsFeedback from "/_includes/docs-feedback.mdx"; | ||
|
|
||
| <DocsFeedback /> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import React from "react"; | ||
| import { UnlistedMetadata } from "@docusaurus/theme-common"; | ||
|
|
||
| /** | ||
| * Swizzled from @docusaurus/theme-classic. | ||
| * | ||
| * The upstream component renders two things for an `unlisted: true` page: | ||
| * <UnlistedMetadata /> (the `noindex, nofollow` robots meta) and a caution | ||
| * banner reading "This page is unlisted." | ||
| * | ||
| * We keep the metadata and drop the banner. Unlisted pages in this repo are | ||
| * finished, hand-distributed pages rather than drafts, so the banner would tell | ||
| * a reader who was given the link that the page is provisional. The metadata is | ||
| * load-bearing and must stay: besides the robots meta itself, the sitemap | ||
| * plugin decides what to exclude by reading the emitted `noindex` meta | ||
| * (@docusaurus/plugin-sitemap `isNoIndexMetaRoute`), so removing it would put | ||
| * unlisted pages back into sitemap.xml. | ||
| */ | ||
| export default function Unlisted() { | ||
| return <UnlistedMetadata />; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.