diff --git a/changelog.md b/changelog.md index abe21c2..88c5ca9 100644 --- a/changelog.md +++ b/changelog.md @@ -54,7 +54,7 @@ Types published in [`@types/apollo-upload-client`](https://npm.im/@types/apollo-upload-client) should no longer be used. - Projects must configure [TypeScript](https://typescriptlang.org) to use types from the ECMAScript modules that have a `// @ts-check` comment: + Projects must configure TypeScript to use types from the ECMAScript modules that have a `// @ts-check` comment: - [`compilerOptions.allowJs`](https://www.typescriptlang.org/tsconfig#allowJs) should be `true`. - [`compilerOptions.maxNodeModuleJsDepth`](https://www.typescriptlang.org/tsconfig#maxNodeModuleJsDepth) should be reasonably large, e.g. `10`. @@ -74,7 +74,7 @@ - Reorganized the test file structure. - In tests, for objects with the property `headers` that as of [`@apollo/client`](https://npm.im/@apollo/client) [v3.7.0](https://github.com/apollographql/apollo-client/releases/tag/v3.7.0) is a null-prototype object, use the assertion `deepEqual` instead of `deepStrictEqual`. - Tweaked code for type safety. -- Updated documentation. +- Updated documentation, including link URLs. - Removed the readme badges. ## 17.0.0 diff --git a/createUploadLink.mjs b/createUploadLink.mjs index f7376ed..32d06e3 100644 --- a/createUploadLink.mjs +++ b/createUploadLink.mjs @@ -18,19 +18,19 @@ import isExtractableFile from "./isExtractableFile.mjs"; /** * Creates a - * [terminating Apollo Link](https://apollographql.com/docs/react/api/link/introduction/#the-terminating-link) - * for [Apollo Client](https://apollographql.com/docs/react) that fetches a + * [terminating Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/#the-terminating-link) + * for [Apollo Client](https://www.apollographql.com/docs/react) that fetches a * [GraphQL multipart request](https://github.com/jaydenseric/graphql-multipart-request-spec) * if the GraphQL variables contain files (by default * [`FileList`](https://developer.mozilla.org/en-US/docs/Web/API/FileList), * [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File), or * [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) instances), * or else fetches a regular - * [GraphQL POST or GET request](https://apollographql.com/docs/apollo-server/requests) + * [GraphQL POST or GET request](https://www.apollographql.com/docs/apollo-server/workflow/requests) * (depending on the config and GraphQL operation). * * Some of the options are similar to the - * [`createHttpLink` options](https://apollographql.com/docs/react/api/link/apollo-link-http/#httplink-constructor-options). + * [`createHttpLink` options](https://www.apollographql.com/docs/react/api/link/apollo-link-http/#httplink-constructor-options). * @see [GraphQL multipart request spec](https://github.com/jaydenseric/graphql-multipart-request-spec). * @param {object} options Options. * @param {string} [options.uri] GraphQL endpoint URI. Defaults to `"/graphql"`. @@ -58,7 +58,7 @@ import isExtractableFile from "./isExtractableFile.mjs"; * {@linkcode fetchOptions}. * @param {boolean} [options.includeExtensions] Toggles sending `extensions` * fields to the GraphQL server. Defaults to `false`. - * @returns A [terminating Apollo Link](https://apollographql.com/docs/react/api/link/introduction/#the-terminating-link). + * @returns A [terminating Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/#the-terminating-link). * @example * A basic Apollo Client setup: * @@ -105,7 +105,7 @@ export default function createUploadLink({ const { // Apollo Studio client awareness `name` and `version` can be configured // via `ApolloClient` constructor options: - // https://apollographql.com/docs/studio/client-awareness/#using-apollo-server-and-apollo-client + // https://www.apollographql.com/docs/graphos/metrics/client-awareness/#setup clientAwareness: { name, version } = {}, headers, } = context; diff --git a/readme.md b/readme.md index 81ec05a..322585b 100644 --- a/readme.md +++ b/readme.md @@ -2,7 +2,7 @@ # apollo-upload-client -A [terminating Apollo Link](https://apollographql.com/docs/react/api/link/introduction/#the-terminating-link) for [Apollo Client](https://apollographql.com/docs/react) that fetches a [GraphQL multipart request](https://github.com/jaydenseric/graphql-multipart-request-spec) if the GraphQL variables contain files (by default [`FileList`](https://developer.mozilla.org/en-US/docs/Web/API/FileList), [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File), or [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) instances), or else fetches a regular [GraphQL POST or GET request](https://apollographql.com/docs/apollo-server/requests) (depending on the config and GraphQL operation). +A [terminating Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/#the-terminating-link) for [Apollo Client](https://www.apollographql.com/docs/react) that fetches a [GraphQL multipart request](https://github.com/jaydenseric/graphql-multipart-request-spec) if the GraphQL variables contain files (by default [`FileList`](https://developer.mozilla.org/en-US/docs/Web/API/FileList), [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File), or [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) instances), or else fetches a regular [GraphQL POST or GET request](https://www.apollographql.com/docs/apollo-server/workflow/requests) (depending on the config and GraphQL operation). - [Installation](#installation) - [Examples](#examples) @@ -11,7 +11,7 @@ A [terminating Apollo Link](https://apollographql.com/docs/react/api/link/introd ## Installation -To install with [npm](https://npmjs.com/get-npm), run: +To install with [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm), run: ```sh npm install apollo-upload-client @@ -19,11 +19,11 @@ npm install apollo-upload-client Polyfill any required globals (see [_**Requirements**_](#requirements)) that are missing in your server and client environments. -Remove any `uri`, `credentials`, or `headers` options from the [`ApolloClient` constructor](https://apollographql.com/docs/react/api/core/ApolloClient/#the-apolloclient-constructor). +Remove any `uri`, `credentials`, or `headers` options from the [`ApolloClient` constructor](https://www.apollographql.com/docs/react/api/core/ApolloClient/#the-apolloclient-constructor). -[Apollo Client](https://apollographql.com/docs/react) can only have 1 [terminating Apollo Link](https://apollographql.com/docs/react/api/link/introduction/#the-terminating-link) that sends the GraphQL requests; if one such as [`HttpLink`](https://apollographql.com/docs/react/api/link/apollo-link-http) is already setup, remove it. +[Apollo Client](https://www.apollographql.com/docs/react) can only have 1 [terminating Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/#the-terminating-link) that sends the GraphQL requests; if one such as [`HttpLink`](https://www.apollographql.com/docs/react/api/link/apollo-link-http) is already setup, remove it. -Initialize the client with a [terminating Apollo Link](https://apollographql.com/docs/react/api/link/introduction/#the-terminating-link) using the function [`createUploadLink`](./createUploadLink.mjs). +Initialize the client with a [terminating Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/#the-terminating-link) using the function [`createUploadLink`](./createUploadLink.mjs). Also ensure the GraphQL server implements the [GraphQL multipart request spec](https://github.com/jaydenseric/graphql-multipart-request-spec) and that uploads are handled correctly in resolvers. @@ -128,7 +128,7 @@ Consider polyfilling: - [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) - [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) -Projects must configure [TypeScript](https://typescriptlang.org) to use types from the ECMAScript modules that have a `// @ts-check` comment: +Projects must configure [TypeScript](https://www.typescriptlang.org) to use types from the ECMAScript modules that have a `// @ts-check` comment: - [`compilerOptions.allowJs`](https://www.typescriptlang.org/tsconfig#allowJs) should be `true`. - [`compilerOptions.maxNodeModuleJsDepth`](https://www.typescriptlang.org/tsconfig#maxNodeModuleJsDepth) should be reasonably large, e.g. `10`.